]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
Improvement Bug PAL8685:
authorenk <enk@opencascade.com>
Thu, 26 Jan 2006 07:51:34 +0000 (07:51 +0000)
committerenk <enk@opencascade.com>
Thu, 26 Jan 2006 07:51:34 +0000 (07:51 +0000)
  Displaying a scalar field on a deformed shape

25 files changed:
idl/VISU_Gen.idl
resources/VISU_en.xml
resources/VISU_fr.xml
resources/Visu_scalarmapondeformedshape.png [new file with mode: 0644]
src/PIPELINE/Makefile.in
src/PIPELINE/VISU_ScalarMapOnDeformedShapePL.cxx [new file with mode: 0644]
src/PIPELINE/VISU_ScalarMapOnDeformedShapePL.hxx [new file with mode: 0644]
src/VISUGUI/Makefile.in
src/VISUGUI/VISU_icons.po
src/VISUGUI/VISU_images.po
src/VISUGUI/VISU_msg_en.po
src/VISUGUI/VisuGUI.cxx
src/VISUGUI/VisuGUI.h
src/VISUGUI/VisuGUI_ActionsDef.h
src/VISUGUI/VisuGUI_PopupTools.cxx
src/VISUGUI/VisuGUI_ScalarBarDlg.cxx
src/VISUGUI/VisuGUI_ScalarBarDlg.h
src/VISUGUI/VisuGUI_ScalarMapOnDeformedShapeDlg.cxx [new file with mode: 0644]
src/VISUGUI/VisuGUI_ScalarMapOnDeformedShapeDlg.h [new file with mode: 0644]
src/VISUGUI/VisuGUI_TimeAnimation.cxx
src/VISUGUI/VisuGUI_Tools.cxx
src/VISU_I/Makefile.in
src/VISU_I/VISU_ScalarMapOnDeformedShape_i.cc [new file with mode: 0644]
src/VISU_I/VISU_ScalarMapOnDeformedShape_i.hh [new file with mode: 0644]
src/VISU_I/VISU_TimeAnimation.cxx

