]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
Merge with maintanace of the Base version of the D5-38-2003
authorapo <apo@opencascade.com>
Tue, 29 Nov 2005 09:04:54 +0000 (09:04 +0000)
committerapo <apo@opencascade.com>
Tue, 29 Nov 2005 09:04:54 +0000 (09:04 +0000)
72 files changed:
doc/salome/VISU_index.html
doc/salome/gui/Makefile.in
idl/VISU_Gen.idl
resources/Vertex_Program_ARB.txt
src/CONVERTOR/VISUConvertor.cxx
src/CONVERTOR/VISU_Convertor.cxx
src/CONVERTOR/VISU_Convertor.hxx
src/CONVERTOR/VISU_ConvertorDef.hxx
src/CONVERTOR/VISU_ConvertorUtils.cxx
src/CONVERTOR/VISU_ConvertorUtils.hxx
src/CONVERTOR/VISU_Convertor_impl.cxx
src/CONVERTOR/VISU_Convertor_impl.hxx
src/CONVERTOR/VISU_IDMapper.hxx
src/CONVERTOR/VISU_MedConvertor.cxx
src/CONVERTOR/VISU_MedConvertor.hxx
src/ENGINE/VISU_Engine_i.cc
src/ENGINE/VISU_Engine_i.hh
src/OBJECT/VISU_Actor.cxx
src/OBJECT/VISU_Actor.h
src/OBJECT/VISU_ActorFactory.h
src/OBJECT/VISU_Event.h
src/OBJECT/VISU_GaussPtsAct.cxx
src/OBJECT/VISU_GaussPtsAct.h
src/OBJECT/VISU_GaussPtsActorFactory.h
src/OBJECT/VISU_GaussPtsDeviceActor.cxx
src/OBJECT/VISU_GaussPtsDeviceActor.h
src/OBJECT/VISU_GaussPtsSettings.cxx
src/OBJECT/VISU_GaussPtsSettings.h
src/PIPELINE/Makefile.in
src/PIPELINE/VISU_Extractor.cxx
src/PIPELINE/VISU_GaussPointsPL.hxx
src/PIPELINE/VISU_OpenGLPointSpriteMapper.cxx
src/PIPELINE/VISU_OpenGLPointSpriteMapper.hxx
src/PIPELINE/VISU_PipeLine.cxx
src/PIPELINE/VISU_PipeLine.hxx
src/VISUGUI/Makefile.in
src/VISUGUI/VISUM_msg_en.po
src/VISUGUI/VisuGUI.cxx
src/VISUGUI/VisuGUI_GaussPointsDlg.cxx
src/VISUGUI/VisuGUI_GaussPointsDlg.h
src/VISUGUI/VisuGUI_Module.cxx
src/VISUGUI/VisuGUI_Module.h
src/VISUGUI/VisuGUI_OffsetDlg.cxx
src/VISUGUI/VisuGUI_Prs3dTools.h
src/VISUGUI/VisuGUI_Selection.cxx
src/VISUGUI/VisuGUI_Selection.h
src/VISUGUI/VisuGUI_Timer.cxx
src/VISUGUI/VisuGUI_Tools.cxx
src/VISUGUI/VisuGUI_ViewTools.cxx
src/VISU_I/Makefile.in
src/VISU_I/VISU_GaussPoints_i.cc
src/VISU_I/VISU_GaussPoints_i.hh
src/VISU_I/VISU_Gen_i.cc
src/VISU_I/VISU_Gen_i.hh
src/VISU_I/VISU_Prs3d_i.cc
src/VISU_I/VISU_Prs3d_i.hh
src/VISU_I/VISU_Result_i.cc
src/VISU_I/VISU_Result_i.hh
src/VISU_I/VISU_TimeAnimation.cxx
src/VVTK/VVTK_InteractorStyle.cxx
src/VVTK/VVTK_InteractorStyle.h
src/VVTK/VVTK_MainWindow.cxx
src/VVTK/VVTK_MainWindow.h
src/VVTK/VVTK_PickingDlg.cxx
src/VVTK/VVTK_PickingDlg.h
src/VVTK/VVTK_Renderer.cxx
src/VVTK/VVTK_Renderer.h
src/VVTK/VVTK_SegmentationCursorDlg.cxx
src/VVTK/VVTK_SegmentationCursorDlg.h
src/VVTK/VVTK_ViewManager.h
src/VVTK/VVTK_ViewModel.h
src/VVTK/VVTK_ViewWindow.h

index 841180805d440fb5267a3961841da5b1be1128d0..a69a84033eef0a92162e974d824d169a78697f2f 100644 (file)
    <br>
    </center>
      
-<address> </address>
-   
 <center><big><a href="gui/VISU/visu.html">GUI Documentation</a></big></center>
       
-<address> </address>
-   
-<center></center>
+<br>
+
+<center><big><a href="gui/GAUSS/gauss_points_viewer.htm">Gauss Viewer User Guide</a></big></center>
       
-<center><br>
-   </center>
-     
-<address> </address>
+<br>
    
 <center><big><a href="tui/VISU/index.html">TUI Documentation</a></big></center>
-      
-<address> </address>
-   
-<center></center>
-      
+         
 <center><br>
    <br>
     </center>
index e03160f157d2f37ede3d4a85ed68f87adfe27f70..805d892e822bf039ba874f2a82ad822a3a51637d 100644 (file)
@@ -16,6 +16,7 @@ VPATH=.:@srcdir@
 
 docs:
        cp -fr $(srcdir)/VISU ./
+       cp -fr $(srcdir)/GAUSS ./
        -find $(PWD) -name CVS -exec rm -rf {} \;
 
 clean:
@@ -23,11 +24,14 @@ clean:
 
 distclean: clean
        rm -fr VISU
+       rm -fr GAUSS
 
 install:
        mkdir -p $(docdir)/gui
        cp -rf VISU $(docdir)/gui
+       cp -rf GAUSS $(docdir)/gui
        -find $(PWD) -name CVS -exec rm -rf {} \;
 
 uninstall:
        rm -rf $(docdir)/gui/VISU
+       rm -rf $(docdir)/gui/GAUSS
index 2b04645b5cc2ac0ed80d5513911172789e3fad00..72b6829f6a25201644aa9bbfa4c49252cab93aa8 100644 (file)
@@ -1250,10 +1250,33 @@ module VISU {
    * for further construction of graphical presentations.
    */
   interface Result : RemovableObject, SALOME::GenericObj {
-    //interface Result : Base{
     /*! Reads all data from the corresponding sources. By default the data is loaded on demand.
      */
     boolean BuildAll();
+
+    /*! Start to parse the source MED file and publish all its entities into the study*/
+    boolean Build(in boolean theIsBuildAll, in boolean theIsAtOnce);
+
+    /*! Allow to check is all requested MED entites already loaded or not */
+    boolean IsDone();
+
+    /*! Allow to check is corresponding MED entites already loaded or not */
+    boolean IsEntitiesDone();
+
+    /*! Choose to parse MED fields and perform global min / max on the MED timestamps.*/
+    void SetBuildFields(in boolean theIsBuildFields, in boolean theIsCalculateMinMax);
+
+    /*! Allow to check is corresponding MED fields already loaded or not */
+    boolean IsFieldsDone();
+
+    /*! Choose to parse MED groups.*/
+    void SetBuildGroups(in boolean theIsBuildGroups);
+
+    /*! Allow to check is corresponding MED groups and families already loaded or not */
+    boolean IsGroupsDone();
+
+    /*! Allow to check is min / max calculation over field's components already perfrormed or not */
+    boolean IsMinMaxDone();
   };
 
   //-------------------------------------------------------
@@ -1298,6 +1321,13 @@ module VISU {
      */
     Result ImportFile(in string theFileName);
 
+    /*!
+     * Create result and initialize its with the 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 CreateResult(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
index 965b523da39930289e49652849e0516cc37f25e8..e13d0258a4cf0b89f98f6e5812e28996064046a6 100755 (executable)
@@ -1,21 +1,12 @@
-attribute int   mode;
-attribute float clamp;
-attribute float geomSize;
-attribute float minSize;
-attribute float maxSize;
-attribute float magnification;
+attribute float clamp_size;
 
 void main()
 {
   gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
 
-  gl_FrontColor = gl_Color;
+  gl_FrontColor.x = gl_Color.x;
+  gl_FrontColor.y = gl_Color.y;
+  gl_FrontColor.z = gl_Color.z;
 
-  float size;
-  if( mode == 0 )
-    size = minSize + ( maxSize - minSize ) * ( 1 - gl_Color.w / 241.0f  );
-  else
-    size = geomSize;
-
-  gl_PointSize = min( magnification * size * gl_ProjectionMatrix[0].x, clamp );
+  gl_PointSize = min( gl_Color.w * gl_ProjectionMatrix[0].x, clamp_size );
 }
index f34d49355b2578111baeff49fd02a4508da9889a..273b62a8554cff3e323e2aa28dda5a1e9e13591d 100644 (file)
@@ -59,7 +59,11 @@ void parseFile(const char* theFileName)
     auto_ptr<VISU_Convertor> aCon(CreateConvertor(theFileName));
     //aCon->GetSize();
     //return;
+    aCon->BuildEntities();
+    aCon->BuildFields();
+    aCon->BuildMinMax();
     const VISU::TMeshMap& aMeshMap = aCon->GetMeshMap();
+    //return;
     VISU::TMeshMap::const_iterator aMeshMapIter = aMeshMap.begin();
     for(; aMeshMapIter != aMeshMap.end(); aMeshMapIter++){
       //continue;
@@ -108,7 +112,7 @@ void parseFile(const char* theFileName)
              }
              */
            }
-           goto OK;
+           //goto OK;
          }
        }
       }
index 0a599cd16b24c98a9da882e7846ae4f2c3cc0ec0..f417ad07a5c079b770a87d1c2c9196039d062163 100644 (file)
@@ -56,7 +56,6 @@ const VISU::TMeshMap&
 VISU_Convertor
 ::GetMeshMap() 
 { 
-  if(!myIsDone) { myIsDone = true;  Build();}
   return myMeshMap;
 }
 
index d9145a7c94702e55f35a01483f494f2bc7a44792..ea3debee762b1a6d93276ecd682ca53cf409187d 100644 (file)
 #ifndef VISU_Convertor_HeaderFile
 #define VISU_Convertor_HeaderFile
 
+/*! 
+  \file VISU_Convertor.hxx
+  \brief The file contains definitions for basic classes of the VISU CONVERTER package
+*/
+
 #include "VISU_IDMapper.hxx"
 #include "VISU_ConvertorDef.hxx"
 
@@ -48,6 +53,7 @@ namespace VISU
   typedef TVector<TName> TNames;
 
   //---------------------------------------------------------------
+  //! Define a basic class for all MED entites which can be identified by its number
   struct TIntId: virtual TBaseStructure
   {
     vtkIdType myId;
@@ -61,12 +67,17 @@ namespace VISU
   typedef std::map<TEntity,PMeshOnEntity> TMeshOnEntityMap;
   typedef std::map<TName,PGroup> TGroupMap;
 
+  //! Define a basic class which corresponds to MED MESH entity
+  /*!
+    This class in its turn contains map of TMeshOnEntity and TGroup substructures,
+    also it keeps name and dimention of corresponding MED MESH entity.
+  */
   struct TMesh: virtual TBaseStructure
   {
-    TMeshOnEntityMap myMeshOnEntityMap;
-    TGroupMap myGroupMap;
-    TName myName;
-    int myDim;
+    TMeshOnEntityMap myMeshOnEntityMap; //!< Contains corresponding meshes for MED ENTITIES
+    TGroupMap myGroupMap; //!< Contains map of bounded MED GROUPS
+    TName myName; //! Name of the corresponding MED MESH
+    int myDim; //! Dimension of the corresponding MED MESH
 
     TMesh(): myDim(0)
     {}
@@ -75,11 +86,13 @@ namespace VISU
 
 
   //---------------------------------------------------------------
+  //! Define a basic class which corresponds to MED PROFILE entity
   struct TSubProfile: virtual TBaseStructure
   {};
 
 
   //---------------------------------------------------------------
+  //! Define a containerfor MED PROFILE entities which belongs to the same MED ENTITY
   struct TProfile: virtual TIDMapper
   {};
 
@@ -93,18 +106,21 @@ namespace VISU
 
 
   //---------------------------------------------------------------
+  //! Define a basic class for MED GAUSS entity
   struct TGauss: virtual TBaseStructure
   {};
 
 
   //---------------------------------------------------------------
+  //! Define a container for mesh generated from MED GAUSS and corresponding MED PROFILE
   struct TGaussSubMesh: virtual TBaseStructure
   {
-    PSubProfile mySubProfile;
+    PSubProfile mySubProfile; //!< Keeps reference on what submesh the Gauss Points are located
   };
 
   
   //---------------------------------------------------------------
+  //! Define a container for all TGaussSubMesh that belongs to the same MED ENTITY
   struct TGaussMesh: virtual TGaussPtsIDMapper
   {};
 
@@ -122,31 +138,38 @@ namespace VISU
   typedef std::map<TName,PFamily> TFamilyMap;
   typedef std::map<TName,PField> TFieldMap;
 
+  //! Define a basic class which corresponds to MED ENTITY
+  /*!
+    This class in its turn contains map of TGaussMesh and TProfile substructures,
+    also it keeps corresponding map of MED FAMILIES and FIELDS.
+  */
   struct TMeshOnEntity: virtual TNamedIDMapper
   {
-    TGaussMeshMap myGaussMeshMap;
-    TProfileMap myProfileMap;
+    TGaussMeshMap myGaussMeshMap; //!< Contains map of Gauss mesh which exist on it
+    TProfileMap myProfileMap; //!< Contains map of Profile mesh which exist on it
 
-    TFamilyMap myFamilyMap;
-    TFieldMap myFieldMap;
+    TFamilyMap myFamilyMap; //!< Contains map of MED FAMILIES which belongs to it
+    TFieldMap myFieldMap; //!< Contains map of MED FIELDS which belongs to it
 
-    TName myMeshName;
-    TEntity myEntity;
+    TName myMeshName; //!< Contains name of the MED MESH where the it belongs to.
+    TEntity myEntity; //!< Referes to MED ENTITY where the it belongs to.
   };
 
 
   //---------------------------------------------------------------
+  //! Define a basic class for MED FAMILY entity
   struct TFamily: virtual TIntId,
                  virtual TIDMapper
   {
-    TEntity myEntity;
-    TName myName;
+    TEntity myEntity; //!< Referes to MED ENTITY where the TFamily belongs to.
+    TName myName; //!< Contains name of the corresponding MED FAMILY
   };
 
 
   //---------------------------------------------------------------
   typedef std::set<PFamily> TFamilySet;
 
+  //! Define a basic class for MED GROUP entity
   struct TGroup: virtual TIDMapper
   {
     TFamilySet myFamilySet;
@@ -157,16 +180,22 @@ namespace VISU
   typedef std::map<vtkIdType,PValForTime> TValField;
   typedef std::pair<float,float> TMinMax;
 
+  //! Define a basic class for MED FIELD entity
   struct TField: virtual TIntId
   {
-    TEntity myEntity;
-    TName myName;
-    TName myMeshName;
-    TValField myValField;
-    TNames myCompNames;
-    TNames myUnitNames;
-    vtkIdType myNbComp;
-
+    TEntity myEntity; //!< Referes to MED ENTITY where it belongs to.
+    TName myName; //!< Contains name of the corresponding MED FIELD
+    TName myMeshName; //!< Contains name of the MED MESH where it belongs to.
+    TValField myValField; //!< Contains sequence of values for corresponding MED TIMESTAMPS
+    TNames myCompNames; //!< Contains names of components of the MED FIELD
+    TNames myUnitNames; //!< Contains names of units of the MED FIELD
+    vtkIdType myNbComp; //!< Keeps number of components for the MED FIELD
+
+    //! Calculate min/max values for each of the MED FIELD components among all its timestamps
+    /*!
+      Numeration of the components starts from 1.
+      Zero component contains min/max value for modulus of corresponding vector
+    */
     virtual
     TMinMax 
     GetMinMax(vtkIdType theCompID) = 0;
@@ -179,19 +208,21 @@ namespace VISU
   //---------------------------------------------------------------
   typedef std::pair<double,std::string> TTime;
 
+  //! Define a basic class for MED TIMESTAMP entity
   struct TValForTime: virtual TIntId
   {
-    TEntity myEntity;
-    TName myMeshName;
-    TName myFieldName;
+    TEntity myEntity; //!< Referes to MED ENTITY where it belongs to.
+    TName myMeshName; //!< Contains name of the MED MESH where it belongs to.
+    TName myFieldName; //!< Contains name of the MED FIELD where it belongs to.
     TTime myTime;
 
-    PProfile myProfile;
+    PProfile myProfile; //!< Contains corresponding MED PROFILE where the MED TIEMSTMAP attached to
     PGaussMesh myGaussMesh;
   };
 
 
   //---------------------------------------------------------------
+  //! The utility function allows to write vtkUnstructuredGrid to a file with defined name
   void 
   WriteToFile(vtkUnstructuredGrid* theDataSet, 
              const std::string& theFileName);
@@ -199,6 +230,20 @@ namespace VISU
 
 
 //---------------------------------------------------------------
+//! This class defines interface to read VTK interpretation of MED entities
+/*!
+  It is the main class of the VISU CONVERTER package.
+  Following MED entities can be retrived from any MED file:
+  - mesh from corresponding MED ENTITIES;
+  - MED TIMESTAMPS;
+  - MED FAMILIES;
+  - MED GROUPS.
+  The class produce its work in two main steps:
+  1. Perfrom parsing of MED file to get known what MED entities are pressent in it
+  2. Get VTK representation for any existing MED entity
+  Also, it can perform some additional work to calculate expected amount of memory to build defined VTK representation
+  
+*/
 class VISU_Convertor
 {
 protected:
@@ -211,58 +256,93 @@ public:
   ~VISU_Convertor()
   {};
   
+  //! Get brief name of the corresponding source MED file
   virtual
   const std::string& 
   GetName(){ return myName;}
 
+  //! Let known whether the source MED file parsed or not
   virtual
   int
   IsDone() const { return myIsDone; }
 
+  //! Defines what subtype of vtkDataSet is used for MED to VTK mapping
   typedef VISU::TVTKOutput TOutput;
 
+  //! This method perform first parsing of MED file to get known what MED entities are pressent in it
   virtual
   VISU_Convertor* 
   Build() = 0;
 
+  //! This method perform first parsing of MED file to get known what MED mesh entities are pressent in it
+  virtual
+  VISU_Convertor* 
+  BuildEntities() = 0;
+
+  //! This method perform first parsing of MED file to get known what MED fields are pressent in it
+  virtual
+  VISU_Convertor* 
+  BuildFields() = 0;
+
+  //! This min /max calculation over existing MED fields
+  virtual
+  VISU_Convertor* 
+  BuildMinMax() = 0;
+
+  //! This method perform first parsing of MED file to get known what MED groups are pressent in it
+  virtual
+  VISU_Convertor* 
+  BuildGroups() = 0;
+
+  //! This method allow to get known what MED entities are present is the MED file
   virtual
   const VISU::TMeshMap& 
   GetMeshMap();
 
+  //! Get amount of memory to build VTK representations for all existing MED entities
   virtual
   float
   GetSize() = 0;
 
+  //! Get mesh for corresponding MED ENTITY
   virtual
   VISU::PNamedIDMapper 
   GetMeshOnEntity(const std::string& theMeshName, 
                  const VISU::TEntity& theEntity) = 0;
   
+  //! Get amount of memory to build mesh for corresponding MED ENTITY
   virtual
   float
   GetMeshOnEntitySize(const std::string& theMeshName, 
                      const VISU::TEntity& theEntity) = 0;
   
+  //! Get mesh for corresponding MED FAMILY
   virtual 
   VISU::PIDMapper 
   GetFamilyOnEntity(const std::string& theMeshName, 
                    const VISU::TEntity& theEntity,
                    const std::string& theFamilyName) = 0;
+
+  //! Get amount of memory to build mesh for corresponding MED FAMILY
   virtual 
   float 
   GetFamilyOnEntitySize(const std::string& theMeshName, 
                        const VISU::TEntity& theEntity,
                        const std::string& theFamilyName) = 0;
+
+  //! Get mesh for corresponding MED GROUP
   virtual
   VISU::PIDMapper
   GetMeshOnGroup(const std::string& theMeshName, 
                 const std::string& theGroupName) = 0;
   
+  //! Get amount of memory to build mesh for corresponding MED GROUP
   virtual
   float
   GetMeshOnGroupSize(const std::string& theMeshName, 
                     const std::string& theGroupName) = 0;
   
+  //! Get mesh with attached values for corresponding MED TIMESTAMP
   virtual
   VISU::PIDMapper 
   GetTimeStampOnMesh(const std::string& theMeshName, 
@@ -270,6 +350,7 @@ public:
                     const std::string& theFieldName,
                     int theStampsNum) = 0;
 
+  //! Get Gauss Points mesh with attached values for corresponding MED TIMESTAMP
   virtual
   VISU::PGaussPtsIDMapper 
   GetTimeStampOnGaussPts(const std::string& theMeshName, 
@@ -277,6 +358,7 @@ public:
                         const std::string& theFieldName,
                         int theStampsNum) = 0;
    
+  //! Get amount of memory to build mesh for corresponding MED TIMESTAMP
   virtual 
   float
   GetTimeStampSize(const std::string& theMeshName, 
@@ -284,18 +366,21 @@ public:
                   const std::string& theFieldName,
                   int theStampsNum) = 0;
     
+  //! Get amount of memory to build all MED TIMESTAMPS for corresponding MED FIELD
   virtual 
   float
   GetFieldOnMeshSize(const std::string& theMeshName, 
                     const VISU::TEntity& theEntity,
                     const std::string& theFieldName) = 0;
   
+  //! Find MED FIELD container
   virtual
   const VISU::PField 
   GetField(const std::string& theMeshName, 
           VISU::TEntity theEntity, 
           const std::string& theFieldName) = 0;
   
+  //! Find MED TIMESTAMP container
   virtual
   const VISU::PValForTime 
   GetTimeStamp(const std::string& theMeshName, 
@@ -303,6 +388,7 @@ public:
               const std::string& theFieldName,
               int theStampsNum) = 0;
     
+  //! Allow to generate pretty name for MED TIMESTAMP
   static 
   std::string 
   GenerateName(const VISU::TTime& aTime);
@@ -314,6 +400,7 @@ public:
 
 extern "C"
 {
+  //! Instatiate proper VISU_Convertor subclass
   VISU_Convertor* 
   CreateConvertor(const std::string& theFileName);
 };
index 4744e653836c77096a9cb8b38f4e59779fa3d3f9..0fedadc5b24869b6859b6fd6fff1cf296b607a0a 100644 (file)
 #ifndef VISU_ConvertorDef_HeaderFile
 #define VISU_ConvertorDef_HeaderFile
 
+/*! 
+  \file VISU_ConvertorDef.hxx
+  \brief The file contains predeclarations for basic classes of the VISU CONVERTER package
+*/
+
 #include "MED_SharedPtr.hxx"
 
 namespace VISU
index fcfb6f9539fd6073d6c80c8670240a4b90af7c91..a4d0f3bbc85d7b8b85e39fc76a5301e8b0afc147 100644 (file)
 //  Module : VISU
 
 #include "VISU_ConvertorUtils.hxx"
+
 #include <vtkUnstructuredGridWriter.h>
+#include <vtkTimerLog.h>
+
+#ifdef _DEBUG_
+static int MYDEBUG = 0;
+#else
+static int MYDEBUG = 0;
+#endif
 
-namespace VISU{
+namespace VISU
+{
 
   void 
   WriteToFile(vtkUnstructuredGrid* theDataSet, const std::string& theFileName)
@@ -40,4 +49,32 @@ namespace VISU{
     aWriter->Delete();
   }
 
+
+  TTimerLog
+  ::TTimerLog(int theIsDebug,
+             const std::string& theName):
+    myIsDebug(MYDEBUG + theIsDebug),
+    myTimerLog(vtkTimerLog::New()),
+    myPrefixPrinter(myIsDebug == 1),
+    myName(theName)
+  {
+    myCPUTime = myTimerLog->GetCPUTime();
+    BEGMSG(myIsDebug > 1,"{\n");
+  }
+
+  TTimerLog
+  ::~TTimerLog()
+  {
+    myCPUTime = myTimerLog->GetCPUTime() - myCPUTime;
+
+    if(myIsDebug > 1){
+      BEGMSG(myIsDebug,"} = "<<myCPUTime<<" secs ("<<myName<<")\n");
+    }else{
+      BEGMSG(myIsDebug,myName<<" takes "<<myCPUTime<<" secs\n");
+    }
+    
+    myTimerLog->Delete();
+    myTimerLog = NULL;
+  }
+
 }
index 1ef42e369fbc1cee2e3853422c01a081b4536af6..154589fc7d89ee0002ba2dfcf32858da1501de80 100644 (file)
 #include "MED_Utilities.hxx"
 
 class vtkUnstructuredGrid;
+class vtkTimerLog;
+
+namespace MED
+{
+  class PrefixPrinter;
+}
 
 namespace VISU{
 
   void 
   WriteToFile(vtkUnstructuredGrid* theDataSet, const std::string& theFileName);
+
+  class TTimerLog
+  {
+    int myIsDebug;
+    double myCPUTime;
+    std::string myName;
+    vtkTimerLog* myTimerLog;
+    MED::PrefixPrinter myPrefixPrinter;
+  public:
+    TTimerLog(int theIsDebug,
+             const std::string& theName);
+    ~TTimerLog();
+  };
   
 }
 
index ad2a643c6e61fc80c6be989faaf62ed39477cca7..fd4dbd114675f03a3dab8bf88ffd32f86f951b83 100644 (file)
@@ -59,7 +59,7 @@ static int MYVTKDEBUG = 0;
 #ifdef _DEBUG_
 static int MYDEBUG = 0;
 static int MYDEBUGWITHFILES = 0;
-//#define _DEXCEPT_
+#define _DEXCEPT_
 #else
 static int MYDEBUG = 0;
 static int MYDEBUGWITHFILES = 0;
@@ -1765,6 +1765,50 @@ VISU_Convertor_impl
 {}
 
 
+//---------------------------------------------------------------
+VISU_Convertor* 
+VISU_Convertor_impl
+::Build() 
+{ 
+  if(!myIsDone){ 
+    myIsDone = true;  
+    BuildEntities();
+    BuildFields();
+    BuildMinMax();
+    BuildGroups();
+  }
+  return this;
+}
+
+VISU_Convertor* 
+VISU_Convertor_impl
+::BuildEntities() 
+{ 
+  return this;
+}
+
+VISU_Convertor* 
+VISU_Convertor_impl
+::BuildFields() 
+{ 
+  return this;
+}
+
+VISU_Convertor* 
+VISU_Convertor_impl
+::BuildMinMax() 
+{ 
+  return this;
+}
+
+VISU_Convertor* 
+VISU_Convertor_impl
+::BuildGroups() 
+{ 
+  return this;
+}
+
+
 //---------------------------------------------------------------
 VISU::PNamedIDMapper 
 VISU_Convertor_impl
index 08771a4c3489b2579bbc17079e1bc981a47c2082..5e910090f274b7f5955bdba5a98bb34f5e528c1a 100644 (file)
@@ -49,15 +49,18 @@ class VISU_MergeFilter;
 
 namespace VISU
 {
+  //! Defines VISU enumeration of geometrical types
   enum EGeometry {ePOINT1=1, eSEG2=102, eSEG3=103, eTRIA3=203,
                  eQUAD4=204, eTRIA6=206,eQUAD8=208, eTETRA4=304,
                  ePYRA5=305, ePENTA6=306, eHEXA8=308, eTETRA10=310, 
                  ePYRA13=313, ePENTA15=315, eHEXA20=320, 
                  ePOLYGONE=400, ePOLYEDRE=500, eNONE=-1};
 
+  //! Get number of nodes for defined geometrical type
   vtkIdType
   VISUGeom2NbNodes(EGeometry theGeom);
 
+  //! Maps VISU geometrical type to VTK one
   vtkIdType
   VISUGeom2VTK(EGeometry theGeom);
 
@@ -76,24 +79,27 @@ namespace VISU
   typedef float TCoord;
 
   //---------------------------------------------------------------
+  //! Define an utility base class which is repsonsible for preventing repetion
   struct TIsVTKDone: virtual TBaseStructure
   {
     TIsVTKDone();
-    bool myIsDone;
-    bool myIsVTKDone;
+    bool myIsDone; //!< Say, is the corresponding MED entity already loaded into intermediate data structure 
+    bool myIsVTKDone; //!< Say, is the corresponding intermediate data structure already mapped into VTK representation  
   };
 
   
   //---------------------------------------------------------------
+  //! Define an utility base class which allow to keep calculated number of cells and their size
   struct TSizeCounter: virtual TIsVTKDone
   {
     TSizeCounter();
-    vtkIdType myNbCells;
-    vtkIdType myCellsSize;
+    vtkIdType myNbCells; //!< Number of cells contained into corresponding sublclass
+    vtkIdType myCellsSize; //!< Size of cells contained into corresponding sublclass
   };
 
 
   //---------------------------------------------------------------
+  //! Define a container for VTK representation
   class TSource: public virtual TSizeCounter
   {
   protected:
@@ -101,9 +107,11 @@ namespace VISU
   public:
     TSource();
 
+    //! This method allow to create corresponding VTK data set by demand (not at once)
     const TVTKSource& 
     GetSource() const;
 
+    //! Reimplement the TIDMapper::GetVTKOutput
     virtual
     TVTKOutput* 
     GetVTKOutput();
@@ -111,6 +119,10 @@ namespace VISU
 
 
   //---------------------------------------------------------------
+  //! Define a container for VTK representation
+  /*!
+    This container allow to combine other VTK representation into single one.
+  */
   class TAppendFilter: public virtual TIsVTKDone,
                       public virtual TIDMapper
   {
@@ -119,9 +131,11 @@ namespace VISU
   public:
     TAppendFilter();
 
+    //! This method allow to create corresponding VTK filter by demand (not at once)
     const TVTKAppendFilter& 
     GetFilter() const;
 
+    //! Reimplement the TIDMapper::GetVTKOutput
     virtual
     TVTKOutput* 
     GetVTKOutput();
@@ -129,6 +143,10 @@ namespace VISU
 
 
   //---------------------------------------------------------------
+  //! Define a container for VTK representation
+  /*!
+    This container allow to assign data to mesh and represent them into single VTK representation
+  */
   class TMergeFilter: public virtual TIsVTKDone,
                      public virtual TIDMapper
   {
@@ -137,9 +155,11 @@ namespace VISU
   public:
     TMergeFilter();
 
+    //! This method allow to create corresponding VTK filter by demand (not at once)
     const TVTKMergeFilter& 
     GetFilter() const;
 
+    //! Reimplement the TIDMapper::GetVTKOutput
     virtual
     TVTKOutput* 
     GetVTKOutput();
@@ -151,25 +171,34 @@ namespace VISU
   typedef TSlice<TCoordArray> TCoordSlice;
   typedef TCSlice<TCoordArray> TCCoordSlice;
 
+  //! This class is responsible for representation of mesh nodes
   class TPointCoords: public virtual TBaseStructure
   {
   protected:
-    vtkIdType myDim;
-    vtkIdType myNbPoints;
+    vtkIdType myDim; //!< Dimension of the nodal coordinates
+    vtkIdType myNbPoints; //!< Number of nodes in corresponding mesh
 
-    TCoordArray myCoord;
-    TVTKPoints myPoints;
+    //! An container for coordinates of the nodes
+    /*!
+      Usage of slices allow to minimize amount of memory to store the nodal coordinates and
+      provide unifirm way of conversation with this coordinates (independant from mesh dimension)
+    */
+    TCoordArray myCoord; 
+    TVTKPoints myPoints; //!< VTK representation for the mesh nodes
 
   public:
     TPointCoords();
 
+    //! To initilize the class
     void
     Init(vtkIdType theNbPoints,
         vtkIdType theDim);
 
+    //! Get slice of coordinates for defined node (const version)
     TCCoordSlice
     GetCoordSlice(vtkIdType theNodeId) const;
 
+    //! Get slice of coordinates for defined node
     TCoordSlice 
     GetCoordSlice(vtkIdType theNodeId);
 
@@ -192,35 +221,46 @@ namespace VISU
   typedef TVector<vtkIdType> TVectorID;
   typedef std::map<vtkIdType,vtkIdType> TObj2VTKID;
 
+  //! This class is responsible for representation of mesh nodes
+  /*!
+    In additition to its base functionlity it support mapping of VTK to object numeration and
+    keeps names for each of nodes.
+  */
   class TNamedPointCoords: public virtual TPointCoords
   {
   protected:
     typedef TVector<std::string> TPointsDim;
-    TPointsDim myPointsDim;
-    TVectorID myVectorID;
-    TObj2VTKID myObj2VTKID;
+    TPointsDim myPointsDim; //!< Keeps name of each dimension
+    TVectorID myVectorID; //!< Keeps object¶ numeration
+    TObj2VTKID myObj2VTKID; //!< Keeps mapping from object number to VTK one
 
   public:
 
+    //! To initilize the class (numeration of the nodes can be missed)
     void
     Init(vtkIdType theNbPoints,
         vtkIdType theDim,
         const TVectorID& theVectorID = TVectorID());
     
+    //! Get name for defined dimension
     std::string&
     GetName(vtkIdType theDim);
     
+    //! Get name for defined dimension (const version)
     const std::string&
     GetName(vtkIdType theDim) const;
 
+    //! Get object number for node by its VTK one
     virtual
     vtkIdType
     GetObjID(vtkIdType theID) const;
 
+    //! Get VTK number for node by its object one
     virtual
     vtkIdType
     GetVTKID(vtkIdType theID) const;
 
+    //! Get name of node by its object number
     virtual
     std::string 
     GetNodeName(vtkIdType theObjID) const;
@@ -229,13 +269,14 @@ namespace VISU
 
 
   //---------------------------------------------------------------
+  //! Specialize TMesh to provide VTK mapping for nodes
   struct TMeshImpl: virtual TMesh, 
                    virtual TIsVTKDone
   {
-    PNamedPointCoords myNamedPointCoords;
+    PNamedPointCoords myNamedPointCoords; //!< Keeps intermediate representation of the nodes
 
-    TVTKPoints myPoints;
-    vtkIdType myNbPoints;
+    TVTKPoints myPoints; //!< Keeps VTK representation of the nodes
+    vtkIdType myNbPoints; //!< Keeps number of the nodes
 
     TMeshImpl();
   };
@@ -246,20 +287,27 @@ namespace VISU
   typedef TVector<vtkIdType> TSubMeshID;
   typedef enum {eRemoveAll, eAddAll, eAddPart, eNone} ESubMeshStatus; 
 
+  //! Specialize TSubProfile to provide VTK mapping
   struct TSubProfileImpl: virtual TSubProfile, 
                          virtual TSource
   {
     TSubProfileImpl();
 
-    EGeometry myGeom;
-    std::string myName;
+    EGeometry myGeom; //!< Defines to what geometrical type the MED PROFILE belong to
+    std::string myName; //!< Keeps its name
 
+    //! Get object number of mesh cell by its VTK one
     virtual 
     vtkIdType 
     GetElemObjID(int theVtkI) const;
 
-    ESubMeshStatus myStatus;
-    TSubMeshID mySubMeshID;
+    //! Keeps status of the structure
+    /*!
+      In some cases MED file does not use MED PROFILES, but at VISU creates corresponding data strucutre
+      in order to construct mesh for MED TIEMSTAMPS in uniform way.
+    */
+    ESubMeshStatus myStatus; 
+    TSubMeshID mySubMeshID; //!< Keeps numbers of mesh cell which contain the MED PROFILE
   };
   typedef SharedPtr<TSubProfileImpl> PSubProfileImpl;
 
@@ -271,81 +319,97 @@ namespace VISU
   typedef TVector<PSubProfileImpl> TSubProfileArr;
   typedef std::map<EGeometry,PSubProfileImpl> TGeom2SubProfile;
 
+  //! Specialize TProfile to provide VTK mapping for MED TIMESTAMP mesh
   struct TProfileImpl: virtual TProfile, 
                       virtual TAppendFilter
   {
     TProfileImpl();
-    bool myIsAll;
+    bool myIsAll; //!< Say, whether the MED TIMESTAMP defined on all MED ENTITY or not
    
+    //! Reimplement the TIDMapper::GetNodeObjID
     virtual 
     vtkIdType 
     GetNodeObjID(vtkIdType theID) const;
 
+    //! Reimplement the TIDMapper::GetNodeVTKID
     virtual 
     vtkIdType 
     GetNodeVTKID(vtkIdType theID) const;
 
+    //! Reimplement the TIDMapper::GetNodeCoord
     virtual 
     float*  
     GetNodeCoord(vtkIdType theObjID);
 
+    //! Reimplement the TIDMapper::GetElemObjID
     virtual 
     vtkIdType 
     GetElemObjID(vtkIdType theID) const;
 
+    //! Reimplement the TIDMapper::GetElemVTKID
     virtual 
     vtkIdType 
     GetElemVTKID(vtkIdType theID) const;
 
+    //! Reimplement the TIDMapper::GetElemCell
     virtual
     vtkCell* 
     GetElemCell(vtkIdType theObjID);
     
+    //! Reimplement the TIDMapper::GetVTKOutput
     virtual
     TVTKOutput* 
     GetVTKOutput();
 
-    TID2ID myElemObj2VTKID;
-    TSubProfileArr mySubProfileArr;
-    PNamedPointCoords myNamedPointCoords;
-    TMeshOnEntityImpl* myMeshOnEntity;
+    TID2ID myElemObj2VTKID; //!< Keeps object to VTK numeration mapping
+    TSubProfileArr mySubProfileArr; //!< Keeps sequence of TSubProfiles as they were added into TAppendFilter
+    PNamedPointCoords myNamedPointCoords; //!< Keeps reference on the same TNamedPointCoords as TMesh
+    TMeshOnEntityImpl* myMeshOnEntity; //<! Keeps backward reference to corresponding MED ENTITY mesh
 
-    TSource mySource;
-    TGeom2SubProfile myGeom2SubProfile;
+    TSource mySource; //!< Keeps VTK representation of the MED TIMESTAMP mesh
+    TGeom2SubProfile myGeom2SubProfile; //!< Keeps TSubProfiles according to their geometrical type
   };
   typedef SharedPtr<TProfileImpl> PProfileImpl;
 
 
   //---------------------------------------------------------------
+  //! Specialize TIDMapper to provide VTK mapping for MED TIMESTAMP mesh
   struct TIDMapperFilter: virtual TMergeFilter
   {
-    TAppendFilter myIDMapper;
-    TSource mySource;
+    TAppendFilter myIDMapper; //!< Responsible for numbering
+    TSource mySource; //!< Keeps assigned data
 
+    //! Reimplement the TIDMapper::GetNodeObjID
     virtual 
     vtkIdType 
     GetNodeObjID(vtkIdType theID) const;
 
+    //! Reimplement the TIDMapper::GetNodeVTKID
     virtual 
     vtkIdType 
     GetNodeVTKID(vtkIdType theID) const;
 
+    //! Reimplement the TIDMapper::GetNodeCoord
     virtual 
     float*  
     GetNodeCoord(vtkIdType theObjID);
 
+    //! Reimplement the TIDMapper::GetElemObjID
     virtual 
     vtkIdType 
     GetElemObjID(vtkIdType theID) const;
 
+    //! Reimplement the TIDMapper::GetElemVTKID
     virtual 
     vtkIdType 
     GetElemVTKID(vtkIdType theID) const;
 
+    //! Reimplement the TIDMapper::GetElemCell
     virtual
     vtkCell* 
     GetElemCell(vtkIdType theObjID);
     
+    //! Reimplement the TIDMapper::GetVTKOutput
     virtual
     TVTKOutput* 
     GetVTKOutput();
@@ -354,28 +418,38 @@ namespace VISU
 
 
   //---------------------------------------------------------------
+  //! Specialize TGauss to provide more detail information of the MED GAUSS entity for VTK mapping
   struct TGaussImpl: virtual TGauss
   {
-    EGeometry myGeom;
-    std::string myName;
-    vtkIdType myNbPoints;
+    EGeometry myGeom; //!< Define, to which geometrical type the MED GAUSS entity belongs
+    std::string myName; //!< Keeps name of the MED GAUSS entity
+    vtkIdType myNbPoints; //<! Keeps number of points for the MED GAUSS entity
   };
   typedef SharedPtr<TGaussImpl> PGaussImpl;
 
 
   //---------------------------------------------------------------
+  //! Specialize TGaussSubMesh to provide VTK mapping for the entity
   struct TGaussSubMeshImpl: virtual TGaussSubMesh, 
                            virtual TSource
   {
     TGaussSubMeshImpl();
 
+    //! To implement the TGaussPtsIDMapper::GetObjID
     virtual
     TGaussPointID
     GetObjID(vtkIdType theID) const;
     
-    PGaussImpl myGauss;
+    PGaussImpl myGauss; //<! Keep reference to corresponding TGauss structure
+
+    //! Keeps status of the structure
+    /*!
+      In some cases MED file does not use MED GAUSS, but at VISU creates corresponding data strucutre
+      in order to construct mesh for MED TIEMSTAMPS in uniform way.
+    */
     ESubMeshStatus myStatus;
-    TPointCoords myPointCoords;
+
+    TPointCoords myPointCoords; //!< Keeps coordinates of Gauss Points
   };
   typedef SharedPtr<TGaussSubMeshImpl> PGaussSubMeshImpl;
 
@@ -384,40 +458,48 @@ namespace VISU
   typedef TVector<PGaussSubMeshImpl> TGaussSubMeshArr;
   typedef std::map<EGeometry,PGaussSubMeshImpl> TGeom2GaussSubMesh;
 
+  //! Specialize TGaussMesh to provide VTK mapping for the entity
   struct TGaussMeshImpl: virtual TGaussMesh, 
                         virtual TAppendFilter
   {
     TGaussMeshImpl();
 
+    //! Reimplement the TGaussPtsIDMapper::GetObjID
     virtual
     TGaussPointID
     GetObjID(vtkIdType theID) const;
 
+    //! Reimplement the TIDMapper::GetVTKOutput
     virtual
     TVTKOutput* 
     GetVTKOutput();
 
+    //! Reimplement the TGaussPtsIDMapper::GetParent
     virtual 
     TNamedIDMapper*
     GetParent();
 
-    TSource mySource;
-    TNamedIDMapper* myParent;
-    TGaussSubMeshArr myGaussSubMeshArr;
-    TGeom2GaussSubMesh myGeom2GaussSubMesh;
+    TSource mySource; //!< Keeps VTK representation of the Gauss Points
+    TNamedIDMapper* myParent; //!< Refer to parent mesh
+    TGaussSubMeshArr myGaussSubMeshArr; //!< Keeps sequence of TGaussSubMesh as they were added into TAppendFilter
+    TGeom2GaussSubMesh myGeom2GaussSubMesh; //!< Keeps TGaussSubMesh according to their geometrical type
   };
   typedef SharedPtr<TGaussMeshImpl> PGaussMeshImpl;
 
 
+  //---------------------------------------------------------------
+  //! Specialize TGaussPtsIDMapper to provide VTK mapping for MED TIMESTAMP mesh
   struct TGaussPtsIDFilter: virtual TIDMapperFilter,
                            virtual TGaussPtsIDMapper
   { 
     PGaussPtsIDMapper myGaussPtsIDMapper;
 
+    //! Reimplement the TGaussPtsIDMapper::GetObjID
     virtual 
     TGaussPointID 
     GetObjID(vtkIdType theID) const;
 
+    //! Reimplement the TGaussPtsIDMapper::GetParent
     virtual 
     TNamedIDMapper*
     GetParent();
@@ -429,18 +511,22 @@ namespace VISU
   typedef TVector<vtkIdType> TConnect;
   typedef TVector<TConnect> TCell2Connect;
 
+  //! The class is responsible for mapping of cells of defined geometrical type  
   struct TSubMeshImpl: virtual TSource
   {
+    
+    //! To implement the TIDMapper::GetElemObjID
     virtual 
     vtkIdType 
     GetElemObjID(vtkIdType theID) const;
 
+    //! To implement the TNamedIDMapper::GetElemName
     virtual
     std::string 
     GetElemName(vtkIdType theObjID) const;
 
     vtkIdType myStartID;
-    TCell2Connect myCell2Connect;
+    TCell2Connect myCell2Connect; //!< Contains connectivity for the cells
   };
   typedef SharedPtr<TSubMeshImpl> PSubMeshImpl;
 
@@ -449,39 +535,46 @@ namespace VISU
   typedef std::map<EGeometry,PSubMeshImpl> TGeom2SubMesh;
   typedef TVector<PSubMeshImpl> TSubMeshArr;
 
+  //! Specialize TMeshOnEntity to provide VTK mapping for the entity
   struct TMeshOnEntityImpl: virtual TMeshOnEntity, 
                            virtual TAppendFilter, 
                            virtual TSizeCounter
   {
+    //! Reimplement the TIDMapper::GetNodeVTKID
     virtual 
     vtkIdType 
     GetNodeVTKID(vtkIdType theID) const;
 
+    //! Reimplement the TIDMapper::GetNodeObjID
     virtual 
     vtkIdType 
     GetNodeObjID(vtkIdType theID) const;
 
+    //! Reimplement the TIDMapper::GetElemVTKID
     virtual 
     vtkIdType 
     GetElemVTKID(vtkIdType theID) const;
 
+    //! Reimplement the TIDMapper::GetElemObjID
     virtual 
     vtkIdType 
     GetElemObjID(vtkIdType theID) const;
 
+    //! Reimplement the TNamedIDMapper::GetNodeName
     virtual
     std::string 
     GetNodeName(vtkIdType theObjID) const;
 
+    //! Reimplement the TNamedIDMapper::GetElemName
     virtual
     std::string 
     GetElemName(vtkIdType theObjID) const;
 
-    TID2ID myElemObj2VTKID;
-    TSubMeshArr mySubMeshArr;
-    PNamedPointCoords myNamedPointCoords;
+    TID2ID myElemObj2VTKID; //!< To support object to VTK number mapping 
+    TSubMeshArr mySubMeshArr; //!< Keeps sequence of TSubMeshImpl as they were added into TAppendFilter
+    PNamedPointCoords myNamedPointCoords; //!< Share the same instance with TMesh to implement nodal mapping
 
-    TGeom2SubMesh myGeom2SubMesh;
+    TGeom2SubMesh myGeom2SubMesh; //!< Keeps TSubMeshImpl according to their geometrical type
   };
   typedef SharedPtr<TMeshOnEntityImpl> PMeshOnEntityImpl;
 
@@ -489,33 +582,39 @@ namespace VISU
   //---------------------------------------------------------------
   typedef std::map<EGeometry,TSubMeshID> TGeom2SubMeshID;
 
+  //! Specialize TFamily to provide VTK mapping for the entity
   struct TFamilyImpl: virtual TFamily, 
                      virtual TSource
   {
+    //! Reimplement the TIDMapper::GetNodeObjID
     vtkIdType 
     GetNodeObjID(vtkIdType theID) const ;
 
+    //! Reimplement the TIDMapper::GetNodeVTKID
     virtual 
     vtkIdType 
     GetNodeVTKID(vtkIdType theID) const ;
 
+    //! Reimplement the TIDMapper::GetElemVTKID
     virtual 
     vtkIdType 
     GetElemVTKID(vtkIdType theID) const;
 
+    //! Reimplement the TIDMapper::GetElemObjID
     virtual 
     vtkIdType 
     GetElemObjID(vtkIdType theID) const;
 
+    //! Reimplement the TIDMapper::GetVTKOutput
     virtual
     TVTKOutput* 
     GetVTKOutput();
 
-    PNamedPointCoords myNamedPointCoords;
-    TID2ID myElemObj2VTKID;
-    TSubMeshID myMeshID;
+    PNamedPointCoords myNamedPointCoords;  //!< Share the same instance with TMesh to implement nodal mapping
+    TID2ID myElemObj2VTKID; //!< To support object to VTK number mapping
+    TSubMeshID myMeshID; //!< Keeps numbers of mesh elements that belongs to the MED FAMILY
 
-    TGeom2SubMeshID myGeom2SubMeshID;
+    TGeom2SubMeshID myGeom2SubMeshID; //!< Keeps TSubMeshID according to their geometrical type
   };
   typedef SharedPtr<TFamilyImpl> PFamilyImpl;
 
@@ -524,31 +623,37 @@ namespace VISU
   typedef std::pair<vtkIdType,vtkIdType> TNbASizeCells;
   typedef TVector<PFamilyImpl> TFamilyArr;
 
+  //! Specialize TGroup to provide VTK mapping for the entity
   struct TGroupImpl: virtual TGroup, 
                     virtual TAppendFilter
   {
+    //! Calculate pair of values - number of cells and its size
     TNbASizeCells 
     GetNbASizeCells() const;
 
+    //! Reimplement the TIDMapper::GetElemVTKID
     virtual 
     vtkIdType 
     GetElemVTKID(vtkIdType theID) const;
 
+    //! Reimplement the TIDMapper::GetElemObjID
     virtual 
     vtkIdType 
     GetElemObjID(vtkIdType theID) const;
 
+    //! Reimplement the TIDMapper::GetNodeObjID
     virtual 
     vtkIdType 
     GetNodeObjID(vtkIdType theID) const;
 
+    //! Reimplement the TIDMapper::GetNodeVTKID
     virtual 
     vtkIdType 
     GetNodeVTKID(vtkIdType theID) const;
 
-    TID2ID myElemObj2VTKID;
-    TFamilyArr myFamilyArr;
-    PNamedPointCoords myNamedPointCoords;
+    TID2ID myElemObj2VTKID; //!< To support object to VTK number mapping
+    TFamilyArr myFamilyArr; //!< Keeps sequence of TFamily as they were added into TAppendFilter
+    PNamedPointCoords myNamedPointCoords; //!< Share the same instance with TMesh to implement nodal mapping
   };
   typedef SharedPtr<TGroupImpl> PGroupImpl;
 
@@ -556,16 +661,19 @@ namespace VISU
   //---------------------------------------------------------------
   typedef TVector<TMinMax> TMinMaxArr;
 
+  //! Specialize TField to provide VTK mapping for the entity
   struct TFieldImpl: virtual TField
   {
-    vtkIdType myDataSize;
+    vtkIdType myDataSize; //!< Keeps size of the assigned data
 
-    TMinMaxArr myMinMaxArr;
+    TMinMaxArr myMinMaxArr; //!< Keeps min/max values for each component of the MED FIELD
 
+    //! Implement the TField::GetMinMax
     virtual
     TMinMax 
     GetMinMax(vtkIdType theCompID);
 
+    //! To initialize the data structure    
     void 
     InitArrays(vtkIdType theNbComp);
 
@@ -582,29 +690,35 @@ namespace VISU
   typedef TVector<TCValueSlice> TCValueSliceArr;
   typedef TVector<TValueSlice> TValueSliceArr;
 
+  //! Define a container to get access to data assigned to mesh
   struct TMeshValue
   {
-    TValue myValue;
+    TValue myValue; //!< Keeps all values as one dimensional sequence
 
-    vtkIdType myNbElem;
-    vtkIdType myNbComp;
-    vtkIdType myNbGauss;
-    vtkIdType myStep;
+    vtkIdType myNbElem; //!< Defines number of mesh elements where the data assigned to
+    vtkIdType myNbComp; //!< Keeps number of components of corresponding MED FIELD
+    vtkIdType myNbGauss; //!< Defines number of Gauss Points
+    vtkIdType myStep; //! Internal variable
 
+    //! To intitilize the data strucutre
     void
     Init(vtkIdType theNbElem,
         vtkIdType theNbGauss,
         vtkIdType theNbComp);
 
+    //! To get assigned values first by Gauss Points and then by components (constant version)
     TCValueSliceArr
     GetGaussValueSliceArr(vtkIdType theElemId) const;
 
+    //! To get assigned values first by Gauss Points and then by components
     TValueSliceArr 
     GetGaussValueSliceArr(vtkIdType theElemId);
 
+    //! To get assigned values first by components and then by Gauss Points (constant version)
     TCValueSliceArr
     GetCompValueSliceArr(vtkIdType theElemId) const;
 
+    //! To get assigned values first by components and then by Gauss Points
     TValueSliceArr 
     GetCompValueSliceArr(vtkIdType theElemId);
   };
@@ -613,21 +727,25 @@ namespace VISU
   //---------------------------------------------------------------
   typedef std::map<EGeometry,TMeshValue> TGeom2Value;
 
+  //! Specialize TValForTime to provide VTK mapping for the entity
   struct TValForTimeImpl: virtual TValForTime
   {
-    PGaussPtsIDFilter myGaussPtsIDFilter;
-    PIDMapperFilter myIDMapperFilter;
-    TGeom2Value myGeom2Value;
-    vtkIdType myNbGauss;
+    PGaussPtsIDFilter myGaussPtsIDFilter; //!< Keep VTK representation for mesh and data on Gauss Points
+    PIDMapperFilter myIDMapperFilter; //!< Keep VTK representation for ordinary mesh and data
+    TGeom2Value myGeom2Value; //!< Keep value that is assigned to the mesh
+    vtkIdType myNbGauss; //!< Keep number of Gauss Points
    
     TValForTimeImpl();
 
+    //! Get mesh data for defined geometrical type (constant version)
     const TMeshValue& 
     GetMeshValue(EGeometry theGeom) const;
 
+    //! Get mesh data for defined geometrical type
     TMeshValue& 
     GetMeshValue(EGeometry theGeom);
 
+    //! Get number of Gauss Points for defined geometrical type
     virtual
     int
     GetNbGauss(EGeometry theGeom) const;
@@ -636,6 +754,11 @@ namespace VISU
 }
 
 
+//! This class perfroms mapping of intermediate data strucutres into corresponding VTK representation
+/*!
+  It implements VISU_Convertor public interface and declare new pure virtual functions
+  to fill its intermediate data structure from a MED source
+*/
 class VISU_Convertor_impl: public VISU_Convertor
 {
 public:
@@ -644,49 +767,75 @@ public:
   virtual
   ~VISU_Convertor_impl();
 
+  //! Just to define default behaviour
   virtual
   VISU_Convertor* 
-  Build() 
-  { 
-    return this;
-  }
+  Build();
+
+  //! Just to define default behaviour
+  virtual
+  VISU_Convertor* 
+  BuildEntities();
+
+  //! Just to define default behaviour
+  virtual
+  VISU_Convertor* 
+  BuildFields();
+
+  //! Just to define default behaviour
+  virtual
+  VISU_Convertor* 
+  BuildMinMax();
+
+  //! Just to define default behaviour
+  virtual
+  VISU_Convertor* 
+  BuildGroups();
 
+  //! Implemention of the VISU_Convertor::GetSize
   virtual 
   float
   GetSize();
 
+  //! Implemention of the VISU_Convertor::GetMeshOnEntity
   virtual 
   VISU::PNamedIDMapper 
   GetMeshOnEntity(const std::string& theMeshName, 
                  const VISU::TEntity& theEntity);
 
+  //! Implemention of the VISU_Convertor::GetMeshOnEntitySize
   virtual 
   float 
   GetMeshOnEntitySize(const std::string& theMeshName, 
                       const VISU::TEntity& theEntity);
 
+  //! Implemention of the VISU_Convertor::GetFamilyOnEntity
   virtual 
   VISU::PIDMapper 
   GetFamilyOnEntity(const std::string& theMeshName, 
                    const VISU::TEntity& theEntity,
                    const std::string& theFamilyName);
 
+  //! Implemention of the VISU_Convertor::GetFamilyOnEntitySize
   virtual 
   float 
   GetFamilyOnEntitySize(const std::string& theMeshName, 
                        const VISU::TEntity& theEntity,
                        const std::string& theFamilyName);
 
+  //! Implemention of the VISU_Convertor::GetMeshOnGroup
   virtual 
   VISU::PIDMapper 
   GetMeshOnGroup(const std::string& theMeshName, 
                 const std::string& theGroupName);
   
+  //! Implemention of the VISU_Convertor::GetMeshOnGroupSize
   virtual 
   float 
   GetMeshOnGroupSize(const std::string& theMeshName, 
                     const std::string& theGroupName);
 
+  //! Implemention of the VISU_Convertor::GetTimeStampOnMesh
   virtual
   VISU::PIDMapper 
   GetTimeStampOnMesh(const std::string& theMeshName, 
@@ -694,6 +843,7 @@ public:
                     const std::string& theFieldName,
                     int theStampsNum);
 
+  //! Implemention of the VISU_Convertor::GetTimeStampSize
   virtual 
   float 
   GetTimeStampSize(const std::string& theMeshName, 
@@ -701,6 +851,7 @@ public:
                   const std::string& theFieldName,
                   int theStampsNum);
 
+  //! Implemention of the VISU_Convertor::GetTimeStampOnGaussPts
   virtual
   VISU::PGaussPtsIDMapper 
   GetTimeStampOnGaussPts(const std::string& theMeshName, 
@@ -708,18 +859,21 @@ public:
                         const std::string& theFieldName,
                         int theStampsNum);
   
+  //! Implemention of the VISU_Convertor::GetFieldOnMeshSize
   virtual 
   float 
   GetFieldOnMeshSize(const std::string& theMeshName, 
                     const VISU::TEntity& theEntity,
                     const std::string& theFieldName);
 
+  //! Implemention of the VISU_Convertor::GetField
   virtual 
   const VISU::PField 
   GetField(const std::string& theMeshName, 
           VISU::TEntity theEntity, 
           const std::string& theFieldName);
 
+  //! Implemention of the VISU_Convertor::GetTimeStamp
   virtual 
   const VISU::PValForTime 
   GetTimeStamp(const std::string& theMeshName, 
@@ -728,25 +882,30 @@ public:
               int theStampsNum);
 
 protected:
+  //! An utility method to find TMesh by its name
   VISU::PMeshImpl 
   FindMesh(const std::string& theMeshName);
 
+  //! An utility method to find TMeshOnEntity by name of its parent mesh and entity
   typedef boost::tuple<VISU::PMeshImpl,VISU::PMeshOnEntityImpl> TFindMeshOnEntity;
   TFindMeshOnEntity
   FindMeshOnEntity(const std::string& theMeshName,
                   const VISU::TEntity& theEntity);
 
+  //! An utility method to find TFamily by name of its parent mesh, corresponding entity and its name
   typedef boost::tuple<VISU::PMeshImpl,VISU::PMeshOnEntityImpl,VISU::PFamilyImpl> TFindFamilyOnEntity;
   TFindFamilyOnEntity
   FindFamilyOnEntity(const std::string& theMeshName,
                    const VISU::TEntity& theEntity,
                    const std::string& theFamilyName);
 
+  //! An utility method to find Group by name of its parent mesh and its name
   typedef boost::tuple<VISU::PMeshImpl,VISU::PGroupImpl> TFindMeshOnGroup;
   TFindMeshOnGroup
   FindMeshOnGroup(const std::string& theMeshName, 
                  const std::string& theGroupName);
 
+  //! An utility method to find TField by name of its parent mesh, corresponding entity and its name
   typedef boost::tuple<VISU::PMeshImpl,
                       VISU::PMeshOnEntityImpl,
                       VISU::PMeshOnEntityImpl,
@@ -756,6 +915,7 @@ protected:
            const VISU::TEntity& theEntity, 
            const std::string& theFieldName);
 
+  //! An utility method to find TTimeStamp by name of its parent mesh, corresponding entity, field name and its number
   typedef boost::tuple<VISU::PMeshImpl,
                       VISU::PMeshOnEntityImpl,
                       VISU::PMeshOnEntityImpl,
@@ -768,22 +928,26 @@ protected:
                int theStampsNum);
   
 protected:
+  //! To fill intermeiate representation of TMeshOnEntity from a MED source
   virtual
   int
   LoadMeshOnEntity(VISU::PMeshImpl theMesh,
                   VISU::PMeshOnEntityImpl theMeshOnEntity) = 0;
 
+  //! To fill intermeiate representation of TFamily from a MED source
   virtual
   int
   LoadFamilyOnEntity(VISU::PMeshImpl theMesh,
                     VISU::PMeshOnEntityImpl theMeshOnEntity, 
                     VISU::PFamilyImpl theFamily) = 0;
 
+  //! To fill intermeiate representation of TGroup from a MED source
   virtual 
   int
   LoadMeshOnGroup(VISU::PMeshImpl theMesh, 
                  const VISU::TFamilySet& theFamilySet) = 0;
 
+  //! To fill intermeiate representation of TValForTime for ordinary mesh from a MED source
   virtual 
   int
   LoadValForTimeOnMesh(VISU::PMeshImpl theMesh, 
@@ -791,6 +955,7 @@ protected:
                       VISU::PFieldImpl theField, 
                       VISU::PValForTimeImpl theValForTime) = 0;
 
+  //! To fill intermeiate representation of TValForTime for mesh on Gauss Points from a MED source
   virtual 
   int
   LoadValForTimeOnGaussPts(VISU::PMeshImpl theMesh, 
index 8bfdd23fde761f4a15319d66f6b46cbfa7071b9b..57cf9ee79ae815204bb7e1f0ae186a827e472803 100644 (file)
 #ifndef VISU_IDMapper_HeaderFile
 #define VISU_IDMapper_HeaderFile
 
+/*! 
+  \file VISU_IDMapper.hxx
+  \brief The file contains declarations for basic interfaces that defines mapping of mesh elements
+*/
+
 #include "MED_SharedPtr.hxx"
 
 #include <vtkSystemIncludes.h>
@@ -40,42 +45,58 @@ namespace VISU
   using MED::SharedPtr;
 
   //---------------------------------------------------------------
+  //! Defines a basic class for intemediate data structures
   struct TBaseStructure
   {
+    //! Just to provide possibility of dynamic navigation through the class hierarchy
     virtual ~TBaseStructure()
     {}
+
+    std::string myEntry; //!< To simplify publication of the object tree
   };
   typedef SharedPtr<TBaseStructure> PBaseStructure;
 
   //---------------------------------------------------------------
   typedef vtkUnstructuredGrid TVTKOutput;
 
+  //! Defines a basic abstract interface for VTK to object ID's and backward mapping
+  /*!
+    Where object ID means ID which attached to corresponding MED entity.
+    For example, each MED node can have its own ID as well as any other mesh cell
+  */
   struct TIDMapper: virtual TBaseStructure
   {
+    //! Get node object ID for corresponding VTK ID
     virtual 
     vtkIdType 
     GetNodeObjID(vtkIdType theID) const;
 
+    //! Get node VTK ID for corresponding object ID
     virtual 
     vtkIdType 
     GetNodeVTKID(vtkIdType theID) const;
 
+    //! Get coordinates of node for corresponding object ID
     virtual
     float* 
     GetNodeCoord(vtkIdType theObjID);
 
+    //! Get cell object ID for corresponding VTK ID
     virtual 
     vtkIdType 
     GetElemObjID(vtkIdType theID) const;
 
+    //! Get cell VTK ID for corresponding object ID
     virtual 
     vtkIdType 
     GetElemVTKID(vtkIdType theID) const;
 
+    //! Get VTK representation of mesh cell for corresponding object ID
     virtual
     vtkCell* 
     GetElemCell(vtkIdType theObjID);
 
+    //! Get VTK representation of mesh for corresponding MED entity
     virtual
     TVTKOutput*
     GetVTKOutput() = 0;
@@ -84,12 +105,18 @@ namespace VISU
   
 
   //---------------------------------------------------------------
+  //! Defines an abstract interface for VTK to object ID's and backward mapping
+  /*!
+    This class defines some additional methods that allow get names for corresponding mesh elements
+  */
   struct TNamedIDMapper: virtual TIDMapper
   {
+    //! Get name of mesh node for corresponding object ID
     virtual
     std::string 
     GetNodeName(vtkIdType theObjID) const = 0;
 
+    //! Get name of mesh cell for corresponding object ID
     virtual
     std::string 
     GetElemName(vtkIdType theObjID) const = 0;
@@ -98,16 +125,19 @@ namespace VISU
   
 
   //---------------------------------------------------------------
-  typedef vtkIdType TCellID;
+  typedef vtkIdType TCellID; 
   typedef vtkIdType TLocalPntID;
+  //! Defines a type that represent complex ID for defined Gauss Point
   typedef std::pair<TCellID,TLocalPntID> TGaussPointID;
 
   struct TGaussPtsIDMapper: virtual TIDMapper
   {
+    //! Gets complex Gauss Point ID by its VTK ID
     virtual 
     TGaussPointID 
     GetObjID(vtkIdType theID) const = 0;
 
+    //! Gets parent TNamedIDMapper, which contains reference mesh cells
     virtual 
     TNamedIDMapper*
     GetParent() = 0;
index 4ab71595a40871b4480d725ca88a4e83c2104bbf..5616c086f12a35f4fe767fc0b33ce1d6e94d37ca 100644 (file)
@@ -49,16 +49,12 @@ using MED::EBooleen;
 #ifdef _DEBUG_
 static int MYDEBUG = 0;
 static int MYVALUEDEBUG = 0;
-static int MYMEMORYDEBUG = 0;
-static int MYTHREADDEBUG = 0;
 static int MY_FAMILY_DEBUG = 0;
 static int MY_GROUP_DEBUG = 0;
-//#define _DEXCEPT_
+#define _DEXCEPT_
 #else
 static int MYDEBUG = 0;
 static int MYVALUEDEBUG = 0;
-static int MYMEMORYDEBUG = 0;
-static int MYTHREADDEBUG = 0;
 static int MY_FAMILY_DEBUG = 0;
 static int MY_GROUP_DEBUG = 0;
 #endif
@@ -312,6 +308,7 @@ namespace
              const MED::TGeom2Size& theGeom2Size,
              VISU::TMEDValForTime& theValForTime)
   {
+    TTimerLog aTimerLog(MYDEBUG,"InitProfile");
     INITMSG(MYDEBUG,"InitProfile"<<endl);
     
     TProfileMap& aProfileMap = theMeshOnEntity.myProfileMap;
@@ -355,13 +352,13 @@ namespace
              const MED::TGeom2Size& theGeom2Size,
              VISU::TMEDValForTime& theValForTime)
   {
+    TTimerLog aTimerLog(MYDEBUG,"GetGaussKey");
     INITMSG(MYDEBUG,"GetGaussKey"<<endl);
 
     TGaussKey aGaussKey;
     PMEDProfile aProfile = theValForTime.myProfile;
     TGeom2SubProfile& aGeom2SubProfile = aProfile->myGeom2SubProfile;
 
-    const MED::TGeom2Profile& aGeom2Profile = theTimeStampVal.GetGeom2Profile();
     const MED::TTimeStampInfo& aTimeStampInfo = theTimeStampVal.GetTimeStampInfo();
     const MED::TGeom2Gauss& aGeom2Gauss = aTimeStampInfo.GetGeom2Gauss();
 
@@ -429,6 +426,7 @@ namespace
                const MED::TGeom2Size& theGeom2Size,
                VISU::TMEDValForTime& theValForTime)
   {
+    TTimerLog aTimerLog(MYDEBUG,"InitGaussMesh");
     INITMSG(MYDEBUG,"InitGaussMesh"<<endl);
 
     if(theMeshOnEntity.myEntity == NODE_ENTITY)
@@ -482,6 +480,7 @@ namespace
                   const MED::TGeom2Size& theGeom2Size,
                   VISU::TMEDValForTime& theValForTime)
   {
+    TTimerLog aTimerLog(MYDEBUG,"InitGaussProfile");
     INITMSG(MYDEBUG,"InitGaussProfile"<<endl);
 
     // The order of the function calls is important
@@ -501,16 +500,15 @@ namespace
 
 
   //---------------------------------------------------------------
-  typedef std::map<TInt,TInt> TFamilyCounterMap;
-
   void
   BuildMeshOnEntityMap(PMEDMesh theMesh,
-                      TFamilyCounterMap& theFamilyID2CellsSize,
                       const MED::TEntityInfo& theEntityInfo,
                       const MED::PNodeInfo& theNodeInfo,
                       const MED::PWrapper& theMEDWrapper)
   {
+    TTimerLog aTimerLog(MYDEBUG,"BuildMeshOnEntityMap");
     INITMSG(MYDEBUG,"BuildMeshOnEntityMap"<<endl);
+
     MED::PMeshInfo aMeshInfo = theMesh->myMeshInfo;
     const std::string& aMeshName = theMesh->myName;
     TMeshOnEntityMap& aMeshOnEntityMap = theMesh->myMeshOnEntityMap;
@@ -524,7 +522,8 @@ namespace
       aMeshOnEntity->myEntity = aVEntity;
       aMeshOnEntity->myMeshName = aMeshName;
       aMeshOnEntity->myGeom2Size = aGeom2Size;
-      
+      TFamilyID2CellsSize& aFamilyID2CellsSize = aMeshOnEntity->myFamilyID2CellsSize;
+
       INITMSG(MYDEBUG,
              "- aMEntity = "<<aMEntity<<
              "; aVEntity = "<<aVEntity<<
@@ -537,7 +536,7 @@ namespace
        for(TInt iElem = 0; iElem < theMesh->myNbPoints; iElem++){
          TInt aFamId = theNodeInfo->GetFamNum(iElem);
          if(aFamId != 0)
-           theFamilyID2CellsSize[aFamId] += 2;
+           aFamilyID2CellsSize[aFamId] += 2;
        }
        
        INITMSG(MYDEBUG,
@@ -568,7 +567,7 @@ namespace
              aMeshOnEntity->myCellsSize += aNbConn;
              TInt aFamId = aPolygoneInfo->GetFamNum(anElemId);
              if(aFamId != 0)
-               theFamilyID2CellsSize[aFamId] += aNbConn + 1;
+               aFamilyID2CellsSize[aFamId] += aNbConn + 1;
            }
            break;
          }
@@ -594,7 +593,7 @@ namespace
              aMeshOnEntity->myCellsSize += aCellSize;
              TInt aFamId = aPolyedreInfo->GetFamNum(anElemId);
              if(aFamId != 0)
-               theFamilyID2CellsSize[aFamId] += aCellSize + 1;
+               aFamilyID2CellsSize[aFamId] += aCellSize + 1;
            }
            break;
          }
@@ -616,7 +615,7 @@ namespace
            for(TInt iElem = 0; iElem < aNbElem; iElem++){
              TInt aFamId = aCellInfo->GetFamNum(iElem);
              if(aFamId != 0)
-               theFamilyID2CellsSize[aFamId] += aVNbNodes + 1;
+               aFamilyID2CellsSize[aFamId] += aVNbNodes + 1;
            }
          }} // end switch(...)
        }
@@ -625,240 +624,19 @@ namespace
   }
 
 
-  //---------------------------------------------------------------
-  struct TFieldMinMax
-  {
-    VISU::PMEDField myField;
-    MED::PFieldInfo myFieldInfo;
-    TInt myNbTimeStamps;
-    MED::EEntiteMaillage myMEntity;
-    MED::TGeom2Size myGeom2Size;
-    MED::TMKey2Profile myMKey2Profile;
-    MED::TKey2Gauss myKey2Gauss;
-    MED::PWrapper myMEDWrapper;
-
-    TFieldMinMax(const VISU::PMEDField& theField,
-                const MED::PFieldInfo& theFieldInfo,
-                TInt theNbTimeStamps,
-                MED::EEntiteMaillage theMEntity,
-                const MED::TGeom2Size& theGeom2Size,
-                const MED::TMKey2Profile& theMKey2Profile,
-                const MED::TKey2Gauss& theKey2Gauss,
-                const MED::PWrapper& theMEDWrapper):
-      myField(theField),
-      myFieldInfo(theFieldInfo),
-      myNbTimeStamps(theNbTimeStamps),
-      myMEntity(theMEntity),
-      myGeom2Size(theGeom2Size),
-      myMKey2Profile(theMKey2Profile),
-      myKey2Gauss(theKey2Gauss),
-      myMEDWrapper(theMEDWrapper)
-    {
-      INITMSG(MYMEMORYDEBUG,"TFieldMinMax() - "<<this<<endl);
-    }
-
-    ~TFieldMinMax()
-    {
-      INITMSG(MYMEMORYDEBUG,"~TFieldMinMax() - "<<this<<endl);
-    }
-
-    void
-    Calculate()
-    {
-      INITMSG(MYTHREADDEBUG,"TFieldMinMax::Calculate() - "<<this<<
-             "; aFieldName = '"<<myField->myName<<"'"<<
-             "; myNbTimeStamps = "<<myNbTimeStamps<<
-             endl);
-      
-      TInt aNbComp = myField->myNbComp;
-      int aNbComp2 = aNbComp;
-      if(aNbComp == 2 || aNbComp == 4)
-       aNbComp2 = 2;
-      else if(aNbComp > 4)
-       aNbComp2 = 3;
-
-      TValField& aValField = myField->myValField;
-      TMinMaxArr& aMinMaxArr = myField->myMinMaxArr;
-      for(TInt iTimeStamp = 1; iTimeStamp <= myNbTimeStamps; iTimeStamp++){
-       INITMSG(MYTHREADDEBUG,"- "<<this<<"; iTimeStamp = "<<iTimeStamp<<endl);
-       
-       MED::PTimeStampInfo aTimeStampInfo = myMEDWrapper->GetPTimeStampInfo(myFieldInfo,
-                                                                            myMEntity,
-                                                                            myGeom2Size,
-                                                                            iTimeStamp);
-       MED::PTimeStampVal aTimeStampVal = myMEDWrapper->GetPTimeStampVal(aTimeStampInfo,
-                                                                         myMKey2Profile,
-                                                                         myKey2Gauss);
-       PMEDValForTime aValForTime = aValField[iTimeStamp];
-       
-       const MED::TTimeStampVal& aTimeStampValRef = aTimeStampVal;
-       
-       PMEDProfile aProfile = aValForTime->myProfile;
-       TGeom2SubProfile& aGeom2SubProfile = aProfile->myGeom2SubProfile;
-       TGeom2SubProfile::const_iterator anIter = aGeom2SubProfile.begin();
-       for(; anIter != aGeom2SubProfile.end(); anIter++){
-         VISU::EGeometry aEGeom = anIter->first;
-         PMEDSubProfile aSubProfile(anIter->second);
-         
-         TInt aNbElem = aSubProfile->myNbCells;
-         TInt aNbGauss = aValForTime->GetNbGauss(aEGeom);
-         
-         if(aSubProfile->myStatus != eRemoveAll){
-           INITMSG(MYTHREADDEBUG,
-                   "- "<<this<< 
-                   "; aEGeom = "<<aEGeom<<
-                   "; aNbElem = "<<aNbElem<<
-                   "; aNbGauss = "<<aNbGauss<<
-                   endl);
-           
-           MED::EGeometrieElement aMGeom = aSubProfile->myMGeom;
-           const MED::TMeshValue& aMMeshValue = aTimeStampValRef.GetMeshValue(aMGeom);
-
-           // To calculate min/max per components
-           for(TInt iElem = 0; iElem < aNbElem; iElem++){
-             MED::TCValueSliceArr aMValueSliceArr = aMMeshValue.GetCompValueSliceArr(iElem);
-             for(TInt iComp = 0; iComp < aNbComp; iComp++){
-               const MED::TCValueSlice& aMValueSlice = aMValueSliceArr[iComp];
-               TMinMax& aMinMax = aMinMaxArr[iComp+1];
-               float& aMin = aMinMax.first;
-               float& aMax = aMinMax.second;
-               for(TInt iGauss = 0; iGauss < aNbGauss; iGauss++){
-                 const float& aVal = aMValueSlice[iGauss];
-                 aMin = min(aMin,aVal);
-                 aMax = max(aMax,aVal);
-               }
-             }
-           }
-
-           // To calculate min/max per vector modulus
-           TMinMax& aMinMax = aMinMaxArr[0];
-           float& aMin = aMinMax.first;
-           float& aMax = aMinMax.second;
-           for(TInt iElem = 0; iElem < aNbElem; iElem++){
-             MED::TCValueSliceArr aMValueSliceArr = aMMeshValue.GetGaussValueSliceArr(iElem);
-             for(TInt iGauss = 0; iGauss < aNbGauss; iGauss++){
-               const MED::TCValueSlice& aMValueSlice = aMValueSliceArr[iGauss];
-               float aValue = 0.0;
-               for(TInt iComp = 0; iComp < aNbComp2; iComp++){
-                 float aVal = aMValueSlice[iComp];
-                 aValue += aVal*aVal;
-               }
-               aValue = sqrt(aValue);
-               aMin = min(aMin,aValue);
-               aMax = max(aMax,aValue);
-             }
-           }
-         }
-       }
-      }
-      for(TInt iComp = 0; iComp <= aNbComp; iComp++){
-       VISU::TMinMax aMinMax = myField->GetMinMax(iComp);
-       INITMSG(MYTHREADDEBUG,"- "<<this<<"; "<<iComp<<": "<<aMinMax.first<<"; "<<aMinMax.second<<endl);
-      }
-    }
-  };
-  typedef SharedPtr<TFieldMinMax> PFieldMinMax;
-
-
-  //---------------------------------------------------------------
-  void
-  GetFieldMinMax(PFieldMinMax theFieldMinMax)
-  {
-    theFieldMinMax->Calculate();
-  }
-
-
-  //---------------------------------------------------------------
-  struct TCalculateMinMax
-  {
-    VISU::PMEDMesh myMesh;
-    MED::TEntityInfo myEntityInfo;
-    MED::TMKey2Profile myMKey2Profile;
-    MED::TKey2Gauss myKey2Gauss;
-    MED::PWrapper myMEDWrapper;
-
-    TCalculateMinMax(const VISU::PMEDMesh& theMesh,
-                    const MED::TEntityInfo& theEntityInfo,
-                    const MED::TMKey2Profile& theMKey2Profile,
-                    const MED::TKey2Gauss& theKey2Gauss,
-                    const MED::PWrapper& theMEDWrapper):
-      myMesh(theMesh),
-      myEntityInfo(theEntityInfo),
-      myMKey2Profile(theMKey2Profile),
-      myKey2Gauss(theKey2Gauss),
-      myMEDWrapper(theMEDWrapper)
-    {
-      INITMSG(MYMEMORYDEBUG,"TCalculateMinMax() - "<<this<<endl);
-    }
-
-    ~TCalculateMinMax()
-    {
-      INITMSG(MYMEMORYDEBUG,"~TCalculateMinMax() - "<<this<<endl);
-    }
-
-    void
-    Calculate()
-    {
-      TInt aNbFields = myMEDWrapper->GetNbFields(); 
-      MED::PMeshInfo aMeshInfo = myMesh->myMeshInfo;
-      const std::string& aMeshName = myMesh->myName;
-      INITMSG(MYDEBUG,"MinMaxCalculation: aNbFields = "<<aNbFields<<"\n");
-      for(TInt iField = 1; iField <= aNbFields; iField++){
-       MED::PFieldInfo aFieldInfo = myMEDWrapper->GetPFieldInfo(aMeshInfo,iField);
-       TInt aNbComp = aFieldInfo->GetNbComp();
-       std::string aFieldName = aFieldInfo->GetName();
-       
-       MED::TGeom2Size aGeom2Size;
-       MED::EEntiteMaillage aMEntity;
-       TInt aNbTimeStamps = myMEDWrapper->GetNbTimeStamps(aFieldInfo,
-                                                           myEntityInfo,
-                                                           aMEntity,
-                                                           aGeom2Size);
-       if(aNbTimeStamps < 1)
-         continue;
-       
-       TEntity aVEntity = MEDEntityToVTK(aMEntity);
-       PMEDMeshOnEntity aMeshOnEntity = myMesh->myMeshOnEntityMap[aVEntity];
-       TFieldMap& aFieldMap = aMeshOnEntity->myFieldMap;
-       PMEDField aField = aFieldMap[aFieldName];
-       
-       PFieldMinMax aFieldMinMax(new TFieldMinMax(aField,
-                                                  aFieldInfo,
-                                                  aNbTimeStamps,
-                                                  aMEntity,
-                                                  aGeom2Size,
-                                                  myMKey2Profile,
-                                                  myKey2Gauss,
-                                                  myMEDWrapper));
-       
-       boost::thread aThread(boost::bind(&GetFieldMinMax,aFieldMinMax));
-      }
-    }
-  };
-  typedef SharedPtr<TCalculateMinMax> PCalculateMinMax;
-
-
-  //---------------------------------------------------------------
-  void
-  CalculateMinMax(PCalculateMinMax theCalculateMinMax)
-  {
-    theCalculateMinMax->Calculate();
-  }
-
-
   //---------------------------------------------------------------
   void
   BuildFieldMap(PMEDMesh theMesh,
                const MED::TEntityInfo& theEntityInfo,
-               const MED::TMKey2Profile& theMKey2Profile,
-               const MED::TKey2Gauss& theKey2Gauss,
                MED::PWrapper theMEDWrapper)
   {
+    TTimerLog aTimerLog(MYDEBUG,"BuildFieldMap");
     TInt aNbFields = theMEDWrapper->GetNbFields(); 
     MED::PMeshInfo aMeshInfo = theMesh->myMeshInfo;
     const std::string& aMeshName = theMesh->myName;
     INITMSG(MYDEBUG,"BuildFieldMap: aNbFields = "<<aNbFields<<"\n");
     for(TInt iField = 1; iField <= aNbFields; iField++){
+      TTimerLog aTimerLog(MYDEBUG,"GetPFieldInfo");
       MED::PFieldInfo aFieldInfo = theMEDWrapper->GetPFieldInfo(aMeshInfo,iField);
       TInt aNbComp = aFieldInfo->GetNbComp();
       std::string aFieldName = aFieldInfo->GetName();
@@ -895,15 +673,14 @@ namespace
       }
       
       for(TInt iTimeStamp = 1; iTimeStamp <= aNbTimeStamps; iTimeStamp++){
+       TTimerLog aTimerLog(MYDEBUG,"GetPTimeStampInfo");
        MED::PTimeStampInfo aTimeStampInfo = theMEDWrapper->GetPTimeStampInfo(aFieldInfo,
                                                                              aMEntity,
                                                                              aGeom2Size,
                                                                              iTimeStamp);
        TFloat aDt = aTimeStampInfo->GetDt();
        std::string anUnitDt = aTimeStampInfo->GetUnitDt();
-       MED::PTimeStampVal aTimeStampVal = theMEDWrapper->GetPTimeStampVal(aTimeStampInfo,
-                                                                          theMKey2Profile,
-                                                                          theKey2Gauss);
+
        TValField& aValField = aField->myValField;
        PMEDValForTime aValForTime = aValField[iTimeStamp](new TMEDValForTime());
        aValForTime->myId = iTimeStamp;
@@ -913,14 +690,6 @@ namespace
        aValForTime->myNbGauss = aTimeStampInfo->GetNbGauss();
        aValForTime->myTime = VISU::TTime(aDt,anUnitDt);
        INITMSG(MYDEBUG,"aDt = '"<<aDt<<", "<<anUnitDt<<"'\n");
-       
-       InitGaussProfile(theMEDWrapper,
-                        aMeshInfo,
-                        aTimeStampVal,
-                        aMeshOnEntity,
-                        aMEntity,
-                        aGeom2Size,
-                        aValForTime);
       }
     }
   }
@@ -929,13 +698,14 @@ namespace
   //---------------------------------------------------------------
   void
   BuildFamilyMap(PMEDMesh theMesh,
-                const TFamilyCounterMap& theFamilyID2CellsSize,
                 const MED::TEntityInfo& theEntityInfo,
                 const MED::TEntity2TGeom2ElemInfo& theEntity2TGeom2ElemInfo,
                 const MED::TFamilyInfoSet& theFamilyInfoSet,
                 MED::PWrapper theMEDWrapper)
   {
+    TTimerLog aTimerLog(MYDEBUG,"BuildFamilyMap");
     INITMSG(MYDEBUG,"BuildFamilyMap\n");
+
     MED::PMeshInfo aMeshInfo = theMesh->myMeshInfo;
     MED::TEntity2FamilySet aEntity2FamilySet = MED::GetEntity2FamilySet(theMEDWrapper,theEntity2TGeom2ElemInfo,theFamilyInfoSet);
     MED::TEntity2FamilySet::const_iterator aEntity2FamilySetIter = aEntity2FamilySet.begin();
@@ -945,6 +715,7 @@ namespace
       
       TEntity aVEntity = MEDEntityToVTK(aMEntity);
       PMEDMeshOnEntity aMeshOnEntity = theMesh->myMeshOnEntityMap[aVEntity];
+      const TFamilyID2CellsSize& aFamilyID2CellsSize = aMeshOnEntity->myFamilyID2CellsSize;
       TFamilyMap& aFamilyMap = aMeshOnEntity->myFamilyMap;
        
       if(aFamilyTSizeSet.empty())
@@ -973,8 +744,8 @@ namespace
        aFamily->myNbCells = aSize;
 
        aFamily->myCellsSize = 0;
-       TFamilyCounterMap::const_iterator anIter = theFamilyID2CellsSize.find(anId);
-       if(anIter != theFamilyID2CellsSize.end())
+       TFamilyID2CellsSize::const_iterator anIter = aFamilyID2CellsSize.find(anId);
+       if(anIter != aFamilyID2CellsSize.end())
          aFamily->myCellsSize = anIter->second;
        
        INITMSG(MY_FAMILY_DEBUG,
@@ -1004,7 +775,9 @@ namespace
   BuildGroupMap(PMEDMesh theMesh,
                const MED::TFamilyInfoSet& theFamilyInfoSet)
   {
-    INITMSG(MYDEBUG,"BuildGroupMap:\n");
+    TTimerLog aTimerLog(MYDEBUG,"BuildGroupMap");
+    INITMSG(MYDEBUG,"BuildGroupMap\n");
+
     TGroupMap& aGroupMap = theMesh->myGroupMap;
     MED::TGroupInfo aGroupInfo = MED::GetGroupInfo(theFamilyInfoSet);
     MED::TGroupInfo::const_iterator aGroupInfoIter = aGroupInfo.begin();
@@ -1137,6 +910,20 @@ namespace
       return myElemInfo->GetElemName(theObjID);
     return TSubMeshImpl::GetElemName(theObjID);
   }
+
+  struct TSetIsDone
+  {
+    bool& myIsDone;
+    TSetIsDone(bool& theIsDone):
+      myIsDone(theIsDone)
+    {}
+
+    ~TSetIsDone()
+    {
+      myIsDone = true;
+    }
+
+  };
 }
 
 
@@ -1149,7 +936,11 @@ CreateConvertor(const string& theFileName)
 }
 
 VISU_MedConvertor
-::VISU_MedConvertor(const string& theFileName)
+::VISU_MedConvertor(const string& theFileName):
+  myIsEntitiesDone(false),
+  myIsFieldsDone(false),
+  myIsGroupsDone(false),
+  myIsMinMaxDone(false)
 {
   myFileInfo.setFile(QString(theFileName.c_str()));
   myName = myFileInfo.baseName().latin1();
@@ -1159,42 +950,41 @@ VISU_MedConvertor
 //---------------------------------------------------------------
 VISU_Convertor* 
 VISU_MedConvertor
-::Build()
+::BuildEntities()
 {
-  MED::PWrapper aMed = MED::CrWrapper(myFileInfo.absFilePath().latin1());
+  if(myIsEntitiesDone)
+    return this;
 
-  MED::TKey2Gauss aKey2Gauss = MED::GetKey2Gauss(aMed);
-  MED::TMKey2Profile aMKey2Profile = MED::GetMKey2Profile(aMed);
+  TSetIsDone aSetIsDone(myIsEntitiesDone);
+  TTimerLog aTimerLog(MYDEBUG,"BuildEntities");
+  MED::PWrapper aMed = MED::CrWrapper(myFileInfo.absFilePath().latin1());
 
   TInt aNbMeshes = aMed->GetNbMeshes();
   TMeshMap& aMeshMap = myMeshMap;
 
-  MSG(MYDEBUG,"VISU_MedConvertor::Build()");
-  INITMSG(MYDEBUG,"GetNbMeshes() = "<<aNbMeshes<<"\n");
+  INITMSG(MYDEBUG,"BuildEntities aNbMeshes = "<<aNbMeshes<<"\n");
 
   for(TInt iMesh = 1; iMesh <= aNbMeshes; iMesh++){
 #ifndef _DEXCEPT_
     try{
 #endif
+      TTimerLog aTimerLog(MYDEBUG,"GetPMeshInfo");
+
       MED::PMeshInfo aMeshInfo = aMed->GetPMeshInfo(iMesh);
+      std::string aMeshName = aMeshInfo->GetName();
+      TInt aDim = aMeshInfo->GetDim();
       
       MED::PNodeInfo aNodeInfo = aMed->GetPNodeInfo(aMeshInfo);
       
-      MED::TEntityInfo aEntityInfo = aMed->GetEntityInfo(aMeshInfo);
-      
-      MED::TEntity2TGeom2ElemInfo anEntity2TGeom2ElemInfo = 
-       MED::GetEntity2TGeom2ElemInfo(aMed,aMeshInfo,aEntityInfo);
-      
-      // creating TMesh structure and TMeshOnEntityMap     
-      TInt aDim = aMeshInfo->GetDim();
-      std::string aMeshName = aMeshInfo->GetName();
+      MED::TEntityInfo anEntityInfo = aMed->GetEntityInfo(aMeshInfo);
       
+      // creating TMesh structure and TMeshOnEntityMap         
       PMEDMesh aMesh = aMeshMap[aMeshName](new TMEDMesh());
       aMesh->myDim = aDim;
       aMesh->myName = aMeshName;
       aMesh->myNbPoints = aNodeInfo->GetNbElem();
       aMesh->myMeshInfo = aMeshInfo;
-      aMesh->myEntityInfo = aEntityInfo;
+      aMesh->myEntityInfo = anEntityInfo;
       aMesh->myNamedPointCoords(new TMEDNamedPointCoords());
 
       INITMSG(MYDEBUG,"aMeshName = '"<<aMeshName<<
@@ -1204,47 +994,322 @@ VISU_MedConvertor
 #ifndef _DEXCEPT_
       try{
 #endif
-       BEGMSG(MYDEBUG,"aEntityInfo.size() = "<<aEntityInfo.size()<<"\n");
-       TFamilyCounterMap aFamilyID2CellsSize;
+       BEGMSG(MYDEBUG,"anEntityInfo.size() = "<<anEntityInfo.size()<<"\n");
        
        BuildMeshOnEntityMap(aMesh,
-                            aFamilyID2CellsSize,
-                            aEntityInfo,
+                            anEntityInfo,
                             aNodeInfo,
                             aMed);
        
+#ifndef _DEXCEPT_
+      }catch(std::exception& exc){
+       MSG(MYDEBUG,"Follow exception was occured in:\n"<<exc.what());
+      }catch(...){
+       MSG(MYDEBUG,"Unknown exception !!!");
+      }
+#endif
+
+#ifndef _DEXCEPT_
+    }catch(std::exception& exc){
+      MSG(MYDEBUG,"Follow exception was occured in:\n"<<exc.what());
+    }catch(...){
+      MSG(MYDEBUG,"Unknown exception !!!");
+    }
+#endif
+  } 
+
+  return this; 
+}
+
+
+//---------------------------------------------------------------
+VISU_Convertor* 
+VISU_MedConvertor
+::BuildFields()
+{
+  if(myIsFieldsDone)
+    return this;
+
+  TSetIsDone aSetIsDone(myIsFieldsDone);
+  TTimerLog aTimerLog(MYDEBUG,"BuildFields");
+  MED::PWrapper aMed = MED::CrWrapper(myFileInfo.absFilePath().latin1());
+
+  TInt aNbMeshes = aMed->GetNbMeshes();
+  TMeshMap& aMeshMap = myMeshMap;
+
+  INITMSG(MYDEBUG,"BuildFields - aNbMeshes = "<<aNbMeshes<<"\n");
+
+  for(TInt iMesh = 1; iMesh <= aNbMeshes; iMesh++){
+#ifndef _DEXCEPT_
+    try{
+#endif
+      TTimerLog aTimerLog(MYDEBUG,"GetPMeshInfo");
+
+      MED::PMeshInfo aMeshInfo = aMed->GetPMeshInfo(iMesh);
+      std::string aMeshName = aMeshInfo->GetName();
+      
+      TMeshMap::const_iterator anIter = aMeshMap.find(aMeshName);
+      if(anIter == aMeshMap.end())
+       continue;
+      PMEDMesh aMesh = anIter->second;
+
+      INITMSG(MYDEBUG,"aMeshName = '"<<aMeshName<<"'\n");
+#ifndef _DEXCEPT_
+      try{
+#endif
+       MED::TEntityInfo anEntityInfo = aMed->GetEntityInfo(aMeshInfo);
+
        BuildFieldMap(aMesh,
-                     aEntityInfo,
-                     aMKey2Profile,
-                     aKey2Gauss,
+                     anEntityInfo,
                      aMed);
+#ifndef _DEXCEPT_
+      }catch(std::exception& exc){
+       MSG(MYDEBUG,"Follow exception was occured in:\n"<<exc.what());
+      }catch(...){
+       MSG(MYDEBUG,"Unknown exception !!!");
+      }
+#endif
+
+#ifndef _DEXCEPT_
+    }catch(std::exception& exc){
+      MSG(MYDEBUG,"Follow exception was occured in:\n"<<exc.what());
+    }catch(...){
+      MSG(MYDEBUG,"Unknown exception !!!");
+    }
+#endif
+  } 
+
+  return this; 
+}
+
+
+//---------------------------------------------------------------
+VISU_Convertor* 
+VISU_MedConvertor
+::BuildMinMax()
+{
+  if(myIsMinMaxDone)
+    return this;
+
+  TSetIsDone aSetIsDone(myIsMinMaxDone);
+  TTimerLog aTimerLog(MYDEBUG,"BuildMinMax");
+  MED::PWrapper aMed = MED::CrWrapper(myFileInfo.absFilePath().latin1());
+
+  MED::TKey2Gauss aKey2Gauss = MED::GetKey2Gauss(aMed);
+  MED::TMKey2Profile aMKey2Profile = MED::GetMKey2Profile(aMed);
+
+  TInt aNbMeshes = aMed->GetNbMeshes();
+  TMeshMap& aMeshMap = myMeshMap;
+
+  INITMSG(MYDEBUG,"BuildMinMax - aNbMeshes = "<<aNbMeshes<<"\n");
+
+  for(TInt iMesh = 1; iMesh <= aNbMeshes; iMesh++){
+#ifndef _DEXCEPT_
+    try{
+#endif
+      TTimerLog aTimerLog(MYDEBUG,"BuildMinMax - GetPMeshInfo");
+
+      MED::PMeshInfo aMeshInfo = aMed->GetPMeshInfo(iMesh);
+      std::string aMeshName = aMeshInfo->GetName();
+      
+      TMeshMap::const_iterator anIter = aMeshMap.find(aMeshName);
+      if(anIter == aMeshMap.end())
+       continue;
+      PMEDMesh aMesh = anIter->second;
+
+#ifndef _DEXCEPT_
+      try{
+#endif
+       TInt aNbFields = aMed->GetNbFields(); 
+
+       INITMSG(MYDEBUG,
+               "- aMeshName = '"<<aMeshName<<"'"<<
+               "; aNbFields = "<<aNbFields<<"\n");
+
+       MED::TEntityInfo anEntityInfo = aMed->GetEntityInfo(aMeshInfo);
+
+       for(TInt iField = 1; iField <= aNbFields; iField++){
+         TTimerLog aTimerLog(MYDEBUG,"BuildMinMax - GetPFieldInfo()");
+         MED::PFieldInfo aFieldInfo = aMed->GetPFieldInfo(aMeshInfo,iField);
+         std::string aFieldName = aFieldInfo->GetName();
+         INITMSG(MYDEBUG,"- aFieldName = '"<<aFieldName<<"'\n");
+         
+         MED::TGeom2Size aGeom2Size;
+         MED::EEntiteMaillage aMEntity;
+         TInt aNbTimeStamps = aMed->GetNbTimeStamps(aFieldInfo,
+                                                    anEntityInfo,
+                                                    aMEntity,
+                                                    aGeom2Size);
+         if(aNbTimeStamps < 1)
+           continue;
+       
+         TEntity aVEntity = MEDEntityToVTK(aMEntity);
+         PMEDMeshOnEntity aMeshOnEntity = aMesh->myMeshOnEntityMap[aVEntity];
+         TFieldMap& aFieldMap = aMeshOnEntity->myFieldMap;
+         PMEDField aField = aFieldMap[aFieldName];
+       
+         TInt aNbComp = aField->myNbComp;
+         int aNbComp2 = aNbComp;
+         if(aNbComp == 2 || aNbComp == 4)
+           aNbComp2 = 2;
+         else if(aNbComp > 4)
+           aNbComp2 = 3;
+
+         TMinMaxArr& aMinMaxArr = aField->myMinMaxArr;
+         for(TInt iTimeStamp = aNbTimeStamps; iTimeStamp >= 1; iTimeStamp--){
+           TTimerLog aTimerLog(MYDEBUG,"BuildMinMax - GetPTimeStampInfo()");
+           INITMSG(MYDEBUG,"- iTimeStamp = "<<iTimeStamp<<endl);
+           
+           MED::PTimeStampInfo aTimeStampInfo = aMed->GetPTimeStampInfo(aFieldInfo,
+                                                                        aMEntity,
+                                                                        aGeom2Size,
+                                                                        iTimeStamp);
+           
+           MED::PTimeStampVal aTimeStampVal = aMed->GetPTimeStampVal(aTimeStampInfo,
+                                                                     aMKey2Profile,
+                                                                     aKey2Gauss);
+           
+           const MED::TGeom2Gauss& aGeom2Gauss = aTimeStampInfo->GetGeom2Gauss();
 
-#ifdef _LOAD_FAMILIES_
+           const MED::TTimeStampVal& aTimeStampValRef = aTimeStampVal;
+           
+           const MED::TGeom2Value& aGeom2Value = aTimeStampValRef.myGeom2Value;
+           MED::TGeom2Value::const_iterator anIter = aGeom2Value.begin();
+           for(; anIter != aGeom2Value.end(); anIter++){
+             const MED::TMeshValue& aMMeshValue = anIter->second;
+             MED::EGeometrieElement aMGeom = anIter->first;
+             
+             TInt aNbElem = aMMeshValue.myNbElem;
+             TInt aNbGauss = aMMeshValue.myNbGauss;
+             
+             MED::TGeom2Gauss::const_iterator aGaussIter = aGeom2Gauss.find(aMGeom);
+             if(aGaussIter == aGeom2Gauss.end())
+               aNbGauss = 1;
+
+             INITMSG(MYDEBUG,
+                     "- aMGeom = "<<aMGeom<<
+                     "; aNbElem = "<<aNbElem<<
+                     "; aNbGauss = "<<aNbGauss<<
+                     endl);
+             
+             // To calculate min/max per components
+             for(TInt iElem = 0; iElem < aNbElem; iElem++){
+               MED::TCValueSliceArr aMValueSliceArr = aMMeshValue.GetCompValueSliceArr(iElem);
+               for(TInt iComp = 0; iComp < aNbComp; iComp++){
+                 const MED::TCValueSlice& aMValueSlice = aMValueSliceArr[iComp];
+                 TMinMax& aMinMax = aMinMaxArr[iComp+1];
+                 float& aMin = aMinMax.first;
+                 float& aMax = aMinMax.second;
+                 for(TInt iGauss = 0; iGauss < aNbGauss; iGauss++){
+                   const float& aVal = aMValueSlice[iGauss];
+                   aMin = min(aMin,aVal);
+                   aMax = max(aMax,aVal);
+                 }
+               }
+             }
+             
+             // To calculate min/max per vector modulus
+             TMinMax& aMinMax = aMinMaxArr[0];
+             float& aMin = aMinMax.first;
+             float& aMax = aMinMax.second;
+             for(TInt iElem = 0; iElem < aNbElem; iElem++){
+               MED::TCValueSliceArr aMValueSliceArr = aMMeshValue.GetGaussValueSliceArr(iElem);
+               for(TInt iGauss = 0; iGauss < aNbGauss; iGauss++){
+                 const MED::TCValueSlice& aMValueSlice = aMValueSliceArr[iGauss];
+                 float aValue = 0.0;
+                 for(TInt iComp = 0; iComp < aNbComp2; iComp++){
+                   float aVal = aMValueSlice[iComp];
+                   aValue += aVal*aVal;
+                 }
+                 aValue = sqrt(aValue);
+                 aMin = min(aMin,aValue);
+                 aMax = max(aMax,aValue);
+               }
+             }
+           }
+         }
+         for(TInt iComp = 0; iComp <= aNbComp; iComp++){
+           VISU::TMinMax aMinMax = aField->GetMinMax(iComp);
+           INITMSG(MYDEBUG,"- "<<iComp<<": "<<aMinMax.first<<"; "<<aMinMax.second<<endl);
+         }
+       }
+#ifndef _DEXCEPT_
+      }catch(std::exception& exc){
+       MSG(MYDEBUG,"Follow exception was occured in:\n"<<exc.what());
+      }catch(...){
+       MSG(MYDEBUG,"Unknown exception !!!");
+      }
+#endif
+
+#ifndef _DEXCEPT_
+    }catch(std::exception& exc){
+      MSG(MYDEBUG,"Follow exception was occured in:\n"<<exc.what());
+    }catch(...){
+      MSG(MYDEBUG,"Unknown exception !!!");
+    }
+#endif
+  }
+
+  return this; 
+}
+
+
+//---------------------------------------------------------------
+VISU_Convertor* 
+VISU_MedConvertor
+::BuildGroups()
+{
+  if(myIsGroupsDone)
+    return this;
+
+  TSetIsDone aSetIsDone(myIsGroupsDone);
+  TTimerLog aTimerLog(MYDEBUG,"BuildGroups");
+  MED::PWrapper aMed = MED::CrWrapper(myFileInfo.absFilePath().latin1());
+
+  TInt aNbMeshes = aMed->GetNbMeshes();
+  TMeshMap& aMeshMap = myMeshMap;
+
+  INITMSG(MYDEBUG,"BuildGroups - aNbMeshes = "<<aNbMeshes<<"\n");
+
+  for(TInt iMesh = 1; iMesh <= aNbMeshes; iMesh++){
+#ifndef _DEXCEPT_
+    try{
+#endif
+      TTimerLog aTimerLog(MYDEBUG,"GetPMeshInfo");
+
+      MED::PMeshInfo aMeshInfo = aMed->GetPMeshInfo(iMesh);
+      std::string aMeshName = aMeshInfo->GetName();      
+
+      TMeshMap::const_iterator anIter = aMeshMap.find(aMeshName);
+      if(anIter == aMeshMap.end())
+       continue;
+      PMEDMesh aMesh = anIter->second;
+
+      INITMSG(MYDEBUG,"aMeshName = '"<<aMeshName<<"'\n");
+
+      MED::TEntityInfo anEntityInfo = aMed->GetEntityInfo(aMeshInfo);
+      
+      MED::TEntity2TGeom2ElemInfo anEntity2TGeom2ElemInfo = 
+       MED::GetEntity2TGeom2ElemInfo(aMed,aMeshInfo,anEntityInfo);
+      
+#ifndef _DEXCEPT_
+      try{
+#endif
        MED::TFamilyInfoSet aFamilyInfoSet = MED::GetFamilyInfoSet(aMed,aMeshInfo);
        
        BuildFamilyMap(aMesh,
-                      aFamilyID2CellsSize,
-                      aEntityInfo,
+                      anEntityInfo,
                       anEntity2TGeom2ElemInfo,
                       aFamilyInfoSet,
                       aMed);
        
        BuildGroupMap(aMesh,
                      aFamilyInfoSet);
-#endif
-
-       PCalculateMinMax aCalculateMinMax(new TCalculateMinMax(aMesh,
-                                                              aEntityInfo,
-                                                              aMKey2Profile,
-                                                              aKey2Gauss,
-                                                              aMed));
-       
-       boost::thread aThread(boost::bind(&CalculateMinMax,aCalculateMinMax));
 #ifndef _DEXCEPT_
       }catch(std::exception& exc){
        MSG(MYDEBUG,"Follow exception was occured in:\n"<<exc.what());
       }catch(...){
-       EXCEPTION(runtime_error,"Unknown exception !!!");
+       MSG(MYDEBUG,"Unknown exception !!!");
       }
 #endif
 
@@ -1252,7 +1317,7 @@ VISU_MedConvertor
     }catch(std::exception& exc){
       MSG(MYDEBUG,"Follow exception was occured in:\n"<<exc.what());
     }catch(...){
-      EXCEPTION(runtime_error,"Unknown exception !!!");
+      MSG(MYDEBUG,"Unknown exception !!!");
     }
 #endif
   } 
@@ -1267,6 +1332,9 @@ VISU_MedConvertor
 ::LoadMeshOnEntity(VISU::PMeshImpl theMesh,
                   VISU::PMeshOnEntityImpl theMeshOnEntity)
 {
+  TTimerLog aTimerLog(MYDEBUG,"LoadMeshOnEntity");
+  INITMSG(MYDEBUG,"LoadMeshOnEntity"<<endl);
+
   MED::PWrapper aMed = MED::CrWrapper(myFileInfo.absFilePath().latin1());
   const TEntity& anEntity = theMeshOnEntity->myEntity;
 
@@ -1289,6 +1357,9 @@ VISU_MedConvertor
                     VISU::PMeshOnEntityImpl theMeshOnEntity, 
                     VISU::PFamilyImpl theFamily)
 {
+  TTimerLog aTimerLog(MYDEBUG,"LoadFamilyOnEntity");
+  INITMSG(MYDEBUG,"LoadFamilyOnEntity"<<endl);
+
   MED::PWrapper aMed = MED::CrWrapper(myFileInfo.absFilePath().latin1());
   const TEntity& anEntity = theMeshOnEntity->myEntity;
 
@@ -1310,6 +1381,9 @@ VISU_MedConvertor
 ::LoadMeshOnGroup(VISU::PMeshImpl theMesh, 
                  const VISU::TFamilySet& theFamilySet)
 {
+  TTimerLog aTimerLog(MYDEBUG,"LoadMeshOnGroup");
+  INITMSG(MYDEBUG,"LoadMeshOnGroup"<<endl);
+
   MED::PWrapper aMed = MED::CrWrapper(myFileInfo.absFilePath().latin1());
   int isPointsUpdated = 0, isCellsOnEntityUpdated = 0;
   TFamilySet::const_iterator aFamilyIter = theFamilySet.begin();
@@ -1337,6 +1411,9 @@ VISU_MedConvertor
                       VISU::PFieldImpl theField, 
                       VISU::PValForTimeImpl theValForTime)
 {
+  TTimerLog aTimerLog(MYDEBUG,"LoadValForTimeOnMesh");
+  INITMSG(MYDEBUG,"LoadValForTimeOnMesh"<<endl);
+
   MED::PWrapper aMed = MED::CrWrapper(myFileInfo.absFilePath().latin1());
 
   const TEntity& anEntity = theMeshOnEntity->myEntity;
@@ -1358,6 +1435,9 @@ VISU_MedConvertor
                           VISU::PFieldImpl theField, 
                           VISU::PValForTimeImpl theValForTime)
 {
+  TTimerLog aTimerLog(MYDEBUG,"LoadValForTimeOnGaussPts");
+  INITMSG(MYDEBUG,"LoadValForTimeOnGaussPts"<<endl);
+
   MED::PWrapper aMed = MED::CrWrapper(myFileInfo.absFilePath().latin1());
 
   const TEntity& anEntity = theMeshOnEntity->myEntity;
@@ -1376,6 +1456,7 @@ VISU_MedConvertor
 ::LoadPoints(const MED::PWrapper& theMed,
             VISU::PMEDMesh theMesh) 
 {
+  TTimerLog aTimerLog(MYDEBUG,"LoadValForTimeOnGaussPts");
   try{
     //Check on existing family
     PMEDMeshOnEntity aMeshOnEntity = theMesh->myMeshOnEntityMap[VISU::NODE_ENTITY];
@@ -1440,6 +1521,7 @@ VISU_MedConvertor
                     const VISU::PMEDMesh theMesh, 
                     const VISU::PMEDFamily theFamily) 
 {
+  TTimerLog aTimerLog(MYDEBUG,"LoadPointsOnFamily");
   try{
     if(theFamily->myIsDone) 
       return 0;
@@ -1477,6 +1559,7 @@ VISU_MedConvertor
                    const VISU::PMEDMesh theMesh,
                    const VISU::PMEDMeshOnEntity theMeshOnEntity)
 {
+  TTimerLog aTimerLog(MYDEBUG,"LoadCellsOnEntity");
 #ifndef _DEXCEPT_
   try{
 #endif
@@ -1703,6 +1786,7 @@ VISU_MedConvertor
                    const VISU::PMEDMeshOnEntity theMeshOnEntity,
                    const VISU::PMEDFamily theFamily)
 {
+  TTimerLog aTimerLog(MYDEBUG,"LoadCellsOnFamily");
 #ifndef _DEXCEPT_
   try{
 #endif
@@ -1776,6 +1860,7 @@ LoadProfile(const MED::PWrapper& theMed,
            VISU::TMEDValForTime& theValForTime,
            VISU::TMEDMeshOnEntity& theMeshOnEntity)
 {
+  TTimerLog aTimerLog(MYDEBUG,"LoadProfile");
   INITMSG(MYDEBUG,"LoadProfile"<<endl);
 
   PMEDProfile aProfile = theValForTime.myProfile;
@@ -1855,6 +1940,7 @@ LoadGaussMesh(const MED::PWrapper& theMed,
              VISU::TMEDValForTime& theValForTime,
              VISU::TMEDMeshOnEntity& theMeshOnEntity)
 {
+  TTimerLog aTimerLog(MYDEBUG,"LoadGaussMesh");
   INITMSG(MYDEBUG,"LoadGaussMesh"<<endl);
 
   PMEDGaussMesh aGaussMesh = theValForTime.myGaussMesh;
@@ -2026,6 +2112,7 @@ LoadValForTime(const MED::PWrapper& theMed,
               bool theIsGauss,
               bool& theIsDone)
 {
+  TTimerLog aTimerLog(MYDEBUG,"LoadValForTime");
   INITMSG(MYDEBUG,"LoadValForTime - theIsGauss = "<<theIsGauss<<endl);
 
   //Check on loading already done
@@ -2059,6 +2146,14 @@ LoadValForTime(const MED::PWrapper& theMed,
                             aMKey2Profile,
                             aKey2Gauss);
 
+  InitGaussProfile(theMed,
+                  aMeshInfo,
+                  aTimeStampVal,
+                  theMeshOnEntity,
+                  aMEntity,
+                  aGeom2Size,
+                  theValForTime);
+
   LoadProfile(theMed,
              theMesh,
              aTimeStampVal,
@@ -2075,7 +2170,6 @@ LoadValForTime(const MED::PWrapper& theMed,
   PMEDProfile aProfile = theValForTime->myProfile;
   TGeom2SubProfile& aGeom2SubProfile = aProfile->myGeom2SubProfile;
 
-  const MED::TGeom2Gauss& aGeom2Gauss = aTimeStampInfo->GetGeom2Gauss();
   TInt aNbComp = theField->myNbComp;
 
   INITMSGA(MYDEBUG,0,
index 61bb67e18d16864bdf013c57c0e499354245f8df..082c237db1eff4ae5a9b1ec995a1cbb803aa0a77 100644 (file)
@@ -130,8 +130,11 @@ namespace VISU
 
 
   //---------------------------------------------------------------
+  typedef std::map<vtkIdType,vtkIdType> TFamilyID2CellsSize;
+
   struct TMEDMeshOnEntity: virtual TMeshOnEntityImpl
   {
+    TFamilyID2CellsSize myFamilyID2CellsSize;
     MED::TGeom2Size myGeom2Size;
   };
   typedef SharedPtr<TMEDMeshOnEntity> PMEDMeshOnEntity;
@@ -167,12 +170,29 @@ class VISU_MedConvertor: public VISU_Convertor_impl
   VISU_MedConvertor();
   VISU_MedConvertor(const VISU_MedConvertor&);
   
+  bool myIsEntitiesDone;
+  bool myIsFieldsDone;
+  bool myIsGroupsDone;
+  bool myIsMinMaxDone;
+
 public:
   VISU_MedConvertor(const std::string& theFileName);
 
   virtual
   VISU_Convertor* 
-  Build();
+  BuildEntities();
+
+  virtual
+  VISU_Convertor* 
+  BuildFields();
+
+  virtual
+  VISU_Convertor* 
+  BuildMinMax();
+
+  virtual
+  VISU_Convertor* 
+  BuildGroups();
 
 protected:
   QFileInfo myFileInfo;
index 77413b197499196af361282f86a8e30f19ed158d..45dc68bcc768c0fe181b93ffa050a39ba6c49ed8 100644 (file)
@@ -162,6 +162,11 @@ namespace VISU{
   }
 
 
+  Result_ptr VISU_Gen_i::CreateResult(const char* theFileName){
+    return myVisuGen->CreateResult(theFileName);
+  }
+
+
   Result_ptr VISU_Gen_i::CopyAndImportFile(const char* theFileName){
     return myVisuGen->CopyAndImportFile(theFileName);
   }
index fbcc3b48566d514c4d1fcc1a530d787c9081e39e..d9c665ac349c8dd55080c6cd4ebfb27cfe96ac1b 100644 (file)
@@ -57,6 +57,7 @@ namespace VISU{
 
     //Create Result
     virtual Result_ptr ImportFile(const char* theFileName);
+    virtual Result_ptr CreateResult(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);
index c576c022445dd9e526d683276156256a442754bc..7cfc003b5090a7e737e2d907cc8cbc137e2ac2a9 100644 (file)
@@ -194,10 +194,10 @@ VISU_Actor
 //----------------------------------------------------------------------------
 void
 VISU_Actor
-::Update()
+::UpdateFromFactory()
 {
   myActorFactory->UpdateActor(this);
-  Superclass::Update();
+  Update();
 }
 
 void
index 6078198e93e39f381b2189ebecb9a39d77e9af51..ffeab72e279cbafa2fc4afd5f775057e9eb0abad 100644 (file)
@@ -100,7 +100,7 @@ class VTKOCC_EXPORT VISU_Actor :
   //----------------------------------------------------------------------------
   virtual
   void
-  Update();
+  UpdateFromFactory();
 
   virtual
   void
index d594f5b8f91371a1636c8845995db7e239e55161..97cee603ed74f64eeb3694ee0f1e33e018386706 100644 (file)
@@ -36,16 +36,29 @@ class VISU_Actor;
 //----------------------------------------------------------------------------
 namespace VISU 
 { 
+  //! This class defines an abstaract interface to manage actors
+  /*!
+    Actors are created by corresponding presentations and published in the defined view.
+    Each actor can be published only into one view but one presentation can have many actors.
+    Due to the complexity of the actor presentation interaction the new interface defines common 
+    and simply way to manage them properly.
+    @note
+    This interface inherits from boost::bsignals::trackable in order to provide automatic 
+    diconnection from defined signals if the object is destroyed.
+  */
   struct TActorFactory: public virtual boost::bsignals::trackable
   {
+    //! Just to make this class virtual
     virtual 
     ~TActorFactory()
     {}
 
+    //! To update the actor
     virtual 
     void
     UpdateActor(VISU_Actor* theActor) = 0;
 
+    //! To unregister the actor
     virtual 
     void
     RemoveActor(VISU_Actor* theActor) = 0;
index e9850df950174a97c37b5ae5c3455a1886c7cb4f..7c613cf209e2a1d6091efdeacec937a8e08cc902 100644 (file)
@@ -30,6 +30,7 @@
 #define VISU_Event_h
 
 #include "SVTK_Event.h"
+#include "SVTK_Selection.h"
 
 namespace VISU
 {
@@ -40,5 +41,7 @@ namespace VISU
     LastEvent
   };
 }
+
+const Selection_Mode GaussPointSelection = 100;
   
 #endif
index b171488862d398504aa795c191143979d45731c2..2d579106683ad738f64dde6b102beae8ca008041 100644 (file)
@@ -35,6 +35,8 @@
 #include "VISU_ScalarBarCtrl.hxx"
 #include "VISU_ScalarBarActor.hxx"
 
+#include "SALOME_ExtractGeometry.h"
+
 #include "VISU_Event.h" 
 #include "SVTK_Actor.h"
 
 #include <vtkTextProperty.h>
 
 #include <vtkCellData.h>
+#include <vtkPointData.h>
+
 #include <vtkDataArray.h>
+#include <vtkFloatArray.h>
 
 #include <vtkSphereSource.h>
 #include <vtkPolyDataMapper.h>
@@ -304,6 +309,9 @@ VISU_GaussPtsAct
     theWidgetCtrl->AddObserver(vtkCommand::DisableEvent, 
                               myEventCallbackCommand.GetPointer(), 
                               myPriority);
+    theWidgetCtrl->AddObserver(vtkCommand::StartInteractionEvent, 
+                              myEventCallbackCommand.GetPointer(), 
+                              myPriority);
     theWidgetCtrl->AddObserver(vtkCommand::EndInteractionEvent, 
                               myEventCallbackCommand.GetPointer(), 
                               myPriority);
@@ -497,37 +505,37 @@ bool VISU_GaussPtsAct::PreHighlight(vtkInteractorStyle* theInteractorStyle,
     return false;
   }
 
-  if(theSelectionEvent->mySelectionMode == ActorSelection || !theIsHighlight)
-    return Superclass::PreHighlight(theInteractorStyle,
-                                   theSelectionEvent,
-                                   theIsHighlight);
-
+  if(!theIsHighlight)
+    myLastObjPointID = -1;
 
-  bool anIsSelectionModeChanged = (theSelectionEvent->mySelectionMode != mySelectionMode);
-  if(!anIsSelectionModeChanged && mySelectionMode == ActorSelection)
-    return false;
+  Selection_Mode aSelectionMode = theSelectionEvent->mySelectionMode;
 
-  mySelectionMode = theSelectionEvent->mySelectionMode;
-
-  bool anIsChanged = false;
-  if(theIsHighlight){
-    switch(mySelectionMode){
-    case NodeSelection: 
-    case CellSelection:
-    {
-      myPointPicker->Pick(theSelectionEvent->myX, 
-                         theSelectionEvent->myY, 
-                         0.0, 
-                         theInteractorStyle->GetCurrentRenderer());
-
-      if(myPointPicker->GetActor() != this)
-       return false;
-      
-      vtkIdType aVtkId = myPointPicker->GetPointId();
-      
-      if(aVtkId >= 0 && mySelector->IsValid(this,aVtkId,true) && hasIO()){
-       vtkIdType anObjId = GetNodeObjId( aVtkId );
-       if(myLastObjPointID != anObjId){
+  if(aSelectionMode == ActorSelection || !theIsHighlight)
+    return Superclass::PreHighlight(theInteractorStyle,
+                                   theSelectionEvent,
+                                   theIsHighlight);  
+  
+  bool anIsChanged = (mySelectionMode != aSelectionMode);
+  bool anIsPreselected = myIsPreselected;
+  myIsPreselected = false;
+  
+  if(aSelectionMode == GaussPointSelection && theIsHighlight){
+    myPointPicker->Pick(theSelectionEvent->myX, 
+                       theSelectionEvent->myY, 
+                       0.0, 
+                       theInteractorStyle->GetCurrentRenderer());
+    
+    if(myPointPicker->GetActor() != this)
+      return (anIsPreselected != myIsPreselected);
+    
+    vtkIdType aVtkId = myPointPicker->GetPointId();
+    
+    if(aVtkId >= 0 && mySelector->IsValid(this,aVtkId,true) && hasIO()){
+      vtkIdType anObjId = GetNodeObjId( aVtkId );
+      myIsPreselected = (anObjId >= 0);
+      if(myIsPreselected){
+       anIsChanged = (myLastObjPointID != anObjId);
+       if(anIsChanged){
          float* aNodeCoord = GetNodeCoord(anObjId);
          vtkDataSet* aDataSet = GetInput();
          vtkCellData* aCellData = aDataSet->GetCellData();
@@ -535,44 +543,89 @@ bool VISU_GaussPtsAct::PreHighlight(vtkInteractorStyle* theInteractorStyle,
            float aRadius = myGaussPointsPL->GetPointSize(aVtkId,aScalarArray);
            float aPyramidHeight = myPickingSettings->GetPyramidHeight();
            aPyramidHeight = aPyramidHeight*myGaussPointsPL->GetMaxPointSize();
+           //float aColor[3] = myPreHighlightActor->GetProperty()->GetColor();
+           float aColor[3];
+           theInteractorStyle->GetCurrentRenderer()->GetBackground( aColor );
+           aColor[0] = 1. - aColor[0];
+           aColor[1] = 1. - aColor[1];
+           aColor[2] = 1. - aColor[2];
            myCursorPyramid->Init(aPyramidHeight,
                                  aRadius,
                                  aNodeCoord,
-                                 myPreHighlightActor->GetProperty()->GetColor()); 
+                                 aColor);
          }
          myLastObjPointID = anObjId;
        }
        myCursorPyramid->SetVisibility(true);
-       myIsPreselected = theIsHighlight;
-       anIsChanged = true;
       }
     }
-    break;
-    }
   }
+  
+  mySelectionMode = aSelectionMode;
+  anIsChanged |= (anIsPreselected != myIsPreselected);
 
   return anIsChanged;
 }
 
 
 //----------------------------------------------------------------------------
+inline
+void
+ChangeZoom(VISU_PickingSettings *thePickingSettings,
+          vtkInteractorStyle* theInteractorStyle,
+          int theInitialHasIndex,
+          SVTK_Selector* theSelector,
+          const Handle(SALOME_InteractiveObject)& theIO)
+{
+  int aCurrentHasIndex = theSelector->HasIndex(theIO);
+
+  if(theInitialHasIndex + aCurrentHasIndex == 1){
+    vtkRenderer *aRenderer = theInteractorStyle->GetCurrentRenderer();
+    vtkCamera *aCamera = aRenderer->GetActiveCamera();
+    float aZoomFactor = thePickingSettings->GetZoomFactor();
+    double aScale = aCamera->GetParallelScale();
+    if (!theInitialHasIndex && aCurrentHasIndex) {
+      aCamera->SetParallelScale(aScale/aZoomFactor);
+    }
+    else {
+      aCamera->SetParallelScale(aScale*aZoomFactor);
+    }
+  }
+  
+}
+
 bool VISU_GaussPtsAct::Highlight(vtkInteractorStyle* theInteractorStyle, 
                                 SVTK_SelectionEvent* theSelectionEvent,
                                 bool theIsHighlight)
 { 
+  Handle(SALOME_InteractiveObject) anIO = getIO();
+  int anInitialHasIndex = mySelector->HasIndex(anIO);
+
+  Selection_Mode aSelectionMode = theSelectionEvent->mySelectionMode;
+  //
+  if(!theIsHighlight && aSelectionMode == GaussPointSelection){
+    mySelector->RemoveIObject(anIO);
+
+    ChangeZoom(myPickingSettings,
+              theInteractorStyle,
+              anInitialHasIndex,
+              mySelector.GetPointer(),
+              anIO);
+
+    return true;
+  }
+  
   if (!myBarVisibility) {
     return false;
   }
   //
-  Selection_Mode aSelectionMode = theSelectionEvent->mySelectionMode;
-  //
   if(aSelectionMode == ActorSelection){
     return Superclass::Highlight(theInteractorStyle,
                                 theSelectionEvent,
                                 theIsHighlight);
   }
   //
-  if(!theSelectionEvent->myIsRectangle){
+  if(aSelectionMode == GaussPointSelection && !theSelectionEvent->myIsRectangle){
 
     vtkRenderer *aRenderer = theInteractorStyle->GetCurrentRenderer();
     myPointPicker->Pick(theSelectionEvent->myX, 
@@ -582,6 +635,13 @@ bool VISU_GaussPtsAct::Highlight(vtkInteractorStyle* theInteractorStyle,
 
     if(myPointPicker->GetActor() != this) {
       mySelector->ClearIObjects();
+
+      ChangeZoom(myPickingSettings,
+                theInteractorStyle,
+                anInitialHasIndex,
+                mySelector.GetPointer(),
+                anIO);
+
       return true;
     }
 
@@ -616,11 +676,23 @@ bool VISU_GaussPtsAct::Highlight(vtkInteractorStyle* theInteractorStyle,
        
        mySelectionMode = aSelectionMode;
 
+       ChangeZoom(myPickingSettings,
+                  theInteractorStyle,
+                  anInitialHasIndex,
+                  mySelector.GetPointer(),
+                  anIO);
+
        return true;
        //
       }// if( anObjId >= 0 ) {
     }//if( aVtkId >= 0  && mySelector->IsValid( this, aVtkId, true ) && hasIO()) 
   }//if(!theSelectionEvent->myIsRectangle){
+
+  ChangeZoom(myPickingSettings,
+            theInteractorStyle,
+            anInitialHasIndex,
+            mySelector.GetPointer(),
+            anIO);
   
   return false;
 }
@@ -643,8 +715,12 @@ VISU_GaussPtsAct
 
   bool anIsVisible = GetVisibility();
 
-  if(mySelector->SelectionMode() == ActorSelection)
+  Selection_Mode aSelectionMode = mySelector->SelectionMode();
+
+  if(aSelectionMode == ActorSelection)
     Superclass::highlight(theIsHighlight);
+  else if(aSelectionMode != GaussPointSelection)
+    return;
 
   TColStd_IndexedMapOfInteger aMapIndex;
   mySelector->GetIndex( getIO(), aMapIndex );
@@ -664,12 +740,9 @@ VISU_GaussPtsAct
     float aWorldCoord[4] = {aNodeCoord[0], aNodeCoord[1], aNodeCoord[2], 1.};
     //
     vtkDataSet* aDataSet = GetInput();
-    vtkCellData* aCellData = aDataSet->GetCellData();
+    vtkCellData* aDataSetAttributes = aDataSet->GetCellData();
     //
-    vtkDataArray* aScalarArray = aCellData->GetScalars();
-    vtkDataArray *aVectorArray = aCellData->GetVectors();
-    // 
-    if(aScalarArray){
+    if(vtkDataArray* aScalarArray = aDataSetAttributes->GetScalars()){
       aVal = aScalarArray->GetTuple1(aVtkId);
       aRadius = myGaussPointsPL->GetPointSize(aVtkId, aScalarArray);
       //
@@ -678,7 +751,7 @@ VISU_GaussPtsAct
       GetScalarBarCtrl()->Update();
       //
       float aPyramidHeight = myPickingSettings->GetPyramidHeight();
-      aPyramidHeight=aPyramidHeight*myGaussPointsPL->GetMaxPointSize();
+      aPyramidHeight = aPyramidHeight*myGaussPointsPL->GetMaxPointSize();
       myCursorPyramidSelected->Init(aPyramidHeight,
                                    aRadius,
                                    aNodeCoord,
@@ -700,9 +773,20 @@ VISU_GaussPtsAct
       aStr<<"\nLocalPntID: "<<aLocalPntID;
       aStr<<"\nScalar: "<<aVal;
     }
-    if(aVectorArray) {
-      float* pVec = aVectorArray->GetTuple3(aVtkId);
-      aStr<<"\nVector: {"<<pVec[0]<<"; "<<pVec[1]<<"; "<<pVec[2]<<"}";
+
+    if(vtkDataArray* aFieldArray = aDataSetAttributes->GetArray("VISU_FIELD")){
+      if(vtkFloatArray *aFloatArray = dynamic_cast<vtkFloatArray*>(aFieldArray)){
+       int aNbComp = aFloatArray->GetNumberOfComponents();
+       aStr<<"\nData: {";
+       int anId = 0;
+       while(anId < aNbComp){
+         float aComp = aFloatArray->GetComponent(aVtkId,anId++);
+         aStr<<aComp;
+         if(anId < aNbComp)
+           aStr<<"; ";
+       }
+       aStr<<"}";
+      }
     }
     //
     // myTextActor
@@ -748,23 +832,28 @@ VISU_GaussPtsAct
   myPickingSettings = thePickingSettings;
 
   if(thePickingSettings)
+  {
     thePickingSettings->AddObserver(VISU::UpdatePickingSettingsEvent, 
                                    myEventCallbackCommand.GetPointer(), 
                                    myPriority);
+    this->UpdatePickingSettings();
+  }
 }
 
 void
 VISU_GaussPtsAct
 ::UpdatePickingSettings()
 {
-  // Update picking parameters using myPickingSettings object
   myTextActor->SetModePosition(myPickingSettings->GetInfoWindowPosition());
   myTextActor->SetTransparency(myPickingSettings->GetInfoWindowTransparency());
-  float aHeight=
-    myGaussPointsPL->GetMaxPointSize()*myPickingSettings->GetPyramidHeight();
+
+  float aHeight = myGaussPointsPL->GetMaxPointSize()*myPickingSettings->GetPyramidHeight();
   myCursorPyramid->SetHeight(aHeight);
   myCursorPyramidSelected->SetHeight(aHeight);
-  //
+
+  myHighlightActor->GetProperty()->SetColor( myPickingSettings->GetColor() );
+  myPointPicker->SetTolerance( myPickingSettings->GetPointTolerance() );
+
   Highlight(isHighlighted());
 
   Update();
@@ -921,8 +1010,6 @@ VISU_GaussPtsAct1
 
     myOutsideDeviceActor->GetPipeLine()->SetImplicitFunction(NULL);  
     myOutsideDeviceActor->SetVisibility(false);
-
-    myCurrentPL = myDeviceActor->GetPipeLine();
   }
 
   if(theWidgetCtrl){
@@ -954,14 +1041,16 @@ VISU_GaussPtsAct1
 
   if(VISU_GaussPointsPL* aPipeLine = CreatePipeLine(GetGaussPointsPL())){
     myInsideDeviceActor->SetPipeLine(aPipeLine);
+    aPipeLine->Delete();
   }
 
   if(VISU_GaussPointsPL* aPipeLine = CreatePipeLine(GetGaussPointsPL())){
     myOutsideDeviceActor->SetPipeLine(aPipeLine);
+    aPipeLine->Delete();
 
-    myOutsideDeviceActor->GetMapper()->ScalarVisibilityOff();
-
-    myOutsideDeviceActor->GetPipeLine()->SetExtractInside(true);
+    SALOME_ExtractGeometry* anExtractGeometry = aPipeLine->GetExtractGeometryFilter();
+    anExtractGeometry->SetExtractBoundaryCells(true);
+    anExtractGeometry->SetExtractInside(true);
   }
 }
 
@@ -1012,9 +1101,12 @@ VISU_GaussPtsAct1
   myOutsideCursorSettings = theOutsideCursorSettings;
 
   if(theOutsideCursorSettings)
+  {
     theOutsideCursorSettings->AddObserver(VISU::UpdateOutsideSettingsEvent, 
                                          myEventCallbackCommand.GetPointer(), 
                                          myPriority);
+    this->UpdateOutsideCursorSettings();
+  }
 }
 
 void
@@ -1066,8 +1158,14 @@ VISU_GaussPtsAct1
 ::OnInteractorEvent(unsigned long theEvent)
 {
   switch(theEvent){
+  case vtkCommand::StartInteractionEvent: 
+    myDeviceActor->SetVisibility(GetVisibility());
+    myInsideDeviceActor->SetVisibility(false);
+    myOutsideDeviceActor->SetVisibility(false);
+    break;
   case vtkCommand::EnableEvent: 
   case vtkCommand::DisableEvent:
+  case vtkCommand::EndInteractionEvent:
     myDeviceActor->SetVisibility(GetVisibility() && !myWidgetCtrl->GetEnabled());
     myInsideDeviceActor->SetVisibility(GetVisibility() && myWidgetCtrl->GetEnabled());
     myOutsideDeviceActor->SetVisibility(GetVisibility() && myWidgetCtrl->GetEnabled());
@@ -1075,18 +1173,6 @@ VISU_GaussPtsAct1
   default:
     break;
   }
-
-  
-  switch(theEvent){
-  case vtkCommand::EnableEvent: 
-    myCurrentPL = myInsideDeviceActor->GetPipeLine();
-    break;
-  case vtkCommand::DisableEvent:
-    myCurrentPL = myDeviceActor->GetPipeLine();
-    break;
-  default:
-    break;
-  }
   
   Superclass::OnInteractorEvent(theEvent);
 }
@@ -1139,6 +1225,7 @@ VISU_GaussPtsAct2
   if(VISU_GaussPointsPL* aPipeLine = CreatePipeLine(GetGaussPointsPL())){
     myDeviceActor->SetPipeLine(aPipeLine);
     myCurrentPL = aPipeLine;
+    aPipeLine->Delete();
   }
 }
 
index e69f235665cbdffbc680ae4b566c200f8c48a7bf..13eec03f3df0de77d229980e255a4ad786fb3a64 100644 (file)
@@ -65,6 +65,16 @@ class VISU_OutsideCursorSettings;
 
 
 //============================================================================
+//! Base class for Gauss Points Actors.
+/*!
+  The actor is responsible for representation of Gauss Points.
+  It render corresponding presentation by usage of corresponding VISU_GaussPtsDeviceActor.
+  Usage of such technic of rendering gives addititional flexibility to change its behaviour in run-time.
+  Also, the base class implements the following functionality:
+  - implements a highlight and prehighlight functionality;
+  - defining a way to handle VISU_ImplicitFunctionWidget;
+  - global / local scalar bar mamangement.
+*/
 class VTKOCC_EXPORT VISU_GaussPtsAct : public VISU_Actor
 {
  public:
@@ -88,14 +98,17 @@ class VTKOCC_EXPORT VISU_GaussPtsAct : public VISU_Actor
   ShallowCopyPL(VISU_PipeLine* thePipeLine);
 
   //----------------------------------------------------------------------------
+  //! Redefined method of getting a native mapper of the actor.
   virtual
   vtkMapper* 
   GetMapper();
 
+  //! Redefined method of getting an actor bounds.
   virtual
   float* 
   GetBounds();
 
+  //! Redefined method of getting an actor input.
   virtual
   vtkDataSet* 
   GetInput(); 
@@ -109,59 +122,75 @@ class VTKOCC_EXPORT VISU_GaussPtsAct : public VISU_Actor
   GetGaussPtsFactory();    
 
   //----------------------------------------------------------------------------
+  //! Add actor to the renderer.
   virtual
   void
   AddToRender(vtkRenderer* theRenderer); 
 
+  //! Remove actor from the renderer.
   virtual
   void
   RemoveFromRender(vtkRenderer* theRenderer);
 
+  //! Set the Render Window Interactor to the actor.
   virtual
   void
   SetInteractor(vtkRenderWindowInteractor* theInteractor);
 
+  //! Apply the transform on the actor.
   virtual
   void
   SetTransform(VTKViewer_Transform* theTransform);
 
+  //! Redefined method of rendering the Opaque Geometry.
   virtual
   int
   RenderOpaqueGeometry(vtkViewport *viewport);
 
+  //! Redefined method of rendering the Translucent Geometry.
   virtual
   int
   RenderTranslucentGeometry(vtkViewport *viewport);
 
   //----------------------------------------------------------------------------
+  //! Set actor visibility.
   virtual
   void
   SetVisibility(int theMode);
 
+  //! Set Scalar Bar Control to the actor.
   VISU_ScalarBarCtrl* 
   GetScalarBarCtrl();
 
+  //! Set the Scalar Bar Control visibility.
   void
   SetBarVisibility(bool theMode);
 
+  //! Get the Scalar Bar Control visibility.
   bool
   GetBarVisibility();
 
   virtual void SetWidgetCtrl(VISU_WidgetCtrl* theWidgetCtrl);
 
+  //! Return the information about pipeline magnification changing.
+  /*! True indicates that magnification is increased, false - decreased. */
   bool
   ChangeMagnification();
 
   //----------------------------------------------------------------------------
+  //! Internal highlight.
   virtual
   void
   Highlight(bool theIsHighlight);
  
+  //! Redefined method of the actor's prehighlighting 
   virtual
   bool
   PreHighlight(vtkInteractorStyle* theInteractorStyle, 
               SVTK_SelectionEvent* theSelectionEvent,
               bool theIsHighlight);
+
+  //! Redefined method of the actor's highlighting 
   virtual
   bool
   Highlight(vtkInteractorStyle* theInteractorStyle, 
@@ -169,6 +198,7 @@ class VTKOCC_EXPORT VISU_GaussPtsAct : public VISU_Actor
            bool theIsHighlight);
 
   //----------------------------------------------------------------------------
+  //! Set the picking settings to the actor.
   void
   SetInsideCursorSettings(VISU_InsideCursorSettings* theInsideCursorSettings);
 
@@ -182,6 +212,7 @@ class VTKOCC_EXPORT VISU_GaussPtsAct : public VISU_Actor
   void
   SetPickingSettings(VISU_PickingSettings* thePickingSettings);
 
+  //! Apply the picking settings on the actor.
   void
   UpdatePickingSettings();
 
@@ -196,6 +227,7 @@ class VTKOCC_EXPORT VISU_GaussPtsAct : public VISU_Actor
   virtual 
   ~VISU_GaussPtsAct();
 
+  // Redefined method of setting mapper input.
   virtual 
   void
   SetMapperInput(vtkDataSet* theDataSet);
@@ -207,13 +239,15 @@ class VTKOCC_EXPORT VISU_GaussPtsAct : public VISU_Actor
   //----------------------------------------------------------------------------
   vtkSmartPointer<vtkCallbackCommand> myEventCallbackCommand;
 
-  // Main process VTK event method
+  //! Main process VTK event method
   static
   void
   ProcessEvents(vtkObject* theObject, 
                unsigned long theEvent,
                void* theClientData, 
                void* theCallData);
+
+  // To process VTK event method
   virtual
   void
   OnInteractorEvent(unsigned long theEvent);
@@ -252,6 +286,12 @@ class VTKOCC_EXPORT VISU_GaussPtsAct : public VISU_Actor
 //============================================================================
 class VISU_GaussPtsAct2;
 
+//! Gauss Points Actor, displayed in the Base View.
+/*!
+ * Contains device actor (VISU_GaussPtsDeviceActor),
+ * which has two representation modes - outside and
+ * inside segmentation cursor.
+ */
 class VTKOCC_EXPORT VISU_GaussPtsAct1 : public VISU_GaussPtsAct
 {
  public:
@@ -266,6 +306,7 @@ class VTKOCC_EXPORT VISU_GaussPtsAct1 : public VISU_GaussPtsAct
   ShallowCopyPL(VISU_PipeLine* thePipeLine);
 
   //----------------------------------------------------------------------------
+  //! Set actor visibility.
   virtual
   void
   SetVisibility(int theMode);
@@ -279,21 +320,26 @@ class VTKOCC_EXPORT VISU_GaussPtsAct1 : public VISU_GaussPtsAct
   UpdateInsideCursorSettings();
 
   //----------------------------------------------------------------------------
+  //! Set the Outside Cursor Gauss Points settings to the actor.
   void
   SetOutsideCursorSettings(VISU_OutsideCursorSettings* theOutsideCursorSettings);
 
+  //! Apply the Outside Cursor Gauss Points settings on the actor.
   void
   UpdateOutsideCursorSettings();
 
   //----------------------------------------------------------------------------
+  //! Add actor to the renderer.
   virtual
   void
   AddToRender(vtkRenderer* theRenderer); 
 
+  //! Remove actor from the renderer.
   virtual
   void
   RemoveFromRender(vtkRenderer* theRenderer);
 
+  //! Apply the transform on the actor.
   virtual
   void
   SetTransform(VTKViewer_Transform* theTransform);
@@ -307,6 +353,7 @@ class VTKOCC_EXPORT VISU_GaussPtsAct1 : public VISU_GaussPtsAct
   virtual 
   ~VISU_GaussPtsAct1();
 
+  // Redefined method of setting mapper input.
   virtual 
   void
   SetMapperInput(vtkDataSet* theDataSet);
@@ -334,7 +381,7 @@ class VTKOCC_EXPORT VISU_GaussPtsAct1 : public VISU_GaussPtsAct
 };
 
 
-//============================================================================
+//! Gauss Points Actor, displayed in the Segmented View.
 class VTKOCC_EXPORT VISU_GaussPtsAct2 : public VISU_GaussPtsAct
 {
  public:
@@ -344,6 +391,7 @@ class VTKOCC_EXPORT VISU_GaussPtsAct2 : public VISU_GaussPtsAct
   VISU_GaussPtsAct2* 
   New();
 
+  // Redefined method of setting mapper input.
   virtual 
   void
   SetMapperInput(vtkDataSet* theDataSet);
@@ -353,10 +401,12 @@ class VTKOCC_EXPORT VISU_GaussPtsAct2 : public VISU_GaussPtsAct
   ShallowCopyPL(VISU_PipeLine* thePipeLine);
 
   //----------------------------------------------------------------------------
+  //! Set actor visibility.
   virtual
   void
   SetVisibility(int theMode);
 
+  //! Get actor visibility.
   virtual
   int
   GetVisibility();
index 9557c60af57186a5adf8313b4eb7ee3442fb965b..ba785efc004ef80eddbca07e02bc249b1fc47a9d 100644 (file)
@@ -38,12 +38,15 @@ class VISU_GaussPtsAct2;
 //----------------------------------------------------------------------------
 namespace VISU 
 { 
+  //! Extend an abstaract interface to manage Gauss points actors
   struct TGaussPtsActorFactory: virtual TActorFactory
   {
+    //! To create VISU_GaussPtsAct2 actor (segemented representation) from VISU_GaussPtsAct1 (basic representation)
     virtual 
     VISU_GaussPtsAct2* 
     CloneActor(VISU_GaussPtsAct1* theActor) = 0;
 
+    //! The VISU_GaussPtsAct can update its presentation
     virtual 
     void
     UpdateFromActor(VISU_GaussPtsAct* theActor) = 0;
index 86eb25d28ca33793a8c8960166342ba94c96a82b..519a74da5ebfcfb88287aaf4e6c4ea7f1399362b 100644 (file)
@@ -40,6 +40,9 @@
 #include <vtkPolyData.h>
 #include <vtkRenderer.h>
 #include <vtkTextProperty.h>
+#include <vtkProperty.h>
+#include <vtkTexture.h>
+
 #include "utilities.h"
 
 #ifdef _DEBUG_
@@ -80,6 +83,46 @@ VISU_GaussPtsDeviceActor
 }
 
 
+//----------------------------------------------------------------
+void
+VISU_GaussPtsDeviceActor
+::Render(vtkRenderer *ren, vtkMapper *vtkNotUsed(m))
+{
+  if (this->Mapper == NULL)
+    {
+    vtkErrorMacro("No mapper for actor.");
+    return;
+    }
+  
+  // render the property
+  if (!this->Property)
+    {
+    // force creation of a property
+    this->GetProperty();
+    }
+  this->Property->Render(this, ren);
+  if (this->BackfaceProperty)
+    {
+    this->BackfaceProperty->BackfaceRender(this, ren);
+    this->Device->SetBackfaceProperty(this->BackfaceProperty);
+    }
+  this->Device->SetProperty(this->Property);  
+  
+  // render the texture
+  if (this->Texture)
+    {
+    this->Texture->Render(ren);
+    }
+  
+  // make sure the device has the same matrix
+  vtkMatrix4x4 *matrix = this->Device->GetUserMatrix();
+  this->GetMatrix(matrix);
+  
+  this->Device->Render(ren,Mapper);  
+  this->EstimatedRenderTime = Mapper->GetTimeToDraw();
+}
+
+
 //----------------------------------------------------------------
 void
 VISU_GaussPtsDeviceActor
index 4f4d5e3e88dbbda3cf2dbebc0e61cad38a28a208..41f4ebd3b375cd9ee8c1e646caaabb1404f7547e 100644 (file)
@@ -52,6 +52,10 @@ class VISU_GaussPtsDeviceActor: public vtkLODActor
   VISU_GaussPtsDeviceActor* 
   New();
 
+  virtual
+  void
+  Render(vtkRenderer *, vtkMapper *);
+
   //----------------------------------------------------------------------------
   void
   AddToRender(vtkRenderer* theRenderer); 
index b0b36ab67327004f41828fca068a6af4e94f3e7e..d7e5d1ea17bc408b1fa8c8e1d087baea0d09b8b3 100644 (file)
@@ -83,6 +83,10 @@ VISU_PickingSettings::VISU_PickingSettings()
   this->Initial                = true;
 
   this->PyramidHeight          = -1;
+  this->PointTolerance         = -1;
+  this->Color[0]               = -1;
+  this->Color[1]               = -1;
+  this->Color[1]               = -1;
   this->InfoWindowTransparency = -1;
   this->InfoWindowPosition     = -1;
   this->ZoomFactor             = -1;
index 12f241f984d67d5cafe3bc7fb0490acf96e2a333..8f53ecae65060669428d3c93262cac36ac5a0543 100644 (file)
@@ -100,6 +100,12 @@ private:
 
 
 //============================================================================
+//! Class of Outside Cursor Gauss Points settings.
+/*!
+ * Contains information about the point sprite parameters:
+ * Clamp, Texture, Alpha threshold, Const size and Color.
+ * Used by Gauss Points Actor.
+ */
 class VISU_OutsideCursorSettings : public vtkObject
 {
  public:
@@ -149,7 +155,14 @@ private:
 };
 
 
-//============================================================================
+//! Class of Picking settings.
+/*!
+ * Contains information about the following parameters:
+ * Cursor Pyramid height, Info Window transparency,
+ * Info Window position, Zoom factor on first selected point,
+ * Camera movement steps number and Display parent mesh.
+ * Used by Gauss Points Actor.
+ */
 class VISU_PickingSettings : public vtkObject
 {
  public:
@@ -171,6 +184,12 @@ class VISU_PickingSettings : public vtkObject
   vtkSetMacro( PyramidHeight, float );
   vtkGetMacro( PyramidHeight, float );
 
+  vtkSetVector3Macro( Color, float );
+  vtkGetVector3Macro( Color, float );
+
+  vtkSetMacro( PointTolerance, float );
+  vtkGetMacro( PointTolerance, float );
+
   vtkSetMacro( InfoWindowTransparency, float );
   vtkGetMacro( InfoWindowTransparency, float );
 
@@ -190,6 +209,8 @@ private:
   bool                Initial;
 
   float               PyramidHeight;
+  float               PointTolerance;
+  float               Color[3];
   float               InfoWindowTransparency;
   int                 InfoWindowPosition;
   float               ZoomFactor;
index a2f495ec8e3a4ab5c85dec1aee40516b18267c24..cc97361b78b29eb8024a65fa72472040c9a864ca 100644 (file)
@@ -52,6 +52,7 @@ EXPORT_HEADERS = \
        VISU_Plot3DPL.hxx \
        VISU_OpenGLPointSpriteMapper.hxx \
        VISU_ImplicitFunctionWidget.hxx \
+       SALOME_ExtractGeometry.h \
        VISU_ScalarBarCtrl.hxx \
        VISU_PlanesWidget.hxx \
        VISU_SphereWidget.hxx \
index 6b182da22977a6e9fe77db9a7599890de02cfb20..63e26e038b97dec56bb789aff5cf08807efcb484 100644 (file)
@@ -62,7 +62,6 @@ execute(int theNbElems,
 {
   if(theNbElems < 1 )
     return;
-  vtkDataArray* aVectors = theInputData->GetVectors();
   vtkDataArray* aFieldArray = theInputData->GetArray("VISU_FIELD");
   if(vtkFloatArray *aFloatArray = dynamic_cast<vtkFloatArray*>(aFieldArray)){
     int aNbComp = aFloatArray->GetNumberOfComponents();
@@ -104,6 +103,7 @@ void VISU_Extractor::Execute(){
     else
       output->GetPointData()->CopyScalarsOn();
     outData->PassData(inData);
+    outData->AddArray(inData->GetArray("VISU_FIELD"));
   }else{
     output->GetCellData()->CopyVectorsOn();
     int aNbElems = input->GetNumberOfCells();
@@ -113,5 +113,6 @@ void VISU_Extractor::Execute(){
     else
       output->GetCellData()->CopyScalarsOn();
     outData->PassData(inData);
+    outData->AddArray(inData->GetArray("VISU_FIELD"));
   }
 }
index 8ecdeabbcefbd79544debdfd27cd5ebdb6191042..7e24000cf5abdfadf0d03c76f0396e7fad0f9716 100644 (file)
@@ -46,6 +46,11 @@ class vtkCellDataToPointData;
 class vtkWarpVector;
 class SALOME_Transform;
 
+//! Pipeline for the Gauss Points presentation.
+/*!
+ * This class uses the special mapper (VISU_OpenGLPointSpriteMapper)
+ * for rendering the Gauss Points as Point Sprites.
+ */
 class VISU_GaussPointsPL : public VISU_ScalarMapPL
 {
 protected:
@@ -64,17 +69,21 @@ public:
   void
   ShallowCopy(VISU_PipeLine *thePipeLine);
 
+  //! Get the native mapper.
   virtual
   TMapper* 
   GetMapper();
 
+  //! Get the internal #VISU_OpenGLPointSpriteMapper.
   VISU_OpenGLPointSpriteMapper*
   GetPSMapper();
 
+  //! Redefined method for building the pipeline.
   virtual
   void
   Build();
 
+  //! Redefined method for updating the pipeline.
   virtual
   void
   Update();
@@ -89,13 +98,27 @@ public:
   const VISU::PGaussPtsIDMapper&  
   GetGaussPtsIDMapper() const;
 
+  //! Set the Bicolor mode.
+  /*!
+   * When the Bicolor parameter is set to true, scalar bars are
+   * drawing with two colors : red color correspoonds to positive
+   * scalar values, blue color - to negative values.
+   */
   void
   SetBicolor(bool theBicolor);
 
+  //! Get the Bicolor mode.
   bool
   GetBicolor();
 
-  void SetIsColored(bool theIsColored);
+  //! Set the Multicolored mode.
+  /*!
+   * This parameter is using to switch between Results and Geometry
+   * modes. Multiple colors are using when the presentation is
+   * drawing in the Results mode, one color - in the Geometry mode.
+   */
+  void
+  SetIsColored(bool theIsColored);
 
   void
   SetPrimitiveType(int thePrimitiveType);
@@ -103,66 +126,91 @@ public:
   int
   GetPrimitiveType() { return myPrimitiveType; }
 
+  //! Get the maximum Point Sprite size, which is supported by hardware.
   float 
   GetMaximumSupportedSize();
 
+  //! Redirect the request to VISU_OpenGLPointSpriteMapper::SetPointSpriteClamp.
   void
   SetClamp(float theClamp);
 
+  //! Redirect the request to VISU_OpenGLPointSpriteMapper.vtkGetMacro(PointSpriteClamp, float).
   float
   GetClamp() { return myClamp; }
 
+  //! Redirect the request to VISU_OpenGLPointSpriteMapper::SetPointSpriteSize.
   void
   SetSize(float theSize);
 
+  //! Redirect the request to VISU_OpenGLPointSpriteMapper.vtkGetMacro(PointSpriteSize, float).
   float 
   GetSize() { return mySize; }
 
+  //! Redirect the request to VISU_OpenGLPointSpriteMapper::SetPointSpriteMinSize.
   void
   SetMinSize(float theMinSize);
 
+  //! Redirect the request to VISU_OpenGLPointSpriteMapper.vtkGetMacro(PointSpriteMinSize, float).
   float 
   GetMinSize() { return myMinSize; }
 
+  //! Redirect the request to VISU_OpenGLPointSpriteMapper::SetPointSpriteMinSize.
   void
   SetMaxSize(float theMaxSize);
 
+  //! Redirect the request to VISU_OpenGLPointSpriteMapper.vtkGetMacro(PointSpriteMaxSize, float).
   float 
   GetMaxSize() { return myMaxSize; }
 
+  //! Redirect the request to VISU_OpenGLPointSpriteMapper::SetPointSpriteMagnification.
   void
   SetMagnification(float theMagnification);
 
+  //! Redirect the request to VISU_OpenGLPointSpriteMapper.vtkGetMacro(PointSpriteMagnification, float).
   float
   GetMagnification() { return myMagnification; }
 
+  //! Set the increment of changing Magnification parameter.
   void
   SetMagnificationIncrement(float theIncrement);
 
+  //! Get the increment of changing Magnification parameter.
   float
   GetMagnificationIncrement() { return myMagnificationIncrement; }
 
+  //! Redirect the request to VISU_OpenGLPointSpriteMapper::SetPointSpriteAlphaThreshold.
   void
   SetAlphaThreshold(float theAlphaThreshold);
 
+  //! Redirect the request to VISU_OpenGLPointSpriteMapper.vtkGetMacro(PointSpriteAlphaThreshold, float).
   float
   GetAlphaThreshold() { return myAlphaThreshold; }
 
+  //! Method for changing the Magnification parameter.
   void
   ChangeMagnification( bool up );
 
+  //! Get the maximum size of Point Sprites in the presentation.
   float
   GetMaxPointSize();
 
+  //! Get point size by element's Id.
   float
   GetPointSize(vtkIdType theID);
 
+  //! Get point size by element's Id using the specified scalar array.
   float
   GetPointSize(vtkIdType theID, vtkDataArray* theScalarArray);
 
+  //! Set image data for the Point Sprite texture.
   void
   SetImageData(vtkImageData* theImageData);
 
+  //! Make the image data for Point Sprite texture.
+  /*!
+   * First parameter - texture for shape.
+   * Second parameter - texture for alpha mask.
+   */
   static
   vtkImageData*
   MakeTexture( const char* theMainTexture,
index f56b98c98d5d587e59e3e4ede9e7a7484760c0df..0240d986d0c487c1fedc61d6f0e6c7c5aa824011 100755 (executable)
@@ -52,7 +52,6 @@
 #include <stdio.h>
 #include <cmath>
 #include <string>
-#include <vector>
 
 #ifndef VTK_IMPLEMENT_MESA_CXX
 vtkCxxRevisionMacro(VISU_OpenGLPointSpriteMapper, "Revision$");
@@ -67,7 +66,6 @@ vtkStandardNewMacro(VISU_OpenGLPointSpriteMapper);
 #define VTK_PDPSM_NORMAL_TYPE_FLOAT  0x0010
 #define VTK_PDPSM_NORMAL_TYPE_DOUBLE 0x0020
 #define VTK_PDPSM_OPAQUE_COLORS      0x0040
-#define VTK_PDPSM_ALPHA_ARRAY        0x0080
 
 #ifndef APIENTRY
 #define APIENTRY
@@ -166,18 +164,12 @@ static int IsARBInitialized = InitializeARB();
 // Construct empty object.
 VISU_OpenGLPointSpriteMapper::VISU_OpenGLPointSpriteMapper()
 {
+  this->RenderMode               = VISU_OpenGLPointSpriteMapper::Occlude;
+
   this->ListId                   = 0;
   this->TotalCells               = 0;
   this->ExtensionsInitialized    = 0;
-  this->ExtensionsOK             = 0;
-  this->AlphaChannelArray        = NULL;
-  this->SizeChannelArray         = NULL;
-  this->DefaultPointSize         = 10.0;
-  this->QuadraticPointDistanceAttenuation[0] = 1.0;
-  this->QuadraticPointDistanceAttenuation[1] = 0.0;
-  this->QuadraticPointDistanceAttenuation[2] = 0.0;
-
-  this->RenderMode               = VISU_OpenGLPointSpriteMapper::Occlude;
+  this->DefaultPointSize         = 20.0;
 
   this->UsePointSprites          = true;
   this->UseTextures              = true;
@@ -188,7 +180,7 @@ VISU_OpenGLPointSpriteMapper::VISU_OpenGLPointSpriteMapper()
   this->PointSpritePrimitiveType = 0;
 
   this->PointSpriteClamp         = 100.0;
-  this->PointSpriteSize          =   0.0;
+  this->PointSpriteSize          =  30.0;
   this->PointSpriteMinSize       =  15.0;
   this->PointSpriteMaxSize       =  50.0;
   this->PointSpriteMagnification =   1.0;
@@ -207,16 +199,6 @@ VISU_OpenGLPointSpriteMapper::~VISU_OpenGLPointSpriteMapper()
     {
     this->ReleaseGraphicsResources(this->LastWindow);
     }
-  if (this->AlphaChannelArray)
-    {
-    delete [] this->AlphaChannelArray;
-    this->AlphaChannelArray = NULL;
-    }
-  if (this->SizeChannelArray)
-    {
-    delete [] this->SizeChannelArray;
-    this->SizeChannelArray = NULL;
-    }
 }
 //-----------------------------------------------------------------------------
 void VISU_OpenGLPointSpriteMapper::ShallowCopy( vtkAbstractMapper* mapper )
@@ -296,10 +278,10 @@ void VISU_OpenGLPointSpriteMapper::InitShader()
   vglCompileShaderARB( VertexShader );
   //this->PrintInfoLog( VertexShader );
 
-  myVertexProgram = vglCreateProgramObjectARB();
-  vglAttachObjectARB( myVertexProgram, VertexShader );
+  this->VertexProgram = vglCreateProgramObjectARB();
+  vglAttachObjectARB( this->VertexProgram, VertexShader );
 
-  vglLinkProgramARB( myVertexProgram );
+  vglLinkProgramARB( this->VertexProgram );
   //this->PrintInfoLog( VertexProgram );
   /*
   cout << "Shader from " << fileName << endl;
@@ -313,21 +295,15 @@ void VISU_OpenGLPointSpriteMapper::InitShader()
     cout << "Loading vertex program... failed" << endl << endl;
   */
   free( shader );
-
-  glMatrixMode( GL_MODELVIEW );
-  glLoadIdentity();
-  glTranslatef( 0.0f, 0.0f, -4.0f );
-  glRotatef( 0.0f, 1.0f, 0.0f, 0.0f );
-  glRotatef( 0.0f, 0.0f, 1.0f, 0.0f );
 }
 //-----------------------------------------------------------------------------
 void VISU_OpenGLPointSpriteMapper::SetShaderVariable( const char* variable, float value )
 {
-  //cout << myVertexProgram << " ";
-  //cout << vglGetAttribLocationARB( myVertexProgram, variable ) << " ";
+  //cout << this->VertexProgram << " ";
+  //cout << vglGetAttribLocationARB( this->VertexProgram, variable ) << " ";
   //cout << variable << " " << value << endl;
 
-  vglVertexAttrib1fARB( vglGetAttribLocationARB( myVertexProgram, variable ), value );
+  vglVertexAttrib1fARB( vglGetAttribLocationARB( this->VertexProgram, variable ), value );
 }
 //-----------------------------------------------------------------------------
 void VISU_OpenGLPointSpriteMapper::SetPointSpriteMode( int theMode )
@@ -400,7 +376,6 @@ void VISU_OpenGLPointSpriteMapper::InitExtensions()
   if( this->UseShader )
     this->InitShader();
 
-  this->ExtensionsOK = 1;
   this->ExtensionsInitialized = 1;
 }
 //-----------------------------------------------------------------------------
@@ -457,12 +432,6 @@ void VISU_OpenGLPointSpriteMapper::RenderPiece(vtkRenderer *ren, vtkActor *act)
   // make sure our window is current
   ren->GetRenderWindow()->MakeCurrent();
 
-  // For vertex coloring, this sets this->Colors as side effect.
-  // Color arrays are cached. If nothing has changed,
-  // then the scalars do not have to be regenerted.
-  this->ActorOpacity = act->GetProperty()->GetOpacity();
-  this->MapScalars(this->ActorOpacity);
-
   // Initializing the texture for Point Sprites
   if( this->UseTextures && this->PointSpritePrimitiveType == 0 )
     this->InitTextures();
@@ -477,6 +446,9 @@ void VISU_OpenGLPointSpriteMapper::RenderPiece(vtkRenderer *ren, vtkActor *act)
        act->GetProperty()->GetMTime() > this->BuildTime ||
        ren->GetRenderWindow() != this->LastWindow)
   {
+    // sets this->Colors as side effect
+    this->MapScalars( act->GetProperty()->GetOpacity() );
+
     if (!this->ImmediateModeRendering &&
         !this->GetGlobalImmediateModeRendering())
     {
@@ -521,6 +493,9 @@ void VISU_OpenGLPointSpriteMapper::RenderPiece(vtkRenderer *ren, vtkActor *act)
   if (this->ImmediateModeRendering ||
       this->GetGlobalImmediateModeRendering())
   {
+    // sets this->Colors as side effect
+    this->MapScalars( act->GetProperty()->GetOpacity() );
+
     // Time the actual drawing
     this->Timer->StartTimer();
     this->Draw(ren,act);
@@ -537,7 +512,7 @@ void VISU_OpenGLPointSpriteMapper::RenderPiece(vtkRenderer *ren, vtkActor *act)
 //-----------------------------------------------------------------------------
 float VISU_OpenGLPointSpriteMapper::GetMaximumSupportedSize()
 {
-  float maximumSupportedSize = 300.0;
+  float maximumSupportedSize = 512.0;
   //glGetFloatv( GL_POINT_SIZE_MAX_ARB, &maximumSupportedSize );
 
   return maximumSupportedSize;
@@ -588,7 +563,7 @@ void VISU_OpenGLPointSpriteMapper::InitPointSprites()
 //-----------------------------------------------------------------------------
 void VISU_OpenGLPointSpriteMapper::CleanupPointSprites()
 {
-  // Set GL params back to normal to stop other vtkMappers diusplaying wrongly
+  // Set GL params back to normal to stop other vtkMappers displaying wrongly
   glDisable( GL_ALPHA_TEST );
 
   glEnable( GL_BLEND );
@@ -695,8 +670,7 @@ struct TVertex
 };
 
 //-----------------------------------------------------------------------------
-void VISU_OpenGLPointSpriteMapper::DrawPoints(int idx,
-                                             vtkPoints *p,
+void VISU_OpenGLPointSpriteMapper::DrawPoints(vtkPoints *p,
                                              vtkUnsignedCharArray *colors,
                                              vtkFloatArray *alpha,
                                              vtkIdType &cellNum,
@@ -710,14 +684,9 @@ void VISU_OpenGLPointSpriteMapper::DrawPoints(int idx,
 
   glPointSize( this->DefaultPointSize );
 
-  vglUseProgramObjectARB( myVertexProgram );
+  vglUseProgramObjectARB( this->VertexProgram );
 
-  this->SetShaderVariable( "mode",          this->PointSpriteMode );
-  this->SetShaderVariable( "clamp",         this->PointSpriteClamp );
-  this->SetShaderVariable( "geomSize",      this->PointSpriteSize );
-  this->SetShaderVariable( "minSize",       this->PointSpriteMinSize );
-  this->SetShaderVariable( "maxSize",       this->PointSpriteMaxSize );
-  this->SetShaderVariable( "magnification", this->PointSpriteMagnification );
+  this->SetShaderVariable( "clamp_size", this->PointSpriteClamp );
 
   TVertex* aVertex = new TVertex[ this->TotalCells ];
 
@@ -754,7 +723,16 @@ void VISU_OpenGLPointSpriteMapper::DrawPoints(int idx,
     aVertex[i].g = green;
     aVertex[i].b = blue;
 
-    aVertex[i].hue = ComputeHue( ( int )( red * 255 ), ( int )( green * 255 ), ( int )( blue * 255 ) );
+    float size = 0.0;
+    if( this->PointSpriteMode == 0 )
+    {
+      float h = ComputeHue( ( int )( red * 255 ), ( int )( green * 255 ), ( int )( blue * 255 ) );
+      size = this->PointSpriteMinSize + ( PointSpriteMaxSize - PointSpriteMinSize ) * ( 1 - h / 241.0f );
+    }
+    else
+      size = this->PointSpriteSize;
+
+    aVertex[i].hue = this->PointSpriteMagnification * size;
   }
 
   GLuint aBufferObjectID = 0;
@@ -772,13 +750,13 @@ void VISU_OpenGLPointSpriteMapper::DrawPoints(int idx,
   glColorPointer( 4, GL_FLOAT, sizeof(TVertex), (void*)0 );
   glVertexPointer( 3, GL_FLOAT, sizeof(TVertex), (void*)(4*sizeof(GLfloat)) );
 
-  glEnableClientState(GL_VERTEX_ARRAY);
-  glEnableClientState(GL_COLOR_ARRAY);
+  glEnableClientState( GL_VERTEX_ARRAY );
+  glEnableClientState( GL_COLOR_ARRAY );
 
-  glDrawArrays(GL_POINTS,0,this->TotalCells);
+  glDrawArrays( GL_POINTS, 0, this->TotalCells );
 
-  glDisableClientState(GL_COLOR_ARRAY);
-  glDisableClientState(GL_VERTEX_ARRAY);
+  glDisableClientState( GL_COLOR_ARRAY );
+  glDisableClientState( GL_VERTEX_ARRAY );
 
   vglDeleteBuffersARB( 1, &aBufferObjectID );
 
@@ -831,42 +809,10 @@ int VISU_OpenGLPointSpriteMapper::Draw(vtkRenderer *aren, vtkActor *act)
     }
   }
 
-  unsigned long idx = 0;
-  if (colors)
-  {
-    idx |= VTK_PDPSM_COLORS;
-    if (colors->GetName())
-    {
-      // In the future, I will look at the number of components.
-      // All paths will have to handle 3 component colors.
-      idx |= VTK_PDPSM_OPAQUE_COLORS;
-    }
-  }
-  if (cellScalars)
-  {
-    idx |= VTK_PDPSM_CELL_COLORS;
-  }
-
-  // store the types in the index
-  if (points->GetDataType() == VTK_FLOAT)
-  {
-    idx |= VTK_PDPSM_POINT_TYPE_FLOAT;
-  }
-  else if (points->GetDataType() == VTK_DOUBLE)
-  {
-    idx |= VTK_PDPSM_POINT_TYPE_DOUBLE;
-  }
-
-  if (this->AlphaChannelArray && (alpha = vtkFloatArray::SafeDownCast(input->GetPointData()->GetArray(this->AlphaChannelArray)))
-  )
-  {
-    idx |= VTK_PDPSM_ALPHA_ARRAY;
-  }
-
   // we need to know the total number of cells so that we can report progress
   this->TotalCells = input->GetVerts()->GetNumberOfCells();
 
-  this->DrawPoints(idx, points, colors, alpha, cellNum, noAbort, input->GetVerts(), ren, act);
+  this->DrawPoints(points, colors, alpha, cellNum, noAbort, input->GetVerts(), ren, act);
 
   this->UpdateProgress(1.0);
   return noAbort;
@@ -887,8 +833,3 @@ void VISU_OpenGLPointSpriteMapper::ReleaseGraphicsResources(vtkWindow *win)
   this->LastWindow = NULL;
 }
 //-----------------------------------------------------------------------------
-void VISU_OpenGLPointSpriteMapper::PrintSelf(ostream& os, vtkIndent indent)
-{
-  this->Superclass::PrintSelf(os,indent);
-}
-//-----------------------------------------------------------------------------
index 82df736a576ad3454c61496f8e752887a14be157..87fe2d722c4c56e8b3b3889e48d56f36472af3df 100755 (executable)
@@ -60,99 +60,92 @@ class vtkXMLImageDataReader;
 typedef GLuint GLhandleARB;
 #endif
 
+//----------------------------------------------------------------------------
+//! OpenGL Point Sprites PolyData Mapper.
+/*!
+ * VISU_OpenGLPointSpriteMapper is a class that maps polygonal data 
+ * (i.e., vtkPolyData) to graphics primitives. It is performing the mapping
+ * to the rendering/graphics hardware/software. It is now possible to set a 
+ * memory limit for the pipeline in the mapper. If the total estimated memory 
+ * usage of the pipeline is larger than this limit, the mapper will divide 
+ * the data into pieces and render each in a for loop.
+ */
 class VISU_OpenGLPointSpriteMapper : public MAPPER_SUPERCLASS
 {
 public:
-//BTX
-  enum RenderModes {
-    Accumulate=0,
-    Occlude
-  };
-//ETX
+  //! The Point Sprites rendering mode.
+  /*!
+   * Accumulate : Uses glBlendFunc(GL_SRC_ALPHA, GL_ONE), and no depth testing
+   * so that points are accumulated. Suitable for Galaxy plots.
+   * Occlude : No blending. Particles are solid spheres and depth testing is
+   * used as usual. Suitable for most particle simulations without the need
+   * for opacity.
+   */
+  enum RenderModes { Accumulate = 0, Occlude };
+
   static VISU_OpenGLPointSpriteMapper *New();
   vtkTypeRevisionMacro(VISU_OpenGLPointSpriteMapper,MAPPER_SUPERCLASS);
-  virtual void PrintSelf(ostream& os, vtkIndent indent);
 
   void ShallowCopy(vtkAbstractMapper*);
 
-  // Description:
-  // Specify the name of a scalar array which will be used to control
-  // the alpha value of each point. The values should be between 0,1
-  vtkSetStringMacro(AlphaChannelArray);
-  vtkGetStringMacro(AlphaChannelArray);
-
-  // Description:
-  // Specify the name of a scalar array which will be used to control
-  // the size of each point.
-  // NOT YET IMPLEMENTED
-  vtkSetStringMacro(SizeChannelArray);
-  vtkGetStringMacro(SizeChannelArray);
-
-  // Description:
-  // Set the initial point size to be used. This value forms the
-  // base upon which the distance attenuation acts.
-  // Usually the pointsize is set to the maximum supported by the graphics
-  // card for sprite display, then the quadratic factors are adjusted to
-  // bring the size down.
-  // Set the default size to -1 if you wish the value returned by
-  // glGetFloatv( GL_POINT_SIZE_MAX_ARB, &MaximimSupportedSize );
-  // to be used as the initial default point size.
+  //! Set the initial point size to be used.
+  /*!
+   * This value forms the base upon which the distance attenuation acts.
+   * Usually the pointsize is set to the maximum supported by the graphics
+   * card for sprite display, then the quadratic factors are adjusted to
+   * bring the size down.
+   */
   vtkSetMacro(DefaultPointSize, float);
-  vtkGetMacro(DefaultPointSize, float);
 
-  // Description:
-  // Set the 3 values (a,b,c) of the parametric function which controls the
-  // reduction in point size with increasing distance (d).
-  // e.g. (1,0,0) will give all points the same size regardless of distance.
-  // @verbatim
-  //     point fading = _____1_______
-  //                   (a + bd + cd^2)
-  // @endverbatim
-  vtkSetVector3Macro(QuadraticPointDistanceAttenuation, float);
-  vtkGetVector3Macro(QuadraticPointDistanceAttenuation, float);
+  //! Get the initial point size to be used.
+  vtkGetMacro(DefaultPointSize, float);
 
-  // Description:
-  // Set/Get the RenderMode for this mapper. Currently 2 modes are supported
-  // Accumulate : Uses glBlendFunc(GL_SRC_ALPHA, GL_ONE), and no depth testing
-  // so that points are accumulated. Suitable for Galaxy plots.
-  // Occlude : No blending. Particles are solid spheres and depth testing is
-  // used as usual. Suitable for most particle simulations without the need
-  // for opacity.
+  //! Set the Render Mode for the mapper.
   vtkSetMacro(RenderMode, int);
+
+  //! Get the Render Mode for the mapper.
   vtkGetMacro(RenderMode, int);
-  void SetRenderModeToAccumulate() { this->SetRenderMode(Accumulate); }
-  void SetRenderModeToOcclude() { this->SetRenderMode(Occlude); }
 
-  // Description:
-  // Implement superclass render method.
+  //! Implement superclass render method.
   virtual void RenderPiece(vtkRenderer *ren, vtkActor *a);
 
-  // Description:
-  // Release any graphics resources that are being consumed by this mapper.
-  // The parameter window could be used to determine which graphic
-  // resources to release.
+  //! Release any graphics resources that are being consumed by this mapper.
   void ReleaseGraphicsResources(vtkWindow *);
 
-  // Description:
-  // Draw method for OpenGL.
+  //! Draw method for OpenGL.
   virtual int Draw(vtkRenderer *ren, vtkActor *a);
 
-  // Description:
-  // Return the maximum point size supported by the graphics hardware.
-  float GetMaximumSupportedSize();
+  //! Return the maximum point size supported by the graphics hardware.
+  static float GetMaximumSupportedSize();
+
+  //! Set usage of #vtkOpenGLPolyDataMapper.
+  /*!
+   * This flags prevents using of the VISU_OpenGLPointSpriteMapper
+   * (#vtkOpenGLPolyDataMapper is using instead).
+   */
+  vtkSetMacro(UseOpenGLMapper, bool);
 
-  // Set/Get usage of Point Sprites
+  //! Get usage of #vtkOpenGLPolyDataMapper.
+  vtkGetMacro(UseOpenGLMapper, bool);
+
+  //! Set usage of Point Sprites.
   vtkSetMacro(UsePointSprites, bool);
+
+  //! Get usage of Point Sprites.
   vtkGetMacro(UsePointSprites, bool);
 
-  // Set/Get usage of textures for Point Sprites
-  // (only if usage of Point Sprites is turned on)
+  //! Set usage of textures for Point Sprites.
+  /*! Works only if usage of Point Sprites is turned on. */
   vtkSetMacro(UseTextures, bool);
+
+  //! Get usage of textures for Point Sprites.
   vtkGetMacro(UseTextures, bool);
 
-  // Set/Get usage of vertex shader
-  // (only if usage of Point Sprites is turned on)
+  //! Set usage of vertex shader.
+  /*! Works only if usage of Point Sprites is turned on. */
   vtkSetMacro(UseShader, bool);
+
+  //! Get usage of vertex shader.
   vtkGetMacro(UseShader, bool);
 
   // Description:
@@ -168,32 +161,54 @@ public:
   vtkGetMacro(PointSpritePrimitiveType, int);
   void SetPointSpritePrimitiveType( int );
 
-  // Description:
-  // Point Sprite size parameters
+  //! Set Point Sprite Clamp.
+  void SetPointSpriteClamp( float );
+
+  //! Get Point Sprite Clamp.
   vtkGetMacro(PointSpriteClamp, float);
-  vtkGetMacro(PointSpriteSize, float);
-  vtkGetMacro(PointSpriteMinSize, float);
-  vtkGetMacro(PointSpriteMaxSize, float);
-  vtkGetMacro(PointSpriteMagnification, float);
 
-  void SetPointSpriteClamp( float );
+  //! Set Point Sprite Const Size.
   void SetPointSpriteSize( float );
+
+  //! Get Point Sprite Const Size.
+  vtkGetMacro(PointSpriteSize, float);
+
+  //! Set Point Sprite Minimum Size.
   void SetPointSpriteMinSize( float );
+
+  //! Get Point Sprite Minimum Size.
+  vtkGetMacro(PointSpriteMinSize, float);
+
+  //! Set Point Sprite Maximum Size.
   void SetPointSpriteMaxSize( float );
+
+  //! Get Point Sprite Maximum Size.
+  vtkGetMacro(PointSpriteMaxSize, float);
+
+  //! Set Point Sprite Magnification.
   void SetPointSpriteMagnification( float );
 
-  vtkGetMacro(PointSpriteAlphaThreshold, float);
+  //! Get Point Sprite Magnification.
+  vtkGetMacro(PointSpriteMagnification, float);
+
+  //! Set Point Sprite AlphaThreshold.
   void SetPointSpriteAlphaThreshold( float );
 
+  //! Get Point Sprite AlphaThreshold.
+  vtkGetMacro(PointSpriteAlphaThreshold, float);
+
+  //! Set ImageData for Point Sprite Texture.
   void SetImageData(vtkImageData* theImageData);
+
+  //! Get ImageData for Point Sprite Texture.
   vtkImageData* GetImageData();
 
 protected:
   VISU_OpenGLPointSpriteMapper();
   ~VISU_OpenGLPointSpriteMapper();
 
-  void              DrawPoints(int idx,
-                              vtkPoints *p,
+  //! Internal method of the Point Sprites drawing.
+  void              DrawPoints(vtkPoints *p,
                               vtkUnsignedCharArray *c,
                               vtkFloatArray *alpha,
                               vtkIdType &cellNum,
@@ -202,38 +217,41 @@ protected:
                               vtkRenderer *ren,
                               vtkActor *act);
 
-  // Initializing OpenGL extensions
+  //! Initializing OpenGL extensions.
   void              InitExtensions();
 
-  // Activate/deactivate Point Sprites
+  //! Activate Point Sprites.
   void              InitPointSprites();
+
+  //! Deactivate Point Sprites.
   void              CleanupPointSprites();
 
-  // Initializing textures for Point Sprites
+  //! Initializing textures for Point Sprites.
   void              InitTextures();
 
+  //! Initializing of the Vertex Shader.
+  void              InitShader();
+
+  //! Set Vertex Shader variable.
+  void              SetShaderVariable( const char* variable, float value );
+
+  //! Getting information about Vertex Shader compiling and linking.
+  void              PrintInfoLog( GLhandleARB );
+
+private:
+  bool              UseOpenGLMapper;
+
   bool              UsePointSprites;
   bool              UseTextures;
   bool              UseShader;
 
-
-  vtkIdType         TotalCells;
-
+  int               RenderMode;
   int               ListId;
+  vtkIdType         TotalCells;
   int               ExtensionsInitialized;
-  int               ExtensionsOK;
-  char             *AlphaChannelArray;
-  double            ActorOpacity; 
-  char             *SizeChannelArray;
   float             DefaultPointSize;
-  float             QuadraticPointDistanceAttenuation[3];
-  int               RenderMode;
-
-  void              InitShader();
-  void              PrintInfoLog( GLhandleARB );
-  void              SetShaderVariable( const char* variable, float value );
 
-  GLhandleARB       myVertexProgram;
+  GLhandleARB       VertexProgram;
 
   int               PointSpriteMode;
 
@@ -248,8 +266,6 @@ protected:
   float             PointSpriteAlphaThreshold;
 
   vtkSmartPointer<vtkImageData> ImageData;
-
-  bool              UseOpenGLMapper;
 };
 
 #endif
index fa92ebdaafee559cbea366cf320d5240e834a3cf..e6d40ae343e6ff114a7c91631e4d35de3e4cb8c5 100644 (file)
@@ -470,9 +470,9 @@ VISU_PipeLine
   return myExtractGeometry->GetImplicitFunction();
 }
 
-void
+SALOME_ExtractGeometry*
 VISU_PipeLine
-::SetExtractInside(int theFlag)
+::GetExtractGeometryFilter()
 {
-  myExtractGeometry->SetExtractInside(theFlag);
+  return myExtractGeometry.GetPointer();
 } 
index 09945f791354763ceb3d6236b45e306cf0374f69..6109c2a9362f9d4f3dee361e8b74440e782e185f 100644 (file)
@@ -199,8 +199,8 @@ public:
   vtkImplicitFunction* 
   GetImplicitFunction();
 
-  void
-  SetExtractInside(int);
+  SALOME_ExtractGeometry*
+  GetExtractGeometryFilter();
 
 protected:
   VISU_PipeLine();
index 84579bf285f70eb068e252e3b15fbb67e666fb5c..f787a02d9e198b5eef3f555becfd2de83b030320 100644 (file)
@@ -70,6 +70,7 @@ LIB_SRC =     VisuGUI.cxx \
                VisuGUI_CutPlanesDlg.cxx \
                VisuGUI_StreamLinesDlg.cxx \
                VisuGUI_VectorsDlg.cxx \
+               VisuGUI_BuildProgressDlg.cxx \
                VisuGUI_Timer.cxx
 
 LIB_MOC =      VisuGUI.h \
@@ -91,7 +92,8 @@ LIB_MOC =     VisuGUI.h \
                VisuGUI_CutLinesDlg.h \
                VisuGUI_CutPlanesDlg.h \
                VisuGUI_StreamLinesDlg.h \
-               VisuGUI_VectorsDlg.h
+               VisuGUI_VectorsDlg.h \
+               VisuGUI_BuildProgressDlg.h
 
 LIB_CLIENT_IDL = SALOME_Exception.idl \
                 VISU_Gen.idl \
index 88a91075aad840022f51fff069411469f6d960f6..9cad7e96295a149a38903f3821dec0af35c0c7b8 100644 (file)
@@ -6,6 +6,12 @@ msgstr ""
 "Last-Translator: FULLNAME <EMAIL@ADDRESS>\n"
 "Content-Type: text/plain; charset=iso-8859-1\n"
 
+msgid "INF_VISU"
+msgstr "Post-Pro Info"
+
+msgid "IMPORT_DONE"
+msgstr "Importing is done"
+
 msgid "VisuGUI_Module::MEN_VISUALISATION"
 msgstr "Visualization"
 
@@ -130,6 +136,15 @@ msgstr "Cursor"
 msgid "VisuGUI_Module::VISU_PICKING_PREF_PYRAMID_HEIGHT"
 msgstr "Height of the pyramids"
 
+msgid "VisuGUI_Module::VISU_PICKING_PREF_SELECTION_COLOR"
+msgstr "Selection cursor color"
+
+msgid "VisuGUI_Module::VISU_PICKING_PREF_TOLERANCE_GROUP_TTL"
+msgstr "Tolerance"
+
+msgid "VisuGUI_Module::VISU_PICKING_PREF_POINT_SELECTION_TOLERANCE"
+msgstr "Point selection tolerance"
+
 msgid "VisuGUI_Module::VISU_PICKING_PREF_INFO_WINDOW_GROUP_TTL"
 msgstr "Information window"
 
@@ -161,7 +176,7 @@ msgid "VisuGUI_Module::VISU_PICKING_PREF_DISPLAY_PARENT_MESH"
 msgstr "Display parent mesh element"
 
 msgid "VisuGUI_Module::VISU_MOUSE_PREF_TAB_TLT"
-msgstr "Spacemouse"
+msgstr "Navigation"
 
 msgid "VisuGUI_Module::VISU_MOUSE_PREF_GROUP_TLT"
 msgstr "Mouse"
@@ -247,6 +262,57 @@ msgstr "Gauss Points Preferences"
 msgid "VisuGUI_GaussPointsDlg::DLG_PROP_TITLE"
 msgstr "Gauss Points Properties"
 
+msgid "VisuGUI_BuildProgressDlg::DLG_BUILD_PROGRESS_TITLE"
+msgstr "Build progress"
+
+msgid "VisuGUI_BuildProgressDlg::IMPORT_SETTINGS"
+msgstr "Settings"
+
+msgid "VisuGUI_BuildProgressDlg::FILE_NAME"
+msgstr "Import file : "
+
+msgid "VisuGUI_BuildProgressDlg::BUILD_AT_ONCE"
+msgstr "Build at once"
+
+msgid "VisuGUI_BuildProgressDlg::BUILD_ALL"
+msgstr "Build all"
+
+msgid "VisuGUI_BuildProgressDlg::IMPORT_PROGRESS"
+msgstr "Import progress"
+
+msgid "VisuGUI_BuildProgressDlg::BUILD_ENTITIES"
+msgstr "Build entities"
+
+msgid "VisuGUI_BuildProgressDlg::BUILD_FIELDS"
+msgstr "Build fields"
+
+msgid "VisuGUI_BuildProgressDlg::BUILD_GROUPS"
+msgstr "Build groups"
+
+msgid "VisuGUI_BuildProgressDlg::BUILD_MINMAX"
+msgstr "Build min/max"
+
+msgid "VisuGUI_BuildProgressDlg::IMPORT_TIME"
+msgstr "Time"
+
+msgid "VisuGUI_BuildProgressDlg::TIME"
+msgstr "Elapsed time : "
+
+msgid "VisuGUI_BuildProgressDlg::IMPORT_FROM_FILE"
+msgstr "Import from File"
+
+msgid "VisuGUI_BuildProgressDlg::FLT_ALL_FILES"
+msgstr "All Files (*.*)"
+
+msgid "VisuGUI_BuildProgressDlg::FLT_MED_FILES"
+msgstr "MED Files (*.med)"
+
+msgid "VisuGUI_BuildProgressDlg::START"
+msgstr "Start"
+
+msgid "VisuGUI_BuildProgressDlg::CLOSE"
+msgstr "Close"
+
 msgid "VVTK_ViewManager::VTK_VIEW_TITLE"
 msgstr "VISU scene:%1 - viewer:%2"
 
@@ -529,6 +595,15 @@ msgstr "Cursor"
 msgid "VVTK_PickingDlg::PYRAMID_HEIGHT"
 msgstr "Height of the pyramids :"
 
+msgid "VVTK_PickingDlg::SELECTION_COLOR"
+msgstr "Selection cursor color :"
+
+msgid "VVTK_PickingDlg::TOLERANCE_TITLE"
+msgstr "Tolerance"
+
+msgid "VVTK_PickingDlg::POINT_TOLERANCE"
+msgstr "Point tolerance :"
+
 msgid "VVTK_PickingDlg::INFO_WINDOW_TITLE"
 msgstr "Information window"
 
index 99b80b0e9f0e7e4f3d506c92a158fdc0250abce5..16b33f07e8fbc0a1e7fa371cbdd7a7cab90e7bed 100644 (file)
 #include <qptrlist.h>
 #include <qptrvector.h>
 #include <qcolordialog.h>
+#include <qdatetime.h>
 
 // VTK Includes
 #include <vtkRenderer.h>
 #include <vtkRenderWindow.h>
 #include <vtkActorCollection.h>
+#include <vtkTimerLog.h>
 
 // SALOME Includes
 #include "SALOME_LifeCycleCORBA.hxx"
 #include "VisuGUI_Plot3DDlg.h"
 #include "VisuGUI_OffsetDlg.h"
 #include "VisuGUI_Displayer.h"
+#include "VisuGUI_BuildProgressDlg.h"
 
 #include "VISU_ScalarMap_i.hh"
 #include "VisuGUI_ScalarBarDlg.h"
@@ -158,63 +161,16 @@ VisuGUI::~VisuGUI()
 {
 }
 
-
 void
 VisuGUI::
 OnImportFromFile()
 {
-  VisuGUI_Timer aTimer;
-  aTimer.Start();
-
   if(MYDEBUG) MESSAGE("VisuGUI::OnImportFromFile()");
-  if ( CheckLock(GetCStudy(GetAppStudy(this))) )
-    return;
-  SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
-
-  QStringList aFilter;
-  aFilter.append( tr("FLT_MED_FILES") );
-  aFilter.append( tr("FLT_ALL_FILES") );
-
-  QFileInfo aFileInfo =
-    SUIT_FileDlg::getFileName(GetDesktop(this),
-                              "",
-                              aFilter,
-                              tr("MEN_IMPORT_FROM_FILE"),
-                              true);
-  if(aFileInfo.exists()) {
-    application()->putInfo( "Importing From File " + aFileInfo.filePath() + "...", -1 );
-
-    VISU::Result_var aResult;
-    bool anIsBuild = aResourceMgr->booleanValue("VISU", "full_med_loading", false);
-    if (VisuGUI_FileDlg::IsBuild) {
-      aResult = GetVisuGen(this)->ImportFile(aFileInfo.filePath());
-      if (!CORBA::is_nil(aResult.in()))
-        if (Result_i* aRes = dynamic_cast<Result_i*>(GetServant(aResult).in())) {
-          if (!aRes->IsPossible())
-            SUIT_MessageBox::warn1(GetDesktop(this),
-                                   tr("WRN_VISU"),
-                                   tr("ERR_CANT_BUILD_PRESENTATION"),
-                                   tr("BUT_OK"));
-          else
-            aRes->BuildAll();
-        }
-    } else {
-      aResourceMgr->setValue("VISU", "full_med_loading", false);
-      aResult = GetVisuGen(this)->ImportFile(aFileInfo.filePath());
-      aResourceMgr->setValue("VISU", "full_med_loading", anIsBuild);
-    }
+  CheckLock(GetCStudy(GetAppStudy(this)));
 
-    if (CORBA::is_nil(aResult.in())) {
-      SUIT_MessageBox::warn1(GetDesktop(this),
-                             tr("WRN_VISU"),
-                             tr("ERR_ERROR_IN_THE_FILE"),
-                             tr("BUT_OK"));
-    }else{
-      UpdateObjBrowser(this);
-      application()->putInfo(aFileInfo.filePath() + tr("INF_DONE") +
-                            " in " + aTimer.GetTime() + " seconds", -1 );
-    }
-  }
+  VisuGUI_BuildProgressDlg* aBuildProgressDlg = new VisuGUI_BuildProgressDlg( GetDesktop(this) );
+  aBuildProgressDlg->setGenerator( GetVisuGen(this) );
+  aBuildProgressDlg->show();
 }
 
 
@@ -714,7 +670,7 @@ OnEditScalarMap()
   Handle(SALOME_InteractiveObject) anIO;
   if(VISU::Prs3d_i* aPrs3d = GetPrsToModify(this,&anIO)){
     EditPrs3d<VISU::ScalarMap_i, VisuGUI_ScalarBarDlg,1>(this, aPrs3d);
-    if(SVTK_ViewWindow* aViewWindow = GetViewWindow()){
+    if(SVTK_ViewWindow* aViewWindow = GetViewWindow(this)){
       aViewWindow->highlight(anIO, 1);
     }
   }
@@ -728,7 +684,7 @@ OnEditDeformedShape()
   Handle(SALOME_InteractiveObject) anIO;
   if(VISU::Prs3d_i* aPrs3d = GetPrsToModify(this,&anIO)){
     EditPrs3d<VISU::DeformedShape_i, VisuGUI_DeformedShapeDlg,1>(this, aPrs3d);
-    if(SVTK_ViewWindow* aViewWindow = GetViewWindow()){
+    if(SVTK_ViewWindow* aViewWindow = GetViewWindow(this)){
       aViewWindow->highlight(anIO, 1);
     }
   }
@@ -742,7 +698,7 @@ OnEditCutPlanes()
   Handle(SALOME_InteractiveObject) anIO;
   if(VISU::Prs3d_i* aPrs3d = GetPrsToModify(this,&anIO)){
     EditPrs3d<VISU::CutPlanes_i, VisuGUI_CutPlanesDlg,0>(this, aPrs3d);
-    if(SVTK_ViewWindow* aViewWindow = GetViewWindow()){
+    if(SVTK_ViewWindow* aViewWindow = GetViewWindow(this)){
       aViewWindow->highlight(anIO, 1);
     }
   }
@@ -756,7 +712,7 @@ OnEditCutLines()
   Handle(SALOME_InteractiveObject) anIO;
   if(VISU::Prs3d_i* aPrs3d = GetPrsToModify(this,&anIO)){
     EditPrs3d<VISU::CutLines_i, VisuGUI_CutLinesDlg,0>(this, aPrs3d);
-    if(SVTK_ViewWindow* aViewWindow = GetViewWindow()){
+    if(SVTK_ViewWindow* aViewWindow = GetViewWindow(this)){
       aViewWindow->highlight(anIO, 1);
     }
   }
@@ -770,7 +726,7 @@ OnEditIsoSurfaces()
   Handle(SALOME_InteractiveObject) anIO;
   if(VISU::Prs3d_i* aPrs3d = GetPrsToModify(this,&anIO)){
     EditPrs3d<VISU::IsoSurfaces_i, VisuGUI_IsoSurfacesDlg,1>(this, aPrs3d);
-    if(SVTK_ViewWindow* aViewWindow = GetViewWindow()){
+    if(SVTK_ViewWindow* aViewWindow = GetViewWindow(this)){
       aViewWindow->highlight(anIO, 1);
     }
   }
@@ -784,7 +740,7 @@ OnEditVectors()
   Handle(SALOME_InteractiveObject) anIO;
   if(VISU::Prs3d_i* aPrs3d = GetPrsToModify(this,&anIO)){
     EditPrs3d<VISU::Vectors_i, VisuGUI_VectorsDlg,1>(this, aPrs3d);
-    if(SVTK_ViewWindow* aViewWindow = GetViewWindow()){
+    if(SVTK_ViewWindow* aViewWindow = GetViewWindow(this)){
       aViewWindow->highlight(anIO, 1);
     }
   }
@@ -798,7 +754,7 @@ OnEditStreamLines()
   Handle(SALOME_InteractiveObject) anIO;
   if(VISU::Prs3d_i* aPrs3d = GetPrsToModify(this,&anIO)){
     EditPrs3d<VISU::StreamLines_i, VisuGUI_StreamLinesDlg,1>(this, aPrs3d);
-    if(SVTK_ViewWindow* aViewWindow = GetViewWindow()){
+    if(SVTK_ViewWindow* aViewWindow = GetViewWindow(this)){
       aViewWindow->highlight(anIO, 1);
     }
   }
@@ -812,7 +768,7 @@ OnEditPlot3D()
   Handle(SALOME_InteractiveObject) anIO;
   if(VISU::Prs3d_i* aPrs3d = GetPrsToModify(this,&anIO)){
     EditPrs3d<VISU::Plot3D_i, VisuGUI_Plot3DDlg,0>(this, aPrs3d);
-    if(SVTK_ViewWindow* aViewWindow = GetViewWindow()){
+    if(SVTK_ViewWindow* aViewWindow = GetViewWindow(this)){
       aViewWindow->highlight(anIO, 1);
     }
   }
@@ -824,7 +780,7 @@ VisuGUI::
 OnEraseAll()
 {
   startOperation( myEraseAll );
-  if (SVTK_ViewWindow* vw = GetViewWindow()) {
+  if (SVTK_ViewWindow* vw = GetViewWindow(this)) {
     vw->unHighlightAll();
     if (vtkRenderer *aRen = vw->getRenderer()) {
       vtkActor *anActor;
@@ -911,7 +867,7 @@ OnChangeColor()
   VISU::Prs3d_i* aPrs3d = dynamic_cast<VISU::Prs3d_i*>(aServant.in());
   if (!aPrs3d) return;
 
-  SVTK_ViewWindow* vw = GetViewWindow();
+  SVTK_ViewWindow* vw = GetViewWindow(this);
   if (!vw) return;
 
   VISU_Actor* anActor = GetActor(aPrs3d, vw);
@@ -983,7 +939,7 @@ OnChangeWireframeColor()
   VISU::Prs3d_i* aPrs3d = dynamic_cast<VISU::Prs3d_i*>(aServant.in());
   if (!aPrs3d) return;
 
-  SVTK_ViewWindow* vw = GetViewWindow();
+  SVTK_ViewWindow* vw = GetViewWindow(this);
   if (!vw) return;
 
   VISU_Actor* anActor = GetActor(aPrs3d, vw);
@@ -1018,7 +974,7 @@ OnChangeOpacity()
   VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(aServant.in());
   if (!aPrsObject) return;
 
-  SVTK_ViewWindow* vw = GetViewWindow();
+  SVTK_ViewWindow* vw = GetViewWindow(this);
   if (!vw) return;
 
   VISU_Actor* anActor = GetActor(aPrsObject, vw);
@@ -1058,7 +1014,7 @@ OnChangeLines()
   VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(aServant.in());
   if (!aPrsObject) return;
 
-  SVTK_ViewWindow* vw = GetViewWindow();
+  SVTK_ViewWindow* vw = GetViewWindow(this);
   if (!vw) return;
 
   VISU_Actor* anActor = GetActor(aPrsObject, vw);
@@ -1584,7 +1540,7 @@ OnSweep()
   VISU::ScalarMap_i* aPrsObject = dynamic_cast<VISU::ScalarMap_i*>(aServant.in());
   if (!aPrsObject) return;
 
-  SVTK_ViewWindow* vw = GetViewWindow();
+  SVTK_ViewWindow* vw = GetViewWindow(this);
   if (!vw) return;
 
   VISU_Actor* aActor = GetActor(aPrsObject, vw);
@@ -1627,9 +1583,11 @@ void
 VisuGUI::
 OnTimeAnimation()
 {
+  if(!VISU::GetViewWindow())
+    return;
+
   _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
   VisuGUI_TimeAnimationDlg* aAnimationDlg =
-//    new VisuGUI_TimeAnimationDlg(GetDesktop(this), aCStudy);
     new VisuGUI_TimeAnimationDlg (this, aCStudy);
 
   LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
@@ -1664,6 +1622,9 @@ void
 VisuGUI::
 OnShowAnimation()
 {
+  if(!VISU::GetViewWindow())
+    return;
+
   LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
   SALOME_ListIO aListIO;
   aSelectionMgr->selectedObjects(aListIO);
@@ -1794,8 +1755,8 @@ void
 VisuGUI::
 OnSelectionInfo()
 {
-  if (GetViewWindow())
-    (new VisuGUI_SelectionDlg(GetDesktop(this)))->show();
+  if (GetViewWindow(this))
+    (new VisuGUI_SelectionDlg(this))->show();
   else
     SUIT_MessageBox::warn1(GetDesktop(this),
                            tr("WRN_VISU"),
@@ -1944,7 +1905,7 @@ void
 VisuGUI::
 OnArrangeActors()
 {
-  SVTK_ViewWindow* vw = GetViewWindow();
+  SVTK_ViewWindow* vw = GetViewWindow(this);
   if (vw) {
     ArrangeDlg* aDlg = new ArrangeDlg (GetDesktop(this), vw);
     aDlg->exec();
@@ -2579,7 +2540,7 @@ createPopupMenus()
   aRule = "client='VTKViewer' and selcount=1" + aInsideType;
   mgr->setRule( action( VISU_SELECTION_INFO ), aRule, true );
 
-  aRule = "client='ObjectBrowser' and selcount>0 and $type in {'VISU::TFIELD'} and nbTimeStamps>1";
+  aRule = "client='ObjectBrowser' and selcount>0 and $type in {'VISU::TFIELD'} and nbTimeStamps>1 and activeView='VTKViewer'";
   mgr->setRule( action( VISU_ANIMATION ), aRule, true );
 
   aRule = "client='ObjectBrowser' and $type in {'VISU::TENTITY' 'VISU::TFAMILY' 'VISU::TGROUP'}";
index 3b8e345c1e5f7afebfe95f220a11d60101887a09..098f8bffcb84a419e81656306ca4a214abc45db5 100644 (file)
@@ -33,6 +33,7 @@
 
 #include "VISU_GaussPoints_i.hh"
 #include "VISU_GaussPointsPL.hxx"
+#include "VISU_OpenGLPointSpriteMapper.hxx"
 #include "VISU_Convertor.hxx"
 
 #include "VVTK_PrimitiveBox.h"
@@ -246,7 +247,7 @@ VisuGUI_GaussScalarBarPane::VisuGUI_GaussScalarBarPane (QWidget * parent, bool S
 
   // signals and slots connections ===========================================
   connect( myRBLocal,     SIGNAL( toggled( bool ) ), myCBDisplayed, SLOT( setEnabled( bool ) ) );
-  connect( myRBGlobal,    SIGNAL( toggled( bool ) ), myCBDisplayed, SLOT( setChecked( bool ) ) );
+  connect( myRBGlobal,    SIGNAL( clicked() ),       this, SLOT( onSetDisplayGlobal() ) );
   connect( RainbowButton, SIGNAL( toggled( bool ) ), ColorLabel, SLOT( setEnabled( bool ) ) );
   connect( RainbowButton, SIGNAL( toggled( bool ) ), ColorSpin, SLOT( setEnabled( bool ) ) );
   connect( RainbowButton, SIGNAL( toggled( bool ) ), LabelLabel, SLOT( setEnabled( bool ) ) );
@@ -260,6 +261,12 @@ VisuGUI_GaussScalarBarPane::VisuGUI_GaussScalarBarPane (QWidget * parent, bool S
   myIsStoreTextProp = false;
 }
 
+void VisuGUI_GaussScalarBarPane::onSetDisplayGlobal()
+{
+  myCBDisplayed->setChecked( true );
+}
+
+
 /**
  * Initialise dialog box from presentation object
  */
index 6ffd3bd4d0533a880a0fdfd1e7636045ce92bc5d..27b46071a2581b79aa2ca6066e99c164fdaff285 100644 (file)
@@ -53,6 +53,8 @@ namespace VISU
   class GaussPoints_i;
 }
 
+//! Specific Scalar Bar tab.
+/*! Uses for set up Gauss Points Scalar Bars preferenses. */
 class VisuGUI_GaussScalarBarPane : public QVBox
 {
   Q_OBJECT
@@ -115,17 +117,26 @@ class VisuGUI_GaussScalarBarPane : public QVBox
   void changeRange( int );
   void XYChanged( double );
   void onTextPref();
+  void onSetDisplayGlobal();
 };
 
-
+//! Create Gauss Points Presentation Dialog.
+/*!
+ * Uses for set up initial parameters of the Gauss Points
+ * presentation and edit them interactively.
+ */
 class VisuGUI_GaussPointsDlg : public QDialog
 {
   Q_OBJECT
+
 public:
   VisuGUI_GaussPointsDlg (SalomeApp_Module* theModule, bool SetPref = FALSE);
   ~VisuGUI_GaussPointsDlg() {}
 
+  //! Initializing dialog from the Gauss Points presentation.
   void    initFromPrsObject(VISU::GaussPoints_i* thePrs);
+
+  //! Update Gauss Points presentation using parameters from the dialog.
   int     storeToPrsObject(VISU::GaussPoints_i* thePrs);
 
 protected slots:
index 510f6f9db71280a6df29d7c7985ad89a1898b2b2..4c5f00e20703cf215e0ebc4ebc3ec9ad8966dded 100644 (file)
 #include "VVTK_MainWindow.h"
 #include "VISU_View_i.hh"
 
+#include <qaction.h>
+
 #include <vtkRenderer.h>
 #include <vtkCamera.h>
+#include <vtkTimerLog.h>
 
 #include <sstream>
 
@@ -86,7 +89,9 @@ static int MYDEBUG = 0;
 
 #define GAUSS_NEW_VIEWER         5100
 #define GAUSS_CREATE_PRS         5200
+#define GAUSS_RENAME             5210
 #define GAUSS_EDIT_PRS           5300
+#define GAUSS_COPY_PRS           5310
 #define GAUSS_ERASE_PRS          5400
 #define GAUSS_DISPLAY_PRS        5500
 #define GAUSS_DISPLAY_ONLY_PRS   5600
@@ -238,6 +243,14 @@ VisuGUI_Module
   createMenu( action( GAUSS_CREATE_PRS ), createMenu( tr( "MEN_VISUALISATION" ), -1 ), -1 );
   createTool( GAUSS_CREATE_PRS, createTool( tr( "TOOL_VISUALISATION" ) ), -1 );
 
+  createAction( GAUSS_RENAME, VisuGUI::tr("MEN_RENAME"), QIconSet(),
+                VisuGUI::tr("MEN_RENAME"), "", 0, this, false,
+                this, SLOT(OnRename()));
+  mgr->insert( action( GAUSS_RENAME ), -1, 0, -1 );
+  mgr->setRule( action( GAUSS_RENAME ), 
+               "selcount=1 and type='VISU::TGAUSSPOINTS'", 
+               true );
+
   createAction( GAUSS_EDIT_PRS, VisuGUI::tr("MEN_EDIT_PRS"), QIconSet(),
                 VisuGUI::tr("MEN_EDIT_PRS"), "", 0, this, false,
                 this, SLOT(OnEditGaussPoints()));
@@ -246,6 +259,15 @@ VisuGUI_Module
                "selcount=1 and type='VISU::TGAUSSPOINTS'", 
                true );
 
+  createAction( GAUSS_COPY_PRS, VisuGUI::tr("MEN_COPY_PRS"), QIconSet(),
+                VisuGUI::tr("MEN_COPY_PRS"), "", 0, this, false,
+                this, SLOT(OnCopyPresentation()));
+  mgr->insert( action( GAUSS_COPY_PRS ), -1, 0, -1 );
+  mgr->setRule( action( GAUSS_COPY_PRS ), 
+               "selcount=1 and type='VISU::TGAUSSPOINTS'", 
+               true );
+  action( GAUSS_COPY_PRS )->setEnabled(false);
+
   aRule = "(selcount>0 and type='VISU::TGAUSSPOINTS')";
 
   createAction( GAUSS_ERASE_PRS, VisuGUI::tr("MEN_ERASE"), QIconSet(),
@@ -580,12 +602,28 @@ VisuGUI_Module
 {
   int pickingTab = addPreference( tr( "VISU_PICKING_PREF_TAB_TTL" ) );
 
+  // Cursor
   int cursorGr = addPreference( tr( "VISU_PICKING_PREF_CURSOR_GROUP_TTL" ), pickingTab );
+  setPreferenceProperty( cursorGr, "columns", 1 );
+
   int pyramidHeightPref = addPreference( tr( "VISU_PICKING_PREF_PYRAMID_HEIGHT" ), cursorGr,
                                         LightApp_Preferences::DblSpin, "VISU", "picking_pyramid_height" );
   setPreferenceProperty( pyramidHeightPref, "min", 1 );
   setPreferenceProperty( pyramidHeightPref, "max", 100 );
 
+  int selectionColorPref = addPreference( tr( "VISU_PICKING_PREF_SELECTION_COLOR" ), cursorGr,
+                                         LightApp_Preferences::Color, "VISU", "picking_selection_color" );
+
+  // Tolerance
+  int toleranceGr = addPreference( tr( "VISU_PICKING_PREF_TOLERANCE_GROUP_TTL" ), pickingTab );
+
+  int pointTolerancePref = addPreference( tr( "VISU_PICKING_PREF_POINT_SELECTION_TOLERANCE" ), toleranceGr,
+                                        LightApp_Preferences::DblSpin, "VISU", "picking_point_tolerance" );
+  setPreferenceProperty( pointTolerancePref, "min", 0.001 );
+  setPreferenceProperty( pointTolerancePref, "max", 10 );
+  setPreferenceProperty( pointTolerancePref, "step", 0.01 );
+
+  // Info window
   int infoWindowGr = addPreference( tr( "VISU_PICKING_PREF_INFO_WINDOW_GROUP_TTL" ), pickingTab );
   setPreferenceProperty( infoWindowGr, "columns", 1 );
 
@@ -606,6 +644,7 @@ VisuGUI_Module
   setPreferenceProperty( positionPref, "strings", values );
   setPreferenceProperty( positionPref, "indexes", indices );
 
+  // Camera
   int cameraGr = addPreference( tr( "VISU_PICKING_PREF_CAMERA_GROUP_TTL" ), pickingTab );
   setPreferenceProperty( cameraGr, "columns", 1 );
 
@@ -620,6 +659,7 @@ VisuGUI_Module
   setPreferenceProperty( stepNumberPref, "min", 1 );
   setPreferenceProperty( stepNumberPref, "max", 100 );
 
+  // Display parent mesh
   int parentMeshGr = addPreference( tr( "VISU_PICKING_PREF_PARENT_MESH_TTL" ), pickingTab );
   setPreferenceProperty( parentMeshGr, "columns", 1 );
 
@@ -703,7 +743,10 @@ void
 VisuGUI_Module
 ::OnCreateGaussPoints()
 {
+  double initialTime = vtkTimerLog::GetCPUTime();
   CreatePrs3d<VISU::GaussPoints_i,VVTK_Viewer,VisuGUI_GaussPointsDlg,1>(this,true);
+  INFOS( "VisuGUI_Module::OnCreateGaussPoints() : Gauss Points created in " <<
+        vtkTimerLog::GetCPUTime() - initialTime << " seconds" );
 }
 
 void
@@ -844,10 +887,15 @@ VisuGUI_Module
       if(!CORBA::is_nil(anObject)){
        if(VISU::Prs3d_i* aPrs3d = dynamic_cast<VISU::Prs3d_i*>(VISU::GetServant(anObject).in())){
          if(MYDEBUG) MESSAGE("VisuGUI_Module::OnDisplayPrs : Prs3d object");
-         if(aPrs3d->GetType() != VISU::TGAUSSPOINTS)
-           VISU::UpdateViewer<SVTK_Viewer>(this,aPrs3d,false,true,true);
-         else
+         if(aPrs3d->GetType() == VISU::TGAUSSPOINTS)
            VISU::UpdateViewer<VVTK_Viewer>(this,aPrs3d,false,true,true);
+         else if(SUIT_ViewManager* aViewManager = getApp()->activeViewManager()){
+           QString aType = aViewManager->getType();
+           if(aType == SVTK_Viewer::Type())
+             VISU::UpdateViewer<SVTK_Viewer>(this,aPrs3d,false,true,true);
+           else if(aType == VVTK_Viewer::Type())
+             VISU::UpdateViewer<VVTK_Viewer>(this,aPrs3d,false,true,true);
+         }
          continue;
        }
       }
@@ -901,24 +949,7 @@ void
 VisuGUI_Module
 ::OnDisplayOnlyPrs()
 {
-  if(LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this)){
-    SALOME_ListIO aList;
-    aSelectionMgr->selectedObjects(aList);
-    for(SALOME_ListIteratorOfListIO it( aList ); it.More(); it.Next()){
-      Handle(SALOME_InteractiveObject) anIO = it.Value();
-      CORBA::Object_var anObject = GetSelectedObj( GetAppStudy(this), anIO->getEntry() );
-
-      if(!CORBA::is_nil(anObject)){
-       if(VISU::Prs3d_i* aPrs3d = dynamic_cast<VISU::Prs3d_i*>(VISU::GetServant(anObject).in())){
-         if(aPrs3d->GetType() != VISU::TGAUSSPOINTS)
-           VISU::OnEraseAll<SVTK_Viewer>(this);
-         else
-           VISU::OnEraseAll<VVTK_Viewer>(this);
-         break;
-       }
-      }
-    }
-  }
+  OnEraseAll();
   OnDisplayPrs();
 }
 
index 1081b16f090709add8bb70cc23fa28dee23b701b..58644baa739bebb074a2165f4838cc1bb321eac1 100644 (file)
@@ -46,7 +46,8 @@ namespace VISU
   typedef std::map<SUIT_ViewManager*,PViewer> TViewerMap;
 }
 
-
+//! This class inherits base VisuGUI.
+/*! Used to display, erase end edit presentations in the VVTK viewer. */
 class VisuGUI_Module: public VisuGUI
 {
   Q_OBJECT;
@@ -59,10 +60,12 @@ public:
   virtual
   ~VisuGUI_Module();
 
+  //! Redifined method of the module initializing.
   virtual
   void
   initialize( CAM_Application* );
 
+  //! Redefined method of creating prefernces.
   virtual 
   void 
   createPreferences();
@@ -77,23 +80,28 @@ public:
                 const bool theIsCreate);
 
 public slots:
+  //! Reimplemented method of the module deactivation.
   virtual 
   bool
   deactivateModule( SUIT_Study* );
 
+  //! Reimplemented method of the module activation.
   virtual 
   bool
   activateModule( SUIT_Study* );
 
 protected:
+  //! Create preferences for Gauss Points presentation.
   virtual 
   void 
   createGaussPointsPreferences();
 
+  //! Create preferences for Gauss Points Scalar Bars.
   virtual 
   void 
   createScalarBarPreferences();
 
+  //! Create preferences for Outside Cursor Gauss Points presentations.
   virtual 
   void 
   createInsideCursorPreferences();
@@ -102,10 +110,12 @@ protected:
   void 
   createOutsideCursorPreferences();
 
+  //! Create preferences for Picking.
   virtual 
   void 
   createPickingPreferences();
 
+  //! Create preferences for Space Mouse.
   virtual 
   void 
   createSpaceMousePreferences();
@@ -126,30 +136,37 @@ protected slots:
   void 
   OnViewManagerAdded(SUIT_ViewManager*);
 
+  //! Reimplemented method of the Gauss Points edition.
   virtual
   void
   OnEditGaussPoints();
 
+  //! Reimplemented method of the Gauss Points displaying.
   virtual 
   void
   OnDisplayPrs();
 
+  //! Reimplemented method of the Gauss Points displaying only.
   virtual 
   void
   OnDisplayOnlyPrs();
 
+  //! Reimplemented method of the Gauss Points full erasing.
   virtual
   void
   OnEraseAll();
 
+  //! Reimplemented method of the Gauss Points erasing.
   virtual
   void
   OnErasePrs();
 
+  //! Reimplemented method of saving view parameters.
   virtual
   void
   OnSaveViewParams();
 
+  //! Reimplemented method of restoring view parameters.
   virtual
   void
   OnRestoreViewParams();
index bb078813512cd19215cf2566728711e0147bd993..7465cee51dfeea2d41237cbd0c41ebd08b523b04 100644 (file)
@@ -156,7 +156,7 @@ void VisuGUI_OffsetDlg::updateOffset (VISU::Prs3d_i* thePrs, float* theOffset)
 
   ViewManagerList aViewManagerList;
   SalomeApp_Application* anApp = myModule->getApp();
-  anApp->viewManagers(SVTK_Viewer::Type(), aViewManagerList);
+  anApp->viewManagers(aViewManagerList);
   QPtrListIterator<SUIT_ViewManager> anVMIter (aViewManagerList);
   for (; anVMIter.current(); ++anVMIter) {
     SUIT_ViewManager* aViewManager = anVMIter.current();
index 4287a9abe700782ea7a9a88fd40ab29922cd495f..d9a4b448c0b3c172d9bb38068ad30b58b7f7d555 100644 (file)
@@ -213,8 +213,15 @@ namespace VISU
   CreatePrs3d(VisuGUI* theModule,
              const bool theIsCreateView = true)
   {
-    CreatePrs3d<TPrs3d_i,SVTK_Viewer,TDlg,IsDlgModal>(theModule,theIsCreateView);
+    if(SUIT_ViewManager* aViewManager = theModule->getApp()->activeViewManager()){
+      QString aType = aViewManager->getType();
+      if(aType == SVTK_Viewer::Type())
+       CreatePrs3d<TPrs3d_i,SVTK_Viewer,TDlg,IsDlgModal>(theModule,theIsCreateView);
+      else if(aType == VVTK_Viewer::Type())
+       CreatePrs3d<TPrs3d_i,VVTK_Viewer,TDlg,IsDlgModal>(theModule,theIsCreateView);
+    }
   }
+
 }
 
 #endif
index 4ffcf68d26c5ff983da5dc3c98495cac5784c272..d5043f9c4d7fddf13e6acf8e87e61c03cd4eaebc 100644 (file)
@@ -89,10 +89,13 @@ using namespace std;
 
 static VisuGUI_SelectionDlg* mySelectionDlg = NULL;
 
-VisuGUI_SelectionDlg::VisuGUI_SelectionDlg (QWidget* parent)
-     : QDialog(parent, 0, false, WStyle_Customize | WStyle_NormalBorder |
-               WStyle_Title | WStyle_SysMenu | WDestructiveClose),
-       mySelectionMgr(NULL)
+VisuGUI_SelectionDlg::VisuGUI_SelectionDlg (const SalomeApp_Module* theModule):
+  QDialog(VISU::GetDesktop(theModule), 
+         0, 
+         false, 
+         WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | WDestructiveClose),
+  mySelectionMgr(NULL),
+  myModule(theModule)
 {
   if (mySelectionDlg)
     mySelectionDlg->close(true);
@@ -259,10 +262,9 @@ VisuGUI_SelectionDlg::VisuGUI_SelectionDlg (QWidget* parent)
   myFl = false;
 
   // Activate Points pane
-  SVTK_ViewWindow* aSVTKVW = VISU::GetViewWindow();
   myWidgetStack->raiseWidget(myPointsPane);
-  if (aSVTKVW)
-    aSVTKVW->SetSelectionMode(NodeSelection);
+  if(SVTK_ViewWindow* aViewWindow = VISU::GetViewWindow(myModule))
+    aViewWindow->SetSelectionMode(NodeSelection);
   onSelectionEvent();
 
   mySelectionDlg = this;
@@ -274,23 +276,23 @@ VisuGUI_SelectionDlg::~VisuGUI_SelectionDlg()
 
 void VisuGUI_SelectionDlg::onSelectionChange (int theId)
 {
-  SVTK_ViewWindow* aSVTKVW = VISU::GetViewWindow();
-  if (!aSVTKVW) return;
+  SVTK_ViewWindow* aViewWindow = VISU::GetViewWindow(myModule);
+  if (!aViewWindow) return;
 
   switch (theId) {
   case 0: // Points
     myWidgetStack->raiseWidget(myPointsPane);
-    aSVTKVW->SetSelectionMode(NodeSelection);
+    aViewWindow->SetSelectionMode(NodeSelection);
     onPointIdEdit(myIDValLbl->text());
     break;
   case 1: // Cells
     myWidgetStack->raiseWidget(myCellsPane);
-    aSVTKVW->SetSelectionMode(CellSelection);
+    aViewWindow->SetSelectionMode(CellSelection);
     onCellIdEdit(myCellIDValLbl->text());
     break;
   case 2: // Actor
     myWidgetStack->raiseWidget(myActorsPane);
-    aSVTKVW->SetSelectionMode(ActorSelection);
+    aViewWindow->SetSelectionMode(ActorSelection);
     onSelectionEvent();
   }
 }
@@ -298,11 +300,9 @@ void VisuGUI_SelectionDlg::onSelectionChange (int theId)
 
 void VisuGUI_SelectionDlg::closeEvent (QCloseEvent* theEvent)
 {
-  SVTK_ViewWindow* aSVTKVW = VISU::GetViewWindow();
-
   mySelectionDlg = NULL;
-  if (aSVTKVW)
-    aSVTKVW->SetSelectionMode(ActorSelection);
+  if(SVTK_ViewWindow* aViewWindow = VISU::GetViewWindow(myModule))
+    aViewWindow->SetSelectionMode(ActorSelection);
   disconnect(mySelectionMgr,0,0,0);
   QDialog::closeEvent(theEvent);
 }
@@ -328,8 +328,8 @@ template<class TData> QString getVector(TData* theData, int theId){
 #define ABS(a) (a>=0)?a:-a
 
 void VisuGUI_SelectionDlg::onSelectionEvent() {
-  SVTK_ViewWindow* aSVTKVW = VISU::GetViewWindow();
-  if (!aSVTKVW) return;
+  SVTK_ViewWindow* aViewWindow = VISU::GetViewWindow(myModule);
+  if (!aViewWindow) return;
 
   if (myFl) return;
   myFl = true;
@@ -339,14 +339,14 @@ void VisuGUI_SelectionDlg::onSelectionEvent() {
   SalomeApp_Application* anApp = dynamic_cast<SalomeApp_Application*>
     (SUIT_Session::session()->activeApplication());
 
-  SVTK_Selector* aSelector = aSVTKVW->GetSelector();
+  SVTK_Selector* aSelector = aViewWindow->GetSelector();
 
   VISU::Prs3d_i* aPrs3d = NULL;
   _PTR(SObject) aSObject;
   Handle(SALOME_InteractiveObject) anIO;
 
   SALOME_ListIO aListIO;
-  mySelectionMgr->selectedObjects(aListIO, SVTK_Viewer::Type());
+  mySelectionMgr->selectedObjects(aListIO);
 
   if (aListIO.Extent() == 1) {
     anIO = aListIO.First();
@@ -392,7 +392,7 @@ void VisuGUI_SelectionDlg::onSelectionEvent() {
     myFieldName->setText((aFieldName == "NULL") ? QString("No name") : aFieldName);
 
     VISU_Actor* anVISUActor =
-      VISU::FindActor(aSVTKVW, aSObject->GetID().c_str());
+      VISU::FindActor(aViewWindow, aSObject->GetID().c_str());
     if (anVISUActor) {
       float aCoord[6];
       anVISUActor->GetBounds(aCoord);
@@ -512,16 +512,16 @@ typedef  vtkIdType (vtkDataSet::* TDataSetMethod)();
 bool onIdEdit (const QString& theText,
                TDataSetMethod theMethod,
                bool theIsCell,
+              const SalomeApp_Module* theModule,
                LightApp_SelectionMgr* theSelectionMgr,
                QLabel* theMeshName,
                QString theValue,
                QLabel* theFieldName)
 {
-  SalomeApp_Application* anApp = dynamic_cast<SalomeApp_Application*>
-    (SUIT_Session::session()->activeApplication());
-  SVTK_ViewWindow* aSVTKVW = VISU::GetViewWindow();
-  if (!aSVTKVW) return false;
-  SVTK_Selector* aSelector = aSVTKVW->GetSelector();
+  SalomeApp_Application* anApp = theModule->getApp();
+  SVTK_ViewWindow* aViewWindow = VISU::GetViewWindow(theModule);
+  if (!aViewWindow) return false;
+  SVTK_Selector* aSelector = aViewWindow->GetSelector();
 
   VISU::Prs3d_i* aPrs3d = NULL;
   Handle(SALOME_InteractiveObject) anIO;
@@ -561,7 +561,7 @@ bool onIdEdit (const QString& theText,
     TColStd_MapOfInteger newIndices;
     newIndices.Add(anId);
     aSelector->AddOrRemoveIndex(anIO, newIndices, false);
-    aSVTKVW->highlight(anIO, true, true);
+    aViewWindow->highlight(anIO, true, true);
 
     return true;
 
@@ -576,7 +576,7 @@ void VisuGUI_SelectionDlg::onPointIdEdit (const QString& theText)
 {
   if (myFl) return;
   TDataSetMethod aMethod = &vtkDataSet::GetNumberOfPoints;
-  bool anIsSelected = onIdEdit(theText,aMethod,false,mySelectionMgr,
+  bool anIsSelected = onIdEdit(theText,aMethod,false,myModule,mySelectionMgr,
                               myMeshName,tr("WRN_NO_AVAILABLE_DATA"),
                               myFieldName);
   if (anIsSelected)
@@ -590,7 +590,7 @@ void VisuGUI_SelectionDlg::onCellIdEdit (const QString& theText)
 {
   if (myFl) return;
   TDataSetMethod aMethod = &vtkDataSet::GetNumberOfCells;
-  bool anIsSelected = onIdEdit(theText,aMethod,true,mySelectionMgr,
+  bool anIsSelected = onIdEdit(theText,aMethod,true,myModule,mySelectionMgr,
                               myMeshName,tr("WRN_NO_AVAILABLE_DATA"),
                               myFieldName);
   if (anIsSelected)
index 4fc4f265b450de8c506f9ec923f9b1463cc613b4..467e9c182d810b2d6e45589fd95ced5cfa034824 100644 (file)
@@ -38,12 +38,13 @@ class QLineEdit;
 class QTable;
 class LightApp_SelectionMgr;
 class SalomeApp_Application;
+class SalomeApp_Module;
 
 class VisuGUI_SelectionDlg: public QDialog {
   Q_OBJECT
 
 public:
-  VisuGUI_SelectionDlg (QWidget*);
+  VisuGUI_SelectionDlg (const SalomeApp_Module* theModule);
   virtual ~VisuGUI_SelectionDlg ();
 
 protected:
@@ -85,6 +86,7 @@ private slots:
   QLabel* myDYLbl;
   QLabel* myDZLbl;
 
+  const SalomeApp_Module* myModule;
   LightApp_SelectionMgr* mySelectionMgr;
   bool myFl;
 };
index ce88bbfc7b3324aabbaa316d34b840a3f85e4d33..ca1eea96bdb3c617901aab3b59bcb64bf7118961 100644 (file)
@@ -74,8 +74,9 @@ void VisuGUI_Timer::Stop()
     int diffr_sys  = RefToCurrentTMS->tms_stime - RefToInitialTMS->tms_stime;
     gettimeofday(RefToCurrentTimeB,tz);
 
-    Cumul_user += (double) diffr_user / CLK_TCK ;
-    Cumul_sys  += (double) diffr_sys  / CLK_TCK ;
+    static long aCLK_TCK=sysconf(_SC_CLK_TCK);
+    Cumul_user += (double) diffr_user / aCLK_TCK ;
+    Cumul_sys  += (double) diffr_sys  / aCLK_TCK ;
 #else
     SYSTEMTIME st;
     GetSystemTime(&st);
index 5484e621e8ffc4f2e5bfab591a5f4dd0e17e28c4..1fc889d10bfff0197d0fa355485b1fce4e563147 100644 (file)
@@ -462,9 +462,7 @@ namespace VISU
   ChangeRepresentation (const SalomeApp_Module* theModule,
                         VISU::PresentationType  theType)
   {
-    SUIT_ViewWindow* aView = GetActiveView(theModule, SVTK_Viewer::Type());
-    if (!aView) return;
-    SVTK_ViewWindow* vw  = dynamic_cast<SVTK_ViewWindow*>( aView );
+    SVTK_ViewWindow* vw  = GetViewWindow( theModule, false );
     if( !vw )
       return;
 
@@ -653,11 +651,15 @@ namespace VISU
   /*SVTK_ViewWindow*
   GetViewWindow(const SalomeApp_Module* theModule, const bool theCreate )
   {
-    if(SalomeApp_Application* anApp = theModule->getApp()){
-      if(SUIT_ViewManager* aViewManager = anApp->getViewManager( SVTK_Viewer::Type(), theCreate )){
-        if(SUIT_ViewWindow* aViewWindow = aViewManager->getActiveView()){
-          return dynamic_cast<SVTK_ViewWindow*>(aViewWindow);
-        }
+    if (SalomeApp_Application* anApp = theModule->getApp())
+    {
+      SVTK_ViewWindow* wnd = dynamic_cast<SVTK_ViewWindow*>(anApp->desktop()->activeWindow());
+      if( wnd )
+       return wnd;
+      else
+      {
+       if(SUIT_ViewManager* aViewManager = anApp->getViewManager( SVTK_Viewer::Type(), theCreate ))
+         return dynamic_cast<SVTK_ViewWindow*>( aViewManager->getActiveView() );
       }
     }
     return NULL;
@@ -816,15 +818,7 @@ namespace VISU
 
     try {
       thePrs->Update();
-
-      TViewWindows aViewWindows = GetViews(theModule);
-      for (int i = 0, iEnd = aViewWindows.size(); i < iEnd; i++) {
-        SVTK_ViewWindow* aView = aViewWindows[i];
-        if (VISU_Actor* anActor = FindActor(aView, anEntry.in())) {
-          isPublished = true;
-          thePrs->UpdateActor(anActor);
-        }
-      }
+      thePrs->UpdateActors();
     } catch (std::runtime_error& ex) {
       INFOS(ex.what());
       QApplication::restoreOverrideCursor();
@@ -832,14 +826,7 @@ namespace VISU
                               QObject::tr("ERR_CANT_BUILD_PRESENTATION") + ": " + QObject::tr(ex.what()),
                               QObject::tr("BUT_OK"));
 
-      TViewWindows aViewWindows = GetViews(theModule);
-      for (int i = 0, iEnd = aViewWindows.size(); i < iEnd; i++) {
-        SVTK_ViewWindow* aView = aViewWindows[i];
-        if (VISU_Actor* anActor = FindActor(aView, anEntry.in())) {
-          aView->RemoveActor(anActor);
-          anActor->Delete();
-        }
-      }
+      thePrs->RemoveActors();
       return;
     }
     QApplication::restoreOverrideCursor();
index bc2650dca293d6ef358beeda134800c11e00e6f6..868ab60672be4f118a6fed72a194313930c5df25 100644 (file)
@@ -61,8 +61,13 @@ namespace VISU
       if(VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(VISU::GetServant(theBase).in())){
        if(aType == VISU::TGAUSSPOINTS)
          ErasePrs3d<VVTK_Viewer>(theModule,aPrsObject,thIsUpdate);
-       else
-         ErasePrs3d<SVTK_Viewer>(theModule,aPrsObject,thIsUpdate);
+       else if(SUIT_ViewManager* aViewManager = theModule->getApp()->activeViewManager()){
+         QString aType = aViewManager->getType();
+         if(aType == SVTK_Viewer::Type())
+           ErasePrs3d<SVTK_Viewer>(theModule,aPrsObject,thIsUpdate);
+         else if(aType == VVTK_Viewer::Type())
+           ErasePrs3d<VVTK_Viewer>(theModule,aPrsObject,thIsUpdate);
+       }
       }
     }} // switch (aType)
   }
index 107f3e2463ee147ee9d4b6cf6c8eb356b75607cf..dedfe061344082f9cddbd95ba82e9de2f769d5cc 100644 (file)
@@ -19,6 +19,7 @@ VPATH=.:@srcdir@:@top_srcdir@/idl
 LIB = libVISUEngineImpl.la
 
 LIB_SRC = \
+       VISU_Result_i.cc \
        VISUConfig.cc \
        VISU_PrsObject_i.cc \
        VISU_Prs3d_i.cc \
@@ -35,7 +36,6 @@ LIB_SRC = \
        VISU_Mesh_i.cc \
        VISU_Table_i.cc \
        VISU_Gen_i.cc \
-       VISU_Result_i.cc \
        VISU_ViewManager_i.cc \
        VISU_View_i.cc \
        VISU_TimeAnimation.cxx \
index 6c0d4a6408a3ecbaf186b14af3c83966b7b336ca..f255cd5de4429e7d150daf38888f10a249ece03e 100644 (file)
@@ -606,7 +606,6 @@ VISU::GaussPoints_i
        vtkIdType aScalarMode = GetScalarMode();
        TMinMax aTMinMax = myField->GetMinMax(aScalarMode);
        aScalarBarCtrl->SetRangeGlobal(aTMinMax.first, aTMinMax.second);
-
        aScalarBarCtrl->SetOrientation(myOrientation);
 
        int aScalarBarMode;
@@ -620,6 +619,15 @@ VISU::GaussPoints_i
          }
        }
        
+       if (aScalarBarMode==1){
+         float aRangeGlobal[2];
+         //
+         aRangeGlobal[0]=aTMinMax.first;
+         aRangeGlobal[1]=aTMinMax.second;
+         
+         GetGaussPointsPL()->GetMapper()->SetScalarRange(aRangeGlobal);
+       }
+       
        aScalarBarCtrl->SetMode(aScalarBarMode);
 
        // Position
index 3ae3acd0c44c65900c10f76fb3746521e69b41b5..c6fe0cd97a800ddd04e6c095c00a37f02e16f4a8 100644 (file)
@@ -34,6 +34,7 @@ class VISU_GaussPointsPL;
 
 namespace VISU
 {
+  //! Class of the Gauss Points presentation.
   class GaussPoints_i : public virtual POA_VISU::GaussPoints,
                        public virtual VISU::TGaussPtsActorFactory,
                        public virtual ColoredPrs3d_i
@@ -65,6 +66,7 @@ namespace VISU
 
     typedef VISU::GaussPoints TInterface;
 
+    //! Get the Gauss Points Pipeline.
     VISU_GaussPointsPL* 
     GetGaussPointsPL();
 
@@ -80,37 +82,49 @@ namespace VISU
     void
     SetScaleFactor( float theScaleFactor );
 
+    //! Get color for Geometry mode of the presentation.
     QColor
     GetColor() { return myColor; }
 
+    //! Set color for Geometry mode of the presentation.
     void
     SetColor( const QColor& theColor ) { myColor = theColor; }
 
+    //! Get flag indicating which mode of the presentation is active.
+    /*! When Results mode is active, returns true. Geometry - false. */
     bool 
     GetIsColored() { return myIsColored; }
 
+    //! Get flag indicating which mode of the presentation is active.
     void
     SetIsColored( bool theIsColored );
 
+    //! Set path to the image using for Main Point Sprite texture.
     bool
     SetMainTexture( const QString& theMainTexture );
 
+    //! Get path to the image using for Main Point Sprite texture.
     const QString&
     GetMainTexture();
 
+    //! Set path to the image using for Alpha Point Sprite texture.
     bool
     SetAlphaTexture( const QString& theAlphaTexture );
 
+    //! Get path to the image using for Alpha Point Sprite texture.
     const QString&
     GetAlphaTexture();
 
+    //! Convert Main and AlphaMask images to VTI format and set them to pipeline.
     void
     SetTextures( const QString& theMainTexture,
                 const QString& theAlphaTexture );
 
+    //! Redirect the request to VISU_GaussPointsPL::SetAlphaThreshold.
     void
     SetAlphaThreshold(float theAlphaThreshold);
 
+    //! Redirect the request to VISU_GaussPointsPL::GetAlphaThreshold.
     float
     GetAlphaThreshold();
 
@@ -120,69 +134,87 @@ namespace VISU
     int
     GetPrimitiveType();
 
+    //! Redirect the request to VISU_GaussPointsPL::GetMaximumSupportedSize.
     float 
     GetMaximumSupportedSize();
 
+    //! Redirect the request to VISU_GaussPointsPL::SetClamp.
     void
     SetClamp(float theClamp);
 
+    //! Redirect the request to VISU_GaussPointsPL::GetClamp.
     float
     GetClamp();
 
+    //! Redirect the request to VISU_GaussPointsPL::SetSize.
     void
     SetGeomSize(float theGeomSize);
 
+    //! Redirect the request to VISU_GaussPointsPL::GetSize.
     float 
     GetGeomSize();
 
+    //! Redirect the request to VISU_GaussPointsPL::SetMinSize.
     void
     SetMinSize(float theMinSize);
 
+    //! Redirect the request to VISU_GaussPointsPL::GetMinSize.
     float 
     GetMinSize();
 
+    //! Redirect the request to VISU_GaussPointsPL::SetMaxSize.
     void
     SetMaxSize(float theMaxSize);
 
+    //! Redirect the request to VISU_GaussPointsPL::GetMaxSize.
     float 
     GetMaxSize();
 
-    float
-    GetMaxPointSize();
-
+    //! Redirect the request to VISU_GaussPointsPL::SetMagnification.
     void
     SetMagnification(float theMagnification);
 
+    //! Redirect the request to VISU_GaussPointsPL::GetMagnification.
     float
     GetMagnification();
 
+    //! Redirect the request to VISU_GaussPointsPL::SetMagnificationIncrement.
     void
     SetMagnificationIncrement(float theIncrement);
 
+    //! Redirect the request to VISU_GaussPointsPL::GetMagnificationIncrement.
     float
     GetMagnificationIncrement();
 
+    //! Set flag indicating which scalar bar is active.
     void
     SetIsActiveLocalScalarBar(const bool theFlag);
 
+    //! Get flag indicating which scalar bar is active.
     bool
     GetIsActiveLocalScalarBar() const;
 
+    //! Set flag indicating visibility of global scalar bar.
     void
     SetIsDispGlobalScalarBar(const bool theFlag);
 
+    //! Get flag indicating visibility of global scalar bar.
     bool
     GetIsDispGlobalScalarBar() const;
 
+    //! Redirect the request to VISU_GaussPointsPL::SetBicolor.
     void
     SetBiColor(bool theIsBiColor);
 
+    //! Redirect the request to VISU_GaussPointsPL::GetBicolor.
     bool
     GetBiColor();
 
+    //! Set value of the distance between global and local scalar bars.
     void
     SetSpacing(const float theSpacing);
 
+    //! Get value of the distance between global and local scalar bars.
     float
     GetSpacing() const;
 
index cda09ad0cc6fe52863ddeb64e3920304f92b8647..4191181540ade7a243d36615b09cfd52a373d763 100644 (file)
@@ -499,6 +499,23 @@ namespace VISU{
     }
   }
 
+  Result_ptr VISU_Gen_i::CreateResult(const char* theFileName){
+    if(myStudyDocument->GetProperties()->IsLocked())
+      return Result::_nil();
+    Mutex mt(myMutex);
+    aFileInfo.setFile(theFileName);
+    Result_i* pResult = new Result_i(myStudyDocument,
+                                    Result_i::eFile,
+                                    Result_i::eImportFile,
+                                    false);
+    if(pResult->Create(theFileName) != NULL)
+      return pResult->_this();
+    else{
+      pResult->_remove_ref();
+      return VISU::Result::_nil();
+    }
+  }
+
   Result_ptr VISU_Gen_i::CopyAndImportFile(const char* theFileName){
     if(myStudyDocument->GetProperties()->IsLocked())
       return Result::_nil();
index a387b2e5186ba9292f35130ce3da052169edde2c..4ad14670fc04f9b9afe1344848805c50f41e976d 100644 (file)
@@ -44,6 +44,7 @@ namespace VISU{
 
     //Create Result
     virtual Result_ptr ImportFile(const char* theFileName);
+    virtual Result_ptr CreateResult(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);
index 2cd195836391936d2c8e8e3d22e5d40b1fe11aac..17c7d61a56949fa4a444216949bc02010bedb57e 100644 (file)
@@ -212,7 +212,7 @@ VISU::Prs3d_i
     theActor->SetPipeLine(GetPipeLine());
 
     theActor->SetFactory(this);
-    myUpdateActorsSignal.connect(boost::bind(&VISU_Actor::Update,theActor));
+    myUpdateActorsSignal.connect(boost::bind(&VISU_Actor::UpdateFromFactory,theActor));
     myRemoveActorsFromRendererSignal.connect(boost::bind(&VISU_Actor::RemoveFromRender,theActor));
 
     myActorCollection->AddItem(theActor);
@@ -230,20 +230,29 @@ VISU::Prs3d_i
 
 void
 VISU::Prs3d_i
-::UpdateActor(VISU_Actor* theActor) 
+::RemoveActor(VISU_Actor* theActor) 
 {
-  if(MYDEBUG) MESSAGE("Prs3d_i::UpdateActor - this = "<<this<<"; theActor = "<<theActor);
-  theActor->ShallowCopyPL(myPipeLine);
-  theActor->SetPosition(myOffset);
-  theActor->Modified();
+  if(MYDEBUG) MESSAGE("Prs3d_i::RemoveActor - this = "<<this<<"; theActor = "<<theActor);
+  myActorCollection->RemoveItem(theActor);
 }
 
 void
 VISU::Prs3d_i
-::RemoveActor(VISU_Actor* theActor) 
+::RemoveActors()
 {
-  if(MYDEBUG) MESSAGE("Prs3d_i::RemoveActor - this = "<<this<<"; theActor = "<<theActor);
-  myActorCollection->RemoveItem(theActor);
+  if(MYDEBUG) MESSAGE("Prs3d_i::RemoveActors - this = "<<this);
+  myRemoveActorsFromRendererSignal();
+  myActorCollection->RemoveAllItems();
+}
+
+void
+VISU::Prs3d_i
+::UpdateActor(VISU_Actor* theActor) 
+{
+  if(MYDEBUG) MESSAGE("Prs3d_i::UpdateActor - this = "<<this<<"; theActor = "<<theActor);
+  theActor->ShallowCopyPL(myPipeLine);
+  theActor->SetPosition(myOffset);
+  theActor->Modified();
 }
 
 void
index 7bad0b68048906198ab95dee51e4a5e10052a5b8..a92161658e109add000487ac457df21384b388de 100644 (file)
@@ -50,6 +50,16 @@ namespace VISU
   class Result_i;
 
   //----------------------------------------------------------------------------
+  //! Base class for all VTK 3D presentations.
+  /*!
+    It is a root class for a middle level of VISU functionality.
+    Almost all functionality of the the class implemented through redirection 
+    external requestes to its VISU_PipeLine.
+    It define an interface and implement the following topics:
+    - provide persistent mechanism;
+    - implement basic actor management (CreateActor, UpdateActor, UpdateActors, RemoveActor and RemoveActors);
+    - implement common 3D functionality like "clipping planes" and offset.
+  */
   class Prs3d_i :
     public virtual POA_VISU::Prs3d,
     public virtual SALOME::GenericObj_i,
@@ -62,12 +72,17 @@ namespace VISU
 
   public:
     //----------------------------------------------------------------------------
+    //! A constructor to create a fresh instance of the class
     explicit
     Prs3d_i(Result_i* theResult,
            bool theAddToStudy);
+
+    //! A constructor to restore an instance of the class
     explicit
     Prs3d_i(Result_i* theResult,
            SALOMEDS::SObject_ptr theSObject);
+
+    //! To create a deep copy from another instance of the class
     virtual
     void
     SameAs(const Prs3d_i* theOrigin);
@@ -76,26 +91,32 @@ namespace VISU
     ~Prs3d_i();
 
     //----------------------------------------------------------------------------
+    //! To generate an unique type name for the class (used into persistent functionality)
     virtual
     const char* 
     GetComment() const = 0;
 
+    //! To generate an unique name for the instance of the class
     virtual
     QString
     GenerateName() = 0;
 
+    //! To restore paramters of the instance from Storable::TRestoringMap
     virtual
     Storable* 
     Restore(const Storable::TRestoringMap& theMap);
 
+    //! To save paramters of the instance to std::ostringstream
     virtual
     void
     ToStream(std::ostringstream& theStr);
 
     //----------------------------------------------------------------------------
+    //! Get corresponding Result_i
     Result_i* 
     GetResult() const;
 
+    //! Get corresponding SALOMEDS::SObject
     virtual
     SALOMEDS::SObject_var 
     GetSObject();
@@ -104,34 +125,47 @@ namespace VISU
     GetMeshName() const;
 
     //----------------------------------------------------------------------------
+    //! To update is internal state
     virtual 
     void
     Update();
 
+    //! To remove the instance from study
     virtual
     void
     RemoveFromStudy();
 
     //----------------------------------------------------------------------------
+    //! Get corresponding VISU_PipeLine
     VISU_PipeLine* 
     GetPL();
 
+    //! Get input of the VISU_PipeLine
     vtkUnstructuredGrid* 
     GetInput();
 
     //----------------------------------------------------------------------------
+    //! To define a way to create VTK representation of the instance
     virtual 
     VISU_Actor* 
     CreateActor(const Handle(SALOME_InteractiveObject)& theIO = NULL) = 0;
 
+    //! To unregister the pointed actor
     virtual 
     void
     RemoveActor(VISU_Actor* theActor);
 
+    //! To unregister all actors of the instance
+    virtual 
+    void
+    RemoveActors();
+
+    //! To update the pointed actor
     virtual 
     void
     UpdateActor(VISU_Actor* theActor);
 
+    //! To update all actors of the instance
     virtual 
     void
     UpdateActors();
index 2ecd1f0fcf551cd969d12070090f523e81acbc6d..c42725cba3ad24e8a8f764786ae5467835e32b93 100644 (file)
@@ -28,6 +28,7 @@
 
 #include "VISU_Convertor_impl.hxx"
 #include "VISU_CorbaMedConvertor.hxx"
+#include "VISU_ConvertorUtils.hxx"
 #include "VISU_PipeLine.hxx"
 
 #include "SUIT_ResourceMgr.h"
 #include "SALOMEDS_Tool.hxx"
 #include "HDFascii.hxx"
 
+#include "SUIT_Session.h"
+#include "SALOME_Event.hxx"
+#include "SalomeApp_Study.h"
+#include "SalomeApp_Application.h"
+
+#include <boost/thread/recursive_mutex.hpp>
+#include <boost/thread/thread.hpp>
+
+#include <boost/thread/mutex.hpp>
+#include <boost/bind.hpp>
+
 // QT Includes
 #include <qstring.h>
 #include <qfileinfo.h>
+#include <qsemaphore.h>
+#include <qthread.h>
 
 // VTK Includes
 #include <vtkCell.h>
@@ -51,92 +65,718 @@ using namespace std;
 
 #ifdef _DEBUG_
 static int MYDEBUG = 0;
+static int MYTIMEDEBUG = 0;
 #else
 static int MYDEBUG = 0;
+static int MYTIMEDEBUG = 0;
 #endif
 
-VISU::Result_var VISU::FindResult (SALOMEDS::SObject_ptr theSObject)
+
+namespace VISU
 {
-  SALOMEDS::SComponent_var aSComponent = theSObject->GetFatherComponent();
-  SALOMEDS::SObject_var aFather = theSObject->GetFather();
-  CORBA::String_var aComponentID (aSComponent->GetID());
-  CORBA::String_var aFatherID    (aFather->GetID());
-  VISU::Result_var aResult;
-  while (strcmp(aComponentID, aFatherID) != 0) {
-    CORBA::Object_var anObject = VISU::SObjectToObject(aFather);
-    if (!CORBA::is_nil(anObject)) {
-      aResult = VISU::Result::_narrow(anObject);
-      if (!aResult->_is_nil()) return aResult;
-    }
-    aFather = aFather->GetFather();
-    aFatherID = aFather->GetID();
+  //---------------------------------------------------------------
+  Result_var 
+  FindResult (SALOMEDS::SObject_ptr theSObject)
+  {
+    SALOMEDS::SComponent_var aSComponent = theSObject->GetFatherComponent();
+    SALOMEDS::SObject_var aFather = theSObject->GetFather();
+    CORBA::String_var aComponentID (aSComponent->GetID());
+    CORBA::String_var aFatherID    (aFather->GetID());
+    Result_var aResult;
+    while (strcmp(aComponentID, aFatherID) != 0) {
+      CORBA::Object_var anObject = SObjectToObject(aFather);
+      if (!CORBA::is_nil(anObject)) {
+       aResult = Result::_narrow(anObject);
+       if (!aResult->_is_nil()) return aResult;
+      }
+      aFather = aFather->GetFather();
+      aFatherID = aFather->GetID();
+    }
+    return aResult;
   }
-  return aResult;
-}
 
-QString GenerateName (const char* theName)
-{
-  typedef map<string,int> TNameMap;
-  static TNameMap aMap;
-  TNameMap::const_iterator i = aMap.find(theName);
-  QString tmp;
-  if (i == aMap.end()) {
-    aMap[theName] = 0;
-    tmp = theName;
-  } else {
-    tmp = VISU::GenerateName(theName,++aMap[theName]);
+
+  //---------------------------------------------------------------
+  typedef boost::recursive_mutex TMutex;
+  typedef TMutex::scoped_lock TLock;
+
+  static TMutex myMutex;
+
+  //---------------------------------------------------------------
+  struct TGetStudy: public SALOME_Event
+  {
+    typedef _PTR(Study) TResult;
+    TResult myResult;
+    int myStudyId;
+
+    TGetStudy(const int theStudyId):
+      myStudyId(theStudyId)
+    {}
+    
+    virtual
+    void
+    Execute()
+    {
+      SUIT_Session* aSession = SUIT_Session::session();
+      QPtrList<SUIT_Application> anApplications = aSession->applications();
+      QPtrListIterator<SUIT_Application> anIter (anApplications);
+      while (SUIT_Application* aSApp = anIter.current()) {
+       if(SalomeApp_Application* anApp = dynamic_cast<SalomeApp_Application*>(aSApp)){
+         if(SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>(anApp->activeStudy())) {
+           myResult = aStudy->studyDS();
+           break;
+         }
+       }
+       ++anIter;
+      }
+    }
+  };
+
+
+  //---------------------------------------------------------------
+  QString
+  GenerateName (const char* theName)
+  {
+    TLock aLock(myMutex);
+
+    typedef map<string,int> TNameMap;
+    static TNameMap aMap;
+
+    TNameMap::const_iterator i = aMap.find(theName);
+    QString tmp;
+    if (i == aMap.end()) {
+      aMap[theName] = 0;
+      tmp = theName;
+    } else {
+      tmp = GenerateName(theName,++aMap[theName]);
+    }
+    if(MYDEBUG) MESSAGE("GenerateName - "<<tmp<<" from - "<<theName<<"; " <<aMap[theName]);
+    return tmp;
   }
-  if(MYDEBUG) MESSAGE("GenerateName - "<<tmp<<" from - "<<theName<<"; " <<aMap[theName]);
-  return tmp;
-}
+  
 
-QString GenerateFieldName (const string& theName, const string& theUnits)
-{
-  static QString aName;
-  const string tmp (theUnits.size(),' ');
-  if (theUnits == "" || theUnits == tmp)
-    aName.sprintf("%s, -",theName.c_str());
-  else
-    aName.sprintf("%s, %s",theName.c_str(),theUnits.c_str());
-  aName = aName.simplifyWhiteSpace();
-  return aName.latin1();
-}
+  //---------------------------------------------------------------
+  QString 
+  GenerateFieldName (const string& theName, const string& theUnits)
+  {
+    QString aName;
+    const string tmp (theUnits.size(),' ');
+    if (theUnits == "" || theUnits == tmp)
+      aName.sprintf("%s, -",theName.c_str());
+    else
+      aName.sprintf("%s, %s",theName.c_str(),theUnits.c_str());
+    aName = aName.simplifyWhiteSpace();
+    return aName.latin1();
+  }
 
-void CreateReference (SALOMEDS::Study_ptr theStudyDocument,
-                     const string& theFatherEntry, const string& theRefEntry)
-{
-  SALOMEDS::StudyBuilder_var aStudyBuilder = theStudyDocument->NewBuilder();
-  SALOMEDS::SObject_var aFather = theStudyDocument->FindObjectID(theFatherEntry.c_str());
-  SALOMEDS::SObject_var newObj = aStudyBuilder->NewObject(aFather);
-  SALOMEDS::SObject_var aRefSObj = theStudyDocument->FindObjectID(theRefEntry.c_str());
-  aStudyBuilder->Addreference(newObj,aRefSObj);
-}
 
-string GetComponentDataType (SALOMEDS::SObject_ptr theSObject)
-{
-  SALOMEDS::SComponent_var aCompRefSObj = theSObject->GetFatherComponent();
-  CORBA::String_var aDataType = aCompRefSObj->ComponentDataType();
-  return aDataType.in();
+  //---------------------------------------------------------------
+  string
+  GetComponentDataType (SALOMEDS::SObject_ptr theSObject)
+  {
+    SALOMEDS::SComponent_var aCompRefSObj = theSObject->GetFatherComponent();
+    CORBA::String_var aDataType = aCompRefSObj->ComponentDataType();
+    return aDataType.in();
+  }
+
+
+  //---------------------------------------------------------------
+  void
+  CreateReference (SALOMEDS::Study_ptr theStudyDocument,
+                  const string& theFatherEntry, 
+                  const string& theRefEntry)
+  {
+    SALOMEDS::StudyBuilder_var aStudyBuilder = theStudyDocument->NewBuilder();
+    SALOMEDS::SObject_var aFather = theStudyDocument->FindObjectID(theFatherEntry.c_str());
+    SALOMEDS::SObject_var newObj = aStudyBuilder->NewObject(aFather);
+    SALOMEDS::SObject_var aRefSObj = theStudyDocument->FindObjectID(theRefEntry.c_str());
+    aStudyBuilder->Addreference(newObj,aRefSObj);
+  }
+
+
+  //---------------------------------------------------------------
+  void
+  CreateReference (_PTR(Study) theStudyDocument,
+                  const string& theFatherEntry, 
+                  const string& theRefEntry)
+  {
+    TLock aLock(myMutex);
+
+    _PTR(StudyBuilder) aStudyBuilder = theStudyDocument->NewBuilder();
+    _PTR(SObject) aFather = theStudyDocument->FindObjectID(theFatherEntry);
+    _PTR(SObject) aNewObj = aStudyBuilder->NewObject(aFather);
+    _PTR(SObject) aRefSObj = theStudyDocument->FindObjectID(theRefEntry);
+    aStudyBuilder->Addreference(aNewObj,aRefSObj);
+  }
+
+  string 
+  CreateAttributes(_PTR(Study) theStudyDocument,
+                  const string& theFatherEntry, 
+                  const string& theIOR, 
+                  const string& theName,
+                  const string& thePersistentRef, 
+                  const string& theComment,
+                  CORBA::Boolean theCreateNew)
+  {
+    TLock aLock(myMutex);
+
+    _PTR(StudyBuilder) aStudyBuilder = theStudyDocument->NewBuilder();
+    _PTR(SObject) aFather = theStudyDocument->FindObjectID(theFatherEntry);
+
+    _PTR(SObject) aNewObj;
+    if(theCreateNew)
+      aNewObj = aStudyBuilder->NewObject(aFather);
+    else
+      aNewObj = aFather;
+
+    _PTR(GenericAttribute) anAttr;
+    if (theIOR != "") {
+      anAttr = aStudyBuilder->FindOrCreateAttribute(aNewObj, "AttributeIOR");
+      _PTR(AttributeIOR) anIOR (anAttr);
+      anIOR->SetValue(theIOR);
+    }
+    if (theName != "") {
+      anAttr = aStudyBuilder->FindOrCreateAttribute(aNewObj, "AttributeName");
+      _PTR(AttributeName) aName (anAttr);
+      aName->SetValue(theName);
+    }
+    if (thePersistentRef != "") {
+      anAttr = aStudyBuilder->FindOrCreateAttribute(aNewObj, "AttributePersistentRef");
+      _PTR(AttributePersistentRef) aPRef (anAttr);
+      aPRef->SetValue(thePersistentRef);
+    }
+    if (theComment != "") {
+      anAttr = aStudyBuilder->FindOrCreateAttribute(aNewObj, "AttributeComment");
+      _PTR(AttributeComment) aCmnt (anAttr);
+      aCmnt->SetValue(theComment);
+    }
+    return aNewObj->GetID();
+  }
+
+  //---------------------------------------------------------------
+  struct TResultManager
+  {
+    Result_i* myResult;
+
+    TResultManager(Result_i* theResult):
+      myResult(theResult)
+    {
+      myResult->Register();
+    }
+
+    ~TResultManager()
+    {
+      myResult->Destroy();
+    }
+  };
+
+
+  //---------------------------------------------------------------
+  struct TTransactionManager
+  {
+    _PTR(StudyBuilder) myStudyBuilder;
+
+    TTransactionManager(_PTR(Study) theStudyDocument):
+      myStudyBuilder(theStudyDocument->NewBuilder())
+    {
+      TLock aLock(myMutex);
+      myStudyBuilder->NewCommand();
+    }
+
+    ~TTransactionManager()
+    {
+      TLock aLock(myMutex);
+      myStudyBuilder->CommitCommand();
+    }
+  };
+
+
+  //---------------------------------------------------------------
+  struct TUpdateObjBrowser: public SALOME_Event
+  {
+    int myStudyId;
+    CORBA::Boolean* myIsDone;
+    TUpdateObjBrowser(const int theStudyId,
+                     CORBA::Boolean* theIsDone):
+      myStudyId(theStudyId),
+      myIsDone(theIsDone)
+    {}
+    
+    virtual
+    void
+    Execute()
+    {
+      TLock aLock(myMutex);
+      SUIT_Session* aSession = SUIT_Session::session();
+      QPtrList<SUIT_Application> anApplications = aSession->applications();
+      QPtrListIterator<SUIT_Application> anIter (anApplications);
+      while (SUIT_Application* aSApp = anIter.current()) {
+       if(SalomeApp_Application* anApp = dynamic_cast<SalomeApp_Application*>(aSApp)){
+         if (SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>(anApp->activeStudy())) {
+           if (_PTR(Study) aCStudy = aStudy->studyDS()) {
+             if (myStudyId == aCStudy->StudyId()) {
+               TTimerLog aTimerLog(MYTIMEDEBUG,"Result_i::updateObjectBrowser");
+               anApp->updateObjectBrowser();
+               *myIsDone = true;
+               break;
+             }
+           }
+         }
+       }
+       ++anIter;
+      }
+    }
+  };
+
+
+  //---------------------------------------------------------------
+  void
+  BuildEntities(Result_i* theResult,
+               VISU_Convertor* theInput,
+               CORBA::Boolean* theIsDone,
+               std::string theResultEntry,
+               _PTR(Study) theStudy)
+  {
+    if(*theIsDone)
+      return;
+
+    TTimerLog aTimerLog(MYTIMEDEBUG,"Result_i::BuildEntities");
+    TResultManager aResultManager(theResult);
+    TTransactionManager aTransactionManager(theStudy);
+
+    {
+      TTimerLog aTimerLog(MYTIMEDEBUG,"theInput->BuildEntities");
+      theInput->BuildEntities();
+    }
+
+    QString aComment;
+    const TMeshMap& aMeshMap = theInput->GetMeshMap();
+    TMeshMap::const_iterator aMeshMapIter = aMeshMap.begin();
+    for(; aMeshMapIter != aMeshMap.end(); aMeshMapIter++){
+      const string& aMeshName = aMeshMapIter->first;
+      const PMesh& aMesh = aMeshMapIter->second;
+      const TMeshOnEntityMap& aMeshOnEntityMap = aMesh->myMeshOnEntityMap;
+      if(aMeshOnEntityMap.empty()) 
+       continue;
+    
+      aComment.sprintf("myComment=MESH;myName=%s;myDim=%d",
+                      aMeshName.c_str(),
+                      aMesh->myDim);
+      aMesh->myEntry = 
+       CreateAttributes(theStudy,
+                        theResultEntry,
+                        "",
+                        aMeshName,
+                        "",
+                        aComment.latin1(),
+                        true);
+    
+      aComment.sprintf("myComment=FAMILIES;myMeshName=%s",
+                      aMeshName.c_str());
+      string aSubMeshesEntry = 
+       CreateAttributes(theStudy,
+                        aMesh->myEntry,
+                        "",
+                        "Families",
+                        "",
+                        aComment.latin1(),
+                        true);
+      //Import entities
+      TMeshOnEntityMap::const_iterator aMeshOnEntityMapIter = aMeshOnEntityMap.begin();
+      for(; aMeshOnEntityMapIter != aMeshOnEntityMap.end(); aMeshOnEntityMapIter++){
+       const TEntity& anEntity = aMeshOnEntityMapIter->first;
+       const PMeshOnEntity& aMeshOnEntity = aMeshOnEntityMapIter->second;
+       
+       string anEntityName;
+       switch(anEntity){
+       case NODE_ENTITY: 
+         anEntityName = "onNodes"; 
+         break;
+       case EDGE_ENTITY: 
+         anEntityName = "onEdges"; 
+         break;
+       case FACE_ENTITY: 
+         anEntityName = "onFaces"; 
+         break;
+       case CELL_ENTITY: 
+         anEntityName = "onCells"; 
+         break;
+       default:
+       continue;
+       }
+       
+       aComment.sprintf("myComment=ENTITY;myType=%d;myMeshName=%s;myId=%d",
+                        VISU::TENTITY,
+                        aMeshName.c_str(),
+                        anEntity);
+       
+       aMeshOnEntity->myEntry = 
+         CreateAttributes(theStudy, 
+                          aSubMeshesEntry, 
+                          "", 
+                          anEntityName.c_str(), 
+                          "", 
+                          aComment.latin1(), 
+                          true);
+      }
+    }
+    
+    ProcessVoidEvent(new TUpdateObjBrowser(theStudy->StudyId(),theIsDone));
+  }
+
+  //---------------------------------------------------------------
+  void
+  BuildGroups(Result_i* theResult,
+             VISU_Convertor* theInput,
+             CORBA::Boolean* theIsDone,
+             CORBA::Boolean theIsBuild,
+             _PTR(Study) theStudy)
+  {
+    if(!theIsBuild || *theIsDone)
+      return;
+
+    TTimerLog aTimerLog(MYTIMEDEBUG,"Result_i::BuildGroups");
+    TResultManager aResultManager(theResult);
+    TTransactionManager aTransactionManager(theStudy);
+    
+    {
+      TTimerLog aTimerLog(MYTIMEDEBUG,"theInput->BuildGroups");
+      theInput->BuildGroups();
+    }
+
+    QString aComment;
+    const TMeshMap& aMeshMap = theInput->GetMeshMap();
+    TMeshMap::const_iterator aMeshMapIter = aMeshMap.begin();
+    for(; aMeshMapIter != aMeshMap.end(); aMeshMapIter++){
+      const string& aMeshName = aMeshMapIter->first;
+      const PMesh& aMesh = aMeshMapIter->second;
+      
+      const TMeshOnEntityMap& aMeshOnEntityMap = aMesh->myMeshOnEntityMap;
+      if(aMeshOnEntityMap.empty()) 
+       continue;
+      
+      TMeshOnEntityMap::const_iterator aMeshOnEntityMapIter = aMeshOnEntityMap.begin();
+      for(; aMeshOnEntityMapIter != aMeshOnEntityMap.end(); aMeshOnEntityMapIter++){
+       const TEntity& anEntity = aMeshOnEntityMapIter->first;
+       const PMeshOnEntity& aMeshOnEntity = aMeshOnEntityMapIter->second;
+       
+       const TFamilyMap& aFamilyMap = aMeshOnEntity->myFamilyMap;
+       TFamilyMap::const_iterator aFamilyMapIter = aFamilyMap.begin();
+       for(; aFamilyMapIter != aFamilyMap.end(); aFamilyMapIter++){
+         const string& aFamilyName = aFamilyMapIter->first;
+         const PFamily& aFamily = aFamilyMapIter->second;
+         aComment.sprintf("myComment=FAMILY;myType=%d;myMeshName=%s;myEntityId=%d;myName=%s",
+                          TFAMILY,
+                          aMeshName.c_str(),
+                          anEntity,
+                          aFamilyName.c_str());
+         aFamily->myEntry =
+           CreateAttributes(theStudy,
+                            aMeshOnEntity->myEntry,
+                            "",
+                            aFamilyName,
+                            "",
+                            aComment.latin1(),
+                            true);
+       }
+      }
+      //Importing groups
+      const TGroupMap& aGroupMap = aMesh->myGroupMap;
+      if(!aGroupMap.empty()){
+       aComment.sprintf("myComment=GROUPS;myMeshName=%s",
+                        aMeshName.c_str());
+       string aGroupsEntry =
+         CreateAttributes(theStudy,
+                          aMesh->myEntry,
+                          "",
+                          "Groups",
+                          "",
+                          aComment.latin1(),
+                          true);
+       TGroupMap::const_iterator aGroupMapIter = aGroupMap.begin();
+       for(; aGroupMapIter != aGroupMap.end(); aGroupMapIter++){
+         const string& aGroupName = aGroupMapIter->first;
+         const PGroup& aGroup = aGroupMapIter->second;
+         aComment.sprintf("myComment=GROUP;myType=%d;myMeshName=%s;myName=%s",
+                          TGROUP,aMeshName.c_str(),aGroupName.c_str());
+         aGroup->myEntry = 
+           CreateAttributes(theStudy,
+                            aGroupsEntry,
+                            "",
+                            aGroupName,
+                            "",
+                            aComment.latin1(),
+                            true);
+         const TFamilySet& aFamilySet = aGroup->myFamilySet;
+         TFamilySet::const_iterator aFamilyIter = aFamilySet.begin();
+         for(; aFamilyIter != aFamilySet.end(); aFamilyIter++){
+           const PFamily& aFamily = *aFamilyIter;
+           CreateReference(theStudy,
+                           aGroup->myEntry,
+                           aFamily->myEntry);
+         }
+       }
+      }
+    }
+    
+    ProcessVoidEvent(new TUpdateObjBrowser(theStudy->StudyId(),theIsDone));
+  }
+
+
+  //---------------------------------------------------------------
+  void
+  BuildFields(Result_i* theResult,
+             VISU_Convertor* theInput,
+             CORBA::Boolean* theIsDone,
+             CORBA::Boolean theIsBuild,
+             _PTR(Study) theStudy)
+  {
+    if(!theIsBuild || *theIsDone)
+      return;
+
+    TTimerLog aTimerLog(MYTIMEDEBUG,"Result_i::BuildFields");
+    TResultManager aResultManager(theResult);
+    TTransactionManager aTransactionManager(theStudy);
+
+    {
+      TTimerLog aTimerLog(MYTIMEDEBUG,"theInput->BuildFields");
+      theInput->BuildFields();
+    }
+
+    QString aComment;
+    const TMeshMap& aMeshMap = theInput->GetMeshMap();
+    TMeshMap::const_iterator aMeshMapIter = aMeshMap.begin();
+    for(; aMeshMapIter != aMeshMap.end(); aMeshMapIter++){
+      const string& aMeshName = aMeshMapIter->first;
+      const PMesh& aMesh = aMeshMapIter->second;
+      
+      const TMeshOnEntityMap& aMeshOnEntityMap = aMesh->myMeshOnEntityMap;
+      if(aMeshOnEntityMap.empty()) 
+       continue;
+      
+      //Import fields
+      string aFieldsEntry;
+      bool anIsFieldsEntryCreated = false;
+      
+      TMeshOnEntityMap::const_iterator aMeshOnEntityMapIter = aMeshOnEntityMap.begin();
+      for(; aMeshOnEntityMapIter != aMeshOnEntityMap.end(); aMeshOnEntityMapIter++){
+       const TEntity& anEntity = aMeshOnEntityMapIter->first;
+       const PMeshOnEntity& aMeshOnEntity = aMeshOnEntityMapIter->second;
+       const TFieldMap& aFieldMap = aMeshOnEntity->myFieldMap;
+       TFieldMap::const_iterator aFieldMapIter = aFieldMap.begin();
+       for(; aFieldMapIter != aFieldMap.end(); aFieldMapIter++){
+         if(!anIsFieldsEntryCreated){
+           aComment.sprintf("myComment=FIELDS;myMeshName=%s",
+                            aMeshName.c_str());
+           aFieldsEntry =
+             CreateAttributes(theStudy,
+                              aMesh->myEntry,
+                              "",
+                              "Fields",
+                              "",
+                              aComment.latin1(),
+                              true);
+           anIsFieldsEntryCreated = true;
+         }
+         const string& aFieldName = aFieldMapIter->first;
+         const PField& aField = aFieldMapIter->second;
+         const TValField& aValField = aField->myValField;
+         QString aFieldNameWithUnit = GenerateFieldName(aFieldName,aField->myUnitNames[0]);
+         aComment.sprintf("myComment=FIELD;myType=%d;myMeshName=%s;myEntityId=%d;myName=%s;myNbTimeStamps=%d;myNumComponent=%d",
+                          TFIELD,
+                          aMeshName.c_str(),
+                          anEntity,
+                          aFieldName.c_str(),
+                          aValField.size(),
+                          aField->myNbComp);
+         aField->myEntry = 
+           CreateAttributes(theStudy,
+                            aFieldsEntry,
+                            "",
+                            aFieldNameWithUnit.latin1(),
+                            "",
+                            aComment.latin1(),
+                            true);
+         CreateReference(theStudy,
+                         aField->myEntry,
+                         aMeshOnEntity->myEntry);
+         TValField::const_iterator aValFieldIter = aValField.begin();
+         for(; aValFieldIter != aValField.end(); aValFieldIter++){
+           int aTimeStamp = aValFieldIter->first;
+           const PValForTime& aValForTime = aValFieldIter->second;
+           aComment.sprintf("myComment=TIMESTAMP;myType=%d;myMeshName=%s;myEntityId=%d;myFieldName=%s;myTimeStampId=%d;myNumComponent=%d",
+                            TTIMESTAMP,
+                            aMeshName.c_str(),
+                            anEntity,
+                            aFieldName.c_str(),
+                            aTimeStamp,
+                            aField->myNbComp);
+           string aTimeStampId = VISU_Convertor::GenerateName(aValForTime->myTime);
+           aValForTime->myEntry = 
+             CreateAttributes(theStudy,
+                              aField->myEntry,
+                              "",
+                              aTimeStampId,
+                              "",
+                              aComment.latin1(),
+                              true);
+         }
+       }
+      }
+    }
+    
+    ProcessVoidEvent(new TUpdateObjBrowser(theStudy->StudyId(),theIsDone));
+  }
+
+
+  //---------------------------------------------------------------
+  void
+  BuildMinMax(Result_i* theResult,
+             VISU_Convertor* theInput,
+             CORBA::Boolean* theIsDone,
+             CORBA::Boolean theIsBuild)
+  {
+    if(!theIsBuild || *theIsDone)
+      return;
+
+    TTimerLog aTimerLog(MYTIMEDEBUG,"Result_i::BuildMinMax");
+    TResultManager aResultManager(theResult);
+    
+    theInput->BuildMinMax();
+    *theIsDone = true;
+  }
+
+
+  //---------------------------------------------------------------
+  void
+  BuildFieldDataTree(Result_i* theResult,
+                    VISU_Convertor* theInput,
+                    CORBA::Boolean* theIsFieldsDone,
+                    CORBA::Boolean theIsBuildFields,
+                    CORBA::Boolean* theIsMinMaxDone,
+                    CORBA::Boolean theIsBuildMinMax,
+                    _PTR(Study) theStudy)
+  {
+    BuildFields(theResult,
+               theInput,
+               theIsFieldsDone,
+               theIsBuildFields,
+               theStudy);
+
+    BuildMinMax(theResult,
+               theInput,
+               theIsMinMaxDone,
+               theIsBuildMinMax);
+  }
+  
+
+  //---------------------------------------------------------------
+  struct TBuildArgs
+  {
+    Result_i* myResult;
+    VISU_Convertor* myInput;
+    CORBA::Boolean* myIsEntitiesDone;
+    std::string myResultEntry;
+    CORBA::Boolean* myIsFieldsDone;
+    CORBA::Boolean myIsBuildFields;
+    CORBA::Boolean* myIsMinMaxDone;
+    CORBA::Boolean myIsBuildMinMax;
+    CORBA::Boolean* myIsGroupsDone;
+    CORBA::Boolean myIsBuildGroups;
+    _PTR(Study) myStudy;
+
+    TBuildArgs(Result_i* theResult,
+              VISU_Convertor* theInput,
+              CORBA::Boolean* theIsEntitiesDone,
+              std::string theResultEntry,
+              CORBA::Boolean* theIsFieldsDone,
+              CORBA::Boolean theIsBuildFields,
+              CORBA::Boolean* theIsMinMaxDone,
+              CORBA::Boolean theIsBuildMinMax,
+              CORBA::Boolean* theIsGroupsDone,
+              CORBA::Boolean theIsBuildGroups,
+              _PTR(Study) theStudy):
+      myResult(theResult),
+      myInput(theInput),
+      myIsEntitiesDone(theIsEntitiesDone),
+      myResultEntry(theResultEntry),
+      myIsFieldsDone(theIsFieldsDone),
+      myIsBuildFields(theIsBuildFields),
+      myIsMinMaxDone(theIsMinMaxDone),
+      myIsBuildMinMax(theIsBuildMinMax),
+      myIsGroupsDone(theIsGroupsDone),
+      myIsBuildGroups(theIsBuildGroups),
+      myStudy(theStudy)
+    {}
+      
+  };
+
+  //---------------------------------------------------------------
+  void
+  BuildDataTree(TBuildArgs theBuildArgs)
+  {
+    BuildEntities(theBuildArgs.myResult,
+                 theBuildArgs.myInput,
+                 theBuildArgs.myIsEntitiesDone,
+                 theBuildArgs.myResultEntry,
+                 theBuildArgs.myStudy);
+
+    {
+      boost::thread aThread(boost::bind(&BuildFieldDataTree,
+                                       theBuildArgs.myResult,
+                                       theBuildArgs.myInput,
+                                       theBuildArgs.myIsFieldsDone,
+                                       theBuildArgs.myIsBuildFields,
+                                       theBuildArgs.myIsMinMaxDone,
+                                       theBuildArgs.myIsBuildMinMax,
+                                       theBuildArgs.myStudy));
+    }
+
+    {
+      boost::thread aThread(boost::bind(&BuildGroups,
+                                       theBuildArgs.myResult,
+                                       theBuildArgs.myInput,
+                                       theBuildArgs.myIsGroupsDone,
+                                       theBuildArgs.myIsBuildGroups,
+                                       theBuildArgs.myStudy));
+    }
+  }
+  
 }
 
-//==============================================================================
 
+//---------------------------------------------------------------
 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,
-                         const ESourceId& theSourceId,
-                         const ECreationId& theCreationId):
+//---------------------------------------------------------------
+VISU::Result_i
+::Result_i (SALOMEDS::Study_ptr theStudy,
+           const ESourceId& theSourceId,
+           const ECreationId& theCreationId,
+           CORBA::Boolean theIsBuildImmediately):
   myStudyDocument(SALOMEDS::Study::_duplicate(theStudy)),
   myCreationId(theCreationId),
   mySourceId(theSourceId),
+  myIsBuildImmediately(theIsBuildImmediately),
   myInput(NULL),
-  myIsDone(0)
+  myIsEntitiesDone(false),
+  myIsFieldsDone(false),
+  myIsGroupsDone(false),
+  myIsMinMaxDone(false),
+  myIsBuildFields(true),
+  myIsBuildGroups(true),
+  myIsBuildMinMax(true),
+  myIsAllDone(false)
 {
+  myStudy = ProcessEvent(new TGetStudy(myStudyDocument->StudyId()));
 }
 
 
-void VISU::Result_i::RemoveFromStudy()
+//---------------------------------------------------------------
+void
+VISU::Result_i
+::RemoveFromStudy()
 {
   // Remove the result with all presentations and other possible sub-objects
   VISU::RemoveFromStudy(mySObject,false);
@@ -144,9 +784,10 @@ void VISU::Result_i::RemoveFromStudy()
 }
 
 
+//---------------------------------------------------------------
 int
-VISU::Result_i::
-IsPossible()
+VISU::Result_i
+::IsPossible()
 {
   try{
     float aSize = myInput->GetSize();
@@ -162,13 +803,16 @@ IsPossible()
 }
 
 
+//---------------------------------------------------------------
 CORBA::Boolean
-VISU::Result_i::
-BuildAll()
+VISU::Result_i
+::BuildAll()
 {
-  if(MYDEBUG) MESSAGE("Result_i::Build - myIsDone = "<<myIsDone);
-  if(myIsDone) return 1;
-  if(!IsPossible()) return 0;
+  if(MYDEBUG) MESSAGE("Result_i::Build - myIsAllDone = "<<myIsAllDone);
+  if(myIsAllDone) 
+    return 1;
+  if(!IsPossible()) 
+    return 0;
   try{
     const VISU::TMeshMap& aMeshMap = myInput->GetMeshMap();
     VISU::TMeshMap::const_iterator aMeshMapIter = aMeshMap.begin();
@@ -236,199 +880,119 @@ BuildAll()
        }
       }
     }
-    myIsDone = 1;
+    myIsAllDone = 1;
   }catch(std::exception& exc){
     INFOS("Follow exception was occured :\n"<<exc.what());
   }catch(...){
     INFOS("Unknown exception was occured!!!");
   }
-  return myIsDone;
+  return myIsAllDone;
+}
+
+
+//---------------------------------------------------------------
+CORBA::Boolean
+VISU::Result_i
+::Build(CORBA::Boolean theIsBuildAll,
+       CORBA::Boolean theIsAtOnce)
+{
+  if(theIsBuildAll)
+    theIsAtOnce = true;
+
+  if(Build(SALOMEDS::SObject::_nil(),theIsAtOnce)){
+    if(theIsBuildAll)
+      return BuildAll();
+    return true;
+  }
+
+  return false;
 }
 
 
+//---------------------------------------------------------------
 VISU::Storable*
-VISU::Result_i::
-Build(SALOMEDS::SObject_ptr theSObject)
+VISU::Result_i
+::Build(SALOMEDS::SObject_ptr theSObject,
+       CORBA::Boolean theIsAtOnce)
+{
+  if(IsDone())
+    return this;
+
+  mySComponent = FindOrCreateVisuComponent(myStudyDocument);
+  CORBA::String_var aSComponentEntry = mySComponent->GetID();
+  CORBA::String_var anIOR(GetID());
+  QString aComment;
+  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(myStudy,
+                    aSComponentEntry.in(),
+                    anIOR.in(),
+                    myName,
+                    "",
+                    aComment.latin1(),
+                    true);
+  mySObject = myStudyDocument->FindObjectID(aResultEntry.c_str());
+  if(!CORBA::is_nil(theSObject)){
+    CORBA::String_var aString = theSObject->GetID();
+    CreateReference(myStudyDocument,aResultEntry,aString.in());
+  }
+
+  if(theIsAtOnce){
+    BuildEntities(this,
+                 myInput,
+                 &myIsEntitiesDone,
+                 aResultEntry,
+                 myStudy);
+    
+    BuildFields(this,
+               myInput,
+               &myIsFieldsDone,
+               myIsBuildFields,
+               myStudy);
+    
+    BuildMinMax(this,
+               myInput,
+               &myIsMinMaxDone,
+               myIsBuildMinMax);
+    
+    BuildGroups(this,
+               myInput,
+               &myIsGroupsDone,
+               myIsBuildGroups,
+               myStudy);
+  }else{
+    TBuildArgs aBuildArgs(this,
+                         myInput,
+                         &myIsEntitiesDone,
+                         aResultEntry,
+                         &myIsFieldsDone,
+                         myIsBuildFields,
+                         &myIsMinMaxDone,
+                         myIsBuildMinMax,
+                         &myIsGroupsDone,
+                         myIsBuildGroups,
+                         myStudy);
+    boost::thread aThread(boost::bind(&BuildDataTree,
+                                     aBuildArgs));
+  }
+
+  return this;
+}
+
+
+//---------------------------------------------------------------
+VISU::Storable*
+VISU::Result_i
+::BuildAll(SALOMEDS::SObject_ptr theSObject)
 {
-  SALOMEDS::StudyBuilder_var aStudyBuilder = myStudyDocument->NewBuilder();
-  aStudyBuilder->NewCommand();  // There is a transaction
   if(MYDEBUG) MESSAGE("Result_i::Build");
   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;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());
-    if(mySObject->_is_nil()) throw std::runtime_error("Build - There is no SObject for the Result !!!");
-    if(!CORBA::is_nil(theSObject)){
-      CORBA::String_var aString = theSObject->GetID();
-      CreateReference(myStudyDocument,aResultEntry,aString.in());
-    }
-    TMeshMap::const_iterator aMeshMapIter = aMeshMap.begin();
-    for(; aMeshMapIter != aMeshMap.end(); aMeshMapIter++){
-      const string& aMeshName = aMeshMapIter->first;
-      const VISU::PMesh aMesh = aMeshMapIter->second;
-      const VISU::TMeshOnEntityMap& aMeshOnEntityMap = aMesh->myMeshOnEntityMap;
-      VISU::TMeshOnEntityMap::const_iterator aMeshOnEntityMapIter;
-      aComment.sprintf("myComment=MESH;myName=%s;myDim=%d",
-                      aMeshName.c_str(),aMesh->myDim);
-      string aMeshEntry = CreateAttributes(myStudyDocument,aResultEntry.c_str(),aRefFatherEntry.c_str(),
-                                          "",aMeshName.c_str(),"",aComment.latin1(),true);
-      if(aMeshOnEntityMap.empty()) continue;
-      aComment.sprintf("myComment=FAMILIES;myMeshName=%s",aMeshName.c_str());
-      string aSubMeshesEntry = CreateAttributes(myStudyDocument,aMeshEntry.c_str(),aRefFatherEntry.c_str(),
-                                               "","Families","",aComment.latin1(),true);
-      //Import entities and according families
-      aMeshOnEntityMapIter = aMeshOnEntityMap.begin();
-      typedef std::map<std::string,std::string> TComment2EntryMap;
-      TComment2EntryMap aComment2EntryMap;
-      typedef std::map<VISU::TEntity,std::string> TEntity2EntryMap;
-      TEntity2EntryMap aEntity2EntryMap;
-      for(; aMeshOnEntityMapIter != aMeshOnEntityMap.end(); aMeshOnEntityMapIter++){
-       const VISU::TEntity& anEntity = aMeshOnEntityMapIter->first;
-       aComment.sprintf("myComment=ENTITY;myType=%d;myMeshName=%s;myId=%d",
-                        VISU::TENTITY,
-                        aMeshName.c_str(),
-                        anEntity);
-       string anEntityName;
-       switch(anEntity){
-       case VISU::NODE_ENTITY : anEntityName = "onNodes"; break;
-       case VISU::EDGE_ENTITY : anEntityName = "onEdges"; break;
-       case VISU::FACE_ENTITY : anEntityName = "onFaces"; break;
-       case VISU::CELL_ENTITY : anEntityName = "onCells"; break;
-       default:
-         throw std::runtime_error("Build >> Value of entity is incorrect!");
-       }
-       aEntity2EntryMap[anEntity] = CreateAttributes
-         (myStudyDocument, aSubMeshesEntry.c_str(), aRefFatherEntry.c_str(),
-          "", anEntityName.c_str(), "", aComment.latin1(), true);
-       const VISU::PMeshOnEntity aMeshOnEntity = aMeshOnEntityMapIter->second;
-       const VISU::TFamilyMap& aFamilyMap = aMeshOnEntity->myFamilyMap;
-       VISU::TFamilyMap::const_iterator aFamilyMapIter = aFamilyMap.begin();
-       for(; aFamilyMapIter != aFamilyMap.end(); aFamilyMapIter++){
-         const string& aFamilyName = aFamilyMapIter->first;
-         aComment.sprintf("myComment=FAMILY;myType=%d;myMeshName=%s;myEntityId=%d;myName=%s",
-                          VISU::TFAMILY,
-                          aMeshName.c_str(),
-                          anEntity,
-                          aFamilyName.c_str());
-         aComment2EntryMap[aComment.latin1()] =
-           CreateAttributes(myStudyDocument,
-                            aEntity2EntryMap[anEntity].c_str(),
-                            aRefFatherEntry.c_str(),
-                            "",
-                            aFamilyName.c_str(),
-                            "",
-                            aComment.latin1(),
-                            true);
-       }
-      }
-      //Importing groups
-      const VISU::TGroupMap& aGroupMap = aMesh->myGroupMap;
-      if(aGroupMap.size() > 0){
-       aComment.sprintf("myComment=GROUPS;myMeshName=%s",
-                        aMeshName.c_str());
-       string aGroupsEntry =
-         CreateAttributes(myStudyDocument,
-                          aMeshEntry.c_str(),
-                          aRefFatherEntry.c_str(),
-                          "",
-                          "Groups",
-                          "",
-                          aComment.latin1(),
-                          true);
-       VISU::TGroupMap::const_iterator aGroupMapIter = aGroupMap.begin();
-       for(; aGroupMapIter != aGroupMap.end(); aGroupMapIter++){
-         const string& aGroupName = aGroupMapIter->first;
-         aComment.sprintf("myComment=GROUP;myType=%d;myMeshName=%s;myName=%s",
-                          VISU::TGROUP,aMeshName.c_str(),aGroupName.c_str());
-         string aGroupEntry = CreateAttributes(myStudyDocument,aGroupsEntry.c_str(),aRefFatherEntry.c_str(),
-                                               "",aGroupName.c_str(),"",aComment.latin1(),true);
-         const VISU::PGroup aGroup = aGroupMapIter->second;
-         const VISU::TFamilySet& aFamilySet = aGroup->myFamilySet;
-         VISU::TFamilySet::const_iterator aFamilyIter = aFamilySet.begin();
-         for(; aFamilyIter != aFamilySet.end(); aFamilyIter++){
-           const VISU::PFamily& aFamily = *aFamilyIter;
-           const string& aFamilyName = aFamily->myName;
-           const VISU::TEntity& anEntity = aFamily->myEntity;
-           aComment.sprintf("myComment=FAMILY;myType=%d;myMeshName=%s;myEntityId=%d;myName=%s",
-                            VISU::TFAMILY,
-                            aMeshName.c_str(),
-                            anEntity,
-                            aFamilyName.c_str());
-           TComment2EntryMap::const_iterator anIter = aComment2EntryMap.find(aComment.latin1());
-           if(anIter != aComment2EntryMap.end()){
-             const std::string& anEntry = anIter->second;
-             CreateReference(myStudyDocument,aGroupEntry,anEntry);
-           }
-         }
-       }
-      }
-      //Import fields
-      string aFieldsEntry;
-      bool isFieldEntryCreated = 0;
-      aMeshOnEntityMapIter = aMeshOnEntityMap.begin();
-      for(; aMeshOnEntityMapIter != aMeshOnEntityMap.end(); aMeshOnEntityMapIter++){
-       const VISU::TEntity& anEntity = aMeshOnEntityMapIter->first;
-       const VISU::PMeshOnEntity aMeshOnEntity = aMeshOnEntityMapIter->second;
-       const VISU::TFieldMap& aFieldMap = aMeshOnEntity->myFieldMap;
-       VISU::TFieldMap::const_iterator aFieldMapIter = aFieldMap.begin();
-       for(; aFieldMapIter != aFieldMap.end(); aFieldMapIter++){
-         if(!isFieldEntryCreated){
-           aComment.sprintf("myComment=FIELDS;myMeshName=%s",
-                            aMeshName.c_str());
-           aFieldsEntry =
-             CreateAttributes(myStudyDocument,
-                              aMeshEntry.c_str(),
-                              aRefFatherEntry.c_str(),
-                              "",
-                              "Fields",
-                              "",
-                              aComment.latin1(),
-                              true);
-           isFieldEntryCreated = true;
-         }
-         const string& aFieldName = aFieldMapIter->first;
-         const VISU::PField aField = aFieldMapIter->second;
-         const VISU::TValField& aValField = aField->myValField;
-         QString aFieldNameWithUnit = ::GenerateFieldName(aFieldName,aField->myUnitNames[0]);
-         aComment.sprintf("myComment=FIELD;myType=%d;myMeshName=%s;myEntityId=%d;myName=%s;myNbTimeStamps=%d;myNumComponent=%d",
-                          VISU::TFIELD,aMeshName.c_str(),anEntity,aFieldName.c_str(),aValField.size(),aField->myNbComp);
-         string aFieldEntry = CreateAttributes(myStudyDocument,aFieldsEntry.c_str(),aRefFatherEntry.c_str(),
-                                               "",aFieldNameWithUnit.latin1(),"",aComment.latin1(),true);
-         CreateReference(myStudyDocument,aFieldEntry,aEntity2EntryMap[anEntity]);
-         VISU::TValField::const_iterator aValFieldIter = aValField.begin();
-         for(; aValFieldIter != aValField.end(); aValFieldIter++){
-           int aTimeStamp = aValFieldIter->first;
-           const VISU::PValForTime aValForTime = aValFieldIter->second;
-           aComment.sprintf("myComment=TIMESTAMP;myType=%d;myMeshName=%s;myEntityId=%d;myFieldName=%s;myTimeStampId=%d;myNumComponent=%d",
-                            VISU::TTIMESTAMP,aMeshName.c_str(),anEntity,aFieldName.c_str(),aTimeStamp,aField->myNbComp);
-           string aTimeStampId = VISU_Convertor::GenerateName(aValForTime->myTime);
-           CreateAttributes(myStudyDocument,aFieldEntry.c_str(),aRefFatherEntry.c_str(),
-                            "",aTimeStampId.c_str(),"",aComment.latin1(),true);
-         }
-       }
-      }
-    }
-    bool isBuildAll = VISU::GetResourceMgr()->booleanValue("VISU", "full_med_loading", false);
-    if(isBuildAll) BuildAll();
+    Build(theSObject);
+    BuildAll();
   }catch(std::exception& exc){
     INFOS("Follow exception was occured :\n"<<exc.what());
     return NULL;
@@ -436,11 +1000,12 @@ Build(SALOMEDS::SObject_ptr theSObject)
     INFOS("Unknown exception was occured!!!");
     return NULL;
   }
-  aStudyBuilder->CommitCommand();
+
   return this;
 }
 
 
+//---------------------------------------------------------------
 VISU::Storable*
 VISU::Result_i::
 Create(const char* theFileName)
@@ -461,9 +1026,11 @@ Create(const char* theFileName)
       myFileInfo.setFile(QString(aTmpDir.c_str()) + myFileInfo.fileName());
     }
     myInput = CreateConvertor(myFileInfo.absFilePath().latin1());
-    if(!myInput)
-      throw std::runtime_error("Create - Cannot create a Convertor for this file!!!");
-    return Build();
+    if(myInput){
+      if(myIsBuildImmediately)
+       Build(SALOMEDS::SObject::_nil());
+      return this;
+    }
   }catch(std::exception& exc){
     INFOS("Follow exception was occured :\n"<<exc.what());
   }catch(...){
@@ -473,6 +1040,7 @@ Create(const char* theFileName)
 }
 
 
+//---------------------------------------------------------------
 VISU::Storable*
 VISU::Result_i::
 Create(SALOMEDS::SObject_ptr theMedSObject)
@@ -483,14 +1051,15 @@ Create(SALOMEDS::SObject_ptr theMedSObject)
     if(myInput == NULL)
       return NULL;
 
+    myInput->Build();
+
     string aCompDataType = GetComponentDataType(theMedSObject);
     myFileInfo.setFile(aCompDataType.c_str());
     myInitFileName = aCompDataType;
 
     myName = ::GenerateName("aResult").latin1();
 
-    VISU::Storable* aStorable = Build(theMedSObject);
-    return aStorable;
+    return Build(theMedSObject);
   }catch(std::exception& exc){
     INFOS("Follow exception was occured :\n"<<exc.what());
   }catch(...){
@@ -499,6 +1068,8 @@ Create(SALOMEDS::SObject_ptr theMedSObject)
   return NULL;
 }
 
+
+//---------------------------------------------------------------
 VISU::Storable*
 VISU::Result_i::
 Create(SALOME_MED::FIELD_ptr theField)
@@ -509,6 +1080,8 @@ Create(SALOME_MED::FIELD_ptr theField)
     if(myInput == NULL)
       return NULL;
 
+    myInput->Build();
+
     string aCompDataType = "MED";
     myFileInfo.setFile(aCompDataType.c_str());
     myInitFileName = aCompDataType;
@@ -518,8 +1091,7 @@ Create(SALOME_MED::FIELD_ptr theField)
     CORBA::String_var anIOR = myStudyDocument->ConvertObjectToIOR(theField);
     SALOMEDS::SObject_var aFieldSObject = myStudyDocument->FindObjectIOR(anIOR);
 
-    VISU::Storable* aStorable = Build(aFieldSObject);
-    return aStorable;
+    return Build(aFieldSObject);
   }catch(std::exception& exc){
     INFOS("Follow exception was occured :\n"<<exc.what());
   }catch(...){
@@ -529,6 +1101,7 @@ Create(SALOME_MED::FIELD_ptr theField)
 }
 
 
+//---------------------------------------------------------------
 VISU::Storable*
 VISU::Result_i::
 Restore(SALOMEDS::SObject_ptr theSObject,
@@ -558,9 +1131,10 @@ 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
+       myInput->Build();
+      }else
        throw std::runtime_error("GetInput - There is no convertor for the aDataType !!!");
     } else {
       myFileInfo.setFile(thePrefix.c_str());
@@ -615,6 +1189,7 @@ Restore(SALOMEDS::SObject_ptr theSObject,
       }
       if(MYDEBUG) MESSAGE("VISU::Result_i::Restore - mySourceId = " << mySourceId);
       myInput = CreateConvertor(myFileInfo.filePath().latin1());
+      myInput->Build();
       QString aComment;
       aComment.sprintf("myComment=%s;myType=%d;myFileName=%s;myInitFileName=%s",
                       GetComment(), VISU::TRESULT, myFileInfo.filePath().latin1(),
@@ -637,21 +1212,91 @@ Restore(SALOMEDS::SObject_ptr theSObject,
   return NULL;
 }
 
-VISU::Result_i::TInput* VISU::Result_i::GetInput() {
+//---------------------------------------------------------------
+VISU::Result_i::TInput* 
+VISU::Result_i
+::GetInput() 
+{
   return myInput;
 }
 
-void VISU::Result_i::ToStream(std::ostringstream& theStr){
+//---------------------------------------------------------------
+CORBA::Boolean 
+VISU::Result_i
+::IsDone() 
+{
+  return 
+    myIsEntitiesDone && 
+    (myIsBuildFields? myIsFieldsDone: true) &&
+    (myIsBuildMinMax? myIsMinMaxDone: true) &&
+    (myIsBuildGroups? myIsGroupsDone: true);
+}
+
+CORBA::Boolean 
+VISU::Result_i
+::IsEntitiesDone() 
+{
+  return myIsEntitiesDone;
+}
+
+void
+VISU::Result_i
+::SetBuildFields(CORBA::Boolean theIsBuildFields, 
+                CORBA::Boolean theIsCalculateMinMax)
+{
+  myIsBuildFields = theIsBuildFields;
+  if(theIsBuildFields)
+    myIsBuildMinMax = theIsCalculateMinMax;
+  else
+    myIsBuildMinMax = false;
+}
+
+void
+VISU::Result_i
+::SetBuildGroups(CORBA::Boolean theIsBuildGroups)
+{
+  myIsBuildGroups = theIsBuildGroups;
+}
+
+CORBA::Boolean 
+VISU::Result_i
+::IsFieldsDone() 
+{
+  return myIsFieldsDone;
+}
+
+CORBA::Boolean 
+VISU::Result_i
+::IsGroupsDone() 
+{
+  return myIsGroupsDone;
+}
+
+CORBA::Boolean 
+VISU::Result_i
+::IsMinMaxDone() 
+{
+  return myIsMinMaxDone;
+}
+
+//---------------------------------------------------------------
+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());
   Storable::DataToStream(theStr,"myCreationId",myCreationId);
 }
 
+
+//---------------------------------------------------------------
 VISU::Storable*
-VISU::Result_i::Restore(SALOMEDS::SObject_ptr theSObject,
-                       const string& thePrefix,
-                       const Storable::TRestoringMap& theMap)
+VISU::Result_i
+::Restore(SALOMEDS::SObject_ptr theSObject,
+         const string& thePrefix,
+         const Storable::TRestoringMap& theMap)
 {
   SALOMEDS::Study_var aStudy = theSObject->GetStudy();
 
@@ -667,25 +1312,55 @@ VISU::Result_i::Restore(SALOMEDS::SObject_ptr theSObject,
   return pResult->Restore(theSObject,theMap,thePrefix);
 }
 
-string VISU::Result_i::GetRefFatherEntry() {
-  //return QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->entry();
+
+//---------------------------------------------------------------
+string 
+VISU::Result_i
+::GetRefFatherEntry() 
+{
   return "";
 }
 
-string VISU::Result_i::GetEntry(){
+string
+VISU::Result_i
+::GetEntry()
+{
   CORBA::String_var anEntry = mySObject->GetID();
   return string(anEntry);
 }
 
-const SALOMEDS::SObject_var& VISU::Result_i::GetSObject() const { return mySObject;}
-const SALOMEDS::Study_var& VISU::Result_i::GetStudyDocument() const { return myStudyDocument;}
-const SALOMEDS::SComponent_var& VISU::Result_i::GetSComponent() const { return mySComponent;}
-std::string VISU::Result_i::GetEntry(const std::string& theComment)
+const SALOMEDS::SObject_var& 
+VISU::Result_i
+::GetSObject() const 
+{ 
+  return mySObject;
+}
+
+const SALOMEDS::Study_var& 
+VISU::Result_i
+::GetStudyDocument() const 
+{ 
+  return myStudyDocument;
+}
+
+const SALOMEDS::SComponent_var& 
+VISU::Result_i
+::GetSComponent() const
+{
+  return mySComponent;
+}
+
+std::string 
+VISU::Result_i
+::GetEntry(const std::string& theComment)
 {
   return FindEntryWithComment(myStudyDocument,GetEntry().c_str(),theComment.c_str());
 }
 
-VISU::Result_i::~Result_i()
+
+//---------------------------------------------------------------
+VISU::Result_i
+::~Result_i()
 {
   MESSAGE("Result_i::~Result_i() - this = "<<this);
   if (mySourceId == eRestoredFile) {
index beb1e55868d11c9dea680efaf25933d1a95b3de8..e56cc0f6b60c6f569f14486ace2e7fdd29ede5d8 100644 (file)
@@ -50,7 +50,8 @@ namespace VISU{
 
     Result_i(SALOMEDS::Study_ptr theStudy,
             const ESourceId& theSourceId,
-            const ECreationId& theCreationId);
+            const ECreationId& theCreationId,
+            CORBA::Boolean theIsBuildImmediately = true);
 
     virtual ~Result_i();
     virtual void RemoveFromStudy();
@@ -58,6 +59,21 @@ namespace VISU{
     virtual VISU::VISUType GetType() { return VISU::TRESULT;}
     virtual CORBA::Boolean BuildAll();
 
+    virtual CORBA::Boolean Build(CORBA::Boolean theIsBuildAll,
+                                CORBA::Boolean theIsAtOnce);
+    virtual CORBA::Boolean IsDone();
+
+    virtual CORBA::Boolean IsEntitiesDone();
+
+    virtual void SetBuildFields(CORBA::Boolean theIsBuildFields, 
+                               CORBA::Boolean theIsCalculateMinMax);
+    virtual CORBA::Boolean IsFieldsDone();
+
+    virtual void SetBuildGroups(CORBA::Boolean theIsBuildGroups);
+    virtual CORBA::Boolean IsGroupsDone();
+
+    virtual CORBA::Boolean IsMinMaxDone();
+
     typedef VISU_Convertor TInput;
 
   private:
@@ -65,12 +81,27 @@ namespace VISU{
     ECreationId myCreationId;
 
     TInput *myInput;
-    CORBA::Boolean myIsDone;
     std::string myName, myInitFileName;
     QFileInfo myFileInfo;
 
   protected:
-    virtual Storable* Build(SALOMEDS::SObject_ptr theSObject = SALOMEDS::SObject::_nil()) ;
+    virtual Storable* Build(SALOMEDS::SObject_ptr theSObject,
+                           CORBA::Boolean theIsAtOnce = true) ;
+    virtual Storable* BuildAll(SALOMEDS::SObject_ptr theSObject) ;
+
+    _PTR(Study) myStudy;
+    CORBA::Boolean myIsBuildImmediately;
+
+    CORBA::Boolean myIsEntitiesDone;
+    CORBA::Boolean myIsFieldsDone;
+    CORBA::Boolean myIsGroupsDone;
+    CORBA::Boolean myIsMinMaxDone;
+
+    CORBA::Boolean myIsBuildFields;
+    CORBA::Boolean myIsBuildGroups;
+    CORBA::Boolean myIsBuildMinMax;
+
+    CORBA::Boolean myIsAllDone;
 
   public:
     virtual int IsPossible();
index cacc4046195e0b58baa47b29480a75ec89c76a1b..f70ad911f3d51e137c430155ec40542ec809748b 100644 (file)
@@ -77,6 +77,11 @@ VISU_TimeAnimation::VISU_TimeAnimation (_PTR(Study) theStudy,
 //************************************************************************
 VISU_TimeAnimation::~VISU_TimeAnimation()
 {
+  if (!myView) {
+    MESSAGE("Viewer is not defined for animation");
+    return;
+  }
+
   for (int i = 0; i < getNbFields(); i++) {
     clearData(myFieldsLst[i]);
   }
@@ -117,6 +122,10 @@ void VISU_TimeAnimation::addField (SALOMEDS::SObject_ptr theField)
 
 //************************************************************************
 void VISU_TimeAnimation::clearData(FieldData& theData) {
+  if (!myView) {
+    MESSAGE("Viewer is not defined for animation");
+    return;
+  }
   theData.myTiming.clear();
   vtkRenderer* aRen = myView->getRenderer();
   if (!theData.myActors.empty()) {
@@ -353,6 +362,10 @@ void VISU_TimeAnimation::startAnimation() {
 
 //************************************************************************
 void VISU_TimeAnimation::nextFrame() {
+  if (!myView) {
+    MESSAGE("Viewer is not defined for animation");
+    return;
+  }
   stopAnimation();
   if (myFrame < (myFieldsLst[0].myNbFrames-1)) {
     int i;
@@ -372,6 +385,10 @@ void VISU_TimeAnimation::nextFrame() {
 
 //************************************************************************
 void VISU_TimeAnimation::prevFrame() {
+  if (!myView) {
+    MESSAGE("Viewer is not defined for animation");
+    return;
+  }
   stopAnimation();
   if (myFrame > 0) {
     int i;
@@ -391,6 +408,10 @@ void VISU_TimeAnimation::prevFrame() {
 
 //************************************************************************
 void VISU_TimeAnimation::firstFrame() {
+  if (!myView) {
+    MESSAGE("Viewer is not defined for animation");
+    return;
+  }
   stopAnimation();
   int i;
   for (i = 0; i < getNbFields(); i++)
@@ -410,6 +431,10 @@ void VISU_TimeAnimation::firstFrame() {
 
 //************************************************************************
 void VISU_TimeAnimation::lastFrame() {
+  if (!myView) {
+    MESSAGE("Viewer is not defined for animation");
+    return;
+  }
   stopAnimation();
   int i;
   for (i = 0; i < getNbFields(); i++)
@@ -429,6 +454,10 @@ void VISU_TimeAnimation::lastFrame() {
 //************************************************************************
 // For Batchmode using
 void VISU_TimeAnimation::gotoFrame(CORBA::Long theFrame) {
+  if (!myView) {
+    MESSAGE("Viewer is not defined for animation");
+    return;
+  }
   if ((theFrame < 0) || (theFrame > (getNbFrames()-1)))
     return;
   stopAnimation();
index 02343e4110a82a2621faf9715540ede1f1d1b51f..87552d7b173762bd430b438b3f7e276ca13ded31 100644 (file)
@@ -161,55 +161,10 @@ VVTK_InteractorStyle
   if ( myIsLeftButtonDown )
     OnLeftButtonDown( ctrl, shift, x, y );
 }
-
-//----------------------------------------------------------------------------
-void  
-VVTK_InteractorStyle
-::OnKeyDown()
-{
-  if( GetSelector()->SelectionMode() != NodeSelection )
-    return;
-
-  char key = Interactor->GetKeyCode();
-
-  if ( key == 'S' ) {
-    // current mouse position (from last mouse move event or any other event)
-    int x, y;
-    Interactor->GetEventPosition( x, y ); 
-    FindPokedRenderer( x, y ); // calls SetCurrentRenderer
-
-    myOtherPoint = myPoint = QPoint(x, y);
-    //printf ( "--- myPoint[ %d, %d ], myOtherPoint[ %d, %d ] ---\n", 
-    //myPoint.x(), myPoint.y(), myOtherPoint.x(), myOtherPoint.y() );
-    
-    startOperation(VTK_INTERACTOR_STYLE_CAMERA_SELECT);
-    onFinishOperation();
-    startOperation(VTK_INTERACTOR_STYLE_CAMERA_NONE);
-  }
-}
-
 //----------------------------------------------------------------------------
 void  VVTK_InteractorStyle::onFinishOperation()
 {
-  int aNbObjWas, aNbObjNow;
-  //
-  aNbObjWas=GetSelector()->IObjectCount();
-  //
-  SVTK_InteractorStyle::onFinishOperation();
-  //
-  aNbObjNow=GetSelector()->IObjectCount();
-  
-  if (aNbObjWas+aNbObjNow==1){
-    vtkCamera *aCamera = GetCurrentRenderer()->GetActiveCamera();
-    float aZoomFactor = myPickingSettings->GetZoomFactor();
-    double aScale = aCamera->GetParallelScale();
-    if (!aNbObjWas && aNbObjNow) {
-      aCamera->SetParallelScale(aScale/aZoomFactor);
-    }
-    else {
-      aCamera->SetParallelScale(aScale*aZoomFactor);
-    }
-  }
+  Superclass::onFinishOperation();
 }
 
 
@@ -292,3 +247,58 @@ VVTK_InteractorStyle
 {
   Interactor->InvokeEvent(VISU::SetSMIncreaseMagnificationEvent,NULL);
 }
+//============================================================================
+//
+//  Controllers
+//
+vtkStandardNewMacro(VVTK_ControllerIncrement);
+//----------------------------------------------------------------------------
+VVTK_ControllerIncrement::VVTK_ControllerIncrement()
+{
+  myIncrement=10;
+}
+//----------------------------------------------------------------------------
+VVTK_ControllerIncrement::~VVTK_ControllerIncrement()
+{
+}
+//----------------------------------------------------------------------------
+int VVTK_ControllerIncrement::Increase()
+{
+  myIncrement*=2;
+  return myIncrement;
+}
+//----------------------------------------------------------------------------
+int VVTK_ControllerIncrement::Decrease()
+{
+  myIncrement/=2;
+  if (!myIncrement){
+    myIncrement=1;
+  }
+  return myIncrement;
+}
+//
+vtkStandardNewMacro(VVTK_ControllerOnKeyDown);
+//----------------------------------------------------------------------------
+VVTK_ControllerOnKeyDown::VVTK_ControllerOnKeyDown()
+{
+}
+//----------------------------------------------------------------------------
+VVTK_ControllerOnKeyDown::~VVTK_ControllerOnKeyDown()
+{
+}
+//----------------------------------------------------------------------------
+bool VVTK_ControllerOnKeyDown::OnKeyDown(vtkInteractorStyle* theIS)
+{
+  SVTK_InteractorStyle *pIS=dynamic_cast<SVTK_InteractorStyle *>(theIS);
+  if (pIS){
+    if(pIS->GetSelector()->SelectionMode()==GaussPointSelection){
+      char key = pIS->GetInteractor()->GetKeyCode();
+      //
+      if (key == 'S') {
+       pIS->ActionPicking();
+       return false;
+      }
+    }
+  }
+  return Superclass::OnKeyDown(theIS);
+}
index f180b7882ba3496965293ce019c513c5ad7593a1..2d6ec122ffd9ba78512ad8759a5599527ebd76dd 100644 (file)
 #ifndef __VVTK_InteractorStyle_h
 #define __VVTK_InteractorStyle_h
 
+
 #include "VVTK.h"
 
 #include "SVTK_InteractorStyle.h"
+//
+//-------------------------------------------
+//! Control the value of increment in new style of interaction.
+/*!
+  This class controls of value of increment,
+  for pan/rotate/zoom operations in new style 
+  of interaction
+*/
+class VVTK_ControllerIncrement : public SVTK_ControllerIncrement {
+ public:
+  vtkTypeMacro(VVTK_ControllerIncrement,SVTK_ControllerIncrement);
+  static VVTK_ControllerIncrement* New();
+  
+  //! Increace the increment value by multiplying on 2
+  virtual int Increase();
 
-class VISU_PickingSettings;
+  //! Decreace the increment value by division on 2
+  virtual int Decrease();
+  
+ protected:
+  VVTK_ControllerIncrement();
+  virtual ~VVTK_ControllerIncrement();
+  //
+ private:
+  VVTK_ControllerIncrement(const VVTK_ControllerIncrement&);  //Not implemented
+  void operator=(const VVTK_ControllerIncrement&);  //Not implemented
+};
+//
+//-------------------------------------------
+//! Control the behaviour of KeyDown event in new style of interaction.
+/*!
+  This class controls of behaviour of of KeyDown event
+  in new style of interaction.
+*/
+class VVTK_ControllerOnKeyDown : public SVTK_ControllerOnKeyDown{
+ public:
+  vtkTypeMacro(VVTK_ControllerOnKeyDown, SVTK_ControllerOnKeyDown);
+  static VVTK_ControllerOnKeyDown* New();
+
+  //! Provides the action on event 
+  virtual bool OnKeyDown(vtkInteractorStyle* );
+
+ protected:
+  VVTK_ControllerOnKeyDown();
+  virtual ~VVTK_ControllerOnKeyDown();
+  
+ private:
+  VVTK_ControllerOnKeyDown(const VVTK_ControllerOnKeyDown&);//Not implemented
+  void operator=(const VVTK_ControllerOnKeyDown&);          //Not implemented
+};
 
+class VISU_PickingSettings;
 
+//! Introduce new style of interaction (keyboard free)
 class VVTK_EXPORT VVTK_InteractorStyle : public SVTK_InteractorStyle
 {
  public:
-  // Description:
-  // This class must be supplied with a vtkRenderWindowInteractor wrapper or
-  // parent. This class should not normally be instantiated by application
-  // programmers.
   static VVTK_InteractorStyle *New();
   vtkTypeMacro(VVTK_InteractorStyle,SVTK_InteractorStyle);
 
-  // redefined in order to add an observer (callback) for custorm event (space mouse event)
+  //! Redefined from SVTK_InteractorStyle::SetInteractor in order to add an observer (callback) for custorm event (space mouse event)
   virtual
   void
   SetInteractor( vtkRenderWindowInteractor* );
 
+  //! To share the VISU_PickingSettings
   void
   SetPickingSettings(VISU_PickingSettings* thePickingSettings);
-
+  
+  
  protected:
   VVTK_InteractorStyle();
   ~VVTK_InteractorStyle();
@@ -62,14 +111,23 @@ class VVTK_EXPORT VVTK_InteractorStyle : public SVTK_InteractorStyle
   void operator=(const VVTK_InteractorStyle&); // Not implemented
 
   // Generic event bindings must be overridden in subclasses
+
+  //! Redefine SVTK_InteractorStyle::OnLeftButtonDown
   virtual void OnLeftButtonDown(int ctrl, int shift, int x, int y);
+
+  //! Redefine SVTK_InteractorStyle::OnMiddleButtonDown
   virtual void OnMiddleButtonDown(int ctrl, int shift, int x, int y);
+
+  //! Redefine SVTK_InteractorStyle::OnLeftButtonUp
   virtual void OnLeftButtonUp(int ctrl, int shift, int x, int y);
+
+  //! Redefine SVTK_InteractorStyle::OnMiddleButtonUp
   virtual void OnMiddleButtonUp(int ctrl, int shift, int x, int y);
-  virtual void OnKeyDown();
+
+  //! Redefine SVTK_InteractorStyle::onFinishOperation
   virtual void onFinishOperation();
 
-  // Main process VTK event method
+  //! Main process VTK event method
   static 
   void
   ProcessEvents(vtkObject* object, 
@@ -77,11 +135,16 @@ class VVTK_EXPORT VVTK_InteractorStyle : public SVTK_InteractorStyle
                void* clientData, 
                void* callData );
 
+  //! Redefine SVTK_InteractorStyle::onSpaceMouseButton
   virtual void onSpaceMouseButton( int button );
+  
+  //! To decrease magnification of the Gauss Points
   void DecreaseGaussPointMagnification();
+
+  //! To increase magnification of the Gauss Points
   void IncreaseGaussPointMagnification();
 
-  // SpaceMouse short cuts
+  //! SpaceMouse short cuts
   int mySMDecreaseMagnificationBtn;
   int mySMIncreaseMagnificationBtn;
   
index 47e3558326048b143d1b50e46800295bed19a93c..a7c21ee5512a05970fe4462e5a3e29bef9d9894c 100644 (file)
@@ -31,6 +31,7 @@
 #include "VVTK_Recorder.h"
 #include "VISU_WidgetCtrl.hxx"
 #include "VISU_GaussPtsAct.h"
+#include "VISU_Event.h" 
 
 #include "SVTK_RenderWindowInteractor.h"
 #include "VVTK_Renderer.h"
@@ -51,8 +52,16 @@ VVTK_MainWindow
                  const char* theName,
                  SUIT_ResourceMgr* theResourceMgr):
   SVTK_MainWindow(theParent,theName,theResourceMgr),
-  myInteractorStyle(VVTK_InteractorStyle::New())
+  myInteractorStyle(VVTK_InteractorStyle::New()),
+  myControllerIncrement(VVTK_ControllerIncrement::New()),
+  myControllerOnKeyDown(VVTK_ControllerOnKeyDown::New())
 {
+  myInteractorStyle->SetControllerIncrement(myControllerIncrement.GetPointer());
+  myControllerIncrement->Delete();
+
+  myInteractorStyle->SetControllerOnKeyDown(myControllerOnKeyDown.GetPointer());
+  myControllerOnKeyDown->Delete();
+
   myInteractorStyle->Delete();
 
   moveDockWindow(myToolBar,Qt::DockLeft);
@@ -102,12 +111,18 @@ VVTK_MainWindow
   }
 }
 
+//----------------------------------------------------------------------------
 void
 VVTK_MainWindow
 ::Initialize(SVTK_RenderWindowInteractor* theInteractor)
-{
+{ 
+  vtkInteractorStyle* pVIS=theInteractor->GetInteractorStyle();
+  SVTK_InteractorStyle *pInteractorStyle=dynamic_cast<SVTK_InteractorStyle*>(pVIS);
+  if (pInteractorStyle){
+    pInteractorStyle->SetControllerIncrement(myControllerIncrement.GetPointer());
+    pInteractorStyle->SetControllerOnKeyDown(myControllerOnKeyDown.GetPointer());
+  }
   SVTK_MainWindow::Initialize(theInteractor);
-  PushInteractorStyle(myInteractorStyle.GetPointer());
 }
 
 VVTK_MainWindow::~VVTK_MainWindow()
@@ -134,7 +149,7 @@ void
 VVTK_MainWindow
 ::OnSelectionModeSwitch(bool theIsSelectionOn)
 {
-  SetSelectionMode(theIsSelectionOn? NodeSelection: ActorSelection);
+  SetSelectionMode(theIsSelectionOn? GaussPointSelection: ActorSelection);
 }
 
 //----------------------------------------------------------------------------
@@ -240,12 +255,14 @@ VVTK_MainWindow1
                           "VVTK/SVTK StyleSwitch", 
                           true);
   anAction->setToggleAction(true);
-  anAction->toggle();
   anAction->setStatusTip(tr("DSC_VVTK_INTERACTOR_STYLE_SWITCH"));
-  connect(anAction, SIGNAL(toggled(bool)), this, SLOT(OnInteractorStyleSwitch(bool)));
+
   anAction->addTo( myPtsToolBar );
   myStyleSwitchAction = anAction;
 
+  if( theResourceMgr->integerValue( "VISU", "mouse_behaviour", true ) == 1 )
+    myStyleSwitchAction->toggle();
+
   aPixmap = theResourceMgr->loadPixmap("VISU",tr("ICON_VVTK_SELECTION_MODE_SWITCH"));
   anAction = new QtxAction(tr("MNU_VVTK_SELECTION_MODE_SWITCH"), 
                           aPixmap,
@@ -304,6 +321,10 @@ VVTK_MainWindow1
   myRenderer = theRenderer;
   VVTK_MainWindow::Initialize(theInteractor);
 
+  if( myStyleSwitchAction->isOn() )
+    PushInteractorStyle(myInteractorStyle.GetPointer());
+  connect(myStyleSwitchAction, SIGNAL(toggled(bool)), this, SLOT(OnInteractorStyleSwitch(bool)));
+
   mySegmentationCursorDlg->SetWidgetCtrl( theRenderer->GetWidgetCtrl() );
   myPickingDlg->SetInteractor( GetInteractor() );
 }
@@ -326,7 +347,6 @@ VVTK_MainWindow1
                                       theResourceMgr,
                                       thePickingSettings,
                                       myStyleSwitchAction);
-  //myMainWindow2->hide();
   return myMainWindow2;
 }
 
index 95454fd563cd241d24d81446d542a22c45b4f9b0..608b8cc0751c2f615f70c5154d5d9c982dd3ebcd 100644 (file)
@@ -16,6 +16,8 @@ class VISU_InsideCursorSettings;
 class VISU_OutsideCursorSettings;
 class VISU_PickingSettings;
 class VVTK_InteractorStyle;
+class VVTK_ControllerIncrement;
+class VVTK_ControllerOnKeyDown;
 class VVTK_PickingDlg;
 class VVTK_MainWindow2;
 class VVTK_Renderer1;
@@ -23,26 +25,33 @@ class VVTK_Renderer2;
 class VVTK_Recorder;
 
 //----------------------------------------------------------------------------
+//! Customize SVTK_MainWindow to provide VVTK functionality
 class VVTK_EXPORT VVTK_MainWindow: public SVTK_MainWindow
 {
   Q_OBJECT;
 
 public:
+  //! Construct instance of the class
   VVTK_MainWindow(QWidget* theParent, 
                  const char* theName,
                  SUIT_ResourceMgr* theResourceMgr);
+
+  //! Reimplement SVTK_MainWindow::Initialize
   virtual
   void
   Initialize(SVTK_RenderWindowInteractor* theInteractor);
 
+  //! Destroy instance of the class
   virtual
   ~VVTK_MainWindow();
 
  public slots:
+   //! To change active interactor style at run-time
   virtual
   void
   OnInteractorStyleSwitch(bool theIsGaussStyleOn); 
 
+   //! To change active selection mode at run-time
   virtual void OnSelectionModeSwitch(bool theIsSelectionOn); 
 
   virtual 
@@ -67,6 +76,8 @@ public:
 
  protected:
   vtkSmartPointer<VVTK_InteractorStyle> myInteractorStyle;
+  vtkSmartPointer<VVTK_ControllerIncrement> myControllerIncrement;
+  vtkSmartPointer<VVTK_ControllerOnKeyDown> myControllerOnKeyDown; 
 
   QToolBar* myRecordingToolBar;
   QtxAction* myStartAction;
@@ -79,23 +90,32 @@ public:
 
 
 //----------------------------------------------------------------------------
+//! Extend VVTK_MainWindow to implement functionality for base view
 class VVTK_EXPORT VVTK_MainWindow1: public VVTK_MainWindow
 {
   Q_OBJECT;
 
 public:
+  //! Construct instance of the class
   VVTK_MainWindow1(QSplitter* theParent, 
                   const char* theName,
                   SUIT_ResourceMgr* theResourceMgr);
+
+  //! Reimplement VVTK_MainWindow::Initialize
   virtual
   void
   Initialize(SVTK_RenderWindowInteractor* theInteractor,
             VVTK_Renderer1* theRenderer);
 
-  
+  //! Destroy instance of the class
   virtual
   ~VVTK_MainWindow1();
 
+  //! Create instance of the segmented VVTK_MainWindow
+  /*!
+    The two views (VVTK_MainWindow1 and VVTK_MainWindow2) should change its behaviour in the same time.
+    So, it is necessary to synhronize them through sharing some common pointers.
+  */
   VVTK_MainWindow2*
   CreateMainWindow2(QWidget* theParent, 
                    const char* theName,
@@ -107,50 +127,60 @@ public:
   VISU_InsideCursorSettings*
   GetInsideCursorSettings();
 
+  //! Get contained VISU_OutsideCursorSettings
   VISU_OutsideCursorSettings*
   GetOutsideCursorSettings();
 
+  //! Get contained VISU_PickingSettings
   VISU_PickingSettings* 
   GetPickingSettings();
 
  public slots:
+  //! To activate/ deactivate the segementation cursor at run-time
   void
   OnSegmentationSwitch();//bool theIsSegmentationOn); 
 
+  //! Customize VVTK_MainWindow::OnSelectionModeSwitch
   virtual
   void
   OnSelectionModeSwitch(bool theIsSelectionOn); 
 
  protected:
-  VVTK_Renderer1* myRenderer;
+  VVTK_Renderer1* myRenderer; //!< Keeps extended version of SVTK_Renderer
+
+  VVTK_MainWindow2* myMainWindow2; //!< Refer to segmented view
 
-  VVTK_MainWindow2* myMainWindow2;
+  QtxAction* myStyleSwitchAction; //!< Action for switch interactor style
+  QToolBar* myPtsToolBar; //!< Additional tool bar
 
-  QtxAction* myStyleSwitchAction;
-  QToolBar* myPtsToolBar;
-  QSplitter* mySplitter;
+  //! To implement show/hide segmented view on acttivate/ deactivate segementation cursor
+  QSplitter* mySplitter; 
 
-  QtxAction* myPlaneSegmentationAction;
-  QtxAction* mySphereSegmentationAction;
+  QtxAction* myPlaneSegmentationAction; //!< Action for switch segmentation mode to plane
+  QtxAction* mySphereSegmentationAction; //!< Action for switch segmentation mode to sphere
 
-  VVTK_SegmentationCursorDlg* mySegmentationCursorDlg;
-  VVTK_PickingDlg* myPickingDlg;
+  //! Keep reference to VVTK_SegmentationCursorDlg
+  VVTK_SegmentationCursorDlg* mySegmentationCursorDlg; 
+  VVTK_PickingDlg* myPickingDlg; //!< Keep reference to VVTK_PickingDlg
 };
 
 
 //----------------------------------------------------------------------------
+//! Extend VVTK_MainWindow to implement functionality for segmented view
 class VVTK_EXPORT VVTK_MainWindow2: public VVTK_MainWindow
 {
   Q_OBJECT;
 
   friend class VVTK_MainWindow1;
 
+  //! Construct instance of the class
   VVTK_MainWindow2(QWidget* theParent, 
                   const char* theName,
                   SUIT_ResourceMgr* theResourceMgr,
                   VISU_PickingSettings* thePickingSettings,
                   QtxAction* theStyleSwitchAction);
 public:
+  //! Destroy instance of the class
   virtual
   ~VVTK_MainWindow2();
 };
index 4bdf4a444bc98453dbd93941f767da642d314fc2..21b8c2e6d8fa4f863d9287f2f33eefe97ef27408 100644 (file)
@@ -28,6 +28,7 @@
 #include "utilities.h"
 
 #include <qcheckbox.h>
+#include <qcolordialog.h>
 #include <qcombobox.h>
 #include <qgroupbox.h>
 #include <qlabel.h>
@@ -76,11 +77,42 @@ VVTK_PickingDlg::VVTK_PickingDlg( QWidget* parent, const char* name )
   CursorGroupLayout->setMargin(11);
 
   QLabel* PyramidHeightLabel = new QLabel( tr( "PYRAMID_HEIGHT" ), CursorGroup );
-  myPyramidHeightSpinBox = new QtxDblSpinBox( 1.0, 100.0, 1.0, CursorGroup );
+  double aHeightMin=1.e-7;
+  double aHeightMax=10.;
+  double aHeightStep=0.1;
+  myPyramidHeightSpinBox = new QtxDblSpinBox(aHeightMin, aHeightMax, aHeightStep, CursorGroup );
+  
   myPyramidHeightSpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
+  
+
+  QLabel* SelectionColorLabel = new QLabel( tr( "SELECTION_COLOR" ), CursorGroup );
+  mySelectionColorButton = new QPushButton( CursorGroup );
+  mySelectionColorButton->setPaletteBackgroundColor( Qt::blue );
+  mySelectionColorButton->setPaletteForegroundColor( Qt::blue );
+  connect( mySelectionColorButton, SIGNAL( clicked() ), this, SLOT( onColorButtonPressed() ) );
 
   CursorGroupLayout->addWidget( PyramidHeightLabel, 0, 0 );
   CursorGroupLayout->addWidget( myPyramidHeightSpinBox, 0, 1 );
+  CursorGroupLayout->addWidget( SelectionColorLabel, 1, 0 );
+  CursorGroupLayout->addWidget( mySelectionColorButton, 1, 1 );
+
+  // Tolerance
+  QGroupBox* ToleranceGroup = new QGroupBox( tr( "TOLERANCE_TITLE" ), aBox, "ToleranceGroup" );
+  ToleranceGroup->setColumnLayout(0, Qt::Vertical );
+  ToleranceGroup->layout()->setSpacing( 0 );
+  ToleranceGroup->layout()->setMargin( 0 );
+
+  QGridLayout* ToleranceGroupLayout = new QGridLayout (ToleranceGroup->layout());
+  ToleranceGroupLayout->setAlignment(Qt::AlignTop | Qt::AlignCenter);
+  ToleranceGroupLayout->setSpacing(6);
+  ToleranceGroupLayout->setMargin(11);
+
+  QLabel* PointToleranceLabel = new QLabel( tr( "POINT_TOLERANCE" ), ToleranceGroup );
+  myPointToleranceSpinBox = new QtxDblSpinBox( 0.001, 10.0, 0.01, ToleranceGroup );
+  myPointToleranceSpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
+
+  ToleranceGroupLayout->addWidget( PointToleranceLabel, 0, 0 );
+  ToleranceGroupLayout->addWidget( myPointToleranceSpinBox, 0, 1 );
 
   // Information window
   QGroupBox* InfoWindowGroup = new QGroupBox( tr( "INFO_WINDOW_TITLE" ), aBox, "InfoWindowGroup" );
@@ -194,6 +226,8 @@ void VVTK_PickingDlg::RemoveActor( VISU_GaussPtsAct* theActor )
 void VVTK_PickingDlg::Update()
 {
   float aPyramidHeight = 10.0;
+  float aPointTolerance = 0.1;
+  QColor aColor = Qt::yellow;
   int anInfoWindowTransparency = 50;
   int anInfoWindowPosition = VISU_PickingSettings::BelowPoint;
   float aZoomFactor = 1.5;
@@ -203,12 +237,19 @@ void VVTK_PickingDlg::Update()
   if( !myPickingSettings->GetInitial() )
   {
     myPyramidHeightSpinBox->setValue( myPickingSettings->GetPyramidHeight() );
+    myPointToleranceSpinBox->setValue( myPickingSettings->GetPointTolerance() );
+    myTransparencySpinBox->setValue( myPickingSettings->GetInfoWindowTransparency() * 100.0 );
     myTransparencySpinBox->setValue( ( int )myPickingSettings->GetInfoWindowTransparency() * 100 );
     myPositionComboBox->setCurrentItem( myPickingSettings->GetInfoWindowPosition() );
     myZoomFactorSpinBox->setValue( myPickingSettings->GetZoomFactor() );
     myStepNumberSpinBox->setValue( myPickingSettings->GetStepNumber() );
     myDisplayParentMeshCheckBox->setChecked( myPickingSettings->GetDisplayParentMesh() );
 
+    float* aColor = myPickingSettings->GetColor();
+    mySelectionColorButton->setPaletteBackgroundColor( QColor( ( int )( aColor[0] * 255.0 ),
+                                                              ( int )( aColor[1] * 255.0 ),
+                                                              ( int )( aColor[2] * 255.0 ) ) );
+
     return;
   }
 
@@ -217,6 +258,12 @@ void VVTK_PickingDlg::Update()
   aPyramidHeight = aResourceMgr->doubleValue( "VISU", "picking_pyramid_height", aPyramidHeight );
   myPyramidHeightSpinBox->setValue( aPyramidHeight );
 
+  aPointTolerance = aResourceMgr->doubleValue( "VISU", "picking_point_tolerance", aPointTolerance );
+  myPointToleranceSpinBox->setValue( aPointTolerance );
+
+  aColor = aResourceMgr->colorValue( "VISU", "picking_selection_color", aColor );
+  mySelectionColorButton->setPaletteBackgroundColor( aColor );
+
   anInfoWindowTransparency = aResourceMgr->integerValue( "VISU", "picking_transparency", anInfoWindowTransparency );
   myTransparencySpinBox->setValue( anInfoWindowTransparency );
 
@@ -285,12 +332,20 @@ void VVTK_PickingDlg::onClickApply()
   myPickingSettings->SetInitial( false );
 
   myPickingSettings->SetPyramidHeight( myPyramidHeightSpinBox->value() );
+  myPickingSettings->SetPointTolerance( myPointToleranceSpinBox->value() );
   myPickingSettings->SetInfoWindowTransparency( myTransparencySpinBox->value() / 100.0 );
   myPickingSettings->SetInfoWindowPosition( myPositionComboBox->currentItem() );
   myPickingSettings->SetZoomFactor( myZoomFactorSpinBox->value() );
   myPickingSettings->SetStepNumber( myStepNumberSpinBox->value() );
   myPickingSettings->SetDisplayParentMesh( myDisplayParentMeshCheckBox->isChecked() );
 
+  QColor aButtonColor = mySelectionColorButton->paletteBackgroundColor();
+  float aColor[3];
+  aColor[0] = aButtonColor.red() / 255.0;
+  aColor[1] = aButtonColor.green() / 255.0;
+  aColor[2] = aButtonColor.blue() / 255.0;
+  myPickingSettings->SetColor( aColor );
+
   myPickingSettings->InvokeEvent(VISU::UpdatePickingSettingsEvent,NULL);
 }
 
@@ -305,3 +360,10 @@ void VVTK_PickingDlg::done( int r )
   myAction->setOn( false );
   QDialog::done( r );
 }
+
+void VVTK_PickingDlg::onColorButtonPressed()
+{
+  QColor aColor = QColorDialog::getColor( mySelectionColorButton->paletteBackgroundColor(), this );
+  if( aColor.isValid() )
+    mySelectionColorButton->setPaletteBackgroundColor( aColor );
+}
index 5f4fb2d9d024320cc62502ba75eda45a09f4954d..01ba29cd2e9c00adcd9d7dc1debdd81f146eae3f 100644 (file)
@@ -23,6 +23,7 @@ class vtkImageData;
 class QLabel;
 class QComboBox;
 class QCheckBox;
+class QPushButton;
 
 class QtxAction;
 class QtxDblSpinBox;
@@ -33,6 +34,11 @@ class VISU_PickingSettings;
 
 class SVTK_RenderWindowInteractor;
 
+//! Picking Dialog.
+/*!
+ * Uses for set up picking preferenses and apply
+ * them to all actors in the current renderer.
+ */
 class VVTK_PickingDlg : public QDialog
 {
   Q_OBJECT
@@ -41,11 +47,14 @@ public:
   VVTK_PickingDlg( QWidget* parent = 0, const char* name = 0 );
   ~VVTK_PickingDlg();
 
+  //! Used to switch toggle state of the Picking action.
   void             SetAction( QtxAction* theAction ) { myAction = theAction; }
 
+  //! Make an actor to listen the event of Update Picking Settings event.
   void             AddActor( VISU_GaussPtsAct* );
   void             RemoveActor( VISU_GaussPtsAct* );
 
+  //! Update dialog contents.
   void             Update();
 
   VISU_PickingSettings* GetPickingSettings();
@@ -58,6 +67,8 @@ protected slots:
   void             onClickApply();
   void             onClickClose();
 
+  void             onColorButtonPressed();
+
 private:
   static void      ProcessEvents(vtkObject* theObject, 
                                 unsigned long theEvent,
@@ -68,6 +79,8 @@ private:
 
 private:
   QtxDblSpinBox*   myPyramidHeightSpinBox;
+  QPushButton*     mySelectionColorButton;
+  QtxDblSpinBox*   myPointToleranceSpinBox;
   QtxIntSpinBox*   myTransparencySpinBox;
   QComboBox*       myPositionComboBox;
   QtxDblSpinBox*   myZoomFactorSpinBox;
index eb315b7fb03ea87be95810970d7a9b9ddc2e6450..484eff95d63b51e8dd2180f19b762ea2be0ee683 100644 (file)
@@ -36,6 +36,7 @@
 
 #include <vtkObjectFactory.h>
 #include <vtkProperty.h>
+#include <vtkPointPicker.h>
 
 #include <vtkRenderWindowInteractor.h>
 #include <vtkCallbackCommand.h>
@@ -141,7 +142,10 @@ VVTK_Renderer
 ::VVTK_Renderer():
   myFPSActor(VISU_FPSActor::New()),
   myInsideCursorSettings(NULL),
-  myPickingSettings(NULL)
+  myPickingSettings(NULL),
+  myGaussPointPicker(vtkPointPicker::New()),
+  myGaussPreHighlightProperty(vtkProperty::New()),
+  myGaussHighlightProperty(vtkProperty::New())
 {
   if(MYDEBUG) INFOS("VVTK_Renderer() - "<<this);
 
@@ -161,6 +165,15 @@ VVTK_Renderer
   aTextMapper->Delete();
 
   GetDevice()->AddActor2D(myFPSActor.GetPointer());
+
+  myGaussPointPicker->Delete();
+
+  myGaussPreHighlightProperty->Delete();
+  myGaussPreHighlightProperty->SetColor(0,1,1);
+
+  myGaussHighlightProperty->Delete();
+  myGaussHighlightProperty->SetColor(1,1,0);
+
 }
 
 VVTK_Renderer
@@ -174,10 +187,14 @@ void
 VVTK_Renderer
 ::AddActor(VTKViewer_Actor* theActor)
 {
+  Superclass::AddActor(theActor);
   if(VISU_GaussPtsAct* anActor = dynamic_cast<VISU_GaussPtsAct*>(theActor)){
+    anActor->SetPointPicker(myGaussPointPicker.GetPointer());
+    anActor->SetPreHighlightProperty(myGaussPreHighlightProperty.GetPointer());
+    anActor->SetHighlightProperty(myGaussHighlightProperty.GetPointer());
+
     anActor->SetInsideCursorSettings(myInsideCursorSettings);
     anActor->SetPickingSettings(myPickingSettings);
-    Superclass::AddActor(anActor);
   }
 }
 
@@ -186,11 +203,14 @@ void
 VVTK_Renderer
 ::RemoveActor(VTKViewer_Actor* theActor)
 {
-  using namespace VISU;  
+  Superclass::RemoveActor(theActor);
   if(VISU_GaussPtsAct* anActor = dynamic_cast<VISU_GaussPtsAct*>(theActor)){
+    anActor->SetPointPicker(NULL);
+    anActor->SetPreHighlightProperty(NULL);
+    anActor->SetHighlightProperty(NULL);
+
     anActor->SetInsideCursorSettings(NULL);
     anActor->SetPickingSettings(NULL);
-    Superclass::RemoveActor(theActor);
   }
 }
 
@@ -246,10 +266,10 @@ void
 VVTK_Renderer1
 ::AddActor(VTKViewer_Actor* theActor)
 {
+  Superclass::AddActor(theActor);
   if(VISU_GaussPtsAct1* anActor = dynamic_cast<VISU_GaussPtsAct1*>(theActor)){
     anActor->SetWidgetCtrl(GetWidgetCtrl());
     anActor->SetOutsideCursorSettings(myOutsideCursorSettings);
-    Superclass::AddActor(anActor);
     AdjustWidgetCtrl();
   }
 }
@@ -259,11 +279,10 @@ void
 VVTK_Renderer1
 ::RemoveActor(VTKViewer_Actor* theActor)
 {
-  using namespace VISU;  
+  Superclass::RemoveActor(theActor);
   if(VISU_GaussPtsAct1* anActor = dynamic_cast<VISU_GaussPtsAct1*>(theActor)){
     anActor->SetWidgetCtrl(NULL);
     anActor->SetOutsideCursorSettings(NULL);
-    Superclass::RemoveActor(theActor);
     AdjustWidgetCtrl();
   }
 }
@@ -371,6 +390,7 @@ VVTK_Renderer2
   VVTK_Renderer2* self = reinterpret_cast<VVTK_Renderer2*>(theClientData);
 
   switch(theEvent){
+  case vtkCommand::EnableEvent:
   case vtkCommand::EndInteractionEvent:
     self->OnEndInteractionEvent();  
     break;
index 5860f4ba818c970eec88afde3e61a83626923a8f..1f566884ba4aa7c19a69df5532b691fc997929e3 100644 (file)
@@ -39,23 +39,31 @@ class VISU_OutsideCursorSettings;
 class VISU_PickingSettings;
 class VISU_FPSActor;
 
+class vtkPointPicker;
 class vtkImplicitFunction;
 
 //----------------------------------------------------------------------------
+//! To customize SVTK_Renderer according to VVTK functionality
 class VVTK_EXPORT VVTK_Renderer : public SVTK_Renderer
 {
  public:
   vtkTypeMacro(VVTK_Renderer,SVTK_Renderer);
   static VVTK_Renderer* New();
 
+  //! Reimplement SVTK_Renderer::AddActor
+  /*!
+    Perform an additional action - apply picking settings on the published VISU_GaussPtsAct actors
+  */
   virtual
   void 
   AddActor(VTKViewer_Actor* theActor);
 
+  //! Reimplement SVTK_Renderer::RemoveActor (remove additional settings)
   virtual
   void 
   RemoveActor(VTKViewer_Actor* theActor);
 
+  //! To set VISU_PickingSettings to share them among all VISU_GaussPtsAct actors published into the view 
   void
   SetInsideCursorSettings(VISU_InsideCursorSettings* theInsideCursorSettings);
 
@@ -66,32 +74,41 @@ class VVTK_EXPORT VVTK_Renderer : public SVTK_Renderer
   VVTK_Renderer();
   ~VVTK_Renderer();
 
-  VISU_InsideCursorSettings* myInsideCursorSettings;
-  VISU_PickingSettings* myPickingSettings;
-  vtkSmartPointer<VISU_FPSActor> myFPSActor;
+  VISU_PickingSettings* myPickingSettings; //! Keeps reference of the VISU_PickingSettings
+  VISU_InsideCursorSettings* myInsideCursorSettings; //! Keeps reference of the VISU_InsideCursorSettings
+  vtkSmartPointer<VISU_FPSActor> myFPSActor; //!< To show FPS of the rendering at run-time
+
+  vtkSmartPointer<vtkPointPicker> myGaussPointPicker;
+  vtkSmartPointer<vtkProperty>    myGaussPreHighlightProperty;
+  vtkSmartPointer<vtkProperty>    myGaussHighlightProperty;
 };
 
 
 //----------------------------------------------------------------------------
+//! To extend VVTK_Renderer to implement base view functionality
 class VVTK_EXPORT VVTK_Renderer1 : public VVTK_Renderer
 {
  public:
   vtkTypeMacro(VVTK_Renderer1,VVTK_Renderer);
   static VVTK_Renderer1* New();
 
+  //! Reimplement SVTK_Renderer::Initialize
   virtual
   void 
   Initialize(vtkRenderWindowInteractor* theInteractor,
             SVTK_Selector* theSelector);
 
+  //! Reimplement VVTK_Renderer::AddActor to apply to the actor additional settings
   virtual
   void 
   AddActor(VTKViewer_Actor* theActor);
 
+  //! Reimplement VVTK_Renderer::RemoveActor
   virtual
   void 
   RemoveActor(VTKViewer_Actor* theActor);
 
+  //! To set VISU_PickingSettings to share them among all VISU_GaussPtsAct1 actors published into the view 
   void
   SetOutsideCursorSettings(VISU_OutsideCursorSettings* theOutsideCursorSettings);
 
@@ -101,6 +118,7 @@ class VVTK_EXPORT VVTK_Renderer1 : public VVTK_Renderer
   VVTK_Renderer1();
   ~VVTK_Renderer1();
 
+  //! Reimplement VVTK_Renderer::OnAdjustActors
   virtual
   bool
   OnAdjustActors();
@@ -120,16 +138,19 @@ class VVTK_EXPORT VVTK_Renderer2 : public VVTK_Renderer
   vtkTypeMacro(VVTK_Renderer2,VVTK_Renderer);
   static VVTK_Renderer2* New();
 
+  //! Reimplement VVTK_Renderer::AddActor to apply to the actor additional settings
   virtual
   void 
   AddActor(VTKViewer_Actor* theActor);
 
+  //! Reimplement VVTK_Renderer::RemoveActor
   virtual
   void 
   RemoveActor(VTKViewer_Actor* theActor);
 
   void SetWidgetCtrl(VISU_WidgetCtrl* theWidgetCtrl);
 
+  //! To handle vtkCommand::EndInteractionEvent to redraw the view
   void
   OnEndInteractionEvent();
 
@@ -137,7 +158,7 @@ class VVTK_EXPORT VVTK_Renderer2 : public VVTK_Renderer
   VVTK_Renderer2();
   ~VVTK_Renderer2();
 
-  // Main process VTK event method
+  //! Main process VTK event method
   static
   void
   ProcessEvents(vtkObject* theObject, 
@@ -145,10 +166,10 @@ class VVTK_EXPORT VVTK_Renderer2 : public VVTK_Renderer
                void* theClientData, 
                void* theCallData);
 
-  // Used to process VTK events
+  //! Used to process VTK events
   vtkSmartPointer<vtkCallbackCommand> myEventCallbackCommand;
 
-  // Priority at which events are processed
+  //! Priority at which events are processed
   float myPriority;
 
   VISU_WidgetCtrl* myWidgetCtrl;
index 5d4cfe100f07b1c3dda5930b87bd896a54de080a..fcb7be80159ff95cb937a6439a1b1379db4aa709 100644 (file)
@@ -20,6 +20,7 @@
 #include "VISU_SphereWidget.hxx"
 
 #include "VISU_GaussPointsPL.hxx"
+#include "VISU_OpenGLPointSpriteMapper.hxx"
 
 #include "SUIT_ResourceMgr.h"
 #include "SUIT_Session.h"
@@ -410,8 +411,8 @@ void VVTK_SegmentationCursorDlg::UpdateInsideGaussPoints()
 
 void VVTK_SegmentationCursorDlg::UpdateOutsideGaussPoints()
 {
+  float aClamp = 256.0;
   int aPrimitiveType = VVTK_PrimitiveBox::PointSprite;
-  float aClamp = 200.0;
   QString aMainTexture = QString( getenv( "VISU_ROOT_DIR") ) + "/share/salome/resources/sprite_texture.bmp";
   QString anAlphaTexture = QString( getenv( "VISU_ROOT_DIR") ) + "/share/salome/resources/sprite_alpha.bmp";
   float anAlphaThreshold = 0.1;
@@ -549,10 +550,16 @@ void VVTK_SegmentationCursorDlg::ApplySegmentationCursor()
     normal[0] = myDXDirectionSpinBox->value();
     normal[1] = myDYDirectionSpinBox->value();
     normal[2] = myDZDirectionSpinBox->value();
+    
+    if( normal[0] == 0.0 && normal[1] == 0.0 && normal[2] == 0.0 )
+    {
+      normal[2] = 1.0;
+      myDZDirectionSpinBox->setValue( 1.0 );
+    }
     pPlanesWidget->SetNormal( normal );
 
     pPlanesWidget->SetDistance( myDepthSpinBox->value() );
-
+    
     myWidgetCtrl->InvokeEvent(vtkCommand::EndInteractionEvent,NULL);
     myWidgetCtrl->GetInteractor()->Render();
   }
index 009278b829122468d79d07fcbb5d3cadc0b8433a..39c0c118a061809e16a91e7f4497b8bde54f2460 100644 (file)
@@ -39,6 +39,11 @@ class VISU_WidgetCtrl;
 class VVTK_PrimitiveBox;
 class VVTK_SizeBox;
 
+//! Segmentation Cursor Dialog.
+/*!
+ * Uses for set up Segmentation and Outside Cursor Gauss Points preferenses
+ * and apply them to all actors in the current renderer.
+ */
 class VVTK_SegmentationCursorDlg : public QDialog
 {
   Q_OBJECT
@@ -54,10 +59,14 @@ public:
   bool             GetIsPlaneSegmentation() const { return myIsPlaneSegmentation; }
   void             SetIsPlaneSegmentation( bool on ) { myIsPlaneSegmentation = on; }
 
+  //! Update contents of the Segmentation tab.
   void             UpdateSegmentation();
   void             UpdateInsideGaussPoints();
   void             UpdateOutsideGaussPoints();
 
+  //! Update contents of the Outside Cursor tab.
+  void             UpdateOutsideCursor();
+
   VISU_InsideCursorSettings*  GetInsideCursorSettings();
   VISU_OutsideCursorSettings* GetOutsideCursorSettings();
 
index 9e70cbc4535e9b5efdfb9ae40039633182fc8120..101fa583c4ce08922420fae5ecd0f3d46c1d7243 100644 (file)
@@ -6,12 +6,15 @@
 
 class SUIT_Desktop;
 
+//! Extend SUIT_ViewManager to deal with VVTK_Viewer
 class VVTK_EXPORT VVTK_ViewManager : public SUIT_ViewManager
 {
   Q_OBJECT;
 public:
-
+  //! Construct the view manager
   VVTK_ViewManager( SUIT_Study* study, SUIT_Desktop* );
+
+  //! Destroy the view manager
   virtual ~VVTK_ViewManager();
 
 protected:
index 6c2453b15df2c86aa45e162fe59cd111ccece48b..0846edcd0a3618c46bfb8597a30392ad6f6df0ab 100644 (file)
@@ -11,6 +11,7 @@
 
 class VVTK_ViewWindow;
 
+//! Extends two interfaces #SVTK_ViewModelBase and #SALOME_View 
 class VVTK_EXPORT VVTK_Viewer : public SVTK_ViewModelBase, public SALOME_View
 {
   Q_OBJECT;
@@ -22,20 +23,32 @@ public:
   VVTK_Viewer();
   virtual ~VVTK_Viewer();
 
+  //! Redefine SUIT_ViewModel::createView
   virtual SUIT_ViewWindow* createView(SUIT_Desktop*);
 
-  virtual void             setViewManager(SUIT_ViewManager* theViewManager);
-  virtual void             contextMenuPopup( QPopupMenu* );
-  virtual QString          getType() const { return Type(); }
+  //! Redefine SUIT_ViewModel::setViewManager
+  virtual void setViewManager(SUIT_ViewManager* theViewManager);
+  //! Redefine SUIT_ViewModel::contextMenuPopup
+  virtual void contextMenuPopup( QPopupMenu* );
+  //! See SUIT_ViewModel::getType
+  virtual QString getType() const { return Type(); }
 
+  //! Redefine SALOME_View::Repaint
   virtual void Repaint();
 
-  virtual bool             isVisible( const Handle(SALOME_InteractiveObject)& );
+  //! Redefine SALOME_View::isVisible
+  virtual bool isVisible( const Handle(SALOME_InteractiveObject)& );
 
+  //! Get background color of the viewer
   QColor backgroundColor() const;
+
+  //! Set background color to the viewer
   void   setBackgroundColor( const QColor& );
 
+  //! Get size of trihedron of the viewer (see SVTK_Renderer::SetTrihedronSize)
   int    trihedronSize() const;
+
+  //! Set size of trihedron of the viewer (see SVTK_Renderer::SetTrihedronSize)
   void   setTrihedronSize( const int );
 
 protected slots:
index a6ddca69637cc150036057e0a99b14585526d9ab..8f952ab964723edf06a807cefebd6372df966c8f 100755 (executable)
@@ -15,63 +15,84 @@ class VVTK_MainWindow2;
 class SVTK_View;
 
 //----------------------------------------------------------------------------
+//! Customize the SVTK_ViewWindow in order to manage two SVTK_View (base and segmented one)
 class VVTK_EXPORT VVTK_ViewWindow : public SVTK_ViewWindow
 {
   Q_OBJECT;
 
 public:
+  //! To construct the class
   VVTK_ViewWindow(SUIT_Desktop* theDesktop);
 
+  //! Destroy
   virtual
   ~VVTK_ViewWindow();
 
+  //! To initialize
   virtual
   void
   Initialize(SVTK_ViewModelBase* theModel);
 
   //----------------------------------------------------------------------------
+  //! Get access to base SVTK_MainWindow
   VVTK_MainWindow1* 
   getMainWindow1();
 
+  //! Get access to segmented SVTK_MainWindow
   VVTK_MainWindow2* 
   getMainWindow2();
 
   //----------------------------------------------------------------------------
+  //! Redefine SVTK_ViewWindow::AddActor method
+  /*!
+    This is an entry point for publication the presentation into the viewer.
+    Pointed actor published into the basic MainWindow. If the actor is
+    a Gauss Points one second actor is created from initial actor and 
+    is put into segemented MainWindow.
+  */
   virtual
   void
   AddActor(VTKViewer_Actor* theActor,
           bool theIsUpdate = false);
 
+  //! Redefine SVTK_ViewWindow::RemoveActor method
   virtual
   void
   RemoveActor(VTKViewer_Actor* theActor,
              bool theIsUpdate = false);
 
+  //! Redefine SVTK_ViewWindow::Repaint method
   virtual
   void
   Repaint(bool theUpdateTrihedron = true);
 
   //----------------------------------------------------------------------------
   /*  interactive object management */
+  //! Redefine SVTK_ViewWindow::highlight method
   virtual
   void
   highlight(const Handle(SALOME_InteractiveObject)& theIO, 
            bool theIsHighlight = true, 
            bool theIsUpdate = true);
+
+  //! Redefine SVTK_ViewWindow::unHighlightAll method
   virtual
   void
   unHighlightAll();
 
   //----------------------------------------------------------------------------
 public slots:
+  //! Redefine SVTK_ViewWindow::onSelectionChanged method
   virtual
   void
   onSelectionChanged();
 
+  //! Redefine SVTK_ViewWindow::onResetView method
   virtual
   void
   onResetView();     
 
+  //! Redefine SVTK_ViewWindow::onFitAll method
   virtual
   void 
   onFitAll();
@@ -82,11 +103,11 @@ protected:
   void
   action( const int );
 
-  VVTK_MainWindow1* myMainWindow1;
-  SVTK_View* myView1;
+  VVTK_MainWindow1* myMainWindow1; //!< The manage base view
+  SVTK_View* myView1; //!< The manage base view
 
-  VVTK_MainWindow2* myMainWindow2;
-  SVTK_View* myView2;
+  VVTK_MainWindow2* myMainWindow2; //!< The manage segmented view
+  SVTK_View* myView2; //!< The manage segmented view
 };
 
 #ifdef WIN32