]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
Start improvement NPAL16840 : EDF PAL 569 (Cut plane on Deformed).
authorrnv <rnv@opencascade.com>
Wed, 4 Jun 2008 12:55:28 +0000 (12:55 +0000)
committerrnv <rnv@opencascade.com>
Wed, 4 Jun 2008 12:55:28 +0000 (12:55 +0000)
23 files changed:
idl/VISU_Gen.idl
src/CONVERTOR/VISU_MergeFilterUtilities.cxx
src/PIPELINE/Makefile.am
src/PIPELINE/VISU_CutLinesPL.cxx
src/PIPELINE/VISU_CutLinesPL.hxx
src/PIPELINE/VISU_CutPlanesPL.cxx
src/PIPELINE/VISU_CutPlanesPL.hxx
src/PIPELINE/VISU_DeformationPL.cxx [new file with mode: 0755]
src/PIPELINE/VISU_DeformationPL.hxx [new file with mode: 0755]
src/PIPELINE/VISU_OptionalDeformationPL.cxx [new file with mode: 0755]
src/PIPELINE/VISU_OptionalDeformationPL.hxx [new file with mode: 0755]
src/VISUGUI/VISU_msg_en.po
src/VISUGUI/VisuGUI_CutPlanesDlg.cxx
src/VISUGUI/VisuGUI_CutPlanesDlg.h
src/VISU_I/Makefile.am
src/VISU_I/VISU_CutPlanes_i.cc
src/VISU_I/VISU_CutPlanes_i.hh
src/VISU_I/VISU_Deformation_i.cc [new file with mode: 0755]
src/VISU_I/VISU_Deformation_i.hh [new file with mode: 0755]
src/VISU_I/VISU_DumpPython.cc
src/VISU_I/VISU_OptionalDeformation_i.cc [new file with mode: 0755]
src/VISU_I/VISU_OptionalDeformation_i.hh [new file with mode: 0755]
src/VISU_I/VISU_Result_i.cc

index 783375886784b4209d055c170249364dc4ba6685..7d502135bb08a27196112092ec26c7861ef4c550 100644 (file)
@@ -874,6 +874,61 @@ module VISU {
 
   };
 
+  //-------------------------------------------------------
+  /*! \brief Deformation interface
+   *
+   * This is base interface for building of the deformed presentations
+   */
+  interface Deformation{
+    /*!
+     * Sets the scale of the presentatable object.
+     * \param theScale Double value defining the scale of this presentable object.
+     */
+    void SetScale(in double theScale);
+
+    /*!
+     * Gets the scale of the presentatable object.
+     */
+    double GetScale();
+
+    /*!
+     * Sets the vectorial field
+     * \param theEntity    - entity of vectorial field
+     * \param theFieldName - the name of vectorial field
+     */
+    void SetVectorialField(in Entity theEntity,
+                          in string theFieldName);
+
+    /*!
+     * Get vectorial entity
+     */
+    Entity GetVectorialFieldEntity();
+
+    /*!
+     * Get scalar field name
+     */
+    string GetVectorialFieldName();
+    
+  };
+
+  //-------------------------------------------------------
+  /*! \brief OptionalDeformation interface
+   *
+   * This is interface for switch on/off of the deformation of the presentation
+   */
+  interface OptionalDeformation : Deformation{
+
+    /*!
+     * Sets the deformation flag of the presentatable object.
+     * \param theFlag Boolean value defining the deformation flag of this presentable object.
+     */
+    void UseDeformation(in boolean theFlag);
+
+    /*!
+     * Gets the deformation flag of the presentatable object.
+     */
+    boolean IsDeformed();
+  };
 
   //-------------------------------------------------------
   /*! \brief Scalar Map on Deformed shape presentation interface
@@ -1090,7 +1145,7 @@ module VISU {
    * consists of cutting your initial mesh by a definite number of planes. As the
    * result you will see these planes which will be cutted by the borders of the mesh.
    */