index 79237353a4071602bad112f7cfc6ad3d40f777c1..5f7648d6150efd3482c7e5e3cb70087b95f0afd5 100644 (file)
@@ -59,6 +59,7 @@ module VISU {
     TSCALARMAP, /*!< Scalarmap 3D presentation object */
     TISOSURFACE, /*!< Iso surface 3D presentation object */
     TDEFORMEDSHAPE, /*!< Deformed shape 3D presentation object */
+    TSCALARMAPONDEFORMEDSHAPE, /*!< Scalar map on deformed shape 3D presentation object */
     TGAUSSPOINTS, /*!< Gauss Points 3D presentation object */
     TPLOT3D, /*!< Plot3D 3D presentation object */
     TCUTPLANES, /*!< Cut planes 3D presentation object */
@@ -567,6 +568,38 @@ module VISU {
     void SetColor(in SALOMEDS::Color theColor);
   };
 
+  //-------------------------------------------------------
+  /*! \brief Scalar Map on Deformed shape presentation interface
+   *
+   * Presentation parameters of the scalar map on deformed shape presentation.
+   */
+  interface ScalarMapOnDeformedShape : ScalarMap {
+    
+    /*!
+     * Sets the source ranges of pipeline
+     */
+    void SetSourceRange(in double theMinRange,in double theMaxRange);
+    /*!
+     * Gets the minimum source range of pipeline
+     */
+    double GetSourceRangeMin();
+    /*!
+     * Gets the maximum source range of pipeline
+     */
+    double GetSourceRangeMax();
+    
+    /*!
+     * Sets the scale of the presentatable object.
+     * \param theScale Double value defining the scale of this presentable object.
+     */
+    void SetScale(in double theScale);
+
+    /*!
+     * Gets the scale of the presentatable object.
+     */
+    double GetScale();
+
+  };
   //-------------------------------------------------------
   /*!
    *  \brief Plot3D interface
index 4e3aedae17fba0dcec94b305d51595acd74c8aa3..d2c013d9d1f5175230e5a7f9525006af2c803cde 100644 (file)
@@ -32,6 +32,7 @@
   <popup-item item-id="4018" pos-id="" label-id="Cut Lines" icon-id="Visu_cutlines.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
   <popup-item item-id="4016" pos-id="" label-id="Stream Lines" icon-id="Visu_streamlines.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
   <popup-item item-id="4017" pos-id="" label-id="Plot 3D" icon-id="Visu_plot3d.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
+  <popup-item item-id="4020" pos-id="" label-id="Scalar Map on Deformed Shape" icon-id="Visu_scalarmapondeformedshape.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
 </menu-item>
                        
 <!-- ************************* Selection (menubar) ************************************** -->
@@ -91,6 +92,7 @@
   <toolbutton-item item-id="4018" pos-id="" label-id="Cut Lines" icon-id="Visu_cutlines.png" tooltip-id="Cut Lines" accel-id="" toggle-id="" execute-action=""/>
   <toolbutton-item item-id="4016" pos-id="" label-id="Stream Lines" icon-id="Visu_streamlines.png" tooltip-id="Stream Lines" accel-id="" toggle-id="" execute-action=""/>
   <toolbutton-item item-id="4017" pos-id="" label-id="Plot 3D" icon-id="Visu_plot3d.png" tooltip-id="Plot 3D" accel-id="" toggle-id="" execute-action=""/>
+  <toolbutton-item item-id="4020" pos-id="" label-id="Scalar map on deformed shape" icon-id="Visu_scalarmapondeformedshape.png" tooltip-id="Scalar Map on Deformed Shape" accel-id="" toggle-id="" execute-action=""/>
 </toolbar>
 
 </desktop>      <!--   DESKTOP END    -->  
index b10a3084a55da5e9584b8f65b54209c6cbc8369c..7a3230b97a8484d5b8d878a17e28c1ae8c8354b7 100644 (file)
@@ -32,6 +32,7 @@
   <popup-item item-id="4018" pos-id="" label-id="Cut Lines" icon-id="Visu_cutlines.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
   <popup-item item-id="4016" pos-id="" label-id="Stream Lines" icon-id="Visu_streamlines.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
   <popup-item item-id="4017" pos-id="" label-id="Plot 3D" icon-id="Visu_plot3d.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
+  <popup-item item-id="4020" pos-id="" label-id="Scalar Map on Deformed Shape" icon-id="Visu_scalarmapondeformedshape.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
 </menu-item>
                        
 <!-- ************************* Selection (menubar) ************************************** -->
@@ -89,6 +90,7 @@
   <toolbutton-item item-id="4018" pos-id="" label-id="Cut Lines" icon-id="Visu_cutlines.png" tooltip-id="Cut Lines" accel-id="" toggle-id="" execute-action=""/>
   <toolbutton-item item-id="4016" pos-id="" label-id="Stream Lines" icon-id="Visu_streamlines.png" tooltip-id="Stream Lines" accel-id="" toggle-id="" execute-action=""/>
   <toolbutton-item item-id="4017" pos-id="" label-id="Plot 3D" icon-id="Visu_plot3d.png" tooltip-id="Plot 3D" accel-id="" toggle-id="" execute-action=""/>
+  <toolbutton-item item-id="4020" pos-id="" label-id="Scalar map on deformed shape" icon-id="Visu_scalarmapondeformedshape.png" tooltip-id="Scalar Map on Deformed Shape" accel-id="" toggle-id="" execute-action=""/>
 </toolbar>
 
 </desktop>      <!--   DESKTOP END    -->  
diff --git a/resources/Visu_scalarmapondeformedshape.png b/resources/Visu_scalarmapondeformedshape.png
new file mode 100644 (file)
index 0000000..29df093
Binary files /dev/null and b/resources/Visu_scalarmapondeformedshape.png differ
index cc97361b78b29eb8024a65fa72472040c9a864ca..8f775a803f74fa74dccd713f14cb07b61a2e9d19 100644 (file)
@@ -56,7 +56,8 @@ EXPORT_HEADERS = \
        VISU_ScalarBarCtrl.hxx \
        VISU_PlanesWidget.hxx \
        VISU_SphereWidget.hxx \
-       VISU_WidgetCtrl.hxx 
+       VISU_WidgetCtrl.hxx \
+       VISU_ScalarMapOnDeformedShapePL.hxx
 
 # Libraries targets
 
@@ -85,7 +86,8 @@ LIB_SRC = \
        VISU_PlanesWidget.cxx \
        VISU_SphereWidget.cxx \
        VISU_WidgetCtrl.cxx \
-       VISU_ScalarBarCtrl.cxx
+       VISU_ScalarBarCtrl.cxx \
+       VISU_ScalarMapOnDeformedShapePL.cxx
 
 # Executables targets
 
diff --git a/src/PIPELINE/VISU_ScalarMapOnDeformedShapePL.cxx b/src/PIPELINE/VISU_ScalarMapOnDeformedShapePL.cxx
new file mode 100644 (file)
index 0000000..0d0ccad
--- /dev/null
@@ -0,0 +1,239 @@
+//  VISU ScalarMapOnDeformedShapePL
+//
+//  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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+// File:    VISU_ScalarMapOnDeformedShapePL.cxx
+// Author:  Eugeny Nikolaev
+// Module : VISU
+
+#include "VISU_ScalarMapOnDeformedShapePL.hxx"
+#include "VISU_DeformedShapePL.hxx"
+#include "VISU_PipeLineUtils.hxx"
+#include "VTKViewer_TransformFilter.h"
+#include "VTKViewer_Transform.h"
+
+#include <vtkWarpVector.h>
+#include <vtkMergeFilter.h>
+#include <vtkUnstructuredGrid.h>
+#include <vtkCellDataToPointData.h>
+#include <vtkPointDataToCellData.h>
+
+#include <VISU_Convertor.hxx>
+
+vtkStandardNewMacro(VISU_ScalarMapOnDeformedShapePL)
+
+/*!
+ * Constructor. Creating new instances of vtkWarpVector,vtkMergeFilter,vtkUnstructuredGrid
+ * Where:
+ * \li myDeformVectors is vtkWarpVector  - deformation vectors data
+ * \li myMergeFilter   is vtkMergeFilter - merge filter.
+ * Merge filter which unify the deformation and scalars
+ * \li myScalars is vtk shared pointer to vtkUnstructuredGrid - scalars data
+*/
+VISU_ScalarMapOnDeformedShapePL::VISU_ScalarMapOnDeformedShapePL(){
+  myDeformVectors = vtkWarpVector::New();
+  myMergeFilter   = vtkMergeFilter::New();
+  myExtractorScalars = VISU_Extractor::New();
+  myCellDataToPointData = vtkCellDataToPointData::New();
+}
+
+/*!
+ * Destructor.
+ * Delete all fields.
+*/
+VISU_ScalarMapOnDeformedShapePL::~VISU_ScalarMapOnDeformedShapePL(){
+  myDeformVectors->UnRegisterAllOutputs();
+  myDeformVectors->Delete();
+
+  myMergeFilter->UnRegisterAllOutputs();
+  myMergeFilter->Delete();
+  
+  myExtractorScalars->UnRegisterAllOutputs();
+  myExtractorScalars->Delete();
+
+  myCellDataToPointData->UnRegisterAllOutputs();
+  myCellDataToPointData->Delete();
+}
+
+/*!
+ * Initial method
+ */
+void VISU_ScalarMapOnDeformedShapePL::Init(){
+
+  if (GetScalars() == NULL) SetScalars(GetInput2());
+  
+  Superclass::Init();
+  
+  float aScalarRange[2];
+  GetSourceRange(aScalarRange);
+  static double EPS = 1.0 / VTK_LARGE_FLOAT;
+  if(aScalarRange[1] > EPS)
+    SetScale(VISU_DeformedShapePL::GetScaleFactor(GetInput2())/aScalarRange[1]);
+  else
+    SetScale(0.0);
+
+  myMapper->SetColorModeToMapScalars();
+  myMapper->ScalarVisibilityOn();
+
+  // Sets input for field transformation filter
+  myFieldTransform->SetInput(myExtractor->GetOutput());
+
+}
+
+/*!
+ * Build method
+ * Building of deformation and puts result to merge filter.
+ */
+void VISU_ScalarMapOnDeformedShapePL::Build()
+{
+  // Set input for extractor
+  myExtractor->SetInput(GetInput2());
+  
+  VISU::CellDataToPoint(myDeformVectors,myCellDataToPointData,
+                       GetInput2(),myFieldTransform);
+  
+  // Sets geometry for merge filter
+  myMergeFilter->SetGeometry(myDeformVectors->GetOutput());
+  // Sets data to mapper
+  myMapper->SetInput(myMergeFilter->GetOutput());
+}
+
+/*!
+ *  Update method
+ */
+void VISU_ScalarMapOnDeformedShapePL::Update(){
+  this->UpdateScalars();
+  
+  float aRange[2];
+  GetSourceRange(aRange);
+  float aScalarRange[2] = {aRange[0], aRange[1]};
+  
+  if(myBarTable->GetScale() == VTK_SCALE_LOG10)
+    VISU_LookupTable::ComputeLogRange(aRange,aScalarRange);
+  myMapperTable->SetRange(aScalarRange);
+
+  myMapperTable->Build();
+  myBarTable->Build();
+
+  myMapper->SetLookupTable(myMapperTable);
+  myMapper->SetScalarRange(aScalarRange);
+  
+  VISU_PipeLine::Update();
+}
+
+/*!
+ * Update scalars method.
+ * Put scalars to merge filter.
+ */
+void VISU_ScalarMapOnDeformedShapePL::UpdateScalars(){
+  if(myScalars->GetCellData()->GetVectors() != NULL ||
+     myScalars->GetPointData()->GetVectors() != NULL)
+    myMergeFilter->SetScalars(myExtractorScalars->GetOutput());
+  else
+    myMergeFilter->SetScalars(GetScalars());
+}
+
+/*!
+ * Copy information about pipline.
+ * Copy scale and scalars.
+ */
+void VISU_ScalarMapOnDeformedShapePL::ShallowCopy(VISU_PipeLine *thePipeLine){
+  VISU_ScalarMapOnDeformedShapePL *aPipeLine = dynamic_cast<VISU_ScalarMapOnDeformedShapePL*>(thePipeLine);
+  if(aPipeLine){
+     SetScale(aPipeLine->GetScale());
+     SetScalars(aPipeLine->GetScalars());
+     float aRange[2];
+     aPipeLine->GetSourceRange(aRange);
+     SetScalarRange(aRange);
+  }
+  Superclass::ShallowCopy(thePipeLine);
+}
+
+/*!
+ * Set scalars.
+ * Sets vtkDataSet with scalars values to VISU_Extractor filter for scalars extraction.
+ */
+void VISU_ScalarMapOnDeformedShapePL::SetScalars(vtkDataSet *theScalars){
+  myScalars = theScalars;
+  vtkUnstructuredGrid* aScalars = GetScalars();
+  myExtractorScalars->SetInput(aScalars);
+  Modified();
+}
+
+/*!
+ * Get pointer to input scalars.
+ */
+vtkUnstructuredGrid* VISU_ScalarMapOnDeformedShapePL::GetScalars(){
+  return myScalars.GetPointer();
+}
+
+/*!
+ * Sets scale for deformed shape
+ */
+void VISU_ScalarMapOnDeformedShapePL::SetScale(float theScale) {
+  if(myScaleFactor == theScale) return;
+  myScaleFactor = theScale;
+  myDeformVectors->SetScaleFactor(myScaleFactor);
+  Modified();
+}
+
+/*!
+ * Gets scale of deformed shape.
+ */
+float VISU_ScalarMapOnDeformedShapePL::GetScale() {
+  float aScale=myDeformVectors->GetScaleFactor();
+  return aScale;
+}
+
+/*!
+ * Set scale factor of deformation.
+ */
+void VISU_ScalarMapOnDeformedShapePL::SetMapScale(float theMapScale){
+  myDeformVectors->SetScaleFactor(myScaleFactor*theMapScale);
+  Modified();
+}
+
+/*!
+ * Gets scalar mode.
+ */
+int VISU_ScalarMapOnDeformedShapePL::GetScalarMode(){
+  int aMode=myExtractorScalars->GetScalarMode();
+  return aMode;
+}
+
+/*!
+ * Sets scalar mode.
+ */
+void VISU_ScalarMapOnDeformedShapePL::SetScalarMode(int theScalarMode){
+  myExtractorScalars->SetScalarMode(theScalarMode);
+  Modified();
+}
+
+/*!
+ * Gets ranges of extracted scalars
+ * \param theRange[2] - output values
+ * \li theRange[0] - minimum value
+ * \li theRange[1] - maximum value
+ */
+void VISU_ScalarMapOnDeformedShapePL::GetSourceRange(float theRange[2]){
+  myExtractorScalars->Update();
+  myExtractorScalars->GetUnstructuredGridOutput()->GetScalarRange(theRange);
+}
diff --git a/src/PIPELINE/VISU_ScalarMapOnDeformedShapePL.hxx b/src/PIPELINE/VISU_ScalarMapOnDeformedShapePL.hxx
new file mode 100644 (file)
index 0000000..6d1ccf9
--- /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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+//
+//
+// File:    VISU_ScalarMapOnDeformedShapePL.hxx
+// Author:  Eugeny Nikolaev
+// Module : VISU
+
+#ifndef VISU_ScalarMapOnDeformedShapePL_HeaderFile
+#define VISU_ScalarMapOnDeformedShapePL_HeaderFile
+
+#include "VISU_ScalarMapPL.hxx"
+
+class vtkMergeFilter;
+class vtkWarpVector;
+class vtkUnstructuredGrid;
+class vtkCellDataToPointData;
+class vtkPointDataToCellData;
+
+class VISU_ScalarMapOnDeformedShapePL : public VISU_ScalarMapPL
+{
+protected:
+  VISU_ScalarMapOnDeformedShapePL();
+  
+  virtual ~VISU_ScalarMapOnDeformedShapePL();
+  
+  VISU_ScalarMapOnDeformedShapePL(const VISU_ScalarMapOnDeformedShapePL&);
+public:
+  vtkTypeMacro(VISU_ScalarMapOnDeformedShapePL,VISU_ScalarMapPL);
+
+  static VISU_ScalarMapOnDeformedShapePL* New();
+
+  virtual void ShallowCopy(VISU_PipeLine *thePipeLine);
+
+  virtual void SetScale(float theScale);
+  virtual float GetScale();
+
+  virtual int GetScalarMode();
+  virtual void SetScalarMode(int theScalarMode = 0);
+
+  virtual void GetSourceRange(float theRange[2]);
+
+  virtual void SetScalars(vtkDataSet *theScalars);
+  virtual vtkUnstructuredGrid* GetScalars();
+
+public:
+  //! Redefined method for initialization of the pipeline.
+  virtual
+  void
+  Init();
+
+  //! Redefined method for building the pipeline.
+  virtual
+  void
+  Build();
+
+  //! Redefined method for updating the pipeline.
+  virtual
+  void
+  Update();
+
+  //! Update scalars.
+  void
+  UpdateScalars();
+  
+  virtual void SetMapScale(float theMapScale = 1.0);
+  
+protected:
+  float myScaleFactor;
+  vtkWarpVector  *myDeformVectors;
+  vtkMergeFilter *myMergeFilter;
+  vtkSmartPointer<vtkUnstructuredGrid> myScalars;
+  VISU_Extractor* myExtractorScalars;
+  vtkCellDataToPointData* myCellDataToPointData;
+};
+
+#endif
index cb4e7176d78008421ee9cb535458b15edc3562bd..1c2f20f1a0ccf5c4d08d4660ef354f765ca299ea 100644 (file)
@@ -71,6 +71,7 @@ LIB_SRC =     VisuGUI.cxx \
                VisuGUI_StreamLinesDlg.cxx \
                VisuGUI_VectorsDlg.cxx \
                VisuGUI_Displayer.cxx \
+               VisuGUI_ScalarMapOnDeformedShapeDlg.cxx \
                VisuGUI_SetupPlot2dDlg.cxx \
                VisuGUI_BuildProgressDlg.cxx \
                VisuGUI_TransparencyDlg.cxx \
@@ -96,6 +97,7 @@ LIB_MOC =     VisuGUI.h \
                VisuGUI_CutPlanesDlg.h \
                VisuGUI_StreamLinesDlg.h \
                VisuGUI_VectorsDlg.h \
+               VisuGUI_ScalarMapOnDeformedShapeDlg.h \
                VisuGUI_SetupPlot2dDlg.h \
                VisuGUI_BuildProgressDlg.h \
                VisuGUI_TransparencyDlg.h
index 4422d48d72d76401057e6df1f019ce8ba41daf37..525994aa14c6852ccf86b93822bfaa6fceab325d 100644 (file)
@@ -42,6 +42,9 @@ msgstr "Visu_scalars.png"
 msgid "ICON_DEFORMED_SHAPE"
 msgstr "Visu_deformed.png"
 
+msgid "ICON_SCALAR_MAP_ON_DEFORMED_SHAPE"
+msgstr "Visu_scalarmapondeformedshape.png"
+
 msgid "ICON_VECTORS"
 msgstr "Visu_vectors.png"
 
index 0f7909b97036ba398f078ec58fda61c0580db251..7357d06ad1b182d654982454dc64b9cfaa24abd5 100644 (file)
@@ -42,6 +42,9 @@ msgstr "Visu_scalars.png"
 msgid "ICON_DEFORMED_SHAPE"
 msgstr "Visu_deformed.png"
 
+msgid "ICON_SCALAR_MAP_ON_DEFORMED_SHAPE"
+msgstr "Visu_scalarmapondeformedshape.png"
+
 msgid "ICON_VECTORS"
 msgstr "Visu_vectors.png"
 
index e25236e9b117a1410c83e06f6b9e53f6a8e6cbd6..0cd7807bb5eae8b6cc376926f8099c13a23b05c7 100644 (file)
@@ -178,6 +178,9 @@ msgstr "Scalar Map"
 msgid "VisuGUI::MEN_DEFORMED_SHAPE"
 msgstr "Deformed Shape"
 
+msgid "VisuGUI::MEN_SCALAR_MAP_ON_DEFORMED_SHAPE"
+msgstr "Scalar Map on Deformed Shape"
+
 msgid "VisuGUI::MEN_VISUALIZATION"
 msgstr "Visualization"
 
@@ -555,6 +558,32 @@ msgid "VisuGUI_DeformedShapeDlg::SCALE_FACTOR"
 msgstr "Scale Factor:"
 
 
+#: VisuGUI_ScalarMapOnDeformedShapeDlg.cxx
+
+msgid "VisuGUI_ScalarMapOnDeformedShapeDlg::DLG_TITLE"
+msgstr "Scalar Map on Deformed Shape"
+
+msgid "VisuGUI_ScalarMapOnDeformedShapeDlg::&Cancel"
+msgstr ""
+
+msgid "VisuGUI_ScalarMapOnDeformedShapeDlg::&OK"
+msgstr ""
+
+msgid "VisuGUI_ScalarMapOnDeformedShapeDlg::SCALAR_MAP_ON_DEFORMED_SHAPE_TAB"
+msgstr "Scalar Map on Deformed Shape"
+                                            
+msgid "VisuGUI_ScalarMapOnDeformedShapeDlg::SCALAR_BAR_TAB"
+msgstr "Scalar Bar"
+
+msgid "VisuGUI_ScalarMapOnDeformedShapeDlg::SCALE_FACTOR"
+msgstr "Scale Factor:"
+
+msgid "VisuGUI_ScalarMapOnDeformedShapeDlg::FIELD_ITEM"
+msgstr "Fields"
+
+msgid "VisuGUI_ScalarMapOnDeformedShapeDlg::TIMESTAMP_ITEM"
+msgstr "Time stamp"
+
 #: VisuGUI_EditContainerDlg.cxx
 
 msgid "VisuGUI_EditContainerDlg::&Cancel"
index 0c935ffadefcf88dd4bac939f16f1b57bdd44c01..f59460c8e0fde02dab29521691116725a4be7432 100644 (file)
 #include "VISU_DeformedShape_i.hh"
 #include "VisuGUI_DeformedShapeDlg.h"
 
+#include "VISU_ScalarMapOnDeformedShape_i.hh"
+#include "VisuGUI_ScalarMapOnDeformedShapeDlg.h"
+
 #include "VISU_IsoSurfaces_i.hh"
 #include "VisuGUI_IsoSurfacesDlg.h"
 
@@ -514,6 +517,13 @@ OnCreateDeformedShape()
   CreatePrs3d<VISU::DeformedShape_i,VisuGUI_DeformedShapeDlg,1>(this);
 }
 
