]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
To introduce first version of WP1_2_1 development BR_WP1_2_1
authorapo <apo@opencascade.com>
Fri, 4 May 2007 09:08:47 +0000 (09:08 +0000)
committerapo <apo@opencascade.com>
Fri, 4 May 2007 09:08:47 +0000 (09:08 +0000)
50 files changed:
src/CONVERTOR/VISU_AppendPolyData.cxx [new file with mode: 0644]
src/CONVERTOR/VISU_AppendPolyData.hxx [new file with mode: 0644]
src/CONVERTOR/VISU_ConvertorDef_impl.hxx [new file with mode: 0644]
src/CONVERTOR/VISU_MeshValue.cxx [new file with mode: 0644]
src/CONVERTOR/VISU_MeshValue.hxx [new file with mode: 0644]
src/CONVERTOR/VISU_PointCoords.cxx [new file with mode: 0644]
src/CONVERTOR/VISU_PointCoords.hxx [new file with mode: 0644]
src/CONVERTOR/VISU_Structures.cxx [new file with mode: 0644]
src/CONVERTOR/VISU_Structures.hxx [new file with mode: 0644]
src/CONVERTOR/VISU_Structures_impl.cxx [new file with mode: 0644]
src/CONVERTOR/VISU_Structures_impl.hxx [new file with mode: 0644]
src/CONVERTOR/VISU_TypeList.hxx [new file with mode: 0644]
src/OBJECT/VISU_DataSetActor.cxx [new file with mode: 0644]
src/OBJECT/VISU_DataSetActor.h [new file with mode: 0644]
src/PIPELINE/SALOME_ExtractPolyDataGeometry.cxx [new file with mode: 0644]
src/PIPELINE/SALOME_ExtractPolyDataGeometry.h [new file with mode: 0644]
src/PIPELINE/VISU_ColoredPL.cxx [new file with mode: 0644]
src/PIPELINE/VISU_ColoredPL.hxx [new file with mode: 0644]
src/PIPELINE/VISU_DataSetMapperHolder.cxx [new file with mode: 0644]
src/PIPELINE/VISU_DataSetMapperHolder.hxx [new file with mode: 0644]
src/PIPELINE/VISU_MapperHolder.cxx [new file with mode: 0644]
src/PIPELINE/VISU_MapperHolder.hxx [new file with mode: 0644]
src/PIPELINE/VISU_PointSpriteMapperHolder.cxx [new file with mode: 0644]
src/PIPELINE/VISU_PointSpriteMapperHolder.hxx [new file with mode: 0644]
src/PIPELINE/VISU_PolyDataMapperHolder.cxx [new file with mode: 0644]
src/PIPELINE/VISU_PolyDataMapperHolder.hxx [new file with mode: 0644]
src/PIPELINE/VISU_PolyDataPL.cxx [new file with mode: 0644]
src/PIPELINE/VISU_PolyDataPL.hxx [new file with mode: 0644]
src/PIPELINE/VISU_UnstructuredGridPL.cxx [new file with mode: 0644]
src/PIPELINE/VISU_UnstructuredGridPL.hxx [new file with mode: 0644]
src/VISUGUI/VisuGUI_CacheDlg.cxx [new file with mode: 0644]
src/VISUGUI/VisuGUI_CacheDlg.h [new file with mode: 0644]
src/VISUGUI/VisuGUI_FieldFilter.cxx [new file with mode: 0644]
src/VISUGUI/VisuGUI_FieldFilter.h [new file with mode: 0644]
src/VISUGUI/VisuGUI_InputPane.cxx [new file with mode: 0644]
src/VISUGUI/VisuGUI_InputPane.h [new file with mode: 0644]
src/VISUGUI/VisuGUI_Prs3dDlg.cxx [new file with mode: 0644]
src/VISUGUI/VisuGUI_Prs3dDlg.h [new file with mode: 0644]
src/VISUGUI/VisuGUI_Slider.cxx [new file with mode: 0644]
src/VISUGUI/VisuGUI_Slider.h [new file with mode: 0644]
src/VISU_I/SALOME_GenericObjPointer.cc [new file with mode: 0644]
src/VISU_I/SALOME_GenericObjPointer.hh [new file with mode: 0644]
src/VISU_I/VISU_ColoredPrs3dCache_i.cc [new file with mode: 0644]
src/VISU_I/VISU_ColoredPrs3dCache_i.hh [new file with mode: 0644]
src/VISU_I/VISU_ColoredPrs3dFactory.cc [new file with mode: 0644]
src/VISU_I/VISU_ColoredPrs3dFactory.hh [new file with mode: 0644]
src/VISU_I/VISU_ColoredPrs3dHolder_i.cc [new file with mode: 0644]
src/VISU_I/VISU_ColoredPrs3dHolder_i.hh [new file with mode: 0644]
src/VISU_SWIG/visu_cache.py [new file with mode: 0644]
src/VISU_SWIG/visu_change_input.py [new file with mode: 0644]

diff --git a/src/CONVERTOR/VISU_AppendPolyData.cxx b/src/CONVERTOR/VISU_AppendPolyData.cxx
new file mode 100644 (file)
index 0000000..76db3a2
--- /dev/null
@@ -0,0 +1,483 @@
+//  SALOME OBJECT : kernel of SALOME component
+//
+//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
+// 
+//  This library is free software; you can redistribute it and/or 
+//  modify it under the terms of the GNU Lesser General Public 
+//  License as published by the Free Software Foundation; either 
+//  version 2.1 of the License. 
+// 
+//  This library is distributed in the hope that it will be useful, 
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of 
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
+//  Lesser General Public License for more details. 
+// 
+//  You should have received a copy of the GNU Lesser General Public 
+//  License along with this library; if not, write to the Free Software 
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
+// 
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+//
+//
+//  File   : VTKViewer_GeometryFilter.cxx
+//  Author : 
+//  Module : SALOME
+//  $Header$
+
+#include "VISU_AppendPolyData.hxx"
+
+#include <vtkCellArray.h>
+#include <vtkCellData.h>
+#include <vtkDataSetAttributes.h>
+#include <vtkDataSetCollection.h>
+#include <vtkObjectFactory.h>
+#include <vtkPointData.h>
+#include <vtkPolyData.h>
+
+#include <vtkPoints.h>
+
+vtkCxxRevisionMacro(VISU_AppendPolyData, "$Revision$");
+vtkStandardNewMacro(VISU_AppendPolyData);
+
+VISU_AppendPolyData
+::VISU_AppendPolyData() 
+{
+  myDoMappingFlag = false;
+}
+
+VISU_AppendPolyData
+::~VISU_AppendPolyData()
+{}
+
+void
+VISU_AppendPolyData
+::SetDoMappingFlag(const bool theFlag)
+{
+  if(myDoMappingFlag == theFlag)
+    return;
+
+  myDoMappingFlag = theFlag;
+
+  this->Modified();
+}
+
+bool 
+VISU_AppendPolyData
+::DoMappingFlag() const
+{
+  return myDoMappingFlag;
+}
+
+void
+VISU_AppendPolyData
+::SetPoints(vtkPoints* thePoints)
+{
+  if(GetPoints() == thePoints)
+    return;
+
+  myPoints = thePoints;
+
+  this->Modified();
+}
+
+vtkPoints*
+VISU_AppendPolyData
+::GetPoints()
+{
+  return myPoints.GetPointer();
+}
+
+void
+VISU_AppendPolyData
+::Execute()
+{
+  if(myPoints.GetPointer())
+    MakeOutput();
+  else
+    Superclass::Execute();
+
+  if(myDoMappingFlag)
+    DoMapping();
+}
+
+
+void 
+VISU_AppendPolyData
+::DoMapping()
+{
+  myNodeRanges.clear();
+  myCellRanges.clear();
+
+  vtkIdType aPntStartId = 0;
+  vtkIdType aCellStartId = 0;
+
+  for(vtkIdType aDataSetId = 0; aDataSetId < this->NumberOfInputs; ++aDataSetId){
+    vtkDataSet* aDataSet = (vtkDataSet *)(this->Inputs[aDataSetId]);
+    // Do mapping of the nodes
+    if(!myPoints.GetPointer()){
+      vtkIdType aNbPnts = aDataSet->GetNumberOfPoints();
+      myNodeRanges.push_back(aPntStartId + aNbPnts);
+      aPntStartId += aNbPnts;
+    }
+    // Do mapping of the cells
+    vtkIdType aNbCells = aDataSet->GetNumberOfCells();
+    myCellRanges.push_back(aCellStartId + aNbCells);
+    aCellStartId += aNbCells;
+  }
+}
+
+namespace
+{
+  inline
+  vtkIdType
+  GetOutputID(vtkIdType theInputID,
+             vtkIdType theInputDataSetID,
+             const VISU_AppendPolyData::TVectorIds& theRanges)
+  {
+    theInputID = theInputDataSetID = -1;
+
+    vtkIdType aNbInputs = theRanges.size();
+    if(theInputDataSetID < 0 || theInputDataSetID >= aNbInputs)
+      return -1;
+    
+    vtkIdType aStartId = theRanges[theInputDataSetID];
+    return aStartId + theInputID;
+  }
+}
+
+vtkIdType
+VISU_AppendPolyData
+::GetPointOutputID(vtkIdType theInputID,
+                  vtkIdType theInputDataSetID)
+{
+  if(myPoints.GetPointer())
+    return theInputID;
+
+  return GetOutputID(theInputID,theInputDataSetID,myNodeRanges);
+}
+
+
+vtkIdType 
+VISU_AppendPolyData
+::GetCellOutputID(vtkIdType theInputID,
+                  vtkIdType theInputDataSetID)
+{
+  if(myPoints.GetPointer())
+    return theInputID;
+
+  return GetOutputID(theInputID,theInputDataSetID,myCellRanges);
+}
+
+
+namespace
+{
+  void
+  GetInputID(vtkIdType theOutputID,
+            vtkIdType& theInputID,
+            vtkIdType& theStartID,
+            vtkIdType& theInputDataSetID,
+            const VISU_AppendPolyData::TVectorIds& theRanges)
+  {
+    theInputID = theStartID = theInputDataSetID = -1;
+
+    if(theRanges.empty())
+      return;
+
+    const vtkIdType& aRangeEnd = theRanges.back();
+    if(theOutputID < 0 ||  theOutputID >= aRangeEnd)
+      return;
+
+    vtkIdType aStartId = 0;
+    vtkIdType aNbInputs = theRanges.size();
+    for(vtkIdType aDataSetId = 0; aDataSetId < aNbInputs; ++aDataSetId){
+      vtkIdType aRange = theRanges[aDataSetId];
+      if(aRange > theOutputID){
+       theInputID = theOutputID - aStartId;
+       theInputDataSetID = aDataSetId;
+       theStartID = aStartId;
+       break;
+      }
+      aStartId = aRange;
+    }
+  }
+}
+
+void 
+VISU_AppendPolyData
+::GetPointInputID(vtkIdType theOutputID,
+                 vtkIdType& theInputID,
+                 vtkIdType& theStartID,
+                 vtkIdType& theInputDataSetID)
+{
+  if(myPoints.GetPointer()) {
+    theStartID = theInputDataSetID = 0;
+    theInputID = theOutputID;
+    return;
+  }
+
+  ::GetInputID(theOutputID,
+              theInputID,
+              theStartID,
+              theInputDataSetID,
+              myNodeRanges);
+}
+
+
+void
+VISU_AppendPolyData
+::GetCellInputID(vtkIdType theOutputID,
+                vtkIdType& theInputID,
+                vtkIdType& theStartID,
+                vtkIdType& theInputDataSetID)
+{
+  ::GetInputID(theOutputID,
+              theInputID,
+              theStartID,
+              theInputDataSetID,
+              myCellRanges);
+}
+
+
+void 
+VISU_AppendPolyData
+::MakeOutput()
+{
+  // loop over all data sets, checking to see what point data is available.
+  vtkIdType numPts = 0;
+
+  // These Field lists are very picky.  Count the number of non empty inputs
+  // so we can initialize them properly.
+  int idx;
+  int countCD = 0;
+  for (idx = 0; idx < this->NumberOfInputs; ++idx)
+    {
+    vtkPolyData *ds = (vtkPolyData *)(this->Inputs[idx]);
+    if (ds != NULL)
+      {
+      if (ds->GetNumberOfCells() > 0 )  
+        {
+        ++countCD;
+        } // for a data set that has cells
+      } // for a non NULL input
+    } // for each input
+
+  // These are used to determine which fields are available for appending
+  vtkDataSetAttributes::FieldList cellList(countCD);  
+
+  countCD = 0;
+  vtkIdType numCells = 0;
+  vtkIdType numPolys = 0;
+  vtkIdType sizePolys = 0;
+  for (idx = 0; idx < this->NumberOfInputs; ++idx)
+    {
+    vtkPolyData *ds = (vtkPolyData *)(this->Inputs[idx]);
+    if (ds != NULL)
+      {
+      // Although we cannot have cells without points ... let's not nest.
+      if (ds->GetNumberOfCells() > 0 )  
+        {
+        // keep track of the size of the poly cell array
+        if (ds->GetPolys())
+          {
+          numPolys += ds->GetPolys()->GetNumberOfCells();
+          sizePolys += ds->GetPolys()->GetNumberOfConnectivityEntries();
+          }
+        numCells += ds->GetNumberOfCells();
+        
+        vtkCellData *inCD = ds->GetCellData();
+        if ( countCD == 0 )
+          {
+          cellList.InitializeFieldList(inCD);
+          }
+        else
+          {
+          cellList.IntersectFieldList(inCD);
+          }
+        ++countCD;
+        } // for a data set that has cells
+      } // for a non NULL input
+    } // for each input
+
+  if ( numPts < 1 || numCells < 1 )
+    {
+    return;
+    }
+  this->UpdateProgress(0.10);
+
+  // Allocate geometry/topology
+  vtkCellArray* newVerts = vtkCellArray::New();
+  newVerts->Allocate(numCells*4);
+
+  vtkCellArray* newLines = vtkCellArray::New();
+  newLines->Allocate(numCells*4);
+
+  vtkCellArray* newStrips = vtkCellArray::New();
+  newStrips->Allocate(numCells*4);
+
+  vtkCellArray* newPolys = vtkCellArray::New();
+  vtkIdType *pPolys = newPolys->WritePointer(numPolys, sizePolys);
+
+  // Allocate the point and cell data
+  vtkPolyData *output = this->GetOutput();
+  vtkCellData *outputCD = output->GetCellData();
+  outputCD->CopyAllocate(cellList,numCells);
+
+  // loop over all input sets
+  vtkIdType ptOffset = 0;
+  vtkIdType cellOffset = 0;
+  countCD = 0;
+  for (idx = 0; idx < this->NumberOfInputs; ++idx)
+    {
+    this->UpdateProgress(0.2 + 0.8*idx/this->NumberOfInputs);
+    vtkPolyData *ds = (vtkPolyData *)(this->Inputs[idx]);
+    // this check is not necessary, but I'll put it in anyway
+    if (ds != NULL)
+      {
+      vtkIdType numPts = ds->GetNumberOfPoints();
+      vtkIdType numCells = ds->GetNumberOfCells();
+      if ( numPts <= 0 && numCells <= 0 )
+        {
+        continue; //no input, just skip
+        }
+
+      vtkCellData *inCD = ds->GetCellData();
+
+      vtkCellArray *inVerts = ds->GetVerts();
+      vtkCellArray *inLines = ds->GetLines();
+      vtkCellArray *inPolys = ds->GetPolys();
+      vtkCellArray *inStrips = ds->GetStrips();
+
+      if (ds->GetNumberOfCells() > 0)
+        {
+        // cell data could be made efficient like the point data,
+        // but I will wait on that.
+        // copy cell data
+       vtkIdType cellId;
+        for (cellId=0; cellId < numCells; cellId++)
+          {
+          outputCD->CopyData(cellList,inCD,countCD,cellId,cellId+cellOffset);
+          }
+        ++countCD;
+        
+        // copy the cells
+        pPolys = this->AppendCells(pPolys, inPolys, ptOffset);
+        
+        // These other cell arrays could be made efficient like polys ...
+       int i;
+       vtkIdType *pts = 0;
+       vtkIdType npts = 0;
+        for (inVerts->InitTraversal(); inVerts->GetNextCell(npts,pts); )
+          {
+          newVerts->InsertNextCell(npts);
+          for (i=0; i < npts; i++)
+            {
+            newVerts->InsertCellPoint(pts[i]+ptOffset);
+            }
+          }
+        
+        for (inLines->InitTraversal(); inLines->GetNextCell(npts,pts); )
+          {
+          newLines->InsertNextCell(npts);
+          for (i=0; i < npts; i++)
+            {
+            newLines->InsertCellPoint(pts[i]+ptOffset);
+            }
+          }
+
+        for (inStrips->InitTraversal(); inStrips->GetNextCell(npts,pts); )
+          {
+          newStrips->InsertNextCell(npts);
+          for (i=0; i < npts; i++)
+            {
+            newStrips->InsertCellPoint(pts[i]+ptOffset);
+            }
+          }
+        }
+      cellOffset += numCells;
+      }
+    }
+  
+  if ( newVerts->GetNumberOfCells() > 0 )
+    {
+    output->SetVerts(newVerts);
+    }
+  newVerts->Delete();
+
+  if ( newLines->GetNumberOfCells() > 0 )
+    {
+    output->SetLines(newLines);
+    }
+  newLines->Delete();
+
+  if ( newPolys->GetNumberOfCells() > 0 )
+    {
+    output->SetPolys(newPolys);
+    }
+  newPolys->Delete();
+
+  if ( newStrips->GetNumberOfCells() > 0 )
+    {
+    output->SetStrips(newStrips);
+    }
+  newStrips->Delete();
+
+  // When all optimizations are complete, this squeeze will be unecessary.
+  // (But it does not seem to cost much.)
+  output->Squeeze();
+
+  /*
+  int idx;
+  vtkIdType numPts, numCells, newCellId, cellId;
+  vtkCellData *cd;
+  vtkIdList *ptIds;
+  vtkDataSet *ds;
+  vtkPolyData *output = this->GetOutput();
+  //
+  numPts = myPoints->GetNumberOfPoints();
+  if (numPts < 1) {
+    return;
+  }
+  //
+  numCells = 0;
+  for (idx = 0; idx < this->NumberOfInputs; ++idx) {
+    ds = (vtkDataSet *)(this->Inputs[idx]);
+    if (ds != NULL)  {
+      if ( ds->GetNumberOfPoints() <= 0 && ds->GetNumberOfCells() <= 0 )  {
+        continue; //no input, just skip
+      }
+      numCells += ds->GetNumberOfCells();
+    }//if non-empty dataset
+  }//for all inputs
+  if (numCells < 1) {
+    return;
+  }
+  //
+  // Now can allocate memory
+  output->Allocate(numCells); 
+  ptIds = vtkIdList::New(); 
+  ptIds->Allocate(VTK_CELL_SIZE);
+  //
+  // Append each input dataset together
+  //
+  // 1.points
+  output->SetPoints(myPoints.GetPointer());
+  // 2.cells
+  for (idx = 0; idx < this->NumberOfInputs; ++idx) {
+    ds = (vtkDataSet *)(this->Inputs[idx]);
+    if (ds != NULL) {
+      numCells = ds->GetNumberOfCells(); 
+      cd = ds->GetCellData();
+      // copy cell and cell data
+      for (cellId=0; cellId<numCells; cellId++)  {
+        ds->GetCellPoints(cellId, ptIds);
+        newCellId = output->InsertNextCell(ds->GetCellType(cellId), ptIds);
+      }
+    }
+  }
+  //
+  ptIds->Delete();
+  */
+}
+
diff --git a/src/CONVERTOR/VISU_AppendPolyData.hxx b/src/CONVERTOR/VISU_AppendPolyData.hxx
new file mode 100644 (file)
index 0000000..d07757f
--- /dev/null
@@ -0,0 +1,102 @@
+// Copyright (C) 2005  CEA/DEN, EDF R&D, OPEN CASCADE, PRINCIPIA R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+#ifndef VISU_APPENDPOLYDATA_H
+#define VISU_APPENDPOLYDATA_H
+
+#include <vtkAppendPolyData.h>
+#include <vtkSmartPointer.h>
+
+#include <vector>
+#include <map>
+
+class vtkPoints;
+
+/*! \brief This class used same as vtkAppendFilter. See documentation on VTK for more information.
+ */
+class VISU_AppendPolyData : public vtkAppendPolyData 
+{
+public:
+  /*! \fn static VTKViewer_AppendFilter *New()
+   */
+  static VISU_AppendPolyData *New();
+  
+  /*! \fn vtkTypeRevisionMacro(VTKViewer_AppendFilter, vtkAppendFilter)
+   *  \brief VTK type revision macros.
+   */
+  vtkTypeRevisionMacro(VISU_AppendPolyData, vtkAppendPolyData);
+
+  void SetDoMappingFlag(const bool theFlag);
+
+  bool DoMappingFlag() const;
+
+  void
+  SetPoints(vtkPoints* thePoints);
+
+  vtkPoints*
+  GetPoints();
+
+  vtkIdType
+  GetPointOutputID(vtkIdType theInputID,
+                  vtkIdType theInputDataSetID);
+
+  vtkIdType
+  GetCellOutputID(vtkIdType theInputID,
+                 vtkIdType theInputDataSetID);
+
+  void 
+  GetPointInputID(vtkIdType theOutputID,
+                vtkIdType& theInputID,
+                vtkIdType& theStartID,
+                vtkIdType& theInputDataSetID);
+
+  void
+  GetCellInputID(vtkIdType theOutputID,
+                vtkIdType& theInputID,
+                vtkIdType& theStartID,
+                vtkIdType& theInputDataSetID);
+
+  typedef std::vector<vtkIdType> TVectorIds;
+
+protected:
+  /*! \fn VTKViewer_AppendFilter();
+   * \brief Constructor
+   */
+  VISU_AppendPolyData();
+  /*! \fn ~VTKViewer_AppendFilter();
+   * \brief Destructor.
+   */
+  ~VISU_AppendPolyData();
+  /*! \fn void Execute();
+   * \brief Filter culculation method.
+   */
+  virtual void Execute();
+  //
+  void DoMapping();
+
+  void Reset();
+
+  void MakeOutput();
+
+  bool myDoMappingFlag;
+  TVectorIds myNodeRanges;
+  TVectorIds myCellRanges;
+  vtkSmartPointer<vtkPoints> myPoints;
+};
+
+#endif
diff --git a/src/CONVERTOR/VISU_ConvertorDef_impl.hxx b/src/CONVERTOR/VISU_ConvertorDef_impl.hxx
new file mode 100644 (file)
index 0000000..441b206
--- /dev/null
@@ -0,0 +1,158 @@
+//  VISU CONVERTOR :
+//
+//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
+// 
+//  This library is free software; you can redistribute it and/or 
+//  modify it under the terms of the GNU Lesser General Public 
+//  License as published by the Free Software Foundation; either 
+//  version 2.1 of the License. 
+// 
+//  This library is distributed in the hope that it will be useful, 
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of 
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
+//  Lesser General Public License for more details. 
+// 
+//  You should have received a copy of the GNU Lesser General Public 
+//  License along with this library; if not, write to the Free Software 
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
+// 
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+//
+//  File   : 
+//  Author : 
+//  Module : 
+
+#ifndef VISU_ConvertorDef_impl_HeaderFile
+#define VISU_ConvertorDef_impl_HeaderFile
+
+/*! 
+  \file VISU_ConvertorDef_impl.hxx
+  \brief The file contains predeclarations for basic classes of the VISU CONVERTOR package
+*/
+
+#include "VISU_ConvertorDef.hxx"
+
+#include <vtkSmartPointer.h>
+
+class vtkCell;
+class vtkPoints;
+
+class vtkPolyData;
+class VISU_AppendPolyData;
+
+class vtkUnstructuredGrid;
+class VTKViewer_AppendFilter;
+
+class VISU_MergeFilter;
+
+namespace VISU
+{
+  //---------------------------------------------------------------
+  typedef vtkSmartPointer<VISU_MergeFilter> PMergeFilter;
+
+
+  //---------------------------------------------------------------
+  typedef vtkSmartPointer<vtkPolyData> PPolyData;
+  typedef vtkSmartPointer<VISU_AppendPolyData> PAppendPolyData;
+
+  struct TAppendPolyDataHolder;
+  typedef MED::SharedPtr<TAppendPolyDataHolder> PAppendPolyDataHolder;
+
+  struct TPolyDataIDMapperImpl;
+  typedef MED::SharedPtr<TPolyDataIDMapperImpl> PPolyDataIDMapperImpl;
+
+
+  //---------------------------------------------------------------
+  typedef vtkSmartPointer<vtkUnstructuredGrid> PUnstructuredGrid;
+  typedef vtkSmartPointer<VTKViewer_AppendFilter> PAppendFilter;
+
+  struct TAppendFilterHolder;
+  typedef MED::SharedPtr<TAppendFilterHolder> PAppendFilterHolder;
+
+  struct TUnstructuredGridIDMapperImpl;
+  typedef MED::SharedPtr<TUnstructuredGridIDMapperImpl> PUnstructuredGridIDMapperImpl;
+
+
+  //---------------------------------------------------------------
+  struct TPointCoords;
+  typedef MED::SharedPtr<TPointCoords> PPointCoords;
+
+
+  //---------------------------------------------------------------
+  struct TNamedPointCoords;
+  typedef MED::SharedPtr<TNamedPointCoords> PNamedPointCoords;
+
+
+  //---------------------------------------------------------------
+  struct TMeshValueBase;
+  typedef MED::SharedPtr<TMeshValueBase> PMeshValue;
+
+
+  //---------------------------------------------------------------
+  struct TMeshImpl;
+  typedef MED::SharedPtr<TMeshImpl> PMeshImpl;
+
+
+  //---------------------------------------------------------------
+  struct TSubProfileImpl;
+  typedef MED::SharedPtr<TSubProfileImpl> PSubProfileImpl;
+
+
+  //---------------------------------------------------------------
+  struct TProfileImpl;
+  typedef MED::SharedPtr<TProfileImpl> PProfileImpl;
+
+
+  //---------------------------------------------------------------
+  struct TGaussImpl;
+  typedef MED::SharedPtr<TGaussImpl> PGaussImpl;
+
+
+  //---------------------------------------------------------------
+  struct TGaussSubMeshImpl;
+  typedef MED::SharedPtr<TGaussSubMeshImpl> PGaussSubMeshImpl;
+
+
+  //---------------------------------------------------------------
+  struct TGaussMeshImpl;
+  typedef MED::SharedPtr<TGaussMeshImpl> PGaussMeshImpl;
+
+
+  //---------------------------------------------------------------
+  struct TGaussPtsIDFilter;
+  typedef MED::SharedPtr<TGaussPtsIDFilter> PGaussPtsIDFilter;
+
+
+  //---------------------------------------------------------------
+  struct TSubMeshImpl;
+  typedef MED::SharedPtr<TSubMeshImpl> PSubMeshImpl;
+
+
+  //---------------------------------------------------------------
+  struct TMeshOnEntityImpl;
+  typedef MED::SharedPtr<TMeshOnEntityImpl> PMeshOnEntityImpl;
+
+
+  //---------------------------------------------------------------
+  struct TFamilyImpl;
+  typedef MED::SharedPtr<TFamilyImpl> PFamilyImpl;
+
+
+  //---------------------------------------------------------------
+  struct TGroupImpl;
+  typedef MED::SharedPtr<TGroupImpl> PGroupImpl;
+
+
+  //---------------------------------------------------------------
+  struct TFieldImpl;
+  typedef MED::SharedPtr<TFieldImpl> PFieldImpl;
+
+
+  //---------------------------------------------------------------
+  struct TValForTimeImpl;
+  typedef MED::SharedPtr<TValForTimeImpl> PValForTimeImpl;
+}
+
+#endif
diff --git a/src/CONVERTOR/VISU_MeshValue.cxx b/src/CONVERTOR/VISU_MeshValue.cxx
new file mode 100644 (file)
index 0000000..4b7a278
--- /dev/null
@@ -0,0 +1,615 @@
+//  VISU OBJECT : interactive object for VISU entities implementation
+//
+//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
+// 
+//  This library is free software; you can redistribute it and/or 
+//  modify it under the terms of the GNU Lesser General Public 
+//  License as published by the Free Software Foundation; either 
+//  version 2.1 of the License. 
+// 
+//  This library is distributed in the hope that it will be useful, 
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of 
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
+//  Lesser General Public License for more details. 
+// 
+//  You should have received a copy of the GNU Lesser General Public 
+//  License along with this library; if not, write to the Free Software 
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
+// 
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+//
+//  File:
+//  Author:
+//  Module : VISU
+
+#include "VISU_MeshValue.hxx"
+#include "VISU_Structures_impl.hxx"
+#include "VISU_ConvertorUtils.hxx"
+
+#include "VISU_PointCoords.hxx"
+#include "VISU_TypeList.hxx"
+
+#include <vtkUnstructuredGrid.h>
+#include <vtkPolyData.h>
+
+#include <vtkPointData.h>
+#include <vtkCellData.h>
+
+#include <vtkCharArray.h>
+#include <vtkUnsignedCharArray.h>
+#include <vtkShortArray.h>
+#include <vtkUnsignedShortArray.h>
+#include <vtkIntArray.h>
+#include <vtkUnsignedIntArray.h>
+#include <vtkLongArray.h>
+#include <vtkUnsignedLongArray.h> 
+#include <vtkFloatArray.h> 
+#include <vtkDoubleArray.h> 
+
+#include <string>
+#include <algorithm>
+
+#ifdef _DEBUG_
+static int MYDEBUG = 0;
+#else
+static int MYDEBUG = 0;
+#endif
+
+namespace VISU
+{
+  //---------------------------------------------------------------
+  std::string
+  GenerateFieldName(const PFieldImpl& theField,
+                   const PValForTimeImpl& theValForTime)
+  {
+    const VISU::TTime& aTime = theValForTime->myTime;
+    std::string aFieldName = theField->myMeshName + ", " + theField->myName + ": " + 
+      VISU_Convertor::GenerateName(aTime);
+    return aFieldName;
+  }
+
+
+  //---------------------------------------------------------------
+  void
+  TMeshValueBase
+  ::Init(vtkIdType theNbElem,
+        vtkIdType theNbGauss,
+        vtkIdType theNbComp)
+  {
+    myNbElem = theNbElem;
+    myNbGauss = theNbGauss;
+    myNbComp = theNbComp;
+    myStep = theNbComp*theNbGauss;
+  }
+
+  vtkIdType 
+  TMeshValueBase
+  ::GetNbElem() const
+  {
+    return myNbElem;
+  }
+
+  vtkIdType 
+  TMeshValueBase
+  ::GetNbComp() const
+  {
+    return myNbComp;
+  }
+
+  vtkIdType 
+  TMeshValueBase
+  ::GetNbGauss() const
+  {
+    return myNbGauss;
+  }
+
+  size_t 
+  TMeshValueBase
+  ::size() const
+  {
+    return myNbElem * myStep;
+  }
+
+
+  namespace TL
+  {
+    //----------------------------------------------------------------------------
+    typedef TList<char,
+                 TList<unsigned char,
+                       TList<short,
+                             TList<unsigned short,
+                                   TList<int,
+                                         TList<unsigned int,
+                                               TList<long,
+                                                     TList<unsigned long, 
+                                                           TList<float, 
+                                                                 TList<double, 
+                                                                       TNullType> > > > > > > > > >
+    TVTKBasicTypeList;
+    
+
+    //----------------------------------------------------------------------------
+    typedef TList<vtkCharArray,
+                 TList<vtkUnsignedCharArray,
+                       TList<vtkShortArray,
+                             TList<vtkUnsignedShortArray,
+                                   TList<vtkIntArray,
+                                         TList<vtkUnsignedIntArray,
+                                               TList<vtkLongArray,
+                                                     TList<vtkUnsignedLongArray, 
+                                                           TList<vtkFloatArray, 
+                                                                 TList<vtkDoubleArray, 
+                                                                             TNullType> > > > > > > > > >
+    TVTKArrayTypeList;
+    
+
+    typedef TList<TInt2Type<VTK_CHAR>,
+                 TList<TInt2Type<VTK_UNSIGNED_CHAR>,
+                       TList<TInt2Type<VTK_SHORT>,
+                             TList<TInt2Type<VTK_UNSIGNED_SHORT>,
+                                   TList<TInt2Type<VTK_INT>,
+                                         TList<TInt2Type<VTK_UNSIGNED_INT>,
+                                               TList<TInt2Type<VTK_LONG>,
+                                                     TList<TInt2Type<VTK_UNSIGNED_LONG>,
+                                                           TList<TInt2Type<VTK_FLOAT>, 
+                                                                 TList<TInt2Type<VTK_DOUBLE>, 
+                                                                       TNullType> > > > > > > > > >
+    TVTKBasicEnumList;
+    
+
+    //----------------------------------------------------------------------------
+    template <unsigned int type_enum>
+    struct TEnum2VTKBasicType
+    {
+      typedef typename TTypeAt<TVTKBasicTypeList, TIndexOf<TVTKBasicEnumList, TInt2Type<type_enum> >::value >::TResult TResult;
+    };
+    
+    //----------------------------------------------------------------------------
+    template <unsigned int type_enum>
+    struct TEnum2VTKArrayType
+    {
+      typedef typename TTypeAt<TVTKArrayTypeList, TIndexOf<TVTKBasicEnumList, TInt2Type<type_enum> >::value >::TResult TResult;
+    };
+    
+    //----------------------------------------------------------------------------
+    template <class T>
+    struct TVTKBasicType2Enum
+    {
+      typedef typename TTypeAt<TVTKBasicEnumList, TIndexOf<TVTKBasicTypeList, T>::value >::TResult TResult;
+    };
+    
+  }
+
+
+  //----------------------------------------------------------------------------
+  template<int EDataType>
+  void 
+  InitTimeStampOnProfile(const PUnstructuredGrid& theSource,
+                        const PFieldImpl& theField, 
+                        const PValForTimeImpl& theValForTime,
+                        const VISU::TEntity& theEntity);
+
+
+  //----------------------------------------------------------------------------
+  void 
+  GetTimeStampOnProfile(const PUnstructuredGrid& theSource,
+                       const PFieldImpl& theField, 
+                       const PValForTimeImpl& theValForTime,
+                       const VISU::TEntity& theEntity)
+  {
+    vtkIdType aDataType = theField->GetDataType();
+    switch(aDataType){
+    case VTK_DOUBLE:
+      InitTimeStampOnProfile<VTK_DOUBLE>(theSource, theField, theValForTime, theEntity);
+      break;
+    case VTK_FLOAT:
+      InitTimeStampOnProfile<VTK_FLOAT>(theSource, theField, theValForTime, theEntity);
+      break;
+    case VTK_INT:
+      InitTimeStampOnProfile<VTK_INT>(theSource, theField, theValForTime, theEntity);
+      break;
+    case VTK_LONG:
+      InitTimeStampOnProfile<VTK_LONG>(theSource, theField, theValForTime, theEntity);
+      break;
+    default:
+      EXCEPTION(std::runtime_error,
+               "GetTimeStampOnProfile - handling unsupported data type - "<<aDataType);
+    }
+  }
+
+
+  //----------------------------------------------------------------------------
+  template<int EDataType>
+  struct TDataArrayHolder
+  {
+    typedef typename TL::TEnum2VTKArrayType<EDataType>::TResult TVTKDataArray;
+    typedef typename TL::TEnum2VTKBasicType<EDataType>::TResult TVTKBasicType;
+    TVTKDataArray* myDataArray;
+
+    TDataArrayHolder(TVTKDataArray* theDataArray):
+      myDataArray(theDataArray)
+    {}
+    
+    void
+    WritePointer(TVTKDataArray* theDataArray,
+                vtkIdType theTupleId,
+                TVTKBasicType* thePointer)
+    {
+      vtkIdType aNumberOfComponents = theDataArray->GetNumberOfComponents();
+      vtkIdType aPosition = theTupleId * aNumberOfComponents;
+      TVTKBasicType *aPtr = theDataArray->WritePointer(aPosition, aNumberOfComponents);
+      for(vtkIdType anId = 0; anId < aNumberOfComponents; anId++)
+       *aPtr++ = *thePointer++;
+    }
+
+    virtual
+    void
+    SetTuple(vtkIdType theTupleId, 
+            TVTKBasicType* thePointer)
+    {
+      this->WritePointer(myDataArray, theTupleId, thePointer);
+    }
+  };
+
+
+  //----------------------------------------------------------------------------
+  template<int EDataType>
+  struct TDataArrayHolder2: TDataArrayHolder<EDataType>
+  {
+    typedef TDataArrayHolder<EDataType> TSuperClass;
+    typedef typename TSuperClass::TVTKDataArray TVTKDataArray;
+    typedef typename TSuperClass::TVTKBasicType TVTKBasicType;
+    TVTKDataArray* myDataArray2;
+
+    TDataArrayHolder2(TVTKDataArray* theDataArray,
+                     TVTKDataArray* theDataArray2):
+      TSuperClass(theDataArray),
+      myDataArray2(theDataArray2)
+    {}
+    
+    virtual
+    void
+    SetTuple(vtkIdType theTupleId, 
+            TVTKBasicType* thePointer)
+    {
+      this->WritePointer(this->myDataArray, theTupleId, thePointer);
+      this->WritePointer(this->myDataArray2, theTupleId, thePointer);
+    }
+  };
+
+
+  //----------------------------------------------------------------------------
+  template<int EDataType>
+  struct TTimeStampOnProfileInitArray
+  {
+    typedef typename TL::TEnum2VTKArrayType<EDataType>::TResult TVTKDataArray;
+    typedef typename TL::TEnum2VTKBasicType<EDataType>::TResult TVTKBasicType;
+    typedef TTMeshValue<TVTKBasicType> TMeshValue;
+    typedef MED::SharedPtr<TMeshValue> TMeshValuePtr;
+
+    typedef TDataArrayHolder<EDataType> TTDataArrayHolder;
+    typedef MED::SharedPtr<TTDataArrayHolder> PDataArrayHolder;
+    PDataArrayHolder myDataArrayHolder;
+
+    TTimeStampOnProfileInitArray(const PDataArrayHolder& theDataArrayHolder):
+      myDataArrayHolder(theDataArrayHolder)
+    {}
+    
+    void
+    Execute(const PFieldImpl& theField,
+           const PValForTimeImpl& theValForTime)
+    {
+      vtkIdType aNbComp = theField->myNbComp;
+      vtkIdType aSize = std::max(3, aNbComp);
+      TVector<TVTKBasicType> aDataValues(aSize);
+      
+      const TGeom2MeshValue& aGeom2MeshValue = theValForTime->GetGeom2MeshValue();
+      TGeom2MeshValue::const_iterator anIter = aGeom2MeshValue.begin();
+      for(int aTupleId = 0; anIter != aGeom2MeshValue.end(); anIter++){
+       EGeometry aEGeom = anIter->first;
+       const TMeshValuePtr aMeshValue = anIter->second;
+       
+       vtkIdType aNbElem = aMeshValue->GetNbElem();
+       vtkIdType aNbGauss = aMeshValue->GetNbGauss();
+       
+       INITMSG(MYDEBUG,
+               "- aEGeom = "<<aEGeom<<
+               "; aNbElem = "<<aNbElem<<
+               "; aNbGauss = "<<aNbGauss<<
+               std::endl);
+       
+       for(vtkIdType iElem = 0; iElem < aNbElem; iElem++, aTupleId++){
+         typename TMeshValue::TCValueSliceArr aValueSliceArr = aMeshValue->GetCompValueSliceArr(iElem);
+         for(vtkIdType iComp = 0; iComp < aNbComp; iComp++){
+           const typename TMeshValue::TCValueSlice& aValueSlice = aValueSliceArr[iComp];
+           aDataValues[iComp] = TVTKBasicType();
+           for(vtkIdType iGauss = 0; iGauss < aNbGauss; iGauss++){
+             aDataValues[iComp] += aValueSlice[iGauss];
+           }
+           aDataValues[iComp] /= aNbGauss;
+         }
+         this->myDataArrayHolder->SetTuple(aTupleId, &aDataValues[0]);
+       }
+      }
+    }
+  };
+
+
+  //----------------------------------------------------------------------------
+  template<int EDataType>
+  void 
+  InitTimeStampOnProfile(const PUnstructuredGrid& theSource,
+                        const PFieldImpl& theField, 
+                        const PValForTimeImpl& theValForTime,
+                        const VISU::TEntity& theEntity)
+  {
+    vtkIdType aNbTuples = theField->myDataSize / theField->myNbComp;
+    std::string aFieldName = VISU::GenerateFieldName(theField, theValForTime);
+    
+    vtkDataSetAttributes* aDataSetAttributes;
+    switch(theEntity){
+    case VISU::NODE_ENTITY : 
+      aDataSetAttributes = theSource->GetPointData();
+      break;
+    default: 
+      aDataSetAttributes = theSource->GetCellData();
+    }
+
+    typedef typename TL::TEnum2VTKArrayType<EDataType>::TResult TVTKDataArray;
+    TVTKDataArray *aSelectedDataArray = TVTKDataArray::New();
+    vtkIdType aNbComp = theField->myNbComp;
+    switch(aNbComp) {
+    case 1:
+      aSelectedDataArray->SetNumberOfComponents(1);
+      aDataSetAttributes->SetScalars(aSelectedDataArray);
+      break;
+    default:
+      aSelectedDataArray->SetNumberOfComponents(3);
+      aDataSetAttributes->SetVectors(aSelectedDataArray);
+    }
+    aSelectedDataArray->SetNumberOfTuples(aNbTuples);
+    aSelectedDataArray->SetName(aFieldName.c_str());
+
+    TVTKDataArray *aFullDataArray = TVTKDataArray::New();
+    aFullDataArray->SetNumberOfComponents(aNbComp);
+    aFullDataArray->SetNumberOfTuples(aNbTuples);
+    aFullDataArray->SetName("VISU_FIELD");
+    aDataSetAttributes->AddArray(aFullDataArray);
+
+    INITMSG(MYDEBUG,"InitTimeStampOnProfile "<<
+           "- theEntity = "<<theEntity<<
+           "; aNbTuples = "<<aNbTuples<<
+           "; aNbComp = "<<aNbComp<<
+           std::endl);
+    TTimerLog aTimerLog(MYDEBUG,"InitTimeStampOnProfile");
+    
+    const TGeom2MeshValue& aGeom2MeshValue = theValForTime->GetGeom2MeshValue();
+    typedef typename TL::TEnum2VTKBasicType<EDataType>::TResult TVTKBasicType;
+    typedef TTMeshValue<TVTKBasicType> TMeshValue;
+    typedef MED::SharedPtr<TMeshValue> TMeshValuePtr;
+
+    typedef TDataArrayHolder<EDataType> TTDataArrayHolder;
+    typedef MED::SharedPtr<TTDataArrayHolder> PDataArrayHolder;
+
+    TMeshValuePtr aMeshValue = theValForTime->GetFirstMeshValue();
+    if(aGeom2MeshValue.size() == 1 && aMeshValue->GetNbGauss() == 1){
+      aFullDataArray->SetVoidArray(aMeshValue->GetPointer(),
+                                  aMeshValue->size(),
+                                  true);
+      INITMSG(MYDEBUG,"InitTimeStampOnProfile - aFullDataArray->SetVoidArray()"<<std::endl);
+      if(aNbComp == 1){
+       aSelectedDataArray->SetVoidArray(aMeshValue->GetPointer(),
+                                        aMeshValue->size(),
+                                        true);
+       INITMSG(MYDEBUG,"InitTimeStampOnProfile - aSelectedDataArray->SetVoidArray()"<<std::endl);
+      }else{
+       PDataArrayHolder aDataArrayHolder(new TTDataArrayHolder(aSelectedDataArray));
+       TTimeStampOnProfileInitArray<EDataType>(aDataArrayHolder).Execute(theField, theValForTime);
+      }
+    }else{
+      typedef TDataArrayHolder2<EDataType> TTDataArrayHolder2;
+      PDataArrayHolder aDataArrayHolder(new TTDataArrayHolder2(aSelectedDataArray, aFullDataArray));
+      TTimeStampOnProfileInitArray<EDataType>(aDataArrayHolder).Execute(theField, theValForTime);
+    }
+
+    aSelectedDataArray->Delete();
+    aFullDataArray->Delete();
+  }
+
+
+  //----------------------------------------------------------------------------
+  template<int EDataType>
+  void 
+  InitTimeStampOnGaussMesh(const PPolyData& theSource,
+                          const PFieldImpl& theField, 
+                          const PValForTimeImpl& theValForTime);
+
+  void 
+  GetTimeStampOnGaussMesh(const PPolyData& theSource,
+                         const PFieldImpl& theField, 
+                         const PValForTimeImpl& theValForTime)
+  {
+    vtkIdType aDataType = theField->GetDataType();
+    switch(aDataType){
+    case VTK_DOUBLE:
+      InitTimeStampOnGaussMesh<VTK_DOUBLE>(theSource, theField, theValForTime);
+      break;
+    case VTK_FLOAT:
+      InitTimeStampOnGaussMesh<VTK_FLOAT>(theSource, theField, theValForTime);
+      break;
+    case VTK_INT:
+      InitTimeStampOnGaussMesh<VTK_INT>(theSource, theField, theValForTime);
+      break;
+    case VTK_LONG:
+      InitTimeStampOnGaussMesh<VTK_LONG>(theSource, theField, theValForTime);
+      break;
+    default:
+      EXCEPTION(std::runtime_error,
+               "GetTimeStampOnGaussMesh - handling unsupported data type - "<<aDataType);
+    }
+  }
+
+  //----------------------------------------------------------------------------
+  template<int EDataType>
+  struct TTimeStampOnGaussMeshInitArray
+  {
+    typedef typename TL::TEnum2VTKArrayType<EDataType>::TResult TVTKDataArray;
+    typedef typename TL::TEnum2VTKBasicType<EDataType>::TResult TVTKBasicType;
+    typedef TTMeshValue<TVTKBasicType> TMeshValue;
+    typedef MED::SharedPtr<TMeshValue> TMeshValuePtr;
+
+    typedef TDataArrayHolder<EDataType> TTDataArrayHolder;
+    typedef MED::SharedPtr<TTDataArrayHolder> PDataArrayHolder;
+    PDataArrayHolder myDataArrayHolder;
+
+    TTimeStampOnGaussMeshInitArray(const PDataArrayHolder& theDataArrayHolder):
+      myDataArrayHolder(theDataArrayHolder)
+    {}
+    
+    void
+    Execute(const PFieldImpl& theField,
+           const PValForTimeImpl& theValForTime)
+    {
+      vtkIdType aNbComp = theField->myNbComp;
+      vtkIdType aSize = std::max(3, aNbComp);
+      TVector<TVTKBasicType> aDataValues(aSize);
+
+      const TGeom2MeshValue& aGeom2MeshValue = theValForTime->GetGeom2MeshValue();
+
+      PGaussMeshImpl aGaussMesh = theValForTime->myGaussMesh;
+      const TGeom2GaussSubMesh& aGeom2GaussSubMesh = aGaussMesh->myGeom2GaussSubMesh;
+      TGeom2GaussSubMesh::const_iterator anIter = aGeom2GaussSubMesh.begin();
+      for(int aTupleId = 0; anIter != aGeom2GaussSubMesh.end(); anIter++){
+       EGeometry aEGeom = anIter->first;
+       
+       PGaussSubMeshImpl aGaussSubMesh = anIter->second;
+       if(!aGaussSubMesh->myIsDone)
+         continue;
+       
+       TGeom2MeshValue::const_iterator anIter2 = aGeom2MeshValue.find(aEGeom);
+       if(anIter2 == aGeom2MeshValue.end()){
+         EXCEPTION(std::runtime_error,
+                   "TTimeStampOnGaussMeshInitArray >> Can't find values for corresponding Gauss Points SubMesh");
+       }
+       TMeshValuePtr aMeshValue = anIter2->second;
+       vtkIdType aNbGauss = aMeshValue->GetNbGauss();
+       vtkIdType aNbElem = aMeshValue->GetNbElem();
+       
+       if(aNbGauss < 1)
+         continue;
+       
+       const TPointCoords& aCoords = aGaussSubMesh->myPointCoords;
+       
+       INITMSG(MYDEBUG,
+               "- aEGeom = "<<aEGeom<<
+               "; aNbElem = "<<aNbElem<<
+               "; aNbGauss = "<<aNbGauss<<
+               "; aCoords.GetNbPoints() = "<<aCoords.GetNbPoints()<<
+               std::endl);
+
+       if(aCoords.GetNbPoints() == aNbElem*aNbGauss){
+         for(int iElem = 0; iElem < aNbElem; iElem++){
+           typename TMeshValue::TCValueSliceArr aValueSliceArr = aMeshValue->GetGaussValueSliceArr(iElem);
+           for(int iGauss = 0; iGauss < aNbGauss; iGauss++, aTupleId++){
+             const typename TMeshValue::TCValueSlice& aValueSlice = aValueSliceArr[iGauss];
+             for(int iComp = 0; iComp < aNbComp; iComp++){
+               aDataValues[iComp] = aValueSlice[iComp];
+             }
+             this->myDataArrayHolder->SetTuple(aTupleId, &aDataValues[0]);
+           }
+         }
+       }else{
+         for(int iElem = 0; iElem < aNbElem; iElem++, aTupleId++){
+           typename TMeshValue::TCValueSliceArr aValueSliceArr = aMeshValue->GetCompValueSliceArr(iElem);
+           for(int iComp = 0; iComp < aNbComp; iComp++){
+             const typename TMeshValue::TCValueSlice& aValueSlice = aValueSliceArr[iComp];
+             aDataValues[iComp] = TVTKBasicType();
+             for(int iGauss = 0; iGauss < aNbGauss; iGauss++){
+               aDataValues[iComp] += aValueSlice[iGauss];
+             }
+             aDataValues[iComp] /= aNbGauss;
+           }
+           this->myDataArrayHolder->SetTuple(aTupleId, &aDataValues[0]);
+         }
+       }
+      }
+    }
+  };
+
+
+  template<int EDataType>
+  void 
+  InitTimeStampOnGaussMesh(const PPolyData& theSource,
+                          const PFieldImpl& theField, 
+                          const PValForTimeImpl& theValForTime)
+  {
+    vtkIdType aNbTuples = theSource->GetNumberOfPoints();
+    std::string aFieldName = VISU::GenerateFieldName(theField, theValForTime);
+
+    vtkDataSetAttributes* aDataSetAttributes = theSource->GetPointData();
+
+    typedef typename TL::TEnum2VTKArrayType<EDataType>::TResult TVTKDataArray;
+    TVTKDataArray *aSelectedDataArray = TVTKDataArray::New();
+    vtkIdType aNbComp = theField->myNbComp;
+    switch(aNbComp){
+    case 1:
+      aSelectedDataArray->SetNumberOfComponents(1);
+      aDataSetAttributes->SetScalars(aSelectedDataArray);
+      break;
+    default:
+      aSelectedDataArray->SetNumberOfComponents(3);
+      aDataSetAttributes->SetVectors(aSelectedDataArray);
+    }
+    aSelectedDataArray->SetNumberOfTuples(aNbTuples);
+    aSelectedDataArray->SetName(aFieldName.c_str());
+
+    TVTKDataArray *aFullDataArray = TVTKDataArray::New();
+    aFullDataArray->SetNumberOfComponents(aNbComp);
+    aFullDataArray->SetNumberOfTuples(aNbTuples);
+    aFullDataArray->SetName("VISU_FIELD");
+    aDataSetAttributes->AddArray(aFullDataArray);
+
+    INITMSG(MYDEBUG,"InitTimeStampOnGaussMesh "<<
+           "- aNbTuples = "<<aNbTuples<<
+           "; aNbComp = "<<aNbComp<<
+           std::endl);
+    TTimerLog aTimerLog(MYDEBUG,"InitTimeStampOnGaussMesh");
+    
+    const TGeom2MeshValue& aGeom2MeshValue = theValForTime->GetGeom2MeshValue();
+    typedef typename TL::TEnum2VTKBasicType<EDataType>::TResult TVTKBasicType;
+    typedef TTMeshValue<TVTKBasicType> TMeshValue;
+    typedef MED::SharedPtr<TMeshValue> TMeshValuePtr;
+
+    typedef TDataArrayHolder<EDataType> TTDataArrayHolder;
+    typedef MED::SharedPtr<TTDataArrayHolder> PDataArrayHolder;
+
+    TMeshValuePtr aMeshValue = theValForTime->GetFirstMeshValue();
+    if(aGeom2MeshValue.size() == 1){
+      aFullDataArray->SetVoidArray(aMeshValue->GetPointer(),
+                                  aMeshValue->size(),
+                                  true);
+      INITMSG(MYDEBUG,"InitTimeStampOnGaussMesh - aFullDataArray->SetVoidArray()"<<std::endl);
+      if(aNbComp == 1 || aNbComp == 3){
+       aSelectedDataArray->SetVoidArray(aMeshValue->GetPointer(),
+                                        aMeshValue->size(),
+                                        true);
+       INITMSG(MYDEBUG,"InitTimeStampOnGaussMesh - aSelectedDataArray->SetVoidArray()"<<std::endl);
+      }else{
+       PDataArrayHolder aDataArrayHolder(new TTDataArrayHolder(aSelectedDataArray));
+       TTimeStampOnGaussMeshInitArray<EDataType>(aDataArrayHolder).Execute(theField, theValForTime);
+      }
+    }else{
+      typedef TDataArrayHolder2<EDataType> TTDataArrayHolder2;
+      PDataArrayHolder aDataArrayHolder(new TTDataArrayHolder2(aSelectedDataArray, aFullDataArray));
+      TTimeStampOnGaussMeshInitArray<EDataType>(aDataArrayHolder).Execute(theField, theValForTime);
+    }
+
+    aSelectedDataArray->Delete();
+    aFullDataArray->Delete();
+  }
+
+
+  //---------------------------------------------------------------
+}
diff --git a/src/CONVERTOR/VISU_MeshValue.hxx b/src/CONVERTOR/VISU_MeshValue.hxx
new file mode 100644 (file)
index 0000000..70c1df6
--- /dev/null
@@ -0,0 +1,219 @@
+//  VISU CONVERTOR :
+//
+//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
+// 
+//  This library is free software; you can redistribute it and/or 
+//  modify it under the terms of the GNU Lesser General Public 
+//  License as published by the Free Software Foundation; either 
+//  version 2.1 of the License. 
+// 
+//  This library is distributed in the hope that it will be useful, 
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of 
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
+//  Lesser General Public License for more details. 
+// 
+//  You should have received a copy of the GNU Lesser General Public 
+//  License along with this library; if not, write to the Free Software 
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
+// 
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+//
+//  File   : VISU_Convertor.hxx
+//  Author : Alexey PETROV
+//  Module : VISU
+
+#ifndef VISU_MeshValue_HeaderFile
+#define VISU_MeshValue_HeaderFile
+
+/*! 
+  \file VISU_MeshValue.hxx
+  \brief The file contains declarations for basic interfaces that defines mesh value of mesh elements
+*/
+
+#include "VISU_Convertor.hxx"
+#include "VISU_ConvertorDef_impl.hxx"
+
+#include "MED_SliceArray.hxx"
+#include "MED_Vector.hxx"
+
+namespace VISU
+{
+  //---------------------------------------------------------------
+  //! Define a base class for the container to get access to data assigned to mesh
+  class TMeshValueBase
+  {
+  public:
+    //! To intitilize the data strucutre
+    void
+    Init(vtkIdType theNbElem,
+        vtkIdType theNbGauss,
+        vtkIdType theNbComp);
+
+    //! Gets memory size used by the instance (bytes).
+    virtual
+    unsigned long int
+    GetMemorySize() const = 0;
+
+    //! Gets number of mesh elements where the data assigned to.
+    vtkIdType
+    GetNbElem() const;
+
+    //! Gets number of components of corresponding MED FIELD.
+    vtkIdType
+    GetNbComp() const;
+
+    //! Gets number of Gauss Points.
+    vtkIdType
+    GetNbGauss() const;
+
+    size_t
+    size() const;
+
+  protected:
+    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
+  };
+  typedef MED::SharedPtr<TMeshValueBase> PMeshValue;
+
+
+  //---------------------------------------------------------------
+  //! Define a container to get access to data assigned to mesh
+  template<class TValueType>
+  class TTMeshValue: public virtual TMeshValueBase
+  {
+  public:
+    typedef MED::TSlice<TValueType> TValueSlice;
+    typedef MED::TCSlice<TValueType> TCValueSlice;
+    
+    typedef TVector<TCValueSlice> TCValueSliceArr;
+    typedef TVector<TValueSlice> TValueSliceArr;
+
+    virtual
+    const TValueType*
+    GetPointer() const = 0;
+
+    virtual
+    TValueType*
+    GetPointer() = 0;
+
+    //! To get assigned values first by Gauss Points and then by components (constant version)
+    TCValueSliceArr
+    GetGaussValueSliceArr(vtkIdType theElemId) const
+    {
+      TCValueSliceArr aValueSliceArr(this->myNbGauss);
+      vtkIdType anId = theElemId * this->myStep;
+      for(vtkIdType aGaussId = 0; aGaussId < this->myNbGauss; aGaussId++){
+       aValueSliceArr[aGaussId] =
+         TCValueSlice(this->GetPointer(), 
+                      this->size(),
+                      std::slice(anId, this->myNbComp, 1));
+       anId += this->myNbComp;
+      }
+      return aValueSliceArr;
+    }
+
+    //! To get assigned values first by Gauss Points and then by components
+    TValueSliceArr 
+    GetGaussValueSliceArr(vtkIdType theElemId)
+    {
+      TValueSliceArr aValueSliceArr(this->myNbGauss);
+      vtkIdType anId = theElemId * this->myStep;
+      for(vtkIdType aGaussId = 0; aGaussId < this->myNbGauss; aGaussId++){
+       aValueSliceArr[aGaussId] =
+         TValueSlice(this->GetPointer(), 
+                     this->size(),
+                     std::slice(anId, this->myNbComp, 1));
+       anId += this->myNbComp;
+      }
+      return aValueSliceArr;
+    }
+
+    //! To get assigned values first by components and then by Gauss Points (constant version)
+    TCValueSliceArr
+    GetCompValueSliceArr(vtkIdType theElemId) const
+    {
+      TCValueSliceArr aValueSliceArr(this->myNbComp);
+      vtkIdType anId = theElemId * this->myStep;
+      for(vtkIdType aCompId = 0; aCompId < this->myNbComp; aCompId++){
+       aValueSliceArr[aCompId] =
+         TCValueSlice(this->GetPointer(), 
+                      this->size(),
+                      std::slice(anId, this->myNbGauss, this->myNbComp));
+       anId += 1;
+      }
+      return aValueSliceArr;
+    }
+
+    //! To get assigned values first by components and then by Gauss Points
+    TValueSliceArr 
+    GetCompValueSliceArr(vtkIdType theElemId)
+    {
+      TValueSliceArr aValueSliceArr(this->myNbComp);
+      vtkIdType anId = theElemId * this->myStep;
+      for(vtkIdType aCompId = 0; aCompId < this->myNbComp; aCompId++){
+       aValueSliceArr[aCompId] =
+         TValueSlice(this->GetPointer(), 
+                     this->size(),
+                     std::slice(anId, this->myNbGauss, this->myNbComp));
+       anId += 1;
+      }
+      return aValueSliceArr;
+    }
+
+    //! Gets memory size used by the instance (bytes).
+    virtual
+    unsigned long int
+    GetMemorySize() const
+    {
+      return this->size() * sizeof(TValueType);
+    }
+  };
+  
+
+  //---------------------------------------------------------------
+  //! Define a container to get access to data assigned to mesh
+  template<class TValueType, class TContainerType>
+  class TTMeshValueHolder: public virtual TTMeshValue<TValueType>
+  {
+  public:
+    //! To initilize the class instance
+    void
+    Init(vtkIdType theNbElem,
+        vtkIdType theNbGauss,
+        vtkIdType theNbComp,
+        const TContainerType& theContainer)
+    {
+      TMeshValueBase::Init(theNbElem, theNbGauss, theNbComp);
+      myContainer = theContainer;
+    }
+
+  protected:
+    mutable TContainerType myContainer; //!< Keeps the mesh values container itself
+  };
+
+
+  //---------------------------------------------------------------
+  // Initilize corresponding vtkDataSetAttributes for TValForTime
+  void 
+  GetTimeStampOnProfile(const PUnstructuredGrid& theSource,
+                       const PFieldImpl& theField, 
+                       const PValForTimeImpl& theValForTime,
+                       const VISU::TEntity& theEntity);
+
+
+  //---------------------------------------------------------------
+  // Initilize corresponding vtkDataSetAttributes for TValForTime
+  void 
+  GetTimeStampOnGaussMesh(const PPolyData& theSource,
+                         const PFieldImpl& theField, 
+                         const PValForTimeImpl& theValForTime);
+
+
+  //---------------------------------------------------------------
+}
+
+#endif
diff --git a/src/CONVERTOR/VISU_PointCoords.cxx b/src/CONVERTOR/VISU_PointCoords.cxx
new file mode 100644 (file)
index 0000000..31c4ea4
--- /dev/null
@@ -0,0 +1,381 @@
+//  VISU OBJECT : interactive object for VISU entities implementation
+//
+//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
+// 
+//  This library is free software; you can redistribute it and/or 
+//  modify it under the terms of the GNU Lesser General Public 
+//  License as published by the Free Software Foundation; either 
+//  version 2.1 of the License. 
+// 
+//  This library is distributed in the hope that it will be useful, 
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of 
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
+//  Lesser General Public License for more details. 
+// 
+//  You should have received a copy of the GNU Lesser General Public 
+//  License along with this library; if not, write to the Free Software 
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
+// 
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+//
+//  File:
+//  Author:
+//  Module : VISU
+
+#include "VISU_PointCoords.hxx"
+#include "VISU_ConvertorUtils.hxx"
+
+#include <vtkPoints.h>
+
+#ifdef _DEBUG_
+static int MYDEBUG = 0;
+#else
+static int MYDEBUG = 0;
+#endif
+
+namespace VISU
+{
+  //---------------------------------------------------------------
+  void
+  TCoordHolderBase
+  ::Init(vtkIdType theNbPoints,
+        vtkIdType theDim)
+  {
+    myDim = theDim;
+    myNbPoints = theNbPoints;
+  }
+
+  vtkIdType
+  TCoordHolderBase
+  ::GetNbPoints() const
+  {
+    return myNbPoints; 
+  }
+
+  vtkIdType
+  TCoordHolderBase
+  ::GetDim() const
+  {
+    return myDim; 
+  }
+
+  size_t
+  TCoordHolderBase
+  ::size() const
+  {
+    return GetNbPoints() * GetDim(); 
+  }
+
+  unsigned long int
+  TCoordHolderBase
+  ::GetMemorySize()
+  {
+    return sizeof(TCoord) * size();
+  }
+
+
+  //---------------------------------------------------------------
+  TPointCoords
+  ::TPointCoords():
+    myPoints(vtkPoints::New())
+  {
+    myPoints->SetDataType(VTK_DOUBLE);
+    myPoints->Delete();
+  }
+
+  void
+  TPointCoords
+  ::Init(const PCoordHolder& theCoord)
+  {
+    myPoints->SetNumberOfPoints(theCoord->GetNbPoints());
+    myCoord = theCoord;
+  }
+
+  vtkIdType
+  TPointCoords
+  ::GetNbPoints() const
+  {
+    return myCoord->GetNbPoints(); 
+  }
+
+  vtkIdType
+  TPointCoords
+  ::GetDim() const
+  {
+    return myCoord->GetDim(); 
+  }
+
+  TCCoordSlice 
+  TPointCoords
+  ::GetCoordSlice(vtkIdType theNodeId) const
+  {
+    return myCoord->GetCoordSlice(theNodeId);
+  }
+  
+  TCoordSlice 
+  TPointCoords
+  ::GetCoordSlice(vtkIdType theNodeId)
+  {
+    return myCoord->GetCoordSlice(theNodeId);
+  }
+
+  void 
+  TPointCoords
+  ::SetVoidArray() const
+  {
+    vtkDataArray* aDataArray = myPoints->GetData();
+    aDataArray->SetVoidArray(myCoord->GetValuePtr(), myCoord->size(), true);
+  }
+
+  vtkPoints*
+  TPointCoords
+  ::GetPoints() const
+  { 
+    if(!myIsVTKDone){
+      TTimerLog aTimerLog(MYDEBUG,"TPointCoords::GetPoints()");
+      vtkIdType aNbPoints = GetNbPoints();
+      vtkIdType aDim = GetDim();
+
+      INITMSG(MYDEBUG,"TPointCoords::GetPoints - aNbPoints = "<<aNbPoints<<
+             "; aDim = "<<aDim<<
+             endl);
+      
+      if(GetDim() == 3){
+       INITMSG(MYDEBUG,"TPointCoords::GetPoints - SetVoidArray()"<<endl);
+       SetVoidArray();
+      }else{
+       for(vtkIdType aPointId = 0; aPointId < aNbPoints; aPointId++){
+         TCCoordSlice aSlice = GetCoordSlice(aPointId);
+      
+         vtkFloatingPointType aCoords[3] = {0.0, 0.0, 0.0};
+         for(vtkIdType aDimId = 0; aDimId < aDim; aDimId++)
+           aCoords[aDimId] = aSlice[aDimId];
+
+         myPoints->SetPoint(aPointId, aCoords);
+       }
+      }
+      
+      myIsVTKDone = true;
+    }
+    
+    return myPoints.GetPointer();
+  }
+
+  unsigned long int
+  TPointCoords
+  ::GetMemorySize()
+  {
+    size_t aSize = myCoord->GetMemorySize();
+    aSize += myPoints->GetActualMemorySize() * 1024;
+    return aSize;
+  }
+
+
+  //---------------------------------------------------------------
+  void
+  TNamedPointCoords
+  ::Init(const PCoordHolder& theCoord)
+  {
+    TPointCoords::Init(theCoord);
+    myPointsDim.resize(theCoord->GetDim());
+  }
+
+  std::string&
+  TNamedPointCoords
+  ::GetName(vtkIdType theDim)
+  {
+    return myPointsDim[theDim];
+  }
+
+  const std::string&
+  TNamedPointCoords
+  ::GetName(vtkIdType theDim) const
+  {
+    return myPointsDim[theDim];
+  }
+
+  vtkIdType
+  TNamedPointCoords
+  ::GetObjID(vtkIdType theID) const
+  {
+    return theID;
+  }
+
+  vtkIdType
+  TNamedPointCoords
+  ::GetVTKID(vtkIdType theID) const
+  {
+    return theID;
+  }
+
+  std::string 
+  TNamedPointCoords
+  ::GetNodeName(vtkIdType theObjID) const
+  {
+    return "";
+  }
+
+
+  //---------------------------------------------------------------
+  enum ECoordName{eX, eY, eZ, eNoneCoord};
+  typedef VISU::TCoord (*TGetCoord)(const VISU::TCCoordSlice& theCoordSlice);
+  
+  template<ECoordName TCoordId>
+  VISU::TCoord 
+  GetCoord(const VISU::TCCoordSlice& theCoordSlice)
+  {
+    return theCoordSlice[TCoordId];
+  }
+  
+  template<>
+  VISU::TCoord 
+  GetCoord<eNoneCoord>(const VISU::TCCoordSlice& theCoordSlice)
+  {
+    return 0.0;
+  }
+  
+  
+  TGetCoord aXYZGetCoord[3] = {
+    &GetCoord<eX>, 
+    &GetCoord<eY>, 
+    &GetCoord<eZ>
+  };
+  
+  
+  TGetCoord aXYGetCoord[3] = {
+    &GetCoord<eX>, 
+    &GetCoord<eY>, 
+    &GetCoord<eNoneCoord>
+  };
+  
+  TGetCoord aYZGetCoord[3] = {
+    &GetCoord<eNoneCoord>,
+    &GetCoord<eX>, 
+    &GetCoord<eY>
+  };
+  
+  TGetCoord aXZGetCoord[3] = {
+    &GetCoord<eX>, 
+    &GetCoord<eNoneCoord>,
+    &GetCoord<eY>
+  };
+  
+  
+  TGetCoord aXGetCoord[3] = {
+    &GetCoord<eX>, 
+    &GetCoord<eNoneCoord>,
+    &GetCoord<eNoneCoord>
+  };
+  
+  TGetCoord aYGetCoord[3] = {
+    &GetCoord<eNoneCoord>,
+    &GetCoord<eX>, 
+    &GetCoord<eNoneCoord>
+  };
+
+  TGetCoord aZGetCoord[3] = {
+    &GetCoord<eNoneCoord>,
+    &GetCoord<eNoneCoord>,
+    &GetCoord<eX>
+  };
+
+  
+  class TCoordHelper{
+    TGetCoord* myGetCoord;
+  public:
+    TCoordHelper(TGetCoord* theGetCoord):
+      myGetCoord(theGetCoord)
+    {}
+
+    virtual
+    ~TCoordHelper()
+    {}
+
+    VISU::TCoord 
+    GetCoord(VISU::TCCoordSlice& theCoordSlice, 
+            int theCoordId)
+    {
+      return (*myGetCoord[theCoordId])(theCoordSlice);
+    }
+  };
+  typedef std::auto_ptr<TCoordHelper> TCoordHelperPtr;
+  
+
+  //---------------------------------------------------------------
+  vtkPoints*
+  TNamedPointCoords
+  ::GetPoints() const
+  { 
+    if(!myIsVTKDone){
+      TTimerLog aTimerLog(MYDEBUG,"TNamedPointCoords::GetPoints()");
+      TCoordHelperPtr aCoordHelperPtr;
+      bool anIsDimPresent[3] = {false, false, false};
+      for(int iDim = 0; iDim < GetDim(); iDim++){
+       std::string aName = GetName(iDim);
+       if ( aName.size() > 1 ) // PAL13021 (PAL12148), aName has size 8 or 16
+         aName = aName.substr(0,1);
+       if(aName == "x" || aName == "X")
+         anIsDimPresent[eX] = true;
+       else if(aName == "y" || aName == "Y")
+         anIsDimPresent[eY] = true;
+       else if(aName == "z" || aName == "Z")
+         anIsDimPresent[eZ] = true;
+      }
+      
+      switch(GetDim()){
+      case 3:
+       aCoordHelperPtr.reset(new TCoordHelper(aXYZGetCoord));
+       break;
+      case 2:
+       if(anIsDimPresent[eY] && anIsDimPresent[eZ])
+         aCoordHelperPtr.reset(new TCoordHelper(aYZGetCoord));
+       else if(anIsDimPresent[eX] && anIsDimPresent[eZ])
+         aCoordHelperPtr.reset(new TCoordHelper(aXZGetCoord));
+       else
+         aCoordHelperPtr.reset(new TCoordHelper(aXYGetCoord));
+       break;
+      case 1:
+       if(anIsDimPresent[eY])
+         aCoordHelperPtr.reset(new TCoordHelper(aYGetCoord));
+       else if(anIsDimPresent[eZ])
+         aCoordHelperPtr.reset(new TCoordHelper(aZGetCoord));
+       else
+         aCoordHelperPtr.reset(new TCoordHelper(aXGetCoord));
+       break;
+      }
+      
+      INITMSG(MYDEBUG,"TNamedPointCoords::GetPoints - aNbPoints = "<<GetNbPoints()<<
+             "; aDim = "<<GetDim()<<
+             endl);
+      
+      if(anIsDimPresent[eX] && anIsDimPresent[eY] && anIsDimPresent[eZ]){
+       INITMSG(MYDEBUG,"TNamedPointCoords::GetPoints - SetVoidArray()"<<endl);
+       SetVoidArray();
+      }else{
+       for(vtkIdType aNodeId = 0; aNodeId < GetNbPoints(); aNodeId++){ 
+         TCCoordSlice aCoordSlice = GetCoordSlice(aNodeId);
+         myPoints->SetPoint(aNodeId,
+                            aCoordHelperPtr->GetCoord(aCoordSlice,eX),
+                            aCoordHelperPtr->GetCoord(aCoordSlice,eY),
+                            aCoordHelperPtr->GetCoord(aCoordSlice,eZ));
+       }
+      }
+      
+      myIsVTKDone = true;
+    }
+    
+    return myPoints.GetPointer();
+  }
+
+  unsigned long int
+  TNamedPointCoords
+  ::GetMemorySize()
+  {
+    return TPointCoords::GetMemorySize();
+  }
+
+
+  //---------------------------------------------------------------
+}
diff --git a/src/CONVERTOR/VISU_PointCoords.hxx b/src/CONVERTOR/VISU_PointCoords.hxx
new file mode 100644 (file)
index 0000000..1ef6877
--- /dev/null
@@ -0,0 +1,258 @@
+//  VISU CONVERTOR :
+//
+//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
+// 
+//  This library is free software; you can redistribute it and/or 
+//  modify it under the terms of the GNU Lesser General Public 
+//  License as published by the Free Software Foundation; either 
+//  version 2.1 of the License. 
+// 
+//  This library is distributed in the hope that it will be useful, 
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of 
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
+//  Lesser General Public License for more details. 
+// 
+//  You should have received a copy of the GNU Lesser General Public 
+//  License along with this library; if not, write to the Free Software 
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
+// 
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+//
+//  File   : VISU_Convertor.hxx
+//  Author : Alexey PETROV
+//  Module : VISU
+
+#ifndef VISU_PointCoords_HeaderFile
+#define VISU_PointCoords_HeaderFile
+
+/*! 
+  \file VISU_PointCoords.hxx
+  \brief The file contains declarations for basic interfaces that defines point coords of mesh elements
+*/
+
+#include "VISU_Convertor.hxx"
+#include "VISU_ConvertorDef_impl.hxx"
+
+#include "MED_SliceArray.hxx"
+#include "MED_Structures.hxx"
+
+#include <vtkSmartPointer.h>
+
+class vtkPoints;
+
+namespace VISU
+{
+  //---------------------------------------------------------------
+  typedef vtkSmartPointer<vtkPoints> PPoints;
+
+  typedef MED::TFloat TCoord;
+  using MED::TCoordSlice;
+  using MED::TCCoordSlice;
+
+  //---------------------------------------------------------------
+  //! This class is responsible for keeping the mesh node coordinates
+  class TCoordHolderBase: public virtual TBaseStructure
+  {
+  public:
+    //! To initilize the instance
+    void
+    Init(vtkIdType theNbPoints,
+        vtkIdType theDim);
+
+    vtkIdType
+    GetNbPoints() const;
+
+    vtkIdType
+    GetDim() const;
+
+    size_t
+    size() const;
+
+    //! Gets memory size used by the instance (bytes).
+    virtual
+    unsigned long int
+    GetMemorySize();
+
+    //! Get slice of coordinates for defined node (const version)
+    virtual
+    TCCoordSlice
+    GetCoordSlice(vtkIdType theNodeId) const = 0;
+
+    //! Get slice of coordinates for defined node
+    virtual
+    TCoordSlice 
+    GetCoordSlice(vtkIdType theNodeId) = 0;
+
+    virtual
+    unsigned char*
+    GetValuePtr() = 0;
+
+  protected:
+    vtkIdType myDim; //!< Dimension of the nodal coordinates
+    vtkIdType myNbPoints; //!< Number of nodes in corresponding mesh
+  };
+  typedef MED::SharedPtr<TCoordHolderBase> PCoordHolder;
+
+
+  //---------------------------------------------------------------
+  template<class TContainerType>
+  class TCoordHolder: public virtual TCoordHolderBase
+  {
+  public:
+    //! To initilize the class instance
+    void
+    Init(vtkIdType theNbPoints,
+        vtkIdType theDim,
+        const TContainerType& theCoord)
+    {
+      TCoordHolderBase::Init(theNbPoints, theDim);
+      myCoord = theCoord;
+    }
+
+    //! Gets pointer to the first element in the node coordinates array
+    virtual
+    TCoord*
+    GetPointer() = 0;
+
+    //! Gets pointer to the first element in the node coordinates array (const version)
+    virtual
+    const TCoord*
+    GetPointer() const = 0;
+
+    //! Get slice of coordinates for defined node (const version)
+    virtual
+    TCCoordSlice
+    GetCoordSlice(vtkIdType theNodeId) const
+    {
+      return TCCoordSlice(this->GetPointer(), 
+                         this->size(),
+                         std::slice(theNodeId * this->GetDim(), this->GetDim(), 1));
+    }
+
+    //! Get slice of coordinates for defined node
+    virtual
+    TCoordSlice 
+    GetCoordSlice(vtkIdType theNodeId)
+    {
+      return TCoordSlice(this->GetPointer(), 
+                        this->size(),
+                        std::slice(theNodeId * this->GetDim(), this->GetDim(), 1));
+    }
+
+    virtual
+    unsigned char*
+    GetValuePtr()
+    {
+      return (unsigned char*)this->GetPointer();
+    }
+
+  protected:
+    mutable TContainerType myCoord; //!< Keeps the node coordinates container itself
+  };
+
+
+  //---------------------------------------------------------------
+  //! This class is responsible for representation of mesh nodes
+  class TPointCoords: public virtual TIsVTKDone
+  {
+  public:
+    TPointCoords();
+
+    //! To initilize the class
+    void
+    Init(const PCoordHolder& theCoord);
+
+    vtkIdType
+    GetNbPoints() const;
+
+    vtkIdType
+    GetDim() const;
+
+    virtual
+    vtkPoints*
+    GetPoints() const; //!< Gets corresponding VTK structure
+
+    //! Gets memory size used by the instance (bytes).
+    virtual
+    unsigned long int
+    GetMemorySize();
+
+    //! 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);
+
+  protected:
+    //! 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)
+    */
+    PCoordHolder myCoord; //!< A pointer to the coordinates container holder
+    PPoints myPoints; //!< VTK representation for the mesh nodes
+
+    void
+    SetVoidArray() const; //!< Passes the MED node coordinates data directly to VTK
+  };
+
+
+  //---------------------------------------------------------------
+  //! 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
+  {
+  public:
+    //! To initilize the class (numeration of the nodes can be missed)
+    void
+    Init(const PCoordHolder& theCoord);
+    
+    //! 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;
+
+    virtual
+    vtkPoints*
+    GetPoints() const; //!< Gets initialized corresponding VTK structure
+
+    //! Gets memory size used by the instance (bytes).
+    virtual
+    unsigned long int
+    GetMemorySize();
+
+  protected:
+    typedef TVector<std::string> TPointsDim;
+    TPointsDim myPointsDim; //!< Keeps name of each dimension
+  };
+
+
+  //---------------------------------------------------------------
+}
+
+#endif
diff --git a/src/CONVERTOR/VISU_Structures.cxx b/src/CONVERTOR/VISU_Structures.cxx
new file mode 100644 (file)
index 0000000..69386ff
--- /dev/null
@@ -0,0 +1,85 @@
+//  
+//
+//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
+// 
+//  This library is free software; you can redistribute it and/or 
+//  modify it under the terms of the GNU Lesser General Public 
+//  License as published by the Free Software Foundation; either 
+//  version 2.1 of the License. 
+// 
+//  This library is distributed in the hope that it will be useful, 
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of 
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
+//  Lesser General Public License for more details. 
+// 
+//  You should have received a copy of the GNU Lesser General Public 
+//  License along with this library; if not, write to the Free Software 
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
+// 
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+//
+//  File:    
+//  Author:  Alexey PETROV
+//  Module : VISU
+
+#include "VISU_Structures.hxx"
+
+
+namespace VISU
+{
+  //---------------------------------------------------------------
+  TIntId
+  ::TIntId(): 
+    myId(0)
+  {}
+  
+  
+  //---------------------------------------------------------------
+  TIsVTKDone
+  ::TIsVTKDone(): 
+    myIsVTKDone(false),
+    myIsDone(false)
+  {}
+  
+  
+  //---------------------------------------------------------------
+  TMesh
+  ::TMesh(): 
+    myDim(0)
+  {}
+  
+  
+  //---------------------------------------------------------------
+  TMeshOnEntity
+  ::TMeshOnEntity():
+    myEntity(TEntity(-1))
+  {}
+  
+  
+  //---------------------------------------------------------------
+  TFamily
+  ::TFamily():
+    myEntity(TEntity(-1))
+  {}
+  
+  
+  //---------------------------------------------------------------
+  TField
+  ::TField(): 
+    myNbComp(0),
+    myEntity(TEntity(-1)),
+    myIsMinMaxInitilized(false)
+  {}
+  
+  
+  //---------------------------------------------------------------
+  
+  // MULTIPR
+  TPart
+  ::TPart(): 
+    myCurrentRes(0)
+  {}
+  
+}
diff --git a/src/CONVERTOR/VISU_Structures.hxx b/src/CONVERTOR/VISU_Structures.hxx
new file mode 100644 (file)
index 0000000..ed7bbf5
--- /dev/null
@@ -0,0 +1,254 @@
+//  
+//
+//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
+// 
+//  This library is free software; you can redistribute it and/or 
+//  modify it under the terms of the GNU Lesser General Public 
+//  License as published by the Free Software Foundation; either 
+//  version 2.1 of the License. 
+// 
+//  This library is distributed in the hope that it will be useful, 
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of 
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
+//  Lesser General Public License for more details. 
+// 
+//  You should have received a copy of the GNU Lesser General Public 
+//  License along with this library; if not, write to the Free Software 
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
+// 
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+//
+//  File   : 
+//  Author : Alexey PETROV
+//  Module : VISU
+
+#ifndef VISU_Structures_HeaderFile
+#define VISU_Structures_HeaderFile
+
+/*! 
+  \file VISU_Structures.hxx
+  \brief The file contains definitions for basic classes of the VISU CONVERTER package
+*/
+
+#include "VISU_IDMapper.hxx"
+#include "VISU_ConvertorDef.hxx"
+
+#include "MED_Vector.hxx"
+
+#include <map>
+#include <set>
+#include <string>
+#include <stdexcept>
+
+namespace VISU
+{
+  using MED::TVector;
+
+  //---------------------------------------------------------------
+  typedef std::string TName;
+  typedef TVector<TName> TNames;
+
+  //---------------------------------------------------------------
+  //! Define a basic class for all MED entites which can be identified by its number
+  struct TIntId: virtual TBaseStructure
+  {
+    vtkIdType myId;
+
+    TIntId();
+  };
+
+
+  //---------------------------------------------------------------
+  //! Define an utility base class which is repsonsible for preventing repetion
+  struct TIsVTKDone: virtual TBaseStructure
+  {
+    mutable bool myIsDone; //!< Say, is the corresponding MED entity already loaded into intermediate data structure 
+    mutable bool myIsVTKDone; //!< Say, is the corresponding intermediate data structure already mapped into VTK representation  
+
+    TIsVTKDone();
+  };
+
+  
+  //---------------------------------------------------------------
+  typedef std::map<TEntity, PMeshOnEntity> TMeshOnEntityMap;
+  typedef std::map<TName, PGroup> TGroupMap;
+
+  //! Define a basic class which corresponds to MED MESH entity
+  /*!
+    This class in its turn contains map of TMeshOnEntity and TGroup substructures,
+    also it keeps name and dimention of corresponding MED MESH entity.
+  */
+  struct TMesh: virtual TBaseStructure
+  {
+    TMeshOnEntityMap myMeshOnEntityMap; //!< Contains corresponding meshes for MED ENTITIES
+    TGroupMap myGroupMap; //!< Contains map of bounded MED GROUPS
+    TName myName; //! Name of the corresponding MED MESH
+    vtkIdType myDim; //! Dimension of the corresponding MED MESH
+
+    std::string myGroupsEntry; //!< To simplify publication of the groups in a data tree
+    std::string myFieldsEntry; //!< To simplify publication of the fiels in a data tree
+       
+       // MULTIPR
+       std::string myPartsEntry; //!< To simplify publication of the parts in a data tree
+
+    TMesh();
+  };
+  typedef std::map<std::string, PMesh> TMeshMap;
+
+
+  //---------------------------------------------------------------
+  //! Define a basic class which corresponds to MED PROFILE entity
+  struct TSubProfile: virtual TBaseStructure
+  {};
+
+
+  //---------------------------------------------------------------
+  //! Define a containerfor MED PROFILE entities which belongs to the same MED ENTITY
+  struct TProfile: virtual TNamedIDMapper
+  {};
+
+
+  //---------------------------------------------------------------
+  bool
+  operator<(const PSubProfile& theLeft, const PSubProfile& theRight);
+
+  typedef std::set<PSubProfile> TProfileKey;
+  typedef std::map<TProfileKey, PProfile> TProfileMap;
+
+
+  //---------------------------------------------------------------
+  //! Define a basic class for MED GAUSS entity
+  struct TGauss: virtual TBaseStructure
+  {};
+
+
+  //---------------------------------------------------------------
+  //! Define a container for mesh generated from MED GAUSS and corresponding MED PROFILE
+  struct TGaussSubMesh: virtual TBaseStructure
+  {
+    PSubProfile mySubProfile; //!< Keeps reference on what submesh the Gauss Points are located
+  };
+
+  
+  //---------------------------------------------------------------
+  //! Define a container for all TGaussSubMesh that belongs to the same MED ENTITY
+  struct TGaussMesh: virtual TGaussPtsIDMapper
+  {};
+
+
+  //---------------------------------------------------------------
+  bool
+  operator<(const PGaussSubMesh& theLeft, const PGaussSubMesh& theRight);
+
+  typedef std::set<PGaussSubMesh> TGaussKey;
+  typedef std::map<TGaussKey, PGaussMesh> TGaussMeshMap;
+
+
+  //---------------------------------------------------------------
+
+  typedef std::map<TName, PFamily> TFamilyMap;
+  typedef std::map<TName, PField> TFieldMap;
+
+  //! Define a basic class which corresponds to MED ENTITY
+  /*!
+    This class in its turn contains map of TGaussMesh and TProfile substructures,
+    also it keeps corresponding map of MED FAMILIES and FIELDS.
+  */
+  struct TMeshOnEntity: virtual TNamedIDMapper
+  {
+    TGaussMeshMap myGaussMeshMap; //!< Contains map of Gauss mesh which exist on it
+    TProfileMap myProfileMap; //!< Contains map of Profile mesh which exist on it
+
+    TFamilyMap myFamilyMap; //!< Contains map of MED FAMILIES which belongs to it
+    TFieldMap myFieldMap; //!< Contains map of MED FIELDS which belongs to it
+
+    TName myMeshName; //!< Contains name of the MED MESH where the it belongs to.
+    TEntity myEntity; //!< Referes to MED ENTITY where the it belongs to.
+
+    TMeshOnEntity();
+  };
+
+
+  //---------------------------------------------------------------
+  //! Define a basic class for MED FAMILY entity
+  struct TFamily: virtual TIntId,
+                 virtual TUnstructuredGridIDMapper
+  {
+    TEntity myEntity; //!< Referes to MED ENTITY where the TFamily belongs to.
+    TName myName; //!< Contains name of the corresponding MED FAMILY
+
+    TFamily();
+  };
+
+
+  //---------------------------------------------------------------
+  typedef std::set<PFamily> TFamilySet;
+
+  //! Define a basic class for MED GROUP entity
+  struct TGroup: virtual TUnstructuredGridIDMapper
+  {
+    TFamilySet myFamilySet;
+  };
+
+
+  //---------------------------------------------------------------
+  typedef std::map<vtkIdType, PValForTime> TValField;
+  typedef std::pair<vtkFloatingPointType, vtkFloatingPointType> TMinMax;
+
+  //! Define a basic class for MED FIELD entity
+  struct TField: virtual TIntId
+  {
+    TEntity myEntity; //!< Referes to MED ENTITY where it belongs to.
+    TName myName; //!< Contains name of the corresponding MED FIELD
+    TName myMeshName; //!< Contains name of the MED MESH where it belongs to.
+    TValField myValField; //!< Contains sequence of values for corresponding MED TIMESTAMPS
+    TNames myCompNames; //!< Contains names of components of the MED FIELD
+    TNames myUnitNames; //!< Contains names of units of the MED FIELD
+    vtkIdType myNbComp; //!< Keeps number of components for the MED FIELD
+
+    //! Calculate min/max values for each of the MED FIELD components among all its timestamps
+    /*!
+      Numeration of the components starts from 1.
+      Zero component contains min/max value for modulus of corresponding vector
+    */
+    virtual
+    TMinMax 
+    GetMinMax(vtkIdType theCompID) = 0;
+    
+    bool myIsMinMaxInitilized; //!< Is the min / max values are calculated
+
+    TField();
+  };
+  
+  // MULTIPR
+  struct TPart: virtual TIntId
+  {
+    vtkIdType myCurrentRes; //!< Keeps current resolution fot this part
+
+    TPart();
+  };
+
+  //---------------------------------------------------------------
+  typedef std::pair<double, std::string> TTime;
+
+  //! Define a basic class for MED TIMESTAMP entity
+  struct TValForTime: virtual TIntId
+  {
+    TEntity myEntity; //!< Referes to MED ENTITY where it belongs to.
+    TName myMeshName; //!< Contains name of the MED MESH where it belongs to.
+    TName myFieldName; //!< Contains name of the MED FIELD where it belongs to.
+    TTime myTime;
+
+    PProfile myProfile; //!< Contains corresponding MED PROFILE where the MED TIEMSTMAP attached to
+    PGaussMesh myGaussMesh;
+  };
+
+  //---------------------------------------------------------------
+}
+
+
+#endif
diff --git a/src/CONVERTOR/VISU_Structures_impl.cxx b/src/CONVERTOR/VISU_Structures_impl.cxx
new file mode 100644 (file)
index 0000000..100bcf1
--- /dev/null
@@ -0,0 +1,1149 @@
+//  
+//
+//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
+// 
+//  This library is free software; you can redistribute it and/or 
+//  modify it under the terms of the GNU Lesser General Public 
+//  License as published by the Free Software Foundation; either 
+//  version 2.1 of the License. 
+// 
+//  This library is distributed in the hope that it will be useful, 
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of 
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
+//  Lesser General Public License for more details. 
+// 
+//  You should have received a copy of the GNU Lesser General Public 
+//  License along with this library; if not, write to the Free Software 
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
+// 
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+//
+//  File:    
+//  Author:  Alexey PETROV
+//  Module : VISU
+
+#include "VISU_Structures_impl.hxx"
+#include "VISU_PointCoords.hxx"
+#include "VISU_MeshValue.hxx"
+
+#include "VTKViewer_AppendFilter.h"
+#include "VISU_AppendPolyData.hxx"
+#include "VISU_MergeFilter.hxx"
+
+#include <vtkUnstructuredGrid.h>
+#include <vtkPolyData.h>
+#include <vtkCellType.h>
+
+namespace VISU
+{
+  //---------------------------------------------------------------
+  /*! Computes number of points by the given number of cells
+   *  in assumption of regular hexahedral mesh structure
+   */
+  size_t
+  GetNumberOfPoints(size_t theNbCells)
+  {
+    return size_t(pow(pow(theNbCells, 1.0/3.0) + 1.0, 3.0));
+  }
+
+  //---------------------------------------------------------------
+  /*! Computes size dataset the given number of mesh macro metrics
+   *  in assumption of regular hexahedral mesh structure
+   */
+  size_t
+  GetDataSetSize(size_t theNbOfPoints,
+                size_t theNbOfCells,
+                size_t theCellsSize,
+                bool theComputeLinks)
+  {
+    size_t aPointsSize = 3*theNbOfPoints*sizeof(VISU::TCoord);
+    size_t aConnectivityAndTypesSize = theCellsSize*sizeof(vtkIdType);
+    size_t aLocationsSize = theNbOfCells*sizeof(int);
+    vtkFloatingPointType aNbCellsPerPoint = theCellsSize / theNbOfCells - 1;
+    size_t aLinksSize = theNbOfPoints * (vtkIdType(sizeof(vtkIdType)*aNbCellsPerPoint) + sizeof(short));
+    if(!theComputeLinks)
+      aLinksSize = 0;
+    size_t aResult = aPointsSize + aConnectivityAndTypesSize + aLocationsSize + aLinksSize;
+    return aResult;
+  }
+
+  //---------------------------------------------------------------
+  TSizeCounter
+  ::TSizeCounter():
+    myNbCells(0),
+    myCellsSize(0)
+  {}
+
+
+  //---------------------------------------------------------------
+  TPolyDataHolder
+  ::TPolyDataHolder()
+  {}
+
+  const PPolyData& 
+  TPolyDataHolder
+  ::GetSource() const
+  {
+    if(!mySource.GetPointer()){
+      mySource = vtkPolyData::New();
+      mySource->Delete();
+    }
+    return mySource;
+  }
+
+  vtkPolyData* 
+  TPolyDataHolder
+  ::GetPolyDataOutput()
+  {
+    return GetSource().GetPointer();
+  }
+
+  unsigned long int
+  TPolyDataHolder
+  ::GetMemorySize()
+  {
+    if(vtkDataSet* anOutput = GetPolyDataOutput()){
+      anOutput->Update();
+      return anOutput->GetActualMemorySize() * 1024;
+    }
+    if(myIsDone){
+      size_t aNbPoints = GetNumberOfPoints(myNbCells);
+      return GetDataSetSize(aNbPoints, myNbCells, myCellsSize, false);
+    }
+    throw std::runtime_error("TUnstructuredGridHolder::GetMemorySize - myIsDone == false !!!");
+    return 0;
+  }
+
+  //---------------------------------------------------------------
+  TUnstructuredGridHolder
+  ::TUnstructuredGridHolder()
+  {}
+
+  const PUnstructuredGrid& 
+  TUnstructuredGridHolder
+  ::GetSource() const
+  {
+    if(!mySource.GetPointer()){
+      mySource = vtkUnstructuredGrid::New();
+      mySource->Delete();
+    }
+    return mySource;
+  }
+
+  vtkUnstructuredGrid* 
+  TUnstructuredGridHolder
+  ::GetUnstructuredGridOutput()
+  {
+    return GetSource().GetPointer();
+  }
+
+  unsigned long int
+  TUnstructuredGridHolder
+  ::GetMemorySize()
+  {
+    if(vtkDataSet* anOutput = GetUnstructuredGridOutput()){
+      anOutput->Update();
+      return anOutput->GetActualMemorySize() * 1024;
+    }
+    if(myIsDone){
+      size_t aNbPoints = GetNumberOfPoints(myNbCells);
+      return GetDataSetSize(aNbPoints, myNbCells, myCellsSize, false);
+    }
+    throw std::runtime_error("TUnstructuredGridHolder::GetMemorySize - myIsDone == false !!!");
+    return 0;
+  }
+
+
+  //---------------------------------------------------------------
+  unsigned long int
+  TMemoryCheckIDMapper
+  ::GetMemorySize()
+  {
+    if(myIsVTKDone){
+      if(vtkDataSet* anOutput = GetOutput()){
+       anOutput->Update();
+       return anOutput->GetActualMemorySize() * 1024;
+      }
+    }
+    throw std::runtime_error("TMemoryCheckIDMapper::GetMemorySize - myIsVTKDone == false !!!");
+    return 0;
+  }
+
+
+  //---------------------------------------------------------------
+  TAppendFilterHolder
+  ::TAppendFilterHolder()
+  {}
+
+  const PAppendFilter& 
+  TAppendFilterHolder
+  ::GetFilter() const
+  {
+    if(!myFilter.GetPointer()){
+      myFilter = VTKViewer_AppendFilter::New();
+      myFilter->Delete();
+      myFilter->SetDoMappingFlag(true);
+    }
+    return myFilter;
+  }
+
+  vtkUnstructuredGrid* 
+  TAppendFilterHolder
+  ::GetUnstructuredGridOutput()
+  {
+    GetFilter()->Update();
+    return GetFilter()->GetOutput();
+  }
+
+  //---------------------------------------------------------------
+  TAppendPolyDataHolder
+  ::TAppendPolyDataHolder()
+  {}
+
+  const PAppendPolyData& 
+  TAppendPolyDataHolder
+  ::GetFilter() const
+  {
+    if(!myFilter.GetPointer()){
+      myFilter = VISU_AppendPolyData::New();
+      myFilter->Delete();
+      myFilter->SetDoMappingFlag(true);
+    }
+    return myFilter;
+  }
+
+  vtkPolyData* 
+  TAppendPolyDataHolder
+  ::GetPolyDataOutput()
+  {
+    GetFilter()->Update();
+    return GetFilter()->GetOutput();
+  }
+
+
+  //---------------------------------------------------------------
+  TMergeFilterHolder
+  ::TMergeFilterHolder()
+  {}
+
+  const PMergeFilter& 
+  TMergeFilterHolder
+  ::GetFilter() const
+  {
+    if(!myFilter.GetPointer()){
+      myFilter = VISU_MergeFilter::New();
+      myFilter->Delete();
+    }
+    return myFilter;
+  }
+
+  vtkDataSet* 
+  TMergeFilterHolder
+  ::GetOutput()
+  {
+    GetFilter()->Update();
+    return GetFilter()->GetOutput();
+  }
+
+
+  //---------------------------------------------------------------
+  TMeshImpl
+  ::TMeshImpl(): 
+    myNbPoints(0)
+  {}
+
+  vtkIdType
+  TMeshImpl::
+  GetNbPoints() const
+  {
+    return myNbPoints;
+  }
+  
+  vtkIdType
+  TMeshImpl::
+  GetDim() const
+  {
+    return myDim;
+  }
+  
+  vtkPoints*
+  TMeshImpl::
+  GetPoints()
+  {
+    return myNamedPointCoords->GetPoints();
+  }
+
+
+  //---------------------------------------------------------------
+  TSubProfileImpl::TSubProfileImpl():
+    myStatus(eNone),
+    myGeom(eNONE)
+  {}
+
+
+  vtkIdType
+  TSubProfileImpl
+  ::GetElemObjID(vtkIdType theID) const
+  {
+    return theID;
+  }
+
+  unsigned long int
+  TSubProfileImpl
+  ::GetMemorySize()
+  {
+    size_t aSize = TUnstructuredGridHolder::GetMemorySize();
+    aSize += sizeof(vtkIdType) * mySubMeshID.size();
+    return aSize;
+  }
+
+
+  //---------------------------------------------------------------
+  bool
+  operator<(const PSubProfile& theLeft, const PSubProfile& theRight)
+  {
+    PSubProfileImpl aLeft(theLeft), aRight(theRight);
+
+    if(aLeft->myGeom != aRight->myGeom)
+      return aLeft->myGeom < aRight->myGeom;
+
+    if(aLeft->myStatus != aRight->myStatus)
+      return aLeft->myStatus < aRight->myStatus;
+
+    return aLeft->myName < aRight->myName;
+  }
+
+
+  //---------------------------------------------------------------
+  TProfileImpl
+  ::TProfileImpl():
+    myIsAll(true),
+    myMeshOnEntity(NULL)
+  {}
+
+  vtkIdType
+  TProfileImpl
+  ::GetNodeObjID(vtkIdType theID) const
+  {
+    return myNamedPointCoords->GetObjID(theID);
+  }
+  
+  vtkIdType
+  TProfileImpl
+  ::GetNodeVTKID(vtkIdType theID) const
+  {
+    return myNamedPointCoords->GetVTKID(theID);
+  }
+
+  vtkFloatingPointType*  
+  TProfileImpl
+  ::GetNodeCoord(vtkIdType theObjID)
+  {
+    if(myIsAll)
+      return myMeshOnEntity->GetNodeCoord(theObjID);
+
+    vtkIdType aVtkID = GetNodeVTKID(theObjID);
+    return GetFilter()->GetOutput()->GetPoint(aVtkID);
+  }
+
+  vtkIdType
+  TProfileImpl
+  ::GetElemObjID(vtkIdType theID) const
+  {
+    if(myIsAll)
+      return myMeshOnEntity->GetElemObjID(theID);
+
+    vtkIdType anInputID, aStartID, anInputDataSetID;
+    const PAppendFilter& anAppendFilter = GetFilter();
+    anAppendFilter->GetCellInputID(theID,anInputID,aStartID,anInputDataSetID);
+    PSubProfileImpl aSubProfileImpl = mySubProfileArr[anInputDataSetID];
+    return aSubProfileImpl->GetElemObjID(anInputID);
+  }
+
+  vtkIdType
+  TProfileImpl
+  ::GetElemVTKID(vtkIdType theID) const
+  {
+    if(myIsAll)
+      return myMeshOnEntity->GetElemVTKID(theID);
+
+    if(myElemObj2VTKID.empty())
+      return theID;
+    else{
+      TID2ID::const_iterator anIter = myElemObj2VTKID.find(theID);
+      if(anIter != myElemObj2VTKID.end())
+       return anIter->second;
+    }
+    return -1;
+  }
+
+  vtkCell* 
+  TProfileImpl
+  ::GetElemCell(vtkIdType theObjID)
+  {
+    if(myIsAll)
+      return myMeshOnEntity->GetElemCell(theObjID);
+
+    vtkIdType aVtkID = GetElemVTKID(theObjID);
+    return GetFilter()->GetOutput()->GetCell(aVtkID);
+  }
+  
+  vtkUnstructuredGrid* 
+  TProfileImpl
+  ::GetUnstructuredGridOutput()
+  {
+    const PAppendFilter& anAppendFilter = GetFilter();
+    return anAppendFilter->GetOutput();
+  }
+
+  unsigned long int
+  TProfileImpl
+  ::GetMemorySize()
+  {
+    size_t aSize = TAppendFilterHolder::GetMemorySize();
+    aSize += myNamedPointCoords->GetMemorySize();
+    aSize += myElemObj2VTKID.size() * 2 * sizeof(vtkIdType);
+    TGeom2SubProfile::const_iterator anIter = myGeom2SubProfile.begin();
+    TGeom2SubProfile::const_iterator anIterEnd = myGeom2SubProfile.end();
+    for(; anIter != anIterEnd; anIter++){
+      const PSubProfileImpl& aSubProfile = anIter->second;
+      aSize += aSubProfile->GetMemorySize();
+      aSize += sizeof(EGeometry);
+    }
+    return aSize;
+  }
+
+  std::string 
+  TProfileImpl
+  ::GetNodeName(vtkIdType theObjID) const
+  {
+    return myNamedPointCoords->GetNodeName(theObjID);
+  }
+
+  std::string 
+  TProfileImpl
+  ::GetElemName(vtkIdType theObjID) const
+  {
+    if(myIsAll)
+      return myMeshOnEntity->GetElemName(theObjID);
+
+    vtkIdType aVTKId = GetElemVTKID(theObjID);
+    vtkIdType anInputID, aStartID, anInputDataSetID;
+    const PAppendFilter& anAppendFilter = GetFilter();
+    anAppendFilter->GetCellInputID(aVTKId,anInputID,aStartID,anInputDataSetID);
+    PSubProfileImpl aSubProfileImpl = mySubProfileArr[anInputDataSetID];
+    vtkIdType anEntityObjId = aSubProfileImpl->GetElemObjID(anInputID);
+    return myMeshOnEntity->GetElemName(anEntityObjId);
+  }
+
+
+  //---------------------------------------------------------------
+  vtkIdType
+  TUnstructuredGridIDMapperImpl
+  ::GetNodeObjID(vtkIdType theID) const
+  {
+    return myIDMapper->GetNodeObjID(theID);
+  }
+  
+  vtkIdType
+  TUnstructuredGridIDMapperImpl
+  ::GetNodeVTKID(vtkIdType theID) const
+  {
+    return myIDMapper->GetNodeVTKID(theID);
+  }
+
+  vtkFloatingPointType*  
+  TUnstructuredGridIDMapperImpl
+  ::GetNodeCoord(vtkIdType theObjID)
+  {
+    return myIDMapper->GetNodeCoord(theObjID);
+  }
+
+  vtkIdType
+  TUnstructuredGridIDMapperImpl
+  ::GetElemObjID(vtkIdType theID) const
+  {
+    return myIDMapper->GetElemObjID(theID);
+  }
+
+  vtkIdType
+  TUnstructuredGridIDMapperImpl
+  ::GetElemVTKID(vtkIdType theID) const
+  {
+    return myIDMapper->GetElemVTKID(theID);
+  }
+
+  vtkCell* 
+  TUnstructuredGridIDMapperImpl
+  ::GetElemCell(vtkIdType theObjID)
+  {
+    return myIDMapper->GetElemCell(theObjID);
+  }
+  
+  vtkUnstructuredGrid* 
+  TUnstructuredGridIDMapperImpl
+  ::GetUnstructuredGridOutput()
+  {
+    if(!myFilter.GetPointer()){
+      const PAppendFilter& anAppendFilter = myIDMapper->GetFilter();
+      vtkUnstructuredGrid* aGeometry = anAppendFilter->GetOutput();
+      
+      const PUnstructuredGrid& aSource = mySource.GetSource();
+      vtkUnstructuredGrid* aDataSet = aSource.GetPointer();
+      aDataSet->ShallowCopy(aGeometry);
+      
+      const PMergeFilter& aFilter = GetFilter();
+      aFilter->SetGeometry(aGeometry);
+      aFilter->SetScalars(aDataSet);
+      aFilter->SetVectors(aDataSet);
+      aFilter->AddField("VISU_FIELD",aDataSet);
+    }
+    return myFilter->GetUnstructuredGridOutput();
+  }
+
+  vtkDataSet* 
+  TUnstructuredGridIDMapperImpl
+  ::GetOutput()
+  {
+    return GetUnstructuredGridOutput();
+  }
+
+  unsigned long int
+  TUnstructuredGridIDMapperImpl
+  ::GetMemorySize()
+  {
+    size_t aSize = myIDMapper->GetMemorySize();
+    aSize += mySource.GetMemorySize();
+    return aSize;
+  }
+
+
+  //---------------------------------------------------------------
+  vtkIdType
+  TPolyDataIDMapperImpl
+  ::GetNodeObjID(vtkIdType theID) const
+  {
+    return myIDMapper->GetNodeObjID(theID);
+  }
+  
+  vtkIdType
+  TPolyDataIDMapperImpl
+  ::GetNodeVTKID(vtkIdType theID) const
+  {
+    return myIDMapper->GetNodeVTKID(theID);
+  }
+
+  vtkFloatingPointType*  
+  TPolyDataIDMapperImpl
+  ::GetNodeCoord(vtkIdType theObjID)
+  {
+    return myIDMapper->GetNodeCoord(theObjID);
+  }
+
+  vtkIdType
+  TPolyDataIDMapperImpl
+  ::GetElemObjID(vtkIdType theID) const
+  {
+    return myIDMapper->GetElemObjID(theID);
+  }
+
+  vtkIdType
+  TPolyDataIDMapperImpl
+  ::GetElemVTKID(vtkIdType theID) const
+  {
+    return myIDMapper->GetElemVTKID(theID);
+  }
+
+  vtkCell* 
+  TPolyDataIDMapperImpl
+  ::GetElemCell(vtkIdType theObjID)
+  {
+    return myIDMapper->GetElemCell(theObjID);
+  }
+  
+  vtkPolyData* 
+  TPolyDataIDMapperImpl
+  ::GetPolyDataOutput()
+  {
+    if(!myFilter.GetPointer()){
+      const PAppendPolyData& anAppendFilter = myIDMapper->GetFilter();
+      vtkPolyData* aGeometry = anAppendFilter->GetOutput();
+      
+      const PPolyData& aSource = mySource.GetSource();
+      vtkPolyData* aDataSet = aSource.GetPointer();
+      aDataSet->ShallowCopy(aGeometry);
+      
+      const PMergeFilter& aFilter = GetFilter();
+      aFilter->SetGeometry(aGeometry);
+      aFilter->SetScalars(aDataSet);
+      aFilter->SetVectors(aDataSet);
+      aFilter->AddField("VISU_FIELD",aDataSet);
+    }
+    return myFilter->GetPolyDataOutput();
+  }
+
+  vtkDataSet* 
+  TPolyDataIDMapperImpl
+  ::GetOutput()
+  {
+    return GetPolyDataOutput();
+  }
+
+  unsigned long int
+  TPolyDataIDMapperImpl
+  ::GetMemorySize()
+  {
+    size_t aSize = myIDMapper->GetMemorySize();
+    aSize += mySource.GetMemorySize();
+    return aSize;
+  }
+
+
+  //---------------------------------------------------------------
+  TGaussImpl
+  ::TGaussImpl():
+    myGeom(EGeometry(-1)),
+    myNbPoints(0)
+  {}
+  
+  void
+  TGaussImpl
+  ::LessThan(const PGaussImpl& theGauss,
+            bool& theResult) const
+  {
+    theResult = false;
+  }
+
+
+  //---------------------------------------------------------------
+  TGaussSubMeshImpl
+  ::TGaussSubMeshImpl():
+    myPointCoords(new TPointCoords()),
+    myStatus(eNone)
+  {}
+  
+  TGaussPointID
+  TGaussSubMeshImpl
+  ::GetObjID(vtkIdType theID,
+            vtkIdType theStartID) const
+  {
+    TCellID aCellID = theStartID + theID / myGauss->myNbPoints;
+    TLocalPntID aLocalPntID = theID % myGauss->myNbPoints;
+    
+    return TGaussPointID(aCellID,aLocalPntID);
+  }
+
+  unsigned long int
+  TGaussSubMeshImpl
+  ::GetMemorySize()
+  {
+    size_t aSize = TPolyDataHolder::GetMemorySize();
+    aSize += myPointCoords->GetMemorySize();
+    return aSize;
+  }
+
+  //---------------------------------------------------------------
+  bool
+  operator<(const PGaussSubMesh& theLeft, const PGaussSubMesh& theRight)
+  {
+    PGaussSubMeshImpl aLeft(theLeft), aRight(theRight);
+    const PGaussImpl& aGaussLeft = aLeft->myGauss;
+    const PGaussImpl& aGaussRight = aRight->myGauss;
+    
+    if(aGaussLeft->myGeom != aGaussRight->myGeom)
+      return aGaussLeft->myGeom < aGaussRight->myGeom;
+
+    if(aLeft->mySubProfile != aRight->mySubProfile)
+      return aLeft->mySubProfile < aRight->mySubProfile;
+
+    bool aResult;
+    aGaussLeft->LessThan(aGaussRight,aResult);
+
+    return aResult;
+  }
+
+
+  //---------------------------------------------------------------
+  TGaussMeshImpl
+  ::TGaussMeshImpl():
+    myParent(NULL)
+  {}
+
+  TGaussPointID 
+  TGaussMeshImpl
+  ::GetObjID(vtkIdType theID) const
+  {
+    vtkIdType anInputID, aStartId, anInputDataSetID;
+    const PAppendPolyData& aFilter = GetFilter();
+    aFilter->GetCellInputID(theID, anInputID, aStartId, anInputDataSetID);
+    const TGaussSubMeshImpl& aSubMeshImpl = myGaussSubMeshArr[anInputDataSetID];
+
+    return aSubMeshImpl.GetObjID(anInputID,aStartId);
+  }
+
+  vtkPolyData* 
+  TGaussMeshImpl
+  ::GetPolyDataOutput()
+  {
+    return TAppendPolyDataHolder::GetPolyDataOutput();
+  }
+
+  unsigned long int
+  TGaussMeshImpl
+  ::GetMemorySize()
+  {
+    size_t aSize = TAppendPolyDataHolder::GetMemorySize();
+    TGeom2GaussSubMesh::const_iterator anIter = myGeom2GaussSubMesh.begin();
+    TGeom2GaussSubMesh::const_iterator anIterEnd = myGeom2GaussSubMesh.end();
+    for(; anIter != anIterEnd; anIter++){
+      const PGaussSubMeshImpl& aGaussSubMesh = anIter->second;
+      aSize += aGaussSubMesh->GetMemorySize();
+      aSize += sizeof(EGeometry);
+    }
+    return aSize;
+  }
+
+  TNamedIDMapper* 
+  TGaussMeshImpl
+  ::GetParent()
+  {
+    return myParent;
+  }
+
+
+  //---------------------------------------------------------------
+  TGaussPointID 
+  TGaussPtsIDFilter
+  ::GetObjID(vtkIdType theID) const
+  {
+    return myGaussPtsIDMapper->GetObjID(theID);
+  }
+  
+  TNamedIDMapper* 
+  TGaussPtsIDFilter
+  ::GetParent()
+  {
+    return myGaussPtsIDMapper->GetParent();
+  }
+
+  vtkPolyData* 
+  TGaussPtsIDFilter
+  ::GetPolyDataOutput()
+  {
+    return TPolyDataIDMapperImpl::GetPolyDataOutput();
+  }
+
+  vtkDataSet* 
+  TGaussPtsIDFilter
+  ::GetOutput()
+  {
+    return GetPolyDataOutput();
+  }
+
+
+  //---------------------------------------------------------------
+  vtkIdType
+  TSubMeshImpl
+  ::GetElemObjID(vtkIdType theID) const
+  {
+    return myStartID + theID;
+  }
+
+  std::string 
+  TSubMeshImpl
+  ::GetElemName(vtkIdType theObjID) const
+  {
+    return "";
+  }
+
+  unsigned long int
+  TSubMeshImpl
+  ::GetMemorySize()
+  {
+    size_t aSize = TUnstructuredGridHolder::GetMemorySize();
+    for(size_t anId = 0; anId < myCell2Connect.size(); anId++){
+      const TConnect& aConnect = myCell2Connect[anId];
+      aSize += aConnect.size() * sizeof(vtkIdType);
+    }
+    return aSize;
+  }
+
+  //---------------------------------------------------------------
+  vtkIdType
+  TMeshOnEntityImpl
+  ::GetNodeVTKID(vtkIdType theID) const
+  {
+    return myNamedPointCoords->GetVTKID(theID);
+  }
+
+  vtkIdType
+  TMeshOnEntityImpl
+  ::GetNodeObjID(vtkIdType theID) const
+  {
+    return myNamedPointCoords->GetObjID(theID);
+  }
+
+  vtkIdType
+  TMeshOnEntityImpl
+  ::GetElemVTKID(vtkIdType theID) const
+  {
+    if(myElemObj2VTKID.empty())
+      return theID;
+    else{
+      TID2ID::const_iterator anIter = myElemObj2VTKID.find(theID);
+      if(anIter != myElemObj2VTKID.end())
+       return anIter->second;
+    }
+    return -1;
+  }
+
+  vtkIdType
+  TMeshOnEntityImpl
+  ::GetElemObjID(vtkIdType theID) const
+  {
+    vtkIdType anInputID, aStartId, anInputDataSetID;
+    const PAppendFilter& anAppendFilter = GetFilter();
+    anAppendFilter->GetCellInputID(theID,anInputID,aStartId,anInputDataSetID);
+    const PSubMeshImpl& aSubMesh = mySubMeshArr[anInputDataSetID];
+    return aSubMesh->GetElemObjID(anInputID);
+  }
+
+  std::string 
+  TMeshOnEntityImpl
+  ::GetNodeName(vtkIdType theObjID) const
+  {
+    return myNamedPointCoords->GetNodeName(theObjID);
+  }
+
+  std::string 
+  TMeshOnEntityImpl
+  ::GetElemName(vtkIdType theObjID) const
+  {
+    vtkIdType aVTKId = GetElemVTKID(theObjID);
+    vtkIdType anInputID, aStartId, anInputDataSetID;
+    const PAppendFilter& anAppendFilter = GetFilter();
+    anAppendFilter->GetCellInputID(aVTKId,anInputID,aStartId,anInputDataSetID);
+    const PSubMeshImpl& aSubMesh = mySubMeshArr[anInputDataSetID];
+    return aSubMesh->GetElemName(anInputID);
+  }
+
+  vtkUnstructuredGrid* 
+  TMeshOnEntityImpl
+  ::GetUnstructuredGridOutput()
+  {
+    return TAppendFilterHolder::GetUnstructuredGridOutput();
+  }
+
+  unsigned long int
+  TMeshOnEntityImpl
+  ::GetMemorySize()
+  {
+    size_t aSize = TAppendFilterHolder::GetMemorySize();
+    aSize += myNamedPointCoords->GetMemorySize();
+    aSize += myElemObj2VTKID.size() * 2 * sizeof(vtkIdType);
+    TGeom2SubMesh::const_iterator anIter = myGeom2SubMesh.begin();
+    TGeom2SubMesh::const_iterator anIterEnd = myGeom2SubMesh.end();
+    for(; anIter != anIterEnd; anIter++){
+      const PSubMeshImpl& aSubMesh = anIter->second;
+      aSize += aSubMesh->GetMemorySize();
+      aSize += sizeof(EGeometry);
+    }
+    return aSize;
+  }
+
+  //---------------------------------------------------------------
+  vtkIdType
+  TFamilyImpl
+  ::GetElemVTKID(vtkIdType theID) const
+  {
+    if(myElemObj2VTKID.empty())
+      return theID;
+    else{
+      TID2ID::const_iterator anIter = myElemObj2VTKID.find(theID);
+      if(anIter != myElemObj2VTKID.end())
+       return anIter->second;
+    }
+    return -1;
+  }
+
+  vtkIdType
+  TFamilyImpl
+  ::GetElemObjID(vtkIdType theID) const
+  {
+    return myMeshID[theID];
+  }
+
+  vtkIdType 
+  TFamilyImpl
+  ::GetNodeObjID(vtkIdType theID) const 
+  {
+    return myNamedPointCoords->GetObjID(theID);
+  }
+
+  vtkIdType
+  TFamilyImpl
+  ::GetNodeVTKID(vtkIdType theID) const 
+  {
+    return myNamedPointCoords->GetVTKID(theID);
+  }
+
+  vtkUnstructuredGrid* 
+  TFamilyImpl
+  ::GetUnstructuredGridOutput()
+  {
+    return TUnstructuredGridHolder::GetUnstructuredGridOutput();
+  }
+
+  unsigned long int
+  TFamilyImpl
+  ::GetMemorySize()
+  {
+    size_t aSize = TUnstructuredGridHolder::GetMemorySize();
+    aSize += myNamedPointCoords->GetMemorySize();
+    aSize += myElemObj2VTKID.size() * 2 * sizeof(vtkIdType);
+    aSize += myMeshID.size() * sizeof(vtkIdType);
+    TGeom2SubMeshID::const_iterator anIter = myGeom2SubMeshID.begin();
+    TGeom2SubMeshID::const_iterator anIterEnd = myGeom2SubMeshID.end();
+    for(; anIter != anIterEnd; anIter++){
+      const TSubMeshID& aSubMeshID = anIter->second;
+      aSize += aSubMeshID.size() * sizeof(vtkIdType);
+      aSize += sizeof(EGeometry);
+    }
+    return aSize;
+  }
+
+
+  //---------------------------------------------------------------
+  TNbASizeCells 
+  TGroupImpl
+  ::GetNbASizeCells() const
+  {
+    vtkIdType aNbCells = 0, aCellsSize = 0;
+    TFamilySet::const_iterator anIter = myFamilySet.begin();
+    for(; anIter != myFamilySet.end(); anIter++){
+      PFamilyImpl aFamily = *anIter; 
+      aNbCells += aFamily->myNbCells;
+      aCellsSize += aFamily->myCellsSize;
+    }
+    return std::make_pair(aNbCells,aCellsSize);
+  }
+
+  vtkIdType
+  TGroupImpl
+  ::GetElemVTKID(vtkIdType theID) const
+  {
+    if(myElemObj2VTKID.empty())
+      return theID;
+    else{
+      TID2ID::const_iterator anIter = myElemObj2VTKID.find(theID);
+      if(anIter != myElemObj2VTKID.end())
+       return anIter->second;
+    }
+    return -1;
+  }
+
+  vtkIdType
+  TGroupImpl
+  ::GetElemObjID(vtkIdType theID) const
+  {
+    vtkIdType anInputID, aStartId, anInputDataSetID;
+    const PAppendFilter& anAppendFilter = GetFilter();
+    anAppendFilter->GetCellInputID(theID,anInputID,aStartId,anInputDataSetID);
+    const PFamilyImpl& aFamily = myFamilyArr[anInputDataSetID];
+    return aFamily->GetElemObjID(anInputID);
+  }
+
+  vtkIdType 
+  TGroupImpl
+  ::GetNodeObjID(vtkIdType theID) const 
+  {
+    return myNamedPointCoords->GetObjID(theID);
+  }
+
+  vtkIdType
+  TGroupImpl
+  ::GetNodeVTKID(vtkIdType theID) const 
+  {
+    return myNamedPointCoords->GetVTKID(theID);
+  }
+
+  vtkUnstructuredGrid* 
+  TGroupImpl
+  ::GetUnstructuredGridOutput()
+  {
+    return TAppendFilterHolder::GetUnstructuredGridOutput();
+  }
+
+  unsigned long int
+  TGroupImpl
+  ::GetMemorySize()
+  {
+    size_t aSize = TAppendFilterHolder::GetMemorySize();
+    aSize += myNamedPointCoords->GetMemorySize();
+    aSize += myElemObj2VTKID.size() * 2 * sizeof(vtkIdType);
+    for(size_t anId = 0; anId < myFamilyArr.size(); anId++){
+      const PFamilyImpl& aFamily = myFamilyArr[anId];
+      aSize += aFamily->GetMemorySize();
+    }
+    return aSize;
+  }
+
+
+  
+  //---------------------------------------------------------------
+  TFieldImpl
+  ::TFieldImpl(): 
+    myDataSize(0),
+    myDataType(0)
+  {}
+
+  void 
+  TFieldImpl
+  ::Init(vtkIdType theNbComp,
+        vtkIdType theDataType)
+  {
+    myNbComp = theNbComp;
+    myDataType = theDataType;
+    myCompNames.resize(theNbComp);
+    myUnitNames.resize(theNbComp);
+    myMinMaxArr.resize(theNbComp + 1);
+    for(vtkIdType iComp = 0; iComp <= theNbComp; iComp++){
+      TMinMax& aMinMax = myMinMaxArr[iComp];
+      aMinMax.first = VTK_LARGE_FLOAT;
+      aMinMax.second = -VTK_LARGE_FLOAT;
+    }
+  }
+
+  vtkIdType 
+  TFieldImpl
+  ::GetDataType() const
+  {
+    return myDataType;
+  }
+
+  TMinMax 
+  TFieldImpl
+  ::GetMinMax(vtkIdType theCompID)
+  {
+    return myMinMaxArr[theCompID];
+  }
+
+
+  //----------------------------------------------------------------------------
+  const PMeshValue& 
+  TGeom2Value
+  ::GetMeshValue(EGeometry theGeom) const
+  {
+    TGeom2MeshValue::const_iterator anIter = myGeom2MeshValue.find(theGeom);
+    if(anIter == myGeom2MeshValue.end())
+      EXCEPTION(std::runtime_error,"TGeom2Value::GetMeshValue - myGeom2MeshValue.find(theGeom) fails");
+    return anIter->second;
+  }
+  
+  PMeshValue& 
+  TGeom2Value
+  ::GetMeshValue(EGeometry theGeom)
+  {
+    return myGeom2MeshValue[theGeom];
+  }
+
+
+  //----------------------------------------------------------------------------
+  TGeom2MeshValue& 
+  TGeom2Value
+  ::GetGeom2MeshValue()
+  {
+    return myGeom2MeshValue;
+  }
+    
+  const TGeom2MeshValue& 
+  TGeom2Value
+  ::GetGeom2MeshValue() const
+  {
+    return myGeom2MeshValue;
+  }
+
+  PMeshValue 
+  TGeom2Value
+  ::GetFirstMeshValue() const
+  {
+    if(myGeom2MeshValue.size() == 1)
+      return myGeom2MeshValue.begin()->second;
+    return PMeshValue();
+  }
+
+
+  //---------------------------------------------------------------
+  TValForTimeImpl
+  ::TValForTimeImpl():
+    myGaussPtsIDFilter(new TGaussPtsIDFilter()),
+    myUnstructuredGridIDMapper(new TUnstructuredGridIDMapperImpl())
+  {}
+
+  const PMeshValue& 
+  TValForTimeImpl
+  ::GetMeshValue(EGeometry theGeom) const
+  {
+    return myGeom2Value.GetMeshValue(theGeom);
+  }
+  
+  PMeshValue& 
+  TValForTimeImpl
+  ::GetMeshValue(EGeometry theGeom)
+  {
+    return myGeom2Value.GetMeshValue(theGeom);
+  }
+
+  TGeom2MeshValue& 
+  TValForTimeImpl
+  ::GetGeom2MeshValue()
+  {
+    return myGeom2Value.GetGeom2MeshValue();
+  }
+
+  const TGeom2MeshValue& 
+  TValForTimeImpl
+  ::GetGeom2MeshValue() const
+  {
+    return myGeom2Value.GetGeom2MeshValue();
+  }
+
+  PMeshValue 
+  TValForTimeImpl
+  ::GetFirstMeshValue() const
+  {
+    return myGeom2Value.GetFirstMeshValue();
+  }
+
+  int
+  TValForTimeImpl
+  ::GetNbGauss(EGeometry theGeom) const
+  {
+    TGeom2NbGauss::const_iterator anIter = myGeom2NbGauss.find(theGeom);
+    if(anIter == myGeom2NbGauss.end()){
+      return 1;
+    }
+    return anIter->second;
+  }
+  
+  unsigned long int
+  TValForTimeImpl
+  ::GetMemorySize()
+  {
+    size_t aSize = sizeof(TValForTimeImpl);
+    const TGeom2MeshValue& aGeom2MeshValue = GetGeom2MeshValue();
+    TGeom2MeshValue::const_iterator anIter = aGeom2MeshValue.begin();
+    TGeom2MeshValue::const_iterator anIterEnd = aGeom2MeshValue.end();
+    for(; anIter != anIterEnd; anIter++){
+      const PMeshValue& aMeshValue = anIter->second;
+      aSize += aMeshValue->GetMemorySize();
+      aSize += sizeof(EGeometry);
+    }
+    return aSize;
+  }
+
+
+  //---------------------------------------------------------------
+}
diff --git a/src/CONVERTOR/VISU_Structures_impl.hxx b/src/CONVERTOR/VISU_Structures_impl.hxx
new file mode 100644 (file)
index 0000000..7783b66
--- /dev/null
@@ -0,0 +1,810 @@
+//  
+//
+//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
+// 
+//  This library is free software; you can redistribute it and/or 
+//  modify it under the terms of the GNU Lesser General Public 
+//  License as published by the Free Software Foundation; either 
+//  version 2.1 of the License. 
+// 
+//  This library is distributed in the hope that it will be useful, 
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of 
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
+//  Lesser General Public License for more details. 
+// 
+//  You should have received a copy of the GNU Lesser General Public 
+//  License along with this library; if not, write to the Free Software 
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
+// 
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+//
+//  File   : 
+//  Author : Alexey PETROV
+//  Module : VISU
+
+#ifndef VISU_Structures_impl_HeaderFile
+#define VISU_Structures_impl_HeaderFile
+
+/*! 
+  \file VISU_Structures_impl.hxx
+  \brief The file contains definitions for basic classes of the implementation of VISU CONVERTER package
+*/
+
+#include "VISU_Structures.hxx"
+#include "VISU_ConvertorDef_impl.hxx"
+
+namespace VISU
+{
+  //---------------------------------------------------------------
+  //! Define an utility base class which allow to keep calculated number of cells and their size
+  struct TSizeCounter: virtual TIsVTKDone
+  {
+    TSizeCounter();
+    vtkIdType myNbCells; //!< Number of cells contained into corresponding sublclass
+    vtkIdType myCellsSize; //!< Size of cells contained into corresponding sublclass
+  };
+
+
+  //---------------------------------------------------------------
+  //! Define a container for VTK representation
+  class TPolyDataHolder: public virtual TSizeCounter
+  {
+  protected:
+    mutable PPolyData mySource;
+  public:
+    TPolyDataHolder();
+
+    //! This method allow to create corresponding VTK data set by demand (not at once)
+    const PPolyData& 
+    GetSource() const;
+
+    virtual
+    vtkPolyData* 
+    GetPolyDataOutput();
+
+    //! Gets memory size used by the instance (bytes).
+    virtual
+    unsigned long int
+    GetMemorySize();
+  };
+
+
+  //---------------------------------------------------------------
+  //! Define a container for VTK representation
+  class TUnstructuredGridHolder: public virtual TSizeCounter
+  {
+  public:
+    TUnstructuredGridHolder();
+
+    //! This method allow to create corresponding VTK data set by demand (not at once)
+    const PUnstructuredGrid& 
+    GetSource() const;
+
+    virtual
+    vtkUnstructuredGrid* 
+    GetUnstructuredGridOutput();
+
+    //! Gets memory size used by the instance (bytes).
+    virtual
+    unsigned long int
+    GetMemorySize();
+
+  protected:
+    mutable PUnstructuredGrid mySource;
+  };
+
+
+  //---------------------------------------------------------------
+  //! Define an intermediate class which unifies memory size calculation
+  struct TMemoryCheckIDMapper: public virtual TIsVTKDone,
+                              public virtual TIDMapper
+  {
+    //! Gets memory size used by the instance (bytes).
+    virtual
+    unsigned long int
+    GetMemorySize();
+  };
+
+
+  //---------------------------------------------------------------
+  //! Define a container for VTK representation
+  /*!
+    This container allow to combine other VTK representation into single one.
+  */
+  class TAppendFilterHolder: public virtual TMemoryCheckIDMapper
+  {
+  protected:
+    mutable PAppendFilter myFilter;
+  public:
+    TAppendFilterHolder();
+
+    //! This method allow to create corresponding VTK filter by demand (not at once)
+    const PAppendFilter& 
+    GetFilter() const;
+
+    //! Reimplement the TNamedIDMapper::GetUnstructuredGridOutput
+    virtual
+    vtkUnstructuredGrid* 
+    GetUnstructuredGridOutput();
+  };
+
+
+  //---------------------------------------------------------------
+  //! Define a container for VTK representation
+  /*!
+    This container allow to combine other VTK representation into single one.
+  */
+  class TAppendPolyDataHolder: public virtual TMemoryCheckIDMapper
+  {
+  protected:
+    mutable PAppendPolyData myFilter;
+  public:
+    TAppendPolyDataHolder();
+
+    //! This method allow to create corresponding VTK filter by demand (not at once)
+    const PAppendPolyData& 
+    GetFilter() const;
+
+    //! Reimplement the TGaussPtsIDMapper::GetPolyDataOutput
+    virtual
+    vtkPolyData* 
+    GetPolyDataOutput();
+  };
+
+
+  //---------------------------------------------------------------
+  //! Define a container for VTK representation
+  /*!
+    This container allow to assign data to mesh and represent them into single VTK representation
+  */
+  class TMergeFilterHolder: public virtual TMemoryCheckIDMapper
+  {
+  protected:
+    mutable PMergeFilter myFilter;
+  public:
+    TMergeFilterHolder();
+
+    //! This method allow to create corresponding VTK filter by demand (not at once)
+    const PMergeFilter& 
+    GetFilter() const;
+
+    //! Gets output of the filter as vtkDataSet
+    virtual
+    vtkDataSet*
+    GetOutput();
+  };
+
+
+  //---------------------------------------------------------------
+  //! Specialize TMesh to provide VTK mapping for nodes
+  struct TMeshImpl: virtual TMesh, 
+                   virtual TIsVTKDone
+  {
+    PNamedPointCoords myNamedPointCoords; //!< Keeps intermediate representation of the nodes
+    vtkIdType myNbPoints; //!< Keeps number of the nodes
+
+    TMeshImpl();
+
+    vtkIdType
+    GetNbPoints() const;
+
+    vtkIdType
+    GetDim() const;
+
+    vtkPoints*
+    GetPoints(); //!< Gets initialized corresponding VTK structure
+  };
+
+
+  //---------------------------------------------------------------
+  typedef TVector<vtkIdType> TSubMeshID;
+  typedef enum {eRemoveAll, eAddAll, eAddPart, eNone} ESubMeshStatus; 
+
+  //! Specialize TSubProfile to provide VTK mapping
+  struct TSubProfileImpl: virtual TSubProfile, 
+                         virtual TUnstructuredGridHolder
+  {
+    TSubProfileImpl();
+
+    EGeometry myGeom; //!< Defines to what geometrical type the MED PROFILE belong to
+    std::string myName; //!< Keeps its name
+
+    //! Get object number of mesh cell by its VTK one
+    virtual 
+    vtkIdType 
+    GetElemObjID(int theVtkI) const;
+
+    //! Gets memory size used by the instance (bytes).
+    virtual
+    unsigned long int
+    GetMemorySize();
+
+    //! 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 std::map<vtkIdType,vtkIdType> TID2ID;
+  typedef TVector<PSubProfileImpl> TSubProfileArr;
+  typedef std::map<EGeometry,PSubProfileImpl> TGeom2SubProfile;
+
+  //! Specialize TProfile to provide VTK mapping for MED TIMESTAMP mesh
+  struct TProfileImpl: virtual TProfile, 
+                      virtual TAppendFilterHolder
+  {
+    TProfileImpl();
+    bool myIsAll; //!< Say, whether the MED TIMESTAMP defined on all MED ENTITY or not
+   
+    //! Reimplement the TIDMapper::GetNodeObjID
+    virtual 
+    vtkIdType 
+    GetNodeObjID(vtkIdType theID) const;
+
+    //! Reimplement the TIDMapper::GetNodeVTKID
+    virtual 
+    vtkIdType 
+    GetNodeVTKID(vtkIdType theID) const;
+
+    //! Reimplement the TIDMapper::GetNodeCoord
+    virtual 
+    vtkFloatingPointType*  
+    GetNodeCoord(vtkIdType theObjID);
+
+    //! Reimplement the TIDMapper::GetElemObjID
+    virtual 
+    vtkIdType 
+    GetElemObjID(vtkIdType theID) const;
+
+    //! Reimplement the TIDMapper::GetElemVTKID
+    virtual 
+    vtkIdType 
+    GetElemVTKID(vtkIdType theID) const;
+
+    //! Reimplement the TIDMapper::GetElemCell
+    virtual
+    vtkCell* 
+    GetElemCell(vtkIdType theObjID);
+    
+    //! Reimplement the TNamedIDMapper::GetUnstructuredGridOutput
+    virtual
+    vtkUnstructuredGrid* 
+    GetUnstructuredGridOutput();
+
+    //! Gets memory size used by the instance (bytes).
+    virtual
+    unsigned long int
+    GetMemorySize();
+
+    //! Reimplement the TNamedIDMapper::GetNodeName
+    virtual
+    std::string 
+    GetNodeName(vtkIdType theObjID) const;
+
+    //! Reimplement the TNamedIDMapper::GetElemName
+    virtual
+    std::string 
+    GetElemName(vtkIdType theObjID) const;
+
+    TID2ID myElemObj2VTKID; //!< Keeps object to VTK numeration mapping
+    TSubProfileArr mySubProfileArr; //!< Keeps sequence of TSubProfiles as they were added into TAppendFilterHolder
+    PNamedPointCoords myNamedPointCoords; //!< Keeps reference on the same TNamedPointCoords as TMesh
+    TMeshOnEntityImpl* myMeshOnEntity; //<! Keeps backward reference to corresponding MED ENTITY mesh
+
+    TGeom2SubProfile myGeom2SubProfile; //!< Keeps TSubProfiles according to their geometrical type
+  };
+
+
+  //---------------------------------------------------------------
+  //! Specialize TIDMapper to provide VTK mapping for MED TIMESTAMP mesh
+  struct TUnstructuredGridIDMapperImpl: virtual TMergeFilterHolder,
+                                       virtual TUnstructuredGridIDMapper
+  {
+    PAppendFilterHolder myIDMapper; //!< Responsible for numbering
+    TUnstructuredGridHolder mySource; //!< Keeps assigned data
+
+    //! Reimplement the TIDMapper::GetNodeObjID
+    virtual 
+    vtkIdType 
+    GetNodeObjID(vtkIdType theID) const;
+
+    //! Reimplement the TIDMapper::GetNodeVTKID
+    virtual 
+    vtkIdType 
+    GetNodeVTKID(vtkIdType theID) const;
+
+    //! Reimplement the TIDMapper::GetNodeCoord
+    virtual 
+    vtkFloatingPointType*  
+    GetNodeCoord(vtkIdType theObjID);
+
+    //! Reimplement the TIDMapper::GetElemObjID
+    virtual 
+    vtkIdType 
+    GetElemObjID(vtkIdType theID) const;
+
+    //! Reimplement the TIDMapper::GetElemVTKID
+    virtual 
+    vtkIdType 
+    GetElemVTKID(vtkIdType theID) const;
+
+    //! Reimplement the TIDMapper::GetElemCell
+    virtual
+    vtkCell* 
+    GetElemCell(vtkIdType theObjID);
+    
+    //! Reimplement the TUnstructuredGridIDMapper::GetUnstructuredGridOutput
+    virtual
+    vtkUnstructuredGrid* 
+    GetUnstructuredGridOutput();
+
+    //! Reimplement the TIDMapper::GetOutput
+    virtual
+    vtkDataSet* 
+    GetOutput();
+
+    //! Gets memory size used by the instance (bytes).
+    virtual
+    unsigned long int
+    GetMemorySize();
+  };
+
+
+  //---------------------------------------------------------------
+  //! Specialize TIDMapper to provide VTK mapping for MED TIMESTAMP mesh
+  struct TPolyDataIDMapperImpl: virtual TMergeFilterHolder,
+                               virtual TPolyDataIDMapper
+  {
+    PAppendPolyDataHolder myIDMapper; //!< Responsible for numbering
+    TPolyDataHolder mySource; //!< Keeps assigned data
+
+    //! Reimplement the TIDMapper::GetNodeObjID
+    virtual 
+    vtkIdType 
+    GetNodeObjID(vtkIdType theID) const;
+
+    //! Reimplement the TIDMapper::GetNodeVTKID
+    virtual 
+    vtkIdType 
+    GetNodeVTKID(vtkIdType theID) const;
+
+    //! Reimplement the TIDMapper::GetNodeCoord
+    virtual 
+    vtkFloatingPointType*  
+    GetNodeCoord(vtkIdType theObjID);
+
+    //! Reimplement the TIDMapper::GetElemObjID
+    virtual 
+    vtkIdType 
+    GetElemObjID(vtkIdType theID) const;
+
+    //! Reimplement the TIDMapper::GetElemVTKID
+    virtual 
+    vtkIdType 
+    GetElemVTKID(vtkIdType theID) const;
+
+    //! Reimplement the TIDMapper::GetElemCell
+    virtual
+    vtkCell* 
+    GetElemCell(vtkIdType theObjID);
+    
+    //! Reimplement the TPolyDataIDMapper::GetPolyDataOutput
+    virtual
+    vtkPolyData* 
+    GetPolyDataOutput();
+
+    //! Reimplement the TIDMapper::GetOutput
+    virtual
+    vtkDataSet* 
+    GetOutput();
+
+    //! Gets memory size used by the instance (bytes).
+    virtual
+    unsigned long int
+    GetMemorySize();
+  };
+
+
+  //---------------------------------------------------------------
+  //! Specialize TGauss to provide more detail information of the MED GAUSS entity for VTK mapping
+  struct TGaussImpl: virtual TGauss
+  {
+    EGeometry myGeom; //!< Define, to which geometrical type the MED GAUSS entity belongs
+    std::string myName; //!< Keeps name of the MED GAUSS entity
+    vtkIdType myNbPoints; //<! Keeps number of points for the MED GAUSS entity
+
+    TGaussImpl();
+
+    //! To define a way to implement more detail comparision of the TGaussSubMesh instances
+    virtual
+    void
+    LessThan(const PGaussImpl& theGauss,
+            bool& theResult) const;
+  };
+
+
+  //---------------------------------------------------------------
+  //! Specialize TGaussSubMesh to provide VTK mapping for the entity
+  struct TGaussSubMeshImpl: virtual TGaussSubMesh, 
+                           virtual TPolyDataHolder
+  {
+    TGaussSubMeshImpl();
+
+    //! To implement the TGaussPtsIDMapper::GetObjID
+    virtual
+    TGaussPointID
+    GetObjID(vtkIdType theID,
+            vtkIdType theStartID) const;
+    
+    //! Gets memory size used by the instance (bytes).
+    virtual
+    unsigned long int
+    GetMemorySize();
+
+    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;
+
+    PPointCoords myPointCoords; //!< Keeps coordinates of Gauss Points
+  };
+
+
+  //---------------------------------------------------------------
+  typedef TVector<PGaussSubMeshImpl> TGaussSubMeshArr;
+  typedef std::map<EGeometry, PGaussSubMeshImpl> TGeom2GaussSubMesh;
+
+  //! Specialize TGaussMesh to provide VTK mapping for the entity
+  struct TGaussMeshImpl: virtual TGaussMesh, 
+                        virtual TAppendPolyDataHolder
+  {
+    TGaussMeshImpl();
+
+    //! Reimplement the TGaussPtsIDMapper::GetObjID
+    virtual
+    TGaussPointID
+    GetObjID(vtkIdType theID) const;
+
+    //! Reimplement the TGaussPtsIDMapper::GetPolyDataOutput
+    virtual
+    vtkPolyData* 
+    GetPolyDataOutput();
+
+    //! Gets memory size used by the instance (bytes).
+    virtual
+    unsigned long int
+    GetMemorySize();
+
+    //! Reimplement the TGaussPtsIDMapper::GetParent
+    virtual 
+    TNamedIDMapper*
+    GetParent();
+
+    TNamedIDMapper* myParent; //!< Refer to parent mesh
+    TGaussSubMeshArr myGaussSubMeshArr; //!< Keeps sequence of TGaussSubMesh as they were added into TAppendFilterHolder
+    TGeom2GaussSubMesh myGeom2GaussSubMesh; //!< Keeps TGaussSubMesh according to their geometrical type
+  };
+
+
+  //---------------------------------------------------------------
+  //! Specialize TGaussPtsIDMapper to provide VTK mapping for MED TIMESTAMP mesh
+  struct TGaussPtsIDFilter: virtual TPolyDataIDMapperImpl,
+                           virtual TGaussPtsIDMapper
+  { 
+    PGaussPtsIDMapper myGaussPtsIDMapper;
+
+    //! Reimplement the TGaussPtsIDMapper::GetObjID
+    virtual 
+    TGaussPointID 
+    GetObjID(vtkIdType theID) const;
+
+    //! Reimplement the TGaussPtsIDMapper::GetParent
+    virtual 
+    TNamedIDMapper*
+    GetParent();
+
+    //! Reimplement the TNamedIDMapper::GetUnstructuredGridOutput
+    virtual
+    vtkPolyData* 
+    GetPolyDataOutput();
+
+    //! Reimplement the TIDMapper::GetOutput
+    virtual
+    vtkDataSet*
+    GetOutput();
+  };
+
+
+  //---------------------------------------------------------------
+  typedef TVector<vtkIdType> TConnect;
+  typedef TVector<TConnect> TCell2Connect;
+
+  //! The class is responsible for mapping of cells of defined geometrical type  
+  struct TSubMeshImpl: virtual TUnstructuredGridHolder
+  {
+    //! To implement the TIDMapper::GetElemObjID
+    virtual 
+    vtkIdType 
+    GetElemObjID(vtkIdType theID) const;
+
+    //! To implement the TNamedIDMapper::GetElemName
+    virtual
+    std::string 
+    GetElemName(vtkIdType theObjID) const;
+
+    //! Gets memory size used by the instance (bytes).
+    virtual
+    unsigned long int
+    GetMemorySize();
+
+    vtkIdType myStartID;
+    TCell2Connect myCell2Connect; //!< Contains connectivity for the cells
+  };
+
+
+  //---------------------------------------------------------------
+  typedef std::map<EGeometry,PSubMeshImpl> TGeom2SubMesh;
+  typedef TVector<PSubMeshImpl> TSubMeshArr;
+
+  //! Specialize TMeshOnEntity to provide VTK mapping for the entity
+  struct TMeshOnEntityImpl: virtual TMeshOnEntity, 
+                           virtual TAppendFilterHolder, 
+                           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;
+
+    //! Reimplement the TNamedIDMapper::GetUnstructuredGridOutput
+    virtual
+    vtkUnstructuredGrid* 
+    GetUnstructuredGridOutput();
+
+    //! Gets memory size used by the instance (bytes).
+    virtual
+    unsigned long int
+    GetMemorySize();
+
+    TID2ID myElemObj2VTKID; //!< To support object to VTK number mapping 
+    TSubMeshArr mySubMeshArr; //!< Keeps sequence of TSubMeshImpl as they were added into TAppendFilterHolder
+    PNamedPointCoords myNamedPointCoords; //!< Share the same instance with TMesh to implement nodal mapping
+
+    TGeom2SubMesh myGeom2SubMesh; //!< Keeps TSubMeshImpl according to their geometrical type
+  };
+
+
+  //---------------------------------------------------------------
+  typedef std::map<EGeometry,TSubMeshID> TGeom2SubMeshID;
+
+  //! Specialize TFamily to provide VTK mapping for the entity
+  struct TFamilyImpl: virtual TFamily, 
+                     virtual TUnstructuredGridHolder
+  {
+    //! 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 TUnstructuredGridIDMapper::GetUnstructuredGridOutput
+    virtual
+    vtkUnstructuredGrid* 
+    GetUnstructuredGridOutput();
+
+    //! Gets memory size used by the instance (bytes).
+    virtual
+    unsigned long int
+    GetMemorySize();
+
+    PNamedPointCoords myNamedPointCoords;  //!< Share the same instance with TMesh to implement nodal mapping
+    TID2ID myElemObj2VTKID; //!< To support object to VTK number mapping
+    TSubMeshID myMeshID; //!< Keeps numbers of mesh elements that belongs to the MED FAMILY
+
+    TGeom2SubMeshID myGeom2SubMeshID; //!< Keeps TSubMeshID according to their geometrical type
+  };
+
+
+  //---------------------------------------------------------------
+  typedef std::pair<vtkIdType,vtkIdType> TNbASizeCells;
+  typedef TVector<PFamilyImpl> TFamilyArr;
+
+  //! Specialize TGroup to provide VTK mapping for the entity
+  struct TGroupImpl: virtual TGroup, 
+                    virtual TAppendFilterHolder
+  {
+    //! 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;
+
+    //! Reimplement the TUnstructuredGridIDMapper::GetUnstructuredGridOutput
+    virtual
+    vtkUnstructuredGrid* 
+    GetUnstructuredGridOutput();
+
+    //! Gets memory size used by the instance (bytes).
+    virtual
+    unsigned long int
+    GetMemorySize();
+
+    TID2ID myElemObj2VTKID; //!< To support object to VTK number mapping
+    TFamilyArr myFamilyArr; //!< Keeps sequence of TFamily as they were added into TAppendFilterHolder
+    PNamedPointCoords myNamedPointCoords; //!< Share the same instance with TMesh to implement nodal mapping
+  };
+
+
+  //---------------------------------------------------------------
+  typedef TVector<TMinMax> TMinMaxArr;
+
+  //! Specialize TField to provide VTK mapping for the entity
+  struct TFieldImpl: virtual TField
+  {
+    TFieldImpl();
+
+    //! To initialize the data structure    
+    void 
+    Init(vtkIdType theNbComp,
+        vtkIdType theDataType);
+
+    //! Gets type idetificator of the mesh data.
+    vtkIdType
+    GetDataType() const;
+
+    //! Implement the TField::GetMinMax
+    virtual
+    TMinMax 
+    GetMinMax(vtkIdType theCompID);
+
+    vtkIdType myDataSize; //!< Keeps size of the assigned data
+    vtkIdType myDataType; //!< Keeps type idetificator of the mesh data
+    TMinMaxArr myMinMaxArr; //!< Keeps min/max values for each component of the MED FIELD
+  };
+
+
+  //---------------------------------------------------------------
+  typedef std::map<EGeometry, PMeshValue> TGeom2MeshValue;
+
+  class TGeom2Value: public virtual TBaseStructure
+  {
+    TGeom2MeshValue myGeom2MeshValue;
+  public:
+
+    //! Gets mesh data for defined geometrical type (constant version)
+    const PMeshValue& 
+    GetMeshValue(EGeometry theGeom) const;
+
+    //! Gets mesh data for defined geometrical type
+    PMeshValue& 
+    GetMeshValue(EGeometry theGeom);
+
+    //! Gets container of the whole mesh data
+    TGeom2MeshValue& 
+    GetGeom2MeshValue();
+    
+    //! Gets container of the whole mesh data (constant version)
+    const TGeom2MeshValue& 
+    GetGeom2MeshValue() const;
+
+    //! Gets mesh data for the first geometry
+    PMeshValue
+    GetFirstMeshValue() const;
+  };
+
+
+  //---------------------------------------------------------------
+  typedef std::map<EGeometry,vtkIdType> TGeom2NbGauss;
+
+  //! Specialize TValForTime to provide VTK mapping for the entity
+  struct TValForTimeImpl: virtual TValForTime
+  {
+    PGaussPtsIDFilter myGaussPtsIDFilter; //!< Keep VTK representation for mesh and data on Gauss Points
+    PUnstructuredGridIDMapperImpl myUnstructuredGridIDMapper; //!< Keep VTK representation for ordinary mesh and data
+    TGeom2Value myGeom2Value; //!< Keep value that is assigned to the mesh
+    TGeom2NbGauss myGeom2NbGauss; //!< Keep number of Gauss Points
+   
+    TValForTimeImpl();
+
+    TGeom2MeshValue& 
+    GetGeom2MeshValue();
+    
+    const TGeom2MeshValue& 
+    GetGeom2MeshValue() const;
+    
+    //! Get mesh data for defined geometrical type (constant version)
+    const PMeshValue& 
+    GetMeshValue(EGeometry theGeom) const;
+
+    //! Get mesh data for defined geometrical type
+    PMeshValue& 
+    GetMeshValue(EGeometry theGeom);
+
+    //! Gets mesh data for the first geometry
+    PMeshValue
+    GetFirstMeshValue() const;
+
+    //! Get number of Gauss Points for defined geometrical type
+    virtual
+    int
+    GetNbGauss(EGeometry theGeom) const;
+
+    //! Gets memory size used by the instance (bytes).
+    virtual
+    unsigned long int
+    GetMemorySize();
+  };
+
+
+  //---------------------------------------------------------------
+}
+
+
+#endif
diff --git a/src/CONVERTOR/VISU_TypeList.hxx b/src/CONVERTOR/VISU_TypeList.hxx
new file mode 100644 (file)
index 0000000..1a09efc
--- /dev/null
@@ -0,0 +1,96 @@
+//  VISU OBJECT : interactive object for VISU entities implementation
+//
+//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+//
+//  File   : VISU_ColoredPrs3dCache_i.hh
+//  Author : Oleg UVAROV
+//  Module : VISU
+
+#ifndef VISU_TypeList_HeaderFile
+#define VISU_TypeList_HeaderFile
+
+namespace VISU
+{
+  namespace TL
+  {
+    //----------------------------------------------------------------------------
+    template <class T, class U>
+    struct TList
+    {
+      typedef T THead;
+      typedef U TTail;
+    };
+    
+    template <int v>
+    struct TInt2Type
+    {
+      enum { value = v };
+    };
+    
+    struct TNullType {};
+    
+    //----------------------------------------------------------------------------
+    template <class TypeList, unsigned int index> 
+    struct TTypeAt;
+
+    template <class THead, class TTail>
+    struct TTypeAt<TList<THead, TTail>, 0>
+    {
+      typedef THead TResult;
+    };
+
+
+    template <class THead, class TTail, unsigned int index>
+    struct TTypeAt<TList<THead, TTail>, index>
+    {
+      typedef typename TTypeAt<TTail, index - 1>::TResult TResult;
+    };
+
+    //----------------------------------------------------------------------------
+    template <class TypeList, class T> 
+    struct TIndexOf;
+
+    template <class T>
+    struct TIndexOf<TNullType, T>
+    {
+      enum { value = -1 };
+    };
+
+    template <class T, class TTail>
+    struct TIndexOf<TList<T, TTail>, T>
+    {
+      enum { value = 0 };
+    };
+
+    template <class THead, class TTail, class T>
+    struct TIndexOf<TList<THead, TTail>, T>
+    {
+    private:
+      enum { temp = TIndexOf<TTail, T>::value };
+    public:
+      enum { value = temp == -1? -1 : 1 + temp };
+    };
+    
+    //----------------------------------------------------------------------------
+  }
+}
+
+#endif
diff --git a/src/OBJECT/VISU_DataSetActor.cxx b/src/OBJECT/VISU_DataSetActor.cxx
new file mode 100644 (file)
index 0000000..1b282c0
--- /dev/null
@@ -0,0 +1,95 @@
+//  VISU OBJECT : interactive object for VISU entities implementation
+//
+//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
+// 
+//  This library is free software; you can redistribute it and/or 
+//  modify it under the terms of the GNU Lesser General Public 
+//  License as published by the Free Software Foundation; either 
+//  version 2.1 of the License. 
+// 
+//  This library is distributed in the hope that it will be useful, 
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of 
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
+//  Lesser General Public License for more details. 
+// 
+//  You should have received a copy of the GNU Lesser General Public 
+//  License along with this library; if not, write to the Free Software 
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
+// 
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+//
+//
+//  File   : 
+//  Author : 
+//  Module : VISU
+
+#include "VISU_DataSetActor.h"
+#include "VISU_UnstructuredGridPL.hxx"
+#include "VISU_PipeLineUtils.hxx"
+
+#include <vtkDataSetMapper.h>
+#include <vtkObjectFactory.h>
+
+#include <boost/bind.hpp>
+
+using namespace std;
+
+#ifdef _DEBUG_
+static int MYDEBUG = 0;
+#else
+static int MYDEBUG = 0;
+#endif
+
+//----------------------------------------------------------------------------
+vtkStandardNewMacro(VISU_DataSetActor);
+
+//----------------------------------------------------------------------------
+VISU_DataSetActor
+::VISU_DataSetActor():
+  myMapper(vtkDataSetMapper::New())
+{
+  if(MYDEBUG) MESSAGE("VISU_DataSetActor::VISU_DataSetActor - this = "<<this);
+
+  myMapper->Delete();
+}
+
+//----------------------------------------------------------------------------
+VISU_DataSetActor
+::~VISU_DataSetActor()
+{
+  if(MYDEBUG) MESSAGE("~VISU_DataSetActor() - this = "<<this);
+}
+
+//----------------------------------------------------------------------------
+void
+VISU_DataSetActor
+::ShallowCopyPL(VISU_PipeLine* thePipeLine)
+{
+  Superclass::ShallowCopyPL(thePipeLine);
+
+  if(VISU_UnstructuredGridPL* aPipeLine = dynamic_cast<VISU_UnstructuredGridPL*>(thePipeLine)){
+    vtkDataSetMapper* aTarget = GetDataSetMapper();
+    vtkDataSetMapper* aSource = aPipeLine->GetDataSetMapper();
+    VISU::CopyDataSetMapper(aTarget, aSource, true);
+    aTarget->SetLookupTable(aSource->GetLookupTable());
+  }
+}
+
+//----------------------------------------------------------------------------
+void
+VISU_DataSetActor
+::SetMapperInput(vtkDataSet* theDataSet) 
+{
+  myMapper->SetInput(theDataSet);
+  SetMapper(myMapper.GetPointer());
+}
+
+//----------------------------------------------------------------------------
+vtkDataSetMapper* 
+VISU_DataSetActor
+::GetDataSetMapper()
+{
+  return myMapper.GetPointer();
+}
diff --git a/src/OBJECT/VISU_DataSetActor.h b/src/OBJECT/VISU_DataSetActor.h
new file mode 100644 (file)
index 0000000..9e7ef45
--- /dev/null
@@ -0,0 +1,74 @@
+//  VISU OBJECT : interactive object for VISU entities implementation
+//
+//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
+// 
+//  This library is free software; you can redistribute it and/or 
+//  modify it under the terms of the GNU Lesser General Public 
+//  License as published by the Free Software Foundation; either 
+//  version 2.1 of the License. 
+// 
+//  This library is distributed in the hope that it will be useful, 
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of 
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
+//  Lesser General Public License for more details. 
+// 
+//  You should have received a copy of the GNU Lesser General Public 
+//  License along with this library; if not, write to the Free Software 
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
+// 
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+//
+//
+//  File   : 
+//  Author : 
+//  Module : VISU
+
+#ifndef VISU_DATASETACTOR_H
+#define VISU_DATASETACTOR_H
+
+#include "VISU_Actor.h"
+
+class vtkDataSetMapper;
+
+#ifdef _WIN_32
+#define VTKOCC_EXPORT __declspec (dllexport)
+#else
+#define VTKOCC_EXPORT VTK_EXPORT
+#endif
+
+//----------------------------------------------------------------------------
+class VTKOCC_EXPORT VISU_DataSetActor : public VISU_Actor
+{
+ public:
+  vtkTypeMacro(VISU_DataSetActor,VISU_Actor);
+
+  static 
+  VISU_DataSetActor* 
+  New();
+
+  virtual
+  void
+  ShallowCopyPL(VISU_PipeLine* thePipeLine);
+
+  virtual 
+  vtkDataSetMapper* 
+  GetDataSetMapper();
+
+  //----------------------------------------------------------------------------
+ protected:
+  VISU_DataSetActor();
+
+  virtual
+  ~VISU_DataSetActor();
+  virtual 
+  void
+  SetMapperInput(vtkDataSet* theDataSet);
+
+  //----------------------------------------------------------------------------
+  vtkSmartPointer<vtkDataSetMapper> myMapper;
+};
+
+#endif //VISU_DATASETACTOR_H
diff --git a/src/PIPELINE/SALOME_ExtractPolyDataGeometry.cxx b/src/PIPELINE/SALOME_ExtractPolyDataGeometry.cxx
new file mode 100644 (file)
index 0000000..6d9aa05
--- /dev/null
@@ -0,0 +1,354 @@
+//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+
+
+#include "SALOME_ExtractPolyDataGeometry.h"
+
+#include <vtkCellArray.h>
+#include <vtkCellData.h>
+#include <vtkFloatArray.h>
+#include <vtkImplicitFunction.h>
+#include <vtkObjectFactory.h>
+#include <vtkPointData.h>
+#include <vtkPolyData.h>
+
+#include <vtkImplicitBoolean.h>
+#include <vtkImplicitFunctionCollection.h>
+
+//----------------------------------------------------------------------------
+vtkStandardNewMacro(SALOME_ExtractPolyDataGeometry);
+
+
+//----------------------------------------------------------------------------
+SALOME_ExtractPolyDataGeometry
+::SALOME_ExtractPolyDataGeometry():
+  myStoreMapping(false),
+  myIsDoneShallowCopy(false)
+{}
+
+SALOME_ExtractPolyDataGeometry
+::~SALOME_ExtractPolyDataGeometry()
+{}
+
+
+//----------------------------------------------------------------------------
+vtkImplicitBoolean* 
+SALOME_ExtractPolyDataGeometry
+::GetImplicitBoolean() 
+{
+  return myImplicitBoolean.GetPointer();
+}
+
+
+void
+SALOME_ExtractPolyDataGeometry
+::SetImplicitFunction(vtkImplicitFunction* theImplicitFunction)  
+{
+  myImplicitBoolean = dynamic_cast<vtkImplicitBoolean*>(theImplicitFunction);
+  Superclass::SetImplicitFunction(theImplicitFunction);
+}
+
+
+//----------------------------------------------------------------------------
+void 
+SALOME_ExtractPolyDataGeometry
+::SetStoreMapping(bool theStoreMapping)
+{
+  if(myStoreMapping != theStoreMapping){
+    myStoreMapping = theStoreMapping;
+    Modified();
+  }
+}
+
+bool 
+SALOME_ExtractPolyDataGeometry
+::GetStoreMapping() const
+{
+  return myStoreMapping;
+}
+
+
+//----------------------------------------------------------------------------
+vtkIdType
+SALOME_ExtractPolyDataGeometry
+::GetElemVTKId(vtkIdType theID)
+{
+  if(!myStoreMapping || myIsDoneShallowCopy)
+    return theID;
+
+  vtkIdType iEnd = myElemVTK2ObjIds.size();
+  for(vtkIdType i = 0; i < iEnd; i++)
+    if(myElemVTK2ObjIds[i] == theID)
+      return i;
+
+  return -1;
+}
+
+vtkIdType
+SALOME_ExtractPolyDataGeometry
+::GetNodeVTKId(vtkIdType theID)
+{
+  if(!myStoreMapping || myIsDoneShallowCopy)
+    return theID;
+
+  vtkIdType iEnd = myNodeVTK2ObjIds.size();
+  for(vtkIdType i = 0; i < iEnd; i++)
+    if(myNodeVTK2ObjIds[i] == theID)
+      return i;
+
+  return -1;
+}
+
+
+//----------------------------------------------------------------------------
+vtkIdType
+SALOME_ExtractPolyDataGeometry
+::GetElemObjId(int theVtkID)
+{
+  if(!myStoreMapping || myIsDoneShallowCopy)
+    return theVtkID;
+
+  if(theVtkID < myElemVTK2ObjIds.size())
+    return myElemVTK2ObjIds[theVtkID];
+
+  return -1;
+}
+
+
+vtkIdType
+SALOME_ExtractPolyDataGeometry
+::GetNodeObjId(int theVtkID)
+{
+  if(!myStoreMapping || myIsDoneShallowCopy)
+    return theVtkID;
+
+  if(theVtkID < myNodeVTK2ObjIds.size())
+    return myNodeVTK2ObjIds[theVtkID];
+
+  return -1;
+}
+
+
+//----------------------------------------------------------------------------
+void
+SALOME_ExtractPolyDataGeometry
+::Execute()
+{
+  myElemVTK2ObjIds.clear();
+  myNodeVTK2ObjIds.clear();
+  //
+  myIsDoneShallowCopy = !this->ImplicitFunction;
+
+  if(!myIsDoneShallowCopy && myImplicitBoolean.GetPointer()){
+    if(vtkImplicitFunctionCollection* aFunction = myImplicitBoolean->GetFunction()){
+      myIsDoneShallowCopy = aFunction->GetNumberOfItems() == 0;
+    }
+  }
+
+  if(myIsDoneShallowCopy)
+    GetOutput()->ShallowCopy(GetInput());
+  else
+    Execute2();
+}
+
+
+//----------------------------------------------------------------------------
+void 
+SALOME_ExtractPolyDataGeometry
+::Execute2()
+{
+  vtkIdType ptId, numPts, numCells, i, cellId, newCellId, newId, *pointMap;
+  vtkIdList *cellPts;
+  vtkCell *cell;
+  int numCellPts;
+  vtkFloatingPointType *x;
+  vtkFloatingPointType multiplier;
+  vtkPoints *newPts;
+  vtkIdList *newCellPts;
+  vtkDataSet *input = this->GetInput();
+  vtkPointData *pd = input->GetPointData();
+  vtkCellData *cd = input->GetCellData();
+  vtkPolyData *output = this->GetOutput();
+  vtkPointData *outputPD = output->GetPointData();
+  vtkCellData *outputCD = output->GetCellData();
+  int npts;
+  numCells = input->GetNumberOfCells();
+  numPts = input->GetNumberOfPoints();
+
+  if ( ! this->ImplicitFunction )
+    {
+    vtkErrorMacro(<<"No implicit function specified");
+    return;
+    }
+
+  newCellPts = vtkIdList::New();
+  newCellPts->Allocate(VTK_CELL_SIZE);
+
+  if ( this->ExtractInside )
+    {
+    multiplier = 1.0;
+    }
+  else
+    {
+    multiplier = -1.0;
+    }
+
+  // Loop over all points determining whether they are inside the
+  // implicit function. Copy the points and point data if they are.
+  //
+  pointMap = new vtkIdType[numPts]; // maps old point ids into new
+  for (i=0; i < numPts; i++)
+    {
+    pointMap[i] = -1;
+    }
+
+  output->Allocate(numCells/4); //allocate storage for geometry/topology
+  newPts = vtkPoints::New();
+  newPts->Allocate(numPts/4,numPts);
+  outputPD->CopyAllocate(pd);
+  outputCD->CopyAllocate(cd);
+  vtkFloatArray *newScalars = NULL;
+
+  if(myStoreMapping){
+    myElemVTK2ObjIds.reserve(numCells);
+    myNodeVTK2ObjIds.reserve(numPts);
+  }
+
+  if ( ! this->ExtractBoundaryCells )
+    {
+    for ( ptId=0; ptId < numPts; ptId++ )
+      {
+      x = input->GetPoint(ptId);
+      if ( (this->ImplicitFunction->FunctionValue(x)*multiplier) < 0.0 )
+        {
+        newId = newPts->InsertNextPoint(x);
+        pointMap[ptId] = newId;
+       if(myStoreMapping)
+         myNodeVTK2ObjIds.push_back(ptId);
+        outputPD->CopyData(pd,ptId,newId);
+        }
+      }
+    }
+  else
+    {
+    // To extract boundary cells, we have to create supplemental information
+    if ( this->ExtractBoundaryCells )
+      {
+      vtkFloatingPointType val;
+      newScalars = vtkFloatArray::New();
+      newScalars->SetNumberOfValues(numPts);
+
+      for (ptId=0; ptId < numPts; ptId++ )
+        {
+        x = input->GetPoint(ptId);
+        val = this->ImplicitFunction->FunctionValue(x) * multiplier;
+        newScalars->SetValue(ptId, val);
+        if ( val < 0.0 )
+          {
+          newId = newPts->InsertNextPoint(x);
+          pointMap[ptId] = newId;
+         if(myStoreMapping)
+           myNodeVTK2ObjIds.push_back(ptId);
+          outputPD->CopyData(pd,ptId,newId);
+          }
+        }
+      }
+    }
+
+  // Now loop over all cells to see whether they are inside implicit
+  // function (or on boundary if ExtractBoundaryCells is on).
+  //
+  for (cellId=0; cellId < numCells; cellId++)
+    {
+    cell = input->GetCell(cellId);
+    cellPts = cell->GetPointIds();
+    numCellPts = cell->GetNumberOfPoints();
+
+    newCellPts->Reset();
+    if ( ! this->ExtractBoundaryCells ) //requires less work
+      {
+      for ( npts=0, i=0; i < numCellPts; i++, npts++)
+        {
+        ptId = cellPts->GetId(i);
+        if ( pointMap[ptId] < 0 )
+          {
+          break; //this cell won't be inserted
+          }
+        else
+          {
+          newCellPts->InsertId(i,pointMap[ptId]);
+          }
+        }
+      } //if don't want to extract boundary cells
+
+    else //want boundary cells
+      {
+      for ( npts=0, i=0; i < numCellPts; i++ )
+        {
+        ptId = cellPts->GetId(i);
+        if ( newScalars->GetValue(ptId) <= 0.0 )
+          {
+          npts++;
+          }
+        }
+      if ( npts > 0 )
+        {
+        for ( i=0; i < numCellPts; i++ )
+          {
+          ptId = cellPts->GetId(i);
+          if ( pointMap[ptId] < 0 )
+            {
+            x = input->GetPoint(ptId);
+            newId = newPts->InsertNextPoint(x);
+            pointMap[ptId] = newId;
+           if(myStoreMapping)
+             myNodeVTK2ObjIds.push_back(ptId);
+            outputPD->CopyData(pd,ptId,newId);
+            }
+          newCellPts->InsertId(i,pointMap[ptId]);
+          }
+        }//a boundary or interior cell
+      }//if mapping boundary cells
+
+    if ( npts >= numCellPts || (this->ExtractBoundaryCells && npts > 0) )
+      {
+      newCellId = output->InsertNextCell(cell->GetCellType(),newCellPts);
+      if(myStoreMapping)
+       myElemVTK2ObjIds.push_back(cellId);
+      outputCD->CopyData(cd,cellId,newCellId);
+      }
+    }//for all cells
+
+  // Update ourselves and release memory
+  //
+  delete [] pointMap;
+  newCellPts->Delete();
+  output->SetPoints(newPts);
+  newPts->Delete();
+
+  if ( this->ExtractBoundaryCells )
+    {
+    newScalars->Delete();
+    }
+
+  output->Squeeze();
+}
+
+
+//----------------------------------------------------------------------------
diff --git a/src/PIPELINE/SALOME_ExtractPolyDataGeometry.h b/src/PIPELINE/SALOME_ExtractPolyDataGeometry.h
new file mode 100644 (file)
index 0000000..ab42be7
--- /dev/null
@@ -0,0 +1,95 @@
+//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+
+#ifndef SALOME_ExtractPolyDataGeometry_H
+#define SALOME_ExtractPolyDataGeometry_H
+
+#include <vtkExtractPolyDataGeometry.h>
+#include <vtkSmartPointer.h>
+
+#include <vector>
+
+class vtkImplicitBoolean;
+
+class SALOME_ExtractPolyDataGeometry : public vtkExtractPolyDataGeometry
+{
+public:
+  vtkTypeMacro(SALOME_ExtractPolyDataGeometry, vtkExtractPolyDataGeometry);
+
+  static 
+  SALOME_ExtractPolyDataGeometry*
+  New();
+
+  virtual
+  void
+  SetImplicitFunction(vtkImplicitFunction* theImplicitFunction); 
+
+  vtkImplicitBoolean* 
+  GetImplicitBoolean();
+
+  bool 
+  GetStoreMapping() const;
+
+  void
+  SetStoreMapping(bool theStoreMapping);
+
+  virtual 
+  vtkIdType 
+  GetNodeObjId(vtkIdType theID);
+
+  virtual
+  vtkIdType
+  GetElemObjId(vtkIdType theID);
+
+  virtual
+  vtkIdType
+  GetNodeVTKId(vtkIdType theID);
+
+  virtual
+  vtkIdType
+  GetElemVTKId(vtkIdType theID);
+
+protected:
+  SALOME_ExtractPolyDataGeometry();
+  ~SALOME_ExtractPolyDataGeometry();
+
+  virtual
+  void
+  Execute();
+
+  void
+  Execute2();
+
+private:
+  bool myStoreMapping;
+  bool myIsDoneShallowCopy;
+
+  typedef std::vector<vtkIdType> TVectorId;
+  TVectorId myElemVTK2ObjIds;
+  TVectorId myNodeVTK2ObjIds;
+
+  vtkSmartPointer<vtkImplicitBoolean> myImplicitBoolean;
+
+  SALOME_ExtractPolyDataGeometry(const SALOME_ExtractPolyDataGeometry&);  // Not implemented.
+  void operator=(const SALOME_ExtractPolyDataGeometry&);  // Not implemented.
+};
+
+#endif
+
+
diff --git a/src/PIPELINE/VISU_ColoredPL.cxx b/src/PIPELINE/VISU_ColoredPL.cxx
new file mode 100644 (file)
index 0000000..2a6f8a5
--- /dev/null
@@ -0,0 +1,306 @@
+//  VISU OBJECT : interactive object for VISU entities implementation
+//
+//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+//
+//
+// File:    VISU_ColoredPL.cxx
+// Author:  Alexey PETROV
+// Module : VISU
+
+
+#include "VISU_ColoredPL.hxx"
+#include "VISU_Extractor.hxx"
+#include "VISU_LookupTable.hxx"
+#include "VISU_MapperHolder.hxx"
+
+#include "VISU_PipeLineUtils.hxx"
+
+
+//----------------------------------------------------------------------------
+VISU_ColoredPL
+::VISU_ColoredPL():
+  myMapperTable(VISU_LookupTable::New()),
+  myBarTable(VISU_LookupTable::New()),
+  myExtractor(VISU_Extractor::New()),
+  myFieldTransform(VISU_FieldTransform::New())
+{
+  myMapperTable->Delete();
+  myMapperTable->SetScale(VTK_SCALE_LINEAR);
+  myMapperTable->SetHueRange(0.667, 0.0);
+
+  myBarTable->Delete();
+  myBarTable->SetScale(VTK_SCALE_LINEAR);
+  myBarTable->SetHueRange(0.667, 0.0);
+
+  myExtractor->Delete();
+
+  myFieldTransform->Delete();
+}
+
+
+VISU_ColoredPL
+::~VISU_ColoredPL()
+{}
+
+
+//----------------------------------------------------------------------------
+void
+VISU_ColoredPL
+::DoShallowCopy(VISU_PipeLine *thePipeLine,
+               bool theIsCopyInput)
+{
+  Superclass::DoShallowCopy(thePipeLine, theIsCopyInput);
+
+  if(VISU_ColoredPL *aPipeLine = dynamic_cast<VISU_ColoredPL*>(thePipeLine)){
+    if(theIsCopyInput)
+      SetScalarRange(aPipeLine->GetScalarRange());
+    SetScalarMode(aPipeLine->GetScalarMode());
+    SetNbColors(aPipeLine->GetNbColors());
+    SetScaling(aPipeLine->GetScaling());
+    SetMapScale(aPipeLine->GetMapScale());
+  }
+}
+
+
+//----------------------------------------------------------------------------
+int
+VISU_ColoredPL
+::GetScalarMode()
+{
+  return myExtractor->GetScalarMode();
+}
+
+void
+VISU_ColoredPL
+::SetScalarMode(int theScalarMode)
+{
+  if(vtkDataSet *anInput = GetInput()){
+    if(anInput->GetPointData()->GetNumberOfArrays()){
+      vtkPointData *aPointData = anInput->GetPointData();
+      if(!aPointData->GetAttribute(vtkDataSetAttributes::VECTORS))
+       if(theScalarMode == 0)
+         return;
+    }else{
+      vtkCellData *aCellData = anInput->GetCellData();
+      if(!aCellData->GetAttribute(vtkDataSetAttributes::VECTORS))
+       if(theScalarMode == 0)
+         return;
+    }
+  }
+
+  myExtractor->SetScalarMode(theScalarMode);
+}
+
+
+//----------------------------------------------------------------------------
+void
+VISU_ColoredPL
+::SetScalarRange(vtkFloatingPointType theRange[2])
+{
+  myFieldTransform->SetScalarRange(theRange);
+  myBarTable->SetRange(theRange);
+}
+
+//----------------------------------------------------------------------------
+vtkFloatingPointType* 
+VISU_ColoredPL
+::GetScalarRange() 
+{
+  return myFieldTransform->GetScalarRange();
+}
+
+//----------------------------------------------------------------------------
+void
+VISU_ColoredPL
+::SetScaling(int theScaling) 
+{
+  myBarTable->SetScale(theScaling);
+  if(theScaling == VTK_SCALE_LOG10)
+    myFieldTransform->SetScalarTransform(&(VISU_FieldTransform::Log10));
+  else
+    myFieldTransform->SetScalarTransform(&(VISU_FieldTransform::Ident));
+}
+
+//----------------------------------------------------------------------------
+int
+VISU_ColoredPL
+::GetScaling() 
+{
+  return myBarTable->GetScale();
+}
+
+//----------------------------------------------------------------------------
+void
+VISU_ColoredPL
+::SetNbColors(int theNbColors) 
+{
+  myMapperTable->SetNumberOfColors(theNbColors);
+  myBarTable->SetNumberOfColors(theNbColors);
+}
+
+int
+VISU_ColoredPL
+::GetNbColors() 
+{
+  return myMapperTable->GetNumberOfColors();
+}
+
+
+//----------------------------------------------------------------------------
+void
+VISU_ColoredPL
+::Init()
+{
+  SetScalarMode(0);
+  SetSourceRange();
+}
+
+//----------------------------------------------------------------------------
+vtkDataSet* 
+VISU_ColoredPL
+::InsertCustomPL()
+{
+  return GetFieldTransformFilter()->GetUnstructuredGridOutput();
+}
+
+
+//----------------------------------------------------------------------------
+void
+VISU_ColoredPL
+::Build() 
+{
+  myExtractor->SetInput(GetClippedInput());
+  myFieldTransform->SetInput(myExtractor->GetOutput());
+
+  GetMapperHolder()->SetLookupTable(GetMapperTable());
+  GetMapper()->SetUseLookupTableScalarRange(true);
+  GetMapper()->SetColorModeToMapScalars();
+  GetMapper()->ScalarVisibilityOn();
+}
+
+
+//----------------------------------------------------------------------------
+void
+VISU_ColoredPL
+::Update() 
+{ 
+  vtkFloatingPointType *aRange = myFieldTransform->GetScalarRange();
+  vtkFloatingPointType aScalarRange[2] = {aRange[0], aRange[1]};
+  if(myBarTable->GetScale() == VTK_SCALE_LOG10)
+    VISU_LookupTable::ComputeLogRange(aRange,aScalarRange);
+  myMapperTable->SetRange(aScalarRange);
+
+  myMapperTable->Build();
+  myBarTable->Build();
+
+  VISU_PipeLine::Update();
+}
+
+
+//----------------------------------------------------------------------------
+unsigned long int
+VISU_ColoredPL
+::GetMemorySize()
+{
+  unsigned long int aSize = Superclass::GetMemorySize();
+
+  if(vtkDataSet* aDataSet = myExtractor->GetInput())
+    aSize = aDataSet->GetActualMemorySize() * 1024;
+  
+  if(vtkDataSet* aDataSet = myFieldTransform->GetInput())
+    aSize += aDataSet->GetActualMemorySize() * 1024;
+  
+  return aSize;
+}
+
+
+//----------------------------------------------------------------------------
+VISU_LookupTable *
+VISU_ColoredPL
+::GetMapperTable()
+{ 
+  return myMapperTable.GetPointer();
+}
+
+
+//----------------------------------------------------------------------------
+VISU_LookupTable*
+VISU_ColoredPL
+::GetBarTable()
+{
+  return myBarTable.GetPointer();
+}
+
+
+//----------------------------------------------------------------------------
+VISU_Extractor*
+VISU_ColoredPL
+::GetExtractorFilter()
+{
+  return myExtractor.GetPointer();
+}
+
+
+//----------------------------------------------------------------------------
+VISU_FieldTransform*
+VISU_ColoredPL
+::GetFieldTransformFilter()
+{
+  return myFieldTransform.GetPointer();
+}
+
+
+//----------------------------------------------------------------------------
+void 
+VISU_ColoredPL
+::SetMapScale(vtkFloatingPointType theMapScale)
+{
+  if(!VISU::CheckIsSameValue(myMapperTable->GetMapScale(), theMapScale)){
+    myMapperTable->SetMapScale(theMapScale);
+    myMapperTable->Build();
+  }
+}
+
+vtkFloatingPointType
+VISU_ColoredPL
+::GetMapScale()
+{
+  return myMapperTable->GetMapScale();
+}
+
+
+//----------------------------------------------------------------------------
+void
+VISU_ColoredPL
+::GetSourceRange(vtkFloatingPointType theRange[2])
+{
+  myExtractor->Update();
+  myExtractor->GetOutput()->GetScalarRange(theRange);
+}
+
+void
+VISU_ColoredPL
+::SetSourceRange()
+{
+  vtkFloatingPointType aRange[2];
+  GetSourceRange(aRange);
+  SetScalarRange(aRange);
+}
diff --git a/src/PIPELINE/VISU_ColoredPL.hxx b/src/PIPELINE/VISU_ColoredPL.hxx
new file mode 100644 (file)
index 0000000..e8a9f02
--- /dev/null
@@ -0,0 +1,155 @@
+//  VISU OBJECT : interactive object for VISU entities implementation
+//
+//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
+// 
+//  This library is free software; you can redistribute it and/or 
+//  modify it under the terms of the GNU Lesser General Public 
+//  License as published by the Free Software Foundation; either 
+//  version 2.1 of the License. 
+// 
+//  This library is distributed in the hope that it will be useful, 
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of 
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
+//  Lesser General Public License for more details. 
+// 
+//  You should have received a copy of the GNU Lesser General Public 
+//  License along with this library; if not, write to the Free Software 
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
+// 
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+//
+//
+// File:    VISU_ColoredPL.hxx
+// Author:  Alexey PETROV
+// Module : VISU
+
+#ifndef VISU_ColoredPL_HeaderFile
+#define VISU_ColoredPL_HeaderFile
+
+#include "VISU_PipeLine.hxx"
+
+#include <vtkSmartPointer.h>
+
+class VISU_Extractor;
+class VISU_FieldTransform;
+class VISU_LookupTable;
+
+
+//----------------------------------------------------------------------------
+class VISU_ColoredPL : public VISU_PipeLine
+{
+public:
+  vtkTypeMacro(VISU_ColoredPL, VISU_PipeLine);
+
+  //----------------------------------------------------------------------------
+  virtual
+  int
+  GetScalarMode();
+
+  virtual
+  void
+  SetScalarMode(int theScalarMode = 0);
+  
+  virtual
+  vtkFloatingPointType* 
+  GetScalarRange();
+
+  virtual
+  void
+  SetScalarRange(vtkFloatingPointType theRange[2]);
+
+  virtual
+  void
+  SetScaling(int theScaling);
+  
+  virtual
+  int
+  GetScaling();
+  
+  virtual
+  void
+  SetNbColors(int theNbColors);
+
+  virtual
+  int
+  GetNbColors();
+  
+  //----------------------------------------------------------------------------
+public:
+  virtual
+  void
+  Init();
+
+  virtual
+  void
+  Update();
+
+  //! Gets memory size used by the instance (bytes).
+  virtual
+  unsigned long int
+  GetMemorySize();
+
+  virtual
+  VISU_LookupTable*
+  GetMapperTable();
+
+  virtual 
+  VISU_LookupTable*
+  GetBarTable();
+
+  virtual 
+  void
+  SetMapScale(vtkFloatingPointType theMapScale = 1.0);
+
+  virtual
+  vtkFloatingPointType
+  GetMapScale();
+
+  virtual
+  void
+  GetSourceRange(vtkFloatingPointType theRange[2]);
+
+  virtual
+  void
+  SetSourceRange();
+
+protected:
+  //----------------------------------------------------------------------------
+  VISU_ColoredPL();
+  VISU_ColoredPL(const VISU_ColoredPL&);
+
+  virtual
+  ~VISU_ColoredPL();
+
+  //----------------------------------------------------------------------------
+  virtual
+  void
+  Build();
+
+  virtual
+  void
+  DoShallowCopy(VISU_PipeLine *thePipeLine,
+               bool theIsCopyInput);
+
+  //----------------------------------------------------------------------------
+  VISU_Extractor* 
+  GetExtractorFilter();
+
+  VISU_FieldTransform* 
+  GetFieldTransformFilter();
+
+  //----------------------------------------------------------------------------
+  virtual 
+  vtkDataSet* 
+  InsertCustomPL();
+
+private:
+  vtkSmartPointer<VISU_LookupTable> myMapperTable;
+  vtkSmartPointer<VISU_LookupTable> myBarTable;
+  vtkSmartPointer<VISU_Extractor> myExtractor;
+  vtkSmartPointer<VISU_FieldTransform> myFieldTransform;
+};
+  
+#endif
diff --git a/src/PIPELINE/VISU_DataSetMapperHolder.cxx b/src/PIPELINE/VISU_DataSetMapperHolder.cxx
new file mode 100644 (file)
index 0000000..7ead8b3
--- /dev/null
@@ -0,0 +1,346 @@
+//  VISU OBJECT : interactive object for VISU entities implementation
+//
+//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+//
+//
+// File:    VISU_DataSetMapperHolder.cxx
+// Author:  Alexey PETROV
+// Module : VISU
+
+
+#include "VISU_DataSetMapperHolder.hxx"
+#include "SALOME_ExtractGeometry.h"
+#include "VISU_LookupTable.hxx"
+
+#include "VISU_PipeLineUtils.hxx"
+
+#include <vtkDataSetMapper.h>
+#include <vtkUnstructuredGrid.h>
+
+#include <vtkPlane.h>
+#include <vtkImplicitBoolean.h>
+#include <vtkImplicitFunction.h>
+#include <vtkImplicitFunctionCollection.h>
+#include <vtkMath.h>
+
+#ifdef _DEBUG_
+static int MYDEBUG = 0;
+#else
+static int MYDEBUG = 0;
+#endif
+
+
+//----------------------------------------------------------------------------
+vtkStandardNewMacro(VISU_DataSetMapperHolder);
+
+
+//----------------------------------------------------------------------------
+VISU_DataSetMapperHolder
+::VISU_DataSetMapperHolder():
+  myExtractGeometry(SALOME_ExtractGeometry::New())
+{
+  if(MYDEBUG) MESSAGE("VISU_DataSetMapperHolder::VISU_DataSetMapperHolder - "<<this);
+
+  // Clipping functionality
+  myExtractGeometry->Delete();
+  myExtractGeometry->SetStoreMapping(true);
+
+  vtkImplicitBoolean* anImplicitBoolean = vtkImplicitBoolean::New();
+  myExtractGeometry->SetImplicitFunction(anImplicitBoolean);
+  anImplicitBoolean->SetOperationTypeToIntersection();
+  anImplicitBoolean->Delete();
+}
+
+
+//----------------------------------------------------------------------------
+VISU_DataSetMapperHolder
+::~VISU_DataSetMapperHolder()
+{
+  if(MYDEBUG)
+    MESSAGE("VISU_DataSetMapperHolder::~VISU_DataSetMapperHolder - "<<this);
+}
+
+
+//----------------------------------------------------------------------------
+void 
+VISU_DataSetMapperHolder
+::ShallowCopy(VISU_MapperHolder *theMapperHolder,
+             bool theIsCopyInput)
+{
+  if(VISU_DataSetMapperHolder* aMapperHolder = dynamic_cast<VISU_DataSetMapperHolder*>(theMapperHolder)){
+    if(theIsCopyInput)
+      SetUnstructuredGridIDMapper(aMapperHolder->GetUnstructuredGridIDMapper());
+    
+    VISU::CopyDataSetMapper(GetDataSetMapper(), 
+                           aMapperHolder->GetDataSetMapper(), 
+                           theIsCopyInput);
+  }
+}
+
+
+//----------------------------------------------------------------------------
+unsigned long int
+VISU_DataSetMapperHolder
+::GetMemorySize()
+{
+  unsigned long int aSize = Superclass::GetMemorySize();
+
+  if(myExtractGeometry->GetInput())
+    if(vtkDataSet* aDataSet = myExtractGeometry->GetOutput())
+      aSize = aDataSet->GetActualMemorySize() * 1024;
+  
+  return aSize;
+}
+
+
+//----------------------------------------------------------------------------
+void
+VISU_DataSetMapperHolder
+::SetUnstructuredGridIDMapper(const VISU::PUnstructuredGridIDMapper& theIDMapper)
+{
+  myExtractGeometry->SetInput(theIDMapper->GetUnstructuredGridOutput());
+  myUnstructuredGridIDMapper = theIDMapper;
+  SetIDMapper(theIDMapper);
+}
+
+
+//----------------------------------------------------------------------------
+const VISU::PUnstructuredGridIDMapper&  
+VISU_DataSetMapperHolder
+::GetUnstructuredGridIDMapper()
+{
+  return myUnstructuredGridIDMapper;
+}
+
+
+//----------------------------------------------------------------------------
+vtkUnstructuredGrid* 
+VISU_DataSetMapperHolder
+::GetUnstructuredGridInput()
+{
+  if(myUnstructuredGridIDMapper)
+    return myUnstructuredGridIDMapper->GetUnstructuredGridOutput();
+
+  return NULL;
+}
+
+
+//----------------------------------------------------------------------------
+vtkDataSet* 
+VISU_DataSetMapperHolder
+::GetClippedInput()
+{
+  vtkUnstructuredGrid* aDataSet = myExtractGeometry->GetOutput();
+  aDataSet->Update();
+  return aDataSet;
+}
+
+
+//----------------------------------------------------------------------------
+void
+VISU_DataSetMapperHolder
+::OnCreateMapper()
+{
+  myDataSetMapper = vtkDataSetMapper::New();
+  myDataSetMapper->Delete();
+  SetMapper(myDataSetMapper.GetPointer());
+}
+
+
+//----------------------------------------------------------------------------
+void
+VISU_DataSetMapperHolder
+::SetDataSetMapper(vtkDataSetMapper* theMapper)
+{
+  myDataSetMapper = theMapper;
+  SetMapper(myDataSetMapper.GetPointer());
+}
+
+
+//----------------------------------------------------------------------------
+vtkDataSetMapper* 
+VISU_DataSetMapperHolder
+::GetDataSetMapper()
+{
+  GetMapper();
+  return myDataSetMapper.GetPointer();
+}
+
+
+//----------------------------------------------------------------------------
+void
+VISU_DataSetMapperHolder
+::SetLookupTable(VISU_LookupTable* theLookupTable)
+{
+  myDataSetMapper->SetLookupTable(theLookupTable);
+}
+
+
+//----------------------------------------------------------------------------
+vtkIdType 
+VISU_DataSetMapperHolder
+::GetNodeObjID(vtkIdType theID)
+{
+  vtkIdType anID = myExtractGeometry->GetNodeObjId(theID);
+  return Superclass::GetNodeObjID(anID);
+}
+
+//----------------------------------------------------------------------------
+vtkIdType 
+VISU_DataSetMapperHolder
+::GetNodeVTKID(vtkIdType theID)
+{
+  vtkIdType anID = Superclass::GetNodeVTKID(theID);
+  return myExtractGeometry->GetNodeVTKId(anID);
+}
+
+//----------------------------------------------------------------------------
+vtkFloatingPointType* 
+VISU_DataSetMapperHolder
+::GetNodeCoord(int theObjID)
+{
+  return Superclass::GetNodeCoord(theObjID);
+}
+
+
+//----------------------------------------------------------------------------
+vtkIdType 
+VISU_DataSetMapperHolder
+::GetElemObjID(vtkIdType theID)
+{
+  vtkIdType anID = myExtractGeometry->GetElemObjId(theID);
+  return Superclass::GetElemObjID(anID);
+}
+
+//----------------------------------------------------------------------------
+vtkIdType
+VISU_DataSetMapperHolder
+::GetElemVTKID(vtkIdType theID)
+{
+  vtkIdType anID = Superclass::GetElemVTKID(theID);
+  return myExtractGeometry->GetElemVTKId(anID);
+}
+
+//----------------------------------------------------------------------------
+vtkCell* 
+VISU_DataSetMapperHolder
+::GetElemCell(vtkIdType  theObjID)
+{
+  return Superclass::GetElemCell(theObjID);
+}
+
+
+//----------------------------------------------------------------------------
+void
+VISU_DataSetMapperHolder
+::SetImplicitFunction(vtkImplicitFunction *theFunction)
+{
+  myExtractGeometry->SetImplicitFunction(theFunction);
+} 
+
+//----------------------------------------------------------------------------
+vtkImplicitFunction * 
+VISU_DataSetMapperHolder
+::GetImplicitFunction()
+{
+  return myExtractGeometry->GetImplicitFunction();
+}
+
+//----------------------------------------------------------------------------
+void
+VISU_DataSetMapperHolder
+::RemoveAllClippingPlanes()
+{
+  if(vtkImplicitBoolean* aBoolean = myExtractGeometry->GetImplicitBoolean()){
+    vtkImplicitFunctionCollection* aFunction = aBoolean->GetFunction();
+    aFunction->RemoveAllItems();
+    aBoolean->Modified(); // VTK bug
+  }
+}
+
+//----------------------------------------------------------------------------
+vtkIdType
+VISU_DataSetMapperHolder
+::GetNumberOfClippingPlanes()
+{
+  if(vtkImplicitBoolean* aBoolean = myExtractGeometry->GetImplicitBoolean()){
+    vtkImplicitFunctionCollection* aFunction = aBoolean->GetFunction();
+    return aFunction->GetNumberOfItems();
+  }
+  return 0;
+}
+
+//----------------------------------------------------------------------------
+bool 
+VISU_DataSetMapperHolder
+::AddClippingPlane(vtkPlane* thePlane)
+{
+  if (thePlane) {
+    if (vtkImplicitBoolean* aBoolean = myExtractGeometry->GetImplicitBoolean()) {
+      vtkImplicitFunctionCollection* aFunction = aBoolean->GetFunction();
+      aFunction->AddItem(thePlane);
+      // Check, that at least one cell present after clipping.
+      // This check was introduced because of bug IPAL8849.
+      vtkDataSet* aClippedDataSet = GetClippedInput();
+      if(aClippedDataSet->GetNumberOfCells() < 1)
+        return false;
+    }
+  }
+  return true;
+}
+
+//----------------------------------------------------------------------------
+vtkPlane* 
+VISU_DataSetMapperHolder
+::GetClippingPlane(vtkIdType theID)
+{
+  vtkPlane* aPlane = NULL;
+  if(theID >= 0 && theID < GetNumberOfClippingPlanes()){
+    if(vtkImplicitBoolean* aBoolean = myExtractGeometry->GetImplicitBoolean()){
+      vtkImplicitFunctionCollection* aFunction = aBoolean->GetFunction();
+      vtkImplicitFunction* aFun = NULL;
+      aFunction->InitTraversal();
+      for(vtkIdType anID = 0; anID <= theID; anID++)
+       aFun = aFunction->GetNextItem();
+      aPlane = dynamic_cast<vtkPlane*>(aFun);
+    }
+  }
+  return aPlane;
+}
+
+//----------------------------------------------------------------------------
+void
+VISU_DataSetMapperHolder
+::SetExtractInside(bool theMode)
+{
+  myExtractGeometry->SetExtractInside(theMode);
+}
+
+//----------------------------------------------------------------------------
+void
+VISU_DataSetMapperHolder
+::SetExtractBoundaryCells(bool theMode)
+{
+  myExtractGeometry->SetExtractBoundaryCells(theMode);
+}
+
+
+//----------------------------------------------------------------------------
diff --git a/src/PIPELINE/VISU_DataSetMapperHolder.hxx b/src/PIPELINE/VISU_DataSetMapperHolder.hxx
new file mode 100644 (file)
index 0000000..a53749f
--- /dev/null
@@ -0,0 +1,165 @@
+//  VISU OBJECT : interactive object for VISU entities implementation
+//
+//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+//
+// File:    VISU_DataSetMapperHolder.hxx
+// Author:  Alexey PETROV
+// Module : VISU
+
+#ifndef VISU_DataSetMapperHolder_HeaderFile
+#define VISU_DataSetMapperHolder_HeaderFile
+
+#include "VISU_MapperHolder.hxx"
+
+class vtkDataSetMapper;
+class vtkUnstructuredGrid;
+class SALOME_ExtractGeometry;
+
+
+//----------------------------------------------------------------------------
+class VISU_DataSetMapperHolder : public VISU_MapperHolder
+{
+public:
+  vtkTypeMacro(VISU_DataSetMapperHolder, VISU_MapperHolder);
+
+  static 
+  VISU_DataSetMapperHolder* 
+  New();
+
+  //----------------------------------------------------------------------------
+  virtual
+  void
+  ShallowCopy(VISU_MapperHolder *theMapperHolder,
+             bool theIsCopyInput);
+
+  //! Gets memory size used by the instance (bytes).
+  virtual
+  unsigned long int
+  GetMemorySize();
+
+  //----------------------------------------------------------------------------
+  void 
+  SetUnstructuredGridIDMapper(const VISU::PUnstructuredGridIDMapper& theIDMapper);
+
+  const VISU::PUnstructuredGridIDMapper&
+  GetUnstructuredGridIDMapper();
+
+  virtual
+  vtkUnstructuredGrid* 
+  GetUnstructuredGridInput();
+
+  virtual 
+  vtkDataSetMapper* 
+  GetDataSetMapper();
+
+  //----------------------------------------------------------------------------
+  virtual
+  vtkIdType
+  GetNodeObjID(vtkIdType theID);
+
+  virtual
+  vtkIdType
+  GetNodeVTKID(vtkIdType theID);
+
+  virtual
+  vtkFloatingPointType* 
+  GetNodeCoord(vtkIdType theObjID);
+
+  virtual
+  vtkIdType
+  GetElemObjID(vtkIdType theID);
+
+  virtual
+  vtkIdType
+  GetElemVTKID(vtkIdType theID);
+
+  virtual
+  vtkCell*
+  GetElemCell(vtkIdType theObjID);
+
+  //----------------------------------------------------------------------------
+  virtual
+  void
+  SetImplicitFunction(vtkImplicitFunction *theFunction);
+
+  virtual
+  vtkImplicitFunction* 
+  GetImplicitFunction();
+
+  virtual
+  void
+  SetExtractInside(bool theMode);
+
+  virtual
+  void
+  SetExtractBoundaryCells(bool theMode);
+
+  //----------------------------------------------------------------------------
+  // Clipping planes
+  virtual
+  void 
+  RemoveAllClippingPlanes();
+
+  virtual
+  vtkIdType
+  GetNumberOfClippingPlanes();
+
+  virtual
+  bool
+  AddClippingPlane(vtkPlane* thePlane);
+
+  virtual
+  vtkPlane* 
+  GetClippingPlane(vtkIdType theID);
+
+protected:
+  //----------------------------------------------------------------------------
+  VISU_DataSetMapperHolder();
+  VISU_DataSetMapperHolder(const VISU_DataSetMapperHolder&);
+
+  virtual
+  ~VISU_DataSetMapperHolder();
+
+  //----------------------------------------------------------------------------
+  virtual
+  void
+  OnCreateMapper();
+
+  void 
+  SetDataSetMapper(vtkDataSetMapper* theMapper);
+
+  //----------------------------------------------------------------------------
+  virtual
+  void
+  SetLookupTable(VISU_LookupTable* theLookupTable);
+
+  virtual
+  vtkDataSet* 
+  GetClippedInput();
+
+private:
+  //----------------------------------------------------------------------------
+  VISU::PUnstructuredGridIDMapper myUnstructuredGridIDMapper;
+  vtkSmartPointer<vtkDataSetMapper> myDataSetMapper;
+  vtkSmartPointer<SALOME_ExtractGeometry> myExtractGeometry; //!< Clipping
+};
+
+#endif
diff --git a/src/PIPELINE/VISU_MapperHolder.cxx b/src/PIPELINE/VISU_MapperHolder.cxx
new file mode 100644 (file)
index 0000000..857daad
--- /dev/null
@@ -0,0 +1,252 @@
+//  VISU OBJECT : interactive object for VISU entities implementation
+//
+//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+//
+//
+// File:    VISU_MapperHolder.cxx
+// Author:  Alexey PETROV
+// Module : VISU
+
+
+#include "VISU_MapperHolder.hxx"
+#include "VISU_PipeLine.hxx"
+
+#include "VISU_PipeLineUtils.hxx"
+
+#include <vtkDataSet.h>
+
+#ifdef _DEBUG_
+static int MYDEBUG = 0;
+#else
+static int MYDEBUG = 0;
+#endif
+
+
+//----------------------------------------------------------------------------
+VISU_MapperHolder
+::VISU_MapperHolder():
+  myPipeLine(NULL)
+{
+  if(MYDEBUG) 
+    MESSAGE("VISU_MapperHolder::VISU_MapperHolder - "<<this);
+}
+
+
+//----------------------------------------------------------------------------
+VISU_MapperHolder
+::~VISU_MapperHolder()
+{
+  if(MYDEBUG)
+    MESSAGE("VISU_MapperHolder::~VISU_MapperHolder - "<<this);
+}
+
+
+//----------------------------------------------------------------------------
+void 
+VISU_MapperHolder
+::ShallowCopy(VISU_MapperHolder *theMapperHolder,
+             bool theIsCopyInput)
+{
+  if(theIsCopyInput)
+    SetIDMapper(theMapperHolder->GetIDMapper());
+
+  VISU::CopyMapper(GetMapper(), 
+                  theMapperHolder->GetMapper(), 
+                  theIsCopyInput);
+}
+
+
+//----------------------------------------------------------------------------
+unsigned long int
+VISU_MapperHolder
+::GetMemorySize()
+{
+  unsigned long int aSize = 0;
+
+  if(myMapper.GetPointer())
+    if(vtkDataSet* aDataSet = myMapper->GetInput())
+      aSize = aDataSet->GetActualMemorySize() * 1024;
+  
+  if(myIDMapper)
+    aSize += myIDMapper->GetMemorySize();
+  
+  return aSize;
+}
+
+
+//----------------------------------------------------------------------------
+unsigned long int 
+VISU_MapperHolder
+::GetMTime()
+{
+  unsigned long int aTime = Superclass::GetMTime();
+
+  if(myIDMapper)
+    if(vtkDataSet* aDataSet = myIDMapper->GetOutput())
+      aTime = std::max(aTime, aDataSet->GetMTime());
+
+  if(myMapper.GetPointer())
+    aTime = std::max(aTime, myMapper->GetMTime());
+
+  return aTime;
+}
+
+
+//----------------------------------------------------------------------------
+void
+VISU_MapperHolder
+::SetPipeLine(VISU_PipeLine* thePipeLine)
+{
+  myPipeLine = thePipeLine;
+}
+
+
+//----------------------------------------------------------------------------
+void
+VISU_MapperHolder
+::SetIDMapper(const VISU::PIDMapper& theIDMapper)
+{
+  myIDMapper = theIDMapper;
+
+  if(myPipeLine && GetInput())
+    if(!GetMapper()->GetInput()){
+      myPipeLine->Build();
+      myPipeLine->Init();
+      myPipeLine->Update();
+    }
+}
+
+
+//----------------------------------------------------------------------------
+const VISU::PIDMapper&  
+VISU_MapperHolder
+::GetIDMapper()
+{
+  return myIDMapper;
+}
+
+
+//----------------------------------------------------------------------------
+vtkDataSet* 
+VISU_MapperHolder
+::GetInput()
+{
+  if(myIDMapper)
+    return myIDMapper->GetOutput();
+
+  return NULL;
+}
+
+
+//----------------------------------------------------------------------------
+vtkMapper* 
+VISU_MapperHolder
+::GetMapper()
+{
+  if(!myMapper.GetPointer())
+    OnCreateMapper();
+
+  return myMapper.GetPointer();
+}
+
+
+//----------------------------------------------------------------------------
+vtkDataSet* 
+VISU_MapperHolder
+::GetOutput()
+{
+  if(myMapper.GetPointer())
+    return myMapper->GetInput();
+
+  return NULL;
+}
+
+
+//----------------------------------------------------------------------------
+void 
+VISU_MapperHolder
+::Update()
+{
+  if(myMapper.GetPointer())
+    return myMapper->Update();
+}
+
+
+//----------------------------------------------------------------------------
+void
+VISU_MapperHolder
+::SetMapper(vtkMapper* theMapper)
+{
+  myMapper = theMapper;
+}
+
+
+//----------------------------------------------------------------------------
+vtkIdType 
+VISU_MapperHolder
+::GetNodeObjID(vtkIdType theID)
+{
+  return myIDMapper->GetNodeObjID(theID);
+}
+
+//----------------------------------------------------------------------------
+vtkIdType 
+VISU_MapperHolder
+::GetNodeVTKID(vtkIdType theID)
+{
+  return myIDMapper->GetNodeVTKID(theID);
+}
+
+//----------------------------------------------------------------------------
+vtkFloatingPointType* 
+VISU_MapperHolder
+::GetNodeCoord(vtkIdType theObjID)
+{
+  return myIDMapper->GetNodeCoord(theObjID);
+}
+
+
+//----------------------------------------------------------------------------
+vtkIdType 
+VISU_MapperHolder
+::GetElemObjID(vtkIdType theID)
+{
+  return myIDMapper->GetElemObjID(theID);
+}
+
+//----------------------------------------------------------------------------
+vtkIdType
+VISU_MapperHolder
+::GetElemVTKID(vtkIdType theID)
+{
+  return myIDMapper->GetElemVTKID(theID);
+}
+
+//----------------------------------------------------------------------------
+vtkCell* 
+VISU_MapperHolder
+::GetElemCell(vtkIdType  theObjID)
+{
+  return myIDMapper->GetElemCell(theObjID);
+}
+
+
+//----------------------------------------------------------------------------
diff --git a/src/PIPELINE/VISU_MapperHolder.hxx b/src/PIPELINE/VISU_MapperHolder.hxx
new file mode 100644 (file)
index 0000000..22ea018
--- /dev/null
@@ -0,0 +1,186 @@
+//  VISU OBJECT : interactive object for VISU entities implementation
+//
+//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+//
+// File:    VISU_MapperHolder.hxx
+// Author:  Alexey PETROV
+// Module : VISU
+
+#ifndef VISU_MapperHolder_HeaderFile
+#define VISU_MapperHolder_HeaderFile
+
+#include "VISU_IDMapper.hxx"
+
+#include <vtkObject.h>
+#include <vtkSmartPointer.h>
+
+class vtkCell;
+class vtkPlane;
+class vtkMapper;
+class vtkDataSet;
+class vtkPointSet;
+class vtkImplicitFunction;
+
+class VISU_PipeLine;
+class VISU_LookupTable;
+
+
+//----------------------------------------------------------------------------
+class VISU_MapperHolder : public vtkObject
+{
+public:
+  vtkTypeMacro(VISU_MapperHolder, vtkObject);
+
+  //----------------------------------------------------------------------------
+  virtual
+  void
+  ShallowCopy(VISU_MapperHolder *theMapperHolder,
+             bool theIsCopyInput);
+
+  //! Gets memory size used by the instance (bytes).
+  virtual
+  unsigned long int
+  GetMemorySize();
+
+  virtual
+  unsigned long int 
+  GetMTime();
+
+  //----------------------------------------------------------------------------
+  void
+  SetPipeLine(VISU_PipeLine* thePipeLine);
+
+  const VISU::PIDMapper&  
+  GetIDMapper();
+
+  virtual
+  vtkDataSet* 
+  GetInput();
+
+  virtual 
+  vtkMapper* 
+  GetMapper();
+
+  virtual
+  vtkDataSet* 
+  GetOutput();
+
+  virtual
+  void
+  Update();
+
+  //----------------------------------------------------------------------------
+  virtual
+  vtkIdType
+  GetNodeObjID(vtkIdType theID);
+
+  virtual
+  vtkIdType
+  GetNodeVTKID(vtkIdType theID);
+
+  virtual
+  vtkFloatingPointType* 
+  GetNodeCoord(vtkIdType theObjID);
+
+  virtual
+  vtkIdType
+  GetElemObjID(vtkIdType theID);
+
+  virtual
+  vtkIdType
+  GetElemVTKID(vtkIdType theID);
+
+  virtual
+  vtkCell*
+  GetElemCell(vtkIdType theObjID);
+
+  //----------------------------------------------------------------------------
+  virtual
+  void
+  SetImplicitFunction(vtkImplicitFunction *theFunction) = 0;
+
+  virtual
+  vtkImplicitFunction* 
+  GetImplicitFunction() = 0;
+
+  //----------------------------------------------------------------------------
+  // Clipping planes
+  virtual
+  void 
+  RemoveAllClippingPlanes() = 0;
+
+  virtual
+  vtkIdType
+  GetNumberOfClippingPlanes() = 0;
+
+  virtual
+  bool
+  AddClippingPlane(vtkPlane* thePlane) = 0;
+
+  virtual
+  vtkPlane* 
+  GetClippingPlane(vtkIdType theID) = 0;
+
+  //----------------------------------------------------------------------------
+  virtual
+  void
+  SetLookupTable(VISU_LookupTable* theLookupTable) = 0;
+
+  virtual
+  vtkDataSet* 
+  GetClippedInput() = 0;
+
+  //----------------------------------------------------------------------------
+  virtual
+  void
+  SetExtractInside(bool theMode) = 0;
+
+  virtual
+  void
+  SetExtractBoundaryCells(bool theMode) = 0;
+
+protected:
+  //----------------------------------------------------------------------------
+  VISU_MapperHolder();
+  VISU_MapperHolder(const VISU_MapperHolder&);
+
+  virtual
+  ~VISU_MapperHolder();
+
+  //----------------------------------------------------------------------------
+  virtual
+  void
+  OnCreateMapper() = 0;
+
+  void 
+  SetMapper(vtkMapper* theMapper);
+
+  void 
+  SetIDMapper(const VISU::PIDMapper& theIDMapper);
+
+private:
+  //----------------------------------------------------------------------------
+  vtkSmartPointer<vtkMapper> myMapper;
+  VISU::PIDMapper myIDMapper;
+  VISU_PipeLine* myPipeLine;
+};
+
+#endif
diff --git a/src/PIPELINE/VISU_PointSpriteMapperHolder.cxx b/src/PIPELINE/VISU_PointSpriteMapperHolder.cxx
new file mode 100644 (file)
index 0000000..69c9be2
--- /dev/null
@@ -0,0 +1,122 @@
+//  VISU OBJECT : interactive object for VISU entities implementation
+//
+//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+//
+//
+// File:    VISU_PointSpriteMapperHolder.cxx
+// Author:  Alexey PETROV
+// Module : VISU
+
+
+#include "VISU_PointSpriteMapperHolder.hxx"
+#include "VISU_OpenGLPointSpriteMapper.hxx"
+
+#include "VISU_PipeLineUtils.hxx"
+
+#ifdef _DEBUG_
+static int MYDEBUG = 0;
+#else
+static int MYDEBUG = 0;
+#endif
+
+
+//----------------------------------------------------------------------------
+vtkStandardNewMacro(VISU_PointSpriteMapperHolder);
+
+
+//----------------------------------------------------------------------------
+VISU_PointSpriteMapperHolder
+::VISU_PointSpriteMapperHolder()
+{
+  if(MYDEBUG)
+    MESSAGE("VISU_PointSpriteMapperHolder::VISU_PointSpriteMapperHolder - "<<this);
+}
+
+
+//----------------------------------------------------------------------------
+VISU_PointSpriteMapperHolder
+::~VISU_PointSpriteMapperHolder()
+{
+  if(MYDEBUG)
+    MESSAGE("VISU_PointSpriteMapperHolder::~VISU_PointSpriteMapperHolder - "<<this);
+}
+
+
+//----------------------------------------------------------------------------
+void 
+VISU_PointSpriteMapperHolder
+::ShallowCopy(VISU_MapperHolder *theMapperHolder,
+             bool theIsCopyInput)
+{
+  if(VISU_PointSpriteMapperHolder* aMapperHolder = dynamic_cast<VISU_PointSpriteMapperHolder*>(theMapperHolder)){
+    if(theIsCopyInput)
+      SetGaussPtsIDMapper(aMapperHolder->GetGaussPtsIDMapper());
+    
+    VISU::CopyPointSpriteDataMapper(GetPointSpriteMapper(), 
+                                   aMapperHolder->GetPointSpriteMapper(), 
+                                   theIsCopyInput);
+  }
+}
+
+
+//----------------------------------------------------------------------------
+void
+VISU_PointSpriteMapperHolder
+::SetGaussPtsIDMapper(const VISU::PGaussPtsIDMapper& theIDMapper)
+{
+  myGaussPtsIDMapper = theIDMapper;
+  SetPolyDataIDMapper(theIDMapper);
+}
+
+
+//----------------------------------------------------------------------------
+const VISU::PGaussPtsIDMapper&  
+VISU_PointSpriteMapperHolder
+::GetGaussPtsIDMapper()
+{
+  return myGaussPtsIDMapper;
+}
+
+
+//----------------------------------------------------------------------------
+void
+VISU_PointSpriteMapperHolder
+::OnCreateMapper()
+{
+  myPointSpriteMapper = VISU_OpenGLPointSpriteMapper::New();
+  myPointSpriteMapper->Delete();
+  myPointSpriteMapper->SetColorModeToMapScalars();
+  myPointSpriteMapper->ScalarVisibilityOn();
+  SetPolyDataMapper(myPointSpriteMapper.GetPointer());
+}
+
+
+//----------------------------------------------------------------------------
+VISU_OpenGLPointSpriteMapper* 
+VISU_PointSpriteMapperHolder
+::GetPointSpriteMapper()
+{
+  GetMapper();
+  return myPointSpriteMapper.GetPointer();
+}
+
+
+//----------------------------------------------------------------------------
diff --git a/src/PIPELINE/VISU_PointSpriteMapperHolder.hxx b/src/PIPELINE/VISU_PointSpriteMapperHolder.hxx
new file mode 100644 (file)
index 0000000..9aedbc6
--- /dev/null
@@ -0,0 +1,81 @@
+//  VISU OBJECT : interactive object for VISU entities implementation
+//
+//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+//
+// File:    VISU_PointSpriteMapperHolder.hxx
+// Author:  Alexey PETROV
+// Module : VISU
+
+#ifndef VISU_PointSpriteMapperHolder_HeaderFile
+#define VISU_PointSpriteMapperHolder_HeaderFile
+
+#include "VISU_PolyDataMapperHolder.hxx"
+
+class VISU_OpenGLPointSpriteMapper;
+
+
+//----------------------------------------------------------------------------
+class VISU_PointSpriteMapperHolder : public VISU_PolyDataMapperHolder
+{
+public:
+  vtkTypeMacro(VISU_PointSpriteMapperHolder, VISU_PolyDataMapperHolder);
+
+  static 
+  VISU_PointSpriteMapperHolder* 
+  New();
+
+  //----------------------------------------------------------------------------
+  virtual
+  void
+  ShallowCopy(VISU_MapperHolder *theMapperHolder,
+             bool theIsCopyInput);
+
+  //----------------------------------------------------------------------------
+  void 
+  SetGaussPtsIDMapper(const VISU::PGaussPtsIDMapper& theGaussPtsIDMapper);
+
+  const VISU::PGaussPtsIDMapper&
+  GetGaussPtsIDMapper();
+
+  virtual 
+  VISU_OpenGLPointSpriteMapper* 
+  GetPointSpriteMapper();
+
+protected:
+  //----------------------------------------------------------------------------
+  VISU_PointSpriteMapperHolder();
+  VISU_PointSpriteMapperHolder(const VISU_PointSpriteMapperHolder&);
+
+  virtual
+  ~VISU_PointSpriteMapperHolder();
+
+  //----------------------------------------------------------------------------
+  virtual
+  void
+  OnCreateMapper();
+
+private:
+  //----------------------------------------------------------------------------
+  VISU::PGaussPtsIDMapper myGaussPtsIDMapper;
+  vtkSmartPointer<VISU_OpenGLPointSpriteMapper> myPointSpriteMapper;
+};
+
+#endif
diff --git a/src/PIPELINE/VISU_PolyDataMapperHolder.cxx b/src/PIPELINE/VISU_PolyDataMapperHolder.cxx
new file mode 100644 (file)
index 0000000..2045f71
--- /dev/null
@@ -0,0 +1,346 @@
+//  VISU OBJECT : interactive object for VISU entities implementation
+//
+//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+//
+//
+// File:    VISU_PolyDataMapperHolder.cxx
+// Author:  Alexey PETROV
+// Module : VISU
+
+
+#include "VISU_PolyDataMapperHolder.hxx"
+#include "SALOME_ExtractPolyDataGeometry.h"
+#include "VISU_LookupTable.hxx"
+
+#include "VISU_PipeLineUtils.hxx"
+
+#include <vtkPolyDataMapper.h>
+#include <vtkPolyData.h>
+
+#include <vtkPlane.h>
+#include <vtkImplicitBoolean.h>
+#include <vtkImplicitFunction.h>
+#include <vtkImplicitFunctionCollection.h>
+#include <vtkMath.h>
+
+#ifdef _DEBUG_
+static int MYDEBUG = 0;
+#else
+static int MYDEBUG = 0;
+#endif
+
+
+//----------------------------------------------------------------------------
+vtkStandardNewMacro(VISU_PolyDataMapperHolder);
+
+
+//----------------------------------------------------------------------------
+VISU_PolyDataMapperHolder
+::VISU_PolyDataMapperHolder():
+  myExtractPolyDataGeometry(SALOME_ExtractPolyDataGeometry::New())
+{
+  if(MYDEBUG) MESSAGE("VISU_PolyDataMapperHolder::VISU_PolyDataMapperHolder - "<<this);
+
+  // Clipping functionality
+  myExtractPolyDataGeometry->Delete();
+  myExtractPolyDataGeometry->SetStoreMapping(true);
+
+  vtkImplicitBoolean* anImplicitBoolean = vtkImplicitBoolean::New();
+  myExtractPolyDataGeometry->SetImplicitFunction(anImplicitBoolean);
+  anImplicitBoolean->SetOperationTypeToIntersection();
+  anImplicitBoolean->Delete();
+}
+
+
+//----------------------------------------------------------------------------
+VISU_PolyDataMapperHolder
+::~VISU_PolyDataMapperHolder()
+{
+  if(MYDEBUG)
+    MESSAGE("VISU_PolyDataMapperHolder::~VISU_PolyDataMapperHolder - "<<this);
+}
+
+
+//----------------------------------------------------------------------------
+void 
+VISU_PolyDataMapperHolder
+::ShallowCopy(VISU_MapperHolder *theMapperHolder,
+             bool theIsCopyInput)
+{
+  if(VISU_PolyDataMapperHolder* aMapperHolder = dynamic_cast<VISU_PolyDataMapperHolder*>(theMapperHolder)){
+    if(theIsCopyInput)
+      SetPolyDataIDMapper(aMapperHolder->GetPolyDataIDMapper());
+    
+    VISU::CopyPolyDataMapper(GetPolyDataMapper(), 
+                            aMapperHolder->GetPolyDataMapper(), 
+                            theIsCopyInput);
+  }
+}
+
+
+//----------------------------------------------------------------------------
+unsigned long int
+VISU_PolyDataMapperHolder
+::GetMemorySize()
+{
+  unsigned long int aSize = Superclass::GetMemorySize();
+
+  if(myExtractPolyDataGeometry->GetInput())
+    if(vtkDataSet* aDataSet = myExtractPolyDataGeometry->GetOutput())
+      aSize = aDataSet->GetActualMemorySize() * 1024;
+
+  return aSize;
+}
+
+
+//----------------------------------------------------------------------------
+void
+VISU_PolyDataMapperHolder
+::SetPolyDataIDMapper(const VISU::PPolyDataIDMapper& theIDMapper)
+{
+  myExtractPolyDataGeometry->SetInput(theIDMapper->GetPolyDataOutput());
+  myPolyDataIDMapper = theIDMapper;
+  SetIDMapper(theIDMapper);
+}
+
+
+//----------------------------------------------------------------------------
+const VISU::PPolyDataIDMapper&  
+VISU_PolyDataMapperHolder
+::GetPolyDataIDMapper()
+{
+  return myPolyDataIDMapper;
+}
+
+
+//----------------------------------------------------------------------------
+vtkPolyData* 
+VISU_PolyDataMapperHolder
+::GetPolyDataInput()
+{
+  if(myPolyDataIDMapper)
+    return myPolyDataIDMapper->GetPolyDataOutput();
+
+  return NULL;
+}
+
+
+//----------------------------------------------------------------------------
+vtkDataSet* 
+VISU_PolyDataMapperHolder
+::GetClippedInput()
+{
+  vtkPolyData* aDataSet = myExtractPolyDataGeometry->GetOutput();
+  aDataSet->Update();
+  return aDataSet;
+}
+
+
+//----------------------------------------------------------------------------
+void
+VISU_PolyDataMapperHolder
+::OnCreateMapper()
+{
+  myPolyDataMapper = vtkPolyDataMapper::New();
+  myPolyDataMapper->Delete();
+  SetMapper(myPolyDataMapper.GetPointer());
+}
+
+
+//----------------------------------------------------------------------------
+void
+VISU_PolyDataMapperHolder
+::SetPolyDataMapper(vtkPolyDataMapper* theMapper)
+{
+  myPolyDataMapper = theMapper;
+  SetMapper(myPolyDataMapper.GetPointer());
+}
+
+
+//----------------------------------------------------------------------------
+vtkPolyDataMapper* 
+VISU_PolyDataMapperHolder
+::GetPolyDataMapper()
+{
+  GetMapper();
+  return myPolyDataMapper.GetPointer();
+}
+
+
+//----------------------------------------------------------------------------
+void
+VISU_PolyDataMapperHolder
+::SetLookupTable(VISU_LookupTable* theLookupTable)
+{
+  myPolyDataMapper->SetLookupTable(theLookupTable);
+}
+
+
+//----------------------------------------------------------------------------
+vtkIdType 
+VISU_PolyDataMapperHolder
+::GetNodeObjID(vtkIdType theID)
+{
+  vtkIdType anID = myExtractPolyDataGeometry->GetNodeObjId(theID);
+  return Superclass::GetNodeObjID(anID);
+}
+
+//----------------------------------------------------------------------------
+vtkIdType 
+VISU_PolyDataMapperHolder
+::GetNodeVTKID(vtkIdType theID)
+{
+  vtkIdType anID = Superclass::GetNodeVTKID(theID);
+  return myExtractPolyDataGeometry->GetNodeVTKId(anID);
+}
+
+//----------------------------------------------------------------------------
+vtkFloatingPointType* 
+VISU_PolyDataMapperHolder
+::GetNodeCoord(vtkIdType theObjID)
+{
+  return Superclass::GetNodeCoord(theObjID);
+}
+
+
+//----------------------------------------------------------------------------
+vtkIdType 
+VISU_PolyDataMapperHolder
+::GetElemObjID(vtkIdType theID)
+{
+  vtkIdType anID = myExtractPolyDataGeometry->GetElemObjId(theID);
+  return Superclass::GetElemObjID(anID);
+}
+
+//----------------------------------------------------------------------------
+vtkIdType
+VISU_PolyDataMapperHolder
+::GetElemVTKID(vtkIdType theID)
+{
+  vtkIdType anID = Superclass::GetElemVTKID(theID);
+  return myExtractPolyDataGeometry->GetElemVTKId(anID);
+}
+
+//----------------------------------------------------------------------------
+vtkCell* 
+VISU_PolyDataMapperHolder
+::GetElemCell(vtkIdType  theObjID)
+{
+  return Superclass::GetElemCell(theObjID);
+}
+
+
+//------------------------ Clipping planes -----------------------------------
+bool 
+VISU_PolyDataMapperHolder
+::AddClippingPlane(vtkPlane* thePlane)
+{
+  if (thePlane) {
+    if (vtkImplicitBoolean* aBoolean = myExtractPolyDataGeometry->GetImplicitBoolean()) {
+      vtkImplicitFunctionCollection* aFunction = aBoolean->GetFunction();
+      aFunction->AddItem(thePlane);
+      // Check, that at least one cell present after clipping.
+      // This check was introduced because of bug IPAL8849.
+      vtkDataSet* aClippedDataSet = GetClippedInput();
+      if(aClippedDataSet->GetNumberOfCells() < 1)
+        return false;
+    }
+  }
+  return true;
+}
+
+//----------------------------------------------------------------------------
+vtkPlane* 
+VISU_PolyDataMapperHolder
+::GetClippingPlane(vtkIdType theID)
+{
+  vtkPlane* aPlane = NULL;
+  if(theID >= 0 && theID < GetNumberOfClippingPlanes()){
+    if(vtkImplicitBoolean* aBoolean = myExtractPolyDataGeometry->GetImplicitBoolean()){
+      vtkImplicitFunctionCollection* aFunction = aBoolean->GetFunction();
+      vtkImplicitFunction* aFun = NULL;
+      aFunction->InitTraversal();
+      for(vtkIdType anID = 0; anID <= theID; anID++)
+       aFun = aFunction->GetNextItem();
+      aPlane = dynamic_cast<vtkPlane*>(aFun);
+    }
+  }
+  return aPlane;
+}
+
+//----------------------------------------------------------------------------
+void
+VISU_PolyDataMapperHolder
+::RemoveAllClippingPlanes()
+{
+  if(vtkImplicitBoolean* aBoolean = myExtractPolyDataGeometry->GetImplicitBoolean()){
+    vtkImplicitFunctionCollection* aFunction = aBoolean->GetFunction();
+    aFunction->RemoveAllItems();
+    aBoolean->Modified(); // VTK bug
+  }
+}
+
+//----------------------------------------------------------------------------
+vtkIdType
+VISU_PolyDataMapperHolder
+::GetNumberOfClippingPlanes()
+{
+  if(vtkImplicitBoolean* aBoolean = myExtractPolyDataGeometry->GetImplicitBoolean()){
+    vtkImplicitFunctionCollection* aFunction = aBoolean->GetFunction();
+    return aFunction->GetNumberOfItems();
+  }
+  return 0;
+}
+
+//----------------------------------------------------------------------------
+void
+VISU_PolyDataMapperHolder
+::SetImplicitFunction(vtkImplicitFunction *theFunction)
+{
+  myExtractPolyDataGeometry->SetImplicitFunction(theFunction);
+} 
+
+//----------------------------------------------------------------------------
+vtkImplicitFunction* 
+VISU_PolyDataMapperHolder
+::GetImplicitFunction()
+{
+  return myExtractPolyDataGeometry->GetImplicitFunction();
+}
+
+//----------------------------------------------------------------------------
+void
+VISU_PolyDataMapperHolder
+::SetExtractInside(bool theMode)
+{
+  myExtractPolyDataGeometry->SetExtractInside(theMode);
+}
+
+//----------------------------------------------------------------------------
+void
+VISU_PolyDataMapperHolder
+::SetExtractBoundaryCells(bool theMode)
+{
+  myExtractPolyDataGeometry->SetExtractBoundaryCells(theMode);
+}
+
+
+//----------------------------------------------------------------------------
diff --git a/src/PIPELINE/VISU_PolyDataMapperHolder.hxx b/src/PIPELINE/VISU_PolyDataMapperHolder.hxx
new file mode 100644 (file)
index 0000000..077dd91
--- /dev/null
@@ -0,0 +1,165 @@
+//  VISU OBJECT : interactive object for VISU entities implementation
+//
+//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+//
+// File:    VISU_PolyDataMapperHolder.hxx
+// Author:  Alexey PETROV
+// Module : VISU
+
+#ifndef VISU_PolyDataMapperHolder_HeaderFile
+#define VISU_PolyDataMapperHolder_HeaderFile
+
+#include "VISU_MapperHolder.hxx"
+
+class vtkPolyDataMapper;
+class vtkPolyData;
+class SALOME_ExtractPolyDataGeometry;
+
+
+//----------------------------------------------------------------------------
+class VISU_PolyDataMapperHolder : public VISU_MapperHolder
+{
+public:
+  vtkTypeMacro(VISU_PolyDataMapperHolder, VISU_MapperHolder);
+
+  static 
+  VISU_PolyDataMapperHolder* 
+  New();
+
+  //----------------------------------------------------------------------------
+  virtual
+  void
+  ShallowCopy(VISU_MapperHolder *theMapperHolder,
+             bool theIsCopyInput);
+
+  //! Gets memory size used by the instance (bytes).
+  virtual
+  unsigned long int
+  GetMemorySize();
+
+  //----------------------------------------------------------------------------
+  void 
+  SetPolyDataIDMapper(const VISU::PPolyDataIDMapper& theIDMapper);
+
+  const VISU::PPolyDataIDMapper&
+  GetPolyDataIDMapper();
+
+  virtual
+  vtkPolyData* 
+  GetPolyDataInput();
+
+  virtual 
+  vtkPolyDataMapper* 
+  GetPolyDataMapper();
+
+  //----------------------------------------------------------------------------
+  virtual
+  vtkIdType
+  GetNodeObjID(vtkIdType theID);
+
+  virtual
+  vtkIdType
+  GetNodeVTKID(vtkIdType theID);
+
+  virtual
+  vtkFloatingPointType* 
+  GetNodeCoord(vtkIdType theObjID);
+
+  virtual
+  vtkIdType
+  GetElemObjID(vtkIdType theID);
+
+  virtual
+  vtkIdType
+  GetElemVTKID(vtkIdType theID);
+
+  virtual
+  vtkCell*
+  GetElemCell(vtkIdType theObjID);
+
+  //----------------------------------------------------------------------------
+  virtual
+  void
+  SetImplicitFunction(vtkImplicitFunction *theFunction);
+
+  virtual
+  vtkImplicitFunction* 
+  GetImplicitFunction();
+
+  virtual
+  void
+  SetExtractInside(bool theMode);
+
+  virtual
+  void
+  SetExtractBoundaryCells(bool theMode);
+
+  //----------------------------------------------------------------------------
+  // Clipping planes
+  virtual
+  void 
+  RemoveAllClippingPlanes();
+
+  virtual
+  vtkIdType
+  GetNumberOfClippingPlanes();
+
+  virtual
+  bool
+  AddClippingPlane(vtkPlane* thePlane);
+
+  virtual
+  vtkPlane* 
+  GetClippingPlane(vtkIdType theID);
+
+protected:
+  //----------------------------------------------------------------------------
+  VISU_PolyDataMapperHolder();
+  VISU_PolyDataMapperHolder(const VISU_PolyDataMapperHolder&);
+
+  virtual
+  ~VISU_PolyDataMapperHolder();
+
+  //----------------------------------------------------------------------------
+  virtual
+  void
+  OnCreateMapper();
+
+  void 
+  SetPolyDataMapper(vtkPolyDataMapper* theMapper);
+
+  //----------------------------------------------------------------------------
+  virtual
+  void
+  SetLookupTable(VISU_LookupTable* theLookupTable);
+
+  virtual
+  vtkDataSet* 
+  GetClippedInput();
+
+private:
+  //----------------------------------------------------------------------------
+  VISU::PPolyDataIDMapper myPolyDataIDMapper;
+  vtkSmartPointer<vtkPolyDataMapper> myPolyDataMapper;
+  vtkSmartPointer<SALOME_ExtractPolyDataGeometry> myExtractPolyDataGeometry; //!< Clipping
+};
+
+#endif
diff --git a/src/PIPELINE/VISU_PolyDataPL.cxx b/src/PIPELINE/VISU_PolyDataPL.cxx
new file mode 100644 (file)
index 0000000..a10d93d
--- /dev/null
@@ -0,0 +1,331 @@
+//  VISU OBJECT : interactive object for VISU entities implementation
+//
+//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+//
+//
+// File:    VISU_PolyDataPL.cxx
+// Author:  Alexey PETROV
+// Module : VISU
+
+
+#include "VISU_PolyDataPL.hxx"
+#include "SALOME_ExtractPolyDataGeometry.h"
+
+#include "VISU_PipeLineUtils.hxx"
+
+#include <float.h>
+#include <algorithm>
+
+#include <vtkPolyDataMapper.h>
+#include <vtkPolyData.h>
+
+#include <vtkPlane.h>
+#include <vtkImplicitBoolean.h>
+#include <vtkImplicitFunction.h>
+#include <vtkImplicitFunctionCollection.h>
+#include <vtkMath.h>
+
+#ifdef _DEBUG_
+static int MYDEBUG = 0;
+#else
+static int MYDEBUG = 0;
+#endif
+
+//----------------------------------------------------------------------------
+VISU_PolyDataPL
+::VISU_PolyDataPL():
+  myExtractPolyDataGeometry(SALOME_ExtractPolyDataGeometry::New())
+{
+  if(MYDEBUG) MESSAGE("VISU_PolyDataPL::VISU_PolyDataPL - "<<this);
+
+  SetIsShrinkable(true);
+
+  // Clipping functionality
+  myExtractPolyDataGeometry->Delete();
+  myExtractPolyDataGeometry->SetStoreMapping(true);
+
+  vtkImplicitBoolean* anImplicitBoolean = vtkImplicitBoolean::New();
+  myExtractPolyDataGeometry->SetImplicitFunction(anImplicitBoolean);
+  anImplicitBoolean->SetOperationTypeToIntersection();
+  anImplicitBoolean->Delete();
+}
+
+
+//----------------------------------------------------------------------------
+VISU_PolyDataPL
+::~VISU_PolyDataPL()
+{
+  if(MYDEBUG)
+    MESSAGE("VISU_PolyDataPL::~VISU_PolyDataPL - "<<this);
+}
+
+
+//----------------------------------------------------------------------------
+void
+VISU_PolyDataPL
+::SetPolyDataIDMapper(const VISU::PPolyDataIDMapper& theIDMapper)
+{
+  myExtractPolyDataGeometry->SetInput(theIDMapper->GetPolyDataOutput());
+  myPolyDataIDMapper = theIDMapper;
+  SetIDMapper(theIDMapper);
+}
+
+
+//----------------------------------------------------------------------------
+const VISU::PPolyDataIDMapper&  
+VISU_PolyDataPL
+::GetPolyDataIDMapper() const
+{
+  return myPolyDataIDMapper;
+}
+
+
+//----------------------------------------------------------------------------
+vtkPolyData* 
+VISU_PolyDataPL
+::GetPolyDataInput()
+{
+  if(myPolyDataIDMapper)
+    return myPolyDataIDMapper->GetPolyDataOutput();
+
+  return NULL;
+}
+
+
+//----------------------------------------------------------------------------
+vtkPointSet* 
+VISU_PolyDataPL
+::GetClippedInput() const
+{
+  vtkPolyData* aDataSet = myExtractPolyDataGeometry->GetOutput();
+  aDataSet->Update();
+  return aDataSet;
+}
+
+
+//----------------------------------------------------------------------------
+void
+VISU_PolyDataPL
+::OnCreateMapper()
+{
+  myPolyDataMapper = vtkPolyDataMapper::New();
+  myPolyDataMapper->Delete();
+  SetMapper(myPolyDataMapper.GetPointer());
+}
+
+
+//----------------------------------------------------------------------------
+void
+VISU_PolyDataPL
+::SetPolyDataMapper(vtkPolyDataMapper* theMapper)
+{
+  myPolyDataMapper = theMapper;
+  SetMapper(theMapper);
+}
+
+
+//----------------------------------------------------------------------------
+vtkPolyDataMapper* 
+VISU_PolyDataPL
+::GetPolyDataMapper()
+{
+  return myPolyDataMapper.GetPointer();
+}
+
+
+//----------------------------------------------------------------------------
+void 
+VISU_PolyDataPL
+::DoCopyMapper(VISU_PipeLine *thePipeLine,
+              bool theIsCopyInput)
+{
+  if(VISU_PolyDataPL* aPipeLine = dynamic_cast<VISU_PolyDataPL*>(thePipeLine)){
+    if(theIsCopyInput)
+      SetPolyDataIDMapper(aPipeLine->GetPolyDataIDMapper());
+    Update();
+    VISU::CopyPolyDataMapper(GetPolyDataMapper(), 
+                            aPipeLine->GetPolyDataMapper(), 
+                            theIsCopyInput);
+  }
+}
+
+
+//----------------------------------------------------------------------------
+void
+VISU_PolyDataPL
+::SetLookupTable(VISU_LookupTable* theLookupTable)
+{
+  myPolyDataMapper->SetLookupTable(theLookupTable);
+}
+
+
+//----------------------------------------------------------------------------
+unsigned long int
+VISU_PolyDataPL
+::GetMemorySize()
+{
+  unsigned long int aSize = 0;
+  if(myExtractPolyDataGeometry->GetInput())
+    if(vtkDataSet* aDataSet = myExtractPolyDataGeometry->GetOutput())
+      aSize = aDataSet->GetActualMemorySize() * 1024;
+  
+  aSize += Superclass::GetMemorySize();
+
+  return aSize;
+}
+
+
+//------------------------ Clipping planes -----------------------------------
+bool 
+VISU_PolyDataPL
+::AddClippingPlane(vtkPlane* thePlane)
+{
+  if (thePlane) {
+    if (vtkImplicitBoolean* aBoolean = myExtractPolyDataGeometry->GetImplicitBoolean()) {
+      vtkImplicitFunctionCollection* aFunction = aBoolean->GetFunction();
+      aFunction->AddItem(thePlane);
+      // Check, that at least one cell present after clipping.
+      // This check was introduced because of bug IPAL8849.
+      vtkDataSet* aClippedDataSet = GetClippedInput();
+      if(aClippedDataSet->GetNumberOfCells() < 1)
+        return false;
+    }
+  }
+  return true;
+}
+
+//----------------------------------------------------------------------------
+vtkPlane* 
+VISU_PolyDataPL
+::GetClippingPlane(vtkIdType theID) const
+{
+  vtkPlane* aPlane = NULL;
+  if(theID >= 0 && theID < GetNumberOfClippingPlanes()){
+    if(vtkImplicitBoolean* aBoolean = myExtractPolyDataGeometry->GetImplicitBoolean()){
+      vtkImplicitFunctionCollection* aFunction = aBoolean->GetFunction();
+      vtkImplicitFunction* aFun = NULL;
+      aFunction->InitTraversal();
+      for(vtkIdType anID = 0; anID <= theID; anID++)
+       aFun = aFunction->GetNextItem();
+      aPlane = dynamic_cast<vtkPlane*>(aFun);
+    }
+  }
+  return aPlane;
+}
+
+//----------------------------------------------------------------------------
+void
+VISU_PolyDataPL
+::RemoveAllClippingPlanes()
+{
+  if(vtkImplicitBoolean* aBoolean = myExtractPolyDataGeometry->GetImplicitBoolean()){
+    vtkImplicitFunctionCollection* aFunction = aBoolean->GetFunction();
+    aFunction->RemoveAllItems();
+    aBoolean->Modified(); // VTK bug
+  }
+}
+
+//----------------------------------------------------------------------------
+vtkIdType
+VISU_PolyDataPL
+::GetNumberOfClippingPlanes() const
+{
+  if(vtkImplicitBoolean* aBoolean = myExtractPolyDataGeometry->GetImplicitBoolean()){
+    vtkImplicitFunctionCollection* aFunction = aBoolean->GetFunction();
+    return aFunction->GetNumberOfItems();
+  }
+  return 0;
+}
+
+//----------------------------------------------------------------------------
+vtkIdType 
+VISU_PolyDataPL
+::GetNodeObjID(vtkIdType theID)
+{
+  vtkIdType anID = myExtractPolyDataGeometry->GetNodeObjId(theID);
+  return Superclass::GetNodeObjID(anID);
+}
+
+vtkIdType 
+VISU_PolyDataPL
+::GetNodeVTKID(vtkIdType theID)
+{
+  vtkIdType anID = Superclass::GetNodeVTKID(theID);
+  return myExtractPolyDataGeometry->GetNodeVTKId(anID);
+}
+
+vtkFloatingPointType* 
+VISU_PolyDataPL
+::GetNodeCoord(int theObjID)
+{
+  return Superclass::GetNodeCoord(theObjID);
+}
+
+
+//----------------------------------------------------------------------------
+vtkIdType 
+VISU_PolyDataPL
+::GetElemObjID(vtkIdType theID)
+{
+  vtkIdType anID = myExtractPolyDataGeometry->GetElemObjId(theID);
+  return Superclass::GetElemObjID(anID);
+}
+
+vtkIdType
+VISU_PolyDataPL
+::GetElemVTKID(vtkIdType theID)
+{
+  vtkIdType anID = Superclass::GetElemVTKID(theID);
+  return myExtractPolyDataGeometry->GetElemVTKId(anID);
+}
+
+vtkCell* 
+VISU_PolyDataPL
+::GetElemCell(vtkIdType  theObjID)
+{
+  return Superclass::GetElemCell(theObjID);
+}
+
+
+//----------------------------------------------------------------------------
+void
+VISU_PolyDataPL
+::SetImplicitFunction(vtkImplicitFunction *theFunction)
+{
+  myExtractPolyDataGeometry->SetImplicitFunction(theFunction);
+} 
+
+vtkImplicitFunction * 
+VISU_PolyDataPL
+::GetImplicitFunction()
+{
+  return myExtractPolyDataGeometry->GetImplicitFunction();
+}
+
+SALOME_ExtractPolyDataGeometry*
+VISU_PolyDataPL
+::GetExtractPolyDataGeometryFilter()
+{
+  return myExtractPolyDataGeometry.GetPointer();
+} 
+
+
+//----------------------------------------------------------------------------
diff --git a/src/PIPELINE/VISU_PolyDataPL.hxx b/src/PIPELINE/VISU_PolyDataPL.hxx
new file mode 100644 (file)
index 0000000..1b8fa32
--- /dev/null
@@ -0,0 +1,153 @@
+//  VISU OBJECT : interactive object for VISU entities implementation
+//
+//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+//
+// File:    VISU_UnstructuredGripPL.hxx
+// Author:  Alexey PETROV
+// Module : VISU
+
+#ifndef VISU_PolyDataPL_HeaderFile
+#define VISU_PolyDataPL_HeaderFile
+
+#include "VISU_ColoredPL.hxx"
+
+class vtkPolyDataMapper;
+class vtkPolyData;
+class SALOME_ExtractPolyDataGeometry;
+
+
+//----------------------------------------------------------------------------
+class VISU_PolyDataPL : public VISU_ColoredPL
+{
+public:
+  vtkTypeMacro(VISU_PolyDataPL, VISU_ColoredPL);
+
+  //----------------------------------------------------------------------------
+  virtual 
+  vtkPolyDataMapper* 
+  GetPolyDataMapper();
+
+  virtual
+  vtkPolyData* 
+  GetPolyDataInput();
+
+  //! Gets memory size used by the instance (bytes).
+  virtual
+  unsigned long int
+  GetMemorySize();
+
+  //----------------------------------------------------------------------------
+  virtual
+  void
+  SetImplicitFunction(vtkImplicitFunction *theFunction);
+
+  virtual
+  vtkImplicitFunction* 
+  GetImplicitFunction();
+
+  virtual
+  SALOME_ExtractPolyDataGeometry*
+  GetExtractPolyDataGeometryFilter();
+
+  //----------------------------------------------------------------------------
+  // Clipping planes
+  virtual
+  void 
+  RemoveAllClippingPlanes();
+
+  virtual
+  vtkIdType
+  GetNumberOfClippingPlanes() const;
+
+  virtual
+  bool
+  AddClippingPlane(vtkPlane* thePlane);
+
+  virtual
+  vtkPlane* 
+  GetClippingPlane(vtkIdType theID) const;
+
+  //----------------------------------------------------------------------------
+  virtual
+  vtkIdType
+  GetNodeObjID(vtkIdType theID);
+
+  virtual
+  vtkIdType
+  GetNodeVTKID(vtkIdType theID);
+
+  virtual
+  vtkFloatingPointType* 
+  GetNodeCoord(vtkIdType theObjID);
+
+  virtual
+  vtkIdType
+  GetElemObjID(vtkIdType theID);
+
+  virtual
+  vtkIdType
+  GetElemVTKID(vtkIdType theID);
+
+  virtual
+  vtkCell*
+  GetElemCell(vtkIdType theObjID);
+
+  //----------------------------------------------------------------------------
+  void 
+  SetPolyDataIDMapper(const VISU::PPolyDataIDMapper& theIDMapper);
+
+  const VISU::PPolyDataIDMapper&
+  GetPolyDataIDMapper() const;
+
+protected:
+  VISU_PolyDataPL();
+  VISU_PolyDataPL(const VISU_PolyDataPL&);
+
+  virtual
+  ~VISU_PolyDataPL();
+
+  virtual
+  void
+  DoCopyMapper(VISU_PipeLine *thePipeLine,
+              bool theIsCopyInput);
+
+  virtual
+  void
+  OnCreateMapper();
+
+  void 
+  SetPolyDataMapper(vtkPolyDataMapper* theMapper);
+
+  virtual
+  void
+  SetLookupTable(VISU_LookupTable* theLookupTable);
+
+  virtual
+  vtkPointSet* 
+  GetClippedInput() const;
+
+private:
+  VISU::PPolyDataIDMapper myPolyDataIDMapper;
+  vtkSmartPointer<vtkPolyDataMapper> myPolyDataMapper;
+  vtkSmartPointer<SALOME_ExtractPolyDataGeometry> myExtractPolyDataGeometry; //!< Clipping
+};
+
+#endif
diff --git a/src/PIPELINE/VISU_UnstructuredGridPL.cxx b/src/PIPELINE/VISU_UnstructuredGridPL.cxx
new file mode 100644 (file)
index 0000000..9e4f84c
--- /dev/null
@@ -0,0 +1,81 @@
+//  VISU OBJECT : interactive object for VISU entities implementation
+//
+//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+//
+//
+// File:    VISU_UnstructuredGridPL.cxx
+// Author:  Alexey PETROV
+// Module : VISU
+
+
+#include "VISU_UnstructuredGridPL.hxx"
+#include "VISU_DataSetMapperHolder.hxx"
+
+
+//----------------------------------------------------------------------------
+VISU_UnstructuredGridPL
+::VISU_UnstructuredGridPL(VISU_PipeLine* thePipeLine):
+  myPipeLine(thePipeLine)
+{}
+
+
+//----------------------------------------------------------------------------
+void  
+VISU_UnstructuredGridPL
+::OnCreateMapperHolder()
+{
+  myDataSetMapperHolder = VISU_DataSetMapperHolder::New();
+  myDataSetMapperHolder->Delete();
+
+  myPipeLine->SetMapperHolder(myDataSetMapperHolder.GetPointer());
+}
+
+
+//----------------------------------------------------------------------------
+void
+VISU_UnstructuredGridPL
+::SetUnstructuredGridIDMapper(const VISU::PUnstructuredGridIDMapper& theIDMapper)
+{
+  GetDataSetMapperHolder()->SetUnstructuredGridIDMapper(theIDMapper);
+}
+
+
+//----------------------------------------------------------------------------
+VISU_DataSetMapperHolder*  
+VISU_UnstructuredGridPL
+::GetDataSetMapperHolder()
+{
+  myPipeLine->GetMapperHolder();
+
+  return myDataSetMapperHolder.GetPointer();
+}
+
+
+//----------------------------------------------------------------------------
+vtkDataSetMapper*  
+VISU_UnstructuredGridPL
+::GetDataSetMapper()
+{
+  return GetDataSetMapperHolder()->GetDataSetMapper();
+}
+
+
+//----------------------------------------------------------------------------
diff --git a/src/PIPELINE/VISU_UnstructuredGridPL.hxx b/src/PIPELINE/VISU_UnstructuredGridPL.hxx
new file mode 100644 (file)
index 0000000..dbad21e
--- /dev/null
@@ -0,0 +1,66 @@
+//  VISU OBJECT : interactive object for VISU entities implementation
+//
+//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+//
+// File:    VISU_UnstructuredGripPL.hxx
+// Author:  Alexey PETROV
+// Module : VISU
+
+#ifndef VISU_UnstructuredGridPL_HeaderFile
+#define VISU_UnstructuredGridPL_HeaderFile
+
+#include "VISU_PipeLine.hxx"
+
+class VISU_DataSetMapperHolder;
+class vtkDataSetMapper;
+
+//----------------------------------------------------------------------------
+class VISU_UnstructuredGridPL
+{
+public:
+  //----------------------------------------------------------------------------
+  void 
+  SetUnstructuredGridIDMapper(const VISU::PUnstructuredGridIDMapper& theIDMapper);
+
+  VISU_DataSetMapperHolder*
+  GetDataSetMapperHolder();
+
+  vtkDataSetMapper* 
+  GetDataSetMapper();
+
+protected:
+  //----------------------------------------------------------------------------
+  VISU_UnstructuredGridPL(VISU_PipeLine* thePipeLine);
+
+  virtual
+  void
+  OnCreateMapperHolder();
+
+private:
+  //----------------------------------------------------------------------------
+  VISU_UnstructuredGridPL(); // Not implemented
+  VISU_UnstructuredGridPL(const VISU_UnstructuredGridPL&); // Not implemented
+
+  VISU_PipeLine* myPipeLine;
+  vtkSmartPointer<VISU_DataSetMapperHolder> myDataSetMapperHolder;
+};
+
+#endif
diff --git a/src/VISUGUI/VisuGUI_CacheDlg.cxx b/src/VISUGUI/VisuGUI_CacheDlg.cxx
new file mode 100644 (file)
index 0000000..70007bb
--- /dev/null
@@ -0,0 +1,188 @@
+//  VISU VISUGUI : GUI of VISU component
+//
+//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+//
+//
+//  File   : VisuGUI_CacheDlg.cxx
+//  Author : Oleg UVAROV
+//  Module : VISU
+
+#include "VisuGUI_CacheDlg.h"
+
+#include "VisuGUI_Tools.h"
+
+#include "VISU_PipeLine.hxx"
+
+#include "SUIT_Desktop.h"
+#include "SUIT_MessageBox.h"
+#include "SUIT_Session.h"
+
+#include "SalomeApp_Module.h"
+
+#include "LightApp_Application.h"
+
+#include "QtxDblSpinBox.h"
+
+#include <qbuttongroup.h>
+#include <qgroupbox.h>
+#include <qlabel.h>
+#include <qlayout.h>
+#include <qlineedit.h>
+#include <qpushbutton.h>
+#include <qradiobutton.h>
+
+VisuGUI_CacheDlg::VisuGUI_CacheDlg( VISU::ColoredPrs3dCache_var theCache,
+                                   SalomeApp_Module* theModule )
+  : QDialog( VISU::GetDesktop( theModule ), "VisuGUI_CacheDlg", true,
+            WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | WDestructiveClose ),
+    myCache( theCache )
+{
+  setCaption( tr( "CACHE_TITLE" ) );
+
+  QVBoxLayout* aTopLayout = new QVBoxLayout( this );
+  aTopLayout->setSpacing( 6 );
+  aTopLayout->setMargin( 6 );
+  aTopLayout->setAutoAdd( true );
+
+  long aMb = 1024 * 1024;
+  bool isLimitedMemory = myCache->GetMemoryMode() == VISU::ColoredPrs3dCache::LIMITED;
+  double aLimitedMemory = myCache->GetLimitedMemory();
+  double aFreeMemory = (double)VISU_PipeLine::GetAvailableMemory( 2048 * aMb ) / (double)aMb;
+  double anUsedMemory = myCache->GetMemorySize();
+  double aLimitedMemoryMax = std::max(anUsedMemory + aFreeMemory, aLimitedMemory);
+
+  // Settings
+  QButtonGroup* aMemoryGroup = new QButtonGroup( 2, Qt::Vertical, tr( "MEMORY_MODE" ), this );
+  aMemoryGroup->setRadioButtonExclusive( true );
+
+  myLimitedMemoryButton = new QRadioButton( tr( "LIMITED_MEMORY" ), aMemoryGroup );
+  myLimitedMemoryButton->setChecked( isLimitedMemory );
+
+  myMimimalMemoryButton = new QRadioButton( tr( "MINIMAL_MEMORY" ), aMemoryGroup );
+  myMimimalMemoryButton->setChecked( !isLimitedMemory );
+
+  myLimitedMemory = new QtxDblSpinBox( 1.0, aLimitedMemoryMax, 10.0, aMemoryGroup );
+  myLimitedMemory->setSuffix( " Mb" );
+  myLimitedMemory->setValue( aLimitedMemory );
+  myLimitedMemory->setEnabled( isLimitedMemory );
+
+  connect( myLimitedMemoryButton, SIGNAL( toggled( bool ) ), myLimitedMemory, SLOT( setEnabled( bool ) ) );
+
+  // Current state
+  QGroupBox* aStateGroup = new QGroupBox( tr( "MEMORY STATE" ), this );
+  aStateGroup->setColumnLayout( 0, Qt::Vertical );
+  aStateGroup->layout()->setSpacing( 0 );
+  aStateGroup->layout()->setMargin( 0 );
+
+  QGridLayout* aStateLayout = new QGridLayout( aStateGroup->layout(), 2, 2 );
+  aStateLayout->setSpacing(6);
+  aStateLayout->setMargin(6);
+
+  QLabel* aUsedMemoryLabel = new QLabel( tr( "USED_BY_CACHE" ), aStateGroup );
+  myUsedMemory = new QLineEdit( aStateGroup );
+  myUsedMemory->setText( QString::number( anUsedMemory ) + " Mb" );
+  myUsedMemory->setReadOnly( true );
+  myUsedMemory->setEnabled( false );
+  myUsedMemory->setPaletteForegroundColor( Qt::black );
+
+  QLabel* aFreeMemoryLabel = new QLabel( tr( "FREE" ), aStateGroup );
+  myFreeMemory = new QLineEdit( aStateGroup );
+  myFreeMemory->setText( QString::number( aFreeMemory ) + " Mb" );
+  myFreeMemory->setReadOnly( true );
+  myFreeMemory->setEnabled( false );
+  myFreeMemory->setPaletteForegroundColor( Qt::black );
+
+  aStateLayout->addWidget( aUsedMemoryLabel, 0, 0 );
+  aStateLayout->addWidget( myUsedMemory, 0, 1 );
+  aStateLayout->addWidget( aFreeMemoryLabel, 1, 0 );
+  aStateLayout->addWidget( myFreeMemory, 1, 1 );
+
+  // Ok / Cancel
+  QGroupBox* GroupButtons = new QGroupBox( this, "GroupButtons" );
+  GroupButtons->setColumnLayout(0, Qt::Vertical );
+  GroupButtons->layout()->setSpacing( 0 );
+  GroupButtons->layout()->setMargin( 0 );
+  QGridLayout* GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
+  GroupButtonsLayout->setAlignment( Qt::AlignTop );
+  GroupButtonsLayout->setSpacing( 6 );
+  GroupButtonsLayout->setMargin( 11 );
+
+  QPushButton* buttonOk = new QPushButton( tr( "&OK" ), GroupButtons, "buttonOk" );
+  buttonOk->setAutoDefault( TRUE );
+  buttonOk->setDefault( TRUE );
+  GroupButtonsLayout->addWidget( buttonOk, 0, 0 );
+  GroupButtonsLayout->addItem( new QSpacerItem( 5, 5, QSizePolicy::Expanding, QSizePolicy::Minimum ), 0, 1 );
+
+  QPushButton* buttonCancel = new QPushButton( tr( "&Cancel" ) , GroupButtons, "buttonCancel" );
+  buttonCancel->setAutoDefault( TRUE );
+  GroupButtonsLayout->addWidget( buttonCancel, 0, 2 );
+
+  QPushButton* buttonHelp = new QPushButton( tr( "&Help" ) , GroupButtons, "buttonHelp" );
+  buttonHelp->setAutoDefault( TRUE );
+  GroupButtonsLayout->addWidget( buttonHelp, 0, 3 );
+
+  connect( buttonOk,     SIGNAL( clicked() ), this, SLOT( accept() ) );
+  connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( reject() ) );
+  connect( buttonHelp,   SIGNAL( clicked() ), this, SLOT( onHelp() ) );
+}
+
+VisuGUI_CacheDlg::~VisuGUI_CacheDlg()
+{
+}
+
+bool VisuGUI_CacheDlg::isLimitedMemory()
+{
+  return myLimitedMemoryButton->isChecked();
+}
+
+double VisuGUI_CacheDlg::getLimitedMemory()
+{
+  return myLimitedMemory->value();
+}
+
+void VisuGUI_CacheDlg::accept()
+{
+  if( isLimitedMemory() )
+  {
+    myCache->SetMemoryMode( VISU::ColoredPrs3dCache::LIMITED );
+    myCache->SetLimitedMemory( (float)getLimitedMemory() );
+  }
+  else
+    myCache->SetMemoryMode( VISU::ColoredPrs3dCache::MINIMAL );
+
+
+  QDialog::accept();
+}
+
+void VisuGUI_CacheDlg::onHelp()
+{
+  QString aHelpFileName;// = "types_of_gauss_points_presentations.htm";
+  LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication());
+  if (app)
+    app->onHelpContextModule(app->activeModule() ?
+                            app->moduleName(app->activeModule()->moduleName()) : QString(""), aHelpFileName);
+  else {
+    SUIT_MessageBox::warn1(0, QObject::tr("WRN_WARNING"),
+                          QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
+                          arg(app->resourceMgr()->stringValue("ExternalBrowser", "application")).arg(aHelpFileName),
+                          QObject::tr("BUT_OK"));
+  }
+}
diff --git a/src/VISUGUI/VisuGUI_CacheDlg.h b/src/VISUGUI/VisuGUI_CacheDlg.h
new file mode 100644 (file)
index 0000000..71693e7
--- /dev/null
@@ -0,0 +1,71 @@
+//  VISU VISUGUI : GUI of VISU component
+//
+//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+//
+//
+//  File   : VisuGUI_CacheDlg.h
+//  Author : Oleg UVAROV
+//  Module : VISU
+
+#ifndef VISUGUI_CACHEDLG_H
+#define VISUGUI_CACHEDLG_H
+
+#include "SALOMEconfig.h"
+#include CORBA_SERVER_HEADER(VISU_Gen)
+
+#include <qdialog.h>
+
+class QLineEdit;
+class QRadioButton;
+class QtxDblSpinBox;
+
+class SalomeApp_Module;
+
+class VisuGUI_CacheDlg : public QDialog
+{
+  Q_OBJECT
+
+public:
+  VisuGUI_CacheDlg( VISU::ColoredPrs3dCache_var aCache,
+                   SalomeApp_Module* theModule );
+  virtual ~VisuGUI_CacheDlg();
+
+public:
+  bool            isLimitedMemory();
+  double          getLimitedMemory();
+
+protected slots:
+  virtual void    accept();
+
+  void            onHelp();
+
+private:
+  VISU::ColoredPrs3dCache_var myCache;
+
+  QRadioButton*   myMimimalMemoryButton;
+  QRadioButton*   myLimitedMemoryButton;
+  QtxDblSpinBox*  myLimitedMemory;
+
+  QLineEdit*      myUsedMemory;
+  QLineEdit*      myFreeMemory;
+};
+
+#endif
diff --git a/src/VISUGUI/VisuGUI_FieldFilter.cxx b/src/VISUGUI/VisuGUI_FieldFilter.cxx
new file mode 100644 (file)
index 0000000..3dd45bb
--- /dev/null
@@ -0,0 +1,113 @@
+//  VISU VISUGUI : GUI of VISU component
+//
+//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+//
+//
+//  File   : VisuGUI_FieldFilter.cxx
+//  Author : Oleg UVAROV
+//  Module : VISU
+
+#include "VisuGUI_FieldFilter.h"
+
+#include "VisuGUI_Tools.h"
+
+#include "VISUConfig.hh"
+#include "VISU_ColoredPrs3dFactory.hh"
+
+#include <SUIT_Session.h>
+
+#include <SalomeApp_Study.h>
+#include <LightApp_DataOwner.h>
+
+using namespace VISU;
+
+VisuGUI_FieldFilter::VisuGUI_FieldFilter( VISU::VISUType theType ) : 
+  myType( theType )
+{
+}
+
+VisuGUI_FieldFilter::~VisuGUI_FieldFilter() 
+{
+}
+
+void VisuGUI_FieldFilter::setPrs3dEntry( const QString& theEntry )
+{
+  myPrs3dEntry = theEntry;
+}
+
+bool VisuGUI_FieldFilter::isOk( const SUIT_DataOwner* theDataOwner ) const
+{
+  const LightApp_DataOwner* anOwner =
+    dynamic_cast<const LightApp_DataOwner*>( theDataOwner );
+
+  SalomeApp_Study* anAppStudy = dynamic_cast<SalomeApp_Study*>
+    (SUIT_Session::session()->activeApplication()->activeStudy());
+
+  if( anOwner && anAppStudy )
+  {
+    if(myPrs3dEntry == anOwner->entry())
+      return true;
+
+    _PTR(Study) aStudy = anAppStudy->studyDS();
+    _PTR(SObject) aSObject = aStudy->FindObjectID( anOwner->entry() );
+    if (!aSObject)
+      return false;
+
+    _PTR(SObject) aRefSO;
+    if( aSObject->ReferencedObject( aRefSO ) )
+      aSObject = aRefSO;
+
+    if( !aSObject )
+      return false;
+
+    _PTR(GenericAttribute) anAttr;
+    if( !aSObject->FindAttribute( anAttr, "AttributeComment" ) )
+      return false;
+
+    _PTR(AttributeComment) aComment( anAttr );
+    string aComm = aComment->Value();
+    QString strIn( aComm.c_str() );
+
+    bool isExist;
+    VISU::Storable::TRestoringMap aMap;
+    VISU::Storable::StrToMap( strIn, aMap );
+    VISU::VISUType aType = ( VISU::VISUType )VISU::Storable::FindValue( aMap, "myType", &isExist ).toInt();
+
+    if( aType == VISU::TFIELD )
+    {
+      VISU::Result_var aResult = FindResult( VISU::GetSObject( aSObject ).in() );
+      QString aMeshName = VISU::getValue( aSObject, "myMeshName" );
+      int anEntity = VISU::getValue( aSObject, "myEntityId" ).toInt();
+      QString aFieldName = VISU::getValue( aSObject, "myName" );
+
+      VISU::ColoredPrs3dHolder::BasicInput anInput;
+      anInput.myResult = aResult;
+      anInput.myMeshName = CORBA::string_dup( aMeshName.latin1() );
+      anInput.myEntity = (VISU::Entity)anEntity;
+      anInput.myFieldName = CORBA::string_dup( aFieldName.latin1() );
+      anInput.myTimeStampNumber = 1;
+
+      size_t isOk = VISU::CheckIsPossible( myType, anInput, true );
+      return isOk > 0;
+    }
+  }
+  return false;
+}
diff --git a/src/VISUGUI/VisuGUI_FieldFilter.h b/src/VISUGUI/VisuGUI_FieldFilter.h
new file mode 100644 (file)
index 0000000..faec6f0
--- /dev/null
@@ -0,0 +1,49 @@
+// Copyright (C) 2005  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+// 
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either 
+// version 2.1 of the License.
+// 
+// This library is distributed in the hope that it will be useful 
+// but WITHOUT ANY WARRANTY; without even the implied warranty of 
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public  
+// License along with this library; if not, write to the Free Software 
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+//  File   : VisuGUI_FieldFilter.hxx
+//  Author : Oleg UVAROV
+//  Module : VISU
+
+#ifndef VISUGUI_FIELDFILTER_H
+#define VISUGUI_FIELDFILTER_H
+
+#include "VISUConfig.hh"
+
+#include "SUIT_SelectionFilter.h"
+
+class SUIT_DataOwner;
+
+class VisuGUI_FieldFilter : public SUIT_SelectionFilter
+{
+public:
+  VisuGUI_FieldFilter( VISU::VISUType theType );
+  ~VisuGUI_FieldFilter();
+
+public:
+  virtual bool     isOk( const SUIT_DataOwner* ) const;
+
+  void             setPrs3dEntry( const QString& theEntry );
+
+private:
+  VISU::VISUType   myType;
+  QString          myPrs3dEntry;
+};
+
+#endif
diff --git a/src/VISUGUI/VisuGUI_InputPane.cxx b/src/VISUGUI/VisuGUI_InputPane.cxx
new file mode 100644 (file)
index 0000000..f20c92f
--- /dev/null
@@ -0,0 +1,277 @@
+//  VISU VISUGUI : GUI of VISU component
+//
+//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+//
+//
+//  File   : VisuGUI_InputPane.cxx
+//  Author : Oleg UVAROV
+//  Module : VISU
+
+#include "VisuGUI_InputPane.h"
+
+#include "VisuGUI_Prs3dDlg.h"
+#include "VisuGUI_FieldFilter.h"
+#include "VisuGUI_Tools.h"
+
+#include "VISU_ColoredPrs3d_i.hh"
+#include "VISU_Result_i.hh"
+
+#include "SUIT_ResourceMgr.h"
+
+#include "SalomeApp_Module.h"
+
+#include "LightApp_Application.h"
+#include "LightApp_SelectionMgr.h"
+
+#include "SALOME_ListIO.hxx"
+
+#include "SALOMEDSClient_AttributeComment.hxx"
+#include "SALOMEDSClient_AttributeName.hxx"
+
+#include <qcheckbox.h>
+#include <qcombobox.h>
+#include <qlabel.h>
+#include <qlayout.h>
+#include <qlineedit.h>
+
+using namespace VISU;
+
+VisuGUI_InputPane::VisuGUI_InputPane( VISU::VISUType theType,
+                                     SalomeApp_Module* theModule,
+                                     VisuGUI_Prs3dDlg* theDialog ) :
+  QGroupBox( 2, Qt::Horizontal, theDialog ),
+  myModule( theModule ),
+  myDialog( theDialog ),
+  myPrs( NULL )
+{
+  setFrameStyle( QFrame::Box | QFrame::Sunken );
+
+  connect( GetSelectionMgr( theModule ), SIGNAL( selectionChanged() ), SLOT( onSelectionChanged() ) );
+
+  new QLabel( tr( "MED_FILE" ), this );
+  myMedFile = new QLineEdit( this );
+  myMedFile->setReadOnly( true );
+  myMedFile->setEnabled( false );
+  myMedFile->setPaletteForegroundColor( Qt::black );
+
+  new QLabel( tr( "MESH" ), this );
+  myMeshName = new QLineEdit( this );
+  myMeshName->setReadOnly( true );
+  myMeshName->setEnabled( false );
+  myMeshName->setPaletteForegroundColor( Qt::black );
+
+  new QLabel( tr( "ENTITY" ), this );
+  myEntityName = new QLineEdit( this );
+  myEntityName->setReadOnly( true );
+  myEntityName->setEnabled( false );
+  myEntityName->setPaletteForegroundColor( Qt::black );
+
+  new QLabel( tr( "FIELD" ), this );
+  myFieldName = new QLineEdit( this );
+  myFieldName->setReadOnly( true );
+
+  new QLabel( tr( "TIME_STAMP" ), this );
+  myTimeStamps = new QComboBox( this );
+
+  myReInit = new QCheckBox( tr( "REINITIALIZE" ), this );
+  myReInit->setChecked( true );
+
+  connect( myReInit, SIGNAL( toggled( bool ) ), SLOT( onReInitialize( bool ) ) );
+
+  onSelectionChanged();
+
+  myFieldFilter = new VisuGUI_FieldFilter( theType );
+
+  hide();
+}
+
+VisuGUI_InputPane::~VisuGUI_InputPane()
+{
+  if( myFieldFilter )
+  {
+    GetSelectionMgr( myModule )->removeFilter( myFieldFilter );
+    delete myFieldFilter;
+  }
+}
+
+bool VisuGUI_InputPane::check()
+{
+  return myTimeStamps->count() != 0;
+}
+
+void VisuGUI_InputPane::clear()
+{
+  myMedFile->clear();
+  myMeshName->clear();
+  myEntityName->clear();
+  myFieldName->clear();
+  myTimeStamps->clear();
+}
+
+void VisuGUI_InputPane::onSelectionChanged()
+{
+  //clear();
+
+  SALOME_ListIO aListIO;
+  GetSelectionMgr( myModule )->selectedObjects(aListIO);
+
+  if (aListIO.Extent() != 1)
+    return;
+
+  const Handle(SALOME_InteractiveObject)& anIO = aListIO.First();
+
+  _PTR(Study) aCStudy = GetCStudy(GetAppStudy(myModule));
+  _PTR(SObject) aSObject = aCStudy->FindObjectID(anIO->getEntry());
+  if (!aSObject)
+    return;
+
+  VISU::Storable::TRestoringMap aMap;
+  _PTR(GenericAttribute) anAttr;
+  if (!aSObject->FindAttribute(anAttr, "AttributeComment"))
+    return;
+
+  _PTR(AttributeComment) aComment (anAttr);
+  string aComm = aComment->Value();
+  QString strIn (aComm.c_str());
+  VISU::Storable::StrToMap(strIn, aMap);
+  bool isExist;
+  VISU::VISUType aType = (VISU::VISUType)VISU::Storable::FindValue(aMap,"myType",&isExist).toInt();
+  if (aType == VISU::TFIELD)
+  {
+    _PTR(SObject) aMedObject = aSObject->GetFather()->GetFather()->GetFather();
+    if( !aMedObject )
+      return;
+
+    myTimeStamps->clear();
+
+    QString anEntityName, aTimeStampName;
+
+    _PTR(StudyBuilder) aBuilder = aCStudy->NewBuilder();
+    _PTR(ChildIterator) aIter = aCStudy->NewChildIterator(aSObject);
+    for( ; aIter->More(); aIter->Next() )
+    {
+      _PTR(SObject) aChildObj = aIter->Value();
+      if( !aChildObj )
+       return;
+
+      if( anEntityName.isNull() )
+      {
+       _PTR(SObject) aRefObj;
+       if( aChildObj->ReferencedObject( aRefObj ) )
+         anEntityName = aRefObj->GetName().c_str();
+      }
+
+      if( VISU::getValue(aChildObj, "myComment") == "TIMESTAMP" )
+      {
+       aTimeStampName = aChildObj->GetName().c_str();
+       myTimeStamps->insertItem( aTimeStampName );
+      }
+    }
+
+    myResult = FindResult( VISU::GetSObject( aSObject ).in() );
+
+    myEntity = VISU::getValue( aSObject, "myEntityId" ).toInt();
+
+    QString aMedFile = aMedObject->GetName().c_str();
+    QString aMeshName = VISU::getValue(aSObject, "myMeshName");
+    QString aFieldName = VISU::getValue(aSObject, "myName");
+
+    myMedFile->setText( aMedFile );
+    myMeshName->setText( aMeshName );
+    myEntityName->setText( anEntityName );
+    myFieldName->setText( aFieldName );
+    myTimeStamps->setCurrentItem( 0 );
+
+    if( myReInit->isChecked() && myPrs )
+    {
+      myPrs->SetResultObject( myResult );
+      myPrs->SetMeshName( aMeshName.latin1() );
+      myPrs->SetEntity( VISU::Entity( myEntity ) );
+      myPrs->SetFieldName( aFieldName.latin1() );
+      myPrs->SetTimeStampNumber( myPrs->GetTimeStampNumberByIndex( 0 ) );
+      myPrs->Apply( true );
+
+      myDialog->initFromPrsObject( myPrs, false );
+    }
+  }
+}
+
+void VisuGUI_InputPane::onReInitialize( bool on )
+{
+  if( on )
+    onSelectionChanged();
+}
+
+void VisuGUI_InputPane::initFromPrsObject( VISU::ColoredPrs3d_i* thePrs )
+{
+  if( myPrs == thePrs )
+    return;
+
+  myPrs = thePrs;
+
+  clear();
+
+  CORBA::Long aTimeStampNumber = thePrs->GetTimeStampNumber();
+  VISU::ColoredPrs3d::TimeStampsRange_var aTimeStampsRange = thePrs->GetTimeStampsRange();
+  CORBA::Long aLength = aTimeStampsRange->length();
+
+  for( int index = 0; index < aLength; index++ )
+  {
+    VISU::ColoredPrs3d::TimeStampInfo anInfo = aTimeStampsRange[ index ];
+    QString aTime = anInfo.myTime.in();
+    myTimeStamps->insertItem( aTime );
+  }
+
+  myResult = thePrs->GetResultObject();
+  VISU::Result_i* aResult = dynamic_cast<VISU::Result_i*>(GetServant(myResult).in());
+  myMedFile->setText( aResult->GetName().c_str() );
+
+  myEntity = (int)thePrs->GetEntity();
+
+  QString anEntityName;
+  switch( myEntity )
+  {
+    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: break;
+  }
+  myEntityName->setText( anEntityName );
+
+  myMeshName->setText( thePrs->GetMeshName() );
+  myFieldName->setText( thePrs->GetFieldName() );
+  myTimeStamps->setCurrentItem( thePrs->GetTimeStampIndexByNumber( aTimeStampNumber ) );
+
+  myFieldFilter->setPrs3dEntry( thePrs->GetHolderEntry() );
+  GetSelectionMgr( myModule )->installFilter( myFieldFilter );
+}
+
+int VisuGUI_InputPane::storeToPrsObject( VISU::ColoredPrs3d_i* thePrs )
+{
+  thePrs->SetResultObject( myResult );
+
+  thePrs->SetMeshName( myMeshName->text().latin1() );
+  thePrs->SetEntity( VISU::Entity( myEntity ) );
+  thePrs->SetFieldName( myFieldName->text().latin1() );
+  thePrs->SetTimeStampNumber( thePrs->GetTimeStampNumberByIndex( myTimeStamps->currentItem() ) );
+  return ( int )thePrs->Apply( false );
+}
diff --git a/src/VISUGUI/VisuGUI_InputPane.h b/src/VISUGUI/VisuGUI_InputPane.h
new file mode 100644 (file)
index 0000000..279ff14
--- /dev/null
@@ -0,0 +1,90 @@
+//  VISU VISUGUI : GUI of VISU component
+//
+//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+//
+//
+//  File   : VisuGUI_InputPane.h
+//  Author : Oleg UVAROV
+//  Module : VISU
+
+#ifndef VISUGUI_INPUTPANE_H
+#define VISUGUI_INPUTPANE_H
+
+#include "VISUConfig.hh"
+
+#include <qgroupbox.h>
+
+class QCheckBox;
+class QComboBox;
+class QLineEdit;
+
+class SalomeApp_Module;
+class LightApp_SelectionMgr;
+
+class VisuGUI_Prs3dDlg;
+class VisuGUI_FieldFilter;
+
+namespace VISU
+{
+  class ColoredPrs3d_i;
+  class Result_i;
+}
+
+class VisuGUI_InputPane : public QGroupBox
+{
+  Q_OBJECT
+
+public:
+  VisuGUI_InputPane( VISU::VISUType theType,
+                    SalomeApp_Module* theModule,
+                    VisuGUI_Prs3dDlg* theDialog );
+  virtual ~VisuGUI_InputPane();
+
+public:
+  virtual bool       check();
+  virtual void       clear();
+
+  void               initFromPrsObject( VISU::ColoredPrs3d_i* );
+  int                storeToPrsObject( VISU::ColoredPrs3d_i* );
+
+public slots:
+  virtual void       onSelectionChanged();
+  virtual void       onReInitialize( bool );
+
+private:
+  SalomeApp_Module*  myModule;
+  VisuGUI_Prs3dDlg*     myDialog;
+  VISU::ColoredPrs3d_i* myPrs;
+
+  QLineEdit*         myMedFile;
+  QLineEdit*         myMeshName;
+  QLineEdit*         myEntityName;
+  QLineEdit*         myFieldName;
+  QComboBox*         myTimeStamps;
+  QCheckBox*         myReInit;
+
+  VISU::Result_var   myResult;
+  int                myEntity;
+
+  VisuGUI_FieldFilter* myFieldFilter;
+};
+
+#endif
diff --git a/src/VISUGUI/VisuGUI_Prs3dDlg.cxx b/src/VISUGUI/VisuGUI_Prs3dDlg.cxx
new file mode 100644 (file)
index 0000000..cd72166
--- /dev/null
@@ -0,0 +1,1308 @@
+//  VISU VISUGUI : GUI of VISU component
+//
+//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+//
+//
+//  File   : VisuGUI_Prs3dDlg.cxx
+//  Author : Laurent CORNABE & Hubert ROLLAND
+//  Module : VISU
+
+#include "VisuGUI_Prs3dDlg.h"
+
+#include "VisuGUI.h"
+#include "VisuGUI_Tools.h"
+#include "VisuGUI_ViewTools.h"
+#include "VisuGUI_InputPane.h"
+
+#include "SVTK_ViewWindow.h"
+#include "SVTK_FontWidget.h"
+
+#include "VISUConfig.hh"
+#include "VISU_Convertor.hxx"
+#include "VISU_ScalarMapPL.hxx"
+#include "VISU_ScalarBarActor.hxx"
+#include "VISU_ScalarMapAct.h"
+#include "VISU_ScalarMap_i.hh"
+#include "VISU_Result_i.hh"
+
+#include "LightApp_Application.h"
+
+#include "SUIT_Session.h"
+#include "SUIT_MessageBox.h"
+#include "SUIT_ResourceMgr.h"
+
+#include <qcheckbox.h>
+#include <qlineedit.h>
+#include <qradiobutton.h>
+#include <qbuttongroup.h>
+#include <qgroupbox.h>
+#include <qlabel.h>
+#include <qpushbutton.h>
+#include <qcombobox.h>
+#include <qvbox.h>
+#include <qtoolbutton.h>
+#include <qlayout.h>
+#include <qvalidator.h>
+#include <qcolordialog.h>
+#include <qtabwidget.h>
+
+#include "QtxDblSpinBox.h"
+
+#include <vtkTextProperty.h>
+
+#include <limits.h>
+
+using namespace std;
+
+//-----------------------------------------------------------------------
+// Text Preferences Dialog
+//-----------------------------------------------------------------------
+
+/*!
+  Constructor
+*/
+VisuGUI_TextPrefDlg::VisuGUI_TextPrefDlg (QWidget* parent)
+  : QDialog(parent, 0, true, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu)
+{
+  setName("VisuGUI_TextPrefDlg");
+  setCaption(tr("TIT_TEXT_PREF"));
+  setSizeGripEnabled(TRUE);
+
+  QVBoxLayout* TopLayout = new QVBoxLayout(this);
+  TopLayout->setSpacing(6);
+  TopLayout->setMargin(11);
+
+  // "Title" grp
+  QGroupBox* aTitleGrp = new QGroupBox (2, Qt::Vertical, tr("LBL_TITLE"), this);
+
+  //   edit line
+  myTitleEdt = new QLineEdit (aTitleGrp);
+
+  //   font
+  QHBox* aHBox = new QHBox (aTitleGrp);
+  aHBox->setSpacing(5);
+  myTitleFont = new SVTK_FontWidget (aHBox);
+
+  TopLayout->addWidget(aTitleGrp);
+
+  // "Labels" grp
+  QGroupBox* aLabelsGrp = new QGroupBox (1, Qt::Vertical, tr("LBL_LABELS"), this);
+
+  //   font
+  aHBox = new QHBox (aLabelsGrp);
+  aHBox->setSpacing(5);
+  myLabelFont = new SVTK_FontWidget (aHBox);
+
+  TopLayout->addWidget(aLabelsGrp);
+
+  // Common buttons ===========================================================
+  QGroupBox* GroupButtons = new QGroupBox( this, "GroupButtons" );
+  GroupButtons->setColumnLayout(0, Qt::Vertical );
+  GroupButtons->layout()->setSpacing( 0 );
+  GroupButtons->layout()->setMargin( 0 );
+  QGridLayout* GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
+  GroupButtonsLayout->setAlignment( Qt::AlignTop );
+  GroupButtonsLayout->setSpacing( 6 );
+  GroupButtonsLayout->setMargin( 11 );
+
+  QPushButton* buttonOk = new QPushButton( tr( "&OK" ), GroupButtons, "buttonOk" );
+  buttonOk->setAutoDefault( TRUE );
+  buttonOk->setDefault( TRUE );
+  GroupButtonsLayout->addWidget( buttonOk, 0, 0 );
+  GroupButtonsLayout->addItem( new QSpacerItem( 5, 5, QSizePolicy::Expanding, QSizePolicy::Minimum ), 0, 1 );
+
+  QPushButton* buttonCancel = new QPushButton( tr( "&Cancel" ) , GroupButtons, "buttonCancel" );
+  buttonCancel->setAutoDefault( TRUE );
+  GroupButtonsLayout->addWidget( buttonCancel, 0, 2 );
+
+  QPushButton* buttonHelp = new QPushButton( tr( "&Help" ) , GroupButtons, "buttonHelp" );
+  buttonHelp->setAutoDefault( TRUE );
+  GroupButtonsLayout->addWidget( buttonHelp, 0, 3 );
+
+  TopLayout->addWidget( GroupButtons );
+
+  connect(buttonOk,     SIGNAL(clicked()), this, SLOT(accept()));
+  connect(buttonCancel, SIGNAL(clicked()), this, SLOT(reject()));
+  connect(buttonHelp,   SIGNAL(clicked()), this, SLOT(onHelp()));
+}
+
+QString VisuGUI_TextPrefDlg::getTitleText()
+{
+  return myTitleEdt->text();
+}
+
+void VisuGUI_TextPrefDlg::setTitleText(QString theText)
+{
+  myTitleEdt->setText(theText);
+}
+
+void VisuGUI_TextPrefDlg::setTitleVisible(bool isVisible)
+{
+  if(isVisible)
+    myTitleEdt->show();
+  else
+    myTitleEdt->hide();
+}
+
+void VisuGUI_TextPrefDlg::onHelp()
+{
+  QString aHelpFileName = "/files/scalar_map_presentation.htm";
+  LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication());
+  if (app) {
+    VisuGUI* aVisuGUI = dynamic_cast<VisuGUI*>( app->activeModule() );
+    app->onHelpContextModule(aVisuGUI ? app->moduleName(aVisuGUI->moduleName()) : QString(""), aHelpFileName);
+  }
+  else {
+    SUIT_MessageBox::warn1(0, QObject::tr("WRN_WARNING"),
+                          QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
+                          arg(app->resourceMgr()->stringValue("ExternalBrowser", "application")).arg(aHelpFileName),
+                          QObject::tr("BUT_OK"));
+  }
+}
+
+void VisuGUI_TextPrefDlg::storeBeginValues()
+{
+  myTitle = myTitleEdt->text();
+  myTitleFont->GetData(myColors[0], myComboVals[0], myCheckVals[0], myCheckVals[1], myCheckVals[2]);
+  myLabelFont->GetData(myColors[1], myComboVals[1], myCheckVals[3], myCheckVals[4], myCheckVals[5]);
+}
+
+/*!
+  Called when <Cancel> button is clicked, restore begin values
+*/
+void VisuGUI_TextPrefDlg::reject()
+{
+  myTitleEdt->setText(myTitle);
+  myTitleFont->SetData(myColors[0], myComboVals[0], myCheckVals[0], myCheckVals[1], myCheckVals[2]);
+  myLabelFont->SetData(myColors[1], myComboVals[1], myCheckVals[3], myCheckVals[4], myCheckVals[5]);
+
+  QDialog::reject();
+}
+/*!
+  Called when <Ok> button is clicked, store begin values
+*/
+void VisuGUI_TextPrefDlg::accept()
+{
+  storeBeginValues();
+
+  QDialog::accept();
+}
+
+/*!
+  Provides help on F1 button click
+*/
+void VisuGUI_TextPrefDlg::keyPressEvent( QKeyEvent* e )
+{
+  QDialog::keyPressEvent( e );
+  if ( e->isAccepted() )
+    return;
+
+  if ( e->key() == Key_F1 )
+    {
+      e->accept();
+      onHelp();
+    }
+}
+
+//-----------------------------------------------------------------------
+// Scalar Bar Pane
+//-----------------------------------------------------------------------
+
+/*!
+  Constructor
+*/
+VisuGUI_ScalarBarPane::VisuGUI_ScalarBarPane (QWidget * parent, bool SetPref):
+  QVBox(parent), myPreviewActor(0)
+{
+  SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
+  QString propertyName;
+  propertyName = QString("scalar_bar_vertical_");
+  myVerX = aResourceMgr->doubleValue("VISU", propertyName + "x", 0.);
+  myVerY = aResourceMgr->doubleValue("VISU", propertyName + "y", 0.);
+  myVerW = aResourceMgr->doubleValue("VISU", propertyName + "width", 0.);
+  myVerH = aResourceMgr->doubleValue("VISU", propertyName + "height",0.);
+  
+  propertyName = QString("scalar_bar_horizontal_");
+  myHorX = aResourceMgr->doubleValue("VISU", propertyName + "x", 0.);
+  myHorY = aResourceMgr->doubleValue("VISU", propertyName + "y", 0.);
+  myHorW = aResourceMgr->doubleValue("VISU", propertyName + "width", 0.);
+  myHorH = aResourceMgr->doubleValue("VISU", propertyName + "height",0.);
+  
+  Imin = 0.0; Imax = 0.0; /*Fmin = 0.0; Fmax = 0.0;*/ Rmin = 0.0; Rmax = 0.0;
+  myRangeMode = -1;
+
+  setSpacing(6);
+  //setMargin(11);
+
+  // Range ============================================================
+  RangeGroup = new QButtonGroup (tr("SCALAR_RANGE_GRP"), this, "RangeGroup");
+  RangeGroup->setColumnLayout(0, Qt::Vertical );
+  RangeGroup->layout()->setSpacing( 0 );
+  RangeGroup->layout()->setMargin( 0 );
+  QGridLayout* RangeGroupLayout = new QGridLayout( RangeGroup->layout() );
+  RangeGroupLayout->setAlignment( Qt::AlignTop );
+  RangeGroupLayout->setSpacing( 6 );
+  RangeGroupLayout->setMargin( 11 );
+
+  myModeLbl = new QLabel("Scalar Mode", RangeGroup);
+
+  myModeCombo = new QComboBox(RangeGroup);
+
+  CBLog = new QCheckBox (tr("LOGARITHMIC_SCALING"), RangeGroup);
+  CBLog->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
+
+  RBFrange = new QRadioButton (tr("FIELD_RANGE_BTN"), RangeGroup, "RBFrange");
+  RBIrange = new QRadioButton (tr("IMPOSED_RANGE_BTN"), RangeGroup, "RBIrange");
+  RBFrange->setChecked( true );
+
+  MinEdit = new QLineEdit( RangeGroup, "MinEdit" );
+  MinEdit->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
+  MinEdit->setMinimumWidth( 70 );
+  MinEdit->setValidator( new QDoubleValidator(this) );
+  MinEdit->setText( "0.0" );
+  QLabel* MinLabel = new QLabel (tr("LBL_MIN"), RangeGroup, "MinLabel");
+  MinLabel->setBuddy(MinEdit);
+
+  MaxEdit = new QLineEdit( RangeGroup, "MaxEdit" );
+  MaxEdit->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
+  MaxEdit->setMinimumWidth( 70 );
+  MaxEdit->setValidator( new QDoubleValidator(this) );
+  MaxEdit->setText( "0.0" );
+  QLabel* MaxLabel = new QLabel (tr("LBL_MAX"), RangeGroup, "MaxLabel");
+  MaxLabel->setBuddy(MaxEdit);
+
+  RangeGroupLayout->addWidget( myModeLbl, 0, 0 );
+  RangeGroupLayout->addMultiCellWidget( myModeCombo, 0, 0, 1, 3);
+  RangeGroupLayout->addMultiCellWidget( CBLog, 1, 1, 0, 3);
+  RangeGroupLayout->addMultiCellWidget( RBFrange, 2, 2, 0, 1);
+  RangeGroupLayout->addMultiCellWidget( RBIrange, 2, 2, 2, 3);
+  RangeGroupLayout->addWidget( MinLabel, 3, 0 );
+  RangeGroupLayout->addWidget( MinEdit,  3, 1 );
+  RangeGroupLayout->addWidget( MaxLabel, 3, 2 );
+  RangeGroupLayout->addWidget( MaxEdit,  3, 3 );
+
+  //TopLayout->addWidget( RangeGroup );
+
+  // Colors and Labels ========================================================
+  QGroupBox* ColLabGroup = new QGroupBox (tr("COLORS_LABELS_GRP"), this, "ColLabGroup");
+  ColLabGroup->setColumnLayout(0, Qt::Vertical );
+  ColLabGroup->layout()->setSpacing( 0 );
+  ColLabGroup->layout()->setMargin( 0 );
+  QGridLayout* ColLabGroupLayout = new QGridLayout( ColLabGroup->layout() );
+  ColLabGroupLayout->setAlignment( Qt::AlignTop );
+  ColLabGroupLayout->setSpacing( 6 );
+  ColLabGroupLayout->setMargin( 11 );
+
+  QLabel* ColorLabel = new QLabel (tr("LBL_NB_COLORS"), ColLabGroup, "ColorLabel");
+  ColorSpin = new QSpinBox( 2, 256, 1, ColLabGroup );
+  ColorSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
+  ColorSpin->setMinimumWidth( 70 );
+  ColorSpin->setValue( 64 );
+
+  QLabel* LabelLabel = new QLabel (tr("LBL_NB_LABELS"), ColLabGroup, "LabelLabel");
+  LabelSpin = new QSpinBox( 2, 65, 1, ColLabGroup );
+  LabelSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
+  LabelSpin->setMinimumWidth( 70 );
+  LabelSpin->setValue( 5 );
+
+  ColLabGroupLayout->addWidget( ColorLabel, 0, 0);
+  ColLabGroupLayout->addWidget( ColorSpin,  0, 1);
+  ColLabGroupLayout->addWidget( LabelLabel, 0, 2);
+  ColLabGroupLayout->addWidget( LabelSpin,  0, 3);
+
+  //TopLayout->addWidget( ColLabGroup );
+
+  // Orientation ==========================================================
+  QButtonGroup* OrientGroup = new QButtonGroup (tr("ORIENTATION_GRP"), this, "OrientGroup");
+  OrientGroup->setColumnLayout(0, Qt::Vertical );
+  OrientGroup->layout()->setSpacing( 0 );
+  OrientGroup->layout()->setMargin( 0 );
+  QGridLayout* OrientGroupLayout = new QGridLayout( OrientGroup->layout() );
+  OrientGroupLayout->setAlignment( Qt::AlignTop );
+  OrientGroupLayout->setSpacing( 6 );
+  OrientGroupLayout->setMargin( 11 );
+
+  RBvert = new QRadioButton (tr("VERTICAL_BTN"), OrientGroup, "RBvert");
+  RBvert->setChecked( true );
+  RBhori = new QRadioButton (tr("HORIZONTAL_BTN"), OrientGroup, "RBhori");
+  OrientGroupLayout->addWidget( RBvert, 0, 0 );
+  OrientGroupLayout->addWidget( RBhori, 0, 1 );
+
+  //  TopLayout->addWidget( OrientGroup );
+
+  // Origin ===============================================================
+  QGroupBox* OriginGroup = new QGroupBox (tr("ORIGIN_GRP"), this, "OriginGroup");
+  OriginGroup->setColumnLayout(0, Qt::Vertical );
+  OriginGroup->layout()->setSpacing( 0 );
+  OriginGroup->layout()->setMargin( 0 );
+  QGridLayout* OriginGroupLayout = new QGridLayout( OriginGroup->layout() );
+  OriginGroupLayout->setAlignment( Qt::AlignTop );
+  OriginGroupLayout->setSpacing( 6 );
+  OriginGroupLayout->setMargin( 11 );
+
+  QLabel* XLabel = new QLabel (tr("LBL_X"), OriginGroup, "XLabel");
+  XSpin = new QtxDblSpinBox( 0.0, 1.0, 0.1, OriginGroup );
+  XSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
+  XSpin->setMinimumWidth( 70 );
+  XSpin->setValue( 0.01 );
+
+  QLabel* YLabel = new QLabel (tr("LBL_Y"), OriginGroup, "YLabel");
+  YSpin = new QtxDblSpinBox( 0.0, 1.0, 0.1, OriginGroup );
+  YSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
+  YSpin->setMinimumWidth( 70 );
+  YSpin->setValue( 0.01 );
+
+  OriginGroupLayout->addWidget( XLabel, 0, 0);
+  OriginGroupLayout->addWidget( XSpin,  0, 1);
+  OriginGroupLayout->addWidget( YLabel, 0, 2);
+  OriginGroupLayout->addWidget( YSpin,  0, 3);
+
+  //TopLayout->addWidget( OriginGroup );
+
+  // Dimensions =========================================================
+  QGroupBox* DimGroup = new QGroupBox (tr("DIMENSIONS_GRP"), this, "DimGroup");
+  DimGroup->setColumnLayout(0, Qt::Vertical );
+  DimGroup->layout()->setSpacing( 0 );
+  DimGroup->layout()->setMargin( 0 );
+  QGridLayout* DimGroupLayout = new QGridLayout( DimGroup->layout() );
+  DimGroupLayout->setAlignment( Qt::AlignTop );
+  DimGroupLayout->setSpacing( 6 );
+  DimGroupLayout->setMargin( 11 );
+
+  QLabel* WidthLabel = new QLabel (tr("LBL_WIDTH"), DimGroup, "WidthLabel");
+  WidthSpin = new QtxDblSpinBox( 0.0, 1.0, 0.1, DimGroup );
+  WidthSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
+  WidthSpin->setMinimumWidth( 70 );
+  WidthSpin->setValue( 0.1 );
+
+  QLabel* HeightLabel = new QLabel (tr("LBL_HEIGHT"), DimGroup, "HeightLabel");
+  HeightSpin = new QtxDblSpinBox( 0.0, 1.0, 0.1, DimGroup );
+  HeightSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
+  HeightSpin->setMinimumWidth( 70 );
+  HeightSpin->setValue( 0.8 );
+
+  DimGroupLayout->addWidget( WidthLabel, 0, 0);
+  DimGroupLayout->addWidget( WidthSpin,  0, 1);
+  DimGroupLayout->addWidget( HeightLabel, 0, 2);
+  DimGroupLayout->addWidget( HeightSpin,  0, 3);
+
+  //TopLayout->addWidget( DimGroup );
+
+  // Save check box ===========================================================
+  QHBox* aSaveBox = new QHBox(this);
+  if (!SetPref) {
+    CBSave = new QCheckBox (tr("SAVE_DEFAULT_CHK"), aSaveBox, "CBSave");
+    //TopLayout->addWidget(CBSave);
+  }
+  else {
+    CBSave = 0;
+  }
+  myTextBtn = new QPushButton("Text properties...", aSaveBox);
+  myTextDlg = new VisuGUI_TextPrefDlg(this);
+  myTextDlg->setTitleVisible(!SetPref);
+
+  QGroupBox* CheckGroup = new QGroupBox("", this, "CheckGroup");
+  CheckGroup->setColumnLayout(0, Qt::Vertical );
+  CheckGroup->layout()->setSpacing( 0 );
+  CheckGroup->layout()->setMargin( 0 );
+  QGridLayout* CheckGroupLayout = new QGridLayout( CheckGroup->layout() );
+  
+  myPreviewCheck = new QCheckBox(tr("LBL_SHOW_PREVIEW"), CheckGroup);
+  myPreviewCheck->setChecked(false);
+  CheckGroupLayout->addWidget(myPreviewCheck , 0, 0 );
+
+  // signals and slots connections ===========================================
+  connect( RangeGroup,   SIGNAL( clicked( int ) ), this, SLOT( changeRange( int ) ) );
+  connect( myModeCombo,   SIGNAL( activated( int ) ), this, SLOT( changeScalarMode( int ) ) );
+  connect( OrientGroup,  SIGNAL( clicked( int ) ), this, SLOT( changeDefaults( int ) ) );
+  connect( XSpin,        SIGNAL( valueChanged( double ) ), this, SLOT( XYChanged( double ) ) );
+  connect( YSpin,        SIGNAL( valueChanged( double ) ), this, SLOT( XYChanged( double ) ) );
+  connect( myTextBtn,    SIGNAL( clicked() ), this, SLOT( onTextPref() ) );
+  connect( myPreviewCheck, SIGNAL( toggled( bool )), this, SLOT( onPreviewCheck( bool ) ) );
+  connect( ColorSpin,    SIGNAL( valueChanged( int ) ), this, SLOT( updatePreview() ));
+  connect( LabelSpin,    SIGNAL( valueChanged( int ) ), this, SLOT( updatePreview() ));
+  connect( WidthSpin,    SIGNAL( valueChanged( double ) ), this, SLOT( updatePreview() ));
+  connect( HeightSpin,   SIGNAL( valueChanged( double ) ), this, SLOT( updatePreview() ));
+  connect( CBLog,        SIGNAL( toggled( bool ) ), this, SLOT( updatePreview() ));
+  changeRange( 0 );
+  changeDefaults( 0 );
+  myIsStoreTextProp = false;
+  myBusy = false;
+}
+
+/**
+ * Initializes dialog box values from resources
+ */
+void VisuGUI_ScalarBarPane::initFromResources() {
+  int sbCol=64,sbLab=5,orient=0;
+  float sbX1=0.01,sbY1=0.1,sbW=0.1,sbH=0.8;
+  float sbVmin=0., sbVmax=0.;
+  bool sbRange=false;
+  QString aString;
+
+  SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
+
+  bool anIsArrangeBar = aResourceMgr->booleanValue("VISU", "scalar_bars_default_position", 0);
+  int aPlace = 1;
+  if (anIsArrangeBar){
+    aPlace = aResourceMgr->integerValue("VISU", "scalar_bar_position_num",0);
+  }
+
+  int aScalarMode = aResourceMgr->integerValue("VISU", "scalar_bar_mode", 0);
+  myModeCombo->setCurrentItem(aScalarMode);
+
+  orient = aResourceMgr->integerValue("VISU", "scalar_bar_orientation", orient);
+  if(orient != 0){
+    orient=1;
+    sbX1=0.2;
+    sbY1=0.01;
+    sbW=0.6;
+    sbH=0.12;
+  }
+  
+  QString propertyName = QString( "scalar_bar_%1_" ).arg( orient == 0 ? "vertical" : "horizontal" );
+
+  sbX1 = aResourceMgr->doubleValue("VISU", propertyName + "x", sbX1);
+  sbY1 = aResourceMgr->doubleValue("VISU", propertyName + "y", sbY1);
+
+  sbW = aResourceMgr->doubleValue("VISU", propertyName + "width", sbW);
+  sbH = aResourceMgr->doubleValue("VISU", propertyName + "height",sbH);
+  
+  if(orient){
+    sbY1 += sbH*(aPlace-1);
+  } else {
+    sbX1 += sbW*(aPlace-1);
+  }
+  sbCol = aResourceMgr->integerValue("VISU" ,"scalar_bar_num_colors", sbCol);
+  sbLab = aResourceMgr->integerValue("VISU", "scalar_bar_num_labels", sbLab);
+
+  int rangeType = aResourceMgr->integerValue("VISU" , "scalar_range_type", 0);
+  if (rangeType == 1) sbRange = true;
+  sbVmin = aResourceMgr->doubleValue("VISU", "scalar_range_min", sbVmin);
+  sbVmax = aResourceMgr->doubleValue("VISU", "scalar_range_max", sbVmax);
+
+  bool isLog = aResourceMgr->booleanValue("VISU", "scalar_bar_logarithmic", false);
+  setLogarithmic(isLog);
+  
+  if((sbX1 < 0.) || (sbY1 < 0.) ||
+     ((sbX1+sbW) > 1.) || ((sbY1+sbH) > 1.)) {
+    if(orient == 0) {
+      sbX1=0.01;
+      sbY1=0.1;
+      sbW=0.1;
+      sbH=0.8;
+    } else {
+      sbX1=0.2;
+      sbY1=0.01;
+      sbW=0.6;
+      sbH=0.12;
+    }
+  }
+  if(sbCol < 2) sbCol=2;
+  if(sbCol > 64) sbCol=64;
+  if(sbLab < 2) sbLab=2;
+  if(sbLab > 65) sbLab=65;
+
+  if(sbVmin > sbVmax) {
+    sbVmin=0.;
+    sbVmax=0.;
+  }
+
+  setRange( sbVmin, sbVmax, /*0.0, 0.0,*/ sbRange );
+  setPosAndSize( sbX1, sbY1, sbW, sbH, orient == 0);
+  setScalarBarData( sbCol, sbLab );
+
+  // "Title"
+  bool isBold = false, isItalic = false, isShadow = false;
+  int aFontFamily = VTK_ARIAL;
+
+  if ( aResourceMgr->hasValue( "VISU", "scalar_bar_title_font" ) )
+    {
+      QFont f = aResourceMgr->fontValue( "VISU", "scalar_bar_title_font" );
+      
+      if ( f.family() == "Arial" )
+       aFontFamily = VTK_ARIAL;
+      else if ( f.family() == "Courier" )
+       aFontFamily = VTK_COURIER;
+      else if ( f.family() == "Times" )
+       aFontFamily = VTK_TIMES;
+      
+      isBold = f.bold();
+      isItalic = f.italic();
+      isShadow =  f.underline();
+    }
+  
+  QColor aTextColor = aResourceMgr->colorValue( "VISU", "scalar_bar_title_color", QColor( 255, 255, 255 ) );
+  
+  myTextDlg->myTitleFont->SetData(aTextColor, aFontFamily, isBold, isItalic, isShadow);
+
+  // "Labels"
+  isBold = isItalic = isShadow = false;
+  aFontFamily = VTK_ARIAL;
+
+  if ( aResourceMgr->hasValue( "VISU", "scalar_bar_label_font" ) )
+    {
+      QFont f = aResourceMgr->fontValue( "VISU", "scalar_bar_label_font" );
+      
+      if ( f.family() == "Arial" )
+       aFontFamily = VTK_ARIAL;
+      else if ( f.family() == "Courier" )
+       aFontFamily = VTK_COURIER;
+      else if ( f.family() == "Times" )
+       aFontFamily = VTK_TIMES;
+      
+      isBold = f.bold();
+      isItalic = f.italic();
+      isShadow =  f.underline();
+    }
+  
+  aTextColor = aResourceMgr->colorValue( "VISU", "scalar_bar_label_color", QColor( 255, 255, 255 ) );
+  
+  myTextDlg->myLabelFont->SetData(aTextColor, aFontFamily, isBold, isItalic, isShadow);
+}
+
+/**
+ * Stores dialog values to resources
+ */
+void VisuGUI_ScalarBarPane::storeToResources() {
+  int orient = (RBvert->isChecked())? 0 : 1;
+  float sbX1   = XSpin->value();
+  float sbY1   = YSpin->value();
+  float sbW    = WidthSpin->value();
+  float sbH    = HeightSpin->value();
+  int sbCol  = ColorSpin->value();
+  int sbLab  = LabelSpin->value();
+
+  if((sbX1 < 0.) || (sbY1 < 0.) || ((sbX1+sbW) > 1.) || ((sbY1+sbH) > 1.)) {
+    if(orient == 0) {
+      sbX1=0.01;
+      sbY1=0.1;
+      sbW=0.17;
+      sbH=0.8;
+    } else {
+      sbX1=0.2;
+      sbY1=0.01;
+      sbW=0.6;
+      sbH=0.12;
+    }
+  }
+
+  bool sbRange = RBIrange->isChecked();
+  float sbVmin = (float)(MinEdit->text().toDouble());
+  float sbVmax = (float)(MaxEdit->text().toDouble());
+
+  if(sbVmin > sbVmax) {
+    sbVmin=0.;
+    sbVmax=0.;
+  }
+
+  SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
+
+  aResourceMgr->setValue("VISU", "scalar_bar_orientation", orient);
+
+  QString propertyName = QString( "scalar_bar_%1_" ).arg( orient == 0 ? "vertical" : "horizontal" );
+
+  aResourceMgr->setValue("VISU", propertyName + "x", sbX1);
+  aResourceMgr->setValue("VISU", propertyName + "y", sbY1);
+  aResourceMgr->setValue("VISU", propertyName + "width", sbW);
+  aResourceMgr->setValue("VISU", propertyName + "height", sbH);
+
+  aResourceMgr->setValue("VISU", "scalar_bar_num_colors", sbCol);
+  aResourceMgr->setValue("VISU", "scalar_bar_num_labels", sbLab);
+
+  if(sbRange)
+    {
+      aResourceMgr->setValue("VISU", "scalar_range_type", 1);
+      aResourceMgr->setValue("VISU", "scalar_range_min" ,sbVmin);
+      aResourceMgr->setValue("VISU", "scalar_range_max" ,sbVmax);
+    }
+  else
+    aResourceMgr->setValue("VISU", "scalar_range_type", 0);
+  
+  aResourceMgr->setValue("VISU", "scalar_bar_logarithmic", isLogarithmic());
+  ////
+
+  if (myIsStoreTextProp) {
+    // "Title"
+    QColor aTitleColor (255, 255, 255);
+    int aTitleFontFamily = VTK_ARIAL;
+    bool isTitleBold = false;
+    bool isTitleItalic = false;
+    bool isTitleShadow = false;
+
+    myTextDlg->myTitleFont->GetData(aTitleColor, aTitleFontFamily,
+                                    isTitleBold, isTitleItalic, isTitleShadow);
+
+    QFont aTitleFont;
+    
+    aTitleFont.setBold(isTitleBold);
+    aTitleFont.setItalic(isTitleItalic);
+    aTitleFont.setUnderline(isTitleShadow);
+    
+    QString titleFontFamily;
+    switch (aTitleFontFamily) {
+    case VTK_ARIAL:
+      titleFontFamily = "Arial";
+      break;
+    case VTK_COURIER:
+      titleFontFamily = "Courier";
+      break;
+    case VTK_TIMES:
+      titleFontFamily = "Times";
+      break;
+    }
+    aTitleFont.setFamily(titleFontFamily);
+    
+    aResourceMgr->setValue("VISU", "scalar_bar_title_font", aTitleFont);
+    
+    aResourceMgr->setValue("VISU", "scalar_bar_title_color", aTitleColor);
+    
+    // "Label"
+    QColor aLabelColor (255, 255, 255);
+    int aLabelFontFamily = VTK_ARIAL;
+    bool isLabelBold = false;
+    bool isLabelItalic = false;
+    bool isLabelShadow = false;
+
+    myTextDlg->myLabelFont->GetData(aLabelColor, aLabelFontFamily,
+                                    isLabelBold, isLabelItalic, isLabelShadow);
+
+
+    QFont aLabelFont;
+    
+    aLabelFont.setBold(isLabelBold);
+    aLabelFont.setItalic(isLabelItalic);
+    aLabelFont.setUnderline(isLabelShadow);
+
+    QString labelFontFamily;
+    switch (aLabelFontFamily) {
+    case VTK_ARIAL:
+      labelFontFamily = "Arial";
+      break;
+    case VTK_COURIER:
+      labelFontFamily = "Courier";
+      break;
+    case VTK_TIMES:
+      labelFontFamily = "Times";
+      break;
+    }
+
+    aLabelFont.setFamily(labelFontFamily);
+    
+    aResourceMgr->setValue("VISU", "scalar_bar_label_font", aLabelFont);
+
+    aResourceMgr->setValue("VISU", "scalar_bar_label_color", aLabelColor);
+  }
+}
+
+/**
+ * Initialise dialog box from presentation object
+ */
+void VisuGUI_ScalarBarPane::initFromPrsObject(VISU::ColoredPrs3d_i* thePrs)
+{
+  initFromResources();
+  myScalarMap = dynamic_cast<VISU::ScalarMap_i*>(thePrs);
+  if( !myScalarMap )
+    return;
+
+  myTitle = myScalarMap->GetTitle();
+  setPosAndSize( myScalarMap->GetPosX(),
+                myScalarMap->GetPosY(),
+                myScalarMap->GetWidth(),
+                myScalarMap->GetHeight(),
+                myScalarMap->GetBarOrientation());
+  switch(myScalarMap->GetScaling()){
+  case VISU::LOGARITHMIC :
+    setLogarithmic(true);
+    break;
+  default:
+    setLogarithmic(false);
+  }
+  CORBA::Double aRange[2] = {myScalarMap->GetSourceMin(), myScalarMap->GetSourceMax()};
+  Rmin = aRange[0]; Rmax = aRange[1];
+  setRange( myScalarMap->GetMin(), myScalarMap->GetMax(),
+           /*0.0, 0.0,*/ myScalarMap->IsRangeFixed() );
+  setScalarBarData( myScalarMap->GetNbColors(), myScalarMap->GetLabels() );
+
+  // Update myModeCombo
+  int aNbComp = myScalarMap->GetField()->myNbComp;
+  bool isScalarMode = (aNbComp > 1);
+  myModeCombo->clear();
+  myModeCombo->insertItem("<Modulus>");
+  const VISU::PField& aField = myScalarMap->GetField();
+  const VISU::TNames& aCompNames = aField->myCompNames;
+  const VISU::TNames& aUnitNames = aField->myUnitNames;
+  for(int i = 0; i < aNbComp; i++){
+    QString aComponent = QString(aCompNames[i].c_str()).simplifyWhiteSpace();
+    if(aComponent.isNull() || aComponent == "")
+      aComponent = "Component " + QString::number(i+1);
+    else
+      aComponent = "[" + QString::number(i+1) + "] " + aComponent;
+
+    QString anUnit = QString(aUnitNames[i].c_str()).simplifyWhiteSpace();
+    if(anUnit.isNull() || anUnit == "")
+      anUnit = "-";
+    
+    aComponent = aComponent + ", " + anUnit;
+
+    myModeCombo->insertItem(aComponent);
+  }
+  //
+  myModeCombo->setCurrentItem(myScalarMap->GetScalarMode());
+  if (aNbComp==1){
+    myModeCombo->setCurrentItem(1);
+  }
+  //
+  myModeLbl->setEnabled(isScalarMode);
+  myModeCombo->setEnabled(isScalarMode);
+
+  // "Title"
+  myTextDlg->setTitleText(QString(myScalarMap->GetTitle()));
+
+  vtkFloatingPointType R, G, B;
+  myScalarMap->GetTitleColor(&R, &G, &B);
+
+  myTextDlg->myTitleFont->SetData(QColor((int)(R*255.), (int)(G*255.), (int)(B*255.)),
+                                  myScalarMap->GetTitFontType(),
+                                  myScalarMap->IsBoldTitle(),
+                                  myScalarMap->IsItalicTitle(),
+                                  myScalarMap->IsShadowTitle());
+
+  // "Labels"
+  myScalarMap->GetLabelColor(&R, &G, &B);
+
+  myTextDlg->myLabelFont->SetData(QColor((int)(R*255.), (int)(G*255.), (int)(B*255.)),
+                                  myScalarMap->GetLblFontType(),
+                                  myScalarMap->IsBoldLabel(),
+                                  myScalarMap->IsItalicLabel(),
+                                  myScalarMap->IsShadowLabel());
+
+  // Draw Preview
+  if (myPreviewCheck->isChecked()) {
+    createScalarBar();
+    updatePreview();
+  }
+
+}
+/*! Slot update preview of scalar bar, if preview is checked
+ */
+void VisuGUI_ScalarBarPane::updatePreview()
+{
+  if (myPreviewCheck->isChecked()) {
+    if (SVTK_ViewWindow* vf = VISU::GetActiveViewWindow<SVTK_ViewWindow>()) {
+      deleteScalarBar();
+      createScalarBar();
+      vf->Repaint();
+    }
+  }
+}
+
+/*! Creating preview scalar bar
+ */
+void VisuGUI_ScalarBarPane::createScalarBar()
+{
+  if (VISU::GetActiveViewWindow<SVTK_ViewWindow>() == NULL) return;
+  if (myPreviewActor != 0) return;
+  if (myScalarMap == NULL) return;
+
+  if (!check()) return;
+  myScalarMapPL = VISU_ScalarMapPL::New();
+  if(myScalarMap->GetSpecificPL())
+    myScalarMapPL->ShallowCopy(myScalarMap->GetSpecificPL(), true);
+  
+  if ( myBusy ) return;
+
+  myBusy = true;
+
+  int sbCol,sbLab;
+  sbCol = getNbColors();
+  sbLab = getNbLabels();
+  if(sbCol < 2) sbCol=2;
+  if(sbCol > 64) sbCol=64;
+  if(sbLab < 2) sbLab=2;
+  if(sbLab > 65) sbLab=65;
+  myPreviewActor = VISU_ScalarMapAct::New();
+  VISU_ScalarBarActor* aScalarBarActor = myPreviewActor->GetScalarBar();
+  myPreviewActor->GetScalarBar()->VisibilityOn();
+  myPreviewActor->PickableOff();
+  
+  myScalarMapPL->SetScalarMode(myModeCombo->currentItem());
+  if(isLogarithmic())
+    myScalarMapPL->SetScaling(VISU::LOGARITHMIC);
+  else
+    myScalarMapPL->SetScaling(VISU::LINEAR);
+  vtkFloatingPointType theRange[2];
+  theRange[0] = (vtkFloatingPointType)MinEdit->text().toDouble();
+  theRange[1] = (vtkFloatingPointType)MaxEdit->text().toDouble();
+  myScalarMapPL->SetScalarRange(theRange);
+  myScalarMapPL->SetNbColors(sbCol);
+  
+  myScalarMapPL->Update();
+  
+  aScalarBarActor->SetLookupTable(myScalarMapPL->GetBarTable());
+  
+  if (myTextDlg->getTitleText().latin1() != "") 
+    aScalarBarActor->SetTitle(myTextDlg->getTitleText().latin1());
+  else
+    aScalarBarActor->SetTitle(myTitle.c_str());
+  aScalarBarActor->SetOrientation(getOrientation());
+  aScalarBarActor->GetPositionCoordinate()->SetCoordinateSystemToNormalizedViewport();
+  aScalarBarActor->GetPositionCoordinate()->SetValue(getX(),getY());
+  aScalarBarActor->SetWidth(getWidth());
+  aScalarBarActor->SetHeight(getHeight());
+  aScalarBarActor->SetNumberOfLabels(sbLab);
+  aScalarBarActor->SetMaximumNumberOfColors(sbCol);
+
+  // title text property
+  QColor aTitleColor;
+  int aTitleFontFamily;
+  bool isTitleBold;
+  bool isTitleItalic;
+  bool isTitleShadow;
+  myTextDlg->myTitleFont->GetData(aTitleColor,aTitleFontFamily,
+                                 isTitleBold,isTitleItalic,isTitleShadow);
+  vtkTextProperty* aTitleProp = aScalarBarActor->GetTitleTextProperty();
+  aTitleProp->SetFontFamily(aTitleFontFamily);
+  aTitleProp->SetColor(vtkFloatingPointType(aTitleColor.red())/255.,
+                      vtkFloatingPointType(aTitleColor.green())/255.,
+                      vtkFloatingPointType(aTitleColor.blue())/255.);
+  (isTitleBold)? aTitleProp->BoldOn() : aTitleProp->BoldOff();
+  (isTitleItalic)? aTitleProp->ItalicOn() : aTitleProp->ItalicOff();
+  (isTitleShadow)? aTitleProp->ShadowOn() : aTitleProp->ShadowOff();
+  
+  // label text property
+  QColor aLabelColor;
+  int aLabelFontFamily;
+  bool isLabelBold;
+  bool isLabelItalic;
+  bool isLabelShadow;
+  myTextDlg->myLabelFont->GetData(aLabelColor, aLabelFontFamily,
+                                 isLabelBold, isLabelItalic, isLabelShadow);
+  vtkTextProperty* aLabelProp = aScalarBarActor->GetLabelTextProperty();
+  aLabelProp->SetFontFamily(aLabelFontFamily);
+  aLabelProp->SetColor(vtkFloatingPointType(aLabelColor.red())/255.,
+                      vtkFloatingPointType(aLabelColor.green())/255.,
+                      vtkFloatingPointType(aLabelColor.blue())/255.);
+  (isLabelBold)? aLabelProp->BoldOn() : aLabelProp->BoldOff();
+  (isLabelItalic)? aLabelProp->ItalicOn() : aLabelProp->ItalicOff();
+  (isLabelShadow)? aLabelProp->ShadowOn() : aLabelProp->ShadowOff();
+
+  aScalarBarActor->Modified();
+
+  VISU::GetActiveViewWindow<SVTK_ViewWindow>()->AddActor(myPreviewActor);
+
+  myBusy = false;
+}
+/*! Deleting preview scalar bar
+ */
+void VisuGUI_ScalarBarPane::deleteScalarBar()
+{
+  if ( myBusy ) return;
+  
+  if (myPreviewActor == 0) return;
+  vtkRenderer* aRend       = myPreviewActor->GetRenderer();
+  vtkRenderWindow* aWnd = aRend->GetRenderWindow();
+  if(aRend && aWnd)
+    myPreviewActor->RemoveFromRender(aRend);
+  myPreviewActor->GetScalarBar()->VisibilityOff();
+  myPreviewActor->Delete();
+  myPreviewActor = 0;
+
+  if (myScalarMapPL){
+    myScalarMapPL->Delete();
+    myScalarMapPL = 0;
+  }
+}
+/*! public: Deleting preview scalar bar
+ */
+void VisuGUI_ScalarBarPane::deletePreview()
+{
+  deleteScalarBar();
+  if (SVTK_ViewWindow* vf = VISU::GetActiveViewWindow<SVTK_ViewWindow>())
+    vf->Repaint();
+}
+/**
+ * Store values to presentation object
+ */
+int VisuGUI_ScalarBarPane::storeToPrsObject(VISU::ColoredPrs3d_i* thePrs) {
+  if( !myScalarMap )
+    return 0;
+
+  myScalarMap->SetScalarMode(myModeCombo->currentItem());
+  myScalarMap->SetPosition(XSpin->value(), YSpin->value());
+  myScalarMap->SetSize(WidthSpin->value(), HeightSpin->value());
+  myScalarMap->SetBarOrientation((RBvert->isChecked())? VISU::ScalarMap::VERTICAL : VISU::ScalarMap::HORIZONTAL);
+  if(isLogarithmic())
+    myScalarMap->SetScaling(VISU::LOGARITHMIC);
+  else
+    myScalarMap->SetScaling(VISU::LINEAR);
+
+  if (RBFrange->isChecked()) {
+    myScalarMap->SetSourceRange();
+  } else {
+    myScalarMap->SetRange(MinEdit->text().toDouble(), MaxEdit->text().toDouble());
+  }
+  myScalarMap->SetNbColors(ColorSpin->value());
+  myScalarMap->SetLabels(LabelSpin->value());
+
+  if (isToSave()) storeToResources();
+
+  if (myIsStoreTextProp) {
+    // "Title"
+    myScalarMap->SetTitle(myTextDlg->getTitleText().latin1());
+
+    QColor aTitColor (255, 255, 255);
+    int aTitleFontFamily = VTK_ARIAL;
+    bool isTitleBold = false;
+    bool isTitleItalic = false;
+    bool isTitleShadow = false;
+
+    myTextDlg->myTitleFont->GetData(aTitColor, aTitleFontFamily,
+                                    isTitleBold, isTitleItalic, isTitleShadow);
+
+    myScalarMap->SetBoldTitle(isTitleBold);
+    myScalarMap->SetItalicTitle(isTitleItalic);
+    myScalarMap->SetShadowTitle(isTitleShadow);
+    myScalarMap->SetTitFontType(aTitleFontFamily);
+    myScalarMap->SetTitleColor(aTitColor.red()/255.,
+                         aTitColor.green()/255.,
+                         aTitColor.blue()/255.);
+
+    // "Label"
+    QColor aLblColor (255, 255, 255);
+    int aLabelFontFamily = VTK_ARIAL;
+    bool isLabelBold = false;
+    bool isLabelItalic = false;
+    bool isLabelShadow = false;
+
+    myTextDlg->myLabelFont->GetData(aLblColor, aLabelFontFamily,
+                                    isLabelBold, isLabelItalic, isLabelShadow);
+
+    myScalarMap->SetBoldLabel(isLabelBold);
+    myScalarMap->SetItalicLabel(isLabelItalic);
+    myScalarMap->SetShadowLabel(isLabelShadow);
+    myScalarMap->SetLblFontType(aLabelFontFamily);
+    myScalarMap->SetLabelColor(aLblColor.red()/255.,
+                              aLblColor.green()/255.,
+                              aLblColor.blue()/255.);
+    myIsStoreTextProp = false;
+  }
+
+  return 1;
+}
+
+/*!
+  Called when orientation is changed
+*/
+void VisuGUI_ScalarBarPane::changeDefaults( int )
+{
+  if ( RBvert->isChecked() ) {
+    XSpin->setValue( myVerX );
+    YSpin->setValue( myVerY );
+    WidthSpin->setValue( myVerW );
+    HeightSpin->setValue( myVerH );
+  }
+  else {
+    XSpin->setValue( myHorX );
+    YSpin->setValue( myHorY );
+    WidthSpin->setValue( myHorW );
+    HeightSpin->setValue( myHorH );
+  }
+  updatePreview();
+}
+
+/*!
+  Called when Range mode is changed
+*/
+void VisuGUI_ScalarBarPane::changeRange( int )
+{
+  int mode = -1;
+  if ( RBFrange->isChecked() )
+    mode = 0;
+  if ( RBIrange->isChecked() )
+    mode = 1;
+  if ( myRangeMode == mode )
+    return;
+  //MinSpin->setMaxValue( Fmin );
+  //MaxSpin->setMinValue( Fmax );
+  if ( RBFrange->isChecked() ) {
+    //MinLabel->setEnabled( false );
+    MinEdit->setEnabled( false );
+    //MaxLabel->setEnabled( false );
+    MaxEdit->setEnabled( false );
+    if ( mode != -1 ) {
+      Imin = MinEdit->text().toDouble();
+      Imax = MaxEdit->text().toDouble();
+    }
+    MinEdit->setText( QString::number( Rmin ) );
+    MaxEdit->setText( QString::number( Rmax ) );
+  }
+  else {
+    //MinLabel->setEnabled( true );
+    MinEdit->setEnabled( true );
+    //MaxLabel->setEnabled( true );
+    MaxEdit->setEnabled( true );
+    MinEdit->setText( QString::number( Imin ) );
+    MaxEdit->setText( QString::number( Imax ) );
+  }
+  myRangeMode = mode;
+  updatePreview();
+}
+
+/*!
+  Called when X,Y position is changed
+*/
+void VisuGUI_ScalarBarPane::XYChanged( double )
+{
+  QtxDblSpinBox* snd = (QtxDblSpinBox*)sender();
+  if ( snd == XSpin ) {
+    WidthSpin->setMaxValue( 1.0 - XSpin->value() );
+  }
+  if ( snd == YSpin ) {
+    HeightSpin->setMaxValue( 1.0 - YSpin->value() );
+  }
+  updatePreview();
+}
+
+/*!
+  Called when scalar mode is changed
+*/
+void VisuGUI_ScalarBarPane::changeScalarMode( int theMode )
+{
+  if ( myScalarMap ) {
+    if ( RBFrange->isChecked() ) {
+      int aMode = myScalarMap->GetScalarMode();
+      myScalarMap->SetScalarMode(theMode);
+      CORBA::Double aRange[2] = {myScalarMap->GetSourceMin(), myScalarMap->GetSourceMax()};
+      MinEdit->setText( QString::number( aRange[0] ) );
+      MaxEdit->setText( QString::number( aRange[1] ) );
+      myScalarMap->SetScalarMode(aMode);
+    }
+  }
+  updatePreview();
+}
+
+/*!
+  Sets default values and range mode
+*/
+void VisuGUI_ScalarBarPane::setRange( double imin, double imax/*, double fmin, double fmax*/, bool sbRange )
+{
+  Imin = imin; Imax = imax;// Fmin = fmin; Fmax = fmax;
+  if ( RBIrange->isChecked() ) {
+    MinEdit->setText( QString::number( Imin ) );
+    MaxEdit->setText( QString::number( Imax ) );
+  }
+  else {
+    MinEdit->setText( QString::number( Rmin ) );
+    MaxEdit->setText( QString::number( Rmax ) );
+  }
+  myRangeMode = -1;
+  if( sbRange )
+    RBIrange->setChecked( true );
+  else
+    RBFrange->setChecked( true );
+  changeRange( 0 );
+}
+
+/*!
+  Sets default values and range mode
+*/
+void VisuGUI_ScalarBarPane::setDefaultRange(double imin, double imax){
+  Rmin = imin;
+  Rmax = imax;
+}
+
+/*!
+  Sets and gets parameters
+*/
+bool VisuGUI_ScalarBarPane::isIRange() {
+  return RBIrange->isChecked();
+}
+
+double VisuGUI_ScalarBarPane::getMin() {
+  return MinEdit->text().toDouble();
+}
+
+double VisuGUI_ScalarBarPane::getMax() {
+  return MaxEdit->text().toDouble();
+}
+
+double VisuGUI_ScalarBarPane::getX() {
+  return XSpin->value();
+}
+
+double VisuGUI_ScalarBarPane::getY() {
+  return YSpin->value();
+}
+
+double VisuGUI_ScalarBarPane::getWidth() {
+  return WidthSpin->value();
+}
+
+double VisuGUI_ScalarBarPane::getHeight() {
+  return HeightSpin->value();
+}
+
+int VisuGUI_ScalarBarPane::getNbColors() {
+  return ColorSpin->value();
+}
+
+int VisuGUI_ScalarBarPane::getNbLabels() {
+  return LabelSpin->value();
+}
+
+bool VisuGUI_ScalarBarPane::isLogarithmic() {
+  return CBLog->isChecked();
+}
+
+void VisuGUI_ScalarBarPane::setLogarithmic( bool on ) {
+  CBLog->setChecked( on );
+}
+
+bool VisuGUI_ScalarBarPane::isToSave() {
+  return CBSave ? CBSave->isChecked() : false;
+}
+
+/*!
+  Sets size and position
+*/
+void VisuGUI_ScalarBarPane::setPosAndSize( double x, double y, double w, double h, bool vert )
+{
+  if ( vert ) {
+    myVerX = x;
+    myVerY = y;
+    myVerW = w;
+    myVerH = h;
+    RBvert->setChecked( true );
+  }
+  else {
+    myHorX = x;
+    myHorY = y;
+    myHorW = w;
+    myHorH = h;
+    RBhori->setChecked( true );
+  }
+  changeDefaults( 0 );
+}
+
+/*!
+  Sets colors and labels number
+*/
+void VisuGUI_ScalarBarPane::setScalarBarData( int colors, int labels )
+{
+  ColorSpin->setValue( colors );
+  LabelSpin->setValue( labels );
+}
+
+/*!
+  Gets orientation
+*/
+int  VisuGUI_ScalarBarPane::getOrientation()
+{
+  if (RBvert->isChecked() )
+    return  1;
+  else
+    return 0;
+}
+
+/*!
+  Called when <OK> button is clicked, validates data and closes dialog
+*/
+bool VisuGUI_ScalarBarPane::check()
+{
+  double minVal = MinEdit->text().toDouble();
+  double maxVal = MaxEdit->text().toDouble();
+  if ( RBIrange->isChecked() ) {
+    if (minVal >= maxVal) {
+      SUIT_MessageBox::warn1( this,tr("WRN_VISU"),
+                            tr("MSG_MINMAX_VALUES"),
+                            tr("BUT_OK"));
+      return false;
+    }
+  }
+  // check if logarithmic mode is on and check imposed range to not contain negative values
+  if ( CBLog->isChecked() ) {
+    if ( RBIrange->isChecked() ) {
+      if ( (minVal > 0) && (maxVal > 0) ) {
+       // nothing to do
+      }
+      else {
+       SUIT_MessageBox::warn1( this,
+                               tr("WRN_VISU"),
+                               tr("WRN_LOGARITHMIC_RANGE"),
+                               tr("BUT_OK"));
+       return false;
+      }
+    }
+    else {
+      if ( Rmin > 0 && Rmax > 0 ) {
+       // nothing to do
+      }
+      else {
+       SUIT_MessageBox::warn1( this,
+                               tr("WRN_VISU"),
+                               tr("WRN_LOGARITHMIC_FIELD_RANGE"),
+                               tr("BUT_OK"));
+       RBIrange->setChecked(1);
+       changeRange(1);
+       //MinEdit->setText( QString::number( Rmin ) );
+       //MaxEdit->setText( QString::number( Rmax ) );
+       return false;
+      }
+    }
+  }
+  return true;
+}
+
+void VisuGUI_ScalarBarPane::onTextPref()
+{
+  myTextDlg->storeBeginValues();
+  myIsStoreTextProp = myTextDlg->exec() || myIsStoreTextProp;
+  updatePreview();
+}
+
+void VisuGUI_ScalarBarPane::onPreviewCheck (bool thePreview)
+{
+  if (SVTK_ViewWindow* vf = VISU::GetActiveViewWindow<SVTK_ViewWindow>()) {
+    if (thePreview) {
+      createScalarBar();
+    } else {
+      deleteScalarBar();
+    }
+    vf->Repaint();
+  }
+}
+
+VisuGUI_Prs3dDlg::VisuGUI_Prs3dDlg( SalomeApp_Module* theModule )
+  : QDialog( VISU::GetDesktop( theModule ), 0, false,
+            WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
+{
+}
+
+void VisuGUI_Prs3dDlg::initFromPrsObject( VISU::ColoredPrs3d_i* thePrs, bool theInit )
+{
+}
+
+int VisuGUI_Prs3dDlg::storeToPrsObject( VISU::ColoredPrs3d_i* thePrs )
+{
+  return 1;
+}
diff --git a/src/VISUGUI/VisuGUI_Prs3dDlg.h b/src/VISUGUI/VisuGUI_Prs3dDlg.h
new file mode 100644 (file)
index 0000000..5f6541f
--- /dev/null
@@ -0,0 +1,198 @@
+//  VISU VISUGUI : GUI of VISU component
+//
+//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+//
+//
+//  File   : VisuGUI_Prs3dDlg.h
+//  Author : Laurent CORNABE & Hubert ROLLAND
+//  Module : VISU
+
+#ifndef VISUGUI_PRS3DDLG_H
+#define VISUGUI_PRS3DDLG_H
+
+#include <qdialog.h>
+#include <qvbox.h>
+
+#include "SALOME_GenericObjPointer.hh"
+
+class QButtonGroup;
+class QGroupBox;
+class QLabel;
+class QCheckBox;
+class QPushButton;
+class QRadioButton;
+class QSpinBox;
+class QLineEdit;
+class QComboBox;
+class QToolButton;
+class QTabWidget;
+
+class QtxDblSpinBox;
+
+class SalomeApp_Module;
+class SVTK_FontWidget;
+class VISU_ScalarMapAct;
+class VISU_ScalarMapPL;
+
+namespace VISU
+{
+  class ColoredPrs3d_i;
+  class ScalarMap_i;
+}
+
+class VisuGUI_TextPrefDlg: public QDialog
+{
+  Q_OBJECT;
+
+ public:
+  VisuGUI_TextPrefDlg (QWidget* parent);
+  ~VisuGUI_TextPrefDlg() {};
+
+  QString getTitleText();
+  void setTitleText(QString theText);
+
+  void setTitleVisible(bool isVisible);
+
+  void storeBeginValues();
+
+ private:
+  void keyPressEvent( QKeyEvent* e );
+
+ public:
+  SVTK_FontWidget* myTitleFont;
+  SVTK_FontWidget* myLabelFont;
+
+ protected slots:
+  void accept();
+  void reject();
+  void onHelp();
+
+ private:
+  QLineEdit* myTitleEdt;
+  QString    myTitle;
+  QColor     myColors[2];
+  int        myComboVals[2];
+  bool       myCheckVals[6];
+};
+
+
+class VisuGUI_ScalarBarPane : public QVBox
+{
+  Q_OBJECT;
+
+ public:
+  VisuGUI_ScalarBarPane(QWidget* parent, bool SetPref);
+  ~VisuGUI_ScalarBarPane() {};
+
+  void    setRange( double imin, double imax, /*double fmin, double fmax,*/ bool sbRange );
+  void    setDefaultRange(double imin, double imax);
+  int     getOrientation();
+  void    setPosAndSize( double x, double y, double w, double h, bool vert );
+  void    setScalarBarData( int colors, int labels );
+  bool    isIRange();
+  double  getMin();
+  double  getMax();
+  double  getX();
+  double  getY();
+  double  getWidth();
+  double  getHeight();
+  int     getNbColors();
+  int     getNbLabels();
+  bool    isLogarithmic();
+  void    setLogarithmic( bool on );
+  bool    isToSave();
+
+  void initFromResources();
+  void storeToResources();
+
+  void initFromPrsObject(VISU::ColoredPrs3d_i* thePrs);
+  int storeToPrsObject(VISU::ColoredPrs3d_i* thePrs);
+
+  bool check();
+  void deletePreview();
+
+ protected:
+  QButtonGroup*   RangeGroup;
+  QRadioButton*   RBFrange;
+  QRadioButton*   RBIrange;
+  QLineEdit*      MinEdit;
+  QLineEdit*      MaxEdit;
+
+  QRadioButton*   RBhori;
+  QRadioButton*   RBvert;
+
+  QtxDblSpinBox*  XSpin;
+  QtxDblSpinBox*  YSpin;
+
+  QtxDblSpinBox*  WidthSpin;
+  QtxDblSpinBox*  HeightSpin;
+
+  QSpinBox*       ColorSpin;
+  QSpinBox*       LabelSpin;
+
+  QCheckBox*      CBSave;
+  QCheckBox*      CBLog;
+  QLabel*         myModeLbl;
+  QComboBox*      myModeCombo;
+  QPushButton*    myTextBtn;
+  VisuGUI_TextPrefDlg* myTextDlg;
+
+  double          Imin,   Imax,  /* Fmin,   Fmax,*/   Rmin,   Rmax;
+  double          myHorX, myHorY, myHorW, myHorH;
+  double          myVerX, myVerY, myVerW, myVerH;
+  int             myRangeMode;
+  bool myIsStoreTextProp;
+
+ private slots:
+  void changeDefaults( int );
+  void changeRange( int );
+  void XYChanged( double );
+  void changeScalarMode( int );
+  void onTextPref();
+  void onPreviewCheck(bool thePreview);
+  void updatePreview();
+
+ private:
+  void createScalarBar();
+  void deleteScalarBar();
+
+  QCheckBox* myPreviewCheck;
+  VISU_ScalarMapAct* myPreviewActor;
+  VISU::ScalarMap_i* myScalarMap;
+  VISU_ScalarMapPL* myScalarMapPL;
+  std::string       myTitle;
+
+  bool myBusy;
+};
+
+class VisuGUI_Prs3dDlg : public QDialog
+{
+  Q_OBJECT;
+
+ public:
+  VisuGUI_Prs3dDlg( SalomeApp_Module* theModule );
+  ~VisuGUI_Prs3dDlg() {}
+
+  virtual void     initFromPrsObject( VISU::ColoredPrs3d_i* thePrs, bool theInit = true );
+  virtual int      storeToPrsObject( VISU::ColoredPrs3d_i* thePrs );
+};
+
+#endif
diff --git a/src/VISUGUI/VisuGUI_Slider.cxx b/src/VISUGUI/VisuGUI_Slider.cxx
new file mode 100644 (file)
index 0000000..b9141af
--- /dev/null
@@ -0,0 +1,451 @@
+//  VISU VISUGUI : GUI of VISU component
+//
+//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+//
+//
+//  File   : VisuGUI_Slider.cxx
+//  Author : Oleg UVAROV
+//  Module : VISU
+
+#include "VisuGUI_Slider.h"
+
+#include "SUIT_ResourceMgr.h"
+#include "SUIT_Session.h"
+
+#include "SalomeApp_Application.h"
+#include "SalomeApp_Study.h"
+
+#include "LightApp_SelectionMgr.h"
+
+#include "SALOME_ListIteratorOfListIO.hxx"
+
+#include "VISU_PipeLine.hxx"
+
+#include "VISU_Actor.h"
+
+#include "VVTK_MainWindow.h"
+#include "VVTK_ViewWindow.h"
+
+#include "VISU_Gen_i.hh"
+#include "VisuGUI_Module.h"
+#include "VisuGUI_Tools.h"
+#include "VisuGUI_Prs3dTools.h"
+
+#include "VTKViewer_Algorithm.h"
+#include "SVTK_Functor.h"
+
+#include <vtkActorCollection.h>
+#include <vtkRenderer.h>
+
+#include <qcombobox.h>
+#include <qfont.h>
+#include <qlabel.h>
+#include <qlayout.h>
+#include <qlineedit.h>
+#include <qtoolbutton.h>
+#include <qtooltip.h>
+#include <qslider.h>
+#include <qspinbox.h>
+#include <qtimer.h>
+
+/*!
+  Constructor
+*/
+VisuGUI_Slider::VisuGUI_Slider( VisuGUI_Module* theModule, 
+                               VVTK_ViewWindow* theViewWindow,
+                               LightApp_SelectionMgr* theSelectionMgr )
+  : QtxDockWindow( InDock, theViewWindow->getMainWindow1() ),
+    myModule( theModule ),
+    myMainWindow( theViewWindow->getMainWindow1() ),
+    mySelectionMgr( theSelectionMgr )
+{
+  VISU::ViewManager_var aViewManager = VISU::GetVisuGen( myModule )->GetViewManager();
+  VISU::View_var aView = aViewManager->GetCurrentView();
+  if(!CORBA::is_nil(aView.in()))
+    myView3D = VISU::View3D::_narrow(aView);
+
+  SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
+
+  setHorizontallyStretchable( true );
+
+  QWidget* aWidget = new QWidget( this );
+  setWidget( aWidget );
+
+  QGridLayout* aLayout = new QGridLayout( aWidget, 2, 13, 11, 6 );
+
+  // Slider and time stamps
+  myFirstTimeStamp = new QLabel( aWidget );
+  myFirstTimeStamp->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
+  aLayout->addWidget( myFirstTimeStamp, 0, 0, Qt::AlignHCenter );
+
+  mySlider = new QSlider( aWidget );
+  mySlider->setMinValue( 0 );
+  mySlider->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
+  mySlider->setOrientation( QSlider::Horizontal );
+  mySlider->setTracking( false );
+  aLayout->addMultiCellWidget( mySlider, 0, 0, 1, 8 );
+
+  myLastTimeStamp = new QLabel( aWidget );
+  myLastTimeStamp->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
+  aLayout->addWidget( myLastTimeStamp, 0, 9, Qt::AlignHCenter );
+
+  myTimeStampsNumber = new QLabel( aWidget );
+  myTimeStampsNumber->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
+  aLayout->addWidget( myTimeStampsNumber, 0, 10, Qt::AlignHCenter );
+
+  QLabel* aCacheMemoryLabel = new QLabel( tr( "CACHE_MEMORY" ), aWidget );
+  aCacheMemoryLabel->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
+  aLayout->addWidget( aCacheMemoryLabel, 0, 11 );
+
+  myCacheMemory = new QLabel( aWidget );
+  myCacheMemory->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
+  QFontMetrics fm( myCacheMemory->font() );
+  myCacheMemory->setFixedWidth( fm.width( "9.99E+99 Mb" ) );
+
+  aLayout->addWidget( myCacheMemory, 0, 12 );
+
+  // Buttons
+  myMoreButton = new QToolButton( aWidget );
+  myMoreButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
+  myMoreButton->setEnabled( false );
+  myMoreButton->setToggleButton( true );
+  myMoreButton->setIconSet( aResourceMgr->loadPixmap( "VISU", tr( "ICON_SLIDER_MORE" ) ) );
+  QToolTip::add( myMoreButton, tr( "MORE" ) );
+  aLayout->addWidget( myMoreButton, 1, 0 );
+
+  myAVIButton = new QToolButton( aWidget );
+  myAVIButton->setEnabled( false );
+  myAVIButton->setToggleButton( true );
+  myAVIButton->setIconSet( aResourceMgr->loadPixmap( "VISU", tr( "ICON_SLIDER_AVI" ) ) );
+  QToolTip::add( myAVIButton, tr( "AVI" ) );
+  aLayout->addWidget( myAVIButton, 1, 1 );
+
+  aLayout->addItem( new QSpacerItem( 24, 24, QSizePolicy::Expanding, QSizePolicy::Minimum ), 1, 2 );
+
+  myFirstButton = new QToolButton( aWidget );
+  myFirstButton->setIconSet( aResourceMgr->loadPixmap( "VISU", tr( "ICON_SLIDER_FIRST" ) ) );
+  aLayout->addWidget( myFirstButton, 1, 3 );
+
+  myPreviousButton = new QToolButton( aWidget );
+  myPreviousButton->setIconSet( aResourceMgr->loadPixmap( "VISU", tr( "ICON_SLIDER_PREVIOUS" ) ) );
+  aLayout->addWidget( myPreviousButton, 1, 4 );
+
+  myPlayButton = new QToolButton( aWidget );
+  myPlayButton->setIconSet( aResourceMgr->loadPixmap( "VISU", tr( "ICON_SLIDER_PLAY" ) ) );
+  myPlayButton->setToggleButton( true );
+  aLayout->addWidget( myPlayButton, 1, 5 );
+
+  myNextButton = new QToolButton( aWidget );
+  myNextButton->setIconSet( aResourceMgr->loadPixmap( "VISU", tr( "ICON_SLIDER_NEXT" ) ) );
+  aLayout->addWidget( myNextButton, 1, 6 );
+
+  myLastButton = new QToolButton( aWidget );
+  myLastButton->setIconSet( aResourceMgr->loadPixmap( "VISU", tr( "ICON_SLIDER_LAST" ) ) );
+  aLayout->addWidget( myLastButton, 1, 7 );
+
+  aLayout->addItem( new QSpacerItem( 24, 24, QSizePolicy::Expanding, QSizePolicy::Minimum ), 1, 8 );
+
+  myTimeStampStrings = new QComboBox( aWidget );
+  myTimeStampStrings->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
+  aLayout->addWidget( myTimeStampStrings, 1, 9 );
+
+  myTimeStampIndices = new QComboBox( aWidget );
+  myTimeStampIndices->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
+  aLayout->addWidget( myTimeStampIndices, 1, 10 );
+
+  // Speed
+  QLabel* aSpeedLabel = new QLabel( tr( "SPEED" ), aWidget );
+  aSpeedLabel->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
+  aLayout->addWidget( aSpeedLabel, 1, 11 );
+
+  mySpeedBox = new QSpinBox( 1, 100, 1, aWidget );
+  mySpeedBox->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
+  mySpeedBox->setValue( 50 );
+  aLayout->addWidget( mySpeedBox, 1, 12 );
+
+  myTimer = new QTimer( this );
+
+  // Common
+  connect( mySelectionMgr, SIGNAL( currentSelectionChanged() ), SLOT( onSelectionChanged() ) );
+
+  connect( myTimeStampStrings, SIGNAL( activated( int ) ),    SLOT( onTimeStampActivated( int ) ) );
+  connect( myTimeStampIndices, SIGNAL( activated( int ) ),    SLOT( onTimeStampActivated( int ) ) );
+
+  connect( myMoreButton,       SIGNAL( toggled( bool ) ),     SLOT( onMore( bool ) ) );
+  connect( myFirstButton,      SIGNAL( clicked() ),           SLOT( onFirst() ) );
+  connect( myPreviousButton,   SIGNAL( clicked() ),           SLOT( onPrevious() ) );
+  connect( myPlayButton,       SIGNAL( toggled( bool ) ),     SLOT( onPlay( bool ) ) );
+  connect( myNextButton,       SIGNAL( clicked() ),           SLOT( onNext() ) );
+  connect( myLastButton,       SIGNAL( clicked() ),           SLOT( onLast() ) );
+
+  connect( mySlider,           SIGNAL( valueChanged( int ) ), SLOT( onValueChanged( int ) ) );
+
+  connect( mySpeedBox,         SIGNAL( valueChanged( int ) ), SLOT( onSpeedChanged( int ) ) );
+
+  connect( myTimer,            SIGNAL( timeout() ),           SLOT( onTimeout() ) );
+
+  enableControls( false );
+
+  myMainWindow->addDockWindow( this, Qt::DockBottom );
+}
+
+/*!
+  Destructor
+*/
+VisuGUI_Slider::~VisuGUI_Slider()
+{
+}
+
+bool VisuGUI_Slider::checkHolderList()
+{
+  THolderList aHolderList;
+  THolderList::const_iterator anIter = myHolderList.begin();
+  THolderList::const_iterator anIterEnd = myHolderList.end();
+  for(; anIter != anIterEnd; anIter++){
+    VISU::ColoredPrs3dHolder_var aHolder = *anIter;
+    if(!aHolder->_non_existent())
+      aHolderList.push_back(aHolder);
+  }
+  myHolderList.swap(aHolderList);
+  return myHolderList.empty();
+}
+
+void VisuGUI_Slider::enableControls( bool on )
+{
+  widget()->setEnabled( on );
+  if( on )
+  {
+    if( checkHolderList() )
+      return;
+
+    myTimeStampStrings->clear();
+    myTimeStampIndices->clear();
+
+    VISU::ColoredPrs3dHolder_var aHolder = myHolderList.front();
+
+    VISU::ColoredPrs3d::TimeStampsRange_var aTimeStampsRange = aHolder->GetTimeStampsRange();
+    CORBA::Long aLength = aTimeStampsRange->length();
+
+    VISU::ColoredPrs3dHolder::BasicInput_var anInput = aHolder->GetBasicInput();
+    CORBA::Long aTimeStampNumber = anInput->myTimeStampNumber;
+
+    myFirstTimeStamp->setText( aTimeStampsRange[0].myTime.in() );
+    myLastTimeStamp->setText( aTimeStampsRange[aLength-1].myTime.in() );
+    myTimeStampsNumber->setText( QString("(") + QString::number( aLength ) + ")" );
+
+    CORBA::Long a_current_index = 0;
+    for( CORBA::Long an_index = 0; an_index < aLength; an_index++ )
+    {
+      VISU::ColoredPrs3d::TimeStampInfo anInfo = aTimeStampsRange[ an_index ];
+      CORBA::Long aNumber = anInfo.myNumber;
+      QString aTime = anInfo.myTime.in();
+
+      myTimeStampStrings->insertItem( aTime );
+      myTimeStampIndices->insertItem( QString::number( aNumber ) );
+
+      if( aNumber == aTimeStampNumber )
+       a_current_index = an_index;
+    }
+    // work around - to update controls' sizes
+    myTimeStampStrings->setFont(myTimeStampStrings->font());
+    myTimeStampStrings->updateGeometry();
+    
+    myTimeStampIndices->setFont(myTimeStampStrings->font());
+    myTimeStampIndices->updateGeometry();
+
+    if( a_current_index > mySlider->maxValue() )
+      mySlider->setMaxValue( aLength-1 );
+
+    myTimeStampStrings->setCurrentItem( a_current_index );
+    myTimeStampIndices->setCurrentItem( a_current_index );
+    mySlider->setValue( a_current_index );
+
+    if( a_current_index <= mySlider->maxValue() )
+      mySlider->setMaxValue( aLength-1 );
+  }
+  else
+  {
+    myPlayButton->setOn( false );
+  }
+
+}
+
+void VisuGUI_Slider::updateMemoryState()
+{
+  if( checkHolderList() )
+    return;
+
+  VISU::ColoredPrs3dHolder_var aHolder = myHolderList.front();
+
+  VISU::ColoredPrs3dCache_var aCache = aHolder->GetCache();
+  CORBA::Float aCacheMemory = aCache->GetMemorySize();
+  myCacheMemory->setText( QString::number( double( aCacheMemory ), 'E', 2 ) + " Mb" );
+}
+
+void VisuGUI_Slider::onSelectionChanged()
+{
+  //cout << "VisuGUI_Slider::onSelectionChanged()" << endl;
+  myHolderList.clear();
+
+  _PTR(SObject) aSObject;
+
+  SalomeApp_Application* anApp = dynamic_cast<SalomeApp_Application*>
+    (SUIT_Session::session()->activeApplication());
+
+  SALOME_ListIO aListIO;
+  mySelectionMgr->selectedObjects(aListIO);
+  SALOME_ListIteratorOfListIO anIter(aListIO);
+  for(; anIter.More(); anIter.Next() ){
+    Handle(SALOME_InteractiveObject) anIO = anIter.Value();
+    if (anIO->hasEntry()) {
+      SalomeApp_Study* theStudy = dynamic_cast<SalomeApp_Study*>(anApp->activeStudy());
+      _PTR(Study) aStudy = theStudy->studyDS();
+      aSObject = aStudy->FindObjectID(anIO->getEntry());
+
+      if (aSObject) {
+       CORBA::Object_var anObject = VISU::ClientSObjectToObject(aSObject);
+        if (!CORBA::is_nil(anObject)) {
+         VISU::ColoredPrs3dHolder_var aHolder = VISU::ColoredPrs3dHolder::_narrow(anObject);
+
+         if(!CORBA::is_nil(aHolder))
+         {
+           //cout << "ColoredPrs3dHolder" << endl;
+           myHolderList.push_back(aHolder);
+         }
+        }
+      }
+    }
+  }
+
+  enableControls( !checkHolderList() );
+  updateMemoryState();
+}
+
+void VisuGUI_Slider::onTimeStampActivated( int value )
+{
+  mySlider->setValue( value );
+  onValueChanged( value );
+}
+
+void VisuGUI_Slider::onMore( bool )
+{
+}
+
+void VisuGUI_Slider::onFirst()
+{
+  int value = mySlider->minValue();
+  mySlider->setValue( value );
+}
+
+void VisuGUI_Slider::onPrevious()
+{
+  int value = mySlider->value() - 1;
+  if( value >= mySlider->minValue() )
+    mySlider->setValue( value );
+}
+
+void VisuGUI_Slider::onPlay( bool on )
+{
+  SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
+  if( on )
+  {
+    myPlayButton->setIconSet( aResourceMgr->loadPixmap( "VISU", tr( "ICON_SLIDER_PAUSE" ) ) );
+
+    int delay = int(5000.0 / double(mySpeedBox->value()));
+    myTimer->start( delay );
+  }
+  else
+  {
+    myTimer->stop();
+    myPlayButton->setIconSet( aResourceMgr->loadPixmap( "VISU", tr( "ICON_SLIDER_PLAY" ) ) );
+  }
+}
+
+void VisuGUI_Slider::onNext()
+{
+  int value = mySlider->value() + 1;
+  if( value <= mySlider->maxValue() )
+    mySlider->setValue( value );
+}
+
+void VisuGUI_Slider::onLast()
+{
+  int value = mySlider->maxValue();
+  mySlider->setValue( value );
+}
+
+void VisuGUI_Slider::onValueChanged( int value )
+{
+  if( checkHolderList() ){
+    enableControls( false );
+    return;
+  }
+
+  myTimeStampStrings->setCurrentItem( value );
+  myTimeStampIndices->setCurrentItem( value );
+
+  VISU::ColoredPrs3dHolder_var aHolder = myHolderList.front();
+
+  VISU::ColoredPrs3d::TimeStampsRange_var aTimeStampsRange = aHolder->GetTimeStampsRange();
+  CORBA::Long aLength = aTimeStampsRange->length();
+  if(value < 0 || aLength <= value)
+    return;
+
+  VISU::ColoredPrs3dHolder::BasicInput_var anInput = aHolder->GetBasicInput();
+  CORBA::Long aTimeStampNumber = anInput->myTimeStampNumber;
+  CORBA::Long aNumber = aTimeStampsRange[ value ].myNumber;
+  if(aNumber == aTimeStampNumber)
+    return;
+
+  THolderList::const_iterator anIter = myHolderList.begin();
+  THolderList::const_iterator anIterEnd = myHolderList.end();
+  for( ; anIter != anIterEnd; anIter++ )
+  {
+    VISU::ColoredPrs3dHolder_var aHolder = *anIter;
+    if( CORBA::is_nil( aHolder.in() ) )
+      continue;
+
+    VISU::ColoredPrs3d_var aPrs3d = aHolder->GetDevice();
+    VISU::ColoredPrs3dHolder::BasicInput_var anInput = aHolder->GetBasicInput();
+    anInput->myTimeStampNumber = aNumber;
+
+    aHolder->Apply( aPrs3d, anInput, myView3D );
+  }
+
+  updateMemoryState();
+}
+
+void VisuGUI_Slider::onSpeedChanged( int value )
+{
+  if(myPlayButton->isOn()){
+    int delay = int(5000.0 / double(mySpeedBox->value()));
+    myTimer->start( delay );
+  }
+}
+
+void VisuGUI_Slider::onTimeout()
+{
+  int value = mySlider->value();
+  if( value < mySlider->maxValue() )
+    onNext();
+  else
+    myPlayButton->setOn( false );
+}
diff --git a/src/VISUGUI/VisuGUI_Slider.h b/src/VISUGUI/VisuGUI_Slider.h
new file mode 100644 (file)
index 0000000..80e4ab0
--- /dev/null
@@ -0,0 +1,122 @@
+//  VISU VISUGUI : GUI of VISU component
+//
+//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+//
+//
+//  File   : VisuGUI_Slider.h
+//  Author : Oleg UVAROV
+//  Module : VISU
+
+#ifndef VisuGUI_Slider_HeaderFile
+#define VisuGUI_Slider_HeaderFile
+
+#include "QtxDockWindow.h"
+#include <vector>
+
+#include "SALOMEconfig.h"
+#include CORBA_SERVER_HEADER(VISU_Gen)
+
+namespace VISU
+{
+  class ColoredPrs3dHolder_i;
+}
+
+class QComboBox;
+class QLabel;
+class QLineEdit;
+class QToolButton;
+class QSlider;
+class QSpinBox;
+class QTimer;
+
+class VVTK_ViewWindow;
+class VVTK_MainWindow;
+class LightApp_SelectionMgr;
+
+class VisuGUI_Module;
+
+class VisuGUI_Slider : public QtxDockWindow
+{
+  Q_OBJECT
+
+public:
+  VisuGUI_Slider( VisuGUI_Module* theModule, 
+                 VVTK_ViewWindow* theViewWindow,
+                 LightApp_SelectionMgr* theSelectionMgr );
+  virtual ~VisuGUI_Slider();
+
+public slots:
+  virtual void     onSelectionChanged();
+
+  virtual void     onTimeStampActivated( int );
+
+  virtual void     onMore( bool );
+  virtual void     onFirst();
+  virtual void     onPrevious();
+  virtual void     onPlay( bool );
+  virtual void     onNext();
+  virtual void     onLast();
+
+  virtual void     onValueChanged( int );
+
+  virtual void     onSpeedChanged( int );
+
+  virtual void     onTimeout();
+
+protected:
+  virtual void     enableControls( bool );
+  virtual void     updateMemoryState();
+  virtual bool     checkHolderList();
+
+private:
+  VisuGUI_Module*  myModule;
+  VVTK_MainWindow* myMainWindow;
+  LightApp_SelectionMgr* mySelectionMgr;
+  VISU::View3D_var myView3D;
+
+  QSlider*         mySlider;
+  QLabel*          myFirstTimeStamp;
+  QLabel*          myLastTimeStamp;
+  QLabel*          myTimeStampsNumber;
+
+  QLabel*          myCacheMemory;
+
+  QToolButton*     myMoreButton;
+  QToolButton*     myAVIButton;
+
+  QToolButton*     myFirstButton;
+  QToolButton*     myPreviousButton;
+  QToolButton*     myPlayButton;
+  QToolButton*     myNextButton;
+  QToolButton*     myLastButton;
+
+  QComboBox*       myTimeStampStrings;
+  QComboBox*       myTimeStampIndices;
+
+  QSpinBox*        mySpeedBox;
+
+  QTimer*          myTimer;
+
+  typedef std::vector<VISU::ColoredPrs3dHolder_var> THolderList;
+  THolderList      myHolderList;
+};
+
+#endif
diff --git a/src/VISU_I/SALOME_GenericObjPointer.cc b/src/VISU_I/SALOME_GenericObjPointer.cc
new file mode 100644 (file)
index 0000000..1e774e1
--- /dev/null
@@ -0,0 +1,25 @@
+//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
+// 
+//  This library is free software; you can redistribute it and/or 
+//  modify it under the terms of the GNU Lesser General Public 
+//  License as published by the Free Software Foundation; either 
+//  version 2.1 of the License. 
+// 
+//  This library is distributed in the hope that it will be useful, 
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of 
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
+//  Lesser General Public License for more details. 
+// 
+//  You should have received a copy of the GNU Lesser General Public 
+//  License along with this library; if not, write to the Free Software 
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
+// 
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+//
+//  File   : SALOME_GenericObjPtr.cc
+//  Author : Oleg UVAROV
+//  Module : SALOME
+
+#include "SALOME_GenericObjPointer.hh"
diff --git a/src/VISU_I/SALOME_GenericObjPointer.hh b/src/VISU_I/SALOME_GenericObjPointer.hh
new file mode 100644 (file)
index 0000000..e710a4f
--- /dev/null
@@ -0,0 +1,181 @@
+//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
+// 
+//  This library is free software; you can redistribute it and/or 
+//  modify it under the terms of the GNU Lesser General Public 
+//  License as published by the Free Software Foundation; either 
+//  version 2.1 of the License. 
+// 
+//  This library is distributed in the hope that it will be useful, 
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of 
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
+//  Lesser General Public License for more details. 
+// 
+//  You should have received a copy of the GNU Lesser General Public 
+//  License along with this library; if not, write to the Free Software 
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
+// 
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+//
+//  File   : SALOME_GenericObjPtr.hh
+//  Author : Oleg UVAROV
+//  Module : SALOME
+
+#ifndef SALOME_GenericObjPointer_HH
+#define SALOME_GenericObjPointer_HH
+
+#include "SALOMEconfig.h"
+#include CORBA_SERVER_HEADER(SALOME_GenericObj)
+
+#include <iosfwd>  // for std::basic_ostream
+
+namespace SALOME
+{
+  //----------------------------------------------------------------------------
+  template <class TGenericObj>
+  class GenericObjPtr
+  {
+    //! Pointer to the actual object.
+    TGenericObj* myPointer;
+
+    void
+    swap(GenericObjPtr& thePointer)
+    {
+      TGenericObj* aPointer = thePointer.myPointer;
+      thePointer.myPointer = this->myPointer;
+      this->myPointer = aPointer;
+    }
+
+    void
+    Register()
+    {
+      if(this->myPointer)
+       this->myPointer->Register();
+    }
+
+    void
+    Destroy()
+    {
+      if(this->myPointer){
+       this->myPointer->Destroy();
+       this->myPointer = NULL;
+      }
+    }
+
+  public:
+    //! Initialize smart pointer to NULL.
+    GenericObjPtr():
+      myPointer(NULL)
+    {}
+
+    //! Initialize smart pointer to given object (TSGenericObj must be complete).
+    template<class TSGenericObj>
+    explicit
+    GenericObjPtr(TSGenericObj* thePointer): 
+      myPointer(thePointer) 
+    {
+      this->Register();
+    }
+
+    /*! 
+      Initialize smart pointer with a new reference to the same object
+      referenced by given smart pointer.
+     */
+    GenericObjPtr(const GenericObjPtr& thePointer):
+      myPointer(thePointer.myPointer) 
+    {
+      this->Register();
+    }
+
+    //! Destroy smart pointer and remove the reference to its object.
+    ~GenericObjPtr()
+    {
+      this->Destroy();
+    }
+
+    /*! 
+      Assign object to reference.  This removes any reference to an old
+      object.
+    */
+    GenericObjPtr&
+    operator=(TGenericObj* thePointer)
+    {
+      GenericObjPtr(thePointer).swap(*this);
+      return *this;
+    }
+
+    /*! 
+      Assign object to reference.  This removes any reference to an old
+      object.
+    */
+    GenericObjPtr& 
+    operator=(const GenericObjPtr& thePointer)
+    {
+      GenericObjPtr(thePointer).swap(*this);
+      return *this;
+    }
+
+    //! Get the contained pointer.
+    virtual
+    TGenericObj* 
+    get() const
+    {
+      return this->myPointer;
+    }
+
+    //! Get the contained pointer.
+    operator TGenericObj* () const
+    {
+      return this->get();
+    }
+
+    /*! 
+      Dereference the pointer and return a reference to the contained
+      object.
+    */
+    TGenericObj& 
+    operator*() const
+    {
+      return *this->get();
+    }
+
+    //! Provides normal pointer target member access using operator ->.
+    TGenericObj* operator->() const
+    {
+      return this->get();
+    }
+
+    operator bool () const
+    {
+      return this->get() != 0;
+    }
+  };
+}
+
+template<class T, class U> 
+inline
+bool 
+operator==(SALOME::GenericObjPtr<T> const & a, SALOME::GenericObjPtr<U> const & b)
+{
+  return a.get() == b.get();
+}
+
+template<class T, class U> 
+inline 
+bool 
+operator!=(SALOME::GenericObjPtr<T> const & a, SALOME::GenericObjPtr<U> const & b)
+{
+  return a.get() != b.get();
+}
+
+template<class Y> 
+std::ostream& 
+operator<< (std::ostream & os, SALOME::GenericObjPtr<Y> const & p)
+{
+  os << p.get();
+  return os;
+}
+
+
+#endif
diff --git a/src/VISU_I/VISU_ColoredPrs3dCache_i.cc b/src/VISU_I/VISU_ColoredPrs3dCache_i.cc
new file mode 100644 (file)
index 0000000..2e5f198
--- /dev/null
@@ -0,0 +1,821 @@
+//  VISU OBJECT : interactive object for VISU entities implementation
+//
+//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+//
+//  File   : VISU_ColoredPrs3dCache_i.cc
+//  Author : Oleg UVAROV
+//  Module : VISU
+
+#include "VISU_ColoredPrs3dCache_i.hh"
+
+#include "VISU_ColoredPrs3dHolder_i.hh"
+#include "VISU_ColoredPrs3dFactory.hh"
+
+#include "VISU_ViewManager_i.hh"
+#include "VISU_View_i.hh"
+#include "VISU_Actor.h"
+
+#include "VISU_PipeLine.hxx"
+
+#include "SALOME_Event.hxx"
+
+#include "VTKViewer_Algorithm.h"
+#include "SVTK_Functor.h"
+
+#include "VVTK_ViewWindow.h"
+#include "SUIT_ResourceMgr.h"
+
+#include <vtkRenderWindow.h>
+
+#ifdef _DEBUG_
+static int MYDEBUG = 0;
+#else
+static int MYDEBUG = 0;
+#endif
+
+namespace
+{
+  //----------------------------------------------------------------------------
+  inline
+  bool
+  IsSameField(const VISU::ColoredPrs3dHolder::BasicInput& theReferenceInput,
+             const VISU::ColoredPrs3dHolder::BasicInput& thePrs3dInput)
+  {
+    return thePrs3dInput.myResult->_is_equivalent(theReferenceInput.myResult) &&
+      thePrs3dInput.myEntity == theReferenceInput.myEntity &&
+      !strcmp(thePrs3dInput.myFieldName.in(), theReferenceInput.myFieldName.in());
+  }
+
+
+  //----------------------------------------------------------------------------
+  inline
+  bool
+  IsSameTimeStamp(const VISU::ColoredPrs3dHolder::BasicInput& theReferenceInput,
+                 const VISU::ColoredPrs3dHolder::BasicInput& thePrs3dInput)
+  {
+    return IsSameField(theReferenceInput, thePrs3dInput) &&
+      thePrs3dInput.myTimeStampNumber == theReferenceInput.myTimeStampNumber;
+  }
+  
+  
+  //----------------------------------------------------------------------------
+  VISU::ColoredPrs3d_i*
+  FindSameFieldPrs(const VISU::TColoredPrs3dHolderMap& theHolderMap,
+                  const VISU::ColoredPrs3dHolder::BasicInput& theInput,
+                  VISU::VISUType theType)
+  {
+    VISU::TColoredPrs3dHolderMap::const_iterator aHolderIter = theHolderMap.begin();
+    VISU::TColoredPrs3dHolderMap::const_iterator aHolderIterEnd = theHolderMap.end();
+    for(; aHolderIter != aHolderIterEnd; aHolderIter++){
+      const VISU::TLastVisitedPrsList& aPrsList = aHolderIter->second;
+      VISU::TLastVisitedPrsList::const_iterator aPrsIter = aPrsList.begin();
+      VISU::TLastVisitedPrsList::const_iterator aPrsIterEnd = aPrsList.end();
+      for(; aPrsIter != aPrsIterEnd; aPrsIter++){
+       VISU::TPrs3dPtr aPrs3d = *aPrsIter;
+       if(aPrs3d->GetType() != theType)
+         break;
+       VISU::ColoredPrs3dHolder::BasicInput_var anInput = aPrs3d->GetBasicInput();
+       if(IsSameField(theInput, anInput))
+         return aPrs3d.get();
+      }
+    }
+    return VISU::TPrs3dPtr();
+  }
+  
+  
+  //----------------------------------------------------------------------------
+  CORBA::Float
+  EstimateMemorySize(const VISU::TColoredPrs3dHolderMap& theHolderMap,
+                    const VISU::ColoredPrs3dHolder::BasicInput& theInput,
+                    VISU::VISUType theType,
+                    const size_t theRawEstimatedMemorySize)
+  {
+    VISU::ColoredPrs3d_i* aPrs3d = FindSameFieldPrs(theHolderMap, theInput, theType);
+    if(aPrs3d)
+      return aPrs3d->GetMemorySize();
+    return CORBA::Float(theRawEstimatedMemorySize/(1024.0*1024.0)); // convert to Mb
+  }
+
+
+  //----------------------------------------------------------------------------
+  bool
+  SelectPrs3dToBeDeleted(CORBA::Float theRequiredMemory,
+                        const std::string& theActiveHolderEntry,
+                        const VISU::TColoredPrs3dHolderMap& theHolderMap,
+                        VISU::TColoredPrs3dHolderMap& theColoredPrs3dHolderMap)
+  {
+    if( theRequiredMemory < 1.0 / VTK_LARGE_FLOAT )
+      return false;
+    
+    VISU::TColoredPrs3dHolderMap::const_iterator aHolderIter = theHolderMap.begin();
+    VISU::TColoredPrs3dHolderMap::const_iterator aHolderIterEnd = theHolderMap.end();
+    
+    // To calculate the maximum length of the cache history among all holders
+    int anIteration = 0;
+    for( ; aHolderIter != aHolderIterEnd; aHolderIter++ ){
+      if( aHolderIter->first == theActiveHolderEntry )
+       continue;
+      const VISU::TLastVisitedPrsList& aPrsList = aHolderIter->second;
+      anIteration = QMAX( aPrsList.size() - 1, anIteration );
+    }
+
+    // To estimate what amount of memory can be obtained
+    // by cleaning of non-active holder's presentation
+    CORBA::Float aGatheredMemory = 0.0;
+    for(; anIteration > 0; anIteration--){ // To take into account only non-devices
+      aHolderIter = theHolderMap.begin();
+      for(; aHolderIter != aHolderIterEnd; aHolderIter++ ){
+       const std::string& aHolderEntry = aHolderIter->first;
+       if( aHolderEntry == theActiveHolderEntry )
+         continue;
+       const VISU::TLastVisitedPrsList& aPrsList = aHolderIter->second;
+       if( anIteration < aPrsList.size() ){
+         VISU::TPrs3dPtr aPrs3d = aPrsList[anIteration];
+         aGatheredMemory += aPrs3d->GetMemorySize();
+         theColoredPrs3dHolderMap[aHolderEntry].push_back(aPrs3d);
+         if( aGatheredMemory > theRequiredMemory )
+           return true;
+       }
+      }
+    }
+    
+    // To estimate what amount of memory can be obtained
+    // by cleaning of active holder's presentation
+    if( theActiveHolderEntry != "" ){
+      aHolderIter = theHolderMap.find( theActiveHolderEntry );
+      if(aHolderIter == theHolderMap.end())
+       return false;
+
+      const VISU::TLastVisitedPrsList& aPrsList = aHolderIter->second;
+
+      // To prefere "move" action instead of destroy / create presentation
+      if(aPrsList.back()->GetMemorySize() >= theRequiredMemory)
+       return false;
+
+      VISU::TLastVisitedPrsList::const_reverse_iterator aPrsIter = aPrsList.rbegin();
+      // Do not porcess first item to avoid of the device destruction
+      VISU::TLastVisitedPrsList::const_reverse_iterator aPrsIterEnd = aPrsList.rend()++;
+      for(; aPrsIter != aPrsIterEnd; aPrsIter++){
+       VISU::TPrs3dPtr aPrs3d = *aPrsIter;
+       aGatheredMemory += aPrs3d->GetMemorySize();
+       theColoredPrs3dHolderMap[theActiveHolderEntry].push_back(aPrs3d);
+       if( aGatheredMemory > theRequiredMemory )
+         return true;
+      }
+    }
+    
+    return false;
+  }
+
+
+  //----------------------------------------------------------------------------
+  void
+  ErasePrs3d(VISU::TLastVisitedPrsList& thePrsList,
+            const VISU::TPrs3dPtr& thePrs3d)
+  {
+    VISU::TLastVisitedPrsList::iterator anIter = thePrsList.begin();
+    VISU::TLastVisitedPrsList::iterator aEndIter = thePrsList.end();
+    for(; anIter != aEndIter; anIter++){
+      VISU::TPrs3dPtr aPrs3d = *anIter;
+      if(aPrs3d == thePrs3d)
+       thePrsList.erase(anIter);
+    }
+  }
+}
+
+
+//----------------------------------------------------------------------------
+VISU::ColoredPrs3dCache_i
+::ColoredPrs3dCache_i(SALOMEDS::Study_ptr theStudy,
+                     bool thePublishInStudy):
+  RemovableObject_i()
+{
+  if(MYDEBUG) MESSAGE("ColoredPrs3dCache_i::ColoredPrs3dCache_i - this = "<<this);
+  SetStudyDocument(theStudy);
+
+  SetName(GetFolderName(), false);
+
+  if( thePublishInStudy )
+  {
+    CORBA::String_var anIOR = GetID();
+    SALOMEDS::SComponent_var aSComponent = VISU::FindOrCreateVisuComponent(theStudy);
+    CORBA::String_var aFatherEntry = aSComponent->GetID();
+    CreateAttributes(GetStudyDocument(), aFatherEntry.in(), "", anIOR.in(), GetName(), "", "", true);
+  }
+
+  SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
+
+  int aMemoryMode = aResourceMgr->integerValue( "VISU", "cache_memory_mode", 0 );
+  SetMemoryMode( aMemoryMode == 0 ? VISU::ColoredPrs3dCache::MINIMAL : VISU::ColoredPrs3dCache::LIMITED );
+
+  float aLimitedMemory = aResourceMgr->doubleValue( "VISU", "cache_memory_limit", 1024.0 );
+  SetLimitedMemory( aLimitedMemory );
+}
+
+
+//----------------------------------------------------------------------------
+VISU::ColoredPrs3dCache_i
+::~ColoredPrs3dCache_i() 
+{
+  if(MYDEBUG) MESSAGE("ColoredPrs3dCache_i::~ColoredPrs3dCache_i - this = "<<this);
+}
+
+
+//----------------------------------------------------------------------------
+const string VISU::ColoredPrs3dCache_i::myComment = "COLOREDPRS3DCACHE";
+
+const char* 
+VISU::ColoredPrs3dCache_i
+::GetComment() const 
+{ 
+  return myComment.c_str();
+}
+
+
+//----------------------------------------------------------------------------
+CORBA::Float
+VISU::ColoredPrs3dCache_i
+::GetMemorySize()
+{ 
+  CORBA::Float aMemoryUsed = 0.0;
+  TColoredPrs3dHolderMap::const_iterator aHolderIter = myHolderMap.begin();
+  TColoredPrs3dHolderMap::const_iterator aHolderIterEnd = myHolderMap.end();
+  for(; aHolderIter != aHolderIterEnd; aHolderIter++){
+    const TLastVisitedPrsList& aPrsList = aHolderIter->second;
+    TLastVisitedPrsList::const_iterator aPrsIter = aPrsList.begin();
+    TLastVisitedPrsList::const_iterator aPrsIterEnd = aPrsList.end();
+    for(; aPrsIter != aPrsIterEnd; aPrsIter++){
+      if(TPrs3dPtr aPrs3d = *aPrsIter)
+       aMemoryUsed += aPrs3d->GetMemorySize();
+    }
+  }
+  return aMemoryUsed; 
+}
+
+
+//----------------------------------------------------------------------------
+CORBA::Float
+VISU::ColoredPrs3dCache_i
+::GetDeviceMemorySize()
+{ 
+  CORBA::Float aMemoryUsed = 0.0;
+  TColoredPrs3dHolderMap::const_iterator aHolderIter = myHolderMap.begin();
+  TColoredPrs3dHolderMap::const_iterator aHolderIterEnd = myHolderMap.end();
+  for(; aHolderIter != aHolderIterEnd; aHolderIter++){
+    const TLastVisitedPrsList& aPrsList = aHolderIter->second;
+    if(TPrs3dPtr aPrs3d = aPrsList.front())
+      aMemoryUsed += aPrs3d->GetMemorySize();
+  }
+  return aMemoryUsed; 
+}
+
+
+//----------------------------------------------------------------------------
+int
+VISU::ColoredPrs3dCache_i
+::IsPossible(VISU::VISUType theType,
+            const VISU::ColoredPrs3dHolder::BasicInput& theInput,
+            CORBA::Float& theRequiredMemory,
+            const std::string theHolderEntry)
+{
+  size_t aRawEstimatedMemorySize = VISU::CheckIsPossible(theType, theInput, true);
+  if(aRawEstimatedMemorySize > 0){
+    if(GetMemoryMode() == VISU::ColoredPrs3dCache::LIMITED){
+      CORBA::Float aMemoryUsed = GetMemorySize();
+      CORBA::Float aMemoryLimit = GetLimitedMemory();
+      CORBA::Float aMemoryNeeded = EstimateMemorySize(myHolderMap,
+                                                     theInput,
+                                                     theType,
+                                                     aRawEstimatedMemorySize);
+
+      if( aMemoryUsed + aMemoryNeeded < aMemoryLimit )
+       return true;
+      
+      theRequiredMemory = aMemoryNeeded - ( aMemoryLimit - aMemoryUsed );
+      TColoredPrs3dHolderMap aColoredPrs3dHolderMap;
+      return SelectPrs3dToBeDeleted(theRequiredMemory, 
+                                   theHolderEntry, 
+                                   myHolderMap,
+                                   aColoredPrs3dHolderMap);
+    }
+  }
+  return aRawEstimatedMemorySize > 0;
+}
+
+
+//----------------------------------------------------------------------------
+VISU::ColoredPrs3dCache::EnlargeType
+VISU::ColoredPrs3dCache_i
+::GetRequiredMemory(VISU::VISUType theType,
+                   const VISU::ColoredPrs3dHolder::BasicInput& theInput,
+                   CORBA::Float& theRequiredMemory)
+{
+  VISU::ColoredPrs3dCache::EnlargeType anEnlargeType = VISU::ColoredPrs3dCache::NO_ENLARGE;
+
+  size_t aRawEstimatedMemorySize = VISU::CheckIsPossible(theType, theInput, true);
+  if(aRawEstimatedMemorySize > 0){
+    if(GetMemoryMode() == VISU::ColoredPrs3dCache::LIMITED){
+      CORBA::Float aMemoryUsed = GetDeviceMemorySize();
+      CORBA::Float aMemoryLimit = GetLimitedMemory();
+      CORBA::Float aMemoryNeeded = EstimateMemorySize(myHolderMap,
+                                                     theInput,
+                                                     theType,
+                                                     aRawEstimatedMemorySize);
+      if( aMemoryUsed + aMemoryNeeded < aMemoryLimit )
+       return anEnlargeType;
+
+      theRequiredMemory = int( aMemoryUsed + aMemoryNeeded ) + 1;
+
+      size_t aMb = 1024 * 1024;
+      double aFreeMemory = double(VISU_PipeLine::GetAvailableMemory(2048*aMb)) / double(aMb);
+      anEnlargeType = aMemoryNeeded < aFreeMemory ?
+       VISU::ColoredPrs3dCache::ENLARGE : VISU::ColoredPrs3dCache::IMPOSSIBLE;
+    }
+  }
+  return anEnlargeType;
+}
+
+
+//----------------------------------------------------------------------------
+VISU::ColoredPrs3dCache_i*
+VISU::ColoredPrs3dCache_i
+::GetInstance_i(SALOMEDS::Study_ptr theStudy)
+{
+  std::string aFolderName = VISU::ColoredPrs3dCache_i::GetFolderName();
+  SALOMEDS::SObject_var aSObject = theStudy->FindObject(aFolderName.c_str());
+  if(!CORBA::is_nil(aSObject)){
+    CORBA::Object_var anObject = aSObject->GetObject();
+    VISU::ColoredPrs3dCache_var aCache = VISU::ColoredPrs3dCache::_narrow(anObject);
+    if(!CORBA::is_nil(aCache))
+      return dynamic_cast<VISU::ColoredPrs3dCache_i*>(GetServant(aCache).in());
+  }
+  
+  return new VISU::ColoredPrs3dCache_i(theStudy);
+}
+
+
+VISU::ColoredPrs3dCache_ptr
+VISU::ColoredPrs3dCache_i
+::GetInstance(SALOMEDS::Study_ptr theStudy)
+{
+  VISU::ColoredPrs3dCache_i* aServant = GetInstance_i(theStudy);
+  VISU::ColoredPrs3dCache_var anObject = aServant->_this();
+  return anObject._retn();
+}
+
+
+//----------------------------------------------------------------------------
+VISU::ColoredPrs3dHolder_ptr
+VISU::ColoredPrs3dCache_i
+::CreateHolder(VISU::VISUType theType,
+              const VISU::ColoredPrs3dHolder::BasicInput& theInput)
+{
+  if(MYDEBUG) cout << "CreateHolder " << theType << endl;
+  CORBA::Float aRequiredMemory = 0.0;
+  if(IsPossible(theType, theInput, aRequiredMemory, "")){
+    if(VISU::ColoredPrs3d_i* aColoredPrs3d = CreateColoredPrs3d(theType, theInput)){
+      VISU::ColoredPrs3dHolder_i* aHolder = new VISU::ColoredPrs3dHolder_i(*this);
+      std::string aComment = std::string("myComment=") + aColoredPrs3d->GetComment();
+      std::string aName = aColoredPrs3d->GenerateName().latin1();
+      aHolder->PublishInStudy(aName, aComment);
+      RegisterInHolder(aColoredPrs3d, aHolder->GetEntry());
+      if( aRequiredMemory > 1.0 / VTK_LARGE_FLOAT )
+       ClearMemory( aRequiredMemory, aHolder->GetEntry() );
+      return aHolder->_this();
+    }
+  }
+  return VISU::ColoredPrs3dHolder::_nil();
+}
+
+
+//----------------------------------------------------------------------------
+void
+VISU::ColoredPrs3dCache_i
+::SetMemoryMode(VISU::ColoredPrs3dCache::MemoryMode theMode)
+{
+  VISU::ColoredPrs3dCache::MemoryMode aCurrentMode = GetMemoryMode();
+
+  if( aCurrentMode == VISU::ColoredPrs3dCache::LIMITED &&
+      theMode == VISU::ColoredPrs3dCache::MINIMAL )
+  {
+    ClearCache();
+  }
+
+  myMemoryMode = theMode;
+}
+
+VISU::ColoredPrs3dCache::MemoryMode
+VISU::ColoredPrs3dCache_i
+::GetMemoryMode()
+{ 
+  return myMemoryMode; 
+}
+
+
+//----------------------------------------------------------------------------
+void
+VISU::ColoredPrs3dCache_i
+::SetLimitedMemory(CORBA::Float theMemorySize)
+{
+  if( fabs( myLimitedMemory - theMemorySize ) < 1 / VTK_LARGE_FLOAT )
+    return;
+
+  size_t aMb = 1024 * 1024;
+  double aFreeMemory = double(VISU_PipeLine::GetAvailableMemory(2048*aMb)) / double(aMb);
+  CORBA::Float aMemoryUsed = GetDeviceMemorySize();
+  CORBA::Float aMemoryNeeded = theMemorySize - aMemoryUsed;
+  if( aMemoryNeeded > aFreeMemory )
+    return;
+
+  ClearCache(theMemorySize);
+  myLimitedMemory = theMemorySize;
+}
+
+CORBA::Float
+VISU::ColoredPrs3dCache_i
+::GetLimitedMemory()
+{ 
+  return myLimitedMemory; 
+}
+
+
+void
+VISU::ColoredPrs3dCache_i
+::RemoveFromStudy() 
+{
+  CORBA::String_var anIOR = GetID();
+  SALOMEDS::SObject_var aSObject = GetStudyDocument()->FindObjectIOR(anIOR.in());
+  VISU::RemoveFromStudy(aSObject, false, true);
+  Destroy();
+}
+
+std::string
+VISU::ColoredPrs3dCache_i
+::GetFolderName() 
+{ 
+  return "3D Cache System"; 
+}
+
+//----------------------------------------------------------------------------
+VISU::ColoredPrs3d_i*
+VISU::ColoredPrs3dCache_i
+::CreateColoredPrs3d(VISU::VISUType theType,
+                    VISU::ColoredPrs3dHolder::BasicInput theInput)
+{
+  VISU::ColoredPrs3d_i* aPrs3d = VISU::CreatePrs3d_i(theType, GetStudyDocument(), ColoredPrs3d_i::ERegisterInCache);
+  aPrs3d->SetResultObject( theInput.myResult );  
+  aPrs3d->SetMeshName( theInput.myMeshName );  
+  aPrs3d->SetEntity( theInput.myEntity );  
+  aPrs3d->SetFieldName( theInput.myFieldName );  
+  aPrs3d->SetTimeStampNumber( theInput.myTimeStampNumber );
+  if(aPrs3d->Apply( false ))
+    return aPrs3d;
+  return NULL;
+}
+
+
+//----------------------------------------------------------------------------
+VISU::ColoredPrs3d_i*
+VISU::ColoredPrs3dCache_i
+::RegisterInHolder(VISU::ColoredPrs3d_i* thePrs3d,
+                  const std::string& theHolderEntry)
+{
+  if(MYDEBUG) cout << "RegisterInHolder " << theHolderEntry.c_str() << " " << thePrs3d << endl;
+  if(thePrs3d){
+    TPrs3dPtr aPrs3d(thePrs3d);
+    myHolderMap[theHolderEntry].push_front(aPrs3d);  
+    thePrs3d->SetHolderEntry( theHolderEntry );
+    thePrs3d->Destroy();
+  }
+  return thePrs3d;
+}
+
+
+//----------------------------------------------------------------------------
+VISU::ColoredPrs3d_i*
+VISU::ColoredPrs3dCache_i
+::CreatePrs(VISU::VISUType theType,
+           VISU::ColoredPrs3dHolder::BasicInput theInput,
+           VISU::ColoredPrs3dHolder_i* theHolder)
+{
+  return RegisterInHolder(CreateColoredPrs3d(theType, theInput), 
+                         theHolder->GetEntry());
+}
+
+
+//----------------------------------------------------------------------------
+VISU::TLastVisitedPrsList&
+VISU::ColoredPrs3dCache_i
+::GetLastVisitedPrsList(VISU::ColoredPrs3dHolder_i* theHolder)
+{
+  return myHolderMap[theHolder->GetEntry()];
+}
+
+
+//----------------------------------------------------------------------------
+VISU::TPrs3dPtr
+VISU::ColoredPrs3dCache_i
+::GetLastVisitedPrs(VISU::ColoredPrs3dHolder_i* theHolder)
+{
+  const TLastVisitedPrsList& aList = GetLastVisitedPrsList(theHolder);
+  if(MYDEBUG) cout << "GetLastVisitedPrs " << theHolder->GetEntry().c_str() << " " << aList.size() << endl;
+  if( !aList.empty() )
+    return aList.front();
+  return VISU::TPrs3dPtr();
+}
+
+
+//----------------------------------------------------------------------------
+VISU::TPrs3dPtr
+VISU::ColoredPrs3dCache_i
+::FindPrsByInput(TLastVisitedPrsList& theLastVisitedPrsList,
+                const VISU::ColoredPrs3dHolder::BasicInput& theInput)
+{
+  TLastVisitedPrsList::iterator anIter = theLastVisitedPrsList.begin();
+  TLastVisitedPrsList::iterator aEndIter = theLastVisitedPrsList.end();
+  for(; anIter != aEndIter; anIter++){
+    TPrs3dPtr aPrs3d = *anIter;
+    VISU::ColoredPrs3dHolder::BasicInput_var anInput = aPrs3d->GetBasicInput();
+    if(IsSameTimeStamp(theInput, anInput)){
+      theLastVisitedPrsList.erase(anIter);
+      return aPrs3d;
+    }
+  }
+  return VISU::TPrs3dPtr();
+}
+
+struct TFindActorEvent: public SALOME_Event
+{
+  VISU::TPrs3dPtr myPrs3d;
+  SVTK_ViewWindow* myViewWindow;
+
+  typedef VISU_Actor* TResult;
+  TResult myResult;
+
+  TFindActorEvent(VISU::TPrs3dPtr thePrs3d, SVTK_ViewWindow* theViewWindow):
+    myPrs3d(thePrs3d),
+    myViewWindow(theViewWindow),
+    myResult(NULL)
+  {}
+
+  virtual
+  void
+  Execute()
+  {
+    myResult = VISU::FindActor(myViewWindow, myPrs3d);
+  }
+};
+
+struct TAddActorEvent: public SALOME_Event
+{
+  VISU_Actor* myActor;
+  SVTK_ViewWindow* myViewWindow;
+public:
+  TAddActorEvent(VISU_Actor* theActor, SVTK_ViewWindow* theViewWindow):
+    myActor(theActor),
+    myViewWindow(theViewWindow)
+  {}
+  virtual void Execute(){
+    myViewWindow->AddActor(myActor);
+  }
+};
+
+struct TRenderEvent: public SALOME_Event
+{
+  SVTK_ViewWindow* myViewWindow;
+public:
+  TRenderEvent(SVTK_ViewWindow* theViewWindow):
+    myViewWindow(theViewWindow)
+  {}
+  virtual void Execute(){
+    myViewWindow->getRenderWindow()->Render();
+  }
+};
+
+//----------------------------------------------------------------------------
+bool
+VISU::ColoredPrs3dCache_i
+::UpdateLastVisitedPrs(VISU::ColoredPrs3dHolder_i* theHolder,
+                      VISU::ColoredPrs3d_i* thePrs,
+                      const VISU::ColoredPrs3dHolder::BasicInput& theInput,
+                      VISU::View3D_ptr theView3D)
+{
+  if(MYDEBUG) cout << "VISU::ColoredPrs3dCache_i::UpdateLastVisitedPrs" << endl;
+  TPrs3dPtr aLastVisitedPrs3d = GetLastVisitedPrs(theHolder);
+  TLastVisitedPrsList& aLastVisitedPrsList = GetLastVisitedPrsList(theHolder);
+  TPrs3dPtr aPrs3d;
+  bool anIsCheckPossible = GetMemoryMode() == VISU::ColoredPrs3dCache::LIMITED;
+  std::string aHolderEntry = theHolder->GetEntry();
+  VISU::VISUType aPrsType = theHolder->GetPrsType();
+  CORBA::Float aRequiredMemory = 0.0;
+  if(aPrs3d = FindPrsByInput(aLastVisitedPrsList, theInput)){
+    aLastVisitedPrsList.push_front(aPrs3d);
+    if(MYDEBUG) cout << "FindPrsByInput " << aPrs3d << endl;
+  }else if(anIsCheckPossible && IsPossible(aPrsType, theInput, aRequiredMemory, aHolderEntry)){
+    if( aRequiredMemory > 1.0 / VTK_LARGE_FLOAT )
+      ClearMemory(aRequiredMemory, aHolderEntry);
+    aPrs3d = CreatePrs(aPrsType, theInput, theHolder);
+    if(MYDEBUG) cout << "Created " << aPrs3d << endl;
+  }else{
+    aPrs3d = aLastVisitedPrsList.back();
+    aPrs3d->SetResultObject(theInput.myResult);
+    aPrs3d->SetMeshName(theInput.myMeshName);
+    aPrs3d->SetEntity(theInput.myEntity);
+    aPrs3d->SetFieldName(theInput.myFieldName);
+    aPrs3d->SetTimeStampNumber(theInput.myTimeStampNumber);
+    aLastVisitedPrsList.pop_back();
+    aLastVisitedPrsList.push_front(aPrs3d);
+    if(MYDEBUG) cout << "Move only " << aPrs3d << endl;
+  }
+  //if(MYDEBUG) PrintCache();
+
+  aPrs3d->SameAs(thePrs);
+  aPrs3d->UpdateActors();
+  if(!CORBA::is_nil(theView3D)){
+    PortableServer::ServantBase_var aServant = GetServant(theView3D);
+    if(VISU::View3D_i* aView3d = dynamic_cast<VISU::View3D_i*>(aServant.in())){
+      if(SUIT_ViewWindow* aView = aView3d->GetViewWindow()){
+       if(SVTK_ViewWindow* aViewWindow = dynamic_cast<SVTK_ViewWindow*>(aView)){
+         // Find actor that corresponds to the holder
+         VISU_Actor* anActor = ProcessEvent(new TFindActorEvent(aLastVisitedPrs3d,aViewWindow));
+         //VISU_Actor* anActor = VISU::FindActor(aViewWindow, aLastVisitedPrs3d);
+
+         // If the holder was erased from view then do nothing
+         if(anActor && !anActor->GetVisibility())
+           return true;
+
+         if(!anActor)
+         {
+           anActor = aLastVisitedPrs3d->CreateActor();
+           ProcessVoidEvent(new TAddActorEvent(anActor,aViewWindow));
+           //aViewWindow->AddActor(anActor);
+           anActor->SetVisibility(true);
+         }
+
+         if(aPrs3d != aLastVisitedPrs3d)
+         {
+           // To erase non active presentation
+           aLastVisitedPrs3d->SetActiveState(false);
+           if(anActor)
+             anActor->SetVisibility(false);
+
+           // To find the new one that corresponds to fresh presentation
+           VISU_Actor* aNewActor = ProcessEvent(new TFindActorEvent(aPrs3d,aViewWindow));
+           //VISU_Actor* aNewActor = VISU::FindActor(aViewWindow, aPrs3d);
+           if(!aNewActor){
+             aNewActor = aPrs3d->CreateActor();
+             ProcessVoidEvent(new TAddActorEvent(aNewActor,aViewWindow));
+             //aViewWindow->AddActor(aNewActor);
+           }else
+             aNewActor->SetVisibility(true);
+           aNewActor->DeepCopy(anActor);
+
+           aPrs3d->SetActiveState(true);
+         }
+         ProcessVoidEvent(new TRenderEvent(aViewWindow));
+         //aViewWindow->getRenderWindow()->Render();
+         return true;
+       }
+      }
+    }
+  }
+
+  return false;
+}
+
+
+//----------------------------------------------------------------------------
+void
+VISU::ColoredPrs3dCache_i
+::ClearCache(float theMemory)
+{
+  CORBA::Float aCurrentMemory = GetMemorySize();
+  ClearMemory( aCurrentMemory - theMemory, "" );
+}
+
+
+//----------------------------------------------------------------------------
+bool
+VISU::ColoredPrs3dCache_i
+::ClearMemory(CORBA::Float theRequiredMemory, 
+             const std::string& theHolderEntry)
+{
+  CORBA::Float aInitialMemorySize = GetMemorySize();
+  TColoredPrs3dHolderMap aHolder2PrsToBeDeletedMap;
+  SelectPrs3dToBeDeleted(theRequiredMemory, theHolderEntry, myHolderMap, aHolder2PrsToBeDeletedMap);
+  TColoredPrs3dHolderMap::const_iterator aHolderIter = aHolder2PrsToBeDeletedMap.begin();
+  TColoredPrs3dHolderMap::const_iterator anEndHolderIter = aHolder2PrsToBeDeletedMap.end();
+  for(; aHolderIter != anEndHolderIter; aHolderIter++){
+    const std::string aHolderEntry = aHolderIter->first;
+    TColoredPrs3dHolderMap::iterator anHolderMapIter = myHolderMap.find(aHolderEntry);
+    if(anHolderMapIter != myHolderMap.end()){
+      TLastVisitedPrsList& aLastVisitedPrsList = anHolderMapIter->second;
+      
+      const TLastVisitedPrsList& aPrsToBeDeletedList = aHolderIter->second;
+      TLastVisitedPrsList::const_iterator anIter = aPrsToBeDeletedList.begin();
+      TLastVisitedPrsList::const_iterator aEndIter = aPrsToBeDeletedList.end();
+      for(; anIter != aEndIter; anIter++){
+       TPrs3dPtr aPrs3d = *anIter;
+       ErasePrs3d(aLastVisitedPrsList, aPrs3d);
+      }
+    }
+  }
+  CORBA::Float aCurrentMemory = GetMemorySize();
+  return (aInitialMemorySize - aCurrentMemory >= theRequiredMemory);
+}
+
+
+//----------------------------------------------------------------------------
+void
+VISU::ColoredPrs3dCache_i
+::PrintCache()
+{
+  if(MYDEBUG)
+  {
+    cout << "--------------CACHE-----------------" << endl;
+    cout << "Cache memory - " << GetMemorySize() << " Mb" << endl;
+    TColoredPrs3dHolderMap::const_iterator aHolderIter = myHolderMap.begin();
+    TColoredPrs3dHolderMap::const_iterator aHolderIterEnd = myHolderMap.end();
+    for(; aHolderIter != aHolderIterEnd; aHolderIter++){
+      const TLastVisitedPrsList& aPrsList = aHolderIter->second;
+      TLastVisitedPrsList::const_iterator aPrsIter = aPrsList.begin();
+      TLastVisitedPrsList::const_iterator aPrsIterEnd = aPrsList.end();
+
+      cout << "--------------------------" << endl;
+      cout << "Holder - " << aHolderIter->first.c_str() << endl;
+      cout << "Size   - " << aPrsList.size() << endl;
+      for(; aPrsIter != aPrsIterEnd; aPrsIter++)
+       if(TPrs3dPtr aPrs3d = *aPrsIter)
+       {
+         cout << aPrs3d << " (" << aPrs3d->GetMemorySize() << " Mb)";
+         if(aPrsIter == aPrsList.begin())
+           cout << " (device)";
+         cout << endl;
+       }
+    }
+    cout << "------------------------------------" << endl;
+  }
+}
+
+
+//----------------------------------------------------------------------------
+void
+VISU::ColoredPrs3dCache_i
+::RemoveHolder(VISU::ColoredPrs3dHolder_i* theHolder)
+{
+  TColoredPrs3dHolderMap::iterator anIter = myHolderMap.find(theHolder->GetEntry());
+  if(anIter != myHolderMap.end())
+    myHolderMap.erase(anIter);
+}
+
+//----------------------------------------------------------------------------
+void
+VISU::ColoredPrs3dCache_i
+::ToStream(std::ostringstream& theStr) 
+{
+  Storable::DataToStream( theStr, "myMemoryMode", GetMemoryMode() );
+  Storable::DataToStream( theStr, "myLimitedMemory", GetLimitedMemory() );
+}
+
+//---------------------------------------------------------------
+VISU::Storable*
+VISU::ColoredPrs3dCache_i
+::Restore(SALOMEDS::SObject_ptr theSObject,
+         const Storable::TRestoringMap& theMap,
+         const string& thePrefix)
+{
+  SetMemoryMode( (VISU::ColoredPrs3dCache::MemoryMode)VISU::Storable::FindValue( theMap, "myMemoryMode" ).toInt() );
+  SetLimitedMemory( VISU::Storable::FindValue( theMap, "myLimitedMemory" ).toInt() );
+
+  return this;
+}
+
+//---------------------------------------------------------------
+VISU::Storable*
+VISU::ColoredPrs3dCache_i
+::Restore(SALOMEDS::SObject_ptr theSObject,
+         const string& thePrefix,
+         const Storable::TRestoringMap& theMap)
+{
+  SALOMEDS::Study_var aStudy = theSObject->GetStudy();
+  VISU::ColoredPrs3dCache_i* aCache = new VISU::ColoredPrs3dCache_i(aStudy, false);
+  return aCache->Restore(theSObject,theMap,thePrefix);
+}
diff --git a/src/VISU_I/VISU_ColoredPrs3dCache_i.hh b/src/VISU_I/VISU_ColoredPrs3dCache_i.hh
new file mode 100644 (file)
index 0000000..8017b59
--- /dev/null
@@ -0,0 +1,283 @@
+//  VISU OBJECT : interactive object for VISU entities implementation
+//
+//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+//
+//  File   : VISU_ColoredPrs3dCache_i.hh
+//  Author : Oleg UVAROV
+//  Module : VISU
+
+#ifndef VISU_ColoredPrs3dCache_i_HeaderFile
+#define VISU_ColoredPrs3dCache_i_HeaderFile
+
+#include "VISU_ColoredPrs3dFactory.hh"
+
+#include "SALOME_GenericObjPointer.hh"
+
+namespace VISU
+{
+  class Result_i;
+  class ColoredPrs3d_i;
+  class ColoredPrs3dHolder_i;
+
+  struct TPrs3dPtr: SALOME::GenericObjPtr<ColoredPrs3d_i>
+  {
+    typedef SALOME::GenericObjPtr<ColoredPrs3d_i> TSuperClass;
+    //! Initialize smart pointer to NULL.
+    TPrs3dPtr():
+      TSuperClass()
+    {}
+
+    //! Initialize smart pointer to given object (TSGenericObj must be complete).
+    TPrs3dPtr(ColoredPrs3d_i* thePointer):
+      TSuperClass(thePointer)
+    {}
+
+    /*! 
+      Initialize smart pointer with a new reference to the same object
+      referenced by given smart pointer.
+     */
+    TPrs3dPtr(const TPrs3dPtr& thePointer):
+      TSuperClass(thePointer)
+    {}
+
+
+    /*! 
+      Assign object to reference.  This removes any reference to an old
+      object.
+    */
+    TPrs3dPtr& 
+    operator=(const TPrs3dPtr& thePointer)
+    {
+      TSuperClass::operator=(thePointer);
+      return *this;
+    }
+
+    /*! 
+      Assign object to reference.  This removes any reference to an old
+      object.
+    */
+    TPrs3dPtr& 
+    operator=(ColoredPrs3d_i* thePointer)
+    {
+      TSuperClass::operator=(thePointer);
+      return *this;
+    }
+
+    //! Get the contained pointer.
+    ColoredPrs3d_i* 
+    get() const
+    {
+      ColoredPrs3d_i* aColoredPrs3d = TSuperClass::get();
+      // To implement postponed restoring of the presentation
+      if(aColoredPrs3d)
+       aColoredPrs3d->InitFromRestoringState();
+      return aColoredPrs3d;
+    }
+  };
+
+  typedef std::deque<TPrs3dPtr> TLastVisitedPrsList;
+
+  typedef std::string THolderEntry;
+  typedef std::map<THolderEntry,TLastVisitedPrsList> TColoredPrs3dHolderMap;
+
+  /*!
+   * This interface is responsible for memory management of 3d presentations.
+   * One cache corresponds to one study.
+   */
+  class ColoredPrs3dCache_i : public virtual POA_VISU::ColoredPrs3dCache,
+                             public virtual SALOME::GenericObj_i,
+                             public virtual RemovableObject_i
+  {
+    ColoredPrs3dCache_i();
+    ColoredPrs3dCache_i(const ColoredPrs3dCache_i&);
+  public:
+    //----------------------------------------------------------------------------
+    //! A constructor to create an instance of the class
+    explicit
+    ColoredPrs3dCache_i(SALOMEDS::Study_ptr theStudy,
+                       bool thePublishInStudy = true);
+
+    virtual
+    ~ColoredPrs3dCache_i();
+
+    //----------------------------------------------------------------------------
+    /*! Creates ColoredPrs3dHolder */
+    virtual
+    VISU::ColoredPrs3dHolder_ptr
+    CreateHolder(VISU::VISUType theType,
+                const VISU::ColoredPrs3dHolder::BasicInput& theInput);
+
+    //----------------------------------------------------------------------------
+    /*! Gets a memory which is required to create a holder. */
+    virtual
+    VISU::ColoredPrs3dCache::EnlargeType
+    GetRequiredMemory(VISU::VISUType theType,
+                     const VISU::ColoredPrs3dHolder::BasicInput& theInput,
+                     CORBA::Float& theRequiredMemory);
+
+    //----------------------------------------------------------------------------
+    //! Sets a memory mode.
+    virtual
+    void
+    SetMemoryMode(VISU::ColoredPrs3dCache::MemoryMode theMode);
+
+    virtual
+    VISU::ColoredPrs3dCache::MemoryMode
+    GetMemoryMode();
+
+    //----------------------------------------------------------------------------
+    //! Sets a memory size for limited mode.
+    virtual
+    void
+    SetLimitedMemory(CORBA::Float theMemorySize);
+
+    virtual
+    CORBA::Float
+    GetLimitedMemory();
+
+    virtual
+    CORBA::Float
+    GetMemorySize();
+
+    virtual
+    CORBA::Float
+    GetDeviceMemorySize();
+
+    //----------------------------------------------------------------------------
+    virtual 
+    VISU::VISUType 
+    GetType() 
+    {
+      return VISU::TCOLOREDPRS3DCACHE; 
+    }
+
+    virtual
+    void
+    RemoveFromStudy();
+
+    static
+    std::string
+    GetFolderName();
+
+    virtual
+    const char* 
+    GetComment() const;
+
+    virtual
+    void
+    ToStream(std::ostringstream&);
+
+    virtual
+    Storable*
+    Restore(SALOMEDS::SObject_ptr theSObject,
+           const Storable::TRestoringMap& theMap,
+           const std::string& thePrefix);
+
+    static
+    Storable*
+    Restore(SALOMEDS::SObject_ptr theSObject,
+           const std::string& thePrefix,
+           const Storable::TRestoringMap& theMap);
+
+    //----------------------------------------------------------------------------
+    //! Finds or creates instance of the ColoredPrs3dCache in the given SALOMEDS::Study
+    static
+    VISU::ColoredPrs3dCache_i*
+    GetInstance_i(SALOMEDS::Study_ptr theStudy);
+
+    static
+    VISU::ColoredPrs3dCache_ptr
+    GetInstance(SALOMEDS::Study_ptr theStudy);
+
+    //! Creates corresponding ColoredPrs3d instance and apply the BasicInput
+    VISU::ColoredPrs3d_i*
+    CreateColoredPrs3d(VISU::VISUType theType,
+                      VISU::ColoredPrs3dHolder::BasicInput theInput);
+
+    //! Registers the given ColoredPrs3d instance for the ColoredPrs3dHolder
+    VISU::ColoredPrs3d_i*
+    RegisterInHolder(VISU::ColoredPrs3d_i* thePrs3d,
+                    const std::string& theHolderEntry);
+
+    //! Creates and registers corresponding ColoredPrs3d instance for the ColoredPrs3dHolder
+    VISU::ColoredPrs3d_i*
+    CreatePrs(VISU::VISUType theType,
+             VISU::ColoredPrs3dHolder::BasicInput theInput,
+             VISU::ColoredPrs3dHolder_i* theHolder);
+
+    TLastVisitedPrsList&
+    GetLastVisitedPrsList(VISU::ColoredPrs3dHolder_i* theHolder);
+
+    TPrs3dPtr
+    GetLastVisitedPrs(VISU::ColoredPrs3dHolder_i* theHolder);
+
+    bool
+    UpdateLastVisitedPrs(VISU::ColoredPrs3dHolder_i* theHolder,
+                        VISU::ColoredPrs3d_i* thePrs,
+                        const VISU::ColoredPrs3dHolder::BasicInput& theInput,
+                        VISU::View3D_ptr theView3D);
+
+    //! Unregister the holder instance from cache
+    void
+    RemoveHolder(VISU::ColoredPrs3dHolder_i* theHolder);
+
+    TColoredPrs3dHolderMap
+    GetHolderMap() { return myHolderMap; }
+
+  public:
+    static const std::string myComment;
+
+  protected:
+    //----------------------------------------------------------------------------
+    virtual int
+    IsPossible(VISU::VISUType theType,
+              const VISU::ColoredPrs3dHolder::BasicInput& theInput,
+              float& theMemoryToClear,
+              const std::string theHolderEntry);
+
+    TPrs3dPtr
+    FindPrsByInput(TLastVisitedPrsList& theLastVisitedPrsList,
+                  const VISU::ColoredPrs3dHolder::BasicInput& theInput);
+
+    //----------------------------------------------------------------------------
+    void
+    ClearCache(float theMemory = 0);
+
+    bool
+    ClearMemory(CORBA::Float theRequiredMemory, 
+               const std::string& theHolderEntry);
+
+    void
+    PrintCache();
+
+  private:
+    CORBA::Float myLimitedMemory;
+    VISU::ColoredPrs3dCache::MemoryMode myMemoryMode;
+
+    TColoredPrs3dHolderMap myHolderMap; 
+  };
+
+
+  //----------------------------------------------------------------------------
+}
+
+#endif
diff --git a/src/VISU_I/VISU_ColoredPrs3dFactory.cc b/src/VISU_I/VISU_ColoredPrs3dFactory.cc
new file mode 100644 (file)
index 0000000..427eb46
--- /dev/null
@@ -0,0 +1,247 @@
+//  VISU OBJECT : interactive object for VISU entities implementation
+//
+//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+//
+//  File   : VISU_ColoredPrs3dCache_i.cc
+//  Author : Oleg UVAROV
+//  Module : VISU
+
+#include "VISU_ColoredPrs3dFactory.hh"
+#include "VISU_ColoredPrs3dCache_i.hh"
+
+#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
+#define NO_CAS_CATCH
+#endif
+
+#include <Standard_Failure.hxx>
+
+#ifdef NO_CAS_CATCH
+#include <Standard_ErrorHandler.hxx>
+#else
+#include "CASCatch.hxx"
+#endif
+
+#ifdef _DEBUG_
+//static int MYDEBUG = 0;
+//#define _DEXCEPT_
+#else
+//static int MYDEBUG = 0;
+#endif
+
+
+namespace VISU
+{
+  //----------------------------------------------------------------------------
+  bool
+  CreatColoredPrs3d(ColoredPrs3d_i* theColoredPrs3d,
+                   Result_i* theResult,
+                   const std::string& theMeshName, 
+                   VISU::Entity theEntity,
+                   const std::string& theFieldName, 
+                   CORBA::Long theIteration)
+  {
+#ifndef _DEXCEPT_
+#ifdef NO_CAS_CATCH
+    try{
+      OCC_CATCH_SIGNALS;
+#else
+      CASCatch_TRY{
+       try{
+#endif
+#endif
+         theColoredPrs3d->SetCResult(theResult);
+         theColoredPrs3d->SetMeshName(theMeshName.c_str());
+         theColoredPrs3d->SetEntity(theEntity);
+         theColoredPrs3d->SetFieldName(theFieldName.c_str());
+         theColoredPrs3d->SetTimeStampNumber(theIteration);
+         if(theColoredPrs3d->Apply(false))
+           return true;
+#ifndef _DEXCEPT_
+#ifdef NO_CAS_CATCH
+       }catch(Standard_Failure) {
+         Handle(Standard_Failure) aFail = Standard_Failure::Caught();
+         INFOS("Follow signal was occured :\n"<<aFail->GetMessageString());
+       }catch(std::exception& exc){
+         INFOS("Follow exception was occured :\n"<<exc.what());
+       }catch(...){
+         INFOS("Unknown exception was occured!");
+       }
+#else
+      }catch(std::exception& exc){
+       INFOS("Follow exception was occured :\n"<<exc.what());
+      }catch(...){
+       INFOS("Unknown exception was occured!");
+      }
+    }CASCatch_CATCH(Standard_Failure){
+      Handle(Standard_Failure) aFail = Standard_Failure::Caught();          
+      INFOS("Follow signal was occured :\n"<<aFail->GetMessageString());
+    }
+#endif
+#endif
+    return false;
+  }
+
+
+  //----------------------------------------------------------------------------
+  VISU::ColoredPrs3d_i*
+  CreatePrs3d_i(VISUType theType,
+               SALOMEDS::Study_ptr theStudy,
+               ColoredPrs3d_i::EPublishInStudyMode thePublishInStudyMode)
+  {
+    switch(theType){
+    case TSCALARMAP:
+      return VISU::CreatePrs3dByEnum<TSCALARMAP>(theStudy, thePublishInStudyMode);
+    case TGAUSSPOINTS:
+      return VISU::CreatePrs3dByEnum<TGAUSSPOINTS>(theStudy, thePublishInStudyMode);
+    case TDEFORMEDSHAPE:
+      return VISU::CreatePrs3dByEnum<TDEFORMEDSHAPE>(theStudy, thePublishInStudyMode);
+    case TSCALARMAPONDEFORMEDSHAPE:
+      return VISU::CreatePrs3dByEnum<TSCALARMAPONDEFORMEDSHAPE>(theStudy, thePublishInStudyMode);
+    case TISOSURFACE:
+      return VISU::CreatePrs3dByEnum<TISOSURFACE>(theStudy, thePublishInStudyMode);
+    case TSTREAMLINES:
+      return VISU::CreatePrs3dByEnum<TSTREAMLINES>(theStudy, thePublishInStudyMode);
+    case TPLOT3D:
+      return VISU::CreatePrs3dByEnum<TPLOT3D>(theStudy, thePublishInStudyMode);
+    case TCUTPLANES:
+      return VISU::CreatePrs3dByEnum<TCUTPLANES>(theStudy, thePublishInStudyMode);
+    case TCUTLINES:
+      return VISU::CreatePrs3dByEnum<TCUTLINES>(theStudy, thePublishInStudyMode);
+    case TVECTORS:
+      return VISU::CreatePrs3dByEnum<TVECTORS>(theStudy, thePublishInStudyMode);
+    }
+    return NULL;
+  }
+
+
+  //----------------------------------------------------------------------------
+  VISU::ColoredPrs3dCache::EnlargeType
+  GetRequiredCacheMemory(VISU::VISUType theType,
+                        VISU::Result_ptr theResult, 
+                        const std::string& theMeshName, 
+                        VISU::Entity theEntity,
+                        const std::string& theFieldName, 
+                        CORBA::Long theIteration,
+                        CORBA::Float& theUsedMemory,
+                        CORBA::Float& theRequiredMemory)
+  {
+    VISU::ColoredPrs3dCache::EnlargeType anEnlargeType = VISU::ColoredPrs3dCache::NO_ENLARGE;
+    if(Result_i* aResult = dynamic_cast<Result_i*>(GetServant(theResult).in())){
+      VISU::ColoredPrs3dHolder::BasicInput anInput;
+      anInput.myResult = VISU::Result::_duplicate(theResult);
+      anInput.myMeshName = theMeshName.c_str();
+      anInput.myEntity = theEntity;
+      anInput.myFieldName = theFieldName.c_str();
+      anInput.myTimeStampNumber = theIteration;
+      
+      SALOMEDS::Study_var aStudy = aResult->GetStudyDocument();
+      VISU::ColoredPrs3dCache_var aCache = ColoredPrs3dCache_i::GetInstance(aStudy);
+
+      theUsedMemory = aCache->GetMemorySize();
+      anEnlargeType = aCache->GetRequiredMemory(theType, anInput, theRequiredMemory);
+    }
+    return anEnlargeType;
+  }
+
+
+  //----------------------------------------------------------------------------
+  VISU::ColoredPrs3d_i*
+  CreateHolder2GetDeviceByEnum(VISU::VISUType theType,
+                              VISU::Result_ptr theResult, 
+                              const std::string& theMeshName, 
+                              VISU::Entity theEntity,
+                              const std::string& theFieldName, 
+                              CORBA::Long theIteration,
+                              VISU::ColoredPrs3dCache::EnlargeType theEnlargeType,
+                              CORBA::Float theRequiredMemory)
+  {
+    VISU::ColoredPrs3d_i* aColoredPrs3d = NULL;
+    if(Result_i* aResult = dynamic_cast<Result_i*>(GetServant(theResult).in())){
+      VISU::ColoredPrs3dHolder::BasicInput anInput;
+      anInput.myResult = VISU::Result::_duplicate(theResult);
+      anInput.myMeshName = theMeshName.c_str();
+      anInput.myEntity = theEntity;
+      anInput.myFieldName = theFieldName.c_str();
+      anInput.myTimeStampNumber = theIteration;
+      
+      SALOMEDS::Study_var aStudy = aResult->GetStudyDocument();
+      VISU::ColoredPrs3dCache_var aCache = ColoredPrs3dCache_i::GetInstance(aStudy);
+
+      if( theEnlargeType == VISU::ColoredPrs3dCache::ENLARGE )
+       aCache->SetLimitedMemory( theRequiredMemory );
+
+      VISU::ColoredPrs3dHolder_var aHolder = aCache->CreateHolder(theType, anInput);
+      
+      if( CORBA::is_nil(aHolder) )
+       return NULL;
+      
+      VISU::ColoredPrs3d_var aPrs3d = aHolder->GetDevice();
+      aColoredPrs3d = dynamic_cast<VISU::ColoredPrs3d_i*>(GetServant(aPrs3d).in());
+    }
+    return aColoredPrs3d;
+  }
+  
+  
+  //----------------------------------------------------------------------------
+  size_t
+  CheckIsPossible(VISU::VISUType theType,
+                 const VISU::ColoredPrs3dHolder::BasicInput& theInput,
+                 bool theMemoryCheck)
+  {
+    size_t aMemory = 0;
+    switch(theType){
+    case TSCALARMAP:
+      aMemory = CheckIsPossible<TSCALARMAP>(theInput, theMemoryCheck);
+      break;
+    case TGAUSSPOINTS:
+      aMemory = CheckIsPossible<TGAUSSPOINTS>(theInput, theMemoryCheck);
+      break;
+    case TDEFORMEDSHAPE:
+      aMemory = CheckIsPossible<TDEFORMEDSHAPE>(theInput, theMemoryCheck);
+      break;
+    case TSCALARMAPONDEFORMEDSHAPE:
+      aMemory = CheckIsPossible<TSCALARMAPONDEFORMEDSHAPE>(theInput, theMemoryCheck);
+      break;
+    case TISOSURFACE:
+      aMemory = CheckIsPossible<TISOSURFACE>(theInput, theMemoryCheck);
+      break;
+    case TSTREAMLINES:
+      aMemory = CheckIsPossible<TSTREAMLINES>(theInput, theMemoryCheck);
+      break;
+    case TPLOT3D:
+      aMemory = CheckIsPossible<TPLOT3D>(theInput, theMemoryCheck);
+      break;
+    case TCUTPLANES:
+      aMemory = CheckIsPossible<TCUTPLANES>(theInput, theMemoryCheck);
+      break;
+    case TCUTLINES:
+      aMemory = CheckIsPossible<TCUTLINES>(theInput, theMemoryCheck);
+      break;
+    case TVECTORS:
+      aMemory = CheckIsPossible<TVECTORS>(theInput, theMemoryCheck);
+      break;
+    }
+    return aMemory;
+  }
+
+
+  //----------------------------------------------------------------------------
+}
diff --git a/src/VISU_I/VISU_ColoredPrs3dFactory.hh b/src/VISU_I/VISU_ColoredPrs3dFactory.hh
new file mode 100644 (file)
index 0000000..5ae97c3
--- /dev/null
@@ -0,0 +1,328 @@
+//  VISU OBJECT : interactive object for VISU entities implementation
+//
+//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+//
+//  File   : VISU_ColoredPrs3dCache_i.hh
+//  Author : Oleg UVAROV
+//  Module : VISU
+
+#ifndef VISU_ColoredPrs3dFactory_HeaderFile
+#define VISU_ColoredPrs3dFactory_HeaderFile
+
+#include "SALOMEconfig.h"
+#include CORBA_SERVER_HEADER(VISU_Gen)
+#include CORBA_SERVER_HEADER(SALOMEDS)
+
+#include "VISU_ScalarMapOnDeformedShape_i.hh"
+#include "VISU_Plot3D_i.hh"
+#include "VISU_GaussPoints_i.hh"
+#include "VISU_StreamLines_i.hh"
+#include "VISU_Vectors_i.hh"
+#include "VISU_CutLines_i.hh"
+#include "VISU_CutPlanes_i.hh"
+#include "VISU_DeformedShape_i.hh"
+#include "VISU_IsoSurfaces_i.hh"
+#include "VISU_ScalarMap_i.hh"
+#include "VISU_ColoredPrs3d_i.hh"
+#include "VISU_Result_i.hh"
+#include "VISU_TypeList.hxx"
+
+namespace VISU
+{
+  namespace TL
+  {
+    //----------------------------------------------------------------------------
+    typedef TList<ScalarMapOnDeformedShape_i,
+                 TList<DeformedShape_i,
+                       TList<StreamLines_i,
+                             TList<GaussPoints_i,
+                                   TList<ScalarMap_i,
+                                         TList<IsoSurfaces_i,
+                                               TList<CutPlanes_i,
+                                                     TList<CutLines_i,
+                                                           TList<Vectors_i,
+                                                                 TList<Plot3D_i, 
+                                                                       TNullType> > > > > > > > > >
+    TColoredPrs3dTypeList;
+    
+
+    typedef TList<TInt2Type<TSCALARMAPONDEFORMEDSHAPE>,
+                 TList<TInt2Type<TDEFORMEDSHAPE>, 
+                       TList<TInt2Type<TSTREAMLINES>,
+                             TList<TInt2Type<TGAUSSPOINTS>,
+                                   TList<TInt2Type<TSCALARMAP>,
+                                         TList<TInt2Type<TISOSURFACE>,
+                                               TList<TInt2Type<TCUTPLANES>,
+                                                     TList<TInt2Type<TCUTLINES>,
+                                                           TList<TInt2Type<TVECTORS>,
+                                                                 TList<TInt2Type<TPLOT3D>, 
+                                                                       TNullType> > > > > > > > > >
+    TColoredPrs3dEnumList;
+    
+
+    //----------------------------------------------------------------------------
+    template <unsigned int type_enum>
+    struct TColoredEnum2Type
+    {
+      typedef typename TTypeAt<TColoredPrs3dTypeList, TIndexOf<TColoredPrs3dEnumList, TInt2Type<type_enum> >::value >::TResult TResult;
+    };
+    
+    //----------------------------------------------------------------------------
+    template <class T>
+    struct TColoredType2Enum
+    {
+      typedef typename TTypeAt<TColoredPrs3dEnumList, TIndexOf<TColoredPrs3dTypeList, T>::value >::TResult TResult;
+    };
+
+  }
+
+  //----------------------------------------------------------------------------
+  template<typename TPrs3d_i> 
+  ColoredPrs3d_i*
+  CreatePrs3dByType(SALOMEDS::Study_ptr theStudy,
+                   ColoredPrs3d_i::EPublishInStudyMode thePublishInStudyMode)
+  {
+    if(!theStudy->GetProperties()->IsLocked()){
+      typedef typename TPrs3d_i::TInterface TPrs3d;
+      if(TPrs3d_i* aPresent = new TPrs3d_i(thePublishInStudyMode)){
+       return aPresent;
+      }
+    }
+    return NULL;
+  }
+
+
+  //----------------------------------------------------------------------------
+  template<unsigned int type_enum> 
+  ColoredPrs3d_i*
+  CreatePrs3dByEnum(SALOMEDS::Study_ptr theStudy,
+                   ColoredPrs3d_i::EPublishInStudyMode thePublishInStudyMode)
+  {
+    typedef typename TL::TColoredEnum2Type<type_enum>::TResult TColoredPrs3d;
+    return CreatePrs3dByType<TColoredPrs3d>(theStudy,
+                                           thePublishInStudyMode);
+  };
+
+
+  //----------------------------------------------------------------------------
+  ColoredPrs3d_i*
+  CreatePrs3d_i(VISUType theType,
+               SALOMEDS::Study_ptr theStudy,
+               ColoredPrs3d_i::EPublishInStudyMode thePublishInStudyMode);
+  
+  
+  //----------------------------------------------------------------------------
+  bool
+  CreatColoredPrs3d(ColoredPrs3d_i* theColoredPrs3d,
+                   Result_i* theResult,
+                   const std::string& theMeshName, 
+                   VISU::Entity theEntity,
+                   const std::string& theFieldName, 
+                   CORBA::Long theIteration);
+
+
+  //----------------------------------------------------------------------------
+  //Create 3D collored Presentation Of Different Types
+  template<typename TPrs3d_i> TPrs3d_i*
+  CreatePrs3d(Result_ptr theResult, 
+             const std::string& theMeshName, 
+             VISU::Entity theEntity,
+             const std::string& theFieldName, 
+             CORBA::Long theTimeStampNumber)
+  {
+    typedef typename TPrs3d_i::TInterface TPrs3d;
+    typename TPrs3d::_var_type aPrs3d;
+
+    if(Result_i* aResult = dynamic_cast<Result_i*>(GetServant(theResult).in())){
+      SALOMEDS::Study_var aStudy = aResult->GetStudyDocument();
+      if(aStudy->GetProperties()->IsLocked()) 
+       return NULL;
+    
+      if(TPrs3d_i::IsPossible(aResult, theMeshName, theEntity, theFieldName, theTimeStampNumber, true)){
+       TPrs3d_i* aPresent = new TPrs3d_i(ColoredPrs3d_i::EPublishUnderTimeStamp);
+       
+       if(CreatColoredPrs3d(aPresent, aResult, theMeshName, theEntity, theFieldName, theTimeStampNumber))
+         return aPresent;
+       
+       aPresent->_remove_ref();
+      }
+    }
+    return NULL;
+  }
+
+
+  //----------------------------------------------------------------------------
+  template<typename TPrs3d_i> 
+  typename TPrs3d_i::TInterface::_var_type
+  Prs3dOnField(Result_ptr theResult, 
+              const std::string& theMeshName, 
+              VISU::Entity theEntity,
+              const std::string& theFieldName, 
+              CORBA::Long theTimeStampNumber)
+  {
+    if(TPrs3d_i* aPrs3d = CreatePrs3d<TPrs3d_i>(theResult,
+                                               theMeshName,
+                                               theEntity,
+                                               theFieldName,
+                                               theTimeStampNumber))
+      return aPrs3d->_this();
+    typedef typename TPrs3d_i::TInterface TPrs3d;
+    return TPrs3d::_nil();
+  }
+
+
+  //----------------------------------------------------------------------------
+  //! Gets the memory required for cache
+  VISU::ColoredPrs3dCache::EnlargeType
+  GetRequiredCacheMemory(VISU::VISUType theType,
+                        VISU::Result_ptr theResult, 
+                        const std::string& theMeshName, 
+                        VISU::Entity theEntity,
+                        const std::string& theFieldName, 
+                        CORBA::Long theTimeStampNumber,
+                        CORBA::Float& theUsedMemory,
+                        CORBA::Float& theRequiredMemory);
+
+
+  //----------------------------------------------------------------------------
+  //! Gets the memory required for cache
+  template<class TColoredPrs3d_i> 
+  VISU::ColoredPrs3dCache::EnlargeType
+  GetRequiredCacheMemory(VISU::Result_ptr theResult, 
+                        const std::string& theMeshName, 
+                        VISU::Entity theEntity,
+                        const std::string& theFieldName, 
+                        CORBA::Long theTimeStampNumber,
+                        CORBA::Float& theUsedMemory,
+                        CORBA::Float& theRequiredMemory)
+  {
+    typedef typename TL::TColoredType2Enum<TColoredPrs3d_i>::TResult TEnum;
+    VISU::VISUType aColoredPrs3dType = VISU::VISUType(TEnum::value);
+    return GetRequiredCacheMemory(aColoredPrs3dType,
+                                 theResult, 
+                                 theMeshName, 
+                                 theEntity,
+                                 theFieldName, 
+                                 theTimeStampNumber,
+                                 theUsedMemory,
+                                 theRequiredMemory);
+  }
+
+
+  //----------------------------------------------------------------------------
+  //! Creates ColoredPrs3dHolder by enumeration value and gets its first device
+  ColoredPrs3d_i*
+  CreateHolder2GetDeviceByEnum(VISU::VISUType theType,
+                              VISU::Result_ptr theResult, 
+                              const std::string& theMeshName, 
+                              VISU::Entity theEntity,
+                              const std::string& theFieldName, 
+                              CORBA::Long theTimeStampNumber,
+                              VISU::ColoredPrs3dCache::EnlargeType theEnlargeType,
+                              CORBA::Float theRequiredMemory);
+    
+  
+  //----------------------------------------------------------------------------
+  //! Creates ColoredPrs3dHolder by type and gets its first device
+  template<class TColoredPrs3d_i> 
+  TColoredPrs3d_i*
+  CreateHolder2GetDeviceByType(VISU::Result_ptr theResult, 
+                              const std::string& theMeshName, 
+                              VISU::Entity theEntity,
+                              const std::string& theFieldName, 
+                              CORBA::Long theTimeStampNumber,
+                              VISU::ColoredPrs3dCache::EnlargeType theEnlargeType,
+                              CORBA::Float theRequiredMemory)
+  {
+    typedef typename TL::TColoredType2Enum<TColoredPrs3d_i>::TResult TEnum;
+    VISU::VISUType aColoredPrs3dType = VISU::VISUType(TEnum::value);
+    ColoredPrs3d_i* aColoredPrs3d = CreateHolder2GetDeviceByEnum(aColoredPrs3dType,
+                                                                theResult, 
+                                                                theMeshName, 
+                                                                theEntity,
+                                                                theFieldName, 
+                                                                theTimeStampNumber,
+                                                                theEnlargeType,
+                                                                theRequiredMemory);
+    return dynamic_cast<TColoredPrs3d_i*>(aColoredPrs3d);
+  }
+
+
+  //----------------------------------------------------------------------------
+  template<unsigned int colored_prs3d_type_enum>
+  struct TSameAsFactory
+  {
+    typedef typename TL::TColoredEnum2Type<colored_prs3d_type_enum>::TResult TColoredPrs3d;
+
+    void
+    Copy(ColoredPrs3d_i* theColoredPrs3dTo, ColoredPrs3d_i* theColoredPrs3dFrom)
+    {
+      theColoredPrs3dTo->SetCResult(theColoredPrs3dFrom->GetCResult());
+      theColoredPrs3dTo->SetMeshName(theColoredPrs3dFrom->GetCMeshName().c_str());
+      theColoredPrs3dTo->SetEntity(theColoredPrs3dFrom->GetEntity());
+      theColoredPrs3dTo->SetFieldName(theColoredPrs3dFrom->GetCFieldName().c_str());
+      theColoredPrs3dTo->SetTimeStampNumber(theColoredPrs3dFrom->GetTimeStampNumber());
+      theColoredPrs3dTo->SameAs(theColoredPrs3dFrom);
+    }
+
+    TColoredPrs3d*
+    Create(ColoredPrs3d_i* theColoredPrs3d,
+          ColoredPrs3d_i::EPublishInStudyMode thePublishInStudyMode)
+    {
+      TColoredPrs3d* aSameColoredPrs3d = new TColoredPrs3d(thePublishInStudyMode);
+      Copy(aSameColoredPrs3d, theColoredPrs3d);
+      return aSameColoredPrs3d;
+    }
+  };
+
+  //----------------------------------------------------------------------------
+  //! Check is possible to create ColoredPrs3dHolder with the given input
+  size_t
+  CheckIsPossible(VISU::VISUType theType,
+                 const VISU::ColoredPrs3dHolder::BasicInput& theInput,
+                 bool theMemoryCheck);
+    
+  //----------------------------------------------------------------------------
+  //! Check is possible to create ColoredPrs3dHolder with the given input
+  template<unsigned int colored_prs3d_type_enum> 
+  size_t
+  CheckIsPossible(const VISU::ColoredPrs3dHolder::BasicInput& theInput,
+                 bool theMemoryCheck)
+  {
+    VISU::Result_i* aResult = dynamic_cast<VISU::Result_i*>( VISU::GetServant(theInput.myResult).in() );
+    std::string aMeshName = theInput.myMeshName.in();
+    VISU::Entity anEntity = theInput.myEntity;
+    std::string aFieldName = theInput.myFieldName.in();
+    CORBA::Long aTimeStampNumber = theInput.myTimeStampNumber;
+
+    typedef typename VISU::TL::TColoredEnum2Type<colored_prs3d_type_enum>::TResult TColoredPrs3d;
+    return TColoredPrs3d::IsPossible(aResult,
+                                    aMeshName,
+                                    anEntity,
+                                    aFieldName,
+                                    aTimeStampNumber,
+                                    theMemoryCheck);
+  }
+
+  //----------------------------------------------------------------------------
+}
+
+#endif
diff --git a/src/VISU_I/VISU_ColoredPrs3dHolder_i.cc b/src/VISU_I/VISU_ColoredPrs3dHolder_i.cc
new file mode 100644 (file)
index 0000000..cefa3e4
--- /dev/null
@@ -0,0 +1,254 @@
+//  VISU OBJECT : interactive object for VISU entities implementation
+//
+//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+//
+//  File   : VISU_ColoredPrs3dHolder_i.cc
+//  Author : Oleg UVAROV
+//  Module : VISU
+
+#include "VISU_ColoredPrs3dHolder_i.hh"
+
+#include "VISU_ColoredPrs3dCache_i.hh"
+#include "VISU_ColoredPrs3d_i.hh"
+
+#include "SALOME_Event.hxx"
+
+using namespace VISU;
+using namespace std;
+
+#ifdef _DEBUG_
+static int MYDEBUG = 0;
+#else
+static int MYDEBUG = 0;
+#endif
+
+//---------------------------------------------------------------
+int VISU::ColoredPrs3dHolder_i::myNbHolders = 0;
+
+//---------------------------------------------------------------
+QString 
+VISU::ColoredPrs3dHolder_i
+::GenerateName() 
+{ 
+  return VISU::GenerateName("Holder",myNbHolders++);
+}
+
+//----------------------------------------------------------------------------
+const string VISU::ColoredPrs3dHolder_i::myComment = "COLOREDPRS3DHOLDER";
+
+const char* 
+VISU::ColoredPrs3dHolder_i
+::GetComment() const 
+{ 
+  return myComment.c_str();
+}
+
+
+//----------------------------------------------------------------------------
+VISU::ColoredPrs3dHolder_i
+::ColoredPrs3dHolder_i(VISU::ColoredPrs3dCache_i& theCache) :
+  PrsObject_i(theCache.GetStudyDocument()),
+  myCache(theCache)
+{
+  if(MYDEBUG) MESSAGE("ColoredPrs3dHolder_i::ColoredPrs3dHolder_i - this = "<<this);
+}
+
+
+//----------------------------------------------------------------------------
+VISU::ColoredPrs3dHolder_i
+::~ColoredPrs3dHolder_i() 
+{
+  if(MYDEBUG) MESSAGE("ColoredPrs3dHolder_i::~ColoredPrs3dHolder_i - this = "<<this);
+}
+
+
+//----------------------------------------------------------------------------
+void
+VISU::ColoredPrs3dHolder_i
+::PublishInStudy(const std::string& theName, 
+                const std::string& theComment)
+{
+  SetName(theName, false);
+  CORBA::String_var anIOR = GetID();
+  std::string aFatherEntry = myCache.GetEntry();
+  CreateAttributes(GetStudyDocument(), aFatherEntry, "", anIOR.in(), GetName(), "", theComment, true);
+}
+
+//----------------------------------------------------------------------------
+struct TApplyEvent: public SALOME_Event
+{
+  VISU::ColoredPrs3dCache_i& myCache;
+  VISU::ColoredPrs3dHolder_i* myHolder;
+  VISU::ColoredPrs3d_i* myPrs3d;
+  VISU::ColoredPrs3dHolder::BasicInput myInput;
+  VISU::View3D_ptr myView3D;
+
+  typedef CORBA::Boolean TResult;
+  TResult myResult;
+
+  TApplyEvent(VISU::ColoredPrs3dCache_i& theCache,
+             VISU::ColoredPrs3dHolder_i* theHolder,
+             VISU::ColoredPrs3d_i* thePrs3d,
+             VISU::ColoredPrs3dHolder::BasicInput theInput,
+             VISU::View3D_ptr theView3D):
+    myCache(theCache),
+    myHolder(theHolder),
+    myPrs3d(thePrs3d),
+    myInput(theInput),
+    myView3D(theView3D)
+  {}
+
+  virtual
+  void
+  Execute()
+  {
+    myResult = myCache.UpdateLastVisitedPrs(myHolder, myPrs3d, myInput, myView3D);
+  }
+};
+
+//----------------------------------------------------------------------------
+CORBA::Boolean 
+VISU::ColoredPrs3dHolder_i
+::Apply(VISU::ColoredPrs3d_ptr thePrs3d,
+       const VISU::ColoredPrs3dHolder::BasicInput& theInput,
+       VISU::View3D_ptr theView3D)
+{
+
+  VISU::ColoredPrs3d_i* aPrs3d = dynamic_cast<VISU::ColoredPrs3d_i*>( VISU::GetServant(thePrs3d).in() );
+  return ProcessEvent(new TApplyEvent(myCache, this, aPrs3d, theInput, theView3D));
+  //return myCache.UpdateLastVisitedPrs(this, aPrs3d, theInput, theView3D);
+}
+
+//----------------------------------------------------------------------------
+VISU::ColoredPrs3d_i*
+VISU::ColoredPrs3dHolder_i
+::GetPrs3dDevice()
+{
+  return myCache.GetLastVisitedPrs(this);
+}
+
+
+VISU::ColoredPrs3d_ptr
+VISU::ColoredPrs3dHolder_i
+::GetDevice()
+{
+  return GetPrs3dDevice()->_this();
+}
+
+
+//----------------------------------------------------------------------------
+VISU::ColoredPrs3d::TimeStampsRange*
+VISU::ColoredPrs3dHolder_i
+::GetTimeStampsRange()
+{
+  if( VISU::ColoredPrs3d_ptr aDevice = GetDevice() )
+    return aDevice->GetTimeStampsRange();
+
+  return NULL;
+}
+
+
+//----------------------------------------------------------------------------
+VISU::ColoredPrs3dHolder::BasicInput*
+VISU::ColoredPrs3dHolder_i
+::GetBasicInput()
+{
+  if( VISU::ColoredPrs3d_ptr aDevice = GetDevice() )
+  {
+    VISU::ColoredPrs3d_i* aPrs3d = dynamic_cast<VISU::ColoredPrs3d_i*>( VISU::GetServant(aDevice).in() );
+    if( aPrs3d )
+      return aPrs3d->GetBasicInput();
+  }
+
+  return NULL;
+}
+
+
+//----------------------------------------------------------------------------
+VISU::ColoredPrs3dCache_ptr
+VISU::ColoredPrs3dHolder_i
+::GetCache()
+{
+  return myCache._this();
+}
+
+
+//----------------------------------------------------------------------------
+CORBA::Float
+VISU::ColoredPrs3dHolder_i
+::GetMemorySize()
+{
+  // tmp
+  return GetDevice()->GetMemorySize();
+}
+
+
+//----------------------------------------------------------------------------
+VISU::VISUType
+VISU::ColoredPrs3dHolder_i
+::GetPrsType()
+{
+  return GetPrs3dDevice()->GetType();
+}
+
+//----------------------------------------------------------------------------
+void
+VISU::ColoredPrs3dHolder_i
+::RemoveFromStudy() 
+{
+  myCache.RemoveHolder(this);
+  CORBA::String_var anIOR = GetID();
+  SALOMEDS::SObject_var aSObject = GetStudyDocument()->FindObjectIOR(anIOR.in());
+  VISU::RemoveFromStudy(aSObject, false);
+  Destroy();
+}
+
+//----------------------------------------------------------------------------
+void
+VISU::ColoredPrs3dHolder_i
+::ToStream(std::ostringstream& theStr) 
+{
+  Storable::DataToStream( theStr, "myPrsType", GetPrsType() );
+  GetPrs3dDevice()->ToStream(theStr);
+}
+
+//---------------------------------------------------------------
+VISU::Storable*
+VISU::ColoredPrs3dHolder_i
+::Restore(SALOMEDS::SObject_ptr theSObject,
+         const string& thePrefix,
+         const Storable::TRestoringMap& theMap)
+{
+  using namespace VISU;
+  SALOMEDS::Study_var aStudy = theSObject->GetStudy();
+  VISUType aType = VISUType(Storable::FindValue(theMap,"myPrsType").toInt());
+  if(ColoredPrs3d_i* aColoredPrs3d = CreatePrs3d_i(aType, aStudy, ColoredPrs3d_i::EDoNotPublish)){
+    if(ColoredPrs3dCache_i* aCache = ColoredPrs3dCache_i::GetInstance_i(aStudy))
+      if(ColoredPrs3dHolder_i* aHolder = new ColoredPrs3dHolder_i(*aCache)){
+       // To postpone restoring of the device
+       aColoredPrs3d->SaveRestoringState(aStudy, theMap); 
+       CORBA::String_var anEntry = theSObject->GetID();
+       aCache->RegisterInHolder(aColoredPrs3d, anEntry.in());
+       return aHolder;
+      }
+  }
+  return NULL;
+}
diff --git a/src/VISU_I/VISU_ColoredPrs3dHolder_i.hh b/src/VISU_I/VISU_ColoredPrs3dHolder_i.hh
new file mode 100644 (file)
index 0000000..2b6a9c9
--- /dev/null
@@ -0,0 +1,150 @@
+//  VISU OBJECT : interactive object for VISU entities implementation
+//
+//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+//
+//  File   : VISU_ColoredPrs3dHolder_i.hxx
+//  Author : Oleg UVAROV
+//  Module : VISU
+
+#ifndef VISU_ColoredPrs3dHolder_i_HeaderFile
+#define VISU_ColoredPrs3dHolder_i_HeaderFile
+
+#include "VISU_PrsObject_i.hh"
+
+#include "SALOME_GenericObj_i.hh"
+
+namespace VISU
+{
+  class ColoredPrs3d_i;
+  class ColoredPrs3dCache_i;
+
+  /*!
+   * Interface of 3d presentation's holder, which represents colored 3d presentations,
+   * created on fields. It is publishing in the object browser in a separate folder
+   * and can be controled by viewer's slider.
+   */
+  class ColoredPrs3dHolder_i : public virtual POA_VISU::ColoredPrs3dHolder,
+                              public virtual SALOME::GenericObj_i,
+                              public virtual PrsObject_i
+  {
+    ColoredPrs3dHolder_i();
+    ColoredPrs3dHolder_i(const ColoredPrs3dHolder_i&);
+
+    friend class ColoredPrs3dCache_i;
+  public:
+    //----------------------------------------------------------------------------
+    //! A constructor to create an instance of the class
+    explicit
+    ColoredPrs3dHolder_i(VISU::ColoredPrs3dCache_i& theCache);
+
+    virtual
+    ~ColoredPrs3dHolder_i();
+
+    //----------------------------------------------------------------------------
+    //! Apply input parameters to last visited presentation in the cache.
+    virtual
+    CORBA::Boolean 
+    Apply(VISU::ColoredPrs3d_ptr thePrs3d,
+         const VISU::ColoredPrs3dHolder::BasicInput& theInput,
+         VISU::View3D_ptr theView3D);
+
+    //----------------------------------------------------------------------------
+    //! Gets the last visited presentation in the cache.
+    VISU::ColoredPrs3d_i*
+    GetPrs3dDevice();
+
+    //! Gets the last visited presentation in the cache.
+    virtual
+    VISU::ColoredPrs3d_ptr
+    GetDevice();
+
+    //----------------------------------------------------------------------------
+    //! Gets TimeStampsRange information from the last visited presentation.
+    virtual
+    VISU::ColoredPrs3d::TimeStampsRange*
+    GetTimeStampsRange();
+
+    //----------------------------------------------------------------------------
+    //! Gets input parameters of the last visited presentation.
+    VISU::ColoredPrs3dHolder::BasicInput*
+    GetBasicInput();
+
+    //----------------------------------------------------------------------------
+    //! Gets a ColoredPrs3dCache, to which the holder belongs
+    VISU::ColoredPrs3dCache_ptr
+    GetCache();
+
+    //----------------------------------------------------------------------------
+    //! Gets memory size actually used by the holder (Mb).
+    virtual
+    CORBA::Float
+    GetMemorySize();
+
+    //----------------------------------------------------------------------------
+    virtual 
+    VISU::VISUType 
+    GetType() 
+    { 
+      return VISU::TCOLOREDPRS3DHOLDER; 
+    }
+
+    virtual 
+    VISU::VISUType
+    GetPrsType();
+
+    //----------------------------------------------------------------------------
+    virtual
+    void
+    RemoveFromStudy();
+
+    virtual
+    const char*
+    GetComment() const;
+
+    virtual
+    void
+    ToStream(std::ostringstream&);
+
+    static
+    Storable*
+    Restore(SALOMEDS::SObject_ptr theSObject,
+           const std::string& thePrefix,
+           const Storable::TRestoringMap& theMap);
+
+    virtual
+    QString 
+    GenerateName();
+
+  public:
+    static const std::string myComment;
+
+    //----------------------------------------------------------------------------
+  private:
+    void
+    PublishInStudy(const std::string& theName, 
+                  const std::string& theComment);
+
+    VISU::ColoredPrs3dCache_i& myCache;
+    static int myNbHolders;
+  };
+}
+
+#endif
diff --git a/src/VISU_SWIG/visu_cache.py b/src/VISU_SWIG/visu_cache.py
new file mode 100644 (file)
index 0000000..36c61f6
--- /dev/null
@@ -0,0 +1,86 @@
+import os
+import time
+import VISU
+import SALOMEDS
+from batchmode_visu import *
+
+#---------------------------------------------------------------
+def WalkTroughTimeStamps(theVISUType,
+                         theInput,
+                         theViewManager):
+  aView = theViewManager.Create3DView();
+  aView.SetTitle("To test presentation of %s type" % theVISUType)
+
+  aCache = myVisu.GetColoredPrs3dCache(myVisu.GetCurrentStudy())
+  aHolder = aCache.CreateHolder(theVISUType, theInput)
+
+  if not aHolder:
+    print "It is impossible to create such kind of holder (%s) with the given parameters" % theVISUType
+    print "\ttheMeshName = '%s'" % theInput.myMeshName
+    print "\ttheEntity = %s" % theInput.myEntity
+    print "\ttheFieldName = '%s'" % theInput.myFieldName
+    print "\ttheTimeStampNumber = %s" % theInput.myTimeStampNumber
+    return
+
+  aPrs3d = aHolder.GetDevice()
+
+  if not aHolder.Apply(aPrs3d, theInput, aView):
+    print "It is impossible to create such kind of presentation (%s) with the given parameters" % theVISUType
+    print "\ttheMeshName = '%s'" % theInput.myMeshName
+    print "\ttheEntity = %s" % theInput.myEntity
+    print "\ttheFieldName = '%s'" % theInput.myFieldName
+    print "\ttheTimeStampNumber = %s" % theInput.myTimeStampNumber
+    return
+
+  aView.FitAll()
+
+  aDelay = 0.0
+  aRange = aHolder.GetTimeStampsRange()
+  for anInfo in aRange:
+    print "%d (%s); " % (anInfo.myNumber, anInfo.myTime)
+    theInput.myTimeStampNumber = anInfo.myNumber
+    aHolder.Apply(aPrs3d, theInput, aView)
+    time.sleep(aDelay)
+    pass
+  pass
+
+#---------------------------------------------------------------
+PRS3D_TYPE_LIST = []
+PRS3D_TYPE_LIST.append(VISU.TGAUSSPOINTS)
+PRS3D_TYPE_LIST.append(VISU.TSCALARMAP)
+PRS3D_TYPE_LIST.append(VISU.TISOSURFACE)
+PRS3D_TYPE_LIST.append(VISU.TCUTPLANES)
+PRS3D_TYPE_LIST.append(VISU.TCUTLINES)
+PRS3D_TYPE_LIST.append(VISU.TPLOT3D)
+PRS3D_TYPE_LIST.append(VISU.TDEFORMEDSHAPE)
+PRS3D_TYPE_LIST.append(VISU.TVECTORS)
+PRS3D_TYPE_LIST.append(VISU.TSTREAMLINES)
+PRS3D_TYPE_LIST.append(VISU.TSCALARMAPONDEFORMEDSHAPE)
+
+
+#---------------------------------------------------------------
+aMedFile = "TimeStamps.med"
+aMedFile = "ResOK_0000.med"
+aMedFile = os.getenv('DATA_DIR') + '/MedFiles/' + aMedFile
+aResult = myVisu.ImportFile(aMedFile)
+
+aMeshName ="dom"
+anEntity = VISU.NODE
+aFieldName = "vitesse";
+aTimeStampNumber = 1
+
+anInput = VISU.ColoredPrs3dHolder.BasicInput(aResult,aMeshName,anEntity,aFieldName,aTimeStampNumber);
+
+aViewManager = myVisu.GetViewManager();
+
+WalkTroughTimeStamps(VISU.TSCALARMAP, anInput, aViewManager)
+
+for aVISUType in PRS3D_TYPE_LIST:
+  WalkTroughTimeStamps(aVISUType, anInput, aViewManager)
+  pass
+
+anInput.myEntity = VISU.CELL;
+anInput.myFieldName = "pression";
+WalkTroughTimeStamps(VISU.TGAUSSPOINTS, anInput, aViewManager)
+
+#execfile('/data/apo/a.py')
\ No newline at end of file
diff --git a/src/VISU_SWIG/visu_change_input.py b/src/VISU_SWIG/visu_change_input.py
new file mode 100644 (file)
index 0000000..44233a3
--- /dev/null
@@ -0,0 +1,106 @@
+import os
+import time
+import VISU
+import SALOMEDS
+from batchmode_visu import *
+
+#---------------------------------------------------------------
+def GetPrsType2OldFactoryMethod(theVISUType):
+  if theVISUType == VISU.TGAUSSPOINTS:
+    return myVisu.GaussPointsOnField
+  if theVISUType == VISU.TSCALARMAP:
+    return myVisu.ScalarMapOnField
+  if theVISUType == VISU.TISOSURFACE:
+    return myVisu.IsoSurfacesOnField
+  if theVISUType == VISU.TCUTPLANES:
+    return myVisu.CutPlanesOnField
+  if theVISUType == VISU.TCUTLINES:
+    return myVisu.CutLinesOnField
+  if theVISUType == VISU.TPLOT3D:
+    return myVisu.Plot3DOnField
+  if theVISUType == VISU.TDEFORMEDSHAPE:
+    return myVisu.DeformedShapeOnField
+  if theVISUType == VISU.TVECTORS:
+    return myVisu.VectorsOnField
+  if theVISUType == VISU.TSTREAMLINES:
+    return myVisu.StreamLinesOnField
+  if theVISUType == VISU.TSCALARMAPONDEFORMEDSHAPE:
+    return myVisu.ScalarMapOnDeformedShapeOnField
+  return None
+
+
+#---------------------------------------------------------------
+def WalkTroughTimeStamps(theVISUType,
+                         theResult, theMeshName,theEntity, theFieldName, theTimeStampNumber,
+                         theViewManager):
+  anOldFactoryMethod = GetPrsType2OldFactoryMethod(theVISUType)
+  aPrs3d = anOldFactoryMethod(theResult, theMeshName, theEntity, theFieldName, theTimeStampNumber)
+  
+  aPrs3d = myVisu.CreatePrs3d(theVISUType, myVisu.GetCurrentStudy())
+  aPrs3d.SetResultObject(theResult)
+  aPrs3d.SetMeshName(theMeshName)
+  aPrs3d.SetEntity(theEntity)
+  aPrs3d.SetFieldName(theFieldName)
+  aPrs3d.SetTimeStampNumber(theTimeStampNumber)
+  if not aPrs3d.Apply(0):
+    print "It is impossible to create such kind of presentation (%s) with the given parameters" % theVISUType
+    print "\ttheMeshName = '%s'" % theMeshName
+    print "\ttheEntity = %s" % theEntity
+    print "\ttheFieldName = '%s'" % theFieldName
+    print "\ttheTimeStampNumber = %s" % theTimeStampNumber
+    return
+
+  aView = theViewManager.Create3DView();
+  aView.SetTitle("To test presentation of %s type" % theVISUType)
+  aView.Display(aPrs3d);
+  aView.FitAll()
+
+  aDelay = 0.0
+  aRange = aPrs3d.GetTimeStampsRange()
+  for anInfo in aRange:
+    print "%d (%s); " % (anInfo.myNumber, anInfo.myTime)
+    aPrs3d.SetTimeStampNumber(anInfo.myNumber)
+    aPrs3d.Apply(0)
+    aView.Update();
+    time.sleep(aDelay)
+    pass
+  pass
+
+
+#---------------------------------------------------------------
+PRS3D_TYPE_LIST = []
+PRS3D_TYPE_LIST.append(VISU.TGAUSSPOINTS)
+PRS3D_TYPE_LIST.append(VISU.TSCALARMAP)
+PRS3D_TYPE_LIST.append(VISU.TISOSURFACE)
+PRS3D_TYPE_LIST.append(VISU.TCUTPLANES)
+PRS3D_TYPE_LIST.append(VISU.TCUTLINES)
+PRS3D_TYPE_LIST.append(VISU.TPLOT3D)
+PRS3D_TYPE_LIST.append(VISU.TDEFORMEDSHAPE)
+PRS3D_TYPE_LIST.append(VISU.TVECTORS)
+PRS3D_TYPE_LIST.append(VISU.TSTREAMLINES)
+PRS3D_TYPE_LIST.append(VISU.TSCALARMAPONDEFORMEDSHAPE)
+
+
+#---------------------------------------------------------------
+aMedFile = "TimeStamps.med"
+aMedFile = "ResOK_0000.med"
+aMedFile = os.getenv('DATA_DIR') + '/MedFiles/' + aMedFile
+aResult = myVisu.ImportFile(aMedFile)
+
+aMeshName ="dom"
+anEntity = VISU.NODE
+aFieldName = "vitesse";
+aTimeStampNumber = 1
+
+aViewManager = myVisu.GetViewManager();
+
+WalkTroughTimeStamps(VISU.TSCALARMAPONDEFORMEDSHAPE, aResult, aMeshName, anEntity, aFieldName, aTimeStampNumber, aViewManager)
+
+for aVISUType in PRS3D_TYPE_LIST:
+  WalkTroughTimeStamps(aVISUType, aResult, aMeshName, anEntity, aFieldName, aTimeStampNumber, aViewManager)
+  pass
+
+anEntity = VISU.CELL
+aFieldName = "pression";
+
+WalkTroughTimeStamps(VISU.TGAUSSPOINTS, aResult, aMeshName, anEntity, aFieldName, aTimeStampNumber, aViewManager)