-  interface CutPlanes : ScalarMap {
+  interface CutPlanes : ScalarMap, OptionalDeformation {
     /*!
      * This enumeration contains a set of elements defining the type of orientation in 3D space
      * of the cut planes.
index 488463696a9adf42b87fd34be88e554c3e2f9f19..2d1eafc2f40da645af9d05b03c51a61cafddfa34 100644 (file)
@@ -81,6 +81,9 @@ namespace
       vtkCellData *anOutputCellData = theOutput->GetCellData();
       anOutputCellData->CopyAllocate(aCellData);
 
+      if(theVectorsDataSet && theVectorsDataSet != theScalarsDataSet)
+        anOutputCellData->CopyVectorsOff();
+
       vtkIdType aNbTuples = anIntersection.size();
       theOutput->Allocate(aNbTuples);
       vtkIdList *aCellIds = vtkIdList::New();
@@ -100,13 +103,68 @@ namespace
       aCellIds->Delete();
 
       theOutput->SetPoints(theInput->GetPoints());
+      
     }else{
       theOutput->CopyStructure(theInput);
       theOutput->GetCellData()->ShallowCopy(theScalarsDataSet->GetCellData());
     }
     theOutput->GetPointData()->ShallowCopy(theInput->GetPointData());
+    
+    //If need, copy vectors data.
+    if(theVectorsDataSet && theVectorsDataSet != theScalarsDataSet){
+      bool isVectorsOnCells = theVectorsDataSet->GetCellData()->GetVectors() != NULL;
+      bool isVectorsDataOnPoints = theVectorsDataSet->GetPointData()->GetVectors() != NULL;
+      if(isVectorsOnCells) {
+        CopyVectorsOnCells(theVectorsDataSet,theOutput);
+      }
+      else if(isVectorsDataOnPoints){
+        CopyVectorsOnPoints(theVectorsDataSet,theOutput);
+      }
+    }
   }
   
+  void CopyVectorsOnCells(vtkDataSet *theVectorsDataSet,
+                          vtkDataSet *theOutput)
+  {
+    vtkDataArray *anInputVectors = theVectorsDataSet->GetCellData()->GetVectors();
+    vtkDataArray *anOutputVectors = vtkDataArray::CreateDataArray(anInputVectors->GetDataType());
+    
+    //Clear output vector data
+    theOutput->GetCellData()->SetVectors(NULL);
+    
+    //Copy vectors data
+    vtkIntArray* anOutputIDMapper = GetIDMapper(theOutput,
+                                                TGetCellData(),
+                                                "VISU_CELLS_MAPPER");
+    
+    vtkIntArray* anInputIDMapper = GetIDMapper(theVectorsDataSet,
+                                               TGetCellData(),
+                                               "VISU_CELLS_MAPPER");
+    
+    TObjectIdArray anIntersection;
+    GetIntersection(anOutputIDMapper,
+                    anInputIDMapper,
+                    anIntersection);
+
+    vtkIdType aNbTuples = anIntersection.size();
+    anOutputVectors->SetNumberOfComponents(anInputVectors->GetNumberOfComponents());
+    anOutputVectors->SetNumberOfTuples(aNbTuples);
+    theOutput->GetCellData()->SetVectors(anOutputVectors);
+    anOutputVectors->Delete();
+    
+    TObjectId2TupleIdMap anOutputObjectId2TupleIdMap;
+    GetObjectId2TupleIdMap(anOutputIDMapper, anOutputObjectId2TupleIdMap);
+    
+    TObjectId2TupleIdMap anInputObjectId2TupleIdMap;
+    GetObjectId2TupleIdMap(anInputIDMapper, anInputObjectId2TupleIdMap);
+
+    for(vtkIdType iTupleId = 0; iTupleId < aNbTuples; iTupleId++ ){
+      TObjectId &anObjectId = anIntersection[iTupleId];
+      vtkIdType anOutputCellId  = anOutputObjectId2TupleIdMap[anObjectId];
+      vtkIdType anInputCellId = anInputObjectId2TupleIdMap[anObjectId];
+      anOutputVectors->SetTuple(anOutputCellId,anInputVectors->GetTuple(anInputCellId));
+    }
+  }
   
   //---------------------------------------------------------------
   template<class TDataSet>
@@ -200,7 +258,118 @@ namespace
       theOutput->GetCellData()->ShallowCopy(theInput->GetCellData());
     }
     theOutput->GetPointData()->ShallowCopy(theScalarsDataSet->GetPointData());
+    
+    //If need, copy vectors data.
+    if(theVectorsDataSet && theVectorsDataSet != theScalarsDataSet){
+      bool isVectorsOnCells = theVectorsDataSet->GetCellData()->GetVectors() != NULL;
+      bool isVectorsDataOnPoints = theVectorsDataSet->GetPointData()->GetVectors() != NULL;
+
+      //Merge cells if need
+      //rnv
+      if(!IsDifferent(theGeometryPointMapper, theDataPointMapper)){
+        vtkIntArray* theGeometryCellMapper = GetIDMapper(theVectorsDataSet,
+                                                         TGetCellData(),
+                                                         "VISU_CELLS_MAPPER");
+        
+        vtkIntArray* theDataCellMapper = GetIDMapper(theScalarsDataSet,
+                                                     TGetCellData(),
+                                                     "VISU_CELLS_MAPPER");
+        
+          
+        if(IsDifferent(theGeometryCellMapper, theDataCellMapper)){
+          TObjectIdArray anIntersection;
+          
+          GetIntersection(theGeometryCellMapper,
+                          theDataCellMapper,
+                          anIntersection);
+    
+          TObjectId2TupleIdMap aGeomObjectId2TupleIdMap;
+          GetObjectId2TupleIdMap(theGeometryCellMapper, aGeomObjectId2TupleIdMap);
+      
+          TObjectId2TupleIdMap aDataObjectId2TupleIdMap;
+          GetObjectId2TupleIdMap(theDataCellMapper, aDataObjectId2TupleIdMap);
+      
+          vtkCellData *aCellData = theScalarsDataSet->GetCellData();
+          vtkCellData *anOutputCellData = theOutput->GetCellData();
+          anOutputCellData->CopyAllocate(aCellData);
+
+          vtkIdType aNbTuples = anIntersection.size();
+          theOutput->Allocate(aNbTuples);
+          vtkIdList *aCellIds = vtkIdList::New();
+          for(int aTupleId = 0; aTupleId < aNbTuples; aTupleId++){
+            TObjectId& anObjectId = anIntersection[aTupleId];
+            vtkIdType aCellId = aGeomObjectId2TupleIdMap[anObjectId];
+            vtkCell *aCell = theInput->GetCell(aCellId);
+            aCellIds->Reset();
+            vtkIdType aNbPointIds = aCell->PointIds->GetNumberOfIds();
+            for(vtkIdType anId = 0; anId < aNbPointIds; anId++)
+              aCellIds->InsertNextId(aCell->GetPointIds()->GetId(anId));
+            vtkIdType aCellType = theInput->GetCellType(aCellId);
+            vtkIdType aNewCellId = theOutput->InsertNextCell(aCellType, aCellIds);
+            vtkIdType aDataCellId = aDataObjectId2TupleIdMap[anObjectId];
+            anOutputCellData->CopyData(aCellData, aDataCellId, aNewCellId);
+          }
+          aCellIds->Delete();
+          
+        }
+      }
+        
+      if(isVectorsOnCells) {
+        CopyVectorsOnCells(theVectorsDataSet,theOutput);
+      }
+      else if(isVectorsDataOnPoints){
+        CopyVectorsOnPoints(theVectorsDataSet,theOutput);
+      }
+    }
   }
+  
+  void CopyVectorsOnPoints(vtkDataSet *theVectorsDataSet,
+                          vtkDataSet *theOutput)
+  {
+    vtkDataArray *anInputVectors = theVectorsDataSet->GetPointData()->GetVectors();
+    
+    //Clear output vector data
+    theOutput->GetPointData()->SetVectors(NULL);
+    
+    vtkDataArray *anOutputVectors = vtkDataArray::CreateDataArray(anInputVectors->GetDataType());
+    
+    //Copy vectors data
+    vtkIntArray* anOutputIDMapper = GetIDMapper(theOutput,
+                                                TGetPointData(),
+                                                "VISU_POINTS_MAPPER");
+    
+    vtkIntArray* anInputIDMapper = GetIDMapper(theVectorsDataSet,
+                                               TGetPointData(),
+                                               "VISU_POINTS_MAPPER");
+    TObjectIdArray anIntersection;
+
+    GetIntersection(anOutputIDMapper,
+                    anInputIDMapper,
+                    anIntersection);
+    
+    vtkIdType aNbTuples = anIntersection.size();  
+    anOutputVectors->SetNumberOfComponents(anInputVectors->GetNumberOfComponents());
+    anOutputVectors->SetNumberOfTuples(aNbTuples);
+    
+    
+
+    TObjectId2TupleIdMap anOutputObjectId2TupleIdMap;
+    GetObjectId2TupleIdMap(anOutputIDMapper, anOutputObjectId2TupleIdMap);
+    
+    TObjectId2TupleIdMap anInputObjectId2TupleIdMap;
+    GetObjectId2TupleIdMap(anInputIDMapper, anInputObjectId2TupleIdMap);
+    
+    for(vtkIdType iTupleId = 0; iTupleId < aNbTuples; iTupleId++ ){
+      TObjectId& anObjectId = anIntersection[iTupleId];
+      vtkIdType anOutputPointId  = anOutputObjectId2TupleIdMap[anObjectId];
+      vtkIdType anInputPointId = anInputObjectId2TupleIdMap[anObjectId];
+      anOutputVectors->SetTuple(anOutputPointId,anInputVectors->GetTuple(anInputPointId));
+    }
+    
+    theOutput->GetPointData()->SetVectors(anOutputVectors);
+    anOutputVectors->Delete();
+  }
+  
 
   //---------------------------------------------------------------
   typedef vtkDataArray* (vtkDataSetAttributes::* TGetAttribute)();
index 82bc4155629ec519701c0c66c83cc9a2876f10ce..36c51a7082eca18ca999c45d5659d9b7f39e6ddb 100644 (file)
@@ -65,7 +65,9 @@ salomeinclude_HEADERS= \
        VISU_WidgetCtrl.hxx \
        VISU_DeformedShapeAndScalarMapPL.hxx \
        VISUPipeline.hxx \
-       VISU_LabelPointsFilter.hxx
+       VISU_LabelPointsFilter.hxx \
+       VISU_DeformationPL.hxx \
+       VISU_OptionalDeformationPL.hxx 
 
 dist_libVisuPipeLine_la_SOURCES= \
        VISU_MapperHolder.cxx \
@@ -103,7 +105,9 @@ dist_libVisuPipeLine_la_SOURCES= \
        VISU_WidgetCtrl.cxx \
        VISU_ScalarBarCtrl.cxx \
        VISU_DeformedShapeAndScalarMapPL.cxx \
-       VISU_LabelPointsFilter.cxx
+       VISU_LabelPointsFilter.cxx \
+       VISU_DeformationPL.cxx \
+       VISU_OptionalDeformationPL.cxx 
 
 libVisuPipeLine_la_CPPFLAGS= \
        $(VTK_INCLUDES) \
index 3bad32d187df31620c822023e025f48bab754d2a..dbd2243a9d6c187fcc665eccde8f4a881e5857d5 100644 (file)
@@ -100,6 +100,12 @@ VISU_CutLinesPL
   Modified();
 }
 
+vtkDataSet* 
+VISU_CutLinesPL
+::InsertCustomPL()
+{
+  return myAppendPolyData->GetOutput();
+}
 
 //----------------------------------------------------------------------------
 vtkFloatingPointType 
index 5811683414924df07c684056fe9484f6c03008cf..7ed0ecd83e5234791c692935f096c9d801a0a267 100644 (file)
@@ -64,6 +64,9 @@ public:
   void
   Init();
 
+  vtkDataSet*
+  InsertCustomPL();
+
   virtual
   void
   Update();
index 22493a104f8b33e3ceb508f0d4579ff7479ce4af..796e3f4e6c84c7ba7ea7c9a3070511271b2cfd44 100644 (file)
 #include "VISU_FieldTransform.hxx"
 #include "VISU_PipeLineUtils.hxx"
 #include "VTKViewer_GeometryFilter.h"
+#include "VISU_MapperHolder.hxx"
+#include "VISU_DeformationPL.hxx"
 
 #include <vtkAppendPolyData.h>
 #include <vtkCutter.h>
 #include <vtkPlane.h>
 
+//#include <vtkUnstructuredGrid.h>
+
 static vtkFloatingPointType EPS = 1.0E-3;
 
+#ifdef _DEBUG_
+static int MYDEBUG = 0;
+#else
+static int MYDEBUG = 0;
+#endif
+
 
 //----------------------------------------------------------------------------
 vtkStandardNewMacro(VISU_CutPlanesPL);
@@ -43,7 +53,8 @@ vtkStandardNewMacro(VISU_CutPlanesPL);
 
 //----------------------------------------------------------------------------
 VISU_CutPlanesPL
-::VISU_CutPlanesPL()
+::VISU_CutPlanesPL():
+  VISU_OptionalDeformationPL()
 {
   SetIsShrinkable(false);
 
@@ -58,6 +69,7 @@ VISU_CutPlanesPL
 
   myAng[0][0] = myAng[0][1] = myAng[0][2] = 0.0;
   myAng[1][0] = myAng[1][1] = myAng[1][2] = 0.0;
+  UseDeformation(false);
 }
 
 
@@ -76,7 +88,11 @@ VISU_CutPlanesPL
 ::GetMTime()
 {
   unsigned long int aTime = Superclass::GetMTime();
-
+  
+  if(IsDeformed()) {
+    aTime = std::max(aTime, VISU_OptionalDeformationPL::GetMTime());
+  }
+  
   aTime = std::max(aTime, myAppendPolyData->GetMTime());
 
   return aTime;
@@ -113,11 +129,11 @@ VISU_CutPlanesPL
 ::Init()
 {
   Superclass::Init();
-
   SetNbParts(10);
   myBasePlane[0] = YZ;
   myDisplacement[0] = 0.5;
   myAng[0][0] = myAng[0][1] = myAng[0][2] = 0.0;
+  SetScale(VISU_DeformationPL::GetDefaultScaleFactor(this));
 }
 
 
@@ -126,7 +142,7 @@ vtkDataSet*
 VISU_CutPlanesPL
 ::InsertCustomPL()
 {
-  return myAppendPolyData->GetOutput();
+  return GetWarpVectorOutput();
 }
 
 
@@ -137,18 +153,30 @@ VISU_CutPlanesPL
 {
   ClearAppendPolyData(myAppendPolyData);
 
-  SetPartPosition();
 
+  if(!myVectorialField || !IsDeformed()){
+    SetMergeFilterInput(GetMergedInput(),GetMergedInput());
+  }
+  
+
+  if(VISU::IsDataOnCells(GetMergedInput()))
+    GetMapper()->SetScalarModeToUseCellData();
+  else
+    GetMapper()->SetScalarModeToUsePointData();
+
+  SetPartPosition();
+  
   vtkFloatingPointType aDir[3];
   GetDir(aDir, 
         myAng[0], 
         myBasePlane[0]);
-
+  
   vtkFloatingPointType aBounds[6];
-  GetMergedInput()->GetBounds(aBounds);
+
+  GetMergeFilterOutput()->GetBounds(aBounds);
 
   CutWithPlanes(myAppendPolyData,
-               GetMergedInput(),
+               GetMergeFilterOutput(),
                myNbParts,
                aDir,
                aBounds,
@@ -156,6 +184,9 @@ VISU_CutPlanesPL
                myPartCondition, 
                myDisplacement[0]);
 
+  
+
+  SetWarpVectorInput(myAppendPolyData->GetOutput());
   Superclass::Update();
 }
 
@@ -412,7 +443,11 @@ VISU_CutPlanesPL
   vtkFloatingPointType aPosition = myPartPosition[thePartNumber];
   if(myPartCondition[thePartNumber]){
       vtkFloatingPointType aDir[3], aBounds[6], aBoundPrj[3];
-      GetMergedInput()->GetBounds(aBounds);
+      if(!IsDeformed()) 
+        GetMergedInput()->GetBounds(aBounds);
+      else
+        GetMergeFilterOutput()->GetBounds(aBounds);
+
 
       GetDir(aDir,
             myAng[theNum],
@@ -564,3 +599,26 @@ VISU_CutPlanesPL
 
 
 //----------------------------------------------------------------------------
+
+void
+VISU_CutPlanesPL::SetVectorialField(VISU::PUnstructuredGridIDMapper theMapper)
+{  
+  if(myVectorialField == theMapper)
+    return;
+
+  if(CheckCanDeformate(theMapper->GetOutput())){
+    myVectorialField = theMapper;
+    
+    SetMergeFilterInput(GetMergedInput(),theMapper->GetOutput());
+  }
+  else
+    UseDeformation(false);
+  
+  Modified();
+}
+
+VISU::PUnstructuredGridIDMapper VISU_CutPlanesPL::
+getVectorialField()
+{
+  return myVectorialField;
+}
index 27d377fd8971d3ecac67413a3a3f132c601d419f..2e7845750cca8017d2f1142a92c1443a77879863 100644 (file)
@@ -29,6 +29,8 @@
 
 #include "VISUPipeline.hxx"
 #include "VISU_ScalarMapPL.hxx"
+#include "VISU_OptionalDeformationPL.hxx"
+#include "VISU_MapperHolder.hxx"
 
 #include <vector>
 
@@ -36,7 +38,8 @@ class vtkAppendPolyData;
 
 
 //----------------------------------------------------------------------------
-class VISU_PIPELINE_EXPORT VISU_CutPlanesPL : public VISU_ScalarMapPL
+class VISU_PIPELINE_EXPORT VISU_CutPlanesPL : public VISU_ScalarMapPL,
+                                              public VISU_OptionalDeformationPL
 {
 public:
   vtkTypeMacro(VISU_CutPlanesPL, VISU_ScalarMapPL);
@@ -182,6 +185,9 @@ public:
                const std::vector<int>& thePlaneCondition,
                vtkFloatingPointType theDisplacement);
 
+  virtual void SetVectorialField(VISU::PUnstructuredGridIDMapper);
+  VISU::PUnstructuredGridIDMapper getVectorialField();
+
 protected:
   VISU_CutPlanesPL();
 
diff --git a/src/PIPELINE/VISU_DeformationPL.cxx b/src/PIPELINE/VISU_DeformationPL.cxx
new file mode 100755 (executable)
index 0000000..d222fd4
--- /dev/null
@@ -0,0 +1,163 @@
+//  Copyright (C) 2008  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_ScalarMapPL.cxx
+// Author:  Roman NIKOLAEV
+// Module : VISU
+
+//Salome includes
+#include "VISU_DeformationPL.hxx"
+#include "VISU_MergeFilter.hxx"
+
+//VTK includes
+#include <vtkDataSet.h>
+#include <vtkPassThroughFilter.h>
+#include <vtkWarpVector.h>
+#include <vtkCellDataToPointData.h>
+#include <vtkUnstructuredGrid.h>
+
+
+//----------------------------------------------------------------------------
+VISU_DeformationPL::VISU_DeformationPL()
+{
+  myWarpVector = vtkWarpVector::New();
+  myWarpVector->SetScaleFactor(0.0);
+  
+  myVectorMergeFilter = VISU_MergeFilter::New();
+  myVectorMergeFilter->SetMergingInputs(true);
+  myInputPassFilter = vtkPassThroughFilter::New();
+  myOutputPassFiler = vtkPassThroughFilter::New();
+  myCellDataToPointData = vtkCellDataToPointData::New();
+  myCellDataToPointData->PassCellDataOn();
+
+  myInputPassFilter->SetInput(vtkUnstructuredGrid::New());
+
+  myCellDataToPointData->SetInput(myInputPassFilter->GetOutput());
+
+  myWarpVector->SetInput(myCellDataToPointData->GetOutput());
+  
+  myOutputPassFiler->SetInput(myWarpVector->GetOutput());
+}
+
+//----------------------------------------------------------------------------
+VISU_DeformationPL::~VISU_DeformationPL()
+{
+  myWarpVector->Delete();
+  myVectorMergeFilter->Delete();
+  myInputPassFilter->Delete();
+  myOutputPassFiler->Delete();
+  myCellDataToPointData->Delete();
+}
+
+
+//----------------------------------------------------------------------------
+unsigned long int 
+VISU_DeformationPL::GetMTime(){
+  unsigned long int aTime = std::max(myWarpVector->GetMTime(), 
+                                     myVectorMergeFilter->GetMTime());
+
+  aTime = std::max(aTime,myInputPassFilter->GetMTime());
+  aTime = std::max(aTime,myOutputPassFiler->GetMTime());
+  aTime = std::max(aTime,myCellDataToPointData->GetMTime());
+}
+
+//----------------------------------------------------------------------------
+void VISU_DeformationPL::SetScale(vtkFloatingPointType theScaleFactor)
+{
+  myWarpVector->SetScaleFactor(theScaleFactor);
+}
+
+vtkFloatingPointType VISU_DeformationPL::GetScale()
+{
+  return myWarpVector->GetScaleFactor();
+}
+
+//----------------------------------------------------------------------------
+void VISU_DeformationPL::SetWarpVectorInput(vtkDataSet *theInput)
+{
+  myInputPassFilter->SetInput(theInput);
+}
+
+//----------------------------------------------------------------------------
+vtkDataSet* VISU_DeformationPL::GetWarpVectorOutput()
+{
+  return myOutputPassFiler->GetOutput();
+}
+
+//----------------------------------------------------------------------------
+void VISU_DeformationPL::SetMergeFilterInput(vtkDataSet* ScalarInput,
+                         vtkDataSet* VectorialInput)
+{
+  myVectorMergeFilter->SetScalars(ScalarInput);
+  myVectorMergeFilter->AddField("VISU_CELLS_MAPPER",ScalarInput);
+  myVectorMergeFilter->AddField("VISU_POINTS_MAPPER",ScalarInput);
+  
+  myVectorMergeFilter->SetGeometry(VectorialInput);
+  myVectorMergeFilter->SetVectors(VectorialInput);
+}
+
+//----------------------------------------------------------------------------
+vtkDataSet* VISU_DeformationPL::GetMergeFilterOutput(){
+ return myVectorMergeFilter->GetOutput();
+}
+
+//----------------------------------------------------------------------------
+vtkFloatingPointType VISU_DeformationPL::GetDefaultScaleFactor(VISU_DeformationPL *thePipeLine)
+{
+  if(!thePipeLine || !thePipeLine->GetMergeFilterOutput())
+    return 0.0;
+  
+  vtkFloatingPointType aSourceRange[2];
+  thePipeLine->GetMergeFilterOutput()->GetScalarRange(aSourceRange);
+  
+  static vtkFloatingPointType EPS = 1.0 / VTK_LARGE_FLOAT;
+  if(fabs(aSourceRange[1]) > EPS){
+    vtkDataSet* aDataSet = thePipeLine->GetMergeFilterOutput();
+    vtkFloatingPointType aScaleFactor = VISU_DeformationPL::ComputeScaleFactor(aDataSet);
+    return aScaleFactor / aSourceRange[1];
+  }
+  return 0.0;
+}
+
+//----------------------------------------------------------------------------
+vtkFloatingPointType VISU_DeformationPL::ComputeScaleFactor(vtkDataSet* theDataSet)
+{
+  if(!theDataSet)
+    return 0.0;
+
+  theDataSet->Update();
+  
+  int aNbCells = theDataSet->GetNumberOfCells();
+  int aNbPoints = theDataSet->GetNumberOfPoints();
+  int aNbElem = aNbCells? aNbCells: aNbPoints;
+  
+  vtkFloatingPointType* aBounds = theDataSet->GetBounds();
+  vtkFloatingPointType aVolume = 1, aVol, idim = 0;
+  for(int i = 0; i < 6; i += 2){
+    aVol = fabs(aBounds[i+1] - aBounds[i]);
+    if(aVol > 0) {
+      idim++;
+      aVolume *= aVol;
+    }
+  }
+  aVolume /= aNbElem;
+  return pow(aVolume, vtkFloatingPointType(1.0/idim));
+}
diff --git a/src/PIPELINE/VISU_DeformationPL.hxx b/src/PIPELINE/VISU_DeformationPL.hxx
new file mode 100755 (executable)
index 0000000..2521ec8
--- /dev/null
@@ -0,0 +1,83 @@
+//  Copyright (C) 2008  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_DeformationPL.hxx
+//  Author : 
+//  Module : SALOME
+
+#ifndef VISU_DeformationPL_HeaderFile
+#define VISU_DeformationPL_HeaderFile
+
+#include "VISUPipeline.hxx"
+#include "VISU_MapperHolder.hxx"
+#include <vtkSmartPointer.h>
+
+class vtkDataSet;
+class VISU_MergeFilter;
+class vtkPassThroughFilter;
+class vtkWarpVector;
+class vtkCellDataToPointData;
+
+class VISU_PIPELINE_EXPORT VISU_DeformationPL {
+  
+public:
+  VISU_DeformationPL();
+  virtual ~VISU_DeformationPL();
+
+  //-----------------------------------------------------------
+  virtual void SetScale(vtkFloatingPointType theScaleFactor);
+  virtual vtkFloatingPointType GetScale();
+
+  //-----------------------------------------------------------
+  virtual void SetVectorialField(VISU::PUnstructuredGridIDMapper theIdMapper) = 0;
+  virtual VISU::PUnstructuredGridIDMapper getVectorialField() = 0;
+
+
+  //-----------------------------------------------------------
+  virtual 
+  unsigned 
+  long int
+  GetMTime();
+
+  static vtkFloatingPointType GetDefaultScaleFactor(VISU_DeformationPL *thePipeLine);
+  static vtkFloatingPointType ComputeScaleFactor(vtkDataSet* theDataSet);
+
+  void SetWarpVectorInput(vtkDataSet *theInput);
+  vtkDataSet* GetWarpVectorOutput();
+
+  //-----------------------------------------------------------
+  void SetMergeFilterInput(vtkDataSet* ScalarInput,
+                           vtkDataSet* VectorialInput);
+
+  vtkDataSet* GetMergeFilterOutput();
+
+protected:
+
+  VISU::PUnstructuredGridIDMapper myVectorialField;
+  vtkWarpVector *myWarpVector;
+  vtkSmartPointer<VISU_MergeFilter> myVectorMergeFilter;
+  vtkPassThroughFilter *myInputPassFilter;
+  vtkPassThroughFilter *myOutputPassFiler;
+  vtkCellDataToPointData *myCellDataToPointData;
+
+};
+
+#endif
diff --git a/src/PIPELINE/VISU_OptionalDeformationPL.cxx b/src/PIPELINE/VISU_OptionalDeformationPL.cxx
new file mode 100755 (executable)
index 0000000..63f54df
--- /dev/null
@@ -0,0 +1,93 @@
+//  Copyright (C) 2008  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_ScalarMapPL.cxx
+// Author:  Roman NIKOLAEV
+// Module : VISU
+
+//Salome includes
+#include "VISU_OptionalDeformationPL.hxx"
+#include "VISU_PipeLineUtils.hxx"
+
+//VTK includes
+#include <vtkDataSet.h>
+#include <vtkPassThroughFilter.h>
+#include <vtkWarpVector.h>
+#include <vtkCellDataToPointData.h>
+
+//----------------------------------------------------------------------------
+VISU_OptionalDeformationPL::VISU_OptionalDeformationPL():
+  VISU_DeformationPL(),
+  myIsDeformed(true)
+{}
+
+//----------------------------------------------------------------------------
+VISU_OptionalDeformationPL::~VISU_OptionalDeformationPL(){
+
+}
+
+//----------------------------------------------------------------------------
+unsigned long int
+VISU_OptionalDeformationPL::GetMTime(){
+  return Superclass::GetMTime();
+}
+
+//----------------------------------------------------------------------------
+void VISU_OptionalDeformationPL::UseDeformation(bool flag){
+  if(myIsDeformed == flag)
+    return;
+
+  myIsDeformed = flag;
+  if(myIsDeformed)
+    OnDeformation();
+  else
+    OffDeformation();
+}
+
+//----------------------------------------------------------------------------
+bool VISU_OptionalDeformationPL::IsDeformed(){
+  return myIsDeformed;
+}
+
+//----------------------------------------------------------------------------
+void VISU_OptionalDeformationPL::OnDeformation(){
+
+  myCellDataToPointData->SetInput(myInputPassFilter->GetOutput());
+  myWarpVector->SetInput(myCellDataToPointData->GetOutput());
+  myOutputPassFiler->SetInput(myWarpVector->GetOutput());
+}
+
+//----------------------------------------------------------------------------
+void VISU_OptionalDeformationPL::OffDeformation(){
+  myOutputPassFiler->SetInput(myInputPassFilter->GetOutput());
+}
+
+
+
+bool VISU_OptionalDeformationPL::CheckCanDeformate(vtkDataSet* theInput){
+  if(theInput) {
+    if(VISU::IsDataOnCells(theInput))
+      return theInput->GetCellData()->GetVectors() != NULL;
+    else if(VISU::IsDataOnPoints(theInput))
+      return theInput->GetPointData()->GetVectors() != NULL;
+  }
+  return false;
+}
diff --git a/src/PIPELINE/VISU_OptionalDeformationPL.hxx b/src/PIPELINE/VISU_OptionalDeformationPL.hxx
new file mode 100755 (executable)
index 0000000..333da0c
--- /dev/null
@@ -0,0 +1,59 @@
+//  Copyright (C) 2008  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_OptionalDeformationPL.hxx
+//  Author : 
+//  Module : SALOME
+
+#ifndef VISU_OptionalDeformationPL_HeaderFile
+#define VISU_OptionalDeformationPL_HeaderFile
+
+#include "VISUPipeline.hxx"
+#include "VISU_DeformationPL.hxx"
+
+class VISU_PIPELINE_EXPORT VISU_OptionalDeformationPL: public VISU_DeformationPL
+{
+public:
+  VISU_OptionalDeformationPL();
+  virtual ~VISU_OptionalDeformationPL();
+
+  typedef VISU_DeformationPL Superclass;
+
+  void UseDeformation(bool flag);
+  bool IsDeformed();
+
+  virtual 
+  unsigned 
+  long int
+  GetMTime();
+
+protected:
+  bool CheckCanDeformate(vtkDataSet* theInput);
+
+private:
+  void OnDeformation();
+  void OffDeformation();
+
+private:
+  bool myIsDeformed;
+};
+
+#endif
index 002b8c62c2b5224a7ee39b0cc870d980e3accc0e..3ab6a01c40cff90897655f16cdb2bcf2a06a7313 100644 (file)
@@ -662,6 +662,15 @@ msgstr "Rotation around Z (X to Y):"
 msgid "VisuGUI_CutPlanesPane::LBL_ROTATION"
 msgstr "Rotations"
 
+msgid "VisuGUI_CutPlanesPane::LBL_DEFORMATION"
+msgstr "Deformation"
+
+msgid "VisuGUI_CutPlanesPane::LBL_DEFROMATION_VECT"
+msgstr "Vectors :"
+
+msgid "VisuGUI_CutPlanesPane::LBL_DEFROMATION_SCALE"
+msgstr "Scale Factor :"
+
 
 #: VisuGUI_DeformedShapeDlg.cxx
 
index bcc04d68d899058e86b99308286e043bd8dc88fa..d244a6930fb4517ddd3ee3f07f32043cf2c7f96b 100644 (file)
@@ -37,6 +37,7 @@
 
 #include "VISU_ColoredPrs3dFactory.hh"
 #include "VISU_CutPlanes_i.hh"
+#include "VISU_Result_i.hh"
 #include "VISU_CutPlanesPL.hxx"
 
 #include "OB_Browser.h"
@@ -68,6 +69,7 @@
 #include <vtkPolyData.h>
 #include <vtkAppendPolyData.h>
 #include <vtkDataSetMapper.h>
+#include <vtkDataSet.h>
 
 using namespace std;
 
@@ -145,6 +147,36 @@ VisuGUI_CutPlanesPane::VisuGUI_CutPlanesPane (QWidget* theParent)
   QLabel* aPosLbl = new QLabel(tr( "LBL_POS" ), this);
   myPosSpn = new QtxDblSpinBox( 0, 1, 0.1, this );
 
+  GDeformation = new QGroupBox (tr("LBL_DEFORMATION"), this, "GDeformation");
+  GDeformation->setCheckable(true);
+  GDeformation->setChecked(false);
+  GDeformation->setColumnLayout(0, Qt::Horizontal);
+  GDeformation->layout()->setSpacing( 0 );
+  GDeformation->layout()->setMargin( 0 );
+  QGridLayout* GDeformationLayout = new QGridLayout( GDeformation->layout() );
+  GDeformationLayout->setAlignment( Qt::AlignTop );
+  GDeformationLayout->setSpacing( 6 );
+  GDeformationLayout->setMargin( 11 );
+  connect(GDeformation, SIGNAL(toggled(bool)), this, SLOT(onDeformationCheck(bool)));
+
+  QLabel* LabelDeformation1 = new QLabel (tr("LBL_DEFROMATION_VECT"), GDeformation, "LabelDeformation1");
+  GDeformationLayout->addWidget( LabelDeformation1, 0, 0 );
+
+
+  myVectorialFieldCombo = new QComboBox (GDeformation,"myVectorialFieldCombo");
+  GDeformationLayout->addWidget( myVectorialFieldCombo, 0, 1 );
+
+  QLabel* LabelDeformation2 = new QLabel (tr("LBL_DEFROMATION_SCALE"), GDeformation, "LabelDeformation2");
+  GDeformationLayout->addWidget( LabelDeformation2, 1, 0 );
+  myScaleSpn = new QtxDblSpinBox (0.0, 1.0E+38, 0.1, GDeformation);
+  myScaleSpn->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed));
+  myScaleSpn->setPrecision(38);
+  myScaleSpn->setValue(0.1);
+  GDeformationLayout->addWidget( myScaleSpn, 1, 1 );
+  connect(myVectorialFieldCombo,     SIGNAL(activated(int)), this, SLOT(onVectorialFieldChanged(int)));
+  connect(myScaleSpn, SIGNAL(valueChanged(double)), this, SLOT(onScaleFactorChanged(double)));
+
+
   myPreviewCheck = new QCheckBox(tr("LBL_SHOW_PREVIEW"), this);
   myPreviewCheck->setChecked(false);
   connect( myPreviewCheck, SIGNAL( toggled( bool )), this, SLOT( onPreviewCheck( bool ) ) );
@@ -157,7 +189,8 @@ VisuGUI_CutPlanesPane::VisuGUI_CutPlanesPane (QWidget* theParent)
   TopLayout->setRowStretch ( 3, 3 );
   TopLayout->addWidget(aPosLbl, 4, 0 );
   TopLayout->addWidget(myPosSpn, 4, 1 );
-  TopLayout->addMultiCellWidget( myPreviewCheck, 5, 5, 0, 1 );
+  TopLayout->addMultiCellWidget( GDeformation, 5, 5, 0, 1 );
+  TopLayout->addMultiCellWidget( myPreviewCheck, 6, 6, 0, 1 );
 
   // signals and slots connections
   connect( SelPlane, SIGNAL( clicked( int )), this, SLOT( orientationChanged( int ) ) );
@@ -187,31 +220,91 @@ void VisuGUI_CutPlanesPane::initFromPrsObject (VISU::CutPlanes_i* thePrs)
   setRotation(thePrs->GetRotateX()*180./PI, thePrs->GetRotateY()*180./PI);
   setPlanePos(thePrs->GetOrientationType());
   myPosSpn->setValue(thePrs->GetDisplacement());
+  InitEntity2VectorialFieldsMap(thePrs);
+  InsertAllVectorialFields();
+  setScaleFactor(thePrs->GetScale());
+  if(myEntity2VectorialFields.size() < 1)
+    GDeformation->setDisabled(true);
+  else{
+    if(thePrs->IsDeformed()){
+      GDeformation->setChecked(true);
+      myVectorialFieldCombo->setCurrentText(thePrs->GetVectorialFieldName());
+    }
+  }
+    
   hasInit = true;
   // init table
   myCutPlanes = VISU::TSameAsFactory<VISU::TCUTPLANES>().Create(thePrs, VISU::ColoredPrs3d_i::EDoNotPublish);
   myCutPlanes->SameAs(thePrs);
   DrawTable();
-
+  
   // Draw Preview
   if (myPreviewCheck->isChecked()) {
     createPlanes();
   }
 }
 
+
+void VisuGUI_CutPlanesPane::InitEntity2VectorialFieldsMap(VISU::ColoredPrs3d_i* thePrs){
+
+  VISU::Result_var theResult = thePrs->GetResultObject();
+  VISU::Result_i* aResult = dynamic_cast<VISU::Result_i*>(GetServant(theResult).in());
+  VISU::Result::Entities_var aEntities = aResult->GetEntities(thePrs->GetMeshName());
+  VISU::Result::TimeStampNumbers_var aScalarTimeStamp = aResult->GetTimeStampNumbers(thePrs->GetMeshName(),
+                                                                                     thePrs->GetEntity(),
+                                                                                     thePrs->GetFieldName());
+  CORBA::Long aTimeStampNumber = aScalarTimeStamp->length();
+  
+  for(size_t iEntity = 0; iEntity < aEntities->length(); iEntity++){
+    VISU::Entity aEntity = aEntities[iEntity];
+    VISU::Result::EntityNames_var aFields = aResult->GetFields(thePrs->GetMeshName(),aEntity);
+    for(size_t iField = 0; iField < aFields->length(); iField++){
+
+      TVectorialFieldsList aVectorialFields;
+      VISU::Result::TimeStampNumbers_var aTimeStamps =  aResult->GetTimeStampNumbers(thePrs->GetMeshName(),aEntity,aFields[iField] );
+      
+      if((aResult->GetNumberOfComponents(thePrs->GetMeshName(),aEntity,aFields[iField] ) > 1) &&
+         (aTimeStamps->length() >= aTimeStampNumber)){
+        aVectorialFields.push_back(QString(aFields[iField].in()));
+      }
+      if(aVectorialFields.size() > 0){
+        myEntity2VectorialFields.insert(TEntVectPair(aEntity,aVectorialFields));
+      }
+    }
+  }
+}
+
+void VisuGUI_CutPlanesPane::InsertAllVectorialFields(){
+  TEntity2VectorialFields::const_iterator aFieldIter = myEntity2VectorialFields.begin();
+  for( ;aFieldIter != myEntity2VectorialFields.end();aFieldIter++ ){
+    TVectorialFieldsList aVectorialFields = aFieldIter->second;
+    for(size_t iField = 0;iField < aVectorialFields.size(); iField++)
+      myVectorialFieldCombo->insertItem(aVectorialFields[iField]);
+  }
+}
+
+double VisuGUI_CutPlanesPane::getScaleFactor(){
+  return myScaleSpn->value();
+}
+
+void VisuGUI_CutPlanesPane::setScaleFactor(double theFactor){
+  return myScaleSpn->setValue(theFactor);
+}
+
+
 void VisuGUI_CutPlanesPane::createPlanes()
 {
   if (VISU::GetActiveViewWindow<SVTK_ViewWindow>() == NULL) return;
   if (!myCutPlanes) return;
   if (myPreviewActor != 0) return;
 
-  vtkAppendPolyData* aPolyData = myCutPlanes->GetSpecificPL()->GetAppendPolyData();
-  if (!aPolyData->GetOutput()->GetNumberOfCells()) {
+  vtkDataSet* aDataSet = myCutPlanes->GetSpecificPL()->GetWarpVectorOutput();
+  if (!aDataSet->GetNumberOfCells()) {
     onPreviewCheck(false);
     return;
   }
   vtkDataSetMapper* aPlaneMapper = vtkDataSetMapper::New();
-  aPlaneMapper->SetInput(aPolyData->GetOutput());
+  aPlaneMapper->SetInput(aDataSet);
   aPlaneMapper->ScalarVisibilityOff();
 
   myPreviewActor = SALOME_Actor::New();
@@ -235,6 +328,31 @@ int VisuGUI_CutPlanesPane::storeToPrsObject (VISU::CutPlanes_i* thePrs)
     else
       thePrs->SetDefault(i);
   }
+
+  thePrs->UseDeformation(GDeformation->isChecked());
+  
+  if(GDeformation->isChecked()){
+    TEntity2VectorialFields::const_iterator anIter = myEntity2VectorialFields.begin();
+    VISU::Entity anEntity;
+    QString aFieldName;
+    bool isInited = false;
+    for(;anIter != myEntity2VectorialFields.end();anIter++){
+      TVectorialFieldsList aFields = anIter->second;
+      for(int it = 0;it < aFields.size();it++)
+        if(!QString::compare(aFields[it], myVectorialFieldCombo->currentText ())){
+          anEntity = anIter->first;
+          aFieldName = aFields[it];
+          isInited = true;
+          break;
+        }
+      if(isInited)
+        break;
+    }
+    if(isInited)
+      thePrs->SetVectorialField(anEntity,aFieldName.latin1());
+    
+    thePrs->SetScale(myScaleSpn->value());
+  }
   return 1;
 }
 
@@ -303,6 +421,45 @@ void VisuGUI_CutPlanesPane::setRotation (const double r1, const double r2)
   Rot2->setValue( r2 );
 }
 
+void VisuGUI_CutPlanesPane::onScaleFactorChanged(double theFactor){
+  DrawTable();
+}
+
+void VisuGUI_CutPlanesPane::onVectorialFieldChanged(int pos){
+  InitVectorialField();
+  DrawTable();
+}
+
+void VisuGUI_CutPlanesPane::onDeformationCheck(bool Flag){
+  if(!myCutPlanes || !hasInit) return;
+  myCutPlanes->UseDeformation(Flag);
+  InitVectorialField();
+  DrawTable();
+}
+
+void VisuGUI_CutPlanesPane::InitVectorialField(){
+  if(myCutPlanes->IsDeformed()){
+    TEntity2VectorialFields::const_iterator anIter = myEntity2VectorialFields.begin();
+    VISU::Entity anEntity;
+    QString aFieldName;
+    bool isInited = false;
+    for(;anIter != myEntity2VectorialFields.end();anIter++){
+      TVectorialFieldsList aFields = anIter->second;
+      for(int it = 0;it < aFields.size();it++)
+        if(!QString::compare(aFields[it], myVectorialFieldCombo->currentText ())){
+          anEntity = anIter->first;
+          aFieldName = aFields[it];
+          isInited = true;
+          break;
+        }
+      if(isInited)
+        break;
+    }
+    if(isInited)
+      myCutPlanes->SetVectorialField(anEntity,aFieldName.latin1());
+  }
+}
+
 /*!
   Draw the table of planes positions
 */
@@ -317,6 +474,7 @@ void VisuGUI_CutPlanesPane::DrawTable()
   myCutPlanes->SetOrientation(getOrientaion(),getRotation1()*PI/180.,getRotation2()*PI/180.);
   myCutPlanes->SetNbPlanes(aNbPlanes);
   myCutPlanes->SetDisplacement(myPosSpn->value());
+  myCutPlanes->SetScale(getScaleFactor());
   if (aNbRows>0)
     for (int i = 0; i < aNbRows; ++i) {
       QCheckTableItem* aItem = (QCheckTableItem*)myPosTable->item( i, 1 );
@@ -537,7 +695,7 @@ void VisuGUI_CutPlanesDlg::initFromPrsObject ( VISU::ColoredPrs3d_i* thePrs,
   VisuGUI_ScalarBarBaseDlg::initFromPrsObject(myPrsCopy, theInit);
 
   myCutPane->initFromPrsObject(myPrsCopy);
-
+  
   if( !theInit )
     return;
 
index 9b029d90c5981c47f7c4ab366bef9e70b69ff8cd..458433dde50903566970d43bb3bf9643226bfa28 100644 (file)
 #include <qradiobutton.h>
 #include <qtable.h>
 #include <qtabwidget.h>
+#include <qcombobox.h>
 
 #include <QtxDblSpinBox.h>
 
 #include "SALOMEconfig.h"
 #include CORBA_CLIENT_HEADER(VISU_Gen)
 
+#include <map>
+#include <vector>
+
+
 namespace VISU 
 {
   class CutPlanes_i;
+  class Result_i;
 };
 
 class SUIT_ViewWindow;
@@ -53,6 +59,7 @@ class SUIT_ViewManager;
 class SalomeApp_Module;
 class VisuGUI_InputPane;
 
+
 class VisuGUI_CutPlanesPane : public QFrame
 {
     Q_OBJECT
@@ -69,15 +76,30 @@ public:
     double getRotation1() {return Rot1->value();}
     double getRotation2() {return Rot2->value();}
 
+    double getScaleFactor();
+    void setScaleFactor(double factor);
+
     void initFromPrsObject(VISU::CutPlanes_i* thePrs);
     int storeToPrsObject(VISU::CutPlanes_i* thePrs);
 
 private:
+    
+    typedef std::vector<QString> TVectorialFieldsList;
+    typedef std::map<VISU::Entity, TVectorialFieldsList> TEntity2VectorialFields;
+    typedef std::pair<VISU::Entity,TVectorialFieldsList> TEntVectPair;
+    TEntity2VectorialFields myEntity2VectorialFields;
+
     void createPlanes();
     void deletePlanes();
 
+    void InitEntity2VectorialFieldsMap(VISU::ColoredPrs3d_i* thePrs);
+    void InsertAllVectorialFields();
+    void InitVectorialField();
+
+
     QLabel* LabelRot1;
     QLabel* LabelRot2;
+    QGroupBox* GDeformation;
     QSpinBox* nbPlan;
     QtxDblSpinBox* Rot1;
     QtxDblSpinBox* Rot2;
@@ -88,6 +110,8 @@ private:
     QTable* myPosTable;
     SALOME::GenericObjPtr<VISU::CutPlanes_i> myCutPlanes;
     QCheckBox* myPreviewCheck;
+    QComboBox* myVectorialFieldCombo;
+    QtxDblSpinBox* myScaleSpn;
     double          X1, X2;
     double          Y1, Y2;
     double          Z1, Z2;
@@ -102,6 +126,9 @@ private slots:
     void onValueChanged(int theRow, int theCol);
     void onRotation(double theValue);
     void onPreviewCheck(bool thePreview);
+    void onScaleFactorChanged(double);
+    void onDeformationCheck(bool);
+    void onVectorialFieldChanged(int);
 };
 
 
index 4e2d5ffb41be9e357db29c36c36831be1f9cfe54..20bff31863fd7f39d1ad968105b9cf21396ab119 100644 (file)
@@ -53,8 +53,11 @@ salomeinclude_HEADERS = \
        VISU_DeformedShapeAndScalarMap_i.hh \
        VISU_ColoredPrs3dFactory.hh \
        VISU_MonoColorPrs_i.hh \
+       VISU_Deformation_i.hh \
+       VISU_OptionalDeformation_i.hh \
        SALOME_GenericObjPointer.hh
 
+
 libVISUEngineImpl_la_SOURCES = \
        VISUConfig.cc \
        VISU_Result_i.cc \
@@ -87,6 +90,8 @@ libVISUEngineImpl_la_SOURCES = \
        VISU_PointMap3d_i.cc \
        VISU_DumpPython.cc \
        VISU_MonoColorPrs_i.cc \
+       VISU_Deformation_i.cc \
+       VISU_OptionalDeformation_i.cc \
        SALOME_GenericObjPointer.cc
 
 MOC_FILES = VISU_TimeAnimation_moc.cxx
index a0f724b7cdb0330ad02634f061ccd6cb2c6804f1..703b3d7d5fe9907bfdd4567f2bfda94977938e71 100644 (file)
@@ -25,6 +25,7 @@
 //  Module : VISU
 
 #include "VISU_CutPlanesPL.hxx"
+#include "VISU_Convertor.hxx"
 #include "VISU_Prs3dUtils.hh"
 #include "VISU_CutPlanes_i.hh"
 
@@ -41,6 +42,7 @@ static int MYDEBUG = 0;
 #endif
 
 
+
 //----------------------------------------------------------------------------
 size_t 
 VISU::CutPlanes_i
@@ -95,8 +97,12 @@ VISU::CutPlanes_i
 ::CutPlanes_i(EPublishInStudyMode thePublishInStudyMode):
   ColoredPrs3d_i(thePublishInStudyMode),
   ScalarMap_i(thePublishInStudyMode),
-  myCutPlanesPL(NULL)
-{}
+  myCutPlanesPL(NULL),
+  Deformation_i(this),
+  OptionalDeformation_i(this)
+{
+  if(MYDEBUG) MESSAGE("CutPlanes_i::CutPlanes_i()");
+}
 
 
 //----------------------------------------------------------------------------
@@ -131,6 +137,8 @@ VISU::CutPlanes_i
     if(aCondList[i].toInt() == 0)
       SetPlanePosition(i,aPosList[i].toDouble());
 
+  OptionalDeformation_i::RestoreDeformation(theSObject,theMap);
+  
   return this;
 }
 
@@ -152,6 +160,7 @@ void VISU::CutPlanes_i::ToStream(std::ostringstream& theStr){
   }
   Storable::DataToStream( theStr, "myPlanePosition",  aStrPos.latin1());
   Storable::DataToStream( theStr, "myPlaneCondition", aStrCon.latin1());
+  OptionalDeformation_i::DeformationToStream(theStr);
 }
 
 
@@ -321,6 +330,7 @@ VISU::CutPlanes_i
   }else
     myCutPlanesPL = dynamic_cast<VISU_CutPlanesPL*>(thePipeLine);
 
+  InitDeformedPipeLine(myCutPlanesPL);
   TSuperClass::CreatePipeLine(myCutPlanesPL);
 }
 