+void
+VisuGUI::
+OnCreateScalarMapOnDeformedShape()
+{
+  CreatePrs3d<VISU::ScalarMapOnDeformedShape_i,VisuGUI_ScalarMapOnDeformedShapeDlg,1>(this);
+}
+
 void
 VisuGUI::
 OnCreateVectors()
@@ -699,6 +709,18 @@ OnEditDeformedShape()
   }
 }
 
+void
+VisuGUI::
+OnEditScalarMapOnDeformedShape()
+{
+  Handle(SALOME_InteractiveObject) anIO;
+  if(VISU::Prs3d_i* aPrs3d = GetPrsToModify(this,&anIO)){
+    EditPrs3d<VISU::ScalarMapOnDeformedShape_i, VisuGUI_ScalarMapOnDeformedShapeDlg,1>(this, aPrs3d);
+    if(SVTK_ViewWindow* aViewWindow = GetViewWindow()){
+      aViewWindow->highlight(anIO, 1);
+    }
+  }
+}
 
 void
 VisuGUI::
@@ -1690,6 +1712,14 @@ OnCopyPresentation()
       UpdateViewer(this, aSameDeformed);
     }
     break;
+  case VISU::TSCALARMAPONDEFORMEDSHAPE:
+    {
+      VISU::ScalarMapOnDeformedShape_i* aDefPrs = dynamic_cast<VISU::ScalarMapOnDeformedShape_i*>(aPrsObject);
+      VISU::ScalarMapOnDeformedShape_i* aSameScalarMapOnDeformed = new VISU::ScalarMapOnDeformedShape_i(aDefPrs->GetResult(),true);
+      aSameScalarMapOnDeformed->SameAs(aDefPrs);
+      UpdateViewer(this, aSameScalarMapOnDeformed);
+    }
+    break;
   case VISU::TCUTPLANES:
     {
       VISU::CutPlanes_i* aCutPrs = dynamic_cast<VISU::CutPlanes_i*>(aPrsObject);
@@ -1948,6 +1978,11 @@ createActions()
                 tr("MEN_DEFORMED_SHAPE"), "", 0, aParent, false,
                 this, SLOT(OnCreateDeformedShape()));
 
+  aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_SCALAR_MAP_ON_DEFORMED_SHAPE"));
+  createAction( VISU_SCALAR_MAP_ON_DEFORMED_SHAPE, tr("MEN_SCALAR_MAP_ON_DEFORMED_SHAPE"), QIconSet(aPixmap),
+                tr("MEN_SCALAR_MAP_ON_DEFORMED_SHAPE"), "", 0, aParent, false,
+                this, SLOT(OnCreateScalarMapOnDeformedShape()));
+
   aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_VECTORS"));
   createAction( VISU_VECTORS, tr("MEN_VECTORS"), QIconSet(aPixmap),
                 tr("MEN_VECTORS"), "", 0, aParent, false,
@@ -2173,6 +2208,10 @@ createActions()
                 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
                 this, SLOT(OnEditPlot3D()));
 
+  createAction( VISU_EDIT_SCALARMAPONDEFORMEDSHAPE, tr("MEN_EDIT_PRS"), QIconSet(),
+                tr("MEN_EDIT_PRS"), "", 0, aParent, false,
+                this, SLOT(OnEditScalarMapOnDeformedShape()));
+
 
   createAction( VISU_CREATE_TABLE, tr("MEN_CREATE_TABLE"), QIconSet(),
                 tr("MEN_CREATE_TABLE"), "", 0, aParent, false,
@@ -2239,6 +2278,7 @@ createMenus()
   createMenu( VISU_CUT_LINES, aMenuId, 10 ); // cut lines
   createMenu( VISU_STREAM_LINES, aMenuId, 10 ); // stream lines
   createMenu( VISU_PLOT_3D, aMenuId, 10 ); // Plot3d
+  createMenu( VISU_SCALAR_MAP_ON_DEFORMED_SHAPE, aMenuId, 10 ); // scalar map on deformed shape
 
   aMenuId = createMenu( tr( "MEN_SELECTION" ), -1, -1, 30 );
   createMenu( VISU_SELECTION_INFO, aMenuId, 10 ); // selection info
@@ -2267,6 +2307,7 @@ createToolBars()
   createTool( VISU_CUT_LINES, aToolId );
   createTool( VISU_STREAM_LINES, aToolId );
   createTool( VISU_PLOT_3D, aToolId );
+  createTool( VISU_SCALAR_MAP_ON_DEFORMED_SHAPE, aToolId );
 
   aToolId = createTool(tr("TOOL_REPRESENTATION"));
   createTool( VISU_POINTS, aToolId );
@@ -2300,6 +2341,7 @@ createPopupMenus()
   mgr->insert( action( VISU_VECTORS ), -1, -1, -1 ); // vectors
   mgr->insert( action( VISU_STREAM_LINES ), -1, -1, -1 ); // stream lines
   mgr->insert( action( VISU_PLOT_3D ), -1, -1, -1 ); // Plot3d
+  mgr->insert( action( VISU_SCALAR_MAP_ON_DEFORMED_SHAPE ), -1, -1, -1 ); // scalar map on deformed shape
 
   mgr->insert( action( VISU_CREATE_PRS ), -1, -1, -1 ); // create presentation
   mgr->insert( action( VISU_CREATE_MANY_PRS ), -1, -1, -1 ); // create presentations
@@ -2315,6 +2357,7 @@ createPopupMenus()
   mgr->insert( action( VISU_EDIT_VECTORS ), -1, -1, -1 );
   mgr->insert( action( VISU_EDIT_STREAMLINES ), -1, -1, -1 );
   mgr->insert( action( VISU_EDIT_PLOT3D ), -1, -1, -1 );
+  mgr->insert( action( VISU_EDIT_SCALARMAPONDEFORMEDSHAPE ), -1, -1, -1 );
   mgr->insert( action( VISU_EDIT_CONTAINER ), -1, -1, -1 );
 
   // rename
@@ -2387,7 +2430,7 @@ createPopupMenus()
   // Rules
 
   QString aPrsAll ("'VISU::TSCALARMAP' 'VISU::TISOSURFACE' 'VISU::TDEFORMEDSHAPE' 'VISU::TCUTPLANES' "
-                   "'VISU::TCUTLINES' 'VISU::TVECTORS' 'VISU::TSTREAMLINES' 'VISU::TPLOT3D'");
+                   "'VISU::TCUTLINES' 'VISU::TVECTORS' 'VISU::TSTREAMLINES' 'VISU::TPLOT3D' 'VISU::TSCALARMAPONDEFORMEDSHAPE'");
 
   // VISU root commands
   QString aRule = "client='ObjectBrowser' and selcount=1 and type='VISU::TVISUGEN'";
@@ -2406,6 +2449,7 @@ createPopupMenus()
   mgr->setRule( action( VISU_DEFORMED_SHAPE ), aRule, true );
   mgr->setRule( action( VISU_VECTORS ), aRule, true );
   mgr->setRule( action( VISU_STREAM_LINES ), aRule, true );
+  mgr->setRule( action( VISU_SCALAR_MAP_ON_DEFORMED_SHAPE ), aRule, true );
 
   // display/erase commands
   QString andInvisible = " and (((not isVisible) and isActiveView) or (not isActiveView))";
@@ -2451,9 +2495,9 @@ createPopupMenus()
   QString aInsideType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TDEFORMEDSHAPE'}";
   QString aSurfType   = " and $type in {'VISU::TMESH'}";
   QString aShrinkType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TISOSURFACE' "
-                        "'VISU::TDEFORMEDSHAPE' 'VISU::TCUTPLANES' 'VISU::TCUTLINES' 'VISU::TPLOT3D'}";
+                        "'VISU::TDEFORMEDSHAPE' 'VISU::TCUTPLANES' 'VISU::TCUTLINES' 'VISU::TPLOT3D' 'VISU::TSCALARMAPONDEFORMEDSHAPE'}";
   QString aLineType   = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TISOSURFACE' 'VISU::TDEFORMEDSHAPE' "
-                        "'VISU::TCUTPLANES' 'VISU::TCUTLINES' 'VISU::TSTREAMLINES' 'VISU::TPLOT3D'}";
+                        "'VISU::TCUTPLANES' 'VISU::TCUTLINES' 'VISU::TSTREAMLINES' 'VISU::TPLOT3D' 'VISU::TSCALARMAPONDEFORMEDSHAPE' }";
 
   aRule = "selcount=1";
   mgr->setRule( action( VISU_CLIPPING ), aRule + aPrsType, true );
@@ -2509,6 +2553,8 @@ createPopupMenus()
                "selcount=1 and type='VISU::TSCALARMAP'", true );
   mgr->setRule( action( VISU_EDIT_DEFORMEDSHAPE ),
                "selcount=1 and type='VISU::TDEFORMEDSHAPE'", true );