@@ -348,3 +358,46 @@ VISU::CutPlanes_i
   return NULL;
 }
 
+void
+VISU::CutPlanes_i::
+SameAs(const Prs3d_i* theOrigin){
+  if(MYDEBUG) MESSAGE("CutPlanes_i::SameAs()");
+  TSuperClass::SameAs(theOrigin);
+  OptionalDeformation_i::SameAsDeformation(dynamic_cast<const Deformation_i*>(theOrigin));
+}
+
+void VISU::CutPlanes_i::SetVectorialField(Entity theEntity, const char* theFieldName){
+  if(MYDEBUG) MESSAGE("CutPlanes_i::SetVectorialField()");
+
+  bool anIsModified = false;
+  if(!anIsModified)
+    anIsModified |= GetVectorialFieldEntity() != theEntity;
+  
+  if(!anIsModified)
+    anIsModified |= GetVectorialFieldName() != theFieldName;
+
+  if(!anIsModified)
+    return;
+  
+  int aTimeStampNumber = GetTimeStampNumber();
+
+  VISU::TEntity aEntity = VISU::TEntity(theEntity);
+  VISU::Result_i::PInput anInput = GetCResult()->GetInput(GetCMeshName(),
+                                                         theEntity,
+                                                         theFieldName,
+                                                         aTimeStampNumber);
+
+  PField aVectorialField = anInput->GetField(GetCMeshName(), aEntity, theFieldName);
+
+  VISU::PUnstructuredGridIDMapper anIDMapper = 
+    anInput->GetTimeStampOnMesh(GetCMeshName(),
+                               aEntity,
+                               theFieldName,
+                               aTimeStampNumber);
+  
+  SetVField(theEntity,
+          theFieldName,
+          anIDMapper,
+          aVectorialField);
+  
+};
index 9386f9f3ea241aef07e830b6d8aeeb9dbcdf86ab..bf4b84a1c45e4d902a60b46f70c2b093d404a1e3 100644 (file)
@@ -28,6 +28,7 @@
 #define VISU_CutPlanes_i_HeaderFile
 
 #include "VISU_ScalarMap_i.hh"