+  mgr->setRule( action( VISU_EDIT_SCALARMAPONDEFORMEDSHAPE ),
+               "selcount=1 and type='VISU::TSCALARMAPONDEFORMEDSHAPE'", true );
   mgr->setRule( action( VISU_EDIT_CUTPLANES ),
                "selcount=1 and type='VISU::TCUTPLANES'", true );
   mgr->setRule( action( VISU_EDIT_CUTLINES ),
index 411b0bfc82323cfdf3f7104397db48cb07d5e983..22224d7210d7608406d357093d50ab3c6a70dc9f 100644 (file)
@@ -97,6 +97,7 @@ protected slots:
   void OnCreatePlot3D();
   void OnCreateManyMesh();
   void OnCreatePlot2dView();
+  void OnCreateScalarMapOnDeformedShape();
 
   void OnEditScalarMap();
   void OnEditDeformedShape();
@@ -106,6 +107,7 @@ protected slots:
   void OnEditVectors();
   void OnEditStreamLines();
   void OnEditPlot3D();
+  void OnEditScalarMapOnDeformedShape();
 
   virtual void OnDisplayPrs();
   virtual void OnDisplayOnlyPrs();
index 923247d8e0849107aace7ce5a2449fa9138eec5e..1fe7a7b2b1506fe94bfd8674032cc18307d967b1 100644 (file)
@@ -40,6 +40,7 @@
 #define VISU_CUT_LINES              4017
 #define VISU_PLOT2D                 4018
 #define VISU_PLOT_3D                4019
+#define VISU_SCALAR_MAP_ON_DEFORMED_SHAPE 40110
 
 //#define VISU_DELETE                 4021
 #define VISU_DELETE_OBJS            4022
@@ -91,6 +92,7 @@
 #define VISU_EDIT_VECTORS           40625
 #define VISU_EDIT_STREAMLINES       40626
 #define VISU_EDIT_PLOT3D            40627
+#define VISU_EDIT_SCALARMAPONDEFORMEDSHAPE     40628
 
 #define VISU_EDIT_PRS               4062
 #define VISU_CREATE_TABLE           4063
index ef22f15454a23232ed99003694b996e019cb0793..b4ca7c2079eda64b23b1b2c1fd0852084e1bacec 100644 (file)
@@ -92,6 +92,7 @@ QString VisuGUI_Selection::type( const int ind ) const
       ENUM2STRING( aResStr, VISU::TSCALARMAP );
       ENUM2STRING( aResStr, VISU::TISOSURFACE );
       ENUM2STRING( aResStr, VISU::TDEFORMEDSHAPE );
+      ENUM2STRING( aResStr, VISU::TSCALARMAPONDEFORMEDSHAPE );
       ENUM2STRING( aResStr, VISU::TCUTPLANES );
       ENUM2STRING( aResStr, VISU::TCUTLINES );
       ENUM2STRING( aResStr, VISU::TVECTORS );
index 9e811e47fe89f97e3c71db13d151e41352a9fc06..fa9da21b719e9eb7f468342329c8e61eb47781c7 100644 (file)
@@ -909,6 +909,14 @@ void VisuGUI_ScalarBarPane::setRange( double imin, double imax/*, double fmin, d
   changeRange( 0 );
 }
 
+/*!
+  Sets default values and range mode
+*/
+void VisuGUI_ScalarBarPane::setDefaultRange(double imin, double imax){
+  Rmin = imin;
+  Rmax = imax;
+}
+
 /*!
   Sets size and position
 */
index f68b0f428f444b639b565d645bc4bc3468242b9e..cec542c6ecaa630e2f6c5ba40be7ab05cf731391 100644 (file)
@@ -95,6 +95,7 @@ class VisuGUI_ScalarBarPane : public QVBox
   ~VisuGUI_ScalarBarPane() {};
 
   void    setRange( double imin, double imax, /*double fmin, double fmax,*/ bool sbRange );
+  void    setDefaultRange(double imin, double imax);
   bool    isIRange() {return RBIrange->isChecked();}
   double  getMin() {return MinEdit->text().toDouble();}
   double  getMax() {return MaxEdit->text().toDouble();}
diff --git a/src/VISUGUI/VisuGUI_ScalarMapOnDeformedShapeDlg.cxx b/src/VISUGUI/VisuGUI_ScalarMapOnDeformedShapeDlg.cxx
new file mode 100644 (file)
index 0000000..95e1319
--- /dev/null
@@ -0,0 +1,380 @@
+//  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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//
+//  File   : VisuGUI_ScalarMapOnDeformedShapeDlg.cxx
+//  Author : Eugeny Nikolaev
+//  Module : VISU
+
+#include "VisuGUI_ScalarMapOnDeformedShapeDlg.h"
+#include "VisuGUI_Tools.h"
+#include "VISU_ScalarMapOnDeformedShape_i.hh"
+#include "VISU_ScalarMapOnDeformedShapePL.hxx"
+#include "SalomeApp_Module.h"
+#include "LightApp_SelectionMgr.h"
+#include "SUIT_Desktop.h"
+#include "VISU_ScalarMapPL.hxx"
+
+#include "SALOME_ListIO.hxx"
+
+#include "VISU_Convertor.hxx"
+
+#include "SALOMEDSClient_AttributeComment.hxx"
+#include "SALOMEDSClient_AttributeName.hxx"
+
+#include <qlayout.h>
+#include <qtabwidget.h>
+
+using namespace std;
+
+#define MYDEBUG 0
+
+/*!
+ * Constructor
+ */
+VisuGUI_ScalarMapOnDeformedShapeDlg::VisuGUI_ScalarMapOnDeformedShapeDlg (SalomeApp_Module* theModule)
+    : QDialog(VISU::GetDesktop(theModule), "VisuGUI_ScalarMapOnDeformedShapeDlg", false,
+              WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu),
+      myVisuGUI(theModule)
+{
+  myPrs = NULL;
+  setCaption(tr("DLG_TITLE"));
+  setSizeGripEnabled(TRUE);
+
+  QVBoxLayout* TopLayout = new QVBoxLayout (this);
+  TopLayout->setSpacing(6);
+  TopLayout->setMargin(11);
+
+  QTabWidget* aTabBox = new QTabWidget (this);
+
+  // Scalar Map on Deformed shape pane
+  QVBox* aBox = new QVBox (this);
+  aBox->setMargin(11);
+  QFrame* TopGroup = new QFrame (aBox, "TopGroup");
+  TopGroup->setFrameStyle(QFrame::Box | QFrame::Sunken);
+  TopGroup->setLineWidth(1);
+  QGridLayout* TopGroupLayout = new QGridLayout (TopGroup);
+  TopGroupLayout->setAlignment(Qt::AlignTop | Qt::AlignCenter);
+  TopGroupLayout->setSpacing(6);
+  TopGroupLayout->setMargin(11);
+
+  //   Scale factor
+  QLabel* ScaleLabel = new QLabel (tr("SCALE_FACTOR"), TopGroup, "ScaleLabel");
+  TopGroupLayout->addWidget(ScaleLabel, 0, 0);
+
+  ScalFact = new QtxDblSpinBox (0.0, 1.0E+38, 0.1, TopGroup);
+  ScalFact->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed));
+  ScalFact->setPrecision(5);
+  ScalFact->setValue(0.1);
+  TopGroupLayout->addWidget(ScalFact, 0, 1);
+
+  // Fields combo box
+  QLabel* FieldLabel = new QLabel (tr("FIELD_ITEM"), TopGroup, "FieldLabel");
+  myFieldsCombo = new QComboBox (TopGroup,"Fields");
+
+  TopGroupLayout->addWidget(FieldLabel, 1, 0);
+  TopGroupLayout->addWidget(myFieldsCombo,1,1);
+  
+  // TimeStamps combo box
+  QLabel* TimeStampLabel = new QLabel (tr("TIMESTAMP_ITEM"), TopGroup, "TimeStampLabel");
+  myTimeStampsCombo = new QComboBox (TopGroup,"TimeStamp");
+
+  TopGroupLayout->addWidget(TimeStampLabel, 2, 0);
+  TopGroupLayout->addWidget(myTimeStampsCombo,2,1);
+  
+  //
+  aTabBox->addTab(aBox, tr("SCALAR_MAP_ON_DEFORMED_SHAPE_TAB"));
+
+  // Scalar bar pane
+  myScalarPane = new VisuGUI_ScalarBarPane (this, false);
+  myScalarPane->setMargin(5);
+
+  aTabBox->addTab(myScalarPane, tr("SCALAR_BAR_TAB"));
+
+  // Buttons
+  QGroupBox* GroupButtons = new QGroupBox (this, "GroupButtons");
+  GroupButtons->setGeometry(QRect(10, 10, 281, 48));
+  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);
+
+  // Add Tab box and Buttons to the top layout
+  TopLayout->addWidget(aTabBox);
+  TopLayout->addWidget(GroupButtons);
+
+  // signals and slots connections
+  connect(buttonOk,     SIGNAL(clicked()), this, SLOT(accept()));
+  connect(buttonCancel, SIGNAL(clicked()), this, SLOT(reject()));
+  connect(myFieldsCombo,     SIGNAL(activated(int)), this, SLOT(onFieldChanged(int)));
+  connect(myTimeStampsCombo, SIGNAL(activated(int)), this, SLOT(onTimeStampChanged(int)));
+  
+}
+
+void VisuGUI_ScalarMapOnDeformedShapeDlg::initFromPrsObject (VISU::ScalarMapOnDeformedShape_i* thePrs,bool isAnim)
+{
+  myPrs = thePrs;
+
+  setFactor(thePrs->GetScale());
+  myTimeStampsCombo->setDisabled(isAnim);
+  
+  QString aFieldName(thePrs->GetScalarFieldName());
+  float aIterFloat = GetFloatValueOfTimeStamp(thePrs->GetScalarIteration());
+  QString aIteration(QString("%1").arg(aIterFloat));
+  
+  if (myMeshFieldsTimes.size() == 0)
+  {
+    // find all fields and time stamps on it
+    _PTR(Study) aActiveStudy = VISU::GetCStudy(VISU::GetAppStudy(myVisuGUI));
+    LightApp_SelectionMgr* aSel = VISU::GetSelectionMgr(myVisuGUI);
+    SALOME_ListIO selected;
+    aSel->selectedObjects(selected);
+    if (selected.Extent() > 0) {
+      Handle(SALOME_InteractiveObject) aIO = selected.First();
+      if (aIO->hasEntry()) {
+       _PTR(SObject) aSObject = aActiveStudy->FindObjectID(aIO->getEntry());
+       aSObject = aSObject->GetFather();
+       aSObject = aSObject->GetFather();
+       aSObject = aSObject->GetFather();
+       aSObject = aSObject->GetFather();
+       mySelectionObj = aSObject;
+       CORBA::Object_var anObject = VISU::ClientSObjectToObject(mySelectionObj);
+       VISU::Result_var aResult;
+       if (CORBA::is_nil(anObject)) {
+         mySelectionObj = mySelectionObj->GetFather();
+       }
+       _PTR(ChildIterator) aIter = aActiveStudy->NewChildIterator(mySelectionObj);
+       
+       for (aIter->InitEx(true); aIter->More(); aIter->Next()) {
+         _PTR(SObject) aChildSObj = aIter->Value();
+         CORBA::Object_var aChildObject = VISU::ClientSObjectToObject(aChildSObj);
+         
+         _PTR(GenericAttribute) anAttr;
+         if (aChildSObj->FindAttribute(anAttr, "AttributeComment")) {
+           _PTR(AttributeComment) aComment (anAttr);
+           string aComm = aComment->Value();
+           QString strIn (aComm.c_str());
+           VISU::Storable::TRestoringMap aMap;
+           VISU::Storable::StrToMap(strIn,aMap);
+           bool isExist;
+           VISU::VISUType aType = (VISU::VISUType)VISU::Storable::FindValue(aMap,"myType",&isExist).toInt();
+           if (isExist) {
+             if ((aType == VISU::TTIMESTAMP)) {
+               _PTR(GenericAttribute) aNameAttr;
+               if (aChildSObj->FindAttribute(aNameAttr, "AttributeName")) {
+                 _PTR(AttributeName) aName (aNameAttr);
+                 VISU::Prs3d_var aPrsObj = VISU::Prs3d::_narrow(aChildObject);
+                 QString aMeshName  = VISU::getValue(aChildSObj,"myMeshName");
+                 if(QString(thePrs->GetMeshName().c_str()) != aMeshName) continue;
+                 myCurrMeshName = aMeshName;
+                 QString aFieldName = VISU::getValue(aChildSObj,"myFieldName");
+                 QString aTimeIter  = VISU::getValue(aChildSObj,"myTimeStampId");
+                 QString aEntity    = VISU::getValue(aChildSObj,"myEntityId");
+                 VISU::TEntity anEntity;
+                 switch(aEntity.toInt()){
+                 case 0: anEntity = VISU::NODE_ENTITY; break;
+                 case 1: anEntity = VISU::EDGE_ENTITY; break;
+                 case 2: anEntity = VISU::FACE_ENTITY; break;
+                 case 3: anEntity = VISU::CELL_ENTITY; break;
+                 }
+                 TFT &aFieldsMap = myMeshFieldsTimes[aMeshName.latin1()];
+                 TFE aKey(aFieldName.latin1(),anEntity);
+                 aFieldsMap[aKey][aTimeIter.toInt()] = GetFloatValueOfTimeStamp(aTimeIter.toInt());
+               }
+             }
+           }
+         }
+       }
+      }
+    }
+    
+    AddAllFieldNames();
+
+  }
+  myFieldsCombo->setCurrentText(aFieldName);
+  AddAllTimes(myFieldsCombo->currentText());
+  myTimeStampsCombo->setCurrentText(aIteration);
+  SetScalarField();
+
+  myScalarPane->initFromPrsObject(myPrs);
+}
+
+int VisuGUI_ScalarMapOnDeformedShapeDlg::storeToPrsObject(VISU::ScalarMapOnDeformedShape_i* thePrs, bool theUpdateScalar) {
+
+  thePrs->SetScale(getFactor());
+  
+  thePrs->SetScalarField(myPrs->GetScalarMeshName().c_str(),
+                        myPrs->GetScalarFieldName().c_str(),
+                        myPrs->GetScalarIteration(),
+                        myPrs->GetScalarEntity());
+
+  if (theUpdateScalar) SetScalarField();
+
+  thePrs->ShowColored(true);
+
+  myScalarPane->storeToPrsObject(thePrs);
+  
+  myPrs = thePrs;
+
+  return 1;
+}
+
+int VisuGUI_ScalarMapOnDeformedShapeDlg::getCurrentScalarFieldNamePos(){
+  return myFieldsCombo->currentItem();
+}
+
+QString VisuGUI_ScalarMapOnDeformedShapeDlg::getCurrentScalarFieldName(){
+  return myFieldsCombo->currentText();
+}
+
+int VisuGUI_ScalarMapOnDeformedShapeDlg::getCurrentScalarNbIterations(){
+  return myTimeStampsCombo->count();
+}
+
+VISU::TEntity VisuGUI_ScalarMapOnDeformedShapeDlg::getCurrentScalarEntity(){
+  VISU::TEntity anEntity;
+  TFT::const_iterator aIterField = myMeshFieldsTimes[myCurrMeshName].begin();
+  for(;aIterField != myMeshFieldsTimes[myCurrMeshName].end();aIterField++){
+    if (aIterField->first.first == myFieldsCombo->currentText()){
+      anEntity = aIterField->first.second;
+      break;
+    }
+  }
+  return anEntity;
+}
+
+void VisuGUI_ScalarMapOnDeformedShapeDlg::SetScalarField(){
+  SetScalarField(myTimeStampsCombo->currentItem()+1);
+}
+
+void VisuGUI_ScalarMapOnDeformedShapeDlg::SetScalarField(int theIter,QString theFieldName){
+
+  QString aFieldName;
+
+  if(theFieldName.isEmpty())
+    aFieldName = myFieldsCombo->currentText();
+  else
+    aFieldName = theFieldName;
+
+  VISU::TEntity anEntity = getCurrentScalarEntity();
+
+  myPrs->SetScalarField(myCurrMeshName.latin1(),
+                       aFieldName.latin1(),
+                       theIter,
+                       anEntity);
+  
+  myScalarPane->storeToPrsObject(myPrs);
+  
+  UpdateScalarField();
+}
+
+void VisuGUI_ScalarMapOnDeformedShapeDlg::accept()
+{
+  if (myScalarPane->check()){
+    myScalarPane->deletePreview();
+    QDialog::accept();
+  }
+}
+
+void VisuGUI_ScalarMapOnDeformedShapeDlg::reject()
+{
+  myScalarPane->deletePreview();
+  QDialog::reject();
+}
+
+void VisuGUI_ScalarMapOnDeformedShapeDlg::AddAllFieldNames(){
+  TMF::const_iterator aIterMesh = myMeshFieldsTimes.begin();
+  for(;aIterMesh != myMeshFieldsTimes.end();aIterMesh++){
+    QString aMeshName = aIterMesh->first;
+    TFT::const_iterator aIterField = (aIterMesh->second).begin();
+    for(;aIterField != (aIterMesh->second).end(); aIterField++){
+      QString aFieldName = aIterField->first.first;
+      myFieldsCombo->insertItem(aFieldName);
+    }
+  }
+}
+
+void VisuGUI_ScalarMapOnDeformedShapeDlg::AddAllTimes(const QString& theFieldName){
+  TMF::const_iterator aIterMesh = myMeshFieldsTimes.begin();
+  for(;aIterMesh != myMeshFieldsTimes.end();aIterMesh++){
+    QString aMeshName = aIterMesh->first;
+    TFT::const_iterator aIterField = (aIterMesh->second).begin();
+    for(;aIterField != (aIterMesh->second).end(); aIterField++){
+      QString aFieldName = aIterField->first.first;
+      if(theFieldName != aFieldName) continue;
+      myTimeStampsCombo->clear();
+      TTL::const_iterator aTimeIter = (aIterField->second).begin();
+      for(;aTimeIter != (aIterField->second).end(); aTimeIter++)
+       myTimeStampsCombo->insertItem(QString("%1").arg(aTimeIter->second));
+      return;
+    }
+  }
+}
+
+void VisuGUI_ScalarMapOnDeformedShapeDlg::onFieldChanged(int){
+  AddAllTimes(myFieldsCombo->currentText());
+  SetScalarField();
+  UpdateScalarField();
+}
+
+void VisuGUI_ScalarMapOnDeformedShapeDlg::onTimeStampChanged(int){
+  SetScalarField();
+  UpdateScalarField();
+}
+
+void VisuGUI_ScalarMapOnDeformedShapeDlg::UpdateScalarField(){
+  myPrs->SetScale(getFactor());
+  float aRange[2];
+  myPrs->GetScalarMapOnDeformedShapePL()->Build();
+  myPrs->GetScalarMapOnDeformedShapePL()->Update();
+  myPrs->GetScalarMapOnDeformedShapePL()->GetSourceRange(aRange);
+  double aDoubleRange[2];
+  aDoubleRange[0] = double(aRange[0]);
+  aDoubleRange[1] = double(aRange[1]);
+  myScalarPane->initFromPrsObject(myPrs);
+  myScalarPane->setRange(aDoubleRange[0],aDoubleRange[1],myScalarPane->isIRange());
+}
+
+float VisuGUI_ScalarMapOnDeformedShapeDlg::GetFloatValueOfTimeStamp(int theIter){
+  float ret=1;
+  VISU::PField aField = myPrs->GetField();
+  VISU::TValField& aValField = aField->myValField;
+  VISU::PValForTime aValForTime = aValField.find(theIter)->second;
+  if(aValForTime)
+    ret = float(aValForTime->myTime.first);
+  return ret;
+}
diff --git a/src/VISUGUI/VisuGUI_ScalarMapOnDeformedShapeDlg.h b/src/VISUGUI/VisuGUI_ScalarMapOnDeformedShapeDlg.h
new file mode 100644 (file)
index 0000000..c49a3de
--- /dev/null
@@ -0,0 +1,108 @@
+//  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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//
+//  File   : VisuGUI_ScalarMapOnDeformedShapeDlg.h
+//  Author : Eugeny Nikolaev
+//  Module : VISU
+
+#ifndef VISUGUI_SCALARMAPONDEFORMEDSHAPEDLS_H
+#define VISUGUI_SCALARMAPONDEFORMEDSHAPEDLS_H
+
+#include "VisuGUI_ScalarBarDlg.h"
+
+#include "QtxDblSpinBox.h"
+
+#include <qdialog.h>
+#include <qgroupbox.h>
+#include <qcheckbox.h>
+#include <qlabel.h>
+#include <qpushbutton.h>
+
+#include <set>
+
+class SalomeApp_Module;
+class QComboBox;
+class QString;
+
+namespace VISU{
+  class ScalarMapOnDeformedShape_i;
+}
+
+class VisuGUI_ScalarMapOnDeformedShapeDlg : public QDialog
+{
+    Q_OBJECT
+
+public:
+    VisuGUI_ScalarMapOnDeformedShapeDlg (SalomeApp_Module* theModule);
+    ~VisuGUI_ScalarMapOnDeformedShapeDlg() {};
+
+    double getFactor()
+      { return ScalFact->value(); }
+    void setFactor(double theFactor)
+      { ScalFact->setValue(theFactor); }
+    
+
+    void initFromPrsObject(VISU::ScalarMapOnDeformedShape_i* thePrs,bool isAnim=false);
+    int storeToPrsObject(VISU::ScalarMapOnDeformedShape_i* thePrs,bool theUpdateScalar=true);
+
+    int getCurrentScalarFieldNamePos();
+    QString getCurrentScalarFieldName();
+    int getCurrentScalarNbIterations();
+    VISU::TEntity getCurrentScalarEntity();
+    void SetScalarField(int theIter,QString theFieldName=QString(""));
+
+protected slots:
+  void accept();
+  void reject();
+
+private slots:
+  void onFieldChanged(int i=0);
+  void onTimeStampChanged(int i=0);
+
+private:
+ QtxDblSpinBox* ScalFact;
+ VisuGUI_ScalarBarPane* myScalarPane;
+ QComboBox *myFieldsCombo;
+ QComboBox *myTimeStampsCombo;
+ typedef std::map<int,float> TTL; // Times map definition (iteration time, real value of time)
+ typedef std::pair<QString,VISU::TEntity> TFE; // pair field name and entity
+ typedef std::map<TFE,TTL> TFT; // Field name and enity to Times
+ typedef std::map<QString,TFT> TMF; // Mesh to fields map
+ TMF myMeshFieldsTimes;
+ QString myCurrMeshName;
+ _PTR(SObject) mySelectionObj;
+ VISU::ScalarMapOnDeformedShape_i* myPrs;
+ SalomeApp_Module* myVisuGUI;
+protected:
+ void UpdateScalarField();
+ void SetScalarField();
+ void AddAllFieldNames();
+ void AddAllTimes(const QString& theFieldName);
+ float GetFloatValueOfTimeStamp(int iteration);
+};
+
+#endif // VISUGUI_DEFORMEDSHAPEDLS_H
index 4d46d01d089eb139cfb5a21c7bbc1318e3f5e63b..2ade874097f27a432f8a259f93195e0df6f6f9f8 100644 (file)
@@ -18,6 +18,7 @@
 #include "VisuGUI_VectorsDlg.h"
 #include "VisuGUI_IsoSurfacesDlg.h"
 #include "VisuGUI_StreamLinesDlg.h"
+#include "VisuGUI_ScalarMapOnDeformedShapeDlg.h"
 #include "VisuGUI_GaussPointsDlg.h"
 
 #include "VISU_TimeAnimation.h"
@@ -30,6 +31,7 @@
 #include "VISU_CutLines_i.hh"
 #include "VISU_Vectors_i.hh"
 #include "VISU_StreamLines_i.hh"
+#include "VISU_ScalarMapOnDeformedShape_i.hh"
 #include "VISU_GaussPoints_i.hh"
 
 #include "VISU_ViewManager_i.hh"
@@ -562,7 +564,8 @@ enum PrsComboItem {
   TDEFORMEDSHAPE_ITEM = 4, // VISU::TDEFORMEDSHAPE
   TVECTORS_ITEM       = 5, // VISU::TVECTORS
   TSTREAMLINES_ITEM   = 6, // VISU::TSTREAMLINES
-  TGAUSSPOINTS_ITEM   = 7  // VISU::TGAUSSPOINTS
+  TGAUSSPOINTS_ITEM   = 7, // VISU::TGAUSSPOINTS
+  TSCALARMAPONDEFORMEDSHAPE_ITEM = 8 // VISU::TSCALARMAPONDEFORMEDSHAPE
 };
 
 //------------------------------------------------------------------------
@@ -604,6 +607,11 @@ void SetupDlg::onFieldChange (int theIndex)
     myTypeCombo->insertItem("Stream Lines");   // item 6
     myTypeId2ComboId[TSTREAMLINES_ITEM] = myComboId2TypeId.size();
     myComboId2TypeId.push_back(TSTREAMLINES_ITEM);;
+
+    myTypeCombo->insertItem("Scalar map on Deformed shape");   // item 8
+    myTypeId2ComboId[TSCALARMAPONDEFORMEDSHAPE_ITEM] = myComboId2TypeId.size();
+    myComboId2TypeId.push_back(TSCALARMAPONDEFORMEDSHAPE_ITEM);;
+    
   }
 
   long anEntityId = VISU::getValue(aSObject, "myEntityId").toLong();
@@ -629,6 +637,9 @@ void SetupDlg::onFieldChange (int theIndex)
   case VISU::TDEFORMEDSHAPE: //Deformed Shape
     myTypeCombo->setCurrentItem(myTypeId2ComboId[TDEFORMEDSHAPE_ITEM]);
     break;
+  case VISU::TSCALARMAPONDEFORMEDSHAPE: //Scalar Map on Deformed Shape
+    myTypeCombo->setCurrentItem(TSCALARMAPONDEFORMEDSHAPE_ITEM);
+    break;
   case VISU::TVECTORS: //Vectors
     myTypeCombo->setCurrentItem(myTypeId2ComboId[TVECTORS_ITEM]);
     break;
@@ -663,6 +674,9 @@ void SetupDlg::onTypeChanged (int theIndex)
   case TDEFORMEDSHAPE_ITEM: //Deformed Shape
     aData.myPrsType = VISU::TDEFORMEDSHAPE;
     break;
+  case TSCALARMAPONDEFORMEDSHAPE_ITEM: //Scalar Map on Deformed Shape
+    aData.myPrsType = VISU::TSCALARMAPONDEFORMEDSHAPE;
+    break;
   case TVECTORS_ITEM: //Vectors
     aData.myPrsType = VISU::TVECTORS;
     break;
@@ -695,7 +709,8 @@ namespace
     delete aDlg;
   }
 }