+#include "VISU_OptionalDeformation_i.hh"
 
 class VISU_CutPlanesPL;
 
@@ -35,7 +36,8 @@ namespace VISU
 {
   //----------------------------------------------------------------------------
   class VISU_I_EXPORT CutPlanes_i : public virtual POA_VISU::CutPlanes,
-                                   public virtual ScalarMap_i
+                                   public virtual ScalarMap_i,
+                                   public virtual OptionalDeformation_i
   {
     static int myNbPresent;
     CutPlanes_i(const CutPlanes_i&);
@@ -113,6 +115,8 @@ namespace VISU
     { 
       return myCutPlanesPL; 
     }
+
+    virtual void SetVectorialField(Entity theEntity, const char* theFieldName);
     
   protected:
     //! Redefines VISU_ColoredPrs3d_i::CreatePipeLine
@@ -157,6 +161,10 @@ namespace VISU
     Restore(SALOMEDS::SObject_ptr theSObject,
            const Storable::TRestoringMap& theMap);
 
+    virtual 
+    void
+    SameAs(const Prs3d_i* theOrigin);
+
     //! Redefines VISU_ColoredPrs3d_i::CreateActor
     virtual 
     VISU_Actor* 
diff --git a/src/VISU_I/VISU_Deformation_i.cc b/src/VISU_I/VISU_Deformation_i.cc
new file mode 100755 (executable)
index 0000000..7f777e1
--- /dev/null
@@ -0,0 +1,146 @@
+//  Copyright (C) 2008  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_Deformation_i.cc
+//  Author : 
+//  Module : VISU
+
+#include "VISU_Deformation_i.hh"
+#include "VISU_Result_i.hh"
+#include "VISU_Prs3dUtils.hh"
+
+#include "VISU_DeformationPL.hxx"
+#include "VISU_Convertor.hxx"
+#include "VISU_DeformationPL.hxx"
+#include "VISUConfig.hh"
+
+#ifdef _DEBUG_
+static int MYDEBUG = 0;
+#else
+static int MYDEBUG = 0;
+#endif
+
+//---------------------------------------------------------------
+VISU::Deformation_i::Deformation_i(VISU::Prs3d_i *theModifiedEngine):
+  myModifiedEngine(theModifiedEngine)
+{
+  if(MYDEBUG) MESSAGE("Deformation_i::Deformation_i()");
+}
+
+//---------------------------------------------------------------
+VISU::Deformation_i::~Deformation_i()
+{
+  if(MYDEBUG) MESSAGE("Deformation_i::~Deformation_i()");
+}
+
+//---------------------------------------------------------------
+void VISU::Deformation_i::SetScale(CORBA::Double theScale)
+{
+  if(MYDEBUG) MESSAGE("Deformation_i::SetScale()");
+
+  VISU::TSetModified aModified(GetModifiedEngine());
+
+  ProcessVoidEvent(new TVoidMemFun1ArgEvent<VISU_DeformationPL, vtkFloatingPointType>
+                  (GetSpecificDeformedPL(), &VISU_DeformationPL::SetScale, theScale));
+}
+
+//---------------------------------------------------------------
+void VISU::Deformation_i::InitDeformedPipeLine(VISU_DeformationPL* theDeformedPipeLine){
+  
+  if(MYDEBUG) MESSAGE("Deformation_i::InitDeformedPipeLine()");
+  myDeformationPL = theDeformedPipeLine;
+}
+
+//---------------------------------------------------------------
+CORBA::Double 
+VISU::Deformation_i
+::GetScale()
+{
+  if(MYDEBUG) MESSAGE("Deformation_i::GetScale()");
+  return GetSpecificDeformedPL()->GetScale();
+}
+
+//---------------------------------------------------------------
+void VISU::
+Deformation_i::SetVField(VISU::Entity theEntity,
+                                const char* theFieldName,
+                                VISU::PUnstructuredGridIDMapper anIDMapper,
+                                PField theVectorialField)
+{
+  
+  if(MYDEBUG) MESSAGE("Deformation_i::SetVField()");
+  
+  
+  VISU::TSetModified aModified(GetModifiedEngine());
+  myVectorialField = theVectorialField;
+  if(GetSpecificDeformedPL() && anIDMapper)
+    ProcessVoidEvent(new TVoidMemFun1ArgEvent<VISU_DeformationPL, VISU::PUnstructuredGridIDMapper>
+                    (GetSpecificDeformedPL(), &VISU_DeformationPL::SetVectorialField, anIDMapper));
+  
+  myVectorialEntity = theEntity;
+  myVectorialFieldName = theFieldName;
+}
+
+
+//---------------------------------------------------------------
+VISU::Entity VISU::Deformation_i::GetVectorialFieldEntity(){
+  return myVectorialEntity;
+}
+
+//---------------------------------------------------------------
+char* VISU::Deformation_i::GetVectorialFieldName(){
+  return CORBA::string_dup(myVectorialFieldName.c_str());
+}
+
+//---------------------------------------------------------------
+void VISU::Deformation_i::
+DeformationToStream(std::ostringstream& theStr)
+{
+  Storable::DataToStream(theStr,"myScaleFactor", GetScale());
+  Storable::DataToStream(theStr,"myVectorialField", GetVectorialFieldName());
+  Storable::DataToStream(theStr,"myVectorialEntiry", GetVectorialFieldEntity());
+
+}
+
+//---------------------------------------------------------------
+void
+VISU::Deformation_i::RestoreDeformation(SALOMEDS::SObject_ptr theSObject,
+                            const Storable::TRestoringMap& theMap)
+{
+  SetScale(VISU::Storable::FindValue(theMap,"myScaleFactor").toDouble());
+  VISU::Entity anEntity = VISU::Entity(VISU::Storable::FindValue(theMap, "myVectorialEntiry").toInt());
+  
+  SetVectorialField(anEntity,
+                   VISU::Storable::FindValue(theMap, "myVectorialField")); 
+}
+
+//---------------------------------------------------------------
+void
+VISU::Deformation_i::SameAsDeformation(const Deformation_i *aDeformedPrs){
+  if(const Deformation_i* aPrs = dynamic_cast<const Deformation_i*>(aDeformedPrs)) {
+    Deformation_i* anOrigin = const_cast<Deformation_i*>(aPrs);
+    
+    CORBA::String_var aVectorialFieldName = anOrigin->GetVectorialFieldName();
+    VISU::Entity anEntity = anOrigin->GetVectorialFieldEntity();
+    this->SetVectorialField(anEntity,
+                           aVectorialFieldName);
+    this->SetScale(anOrigin->GetScale());
+  }
+}
diff --git a/src/VISU_I/VISU_Deformation_i.hh b/src/VISU_I/VISU_Deformation_i.hh
new file mode 100755 (executable)
index 0000000..c574f3d
--- /dev/null
@@ -0,0 +1,106 @@
+//  Copyright (C) 2008  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_Deformation_i.hxx
+//  Author : 
+//  Module : VISU
+
+#ifndef VISU_Deformation_i_HeaderFile
+#define VISU_Deformation_i_HeaderFile
+
+#include "VISU_I.hxx"
+#include "VISU_Prs3d_i.hh"
+#include "VISU_DeformationPL.hxx"
+
+
+
+namespace VISU{
+
+  class VISU_I_EXPORT Deformation_i : public virtual POA_VISU::Deformation
+  {
+    Deformation_i(const Deformation_i&);
+  public:
+    typedef VISU::Deformation TInterface;
+
+    Deformation_i(Prs3d_i* theModifiedEngine);
+    virtual ~Deformation_i();
+
+    virtual 
+    void
+    SetScale(CORBA::Double theScale);
+
+    virtual
+    CORBA::Double 
+    GetScale();
+
+    virtual
+    void
+    DeformationToStream(std::ostringstream& theStr);
+
+    virtual
+    void
+    RestoreDeformation(SALOMEDS::SObject_ptr theSObject,
+           const Storable::TRestoringMap& theMap);
+
+    virtual 
+    void 
+    SameAsDeformation(const Deformation_i *aDeformedPrs);
+
+    virtual
+    VISU::Entity
+    GetVectorialFieldEntity();
+
+    virtual
+    char* 
+    GetVectorialFieldName();
+
+  protected:
+    virtual
+    void
+    InitDeformedPipeLine(VISU_DeformationPL* theDeformedPipeLine);
+
+    VISU_DeformationPL*
+    GetSpecificDeformedPL() const
+    { 
+      return myDeformationPL; 
+    }
+
+    void SetVField(VISU::Entity theEntity,
+                          const char* theFieldName,
+                          PUnstructuredGridIDMapper,
+                          PField theVectorialField);
+
+    Prs3d_i* GetModifiedEngine(){
+      return myModifiedEngine;
+    }
+    
+    
+  private:
+    VISU_DeformationPL *myDeformationPL;
+
+    PField myVectorialField;
+    VISU::Entity myVectorialEntity;
+    std::string myVectorialFieldName;
+    Prs3d_i *myModifiedEngine;
+    
+  };
+}
+
+#endif
index 84b03f05e72b253bf41bc1f7a0860608e63ea2bc..95e42818b8dd0183d544eb17e15c03c145adcae6 100644 (file)
@@ -652,6 +652,27 @@ namespace VISU
        theStr<<thePrefix<<theName<<".SetPlanePosition("<<anId<<", "<<theServant->GetPlanePosition(anId)<<")"<<endl;
     }
 
+    theStr<<thePrefix<<theName<<".UseDeformation("<<GetBoolean(theServant->IsDeformed())<<")"<<endl;
+    if(theServant->IsDeformed()){
+      theStr<< thePrefix << theName << ".SetScale(" << theServant->GetScale()<<")"<<endl;
+      std::string aStringEntity;
+      VISU::Entity anEntity = theServant->GetVectorialFieldEntity();
+      switch(anEntity){
+      case NODE:
+       aStringEntity = "VISU.NODE";
+       break;
+      case EDGE:
+       aStringEntity = "VISU.EDGE";
+       break;
+      case FACE:
+       aStringEntity = "VISU.FACE";
+       break;
+      case CELL:
+       aStringEntity = "VISU.CELL";
+       break;
+      }
+      theStr<< thePrefix << theName << ".SetVectorialField("<<aStringEntity<<", '" << theServant->GetVectorialFieldName() <<"')"<<endl;
+    }
     return thePrefix;
   }
 