-  
+
+
 void SetupDlg::onPreferencesDlg()
 {
   SUIT_OverrideCursor c;
@@ -725,6 +740,28 @@ void SetupDlg::onPreferencesDlg()
     c.suspend();
     EditPrs<VISU::DeformedShape_i,VisuGUI_DeformedShapeDlg>(myModule,aData);
     break;
+  case TSCALARMAPONDEFORMEDSHAPE_ITEM: //Scalar Map on Deformed Shape
+    c.suspend();
+    {
+      typedef VisuGUI_ScalarMapOnDeformedShapeDlg DLG;
+      typedef VISU::ScalarMapOnDeformedShape_i TYPE;
+      DLG* aDlg = new DLG (myModule);
+      aDlg->initFromPrsObject(dynamic_cast<TYPE*>(aData.myPrs[0]),true);
+      if (aDlg->exec())
+        { 
+         int anbFrames=aDlg->getCurrentScalarNbIterations();
+         for (int i = 0; i < aData.myNbFrames; i++){
+           TYPE* aCurrPrs_i = dynamic_cast<TYPE*>(aData.myPrs[i]);
+           if(i+1 > anbFrames)
+             aDlg->SetScalarField(anbFrames);
+           else
+             aDlg->SetScalarField(i+1);
+           aDlg->storeToPrsObject(aCurrPrs_i,false);
+         }
+       }
+      delete aDlg;
+    }
+    break;
   case TVECTORS_ITEM: //Vectors
     c.suspend();
     EditPrs<VISU::Vectors_i,VisuGUI_VectorsDlg>(myModule,aData);
index b59e97ca89689ac4ada63def86db5bf3872978e0..1259dbeea6de7241462c6d2b859b6f76fac51088 100644 (file)
@@ -1319,6 +1319,7 @@ namespace VISU
         case VISU::TVECTORS:
         case VISU::TSTREAMLINES:
         case VISU::TPLOT3D:
+       case VISU::TSCALARMAPONDEFORMEDSHAPE:
           {
             PortableServer::ServantBase_var aServant = VISU::GetServant(aCORBAObject);
             if (aServant.in()) {
index 68d8f5cbe77bd0105a6780742ce4d14ce3ca1511..20168853268cdef702d610b0e2568678e7e00894 100644 (file)
@@ -40,7 +40,8 @@ LIB_SRC = \
        VISU_View_i.cc \
        VISU_TimeAnimation.cxx \
        VISU_CorbaMedConvertor.cxx \
-       VISU_DumpPython.cc
+       VISU_DumpPython.cc \
+       VISU_ScalarMapOnDeformedShape_i.cc
 
 LIB_MOC = \
        VISU_TimeAnimation.h
@@ -84,7 +85,8 @@ EXPORT_HEADERS = \
        VISU_GaussPoints_i.hh \
        VISU_ViewManager_i.hh \
        VISU_View_i.hh \
-       VISU_TimeAnimation.h
+       VISU_TimeAnimation.h \
+       VISU_ScalarMapOnDeformedShape_i.hh
 
 # additionnal information to compil and link file
 CPPFLAGS += \
diff --git a/src/VISU_I/VISU_ScalarMapOnDeformedShape_i.cc b/src/VISU_I/VISU_ScalarMapOnDeformedShape_i.cc
new file mode 100644 (file)
index 0000000..116c8a3
--- /dev/null
@@ -0,0 +1,265 @@
+//  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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+//
+//
+//  File   : VISU_ScalarMapOnDeformedShape_i.cc
+//  Author : Eugeny Nikolaev
+//  Module : VISU
+
+#include "VISU_ScalarMapOnDeformedShapePL.hxx"
+#include "VISU_Result_i.hh"
+#include "VISU_ScalarMap_i.hh"
+#include "VISU_ScalarMapOnDeformedShape_i.hh"
+#include "VISU_Convertor.hxx"
+#include "VISU_Actor.h"
+#include "VISU_ScalarMapAct.h"
+
+#include <vtkUnstructuredGrid.h>
+
+using namespace VISU;
+using namespace std;
+
+#ifdef _DEBUG_
+static int MYDEBUG = 0;
+#else
+static int MYDEBUG = 0;
+#endif
+
+static int INCMEMORY = 4+12;
+
+int VISU::ScalarMapOnDeformedShape_i::IsPossible(Result_i* theResult, const char* theMeshName, VISU::Entity theEntity, 
+                                                const char* theFieldName, int theIteration, int isMemoryCheck)
+{
+  bool aResult = false;
+  try{
+    aResult = VISU::ScalarMap_i::IsPossible(theResult,theMeshName,theEntity,theFieldName,theIteration,false);
+    if(isMemoryCheck && aResult){
+      float aSize = INCMEMORY*
+       theResult->GetInput()->GetTimeStampSize(theMeshName,(VISU::TEntity)theEntity,theFieldName,theIteration);
+      aResult = VISU_PipeLine::CheckAvailableMemory(aSize);
+      MESSAGE("ScalarMapOnDeformedShape_i::IsPossible - CheckAvailableMemory = "<<float(aSize)<<"; aResult = "<<aResult);
+    }
+  }catch(std::exception& exc){
+    INFOS("Follow exception was occured :\n"<<exc.what());
+  }catch(...){
+    INFOS("Unknown exception was occured!");
+  }
+  return aResult;
+}
+
+int VISU::ScalarMapOnDeformedShape_i::myNbPresent = 0;
+QString VISU::ScalarMapOnDeformedShape_i::GenerateName() { return VISU::GenerateName("ScalarDef.Shape",myNbPresent++);}
+
+const string VISU::ScalarMapOnDeformedShape_i::myComment = "SCALARMAPONDEFORMEDSHAPE";
+const char* VISU::ScalarMapOnDeformedShape_i::GetComment() const { return myComment.c_str();}
+
+VISU::ScalarMapOnDeformedShape_i::
+ScalarMapOnDeformedShape_i(Result_i* theResult, 
+         bool theAddToStudy) :
+  PrsObject_i(theResult->GetStudyDocument()), 
+  Prs3d_i(theResult,theAddToStudy),
+  ColoredPrs3d_i(theResult,theAddToStudy),
+  ScalarMap_i(theResult,theAddToStudy),
+  myScalarMapOnDeformedShapePL(NULL),
+  myScalarIteration(1)
+{
+}
+
+VISU::ScalarMapOnDeformedShape_i::
+ScalarMapOnDeformedShape_i(Result_i* theResult, 
+         SALOMEDS::SObject_ptr theSObject) :
+  PrsObject_i(theResult->GetStudyDocument()), 
+  Prs3d_i(theResult,theSObject),
+  ColoredPrs3d_i(theResult,theSObject),
+  ScalarMap_i(theResult,theSObject),
+  myScalarMapOnDeformedShapePL(NULL),
+  myScalarIteration(1)
+{
+}
+
+VISU::Storable* VISU::ScalarMapOnDeformedShape_i::Create(const char* theMeshName, VISU::Entity theEntity, 
+                                                        const char* theFieldName, int theIteration)
+{
+  myIsColored = true;
+  myColor.R = myColor.G = myColor.B = 0.5;
+  VISU::Storable* aRes = TSuperClass::Create(theMeshName,theEntity,theFieldName,theIteration);
+  SetScalarFieldName(theFieldName);
+  SetScalarIteration(theIteration);
+  SetScalarMeshName(theMeshName);
+  int anEntity = theEntity;
+  SetScalarEntity(VISU::TEntity(anEntity));
+  SetScalarField(myScalarMeshName.c_str(),myScalarFieldName.c_str(),myScalarIteration,myScalarEntity);
+  return aRes;
+}
+
+VISU::Storable* VISU::ScalarMapOnDeformedShape_i::Restore(const Storable::TRestoringMap& theMap)
+{
+  TSuperClass::Restore(theMap);
+  
+  SetScalarFieldName(VISU::Storable::FindValue(theMap,"myScalarFieldName"));
+  SetScalarMeshName(VISU::Storable::FindValue(theMap,"myScalarMeshName"));
+  SetScalarIteration(VISU::Storable::FindValue(theMap,"myScalarIteration").toInt());
+  SetScalarEntity(VISU::TEntity(VISU::Storable::FindValue(theMap,"myScalarEntity").toInt()));
+  SetScalarField(GetScalarFieldName().c_str(),
+                GetScalarFieldName().c_str(),
+                GetScalarIteration(),
+                GetScalarEntity());
+  
+  SetScale(VISU::Storable::FindValue(theMap,"myFactor").toDouble());
+  myIsColored = VISU::Storable::FindValue(theMap,"myIsColored").toInt();
+  myColor.R = VISU::Storable::FindValue(theMap,"myColor.R").toDouble();
+  myColor.G = VISU::Storable::FindValue(theMap,"myColor.G").toDouble();
+  myColor.B = VISU::Storable::FindValue(theMap,"myColor.B").toDouble();
+  
+  return this;
+}
+
+void VISU::ScalarMapOnDeformedShape_i::ToStream(std::ostringstream& theStr)
+{
+  TSuperClass::ToStream(theStr);
+  
+  Storable::DataToStream( theStr, "myScalarFieldName", myScalarFieldName.c_str());
+  Storable::DataToStream( theStr, "myScalarMeshName",  myScalarMeshName.c_str());
+  Storable::DataToStream( theStr, "myScalarIteration", myScalarIteration);
+  Storable::DataToStream( theStr, "myScalarEntity",    int(myScalarEntity));
+
+  Storable::DataToStream( theStr, "myFactor", GetScale() );
+  Storable::DataToStream( theStr, "myIsColored", myIsColored );
+  Storable::DataToStream( theStr, "myColor.R", myColor.R );
+  Storable::DataToStream( theStr, "myColor.G", myColor.G );
+  Storable::DataToStream( theStr, "myColor.B", myColor.B );
+
+}
+
+VISU::ScalarMapOnDeformedShape_i::~ScalarMapOnDeformedShape_i(){
+  if(MYDEBUG) MESSAGE("ScalarMapOnDeformedShape_i::~ScalarMapOnDeformedShape_i()");
+}
+
+void VISU::ScalarMapOnDeformedShape_i::SetScale(CORBA::Double theScale) { 
+  myScalarMapOnDeformedShapePL->SetScale(theScale);
+}
+
+CORBA::Double VISU::ScalarMapOnDeformedShape_i::GetScale(){
+  return myScalarMapOnDeformedShapePL->GetScale();
+}
+
+void VISU::ScalarMapOnDeformedShape_i::SetSourceRange(CORBA::Double theMinRange,CORBA::Double theMaxRange){
+  float aRange[2];
+  aRange[0] = float(theMinRange);
+  aRange[1] = float(theMaxRange);
+  myScalarMapOnDeformedShapePL->SetScalarRange(aRange);
+}
+
+CORBA::Double VISU::ScalarMapOnDeformedShape_i::GetSourceRangeMin(){
+  float aRange[2];
+  myScalarMapOnDeformedShapePL->GetSourceRange(aRange);
+  return aRange[0];
+}
+
+CORBA::Double VISU::ScalarMapOnDeformedShape_i::GetSourceRangeMax(){
+  float aRange[2];
+  myScalarMapOnDeformedShapePL->GetSourceRange(aRange);
+  return aRange[1];
+}
+
+void VISU::ScalarMapOnDeformedShape_i::DoHook()
+{
+  if(!myPipeLine)
+    myPipeLine = VISU_ScalarMapOnDeformedShapePL::New();
+  
+  myScalarMapOnDeformedShapePL = dynamic_cast<VISU_ScalarMapOnDeformedShapePL*>(myPipeLine);
+  myPipeLine->GetMapper()->SetScalarVisibility(IsColored());
+
+  TSuperClass::DoHook();
+}
+
+VISU_Actor* VISU::ScalarMapOnDeformedShape_i::CreateActor(const Handle(SALOME_InteractiveObject)& theIO) 
+{
+  VISU_Actor* anActor = TSuperClass::CreateActor(theIO);
+  anActor->SetRepresentation(2);
+  anActor->GetProperty()->SetColor(myColor.R,myColor.G,myColor.B);
+  anActor->SetVTKMapping(false);
+  return anActor;
+}
+
+
+void VISU::ScalarMapOnDeformedShape_i::UpdateActor(VISU_Actor* theActor) {
+  if(VISU_ScalarMapAct* anActor = dynamic_cast<VISU_ScalarMapAct*>(theActor)){
+    if(IsColored()){
+      anActor->SetBarVisibility(true);
+      myPipeLine->GetMapper()->SetScalarVisibility(1);
+    }else{
+      anActor->SetBarVisibility(false);
+      myPipeLine->GetMapper()->SetScalarVisibility(0);
+      anActor->GetProperty()->SetColor(myColor.R,myColor.G,myColor.B);
+    }
+    TSuperClass::UpdateActor(theActor);
+  }
+}
+
+void VISU::ScalarMapOnDeformedShape_i::SetScalarField(const char* theMeshName,
+                                                     const char* theFieldName,
+                                                     const int   theIteration,
+                                                     const VISU::TEntity  theEntity)
+{
+  if (myScalarMapOnDeformedShapePL){
+    myField = myResult->GetInput()->GetField(theMeshName,theEntity,theFieldName);
+    TVTKOutput* aOut = myResult->GetInput()->GetTimeStampOnMesh(theMeshName,
+                                                               theEntity,
+                                                               theFieldName,
+                                                               theIteration)->GetVTKOutput();
+    myScalarMapOnDeformedShapePL->SetScalars(aOut);
+    
+    SetScalarMeshName(theMeshName);
+    SetScalarFieldName(theFieldName);
+    SetScalarIteration(theIteration);
+    SetScalarEntity(theEntity);
+  }
+}
+
+
+void VISU::ScalarMapOnDeformedShape_i::SetScalarMeshName(const char* theName){
+  myScalarMeshName = theName;
+}
+std::string VISU::ScalarMapOnDeformedShape_i::GetScalarMeshName(){
+  return myScalarMeshName;
+}
+
+void VISU::ScalarMapOnDeformedShape_i::SetScalarFieldName(const char* theName){
+  myScalarFieldName = theName;
+}
+std::string VISU::ScalarMapOnDeformedShape_i::GetScalarFieldName(){
+  return myScalarFieldName;
+}
+
+void VISU::ScalarMapOnDeformedShape_i::SetScalarIteration(const int theValue){
+  myScalarIteration = theValue;
+}
+int VISU::ScalarMapOnDeformedShape_i::GetScalarIteration(){
+  return myScalarIteration;
+}
+
+void VISU::ScalarMapOnDeformedShape_i::SetScalarEntity(const VISU::TEntity theValue){
+  myScalarEntity = theValue;
+}
+VISU::TEntity VISU::ScalarMapOnDeformedShape_i::GetScalarEntity(){
+  return myScalarEntity;
+}
diff --git a/src/VISU_I/VISU_ScalarMapOnDeformedShape_i.hh b/src/VISU_I/VISU_ScalarMapOnDeformedShape_i.hh
new file mode 100644 (file)
index 0000000..6cfd5af
--- /dev/null
@@ -0,0 +1,129 @@
+//  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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+//
+//
+// File:    VISU_ScalarMapOnDeformedShape_i.hh
+// Author:  Eugeny Nikolaev
+// Module : VISU
+
+#ifndef VISU_ScalarMapOnDeformedShape_i_HeaderFile
+#define VISU_ScalarMapOnDeformedShape_i_HeaderFile
+
+#include "VISU_ScalarMap_i.hh"
+
+class VISU_ScalarMapOnDeformedShapePL;
+
+namespace VISU{
+  
+  //! Class of Scalar Map on Deformed Shape presentation.
+  class ScalarMapOnDeformedShape_i : public virtual POA_VISU::ScalarMapOnDeformedShape,
+                                    public virtual ScalarMap_i
+  {
+    static int myNbPresent;
+    ScalarMapOnDeformedShape_i();
+    ScalarMapOnDeformedShape_i(const ScalarMapOnDeformedShape_i&);
+    
+  public:
+    
+    typedef ScalarMap_i TSuperClass;
+    
+    explicit
+    ScalarMapOnDeformedShape_i(Result_i* theResult,
+                              bool theAddToStudy);
+    explicit
+    ScalarMapOnDeformedShape_i(Result_i* theResult,
+                              SALOMEDS::SObject_ptr theSObject);
+    
+    virtual ~ScalarMapOnDeformedShape_i();
+
+    virtual VISU::VISUType GetType()
+    { 
+      return VISU::TSCALARMAPONDEFORMEDSHAPE;
+    };
+    
+    typedef VISU::ScalarMapOnDeformedShape TInterface;
+    
+    virtual void SetScale(CORBA::Double theScale);
+    virtual CORBA::Double GetScale();
+
+    virtual CORBA::Boolean IsColored() { return myIsColored; }
+    virtual void ShowColored(CORBA::Boolean theColored) { myIsColored = theColored; }
+
+    virtual SALOMEDS::Color GetColor() { return myColor;}
+    virtual void SetColor(const SALOMEDS::Color& theColor) { myColor = theColor;}
+
+    virtual void SetSourceRange(CORBA::Double theMinRange,CORBA::Double theMaxRange);
+    virtual CORBA::Double GetSourceRangeMin();
+    virtual CORBA::Double GetSourceRangeMax();
+
+    VISU_ScalarMapOnDeformedShapePL* GetScalarMapOnDeformedShapePL(){ return myScalarMapOnDeformedShapePL;}
+   
+  protected:
+    
+    virtual
+    void
+    DoHook();
+
+    VISU_ScalarMapOnDeformedShapePL *myScalarMapOnDeformedShapePL;
+    SALOMEDS::Color myColor;
+    bool myIsColored;
+    std::string myScalarMeshName;
+    std::string myScalarFieldName;
+    VISU::TEntity myScalarEntity;
+    int myScalarIteration;
+
+  public:
+    static int IsPossible(Result_i* theResult, const char* theMeshName, VISU::Entity theEntity,
+                         const char* theFieldName, int theIteration, int isMemoryCheck = true);
+    virtual Storable* Create(const char* theMeshName, VISU::Entity theEntity,
+                            const char* theFieldName, int theIteration);
+
+    virtual void ToStream(std::ostringstream& theStr);
+
+    virtual Storable* Restore(const Storable::TRestoringMap& theMap);
+    
+    static Storable* Restore(SALOMEDS::SObject_ptr theSObject,
+                            const std::string& thePrefix, const Storable::TRestoringMap& theMap);
+
+    static const std::string myComment;
+    virtual const char* GetComment() const;
+    virtual QString GenerateName();
+
+    virtual VISU_Actor* CreateActor(const Handle(SALOME_InteractiveObject)& theIO = NULL);
+
+    virtual void UpdateActor(VISU_Actor* theActor) ;
+
+    virtual void SetScalarField(const char* theMeshName,
+                               const char* theFieldName,
+                               const int   theIteration,
+                               const VISU::TEntity  theEntity);
+
+    virtual void SetScalarFieldName(const char* theName);
+    virtual std::string GetScalarFieldName();
+    virtual void SetScalarIteration(const int theValue);
+    virtual int GetScalarIteration();
+    virtual void SetScalarMeshName(const char* theName);
+    virtual std::string GetScalarMeshName();
+    virtual void SetScalarEntity(const VISU::TEntity theValue);
+    virtual VISU::TEntity GetScalarEntity();
+  };
+}
+#endif
index ff511dbad7ae73c9c57269acc5f67068d6a652db..22733a9504170d353cb4444335ba004404f6291e 100644 (file)
@@ -16,6 +16,7 @@
 #include "VISU_ScalarMap_i.hh"
 #include "VISU_IsoSurfaces_i.hh"
 #include "VISU_DeformedShape_i.hh"
+#include "VISU_ScalarMapOnDeformedShape_i.hh"
 #include "VISU_CutPlanes_i.hh"
 #include "VISU_Plot3D_i.hh"
 #include "VISU_CutLines_i.hh"
@@ -260,6 +261,9 @@ void VISU_TimeAnimation::generatePresentations(CORBA::Long theFieldNum) {
   case VISU::TGAUSSPOINTS: // Gauss Points
     GeneratePresentations<GaussPoints_i>(myStudy,aData,aResult,isRangeDefined(),myMinVal,myMaxVal);
     break;
+  case VISU::TSCALARMAPONDEFORMEDSHAPE: // Scalar map on deformed shape
+    GeneratePresentations<ScalarMapOnDeformedShape_i>(myStudy,aData,aResult,isRangeDefined(),myMinVal,myMaxVal);
+    break;
   default:
     MESSAGE("Not implemented for this presentation type: " << aData.myPrsType);
     return;
@@ -665,6 +669,9 @@ std::string GetPresentationComment (VISU::VISUType thePrsType)
   case VISU::TGAUSSPOINTS:
     aPrsCmt = VISU::GaussPoints_i::myComment;
     break;
+  case VISU::TSCALARMAPONDEFORMEDSHAPE:
+    aPrsCmt = VISU::ScalarMapOnDeformedShape_i::myComment;
+    break;
   default:
     aPrsCmt = "Unknown presentation";
     break;
@@ -831,6 +838,8 @@ void VISU_TimeAnimation::restoreFromStudy(_PTR(SObject) theField)
       aData.myPrsType = VISU::TSTREAMLINES;
     else if (strName == VISU::GaussPoints_i::myComment.c_str())
       aData.myPrsType = VISU::TGAUSSPOINTS;
+    else if (strName == VISU::ScalarMapOnDeformedShape_i::myComment.c_str())
+      aData.myPrsType = VISU::TSCALARMAPONDEFORMEDSHAPE;
     else
       continue;
     generatePresentations(getNbFields()-1);