diff --git a/src/VISU_I/VISU_OptionalDeformation_i.cc b/src/VISU_I/VISU_OptionalDeformation_i.cc
new file mode 100755 (executable)
index 0000000..380db3e
--- /dev/null
@@ -0,0 +1,110 @@
+//  Copyright (C) 2008  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_OptionalDeformation_i.cc
+//  Author : 
+//  Module : VISU
+
+#include "VISU_OptionalDeformation_i.hh"
+#include "VISU_Result_i.hh"
+#include "VISU_Prs3dUtils.hh"
+#include "VISUConfig.hh"
+
+#include "VISU_OptionalDeformationPL.hxx"
+
+
+#ifdef _DEBUG_
+static int MYDEBUG = 0;
+#else
+static int MYDEBUG = 0;
+#endif
+
+//---------------------------------------------------------------
+VISU::OptionalDeformation_i::OptionalDeformation_i(VISU::Prs3d_i *theModifiedEngine):
+  Deformation_i(theModifiedEngine)
+{
+  if(MYDEBUG) MESSAGE("OptionalDeformation_i::OptionalDeformation_i()");
+}
+
+//---------------------------------------------------------------
+VISU::OptionalDeformation_i::~OptionalDeformation_i()
+{
+  if(MYDEBUG) MESSAGE("OptionalDeformation_i::~OptionalDeformation_i()");
+}
+
+//---------------------------------------------------------------
+void VISU::OptionalDeformation_i::UseDeformation(CORBA::Boolean theFlag){
+  if(MYDEBUG) MESSAGE("OptionalDeformation_i::UseDeformation()");
+
+  VISU::TSetModified aModified(GetModifiedEngine());
+
+  ProcessVoidEvent(new TVoidMemFun1ArgEvent<VISU_OptionalDeformationPL, bool>
+                  (GetSpecificDeformedPL(), &VISU_OptionalDeformationPL::UseDeformation, theFlag));
+}
+
+//---------------------------------------------------------------
+CORBA::Boolean VISU::OptionalDeformation_i::IsDeformed(){
+
+  if(MYDEBUG) MESSAGE("OptionalDeformation_i::IsDeformed()");
+  return GetSpecificDeformedPL()->IsDeformed();
+}
+
+
+void VISU::OptionalDeformation_i::InitDeformedPipeLine(VISU_DeformationPL* theDeformedPipeLine){
+
+  if(MYDEBUG) MESSAGE("OptionalDeformation_i::InitDeformedPipeLine()");
+  myOptionalDeformationPL = dynamic_cast<VISU_OptionalDeformationPL*>(theDeformedPipeLine);
+
+  TSuperClass::InitDeformedPipeLine(myOptionalDeformationPL);
+}
+
+//---------------------------------------------------------------
+void VISU::OptionalDeformation_i::
+DeformationToStream(std::ostringstream& theStr)
+{
+  Storable::DataToStream(theStr,"IsDeformed", IsDeformed());
+  if(IsDeformed())
+    TSuperClass::DeformationToStream(theStr);
+}
+
+//---------------------------------------------------------------
+void
+VISU::OptionalDeformation_i::RestoreDeformation(SALOMEDS::SObject_ptr theSObject,
+                                               const Storable::TRestoringMap& theMap)
+{
+  UseDeformation(Storable::FindValue(theMap,"IsDeformed").toInt());
+  if(IsDeformed())
+    TSuperClass::RestoreDeformation(theSObject,theMap);
+}
+
+
+
+void 
+VISU::OptionalDeformation_i::SameAsDeformation(const Deformation_i *aDeformedPrs){
+
+  if(const OptionalDeformation_i* aPrs3d = dynamic_cast<const OptionalDeformation_i*>(aDeformedPrs)){
+    OptionalDeformation_i* anOrigin = const_cast<OptionalDeformation_i*>(aPrs3d);
+    UseDeformation(anOrigin->IsDeformed());
+    
+    if(anOrigin->IsDeformed()){
+      TSuperClass::SameAsDeformation(aDeformedPrs);
+    }
+  }
+}
diff --git a/src/VISU_I/VISU_OptionalDeformation_i.hh b/src/VISU_I/VISU_OptionalDeformation_i.hh
new file mode 100755 (executable)
index 0000000..cfe3a71
--- /dev/null
@@ -0,0 +1,76 @@
+//  Copyright (C) 2008  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_Deformation_i.hxx
+//  Author : 
+//  Module : VISU
+
+#ifndef VISU_OptionalDeformation_i_HeaderFile
+#define VISU_OptionalDeformation_i_HeaderFile
+
+#include "VISU_I.hxx"
+#include "VISU_Deformation_i.hh"
+#include "VISU_OptionalDeformationPL.hxx"
+
+namespace VISU {
+  class VISU_I_EXPORT OptionalDeformation_i : public virtual POA_VISU::OptionalDeformation,
+                                             public virtual Deformation_i
+  {
+    OptionalDeformation_i(const OptionalDeformation_i&);
+  public:
+    typedef VISU::OptionalDeformation TInterface;
+    typedef Deformation_i TSuperClass;
+
+    OptionalDeformation_i(Prs3d_i* theModifiedEngine);
+    virtual ~OptionalDeformation_i();
+    
+    virtual void UseDeformation(CORBA::Boolean theFlag);
+    virtual CORBA::Boolean IsDeformed();
+
+
+    virtual
+    void
+    DeformationToStream(std::ostringstream& theStr);
+
+    virtual
+    void
+    RestoreDeformation(SALOMEDS::SObject_ptr theSObject,
+           const Storable::TRestoringMap& theMap);
+
+    virtual 
+    void 
+    SameAsDeformation(const Deformation_i *aDeformedPrs);
+
+  protected:
+    virtual
+    void InitDeformedPipeLine(VISU_DeformationPL* theDeformedPipeLine);
+
+    VISU_OptionalDeformationPL*
+    GetSpecificDeformedPL() const
+    { 
+      return myOptionalDeformationPL;
+    }
+    
+  private:
+    VISU_OptionalDeformationPL* myOptionalDeformationPL;
+    
+  };
+}
+#endif
index 2c0dc3d68437804490266539e5e1b4bdc847f842..8f3f90e1572f671f4b0d350e31e2296fa37d68a2 100644 (file)
@@ -999,7 +999,7 @@ VISU::Result_i
 
   {
     anEntities->length(aMeshOnEntityMap.size());
-    VISU::TMeshOnEntityMap::const_iterator anIter = aMeshOnEntityMap.end();
+    VISU::TMeshOnEntityMap::const_iterator anIter = aMeshOnEntityMap.begin();
     for(size_t anId = 0; anIter != aMeshOnEntityMap.end(); anIter++, anId++){
       const VISU::TEntity& anEntity = anIter->first;
       anEntities[anId] = VISU::Entity(anEntity);
@@ -1043,7 +1043,7 @@ VISU::Result_i
     
     {
       aResult->length(aFamilyMap.size());
-      VISU::TFamilyMap::const_iterator anIter = aFamilyMap.end();
+      VISU::TFamilyMap::const_iterator anIter = aFamilyMap.begin();
       for(size_t anId = 0; anIter != aFamilyMap.end(); anIter++, anId++){
        const std::string& aName = anIter->first;
        aResult[anId] = aName.c_str();
@@ -1076,7 +1076,7 @@ VISU::Result_i
 
   {
     aResult->length(aGroupMap.size());
-    VISU::TGroupMap::const_iterator anIter = aGroupMap.end();
+    VISU::TGroupMap::const_iterator anIter = aGroupMap.begin();
     for(size_t anId = 0; anIter != aGroupMap.end(); anIter++, anId++){
       const std::string& aName = anIter->first;
       aResult[anId] = aName.c_str();
@@ -1120,7 +1120,7 @@ VISU::Result_i
     
     {
       aResult->length(aFieldMap.size());
-      VISU::TFieldMap::const_iterator anIter = aFieldMap.end();
+      VISU::TFieldMap::const_iterator anIter = aFieldMap.begin();
       for(size_t anId = 0; anIter != aFieldMap.end(); anIter++, anId++){
        const std::string& aName = anIter->first;
        aResult[anId] = aName.c_str();
@@ -1177,7 +1177,7 @@ VISU::Result_i
 
        {
          aResult->length(aValField.size());
-         VISU::TValField::const_iterator anIter = aValField.end();
+         VISU::TValField::const_iterator anIter = aValField.begin();
          for(size_t anId = 0; anIter != aValField.end(); anIter++, anId++){
            const vtkIdType& aTimeStampNumber = anIter->first;
            aResult[anId] = aTimeStampNumber;