]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
Merge with VISU 2008
authorvsv <vsv@opencascade.com>
Tue, 30 Sep 2008 10:20:13 +0000 (10:20 +0000)
committervsv <vsv@opencascade.com>
Tue, 30 Sep 2008 10:20:13 +0000 (10:20 +0000)
128 files changed:
idl/VISU_Gen.idl
resources/Makefile.am
resources/SalomeApp.xml
resources/Visu_DeactivatePlane.png [new file with mode: 0644]
resources/Visu_actor_selection.png [new file with mode: 0644]
resources/Visu_apply.png [new file with mode: 0644]
resources/Visu_cell_selection.png [new file with mode: 0644]
resources/Visu_close.png [new file with mode: 0644]
resources/Visu_gauss_point_selection.png [new file with mode: 0644]
resources/Visu_help.png [new file with mode: 0644]
resources/Visu_ok.png [new file with mode: 0644]
resources/Visu_planemanager.png [new file with mode: 0644]
resources/Visu_point_selection.png [new file with mode: 0644]
resources/Visu_selection_panel.png [new file with mode: 0644]
resources/Visu_slider_panel.png [new file with mode: 0644]
resources/Visu_sweep_panel.png [new file with mode: 0644]
src/OBJECT/Makefile.am
src/OBJECT/VISU_Actor.cxx
src/OBJECT/VISU_Actor.h
src/OBJECT/VISU_DataSetActor.cxx
src/OBJECT/VISU_DataSetActor.h
src/OBJECT/VISU_GaussPtsAct.cxx
src/OBJECT/VISU_GaussPtsAct.h
src/OBJECT/VISU_GaussPtsDeviceActor.cxx
src/OBJECT/VISU_GaussPtsDeviceActor.h
src/OBJECT/VISU_GaussPtsSettings.cxx
src/OBJECT/VISU_GaussPtsSettings.h
src/OBJECT/VISU_MeshAct.cxx
src/OBJECT/VISU_MeshAct.h
src/OBJECT/VISU_PickingSettings.cxx [new file with mode: 0644]
src/OBJECT/VISU_PickingSettings.h [new file with mode: 0644]
src/OBJECT/VISU_ScalarMapAct.cxx
src/OBJECT/VISU_ScalarMapAct.h
src/PIPELINE/Makefile.am
src/PIPELINE/VISUPipeLine.cxx
src/PIPELINE/VISU_ColoredPL.cxx
src/PIPELINE/VISU_ColoredPL.hxx
src/PIPELINE/VISU_CutLinesPL.cxx
src/PIPELINE/VISU_CutPlanesPL.cxx
src/PIPELINE/VISU_DataSetMapperHolder.cxx
src/PIPELINE/VISU_DataSetMapperHolder.hxx
src/PIPELINE/VISU_DeformedShapePL.cxx
src/PIPELINE/VISU_GaussPointsPL.cxx
src/PIPELINE/VISU_IsoSurfacesPL.cxx
src/PIPELINE/VISU_IsoSurfacesPL.hxx
src/PIPELINE/VISU_LookupTable.cxx
src/PIPELINE/VISU_LookupTable.hxx
src/PIPELINE/VISU_MapperHolder.hxx
src/PIPELINE/VISU_MeshPL.cxx
src/PIPELINE/VISU_PipeLine.cxx
src/PIPELINE/VISU_PipeLine.hxx
src/PIPELINE/VISU_Plot3DPL.cxx
src/PIPELINE/VISU_PointSpriteMapperHolder.cxx
src/PIPELINE/VISU_PolyDataMapperHolder.cxx
src/PIPELINE/VISU_PolyDataMapperHolder.hxx
src/PIPELINE/VISU_ScalarBarActor.cxx
src/PIPELINE/VISU_ScalarBarActor.hxx
src/PIPELINE/VISU_ScalarBarCtrl.cxx
src/PIPELINE/VISU_ScalarMapPL.cxx
src/PIPELINE/VISU_StreamLinesPL.cxx
src/PIPELINE/VISU_VectorsPL.cxx
src/PIPELINE/VISU_XYPlotActor.cxx [new file with mode: 0644]
src/PIPELINE/VISU_XYPlotActor.hxx [new file with mode: 0644]
src/VISUGUI/Makefile.am
src/VISUGUI/VISU_images.ts
src/VISUGUI/VISU_msg_en.ts
src/VISUGUI/VisuGUI.cxx
src/VISUGUI/VisuGUI.h
src/VISUGUI/VisuGUI_ActionsDef.h
src/VISUGUI/VisuGUI_BasePanel.cxx [new file with mode: 0755]
src/VISUGUI/VisuGUI_BasePanel.h [new file with mode: 0755]
src/VISUGUI/VisuGUI_ClippingDlg.cxx
src/VISUGUI/VisuGUI_ClippingDlg.h
src/VISUGUI/VisuGUI_ClippingPanel.cxx [new file with mode: 0644]
src/VISUGUI/VisuGUI_ClippingPanel.h [new file with mode: 0644]
src/VISUGUI/VisuGUI_ClippingPlaneDlg.cxx [new file with mode: 0644]
src/VISUGUI/VisuGUI_ClippingPlaneDlg.h [new file with mode: 0644]
src/VISUGUI/VisuGUI_DeformedShapeDlg.cxx
src/VISUGUI/VisuGUI_DeformedShapeDlg.h
src/VISUGUI/VisuGUI_Displayer.cxx
src/VISUGUI/VisuGUI_FeatureEdgesPanel.cxx [new file with mode: 0644]
src/VISUGUI/VisuGUI_FeatureEdgesPanel.h [new file with mode: 0644]
src/VISUGUI/VisuGUI_FilterScalarsDlg.cxx [new file with mode: 0644]
src/VISUGUI/VisuGUI_FilterScalarsDlg.h [new file with mode: 0644]
src/VISUGUI/VisuGUI_FindPane.cxx [new file with mode: 0644]
src/VISUGUI/VisuGUI_FindPane.h [new file with mode: 0644]
src/VISUGUI/VisuGUI_GaussPointsSelectionPane.cxx [new file with mode: 0644]
src/VISUGUI/VisuGUI_GaussPointsSelectionPane.h [new file with mode: 0644]
src/VISUGUI/VisuGUI_InputPanel.cxx [new file with mode: 0755]
src/VISUGUI/VisuGUI_InputPanel.h [new file with mode: 0755]
src/VISUGUI/VisuGUI_Module.cxx
src/VISUGUI/VisuGUI_Module.h
src/VISUGUI/VisuGUI_Panel.cxx [new file with mode: 0755]
src/VISUGUI/VisuGUI_Panel.h [new file with mode: 0755]
src/VISUGUI/VisuGUI_Prs3dDlg.cxx
src/VISUGUI/VisuGUI_Prs3dDlg.h
src/VISUGUI/VisuGUI_Prs3dTools.h
src/VISUGUI/VisuGUI_Selection.cxx
src/VISUGUI/VisuGUI_Selection.h
src/VISUGUI/VisuGUI_SelectionPanel.cxx [new file with mode: 0644]
src/VISUGUI/VisuGUI_SelectionPanel.h [new file with mode: 0644]
src/VISUGUI/VisuGUI_SelectionPrefDlg.cxx [new file with mode: 0644]
src/VISUGUI/VisuGUI_SelectionPrefDlg.h [new file with mode: 0644]
src/VISUGUI/VisuGUI_Slider.cxx
src/VISUGUI/VisuGUI_Slider.h
src/VISUGUI/VisuGUI_Sweep.cxx [new file with mode: 0644]
src/VISUGUI/VisuGUI_Sweep.h [new file with mode: 0644]
src/VISUGUI/VisuGUI_Tools.cxx
src/VISUGUI/VisuGUI_Tools.h
src/VISUGUI/VisuGUI_ViewExtender.cxx [new file with mode: 0644]
src/VISUGUI/VisuGUI_ViewExtender.h [new file with mode: 0644]
src/VISUGUI/VisuGUI_ViewTools.h
src/VISU_I/Makefile.am
src/VISU_I/VISU_ClippingPlaneMgr.cxx [new file with mode: 0644]
src/VISU_I/VISU_ClippingPlaneMgr.hxx [new file with mode: 0644]
src/VISU_I/VISU_ColoredPrs3dCache_i.cc
src/VISU_I/VISU_ColoredPrs3d_i.cc
src/VISU_I/VISU_ColoredPrs3d_i.hh
src/VISU_I/VISU_DumpPython.cc
src/VISU_I/VISU_GaussPoints_i.cc
src/VISU_I/VISU_Gen_i.cc
src/VISU_I/VISU_Gen_i.hh
src/VISU_I/VISU_Mesh_i.cc
src/VISU_I/VISU_Prs3d_i.cc
src/VISU_I/VISU_Prs3d_i.hh
src/VISU_I/VISU_ScalarMap_i.cc
src/VISU_I/VISU_ScalarMap_i.hh
src/VISU_I/VISU_View_i.hh

index a048426206acb656f5444619ff4f612eadae363b..007d86fa749afbcbc85721cdb9dcc84da977a252 100644 (file)
@@ -106,6 +106,18 @@ module VISU {
     TALL
   };
 
+  /* Clipping planes management */
+  struct ClippingPlane {
+    double X;
+    double Y;
+    double Z;
+    double dX;
+    double dY;
+    double dZ;
+    boolean isAuto;
+    string name;
+  };
+    
   interface Base {
     /*!
      * Returns ID of the object.
@@ -295,6 +307,7 @@ module VISU {
                         SHADED,
                         INSIDEFRAME,
                         SURFACEFRAME,
+                        FEATURE_EDGES,
                         SHRINK
   };
 
@@ -508,6 +521,32 @@ module VISU {
      */
     long GetScalarMode();
 
+    /*!  
+     * Set the visibility of a distribution curve.
+     * \param theIs is used to switch on/off the visibility of a distribution curve.
+     */
+    void SetIsDistributionVisible(in boolean theIs);
+
+    //! Gets current visibility of a distribution curve
+    boolean GetIsDistributionVisible();
+
+    //! Gets current filtering by scalars mode
+    boolean IsScalarFilterUsed();
+
+    void UseScalarFiltering( in boolean theUseScalarFilter );
+
+    /*!
+     * Sets scalar range - min and max boundaries of the scalar bar.
+     * \param theMin  Min boundary of the scalar bar.
+     * \param theMax  Max boundary of the scalar bar.
+     * \param theIsFilter  if true then filter by scalars.
+     */
+    void SetScalarFilterRange( in double theMin, in double theMax );
+
+    double GetScalarFilterMin();
+
+    double GetScalarFilterMax();
+
     /*!
      * Add group as geometry of presentation.
      * \param theMeshName  - mesh name
@@ -2209,6 +2248,37 @@ module VISU {
      * Get or create %ColoredPrs3dCache object.
      */
     ColoredPrs3dCache GetColoredPrs3dCache(in SALOMEDS::Study theStudy);
+
+    
+    /* Clipping planes management */
+
+    /*Create a clipping plane and return its ID (position in corresponded array) 
+      Id of clipping plane could be changed after deletion of other clipping plane
+    */
+    long CreateClippingPlane(in double X, in double Y, in double Z, 
+                            in double dX, in double dY, in double dZ, 
+                            in boolean auto, in string name);
+    
+    void EditClippingPlane(in long id, in double X, in double Y, in double Z, 
+                            in double dX, in double dY, in double dZ, 
+                            in boolean auto, in string name);
+    
+    /* Returns clipping plane by its Id */
+    ClippingPlane GetClippingPlane(in long id);
+    
+    /* Deletes clipping plane by its Id */
+    boolean DeleteClippingPlane(in long id);
+    
+    /* Applyes a clipping plane with Id to presentation thePrs */
+    boolean ApplyClippingPlane(in Prs3d thePrs, in long id);
+
+    /* Detaches a clipping plane with Id from presentation thePrs */
+    boolean DetachClippingPlane(in Prs3d thePrs, in long id);
+    
+    
+    /* Get number of clipping planes */
+    long GetClippingPlanesNb();
+
   };
 
   /*! \brief %View interface
@@ -2217,8 +2287,8 @@ module VISU {
    * the following types: 3d, Table, XY plot.
    * %View interface is a base for all types of %view interfaces.
    */
-  interface View: Base {
-
+  interface View: Base, SALOME::GenericObj 
+  {
     /*! \brief %ViewRepresentation enumeration
      *
      * displaying part ("ALL" isn't setable)
@@ -2741,6 +2811,8 @@ module VISU {
      */
     void Destroy(in View theView);
   };
+
+
 };
 
 #endif
index 0c0e492af3474ac4d1833f291fcc73ec25f208c6..410eef63c3fe8ff898844c997d07a8d707ae4b53 100644 (file)
@@ -33,8 +33,12 @@ SalomeApp.xml \
 sprite_alpha.bmp \
 sprite_texture.bmp \
 Vertex_Program_ARB.txt \
+Visu_actor_selection.png \
 Visu_add.png \
+Visu_apply.png \
 Visu_anim.png \
+Visu_cell_selection.png \
+Visu_close.png \
 VISU.config \
 Visu_cutlines.png \
 Visu_cutplanes.png \
@@ -43,14 +47,18 @@ Visu_deformed.png \
 VISU_en.xml \
 Visu_eraseall.png \
 VISU_fr.xml \
+Visu_gauss_point_selection.png \
 Visu_gauss_points.png \
 Visu_graduated_axes.png \
+Visu_help.png \
 Visu_import_med.png \
 Visu_isosurfaces.png \
 Visu_load_texture.png \
+Visu_ok.png \
 Visu_PlaneSegmentation.png \
 Visu_plot2d.png \
 Visu_plot3d.png \
+Visu_point_selection.png \
 Visu_points.png \
 Visu_recording_pause.png \
 Visu_recording_play.png \
@@ -63,6 +71,9 @@ Visu_scalars_anim.png \
 Visu_scalars.png \
 Visu_scaling.png \
 Visu_selectall.png \
+Visu_selection_panel.png \
+Visu_slider_panel.png \
+Visu_sweep_panel.png \
 Visu_selectionactor.png \
 Visu_selectioncell.png \
 Visu_selectionedge.png \
@@ -110,8 +121,10 @@ Visu_slider_previous.png \
 Visu_slider_play.png \
 Visu_slider_pause.png \
 Visu_slider_next.png \
-Visu_slider_last.png \
 Visu_holo_render.png
+Visu_slider_last.png \
+Visu_DeactivatePlane.png \
+Visu_planemanager.png
 
 # VSR: little trick to avoid putting if VISUCatalog.xml to the distribution archive
 nodist_salomeres_SCRIPTS = VISUCatalog.xml
index dfd869d57f1c581e8002b5b50a95ecc7ff4881de..670acb23290da5934432cd501dd41aa912baeac1 100644 (file)
     <parameter name="scalar_def_represent"     value="2"/>
     <parameter name="scalar_def_shrink"        value="false"/>
     <parameter name="represent_shading"        value="false"/>
+    <parameter name="feature_edges_angle"      value="30.0"/>
+    <parameter name="show_feature_edges"       value="true"/>
+    <parameter name="show_boundary_edges"      value="false"/>
+    <parameter name="show_manifold_edges"      value="false"/>
+    <parameter name="show_non_manifold_edges"  value="false"/>
+    <parameter name="feature_edges_coloring"   value="false"/>
     <parameter name="scalar_bar_horizontal_height" value="0.05"/>
     <parameter name="scalar_bar_horizontal_width"  value="0.5" />
     <parameter name="scalar_bar_horizontal_x" value="0.01"/>
     <parameter name="scalar_bar_label_font"   value="Arial,Bold,Italic,Underline,12"/>
     <parameter name="scalar_bar_label_format" value="%-#6.3g" />
     <parameter name="scalar_bar_logarithmic"  value="false"/>
+    <!-- RKV : Begin -->
+    <!-- Do filter by scalars or don't -->
+    <parameter name="scalar_bar_filter_by_scalars"  value="false"/>
+    <!-- Show distribution curve or don't -->
+    <parameter name="scalar_bar_show_distribution"  value="false"/>
+    <!-- RKV : End -->
     <parameter name="scalar_bar_mode"         value="0" />
     <parameter name="scalar_bar_num_colors"   value="64"/>
     <parameter name="scalar_bar_num_labels"   value="5" />
     <parameter name="picking_pyramid_height"  value="1.0"/>
     <parameter name="picking_selection_color" value="255, 255, 0"/>
     <parameter name="picking_point_tolerance" value="0.01"/>
+    <parameter name="picking_info_window"  value="true" />
     <parameter name="picking_transparency" value="50" />
-    <parameter name="picking_position"     value="0"  />
+    <parameter name="picking_position"     value="1"  />
+    <parameter name="picking_camera_movement"  value="true" />
     <parameter name="picking_zoom_factor"  value="1.5"/>
     <parameter name="picking_step_number"  value="10" />
     <parameter name="picking_display_parent_mesh" value="false" />
diff --git a/resources/Visu_DeactivatePlane.png b/resources/Visu_DeactivatePlane.png
new file mode 100644 (file)
index 0000000..e4c2190
Binary files /dev/null and b/resources/Visu_DeactivatePlane.png differ
diff --git a/resources/Visu_actor_selection.png b/resources/Visu_actor_selection.png
new file mode 100644 (file)
index 0000000..f94b29d
Binary files /dev/null and b/resources/Visu_actor_selection.png differ
diff --git a/resources/Visu_apply.png b/resources/Visu_apply.png
new file mode 100644 (file)
index 0000000..3a225a1
Binary files /dev/null and b/resources/Visu_apply.png differ
diff --git a/resources/Visu_cell_selection.png b/resources/Visu_cell_selection.png
new file mode 100644 (file)
index 0000000..8e2dc4f
Binary files /dev/null and b/resources/Visu_cell_selection.png differ
diff --git a/resources/Visu_close.png b/resources/Visu_close.png
new file mode 100644 (file)
index 0000000..d5f353e
Binary files /dev/null and b/resources/Visu_close.png differ
diff --git a/resources/Visu_gauss_point_selection.png b/resources/Visu_gauss_point_selection.png
new file mode 100644 (file)
index 0000000..8129a9e
Binary files /dev/null and b/resources/Visu_gauss_point_selection.png differ
diff --git a/resources/Visu_help.png b/resources/Visu_help.png
new file mode 100644 (file)
index 0000000..452b45f
Binary files /dev/null and b/resources/Visu_help.png differ
diff --git a/resources/Visu_ok.png b/resources/Visu_ok.png
new file mode 100644 (file)
index 0000000..8ce1457
Binary files /dev/null and b/resources/Visu_ok.png differ
diff --git a/resources/Visu_planemanager.png b/resources/Visu_planemanager.png
new file mode 100644 (file)
index 0000000..7e8895e
Binary files /dev/null and b/resources/Visu_planemanager.png differ
diff --git a/resources/Visu_point_selection.png b/resources/Visu_point_selection.png
new file mode 100644 (file)
index 0000000..bcc9203
Binary files /dev/null and b/resources/Visu_point_selection.png differ
diff --git a/resources/Visu_selection_panel.png b/resources/Visu_selection_panel.png
new file mode 100644 (file)
index 0000000..4c95efe
Binary files /dev/null and b/resources/Visu_selection_panel.png differ
diff --git a/resources/Visu_slider_panel.png b/resources/Visu_slider_panel.png
new file mode 100644 (file)
index 0000000..748bb5f
Binary files /dev/null and b/resources/Visu_slider_panel.png differ
diff --git a/resources/Visu_sweep_panel.png b/resources/Visu_sweep_panel.png
new file mode 100644 (file)
index 0000000..fbcddc0
Binary files /dev/null and b/resources/Visu_sweep_panel.png differ
index 7b73580150ea6d3ea816f08643aca78d69ca6899..9c2ed5df6a1c1065053b3fa2b1ac8b3ead91d7fb 100644 (file)
@@ -31,6 +31,7 @@ lib_LTLIBRARIES= libVisuObject.la
 salomeinclude_HEADERS = \
        VISU_BoostSignals.h \
        VISU_ActorFactory.h \
+       VISU_PickingSettings.h \
        VISU_GaussPtsSettings.h \
        VISU_GaussPtsActorFactory.h \
        VISU_GaussPtsDeviceActor.h \
@@ -50,6 +51,7 @@ dist_libVisuObject_la_SOURCES = \
        VISU_DataSetActor.cxx \
        VISU_MeshAct.cxx \
        VISU_ScalarMapAct.cxx \
+       VISU_PickingSettings.cxx \
        VISU_GaussPtsDeviceActor.cxx \
        VISU_GaussPtsSettings.cxx \
        VISU_GaussPtsAct.cxx \
index f4d26b4e3b2316e85f62ecde8e4123b2a56924c0..4c9320dca0ae3e0dbbfda32c426240adfe7de96a 100644 (file)
 //  $Header$
 
 #include "VISU_Actor.h"
+
+#include "VISU_PickingSettings.h"
+#include "VISU_GaussPtsDeviceActor.h"
+
 #include "VISU_PipeLine.hxx"
+
+#include "SVTK_Event.h"
+
 #include "VTKViewer_ShrinkFilter.h"
 #include "VTKViewer_GeometryFilter.h"
 #include "VISU_ActorFactory.h"
@@ -52,6 +59,7 @@
 #include <vtkPolyData.h>
 #include <vtkUnstructuredGrid.h>
 #include <vtkPassThroughFilter.h>
+#include <vtkFeatureEdges.h>
 
 #include <vtkShrinkFilter.h>
 #include <vtkShrinkPolyData.h>
 #include <vtkGeometryFilter.h>
 #include <vtkObjectFactory.h>
 
+#include <vtkCallbackCommand.h>
+#include <vtkCamera.h>
+#include <vtkRenderWindowInteractor.h>
+
 #include <boost/bind.hpp>
 
 #include "utilities.h"
@@ -83,13 +95,21 @@ static int MYDEBUG = 0;
 //----------------------------------------------------------------------------
 VISU_Actor
 ::VISU_Actor():
+  myEventCallbackCommand(vtkCallbackCommand::New()),
+  myPriority(0.0),
   myIsVTKMapping(false),
   myPrs3d(NULL),
   myIsShrunk(false),
   myIsShrinkable(false),
   myShrinkFilter(VTKViewer_ShrinkFilter::New()),
   myAnnotationMapper(vtkTextMapper::New()),
-  myAnnotationActor(vtkTextActor::New())
+  myAnnotationActor(vtkTextActor::New()),
+  myTextActor(VISU_FramedTextActor::New()),
+  myIsFeatureEdgesAllowed(false),
+  myIsFeatureEdgesEnabled(false),
+  myFeatureEdges(vtkFeatureEdges::New()),
+  myLastSelectionMode(ActorSelection),
+  myIsSubElementsHighlighted(false)
 {
   if(MYDEBUG) MESSAGE("VISU_Actor::VISU_Actor - this = "<<this);
 
@@ -104,6 +124,21 @@ VISU_Actor
 
   myAnnotationActor->Delete();
   myAnnotationActor->SetVisibility(0);
+
+  myTextActor->Delete();
+  myTextActor->SetVisibility(false);
+  myTextActor->SetPickable(false);
+
+  myFeatureEdges->Delete();
+
+  myEventCallbackCommand->Delete();
+  myEventCallbackCommand->SetClientData(this); 
+  myEventCallbackCommand->SetCallback(VISU_Actor::ProcessEvents);
+
+  if( VISU_PickingSettings* aPickingSettings = VISU_PickingSettings::Get() )
+    aPickingSettings->AddObserver(VISU::UpdatePickingSettingsEvent, 
+                                 myEventCallbackCommand.GetPointer(), 
+                                 myPriority);
 }
 
 //----------------------------------------------------------------------------
@@ -119,6 +154,15 @@ VISU_Actor
     SetShrink();
   else
     UnShrink();
+
+  SetFeatureEdgesAllowed(theActor->IsFeatureEdgesAllowed());
+  SetFeatureEdgesEnabled(theActor->IsFeatureEdgesEnabled());
+  SetFeatureEdgesAngle(theActor->GetFeatureEdgesAngle());
+  bool aFeatureEdges = false, aBoundaryEdges = false, aManifoldEdges = false, aNonManifoldEdges = false;
+  theActor->GetFeatureEdgesFlags( aFeatureEdges, aBoundaryEdges, aManifoldEdges, aNonManifoldEdges );
+  SetFeatureEdgesFlags( aFeatureEdges, aBoundaryEdges, aManifoldEdges, aNonManifoldEdges );
+  SetFeatureEdgesColoring(theActor->GetFeatureEdgesColoring());
+
   SetOpacity(theActor->GetOpacity());
   SetLineWidth(theActor->GetLineWidth());
   SetPosition(theActor->GetPosition());
@@ -180,11 +224,12 @@ VISU_Actor
 ::SetPipeLine(VISU_PipeLine* thePipeLine) 
 {
   myPipeLine = thePipeLine;
-  if ( thePipeLine ) {
-    if ( vtkMapper *aMapper = myPipeLine->GetMapper() ) {
-      if ( vtkDataSet *aDataSet = aMapper->GetInput() ) {
-       SetShrinkable( thePipeLine->IsShrinkable() );
-       SetMapperInput( aDataSet );
+  if(thePipeLine){
+    if(vtkMapper *aMapper = myPipeLine->GetMapper()){
+      if(vtkDataSet *aDataSet = aMapper->GetInput()){
+       SetShrinkable(thePipeLine->IsShrinkable());
+       SetFeatureEdgesAllowed(thePipeLine->IsFeatureEdgesAllowed());
+       SetMapperInput(aDataSet);
       }
     }
   }
@@ -213,7 +258,10 @@ VISU_Actor
 { 
   Superclass::SetRepresentation(theMode);
   if(myRepresentation == VTK_POINTS)
+  {
     UnShrink();
+  }
+  SetFeatureEdgesEnabled( theMode == SVTK::Representation::FeatureEdges );
 }
 
 
@@ -282,6 +330,111 @@ VISU_Actor
 }
 
 
+//----------------------------------------------------------------------------
+bool
+VISU_Actor
+::IsFeatureEdgesAllowed() 
+{ 
+  return myIsFeatureEdgesAllowed;
+}
+
+void
+VISU_Actor
+::SetFeatureEdgesAllowed(bool theIsFeatureEdgesAllowed)
+{
+  myIsFeatureEdgesAllowed = theIsFeatureEdgesAllowed;
+}
+
+bool
+VISU_Actor
+::IsFeatureEdgesEnabled()
+{
+  return myIsFeatureEdgesEnabled;
+}
+
+void
+VISU_Actor
+::SetFeatureEdgesEnabled(bool theIsFeatureEdgesEnabled)
+{
+  if ( !myIsFeatureEdgesAllowed || myIsFeatureEdgesEnabled == theIsFeatureEdgesEnabled ) 
+    return;
+
+  if ( vtkPolyData* aPolyData = myPassFilter[ 2 ]->GetPolyDataOutput() )
+  {
+    if( theIsFeatureEdgesEnabled )
+    {
+      myFeatureEdges->SetInput( aPolyData );
+      myPassFilter[ 3 ]->SetInput( myFeatureEdges->GetOutput() );
+      myIsFeatureEdgesEnabled = true;
+    }
+    else
+    {
+      myPassFilter[3]->SetInput( aPolyData );
+      myPassFilter[3]->Modified();
+      myIsFeatureEdgesEnabled = false;
+      Modified();
+    }
+    myIsFeatureEdgesEnabled = theIsFeatureEdgesEnabled;
+  }
+}
+
+vtkFloatingPointType
+VISU_Actor
+::GetFeatureEdgesAngle()
+{
+  return myFeatureEdges->GetFeatureAngle();
+}
+
+void
+VISU_Actor
+::SetFeatureEdgesAngle(vtkFloatingPointType theValue)
+{
+  myFeatureEdges->SetFeatureAngle(theValue);
+  Modified();
+}
+
+void
+VISU_Actor
+::GetFeatureEdgesFlags(bool& theIsFeatureEdges,
+                      bool& theIsBoundaryEdges,
+                      bool& theIsManifoldEdges,
+                      bool& theIsNonManifoldEdges)
+{
+  theIsFeatureEdges = myFeatureEdges->GetFeatureEdges();
+  theIsBoundaryEdges = myFeatureEdges->GetBoundaryEdges();
+  theIsManifoldEdges = myFeatureEdges->GetManifoldEdges();
+  theIsNonManifoldEdges = myFeatureEdges->GetNonManifoldEdges();
+}
+
+void
+VISU_Actor
+::SetFeatureEdgesFlags(bool theIsFeatureEdges,
+                      bool theIsBoundaryEdges,
+                      bool theIsManifoldEdges,
+                      bool theIsNonManifoldEdges)
+{
+  myFeatureEdges->SetFeatureEdges(theIsFeatureEdges);
+  myFeatureEdges->SetBoundaryEdges(theIsBoundaryEdges);
+  myFeatureEdges->SetManifoldEdges(theIsManifoldEdges);
+  myFeatureEdges->SetNonManifoldEdges(theIsNonManifoldEdges);
+  Modified();
+}
+
+bool
+VISU_Actor
+::GetFeatureEdgesColoring()
+{
+  return myFeatureEdges->GetColoring();
+}
+
+void
+VISU_Actor
+::SetFeatureEdgesColoring(bool theIsColoring)
+{
+  myFeatureEdges->SetColoring(theIsColoring);
+  Modified();
+}
+
 //----------------------------------------------------------------------------
 void
 VISU_Actor
@@ -321,6 +474,7 @@ VISU_Actor
 {
   Superclass::AddToRender(theRenderer);
   theRenderer->AddActor(myAnnotationActor.GetPointer());
+  theRenderer->AddActor(myTextActor.GetPointer());
 }
 
 //==================================================================
@@ -332,6 +486,7 @@ VISU_Actor
 ::RemoveFromRender(vtkRenderer* theRenderer)
 {
   theRenderer->RemoveActor(myAnnotationActor.GetPointer());
+  theRenderer->RemoveActor(myTextActor.GetPointer());
   Superclass::RemoveFromRender(theRenderer); 
   myDestroySignal(this);
 }
@@ -379,6 +534,11 @@ VISU_Actor
     aSize += aDataSet->GetActualMemorySize() * 1024;
   }
 
+  if(IsFeatureEdgesEnabled()){
+    vtkPolyData* aPolyData = myFeatureEdges->GetOutput();
+    aSize += aPolyData->GetActualMemorySize() * 1024;
+  }
+
   return aSize;
 }
 
@@ -449,6 +609,84 @@ VISU_Actor
 //----------------------------------------------------------------------------
 bool
 VISU_Actor
+::isSubElementsHighlighted() 
+{ 
+  return myIsSubElementsHighlighted; 
+}
+
+
+//----------------------------------------------------------------------------
+inline
+void
+ChangeZoom(vtkFloatingPointType theZoomFactor,
+          vtkRenderer* theRenderer,
+          vtkIdType theInitialHasIndex,
+          vtkIdType theCurrentHasIndex)
+{
+  //printf( "VISU_Actor::ChangeZoom( %d, %d )", theInitialHasIndex, theCurrentHasIndex );
+  if(theInitialHasIndex + theCurrentHasIndex == 1){
+    vtkCamera *aCamera = theRenderer->GetActiveCamera();
+
+    double aScale = aCamera->GetParallelScale();
+    if ( !theInitialHasIndex && theCurrentHasIndex ) {
+      //printf( " : +%f", theZoomFactor );
+      aCamera->SetParallelScale( aScale / theZoomFactor );
+    }
+    else {
+      //printf( " : -%f", theZoomFactor );
+      aCamera->SetParallelScale( aScale * theZoomFactor );
+    }
+  }
+  //printf( "\n" );
+}
+
+/*!
+  Updates visibility of the highlight devices  
+*/
+void
+VISU_Actor
+::highlight(bool theIsHighlight)
+{
+  VISU_PickingSettings* aPickingSettings = VISU_PickingSettings::Get();
+
+  bool aShowTextActor = aPickingSettings->GetInfoWindowEnabled();
+  if( theIsHighlight && mySelectionMode != myLastSelectionMode )
+  {
+    if( mySelectionMode == ActorSelection )
+      ResetTextActor();
+    else
+      aShowTextActor = false;
+    myLastSelectionMode = mySelectionMode;
+  }
+
+  myTextActor->SetVisibility( GetVisibility() && theIsHighlight && aShowTextActor );
+
+  bool anInitialHasIndex = isHighlighted();
+  bool aCurrentHasIndex = theIsHighlight;
+
+  if( !theIsHighlight && mySelectionMode == ActorSelection && isSubElementsHighlighted() )
+  {
+    myIsSubElementsHighlighted = false;
+
+    // Zoom
+    if( GetVisibility() && aPickingSettings->GetCameraMovementEnabled() )
+    {
+      vtkFloatingPointType aZoomFactor = aPickingSettings->GetZoomFactor();
+      ChangeZoom(aZoomFactor,
+                GetRenderer(),
+                anInitialHasIndex,
+                aCurrentHasIndex);
+    }
+  }
+
+  Superclass::highlight(theIsHighlight);
+}
+
+/*!
+  To process prehighlight (called from SVTK_InteractorStyle)
+*/
+bool
+VISU_Actor
 ::PreHighlight(vtkInteractorStyle* theInteractorStyle, 
               SVTK_SelectionEvent* theSelectionEvent,
               bool theIsHighlight)
@@ -472,7 +710,7 @@ VISU_Actor
 
       if(myCellPicker->GetActor() != this)
        return false;
-      
+
       vtkIdType aVTKId = myCellPicker->GetCellId();
       if(aVTKId >= 0  && mySelector->IsValid(this,aVTKId,true) && hasIO()){
        vtkIdType anObjId = GetElemObjId(aVTKId);
@@ -513,7 +751,7 @@ VISU_Actor
                          theSelectionEvent->myY, 
                          0.0, 
                          aRenderer);
-      
+
       if(myPointPicker->GetActor() != this)
        return false;
 
@@ -550,3 +788,312 @@ VISU_Actor
 
   return aRet;
 }
+
+void VISU_Actor::RemoveAllClippingPlanes()
+{
+}
+
+vtkIdType VISU_Actor::GetNumberOfClippingPlanes()
+{
+  return 0;
+}
+
+bool VISU_Actor::AddClippingPlane(vtkPlane* thePlane)
+{
+  return false;
+}
+
+vtkPlane* VISU_Actor::GetClippingPlane(vtkIdType theID)
+{
+  return NULL;
+}
+
+vtkImplicitFunctionCollection* VISU_Actor::GetClippingPlanes()
+{
+  return NULL;
+}
+
+//----------------------------------------------------------------------------
+template<class TData> std::string getScalar(TData* theData, int theId)
+{
+  std::ostringstream aStr;
+  if (vtkDataArray *aScalar = theData->GetScalars()){
+    vtkFloatingPointType aVal = aScalar->GetTuple1(theId);
+    aStr << "\nScalar: " << aVal;
+  }
+  return aStr.str();
+}
+
+template<class TData> std::string getVector(TData* theData, int theId)
+{
+  std::ostringstream aStr;
+  if (vtkDataArray *aVector = theData->GetVectors()) {
+    vtkFloatingPointType *aVal = aVector->GetTuple3(theId);
+    aStr << "\nVector: " << "{" << aVal[0] << "; " << aVal[1] << "; " << aVal[2] << "}";
+  }
+  return aStr.str();
+}
+
+/*!
+  To process highlight (called from SVTK_InteractorStyle)
+*/
+bool
+VISU_Actor
+::Highlight(vtkInteractorStyle* theInteractorStyle, 
+           SVTK_SelectionEvent* theSelectionEvent,
+           bool theIsHighlight)
+{
+  return Superclass::Highlight(theInteractorStyle,
+                              theSelectionEvent,
+                              theIsHighlight);
+}
+
+//-------------------------------------------------------------------------
+void
+VISU_Actor
+::Highlight(bool theIsHighlight)
+{
+  Superclass::Highlight(theIsHighlight);
+
+  VISU_PickingSettings* aPickingSettings = VISU_PickingSettings::Get();
+
+  bool anInitialHasIndex = isSubElementsHighlighted() && mySelectionMode != ActorSelection;
+  
+  TColStd_IndexedMapOfInteger aMapIndex;
+  mySelector->GetIndex( getIO(), aMapIndex );
+  bool aCurrentHasIndex = aMapIndex.Extent() == 1;
+
+  myIsSubElementsHighlighted = aCurrentHasIndex;
+
+  bool aFlyTo = false;
+  vtkFloatingPointType aFlyToCoord[3] = { 0.0, 0.0, 0.0 };
+  vtkRenderer *aRenderer = GetRenderer();
+
+  if( theIsHighlight )
+  {
+    vtkDataSet* aDataSet = GetMapper()->GetInput();
+    switch(mySelectionMode)
+    {
+      case ActorSelection:
+      {
+       ResetTextActor();
+       break;
+      }
+      case CellSelection:
+      {
+       if( !aCurrentHasIndex )
+       {
+         myTextActor->SetVisibility(false);
+         break;
+       }
+
+       int anObjId = aMapIndex(1);
+       vtkCellData* aCellData = aDataSet->GetCellData();
+       if(vtkCell* aCell = GetElemCell(anObjId)){
+         vtkPoints* aPts = aCell->GetPoints();
+         if(int aNbPts = aCell->GetNumberOfPoints()){
+           vtkFloatingPointType aCoord[3] = {0.0, 0.0, 0.0};
+           for(int i = 0; i < aNbPts; i++){
+             vtkFloatingPointType *aPntCoord = aPts->GetPoint(i); 
+             aCoord[0] += aPntCoord[0];
+             aCoord[1] += aPntCoord[1];
+             aCoord[2] += aPntCoord[2];
+           }
+
+           aFlyTo = true;
+           aFlyToCoord[0] = aCoord[0] / aNbPts;
+           aFlyToCoord[1] = aCoord[1] / aNbPts;
+           aFlyToCoord[2] = aCoord[2] / aNbPts;
+
+           vtkFloatingPointType aWorldCoord[4] = {aCoord[0]/aNbPts, aCoord[1]/aNbPts, aCoord[2]/aNbPts, 1.0};
+           aRenderer->SetWorldPoint(aWorldCoord);
+           aRenderer->WorldToDisplay();
+           vtkFloatingPointType aSelectionPoint[3];
+           aRenderer->GetDisplayPoint(aSelectionPoint);
+           myTextActor->SetPosition(aSelectionPoint);
+           myTextActor->SetModePosition(aPickingSettings->GetInfoWindowPosition());
+           myTextActor->SetTransparency(aPickingSettings->GetInfoWindowTransparency());
+           myTextActor->SetWorldPoint(aWorldCoord);
+
+           std::ostringstream aStr;
+           aStr << "Cell ID: " << anObjId;
+
+           vtkCell* aCell = GetElemCell(anObjId);
+           int aVTKID = GetElemVTKID(anObjId);
+           if (aCell) {
+             int aNbOfPoints = aCell->GetNumberOfPoints();
+             if ( aNbOfPoints > 0 ) {
+               aStr << getScalar(aCellData, aVTKID);
+               aStr << getVector(aCellData, aVTKID);
+             }
+           }
+
+           std::string aString = aStr.str();
+           myTextActor->SetText(aString.c_str());
+         }
+       }
+       break;
+      }
+      case NodeSelection:
+      { 
+       if( !aCurrentHasIndex )
+       {
+         myTextActor->SetVisibility(false);
+         break;
+       }
+
+       int anObjId = aMapIndex(1);
+       vtkPointData* aPntData = aDataSet->GetPointData();
+       if(vtkFloatingPointType* aCoord = GetNodeCoord(anObjId)){
+         aFlyTo = true;
+         aFlyToCoord[0] = aCoord[0];
+         aFlyToCoord[1] = aCoord[1];
+         aFlyToCoord[2] = aCoord[2];
+
+         vtkFloatingPointType aWorldCoord[4] = {aCoord[0], aCoord[1], aCoord[2], 1.0};
+         aRenderer->SetWorldPoint(aWorldCoord);
+         aRenderer->WorldToDisplay();
+         vtkFloatingPointType aSelectionPoint[3];
+         aRenderer->GetDisplayPoint(aSelectionPoint);
+         myTextActor->SetPosition(aSelectionPoint);
+         myTextActor->SetModePosition(aPickingSettings->GetInfoWindowPosition());
+         myTextActor->SetTransparency(aPickingSettings->GetInfoWindowTransparency());
+         myTextActor->SetWorldPoint(aWorldCoord);
+
+         std::ostringstream aStr;
+         aStr << "Point ID: " << anObjId;
+
+         int aVTKID = GetNodeVTKID(anObjId);
+         if(aVTKID >= 0) {
+           aStr << getScalar(aPntData, aVTKID);
+           aStr << getVector(aPntData, aVTKID);
+         }
+
+         const VISU::PIDMapper& aMapper = GetPipeLine()->GetIDMapper();
+         VISU::TIdTypeVector aVec = aMapper->GetIndexesOfNode(anObjId);
+
+         aStr << "\nCoordinates: " << "[";
+         aStr << aCoord[0];
+         if( aVec.size() > 0 )
+           aStr << " (" << aVec[0] << ")";
+         aStr << "; ";
+
+         aStr << aCoord[1];
+         if( aVec.size() > 1 )
+           aStr << " (" << aVec[1] << ")";
+         aStr << "; ";
+
+         aStr << aCoord[2];
+         if( aVec.size() > 2 )
+           aStr << " (" << aVec[2] << ")";
+         aStr << "]";
+
+         std::string aString = aStr.str();
+         myTextActor->SetText(aString.c_str());
+       }
+       break;
+      }
+      case EdgeOfCellSelection:
+       break;
+      default:
+       break;
+    }
+  }
+
+  // Zoom
+  if( GetVisibility() && aPickingSettings->GetCameraMovementEnabled() )
+  {
+    vtkFloatingPointType aZoomFactor = aPickingSettings->GetZoomFactor();
+    ChangeZoom(aZoomFactor,
+              GetRenderer(),
+              anInitialHasIndex,
+              aCurrentHasIndex);
+  }
+
+  // FlyTo
+  if( GetVisibility() && aPickingSettings->GetCameraMovementEnabled() && aFlyTo )
+  {
+    vtkRenderWindowInteractor* anInteractor = myInteractor;
+    vtkFloatingPointType aDollyWas = anInteractor->GetDolly();
+    int aNumberOfFlyFramesWas = anInteractor->GetNumberOfFlyFrames();
+  
+    anInteractor->SetDolly(0.0);
+    anInteractor->SetNumberOfFlyFrames(aPickingSettings->GetStepNumber());
+    anInteractor->FlyTo(aRenderer, aFlyToCoord);
+    aRenderer->ResetCameraClippingRange();
+    anInteractor->SetDolly(aDollyWas);
+    anInteractor->SetNumberOfFlyFrames(aNumberOfFlyFramesWas);
+    anInteractor->InvokeEvent(SVTK::ChangeRotationPoint, aFlyToCoord);
+  }
+}
+
+//-------------------------------------------------------------------------
+void
+VISU_Actor
+::ResetTextActor()
+{
+  VISU_PickingSettings* aPickingSettings = VISU_PickingSettings::Get();
+
+  vtkFloatingPointType aCoord[6];
+  GetBounds(aCoord);
+
+  vtkFloatingPointType aWorldCoord[4] = { ( aCoord[0] + aCoord[1] ) / 2,
+                                         ( aCoord[2] + aCoord[3] ) / 2,
+                                         ( aCoord[4] + aCoord[5] ) / 2, 1.0};
+  vtkRenderer* aRenderer = GetRenderer();
+  aRenderer->SetWorldPoint(aWorldCoord);
+  aRenderer->WorldToDisplay();
+  vtkFloatingPointType aSelectionPoint[3];
+  aRenderer->GetDisplayPoint(aSelectionPoint);
+  myTextActor->SetPosition(aSelectionPoint);
+  myTextActor->SetModePosition(aPickingSettings->GetInfoWindowPosition());
+  myTextActor->SetTransparency(aPickingSettings->GetInfoWindowTransparency());
+  myTextActor->SetWorldPoint(aWorldCoord);
+
+  std::ostringstream aStr;
+  /*
+  if( const char* aName = getName() )
+    aStr << aName << "\n";
+  */
+  aStr << "Position: " << "[" << aCoord[0] << "; " << aCoord[2] << "; " << aCoord[4] << "]";
+  aStr << "\nSize: " << "[" <<
+    fabs(aCoord[1]-aCoord[0]) << "; " <<
+    fabs(aCoord[3]-aCoord[2]) << "; " <<
+    fabs(aCoord[5]-aCoord[4]) << "]";
+
+  std::string aString = aStr.str();
+  myTextActor->SetText(aString.c_str());
+}
+
+//-------------------------------------------------------------------------
+void 
+VISU_Actor
+::ProcessEvents(vtkObject* vtkNotUsed(theObject), 
+               unsigned long theEvent,
+               void* theClientData, 
+               void* vtkNotUsed(theCallData))
+{
+  if(vtkObject* anObject = reinterpret_cast<vtkObject*>(theClientData))
+    if(VISU_Actor* self = dynamic_cast<VISU_Actor*>(anObject)) {
+      if(theEvent == VISU::UpdatePickingSettingsEvent)
+       self->UpdatePickingSettings();
+    }
+}
+
+//----------------------------------------------------------------------------
+void
+VISU_Actor
+::UpdatePickingSettings()
+{
+  //printf( "VISU_Actor::UpdatePickingSettings()\n" );
+  VISU_PickingSettings* aPickingSettings = VISU_PickingSettings::Get();
+  if( !aPickingSettings )
+    return;
+
+  myTextActor->SetModePosition(aPickingSettings->GetInfoWindowPosition());
+  myTextActor->SetTransparency(aPickingSettings->GetInfoWindowTransparency());
+
+  Highlight(isHighlighted());
+
+  Update();
+}
index d1c36b8c223e4d92422fe9d0c07c630d639dcb5a..34c1dcc8988d1373d01a03e4d26b3746f7b4d91b 100644 (file)
@@ -43,8 +43,14 @@ class vtkProperty;
 class vtkTextMapper;
 class vtkTextActor;
 class vtkInteractorStyle;
+class vtkCallbackCommand;
 class VTKViewer_ShrinkFilter;
 class VISU_PipeLine;
+class vtkPlane;
+class vtkImplicitFunctionCollection;
+class vtkFeatureEdges;
+
+class VISU_FramedTextActor;
 
 #ifdef _WIN32
 #define VTKOCC_EXPORT __declspec (dllexport)
@@ -57,6 +63,7 @@ namespace SVTK
   namespace Representation
   {
     const Type Surfaceframe = Insideframe + 1;
+    const Type FeatureEdges = Insideframe + 2;
   }
 }
 
@@ -144,6 +151,53 @@ class VTKOCC_EXPORT VISU_Actor : public VISU_ActorBase
   vtkFloatingPointType
   GetShrinkFactor();
 
+  //----------------------------------------------------------------------------
+  virtual
+  bool
+  IsFeatureEdgesAllowed();
+
+  virtual
+  void
+  SetFeatureEdgesAllowed(bool theIsFeatureEdgesAllowed);
+
+  virtual
+  bool
+  IsFeatureEdgesEnabled();
+
+  virtual
+  void
+  SetFeatureEdgesEnabled(bool theIsFeatureEdgesEnabled);
+
+  virtual
+  vtkFloatingPointType
+  GetFeatureEdgesAngle();
+
+  virtual
+  void
+  SetFeatureEdgesAngle(vtkFloatingPointType theAngle = 30.0); 
+
+  virtual
+  void
+  GetFeatureEdgesFlags(bool& theIsFeatureEdges,
+                      bool& theIsBoundaryEdges,
+                      bool& theIsManifoldEdges,
+                      bool& theIsNonManifoldEdges);
+
+  virtual
+  void
+  SetFeatureEdgesFlags(bool theIsFeatureEdges,
+                      bool theIsBoundaryEdges,
+                      bool theIsManifoldEdges,
+                      bool theIsNonManifoldEdges);
+
+  virtual
+  bool
+  GetFeatureEdgesColoring();
+
+  virtual
+  void
+  SetFeatureEdgesColoring(bool theIsColoring);
+
   //----------------------------------------------------------------------------
   virtual
   void
@@ -171,12 +225,30 @@ class VTKOCC_EXPORT VISU_Actor : public VISU_ActorBase
   RemoveFromRender( vtkRenderer* );
 
   //----------------------------------------------------------------------------
+  //! Just to update visibility of the highlight devices
+  virtual
+  void
+  highlight(bool theHighlight);  
+
+  //! To process prehighlight (called from #SVTK_InteractorStyle)
   virtual
   bool
   PreHighlight(vtkInteractorStyle* theInteractorStyle, 
               SVTK_SelectionEvent* theSelectionEvent,
               bool theIsHighlight);
 
+  //! To process highlight (called from #SVTK_InteractorStyle)
+  virtual
+  bool
+  Highlight(vtkInteractorStyle* theInteractorStyle, 
+           SVTK_SelectionEvent* theSelectionEvent,
+           bool theIsHighlight);
+
+  //! Internal highlight.
+  virtual
+  void
+  Highlight(bool theIsHighlight);
+
   virtual
   void 
   SetVTKMapping(bool theIsVTKMapping); 
@@ -219,6 +291,22 @@ class VTKOCC_EXPORT VISU_Actor : public VISU_ActorBase
   vtkCell* 
   GetElemCell(vtkIdType theObjID);
 
+  //----------------------------------------------------------------------------
+  virtual void RemoveAllClippingPlanes();
+
+  virtual vtkIdType GetNumberOfClippingPlanes();
+
+  virtual bool AddClippingPlane(vtkPlane* thePlane);
+
+  virtual vtkPlane* GetClippingPlane(vtkIdType theID);
+
+  virtual vtkImplicitFunctionCollection* GetClippingPlanes();
+
+  //----------------------------------------------------------------------------
+  //! Apply the picking settings on the actor.
+  void
+  UpdatePickingSettings();
+
   //----------------------------------------------------------------------------
  protected:
   VISU_Actor();
@@ -235,6 +323,28 @@ class VTKOCC_EXPORT VISU_Actor : public VISU_ActorBase
   GetCurrentPL();
 
   //----------------------------------------------------------------------------
+  bool
+  isSubElementsHighlighted();
+
+  //----------------------------------------------------------------------------
+  vtkSmartPointer<vtkCallbackCommand> myEventCallbackCommand;
+
+  //! Main process VTK event method
+  static
+  void
+  ProcessEvents(vtkObject* theObject, 
+               unsigned long theEvent,
+               void* theClientData, 
+               void* theCallData);
+
+  //----------------------------------------------------------------------------
+ private:
+  void
+  ResetTextActor();
+
+  //----------------------------------------------------------------------------
+ protected:
+  vtkFloatingPointType myPriority;
   bool myIsVTKMapping;
   VISU::Prs3d_i* myPrs3d;
   vtkSmartPointer<VISU_PipeLine> myPipeLine;
@@ -245,6 +355,15 @@ class VTKOCC_EXPORT VISU_Actor : public VISU_ActorBase
 
   vtkSmartPointer<vtkTextMapper> myAnnotationMapper;
   vtkSmartPointer<vtkTextActor>  myAnnotationActor;
+
+  vtkSmartPointer<VISU_FramedTextActor> myTextActor;
+
+  vtkSmartPointer<vtkFeatureEdges> myFeatureEdges;
+  bool myIsFeatureEdgesAllowed;
+  bool myIsFeatureEdgesEnabled;
+
+  Selection_Mode myLastSelectionMode;
+  bool myIsSubElementsHighlighted;
 };
 
 #endif //VISU_ACTOR_H
index 1b282c013ca792240c910e50a56103c980614bf3..dbdb25ec1ce8fb4e627013ffcdbb5b091286a7d4 100644 (file)
 
 #include <vtkDataSetMapper.h>
 #include <vtkObjectFactory.h>
+#include <vtkImplicitBoolean.h>
+#include <SALOME_ExtractGeometry.h>
+#include <SALOME_ExtractPolyDataGeometry.h>
+#include <vtkImplicitFunctionCollection.h>
+#include <vtkPlane.h>
 
 #include <boost/bind.hpp>
 
@@ -48,11 +53,24 @@ vtkStandardNewMacro(VISU_DataSetActor);
 //----------------------------------------------------------------------------
 VISU_DataSetActor
 ::VISU_DataSetActor():
-  myMapper(vtkDataSetMapper::New())
+  myMapper(vtkDataSetMapper::New()),
+  myExtractor(SALOME_ExtractGeometry::New()),
+  myPolyDataExtractor(SALOME_ExtractPolyDataGeometry::New()),
+  myFunction(vtkImplicitBoolean::New())
 {
   if(MYDEBUG) MESSAGE("VISU_DataSetActor::VISU_DataSetActor - this = "<<this);
 
+  myExtractor->SetImplicitFunction(myFunction);
+  myPolyDataExtractor->SetImplicitFunction(myFunction);
+  //myExtractor->ExtractBoundaryCellsOn();
+  //myPolyDataExtractor->ExtractBoundaryCellsOn();
+
+  myFunction->SetOperationTypeToIntersection();
+
   myMapper->Delete();
+  myExtractor->Delete();
+  myPolyDataExtractor->Delete();
+  myFunction->Delete();
 }
 
 //----------------------------------------------------------------------------
@@ -71,9 +89,8 @@ VISU_DataSetActor
 
   if(VISU_UnstructuredGridPL* aPipeLine = dynamic_cast<VISU_UnstructuredGridPL*>(thePipeLine)){
     vtkDataSetMapper* aTarget = GetDataSetMapper();
-    vtkDataSetMapper* aSource = aPipeLine->GetDataSetMapper();
+    vtkDataSetMapper* aSource = aPipeLine->GetDataSetMapper();    
     VISU::CopyDataSetMapper(aTarget, aSource, true);
-    aTarget->SetLookupTable(aSource->GetLookupTable());
   }
 }
 
@@ -82,14 +99,67 @@ void
 VISU_DataSetActor
 ::SetMapperInput(vtkDataSet* theDataSet) 
 {
-  myMapper->SetInput(theDataSet);
+  if (theDataSet->IsA("vtkPolyData")) {
+    myPolyDataExtractor->SetInput(theDataSet);
+    myMapper->SetInput(myPolyDataExtractor->GetOutput());
+  } else {
+    myExtractor->SetInput(theDataSet);
+    myMapper->SetInput(myExtractor->GetOutput());
+  }
+  //  myMapper->SetInput(theDataSet);
   SetMapper(myMapper.GetPointer());
 }
 
 //----------------------------------------------------------------------------
-vtkDataSetMapper* 
-VISU_DataSetActor
-::GetDataSetMapper()
+vtkDataSetMapper* VISU_DataSetActor::GetDataSetMapper()
 {
   return myMapper.GetPointer();
 }
+
+//----------------------------------------------------------------------------
+void VISU_DataSetActor::RemoveAllClippingPlanes()
+{
+  myFunction->GetFunction()->RemoveAllItems();
+  myFunction->Modified();
+}
+
+//----------------------------------------------------------------------------
+vtkIdType VISU_DataSetActor::GetNumberOfClippingPlanes()
+{
+  return myFunction->GetFunction()->GetNumberOfItems();
+}
+
+//----------------------------------------------------------------------------
+bool VISU_DataSetActor::AddClippingPlane(vtkPlane* thePlane)
+{
+  vtkImplicitFunctionCollection* aFunctions = GetClippingPlanes();
+  aFunctions->InitTraversal();
+  vtkImplicitFunction* aItem;
+  while ((aItem = aFunctions->GetNextItem())) {
+    if (thePlane == aItem)
+      return false;
+  }
+  myFunction->AddFunction(thePlane);
+  return true;
+}
+
+//----------------------------------------------------------------------------
+vtkPlane* VISU_DataSetActor::GetClippingPlane(vtkIdType theID)
+{
+  vtkPlane* aPlane = NULL;
+  if ((theID >= 0) && (theID < GetNumberOfClippingPlanes())) {
+    vtkImplicitFunctionCollection* aFunction = myFunction->GetFunction();
+    vtkImplicitFunction* aFun = NULL;
+    aFunction->InitTraversal();
+    for (vtkIdType i = 0; i <= theID; i++)
+      aFun = aFunction->GetNextItem();
+    aPlane = dynamic_cast<vtkPlane*>(aFun);
+  }
+  return aPlane;
+}
+  
+//----------------------------------------------------------------------------
+vtkImplicitFunctionCollection* VISU_DataSetActor::GetClippingPlanes()
+{
+  return myFunction->GetFunction();
+}
index 9e7ef4573faf65264405be47e04dbda4700dee58..4af55e3e71ce480e593ea93dcf967e373e25aaeb 100644 (file)
 #include "VISU_Actor.h"
 
 class vtkDataSetMapper;
+class SALOME_ExtractGeometry;
+class SALOME_ExtractPolyDataGeometry;
+class vtkImplicitBoolean;
+class vtkImplicitFunctionCollection;
 
 #ifdef _WIN_32
 #define VTKOCC_EXPORT __declspec (dllexport)
@@ -56,6 +60,17 @@ class VTKOCC_EXPORT VISU_DataSetActor : public VISU_Actor
   vtkDataSetMapper* 
   GetDataSetMapper();
 
+  //----------------------------------------------------------------------------
+  virtual void RemoveAllClippingPlanes();
+
+  virtual vtkIdType GetNumberOfClippingPlanes();
+
+  virtual bool AddClippingPlane(vtkPlane* thePlane);
+
+  virtual vtkPlane* GetClippingPlane(vtkIdType theID);
+
+  virtual vtkImplicitFunctionCollection* GetClippingPlanes();
+
   //----------------------------------------------------------------------------
  protected:
   VISU_DataSetActor();
@@ -69,6 +84,9 @@ class VTKOCC_EXPORT VISU_DataSetActor : public VISU_Actor
 
   //----------------------------------------------------------------------------
   vtkSmartPointer<vtkDataSetMapper> myMapper;
+  vtkSmartPointer<SALOME_ExtractGeometry> myExtractor;
+  vtkSmartPointer<SALOME_ExtractPolyDataGeometry> myPolyDataExtractor;
+  vtkSmartPointer<vtkImplicitBoolean> myFunction;
 };
 
 #endif //VISU_DATASETACTOR_H
index 04837dc4b4b9efc12905a57f6f5c5534632fafd2..199941dd45fb5639e5fc4abdd93a1cf66c3162be 100644 (file)
@@ -30,6 +30,7 @@
 #include "VISU_GaussPointsPL.hxx"
 #include "VISU_GaussPtsSettings.h"
 #include "VISU_GaussPtsDeviceActor.h"
+#include "VISU_PickingSettings.h"
 #include "VISU_WidgetCtrl.hxx"
 #include "VISU_SphereWidget.hxx"
 #include "VISU_OpenGLPointSpriteMapper.hxx"
@@ -38,6 +39,7 @@
 
 #include "VISU_Event.h" 
 #include "SVTK_Actor.h"
+#include <SALOME_ExtractPolyDataGeometry.h>
 
 #include <vtkCamera.h>
 #include <vtkRenderer.h>
@@ -46,6 +48,9 @@
 #include <vtkScalarBarWidget.h>
 #include <vtkTextMapper.h>
 #include <vtkTextProperty.h>
+#include <vtkImplicitBoolean.h>
+#include <vtkImplicitFunctionCollection.h>
+#include <vtkPlane.h>
 
 #include <vtkPointData.h>
 #include <vtkDataArray.h>
@@ -124,23 +129,22 @@ VISU_GaussPtsAct
   myWidgetCtrl(NULL),
   myGaussPointsPL(NULL),
   myLastPreHighlightObjID(-1),
-  myTextActor(VISU_FramedTextActor::New()),
   myCursorPyramid(VISU_CursorPyramid::New()),
   myCursorPyramidSelected(VISU_CursorPyramid::New()),
   myCellSource(vtkUnstructuredGrid::New()),
   myCellActor(SVTK_Actor::New()),
   myScalarBarCtrl(VISU_ScalarBarCtrl::New()),
   myBarVisibility(true),
-  myPickingSettings(NULL),
   myInsideCursorSettings(NULL),
   myCurrentPL(NULL),
-  myMapper(vtkPolyDataMapper::New())
+  myMapper(vtkPolyDataMapper::New()),
+  myPolyDataExtractor(SALOME_ExtractPolyDataGeometry::New()),
+  myFunction(vtkImplicitBoolean::New())
 {
   if(MYDEBUG) MESSAGE("VISU_GaussPtsAct::VISU_GaussPtsAct - this = "<<this);
 
   myEventCallbackCommand->Delete();
   myDeviceActor->Delete();
-  myTextActor->Delete();
 
   myCursorPyramid->Delete();
   myCursorPyramid->SetPickable(0);
@@ -163,9 +167,6 @@ VISU_GaussPtsAct
   myDeviceActor->SetVisibility(true);
   myDeviceActor->SetPickable(false);
 
-  myTextActor->SetVisibility(false);
-  myTextActor->SetPickable(false);
-
   myCellSource->Allocate();
   myCellActor->Initialize();
   myCellActor->SetRepresentation(VTK_WIREFRAME);
@@ -180,6 +181,18 @@ VISU_GaussPtsAct
 
   myMapper->Delete();
   aMatrix->Delete();
+
+  myPolyDataExtractor->SetImplicitFunction(myFunction);
+  //myPolyDataExtractor->ExtractBoundaryCellsOn();
+
+  myFunction->SetOperationTypeToIntersection();
+  myPolyDataExtractor->Delete();
+  myFunction->Delete();
+
+  if( VISU_PickingSettings* aPickingSettings = VISU_PickingSettings::Get() )
+    aPickingSettings->AddObserver(VISU::UpdatePickingSettingsEvent, 
+                                 myEventCallbackCommand.GetPointer(), 
+                                 myPriority);
 }
 
 VISU_GaussPtsAct
@@ -188,7 +201,6 @@ VISU_GaussPtsAct
   if(MYDEBUG) MESSAGE("VISU_GaussPtsAct::~VISU_GaussPtsAct - this = "<<this);
   SetWidgetCtrl(NULL);
   SetInteractor(NULL);
-  SetPickingSettings(NULL);
   SetInsideCursorSettings(NULL);
 }
 
@@ -297,7 +309,6 @@ VISU_GaussPtsAct
 
   myDeviceActor->AddToRender(theRenderer);
 
-  theRenderer->AddActor(myTextActor.GetPointer());
   theRenderer->AddActor(myCellActor.GetPointer());
 
   myCursorPyramid->AddToRender(theRenderer);
@@ -313,7 +324,6 @@ VISU_GaussPtsAct
 
   myDeviceActor->RemoveFromRender(theRenderer);
   
-  theRenderer->RemoveActor(myTextActor.GetPointer());
   theRenderer->RemoveActor(myCellActor.GetPointer());
   
   myCursorPyramid->RemoveFromRender(theRenderer);
@@ -423,11 +433,14 @@ VISU_GaussPtsAct
 {
   if(MYDEBUG) MESSAGE("VISU_GaussPtsAct::SetMapperInput - this = "<<this);
 
+  myDeviceActor->SetExtractor(myPolyDataExtractor);
   myDeviceActor->SetPipeLine(GetGaussPointsPL());
   myCurrentPL = myDeviceActor->GetPipeLine();
 
   //SetMapper(myCurrentPL->GetPointSpriteMapper());
 
+  //  myPolyDataExtractor->SetInput(myCurrentPL->GetPickableDataSet());
+  //myMapper->SetInput(myPolyDataExtractor->GetOutput());
   myMapper->SetInput(myCurrentPL->GetPickableDataSet());
   SetMapper(myMapper.GetPointer());
 }
@@ -526,6 +539,7 @@ VISU_GaussPtsAct
 ::SetVisibility(int theMode)
 {
   Superclass::SetVisibility(theMode);
+  myDeviceActor->SetVisibility(GetVisibility()); // VSV
   myScalarBarCtrl->SetVisibility(theMode);
   Highlight(isHighlighted());
 }
@@ -723,6 +737,8 @@ VISU_GaussPtsAct
   bool anIsChanged = (mySelectionMode != aSelectionMode);
   bool anIsPreselected = myIsPreselected;
   myIsPreselected = false;
+
+  VISU_PickingSettings* aPickingSettings = VISU_PickingSettings::Get();
   
   if(aSelectionMode == GaussPointSelection && theIsHighlight){
     myPointPicker->Pick(theSelectionEvent->myX, 
@@ -761,25 +777,22 @@ VISU_GaussPtsAct
          vtkDataSet* aDataSet = GetInput();
          vtkPointData* aPointData = aDataSet->GetPointData();
          if(vtkDataArray *aScalarArray = aPointData->GetScalars()){
-           if ( myPickingSettings ){
-             vtkFloatingPointType aPyramidHeight = myPickingSettings->GetPyramidHeight();
-             aPyramidHeight = aPyramidHeight*myGaussPointsPL->GetMaxPointSize();
-             //vtkFloatingPointType aColor[3] = myPreHighlightActor->GetProperty()->GetColor();
-             vtkFloatingPointType aColor[3];
-             theInteractorStyle->GetCurrentRenderer()->GetBackground( aColor );
-             aColor[0] = 1. - aColor[0];
-             aColor[1] = 1. - aColor[1];
-             aColor[2] = 1. - aColor[2];
-
-             myCursorPyramid->Init(aPyramidHeight,
-                                   myPickingSettings->GetCursorSize(),
-                                   GetRadius(anObjId,aVtkId,aScalarArray),
-                                   GetMagnification(anObjId),
-                                   GetClamp(anObjId),
-                                   aLocalNodeCoord,
-                                   aColor);
-           }
-            
+           vtkFloatingPointType aPyramidHeight = aPickingSettings->GetPyramidHeight();
+           aPyramidHeight = aPyramidHeight*myGaussPointsPL->GetMaxPointSize();
+           //vtkFloatingPointType aColor[3] = myPreHighlightActor->GetProperty()->GetColor();
+           vtkFloatingPointType aColor[3];
+           theInteractorStyle->GetCurrentRenderer()->GetBackground( aColor );
+           aColor[0] = 1. - aColor[0];
+           aColor[1] = 1. - aColor[1];
+           aColor[2] = 1. - aColor[2];
+
+           myCursorPyramid->Init(aPyramidHeight,
+                                 aPickingSettings->GetCursorSize(),
+                                 GetRadius(anObjId,aVtkId,aScalarArray),
+                                 GetMagnification(anObjId),
+                                 GetClamp(anObjId),
+                                 aNodeCoord,
+                                 aColor);
          }
           this->Transform->Pop();
          myLastPreHighlightObjID = anObjId;
@@ -828,9 +841,9 @@ VISU_GaussPtsAct
   if ( !GetPickable() )
     return false;
 
-  //  int anInitialHasIndex = myIsHighlighted && mySelectionMode == GaussPointSelection;
+  //  int anInitialHasIndex = myIsSubElementsHighlighted && mySelectionMode == GaussPointSelection;
   Handle(SALOME_InteractiveObject) anIO = getIO();
-  //  myIsHighlighted = false;
+  //  myIsSubElementsHighlighted = false;
 
   Selection_Mode aSelectionMode = theSelectionEvent->mySelectionMode;
 
@@ -947,35 +960,46 @@ VISU_GaussPtsAct
   if(!mySelector.GetPointer())
     return;
 
-  if ( !myPickingSettings )
-  {
-    Superclass::Highlight(theIsHighlight);
-    return;
-  }
+  VISU_PickingSettings* aPickingSettings = VISU_PickingSettings::Get();
 
   Selection_Mode aSelectionMode = mySelector->SelectionMode();
   
-  bool anInitialHasIndex = isHighlighted() && mySelectionMode == GaussPointSelection;
+  bool anInitialHasIndex = isSubElementsHighlighted() && mySelectionMode == GaussPointSelection;
   
   TColStd_IndexedMapOfInteger aMapIndex;
   mySelector->GetIndex( getIO(), aMapIndex );
   bool aCurrentHasIndex = aMapIndex.Extent() == 1;
   bool anIsVisible = GetVisibility() && aCurrentHasIndex && theIsHighlight;
+  bool aShowTextActor = aPickingSettings->GetInfoWindowEnabled();
+  bool aShowCellActor = aPickingSettings->GetDisplayParentMesh();
 
   myOutlineActor->SetVisibility(false);
   myCursorPyramid->SetVisibility(false);
-  myTextActor->SetVisibility(false);
-  myCellActor->SetVisibility(false);
-  myCursorPyramidSelected->SetVisibility(false);
+  myTextActor->SetVisibility(anIsVisible && aShowTextActor);
+  myCellActor->SetVisibility(anIsVisible && aShowCellActor);
+  GetScalarBarCtrl()->SetIsMarked(anIsVisible);
+  myCursorPyramidSelected->SetVisibility(anIsVisible);
+  //GetScalarBarCtrl()->Update();
 
-  if(!theIsHighlight)
-    return;
+  myIsSubElementsHighlighted = aCurrentHasIndex;
+
+  // Zoom if necessary
+  if( GetVisibility() && aPickingSettings->GetCameraMovementEnabled() )
+  {
+    ChangeZoom(aPickingSettings,
+              GetRenderer(),
+              anInitialHasIndex,
+              aCurrentHasIndex);
+  }
 
   if( aSelectionMode == ActorSelection ) {
-    Superclass::highlight(theIsHighlight);
+    Superclass::Highlight(theIsHighlight);
     return;
   }
 
+  if(!theIsHighlight)
+    return;
+
   if( aSelectionMode != GaussPointSelection )
     return;
 
@@ -1031,17 +1055,20 @@ VISU_GaussPtsAct
     return;
 
   // FlyTo
-  vtkRenderWindowInteractor* anInteractor = myInteractor;
-  vtkFloatingPointType aDollyWas = anInteractor->GetDolly();
-  int aNumberOfFlyFramesWas = anInteractor->GetNumberOfFlyFrames();
+  if( anIsVisible && aPickingSettings->GetCameraMovementEnabled() )
+  {
+    vtkRenderWindowInteractor* anInteractor = myInteractor;
+    vtkFloatingPointType aDollyWas = anInteractor->GetDolly();
+    int aNumberOfFlyFramesWas = anInteractor->GetNumberOfFlyFrames();
   
-  anInteractor->SetDolly(0.0);
-  anInteractor->SetNumberOfFlyFrames(myPickingSettings->GetStepNumber());
-  anInteractor->FlyTo(aRenderer, aLocalNodeCoord);
-  aRenderer->ResetCameraClippingRange();
-  anInteractor->SetDolly(aDollyWas);
-  anInteractor->SetNumberOfFlyFrames(aNumberOfFlyFramesWas);
-  anInteractor->InvokeEvent(SVTK::ChangeRotationPoint, aLocalNodeCoord);
+    anInteractor->SetDolly(0.0);
+    anInteractor->SetNumberOfFlyFrames(aPickingSettings->GetStepNumber());
+    anInteractor->FlyTo(aRenderer, aNodeCoord);
+    aRenderer->ResetCameraClippingRange();
+    anInteractor->SetDolly(aDollyWas);
+    anInteractor->SetNumberOfFlyFrames(aNumberOfFlyFramesWas);
+    anInteractor->InvokeEvent(SVTK::ChangeRotationPoint, aNodeCoord);
+  }
   //
   std::ostringstream aStr;
   //  int anObjId = aMapIndex(1);
@@ -1061,10 +1088,10 @@ VISU_GaussPtsAct
       GetScalarBarCtrl()->SetMarkValue(aVal);
       GetScalarBarCtrl()->Update();
       //
-      vtkFloatingPointType aPyramidHeight = myPickingSettings->GetPyramidHeight();
+      vtkFloatingPointType aPyramidHeight = aPickingSettings->GetPyramidHeight();
       aPyramidHeight = aPyramidHeight*myGaussPointsPL->GetMaxPointSize();
       myCursorPyramidSelected->Init(aPyramidHeight,
-                                   myPickingSettings->GetCursorSize(),
+                                   aPickingSettings->GetCursorSize(),
                                    GetRadius(anObjId,aVtkId,aScalarArray),
                                    GetMagnification(anObjId),
                                    GetClamp(anObjId),
@@ -1106,55 +1133,26 @@ VISU_GaussPtsAct
     //
     // myTextActor
     std::string aString = aStr.str();
-    myTextActor->SetModePosition(myPickingSettings->GetInfoWindowPosition());
-    myTextActor->SetTransparency(myPickingSettings->GetInfoWindowTransparency());
+    myTextActor->SetModePosition(aPickingSettings->GetInfoWindowPosition());
+    myTextActor->SetTransparency(aPickingSettings->GetInfoWindowTransparency());
     myTextActor->SetWorldPoint(aWorldCoord);
     myTextActor->SetText(aString.c_str());
-    myTextActor->SetVisibility(anIsVisible && theIsHighlight);
+    myTextActor->SetVisibility(anIsVisible && theIsHighlight && aShowTextActor);
     //
     // myCellActor
-    if(myPickingSettings->GetDisplayParentMesh()){
-      const VISU::PGaussPtsIDMapper& aGaussPtsIDMapper = 
-       myGaussPointsPL->GetGaussPtsIDMapper();
-      VISU::TNamedIDMapper* aParent = aGaussPtsIDMapper->GetParent();
-      
-      myCellSource->Reset();
-      myCellSource->Modified(); // a VTK bug
-      vtkUnstructuredGrid* aDataSet = aParent->GetUnstructuredGridOutput();
-      myCellSource->SetPoints(aDataSet->GetPoints());
-      
-      VISU::TGaussPointID aGaussPointID = aGaussPtsIDMapper->GetObjID(anObjId);
-      vtkIdType aCellID = aGaussPointID.first;
-      vtkCell* aCell = aParent->GetElemCell(aCellID);
-      myCellSource->InsertNextCell(aCell->GetCellType(),aCell->GetPointIds());
-      myCellActor->SetVisibility(anIsVisible && theIsHighlight);
-      myCellActor->SetRepresentation(VTK_WIREFRAME);
-    }
-    else
-      myCellActor->SetVisibility(false);
-  }
-}
-
-
-//----------------------------------------------------------------
-void
-VISU_GaussPtsAct
-::SetPickingSettings(VISU_PickingSettings* thePickingSettings)
-{
-  if(myPickingSettings == thePickingSettings)
-    return;
-
-  if(myPickingSettings)
-    myPickingSettings->RemoveObserver(myEventCallbackCommand.GetPointer());
-
-  myPickingSettings = thePickingSettings;
-
-  if(thePickingSettings)
-  {
-    thePickingSettings->AddObserver(VISU::UpdatePickingSettingsEvent, 
-                                   myEventCallbackCommand.GetPointer(), 
-                                   myPriority);
-    this->UpdatePickingSettings();
+    const VISU::PGaussPtsIDMapper& aGaussPtsIDMapper = myGaussPointsPL->GetGaussPtsIDMapper();
+    VISU::TNamedIDMapper* aParent = aGaussPtsIDMapper->GetParent();
+    //
+    myCellSource->Reset();
+    myCellSource->Modified(); // a VTK bug
+    vtkUnstructuredGrid* aCellDataSet = aParent->GetUnstructuredGridOutput();
+    myCellSource->SetPoints(aCellDataSet->GetPoints());
+    //  
+    VISU::TGaussPointID aGaussPointID = aGaussPtsIDMapper->GetObjID(anObjId);
+    vtkIdType aCellID = aGaussPointID.first;
+    vtkCell* aCell = aParent->GetElemCell(aCellID);
+    myCellSource->InsertNextCell(aCell->GetCellType(),aCell->GetPointIds());
+    myCellActor->SetVisibility(anIsVisible && theIsHighlight && aShowCellActor);
   }
 }
 
@@ -1162,19 +1160,21 @@ void
 VISU_GaussPtsAct
 ::UpdatePickingSettings()
 {
-  if(!myPickingSettings)
+  //printf( "VISU_GaussPtsAct::UpdatePickingSettings()\n" );
+  VISU_PickingSettings* aPickingSettings = VISU_PickingSettings::Get();
+  if(!aPickingSettings)
     return;
 
-  myTextActor->SetModePosition(myPickingSettings->GetInfoWindowPosition());
-  myTextActor->SetTransparency(myPickingSettings->GetInfoWindowTransparency());
+  myTextActor->SetModePosition(aPickingSettings->GetInfoWindowPosition());
+  myTextActor->SetTransparency(aPickingSettings->GetInfoWindowTransparency());
 
-  vtkFloatingPointType aHeight = myGaussPointsPL->GetMaxPointSize()*myPickingSettings->GetPyramidHeight();
-  vtkFloatingPointType aCursorSize = myPickingSettings->GetCursorSize();
+  vtkFloatingPointType aHeight = myGaussPointsPL->GetMaxPointSize()*aPickingSettings->GetPyramidHeight();
+  vtkFloatingPointType aCursorSize = aPickingSettings->GetCursorSize();
   myCursorPyramid->SetPreferences(aHeight,aCursorSize);
   myCursorPyramidSelected->SetPreferences(aHeight,aCursorSize);
 
-  myHighlightActor->GetProperty()->SetColor( myPickingSettings->GetColor() );
-  myPointPicker->SetTolerance( myPickingSettings->GetPointTolerance() );
+  myHighlightActor->GetProperty()->SetColor( aPickingSettings->GetColor() );
+  myPointPicker->SetTolerance( aPickingSettings->GetPointTolerance() );
 
   Highlight(isHighlighted());
 
@@ -1256,6 +1256,51 @@ VISU_GaussPtsAct
   return aTime;
 }
 
+void VISU_GaussPtsAct::RemoveAllClippingPlanes()
+{
+  myFunction->GetFunction()->RemoveAllItems();
+  myFunction->Modified();
+}
+
+vtkIdType VISU_GaussPtsAct::GetNumberOfClippingPlanes()
+{
+  return myFunction->GetFunction()->GetNumberOfItems();
+}
+
+bool VISU_GaussPtsAct::AddClippingPlane(vtkPlane* thePlane)
+{
+  vtkImplicitFunctionCollection* aFunctions = GetClippingPlanes();
+  aFunctions->InitTraversal();
+  vtkImplicitFunction* aItem;
+  while ((aItem = aFunctions->GetNextItem())) {
+    if (thePlane == aItem)
+      return false;
+  }
+  myFunction->AddFunction(thePlane);
+  return true;
+}
+
+vtkPlane* VISU_GaussPtsAct::GetClippingPlane(vtkIdType theID)
+{
+  vtkPlane* aPlane = NULL;
+  if ((theID >= 0) && (theID < GetNumberOfClippingPlanes())) {
+    vtkImplicitFunctionCollection* aFunction = myFunction->GetFunction();
+    vtkImplicitFunction* aFun = NULL;
+    aFunction->InitTraversal();
+    for (vtkIdType i = 0; i <= theID; i++)
+      aFun = aFunction->GetNextItem();
+    aPlane = dynamic_cast<vtkPlane*>(aFun);
+  }
+  return aPlane;
+}
+
+vtkImplicitFunctionCollection* VISU_GaussPtsAct::GetClippingPlanes()
+{
+  return myFunction->GetFunction();
+}
+
+
+
 //==============================================================================
 vtkStandardNewMacro(VISU_GaussPtsAct1);
 
@@ -1314,16 +1359,16 @@ VISU_GaussPtsAct1
 {
   Superclass::AddToRender(theRenderer);
 
-  myInsideDeviceActor->AddToRender(theRenderer);
-  myOutsideDeviceActor->AddToRender(theRenderer);
+  //myInsideDeviceActor->AddToRender(theRenderer);
+  //myOutsideDeviceActor->AddToRender(theRenderer);
 }
 
 void 
 VISU_GaussPtsAct1
 ::RemoveFromRender(vtkRenderer* theRenderer)
 {
-  myInsideDeviceActor->RemoveFromRender(theRenderer);
-  myOutsideDeviceActor->RemoveFromRender(theRenderer);
+  //myInsideDeviceActor->RemoveFromRender(theRenderer);
+  //myOutsideDeviceActor->RemoveFromRender(theRenderer);
 
   Superclass::RemoveFromRender(theRenderer);
 }
@@ -1401,18 +1446,18 @@ VISU_GaussPtsAct1
 
   Superclass::SetMapperInput(theDataSet);
 
-  if(VISU_GaussPointsPL* aPipeLine = CreatePipeLine(GetGaussPointsPL())){
-    myInsideDeviceActor->SetPipeLine(aPipeLine);
-    aPipeLine->Delete();
-  }
+//   if(VISU_GaussPointsPL* aPipeLine = CreatePipeLine(GetGaussPointsPL())){
+//     myInsideDeviceActor->SetPipeLine(aPipeLine);
+//     aPipeLine->Delete();
+//   }
 
-  if(VISU_GaussPointsPL* aPipeLine = CreatePipeLine(GetGaussPointsPL())){
-    myOutsideDeviceActor->SetPipeLine(aPipeLine);
-    aPipeLine->Delete();
+//   if(VISU_GaussPointsPL* aPipeLine = CreatePipeLine(GetGaussPointsPL())){
+//     myOutsideDeviceActor->SetPipeLine(aPipeLine);
+//     aPipeLine->Delete();
 
-    aPipeLine->SetExtractBoundaryCells(true);
-    aPipeLine->SetExtractInside(true);
-  }
+//     aPipeLine->SetExtractBoundaryCells(true);
+//     aPipeLine->SetExtractInside(true);
+//   }
 }
 
 
@@ -1492,7 +1537,7 @@ VISU_GaussPtsAct1
 
   bool aVisisbility = GetVisibility();
   bool anIsSegementation = IsSegmentationEnabled();
-  myDeviceActor->SetVisibility(aVisisbility && !anIsSegementation);
+  myDeviceActor->SetVisibility(aVisisbility/* && !anIsSegementation*/);
   myInsideDeviceActor->SetVisibility(aVisisbility && anIsSegementation);
   myOutsideDeviceActor->SetVisibility(aVisisbility && anIsSegementation);
 
@@ -1545,7 +1590,7 @@ VISU_GaussPtsAct1
 
   aPipeline->SetImplicitFunction(anImplicitFunction); // To restore
   aPipeline->SetExtractBoundaryCells(true);
-  aPipeline->SetExtractInside(true);
+  //aPipeline->SetExtractInside(true);
   aPipeline->SetMagnification( aMagnification );
 
   aPipeline->SetPrimitiveType( myOutsideCursorSettings->GetPrimitiveType() );
@@ -1615,7 +1660,7 @@ VISU_GaussPtsAct1
   case vtkCommand::EndInteractionEvent: {
     bool aVisisbility = GetVisibility();
     bool anIsSegementation = IsSegmentationEnabled();
-    myDeviceActor->SetVisibility(aVisisbility && !anIsSegementation);
+    myDeviceActor->SetVisibility(aVisisbility/* && !anIsSegementation*/);
     myInsideDeviceActor->SetVisibility(aVisisbility && anIsSegementation);
     myOutsideDeviceActor->SetVisibility(aVisisbility && anIsSegementation);
     break;
@@ -1684,15 +1729,15 @@ VISU_GaussPtsAct2
 ::SetMapperInput(vtkDataSet* theDataSet) 
 {
   if(MYDEBUG2) MESSAGE("VISU_GaussPtsAct2::SetMapperInput - this = "<<this);
-
-  if(VISU_GaussPointsPL* aPipeLine = CreatePipeLine(GetGaussPointsPL())){
-    myDeviceActor->SetPipeLine(aPipeLine);
-    myCurrentPL = aPipeLine;
-    aPipeLine->Delete();
-
-    myMapper->SetInput(myCurrentPL->GetPickableDataSet());
-    SetMapper(myMapper.GetPointer());
-  }
+  Superclass::SetMapperInput(theDataSet);
+//   if(VISU_GaussPointsPL* aPipeLine = CreatePipeLine(GetGaussPointsPL())){
+//     myDeviceActor->SetPipeLine(aPipeLine);
+//     myCurrentPL = aPipeLine;
+//     aPipeLine->Delete();
+
+//     myMapper->SetInput(myCurrentPL->GetPickableDataSet());
+//     SetMapper(myMapper.GetPointer());
+//   }
 }
 
 //----------------------------------------------------------------------------
index 4685f60dc9b00464913aa8d14879ba8e96369f3e..5c0b45ed3acbd50b709610b0a50398cfb2f101fb 100644 (file)
@@ -60,10 +60,11 @@ class vtkInteractorObserver;
 class vtkCallbackCommand;
 
 class VISU_ScalarBarCtrl;
-class VISU_PickingSettings;
 class VISU_InsideCursorSettings;
 class VISU_OutsideCursorSettings;
 
+class SALOME_ExtractPolyDataGeometry;
+class vtkImplicitBoolean;
 
 //============================================================================
 //! Base class for Gauss Points Actors.
@@ -236,9 +237,6 @@ class VTKOCC_EXPORT VISU_GaussPtsAct : public VISU_Actor
   UpdateInsideCursorSettings( PDeviceActor );
 
   //----------------------------------------------------------------------------
-  void
-  SetPickingSettings(VISU_PickingSettings* thePickingSettings);
-
   //! Apply the picking settings on the actor.
   void
   UpdatePickingSettings();
@@ -256,6 +254,17 @@ class VTKOCC_EXPORT VISU_GaussPtsAct : public VISU_Actor
   unsigned long int 
   GetMTime();
 
+  //----------------------------------------------------------------------------
+  virtual void RemoveAllClippingPlanes();
+
+  virtual vtkIdType GetNumberOfClippingPlanes();
+
+  virtual bool AddClippingPlane(vtkPlane* thePlane);
+
+  virtual vtkPlane* GetClippingPlane(vtkIdType theID);
+
+  virtual vtkImplicitFunctionCollection* GetClippingPlanes();
+
  protected:
   //----------------------------------------------------------------------------
   VISU_GaussPtsAct();
@@ -319,11 +328,11 @@ class VTKOCC_EXPORT VISU_GaussPtsAct : public VISU_Actor
   vtkSmartPointer<VISU_GaussPointsPL> myGaussPointsPL;
 
   vtkSmartPointer<vtkPolyDataMapper> myMapper;
+  vtkSmartPointer<SALOME_ExtractPolyDataGeometry> myPolyDataExtractor;
+  vtkSmartPointer<vtkImplicitBoolean> myFunction;
 
   vtkIdType myLastPreHighlightObjID;
 
-  vtkSmartPointer<VISU_FramedTextActor> myTextActor;
-
   vtkSmartPointer<VISU_CursorPyramid> myCursorPyramid;
   vtkSmartPointer<VISU_CursorPyramid> myCursorPyramidSelected;
   
@@ -334,7 +343,6 @@ class VTKOCC_EXPORT VISU_GaussPtsAct : public VISU_Actor
   vtkSmartPointer<VISU_ScalarBarCtrl> myScalarBarCtrl;
 
   VISU_InsideCursorSettings* myInsideCursorSettings;
-  VISU_PickingSettings* myPickingSettings;
 };
 
 
index c4b084daa489a8343fc7853a13d6a0f97bfddc14..654243d65e98f7ce008c8e9d47b285ce8544e116 100644 (file)
@@ -34,6 +34,7 @@
 
 #include "VTKViewer_Transform.h"
 #include "VTKViewer_TransformFilter.h"
+#include <SALOME_ExtractPolyDataGeometry.h>
 
 #include <vtkObjectFactory.h>
 #include <vtkPolyData.h>
@@ -136,7 +137,8 @@ vtkStandardNewMacro(VISU_GaussDeviceActorBase);
 
 VISU_GaussDeviceActorBase
 ::VISU_GaussDeviceActorBase():
-  myTransformFilter(VTKViewer_TransformFilter::New())
+  myTransformFilter(VTKViewer_TransformFilter::New()),
+  myPolyDataExtractor(0)
 {
   if(MYDEBUG) MESSAGE("VISU_GaussDeviceActorBase - "<<this);
 
@@ -214,9 +216,14 @@ VISU_GaussDeviceActorBase
   myMapper = theMapper;
 
   int anId = 0;
-  myPassFilter[ anId ]->SetInput( aDataSet ); 
+  if (myPolyDataExtractor) {
+    myPolyDataExtractor->SetInput(aDataSet);
+    myPassFilter[ anId ]->SetInput( myPolyDataExtractor->GetOutput() ); 
+  } else {
+    myPassFilter[ anId ]->SetInput( aDataSet ); 
+  }
   myPassFilter[ anId + 1 ]->SetInput( myPassFilter[ anId ]->GetOutput() );
-  
+
   anId++;
   myTransformFilter->SetInput( myPassFilter[ anId ]->GetPolyDataOutput() );
   
@@ -586,7 +593,7 @@ VISU_FramedTextActor::VISU_FramedTextActor()
   myTextProperty->SetFontFamilyToArial();
   //
   myTextMapper=vtkTextMapper::New();
-  myTextMapper->SetInput("some text");
+  myTextMapper->SetInput("");
   myTextMapper->GetTextProperty()->ShallowCopy(myTextProperty);
   myTextActor=vtkActor2D::New();
   myTextActor->SetMapper(myTextMapper);
index 7ff5c369ea9e729b6e941d242b519ef9436161d4..5b25e78e15b8a3b4f12a5541834fad73ed389e9f 100644 (file)
@@ -43,6 +43,7 @@ class VISU_GaussPointsPL;
 
 class vtkPassThroughFilter;
 class vtkImageData;
+class SALOME_ExtractPolyDataGeometry;
 
 
 //============================================================================
@@ -92,6 +93,13 @@ class VISU_GaussDeviceActorBase: public vtkLODActor
   virtual
   unsigned long int
   GetMemorySize();
+
+  //----------------------------------------------------------------------------
+  void SetExtractor(SALOME_ExtractPolyDataGeometry* theExtractor) 
+    { myPolyDataExtractor = theExtractor; }
+
+  SALOME_ExtractPolyDataGeometry* GetExtractor() const
+    { return myPolyDataExtractor; }
  
  protected:
   //----------------------------------------------------------------------------
@@ -101,6 +109,8 @@ class VISU_GaussDeviceActorBase: public vtkLODActor
   typedef vtkSmartPointer<vtkPassThroughFilter> PPassThroughFilter;
   std::vector<PPassThroughFilter> myPassFilter;
 
+  SALOME_ExtractPolyDataGeometry* myPolyDataExtractor;
+
   VISU_GaussDeviceActorBase();
   ~VISU_GaussDeviceActorBase();
 
index 7c04a8f02434759b52fa2dc1df9b85ab35ac7350..db7bd70d699d7f7659f9c73b75a84f34803b62bc 100644 (file)
@@ -30,6 +30,9 @@
 #include <SUIT_ResourceMgr.h>
 #include <SUIT_Session.h>
 
+#include "SUIT_ResourceMgr.h"
+#include "SUIT_Session.h"
+
 #include <vtkObjectFactory.h>
 #include <vtkImageData.h>
 
@@ -39,7 +42,6 @@
 vtkStandardNewMacro( VISU_GaussPtsSettings );
 vtkStandardNewMacro( VISU_InsideCursorSettings );
 vtkStandardNewMacro( VISU_OutsideCursorSettings );
-vtkStandardNewMacro( VISU_PickingSettings );
 
 //----------------------------------------------------------------
 VISU_GaussPtsSettings::VISU_GaussPtsSettings()
@@ -86,44 +88,3 @@ VISU_OutsideCursorSettings::VISU_OutsideCursorSettings() :
 VISU_OutsideCursorSettings::~VISU_OutsideCursorSettings()
 {
 }
-
-//----------------------------------------------------------------
-VISU_PickingSettings::VISU_PickingSettings()
-{
-  float aCursorSize = 0.5;
-  float aPyramidHeight = 10.0;
-  float aPointTolerance = 0.1;
-  QColor aColor = Qt::yellow;
-  int anInfoWindowTransparency = 50;
-  int anInfoWindowPosition = VISU_PickingSettings::BelowPoint;
-  float aZoomFactor = 1.5;
-  int aStepNumber = 10;
-  bool aDisplayParentMesh = false;
-  
-  SUIT_ResourceMgr* aResourceMgr = SUIT_Session::session()->resourceMgr();
-
-  this->CursorSize = aResourceMgr->doubleValue( "VISU", "picking_cursor_size", aCursorSize );
-
-  this->PyramidHeight = aResourceMgr->doubleValue( "VISU", "picking_pyramid_height", aPyramidHeight );
-
-  this->PointTolerance = aResourceMgr->doubleValue( "VISU", "picking_point_tolerance", aPointTolerance );
-
-  aColor = aResourceMgr->colorValue( "VISU", "picking_selection_color", aColor );
-  this->Color[0] = aColor.red() / 255.0;
-  this->Color[1] = aColor.green() / 255.0;
-  this->Color[2] = aColor.blue() / 255.0;
-
-  this->InfoWindowTransparency = aResourceMgr->integerValue( "VISU", "picking_transparency", anInfoWindowTransparency ) / 100.0;
-
-  this->InfoWindowPosition = aResourceMgr->integerValue( "VISU", "picking_position", anInfoWindowPosition );
-
-  this->ZoomFactor = aResourceMgr->doubleValue( "VISU", "picking_zoom_factor", aZoomFactor );
-  
-  this->StepNumber = aResourceMgr->integerValue( "VISU", "picking_step_number", aStepNumber );
-
-  this->DisplayParentMesh = aResourceMgr->booleanValue( "VISU", "picking_display_parent_mesh", aDisplayParentMesh );
-}
-
-VISU_PickingSettings::~VISU_PickingSettings()
-{
-}
index a34dbca6cfeb72a67c2382c845305b608e9efd63..11435aebee5317196c40578c1c2860e9bcc7f556 100644 (file)
@@ -44,7 +44,6 @@ namespace VISU
   const vtkIdType UpdateFromSettingsEvent        = vtkCommand::UserEvent + 100; 
   const vtkIdType UpdateInsideSettingsEvent      = vtkCommand::UserEvent + 101; 
   const vtkIdType UpdateOutsideSettingsEvent     = vtkCommand::UserEvent + 102; 
-  const vtkIdType UpdatePickingSettingsEvent     = vtkCommand::UserEvent + 103; 
 }
 
 
@@ -162,68 +161,4 @@ class VTKOCC_EXPORT VISU_OutsideCursorSettings : public VISU_GaussPtsSettings
   vtkFloatingPointType Color[3];
 };
 
-
-//! Class of Picking settings.
-/*!
- * Contains information about the following parameters:
- * Cursor Pyramid height, Info Window transparency,
- * Info Window position, Zoom factor on first selected point,
- * Camera movement steps number and Display parent mesh.
- * Used by Gauss Points Actor.
- */
-class VTKOCC_EXPORT VISU_PickingSettings : public vtkObject
-{
- public:
-  enum { BelowPoint = 0, TopLeftCorner };
-
- public:
-  vtkTypeMacro( VISU_PickingSettings, vtkObject );
-
-  VISU_PickingSettings();
-  virtual ~VISU_PickingSettings();
-
-  static
-  VISU_PickingSettings*
-  New();
-
-  vtkSetMacro( PyramidHeight, vtkFloatingPointType );
-  vtkGetMacro( PyramidHeight, vtkFloatingPointType );
-
-  vtkSetMacro( CursorSize, vtkFloatingPointType );
-  vtkGetMacro( CursorSize, vtkFloatingPointType );
-
-  vtkSetVector3Macro( Color, vtkFloatingPointType );
-  vtkGetVector3Macro( Color, vtkFloatingPointType );
-
-  vtkSetMacro( PointTolerance, vtkFloatingPointType );
-  vtkGetMacro( PointTolerance, vtkFloatingPointType );
-
-  vtkSetMacro( InfoWindowTransparency, vtkFloatingPointType );
-  vtkGetMacro( InfoWindowTransparency, vtkFloatingPointType );
-
-  vtkSetMacro( InfoWindowPosition, int );
-  vtkGetMacro( InfoWindowPosition, int );
-
-  vtkSetMacro( ZoomFactor, vtkFloatingPointType );
-  vtkGetMacro( ZoomFactor, vtkFloatingPointType );
-
-  vtkSetMacro( StepNumber, int );
-  vtkGetMacro( StepNumber, int );
-
-  vtkSetMacro( DisplayParentMesh, bool );
-  vtkGetMacro( DisplayParentMesh, bool );
-
-private:
-  vtkFloatingPointType PyramidHeight;
-  vtkFloatingPointType CursorSize;
-  vtkFloatingPointType PointTolerance;
-  vtkFloatingPointType Color[3];
-  vtkFloatingPointType InfoWindowTransparency;
-  int                 InfoWindowPosition;
-  vtkFloatingPointType ZoomFactor;
-  int                 StepNumber;
-  bool                DisplayParentMesh;
-};
-
-
 #endif
index cf2e7cfc0a3a7c06339bd6af7f8aaa631c19d20c..486498dabe2278f4a96cb73d2c612c6bf8321259 100644 (file)
@@ -212,6 +212,64 @@ VISU_MeshAct
   myEdgeActor->UnShrink();
 }
 
+//----------------------------------------------------------------------------
+void
+VISU_MeshAct
+::SetFeatureEdgesAllowed(bool theIsFeatureEdgesAllowed)
+{
+  Superclass::SetFeatureEdgesAllowed(theIsFeatureEdgesAllowed);
+
+  mySurfaceActor->SetFeatureEdgesAllowed(theIsFeatureEdgesAllowed);
+}
+
+void
+VISU_MeshAct
+::SetFeatureEdgesAngle(vtkFloatingPointType theValue)
+{
+  Superclass::SetFeatureEdgesAngle(theValue);
+
+  mySurfaceActor->SetFeatureEdgesAngle(theValue);
+}
+
+void
+VISU_MeshAct
+::SetFeatureEdgesFlags(bool theIsFeatureEdges,
+                      bool theIsBoundaryEdges,
+                      bool theIsManifoldEdges,
+                      bool theIsNonManifoldEdges)
+{
+  Superclass::SetFeatureEdgesFlags(theIsFeatureEdges,
+                                  theIsBoundaryEdges,
+                                  theIsManifoldEdges,
+                                  theIsNonManifoldEdges);
+
+  mySurfaceActor->SetFeatureEdgesFlags(theIsFeatureEdges,
+                                      theIsBoundaryEdges,
+                                      theIsManifoldEdges,
+                                      theIsNonManifoldEdges);
+}
+
+void
+VISU_MeshAct
+::SetFeatureEdgesColoring(bool theIsColoring)
+{
+  Superclass::SetFeatureEdgesColoring(theIsColoring);
+
+  mySurfaceActor->SetFeatureEdgesColoring(theIsColoring);
+}
+
+//----------------------------------------------------------------------------
+void
+VISU_MeshAct
+::SetFeatureEdgesEnabled(bool theIsFeatureEdgesEnabled)
+{
+  if(theIsFeatureEdgesEnabled && myRepresentation == VTK_POINTS)
+    return;
+
+  Superclass::SetFeatureEdgesEnabled(theIsFeatureEdgesEnabled);
+
+  mySurfaceActor->SetFeatureEdgesEnabled(theIsFeatureEdgesEnabled);
+}
 
 //----------------------------------------------------------------------------
 void 
@@ -288,6 +346,10 @@ VISU_MeshAct
     myEdgeActor->SetAllocatedRenderTime(this->AllocatedRenderTime/2.0,ren);
     myEdgeActor->RenderOpaqueGeometry(ren);
     break;
+  case FeatureEdges :
+    mySurfaceActor->SetAllocatedRenderTime(this->AllocatedRenderTime,ren);
+    mySurfaceActor->RenderOpaqueGeometry(ren);
+    break;
   }
   return 1;
 }
@@ -322,6 +384,10 @@ VISU_MeshAct
     myEdgeActor->SetAllocatedRenderTime(this->AllocatedRenderTime/2.0,ren);
     myEdgeActor->RenderTranslucentGeometry(ren);
     break;
+  case FeatureEdges :
+    mySurfaceActor->SetAllocatedRenderTime(this->AllocatedRenderTime,ren);
+    mySurfaceActor->RenderTranslucentGeometry(ren);
+    break;
   }
   return 1;
 }
index 5a5778d3832d7897ae4aeeed84e873ac551cb5a6..86ea730899b041a92156c21abdee505d4ce2fde1 100644 (file)
@@ -99,6 +99,29 @@ class VTKOCC_EXPORT VISU_MeshAct : public VISU_DataSetActor
   void
   UnShrink(); 
 
+  virtual
+  void
+  SetFeatureEdgesAllowed(bool theIsFeatureEdgesAllowed);
+
+  virtual
+  void
+  SetFeatureEdgesEnabled(bool theIsFeatureEdgesEnabled);
+
+  virtual
+  void
+  SetFeatureEdgesAngle(vtkFloatingPointType theAngle = 30.0); 
+
+  virtual
+  void
+  SetFeatureEdgesFlags(bool theIsFeatureEdges,
+                      bool theIsBoundaryEdges,
+                      bool theIsManifoldEdges,
+                      bool theIsNonManifoldEdges);
+
+  virtual
+  void
+  SetFeatureEdgesColoring(bool theIsColoring);
+
   //! Gets memory size used by the instance (bytes).
   virtual
   unsigned long int
diff --git a/src/OBJECT/VISU_PickingSettings.cxx b/src/OBJECT/VISU_PickingSettings.cxx
new file mode 100644 (file)
index 0000000..982f5c1
--- /dev/null
@@ -0,0 +1,90 @@
+//  VISU OBJECT : interactive object for VISU entities implementation
+//
+//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
+// 
+//  This library is free software; you can redistribute it and/or 
+//  modify it under the terms of the GNU Lesser General Public 
+//  License as published by the Free Software Foundation; either 
+//  version 2.1 of the License. 
+// 
+//  This library is distributed in the hope that it will be useful, 
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of 
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
+//  Lesser General Public License for more details. 
+// 
+//  You should have received a copy of the GNU Lesser General Public 
+//  License along with this library; if not, write to the Free Software 
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
+// 
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+//
+//
+//  File   : VISU_PickingSettings.cxx
+//  Author : Oleg UVAROV
+//  Module : VISU
+
+#include "VISU_PickingSettings.h"
+
+#include "SUIT_ResourceMgr.h"
+#include "SUIT_Session.h"
+
+#include <vtkObjectFactory.h>
+
+vtkStandardNewMacro( VISU_PickingSettings );
+
+VISU_PickingSettings* VISU_PickingSettings::Get()
+{
+  static VISU_PickingSettings* aPickingSettings = VISU_PickingSettings::New();
+
+  if( aPickingSettings->GetIsInitial() )
+  {
+    SUIT_ResourceMgr* aResourceMgr = SUIT_Session::session()->resourceMgr();
+
+    aPickingSettings->SetCursorSize( aResourceMgr->doubleValue( "VISU", "picking_cursor_size", 0.5 ) );
+    aPickingSettings->SetPyramidHeight( aResourceMgr->doubleValue( "VISU", "picking_pyramid_height", 10.0 ) );
+    aPickingSettings->SetPointTolerance( aResourceMgr->doubleValue( "VISU", "picking_point_tolerance", 0.1 ) );
+    aPickingSettings->SetInfoWindowEnabled( aResourceMgr->booleanValue( "VISU", "picking_info_window", false ) );
+    aPickingSettings->SetInfoWindowTransparency( aResourceMgr->integerValue( "VISU", "picking_transparency", 50 ) / 100.0 );
+    aPickingSettings->SetInfoWindowPosition( aResourceMgr->integerValue( "VISU", "picking_position", VISU_PickingSettings::TopLeftCorner ) );
+    aPickingSettings->SetCameraMovementEnabled( aResourceMgr->booleanValue( "VISU", "picking_camera_movement", true ) );
+    aPickingSettings->SetZoomFactor( aResourceMgr->doubleValue( "VISU", "picking_zoom_factor", 1.5 ) );
+    aPickingSettings->SetStepNumber( aResourceMgr->integerValue( "VISU", "picking_step_number", 10 ) );
+    aPickingSettings->SetDisplayParentMesh( aResourceMgr->booleanValue( "VISU", "picking_display_parent_mesh", true ) );
+
+    QColor aSelectionColor = aResourceMgr->colorValue( "VISU", "picking_selection_color", Qt::yellow );
+    vtkFloatingPointType aColor[3];
+    aColor[0] = aSelectionColor.red() / 255.0;
+    aColor[1] = aSelectionColor.green() / 255.0;
+    aColor[2] = aSelectionColor.blue() / 255.0;
+    aPickingSettings->SetColor( aColor );
+
+    aPickingSettings->SetIsInitial( false );
+  }
+
+  return aPickingSettings;
+}
+
+VISU_PickingSettings::VISU_PickingSettings()
+{
+  this->IsInitial              = true;
+
+  this->PyramidHeight          = -1;
+  this->CursorSize             = -1;
+  this->PointTolerance         = -1;
+  this->Color[0]               = -1;
+  this->Color[1]               = -1;
+  this->Color[2]               = -1;
+  this->InfoWindowEnabled      = false;
+  this->InfoWindowTransparency = -1;
+  this->InfoWindowPosition     = -1;
+  this->CameraMovementEnabled  = false;
+  this->ZoomFactor             = -1;
+  this->StepNumber             = -1;
+  this->DisplayParentMesh      = false;
+}
+
+VISU_PickingSettings::~VISU_PickingSettings()
+{
+}
diff --git a/src/OBJECT/VISU_PickingSettings.h b/src/OBJECT/VISU_PickingSettings.h
new file mode 100644 (file)
index 0000000..c5f30b3
--- /dev/null
@@ -0,0 +1,128 @@
+//  VISU OBJECT : interactive object for VISU entities implementation
+//
+//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
+// 
+//  This library is free software; you can redistribute it and/or 
+//  modify it under the terms of the GNU Lesser General Public 
+//  License as published by the Free Software Foundation; either 
+//  version 2.1 of the License. 
+// 
+//  This library is distributed in the hope that it will be useful, 
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of 
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
+//  Lesser General Public License for more details. 
+// 
+//  You should have received a copy of the GNU Lesser General Public 
+//  License along with this library; if not, write to the Free Software 
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
+// 
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+//
+//
+//  File   : VISU_PickingSettings.cxx
+//  Author : Oleg UVAROV
+//  Module : VISU
+
+#ifndef VISU_PickingSettings_HeaderFile
+#define VISU_PickingSettings_HeaderFile
+
+#include <vtkObject.h>
+#include <vtkCommand.h>
+
+#include "VTKViewer.h"
+
+#include "VISU_Actor.h"
+
+//============================================================================
+namespace VISU
+{
+  const vtkIdType UpdatePickingSettingsEvent     = vtkCommand::UserEvent + 103; 
+}
+
+//! Class of Picking settings.
+/*!
+ * Contains information about the following parameters:
+ * Cursor Pyramid height, Info Window transparency,
+ * Info Window position, Zoom factor on first selected point,
+ * Camera movement steps number and Display parent mesh.
+ */
+class VTKOCC_EXPORT VISU_PickingSettings : public vtkObject
+{
+ public:
+  enum { BelowPoint = 0, TopLeftCorner };
+
+ public:
+  vtkTypeMacro( VISU_PickingSettings, vtkObject );
+
+  static
+  VISU_PickingSettings*
+  Get();
+
+  static
+  VISU_PickingSettings*
+  New();
+
+  vtkSetMacro( IsInitial, bool );
+  vtkGetMacro( IsInitial, bool );
+
+  vtkSetMacro( PyramidHeight, vtkFloatingPointType );
+  vtkGetMacro( PyramidHeight, vtkFloatingPointType );
+
+  vtkSetMacro( CursorSize, vtkFloatingPointType );
+  vtkGetMacro( CursorSize, vtkFloatingPointType );
+
+  vtkSetVector3Macro( Color, vtkFloatingPointType );
+  vtkGetVector3Macro( Color, vtkFloatingPointType );
+
+  vtkSetMacro( PointTolerance, vtkFloatingPointType );
+  vtkGetMacro( PointTolerance, vtkFloatingPointType );
+
+  vtkSetMacro( InfoWindowEnabled, bool );
+  vtkGetMacro( InfoWindowEnabled, bool );
+
+  vtkSetMacro( InfoWindowTransparency, vtkFloatingPointType );
+  vtkGetMacro( InfoWindowTransparency, vtkFloatingPointType );
+
+  vtkSetMacro( InfoWindowPosition, int );
+  vtkGetMacro( InfoWindowPosition, int );
+
+  vtkSetMacro( CameraMovementEnabled, bool );
+  vtkGetMacro( CameraMovementEnabled, bool );
+
+  vtkSetMacro( ZoomFactor, vtkFloatingPointType );
+  vtkGetMacro( ZoomFactor, vtkFloatingPointType );
+
+  vtkSetMacro( StepNumber, int );
+  vtkGetMacro( StepNumber, int );
+
+  vtkSetMacro( DisplayParentMesh, bool );
+  vtkGetMacro( DisplayParentMesh, bool );
+
+private:
+  VISU_PickingSettings();
+  virtual ~VISU_PickingSettings();
+
+private:
+  bool                 IsInitial;
+
+  vtkFloatingPointType PyramidHeight;
+  vtkFloatingPointType CursorSize;
+
+  vtkFloatingPointType PointTolerance;
+
+  vtkFloatingPointType Color[3];
+
+  bool                 InfoWindowEnabled;
+  vtkFloatingPointType InfoWindowTransparency;
+  int                  InfoWindowPosition;
+
+  bool                 CameraMovementEnabled;
+  vtkFloatingPointType ZoomFactor;
+  int                  StepNumber;
+
+  bool                 DisplayParentMesh;
+};
+
+#endif
index 908165049a5b59754e0f9898a5ec74905c6b22aa..790bc9fc5d8213b5548f2479b2e52c74bcdee7a0 100644 (file)
@@ -36,6 +36,9 @@
 #include "VISU_DeformedShapePL.hxx"
 #include "VISU_PipeLineUtils.hxx"
 
+#include <SALOME_ExtractGeometry.h>
+#include <SALOME_ExtractPolyDataGeometry.h>
+
 #include <vtkObjectFactory.h>
 #include <vtkRenderer.h>
 #include <vtkProperty.h>
@@ -258,7 +261,7 @@ void
 VISU_ScalarMapAct
 ::ShallowCopyPL(VISU_PipeLine* thePipeLine)
 {
-  VISU_Actor::ShallowCopyPL( thePipeLine );
+  VISU_DataSetActor::ShallowCopyPL( thePipeLine );
 
   myEdgeActor->GetMapper()->ScalarVisibilityOff();
 
@@ -274,10 +277,19 @@ VISU_ScalarMapAct
 {
   Superclass::SetMapperInput( theDataSet );
 
-  myPointsActor->SetInput( theDataSet );
+//    myPointsActor->SetInput( theDataSet );
+//    mySurfaceActor->SetInput( theDataSet );
+//    myEdgeActor->SetInput( theDataSet );
 
-  mySurfaceActor->SetInput( theDataSet );
-  myEdgeActor->SetInput( theDataSet );
+  if (theDataSet->IsA("vtkPolyData")) {
+    myPointsActor->SetInput( myPolyDataExtractor->GetOutput() );
+    mySurfaceActor->SetInput( myPolyDataExtractor->GetOutput() );
+    myEdgeActor->SetInput( myPolyDataExtractor->GetOutput() );
+  } else {
+    myPointsActor->SetInput( myExtractor->GetOutput() );
+    mySurfaceActor->SetInput( myExtractor->GetOutput() );
+    myEdgeActor->SetInput( myExtractor->GetOutput() );
+  }
 }
 
 //----------------------------------------------------------------------------
@@ -334,6 +346,65 @@ VISU_ScalarMapAct
   mySurfaceActor->UnShrink();
 }
 
+//----------------------------------------------------------------------------
+void
+VISU_ScalarMapAct
+::SetFeatureEdgesAllowed(bool theIsFeatureEdgesAllowed)
+{
+  Superclass::SetFeatureEdgesAllowed(theIsFeatureEdgesAllowed);
+
+  mySurfaceActor->SetFeatureEdgesAllowed(theIsFeatureEdgesAllowed);
+}
+
+void
+VISU_ScalarMapAct
+::SetFeatureEdgesAngle(vtkFloatingPointType theValue)
+{
+  Superclass::SetFeatureEdgesAngle(theValue);
+
+  mySurfaceActor->SetFeatureEdgesAngle(theValue);
+}
+
+void
+VISU_ScalarMapAct
+::SetFeatureEdgesFlags(bool theIsFeatureEdges,
+                      bool theIsBoundaryEdges,
+                      bool theIsManifoldEdges,
+                      bool theIsNonManifoldEdges)
+{
+  Superclass::SetFeatureEdgesFlags(theIsFeatureEdges,
+                                  theIsBoundaryEdges,
+                                  theIsManifoldEdges,
+                                  theIsNonManifoldEdges);
+
+  mySurfaceActor->SetFeatureEdgesFlags(theIsFeatureEdges,
+                                      theIsBoundaryEdges,
+                                      theIsManifoldEdges,
+                                      theIsNonManifoldEdges);
+}
+
+void
+VISU_ScalarMapAct
+::SetFeatureEdgesColoring(bool theIsColoring)
+{
+  Superclass::SetFeatureEdgesColoring(theIsColoring);
+
+  mySurfaceActor->SetFeatureEdgesColoring(theIsColoring);
+}
+
+//----------------------------------------------------------------------------
+void
+VISU_ScalarMapAct
+::SetFeatureEdgesEnabled(bool theIsFeatureEdgesEnabled)
+{
+  if(theIsFeatureEdgesEnabled && myRepresentation == VTK_POINTS)
+    return;
+
+  Superclass::SetFeatureEdgesEnabled(theIsFeatureEdgesEnabled);
+
+  mySurfaceActor->SetFeatureEdgesEnabled(theIsFeatureEdgesEnabled);
+}
+
 //----------------------------------------------------------------------------
 void
 VISU_ScalarMapAct
index 8589d05df5c3f9dc2349268526b409b874c8d594..d67cfa5f000bb6510dd9be90bb0c721b29b784c2 100644 (file)
@@ -77,6 +77,29 @@ class VTKOCC_EXPORT VISU_ScalarMapAct : public VISU_DataSetActor
   void
   UnShrink(); 
   
+  virtual
+  void
+  SetFeatureEdgesAllowed(bool theIsFeatureEdgesAllowed);
+
+  virtual
+  void
+  SetFeatureEdgesEnabled(bool theIsFeatureEdgesEnabled);
+
+  virtual
+  void
+  SetFeatureEdgesAngle(vtkFloatingPointType theAngle = 30.0); 
+
+  virtual
+  void
+  SetFeatureEdgesFlags(bool theIsFeatureEdges,
+                      bool theIsBoundaryEdges,
+                      bool theIsManifoldEdges,
+                      bool theIsNonManifoldEdges);
+
+  virtual
+  void
+  SetFeatureEdgesColoring(bool theIsColoring);
+
   virtual
   void
   SetOpacity(vtkFloatingPointType theValue);
index 425f955cf39f64d55aed1e00d963912dde6c0b37..c1b05f63f300adbd7bddb047f5240d7296376919 100644 (file)
@@ -111,7 +111,8 @@ dist_libVisuPipeLine_la_SOURCES= \
        VISU_ElnoDisassembleFilter.cxx \
        VISU_ElnoAssembleFilter.cxx \
        VISU_DeformationPL.cxx \
-       VISU_OptionalDeformationPL.cxx
+       VISU_OptionalDeformationPL.cxx\
+       VISU_XYPlotActor.cxx
 
 libVisuPipeLine_la_CPPFLAGS= \
        $(VTK_INCLUDES) \
index 291c457a1a936c9278dd1fa12baf3ec5adb58d01..32709a1f67ae3e024ff5dc3123eabf30f9b41481 100644 (file)
@@ -34,6 +34,7 @@
 #include "VISU_IsoSurfacesPL.hxx"
 #include "VISU_CutPlanesPL.hxx"
 #include "VISU_CutLinesPL.hxx"
+#include "VISU_ColoredPL.hxx"
 #include "VISU_DeformedShapePL.hxx"
 #include "VISU_VectorsPL.hxx"
 #include "VISU_StreamLinesPL.hxx"
@@ -48,7 +49,9 @@
 #include "VISU_ElnoDisassembleFilter.hxx"
 #include "VISU_ElnoAssembleFilter.hxx"
 
-typedef VISU_ScalarMapPL TPresent;
+//typedef VISU_CutPlanesPL TPresent;
+//typedef VISU_ScalarMapPL TPresent;
+typedef VISU_CutLinesPL TPresent;
 
 // VTK includes
 #include <vtkShrinkFilter.h>
@@ -73,12 +76,146 @@ typedef VISU_ScalarMapPL TPresent;
 #include <vtk3DWidget.h>
 #include <vtkProperty.h>
 
-#include "utilities.h"
+//RKV:Begin
+#include <vtkLookupTable.h>
+#include <vtkIntArray.h>
+#include <vtkPointData.h>
+#include <vtkCellData.h>
+#include <vtkPointSet.h>
+#include <vtkPolyData.h>
+#include <vtkXYPlotActor.h>
+#include <vtkProperty2D.h>
+#include <vtkTextProperty.h>
+
+#include <vtkXYPlotWidget.h>
+#include <vtkScalarBarWidget.h>
+#include <vtkScalarBarActor.h>
+#include <vtkMatrix4x4.h>
+
+/*#include <vtkBarChartActor.h>
+#include <vtkFloatArray.h>
+#include <vtkDataObject.h>
+#include <vtkFieldData.h>
+#include <vtkMath.h>
+#include <vtkTextProperty.h>
+#include <vtkPolyData.h>
+#include <vtkPoints.h>
+#include <vtkIdList.h>
+#include <vtkProperty2D.h>
+#include <vtkLegendBoxActor.h>
+#include <vtkTestUtilities.h>
+#include <vtkRegressionTestImage.h>
+*/
+//RKV:End
+
+static int isOnlyMesh = false;
 
 void PrintMissing(){
   MESSAGE(std::endl << "VISUPipeLine : missing operand after `VISUPipeLine'" <<
           std::endl << "VISUPipeLine : Try `VISUPipeLine -h' for more information.");
 }
+//#define _DEBUG_ID_MAPPING_
+
+//RKV:Begin
+/*
+vtkActor* barChartActor()
+{
+  int numTuples = 6;
+
+  vtkFloatArray *bitter = vtkFloatArray::New();
+  bitter->SetNumberOfTuples(numTuples);
+  
+  for (int i=0; i<numTuples; i++)
+    {
+    bitter->SetTuple1(i, vtkMath::Random(7,100));
+    }
+
+  vtkDataObject *dobj = vtkDataObject::New();
+  dobj->GetFieldData()->AddArray(bitter);
+  
+  vtkBarChartActor *actor = vtkBarChartActor::New();
+  actor->SetInput(dobj);
+  actor->SetTitle("Bar Chart");
+  actor->GetPositionCoordinate()->SetValue(0.05,0.05,0.0);
+  actor->GetPosition2Coordinate()->SetValue(0.95,0.85,0.0);
+  actor->GetProperty()->SetColor(1,1,1);
+  actor->GetLegendActor()->SetNumberOfEntries(numTuples);
+  for (int i=0; i<numTuples; i++)
+    {
+    double red=vtkMath::Random(0,1);
+    double green=vtkMath::Random(0,1);
+    double blue=vtkMath::Random(0,1);
+    actor->SetBarColor(i,red,green,blue);
+    }
+  actor->SetBarLabel(0,"oil");
+  actor->SetBarLabel(1,"gas");
+  actor->SetBarLabel(2,"water");
+  actor->SetBarLabel(3,"snake oil");
+  actor->SetBarLabel(4,"tequila");
+  actor->SetBarLabel(5,"beer");
+  actor->LegendVisibilityOn();
+
+  // Set text colors (same as actor for backward compat with test)
+  actor->GetTitleTextProperty()->SetColor(1,1,0);
+  actor->GetLabelTextProperty()->SetColor(1,0,0);
+  return actor;
+}
+*/
+//RKV:End
+//----------------------------------------------------------------------------
+template<class TPipeLine>
+VISU_ColoredPL*
+CreateColoredPL(VISU_Convertor* theConvertor,
+               const std::string& theMeshName,
+               const VISU::TEntity& theEntity,
+               const std::string& theFieldName,
+               int theTimeStampNumber);
+
+
+//----------------------------------------------------------------------------
+template<>
+VISU_ColoredPL*
+CreateColoredPL<VISU_GaussPointsPL>(VISU_Convertor* theConvertor,
+                                   const std::string& theMeshName,
+                                   const VISU::TEntity& theEntity,
+                                   const std::string& theFieldName,
+                                   int theTimeStampNumber)
+{
+  VISU_GaussPointsPL* aPresent = VISU_GaussPointsPL::New();
+  VISU::PGaussPtsIDMapper aGaussPtsIDMapper = 
+    theConvertor->GetTimeStampOnGaussPts(theMeshName,
+                                        theEntity,
+                                        theFieldName,
+                                        theTimeStampNumber);
+  aPresent->SetGaussPtsIDMapper(aGaussPtsIDMapper);
+
+  char aMainTexture[80];
+  strcpy( aMainTexture, getenv( "VISU_ROOT_DIR" ) );
+  strcat( aMainTexture, "/share/salome/resources/visu/sprite_texture.bmp" );
+  
+  char anAlphaTexture[80];
+  strcpy( anAlphaTexture, getenv( "VISU_ROOT_DIR" ) );
+  strcat( anAlphaTexture, "/share/salome/resources/visu/sprite_alpha.bmp" );
+  
+  vtkSmartPointer<vtkImageData> aTextureValue = 
+    VISU_GaussPointsPL::MakeTexture( aMainTexture, anAlphaTexture );
+  aPresent->SetImageData( aTextureValue.GetPointer() );
+
+  aPresent->Update();
+
+#ifdef _DEBUG_ID_MAPPING_
+  vtkDataSet* aDataSet = aPresent->GetOutput();
+  aDataSet->Update();
+  int aNbCells = aDataSet->GetNumberOfCells();
+  cout<<"aNbCells = "<<aNbCells<<endl;
+  for(int anCellId = 0; anCellId < aNbCells; anCellId++){
+    vtkIdType anObjID = aPresent->GetNodeObjID(anCellId);
+    vtkIdType aVtkID = aPresent->GetNodeVTKID(anObjID);
+    cout<<anObjID<<"; "<<aVtkID<<"; - ";
+    vtkFloatingPointType* aCoord = aPresent->GetNodeCoord(anObjID);
+    cout<<aCoord[0]<<"; "<<aCoord[1]<<"; "<<aCoord[2]<<endl;
+  }
+#endif
 
 void PrintHelp(){
   MESSAGE_ADD(std::endl << " Usage: VISUPipeLine filename meshname fieldname [timestamp] [component] " <<
@@ -94,6 +231,54 @@ void PrintHelp(){
 
 void PrintErr(){
   MESSAGE("***************************ERROR*****************************************");
+
+//----------------------------------------------------------------------------
+template<class TPipeLine>
+VISU_ColoredPL*
+CreateColoredPL(VISU_Convertor* theConvertor,
+               const std::string& theMeshName,
+               const VISU::TEntity& theEntity,
+               const std::string& theFieldName,
+               int theTimeStampNumber)
+{
+  TPipeLine* aPresent = TPipeLine::New();
+  VISU::PUnstructuredGridIDMapper anUnstructuredGridIDMapper = 
+    theConvertor->GetTimeStampOnMesh(theMeshName,
+                                    theEntity,
+                                    theFieldName,
+                                    theTimeStampNumber);
+  aPresent->SetUnstructuredGridIDMapper(anUnstructuredGridIDMapper);
+
+  vtkFloatingPointType aRange[] = { 4, 5 };
+cout << "before filter limits set" << endl;
+      vtkObject::GlobalWarningDisplayOn();
+      aPresent->DebugOn();
+  aPresent->SetScalarFilterRange( aRange );
+  aPresent->UseScalarFiltering( true );
+cout << "after filter set" << endl;
+
+  //aPresent->ClearGeometry();
+  //{
+  //  VISU::PUnstructuredGridIDMapper anIDMapper = 
+  //    theConvertor->GetMeshOnGroup(theMeshName,
+  //                              "groupe1");
+  //  aPresent->AddGeometry(anIDMapper->GetOutput());
+  //}
+  //{
+  //  VISU::PUnstructuredGridIDMapper anIDMapper = 
+  //    theConvertor->GetMeshOnGroup(theMeshName,
+  //                              "TUBEH                                                                           ");
+  //  aPresent->AddGeometry(anIDMapper->GetOutput());
+  //}
+  //{
+  //  VISU::PUnstructuredGridIDMapper anIDMapper = 
+  //    theConvertor->GetMeshOnGroup(theMeshName,
+  //                              "STRI                                                                            ");
+  //  aPresent->AddGeometry(anIDMapper->GetOutput());
+  //}
+  aPresent->Update();
+cout << "after update" << endl;
+  return aPresent;
 }
 
 
@@ -187,106 +372,260 @@ main(int argc, char** argv)
       const VISU::TMeshMap& aMeshMap = aConvertor->GetMeshMap();
       VISU::TMeshMap::const_iterator aMeshMapIter = aMeshMap.begin();
       if(aMeshMapIter == aMeshMap.end()) return 0;
-      //Iterate by meshes
-      for (;aMeshMapIter != aMeshMap.end();aMeshMapIter++) {
-        
-        const std::string& theMeshName = aMeshMapIter->first;
-        if( strcmp(aMeshName, theMeshName.c_str()) )
-          continue;
-        else
-          isMeshOk = true;
-
-        const VISU::PMesh aMesh = aMeshMapIter->second;
-        const VISU::TMeshOnEntityMap& aMeshOnEntityMap = aMesh->myMeshOnEntityMap;
-        VISU::TMeshOnEntityMap::const_iterator aMeshOnEntityMapIter;
-
-        aMeshOnEntityMapIter = aMeshOnEntityMap.begin();
-        //Iterate by meshes on entity
-        for(; aMeshOnEntityMapIter != aMeshOnEntityMap.end(); aMeshOnEntityMapIter++) {
-          const VISU::TEntity& anEntity = aMeshOnEntityMapIter->first;
-          const VISU::PMeshOnEntity aMeshOnEntity = aMeshOnEntityMapIter->second;
-
-          const VISU::TFieldMap& aFieldMap = aMeshOnEntity->myFieldMap;
-          VISU::TFieldMap::const_iterator aFieldMapIter = aFieldMap.begin();
-
-          //Iterate by field
-          for(; aFieldMapIter != aFieldMap.end(); aFieldMapIter++){
-            const VISU::PField aField = aFieldMapIter->second;
-            const std::string& theFieldName = aFieldMapIter->first;
-            
-            if( strcmp(aFieldName, theFieldName.c_str()) )
-              continue;
-            else
-              isFieldOk = true;
-            
-            if(aComponentNumber > aField->myNbComp)
-              continue;
-            else
-              isComponentOk = true;
-            
-            const VISU::TValField& aValField = aField->myValField;
-            VISU::TValField::const_iterator aValFieldIter = aValField.find(aTimeStampNumber);
-            if(aValFieldIter == aValField.end())
-              continue;
-            else
-              isTimeStampOk = true;
-            
-            int aTimeStamp = aValFieldIter->first;
-          
-            vtkActor* anActor = vtkActor::New();
-
-            if(anEntity != VISU::NODE_ENTITY){
-              VISU::PUnstructuredGridIDMapper anUnstructuredGridIDMapper = 
-                aConvertor->GetTimeStampOnMesh(theMeshName,
-                                               anEntity,
-                                               theFieldName,
-                                               aTimeStamp);
-
-             vtkUnstructuredGrid* anUnstructuredGrid = anUnstructuredGridIDMapper->GetUnstructuredGridOutput();
-             VISU::WriteToFile( anUnstructuredGrid, "/data/apo/elno_from_id_mapper.vtk" );
-             
-             VISU_ElnoDisassembleFilter* aDisassembleFilter = VISU_ElnoDisassembleFilter::New();
-             aDisassembleFilter->SetInput( anUnstructuredGrid );
-             aDisassembleFilter->SetShrinkFactor( 0.999 );
-             VISU::WriteToFile( aDisassembleFilter->GetOutput(), "/data/apo/elno_from_disassemble.vtk" );
-
-             vtkCutter *aCutter = vtkCutter::New();
-
-             vtkPointLocator* aPointLocator = vtkPointLocator::New();
-             aCutter->SetLocator( aPointLocator );
-             aPointLocator->Delete();
-             
-             TPresent* aPresent = TPresent::New();
-             aPresent->SetUnstructuredGridIDMapper( anUnstructuredGridIDMapper );
-             //aPresent->SetOrientation( VISU_CutPlanesPL::ZX, 0.0, 0.0, 0 );
-             aPresent->Update();
-
-             aPresent->GetMapper()->InterpolateScalarsBeforeMappingOn();
-             anActor->SetMapper( aPresent->GetMapper() );
-             
-              vtkScalarBarActor* aScalarBar = vtkScalarBarActor::New();
-              //aScalarBar->SetLookupTable( aMapperTable );
-              aScalarBar->SetLookupTable( aPresent->GetBarTable() );
-
-
-             vtkScalarBarWidget* aWidget = vtkScalarBarWidget::New();
-             aWidget->SetScalarBarActor( aScalarBar );
-             aWidget->SetInteractor( anInteractor );
-             aWidget->SetEnabled( true );
-
-              aRenderer->AddActor(anActor);
-              aRenderer->AddActor2D(aScalarBar);
-            }else{
-              continue;
-            }
-
-            aWindow->Render();
-            aRenderer->ResetCamera();
-            
-            anInteractor->Start();
-            return 0;
-          }
-        }
+      const std::string& aMeshName = aMeshMapIter->first;
+      const VISU::PMesh aMesh = aMeshMapIter->second;
+      const VISU::TMeshOnEntityMap& aMeshOnEntityMap = aMesh->myMeshOnEntityMap;
+      VISU::TMeshOnEntityMap::const_iterator aMeshOnEntityMapIter;
+      if(isOnlyMesh){
+       const VISU::TEntity& anEntity = VISU::CELL_ENTITY;
+       aMeshOnEntityMapIter = aMeshOnEntityMap.find(anEntity);
+
+       VISU::PNamedIDMapper anIDMapper = 
+         aConvertor->GetMeshOnEntity(aMeshName,anEntity);
+
+       VISU_MeshPL* aPresent = VISU_MeshPL::New();
+       aPresent->SetUnstructuredGridIDMapper(anIDMapper);
+
+       vtkActor* aActor = vtkActor::New();
+       aActor->SetMapper(aPresent->GetMapper());
+       aActor->GetProperty()->SetRepresentation(VTK_WIREFRAME);
+       //aRenderer->ResetCameraClippingRange();
+
+       aRenderer->AddActor(aActor);
+
+       aWindow->Render();
+       anInteractor->Start();
+       return 0;
+      }
+      //Import fields
+      aMeshOnEntityMapIter = aMeshOnEntityMap.begin();
+      for(; aMeshOnEntityMapIter != aMeshOnEntityMap.end(); aMeshOnEntityMapIter++) {
+       const VISU::TEntity& anEntity = aMeshOnEntityMapIter->first;
+       const VISU::PMeshOnEntity aMeshOnEntity = aMeshOnEntityMapIter->second;
+       const VISU::TFieldMap& aFieldMap = aMeshOnEntity->myFieldMap;
+       VISU::TFieldMap::const_iterator aFieldMapIter = aFieldMap.begin();
+       for(; aFieldMapIter != aFieldMap.end(); aFieldMapIter++){
+         const VISU::PField aField = aFieldMapIter->second;
+//       if(aField->myNbComp == 1) 
+//         continue;
+         const std::string& aFieldName = aFieldMapIter->first;
+         const VISU::TValField& aValField = aField->myValField;
+         VISU::TValField::const_reverse_iterator aValFieldIter = aValField.rbegin();
+         if(aValFieldIter == aValField.rend()) return 0;
+         int aTimeStamp = aValFieldIter->first;
+
+         vtkActor* anActor = vtkActor::New();
+         VISU_ColoredPL* aPresent = NULL;
+         if(anEntity == VISU::NODE_ENTITY){
+           aPresent = CreateColoredPL<TPresent>(aConvertor,
+                                                aMeshName,
+                                                anEntity,
+                                                aFieldName,
+                                                aTimeStamp);
+
+           anActor->SetMapper(aPresent->GetMapper());
+         }else{
+           continue;
+           aPresent = CreateColoredPL<TPresent>(aConvertor,
+                                                aMeshName,
+                                                anEntity,
+                                                aFieldName,
+                                                aTimeStamp);
+
+           VTKViewer_GeometryFilter* aGeometryFilter = VTKViewer_GeometryFilter::New();
+           aGeometryFilter->SetInput(aPresent->GetOutput());
+           aGeometryFilter->SetInside(true);
+
+           vtkMaskPoints* aMaskPoints = vtkMaskPoints::New();
+           aMaskPoints->SetInput(aGeometryFilter->GetOutput());
+           aMaskPoints->SetGenerateVertices(true);
+           aMaskPoints->SetOnRatio(1);
+
+           VISU_OpenGLPointSpriteMapper* aMapper = VISU_OpenGLPointSpriteMapper::New();
+           aMapper->SetAverageCellSize( VISU_DeformedShapePL::GetScaleFactor( aPresent->GetOutput() ) );
+  
+           char aMainTexture[80];
+           strcpy( aMainTexture, getenv( "VISU_ROOT_DIR" ) );
+           strcat( aMainTexture, "/share/salome/resources/visu/sprite_texture.vti" );
+           
+           char anAlphaTexture[80];
+           strcpy( anAlphaTexture, getenv( "VISU_ROOT_DIR" ) );
+           strcat( anAlphaTexture, "/share/salome/resources/visu/sprite_alpha.vti" );
+           
+           vtkSmartPointer<vtkImageData> aTextureValue = 
+             VISU_GaussPointsPL::MakeTexture( aMainTexture, anAlphaTexture );
+           aMapper->SetImageData( aTextureValue.GetPointer() );
+
+           //vtkPolyDataMapper* aMapper = vtkPolyDataMapper::New();
+           aMapper->SetLookupTable(aPresent->GetMapperTable());
+           aMapper->SetUseLookupTableScalarRange(true);
+           aMapper->SetColorModeToMapScalars();
+           aMapper->SetScalarVisibility(true);
+
+           aMapper->SetInput(aMaskPoints->GetOutput());
+           aGeometryFilter->Delete();
+
+           anActor->SetMapper(aMapper);
+           aMapper->Delete();
+         }
+
+
+
+
+
+//RKV:Begin
+  vtkLookupTable* lut = vtkLookupTable::New();
+  int nbColors = aPresent->GetNbColors();
+  lut->SetNumberOfTableValues(nbColors);
+  vtkDataArray* dataArr;
+    if(VISU::IsDataOnCells(aPresent->GetInput())) {
+       dataArr = aPresent->GetInput()->GetCellData()->GetScalars();
+    } else {
+       dataArr = aPresent->GetInput()->GetPointData()->GetScalars();
+    }
+  vtkFloatingPointType aRange[2];
+  dataArr->GetRange(aRange);
+  MSG(true, "Range[0]: "<<aRange[0]);
+  MSG(true, "Range[1]: "<<aRange[1]);
+
+  lut->SetTableRange(aRange);
+  lut->Build();
+    MSG(true, "1\n");
+  vtkIntArray* distr = vtkIntArray::New();
+  distr->SetNumberOfValues(nbColors);
+    MSG(true, "Number of colors: "<<nbColors);
+  distr->FillComponent(0, 0.);
+    MSG(true, "2\n");
+  int aNbVals = dataArr->GetNumberOfTuples();
+  int idx = 0, cnt = 0;
+  
+    MSG(true, "3\n");
+  for(vtkIdType aValId = 0; aValId < aNbVals; aValId++){
+//    MSG(true, "Value: "<< *(dataArr->GetTuple(aValId)));
+       idx = lut->GetIndex(*(dataArr->GetTuple(aValId)));
+//    MSG(true, "Value index "<<idx);
+       cnt = distr->GetValue(idx);
+       distr->SetValue(idx, cnt + 1);
+  }
+    MSG(true, "4\n");
+  distr->Modified();
+  double range[2];
+  distr->GetRange(range);
+  MSG(true, "DistrRange[0]: " << range[0]);
+  MSG(true, "DistrRange[1]: " << range[1]);
+    MSG(true, "5\n");
+//  vtkPoints* points = vtkPoints::New();
+//  aNbVals = distr->GetNumberOfTuples();
+//  points->Allocate(aNbVals);
+//  double x[3] = {0., 0., 0.};
+/*  for(vtkIdType aValId = 0; aValId < aNbVals; aValId++){
+       x[0] = aValId;
+       points->InsertPoint(aValId, x);
+*///    MSG(true, "Inserted point "<<aValId);
+//    MSG(true, ": "<<distr->GetValue(aValId));
+//  }
+//  points->SetData(distr);
+  
+/*  vtkPointSet* pset = vtkPolyData::New();
+  pset->SetPoints(points);
+  pset->GetPointData()->SetScalars(distr);
+*/    
+  vtkDataObject *dobj = vtkDataObject::New();
+  dobj->GetFieldData()->AddArray(distr);
+  
+  vtkXYPlotActor* xyplot = vtkXYPlotActor::New();
+//  xyplot->AddInput(pset);
+  xyplot->AddDataObjectInput(dobj);
+  xyplot->GetPositionCoordinate()->SetValue(0.0, 0.67, 0);
+  xyplot->GetPosition2Coordinate()->SetValue(1.0, 0.33, 0); // #relative to Position
+  xyplot->SetXValuesToIndex();
+//  xyplot->SetXValuesToNormalizedArcLength();
+//  xyplot->SetXValuesToArcLength();
+//  xyplot->SetNumberOfXLabels(0);
+  xyplot->SetTitle("");
+  xyplot->SetXTitle("");
+  xyplot->SetYTitle("Distribution");
+//  xyplot->ReverseYAxisOn();
+//  xyplot->SetDataObjectPlotModeToRows();
+  xyplot->SetLabelFormat("%.0f");
+  xyplot->SetXRange(0, nbColors-1);
+  xyplot->SetYRange(range[0], range[1]);
+/*  int ny = floor(fabs(range[1] - range[0]));
+    MSG(true, "ny = "<<ny);
+    MSG(true, "nbYLabels = "<<xyplot->GetNumberOfYLabels());
+  if (ny < xyplot->GetNumberOfYLabels()) {
+    MSG(true, "5.1");
+       xyplot->SetNumberOfYLabels(ny);
+    MSG(true, "nbYLabels = "<<xyplot->GetNumberOfYLabels());
+  }
+*/  xyplot->GetProperty()->SetColor(1, 1, 1);
+  xyplot->GetProperty()->SetLineWidth(2);
+  xyplot->GetProperty()->SetDisplayLocationToForeground();
+/*  vtkMatrix4x4 *m = vtkMatrix4x4::New();
+    MSG(true, "5.1\n");
+  m->Zero();
+    MSG(true, "5.2\n");
+  m->SetElement(0, 1, 1);
+  m->SetElement(1, 0, -1);
+  m->SetElement(2, 2, 1);
+  m->SetElement(3, 3, 1);
+    MSG(true, "5.3\n");
+  xyplot->PokeMatrix(m);
+*/  //# Set text prop color (same color for backward compat with test)
+  //# Assign same object to all text props
+  vtkTextProperty* tprop;
+  tprop = xyplot->GetTitleTextProperty();
+  tprop->SetColor(xyplot->GetProperty()->GetColor());
+  xyplot->SetAxisTitleTextProperty(tprop);
+  xyplot->SetAxisLabelTextProperty(tprop);
+  
+//RKV:End  
+  
+
+    MSG(true, "6\n");
+
+/*{
+  vtkXYPlotWidget* aWidget = vtkXYPlotWidget::New();
+  aWidget->SetInteractor( anInteractor );
+  aWidget->SetXYPlotActor( xyplot );
+  aWidget->SetEnabled( 1 );
+}*/
+
+
+      vtkObject::GlobalWarningDisplayOn();
+
+         VISU_ScalarBarActor * aScalarBar = VISU_ScalarBarActor::New();
+         //vtkScalarBarActor * aScalarBar = vtkScalarBarActor::New();
+         aPresent->SetNbColors(5);
+         aPresent->DebugOn();
+         aPresent->Update();
+         aScalarBar->SetLookupTable(aPresent->GetBarTable());
+         aScalarBar->DebugOn();
+         aScalarBar->SetDistribution(aPresent->GetDistribution());
+         aScalarBar->DistributionVisibilityOn();
+//       aScalarBar->SetOrientationToHorizontal();
+//       aScalarBar->GetPositionCoordinate()->SetValue(.1, .6, 0);
+//       aScalarBar->GetPosition2Coordinate()->SetValue(.8, .3, 0);
+
+/*{
+  vtkScalarBarWidget* aWidget = vtkScalarBarWidget::New();
+  aWidget->SetInteractor( anInteractor );
+  aWidget->SetScalarBarActor( aScalarBar );
+  aWidget->SetEnabled( 1 );
+}
+*/
+         aRenderer->AddActor(anActor);
+//       aRenderer->AddActor2D(xyplot); //RKV
+         aRenderer->AddActor2D(aScalarBar);
+         
+         //aRenderer->AddActor2D(barChartActor()); //RKV
+
+         aWindow->Render();
+         aRenderer->ResetCamera();
+
+         anInteractor->Start();
+         return 0;
+       }
       }
     }
     else{
index 0792a90c42647da0c40c169a57369f4aaa1a4a4a..39b5a3420bb299d0b56904ae41d5fc952c7465ec 100644 (file)
 
 #include "VISU_PipeLineUtils.hxx"
 
+#include <vtkThreshold.h>
+#include <vtkPassThroughFilter.h>
+#include <vtkDoubleArray.h>
+
 
 //----------------------------------------------------------------------------
 VISU_ColoredPL
 ::VISU_ColoredPL():
-  myMapperTable(VISU_LookupTable::New()),
-  myBarTable(VISU_LookupTable::New()),
-  myExtractor(VISU_Extractor::New()),
-  myFieldTransform(VISU_FieldTransform::New())
+  myMapperTable( VISU_LookupTable::New() ),
+  myBarTable( VISU_LookupTable::New() ),
+  myExtractor( VISU_Extractor::New() ),
+  myFieldTransform( VISU_FieldTransform::New() ),
+  myThreshold ( vtkThreshold::New() ),
+  myPassFilter( vtkPassThroughFilter::New() ),
+  myDistribution( vtkDoubleArray::New() )
 {
   myMapperTable->Delete();
   myMapperTable->SetScale(VTK_SCALE_LINEAR);
@@ -54,6 +61,11 @@ VISU_ColoredPL
   myExtractor->Delete();
 
   myFieldTransform->Delete();
+
+  myThreshold->AllScalarsOn(); 
+  myThreshold->Delete();
+  myPassFilter->Delete();
+  myDistribution->Delete();
 }
 
 
@@ -74,6 +86,9 @@ VISU_ColoredPL
   aTime = std::max(aTime, myBarTable->GetMTime());
   aTime = std::max(aTime, myExtractor->GetMTime());
   aTime = std::max(aTime, myFieldTransform->GetMTime());
+  aTime = std::max(aTime, myThreshold->GetMTime());
+  aTime = std::max(aTime, myPassFilter->GetMTime());
+  aTime = std::max(aTime, myDistribution->GetMTime());
 
   return aTime;
 }
@@ -88,12 +103,26 @@ VISU_ColoredPL
   Superclass::DoShallowCopy(thePipeLine, theIsCopyInput);
 
   if(VISU_ColoredPL *aPipeLine = dynamic_cast<VISU_ColoredPL*>(thePipeLine)){
-    if(theIsCopyInput)
-      SetScalarRange(aPipeLine->GetScalarRange());
+    if ( theIsCopyInput ) {
+      SetScalarRange( aPipeLine->GetScalarRange() );
+      if ( this->IsScalarFilterUsed() )
+       SetScalarFilterRange( aPipeLine->GetScalarFilterRange() );
+    }
+
     SetScalarMode(aPipeLine->GetScalarMode());
     SetNbColors(aPipeLine->GetNbColors());
     SetScaling(aPipeLine->GetScaling());
     SetMapScale(aPipeLine->GetMapScale());
+
+    if ( this != thePipeLine ) {
+      if ( aPipeLine->IsExternalGeometryUsed() ) {
+       ClearGeometry();
+       int aNbOfGeometry = aPipeLine->GetNumberOfGeometry();
+       for(int aGeomNumber = 0; aGeomNumber < aNbOfGeometry; aGeomNumber++)
+         AddGeometry( aPipeLine->GetGeometry( aGeomNumber ) );
+      }else
+       SetSourceGeometry();
+    }
   }
 }
 
@@ -135,7 +164,6 @@ VISU_ColoredPL
   theExtractor->SetScalarMode(theScalarMode);
 }
 
-
 //----------------------------------------------------------------------------
 void
 VISU_ColoredPL
@@ -148,18 +176,144 @@ VISU_ColoredPL
 //----------------------------------------------------------------------------
 void
 VISU_ColoredPL
-::SetScalarRange(vtkFloatingPointType theRange[2])
+::SetScalarRange( vtkFloatingPointType theRange[2] )
 {
-  if(theRange[0] > theRange[1]
+  if ( theRange[0] > theRange[1] 
     return;
   
-  if(VISU::CheckIsSameRange(GetScalarRange(), theRange))
+  if (VISU::CheckIsSameRange( GetScalarRange(), theRange) )
+    return;
+
+  myFieldTransform->SetScalarRange( theRange );
+  myBarTable->SetRange( theRange );
+}
+
+
+//----------------------------------------------------------------------------
+void
+VISU_ColoredPL
+::SetScalarFilterRange( vtkFloatingPointType theRange[2] )
+{
+  vtkFloatingPointType aRange[ 2 ];
+  this->GetScalarFilterRange( aRange );
+
+  if ( VISU::CheckIsSameRange( aRange, theRange) )
     return;
 
-  myFieldTransform->SetScalarRange(theRange);
-  myBarTable->SetRange(theRange);
+  myThreshold->ThresholdBetween( theRange[0], theRange[1] );
 }
 
+
+//----------------------------------------------------------------------------
+void
+VISU_ColoredPL
+::GetScalarFilterRange( vtkFloatingPointType theRange[2] )
+{
+  theRange[ 0 ] = myThreshold->GetLowerThreshold();
+  theRange[ 1 ] = myThreshold->GetUpperThreshold();
+}
+
+
+//----------------------------------------------------------------------------
+vtkFloatingPointType*
+VISU_ColoredPL
+::GetScalarFilterRange()
+{
+  static vtkFloatingPointType aRange[ 2 ];
+
+  this->GetScalarFilterRange( aRange );
+
+  return aRange;
+}
+
+
+//----------------------------------------------------------------------------
+void
+VISU_ColoredPL
+::UseScalarFiltering( bool theUseScalarFilter )
+{
+  if ( theUseScalarFilter ) {
+    // Include threshold filter between the transform and the pass filters. 
+    myPassFilter->SetInput( myThreshold->GetOutput() );
+  } else {
+    // Exclude threshold filter before the pass filter. 
+    myPassFilter->SetInput( myFieldTransform->GetOutput() );
+  }
+}
+
+
+//----------------------------------------------------------------------------
+bool
+VISU_ColoredPL
+::IsScalarFilterUsed()
+{
+  return myThreshold->GetOutput() == myPassFilter->GetInput();
+}
+
+
+//----------------------------------------------------------------------------
+vtkDoubleArray* 
+VISU_ColoredPL
+::GetDistribution() 
+{
+  unsigned long int aTime = this->GetMTime();
+  // If modified then update the distribution array
+  if (aTime > myDistribution->GetMTime()) {
+       // Set number of colors for the distribution
+    int nbColors = this->GetNbColors();
+       this->myDistribution->SetNumberOfValues(nbColors);
+       // Initialize numbers of colored cells with zero
+       this->myDistribution->FillComponent(0, 0);
+       // Create a lookup table to compute a color of a cell
+    VISU_LookupTable* lut = GetMapperTable();
+    vtkFloatingPointType aMapScale = lut->GetMapScale();
+    // Get scalar values from the input data to calculate their distribution within cells
+    vtkDataArray* dataArr;
+    // Dtermine where we have to take scalars from: cells data or points data. 
+    if(VISU::IsDataOnCells(this->GetOutput())) {
+       dataArr = this->GetOutput()->GetCellData()->GetScalars();
+    } else {
+       dataArr = this->GetOutput()->GetPointData()->GetScalars();
+    }
+    // If scalars data array is not defined then create an empty one to avoid exceptions
+    if (dataArr == NULL) {
+       dataArr = vtkDoubleArray::New();
+    }
+    
+    // Get range of scalars values
+//    vtkFloatingPointType aRange[2];
+//    dataArr->GetRange(aRange);
+
+    // Build the lookup table with the found range
+    // Get number of scalar values
+    int aNbVals = dataArr->GetNumberOfTuples();
+    if (aNbVals > 0) {
+      // Count the number of scalar values for each color in the input data
+      int idx = 0;
+      double cnt = 0;
+      // For each scalar value
+      for(vtkIdType aValId = 0; aValId < aNbVals; aValId++){
+        // Find the color index for this scalar value
+        idx = lut->GetIndex(*(dataArr->GetTuple(aValId)) * aMapScale);
+        // Increment the distribution value for this color index
+        cnt = this->myDistribution->GetValue(idx);
+        this->myDistribution->SetValue(idx, cnt + 1);
+      }
+      // Compute relative values when 1 is according to the total number of scalar values
+      for(vtkIdType aValId = 0; aValId < nbColors; aValId++){
+        cnt = this->myDistribution->GetValue(aValId);
+        this->myDistribution->SetValue(aValId, cnt / aNbVals);
+      }
+    }
+    this->myDistribution->Modified();
+       
+  }
+  
+  return myDistribution;
+}
+//----------------------------------------------------------------------------
+  // RKV : End
+
 //----------------------------------------------------------------------------
 vtkFloatingPointType* 
 VISU_ColoredPL
@@ -215,7 +369,12 @@ VISU_ColoredPL
 ::Init()
 {
   SetScalarMode(0);
-  SetSourceRange();
+
+  vtkFloatingPointType aRange[2];
+  GetSourceRange( aRange );
+
+  SetScalarRange( aRange );
+  SetScalarFilterRange( aRange );
 }
 
 //----------------------------------------------------------------------------
@@ -223,9 +382,9 @@ vtkPointSet*
 VISU_ColoredPL
 ::GetClippedInput()
 {
-  if(GetFieldTransformFilter()->GetInput())
-    GetFieldTransformFilter()->Update();
-  return GetFieldTransformFilter()->GetUnstructuredGridOutput();
+  if(myPassFilter->GetInput())
+    myPassFilter->Update();
+  return myPassFilter->GetUnstructuredGridOutput();
 }
 
 
@@ -234,9 +393,14 @@ void
 VISU_ColoredPL
 ::Build() 
 {
-  myExtractor->SetInput(Superclass::GetClippedInput());
+  myExtractor->SetInput( Superclass::GetClippedInput() );
   myFieldTransform->SetInput(myExtractor->GetOutput());
 
+  myThreshold->SetInput( myFieldTransform->GetOutput() );
+  // The pass filter is used here for possibility to include/exclude 
+  // threshold filter before it.
+  myPassFilter->SetInput( myFieldTransform->GetOutput() );
+
   GetMapperHolder()->SetLookupTable(GetMapperTable());
   //GetMapper()->InterpolateScalarsBeforeMappingOn();
   GetMapper()->SetUseLookupTableScalarRange( true );
@@ -343,7 +507,7 @@ VISU_ColoredPL
 ::GetSourceRange(vtkFloatingPointType theRange[2])
 {
   myExtractor->Update();
-  myExtractor->GetOutput()->GetScalarRange(theRange);
+  myExtractor->GetOutput()->GetScalarRange( theRange );
 }
 
 void
@@ -351,6 +515,6 @@ VISU_ColoredPL
 ::SetSourceRange()
 {
   vtkFloatingPointType aRange[2];
-  GetSourceRange(aRange);
-  SetScalarRange(aRange);
+  GetSourceRange( aRange );
+  SetScalarRange( aRange );
 }
index e507f140d36c9d671c8236ca9d5c97893a49b015..ab53522ad395a5a50d715ec606cca5bc9ee761ea 100644 (file)
@@ -36,6 +36,10 @@ class VISU_Extractor;
 class VISU_FieldTransform;
 class VISU_LookupTable;
 
+class vtkPassThroughFilter;
+class vtkDoubleArray;
+class vtkThreshold;
+
 
 //----------------------------------------------------------------------------
 class VISU_ColoredPL : public VISU_PipeLine
@@ -62,7 +66,22 @@ public:
 
   virtual
   void
-  SetScalarRange(vtkFloatingPointType theRange[2]);
+  SetScalarRange( vtkFloatingPointType theRange[2] );
+
+  void
+  SetScalarFilterRange( vtkFloatingPointType theRange[2] );
+
+  void
+  GetScalarFilterRange( vtkFloatingPointType theRange[2] );
+
+  vtkFloatingPointType* 
+  GetScalarFilterRange();
+
+  bool
+  IsScalarFilterUsed();
+
+  void
+  UseScalarFiltering( bool theUseScalarFilter );
 
   virtual
   void
@@ -80,8 +99,11 @@ public:
   int
   GetNbColors();
   
-  //----------------------------------------------------------------------------
+  vtkDoubleArray* GetDistribution();
+
+
 public:
+  //----------------------------------------------------------------------------
   virtual
   void
   Init();
@@ -119,6 +141,36 @@ public:
   void
   SetSourceRange();
 
+public:
+  
+  virtual  
+  void  
+  SetSourceGeometry() = 0;
+
+  virtual
+  int
+  AddGeometry(vtkDataSet* theGeometry) = 0;
+
+  virtual
+  vtkDataSet*
+  GetGeometry( int theGeomNumber ) = 0;
+
+  virtual
+  int
+  GetNumberOfGeometry() = 0;
+
+  virtual
+  bool 
+  IsExternalGeometryUsed() = 0;
+
+  virtual
+  void
+  ClearGeometry() = 0;
+
+  virtual 
+  vtkPointSet* 
+  GetMergedInput() = 0;
+
 protected:
   //----------------------------------------------------------------------------
   VISU_ColoredPL();
@@ -157,11 +209,13 @@ protected:
                VISU_Extractor* theExtractor);
 
 private:
-  vtkSmartPointer<VISU_LookupTable> myMapperTable;
-  vtkSmartPointer<VISU_LookupTable> myBarTable;
-  vtkSmartPointer<VISU_Extractor> myExtractor;
-  vtkSmartPointer<VISU_FieldTransform> myFieldTransform;
-  
+  vtkSmartPointer< VISU_LookupTable > myMapperTable;
+  vtkSmartPointer< VISU_LookupTable > myBarTable;
+  vtkSmartPointer< VISU_Extractor > myExtractor;
+  vtkSmartPointer< VISU_FieldTransform > myFieldTransform;
+  vtkSmartPointer< vtkThreshold > myThreshold;
+  vtkSmartPointer< vtkPassThroughFilter > myPassFilter;
+  vtkSmartPointer< vtkDoubleArray > myDistribution;
 };
   
 #endif
index dbd2243a9d6c187fcc665eccde8f4a881e5857d5..89b00b0269d0f108f500021eb02c763429f7a383 100644 (file)
@@ -41,6 +41,7 @@ VISU_CutLinesPL
 ::VISU_CutLinesPL()
 {
   SetIsShrinkable(false);
+  SetIsFeatureEdgesAllowed(false);
 
   myCondition = 1;
   myPosition = 0;
index a8776eaf28dad097d9eb8041506c5f60c652d5cb..5888942e4536d8b972828d12b54c3e54fd532c47 100644 (file)
@@ -59,6 +59,7 @@ VISU_CutPlanesPL
   if(MYDEBUG) MESSAGE("VISU_CutPlanesPL()::VISU_CutPlanesPL() - "<<this);
   
   SetIsShrinkable(false);
+  SetIsFeatureEdgesAllowed(false);
 
   SetElnoDisassembleState( true );
 
index 4a9adf0a8fe2a620628bc330ee340ee8b36d2aef..8a0a547b38411dc449977f9c0e0eaeae18c2b171 100644 (file)
@@ -98,6 +98,7 @@ VISU_DataSetMapperHolder
     VISU::CopyDataSetMapper(GetDataSetMapper(), 
                            aMapperHolder->GetDataSetMapper(), 
                            theIsCopyInput);
+    myExtractGeometry->SetImplicitFunction(aMapperHolder->GetImplicitFunction());
   }
 }
 
@@ -317,6 +318,7 @@ VISU_DataSetMapperHolder
     if (vtkImplicitBoolean* aBoolean = myExtractGeometry->GetImplicitBoolean()) {
       vtkImplicitFunctionCollection* aFunction = aBoolean->GetFunction();
       aFunction->AddItem(thePlane);
+      aBoolean->Modified();
       // Check, that at least one cell present after clipping.
       // This check was introduced because of bug IPAL8849.
       vtkDataSet* aClippedDataSet = GetClippedInput();
@@ -346,6 +348,19 @@ VISU_DataSetMapperHolder
   return aPlane;
 }
 
+//----------------------------------------------------------------------------
+void VISU_DataSetMapperHolder::RemoveClippingPlane(vtkIdType theID)
+{
+  if(theID >= 0 && theID < GetNumberOfClippingPlanes()){
+    if(vtkImplicitBoolean* aBoolean = myExtractGeometry->GetImplicitBoolean()){
+      vtkImplicitFunctionCollection* aFunctions = aBoolean->GetFunction();
+      aFunctions->RemoveItem(theID);
+      aBoolean->Modified();
+    }
+  }
+}
+
+
 //----------------------------------------------------------------------------
 void
 VISU_DataSetMapperHolder
index 6588abd9b14b6987d3508b66d91fe7ba1ffb1924..23f056e669e8940e0557fbb174885b6b378cd774 100644 (file)
@@ -134,6 +134,8 @@ public:
   vtkPlane* 
   GetClippingPlane(vtkIdType theID);
 
+  virtual void RemoveClippingPlane(vtkIdType theID);
+
 protected:
   //----------------------------------------------------------------------------
   VISU_DataSetMapperHolder();
index 2a7f2c6a8d58ca1896766755b0f2716a48499701..b17f86b867c926f44520bd0c9fba9ffad768a301 100644 (file)
@@ -43,6 +43,7 @@ VISU_DeformedShapePL
   myMapScaleFactor(1.0)
 {
   SetIsShrinkable(true);
+  SetIsFeatureEdgesAllowed(true);
 
   myWarpVector = vtkWarpVector::New();
   myCellDataToPointData = vtkCellDataToPointData::New();
@@ -110,6 +111,8 @@ VISU_DeformedShapePL
       aVolume *= aVol;
     }
   }
+  if( aNbElem == 0 || fabs(idim) < 1.0 / VTK_LARGE_FLOAT )
+    return 0.0; // to avoid division by zero
   aVolume /= aNbElem;
   return pow(aVolume, vtkFloatingPointType(1.0/idim));
 }
index c59d0d19b0d8608d03bf9900947308015b98158d..a0c7a8d8fa8199ac7172790ccb28c825853b16bb 100644 (file)
@@ -60,6 +60,7 @@ VISU_GaussPointsPL
   myMergeFilter(VISU_GaussMergeFilter::New())
 {
   SetIsShrinkable(false);
+  SetIsFeatureEdgesAllowed(false);
 
   myWarpVector = vtkWarpVector::New();
 
@@ -245,7 +246,7 @@ VISU_GaussPointsPL
 {
   Superclass::Init();
 
-  SetExtractInside(false);
+  //SetExtractInside(false);
 
   vtkDataSet* aDataSet = GetParentMesh();
   vtkFloatingPointType aScaleFactor = VISU_DeformedShapePL::GetScaleFactor( aDataSet );
index 883599632739e4a33ca372a82a7c116e3bcd7c43..125d5a21abf6f6473439de18780dece983272b33 100644 (file)
@@ -45,6 +45,7 @@ VISU_IsoSurfacesPL
 ::VISU_IsoSurfacesPL()
 {
   SetIsShrinkable(false);
+  SetIsFeatureEdgesAllowed(false);
 
   SetElnoDisassembleState( true );
 
@@ -125,9 +126,9 @@ VISU_IsoSurfacesPL
 //----------------------------------------------------------------------------
 void
 VISU_IsoSurfacesPL
-::SetScalarRange(vtkFloatingPointType theRange[2]
+::SetScalarRange( vtkFloatingPointType theRange[2] 
 {
-  Superclass::SetScalarRange(theRange);
+  Superclass::SetScalarRange( theRange );
   SetRange(myRange);
 }
 
index 73aec61ed465368085d9d0c93e00ba64aeffe771..b6cb79711dfd2e892bee01dba07822f6317115e3 100644 (file)
@@ -61,7 +61,7 @@ public:
 
   virtual
   void
-  SetScalarRange(vtkFloatingPointType theRange[2]);
+  SetScalarRange( vtkFloatingPointType theRange[2] );
 
   virtual
   void
index 8c4dfc9008c49672de178fd7c26a7c4163186b56..c325fa0656e0f397e6548af9ea58cf26a36a59a5 100644 (file)
 
 using namespace std;
 
+
+//----------------------------------------------------------------------------
 vtkStandardNewMacro(VISU_LookupTable);
 
+
+//----------------------------------------------------------------------------
 VISU_LookupTable
 ::VISU_LookupTable(int sze, int ext):
   vtkLookupTable(sze, ext), 
@@ -41,6 +45,73 @@ VISU_LookupTable
   myBicolor(false) 
 {}
 
+//----------------------------------------------------------------------------
+namespace
+{
+  inline
+  void
+  CopyColor( unsigned char* theTaget, const unsigned char* theSource )
+  {
+    theTaget[0] = theSource[0];
+    theTaget[1] = theSource[1];
+    theTaget[2] = theSource[2];
+  }
+}
+
+
+//----------------------------------------------------------------------------
+void
+VISU_LookupTable
+::MarkValueByColor( vtkFloatingPointType theValue,
+                   unsigned char* theColor )
+{ 
+  vtkIdType anIndex = this->GetIndex( theValue );
+  unsigned char *aTablePtr = this->GetPointer( anIndex );
+  CopyColor( aTablePtr, theColor );
+}
+
+
+//----------------------------------------------------------------------------
+void
+VISU_LookupTable
+::FillByColor( unsigned char* theColor )
+{
+  vtkIdType aNbColors = this->GetNumberOfColors();
+  for(int i = 0; i < aNbColors; i++){
+    unsigned char *aTablePtr = this->GetPointer(i);
+    CopyColor( aTablePtr, theColor );
+  }
+}
+
+
+//----------------------------------------------------------------------------
+void
+VISU_LookupTable
+::MakeBiColor()
+{
+  unsigned char aRedPtr[3] = {255, 0, 0};
+  unsigned char aBluePtr[3] = {0, 0, 255};
+  
+  vtkFloatingPointType aRange[2];
+  this->GetTableRange(aRange);
+  vtkIdType aNbColors = this->GetNumberOfColors();
+  
+  vtkFloatingPointType aDelta = (aRange[1]-aRange[0])/aNbColors;
+  vtkFloatingPointType aValue = aRange[0]+0.5*aDelta;
+  for(int i = 0; i < aNbColors; i++){
+    vtkIdType anIndex = this->GetIndex(aValue);
+    unsigned char* aTablePtr = this->GetPointer(anIndex);
+    if(aValue > 0.0){
+      CopyColor(aTablePtr,aRedPtr);
+    }else{
+      CopyColor(aTablePtr,aBluePtr);
+    }
+    aValue += aDelta;
+  }
+}
+
+
+//----------------------------------------------------------------------------
 void 
 VISU_LookupTable
 ::SetMapScale(vtkFloatingPointType theScale)
index 93fc7a47b137c19cadbe062c5ac3158baa7d93bd..ff525110ea7846594adb52bc7b6f0b1f42c87bde 100644 (file)
@@ -44,8 +44,17 @@ class VISU_LookupTable: public vtkLookupTable
   bool GetBicolor() { return myBicolor; }
   void SetBicolor( bool theBicolor );
 
-   static int ComputeLogRange(vtkFloatingPointType inRange[2], vtkFloatingPointType outRange[2]);
-   unsigned char *MapValue(vtkFloatingPointType v);
+  static int ComputeLogRange( vtkFloatingPointType inRange[2], 
+                             vtkFloatingPointType outRange[2] );
+  
+  unsigned char *MapValue(vtkFloatingPointType v);
+
+  void MarkValueByColor( vtkFloatingPointType theValue,
+                        unsigned char* theColor );
+
+  void FillByColor( unsigned char* theColor );
+
+  void MakeBiColor();
 
  protected:
    VISU_LookupTable(int sze=256, int ext=256);
index 756abdeed99bba7a2990864f94bf774978cab4da..3a87d47cd2b84dadb5a4124319488bd57e21c7dd 100644 (file)
@@ -139,6 +139,8 @@ public:
   vtkPlane* 
   GetClippingPlane(vtkIdType theID) = 0;
 
+  virtual void RemoveClippingPlane(vtkIdType theID) = 0;
+
   //----------------------------------------------------------------------------
   virtual
   void
index 9e5dd5d712e68a3f17c4daf77a214c2ba392857b..cfcc21169c4348a862cc327eb2063c435de98100 100644 (file)
@@ -44,6 +44,7 @@ VISU_MeshPL
   VISU_UnstructuredGridPL(this)
 {
   SetIsShrinkable(true);
+  SetIsFeatureEdgesAllowed(true);
 }
 
 
index ea165bc078c1c073b603e35d5ab35e7f35cf4f2e..0761bbd5e73cb0810fd1c67064db561b13f431c4 100644 (file)
@@ -47,7 +47,8 @@ static int MYDEBUG = 0;
 //----------------------------------------------------------------------------
 VISU_PipeLine
 ::VISU_PipeLine():
-  myIsShrinkable(true)
+  myIsShrinkable(true),
+  myIsFeatureEdgesAllowed(true)
 {
   if(MYDEBUG) MESSAGE("VISU_PipeLine::VISU_PipeLine - "<<this);
 }
@@ -282,6 +283,26 @@ VISU_PipeLine
 }
 
 
+//----------------------------------------------------------------------------
+bool 
+VISU_PipeLine
+::IsFeatureEdgesAllowed()
+{
+  return myIsFeatureEdgesAllowed;
+}
+
+void 
+VISU_PipeLine
+::SetIsFeatureEdgesAllowed(bool theIsFeatureEdgesAllowed)
+{
+  if(myIsFeatureEdgesAllowed == theIsFeatureEdgesAllowed)
+    return;
+
+  myIsFeatureEdgesAllowed = theIsFeatureEdgesAllowed;
+  Modified();
+}
+
+
 //----------------------------------------------------------------------------
 void
 VISU_PipeLine
@@ -347,6 +368,12 @@ VISU_PipeLine
   return GetMapperHolder()->GetClippingPlane(theID);
 }
 
+//----------------------------------------------------------------------------
+void VISU_PipeLine::RemoveClippingPlane(vtkIdType theID)
+{
+  return GetMapperHolder()->RemoveClippingPlane(theID);
+}
+
 //----------------------------------------------------------------------------
 vtkDataSet* 
 VISU_PipeLine
index 5301593714de39a4d3468f01f40db3f3edee2cbd..72ee74d2beebf520adfd368e0991f9309733d1b6 100644 (file)
@@ -132,6 +132,9 @@ public:
   bool 
   IsShrinkable();
 
+  bool 
+  IsFeatureEdgesAllowed();
+
   //----------------------------------------------------------------------------
   void
   SetImplicitFunction(vtkImplicitFunction *theFunction);
@@ -159,6 +162,8 @@ public:
   vtkPlane* 
   GetClippingPlane(vtkIdType theID);
 
+  virtual void RemoveClippingPlane(vtkIdType theID);
+
   virtual
   void
   SetPlaneParam(vtkFloatingPointType theDir[3], 
@@ -209,10 +214,14 @@ protected:
   void 
   SetIsShrinkable(bool theIsShrinkable);
 
+  void 
+  SetIsFeatureEdgesAllowed(bool theIsFeatureEdgesAllowed);
+
 private:
   //----------------------------------------------------------------------------
   vtkSmartPointer<VISU_MapperHolder> myMapperHolder;
   bool myIsShrinkable;
+  bool myIsFeatureEdgesAllowed;
 };
 
 #endif
index ed3750fc98da5e99604968c15c69e0d7ccc60fbe..a3465a37097c28fa3c3acf7e007ab499e85fc090 100644 (file)
@@ -60,6 +60,7 @@ VISU_Plot3DPL
   myMapScaleFactor(1.0)
 {
   SetIsShrinkable(false);
+  SetIsFeatureEdgesAllowed(false);
 
   myCellDataToPointData->Delete();
   myAppendPolyData->Delete();
index 69c9be266c204dedd9873c979b750f77cd7664af..6497e48986a440e1fec693313ce88812b85354b1 100644 (file)
@@ -30,6 +30,7 @@
 #include "VISU_OpenGLPointSpriteMapper.hxx"
 
 #include "VISU_PipeLineUtils.hxx"
+#include "SALOME_ExtractPolyDataGeometry.h"
 
 #ifdef _DEBUG_
 static int MYDEBUG = 0;
@@ -73,6 +74,7 @@ VISU_PointSpriteMapperHolder
     VISU::CopyPointSpriteDataMapper(GetPointSpriteMapper(), 
                                    aMapperHolder->GetPointSpriteMapper(), 
                                    theIsCopyInput);
+    myExtractPolyDataGeometry->SetImplicitFunction(aMapperHolder->GetImplicitFunction());
   }
 }
 
index 0b9cd22766a47430e96165a29f0e401554023c34..43ece1713636d8a59bd546173070a85045bd2f58 100644 (file)
@@ -40,6 +40,7 @@
 #include <vtkImplicitFunction.h>
 #include <vtkImplicitFunctionCollection.h>
 #include <vtkMath.h>
+//#include <vtkExtractPolyDataGeometry.h>
 
 #ifdef _DEBUG_
 static int MYDEBUG = 0;
@@ -67,6 +68,7 @@ VISU_PolyDataMapperHolder
   myExtractPolyDataGeometry->SetImplicitFunction(anImplicitBoolean);
   anImplicitBoolean->SetOperationTypeToIntersection();
   anImplicitBoolean->Delete();
+  //myExtractPolyDataGeometry->ExtractInsideOn();
 }
 
 
@@ -92,6 +94,7 @@ VISU_PolyDataMapperHolder
     VISU::CopyPolyDataMapper(GetPolyDataMapper(), 
                             aMapperHolder->GetPolyDataMapper(), 
                             theIsCopyInput);
+    myExtractPolyDataGeometry->SetImplicitFunction(aMapperHolder->GetImplicitFunction());
   }
 }
 
@@ -257,6 +260,7 @@ VISU_PolyDataMapperHolder
     if (vtkImplicitBoolean* aBoolean = myExtractPolyDataGeometry->GetImplicitBoolean()) {
       vtkImplicitFunctionCollection* aFunction = aBoolean->GetFunction();
       aFunction->AddItem(thePlane);
+      aBoolean->Modified();
       // Check, that at least one cell present after clipping.
       // This check was introduced because of bug IPAL8849.
       vtkDataSet* aClippedDataSet = GetClippedInput();
@@ -286,6 +290,18 @@ VISU_PolyDataMapperHolder
   return aPlane;
 }
 
+//----------------------------------------------------------------------------
+void VISU_PolyDataMapperHolder::RemoveClippingPlane(vtkIdType theID)
+{
+  if(theID >= 0 && theID < GetNumberOfClippingPlanes()){
+    if(vtkImplicitBoolean* aBoolean = myExtractPolyDataGeometry->GetImplicitBoolean()){
+      vtkImplicitFunctionCollection* aFunctions = aBoolean->GetFunction();
+      aFunctions->RemoveItem(theID);
+      aBoolean->Modified();  
+    }
+  }
+}
+
 //----------------------------------------------------------------------------
 void
 VISU_PolyDataMapperHolder
index dc9848eccc1ebfbd02123f08b4312d89b1f68482..ece41f4d11827092b3b94f94dfffdae20284e7e1 100644 (file)
@@ -129,6 +129,8 @@ public:
   virtual
   vtkPlane* 
   GetClippingPlane(vtkIdType theID);
+  
+  void RemoveClippingPlane(vtkIdType theID);
 
 protected:
   //----------------------------------------------------------------------------
@@ -159,6 +161,8 @@ private:
   //----------------------------------------------------------------------------
   VISU::PPolyDataIDMapper myPolyDataIDMapper;
   vtkSmartPointer<vtkPolyDataMapper> myPolyDataMapper;
+
+protected:
   vtkSmartPointer<SALOME_ExtractPolyDataGeometry> myExtractPolyDataGeometry; //!< Clipping
 };
 
index 9adbc3877e5f8cba524fe862b11418d55967292c..eba252be9d0f55e4597d4f898f9e3680679431e1 100644 (file)
@@ -38,6 +38,8 @@
 #include <vtkViewport.h>
 #include <vtkWindow.h>
 #include <vtkLogLookupTable.h>
+#include <vtkProperty2D.h> // RKV
+#include <vtkAxisActor2D.h> // RKV
 
 using namespace std;
 
@@ -109,6 +111,32 @@ VISU_ScalarBarActor::VISU_ScalarBarActor()
   this->TitleRatioHeight = 0;
   this->LabelRatioHeight = 0;
   this->BarRatioHeight = 0;
+  
+  // RKV : Begin
+  this->Distribution = vtkDoubleArray::New();
+  this->DistributionObj = vtkDataObject::New();
+  this->DistributionActor = VISU_XYPlotActor::New();
+  this->DistributionActor->SetTitle("");
+  this->DistributionActor->SetXTitle("");
+  this->DistributionActor->SetYTitle("");
+  this->DistributionActor->GetXAxisActor2D()->LabelVisibilityOff();
+  this->DistributionActor->GetXAxisActor2D()->TitleVisibilityOff();
+  this->DistributionActor->GetXAxisActor2D()->TickVisibilityOff();
+//  this->DistributionActor->GetXAxisActor2D()->SetFontFactor(0.);
+  this->DistributionActor->SetNumberOfYLabels(1);
+//  this->DistributionActor->SetNumberOfXLabels(2);
+  this->DistributionActor->GetXAxisActor2D()->AdjustLabelsOff();
+  this->DistributionActor->GetYAxisActor2D()->AdjustLabelsOff();
+  this->DistributionActor->LegendOff();
+  this->DistributionActor->SetLabelFormat("%4.3f");
+  this->DistributionActor->SetXValuesToIndex();
+//  this->DistributionActor->GetPositionCoordinate()->SetValue(0.0, 0.67, 0);
+//  this->DistributionActor->GetPosition2Coordinate()->SetValue(1.0, 0.33, 0); // #relative to Position
+  this->DistributionActor->GetPositionCoordinate()->
+    SetReferenceCoordinate(this->PositionCoordinate);
+  this->DistributionVisibilityOff(); // Don't show the distribution curve by default
+  
+  // RKV : End
 }
 
 void VISU_ScalarBarActor::ReleaseGraphicsResources(vtkWindow *win)
@@ -122,6 +150,7 @@ void VISU_ScalarBarActor::ReleaseGraphicsResources(vtkWindow *win)
       }
     }
   this->ScalarBarActor->ReleaseGraphicsResources(win);
+  this->DistributionActor->ReleaseGraphicsResources(win); // RKV
 }
 
 VISU_ScalarBarActor::~VISU_ScalarBarActor()
@@ -146,10 +175,16 @@ VISU_ScalarBarActor::~VISU_ScalarBarActor()
     delete [] this->TextActors;
     }
 
+  // RKV : Begin
+  this->DistributionActor->Delete();
+  this->DistributionObj->Delete();
+  this->SetDistribution(NULL);
+  // RKV : End
+
   this->ScalarBar->Delete();
   this->ScalarBarMapper->Delete();
   this->ScalarBarActor->Delete();
-
+  
   if (this->Title)
     {
     delete [] this->Title;
@@ -172,6 +207,10 @@ int VISU_ScalarBarActor::RenderOverlay(vtkViewport *viewport)
     renderedSomething += this->TitleActor->RenderOverlay(viewport);
     }
   this->ScalarBarActor->RenderOverlay(viewport);
+  // RKV : Begin
+  if (this->DistributionVisibility)
+    this->DistributionActor->RenderOverlay(viewport);
+  // RKV : End
   if( this->TextActors == NULL)
     {
      vtkWarningMacro(<<"Need a mapper to render a scalar bar");
@@ -238,11 +277,19 @@ int VISU_ScalarBarActor::RenderOpaqueGeometry(vtkViewport *viewport)
     }
   
   // Check to see whether we have to rebuild everything
+  // RKV : Begin
   if (positionsHaveChanged ||
       this->GetMTime() > this->BuildTime || 
       this->LookupTable->GetMTime() > this->BuildTime ||
       this->LabelTextProperty->GetMTime() > this->BuildTime ||
-      this->TitleTextProperty->GetMTime() > this->BuildTime)
+      this->TitleTextProperty->GetMTime() > this->BuildTime ||
+      this->Distribution->GetMTime() > this->BuildTime)
+  // RKV : End
+/* RKV  if (positionsHaveChanged ||
+      this->GetMTime() > this->BuildTime || 
+      this->LookupTable->GetMTime() > this->BuildTime ||
+      this->LabelTextProperty->GetMTime() > this->BuildTime ||
+      this->TitleTextProperty->GetMTime() > this->BuildTime)*/
     {
 
     // Delete previously constructed objects
@@ -276,6 +323,32 @@ int VISU_ScalarBarActor::RenderOpaqueGeometry(vtkViewport *viewport)
     colors->SetNumberOfComponents(3);
     colors->SetNumberOfTuples(numColors);
 
+// RKV : Begin
+    // If the distribution is changed then recalculate the total
+    if (this->Distribution->GetMTime() > this->BuildTime) {
+         int aNbVals = this->Distribution->GetNumberOfTuples();
+      double range[2];
+      this->Distribution->GetRange(range);
+      this->DistributionActor->SetYRange(0, range[1]);
+/*       int total = 0;
+         for(vtkIdType aValId = 0; aValId < aNbVals; aValId++){
+               total += this->Distribution->GetValue(aValId);
+         }
+         this->DistributionActor->SetYRange(0, total);
+*/
+      }
+  
+    this->DistributionActor->SetProperty(this->GetProperty());
+    this->DistributionActor->GetProperty()->SetColor(1, 1, 1);
+    this->DistributionActor->GetProperty()->SetLineWidth(2);
+    this->DistributionActor->GetProperty()->SetDisplayLocationToForeground();
+    vtkTextProperty* tprop;
+    tprop = this->DistributionActor->GetTitleTextProperty();
+    tprop->SetColor(this->DistributionActor->GetProperty()->GetColor());
+//  this->DistributionActor->SetAxisTitleTextProperty(tprop);
+//  this->DistributionActor->SetAxisLabelTextProperty(tprop);
+    
+// RKV : End
     this->ScalarBarActor->SetProperty(this->GetProperty());
     this->ScalarBar->Initialize();
     this->ScalarBar->SetPoints(pts);
@@ -394,6 +467,7 @@ int VISU_ScalarBarActor::RenderOpaqueGeometry(vtkViewport *viewport)
         this->TextActors[i]->SetPosition(barWidth+3,
                                          val - sizeTextData[1]/2);
         }
+        
       }
     else
       {
@@ -405,7 +479,11 @@ int VISU_ScalarBarActor::RenderOpaqueGeometry(vtkViewport *viewport)
         val = (vtkFloatingPointType)i/(this->NumberOfLabels-1) * barWidth;
         this->TextActors[i]->SetPosition(val, barHeight + 0.05*size[1]);
         }
+        
       }
+      
+    // Compute the position of the distribution curve
+    this->PlaceDistribution(viewport, barWidth, barHeight); // RKV
 
     this->BuildTime.Modified();
     }
@@ -416,6 +494,10 @@ int VISU_ScalarBarActor::RenderOpaqueGeometry(vtkViewport *viewport)
     renderedSomething += this->TitleActor->RenderOpaqueGeometry(viewport);
     }
   this->ScalarBarActor->RenderOpaqueGeometry(viewport);
+  // RKV : Begin
+  if (this->DistributionVisibility)
+    this->DistributionActor->RenderOpaqueGeometry(viewport);
+  // RKV : End
   for (i=0; i<this->NumberOfLabels; i++)
     {
     renderedSomething += this->TextActors[i]->RenderOpaqueGeometry(viewport);
@@ -619,6 +701,58 @@ void VISU_ScalarBarActor::SizeTitle(int *titleSize, int *size,
   this->TitleMapper->GetSize(viewport, titleSize);
 }
 
+// RKV : Begin
+void VISU_ScalarBarActor::SetDistributionVisibility(int v) 
+{
+  this->DistributionVisibility = v;
+  if (v) {
+       this->DistributionActor->VisibilityOn();
+  } else {
+       this->DistributionActor->VisibilityOff();
+  }
+}
+
+void VISU_ScalarBarActor::SetDistribution(vtkDoubleArray *distr) 
+{
+  this->Distribution = distr;
+  if (distr == NULL) return;
+  
+  this->DistributionObj->Initialize();
+  this->DistributionObj->GetFieldData()->AddArray(this->Distribution);
+  this->DistributionActor->AddDataObjectInput(this->DistributionObj);
+  // Set ranges of axes for the distribution curve
+  this->DistributionActor->SetXRange(0, this->Distribution->GetNumberOfTuples()-1);
+  double range[2];
+  this->Distribution->GetRange(range);
+  int aNbVals = this->Distribution->GetNumberOfTuples();
+//  int total = 0;
+  if (this->GetDebug()) {
+  for(vtkIdType aValId = 0; aValId < aNbVals; aValId++){
+//     if (this->GetDebug()) {
+               if (this->Distribution->GetValue(aValId) > 0)
+             vtkDebugMacro(<< "D(" << aValId << ") = " << this->Distribution->GetValue(aValId));
+//     }
+//     total += this->Distribution->GetValue(aValId);
+  }
+  }
+//  this->DistributionActor->SetYRange(0, total);
+  this->DistributionActor->SetYRange(0, range[1]);
+  vtkDebugMacro(<< "max X = " << this->Distribution->GetNumberOfTuples());
+  vtkDebugMacro(<< "Y = (" << range[0] << ", " << range[1] << ")");
+//  vtkDebugMacro(<< "total = " << total);
+}
+
+void VISU_ScalarBarActor::DebugOn() {
+       this->DistributionActor->DebugOn();
+       Superclass::DebugOn();
+} 
+
+void VISU_ScalarBarActor::DebugOff() {
+       this->DistributionActor->DebugOff();
+       Superclass::DebugOff();
+} 
+// RKV : End
+
 void VISU_ScalarBarActor::SetRatios(int titleRatioWidth, int titleRatioHeight,
                                    int labelRatioWidth, int labelRatioHeight,
                                    int barRatioWidth, int barRatioHeight)
@@ -694,3 +828,91 @@ void VISU_ScalarBarActor::SizeBar(int& barSizeWidth, int& barSizeHeight, int *si
   else
     barSizeHeight = (int)(0.01*BarRatioHeight*size[1]);
 }
+// RKV : Begin
+//------------------------------------------------------------------------------
+/** Place the distribution plot actor in the viewport according to the 
+ * scalar bar location and orientation */
+void VISU_ScalarBarActor::PlaceDistribution(vtkViewport *viewport, const int barWidth, const int barHeight) {
+    vtkDebugMacro(<< "barOrigin[0]=" << this->LastOrigin[0] << "; barOrigin[1]=" << this->LastOrigin[1]);
+    // Detect the side of the viewport where the curve should be placed by the bar origin.
+    double u = (double)(this->LastOrigin[0]), v = (double)(this->LastOrigin[1]), z=0;
+    viewport->ViewportToNormalizedViewport(u, v);
+    
+    if ( this->Orientation == VTK_ORIENT_VERTICAL ) {
+      // Position the distribution curve vertically
+      if (u > 0.5) {
+       // X - UP, Y - TO THE LEFT
+       this->DistributionActor->SetPlotLocation(VISU_XYPLOT_RIGHT);
+       // Curve to be placed on the left side of the bar
+        vtkDebugMacro(<< "Curve to be placed on the left side of the bar");
+        // relative to the bar origin
+       u = 0;
+       v = 0;
+        viewport->ViewportToNormalizedViewport(u, v);
+        vtkDebugMacro(<< "u=" << u << "; v=" << v);
+        this->DistributionActor->GetPositionCoordinate()->SetValue(u, v, 0);
+        // relative to Position
+        u = - barWidth;
+        v = barHeight;
+        viewport->ViewportToNormalizedViewport(u, v);
+        vtkDebugMacro("u2=" << u << "; v2=" << v);
+        this->DistributionActor->GetPosition2Coordinate()->SetValue(u, v, 0);
+      } else {
+       // X - UP, Y - TO THE RIGHT
+       this->DistributionActor->SetPlotLocation(VISU_XYPLOT_LEFT);
+       // Curve to be placed on the right side of the bar
+        vtkDebugMacro(<< "Curve to be placed on the right side of the bar");
+        // relative to the bar origin
+        u = barWidth;
+       v = 0;
+        viewport->ViewportToNormalizedViewport(u, v);
+        vtkDebugMacro(<< "u=" << u << "; v=" << v);
+        this->DistributionActor->GetPositionCoordinate()->SetValue(u, v, 0);
+        // relative to Position
+        u = barWidth;
+        v = barHeight;
+        viewport->ViewportToNormalizedViewport(u, v);
+        vtkDebugMacro("u2=" << u << "; v2=" << v);
+        this->DistributionActor->GetPosition2Coordinate()->SetValue(u, v, 0);
+      }
+    } else {
+      // Position the distribution curve horizontally
+      if (v > 0.5) {
+       // X - TO THE LEFT, Y - DOWN
+       this->DistributionActor->SetPlotLocation(VISU_XYPLOT_TOP);
+       // Curve to be placed below the bar
+        vtkDebugMacro(<< "Curve to be placed below the bar");
+        // relative to the bar origin
+               u = 0;
+       v = 0;
+        viewport->ViewportToNormalizedViewport(u, v);
+        vtkDebugMacro(<< "u=" << u << "; v=" << v);
+        this->DistributionActor->GetPositionCoordinate()->SetValue(u, v, 0);
+        // relative to Position
+        u = barWidth;
+        v = - barHeight;
+        viewport->ViewportToNormalizedViewport(u, v);
+        vtkDebugMacro("u2=" << u << "; v2=" << v);
+        this->DistributionActor->GetPosition2Coordinate()->SetValue(u, v, 0);
+      } else {
+       // X - TO THE RIGHT, Y - UP
+       this->DistributionActor->SetPlotLocation(VISU_XYPLOT_BOTTOM);
+       // Curve to be placed on the top of the bar
+        vtkDebugMacro(<< "Curve to be placed on the top of the bar");
+        // relative to the bar origin
+               u = 0;
+       v = barHeight;
+        viewport->ViewportToNormalizedViewport(u, v);
+        vtkDebugMacro(<< "u=" << u << "; v=" << v);
+        this->DistributionActor->GetPositionCoordinate()->SetValue(u, v, 0);
+        // relative to Position
+        u = barWidth;
+        v = barHeight;
+        viewport->ViewportToNormalizedViewport(u, v);
+        vtkDebugMacro("u2=" << u << "; v2=" << v);
+        this->DistributionActor->GetPosition2Coordinate()->SetValue(u, v, 0);
+      }
+    }
+}
+// RKV : End
+
index 3252e6e82de664eaeaf09c58e639e2de172c5fb8..7f21738100ccb3004cb54c9aca48b2335a6d5db1 100644 (file)
 
 #include "VISUPipeline.hxx"
 #include "VISU_LookupTable.hxx"
+#include "VISU_XYPlotActor.hxx"
 
 #include <vtkActor2D.h>
+#include <vtkDoubleArray.h> // RKV
 
 class vtkPolyData;
 class vtkPolyDataMapper2D;
@@ -106,6 +108,24 @@ public:
   // Set/Get the labels text property.
   virtual void SetLabelTextProperty(vtkTextProperty *p);
   vtkGetObjectMacro(LabelTextProperty,vtkTextProperty);
+
+// RKV : Begin
+  // Description:
+  // Set/Get the values distribution array
+  virtual void SetDistribution(vtkDoubleArray *d);
+  vtkGetObjectMacro(Distribution,vtkDoubleArray);
+  
+  // Description:
+  // Set/Get the flag of distribution plot visibility
+  void SetDistributionVisibility(int v);
+  vtkGetMacro(DistributionVisibility, int);
+  void DistributionVisibilityOn()
+       {this->SetDistributionVisibility(1);};
+  void DistributionVisibilityOff() {this->SetDistributionVisibility(0);};
+
+  void DebugOn();
+  void DebugOff();
+// RKV : End
     
   // Description:
   // Set/Get the scalar bar dimention properties in persents.
@@ -139,6 +159,13 @@ protected:
   VISU_LookupTable *LookupTable;
   vtkTextProperty *TitleTextProperty;
   vtkTextProperty *LabelTextProperty;
+  
+  /** Array for keeping the distribution of colors within cells.
+   * For each color index the appropriate element of the array contains 
+   * a number of cells for this color.*/ 
+  vtkDoubleArray     *Distribution; // RKV
+  /** Visibility flag for the distribution plot */
+  int             DistributionVisibility; // RKV
 
   int   MaximumNumberOfColors;
   int   NumberOfLabels;
@@ -167,6 +194,9 @@ private:
   vtkPolyDataMapper2D *ScalarBarMapper;
   vtkActor2D          *ScalarBarActor;
 
+  vtkDataObject       *DistributionObj; // RKV
+  VISU_XYPlotActor    *DistributionActor; // RKV
+
   vtkTimeStamp  BuildTime;
   int LastSize[2];
   int LastOrigin[2];
@@ -175,6 +205,10 @@ private:
 
   void SizeBar(int& barSizeWidth, int& barSizeHeight, int *size,
               vtkViewport *viewport, vtkFloatingPointType *range);
+              
+  /** Place the distribution plot actor in the viewport according to the 
+   * scalar bar location and orientation */
+  void PlaceDistribution(vtkViewport *viewport, const int barWidth, const int barHeight);
 
 private:
   VISU_ScalarBarActor(const VISU_ScalarBarActor&);  // Not implemented.
index 5dbf6e47845fbcb471eba2af6b5a238ca41bbe15..3003295d07d3eaabeec5d03db689c3d8805522e1 100644 (file)
 #include <string.h>
 
 
-//----------------------------------------------------------------------------
-namespace
-{
-  inline
-  void
-  MarkValueByColor(VISU_LookupTable* theTable,
-                  vtkFloatingPointType theValue,
-                  unsigned char* theColor)
-  { 
-    vtkIdType anIndex = theTable->GetIndex(theValue);
-    unsigned char *aTablePtr = theTable->GetPointer(anIndex);
-    aTablePtr[0] = theColor[0];
-    aTablePtr[1] = theColor[1];
-    aTablePtr[2] = theColor[2];
-  }
-
-  inline
-  void
-  CopyColor(unsigned char* theTaget, const unsigned char* theSource)
-  {
-    theTaget[0] = theSource[0];
-    theTaget[1] = theSource[1];
-    theTaget[2] = theSource[2];
-  }
-
-  void
-  FillByColor(VISU_LookupTable* theTable,
-             unsigned char* theColor)
-  {
-    vtkIdType aNbColors = theTable->GetNumberOfColors();
-    for(int i = 0; i < aNbColors; i++){
-      unsigned char *aTablePtr = theTable->GetPointer(i);
-      CopyColor(aTablePtr,theColor);
-    }
-  }
-
-  void
-  MakeBiColor(VISU_LookupTable* theTable)
-  {
-    unsigned char aRedPtr[3] = {255, 0, 0};
-    unsigned char aBluePtr[3] = {0, 0, 255};
-
-    vtkFloatingPointType aRange[2];
-    theTable->GetTableRange(aRange);
-    vtkIdType aNbColors = theTable->GetNumberOfColors();
-
-    vtkFloatingPointType aDelta = (aRange[1]-aRange[0])/aNbColors;
-    vtkFloatingPointType aValue = aRange[0]+0.5*aDelta;
-    for(int i = 0; i < aNbColors; i++){
-      vtkIdType anIndex = theTable->GetIndex(aValue);
-      unsigned char* aTablePtr = theTable->GetPointer(anIndex);
-      if(aValue > 0.0){
-       CopyColor(aTablePtr,aRedPtr);
-      }else{
-       CopyColor(aTablePtr,aBluePtr);
-      }
-      aValue += aDelta;
-    }
-  }
-}
-
-
 //----------------------------------------------------------------------------
 vtkStandardNewMacro(VISU_ScalarBarCtrl);
 
@@ -435,16 +373,16 @@ VISU_ScalarBarCtrl
 {
   if(myMarked){
     if(myMode == eGlobal){
-      MarkValueByColor(myGlobalLookupTable, myMarkedValue, myBlack);
+      myGlobalLookupTable->MarkValueByColor( myMarkedValue, myBlack );
     }else{
-      MarkValueByColor(myLocalLookupTable, myMarkedValue, myBlack);
+      myLocalLookupTable->MarkValueByColor( myMarkedValue, myBlack );
     }
   }
   if(myGlobalRangeIsDefined){
     vtkFloatingPointType aLocalRange[2];
     myLocalLookupTable->GetTableRange(aLocalRange);
-    MarkValueByColor(myGlobalLookupTable, aLocalRange[0], myBlack);
-    MarkValueByColor(myGlobalLookupTable, aLocalRange[1], myBlack);
+    myGlobalLookupTable->MarkValueByColor( aLocalRange[0], myBlack );
+    myGlobalLookupTable->MarkValueByColor( aLocalRange[1], myBlack );
   }
 }
 
@@ -490,9 +428,9 @@ VISU_ScalarBarCtrl
 ::UpdateForColor()
 {
   if(myMode == eGlobal){ 
-    FillByColor(myLocalLookupTable,myGrey);
+    myLocalLookupTable->FillByColor( myGrey );
   }else if(myMode == eLocal){
-    FillByColor(myGlobalLookupTable,myGrey);
+    myGlobalLookupTable->FillByColor( myGrey );
   }
 }
 
@@ -506,15 +444,15 @@ VISU_ScalarBarCtrl
   myLocalLookupTable->Build();
 
   if(myMode == eSimple){
-    MakeBiColor(myLocalLookupTable);
+    myLocalLookupTable->MakeBiColor();
     return;
   }
 
   if(myMode == eGlobal){
-    MakeBiColor(myGlobalLookupTable);
-    FillByColor(myLocalLookupTable,myGrey);
+    myGlobalLookupTable->MakeBiColor();
+    myLocalLookupTable->FillByColor( myGrey );
   }else if(myMode == eLocal){
-    MakeBiColor(myLocalLookupTable);
-    FillByColor(myGlobalLookupTable,myGrey);
+    myLocalLookupTable->MakeBiColor();
+    myGlobalLookupTable->FillByColor( myGrey );
   }
 }
index ad7397733e0e64f0038668b2f26e0b8d80e957d6..e252334bcaee0890281a3fb8ed6377065b6cafca 100644 (file)
@@ -56,6 +56,7 @@ VISU_ScalarMapPL
   myMergeFilter(VISU_MergeFilter::New())
 {
   SetIsShrinkable(true);
+  SetIsFeatureEdgesAllowed(true);
 
   SetElnoDisassembleState( false );
 
index b596155ea19ace0fa2ba5c57a50bf5a0647b4f16..82c050096fdc8757cc26cab3d224b757d35cdcd2 100644 (file)
@@ -62,6 +62,7 @@ VISU_StreamLinesPL
 ::VISU_StreamLinesPL()
 {
   SetIsShrinkable(false);
+  SetIsFeatureEdgesAllowed(false);
 
   myStream = vtkStreamLine::New();
   myCenters = vtkCellCenters::New();
index 1c3257b929ff9345031121c9c93693a28c4d26de..e397649451e3465add16ff6c8b426c497726afd1 100644 (file)
@@ -63,7 +63,8 @@ void ToCellCenters( TOutputFilter *theOutputFilter,
 VISU_VectorsPL
 ::VISU_VectorsPL()
 {
-  SetIsShrinkable( false );
+  SetIsShrinkable(false);
+  SetIsFeatureEdgesAllowed(false);
 
   myGlyph = vtkGlyph3D::New();
 
diff --git a/src/PIPELINE/VISU_XYPlotActor.cxx b/src/PIPELINE/VISU_XYPlotActor.cxx
new file mode 100644 (file)
index 0000000..c4818b4
--- /dev/null
@@ -0,0 +1,2271 @@
+//  VISU OBJECT : interactive object for VISU entities implementation
+//
+//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+//
+//
+// File:    VISU_XYPlotActor.cxx
+// Author:  Roman KOZLOV
+// Module : VISU
+
+/*=========================================================================
+
+  Program:   Visualization Toolkit
+  Module:    $RCSfile$
+
+  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
+  All rights reserved.
+  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
+
+     This software is distributed WITHOUT ANY WARRANTY; without even
+     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+     PURPOSE.  See the above copyright notice for more information.
+
+=========================================================================*/
+#include "VISU_XYPlotActor.hxx"
+
+#include "vtkAppendPolyData.h"
+#include "vtkAxisActor2D.h"
+#include "vtkCellArray.h"
+#include "vtkDataObjectCollection.h"
+#include "vtkDataSetCollection.h"
+#include "vtkFieldData.h"
+#include "vtkDoubleArray.h"
+#include "vtkGlyph2D.h"
+#include "vtkGlyphSource2D.h"
+#include "vtkIntArray.h"
+#include "vtkLegendBoxActor.h"
+#include "vtkMath.h"
+#include "vtkObjectFactory.h"
+#include "vtkPlane.h"
+#include "vtkPlanes.h"
+#include "vtkPointData.h"
+#include "vtkPolyData.h"
+#include "vtkPolyDataMapper2D.h"
+#include "vtkProperty2D.h"
+#include "vtkTextMapper.h"
+#include "vtkTextProperty.h"
+#include "vtkViewport.h"
+#include "vtkTransformPolyDataFilter.h" // RKV
+#include "vtkTransform.h" // RKV
+
+#define VTK_MAX_PLOTS 50
+
+using namespace std;
+
+vtkCxxRevisionMacro(VISU_XYPlotActor, "$Revision$");
+vtkStandardNewMacro(VISU_XYPlotActor);
+
+vtkCxxSetObjectMacro(VISU_XYPlotActor,TitleTextProperty,vtkTextProperty);
+vtkCxxSetObjectMacro(VISU_XYPlotActor,AxisLabelTextProperty,vtkTextProperty);
+vtkCxxSetObjectMacro(VISU_XYPlotActor,AxisTitleTextProperty,vtkTextProperty);
+
+//----------------------------------------------------------------------------
+// Instantiate object
+VISU_XYPlotActor::VISU_XYPlotActor()
+{
+  this->PositionCoordinate->SetCoordinateSystemToNormalizedViewport();
+  this->PositionCoordinate->SetValue(0.25,0.25);
+  this->Position2Coordinate->SetValue(0.5, 0.5);
+
+  this->InputList = vtkDataSetCollection::New();
+  this->SelectedInputScalars = NULL;
+  this->SelectedInputScalarsComponent = vtkIntArray::New();
+  this->DataObjectInputList = vtkDataObjectCollection::New();
+
+  this->Title = NULL;
+  this->XTitle = new char[7];
+  sprintf(this->XTitle,"%s","X Axis");
+  this->YTitle = new char[7];
+  sprintf(this->YTitle,"%s","Y Axis");
+
+  this->XValues = VTK_XYPLOT_INDEX;
+  this->PlotLocation = VISU_XYPLOT_BOTTOM; // RKV
+
+  this->NumberOfXLabels = 5;
+  this->NumberOfYLabels = 5;
+
+  this->TitleTextProperty = vtkTextProperty::New();
+  this->TitleTextProperty->SetBold(1);
+  this->TitleTextProperty->SetItalic(1);
+  this->TitleTextProperty->SetShadow(1);
+  this->TitleTextProperty->SetFontFamilyToArial();
+
+  this->AxisLabelTextProperty = vtkTextProperty::New();
+  this->AxisLabelTextProperty->ShallowCopy(this->TitleTextProperty);
+
+  this->AxisTitleTextProperty = vtkTextProperty::New();
+  this->AxisTitleTextProperty->ShallowCopy(this->AxisLabelTextProperty);
+
+  this->LabelFormat = new char[8]; 
+  sprintf(this->LabelFormat,"%s","%-#6.3g");
+
+  this->Logx = 0;
+  
+  this->XRange[0] = 0.0;
+  this->XRange[1] = 0.0;
+  this->YRange[0] = 0.0;
+  this->YRange[1] = 0.0;
+
+  this->Border = 5;
+  this->PlotLines = 1;
+  this->PlotPoints = 0;
+  this->PlotCurveLines = 0;
+  this->PlotCurvePoints = 0;
+  this->ExchangeAxes = 0;
+  this->ReverseXAxis = 0;
+  this->ReverseYAxis = 0;
+
+  this->TitleMapper = vtkTextMapper::New();
+  this->TitleActor = vtkActor2D::New();
+  this->TitleActor->SetMapper(this->TitleMapper);
+  this->TitleActor->GetPositionCoordinate()->SetCoordinateSystemToViewport();
+
+  this->XAxis = vtkAxisActor2D::New();
+  this->XAxis->GetPositionCoordinate()->SetCoordinateSystemToViewport();
+  this->XAxis->GetPosition2Coordinate()->SetCoordinateSystemToViewport();
+  this->XAxis->SetProperty(this->GetProperty());
+
+  this->YAxis = vtkAxisActor2D::New();
+  this->YAxis->GetPositionCoordinate()->SetCoordinateSystemToViewport();
+  this->YAxis->GetPosition2Coordinate()->SetCoordinateSystemToViewport();
+  this->YAxis->SetProperty(this->GetProperty());
+  
+  this->NumberOfInputs = 0;
+  this->PlotData = NULL;
+  this->PlotGlyph = NULL;
+  this->PlotAppend = NULL;
+  this->PlotTransform = NULL; // RKV
+  this->PlotMapper = NULL;
+  this->PlotActor = NULL;
+
+  this->ViewportCoordinate[0] = 0.0;
+  this->ViewportCoordinate[1] = 0.0;
+  this->PlotCoordinate[0] = 0.0;
+  this->PlotCoordinate[1] = 0.0;
+
+  this->DataObjectPlotMode = VTK_XYPLOT_COLUMN;
+  this->XComponent = vtkIntArray::New();
+  this->XComponent->SetNumberOfValues(VTK_MAX_PLOTS);
+  this->YComponent = vtkIntArray::New();
+  this->YComponent->SetNumberOfValues(VTK_MAX_PLOTS);
+
+  this->LinesOn = vtkIntArray::New();
+  this->LinesOn->SetNumberOfValues(VTK_MAX_PLOTS);
+  this->PointsOn = vtkIntArray::New();
+  this->PointsOn->SetNumberOfValues(VTK_MAX_PLOTS);
+  for (int i=0; i<VTK_MAX_PLOTS; i++)
+    {
+    this->XComponent->SetValue(i,0);
+    this->YComponent->SetValue(i,0);
+    this->LinesOn->SetValue(i,this->PlotLines);
+    this->PointsOn->SetValue(i,this->PlotPoints);
+    }
+
+  this->Legend = 0;
+  this->LegendPosition[0] = 0.85;
+  this->LegendPosition[1] = 0.75;
+  this->LegendPosition2[0] = 0.15;
+  this->LegendPosition2[1] = 0.20;
+  this->LegendActor = vtkLegendBoxActor::New();
+  this->LegendActor->GetPositionCoordinate()->SetCoordinateSystemToViewport();
+  this->LegendActor->GetPosition2Coordinate()->SetCoordinateSystemToViewport();
+  this->LegendActor->GetPosition2Coordinate()->SetReferenceCoordinate(NULL);
+  this->LegendActor->BorderOff();
+  this->LegendActor->SetNumberOfEntries(VTK_MAX_PLOTS); //initial allocation
+  this->GlyphSource = vtkGlyphSource2D::New();
+  this->GlyphSource->SetGlyphTypeToNone();
+  this->GlyphSource->DashOn();
+  this->GlyphSource->FilledOff();
+  this->GlyphSize = 0.020;
+
+  this->ClipPlanes = vtkPlanes::New();
+  vtkPoints *pts = vtkPoints::New();
+  pts->SetNumberOfPoints(4);
+  this->ClipPlanes->SetPoints(pts);
+  pts->Delete();
+  vtkDoubleArray *n = vtkDoubleArray::New();
+  n->SetNumberOfComponents(3);
+  n->SetNumberOfTuples(4);
+  this->ClipPlanes->SetNormals(n);
+  n->Delete();
+
+  this->CachedSize[0] = 0;
+  this->CachedSize[1] = 0;
+}
+
+//----------------------------------------------------------------------------
+VISU_XYPlotActor::~VISU_XYPlotActor()
+{
+  // Get rid of the list of array names.
+  int num = this->InputList->GetNumberOfItems();
+  if (this->SelectedInputScalars)
+    {
+    for (int i = 0; i < num; ++i)
+      {
+      if (this->SelectedInputScalars[i])
+        {
+        delete [] this->SelectedInputScalars[i];
+        this->SelectedInputScalars[i] = NULL;
+        }
+      }
+    delete [] this->SelectedInputScalars;
+    this->SelectedInputScalars = NULL;  
+    }
+  this->SelectedInputScalarsComponent->Delete();
+  this->SelectedInputScalarsComponent = NULL;
+
+  //  Now we can get rid of the inputs. 
+  this->InputList->Delete();
+  this->InputList = NULL;
+
+  this->DataObjectInputList->Delete();
+  this->DataObjectInputList = NULL;
+
+  this->TitleMapper->Delete();
+  this->TitleMapper = NULL;
+  this->TitleActor->Delete();
+  this->TitleActor = NULL;
+
+  this->SetTitle(0);
+  this->SetXTitle(0);
+  this->SetYTitle(0);
+  this->SetLabelFormat(0);
+
+  this->XAxis->Delete();
+  this->YAxis->Delete();
+  
+  this->InitializeEntries();
+
+  this->LegendActor->Delete();
+  this->GlyphSource->Delete();
+  this->ClipPlanes->Delete();
+  
+  this->XComponent->Delete();
+  this->YComponent->Delete();
+
+  this->LinesOn->Delete();
+  this->PointsOn->Delete();
+
+  this->SetTitleTextProperty(NULL);
+  this->SetAxisLabelTextProperty(NULL);
+  this->SetAxisTitleTextProperty(NULL);
+}
+
+//----------------------------------------------------------------------------
+void VISU_XYPlotActor::InitializeEntries()
+{
+  if ( this->NumberOfInputs > 0 )
+    {
+    for (int i=0; i<this->NumberOfInputs; i++)
+      {
+      this->PlotData[i]->Delete();
+      this->PlotGlyph[i]->Delete();
+      this->PlotAppend[i]->Delete();
+      this->PlotTransform[i]->Delete(); // RKV
+      this->PlotMapper[i]->Delete();
+      this->PlotActor[i]->Delete();
+      }//for all entries
+    delete [] this->PlotData; this->PlotData = NULL;
+    delete [] this->PlotGlyph; this->PlotGlyph = NULL;
+    delete [] this->PlotAppend; this->PlotAppend = NULL;
+    delete [] this->PlotTransform; this->PlotTransform = NULL; // RKV
+    delete [] this->PlotMapper; this->PlotMapper = NULL;
+    delete [] this->PlotActor; this->PlotActor = NULL;
+    this->NumberOfInputs = 0;
+    }//if entries have been defined
+}
+  
+//----------------------------------------------------------------------------
+// Add a dataset and array to the list of data to plot.
+void VISU_XYPlotActor::AddInput(vtkDataSet *ds, const char *arrayName, int component)
+{
+  int idx, num;
+  char** newNames;
+
+  // I cannot change the input list, because the user has direct 
+  // access to the collection.  I cannot store the index of the array, 
+  // because the index might change from render to render ...
+  // I have to store the list of string array names.
+
+  // I believe idx starts at 1 and goes to "NumberOfItems".
+  idx = this->InputList->IsItemPresent(ds);
+  if (idx > 0)
+    { // Return if arrays are the same.
+    if (arrayName == NULL && this->SelectedInputScalars[idx-1] == NULL &&
+        component == this->SelectedInputScalarsComponent->GetValue(idx-1))
+      {
+      return;
+      }
+    if (arrayName != NULL && this->SelectedInputScalars[idx-1] != NULL &&
+        strcmp(arrayName, this->SelectedInputScalars[idx-1]) == 0 &&
+        component == this->SelectedInputScalarsComponent->GetValue(idx-1))
+      {
+      return;
+      }
+    }
+
+  // The input/array/component must be a unique combination.  Add it to our input list.
+
+  // Now reallocate the list of strings and add the new value.
+  num = this->InputList->GetNumberOfItems();
+  newNames = new char*[num+1];
+  for (idx = 0; idx < num; ++idx)
+    {
+    newNames[idx] = this->SelectedInputScalars[idx];
+    }
+  if (arrayName == NULL)
+    {
+    newNames[num] = NULL;
+    }
+  else
+    {
+    newNames[num] = new char[strlen(arrayName)+1];
+    strcpy(newNames[num],arrayName);
+    }
+  delete [] this->SelectedInputScalars;
+  this->SelectedInputScalars = newNames;
+
+  // Save the component in the int array.
+  this->SelectedInputScalarsComponent->InsertValue(num, component);
+
+  // Add the data set to the collection
+  this->InputList->AddItem(ds);
+
+  // In case of multiple use of a XYPlotActor the NumberOfEntries could be set
+  // to n. Then when a call to SetEntryString(n+1, bla) was done the string was lost
+  // Need to update the number of entries for the legend actor
+  this->LegendActor->SetNumberOfEntries(this->LegendActor->GetNumberOfEntries()+1);
+
+  this->Modified();
+}
+
+//----------------------------------------------------------------------------
+void VISU_XYPlotActor::RemoveAllInputs()
+{
+  int idx, num;
+
+  num = this->InputList->GetNumberOfItems();
+  this->InputList->RemoveAllItems();
+
+  for (idx = 0; idx < num; ++idx)
+    {
+    if (this->SelectedInputScalars[idx])
+      {
+      delete [] this->SelectedInputScalars[idx];
+      this->SelectedInputScalars[idx] = NULL;
+      }
+    }
+  this->SelectedInputScalarsComponent->Reset();
+
+  this->DataObjectInputList->RemoveAllItems();
+}
+
+//----------------------------------------------------------------------------
+// Remove a dataset from the list of data to plot.
+void VISU_XYPlotActor::RemoveInput(vtkDataSet *ds, const char *arrayName, int component)
+{
+  int idx, num;
+  vtkDataSet *input;
+  int found = -1;
+
+  // This is my own find routine, because the array names have to match also.
+  num = this->InputList->GetNumberOfItems();
+  vtkCollectionSimpleIterator dsit;
+  this->InputList->InitTraversal(dsit);
+  for (idx = 0; idx < num && found == -1; ++idx)
+    {
+    input = this->InputList->GetNextDataSet(dsit);
+    if (input == ds)
+      {
+      if (arrayName == NULL && this->SelectedInputScalars[idx] == NULL &&
+          component == this->SelectedInputScalarsComponent->GetValue(idx))
+        {
+        found = idx;
+        }
+      if (arrayName != NULL && this->SelectedInputScalars[idx] != NULL &&
+          strcmp(arrayName, this->SelectedInputScalars[idx]) == 0 &&
+          component == this->SelectedInputScalarsComponent->GetValue(idx))
+        {
+        found = idx;
+        }
+      }
+    }
+
+  if (found == -1)
+    {
+    return;
+    }
+  
+  this->Modified();
+  // Collections index their items starting at 1.
+  this->InputList->RemoveItem(found);
+
+  // Do not bother reallocating the SelectedInputScalars 
+  // string array to make it smaller.
+  if (this->SelectedInputScalars[found])
+    {
+    delete [] this->SelectedInputScalars[found];
+    this->SelectedInputScalars[found] = NULL;
+    }
+  for (idx = found+1; idx < num; ++idx)
+    {
+    this->SelectedInputScalars[idx-1] = this->SelectedInputScalars[idx];
+    this->SelectedInputScalarsComponent->SetValue(idx-1, 
+                          this->SelectedInputScalarsComponent->GetValue(idx));
+    }
+  // Reseting the last item is not really necessary, 
+  // but to be clean we do it anyway.
+  this->SelectedInputScalarsComponent->SetValue(num-1, -1); 
+  this->SelectedInputScalars[num-1] = NULL;
+}
+
+//----------------------------------------------------------------------------
+// Add a data object to the list of data to plot.
+void VISU_XYPlotActor::AddDataObjectInput(vtkDataObject *in)
+{
+  if ( ! this->DataObjectInputList->IsItemPresent(in) )
+    {
+    this->Modified();
+    this->DataObjectInputList->AddItem(in);
+    }
+}
+
+//----------------------------------------------------------------------------
+// Remove a data object from the list of data to plot.
+void VISU_XYPlotActor::RemoveDataObjectInput(vtkDataObject *in)
+{
+  if ( this->DataObjectInputList->IsItemPresent(in) )
+    {
+    this->Modified();
+    this->DataObjectInputList->RemoveItem(in);
+    }
+}
+
+//----------------------------------------------------------------------------
+// Plot scalar data for each input dataset.
+int VISU_XYPlotActor::RenderOverlay(vtkViewport *viewport)
+{
+  int renderedSomething = 0;
+
+  // Make sure input is up to date.
+  if ( this->InputList->GetNumberOfItems() < 1 && 
+       this->DataObjectInputList->GetNumberOfItems() < 1 )
+    {
+    vtkErrorMacro(<< "Nothing to plot!");
+    return 0;
+    }
+
+  renderedSomething += this->XAxis->RenderOverlay(viewport);
+  renderedSomething += this->YAxis->RenderOverlay(viewport);
+  if ( this->Title )
+    {
+    renderedSomething += this->TitleActor->RenderOverlay(viewport);
+    }
+  for (int i=0; i < this->NumberOfInputs; i++)
+    {
+    renderedSomething += this->PlotActor[i]->RenderOverlay(viewport);
+    }
+  if ( this->Legend )
+    {
+    renderedSomething += this->LegendActor->RenderOverlay(viewport);
+    }
+
+  return renderedSomething;
+}
+
+//----------------------------------------------------------------------------
+// Plot scalar data for each input dataset.
+int VISU_XYPlotActor::RenderOpaqueGeometry(vtkViewport *viewport)
+{
+  unsigned long mtime, dsMtime;
+  vtkDataSet *ds;
+  vtkDataObject *dobj;
+  int numDS, numDO, renderedSomething=0;
+
+  // Initialize
+  // Make sure input is up to date.
+  numDS = this->InputList->GetNumberOfItems();
+  numDO = this->DataObjectInputList->GetNumberOfItems();
+  if ( numDS > 0 )
+    {
+    vtkDebugMacro(<<"Plotting input data sets");
+    vtkCollectionSimpleIterator dsit;
+    for (mtime=0, this->InputList->InitTraversal(dsit); 
+         (ds = this->InputList->GetNextDataSet(dsit)); )
+      {
+      ds->Update();
+      dsMtime = ds->GetMTime();
+      if ( dsMtime > mtime )
+        {
+        mtime = dsMtime;
+        }
+      }
+    }
+  else if ( numDO > 0 )
+    {
+    vtkDebugMacro(<<"Plotting input data objects");
+    vtkCollectionSimpleIterator doit;
+    for (mtime=0, this->DataObjectInputList->InitTraversal(doit); 
+         (dobj = this->DataObjectInputList->GetNextDataObject(doit)); )
+      {
+      dobj->Update();
+      dsMtime = dobj->GetMTime();
+      if ( dsMtime > mtime )
+        {
+        mtime = dsMtime;
+        }
+      }
+    }
+  else
+    {
+    vtkErrorMacro(<< "Nothing to plot!");
+    return 0;
+    }
+
+  if (this->Title && this->Title[0] && !this->TitleTextProperty)
+    {
+    vtkErrorMacro(<< "Need a title text property to render plot title");
+    return 0;
+    }
+
+  // Check modified time to see whether we have to rebuild.
+  // Pay attention that GetMTime() has been redefined (see below)
+
+  int *size=viewport->GetSize();
+  if (mtime > this->BuildTime || 
+      size[0] != this->CachedSize[0] || size[1] != this->CachedSize[1] ||
+      this->GetMTime() > this->BuildTime ||
+      (this->Title && this->Title[0] && 
+       this->TitleTextProperty->GetMTime() > this->BuildTime) ||
+      (this->AxisLabelTextProperty &&
+       this->AxisLabelTextProperty->GetMTime() > this->BuildTime) ||
+      (this->AxisTitleTextProperty &&
+       this->AxisTitleTextProperty->GetMTime() > this->BuildTime))
+    {
+    double range[2], yrange[2], xRange[2], yRange[2], interval, *lengths=NULL;
+    int pos[2], pos2[2], numTicks;
+    int stringSize[2];
+    int num = ( numDS > 0 ? numDS : numDO );
+
+    vtkDebugMacro(<<"Rebuilding plot");
+    this->CachedSize[0] = size[0];
+    this->CachedSize[1] = size[1];
+
+    // RKV : Begin
+    if ((this->PlotLocation == VISU_XYPLOT_RIGHT) || (this->PlotLocation == VISU_XYPLOT_LEFT))
+      this->ReverseYAxis = 1;
+    else
+      this->ReverseYAxis = 0;
+    // RKV : End
+
+    // manage legend
+    vtkDebugMacro(<<"Rebuilding legend");
+    if ( this->Legend )
+      {
+      int legPos[2], legPos2[2];
+      int *p1 = this->PositionCoordinate->GetComputedViewportValue(viewport);
+      int *p2 = this->Position2Coordinate->GetComputedViewportValue(viewport);
+      legPos[0] = (int)(p1[0] + this->LegendPosition[0]*(p2[0]-p1[0]));
+      legPos2[0] = (int)(legPos[0] + this->LegendPosition2[0]*(p2[0]-p1[0]));
+      legPos[1] = (int)(p1[1] + this->LegendPosition[1]*(p2[1]-p1[1]));
+      legPos2[1] = (int)(legPos[1] + this->LegendPosition2[1]*(p2[1]-p1[1]));
+      
+      this->LegendActor->GetPositionCoordinate()->SetValue(
+        (double)legPos[0], (double)legPos[1]);
+      this->LegendActor->GetPosition2Coordinate()->SetValue(
+        (double)legPos2[0], (double)legPos2[1]);
+      this->LegendActor->SetNumberOfEntries(num);
+      for (int i=0; i<num; i++)
+        {
+        if ( ! this->LegendActor->GetEntrySymbol(i) )
+          {
+          this->LegendActor->SetEntrySymbol(i,this->GlyphSource->GetOutput());
+          }
+        if ( ! this->LegendActor->GetEntryString(i) )
+          {
+          static char legendString[12];
+          sprintf(legendString, "%s%d", "Curve ", i);
+          this->LegendActor->SetEntryString(i,legendString);
+          }
+        }
+
+      this->LegendActor->SetPadding(2);
+      this->LegendActor->GetProperty()->DeepCopy(this->GetProperty());
+      this->LegendActor->ScalarVisibilityOff();
+      }
+
+    // Rebuid text props
+    // Perform shallow copy here since each individual axis can be
+    // accessed through the class API (i.e. each individual axis text prop
+    // can be changed). Therefore, we can not just assign pointers otherwise
+    // each individual axis text prop would point to the same text prop.
+
+    if (this->AxisLabelTextProperty &&
+        this->AxisLabelTextProperty->GetMTime() > this->BuildTime)
+      {
+      if (this->XAxis->GetTitleTextProperty())
+        {
+        this->XAxis->GetLabelTextProperty()->ShallowCopy(
+          this->AxisLabelTextProperty);
+        }
+      if (this->YAxis->GetTitleTextProperty())
+        {
+        this->YAxis->GetLabelTextProperty()->ShallowCopy(
+          this->AxisLabelTextProperty);
+        }
+      }
+    
+    if (this->AxisTitleTextProperty &&
+        this->AxisTitleTextProperty->GetMTime() > this->BuildTime)
+      {
+      if (this->XAxis->GetTitleTextProperty())
+        {
+        this->XAxis->GetTitleTextProperty()->ShallowCopy(
+          this->AxisTitleTextProperty);
+        }
+      if (this->YAxis->GetTitleTextProperty())
+        {
+        this->YAxis->GetTitleTextProperty()->ShallowCopy(
+          this->AxisTitleTextProperty);
+        }
+      }
+    
+    // setup x-axis
+    vtkDebugMacro(<<"Rebuilding x-axis");
+    
+    this->XAxis->SetTitle(this->XTitle);
+    this->XAxis->SetNumberOfLabels(this->NumberOfXLabels);
+    this->XAxis->SetProperty(this->GetProperty());
+
+    vtkDebugMacro(<<"xrange = (" << range[0] << ", " << range[1] << ")"); // RKV
+    lengths = new double[num];
+    if ( numDS > 0 ) //plotting data sets
+      {
+      this->ComputeXRange(range, lengths);
+      }
+    else
+      {
+      this->ComputeDORange(range, yrange, lengths);
+      }
+    if ( this->XRange[0] < this->XRange[1] )
+      {
+      range[0] = this->XRange[0];
+      range[1] = this->XRange[1];
+      }
+
+/* RKV    vtkAxisActor2D::ComputeRange(range, xRange, this->NumberOfXLabels,
+                                 numTicks, interval);
+*/    // RKV : Begin
+    vtkDebugMacro(<<"XRange = (" << XRange[0] << ", " << XRange[1] << ")");
+    vtkDebugMacro(<<"xrange = (" << range[0] << ", " << range[1] << ")");
+    xRange[0] = range[0];
+    xRange[1] = range[1];
+    // RKV : End
+    if ( !this->ExchangeAxes )
+      {
+      this->XComputedRange[0] = xRange[0];
+      this->XComputedRange[1] = xRange[1];
+      if ( this->ReverseXAxis )
+        {
+        this->XAxis->SetRange(range[1],range[0]);
+        }
+      else
+        {
+        this->XAxis->SetRange(range[0],range[1]);
+        }
+      }
+    else
+      {
+      this->XComputedRange[1] = xRange[0];
+      this->XComputedRange[0] = xRange[1];
+      if ( this->ReverseYAxis )
+        {
+        this->XAxis->SetRange(range[0],range[1]);
+        }
+      else
+        {
+        this->XAxis->SetRange(range[1],range[0]);
+        }
+      }
+    
+    // setup y-axis
+    vtkDebugMacro(<<"Rebuilding y-axis");
+    this->YAxis->SetTitle(this->YTitle);
+    this->YAxis->SetNumberOfLabels(this->NumberOfYLabels);
+
+    vtkDebugMacro(<<"yrange = (" << yrange[0] << ", " << yrange[1] << ")"); // RKV
+    if ( this->YRange[0] >= this->YRange[1] )
+      {
+      if ( numDS > 0 ) //plotting data sets
+        {
+        this->ComputeYRange(yrange);
+        }
+      }
+    else
+      {
+      yrange[0] = this->YRange[0];
+      yrange[1] = this->YRange[1];
+      }
+/* RKV   vtkAxisActor2D::ComputeRange(yrange, yRange, this->NumberOfYLabels,
+                                 numTicks, interval);
+*/
+    // RKV : Begin
+    vtkDebugMacro(<<"YRange = (" << YRange[0] << ", " << YRange[1] << ")");
+    vtkDebugMacro(<<"yrange = (" << yrange[0] << ", " << yrange[1] << ")");
+    yRange[0] = yrange[0];
+    yRange[1] = yrange[1];
+    // RKV : End
+    
+    if ( !this->ExchangeAxes )
+      {
+      this->YComputedRange[0] = yRange[0];
+      this->YComputedRange[1] = yRange[1];
+      if ( this->ReverseYAxis )
+        {
+        this->YAxis->SetRange(yrange[0],yrange[1]);
+        }
+      else
+        {
+        this->YAxis->SetRange(yrange[1],yrange[0]);
+        }
+      }
+    else
+      {
+      this->YComputedRange[1] = yRange[0];
+      this->YComputedRange[0] = yRange[1];
+      if ( this->ReverseXAxis )
+        {
+        this->YAxis->SetRange(yrange[1],yrange[0]);
+        }
+      else
+        {
+        this->YAxis->SetRange(yrange[0],yrange[1]);
+        }
+      }
+      
+
+    this->PlaceAxes(viewport, size, pos, pos2);
+    
+    // manage title
+    if (this->Title != NULL && this->Title[0])
+      {
+      this->TitleMapper->SetInput(this->Title);
+      if (this->TitleTextProperty->GetMTime() > this->BuildTime)
+        {
+        this->TitleMapper->GetTextProperty()->ShallowCopy(
+          this->TitleTextProperty);
+        }
+
+      vtkAxisActor2D::SetFontSize(viewport, 
+                                  this->TitleMapper, 
+                                  size, 
+                                  1.0,
+                                  stringSize);
+
+      this->TitleActor->GetPositionCoordinate()->SetValue(
+        pos[0] + 0.5 * (pos2[0] - pos[0]) - stringSize[0] / 2.0, 
+        pos2[1] - stringSize[1] / 2.0);
+
+      this->TitleActor->SetProperty(this->GetProperty());
+      }
+
+    vtkDebugMacro(<<"Creating Plot Data");
+    // Okay, now create the plot data and set up the pipeline
+    this->CreatePlotData(pos, pos2, xRange, yRange, lengths, numDS, numDO);
+    delete [] lengths;
+    
+    this->BuildTime.Modified();
+
+    }//if need to rebuild the plot
+
+  vtkDebugMacro(<<"Rendering Axes");
+  renderedSomething += this->XAxis->RenderOpaqueGeometry(viewport);
+  renderedSomething += this->YAxis->RenderOpaqueGeometry(viewport);
+  for (int i=0; i < this->NumberOfInputs; i++)
+    {
+    vtkDebugMacro(<<"Rendering plotactors");
+    renderedSomething += this->PlotActor[i]->RenderOpaqueGeometry(viewport);
+    }
+  if ( this->Title )
+    {
+    vtkDebugMacro(<<"Rendering titleactors");
+    renderedSomething += this->TitleActor->RenderOpaqueGeometry(viewport);
+    }
+  if ( this->Legend )
+    {
+    vtkDebugMacro(<<"Rendering legendeactors");
+    renderedSomething += this->LegendActor->RenderOpaqueGeometry(viewport);
+    }
+
+  return renderedSomething;
+}
+
+//----------------------------------------------------------------------------
+const char *VISU_XYPlotActor::GetXValuesAsString()
+{
+  switch (this->XValues)
+    {
+    case VTK_XYPLOT_INDEX:
+      return "Index";
+    case VTK_XYPLOT_ARC_LENGTH:
+      return "ArcLength";
+    case VTK_XYPLOT_NORMALIZED_ARC_LENGTH:
+      return "NormalizedArcLength";
+    default:
+      return "Value";
+    }
+}
+
+//----------------------------------------------------------------------------
+const char *VISU_XYPlotActor::GetDataObjectPlotModeAsString()
+{
+  if ( this->DataObjectPlotMode == VTK_XYPLOT_ROW )
+    {
+    return "Plot Rows";
+    }
+  else 
+    {
+    return "Plot Columns";
+    }
+}
+
+//----------------------------------------------------------------------------
+// Release any graphics resources that are being consumed by this actor.
+// The parameter window could be used to determine which graphic
+// resources to release.
+void VISU_XYPlotActor::ReleaseGraphicsResources(vtkWindow *win)
+{
+  this->TitleActor->ReleaseGraphicsResources(win);
+  this->XAxis->ReleaseGraphicsResources(win);
+  this->YAxis->ReleaseGraphicsResources(win);
+  for (int i=0; i < this->NumberOfInputs; i++)
+    {
+    this->PlotActor[i]->ReleaseGraphicsResources(win);
+    }
+  this->LegendActor->ReleaseGraphicsResources(win);
+}
+
+//----------------------------------------------------------------------------
+unsigned long VISU_XYPlotActor::GetMTime()
+{
+  unsigned long mtime, mtime2;
+  mtime = this->vtkActor2D::GetMTime();
+
+  if (this->Legend)
+    {
+    mtime2 = this->LegendActor->GetMTime();
+    if (mtime2 > mtime)
+      {
+      mtime = mtime2;
+      }
+    }
+
+  return mtime;
+}
+
+//----------------------------------------------------------------------------
+void VISU_XYPlotActor::PrintSelf(ostream& os, vtkIndent indent)
+{
+  vtkIndent i2 = indent.GetNextIndent();
+  vtkDataSet *input;
+  char *array;
+  int component;
+  int idx, num;
+
+  this->Superclass::PrintSelf(os,indent);
+
+  vtkCollectionSimpleIterator dsit;
+  this->InputList->InitTraversal(dsit);
+  num = this->InputList->GetNumberOfItems();
+  os << indent << "DataSetInputs: " << endl;
+  for (idx = 0; idx < num; ++idx)
+    {
+    input = this->InputList->GetNextDataSet(dsit);
+    array = this->SelectedInputScalars[idx];
+    component = this->SelectedInputScalarsComponent->GetValue((vtkIdType)idx);
+    if (array == NULL)
+      {
+      os << i2 << "(" << input << ") Default Scalars,  Component = " << component << endl;
+      }
+    else
+      {
+      os << i2 << "(" << input << ") " << array << ",  Component = " << component << endl;
+      }
+    }
+
+  os << indent << "Input DataObjects:\n";
+  this->DataObjectInputList->PrintSelf(os,indent.GetNextIndent());
+  
+  if (this->TitleTextProperty)
+    {
+    os << indent << "Title Text Property:\n";
+    this->TitleTextProperty->PrintSelf(os,indent.GetNextIndent());
+    }
+  else
+    {
+    os << indent << "Title Text Property: (none)\n";
+    }
+
+  if (this->AxisTitleTextProperty)
+    {
+    os << indent << "Axis Title Text Property:\n";
+    this->AxisTitleTextProperty->PrintSelf(os,indent.GetNextIndent());
+    }
+  else
+    {
+    os << indent << "Axis Title Text Property: (none)\n";
+    }
+
+  if (this->AxisLabelTextProperty)
+    {
+    os << indent << "Axis Label Text Property:\n";
+    this->AxisLabelTextProperty->PrintSelf(os,indent.GetNextIndent());
+    }
+  else
+    {
+    os << indent << "Axis Label Text Property: (none)\n";
+    }
+
+  os << indent << "Data Object Plot Mode: " << this->GetDataObjectPlotModeAsString() << endl;
+
+  os << indent << "Title: " << (this->Title ? this->Title : "(none)") << "\n";
+  os << indent << "X Title: " 
+     << (this->XTitle ? this->XTitle : "(none)") << "\n";
+  os << indent << "Y Title: " 
+     << (this->YTitle ? this->YTitle : "(none)") << "\n";
+  os << indent << "X Values: " << this->GetXValuesAsString() << endl;
+  os << indent << "Log X Values: " << (this->Logx ? "On\n" : "Off\n");
+
+  os << indent << "Plot global-points: " << (this->PlotPoints ? "On\n" : "Off\n");
+  os << indent << "Plot global-lines: " << (this->PlotLines ? "On\n" : "Off\n");
+  os << indent << "Plot per-curve points: " << (this->PlotCurvePoints ? "On\n" : "Off\n");
+  os << indent << "Plot per-curve lines: " << (this->PlotCurveLines ? "On\n" : "Off\n");
+  os << indent << "Exchange Axes: " << (this->ExchangeAxes ? "On\n" : "Off\n");
+  os << indent << "Reverse X Axis: " << (this->ReverseXAxis ? "On\n" : "Off\n");
+  os << indent << "Reverse Y Axis: " << (this->ReverseYAxis ? "On\n" : "Off\n");
+
+  os << indent << "Number Of X Labels: " << this->NumberOfXLabels << "\n";
+  os << indent << "Number Of Y Labels: " << this->NumberOfYLabels << "\n";
+
+  os << indent << "Label Format: " << this->LabelFormat << "\n";
+  os << indent << "Border: " << this->Border << "\n";
+  
+  os << indent << "X Range: ";
+  if ( this->XRange[0] >= this->XRange[1] )
+    {
+    os << indent << "(Automatically Computed)\n";
+    }
+  else
+    {
+    os << "(" << this->XRange[0] << ", " << this->XRange[1] << ")\n";
+    }
+
+  os << indent << "Y Range: ";
+  if ( this->XRange[0] >= this->YRange[1] )
+    {
+    os << indent << "(Automatically Computed)\n";
+    }
+  else
+    {
+    os << "(" << this->YRange[0] << ", " << this->YRange[1] << ")\n";
+    }
+
+  os << indent << "Viewport Coordinate: ("
+     << this->ViewportCoordinate[0] << ", " 
+     << this->ViewportCoordinate[1] << ")\n";
+
+  os << indent << "Plot Coordinate: ("
+     << this->PlotCoordinate[0] << ", " 
+     << this->PlotCoordinate[1] << ")\n";
+
+  os << indent << "Legend: " << (this->Legend ? "On\n" : "Off\n");
+  os << indent << "Legend Position: ("
+     << this->LegendPosition[0] << ", " 
+     << this->LegendPosition[1] << ")\n";
+  os << indent << "Legend Position2: ("
+     << this->LegendPosition2[0] << ", " 
+     << this->LegendPosition2[1] << ")\n";
+
+  os << indent << "Glyph Size: " << this->GlyphSize << endl;
+
+  os << indent << "Legend Actor:";
+  this->LegendActor->PrintSelf( os << endl, i2);
+  os << indent << "Glyph Source:";
+  this->GlyphSource->PrintSelf( os << endl, i2);
+}
+
+//----------------------------------------------------------------------------
+void VISU_XYPlotActor::ComputeXRange(double range[2], double *lengths)
+{
+  int dsNum;
+  vtkIdType numPts, ptId, maxNum;
+  double maxLength=0.0, xPrev[3], x[3];
+  vtkDataSet *ds;
+
+  range[0] = VTK_DOUBLE_MAX, range[1] = VTK_DOUBLE_MIN;
+
+  vtkCollectionSimpleIterator dsit;
+  for ( dsNum=0, maxNum=0, this->InputList->InitTraversal(dsit); 
+        (ds = this->InputList->GetNextDataSet(dsit)); dsNum++)
+    {
+    numPts = ds->GetNumberOfPoints();
+
+    if ( this->XValues != VTK_XYPLOT_INDEX )
+      {
+      ds->GetPoint(0, xPrev);
+      for ( lengths[dsNum]=0.0, ptId=0; ptId < numPts; ptId++ )
+        {
+        ds->GetPoint(ptId, x);
+        switch (this->XValues)
+          {
+          case VTK_XYPLOT_VALUE:
+            if (this->GetLogx() == 0)
+              {
+              if ( x[this->XComponent->GetValue(dsNum)] < range[0] )
+                {
+                range[0] = x[this->XComponent->GetValue(dsNum)];
+                }
+              if ( x[this->XComponent->GetValue(dsNum)] > range[1] )
+                {
+                range[1] = x[this->XComponent->GetValue(dsNum)];
+                }
+              }
+            else
+              {
+              //ensure range strictly > 0 for log
+              if ( (x[this->XComponent->GetValue(dsNum)]) < range[0] && 
+                   (x[this->XComponent->GetValue(dsNum)] > 0))
+                {
+                range[0] = x[this->XComponent->GetValue(dsNum)];
+                }
+              if ( (x[this->XComponent->GetValue(dsNum)] > range[1]) && 
+                   (x[this->XComponent->GetValue(dsNum)] > 0))
+                {
+                range[1] = x[this->XComponent->GetValue(dsNum)];
+                }
+              }
+            break;
+          default:
+            lengths[dsNum] += sqrt(vtkMath::Distance2BetweenPoints(x,xPrev));
+            xPrev[0] = x[0]; xPrev[1] = x[1]; xPrev[2] = x[2];
+          }
+        }//for all points
+      if ( lengths[dsNum] > maxLength )
+        {
+        maxLength = lengths[dsNum];
+        }
+      }//if need to visit all points
+    
+    else //if ( this->XValues == VTK_XYPLOT_INDEX )
+      {
+      if ( numPts > maxNum )
+        {
+        maxNum = numPts;
+        }
+      }
+    }//over all datasets
+
+  // determine the range
+  switch (this->XValues)
+    {
+    case VTK_XYPLOT_ARC_LENGTH:
+      range[0] = 0.0;
+      range[1] = maxLength;
+      break;
+    case VTK_XYPLOT_NORMALIZED_ARC_LENGTH:
+      range[0] = 0.0;
+      range[1] = 1.0;
+      break;
+    case VTK_XYPLOT_INDEX:
+      range[0] = 0.0;
+      range[1] = (double)(maxNum - 1);
+      break;
+    case VTK_XYPLOT_VALUE:
+      if (this->GetLogx() == 1)
+        {
+        if (range[0] > range[1]) 
+          {
+          range[0] = 0;
+          range[1] = 0;
+          }
+        else
+          {
+          range[0] = log10(range[0]);
+          range[1] = log10(range[1]);
+          }
+        }
+      break; //range computed in for loop above
+    default:
+      vtkErrorMacro(<< "Unkown X-Value option.");
+      return;
+    }
+}
+
+//----------------------------------------------------------------------------
+void VISU_XYPlotActor::ComputeYRange(double range[2])
+{
+  vtkDataSet *ds;
+  vtkDataArray *scalars;
+  double sRange[2];
+  int count;
+  int component;
+
+  range[0]=VTK_DOUBLE_MAX, range[1]=VTK_DOUBLE_MIN;
+
+  vtkCollectionSimpleIterator dsit;
+  for ( this->InputList->InitTraversal(dsit), count = 0; 
+        (ds = this->InputList->GetNextDataSet(dsit)); ++count)
+    {
+    scalars = ds->GetPointData()->GetScalars(this->SelectedInputScalars[count]);
+    component = this->SelectedInputScalarsComponent->GetValue(count);
+    if ( !scalars)
+      {
+      vtkErrorMacro(<<"No scalar data to plot!");
+      continue;
+      }
+    if ( component < 0 || component >= scalars->GetNumberOfComponents())
+      {
+      vtkErrorMacro(<<"Bad component!");
+      continue;
+      }
+    
+    scalars->GetRange(sRange, component);
+    if ( sRange[0] < range[0] )
+      {
+      range[0] = sRange[0];
+      }
+
+    if ( sRange[1] > range[1] )
+      {
+      range[1] = sRange[1];
+      }
+    }//over all datasets
+}
+
+//----------------------------------------------------------------------------
+void VISU_XYPlotActor::ComputeDORange(double xrange[2], double yrange[2], 
+                                    double *lengths)
+{
+  int i;
+  vtkDataObject *dobj;
+  vtkFieldData *field;
+  int doNum, numColumns;
+  vtkIdType numTuples, numRows, num, ptId, maxNum;
+  double maxLength=0.0, x, y, xPrev = 0.0;
+  vtkDataArray *array;
+
+  xrange[0] = yrange[0] = VTK_DOUBLE_MAX;
+  xrange[1] = yrange[1] = -VTK_DOUBLE_MAX;
+  vtkCollectionSimpleIterator doit;
+  for ( doNum=0, maxNum=0, this->DataObjectInputList->InitTraversal(doit); 
+        (dobj = this->DataObjectInputList->GetNextDataObject(doit)); doNum++)
+    {
+    lengths[doNum] = 0.0;
+    field = dobj->GetFieldData();
+    numColumns = field->GetNumberOfComponents(); //number of "columns"
+    for (numRows = VTK_LARGE_ID, i=0; i<field->GetNumberOfArrays(); i++)
+      {
+      array = field->GetArray(i);
+      numTuples = array->GetNumberOfTuples();
+      if ( numTuples < numRows )
+        {
+        numRows = numTuples;
+        }
+      }
+
+    num = (this->DataObjectPlotMode == VTK_XYPLOT_ROW ? 
+           numColumns : numRows);
+
+    if ( this->XValues != VTK_XYPLOT_INDEX )
+      {
+      // gather the information to form a plot
+      for ( ptId=0; ptId < num; ptId++ )
+        {
+        if ( this->DataObjectPlotMode == VTK_XYPLOT_ROW )
+          {
+          x = field->GetComponent(this->XComponent->GetValue(doNum), ptId);
+          }
+        else //if ( this->DataObjectPlotMode == VTK_XYPLOT_COLUMN )
+          {
+          x = field->GetComponent(ptId, this->XComponent->GetValue(doNum));
+          }
+        if ( ptId == 0 )
+          {
+          xPrev = x;
+          }
+              
+        switch (this->XValues)
+          {
+          case VTK_XYPLOT_VALUE:
+            if (this->GetLogx() == 0)
+              {
+              if ( x < xrange[0] )
+                {
+                xrange[0] = x;
+                }
+              if ( x > xrange[1] )
+                {
+                xrange[1] = x;
+                }
+              }
+            else //ensure positive values
+              {
+              if ( (x < xrange[0]) && (x > 0) )
+                {
+                xrange[0] = x;
+                }
+              if ( x > xrange[1]  && (x > 0) )
+                {
+                xrange[1] = x;
+                }
+              }
+            break;
+          default:
+            lengths[doNum] += fabs(x-xPrev);
+            xPrev = x;
+          }
+        }//for all points
+      if ( lengths[doNum] > maxLength )
+        {
+        maxLength = lengths[doNum];
+        }
+      }//if all data has to be visited
+    
+    else //if (this->XValues == VTK_XYPLOT_INDEX)
+      {
+      if ( num > maxNum )
+        {
+        maxNum = num;
+        }
+      }
+
+    // Get the y-values
+    for ( ptId=0; ptId < num; ptId++ )
+      {
+      if ( this->DataObjectPlotMode == VTK_XYPLOT_ROW )
+        {
+        y = field->GetComponent(this->YComponent->GetValue(doNum), ptId);
+        }
+      else //if ( this->DataObjectPlotMode == VTK_XYPLOT_COLUMN )
+        {
+        y = field->GetComponent(ptId, this->YComponent->GetValue(doNum));
+        }
+      if ( y < yrange[0] )
+        {
+        yrange[0] = y;
+        }
+      if ( y > yrange[1] )
+        {
+        yrange[1] = y;
+        }
+      }//over all y values
+    }//over all dataobjects
+
+  // determine the range
+  switch (this->XValues)
+    {
+    case VTK_XYPLOT_ARC_LENGTH:
+      xrange[0] = 0.0;
+      xrange[1] = maxLength;
+      break;
+    case VTK_XYPLOT_NORMALIZED_ARC_LENGTH:
+      xrange[0] = 0.0;
+      xrange[1] = 1.0;
+      break;
+    case VTK_XYPLOT_INDEX:
+      xrange[0] = 0.0;
+      xrange[1] = (double)(maxNum - 1);
+      break;
+    case VTK_XYPLOT_VALUE:
+      if (this->GetLogx() == 1)
+        {
+        xrange[0] = log10(xrange[0]);
+        xrange[1] = log10(xrange[1]);
+        }
+      break;
+    default:
+      vtkErrorMacro(<< "Unknown X-Value option");
+      return;
+    }
+}
+
+//----------------------------------------------------------------------------
+/* RKV void VISU_XYPlotActor::CreatePlotData(int *pos, int *pos2, double xRange[2], 
+                                    double yRange[2], double *lengths,
+                                    int numDS, int numDO) */
+// RKV : Begin
+void VISU_XYPlotActor::CreatePlotData(int *pos, int *pos2Extern, double xRange[2], 
+                                    double yRange[2], double *lengths,
+                                    int numDS, int numDO)
+// RKV : End
+{
+  double xyz[3]; xyz[2] = 0.0;
+  int i, numLinePts, dsNum, doNum, num;
+  vtkIdType numPts, ptId, id;
+  double length, x[3], xPrev[3];
+  vtkDataArray *scalars;
+  int component;
+  vtkDataSet *ds;
+  vtkCellArray *lines;
+  vtkPoints *pts;
+  int clippingRequired = 0;
+
+  // Allocate resources for the polygonal plots
+  //
+  num = (numDS > numDO ? numDS : numDO);
+  this->InitializeEntries();
+  this->NumberOfInputs = num;
+  this->PlotData = new vtkPolyData* [num];
+  this->PlotGlyph = new vtkGlyph2D* [num];
+  this->PlotAppend = new vtkAppendPolyData* [num];
+  this->PlotTransform = new vtkTransformPolyDataFilter* [num]; // RKV
+  this->PlotMapper = new vtkPolyDataMapper2D* [num];
+  this->PlotActor = new vtkActor2D* [num];
+  
+  // RKV : Begin
+  // Prepare the transformation of the curve according to the plot location
+  vtkTransform *tf = vtkTransform::New();
+  tf->Translate(pos[0], pos[1], 0);
+  if ((this->PlotLocation == VISU_XYPLOT_LEFT) || (this->PlotLocation == VISU_XYPLOT_RIGHT))
+    tf->RotateZ(90);
+  tf->Translate(-pos[0], -pos[1], 0);
+  
+  // Compute the position2 to build the curve before the transformation
+  int pos2[2];
+  vtkDebugMacro(<< "pos = (" << pos[0] << ", " << pos[1] << ")"); 
+  vtkDebugMacro(<< "pos2 = (" << pos2Extern[0] << ", " << pos2Extern[1] << ")"); 
+  if ((this->PlotLocation == VISU_XYPLOT_LEFT) || (this->PlotLocation == VISU_XYPLOT_RIGHT))
+    {
+    pos2[0] = pos[0] + pos2Extern[1] - pos[1];
+    pos2[1] = pos[1] + pos[0] - pos2Extern[0];
+    }
+  else
+    {
+    pos2[0] = pos2Extern[0];
+    pos2[1] = pos2Extern[1];
+    }
+  // RKV : End
+  
+  for (i=0; i<num; i++)
+    {
+    this->PlotData[i] = vtkPolyData::New();
+    this->PlotGlyph[i] = vtkGlyph2D::New();
+    this->PlotGlyph[i]->SetInput(this->PlotData[i]);
+    this->PlotGlyph[i]->SetScaleModeToDataScalingOff();
+    this->PlotAppend[i] = vtkAppendPolyData::New();
+    this->PlotAppend[i]->AddInput(this->PlotData[i]);
+    if ( this->LegendActor->GetEntrySymbol(i) != NULL &&
+         this->LegendActor->GetEntrySymbol(i) != this->GlyphSource->GetOutput() )
+      {
+      this->PlotGlyph[i]->SetSource(this->LegendActor->GetEntrySymbol(i));
+      this->PlotGlyph[i]->SetScaleFactor(this->ComputeGlyphScale(i,pos,pos2));
+      this->PlotAppend[i]->AddInput(this->PlotGlyph[i]->GetOutput());
+      }
+    this->PlotMapper[i] = vtkPolyDataMapper2D::New();
+    
+    // RKV : Begin
+    // Insert a transformation filter into the pipeline to 
+    // take into account a plot location.
+    this->PlotTransform[i] = vtkTransformPolyDataFilter::New();
+    this->PlotTransform[i]->SetInput(this->PlotAppend[i]->GetOutput());
+    this->PlotTransform[i]->SetTransform(tf); 
+    this->PlotMapper[i]->SetInput(this->PlotTransform[i]->GetOutput());
+    // RKV : End
+    
+// RKV    this->PlotMapper[i]->SetInput(this->PlotAppend[i]->GetOutput());
+    this->PlotMapper[i]->ScalarVisibilityOff();
+    this->PlotActor[i] = vtkActor2D::New();
+    this->PlotActor[i]->SetMapper(this->PlotMapper[i]);
+    this->PlotActor[i]->GetProperty()->DeepCopy(this->GetProperty());
+    if ( this->LegendActor->GetEntryColor(i)[0] < 0.0 )
+      {
+      this->PlotActor[i]->GetProperty()->SetColor(
+        this->GetProperty()->GetColor());
+      }
+    else
+      {
+      this->PlotActor[i]->GetProperty()->SetColor(
+        this->LegendActor->GetEntryColor(i));
+      }
+    }
+    
+  tf->Delete(); // RKV
+
+  // Prepare to receive data
+  this->GenerateClipPlanes(pos,pos2);
+  for (i=0; i<this->NumberOfInputs; i++)
+    {
+    lines = vtkCellArray::New();
+    pts = vtkPoints::New();
+
+    lines->Allocate(10,10);
+    pts->Allocate(10,10);
+    this->PlotData[i]->SetPoints(pts);
+    this->PlotData[i]->SetVerts(lines);
+    this->PlotData[i]->SetLines(lines);
+
+    pts->Delete();
+    lines->Delete();
+    }
+   
+  // Okay, for each input generate plot data. Depending on the input
+  // we use either dataset or data object.
+  //
+  if ( numDS > 0 )
+    {
+    vtkCollectionSimpleIterator dsit;
+    for ( dsNum=0, this->InputList->InitTraversal(dsit); 
+          (ds = this->InputList->GetNextDataSet(dsit)); dsNum++ )
+      {
+      clippingRequired = 0;
+      numPts = ds->GetNumberOfPoints();
+      scalars = ds->GetPointData()->GetScalars(this->SelectedInputScalars[dsNum]);
+      if ( !scalars)
+        {
+        continue;
+        }
+      component = this->SelectedInputScalarsComponent->GetValue(dsNum);
+      if ( component < 0 || component >= scalars->GetNumberOfComponents())
+        {
+        continue;
+        }
+
+      pts = this->PlotData[dsNum]->GetPoints();
+      lines = this->PlotData[dsNum]->GetLines();
+      lines->InsertNextCell(0); //update the count later
+
+      ds->GetPoint(0, xPrev);
+      for ( numLinePts=0, length=0.0, ptId=0; ptId < numPts; ptId++ )
+        {
+        xyz[1] = scalars->GetComponent(ptId, component);
+        ds->GetPoint(ptId, x);
+        switch (this->XValues)
+          {
+          case VTK_XYPLOT_NORMALIZED_ARC_LENGTH:
+            length += sqrt(vtkMath::Distance2BetweenPoints(x,xPrev));
+            xyz[0] = length / lengths[dsNum];
+            xPrev[0] = x[0]; xPrev[1] = x[1]; xPrev[2] = x[2];
+            break;
+          case VTK_XYPLOT_INDEX:
+            xyz[0] = (double)ptId;
+            break;
+          case VTK_XYPLOT_ARC_LENGTH:
+            length += sqrt(vtkMath::Distance2BetweenPoints(x,xPrev));
+            xyz[0] = length;
+            xPrev[0] = x[0]; xPrev[1] = x[1]; xPrev[2] = x[2];
+            break;
+          case VTK_XYPLOT_VALUE:
+            xyz[0] = x[this->XComponent->GetValue(dsNum)];
+            break;
+          default:
+            vtkErrorMacro(<< "Unknown X-Component option");
+          }
+        
+        if ( this->GetLogx() == 1 )
+          {
+          if (xyz[0] > 0)
+            {
+            xyz[0] = log10(xyz[0]);
+            // normalize and position
+            if ( xyz[0] < xRange[0] || xyz[0] > xRange[1] ||
+                 xyz[1] < yRange[0] || xyz[1] > yRange[1] )
+              {
+              clippingRequired = 1;
+              }
+
+            numLinePts++;
+            xyz[0] = fabs( xRange[1] - xRange[0] ) < 1.0 / VTK_LARGE_FLOAT ? pos[0] : pos[0] + 
+              (xyz[0]-xRange[0])/(xRange[1]-xRange[0])*(pos2[0]-pos[0]);
+            xyz[1] = fabs( yRange[1] - yRange[0] ) < 1.0 / VTK_LARGE_FLOAT ? pos[1] : pos[1] + 
+              (xyz[1]-yRange[0])/(yRange[1]-yRange[0])*(pos2[1]-pos[1]);
+            id = pts->InsertNextPoint(xyz);
+            lines->InsertCellPoint(id);
+            }
+          } 
+        else
+          {
+          // normalize and position
+          if ( xyz[0] < xRange[0] || xyz[0] > xRange[1] ||
+               xyz[1] < yRange[0] || xyz[1] > yRange[1] )
+            {
+            clippingRequired = 1;
+            }
+
+          numLinePts++;
+          xyz[0] = fabs( xRange[1] - xRange[0] ) < 1.0 / VTK_LARGE_FLOAT ? pos[0] : pos[0] + 
+            (xyz[0]-xRange[0])/(xRange[1]-xRange[0])*(pos2[0]-pos[0]);
+          xyz[1] = fabs( yRange[1] - yRange[0] ) < 1.0 / VTK_LARGE_FLOAT ? pos[1] : pos[1] + 
+            (xyz[1]-yRange[0])/(yRange[1]-yRange[0])*(pos2[1]-pos[1]);
+          id = pts->InsertNextPoint(xyz);
+          lines->InsertCellPoint(id);
+          }
+        }//for all input points
+
+      lines->UpdateCellCount(numLinePts);
+      if ( clippingRequired )
+        {
+        this->ClipPlotData(pos,pos2,this->PlotData[dsNum]);
+        }
+      }//loop over all input data sets
+    }//if plotting datasets
+
+  else //plot data from data objects
+    {
+    vtkDataObject *dobj;
+    int numColumns;
+    vtkIdType numRows, numTuples;
+    vtkDataArray *array;
+    vtkFieldData *field;
+    vtkCollectionSimpleIterator doit;
+    for ( doNum=0, this->DataObjectInputList->InitTraversal(doit); 
+          (dobj = this->DataObjectInputList->GetNextDataObject(doit)); 
+          doNum++ )
+      {
+      // determine the shape of the field
+      field = dobj->GetFieldData();
+      numColumns = field->GetNumberOfComponents(); //number of "columns"
+      for (numRows = VTK_LARGE_ID, i=0; i<field->GetNumberOfArrays(); i++)
+        {
+        array = field->GetArray(i);
+        numTuples = array->GetNumberOfTuples();
+        if ( numTuples < numRows )
+          {
+          numRows = numTuples;
+          }
+        }
+
+      pts = this->PlotData[doNum]->GetPoints();
+      lines = this->PlotData[doNum]->GetLines();
+      lines->InsertNextCell(0); //update the count later
+
+      numPts = (this->DataObjectPlotMode == VTK_XYPLOT_ROW ? 
+                numColumns : numRows);
+
+      // gather the information to form a plot
+      for ( numLinePts=0, length=0.0, ptId=0; ptId < numPts; ptId++ )
+        {
+        if ( this->DataObjectPlotMode == VTK_XYPLOT_ROW )
+          {
+          x[0] = field->GetComponent(this->XComponent->GetValue(doNum),ptId);
+          xyz[1] = field->GetComponent(this->YComponent->GetValue(doNum),ptId);
+          }
+        else //if ( this->DataObjectPlotMode == VTK_XYPLOT_COLUMN )
+          {
+          x[0] = field->GetComponent(ptId, this->XComponent->GetValue(doNum));
+          xyz[1] = field->GetComponent(ptId, this->YComponent->GetValue(doNum));
+          }
+
+        switch (this->XValues)
+          {
+          case VTK_XYPLOT_NORMALIZED_ARC_LENGTH:
+            length += fabs(x[0]-xPrev[0]);
+            xyz[0] = length / lengths[doNum];
+            xPrev[0] = x[0];
+            break;
+          case VTK_XYPLOT_INDEX:
+            xyz[0] = (double)ptId;
+            break;
+          case VTK_XYPLOT_ARC_LENGTH:
+            length += fabs(x[0]-xPrev[0]);
+            xyz[0] = length;
+            xPrev[0] = x[0];
+            break;
+          case VTK_XYPLOT_VALUE:
+            xyz[0] = x[0];
+            break;
+          default:
+            vtkErrorMacro(<< "Unknown X-Value option");
+          }
+
+        if ( this->GetLogx() == 1 )
+          {
+          if (xyz[0] > 0)
+            {
+            xyz[0] = log10(xyz[0]);
+            // normalize and position
+            if ( xyz[0] < xRange[0] || xyz[0] > xRange[1] ||
+                 xyz[1] < yRange[0] || xyz[1] > yRange[1] )
+              {
+              clippingRequired = 1;
+              }
+            numLinePts++;
+            xyz[0] = fabs( xRange[1] - xRange[0] ) < 1.0 / VTK_LARGE_FLOAT ? pos[0] : pos[0] + 
+              (xyz[0]-xRange[0])/(xRange[1]-xRange[0])*(pos2[0]-pos[0]);
+            xyz[1] = fabs( yRange[1] - yRange[0] ) < 1.0 / VTK_LARGE_FLOAT ? pos[1] : pos[1] + 
+              (xyz[1]-yRange[0])/(yRange[1]-yRange[0])*(pos2[1]-pos[1]);
+            id = pts->InsertNextPoint(xyz);
+            lines->InsertCellPoint(id);
+            }
+          } 
+        else
+          {
+          // normalize and position
+          if ( xyz[0] < xRange[0] || xyz[0] > xRange[1] ||
+               xyz[1] < yRange[0] || xyz[1] > yRange[1] )
+            {
+            clippingRequired = 1;
+            }    
+          numLinePts++;
+          xyz[0] = fabs( xRange[1] - xRange[0] ) < 1.0 / VTK_LARGE_FLOAT ? pos[0] : pos[0] +
+            (xyz[0]-xRange[0])/(xRange[1]-xRange[0])*(pos2[0]-pos[0]);
+          xyz[1] = fabs( yRange[1] - yRange[0] ) < 1.0 / VTK_LARGE_FLOAT ? pos[1] : pos[1] +
+            (xyz[1]-yRange[0])/(yRange[1]-yRange[0])*(pos2[1]-pos[1]);
+          id = pts->InsertNextPoint(xyz);
+          lines->InsertCellPoint(id);
+          }
+        }//for all input points
+
+      lines->UpdateCellCount(numLinePts);
+      if ( clippingRequired )
+        {
+        this->ClipPlotData(pos,pos2,this->PlotData[doNum]);
+        }
+      }//loop over all input data sets
+    }
+  
+  // Remove points/lines as directed by the user
+  for ( i = 0; i < num; i++)
+    {
+    if (!this->PlotCurveLines) 
+      {
+      if ( !this->PlotLines ) 
+        {
+        this->PlotData[i]->SetLines(NULL);
+        }
+      }
+    else
+      {
+      if ( this->GetPlotLines(i) == 0)
+        {
+        this->PlotData[i]->SetLines(NULL);
+        }
+      }
+
+    if (!this->PlotCurvePoints) 
+      {
+      if ( !this->PlotPoints || (this->LegendActor->GetEntrySymbol(i) &&
+                                 this->LegendActor->GetEntrySymbol(i) != 
+                                 this->GlyphSource->GetOutput()))
+        {
+        this->PlotData[i]->SetVerts(NULL);
+        }
+      }
+    else
+      {
+      if ( this->GetPlotPoints(i) == 0 || 
+          (this->LegendActor->GetEntrySymbol(i) &&
+           this->LegendActor->GetEntrySymbol(i) != 
+           this->GlyphSource->GetOutput()))
+        {
+        this->PlotData[i]->SetVerts(NULL);
+        }
+      }
+    }
+}
+
+//----------------------------------------------------------------------------
+// Position the axes taking into account the expected padding due to labels
+// and titles. We want the result to fit in the box specified. This method
+// knows something about how the vtkAxisActor2D functions, so it may have 
+// to change if that class changes dramatically.
+//
+void VISU_XYPlotActor::PlaceAxes(vtkViewport *viewport, int *size,
+                               int pos[2], int pos2[2])
+{
+  int titleSizeX[2], titleSizeY[2], labelSizeX[2], labelSizeY[2];
+  double labelFactorX, labelFactorY;
+  double fontFactorX, fontFactorY;
+  double tickOffsetX, tickOffsetY;
+  double tickLengthX, tickLengthY;
+
+  vtkAxisActor2D *axisX;
+  vtkAxisActor2D *axisY;
+
+  char str1[512], str2[512];
+
+  if (this->ExchangeAxes)
+    {
+    axisX = this->YAxis;
+    axisY = this->XAxis;
+    }
+  else
+    {
+    axisX = this->XAxis;
+    axisY = this->YAxis;
+    }
+
+  // RKV : Begin
+  // Take into account a location of the plot.
+  if ((this->PlotLocation == VISU_XYPLOT_LEFT) || (this->PlotLocation == VISU_XYPLOT_RIGHT))
+    {
+    vtkAxisActor2D *axisBid;
+    axisBid = axisX;
+    axisX = axisY;
+    axisY = axisBid;
+    }
+    
+  // RKV : End
+  
+  fontFactorY = axisY->GetFontFactor();
+  fontFactorX = axisX->GetFontFactor();
+
+  labelFactorY = axisY->GetLabelFactor();
+  labelFactorX = axisX->GetLabelFactor();
+
+  // Create a dummy text mapper for getting font sizes
+  vtkTextMapper *textMapper = vtkTextMapper::New();
+  vtkTextProperty *tprop = textMapper->GetTextProperty();
+
+  // Get the location of the corners of the box
+  int *p1 = this->PositionCoordinate->GetComputedViewportValue(viewport);
+  int *p2 = this->Position2Coordinate->GetComputedViewportValue(viewport);
+
+  // Estimate the padding around the X and Y axes
+  tprop->ShallowCopy(axisX->GetTitleTextProperty());
+  textMapper->SetInput(axisX->GetTitle());
+  vtkAxisActor2D::SetFontSize(
+    viewport, textMapper, size, fontFactorX, titleSizeX);
+
+  tprop->ShallowCopy(axisY->GetTitleTextProperty());
+  textMapper->SetInput(axisY->GetTitle());
+  vtkAxisActor2D::SetFontSize(
+    viewport, textMapper, size, fontFactorY, titleSizeY);
+
+  // At this point the thing to do would be to actually ask the Y axis
+  // actor to return the largest label.
+  // In the meantime, let's try with the min and max
+  sprintf(str1, axisY->GetLabelFormat(), axisY->GetAdjustedRange()[0]);
+  sprintf(str2, axisY->GetLabelFormat(), axisY->GetAdjustedRange()[1]);
+  tprop->ShallowCopy(axisY->GetLabelTextProperty());
+  textMapper->SetInput(strlen(str1) > strlen(str2) ? str1 : str2);
+  vtkAxisActor2D::SetFontSize(
+    viewport, textMapper, size, labelFactorY * fontFactorY, labelSizeY);
+
+  // We do only care of the height of the label in the X axis, so let's
+  // use the min for example
+  sprintf(str1, axisX->GetLabelFormat(), axisX->GetAdjustedRange()[0]);
+  tprop->ShallowCopy(axisX->GetLabelTextProperty());
+  textMapper->SetInput(str1);
+  vtkAxisActor2D::SetFontSize(
+    viewport, textMapper, size, labelFactorX * fontFactorX, labelSizeX);
+
+  tickOffsetX = axisX->GetTickOffset();
+  tickOffsetY = axisY->GetTickOffset();
+  tickLengthX = axisX->GetTickLength();
+  tickLengthY = axisY->GetTickLength();
+
+  // Okay, estimate the size
+/* RKV  pos[0] = (int)(p1[0] + titleSizeY[0] + 2.0 * tickOffsetY + tickLengthY + 
+                 labelSizeY[0] + this->Border);
+
+  pos[1] = (int)(p1[1] + titleSizeX[1] + 2.0 * tickOffsetX + tickLengthX + 
+                 labelSizeX[1] + this->Border);
+
+  pos2[0] = (int)(p2[0] - labelSizeY[0] / 2 - tickOffsetY - this->Border);
+
+  pos2[1] = (int)(p2[1] - labelSizeX[1] / 2 - tickOffsetX - this->Border);
+  */
+  // RKV : Begin
+  pos[0] = (int)(p1[0]);
+
+  pos[1] = (int)(p1[1]);
+
+  pos2[0] = (int)(p2[0]);
+
+  pos2[1] = (int)(p2[1]);
+  // RKV : End
+
+  // Now specify the location of the axes
+  axisX->GetPositionCoordinate()->SetValue(
+    (double)pos[0], (double)pos[1]);
+  axisX->GetPosition2Coordinate()->SetValue(
+    (double)pos2[0], (double)pos[1]);
+  axisY->GetPositionCoordinate()->SetValue(
+    (double)pos[0], (double)pos2[1]);
+  axisY->GetPosition2Coordinate()->SetValue(
+    (double)pos[0], (double)pos[1]);
+    
+  textMapper->Delete();
+}
+
+//----------------------------------------------------------------------------
+void VISU_XYPlotActor::ViewportToPlotCoordinate(vtkViewport *viewport, double &u, double &v)
+{
+  int *p0, *p1, *p2;
+
+  // XAxis, YAxis are in viewport coordinates already
+  p0 = this->XAxis->GetPositionCoordinate()->GetComputedViewportValue(viewport);
+  p1 = this->XAxis->GetPosition2Coordinate()->GetComputedViewportValue(viewport);
+  p2 = this->YAxis->GetPositionCoordinate()->GetComputedViewportValue(viewport);
+
+  u = ((u - p0[0]) / (double)(p1[0] - p0[0]))
+    *(this->XComputedRange[1] - this->XComputedRange[0])
+    + this->XComputedRange[0];
+  v = ((v - p0[1]) / (double)(p2[1] - p0[1]))
+    *(this->YComputedRange[1] - this->YComputedRange[0])
+    + this->YComputedRange[0];
+}
+
+//----------------------------------------------------------------------------
+void VISU_XYPlotActor::PlotToViewportCoordinate(vtkViewport *viewport,
+                                              double &u, double &v)
+{
+  int *p0, *p1, *p2;
+
+  // XAxis, YAxis are in viewport coordinates already
+  p0 = this->XAxis->GetPositionCoordinate()->GetComputedViewportValue(viewport);
+  p1 = this->XAxis->GetPosition2Coordinate()->GetComputedViewportValue(viewport);
+  p2 = this->YAxis->GetPositionCoordinate()->GetComputedViewportValue(viewport);
+
+  u = (((u - this->XComputedRange[0])
+        / (this->XComputedRange[1] - this->XComputedRange[0]))
+       * (double)(p1[0] - p0[0])) + p0[0];
+  v = (((v - this->YComputedRange[0])
+        / (this->YComputedRange[1] - this->YComputedRange[0]))
+       * (double)(p2[1] - p0[1])) + p0[1];
+}
+
+//----------------------------------------------------------------------------
+void VISU_XYPlotActor::ViewportToPlotCoordinate(vtkViewport *viewport)
+{
+  this->ViewportToPlotCoordinate(viewport, 
+                                 this->ViewportCoordinate[0],
+                                 this->ViewportCoordinate[1]);
+}
+
+//----------------------------------------------------------------------------
+void VISU_XYPlotActor::PlotToViewportCoordinate(vtkViewport *viewport)
+{
+  this->PlotToViewportCoordinate(viewport, 
+                                 this->PlotCoordinate[0],
+                                 this->PlotCoordinate[1]);
+}
+
+//----------------------------------------------------------------------------
+int VISU_XYPlotActor::IsInPlot(vtkViewport *viewport, double u, double v)
+{
+  int *p0, *p1, *p2;
+
+  // Bounds of the plot are based on the axes...
+  p0 = this->XAxis->GetPositionCoordinate()->GetComputedViewportValue(viewport);
+  p1 = this->XAxis->GetPosition2Coordinate()->GetComputedViewportValue(viewport);
+  p2 = this->YAxis->GetPositionCoordinate()->GetComputedViewportValue(viewport);
+  
+  if (u >= p0[0] && u <= p1[0] && v >= p0[1] && v <= p2[1])
+    {
+    return 1;
+    }
+
+  return 0;
+}
+
+//----------------------------------------------------------------------------
+void VISU_XYPlotActor::SetPlotLines(int i, int isOn)
+{
+  i = ( i < 0 ? 0 : (i >=VTK_MAX_PLOTS ? VTK_MAX_PLOTS-1 : i));
+  int val = this->LinesOn->GetValue(i);
+  if ( val != isOn )
+    {
+    this->Modified();
+    this->LinesOn->SetValue(i, isOn);
+    }
+}
+
+//----------------------------------------------------------------------------
+int VISU_XYPlotActor::GetPlotLines(int i)
+{
+  i = ( i < 0 ? 0 : (i >=VTK_MAX_PLOTS ? VTK_MAX_PLOTS-1 : i));
+  return this->LinesOn->GetValue(i);
+}
+
+//----------------------------------------------------------------------------
+void VISU_XYPlotActor::SetPlotPoints(int i, int isOn)
+{
+  i = ( i < 0 ? 0 : (i >=VTK_MAX_PLOTS ? VTK_MAX_PLOTS-1 : i));
+  int val = this->PointsOn->GetValue(i);
+  if ( val != isOn )
+    {
+    this->Modified();
+    this->PointsOn->SetValue(i, isOn);
+    }
+}
+
+//----------------------------------------------------------------------------
+int VISU_XYPlotActor::GetPlotPoints(int i)
+{
+  i = ( i < 0 ? 0 : (i >=VTK_MAX_PLOTS ? VTK_MAX_PLOTS-1 : i));
+  return this->PointsOn->GetValue(i);
+}
+
+//----------------------------------------------------------------------------
+void VISU_XYPlotActor::SetPlotColor(int i, double r, double g, double b)
+{
+  this->LegendActor->SetEntryColor(i, r, g, b);
+}
+
+//----------------------------------------------------------------------------
+double *VISU_XYPlotActor::GetPlotColor(int i)
+{
+  return this->LegendActor->GetEntryColor(i);
+}
+
+//----------------------------------------------------------------------------
+void VISU_XYPlotActor::SetPlotSymbol(int i,vtkPolyData *input)
+{
+  this->LegendActor->SetEntrySymbol(i, input);
+}
+
+//----------------------------------------------------------------------------
+vtkPolyData *VISU_XYPlotActor::GetPlotSymbol(int i)
+{
+  return this->LegendActor->GetEntrySymbol(i);
+}
+
+//----------------------------------------------------------------------------
+void VISU_XYPlotActor::SetPlotLabel(int i, const char *label)
+{
+  this->LegendActor->SetEntryString(i, label);
+}
+
+//----------------------------------------------------------------------------
+const char *VISU_XYPlotActor::GetPlotLabel(int i)
+{
+  return this->LegendActor->GetEntryString(i);
+}
+
+//----------------------------------------------------------------------------
+void VISU_XYPlotActor::GenerateClipPlanes(int *pos, int *pos2)
+{
+  double n[3], x[3];
+  vtkPoints *pts=this->ClipPlanes->GetPoints();
+  vtkDataArray *normals=this->ClipPlanes->GetNormals();
+  
+  n[2] = x[2] = 0.0;
+  
+  //first
+  n[0] = 0.0;
+  n[1] = -1.0;
+  normals->SetTuple(0,n);
+  x[0] = (double)0.5*(pos[0]+pos2[0]);
+  x[1] = (double)pos[1];
+  pts->SetPoint(0,x);
+  
+  //second
+  n[0] = 1.0;
+  n[1] = 0.0;
+  normals->SetTuple(1,n);
+  x[0] = (double)pos2[0];
+  x[1] = (double)0.5*(pos[1]+pos2[1]);
+  pts->SetPoint(1,x);
+  
+  //third
+  n[0] = 0.0;
+  n[1] = 1.0;
+  normals->SetTuple(2,n);
+  x[0] = (double)0.5*(pos[0]+pos2[0]);
+  x[1] = (double)pos2[1];
+  pts->SetPoint(2,x);
+  
+  //fourth
+  n[0] = -1.0;
+  n[1] = 0.0;
+  normals->SetTuple(3,n);
+  x[0] = (double)pos[0];
+  x[1] = (double)0.5*(pos[1]+pos2[1]);
+  pts->SetPoint(3,x);
+}
+
+//----------------------------------------------------------------------------
+double VISU_XYPlotActor::ComputeGlyphScale(int i, int *pos, int *pos2)
+{
+  vtkPolyData *pd=this->LegendActor->GetEntrySymbol(i);
+  pd->Update();
+  double length=pd->GetLength();
+  double sf = this->GlyphSize * sqrt((double)(pos[0]-pos2[0])*(pos[0]-pos2[0]) + 
+                                    (pos[1]-pos2[1])*(pos[1]-pos2[1])) / length;
+
+  return sf;
+}
+
+//----------------------------------------------------------------------------
+//This assumes that there are multiple polylines
+void VISU_XYPlotActor::ClipPlotData(int *pos, int *pos2, vtkPolyData *pd)
+{
+  vtkPoints *points=pd->GetPoints();
+  vtkPoints *newPoints;
+  vtkCellArray *lines=pd->GetLines();
+  vtkCellArray *newLines, *newVerts;
+  vtkIdType numPts=pd->GetNumberOfPoints();
+  vtkIdType npts = 0;
+  vtkIdType newPts[2];
+  vtkIdType *pts=0;
+  vtkIdType i, id;
+  int j;
+  double x1[3], x2[3], px[3], n[3], xint[3], t;
+  double p1[2], p2[2];
+
+  p1[0] = (double)pos[0]; p1[1] = (double)pos[1];
+  p2[0] = (double)pos2[0]; p2[1] = (double)pos2[1];
+  
+  newPoints = vtkPoints::New();
+  newPoints->Allocate(numPts);
+  newVerts = vtkCellArray::New();
+  newVerts->Allocate(lines->GetSize());
+  newLines = vtkCellArray::New();
+  newLines->Allocate(2*lines->GetSize());
+  int *pointMap = new int [numPts];
+  for (i=0; i<numPts; i++)
+    {
+    pointMap[i] = -1;
+    }
+  
+  //Loop over polyverts eliminating those that are outside
+  for ( lines->InitTraversal(); lines->GetNextCell(npts,pts); )
+    {
+    //loop over verts keeping only those that are not clipped
+    for (i=0; i<npts; i++)
+      {
+      points->GetPoint(pts[i], x1);
+
+      if (x1[0] >= p1[0] && x1[0] <= p2[0] && x1[1] >= p1[1] && x1[1] <= p2[1] )
+        {
+        id = newPoints->InsertNextPoint(x1);
+        pointMap[i] = id;
+        newPts[0] = id;
+        newVerts->InsertNextCell(1,newPts);
+        }
+      }
+    }
+
+  //Loop over polylines clipping each line segment
+  for ( lines->InitTraversal(); lines->GetNextCell(npts,pts); )
+    {
+    //loop over line segment making up the polyline
+    for (i=0; i<(npts-1); i++)
+      {
+      points->GetPoint(pts[i], x1);
+      points->GetPoint(pts[i+1], x2);
+
+      //intersect each segment with the four planes
+      if ( (x1[0] < p1[0] && x2[0] < p1[0]) || (x1[0] > p2[0] && x2[0] > p2[0]) ||
+           (x1[1] < p1[1] && x2[1] < p1[1]) || (x1[1] > p2[1] && x2[1] > p2[1]) )
+        {
+        ;//trivial rejection
+        }
+      else if (x1[0] >= p1[0] && x2[0] >= p1[0] && x1[0] <= p2[0] && x2[0] <= p2[0] &&
+               x1[1] >= p1[1] && x2[1] >= p1[1] && x1[1] <= p2[1] && x2[1] <= p2[1] )
+        {//trivial acceptance
+        newPts[0] = pointMap[pts[i]];
+        newPts[1] = pointMap[pts[i+1]];
+        newLines->InsertNextCell(2,newPts);
+        }
+      else
+        {
+        if (x1[0] >= p1[0] && x1[0] <= p2[0] && x1[1] >= p1[1] && x1[1] <= p2[1] )
+          {//first point in
+          newPts[0] = pointMap[pts[i]];
+          }
+        else
+          {//second point in
+          newPts[0] = pointMap[pts[i+1]];
+          }
+        for (j=0; j<4; j++)
+          {
+          this->ClipPlanes->GetPoints()->GetPoint(j, px);
+          this->ClipPlanes->GetNormals()->GetTuple(j, n);
+          if ( vtkPlane::IntersectWithLine(x1,x2,n,px,t,xint) && t >= 0 && t <= 1.0 )
+            {
+            newPts[1] = newPoints->InsertNextPoint(xint);
+            break;
+            }
+          }
+        newLines->InsertNextCell(2,newPts);
+        }
+      }
+    }
+  delete [] pointMap;
+  
+  //Update the lines
+  pd->SetPoints(newPoints);
+  pd->SetVerts(newVerts);
+  pd->SetLines(newLines);
+  
+  newPoints->Delete();
+  newVerts->Delete();
+  newLines->Delete();
+  
+}
+
+//----------------------------------------------------------------------------
+void VISU_XYPlotActor::SetDataObjectXComponent(int i, int comp)
+{
+  i = ( i < 0 ? 0 : (i >=VTK_MAX_PLOTS ? VTK_MAX_PLOTS-1 : i));
+  int val=this->XComponent->GetValue(i);
+  if ( val != comp )
+    {
+    this->Modified();
+    this->XComponent->SetValue(i,comp);
+    }
+}
+
+//----------------------------------------------------------------------------
+int VISU_XYPlotActor::GetDataObjectXComponent(int i)
+{
+  i = ( i < 0 ? 0 : (i >=VTK_MAX_PLOTS ? VTK_MAX_PLOTS-1 : i));
+  return this->XComponent->GetValue(i);
+}
+
+//----------------------------------------------------------------------------
+void VISU_XYPlotActor::SetDataObjectYComponent(int i, int comp)
+{
+  i = ( i < 0 ? 0 : (i >=VTK_MAX_PLOTS ? VTK_MAX_PLOTS-1 : i));
+  int val=this->YComponent->GetValue(i);
+  if ( val != comp )
+    {
+    this->Modified();
+    this->YComponent->SetValue(i,comp);
+    }
+}
+
+//----------------------------------------------------------------------------
+int VISU_XYPlotActor::GetDataObjectYComponent(int i)
+{
+  i = ( i < 0 ? 0 : (i >=VTK_MAX_PLOTS ? VTK_MAX_PLOTS-1 : i));
+  return this->YComponent->GetValue(i);
+}
+
+//----------------------------------------------------------------------------
+void VISU_XYPlotActor::SetPointComponent(int i, int comp)
+{
+  i = ( i < 0 ? 0 : (i >=VTK_MAX_PLOTS ? VTK_MAX_PLOTS-1 : i));
+  int val = this->XComponent->GetValue(i);
+  if ( val != comp )
+    {
+    this->Modified();
+    this->XComponent->SetValue(i,comp);
+    }
+}
+
+//----------------------------------------------------------------------------
+int VISU_XYPlotActor::GetPointComponent(int i)
+{
+  i = ( i < 0 ? 0 : (i >=VTK_MAX_PLOTS ? VTK_MAX_PLOTS-1 : i));
+  return this->XComponent->GetValue(i);
+}
+
+//----------------------------------------------------------------------------
+double *VISU_XYPlotActor::TransformPoint(int pos[2], int pos2[2],
+                                       double x[3], double xNew[3])
+{
+  // First worry about exchanging axes
+  if ( this->ExchangeAxes )
+    {
+    double sx = (x[0]-pos[0]) / (pos2[0]-pos[0]);
+    double sy = (x[1]-pos[1]) / (pos2[1]-pos[1]);
+    xNew[0] = sy*(pos2[0]-pos[0]) + pos[0];
+    xNew[1] = sx*(pos2[1]-pos[1]) + pos[1];
+    xNew[2] = x[2];
+    }
+  else
+    {
+    xNew[0] = x[0];
+    xNew[1] = x[1];
+    xNew[2] = x[2];
+    }
+
+  // Okay, now swap the axes around if reverse is on
+  if ( this->ReverseXAxis )
+    {
+    xNew[0] = pos[0] + (pos2[0]-xNew[0]);
+    }
+  if ( this->ReverseYAxis )
+    {
+    xNew[1] = pos[1] + (pos2[1]-xNew[1]);
+    }
+
+  return xNew;
+}
+    
+//----------------------------------------------------------------------------
+void VISU_XYPlotActor::SetLabelFormat(const char* _arg)
+{
+  if (this->LabelFormat == NULL && _arg == NULL) 
+    { 
+    return;
+    }
+
+  if (this->LabelFormat && _arg && (!strcmp(this->LabelFormat,_arg))) 
+    { 
+    return;
+    }
+
+  if (this->LabelFormat) 
+    { 
+    delete [] this->LabelFormat; 
+    }
+
+  if (_arg)
+    {
+    this->LabelFormat = new char[strlen(_arg)+1];
+    strcpy(this->LabelFormat,_arg);
+    }
+  else
+    {
+    this->LabelFormat = NULL;
+    }
+
+  this->XAxis->SetLabelFormat(this->LabelFormat);
+  this->YAxis->SetLabelFormat(this->LabelFormat);
+
+  this->Modified();
+}
+
+//----------------------------------------------------------------------------
+void VISU_XYPlotActor::PrintAsCSV(ostream &os)
+{
+  vtkDataArray *scalars;
+  vtkDataSet *ds;
+  vtkCollectionSimpleIterator dsit;
+  double s;
+  int dsNum,component;
+  for ( dsNum=0, this->InputList->InitTraversal(dsit); 
+    (ds = this->InputList->GetNextDataSet(dsit)); dsNum++ )
+    {
+    vtkIdType numPts = ds->GetNumberOfPoints();
+    scalars = ds->GetPointData()->GetScalars(this->SelectedInputScalars[dsNum]);
+    component = this->SelectedInputScalarsComponent->GetValue(dsNum);
+    for ( vtkIdType ptId=0; ptId < numPts; ptId++ )
+      {
+      s = scalars->GetComponent(ptId, component);
+      if( ptId == 0 )
+        {
+        os << s;
+        }
+      else
+        {
+        os << "," << s;
+        }
+      }
+    os << endl;
+    }
+}
+
diff --git a/src/PIPELINE/VISU_XYPlotActor.hxx b/src/PIPELINE/VISU_XYPlotActor.hxx
new file mode 100644 (file)
index 0000000..5345d8e
--- /dev/null
@@ -0,0 +1,607 @@
+//  VISU OBJECT : interactive object for VISU entities implementation
+//
+//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
+// 
+//  This library is free software; you can redistribute it and/or 
+//  modify it under the terms of the GNU Lesser General Public 
+//  License as published by the Free Software Foundation; either 
+//  version 2.1 of the License. 
+// 
+//  This library is distributed in the hope that it will be useful, 
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of 
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
+//  Lesser General Public License for more details. 
+// 
+//  You should have received a copy of the GNU Lesser General Public 
+//  License along with this library; if not, write to the Free Software 
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
+// 
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+//
+// File:    VISU_XYPlotActor.hxx
+// Author:  Roman KOZLOV
+// Module : VISU
+
+#ifndef VISU_XYPLOTACTOR_HXX_
+#define VISU_XYPLOTACTOR_HXX_
+
+#include "VISUPipeline.hxx"
+
+/*=========================================================================
+
+  Program:   Visualization Toolkit
+  Module:    $RCSfile$
+
+  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
+  All rights reserved.
+  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
+
+     This software is distributed WITHOUT ANY WARRANTY; without even
+     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+     PURPOSE.  See the above copyright notice for more information.
+
+=========================================================================*/
+// .NAME vtkXYPlotActor - generate an x-y plot from input dataset(s) or field data
+// .SECTION Description
+// vtkXYPlotActor creates an x-y plot of data from one or more input data
+// sets or field data. The class plots dataset scalar values (y-axis) against
+// the points (x-axis). The x-axis values are generated by taking the point
+// ids, computing a cumulative arc length, or a normalized arc length. More
+// than one input data set can be specified to generate multiple plots.
+// Alternatively, if field data is supplied as input, the class plots one
+// component against another. (The user must specify which component to use
+// as the x-axis and which for the y-axis.)
+//
+// To use this class to plot dataset(s), you must specify one or more
+// input datasets containing scalar and point data.  You'll probably also
+// want to invoke a method to control how the point coordinates are converted
+// into x values (by default point ids are used).
+//
+// To use this class to plot field data, you must specify one or more input
+// data objects with its associated field data. You'll also want to specify
+// which component to use as the x-axis and which to use as the y-axis.
+// Note that when plotting field data, the x and y values are used directly
+// (i.e., there are no options to normalize the components).
+//
+// Once you've set up the plot, you'll want to position it.  The
+// PositionCoordinate defines the lower-left location of the x-y plot
+// (specified in normalized viewport coordinates) and the Position2Coordinate
+// define the upper-right corner. (Note: the Position2Coordinate is relative
+// to PositionCoordinate, so you can move the vtkXYPlotActor around the
+// viewport by setting just the PositionCoordinate.) The combination of the
+// two position coordinates specifies a rectangle in which the plot will lie.
+//
+// Optional features include the ability to specify axes labels, label
+// format and plot title. You can also
+// manually specify the x and y plot ranges (by default they are computed
+// automatically). The Border instance variable is used to create space 
+// between the boundary of the plot window (specified by PositionCoordinate
+// and Position2Coordinate) and the plot itself.
+//
+// The font property of the plot title can be modified through the 
+// TitleTextProperty attribute.
+// The font property of the axes titles and labels can be modified through the
+// AxisTitleTextProperty and AxisLabelTextProperty attributes. You may also
+// use the GetXAxisActor2D or GetYAxisActor2D methods 
+// to access each individual axis actor to modify their font properties.
+// In the same way, the GetLegendBoxActor method can be used to access
+// the legend box actor to modify its font properties.
+//
+// There are several advanced features as well. You can assign per curve 
+// properties (such as color and a plot symbol). (Note that each input 
+// dataset and/or data object creates a single curve.) Another option is to
+// add a plot legend that graphically indicates the correspondance between
+// the curve, curve symbols, and the data source. You can also exchange the
+// x and y axes if you prefer you plot orientation that way.
+
+// .SECTION Caveats
+// If you are interested in plotting something other than scalar data, you
+// can use the vtk data shuffling filters (e.g., 
+// vtkAttributeDataToFieldDataFilter and vtkFieldDataToAttributeDataFilter) 
+// to convert the data into scalar data and/or points.
+
+// .SECTION See Also
+// vtkActor2D vtkTextMapper vtkScalarBarActor vtkAxisActor2D vtkCubeAxesActor2D
+// vtkAttributeDataToFieldDataFilter vtkFieldDataToAttributeDataFilter 
+// vtkTextProperty
+
+#include "vtkActor2D.h"
+#include "vtkTransformPolyDataFilter.h" // RKV
+
+#define VTK_XYPLOT_INDEX                 0
+#define VTK_XYPLOT_ARC_LENGTH            1
+#define VTK_XYPLOT_NORMALIZED_ARC_LENGTH 2
+#define VTK_XYPLOT_VALUE                 3
+
+#define VTK_XYPLOT_ROW 0
+#define VTK_XYPLOT_COLUMN 1
+
+class vtkAppendPolyData;
+class vtkAxisActor2D;
+class vtkDataObject;
+class vtkDataObjectCollection;
+class vtkDataSet;
+class vtkDataSetCollection;
+class vtkGlyph2D;
+class vtkGlyphSource2D;
+class vtkIntArray;
+class vtkLegendBoxActor;
+class vtkPlanes;
+class vtkPolyData;
+class vtkPolyDataMapper2D;
+class vtkTextMapper;
+class vtkTextProperty;
+
+// RKV : Begin
+/** Location of the actor in the viewport. 
+ * Axes and a curve is plotted according to the selected side.
+ * Axes origin is plotted at:
+ *  VISU_XYPLOT_BOTTOM - the left bottom corner,
+ *  VISU_XYPLOT_TOP    - the left upper corner (Y axis is directed to the bottom),
+ *  VISU_XYPLOT_LEFT   - the left bottom corner (axes are exchanged),
+ *  VISU_XYPLOT_RIGHT  - the right bottom corner (X axis is directed to the top, Y - to the left)
+ */
+enum VISU_XYPlotLocation { VISU_XYPLOT_BOTTOM = 0,
+       VISU_XYPLOT_TOP, VISU_XYPLOT_LEFT, VISU_XYPLOT_RIGHT };
+// RKV : End
+
+class VISU_PIPELINE_EXPORT VISU_XYPlotActor : public vtkActor2D
+{
+public:
+  vtkTypeRevisionMacro(VISU_XYPlotActor,vtkActor2D);
+  void PrintSelf(ostream& os, vtkIndent indent);
+
+  // Description:
+  // Instantiate object with autorange computation; bold, italic, and shadows
+  // on; arial font family; the number of labels set to 5 for the x and y
+  // axes; a label format of "%-#6.3g"; and x coordinates computed from point
+  // ids.
+  static VISU_XYPlotActor *New();
+
+  //---Data Set Input----------------------------------------------------------
+  // The following methods are used to plot input datasets. Datasets
+  // will be plotted if set as input; otherwise the input data objects
+  // will be plotted (if defined).
+  
+  // Description:
+  // Add a dataset to the list of data to append. The array name specifies
+  // which point array to plot.  If the array name is NULL, then the default
+  // scalars are used.  The array can have multiple components, but only the
+  // first component is ploted.
+  void AddInput(vtkDataSet *in, const char* arrayName, int component);
+  void AddInput(vtkDataSet *in) {this->AddInput(in, NULL, 0);}
+
+  // Description:
+  // Remove a dataset from the list of data to append.
+  void RemoveInput(vtkDataSet *in, const char* arrayName, int component);
+  void RemoveInput(vtkDataSet *in) {this->RemoveInput(in, NULL, 0);}
+
+  // Description:
+  // This removes all of the data set inputs, 
+  // but does not change the data object inputs.
+  void RemoveAllInputs();
+
+  // Description:
+  // Return the list of inputs to this filter.
+  vtkDataSetCollection *GetInputList() {return this->InputList;}
+
+  // Description:
+  // If plotting points by value, which component to use to determine the
+  // value. This sets a value per each input dataset (i.e., the ith dataset).
+  void SetPointComponent(int i, int comp);
+  int GetPointComponent(int i);
+  //---end Data Set Input-----------------------------------------------------
+
+  // Description:
+  // Specify how the independent (x) variable is computed from the points.
+  // The independent variable can be the scalar/point index (i.e., point id),
+  // the accumulated arc length along the points, the normalized arc length,
+  // or by component value. If plotting datasets (e.g., points), the value
+  // that is used is specified by the PointComponent ivar.  (Note: these
+  // methods also control how field data is plotted. Field data is usually
+  // plotted by value or index, if plotting length 1-dimensional length
+  // measures are used.)
+  vtkSetClampMacro(XValues,int,VTK_XYPLOT_INDEX,VTK_XYPLOT_VALUE);
+  vtkGetMacro(XValues,int);
+  void SetXValuesToIndex(){this->SetXValues(VTK_XYPLOT_INDEX);};
+  void SetXValuesToArcLength() {this->SetXValues(VTK_XYPLOT_ARC_LENGTH);};
+  void SetXValuesToNormalizedArcLength()
+    {this->SetXValues(VTK_XYPLOT_NORMALIZED_ARC_LENGTH);};
+  void SetXValuesToValue() {this->SetXValues(VTK_XYPLOT_VALUE);};
+  const char *GetXValuesAsString();
+
+  //---Data Object Input------------------------------------------------------
+  // The following methods are used to plot input data objects. Datasets will
+  // be plotted in preference to data objects if set as input; otherwise the
+  // input data objects will be plotted (if defined).
+  
+  // Description:
+  // Add a dataset to the list of data to append.
+  void AddDataObjectInput(vtkDataObject *in);
+
+  // Description:
+  // Remove a dataset from the list of data to append.
+  void RemoveDataObjectInput(vtkDataObject *in);
+
+  // Description:
+  // Return the list of inputs to this filter.
+  vtkDataObjectCollection *GetDataObjectInputList() 
+    {return this->DataObjectInputList;}
+
+  // Description:
+  // Indicate whether to plot rows or columns. If plotting rows, then
+  // the dependent variables is taken from a specified row,
+  // versus rows (y). 
+  vtkSetClampMacro(DataObjectPlotMode,int,VTK_XYPLOT_ROW,VTK_XYPLOT_COLUMN);
+  vtkGetMacro(DataObjectPlotMode,int);
+  void SetDataObjectPlotModeToRows()
+    {this->SetDataObjectPlotMode(VTK_XYPLOT_ROW);}
+  void SetDataObjectPlotModeToColumns()
+    {this->SetDataObjectPlotMode(VTK_XYPLOT_COLUMN);}
+  const char *GetDataObjectPlotModeAsString();
+
+  // Description:
+  // Specify which component of the input data object to use as the
+  // independent variable for the ith input data object. (This ivar is
+  // ignored if plotting the index.) Note that the value is interpreted
+  // differently depending on DataObjectPlotMode. If the mode is Rows, then
+  // the value of DataObjectXComponent is the row number; otherwise it's the
+  // column number.
+  void SetDataObjectXComponent(int i, int comp);
+  int GetDataObjectXComponent(int i);
+
+  // Description:
+  // Specify which component of the input data object to use as the
+  // dependent variable for the ith input data object. (This ivar is
+  // ignored if plotting the index.) Note that the value is interpreted
+  // differently depending on DataObjectPlotMode. If the mode is Rows, then
+  // the value of DataObjectYComponent is the row number; otherwise it's the
+  // column number.
+  void SetDataObjectYComponent(int i, int comp);
+  int GetDataObjectYComponent(int i);
+  //---end Data Object Input--------------------------------------------------
+
+  //---Per Curve Properties---------------------------------------------------
+  // The following methods are used to set properties on each curve that is
+  // plotted. Each input dataset (or data object) results in one curve. The
+  // methods that follow have an index i that corresponds to the input dataset
+  // or data object. 
+  void SetPlotColor(int i, double r, double g, double b);
+  void SetPlotColor(int i, const double color[3]) {
+    this->SetPlotColor(i, color[0], color[1], color[2]); };
+  double *GetPlotColor(int i);
+  void SetPlotSymbol(int i,vtkPolyData *input);
+  vtkPolyData *GetPlotSymbol(int i);
+  void SetPlotLabel(int i, const char *label);
+  const char *GetPlotLabel(int i);
+
+  // Allow per-curve specification of line and point rendering.  These override
+  // global settings PlotPoints and PlotLines.  If not on, the default behavior
+  // is governed by PlotPoints and PlotLines ivars.
+  vtkGetMacro(PlotCurvePoints, int);
+  vtkSetMacro(PlotCurvePoints, int);
+  vtkBooleanMacro(PlotCurvePoints, int);
+
+  vtkGetMacro(PlotCurveLines, int);
+  vtkSetMacro(PlotCurveLines, int);
+  vtkBooleanMacro(PlotCurveLines, int);
+
+  void SetPlotLines(int i, int);
+  int GetPlotLines(int i);
+
+  void SetPlotPoints(int i, int);
+  int GetPlotPoints(int i);
+  //---end Per Curve Properties-----------------------------------------------
+
+  // Description:
+  // Enable/Disable exchange of the x-y axes (i.e., what was x becomes y, and
+  // vice-versa). Exchanging axes affects the labeling as well.
+  vtkSetMacro(ExchangeAxes, int);
+  vtkGetMacro(ExchangeAxes, int);
+  vtkBooleanMacro(ExchangeAxes, int);
+
+  // Description:
+  // Normally the x-axis is plotted from minimum to maximum. Setting this instance
+  // variable causes the x-axis to be plotted from maximum to minimum. Note that
+  // boolean always applies to the x-axis even if ExchangeAxes is set.
+  vtkSetMacro(ReverseXAxis, int);
+  vtkGetMacro(ReverseXAxis, int);
+  vtkBooleanMacro(ReverseXAxis, int);
+
+  // Description:
+  // Normally the y-axis is plotted from minimum to maximum. Setting this instance
+  // variable causes the y-axis to be plotted from maximum to minimum. Note that
+  // boolean always applies to the y-axis even if ExchangeAxes is set.
+  vtkSetMacro(ReverseYAxis, int);
+  vtkGetMacro(ReverseYAxis, int);
+  vtkBooleanMacro(ReverseYAxis, int);
+
+  // Description:
+  // Retrieve handles to the legend box and glyph source. This is useful
+  // if you would like to change the default behavior of the legend box
+  // or glyph source. For example, the default glyph can be changed from
+  // a line to a vertex plus line, etc.)
+  vtkGetObjectMacro(LegendActor,vtkLegendBoxActor);
+  vtkGetObjectMacro(GlyphSource,vtkGlyphSource2D);
+
+  // Description:
+  // Set/Get the title of the x-y plot, and the title along the 
+  // x and y axes.
+  vtkSetStringMacro(Title);
+  vtkGetStringMacro(Title);
+  vtkSetStringMacro(XTitle);
+  vtkGetStringMacro(XTitle);
+  vtkSetStringMacro(YTitle);
+  vtkGetStringMacro(YTitle);
+
+  // Description:
+  // Retrieve handles to the X and Y axis (so that you can set their text
+  // properties for example)
+  vtkAxisActor2D *GetXAxisActor2D()
+    {return this->XAxis;}
+  vtkAxisActor2D *GetYAxisActor2D()
+    {return this->YAxis;}
+
+  // Description:
+  // Set the plot range (range of independent and dependent variables)
+  // to plot. Data outside of the range will be clipped. If the plot
+  // range of either the x or y variables is set to (v1,v2), where
+  // v1 == v2, then the range will be computed automatically. Note that
+  // the x-range values should be consistent with the way the independent
+  // variable is created (via INDEX, DISTANCE, or ARC_LENGTH).
+  vtkSetVector2Macro(XRange,double);
+  vtkGetVectorMacro(XRange,double,2);
+  vtkSetVector2Macro(YRange,double);
+  vtkGetVectorMacro(YRange,double,2);
+  void SetPlotRange(double xmin, double ymin, double xmax, double ymax)
+    {this->SetXRange(xmin,xmax); this->SetYRange(ymin,ymax);}
+  
+  // Description:
+  // Set/Get the number of annotation labels to show along the x and y axes.
+  // This values is a suggestion: the number of labels may vary depending
+  // on the particulars of the data. The convenience method 
+  // SetNumberOfLables() sets the number of x and y labels to the same value.
+  vtkSetClampMacro(NumberOfXLabels, int, 0, 50);
+  vtkGetMacro(NumberOfXLabels, int);
+  vtkSetClampMacro(NumberOfYLabels, int, 0, 50);
+  vtkGetMacro(NumberOfYLabels, int);
+  void SetNumberOfLabels(int num)
+    {this->SetNumberOfXLabels(num); this->SetNumberOfYLabels(num);}
+  
+  // Description:
+  // Enable/Disable the creation of a legend. If on, the legend labels will
+  // be created automatically unless the per plot legend symbol has been
+  // set.
+  vtkSetMacro(Legend, int);
+  vtkGetMacro(Legend, int);
+  vtkBooleanMacro(Legend, int);
+
+  // Description: 
+  // Use these methods to control the position of the legend. The variables
+  // LegendPosition and LegendPosition2 define the lower-left and upper-right
+  // position of the legend. The coordinates are expressed as normalized
+  // values with respect to the rectangle defined by PositionCoordinate and
+  // Position2Coordinate. Note that LegendPosition2 is relative to
+  // LegendPosition.
+  vtkSetVector2Macro(LegendPosition,double);
+  vtkGetVector2Macro(LegendPosition,double);
+  vtkSetVector2Macro(LegendPosition2,double);
+  vtkGetVector2Macro(LegendPosition2,double);
+  
+  // Description:
+  // Set/Get the title text property.
+  virtual void SetTitleTextProperty(vtkTextProperty *p);
+  vtkGetObjectMacro(TitleTextProperty,vtkTextProperty);
+  
+  // Description:
+  // Set/Get the title text property of all axes. Note that each axis can
+  // be controlled individually through the GetX/YAxisActor2D() methods.
+  virtual void SetAxisTitleTextProperty(vtkTextProperty *p);
+  vtkGetObjectMacro(AxisTitleTextProperty,vtkTextProperty);
+  
+  // Description:
+  // Set/Get the labels text property of all axes. Note that each axis can
+  // be controlled individually through the GetX/YAxisActor2D() methods.
+  virtual void SetAxisLabelTextProperty(vtkTextProperty *p);
+  vtkGetObjectMacro(AxisLabelTextProperty,vtkTextProperty);
+      
+  // Description:
+  // Enable/Disable plotting of Log of x-values.
+  vtkSetMacro(Logx, int);
+  vtkGetMacro(Logx, int);
+  vtkBooleanMacro(Logx, int);
+
+  // Description:
+  // Set/Get the format with which to print the labels on the scalar
+  // bar.
+  virtual void SetLabelFormat (const char* _arg);
+  vtkGetStringMacro(LabelFormat);
+
+  // Description:
+  // Set/Get the spacing between the plot window and the plot. The value
+  // is specified in pixels.
+  vtkSetClampMacro(Border, int, 0, 50);
+  vtkGetMacro(Border, int);
+
+  // Description:
+  // Set/Get whether the points are rendered.  The point size can be set in
+  // the property object. This is a global flag which affects the plot only 
+  // if per curve symbols are not defined.
+  vtkGetMacro(PlotPoints, int);
+  vtkSetMacro(PlotPoints, int);
+  vtkBooleanMacro(PlotPoints, int);
+
+  // Description:
+  // Set/Get whether the lines are rendered.  The line width can be set in
+  // the property object. 
+  vtkGetMacro(PlotLines, int);
+  vtkSetMacro(PlotLines, int);
+  vtkBooleanMacro(PlotLines, int);
+  
+  // RKV : Begin
+  // Description:
+  // Set/Get the location in the viewport 
+  vtkGetMacro(PlotLocation, VISU_XYPlotLocation);
+  vtkSetMacro(PlotLocation, VISU_XYPlotLocation);
+  // RKV : End
+  
+  // Description:
+  // Set/Get the factor that controls how big glyphs are in the plot.
+  // The number is expressed as a fraction of the length of the diagonal
+  // of the plot bounding box.
+  vtkSetClampMacro(GlyphSize, double, 0.0, 0.2);
+  vtkGetMacro(GlyphSize, double);
+
+  // Description:
+  // Given a position within the viewport used by the plot, return the
+  // the plot coordinates (XAxis value, YAxis value)
+  void ViewportToPlotCoordinate(vtkViewport *viewport, double &u, double &v);
+
+  // Description:
+  // An alternate form of ViewportToPlotCoordinate() above. This method
+  // inputs the viewport coordinate pair (defined by the ivar 
+  // ViewportCoordinate)and then stores them in the ivar PlotCoordinate. 
+  void ViewportToPlotCoordinate(vtkViewport *viewport);
+  vtkSetVector2Macro(PlotCoordinate,double);
+  vtkGetVector2Macro(PlotCoordinate,double);
+
+  // Description:
+  // Given a plot coordinate, return the viewpoint position
+  void PlotToViewportCoordinate(vtkViewport *viewport, double &u, double &v);
+
+  // Description:
+  // An alternate form of PlotToViewportCoordinate() above. This method
+  // inputs the plot coordinate pair (defined in the ivar PlotCoordinate)
+  // and then stores them in the ivar ViewportCoordinate. (This method 
+  // can be wrapped.)
+  void PlotToViewportCoordinate(vtkViewport *viewport);
+  vtkSetVector2Macro(ViewportCoordinate,double);
+  vtkGetVector2Macro(ViewportCoordinate,double);
+
+  // Description:
+  // Is the specified viewport position within the plot area (as opposed to the
+  // region used by the plot plus the labels)?
+  int IsInPlot(vtkViewport *viewport, double u, double v);
+  
+  // Description:
+  // Take into account the modified time of internal helper classes.
+  unsigned long GetMTime();
+  
+  // Description:
+  // Write the XY Ploat Actor as a CSV (comma separated value) representation.
+  void PrintAsCSV(ostream &os);
+
+//BTX  
+  // Description:
+  // WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE
+  // DO NOT USE THIS METHOD OUTSIDE OF THE RENDERING PROCESS.
+  // Draw the x-y plot.
+  int RenderOpaqueGeometry(vtkViewport*);
+  int RenderOverlay(vtkViewport*);
+  int RenderTranslucentGeometry(vtkViewport *) {return 0;}
+
+  // Description:
+  // Release any graphics resources that are being consumed by this actor.
+  // The parameter window could be used to determine which graphic
+  // resources to release.
+  void ReleaseGraphicsResources(vtkWindow *);
+//ETX  
+
+protected:
+  VISU_XYPlotActor();
+  ~VISU_XYPlotActor();
+
+  vtkDataSetCollection *InputList; //list of data sets to plot
+  char** SelectedInputScalars; // list of data set arrays to plot
+  vtkIntArray* SelectedInputScalarsComponent; // list of componenents
+  vtkDataObjectCollection *DataObjectInputList; //list of data objects to plot
+  char  *Title;
+  char  *XTitle;
+  char  *YTitle;
+  int   XValues;
+  int   NumberOfXLabels;
+  int   NumberOfYLabels;
+  int   Logx;
+  char  *LabelFormat;
+  double XRange[2];
+  double YRange[2];
+  double XComputedRange[2];  //range actually used by plot
+  double YComputedRange[2];  //range actually used by plot
+  int Border;
+  int PlotLines;
+  int PlotPoints;
+  int PlotCurveLines;
+  int PlotCurvePoints;
+  int ExchangeAxes;
+  int ReverseXAxis;
+  int ReverseYAxis;
+  
+  vtkTextMapper   *TitleMapper;
+  vtkActor2D      *TitleActor;
+  vtkTextProperty *TitleTextProperty;
+
+  vtkAxisActor2D      *XAxis;
+  vtkAxisActor2D      *YAxis;
+
+  vtkTextProperty *AxisTitleTextProperty;
+  vtkTextProperty *AxisLabelTextProperty;
+
+  double ViewportCoordinate[2];
+  double PlotCoordinate[2];
+  
+  //Handle data objects and datasets
+  int DataObjectPlotMode;
+  vtkIntArray *XComponent;
+  vtkIntArray *YComponent;
+  vtkIntArray *LinesOn;
+  vtkIntArray *PointsOn;
+
+  //The data drawn within the axes. Each curve is one polydata.
+  //color is controlled by scalar data. The curves are appended
+  //together, possibly glyphed with point symbols.
+  int NumberOfInputs;
+  vtkPolyData             **PlotData; 
+  vtkGlyph2D              **PlotGlyph;
+  vtkAppendPolyData       **PlotAppend;
+  vtkTransformPolyDataFilter  **PlotTransform; // RKV
+  vtkPolyDataMapper2D     **PlotMapper;
+  vtkActor2D              **PlotActor;
+  void                    InitializeEntries();
+  
+  // Legends and plot symbols. The legend also keeps track of
+  // the symbols and such.
+  int Legend;
+  double LegendPosition[2];
+  double LegendPosition2[2];
+  vtkLegendBoxActor *LegendActor;
+  vtkGlyphSource2D *GlyphSource;
+  vtkPlanes *ClipPlanes;
+  double GlyphSize;
+
+  // Keep track of changes.
+  VISU_XYPlotLocation PlotLocation; // RKV
+  int CachedSize[2];
+  vtkTimeStamp  BuildTime;
+
+  void ComputeXRange(double range[2], double *lengths);
+  void ComputeYRange(double range[2]);
+  void ComputeDORange(double xrange[2], double yrange[2], double *lengths);
+
+  virtual void CreatePlotData(int *pos, int *pos2, double xRange[2], 
+                              double yRange[2], double *norms, 
+                              int numDS, int numDO);
+  void PlaceAxes(vtkViewport *viewport, int *size, int pos[2], int pos2[2]);
+  void GenerateClipPlanes(int *pos, int *pos2);
+  double ComputeGlyphScale(int i, int *pos, int *pos2);
+  void ClipPlotData(int *pos, int *pos2, vtkPolyData *pd);
+  double *TransformPoint(int pos[2], int pos2[2], double x[3], double xNew[3]);
+  
+private:
+  VISU_XYPlotActor(const VISU_XYPlotActor&);  // Not implemented.
+  void operator=(const VISU_XYPlotActor&);  // Not implemented.
+};
+
+
+#endif /*VISU_XYPLOTACTOR_HXX_*/
index 6a722920c618f7bc634df5b2d605385117265cf9..6abacc7daa6201518d9599a00a3494fac1567e68 100644 (file)
@@ -77,10 +77,17 @@ dist_libVISU_la_SOURCES= \
        VisuGUI.cxx \
        VisuGUI_Factory.cxx \
        VisuGUI_Module.cxx \
-       VisuGUI_Selection.cxx \
+       VisuGUI_InputPanel.cxx \
+       VisuGUI_BasePanel.cxx \
+       VisuGUI_Panel.cxx \
+       VisuGUI_SelectionPanel.cxx \
+       VisuGUI_SelectionPrefDlg.cxx \
+       VisuGUI_GaussPointsSelectionPane.cxx \
+       VisuGUI_FindPane.cxx \
+       VisuGUI_FeatureEdgesPanel.cxx \
        VisuGUI_Tools.cxx \
        VisuGUI_ViewTools.cxx \
-       VisuGUI_PopupTools.cxx \
+       VisuGUI_Selection.cxx \
        VisuGUI_NameDlg.cxx \
        VisuGUI_FileDlg.cxx \
        VisuGUI_CursorDlg.cxx \
@@ -107,15 +114,26 @@ dist_libVISU_la_SOURCES= \
        VisuGUI_TransparencyDlg.cxx \
        VisuGUI_Timer.cxx \
        VisuGUI_Slider.cxx \
+       VisuGUI_Sweep.cxx \
        VisuGUI_InputPane.cxx \
        VisuGUI_CacheDlg.cxx \
+       VisuGUI_FileInfoDlg.cxx \
        VisuGUI_FieldFilter.cxx \
-       VisuGUI_FileInfoDlg.cxx
+       VisuGUI_ClippingPanel.cxx \
+       VisuGUI_ClippingPlaneDlg.cxx \
+       VisuGUI_FilterScalarsDlg.cxx
 
 MOC_FILES= \
        VisuGUI_moc.cxx \
        VisuGUI_Module_moc.cxx \
-       VisuGUI_Selection_moc.cxx \
+       VisuGUI_InputPanel_moc.cxx \
+       VisuGUI_BasePanel_moc.cxx \
+       VisuGUI_Panel_moc.cxx \
+       VisuGUI_SelectionPanel_moc.cxx \
+       VisuGUI_SelectionPrefDlg_moc.cxx \
+       VisuGUI_GaussPointsSelectionPane_moc.cxx \
+       VisuGUI_FindPane_moc.cxx \
+       VisuGUI_FeatureEdgesPanel_moc.cxx \
        VisuGUI_NameDlg_moc.cxx \
        VisuGUI_FileDlg_moc.cxx \
        VisuGUI_CursorDlg_moc.cxx \
@@ -140,9 +158,14 @@ MOC_FILES= \
        VisuGUI_Table3dDlg_moc.cxx \
        VisuGUI_TransparencyDlg_moc.cxx \
        VisuGUI_Slider_moc.cxx \
+       VisuGUI_Sweep_moc.cxx \
        VisuGUI_InputPane_moc.cxx \
        VisuGUI_CacheDlg_moc.cxx \
-       VisuGUI_FileInfoDlg_moc.cxx
+       VisuGUI_FileInfoDlg_moc.cxx \
+       VisuGUI_ClippingPanel_moc.cxx \
+       VisuGUI_ClippingPlaneDlg_moc.cxx \
+       VisuGUI_FilterScalarsDlg_moc.cxx
+
 
 nodist_libVISU_la_SOURCES=$(MOC_FILES)
 
index dd7a9d46468f324d9b563e71ffce9da0d4ba08ab..7157c48cb2db542202203843d78ecfc4d64361ed 100644 (file)
@@ -2,10 +2,26 @@
 <TS version="1.1" >
     <context>
         <name>@default</name>
+        <message>
+            <source>ICON_ACTOR_SELECTION</source>
+            <translation>Visu_actor_selection.png</translation>
+        </message>
         <message>
             <source>ICON_ADD</source>
             <translation>Visu_add.png</translation>
         </message>
+        <message>
+            <source>ICON_APPLY</source>
+            <translation>Visu_apply.png</translation>
+        </message>
+        <message>
+            <source>ICON_CELL_SELECTION</source>
+            <translation>Visu_cell_selection.png</translation>
+        </message>
+        <message>
+            <source>ICON_CLOSE</source>
+            <translation>Visu_close.png</translation>
+        </message>
         <message>
             <source>ICON_CUBE_AXES</source>
             <translation>Visu_graduated_axes.png</translation>
             <source>ICON_GAUSS_NEW_VIEWER</source>
             <translation>Visu_points.png</translation>
         </message>
+        <message>
+            <source>ICON_GAUSS_POINT_SELECTION</source>
+            <translation>Visu_gauss_point_selection.png</translation>
+        </message>
         <message>
             <source>ICON_GAUSS_POINTS</source>
             <translation>Visu_gauss_points.png</translation>
             <source>ICON_GLOBAL_SELECTION</source>
             <translation>Visu_selectall.png</translation>
         </message>
+        <message>
+            <source>ICON_HELP</source>
+            <translation>Visu_help.png</translation>
+        </message>
         <message>
             <source>ICON_HOLO_RENDER</source>
             <translation>Visu_holo_render.png</translation>
             <source>ICON_OBJBROWSER_Visu</source>
             <translation>Visu_tree_visu.png</translation>
         </message>
+        <message>
+            <source>ICON_OK</source>
+            <translation>Visu_ok.png</translation>
+        </message>
         <message>
             <source>ICON_PARTIAL_SELECTION</source>
             <translation>Visu_selectonly.png</translation>
             <source>ICON_PLOT_3D</source>
             <translation>Visu_plot3d.png</translation>
         </message>
+        <message>
+            <source>ICON_POINT_SELECTION</source>
+            <translation>Visu_point_selection.png</translation>
+        </message>
         <message>
             <source>ICON_POINTS</source>
             <translation>Visu_points.png</translation>
             <source>ICON_SCALING</source>
             <translation>Visu_scaling.png</translation>
         </message>
+        <message>
+            <source>ICON_SELECTION_PANEL</source>
+            <translation>Visu_selection_panel.png</translation>
+        </message>
+        <message><source>ICON_SLIDER_PANEL</source><translation>Visu_slider_panel.png</translation></message>
+        <message><source>ICON_SWEEP_PANEL</source><translation>Visu_sweep_panel.png</translation></message>
         <message>
             <source>ICON_SLIDER_AVI</source>
             <translation>Visu_slider_avi.png</translation>
             <source>ICON_VVTK_RECORDING_STOP</source>
             <translation>Visu_recording_stop.png</translation>
         </message>
+        <message>
+            <source>ICON_SWEEP_STOP</source>
+            <translation>Visu_recording_stop.png</translation>
+        </message>
         <message>
             <source>ICON_VVTK_SELECTION_MODE_SWITCH</source>
             <translation>Visu_points.png</translation>
             <source>ICON_WIREFRAME</source>
             <translation>Visu_wireframe.png</translation>
         </message>
+        <message>
+            <source>ICON_DEACTIVATE_PLANES</source>
+            <translation>Visu_DeactivatePlane.png</translation>
+        </message>
+        <message>
+            <source>ICON_PLANES_MGR</source>
+            <translation>Visu_planemanager.png</translation>
+        </message>
     </context>
 </TS>
index b24996d2ca6dfcf05a148e57370ae558c36ce784..df589e92dc5d2913e2447d0ad00e31d6373df404 100644 (file)
@@ -96,10 +96,8 @@ number of time stamps or number of components is not the same!</translation>
             <source>UNITS_LBL</source>
             <translation>Units</translation>
         </message>
-        <message>
-            <source>VISU_3DCACHE_PROPS</source>
-            <translation>3D Cache properties</translation>
-        </message>
+        <message><source>VISU_3DCACHE_PREFERENCES</source><translation>3D Cache</translation></message>
+        <message><source>VISU_ANIMATION_PREFERENCES</source><translation>Animation</translation></message>
         <message>
             <source>VISU_COLORS_AND_LABELS</source>
             <translation>Colors &amp;&amp; Labels</translation>
@@ -132,6 +130,22 @@ number of time stamps or number of components is not the same!</translation>
             <source>VISU_DISP_ONLY</source>
             <translation>Display only on creation</translation>
         </message>
+        <message>
+            <source>VISU_FEATURE_EDGES</source>
+            <translation>Feature edges</translation>
+        </message>
+        <message>
+            <source>VISU_FEATURE_EDGES_ANGLE</source>
+            <translation>Feature edges angle</translation>
+        </message>
+        <message>
+            <source>VISU_FEATURE_EDGES_COLORING</source>
+            <translation>Coloring</translation>
+        </message>
+        <message>
+            <source>VISU_FEATURE_EDGES_PROPS</source>
+            <translation>Feature edges properties</translation>
+        </message>
         <message>
             <source>VISU_FIELD_RANGE</source>
             <translation>Field range</translation>
@@ -186,7 +200,7 @@ number of time stamps or number of components is not the same!</translation>
         </message>
         <message>
             <source>VISU_LOGARITHMIC_SCALING</source>
-            <translation>Logarithmic scaling</translation>
+            <translation>Logarithmic</translation>
         </message>
         <message>
             <source>VISU_MAX</source>
@@ -286,7 +300,23 @@ number of time stamps or number of components is not the same!</translation>
         </message>
         <message>
             <source>VISU_SCALAR_RANGE</source>
-            <translation>Scalar range</translation>
+            <translation>Scalar range:</translation>
+        </message>
+        <message>
+            <source>VISU_SHOW_BOUNDARY_EDGES</source>
+            <translation>Show boundary edges</translation>
+        </message>
+        <message>
+            <source>VISU_SHOW_FEATURE_EDGES</source>
+            <translation>Show feature edges</translation>
+        </message>
+        <message>
+            <source>VISU_SHOW_MANIFOLD_EDGES</source>
+            <translation>Show manifold edges</translation>
+        </message>
+        <message>
+            <source>VISU_SHOW_NON_MANIFOLD_EDGES</source>
+            <translation>Show non-manifold edges</translation>
         </message>
         <message>
             <source>VISU_SHRINK</source>
@@ -884,18 +914,26 @@ Please, refer to the documentation.</translation>
             <source>IMPORT_FROM_FILE</source>
             <translation>Import from File</translation>
         </message>
+        <message>
+            <source>MEN_ACTOR_SELECTION</source>
+            <translation>Actor Selection</translation>
+        </message>
         <message>
             <source>MEN_ARRANGE_ACTORS</source>
             <translation>Arrange Actors</translation>
         </message>
         <message>
-            <source>MEN_CACHE_PROPERTIES</source>
-            <translation>Properties</translation>
+            <source>MEN_MANAGE_CACHE</source>
+            <translation>Manage</translation>
         </message>
         <message>
             <source>MEN_CELL_COLOR</source>
             <translation>Cell color</translation>
         </message>
+        <message>
+            <source>MEN_CELL_SELECTION</source>
+            <translation>Cell Selection</translation>
+        </message>
         <message>
             <source>MEN_CLEAR_CONTAINER</source>
             <translation>Clear</translation>
@@ -996,10 +1034,22 @@ Please, refer to the documentation.</translation>
             <source>MEN_EXPORT_TABLE</source>
             <translation>Export Table</translation>
         </message>
+        <message>
+            <source>MEN_FEATURE_EDGES</source>
+            <translation>Feature edges</translation>
+        </message>
+        <message>
+            <source>MEN_FEATURE_EDGES_DISABLE</source>
+            <translation>Disable feature edges</translation>
+        </message>
         <message>
             <source>MEN_FREE_SCALAR_BARS</source>
             <translation>Use Field Range</translation>
         </message>
+        <message>
+            <source>MEN_GAUSS_POINT_SELECTION</source>
+            <translation>Gauss Point Selection</translation>
+        </message>
         <message>
             <source>MEN_GLOBAL_SELECTION</source>
             <translation>Global Selection</translation>
@@ -1088,6 +1138,10 @@ Please, refer to the documentation.</translation>
             <source>MEN_PLOT_3D</source>
             <translation>Plot3D</translation>
         </message>
+        <message>
+            <source>MEN_POINT_SELECTION</source>
+            <translation>Point Selection</translation>
+        </message>
         <message>
             <source>MEN_POINTS</source>
             <translation>Points</translation>
@@ -1137,8 +1191,8 @@ Please, refer to the documentation.</translation>
             <translation>Selection</translation>
         </message>
         <message>
-            <source>MEN_SELECTION_INFO</source>
-            <translation>Selection Info...</translation>
+            <source>MEN_SELECTION_PANEL</source>
+            <translation>Selection Panel</translation>
         </message>
         <message>
             <source>MEN_SHADING</source>
@@ -1197,16 +1251,14 @@ Please, refer to the documentation.</translation>
             <translation>Wireframe</translation>
         </message>
         <message>
-            <source>TOOL_IMPORT</source>
-            <translation>Import Toolbar</translation>
+            <source>MEN_FILTER_SCALARS</source>
+            <translation>Filter by scalars...</translation>
         </message>
-        <message>
-            <source>TOOL_REPRESENTATION</source>
-            <translation>Representation Toolbar</translation>
-        </message>
-        <message>
-            <source>TOOL_VISUALISATION</source>
-            <translation>Visualization Toolbar</translation>
+        <message><source>TOOL_IMPORT</source><translation>Import</translation></message>
+        <message><source>TOOL_REPRESENTATION</source><translation>Representation</translation></message>
+        <message><source>TOOL_SELECTION</source><translation>Selection</translation></message>
+        <message><source>TOOL_NAVIGATION</source><translation>Navigation</translation></message>
+        <message><source>TOOL_VISUALISATION</source><translation>Visualization</translation>
         </message>
         <message>
             <source>USE_BUILD_PROGRESS</source>
@@ -1371,37 +1423,6 @@ Please, refer to the documentation.</translation>
             <translation>Elapsed time : </translation>
         </message>
     </context>
-    <context>
-        <name>VisuGUI_CacheDlg</name>
-        <message>
-            <source>CACHE_TITLE</source>
-            <translation>Cache properties</translation>
-        </message>
-        <message>
-            <source>FREE</source>
-            <translation>Free</translation>
-        </message>
-        <message>
-            <source>LIMITED_MEMORY</source>
-            <translation>Limited memory</translation>
-        </message>
-        <message>
-            <source>MEMORY STATE</source>
-            <translation>Memory state</translation>
-        </message>
-        <message>
-            <source>MEMORY_MODE</source>
-            <translation>Memory mode</translation>
-        </message>
-        <message>
-            <source>MINIMAL_MEMORY</source>
-            <translation>Minimal memory</translation>
-        </message>
-        <message>
-            <source>USED_BY_CACHE</source>
-            <translation>Used by cache</translation>
-        </message>
-    </context>
     <context>
         <name>VisuGUI_ClippingDlg</name>
         <message>
@@ -1525,6 +1546,22 @@ Please, refer to the documentation.</translation>
             <translation>Impossible to use given clipping planes because of VTK restrictions.
 Please, provide non-empty resulting presentation.</translation>
         </message>
+        <message>
+            <source>GRP_TYPE</source>
+            <translation>Type of plane</translation>
+        </message>
+        <message>
+            <source>GLOBAL_BTN</source>
+            <translation>Global planes</translation>
+        </message>
+        <message>
+            <source>LOCAL_BTN</source>
+            <translation>Local planes</translation>
+        </message>
+        <message>
+            <source>GRP_VIEWER_PLANES</source>
+            <translation>Planes defined in viewer</translation>
+        </message>
     </context>
     <context>
         <name>VisuGUI_CubeAxesDlg</name>
@@ -1779,6 +1816,41 @@ Please, provide non-empty resulting presentation.</translation>
             <translation>Table</translation>
         </message>
     </context>
+    <context>
+        <name>VisuGUI_FeatureEdgesPanel</name>
+        <message>
+            <source>WINDOW_TITLE</source>
+            <translation>Feature edges</translation>
+        </message>
+        <message>
+            <source>FEATURE_EDGES_ANGLE</source>
+            <translation>Feature edges angle</translation>
+        </message>
+        <message>
+            <source>FEATURE_EDGES_COLORING</source>
+            <translation>Coloring</translation>
+        </message>
+        <message>
+            <source>FEATURE_EDGES_PROPERTIES</source>
+            <translation>Feature edges properties</translation>
+        </message>
+        <message>
+            <source>SHOW_BOUNDARY_EDGES</source>
+            <translation>Show boundary edges</translation>
+        </message>
+        <message>
+            <source>SHOW_FEATURE_EDGES</source>
+            <translation>Show feature edges</translation>
+        </message>
+        <message>
+            <source>SHOW_MANIFOLD_EDGES</source>
+            <translation>Show manifold edges</translation>
+        </message>
+        <message>
+            <source>SHOW_NON_MANIFOLD_EDGES</source>
+            <translation>Show non-manifold edges</translation>
+        </message>
+    </context>
     <context>
         <name>VisuGUI_FileDlg</name>
         <message>
@@ -1786,6 +1858,33 @@ Please, provide non-empty resulting presentation.</translation>
             <translation>Full loading for current file</translation>
         </message>
     </context>
+    <context>
+        <name>VisuGUI_FindPane</name>
+        <message>
+            <source>BETWEEN</source>
+            <translation>Between</translation>
+        </message>
+        <message>
+            <source>CONDITION</source>
+            <translation>Where scalar value is:</translation>
+        </message>
+        <message>
+            <source>FIND_TITLE</source>
+            <translation>Find</translation>
+        </message>
+        <message>
+            <source>INCORRECT_VALUES</source>
+            <translation>Input values are incorrect</translation>
+        </message>
+        <message>
+            <source>MAXIMUM</source>
+            <translation>Maximum</translation>
+        </message>
+        <message>
+            <source>MINIMUM</source>
+            <translation>Minimum</translation>
+        </message>
+    </context>
     <context>
         <name>VisuGUI_FontWg</name>
         <message>
@@ -1956,7 +2055,7 @@ Please, provide non-empty resulting presentation.</translation>
         </message>
         <message>
             <source>LOGARITHMIC_SCALING</source>
-            <translation>Logarithmic scaling</translation>
+            <translation>Logarithmic</translation>
         </message>
         <message>
             <source>ORIENTATION_GRP</source>
@@ -1972,17 +2071,55 @@ Please, provide non-empty resulting presentation.</translation>
         </message>
         <message>
             <source>SAVE_DEFAULT_CHK</source>
-            <translation>Save as default values</translation>
+            <translation>Save as default</translation>
         </message>
         <message>
             <source>SCALAR_RANGE_GRP</source>
-            <translation>Scalar range</translation>
+            <translation>Scalar range:</translation>
         </message>
         <message>
             <source>VERTICAL_BTN</source>
             <translation>Vertical</translation>
         </message>
     </context>
+    <context>
+        <name>VisuGUI_GaussPointsSelectionPane</name>
+        <message>
+            <source>DISPLAY_PARENT_MESH</source>
+            <translation>Display parent mesh element</translation>
+        </message>
+        <message>
+            <source>PICKING_DLG_TITLE</source>
+            <translation>Picking</translation>
+        </message>
+        <message>
+            <source>DATA_POSITION</source>
+            <translation>Position</translation>
+        </message>
+        <message>
+            <source>PARENT_ELEMENT</source>
+            <translation>Parent ID:</translation>
+        </message>
+        <message>
+            <source>PARENT_ELEMENT_TIP</source>
+            <translation>Parent mesh element ID</translation>
+        </message>
+        <message>
+            <source>LOCAL_POINT</source>
+            <translation>Local ID:</translation>
+        </message>
+        <message>
+            <source>LOCAL_POINT_TIP</source>
+            <translation>Local Gauss Point ID</translation>
+        </message>
+    </context>
+    <context>
+        <name>VisuGUI_InputPanel</name>
+        <message>
+            <source>WINDOW_TITLE</source>
+            <translation>Input Panel</translation>
+        </message>
+    </context>
     <context>
         <name>VisuGUI_InputPane</name>
         <message>
@@ -2183,7 +2320,7 @@ Please, provide non-empty resulting presentation.</translation>
         </message>
         <message>
             <source>TOOL_VISUALISATION</source>
-            <translation>Visualization Toolbar</translation>
+            <translation>Visualization</translation>
         </message>
         <message>
             <source>TOT_DESK_FILE_SAVE_GUI_STATE</source>
@@ -2381,6 +2518,10 @@ Please, provide non-empty resulting presentation.</translation>
             <source>VISU_PICKING_PREF_CAMERA_GROUP_TTL</source>
             <translation>Movement of the camera</translation>
         </message>
+        <message>
+            <source>VISU_PICKING_PREF_CAMERA_MOVEMENT</source>
+            <translation>Enable movement of the camera</translation>
+        </message>
         <message>
             <source>VISU_PICKING_PREF_CURSOR_GROUP_TTL</source>
             <translation>Cursor</translation>
@@ -2393,6 +2534,10 @@ Please, provide non-empty resulting presentation.</translation>
             <source>VISU_PICKING_PREF_DISPLAY_PARENT_MESH</source>
             <translation>Display parent mesh element</translation>
         </message>
+        <message>
+            <source>VISU_PICKING_PREF_INFO_WINDOW</source>
+            <translation>Enable information window</translation>
+        </message>
         <message>
             <source>VISU_PICKING_PREF_INFO_WINDOW_GROUP_TTL</source>
             <translation>Information window</translation>
@@ -2439,7 +2584,7 @@ Please, provide non-empty resulting presentation.</translation>
         </message>
         <message>
             <source>VISU_PICKING_PREF_ZOOM_FACTOR</source>
-            <translation>Zoom at first selected point (ratio)</translation>
+            <translation>Zoom factor</translation>
         </message>
         <message>
             <source>VISU_RECORDER_PREF_ALL_DISLPAYED_FRAMES</source>
@@ -2729,7 +2874,15 @@ Please, provide non-empty resulting presentation.</translation>
         </message>
         <message>
             <source>LBL_SHOW_PREVIEW</source>
-            <translation>Show preview</translation>
+            <translation>Preview</translation>
+        </message>
+        <message>
+            <source>SHOW_DISTRIBUTION</source>
+            <translation>Show distribution</translation>
+        </message>
+        <message>
+            <source>FILTER_BY_SCALARS</source>
+            <translation>Filter by scalars</translation>
         </message>
         <message>
             <source>LBL_WIDTH</source>
@@ -2745,7 +2898,7 @@ Please, provide non-empty resulting presentation.</translation>
         </message>
         <message>
             <source>LOGARITHMIC_SCALING</source>
-            <translation>Logarithmic scaling</translation>
+            <translation>Logarithmic</translation>
         </message>
         <message>
             <source>MSG_MINMAX_VALUES</source>
@@ -2761,11 +2914,11 @@ Please, provide non-empty resulting presentation.</translation>
         </message>
         <message>
             <source>SAVE_DEFAULT_CHK</source>
-            <translation>Save as default values</translation>
+            <translation>Save as default</translation>
         </message>
         <message>
             <source>SCALAR_RANGE_GRP</source>
-            <translation>Scalar range</translation>
+            <translation>Scalar range:</translation>
         </message>
         <message>
             <source>VERTICAL_BTN</source>
@@ -2834,32 +2987,50 @@ Please, provide non-empty resulting presentation.</translation>
             <translation>Do you want to choose all items with the same units for vertical axis?</translation>
         </message>
     </context>
+    <context>
+        <name>VisuGUI_Sweep</name>
+
+        <message><source>TITLE</source><translation>Sweep</translation></message>
+        <message><source>MEN_SWEEP_PANE</source><translation>Sweep</translation></message>
+
+        <message><source>NAVIGATION_TAB</source><translation>Navigation</translation></message>
+        <message><source>START_SWEEP_POSITION</source><translation>0 %</translation></message>
+        <message><source>END_SWEEP_POSITION</source><translation>100 %</translation></message>
+        <message><source>IS_CYCLED</source><translation>Cycled</translation></message>
+
+        <message><source>PROPERTIES_TAB</source><translation>Properties</translation></message>
+
+        <message><source>MODE</source><translation>Mode:</translation></message>
+        <message><source>LINEAR</source><translation>Linear</translation></message>
+        <message><source>COSINUSOIDAL</source><translation>1 - cos( t ) / 2</translation></message>
+        <message><source>SINUSOIDAL</source><translation>sin( t - Pi / 2 )</translation></message>
+
+        <message><source>NUMBER_OF_STEPS</source><translation>Number Steps:</translation></message>
+
+        <message><source>INTERVAL</source><translation>Interval</translation></message>
+        <message><source>[ 0, +PI ]</source><translation>[ 0, +PI ]</translation></message>
+        <message><source>[ -PI, +PI ]</source><translation>[ -PI, +PI ]</translation></message>
+
+        <message><source>DELAY_BETWEEN_STEPS</source><translation>Step Delay [ sec ]:</translation></message>
+    </context>
     <context>
         <name>VisuGUI_Slider</name>
-        <message>
-            <source>AVI</source>
-            <translation>AVI</translation>
-        </message>
-        <message>
-            <source>CACHE_MEMORY</source>
-            <translation>Cache:</translation>
-        </message>
-        <message>
-            <source>FREE_MEMORY</source>
-            <translation>Free:</translation>
-        </message>
-        <message>
-            <source>MORE</source>
-            <translation>More...</translation>
-        </message>
-        <message>
-            <source>SPEED</source>
-            <translation>Speed:</translation>
-        </message>
-        <message>
-            <source>TOOLBAR_TITLE</source>
-            <translation>Slider</translation>
-        </message>
+
+        <message><source>TITLE</source><translation>Slider</translation></message>
+        <message><source>MEN_SLIDER_PANE</source><translation>Slider</translation></message>
+
+        <message><source>NAVIGATION_TAB</source><translation>Navigation</translation></message>
+        <message><source>IS_CYCLED</source><translation>Cycled</translation></message>
+
+        <message><source>PROPERTIES_TAB</source><translation>Properties</translation></message>
+        <message><source>MINIMAL_MEMORY</source><translation>Minimal</translation></message>
+        <message><source>LIMITED_MEMORY</source><translation>Limited</translation></message>
+        <message><source>MEMORY_UNITS</source><translation>Mb</translation></message>
+
+        <message><source>USED_BY_CACHE</source><translation>Used:</translation></message>
+        <message><source>AVAILABLE_MEMORY</source><translation>Free:</translation></message>
+
+        <message><source>SPEED</source><translation>Speed</translation></message>
     </context>
     <context>
         <name>VisuGUI_StreamLinesDlg</name>
@@ -3147,15 +3318,19 @@ Please, refer to the documentation.</translation>
         </message>
     </context>
     <context>
-        <name>VisuGUI_SelectionDlg</name>
+        <name>VisuGUI_SelectionPanel</name>
         <message>
             <source>WINDOW_TITLE</source>
-            <translation>Data on elements</translation>
+            <translation>Selection</translation>
         </message>
         <message>
             <source>MODE_TITLE</source>
             <translation>Selection</translation>
         </message>
+       <message>
+            <source>MODE_GAUSS_POINT</source>
+            <translation>Gauss point</translation>
+        </message>
        <message>
             <source>MODE_POINT</source>
             <translation>Point</translation>
@@ -3192,6 +3367,14 @@ Please, refer to the documentation.</translation>
            <source>DATA_VECTOR_LBL</source>
             <translation>Vector Value:</translation>
         </message>
+       <message>
+           <source>DATA_SCALAR_HDR</source>
+            <translation>Scalar</translation>
+        </message>
+       <message>
+           <source>DATA_VECTOR_HDR</source>
+            <translation>Vector</translation>
+        </message>
         <message>
            <source>POINT_COORD_TITLE</source>
             <translation>Coordinates</translation>
@@ -3204,14 +3387,6 @@ Please, refer to the documentation.</translation>
            <source>CELL_DATA_ID_LBL</source>
             <translation>ID:</translation>
         </message>
-       <message>
-           <source>CELL_DATA_SCALAR_HDR</source>
-            <translation>Scalar</translation>
-        </message>
-       <message>
-           <source>CELL_DATA_VECTOR_HDR</source>
-            <translation>Vector</translation>
-        </message>
        <message>
            <source>ACTOR_DATA_POSITION_TITLE</source>
             <translation>Position</translation>
@@ -3220,6 +3395,77 @@ Please, refer to the documentation.</translation>
            <source>ACTOR_DATA_SIZE_TITLE</source>
             <translation>Size</translation>
         </message>
+        <message>
+            <source>SELECTION_PREFERENCES</source>
+            <translation>Selection preferences...</translation>
+        </message>
+    </context>
+    <context>
+        <name>VisuGUI_SelectionPrefDlg</name>
+        <message>
+            <source>TLT_SELECTION_PREFERENCES</source>
+            <translation>Selection preferences</translation>
+        </message>
+        <message>
+            <source>BELOW_POINT</source>
+            <translation>Centered</translation>
+        </message>
+        <message>
+            <source>CAMERA_TITLE</source>
+            <translation>Movement of the camera</translation>
+        </message>
+        <message>
+            <source>CURSOR_SIZE</source>
+            <translation>Size of the cursor:</translation>
+        </message>
+        <message>
+            <source>CURSOR_TITLE</source>
+            <translation>Cursor</translation>
+        </message>
+        <message>
+            <source>INFO_WINDOW_TITLE</source>
+            <translation>Information window</translation>
+        </message>
+        <message>
+            <source>POINT_TOLERANCE</source>
+            <translation>Point tolerance:</translation>
+        </message>
+        <message>
+            <source>POSITION</source>
+            <translation>Position:</translation>
+        </message>
+        <message>
+            <source>PYRAMID_HEIGHT</source>
+            <translation>Height of the pyramids:</translation>
+        </message>
+        <message>
+            <source>SELECTION_COLOR</source>
+            <translation>Selection cursor color:</translation>
+        </message>
+        <message>
+            <source>STEP_NUMBER</source>
+            <translation>Number of steps:</translation>
+        </message>
+        <message>
+            <source>STEP_NUMBER_TIP</source>
+            <translation>Number of steps between two positions</translation>
+        </message>
+        <message>
+            <source>TOLERANCE_TITLE</source>
+            <translation>Tolerance</translation>
+        </message>
+        <message>
+            <source>TOP_LEFT_CORNER</source>
+            <translation>Top-left corner</translation>
+        </message>
+        <message>
+            <source>TRANSPARENCY</source>
+            <translation>Transparency:</translation>
+        </message>
+        <message>
+            <source>ZOOM_FACTOR</source>
+            <translation>Zoom factor:</translation>
+        </message>
     </context>
     <context>
         <name>VisuGUI_BarPrefDlg</name>
@@ -3428,4 +3674,227 @@ Please, refer to the documentation.</translation>
             <translation>MED version</translation>
         </message>
     </context>
+    <context>
+        <name>VisuGUI_ClippingPlaneMgr</name>
+        <message>
+            <source>TITLE</source>
+            <translation>Clipping planes configuration</translation>
+        </message>
+        <message>
+            <source>TITLE_PLANES</source>
+            <translation>Planes definition</translation>
+        </message>
+        <message>
+            <source>LBL_NAME</source>
+            <translation>Name of the plane</translation>
+        </message>
+        <message>
+            <source>BYVECTOR_TITLE</source>
+            <translation>Normal vector</translation>
+        </message>
+        <message>
+            <source>BYPLANE_TITLE</source>
+            <translation>Main plane</translation>
+        </message>
+        <message>
+            <source>CHK_AUTOAPPLY</source>
+            <translation>Auto apply</translation>
+        </message>
+        <message>
+            <source>CHK_SHOW_PREVIEW</source>
+            <translation>Show preview</translation>
+        </message>
+        <message>
+            <source>ORIGIN_TITLE</source>
+            <translation>Origin</translation>
+        </message>
+        <message>
+            <source>DIRECTION_TITLE</source>
+            <translation>Direction</translation>
+        </message>
+        <message>
+            <source>LBL_ORIENTATION</source>
+            <translation>Orientation</translation>
+        </message>
+        <message>
+            <source>LBL_DISTANCE</source>
+            <translation>Distance</translation>
+        </message>
+        <message>
+            <source>LBL_ROTATION</source>
+            <translation>Rotation around %1</translation>
+        </message>
+        <message>
+            <source>BTN_NEW</source>
+            <translation>New</translation>
+        </message>
+        <message>
+            <source>BTN_DELETE</source>
+            <translation>Delete</translation>
+        </message>
+        <message>
+            <source>BTN_IMPORT</source>
+            <translation>Import...</translation>
+        </message>
+        <message>
+            <source>IMPORT_TITLE</source>
+            <translation>Import from...</translation>
+        </message>
+        <message>
+            <source>SELECT_VIEW</source>
+            <translation>Select View window:</translation>
+        </message>
+    </context>
+    <context>
+        <name>VisuGUI_SegmentationMgr</name>
+        <message>
+            <source>MNU_CLIPPING_PLANE_MGR</source>
+            <translation>Clipping planes</translation>
+        </message>
+        <message>
+            <source>DSK_CLIPPING_PLANE_MGR</source>
+            <translation>Manage clipping planes in the viewer</translation>
+        </message>
+        <message>
+            <source>VISU_VIEW_TOOLBAR</source>
+            <translation>VISU tools</translation>
+        </message>
+        <message>
+            <source>VISU_SETPLANES_MNU</source>
+            <translation>Set clipping plane...</translation>
+        </message>
+        <message>
+            <source>MNU_SHOW_CLIPPINGPLANES</source>
+            <translation>Show clipping planes</translation>
+        </message>
+        <message>
+            <source>DSK_SHOW_CLIPPINGPLANES</source>
+            <translation>Show/Hide clipping planes</translation>
+        </message>
+        <message>
+            <source>MNU_ACTIVATE_CLIPPINGPLANES</source>
+            <translation>Deactivate clipping planes</translation>
+        </message>
+        <message>
+            <source>DSK_ACTIVATE_CLIPPINGPLANES</source>
+            <translation>Activate/Deactivate clipping planes</translation>
+        </message>
+    </context>
+    <context>
+        <name>VisuGUI_ClippingPanel</name>
+        <message>
+            <source>TITLE</source>
+            <translation>Clipping Planes</translation>
+        </message>
+        <message>
+            <source>PRESENTATIONS_LBL</source>
+            <translation>Presentations:</translation>
+        </message>
+        <message>
+            <source>PLANES_LBL</source>
+            <translation>Associated planes:</translation>
+        </message>
+        <message>
+            <source>NEW_BTN</source>
+            <translation>New...</translation>
+        </message>
+        <message>
+            <source>EDIT_BTN</source>
+            <translation>Edit...</translation>
+        </message>
+        <message>
+            <source>DELETE_BTN</source>
+            <translation>Delete</translation>
+        </message>
+        <message>
+            <source>TIT_DELETE_PLANE</source>
+            <translation>Delete clipping plane</translation>
+        </message>
+        <message>
+            <source>MSG_DELETE_PLANE</source>
+            <translation>Clipping plane %1 will be deleted. Continue?</translation>
+        </message>
+        <message>
+            <source>CHK_SHOW_PLANES</source>
+            <translation>Show planes preview</translation>
+        </message>
+        <message>
+            <source>CHK_ACTIVATE_PLANES</source>
+            <translation>Deactivate planes</translation>
+        </message>
+        <message>
+            <source>CHK_AUTO_APPLY</source>
+            <translation>Auto apply</translation>
+        </message>
+         <message>
+            <source>PLANES_TABLE_TITLES</source>
+            <translation>Plane,Active</translation>
+        </message>
+   </context>
+    <context>
+        <name>VisuGUI_ClippingPlaneDlg</name>
+        <message>
+            <source>TITLE</source>
+            <translation>Clipping plane edit</translation>
+        </message>
+       <message>
+            <source>LBL_NAME</source>
+            <translation>Name of the plane</translation>
+        </message>
+        <message>
+            <source>BYVECTOR_TITLE</source>
+            <translation>Normal vector</translation>
+        </message>
+        <message>
+            <source>BYPLANE_TITLE</source>
+            <translation>Main plane</translation>
+        </message>
+        <message>
+            <source>CHK_AUTOAPPLY</source>
+            <translation>Global</translation>
+        </message>
+        <message>
+            <source>CHK_SHOW_PREVIEW</source>
+            <translation>Show preview</translation>
+        </message>
+        <message>
+            <source>ORIGIN_TITLE</source>
+            <translation>Origin</translation>
+        </message>
+        <message>
+            <source>DIRECTION_TITLE</source>
+            <translation>Direction</translation>
+        </message>
+        <message>
+            <source>LBL_ORIENTATION</source>
+            <translation>Orientation</translation>
+        </message>
+        <message>
+            <source>LBL_DISTANCE</source>
+            <translation>Distance</translation>
+        </message>
+        <message>
+            <source>LBL_ROTATION</source>
+            <translation>Rotation around %1</translation>
+        </message>
+    </context>
+    <context>
+        <name>VisuGUI_FilterScalarsDlg</name>
+        <message>
+            <source>TITLE</source>
+            <translation>Filtering by scalars</translation>
+        </message>
+        <message>
+            <source>BOXTITLE</source>
+            <translation>Filter by scalar range</translation>
+        </message>
+        <message>
+            <source>MINLBL</source>
+            <translation>Min:</translation>
+        </message>
+        <message>
+            <source>MAXLBL</source>
+            <translation>Max:</translation>
+        </message>
+    </context>
 </TS>
index cbdad67eccf2dcf9920566940ce83854f5b81529..d93fc6185b0e20d83e85d65d5739a702a3e696a7 100644 (file)
@@ -63,6 +63,7 @@
 #include "SVTK_ViewWindow.h"
 #include "SVTK_ViewModel.h"
 #include "SVTK_Functor.h"
+//#include "SVTK_MainWindow.h"
 
 #include "SPlot2d_ViewModel.h"
 #include "VisuGUI_SetupPlot2dDlg.h"
 #include "VisuGUI_Prs3dTools.h"
 #include "VisuGUI_Tools.h"
 
-#include "VisuGUI_PopupTools.h"
+#include "VisuGUI_SelectionPanel.h"
+#include "VisuGUI_FeatureEdgesPanel.h"
 #include "VisuGUI_NameDlg.h"
 #include "VisuGUI_CursorDlg.h"
 #include "VisuGUI_Selection.h"
 #include "VisuGUI_TransparencyDlg.h"
 #include "VisuGUI_CacheDlg.h"
 #include "VisuGUI_Table3dDlg.h"
+#include "VisuGUI_ClippingPanel.h"
+#include "VisuGUI_FilterScalarsDlg.h"
 
 #include "VISU_ScalarMap_i.hh"
 #include "VisuGUI_ScalarBarDlg.h"
 
 #include "VisuGUI_Timer.h"
 
-#include "VVTK_ViewModel.h"
+//#include "VVTK_ViewModel.h"
+
+#include "VisuGUI_Slider.h"
+#include "VisuGUI_Sweep.h"
+
 
 using namespace VISU;
 
@@ -174,11 +182,12 @@ static int MYDEBUG = 0;
 VisuGUI
 ::VisuGUI():
   SalomeApp_Module( "VISU" ),
-  myDisplayer( 0 )
+  myDisplayer( 0 ),
+  mySlider( NULL ),
+  mySweep( NULL )
 {
 }
 
-
 VisuGUI
 ::~VisuGUI()
 {
@@ -189,6 +198,7 @@ VisuGUI
 ::OnImportFromFile()
 {
   if(MYDEBUG) MESSAGE("VisuGUI::OnImportFromFile()");
+
   if ( CheckLock(GetCStudy(GetAppStudy(this)),GetDesktop(this)) )
     return;
 
@@ -683,7 +693,9 @@ VisuGUI
   SVTK_ViewWindow* aViewWindow = GetViewWindow<SVTK_Viewer>(this);
 
   // create mesh presentation and display it in aViewWindow
-  CreateMesh(this, anIO, aViewWindow);
+  VISU::Mesh_i* aPrs = CreateMesh(this, anIO, aViewWindow);
+  if (aPrs)
+    emit presentationCreated(aPrs);
 }
 
 void
@@ -708,7 +720,9 @@ VisuGUI
       return;
 
     // create mesh presentation and display it in aViewWindow
-    CreateMesh(this, anIO, aViewWindow);
+    VISU::Mesh_i* aPrs = CreateMesh(this, anIO, aViewWindow);
+    if (aPrs)
+      emit presentationCreated(aPrs);
   }
 }
 
@@ -716,7 +730,9 @@ void
 VisuGUI
 ::OnCreateScalarMap()
 {
-  CreatePrs3d<VISU::ScalarMap_i,VisuGUI_ScalarBarDlg,1>(this);
+  Prs3d_i* aPrs = CreatePrs3d<VISU::ScalarMap_i,VisuGUI_ScalarBarDlg,1>(this);
+  if (aPrs)
+    emit presentationCreated(aPrs);
 }
 
 
@@ -724,56 +740,73 @@ void
 VisuGUI
 ::OnCreateDeformedShape()
 {
-  CreatePrs3d<VISU::DeformedShape_i,VisuGUI_DeformedShapeDlg,1>(this);
+  //  CreatePrs3d<VISU::DeformedShape_i,VisuGUI_DeformedShapeDlg,1>(this);
+  Prs3d_i* aPrs = VisuGUI_DeformedShapeDlg::CreatePrs3d(this);
+  if (aPrs)
+    emit presentationCreated(aPrs);
 }
 
 void
 VisuGUI
 ::OnCreateDeformedShapeAndScalarMap()
 {
-  CreatePrs3d<VISU::DeformedShapeAndScalarMap_i,VisuGUI_DeformedShapeAndScalarMapDlg,1>(this);
+  Prs3d_i* aPrs = CreatePrs3d<VISU::ScalarMapOnDeformedShape_i,VisuGUI_ScalarMapOnDeformedShapeDlg,1>(this);
+  if (aPrs)
+    emit presentationCreated(aPrs);
 }
 
 void
 VisuGUI
 ::OnCreateVectors()
 {
-  CreatePrs3d<VISU::Vectors_i,VisuGUI_VectorsDlg,1>(this);
+  Prs3d_i* aPrs = CreatePrs3d<VISU::Vectors_i,VisuGUI_VectorsDlg,1>(this);
+  if (aPrs)
+    emit presentationCreated(aPrs);
 }
 
 void
 VisuGUI
 ::OnCreateIsoSurfaces()
 {
-  CreatePrs3d<VISU::IsoSurfaces_i,VisuGUI_IsoSurfacesDlg,1>(this);
+  Prs3d_i* aPrs = CreatePrs3d<VISU::IsoSurfaces_i,VisuGUI_IsoSurfacesDlg,1>(this);
+  if (aPrs)
+    emit presentationCreated(aPrs);
 }
 
 void
 VisuGUI
 ::OnCreateCutPlanes()
 {
-  CreatePrs3d<VISU::CutPlanes_i,VisuGUI_CutPlanesDlg,0>(this);
+  Prs3d_i* aPrs = CreatePrs3d<VISU::CutPlanes_i,VisuGUI_CutPlanesDlg,0>(this);
+  if (aPrs)
+    emit presentationCreated(aPrs);
 }
 
 void
 VisuGUI
 ::OnCreateCutLines()
 {
-  CreatePrs3d<VISU::CutLines_i,VisuGUI_CutLinesDlg,0>(this);
+  Prs3d_i* aPrs = CreatePrs3d<VISU::CutLines_i,VisuGUI_CutLinesDlg,0>(this);
+  if (aPrs)
+    emit presentationCreated(aPrs);
 }
 
 void
 VisuGUI
 ::OnCreateStreamLines()
 {
-  CreatePrs3d<VISU::StreamLines_i,VisuGUI_StreamLinesDlg,1>(this);
+  Prs3d_i* aPrs = CreatePrs3d<VISU::StreamLines_i,VisuGUI_StreamLinesDlg,1>(this);
+  if (aPrs)
+    emit presentationCreated(aPrs);
 }
 
 void
 VisuGUI
 ::OnCreatePlot3D()
 {
-  CreatePrs3d<VISU::Plot3D_i,VisuGUI_Plot3DDlg,0>(this);
+  Prs3d_i* aPrs = CreatePrs3d<VISU::Plot3D_i,VisuGUI_Plot3DDlg,0>(this);
+  if (aPrs)
+    emit presentationCreated(aPrs);
 }
 
 void
@@ -1053,6 +1086,14 @@ VisuGUI
   ChangeRepresentation(this, VISU::SHRINK);
 }
 
+//----------------------------------------------------------------------------
+void
+VisuGUI
+::OnMakeFeatureEdges()
+{
+  ChangeRepresentation(this, VISU::FEATURE_EDGES);
+}
+
 //----------------------------------------------------------------------------
 void
 VisuGUI
@@ -1070,36 +1111,6 @@ VisuGUI
 }
 
 
-namespace
-{
-  //----------------------------------------------------------------------------
-  bool
-  GetPrs3dSelectionInfo(const SalomeApp_Module* theModule,
-                       VISU::Prs3d_i*& thePrs3d,
-                       SVTK_ViewWindow*& theViewWindow,
-                       VISU_Actor*& thenActor)
-  {
-    VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(theModule);
-    if(aSelectionInfo.empty())
-      return false;
-
-    VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
-    thePrs3d = GetPrs3dFromBase(aSelectionItem.myObjectInfo.myBase);
-    if(!thePrs3d)
-      return false;
-
-    theViewWindow = GetActiveViewWindow<SVTK_ViewWindow>(theModule);
-    if(!theViewWindow)
-      return false;
-
-    thenActor = FindActor(theViewWindow, thePrs3d);
-    if(!thenActor)
-      return false;
-
-    return true;
-  }
-}
-
 //----------------------------------------------------------------------------
 void
 VisuGUI
@@ -1372,6 +1383,7 @@ VisuGUI
   for (i = 0; i < nbSelected; i++) {
     VISU::TObjectInfo anObjectInfo = GetObjectByEntry(GetAppStudy(this), anEntries[i]);
     if(_PTR(SObject) aSObject = anObjectInfo.mySObject){
+      emit beforeObjectDelete(QString(aSObject->GetID().c_str()));
       _PTR(SObject) aRefSObject;
       if (aSObject->ReferencedObject(aRefSObject)) {
        // It can be a reference on curve, published under a container.
@@ -1785,7 +1797,6 @@ VisuGUI
           }
 
           UpdateObjBrowser(this, false);
-
           QApplication::restoreOverrideCursor();
         }
       }
@@ -1812,65 +1823,8 @@ void
 VisuGUI
 ::OnSweep()
 {
-  VISU_Actor* anActor = NULL;
-  VISU::Prs3d_i* aPrs3d = NULL;
-  SVTK_ViewWindow* aViewWindow = NULL;
-  if(!GetPrs3dSelectionInfo(this, aPrs3d, aViewWindow, anActor))
-    return;
-
-  VISU::ScalarMap_i* aScalarMap = dynamic_cast<VISU::ScalarMap_i*>(aPrs3d);
-  if(!aScalarMap)
-    return;
-
-  if(!anActor->GetVisibility())
-    anActor->VisibilityOn();
-
-  // Get sweep parameters
-  SUIT_ResourceMgr* aResourceMgr = GetResourceMgr();
-
-  double aTempoDbl = aResourceMgr->doubleValue("VISU", "sweeping_time_step", 0.1);
-  int aTemp = int(1.E6 * aTempoDbl);
-
-  int aCycles = aResourceMgr->integerValue("VISU", "sweeping_number_cycles", 1);
-  int aSteps  = aResourceMgr->integerValue("VISU", "sweeping_number_steps", 40);
-
-  int aMode = aResourceMgr->integerValue("VISU", "sweeping_modes", 0);
-
-  int is2Pi = aResourceMgr->integerValue("VISU", "sweeping_is2PI", 0);
-
-  // Sweep
-  QApplication::setOverrideCursor(Qt::WaitCursor);
-
-  for (int j = 0; j < aCycles; j++) {
-    for (int i = 0; i <= aSteps; i++) {
-      try {
-        float aPercents;
-       float aT;
-       if( aMode >= 1 )
-         aT = ( is2Pi == 1 ? -PI + 2. * PI * float(i)/aSteps : PI * float(i)/aSteps );
-        if( aMode == 1 ){  //if selected Periodic cosinusoidal mode of sweeping
-          //This is necessary in order for animation to return to the initial picture
-         aPercents = (1.-cos( aT ))/2.;
-        }
-        else if( aMode == 2 ){  //if selected Periodic sinusoidal mode of sweeping
-          //This is necessary in order for animation to return to the initial picture
-         aPercents = sin( aT - PI/2 );
-        }
-        else //if selected Linear mode of sweeping
-          aPercents = float(i)/aSteps;
-        aScalarMap->SetMapScale(aPercents);
-        aScalarMap->UpdateActor(anActor);
-        aViewWindow->getRenderWindow()->Render();
-        aViewWindow->Repaint();
-        usleep(aTemp);
-      } catch (std::exception& exc) {
-        INFOS("Follow exception was occured :\n" << exc.what());
-      } catch (...) {
-        INFOS("Unknown exception was occured!");
-      }
-    }
-  }
-  QApplication::restoreOverrideCursor();
+  mySweep->toggleViewAction()->setChecked(true);
+  mySweep->onPlay(true);
 }
 
 //----------------------------------------------------------------------------
@@ -2012,16 +1966,68 @@ VisuGUI
 //----------------------------------------------------------------------------
 void
 VisuGUI
-::OnSelectionInfo()
+::OnToggleSelectionPanel()
 {
   if (GetActiveViewWindow<SVTK_ViewWindow>(this))
-    (new VisuGUI_SelectionDlg(this))->show();
+  {
+    if( myPanels.find( SelectionPanelId ) != myPanels.end() )
+    {
+      if( VisuGUI_SelectionPanel* aSelectionPanel =
+         dynamic_cast<VisuGUI_SelectionPanel*>( myPanels[ SelectionPanelId ] ) )
+      {
+       if( aSelectionPanel->isVisible() )
+         aSelectionPanel->hide();
+       else
+         aSelectionPanel->show();
+      }
+    }
+  }
   else
     SUIT_MessageBox::warning(GetDesktop(this),
                              tr("WRN_VISU"),
                              tr("ERR_ACTIVATE_VIEW3D") );
 }
 
+//----------------------------------------------------------------------------
+void
+VisuGUI
+::OnSwitchSelectionMode()
+{
+  QAction* anAction = dynamic_cast<QAction*>( sender() );
+  if( !anAction )
+    return;
+
+  bool isAnyChecked = false;
+  for( int anId = VISU_ACTOR_SELECTION; anId <= VISU_GAUSS_POINT_SELECTION; anId++ )
+  {
+    QAction* aRefAction = action( anId );
+    isAnyChecked |= aRefAction->isChecked();
+    if( anAction != aRefAction )
+      aRefAction->setChecked( false );
+    else if( myPanels.find( SelectionPanelId ) != myPanels.end() )
+    {
+      if( VisuGUI_SelectionPanel* aSelectionPanel =
+         dynamic_cast<VisuGUI_SelectionPanel*>( myPanels[ SelectionPanelId ] ) )
+       aSelectionPanel->setSelectionMode( anId - VISU_ACTOR_SELECTION );
+    }
+  }
+  // At least one action must be checked
+  if( !isAnyChecked )
+    anAction->setChecked( true );
+}
+
+//----------------------------------------------------------------------------
+void
+VisuGUI
+::OnSwitchSelectionMode( int theId )
+{
+  for( int anId = VISU_ACTOR_SELECTION; anId <= VISU_GAUSS_POINT_SELECTION; anId++ )
+  {
+    QAction* aRefAction = action( anId );
+    aRefAction->setChecked( anId == VISU_ACTOR_SELECTION + theId );
+  }
+}
+
 //----------------------------------------------------------------------------
 void
 VisuGUI
@@ -2150,10 +2156,18 @@ VisuGUI
 {
   SalomeApp_Module::initialize( theApp );
 
+  mySlider = new VisuGUI_Slider( this, getApp()->desktop(), getApp()->selectionMgr() );
+
+  mySweep = new VisuGUI_Sweep( this, getApp()->desktop(), getApp()->selectionMgr() );
+
   createActions();
   createMenus();
   createToolBars();
   createPopupMenus();
+  createPanels();
+
+  // tmp
+  action( VISU_ACTOR_SELECTION )->setChecked( true );
 }
 
 void
@@ -2363,6 +2377,10 @@ VisuGUI
                 tr("MEN_UNSHRINK"), "", 0, aParent, false,
                 this, SLOT(OnMakeShrink()));
 
+  createAction( VISU_FEATURE_EDGES, tr("MEN_FEATURE_EDGES"), QIcon(),
+                tr("MEN_FEATURE_EDGES"), "", 0, aParent, false,
+                this, SLOT(OnMakeFeatureEdges()));
+
   createAction( VISU_SHADING, tr("MEN_SHADING"), QIcon(),
                 tr("MEN_SHADING"), "", 0, aParent, false,
                 this, SLOT(OnSetShadingOn()));
@@ -2441,10 +2459,6 @@ VisuGUI
                 tr("MEN_CLIPPING"), "", 0, aParent, false,
                 this, SLOT(OnClippingPlanes()));
 
-  createAction( VISU_SELECTION_INFO, tr("MEN_SELECTION_INFO"), QIcon(),
-                tr("MEN_SELECTION_INFO"), "", 0, aParent, false,
-                this, SLOT(OnSelectionInfo()));
-
   aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_TIMEANIMATION"));
   createAction( VISU_PARALLELANIMATION, tr("MEN_PARALLEL_ANIMATION"), QIcon(aPixmap),
                 tr("MEN_PARALLEL_ANIMATION"), "", 0, aParent, false,
@@ -2460,15 +2474,34 @@ VisuGUI
                 tr("MEN_ERASE_ALL"), "", 0, aParent, false,
                 this, SLOT(OnEraseAll()));
 
-  aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_GLOBAL_SELECTION"));
-  createAction( VISU_GLOBAL_SELECTION, tr("MEN_GLOBAL_SELECTION"), QIcon(aPixmap),
-                tr("MEN_GLOBAL_SELECTION"), "", 0, aParent, false,
-                this);
+  aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_SELECTION_PANEL"));
+  createAction( VISU_SELECTION_PANEL, tr("MEN_SELECTION_PANEL"), QIcon(aPixmap),
+                tr("MEN_SELECTION_PANEL"), "", 0, aParent, false,
+                this, SLOT(OnToggleSelectionPanel()));
+
+  aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_ACTOR_SELECTION"));
+  createAction( VISU_ACTOR_SELECTION, tr("MEN_ACTOR_SELECTION"), QIcon(aPixmap),
+                tr("MEN_ACTOR_SELECTION"), "", 0, aParent, true,
+                this, SLOT(OnSwitchSelectionMode()));
+
+  aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_CELL_SELECTION"));
+  createAction( VISU_CELL_SELECTION, tr("MEN_CELL_SELECTION"), QIcon(aPixmap),
+                tr("MEN_CELL_SELECTION"), "", 0, aParent, true,
+                this, SLOT(OnSwitchSelectionMode()));
 
-  aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_PARTIAL_SELECTION"));
-  createAction( VISU_PARTIAL_SELECTION, tr("MEN_PARTIAL_SELECTION"), QIcon(aPixmap),
-                tr("MEN_PARTIAL_SELECTION"), "", 0, aParent, false,
-                this);
+  aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_POINT_SELECTION"));
+  createAction( VISU_POINT_SELECTION, tr("MEN_POINT_SELECTION"), QIcon(aPixmap),
+                tr("MEN_POINT_SELECTION"), "", 0, aParent, true,
+                this, SLOT(OnSwitchSelectionMode()));
+
+  aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_GAUSS_POINT_SELECTION"));
+  createAction( VISU_GAUSS_POINT_SELECTION, tr("MEN_GAUSS_POINT_SELECTION"), QIcon(aPixmap),
+                tr("MEN_GAUSS_POINT_SELECTION"), "", 0, aParent, true,
+                this, SLOT(OnSwitchSelectionMode()));
+
+  // Defenition of the actions for the "Navigation" tool bar
+  registerAction( VISU_SLIDER_PANEL, mySlider->toggleViewAction() );
+  registerAction( VISU_SWEEP_PANEL, mySweep->toggleViewAction() );
 
   createAction( VISU_SHOW_ANIMATION, tr("MEN_SHOW_ANIMATION"), QIcon(),
                 tr("MEN_SHOW_ANIMATION"), "", 0, aParent, false,
@@ -2479,9 +2512,9 @@ VisuGUI
                 tr("MEN_PLOT3D_FROM_CUTPLANE"), "", 0, aParent, false,
                 this, SLOT(OnPlot3dFromCutPlane()));
 
-  createAction( VISU_CACHE_PROPERTIES, tr("MEN_CACHE_PROPERTIES"), QIcon(),
-                tr("MEN_CACHE_PROPERTIES"), "", 0, aParent, false,
-                this, SLOT(OnCacheProperties()));
+  createAction( VISU_MANAGE_CACHE, tr("MEN_MANAGE_CACHE"), QIcon(),
+                tr("MEN_MANAGE_CACHE"), "", 0, aParent, false,
+                this, SLOT( OnManageCache() ) );
 
   aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_MULTIPR_VIEW_FULL"));
   createAction( VISU_MULTIPR_FULL_RES, tr("MEN_MULTIPR_VIEW_FULL_RES"), QIcon(aPixmap),
@@ -2510,6 +2543,10 @@ VisuGUI
   createAction( VISU_EXPORT_MED, tr("MEN_EXPORT_MED"), QIcon(),
                 tr("MEN_EXPORT_MED"), "", 0, aParent, false,
                 this, SLOT(OnExportMED()));
+
+  createAction( VISU_FILTERSCALARS, tr("MEN_FILTER_SCALARS"), QIcon(),
+                tr("MEN_FILTER_SCALARS"), "", 0, aParent, false,
+                this, SLOT(OnFilterScalars()));
 }
 
 void
@@ -2536,9 +2573,6 @@ VisuGUI
   createMenu( VISU_PLOT_3D, aMenuId, 10 ); // Plot3d
   createMenu( VISU_DEFORMED_SHAPE_AND_SCALAR_MAP, aMenuId, 10 ); // scalar map on deformed shape
 
-  aMenuId = createMenu( tr( "MEN_SELECTION" ), -1, -1, 30 );
-  createMenu( VISU_SELECTION_INFO, aMenuId, 10 ); // selection info
-
   aMenuId = createMenu( tr( "MEN_REPRESENTATION" ), -1, -1, 30 );
   int parentId =
     createMenu( tr( "MEN_DISPLAY_SELECTION" ), aMenuId, 10 ); // display selection
@@ -2546,8 +2580,6 @@ VisuGUI
   createMenu( VISU_WIREFRAME, parentId, 10 ); //   wireframe
   createMenu( VISU_SURFACE, parentId, 10 ); //   surface
   createMenu( VISU_ERASE_ALL, aMenuId, 10 ); // erase all
-  createMenu( VISU_GLOBAL_SELECTION, aMenuId, 10 ); // global selection
-  createMenu( VISU_PARTIAL_SELECTION, aMenuId, 10 ); // partial selection
 }
 
 void
@@ -2573,8 +2605,19 @@ VisuGUI
   createTool( VISU_WIREFRAME, aToolId );
   createTool( VISU_SURFACE, aToolId );
   createTool( VISU_ERASE_ALL, aToolId );
-  createTool( VISU_GLOBAL_SELECTION, aToolId );
-  createTool( VISU_PARTIAL_SELECTION, aToolId );
+
+  aToolId = createTool(tr("TOOL_SELECTION"));
+  createTool( VISU_SELECTION_PANEL, aToolId );
+  createTool( separator(), aToolId );
+  createTool( VISU_ACTOR_SELECTION, aToolId );
+  createTool( VISU_CELL_SELECTION, aToolId );
+  createTool( VISU_POINT_SELECTION, aToolId );
+  createTool( VISU_GAUSS_POINT_SELECTION, aToolId );
+
+  aToolId = createTool( tr( "TOOL_NAVIGATION" ) );
+  createTool( VISU_SLIDER_PANEL, aToolId );
+  createTool( separator(), aToolId );
+  createTool( VISU_SWEEP_PANEL, aToolId );
 }
 
 void
@@ -2620,6 +2663,8 @@ VisuGUI
   mgr->insert( action( VISU_EDIT_CONTAINER ), -1, -1, -1 );
   mgr->insert( action( VISU_EDIT_POINTMAP3D ), -1, -1, -1 );
 
+  mgr->insert( action( VISU_FILTERSCALARS ), -1, -1, -1 );
+
   // rename
   mgr->insert( action( VISU_RENAME ), -1, -1, -1 );
 
@@ -2647,6 +2692,7 @@ VisuGUI
   mgr->insert( action( VISU_SURFACE )     , parentId, -1, -1 ); // surface
   mgr->insert( action( VISU_INSIDEFRAME ) , parentId, -1, -1 ); // insideframe
   mgr->insert( action( VISU_SURFACEFRAME ), parentId, -1, -1 ); // surfaceframe
+  mgr->insert( action( VISU_FEATURE_EDGES ), parentId, -1, -1 ); // feature edges
   mgr->insert( action( VISU_SHRINK )      , parentId, -1, -1 ); // shrink
   mgr->insert( action( VISU_UNSHRINK )    , parentId, -1, -1 ); // unshrink
   mgr->insert( separator(), parentId, -1, -1 );
@@ -2686,8 +2732,6 @@ VisuGUI
 
   mgr->insert( action( VISU_CURVE_PROPS ), -1, -1, -1 ); // curve properties
 
-  mgr->insert( action( VISU_SELECTION_INFO ), -1, -1, -1 ); // Selection info
-
   mgr->insert( action( VISU_MULTIPR_FULL_RES ), -1, -1, -1 );
   mgr->insert( action( VISU_MULTIPR_MED_RES ), -1, -1, -1 );
   mgr->insert( action( VISU_MULTIPR_LOW_RES ), -1, -1, -1 );
@@ -2701,6 +2745,9 @@ VisuGUI
   QString aPrsAll ("'VISU::TSCALARMAP' 'VISU::TISOSURFACES' 'VISU::TDEFORMEDSHAPE' 'VISU::TCUTPLANES' "
                    "'VISU::TCUTLINES' 'VISU::TVECTORS' 'VISU::TSTREAMLINES' 'VISU::TPLOT3D' "
                   "'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP' 'VISU::TCOLOREDPRS3DHOLDER'");
+  QString aSimplePrsAll ("'VISU::TSCALARMAP' 'VISU::TISOSURFACES' 'VISU::TDEFORMEDSHAPE' 'VISU::TCUTPLANES' "
+                        "'VISU::TCUTLINES' 'VISU::TVECTORS' 'VISU::TSTREAMLINES' 'VISU::TPLOT3D' "
+                        "'VISU::TSCALARMAPONDEFORMEDSHAPE'");
 
   // VISU root commands
   QString aRule = "client='ObjectBrowser' and selcount=1 and type='VISU::TVISUGEN'";
@@ -2751,6 +2798,9 @@ VisuGUI
   mgr->setRule( action( VISU_MERGE_SCALAR_BARS ), aRule );
   mgr->setRule( action( VISU_FREE_SCALAR_BARS ), aRule );
 
+  aRule = "selcount=1 and $type in { " + aSimplePrsAll + "}";
+  mgr->setRule( action( VISU_FILTERSCALARS ), aRule );
+
   // view parameters
   aRule = "selcount=1 and type='VISU::TVIEW3D' and activeView='VTKViewer'";
   mgr->setRule( action( VISU_SAVE_VIEW_PARAMS_1 ), aRule );
@@ -2758,34 +2808,40 @@ VisuGUI
   mgr->setRule( action( VISU_RESTORE_VIEW_PARAMS ), "selcount=1 and type='VISU::TVIEW3D' and activeView='VTKViewer'" );
   //mgr->setRule( action( VISU_DELETE_VIEW_PARAMS ), "selcount=1 and type='VISU::TVIEW3D'", true );
 
-  mgr->setRule( action( VISU_ARRANGE_ACTORS ), "$client in {'VTKViewer' 'VVTK'} and selcount=0" );
+  mgr->setRule( action( VISU_ARRANGE_ACTORS ), "$client in {'VTKViewer' 'SVTK'} and selcount=0" );
 
   // 3D presentations commands
-  QString aPrsType    = " and $type in {'VISU::TMESH'" + aPrsAll + "}";
+  QString aPrsType    = " and $type in {'VISU::TMESH' 'VISU::TGAUSSPOINTS' " + aPrsAll + "}";
   QString aPrsType2    = " and $type in {'VISU::TMESH' 'VISU::TPOINTMAP3D'" + aPrsAll + "}";
   QString anInsideType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TDEFORMEDSHAPE' 'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP'}";
   QString aSurfFrameType   = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP''VISU::TDEFORMEDSHAPE' 'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP'}";
+  //QString aPrsType    = " and $type in {'VISU::TMESH' " + aPrsAll + "}";
   QString aSurfType   = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TSCALARMAP' 'VISU::TISOSURFACES' 'VISU::TDEFORMEDSHAPE' 'VISU::TCUTPLANES' "
                         " 'VISU::TPLOT3D' 'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP' 'VISU::TPOINTMAP3D'}";
   QString aShrinkType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TDEFORMEDSHAPE' 'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP' 'VISU::TPOINTMAP3D'}";
   QString aLineType   = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TSCALARMAP' 'VISU::TISOSURFACES' 'VISU::TDEFORMEDSHAPE' "
                         "'VISU::TCUTPLANES' 'VISU::TCUTLINES' 'VISU::TSTREAMLINES' 'VISU::TPLOT3D' 'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP' 'VISU::TPOINTMAP3D'}";
 
+  QString aFeatureEdgesType =  " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP''VISU::TDEFORMEDSHAPE' 'VISU::TSCALARMAPONDEFORMEDSHAPE'}";
+
   aRule = "selcount=1";
   mgr->setRule( action( VISU_CLIPPING ), aRule + aPrsType );
+  aPrsType = " and $type in {'VISU::TMESH' " + aPrsAll + "}";
 
   // "Representation" submenu
-  QString aNotPoints = " and $representation in {'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::INSIDEFRAME' 'VISU::SURFACEFRAME'}";
-  QString aNotWirefr = " and $representation in {'VISU::POINT' 'VISU::SHADED' 'VISU::INSIDEFRAME' 'VISU::SURFACEFRAME'}";
-  QString aNotSurfac = " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::INSIDEFRAME' 'VISU::SURFACEFRAME'}";
-  QString aNotInside = " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::SURFACEFRAME'}";
-  QString aNotSurffr = " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::INSIDEFRAME'}";
+  QString aNotPoints = " and $representation in {'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::INSIDEFRAME' 'VISU::SURFACEFRAME' 'VISU::FEATURE_EDGES'}";
+  QString aNotWirefr = " and $representation in {'VISU::POINT' 'VISU::SHADED' 'VISU::INSIDEFRAME' 'VISU::SURFACEFRAME' 'VISU::FEATURE_EDGES'}";
+  QString aNotSurfac = " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::INSIDEFRAME' 'VISU::SURFACEFRAME' 'VISU::FEATURE_EDGES'}";
+  QString aNotInside = " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::SURFACEFRAME' 'VISU::FEATURE_EDGES'}";
+  QString aNotSurffr = " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::INSIDEFRAME' 'VISU::FEATURE_EDGES'}";
+  QString aNotFeatureEdges =  " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::INSIDEFRAME' 'VISU::SURFACEFRAME'}";
 
   mgr->setRule( action( VISU_POINTS )      , aRule + aPrsType + aNotPoints );
   mgr->setRule( action( VISU_WIREFRAME )   , aRule + aPrsType2 + aNotWirefr );
   mgr->setRule( action( VISU_SURFACE )     , aRule + aSurfType + aNotSurfac );
   mgr->setRule( action( VISU_INSIDEFRAME ) , aRule + anInsideType + aNotInside );
   mgr->setRule( action( VISU_SURFACEFRAME ), aRule + aSurfFrameType + aNotSurffr );
+  mgr->setRule( action( VISU_FEATURE_EDGES ), aRule + aFeatureEdgesType + aNotFeatureEdges );
 
   mgr->setRule( action( VISU_SHRINK )  , aRule + aShrinkType + " and isShrunk=0" );
   mgr->setRule( action( VISU_UNSHRINK ), aRule + aShrinkType + " and isShrunk=1" );
@@ -2851,23 +2907,19 @@ VisuGUI
   aRule = "selcount=1 and type='VISU::TCUTLINES' and nbNamedChildren=0";
   mgr->setRule( action( VISU_CREATE_TABLE ), aRule );
 
-  aRule = "selcount=1 and ($type in {" + aPrsAll + "})";
+  aRule = "client='VTKViewer' and selcount=1 and ($type in {" + aSimplePrsAll + "})";
   mgr->setRule( action( VISU_SWEEP ), aRule );
 
-  // "Selection info" popup item
-  aRule = "client='VTKViewer' and selcount=1" + anInsideType;
-  mgr->setRule( action( VISU_SELECTION_INFO ), aRule );
-
   aRule = "client='ObjectBrowser' and selcount>0";
   aRule += " and $type in {'VISU::TFIELD'}";
   aRule += " and nbTimeStamps>1";
-  aRule += " and activeView in {'VTKViewer' 'VVTK'}";
+  aRule += " and activeView in {'VTKViewer' 'SVTK'}";
   mgr->setRule( action( VISU_PARALLELANIMATION ), aRule );
 
   aRule = "client='ObjectBrowser' and selcount>0";
   aRule += " and $type in {'VISU::TFIELD'}";
   aRule += " and nbTimeStamps>0";
-  aRule += " and activeView in {'VTKViewer' 'VVTK'}";
+  aRule += " and activeView in {'VTKViewer' 'SVTK'}";
   mgr->setRule( action( VISU_SUCCCESSIVEANIMATION ), aRule );
 
   aRule = "client='ObjectBrowser' and $type in {'VISU::TENTITY' 'VISU::TFAMILY' 'VISU::TGROUP'}";
@@ -2901,6 +2953,23 @@ VisuGUI
   mgr->setRule( action( VISU_EXPORT_MED ), "selcount=1 and type in {'VISU::TRESULT'}" );
 }
 
+void VisuGUI::createPanels()
+{
+  myPanels.insert( SelectionPanelId,    new VisuGUI_SelectionPanel( this ) );
+  myPanels.insert( FeatureEdgesPanelId, new VisuGUI_FeatureEdgesPanel( this ) );
+  myPanels.insert( ClippingPlanesPanelId, new VisuGUI_ClippingPanel( this ) );
+
+  QMap< PanelId, VisuGUI_Panel* >::iterator it = myPanels.begin(), itEnd = myPanels.end();
+  for( ; it != itEnd; ++it )
+  {
+    if( VisuGUI_Panel* aPanel = it.value() )
+    {
+      aPanel->hide();
+      GetDesktop(this)->addDockWidget( Qt::RightDockWidgetArea, aPanel );
+    }
+  }
+}
+
 //***************************************************************************
 void VisuGUI::contextMenuPopup( const QString& theClient, QMenu* theMenu, QString& theTitle )
 {
@@ -2999,7 +3068,7 @@ void VisuGUI::contextMenuPopup( const QString& theClient, QMenu* theMenu, QStrin
 
   if(VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase){
     if(aBase->GetType() == VISU::TCOLOREDPRS3DCACHE)
-      theMenu->addAction( action( VISU_CACHE_PROPERTIES ) );
+      theMenu->addAction( action( VISU_MANAGE_CACHE ) );
   }
 
   theMenu->addSeparator();
@@ -3079,10 +3148,10 @@ VisuGUI
 {
   theList.clear();
   // append SVTK viewer only if there is no opened VVTK
-  SUIT_ViewManager* vm = getApp()->getViewManager( VVTK_Viewer::Type(), false );
-  if( vm && vm->getViewsCount()>0 )
-    theList.append( VVTK_Viewer::Type() );
-  else
+//   SUIT_ViewManager* vm = getApp()->getViewManager( VVTK_Viewer::Type(), false );
+//   if( vm && vm->getViewsCount()>0 )
+//     theList.append( VVTK_Viewer::Type() );
+//   else
     theList.append( SVTK_Viewer::Type() );
 }
 
@@ -3100,7 +3169,8 @@ bool
 VisuGUI
 ::activateModule( SUIT_Study* theStudy )
 {
-  SalomeApp_Module::activateModule( theStudy );
+  bool aResult = SalomeApp_Module::activateModule( theStudy );
+
   studyActivated();
   setMenuShown( true );
   setToolShown( true );
@@ -3113,7 +3183,11 @@ VisuGUI
   action(VISU_DELETE_OBJS)->setEnabled(true); // Delete: Key_Delete
   action(VISU_RENAME     )->setEnabled(true); // Rename: Key_F2
 
-  return true;
+  ((VisuGUI_ClippingPanel*) myPanels[ClippingPlanesPanelId])->init();
+
+  emit moduleActivated();
+
+  return aResult;
 }
 
 
@@ -3124,14 +3198,24 @@ VisuGUI
   setMenuShown( false );
   setToolShown( false );
 
+  QMap< PanelId, VisuGUI_Panel* >::iterator it = myPanels.begin(), itEnd = myPanels.end();
+  for( ; it != itEnd; ++it )
+  {
+    if( VisuGUI_Panel* aPanel = it.value() )
+      aPanel->hide();
+  }
+
   // Unset actions accelerator keys
   action(VISU_IMPORT_FROM_FILE)->setShortcuts(QKeySequence::UnknownKey); // Import: CTRL + Key_I
 
   action(VISU_DELETE_OBJS)->setEnabled(false); // Delete: Key_Delete
   action(VISU_RENAME     )->setEnabled(false); // Rename: Key_F2
 
-  SalomeApp_Module::deactivateModule( theStudy );
-  return true;
+  bool aResult = SalomeApp_Module::deactivateModule( theStudy );
+  
+  emit moduleDeactivated();
+
+  return aResult;
 }
 
 LightApp_Selection*
@@ -3145,6 +3229,7 @@ VisuGUI
 void VisuGUI::studyActivated()
 {
   GetVisuGen(this)->SetCurrentStudy(GetDSStudy(GetCStudy(GetAppStudy(this))));
+  
 }
 
 /*
@@ -3410,58 +3495,88 @@ void VisuGUI::createPreferences()
   addPreference( tr( "Generate data table" ), cutLineGr, LightApp_Preferences::Bool, "VISU", "generate_data_table" );
   addPreference( tr( "Generate curves" ), cutLineGr, LightApp_Preferences::Bool, "VISU", "generate_curves" );
 
-  // TAB: "Sweep, Animation"
-  int srangeTab = addPreference( tr( "Sweep, Animation" ) );
-
-  // group: "Sweeping preferences"
-  int sweepGr = addPreference( tr( "VISU_SWEEPING_PREF" ), srangeTab );
-  setPreferenceProperty( sweepGr, "columns", 2 );
-
-  int modeSw = addPreference( tr( "VISU_SWEEPING_MODES" ), sweepGr, LightApp_Preferences::Selector, "VISU", "sweeping_modes" );
-  QStringList sweep_modes;
-  sweep_modes.append( tr( "VISU_LINEAR_SWEEP" ) );
-  sweep_modes.append( tr( "VISU_COS_SWEEP" ) );
-  sweep_modes.append( tr( "VISU_SIN_SWEEP" ) );
-  indices.clear();
-  indices.append( 0 );
-  indices.append( 1 );
-  indices.append( 2 );
-  setPreferenceProperty( modeSw, "strings", sweep_modes );
-  setPreferenceProperty( modeSw, "indexes", indices );
-
-  int timestep   = addPreference( tr( "VISU_TIME_STEP" ), sweepGr,
-                                  LightApp_Preferences::DblSpin, "VISU", "sweeping_time_step" );
-  int nbcycles   = addPreference( tr( "VISU_NB_CYCLES" ), sweepGr,
-                                  LightApp_Preferences::IntSpin, "VISU", "sweeping_number_cycles" );
-  int nbsteps    = addPreference( tr( "VISU_NB_STEPS" ),  sweepGr,
-                                  LightApp_Preferences::IntSpin, "VISU", "sweeping_number_steps" );
-  int rangeSw = addPreference( tr( "VISU_IS2PI" ), sweepGr, LightApp_Preferences::Selector, "VISU", "sweeping_is2PI" );
-  QStringList ranges;
-  ranges.append( tr( "PERIOD_PI" ) );
-  ranges.append( tr( "PERIOD_2PI" ) );
-  indices.clear();
-  indices.append( 0 );
-  indices.append( 1 );
-  setPreferenceProperty( rangeSw, "strings", ranges );
-  setPreferenceProperty( rangeSw, "indexes", indices );
-
-  setPreferenceProperty( timestep, "min",  0.1 );
-  setPreferenceProperty( timestep, "step", 0.1 );
-  setPreferenceProperty( timestep, "max",  1000 );
-  setPreferenceProperty( nbcycles, "max",  100  );
-  setPreferenceProperty( nbsteps,  "max",  200  );
-
-  // group: "Animation preferences"
-  int animationGr = addPreference( tr( "Animation preferences" ), srangeTab );
-  setPreferenceProperty( animationGr, "columns", 3 );
+  // TAB: "Sweep, Animation, 3D Cache"
+  int animationTab = addPreference( tr( "Animation" ) );
+  {
+    // group: "3D Cache System prefereces"
+    {
+      int cacheGroup = addPreference( tr( "VISU_3DCACHE_PREFERENCES" ), animationTab );
+      setPreferenceProperty( cacheGroup, "columns", 2 );
+      
+      int memory_mode = addPreference( tr( "VISU_MEMORY_MODE" ), cacheGroup,
+                                      LightApp_Preferences::Selector, "VISU", "cache_memory_mode" );
+      
+      modes.clear();
+      modes.append( tr( "VISU_MINIMAL" ) );
+      modes.append( tr( "VISU_LIMITED" ) );
+      setPreferenceProperty( memory_mode, "strings", modes );
+      
+      indices.clear();
+      indices.append( 0 );
+      indices.append( 1 );
+      setPreferenceProperty( memory_mode, "indexes", indices );
+      
+      int memory_limit = addPreference( tr( "VISU_MEMORY_LIMIT" ), cacheGroup,
+                                       LightApp_Preferences::IntSpin, "VISU", "cache_memory_limit" );
+      setPreferenceProperty( memory_limit, "min", 1 );
+      setPreferenceProperty( memory_limit, "max", 5000 );
+      setPreferenceProperty( memory_limit, "step", 10 );
+    }
 
-  int speed = addPreference( tr( "Speed" ), animationGr, LightApp_Preferences::IntSpin, "VISU", "speed" );
-  addPreference( tr( "Cycled animation" ), animationGr, LightApp_Preferences::Bool, "VISU", "cycled_animation" );
-  addPreference( tr( "Use proportional timing" ), animationGr, LightApp_Preferences::Bool, "VISU", "use_proportional_timing" );
-  addPreference( tr( "Clean memory at each frame" ), animationGr, LightApp_Preferences::Bool, "VISU", "clean_memory_at_each_frame" );
+    // group: "Animation preferences"
+    {
+      int animationGroup = addPreference( tr( "VISU_ANIMATION_PREFERENCES" ), animationTab );
+      setPreferenceProperty( animationGroup, "columns", 3 );
+      
+      int speed = addPreference( tr( "Speed" ), animationGroup, LightApp_Preferences::IntSpin, "VISU", "speed" );
+      addPreference( tr( "Cycled animation" ), animationGroup, LightApp_Preferences::Bool, "VISU", "cycled_animation" );
+      addPreference( tr( "Use proportional timing" ), animationGroup, LightApp_Preferences::Bool, "VISU", "use_proportional_timing" );
+      addPreference( tr( "Clean memory at each frame" ), animationGroup, LightApp_Preferences::Bool, "VISU", "clean_memory_at_each_frame" );
+      
+      setPreferenceProperty( speed, "min", 1 );
+      setPreferenceProperty( speed, "max", 99 );
+    }
 
-  setPreferenceProperty( speed, "min", 1 );
-  setPreferenceProperty( speed, "max", 99 );
+    // group: "Sweeping preferences"
+    {
+      int sweepGroup = addPreference( tr( "VISU_SWEEPING_PREF" ), animationTab );
+      setPreferenceProperty( sweepGroup, "columns", 2 );
+      
+      int modeSw = addPreference( tr( "VISU_SWEEPING_MODES" ), sweepGroup, LightApp_Preferences::Selector, "VISU", "sweeping_modes" );
+      QStringList sweep_modes;
+      sweep_modes.append( tr( "VISU_LINEAR_SWEEP" ) );
+      sweep_modes.append( tr( "VISU_COS_SWEEP" ) );
+      sweep_modes.append( tr( "VISU_SIN_SWEEP" ) );
+      indices.clear();
+      indices.append( 0 );
+      indices.append( 1 );
+      indices.append( 2 );
+      setPreferenceProperty( modeSw, "strings", sweep_modes );
+      setPreferenceProperty( modeSw, "indexes", indices );
+      
+      int timestep   = addPreference( tr( "VISU_TIME_STEP" ), sweepGroup,
+                                     LightApp_Preferences::DblSpin, "VISU", "sweeping_time_step" );
+      int nbcycles   = addPreference( tr( "VISU_NB_CYCLES" ), sweepGroup,
+                                     LightApp_Preferences::IntSpin, "VISU", "sweeping_number_cycles" );
+      int nbsteps    = addPreference( tr( "VISU_NB_STEPS" ),  sweepGroup,
+                                     LightApp_Preferences::IntSpin, "VISU", "sweeping_number_steps" );
+      int rangeSw = addPreference( tr( "VISU_IS2PI" ), sweepGroup, LightApp_Preferences::Selector, "VISU", "sweeping_is2PI" );
+      QStringList ranges;
+      ranges.append( tr( "PERIOD_PI" ) );
+      ranges.append( tr( "PERIOD_2PI" ) );
+      indices.clear();
+      indices.append( 0 );
+      indices.append( 1 );
+      setPreferenceProperty( rangeSw, "strings", ranges );
+      setPreferenceProperty( rangeSw, "indexes", indices );
+      
+      setPreferenceProperty( timestep, "min",  0.1 );
+      setPreferenceProperty( timestep, "step", 0.1 );
+      setPreferenceProperty( timestep, "max",  1000 );
+      setPreferenceProperty( nbcycles, "max",  100  );
+      setPreferenceProperty( nbsteps,  "max",  200  );
+    }
+  }
 
   // TAB: Representation ; group: "Representation properties"
   int representationTab = addPreference( tr( "Representation" ) );
@@ -3475,16 +3590,23 @@ void VisuGUI::createPreferences()
   mesh_modes.append( "Insideframe" );
   mesh_modes.append( "Surfaceframe" );
   mesh_modes.append( "Surface" );
+  mesh_modes.append( "Feature edges" );
   QList<QVariant> mesh_indices;
   mesh_indices.append( 0 );
   mesh_indices.append( 1 );
   mesh_indices.append( 3 );
   mesh_indices.append( 4 );
   mesh_indices.append( 2 );
+  mesh_indices.append( 5 );
+
+  QStringList modes0 = mesh_modes;
+  modes0.removeAll( "Feature edges" );
+  QList<QVariant> indices0 = mesh_indices;
+  indices0.removeAll( 5 );
 
-  QStringList modes1 = mesh_modes;
+  QStringList modes1 = modes0;
   modes1.removeAll( "Insideframe" );
-  QList<QVariant> indices1 = mesh_indices;
+  QList<QVariant> indices1 = indices0;
   indices1.removeAll( 3 );
 
   QStringList modes2 = modes1;
@@ -3504,8 +3626,8 @@ void VisuGUI::createPreferences()
   addPreference( tr( "VISU_SHRINK" ), representGr, LightApp_Preferences::Bool, "VISU", "mesh_shrink" );
 
   int scalar_map_represent = addPreference( tr( "VISU_SCALAR_MAP" ), representGr, LightApp_Preferences::Selector, "VISU", "scalar_map_represent" );
-  setPreferenceProperty( scalar_map_represent, "strings", mesh_modes );
-  setPreferenceProperty( scalar_map_represent, "indexes", mesh_indices );
+  setPreferenceProperty( scalar_map_represent, "strings", modes0 );
+  setPreferenceProperty( scalar_map_represent, "indexes", indices0 );
   addPreference( tr( "VISU_SHRINK" ), representGr, LightApp_Preferences::Bool, "VISU", "scalar_map_shrink" );
 
   int iso_surfaces_represent = addPreference( tr( "VISU_ISO_SURFACES" ), representGr, LightApp_Preferences::Selector, "VISU", "iso_surfaces_represent" );
@@ -3528,8 +3650,8 @@ void VisuGUI::createPreferences()
   setPreferenceProperty( sp, "vstretch", 0 );
 
   int deformed_shape_represent = addPreference( tr( "VISU_DEFORMED_SHAPE" ), representGr, LightApp_Preferences::Selector, "VISU", "deformed_shape_represent" );
-  setPreferenceProperty( deformed_shape_represent, "strings", mesh_modes );
-  setPreferenceProperty( deformed_shape_represent, "indexes", mesh_indices );
+  setPreferenceProperty( deformed_shape_represent, "strings", modes0 );
+  setPreferenceProperty( deformed_shape_represent, "indexes", indices0 );
   addPreference( tr( "VISU_SHRINK" ), representGr, LightApp_Preferences::Bool, "VISU", "deformed_shape_shrink" );
 
   int vectors_represent = addPreference( tr( "VISU_VECTORS" ), representGr, LightApp_Preferences::Selector, "VISU", "vectors_represent" );
@@ -3576,30 +3698,23 @@ void VisuGUI::createPreferences()
   addPreference( tr( "VISU_AUTOMATIC_FIT_ALL" ), representGr,
                  LightApp_Preferences::Bool, "VISU", "automatic_fit_all" );
 
-  // TAB: 3D Cache ; group: "Cache properties"
-  int cacheTab = addPreference( tr( "3D Cache" ) );
-
-  int cacheGr = addPreference( tr( "VISU_3DCACHE_PROPS" ), cacheTab );
-  setPreferenceProperty( cacheGr, "columns", 2 );
-
-  int memory_mode = addPreference( tr( "VISU_MEMORY_MODE" ), cacheGr,
-                                  LightApp_Preferences::Selector, "VISU", "cache_memory_mode" );
+  // TAB: Feature edges ; group: "Feature edges properties"
+  int featureEdgesTab = addPreference( tr( "VISU_FEATURE_EDGES" ) );
 
-  modes.clear();
-  modes.append( tr( "VISU_MINIMAL" ) );
-  modes.append( tr( "VISU_LIMITED" ) );
-  setPreferenceProperty( memory_mode, "strings", modes );
+  int featureEdgesGr = addPreference( tr( "VISU_FEATURE_EDGES_PROPS" ), featureEdgesTab );
+  setPreferenceProperty( featureEdgesGr, "columns", 2 );
 
-  indices.clear();
-  indices.append( 0 );
-  indices.append( 1 );
-  setPreferenceProperty( memory_mode, "indexes", indices );
+  int featureEdgesAnglePref = addPreference( tr( "VISU_FEATURE_EDGES_ANGLE" ), featureEdgesGr,
+                                            LightApp_Preferences::DblSpin, "VISU", "feature_edges_angle" );
+  setPreferenceProperty( featureEdgesAnglePref, "step", 10.0 );
+  setPreferenceProperty( featureEdgesAnglePref, "min", 0.0 );
+  setPreferenceProperty( featureEdgesAnglePref, "max", 90.0 );
 
-  int memory_limit = addPreference( tr( "VISU_MEMORY_LIMIT" ), cacheGr,
-                                   LightApp_Preferences::IntSpin, "VISU", "cache_memory_limit" );
-  setPreferenceProperty( memory_limit, "min", 1 );
-  setPreferenceProperty( memory_limit, "max", 5000 );
-  setPreferenceProperty( memory_limit, "step", 10 );
+  addPreference( tr( "VISU_SHOW_FEATURE_EDGES" ), featureEdgesGr, LightApp_Preferences::Bool, "VISU", "show_feature_edges" );
+  addPreference( tr( "VISU_SHOW_BOUNDARY_EDGES" ), featureEdgesGr, LightApp_Preferences::Bool, "VISU", "show_boundary_edges" );
+  addPreference( tr( "VISU_SHOW_MANIFOLD_EDGES" ), featureEdgesGr, LightApp_Preferences::Bool, "VISU", "show_manifold_edges" );
+  addPreference( tr( "VISU_SHOW_NON_MANIFOLD_EDGES" ), featureEdgesGr, LightApp_Preferences::Bool, "VISU", "show_non_manifold_edges" );
+  //addPreference( tr( "VISU_FEATURE_EDGES_COLORING" ), featureEdgesGr, LightApp_Preferences::Bool, "VISU", "feature_edges_coloring" );
 }
 
 void VisuGUI::preferencesChanged( const QString& a, const QString& b)
@@ -3735,7 +3850,7 @@ void VisuGUI::OnPlot3dFromCutPlane()
    _PTR(SObject) aTimeStampSObj = aSObject->GetFather();
    if (SUIT_ViewManager* aViewManager = getApp()->activeViewManager()) {
      QString aViewType = aViewManager->getType();
-     bool anIsVVTK = (aViewType == VVTK_Viewer::Type());
+     //bool anIsVVTK = (aViewType == VVTK_Viewer::Type());
 
      Storable::TRestoringMap aRestoringMap = Storable::GetStorableMap(aTimeStampSObj);
      VISU::VISUType aType = VISU::Storable::RestoringMap2Type( aRestoringMap );
@@ -3749,13 +3864,13 @@ void VisuGUI::OnPlot3dFromCutPlane()
 
      int aPos;
      SUIT_ViewWindow* aViewWindow = 0;
-     if (anIsVVTK) {
-       aViewWindow = GetViewWindow<VVTK_Viewer>(this);
-       aPos = GetFreePositionOfDefaultScalarBar(this, dynamic_cast<VVTK_ViewWindow*>(aViewWindow));
-     } else {
+//      if (anIsVVTK) {
+//     aViewWindow = GetViewWindow<VVTK_Viewer>(this);
+//     aPos = GetFreePositionOfDefaultScalarBar(this, dynamic_cast<VVTK_ViewWindow*>(aViewWindow));
+//      } else {
        aViewWindow = GetViewWindow<SVTK_Viewer>(this);
        aPos = GetFreePositionOfDefaultScalarBar(this, dynamic_cast<SVTK_ViewWindow*>(GetViewWindow<SVTK_Viewer>(this)));
-     }
+       //     }
      GetResourceMgr()->setValue("VISU", "scalar_bar_position_num", aPos);
 
      VISU::Plot3D_i* aPrs3d =
@@ -3793,31 +3908,17 @@ void VisuGUI::OnPlot3dFromCutPlane()
 
          AddScalarBarPosition(this, aSVtkWindow, aPrs3d, aPos);
        }
+       if (aPrs3d)
+         emit presentationCreated(aPrs3d);
      }
    }
    application()->putInfo(QObject::tr("INF_DONE"));
  }
 }
 
-void VisuGUI::OnCacheProperties()
+void VisuGUI::OnManageCache()
 {
-  VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
-  if(aSelectionInfo.empty())
-    return;
-
-  VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
-  _PTR(SObject) aSObject = aSelectionItem.myObjectInfo.mySObject;
-
-  CORBA::Object_var anObject = VISU::ClientSObjectToObject(aSObject);
-  if( CORBA::is_nil( anObject ) )
-    return;
-
-  VISU::ColoredPrs3dCache_var aCache = VISU::GetInterface<VISU::ColoredPrs3dCache>(anObject);
-  if( CORBA::is_nil( aCache ) )
-    return;
-
-  VisuGUI_CacheDlg* aDlg = new VisuGUI_CacheDlg( aCache, this );
-  aDlg->exec();
+  mySlider->show();
 }
 
 
@@ -3960,3 +4061,9 @@ void VisuGUI::OnExportMED()
     aResult->ExportMED((const char*)aFile.toLatin1());
   }
 }
+
+void VisuGUI::OnFilterScalars()
+{
+  VisuGUI_FilterScalarsDlg* aDlg = new VisuGUI_FilterScalarsDlg( this );
+  aDlg->show();
+}
index 2325ddc12656345b7824a79546d35f5d1551b5da..0900c1a0d202523d65ee8c0620a81344ee8e6192 100644 (file)
 #ifndef VisuGUI_HeaderFile
 #define VisuGUI_HeaderFile
 
-#include <map>
-#include <set>
+#include <SalomeApp_Module.h>
 
-#include "SalomeApp_Module.h"
-
-#include "SALOME_ListIO.hxx"
-#include "VISU_Prs3d_i.hh"
-#include "SVTK_ViewWindow.h"
+#include <SVTK_ViewWindow.h>
+#include <VISU_Prs3d_i.hh>
 
+#include "VisuGUI_Panel.h"
 
+#include <map>
+#include <set>
 
 class SUIT_ViewManager;
-class SVTK_ViewWindow;
-class Prs3d_i;
+class VisuGUI_Slider;
+class VisuGUI_Sweep;
 
 namespace VISU
 {
+  class Prs3d_i;
   typedef std::pair<Prs3d_i*,int> TPrs3dToInd; // prs pointer and default index of scalar bar placement
   typedef std::set<TPrs3dToInd> TSetPrs3d;
   typedef std::map<SVTK_ViewWindow*,TSetPrs3d> TViewToPrs3d;
@@ -56,7 +56,11 @@ class VisuGUI: public SalomeApp_Module
   Q_OBJECT;
 
 public:
+  enum PanelId { SelectionPanelId = 0,
+                FeatureEdgesPanelId,
+                 ClippingPlanesPanelId };
 
+public:
   VisuGUI();
   virtual ~VisuGUI();
 
@@ -81,7 +85,13 @@ public:
 
   VISU::TViewToPrs3d&
   getScalarBarsMap();
-  
+
+signals:
+  void moduleDeactivated();
+  void moduleActivated();
+  void presentationCreated(VISU::Prs3d_i* thePrs);
+  void beforeObjectDelete(QString theEntry);
+
 public slots:
   virtual bool deactivateModule( SUIT_Study* );
   virtual bool activateModule( SUIT_Study* );
@@ -123,6 +133,10 @@ protected slots:
   virtual void OnErasePrs();
   //  virtual void OnEraseAll();
 
+  void OnToggleSelectionPanel();
+  void OnSwitchSelectionMode();
+  void OnSwitchSelectionMode( int );
+
   void OnMakeSurfaceframe();
   void OnMakeInsideframe();
   void OnMakeWireframe();
@@ -130,6 +144,8 @@ protected slots:
   void OnMakePoints();
   void OnMakeShrink();
 
+  void OnMakeFeatureEdges();
+
   void OnSetShadingOn();
   void OnSetShadingOff();
 
@@ -162,13 +178,13 @@ protected slots:
 
   void OnCopyPresentation();
 
-  void OnSelectionInfo();
-
   void OnTranslatePrs();
   void OnArrangeActors();
   void OnPlot3dFromCutPlane();
 
-  void OnCacheProperties();
+  void OnManageCache();
+
+  void OnFilterScalars();
 
   // MULTIPR
   void OnMultiprViewFullRes();
@@ -190,10 +206,15 @@ private:
   void createMenus();
   void createToolBars();
   void createPopupMenus();
+  void createPanels();
 
 private:
-  LightApp_Displayer* myDisplayer;
-  VISU::TViewToPrs3d myScalarBarsMap;
+  QMap< PanelId, VisuGUI_Panel* > myPanels;
+  VisuGUI_Slider*         mySlider;
+  VisuGUI_Sweep*          mySweep; 
+
+  LightApp_Displayer*     myDisplayer;
+  VISU::TViewToPrs3d      myScalarBarsMap;
 };
 
 #endif
index 13cb18dbee1517def33ee114d6f373695ead1538..21cdc5bf66fa9f3caf90ef32b3aa6025a6e90d65 100644 (file)
@@ -75,6 +75,9 @@
 #define VISU_SHRINK                 4055
 #define VISU_UNSHRINK               4056
 
+#define VISU_FEATURE_EDGES          4091
+#define VISU_FEATURE_EDGES_DISABLE  4092
+
 #define VISU_SHADING                4083
 #define VISU_NOSHADING              4084
 
 
 #define VISU_PLOT3D_FROM_CUTPLANE   4085
 
-#define VISU_CACHE_PROPERTIES       4090
+#define VISU_MANAGE_CACHE           4090
 
 // MULTIPR
 #define VISU_MULTIPR_FULL_RES       4095
 #define VISU_FILE_INFO              4100
 #define VISU_EXPORT_MED             4101
 
+#define VISU_SELECTION_PANEL        4102
+#define VISU_ACTOR_SELECTION        4103
+#define VISU_CELL_SELECTION         4104
+#define VISU_POINT_SELECTION        4105
+#define VISU_GAUSS_POINT_SELECTION  4106
+
+#define VISU_SLIDER_PANEL           4200
+#define VISU_SWEEP_PANEL            4300
+#define VISU_FILTERSCALARS          4301
+
 #endif
diff --git a/src/VISUGUI/VisuGUI_BasePanel.cxx b/src/VISUGUI/VisuGUI_BasePanel.cxx
new file mode 100755 (executable)
index 0000000..ed0dc30
--- /dev/null
@@ -0,0 +1,249 @@
+//  VISU VISUGUI : GUI of VISU component
+//
+//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+//
+//  File   : VisuGUI_BasePanel.cxx
+//  Author : Oleg Uvarov
+//  Module : VISU
+
+#include "VisuGUI_BasePanel.h"
+#include "VisuGUI_Tools.h"
+
+#include "SUIT_ResourceMgr.h"
+
+#include <QScrollArea>
+#include <QHBoxLayout>
+#include <QVBoxLayout>
+#include <QApplication>
+#include <QPushButton>
+//#include <QToolButton>
+
+/*!
+  \class MainFrame
+  \internal
+  \brief Frame inserted in viewport with redefined sizeHint method 
+         in order to avoid unreasonable increasing of viewport size
+*/
+class VisuGUI_BasePanel::MainFrame : public QFrame
+{
+public:
+  /*!
+    \brief Constructor.
+    \param theParent parent widget
+  */
+  MainFrame( QWidget* theParent = 0 )
+  : QFrame( theParent )
+  {
+  }
+  
+  /*!
+    \brief Gets frame size hint
+    \return frame size hint
+  */
+  virtual QSize sizeHint() const
+  {
+    return minimumSizeHint();
+  }
+};
+
+/*!
+  \class VisuGUI_BasePanel
+  \brief Base class for VISU interactive sub-panels.
+
+  Set of classes is derived from this class and are intended for representing widgets 
+  (GUI controls) for different operations. VisuGUI_BasePanel consists of main frame 
+  inserted in scroll view and four push buttons. So all widgets of derived sub-panels 
+  should be inherited from mainframe() instead of \93this\94 pointer.
+*/
+
+/*!
+  \brief Constructor creates panels look and feel
+  \param theName name of the panel
+  \param theParent parent widget
+*/
+VisuGUI_BasePanel::VisuGUI_BasePanel( const QString& theName, 
+                                     QWidget* theParent,
+                                      const int theBtns  )
+  : QGroupBox( theName, theParent ),
+    myOK( 0 ),
+    myApply( 0 ),
+    myClose( 0 ),
+    myHelp( 0 )
+{
+  // Create scroll view
+  myView = new QScrollArea( this );
+
+  // Create main frame
+  myMainFrame = new MainFrame( myView );
+  myMainFrame->setFrameStyle( QFrame::Plain | QFrame::NoFrame );
+  
+  myView->setWidget( myMainFrame );
+  myView->setAlignment( Qt::AlignCenter );
+  myView->setWidgetResizable( true );
+  myView->setMinimumWidth( myMainFrame->sizeHint().width() + 22 );
+  
+  // Create buttons
+  QWidget* aBtnWg = new QWidget( this );
+  QHBoxLayout* aBtnWgLayout = new QHBoxLayout( aBtnWg );
+  //aBtnWgLayout->setSpacing( 5 );
+
+  aBtnWgLayout->addStretch();
+
+  if( theBtns & OKBtn )
+  {
+    //myOK = new QToolButton( aBtnWg );
+    //myOK->setIcon( VISU::GetResourceMgr()->loadPixmap("VISU", tr( "ICON_OK" ) ) );
+    myOK = new QPushButton( tr( "BUT_OK" ), aBtnWg );
+    aBtnWgLayout->addWidget( myOK );
+    connect( myOK, SIGNAL( clicked() ), SLOT( onOK() ) );
+  }
+  if( theBtns & ApplyBtn )
+  {
+    //myApply = new QToolButton( aBtnWg );
+    //myApply->setIcon( VISU::GetResourceMgr()->loadPixmap("VISU", tr( "ICON_APPLY" ) ) );
+    myApply = new QPushButton( tr( "BUT_APPLY" ), aBtnWg );
+    aBtnWgLayout->addWidget( myApply );
+    connect( myApply, SIGNAL( clicked() ), SLOT( onApply() ) );
+  }
+  if( theBtns & CloseBtn )
+  {
+    //myClose = new QToolButton( aBtnWg );
+    //myClose->setIcon( VISU::GetResourceMgr()->loadPixmap("VISU", tr( "ICON_CLOSE" ) ) );
+    myClose = new QPushButton( tr( "BUT_CLOSE" ), aBtnWg );
+    aBtnWgLayout->addWidget( myClose );
+    connect( myClose, SIGNAL( clicked() ), SLOT( onClose() ) );
+  }
+  if( theBtns & HelpBtn )
+  {
+    //myHelp = new QToolButton( aBtnWg );
+    //myHelp->setIcon( VISU::GetResourceMgr()->loadPixmap("VISU", tr( "ICON_HELP" ) ) );
+    myHelp = new QPushButton( tr( "BUT_HELP" ), aBtnWg );
+    aBtnWgLayout->addWidget( myHelp );
+    connect( myHelp, SIGNAL( clicked() ), SLOT( onHelp() ) );
+  }
+
+  aBtnWgLayout->addStretch();
+
+  // fill layout
+  QVBoxLayout* aLay = new QVBoxLayout( this );
+  aLay->setContentsMargins( 0, 0, 0, 0 );
+  //aLay->setSpacing( 5 );
+  aLay->addWidget( myView, 1 );
+  aLay->addWidget( aBtnWg );
+}
+
+/*!
+  \brief Destructor
+*/
+VisuGUI_BasePanel::~VisuGUI_BasePanel()
+{
+}
+
+/*!
+  \brief Verifies validity of input data
+
+  This virtual method should be redefined in derived classes. Usually operator 
+  corresponding to the sub-panel calls this method to check validity of input 
+  data when Apply/OK button is pressed.
+
+  \param theErrMsg Error message. 
+  
+        If data is invalid when panel can return message using this parameter given 
+        clear explanation what is wrong
+
+  \return TRUE if data is valid, FALSE otherwise 
+*/
+bool VisuGUI_BasePanel::isValid( QString& /*theErrMsg*/ )
+{
+  return true;
+}
+/*!
+  \brief Virtual methods should be redefined in derived classes and 
+         clears all GUI controls
+*/
+void VisuGUI_BasePanel::clear()
+{
+}
+
+/*!
+  \brief Virtual slot called when \93OK\94 button pressed emits corresponding signal.
+
+  This slot moves focus in OK button before emitting signal. Mainly it provides 
+  application with correct moving data from currently edited controls to internal 
+  structure. For example QTable moves data from cell editor to table item when 
+  focus is out.
+
+*/
+void VisuGUI_BasePanel::onOK()
+{
+  if ( myOK )
+  {
+    myOK->setFocus();
+    qApp->processEvents();
+  }
+  emit bpOk();
+}
+
+/*!
+  \brief Virtual slot called when \93Apply\94 button pressed emits corresponding signal.
+  \sa onOK
+*/
+void VisuGUI_BasePanel::onApply()
+{
+  if ( myApply )
+  {
+    myApply->setFocus();
+    qApp->processEvents();
+  }
+  emit bpApply();
+}
+
+/*!
+  \brief Virtual slot called when \93Close\94 button pressed emits corresponding signal.
+  \sa onOK
+*/
+void VisuGUI_BasePanel::onClose()
+{
+  if ( myClose )
+    myClose->setFocus();
+  emit bpClose();
+}
+
+/*!
+  \brief Virtual slot called when \93Help\94 button pressed emits corresponding signal.
+  \sa onOK
+*/
+void VisuGUI_BasePanel::onHelp()
+{
+  if ( myHelp )
+    myHelp->setFocus();
+  emit bpHelp();
+}
+
+/*!
+  \brief Gets frame inserted in scroll view. All controls of derived 
+         panels should use it as parent
+  \return QFrame* object 
+*/
+QFrame* VisuGUI_BasePanel::mainFrame()
+{
+  return myMainFrame;
+}
diff --git a/src/VISUGUI/VisuGUI_BasePanel.h b/src/VISUGUI/VisuGUI_BasePanel.h
new file mode 100755 (executable)
index 0000000..775a942
--- /dev/null
@@ -0,0 +1,81 @@
+//  VISU VISUGUI : GUI of VISU component
+//
+//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+//
+//  File   : VisuGUI_BasePanel.cxx
+//  Author : Oleg Uvarov
+//  Module : VISU
+
+#ifndef VISUGUI_BASEPANEL_H
+#define VISUGUI_BASEPANEL_H
+
+#include <QGroupBox>
+
+class QScrollArea;
+class QPushButton;
+
+class VisuGUI_BasePanel : public QGroupBox
+{
+  Q_OBJECT
+
+  class MainFrame;
+
+public:
+  enum { OKBtn      = 0x0001,
+         ApplyBtn   = 0x0002,
+         CloseBtn   = 0x0004,
+         HelpBtn    = 0x0008, 
+         AllBtn = OKBtn | ApplyBtn | CloseBtn | HelpBtn
+  };
+
+public:
+  VisuGUI_BasePanel( const QString& theName, QWidget* theParent, const int theBtns = AllBtn ); 
+  virtual ~VisuGUI_BasePanel();
+
+  virtual bool              isValid( QString& theMessage );
+  virtual void              clear();
+
+signals:
+  void                      bpOk();
+  void                      bpApply();
+  void                      bpClose();
+  void                      bpHelp();
+
+protected slots:
+  virtual void              onOK();
+  virtual void              onApply();
+  virtual void              onClose();
+  virtual void              onHelp();
+
+protected:
+  QFrame*                   mainFrame();
+
+protected:
+  QScrollArea*              myView;
+  QFrame*                   myMainFrame;
+
+  QPushButton*              myOK;
+  QPushButton*              myApply;
+  QPushButton*              myClose;
+  QPushButton*              myHelp;
+};
+
+#endif
index 7dc9d39b96dbbbffb2e2aa4978cb2b61ab91bf5d..1a9dd664a9ea5988c483397fa77a142ff07c4193 100644 (file)
 #include "VISU_Result_i.hh"
 
 #include "VISU_PipeLine.hxx"
+#include "VISU_DataSetActor.h"
 
 #include "LightApp_SelectionMgr.h"
 #include "LightApp_Application.h"
 
 #include "SVTK_ViewWindow.h"
+#include <VTKViewer_Utilities.h>
 
 #include "SUIT_Session.h"
 #include "SUIT_Desktop.h"
@@ -41,6 +43,7 @@
 #include "SUIT_OverrideCursor.h"
 
 #include "SALOME_Actor.h"
+#include "VISU_ViewManager_i.hh"
 
 // QT Includes
 #include <QLabel>
 #include <QSpinBox>
 #include <QKeyEvent>
 #include <QPushButton>
+#include <QListWidget>
+#include <QVBoxLayout>
+#include <QHBoxLayout>
+#include <QStackedWidget>
 
 // VTK Includes
 #include <vtkMath.h>
@@ -67,6 +74,7 @@
 #include <vtkPolyData.h>
 #include <vtkUnstructuredGrid.h>
 #include <vtkProperty.h>
+#include <vtkImplicitFunctionCollection.h>
 
 // OCCT Includes
 #include <gp_Dir.hxx>
@@ -244,25 +252,31 @@ VisuGUI_ClippingDlg::VisuGUI_ClippingDlg (VisuGUI* theModule,
     mySelectionMgr(VISU::GetSelectionMgr(theModule)),
     myVisuGUI(theModule),
     myPrs3d(0),
-    myIsSelectPlane(false)
+    myIsSelectPlane(false),
+    myDSActor(0)
 {
   setWindowTitle(tr("TITLE"));
   setSizeGripEnabled(TRUE);
   setAttribute( Qt::WA_DeleteOnClose, true );
 
-  QGridLayout* VisuGUI_ClippingDlgLayout = new QGridLayout(this);
+  QVBoxLayout* VisuGUI_ClippingDlgLayout = new QVBoxLayout(this);
   VisuGUI_ClippingDlgLayout->setSpacing(6);
   VisuGUI_ClippingDlgLayout->setMargin(11);
+  
+  QStackedWidget* aStackWidget = new QStackedWidget(this);
+  VisuGUI_ClippingDlgLayout->addWidget(aStackWidget);
+  // Local planes
+  QWidget* aLocalPlanes = new QWidget(aStackWidget);
+  QVBoxLayout* aLocalLayout = new QVBoxLayout(aLocalPlanes);
+  aStackWidget->addWidget(aLocalPlanes);
 
   // Controls for selecting, creating, deleting planes
-  QGroupBox* GroupPlanes = new QGroupBox (tr("GRP_PLANES"),  this);
-  //GroupPlanes->setColumnLayout(0, Qt::Vertical);
-  //GroupPlanes->layout()->setSpacing(0);
-  //GroupPlanes->layout()->setMargin(0);
+  QGroupBox* GroupPlanes = new QGroupBox (tr("GRP_PLANES"),  aLocalPlanes);
   QGridLayout* GroupPlanesLayout = new QGridLayout (GroupPlanes);
   GroupPlanesLayout->setAlignment(Qt::AlignTop);
   GroupPlanesLayout->setSpacing(6);
   GroupPlanesLayout->setMargin(11);
+  aLocalLayout->addWidget(GroupPlanes);
 
   ComboBoxPlanes = new QComboBox (GroupPlanes);
   GroupPlanesLayout->addWidget(ComboBoxPlanes, 0, 0);
@@ -281,30 +295,38 @@ VisuGUI_ClippingDlg::VisuGUI_ClippingDlg (VisuGUI* theModule,
   // Controls for defining plane parameters
 
   // Tab pane
-  QGroupBox* GroupParameters = new QGroupBox(tr("GRP_PARAMETERS"), this);
-  //GroupParameters->setColumnLayout(0, Qt::Vertical);
-  //GroupParameters->layout()->setSpacing(0);
-  //GroupParameters->layout()->setMargin(0);
+  QGroupBox* GroupParameters = new QGroupBox(tr("GRP_PARAMETERS"), aLocalPlanes);
   QGridLayout* GroupParametersLayout = new QGridLayout (GroupParameters);
   GroupParametersLayout->setAlignment(Qt::AlignTop);
   GroupParametersLayout->setSpacing(6);
   GroupParametersLayout->setMargin(11);
+  aLocalLayout->addWidget(GroupParameters);
 
   TabPane = new QTabWidget (GroupParameters);
   TabPane->addTab(createParamsTab()   , tr("TAB_NON_STRUCTURED"));
   TabPane->addTab(createIJKParamsTab(), tr("TAB_IJK_STRUCTURED"));
   GroupParametersLayout->addWidget(TabPane, 0, 0);
 
+
+
+
+
   // "Show preview" and "Auto Apply" check boxes
+  QHBoxLayout* aCheckBoxLayout = new QHBoxLayout(this);
+  VisuGUI_ClippingDlgLayout->addLayout(aCheckBoxLayout);
 
   PreviewCheckBox = new QCheckBox (tr("SHOW_PREVIEW_CHK"), this);
   PreviewCheckBox->setChecked(true);
+  aCheckBoxLayout->addWidget(PreviewCheckBox);
+  aCheckBoxLayout->addStretch();
 
   AutoApplyCheckBox = new QCheckBox (tr("AUTO_APPLY_CHK"), this);
   AutoApplyCheckBox->setChecked(false);
+  aCheckBoxLayout->addWidget(AutoApplyCheckBox);
 
   // Controls for "Ok", "Apply" and "Close" button
   QGroupBox* GroupButtons = new QGroupBox (this);
+  VisuGUI_ClippingDlgLayout->addWidget(GroupButtons);
   QSizePolicy aSizePolicy(QSizePolicy::Expanding,
                           QSizePolicy::Fixed );
   aSizePolicy.setHeightForWidth( GroupButtons->sizePolicy().hasHeightForWidth() );
@@ -312,9 +334,6 @@ VisuGUI_ClippingDlg::VisuGUI_ClippingDlg (VisuGUI* theModule,
   aSizePolicy.setVerticalStretch( 0 );
   GroupButtons->setSizePolicy( aSizePolicy );
   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);
   GroupButtons->setLayout(GroupButtonsLayout);
   GroupButtonsLayout->setAlignment(Qt::AlignTop);
@@ -340,12 +359,6 @@ VisuGUI_ClippingDlg::VisuGUI_ClippingDlg (VisuGUI* theModule,
   buttonOk->setDefault(TRUE);
   GroupButtonsLayout->addWidget(buttonOk, 0, 0);
 
-  VisuGUI_ClippingDlgLayout->addWidget(GroupPlanes,       0, 0, 1, 2);
-  VisuGUI_ClippingDlgLayout->addWidget(GroupParameters,   1, 0, 1, 2);
-  VisuGUI_ClippingDlgLayout->addWidget(PreviewCheckBox,   2,    0);
-  VisuGUI_ClippingDlgLayout->addWidget(AutoApplyCheckBox, 2,    1);
-  VisuGUI_ClippingDlgLayout->addWidget(GroupButtons,      3, 0, 3, 2);
-
   // Initial state
   VISU::RangeStepAndValidator(SpinBoxDistance, 0.0, 1.0, 0.01, 3);
   VISU::RangeStepAndValidator(SpinBoxRot1, -180.0, 180.0, 1, 3);
@@ -488,6 +501,16 @@ QWidget* VisuGUI_ClippingDlg::createIJKParamsTab()
 // purpose  :
 //=================================================================================
 void VisuGUI_ClippingDlg::ClickOnApply()
+{
+  applyLocalPlanes();
+}
+
+
+//=================================================================================
+// function : applyLocalPlanes()
+// purpose  :
+//=================================================================================
+void VisuGUI_ClippingDlg::applyLocalPlanes()
 {
   if (!myPrs3d)
     return;
@@ -512,7 +535,8 @@ void VisuGUI_ClippingDlg::ClickOnApply()
     }
 
     // Try to apply new clipping
-    myPrs3d->RemoveAllClippingPlanes();
+    //myPrs3d->RemoveAllClippingPlanes();
+    removeAllClippingPlanes(myPrs3d);
 
     VISU::TPlanes::iterator anIter = myPlanes.begin();
     for (; anIter != myPlanes.end(); anIter++) {
@@ -537,7 +561,8 @@ void VisuGUI_ClippingDlg::ClickOnApply()
 
     if (isFailed) {
       // Restore previous clipping state because of failure.
-      myPrs3d->RemoveAllClippingPlanes();
+      //myPrs3d->RemoveAllClippingPlanes();
+      removeAllClippingPlanes(myPrs3d);
 
       TPlns::iterator anOldIter = anOldPlanes.begin();
       for (; anOldIter != anOldPlanes.end(); anOldIter++) {
@@ -555,6 +580,9 @@ void VisuGUI_ClippingDlg::ClickOnApply()
   }
 }
 
+
+
+
 //=================================================================================
 // function : ClickOnOk()
 // purpose  :
@@ -804,9 +832,9 @@ void VisuGUI_ClippingDlg::Sinchronize()
   }
 
   buttonDelete           ->setEnabled(anIsControlsEnable);
-  buttonApply            ->setEnabled(anIsControlsEnable);
-  PreviewCheckBox        ->setEnabled(anIsControlsEnable);
-  AutoApplyCheckBox      ->setEnabled(anIsControlsEnable);
+  //buttonApply            ->setEnabled(anIsControlsEnable);
+  //  PreviewCheckBox        ->setEnabled(anIsControlsEnable);
+  //  AutoApplyCheckBox      ->setEnabled(anIsControlsEnable);
 
   ComboBoxOrientation    ->setEnabled(anIsControlsEnable);
   SpinBoxDistance        ->setEnabled(anIsControlsEnable);
@@ -1210,3 +1238,15 @@ void VisuGUI_ClippingDlg::SetPrs3d(VISU::Prs3d_i* thePrs)
   } else 
     return;
 }
+
+
+void VisuGUI_ClippingDlg::removeAllClippingPlanes(VISU::Prs3d_i* thePrs)
+{
+  for (int i = thePrs->GetNumberOfClippingPlanes() - 1; i >= 0 ; i--) {
+    OrientedPlane* aPlane = dynamic_cast<OrientedPlane*>(thePrs->GetClippingPlane(i));
+    if (aPlane) 
+      thePrs->RemoveClippingPlane(i);
+  }
+}
+
+
index f14ac0951007bdc60a397b3df8c1f2f47256d764..c35e1b93ff99215b389731e69de4fe520945c7bf 100644 (file)
@@ -44,6 +44,7 @@ class QComboBox;
 class QButtonGroup;
 class QSpinBox;
 class QTabWidget;
+class QListWidget;
 
 class SALOME_Actor;
 
@@ -54,11 +55,11 @@ class SVTK_ViewWindow;
 class LightApp_SelectionMgr;
 
 class VisuGUI;
-
 class vtkPlaneSource;
 class vtkDataSetMapper;
-
 class OrientedPlane;
+class VISU_Actor;
+class PreviewPlane;
 
 namespace VISU {
   class Prs3d_i;
@@ -136,6 +137,11 @@ private:
   
     void SetPrs3d(VISU::Prs3d_i* thePrs);
   
+    VISU_Actor* getSelectedActor();
+
+    void applyLocalPlanes();
+
+    void removeAllClippingPlanes(VISU::Prs3d_i* thePrs);
 
 private:
 
@@ -179,6 +185,9 @@ private:
 
     bool myIsSelectPlane;
 
+    VISU_Actor* myDSActor;
+    QList<PreviewPlane*> myPreviewList;
+
 protected:
     QWidget* createParamsTab();
     QWidget* createIJKParamsTab();
@@ -204,3 +213,5 @@ public slots:
 };
 
 #endif // DIALOGBOX_TRANSPARENCYDLG_H
+
+
diff --git a/src/VISUGUI/VisuGUI_ClippingPanel.cxx b/src/VISUGUI/VisuGUI_ClippingPanel.cxx
new file mode 100644 (file)
index 0000000..5b76f65
--- /dev/null
@@ -0,0 +1,1038 @@
+// Copyright (C) 2005  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+// 
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either 
+// version 2.1 of the License.
+// 
+// This library is distributed in the hope that it will be useful 
+// but WITHOUT ANY WARRANTY; without even the implied warranty of 
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public  
+// License along with this library; if not, write to the Free Software 
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+
+#include "VisuGUI_ClippingPanel.h"
+#include "VisuGUI.h"
+#include "VisuGUI_Tools.h"
+#include "VisuGUI_ClippingPlaneDlg.h"
+#include "VisuGUI_ViewTools.h"
+
+#include <VISU_ColoredPrs3dCache_i.hh>
+
+#include <VISU_Gen_i.hh>
+#include <VISU_ColoredPrs3dHolder_i.hh>
+
+#include <LightApp_Application.h>
+#include <SUIT_Desktop.h>
+#include <SUIT_Session.h>
+#include <SUIT_ViewManager.h>
+#include <SUIT_MessageBox.h>
+#include <SUIT_ResourceMgr.h>
+#include <SUIT_ViewWindow.h>
+#include <SVTK_ViewWindow.h>
+#include <VTKViewer_Utilities.h>
+
+
+
+#include <QVBoxLayout>
+#include <QHBoxLayout>
+#include <QPushButton>
+#include <QToolButton>
+#include <QGroupBox>
+#include <QListWidget>
+#include <QTableWidget>
+#include <QStringList>
+#include <QMessageBox>
+#include <QCheckBox>
+
+#include <vtkImageData.h>
+#include <vtkCutter.h>
+#include <vtkPolyDataMapper.h>
+
+#include <SALOMEDSClient_AttributeSequenceOfReal.hxx>
+#include <SALOMEDSClient_AttributeInteger.hxx>
+
+
+
+#define SIZEFACTOR 1.1
+
+
+#define PRINT3(MARK, VAL) printf("#### %s x=%f, y=%f, z=%f\n", MARK, VAL[0], VAL[1], VAL[2]);
+
+
+void AdjustBounds(const double bounds[6], double newBounds[6], double center[3])
+{
+  center[0] = (bounds[0] + bounds[1])/2.0;
+  center[1] = (bounds[2] + bounds[3])/2.0;
+  center[2] = (bounds[4] + bounds[5])/2.0;
+  
+  newBounds[0] = center[0] + SIZEFACTOR*(bounds[0]-center[0]);
+  newBounds[1] = center[0] + SIZEFACTOR*(bounds[1]-center[0]);
+  newBounds[2] = center[1] + SIZEFACTOR*(bounds[2]-center[1]);
+  newBounds[3] = center[1] + SIZEFACTOR*(bounds[3]-center[1]);
+  newBounds[4] = center[2] + SIZEFACTOR*(bounds[4]-center[2]);
+  newBounds[5] = center[2] + SIZEFACTOR*(bounds[5]-center[2]);
+}
+
+
+
+//****************************************************************
+//PreviewPlane::PreviewPlane(SVTK_ViewWindow* theWindow, const PlaneDef& thePlane, const double* theBounds):
+PreviewPlane::PreviewPlane(SVTK_ViewWindow* theWindow,
+                          VISU_CutPlaneFunction* thePlane,
+                          const double* theBounds):
+  myWindow(theWindow),
+  myBounds(theBounds)
+{ 
+  double aCenter[3];
+  double aBound[6];
+
+  AdjustBounds(myBounds, aBound, aCenter);
+
+  //myPlane = thePlane.plane;
+  myPlane = thePlane;
+
+  myBox = vtkImageData::New();
+  myBox->SetDimensions(2, 2, 2);
+  myBox->SetOrigin(aBound[0],aBound[2],aBound[4]);
+  myBox->SetSpacing((aBound[1]-aBound[0]),
+                   (aBound[3]-aBound[2]),
+                   (aBound[5]-aBound[4]));
+
+  myCutter = vtkCutter::New();
+  myCutter->SetInput(myBox);
+  myCutter->SetCutFunction(myPlane);
+
+  myMapper = vtkPolyDataMapper::New();
+  myMapper->SetInput(myCutter->GetOutput());
+
+  myActor = vtkActor::New();
+  myActor->VisibilityOff();
+  myActor->PickableOff();
+  myActor->SetMapper(myMapper);
+  vtkProperty* aProp = vtkProperty::New();
+  float anRGB[3];
+  
+  SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
+  
+  QColor aFillColor = aResourceMgr->colorValue("SMESH", "fill_color", QColor(0, 170, 255));
+  anRGB[0] = aFillColor.red()/255.;
+  anRGB[1] = aFillColor.green()/255.;
+  anRGB[2] = aFillColor.blue()/255.;
+  aProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
+  aProp->SetOpacity(0.75);
+  myActor->SetBackfaceProperty(aProp);
+  aProp->Delete();
+  
+  vtkProperty* aBackProp = vtkProperty::New();
+  QColor aBackFaceColor = aResourceMgr->colorValue("SMESH", "backface_color", QColor(0, 0, 255));
+  anRGB[0] = aBackFaceColor.red()/255.;
+  anRGB[1] = aBackFaceColor.green()/255.;
+  anRGB[2] = aBackFaceColor.blue()/255.;
+  aBackProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
+  aBackProp->SetOpacity(0.75);
+  myActor->SetProperty(aBackProp);
+  aBackProp->Delete();
+
+  myWindow->getRenderer()->AddActor(myActor);
+}
+
+//****************************************************************
+PreviewPlane::~PreviewPlane()
+{
+  myWindow->getRenderer()->RemoveActor(myActor);
+  myActor->Delete();
+
+  myMapper->RemoveAllInputs();
+  myMapper->Delete();
+  myCutter->Delete();
+  myBox->Delete();
+}
+
+
+  
+
+
+//****************************************************************
+//****************************************************************
+//****************************************************************
+/*CutPlaneFunction* CutPlaneFunction::New()
+{
+  return new CutPlaneFunction();
+}
+
+void CutPlaneFunction::setActive(bool theActive) 
+{ 
+  myIsActive = theActive; 
+  Modified();
+}
+
+double CutPlaneFunction::EvaluateFunction(double x[3])
+{
+  if (myIsActive)
+    return vtkPlane::EvaluateFunction(x);
+  else 
+    return -1;
+}
+
+double CutPlaneFunction::EvaluateFunction(double x, double y, double z)
+{
+  if (myIsActive)
+    return vtkPlane::EvaluateFunction(x,y,z);
+  else 
+    return -1;
+}
+  
+CutPlaneFunction::CutPlaneFunction():
+  myIsActive(true)
+{
+
+}
+
+CutPlaneFunction::~CutPlaneFunction()
+{
+}
+*/
+
+
+//****************************************************************
+//****************************************************************
+//****************************************************************
+VisuGUI_ClippingPanel::VisuGUI_ClippingPanel(VisuGUI* theModule)
+  : VisuGUI_Panel(tr("TITLE"), theModule, VISU::GetDesktop(theModule), ApplyBtn | HelpBtn ),
+    myModule(theModule),
+    myPlaneDlg(0),
+    myViewWindow(0),
+    myIsApplied(true)
+{
+  QVBoxLayout* aMainLayout = new QVBoxLayout(mainFrame());
+
+  // List of presentations
+  aMainLayout->addWidget(new QLabel(tr("PRESENTATIONS_LBL"), mainFrame()));
+  myPrsList = new QListWidget(mainFrame());
+  myPrsList->setSelectionMode(QAbstractItemView::SingleSelection);
+  connect(myPrsList, SIGNAL(currentRowChanged(int)), this, SLOT(onPrsSelected(int)));
+  aMainLayout->addWidget(myPrsList);
+
+  // List of planes
+  aMainLayout->addWidget(new QLabel(tr("PLANES_LBL"), mainFrame()));
+  myPlanesList = new QTableWidget(0, 2, mainFrame());
+  myPlanesList->setColumnWidth(1, 50);
+  myPlanesList->setSelectionMode(QAbstractItemView::SingleSelection);
+  connect(myPlanesList, SIGNAL(cellChanged(int,int)), this, SLOT(onCellChanged(int,int)));
+  aMainLayout->addWidget(myPlanesList);
+  
+  // Management buttons
+  QWidget* aButtonsWgt = new QWidget(mainFrame());
+  QHBoxLayout* aBtnLayout = new QHBoxLayout(aButtonsWgt);
+  aMainLayout->addWidget(aButtonsWgt);
+
+  QToolButton* aNewBtn = new QToolButton(aButtonsWgt);
+  aNewBtn->setToolButtonStyle(Qt::ToolButtonTextOnly);
+  aNewBtn->setText(tr("NEW_BTN"));
+  connect(aNewBtn, SIGNAL(clicked(bool)), this, SLOT(onNew()));
+  aBtnLayout->addWidget(aNewBtn);
+
+  QToolButton* aEditBtn = new QToolButton(aButtonsWgt);
+  aEditBtn->setToolButtonStyle(Qt::ToolButtonTextOnly);
+  aEditBtn->setText(tr("EDIT_BTN"));
+  connect(aEditBtn, SIGNAL(clicked(bool)), this, SLOT(onEdit()));
+  aBtnLayout->addWidget(aEditBtn);
+
+  QToolButton* aDeleteBtn = new QToolButton(aButtonsWgt);
+  aDeleteBtn->setToolButtonStyle(Qt::ToolButtonTextOnly);
+  aDeleteBtn->setText(tr("DELETE_BTN"));
+  connect(aDeleteBtn, SIGNAL(clicked(bool)), this, SLOT(onPlaneDelete()));
+  aBtnLayout->addWidget(aDeleteBtn);
+
+  myShowPlanes = new QCheckBox(tr("CHK_SHOW_PLANES"), mainFrame());
+  connect(myShowPlanes, SIGNAL( toggled(bool) ), this, SLOT( setPlanesVisible(bool) ));
+  aMainLayout->addWidget(myShowPlanes);
+
+  myNonActivePlanes = new QCheckBox(tr("CHK_ACTIVATE_PLANES"), mainFrame());
+  connect(myNonActivePlanes, SIGNAL(toggled(bool)), this, SLOT(setPlanesNonActive(bool)));
+  aMainLayout->addWidget(myNonActivePlanes);
+
+  myAutoApply = new QCheckBox(tr("CHK_AUTO_APPLY"), mainFrame());
+  connect(myAutoApply, SIGNAL(toggled(bool)), myApply, SLOT(setDisabled(bool)));
+  myAutoApply->setCheckState(Qt::Checked);
+  aMainLayout->addWidget(myAutoApply);
+
+
+  //  fillPrsList();
+  //  fillPlanesList();
+
+  connect(myModule, SIGNAL(presentationCreated(VISU::Prs3d_i*)), 
+         this, SLOT(onPresentationCreate(VISU::Prs3d_i*)));
+  connect(myModule, SIGNAL(beforeObjectDelete(QString)), 
+         this, SLOT(onObjectDelete(QString)));
+
+  SUIT_Desktop* aDesktop = VISU::GetDesktop(myModule);
+  connect(aDesktop, SIGNAL(windowActivated(SUIT_ViewWindow*)), 
+         this, SLOT(onWindowActivated(SUIT_ViewWindow*)));
+}
+  
+
+//*************************************************************************
+VisuGUI_ClippingPanel::~VisuGUI_ClippingPanel()
+{
+}
+
+
+//*************************************************************************
+void VisuGUI_ClippingPanel::fillPrsList()
+{
+  myPrsList->clear();
+  _PTR(Study) aStudy = VISU::GetCStudy(VISU::GetAppStudy(myModule));
+  _PTR(SComponent) aVisuSO = aStudy->FindComponent("VISU");
+  if (!aVisuSO) {
+    return;
+  }
+  myPresentations = getPrsList(aStudy, aVisuSO);
+
+  //Process Cache system folder
+  _PTR(SObject) aSObjPtr = aStudy->FindObject(VISU::ColoredPrs3dCache_i::GetFolderName().c_str());
+  if (aSObjPtr) {
+    _PTR(ChildIterator) Iter = aStudy->NewChildIterator( aSObjPtr );
+    for ( ; Iter->More(); Iter->Next() ) {
+      _PTR(SObject) aChildObj = Iter->Value();
+      myPresentations.append(aChildObj->GetID().c_str());
+    }
+  }
+
+  QStringList aNames;
+  for (int i = 0; i < myPresentations.size(); i++) {
+    aNames.append(getPrsName(getPrs(myPresentations.at(i))));
+  }
+  myPrsList->addItems(aNames);
+}
+
+//*************************************************************************
+QString VisuGUI_ClippingPanel::getPrsName(VISU::Prs3d_i* thePrs)
+{
+  QString aName;
+  QString aObjName;
+  QStringList aPath;
+  SALOMEDS::SObject_var aSObject = thePrs->GetSObject();
+  if (!aSObject->_is_nil()) {
+    SALOMEDS::SObject_var aFather = aSObject->GetFather();
+    while (!aFather->_is_nil()) {
+      QString aFName = aFather->GetName();
+      aPath.append(aFName);
+      if (aFName == "Post-Pro")        break;
+      aFather = aFather->GetFather();
+    }
+    aObjName = aSObject->GetName();
+  } else {
+    VISU::ColoredPrs3d_i* aColPrs = dynamic_cast<VISU::ColoredPrs3d_i*>(thePrs);
+    if (aColPrs) {
+      _PTR(Study) aStudy = VISU::GetCStudy(VISU::GetAppStudy(myModule));
+      _PTR(SObject) aSObjPtr = aStudy->FindObjectID(aColPrs->GetHolderEntry().c_str());
+      if (aSObjPtr) {
+       _PTR(SObject) aFather = aSObjPtr->GetFather();
+       while (aFather) {
+         QString aFName(aFather->GetName().c_str());
+         aPath.append(aFName);
+         if (aFName == "Post-Pro")     break;
+         aFather = aFather->GetFather();
+       }
+      }
+      aObjName = aSObjPtr->GetName().c_str();
+    }
+  }
+  for (int j = aPath.size() - 2; j >= 0; j--)
+    aName += aPath.at(j) + "/";
+  aName += aObjName;
+  return aName;
+}
+
+//*************************************************************************
+QStringList VisuGUI_ClippingPanel::getPrsList(_PTR(Study) theStudy, 
+                                             _PTR(SObject) theObject)
+{
+  //QList<VISU::Prs3d_i*> aList;
+  QStringList aList;
+  _PTR(ChildIterator) aIter = theStudy->NewChildIterator(theObject);
+  for (aIter->InitEx(true); aIter->More(); aIter->Next()) {
+    _PTR(SObject) aSObject = aIter->Value();
+    std::vector<VISU::Prs3d_i*> aSTLList = VISU::GetPrs3dList(myModule, aSObject);
+    for (int i = 0; i < aSTLList.size(); i++) {
+      VISU::Prs3d_i* aPrs = aSTLList[i];
+      if (!aList.contains(aPrs->GetEntry().c_str()))
+       aList.append(aPrs->GetEntry().c_str());
+    }
+    if (aList.size() == 0) {
+      //QList<VISU::Prs3d_i*> aSubList = getPrsList(theStudy, aSObject);
+      QStringList aSubList = getPrsList(theStudy, aSObject);
+       for (int i = 0; i < aSubList.size(); i++) {
+        //VISU::Prs3d_i* aPrs = aSubList[i];
+       QString aPrsEntry = aSubList[i];
+       if (!aList.contains(aPrsEntry))
+         aList.append(aPrsEntry);
+      }
+    }
+  }
+  return aList;
+}
+
+//*************************************************************************
+VISU_ClippingPlaneMgr& VisuGUI_ClippingPanel::getPlanesMgr() const
+{
+  return VISU::GetVisuGen(myModule)->GetClippingPlaneMgr();
+}
+
+//*************************************************************************
+void VisuGUI_ClippingPanel::fillPlanesList()
+{
+  disconnect(myPlanesList, SIGNAL(cellChanged(int,int)), this, SLOT(onCellChanged(int,int)));
+  myPlanesList->clear();
+  _PTR(Study) aStudy = VISU::GetCStudy(VISU::GetAppStudy(myModule));
+  VISU_ClippingPlaneMgr& aMgr = getPlanesMgr();
+  for (int i = 0; i < aMgr.GetClippingPlanesNb(); i++) {
+    VISU_CutPlaneFunction* aPlane = aMgr.GetClippingPlane(i);
+    myPlanesList->insertRow(i);
+    QTableWidgetItem* aItem = new QTableWidgetItem(aPlane->getName().c_str());
+    QTableWidgetItem* aCheckItem = new QTableWidgetItem();
+    aCheckItem->setCheckState((myNonActivePlanes->checkState() == Qt::Checked)? 
+                             Qt::Unchecked : Qt::Checked);    
+    if (aPlane->isAuto()) { // If this is Auto plane
+      aItem->setFlags(0);
+      aItem->setCheckState(Qt::Checked);
+    } else { // if it is not auto
+      aItem->setCheckState(Qt::Unchecked);
+      // Check current presentation
+      int aPrsNum = myPrsList->currentRow();
+      if (aPrsNum >= 0) {
+       if (VISU_ClippingPlaneMgr::ContainsPlane(getPrs(myPresentations.at(aPrsNum)), aPlane))
+         aItem->setCheckState(Qt::Checked);
+      }
+    }
+    myPlanesList->setItem(i, 0, aItem);
+    myPlanesList->setItem(i, 1, aCheckItem);
+  }
+  myPlanesList->setHorizontalHeaderLabels(QString(tr("PLANES_TABLE_TITLES")).split(","));
+  if (myViewWindow)
+    myViewWindow->Repaint();
+  //myPlanes.clear();
+  /*_PTR(Study) aStudy = VISU::GetCStudy(VISU::GetAppStudy(myModule));
+  _PTR(SObject) aFolder;
+  if (VISU::getClippingPlanesFolder(aStudy, aFolder)) {
+    _PTR(ChildIterator) aIter = aStudy->NewChildIterator(aFolder);
+    int i;
+    for (i = 0; aIter->More(); aIter->Next(), i++) { // For each plane
+      _PTR(SObject) aSObject = aIter->Value(); 
+      PlaneDef aNewPlane = createEmptyPlane();
+      updatePlane(aSObject, aNewPlane);
+
+      myPlanesList->insertRow(i);
+      QTableWidgetItem* aItem = new QTableWidgetItem(aNewPlane.name);
+      QTableWidgetItem* aCheckItem = new QTableWidgetItem();
+      aCheckItem->setCheckState((myNonActivePlanes->checkState() == Qt::Checked)? Qt::Unchecked : Qt::Checked);
+
+      if (aNewPlane.isAuto) { // If this is Auto plane
+       aItem->setFlags(0);
+       // apply to all presentations
+       aItem->setCheckState(Qt::Checked);
+       foreach(QString aPrsEntry, myPresentations) {
+         getPrs(aPrsEntry)->AddClippingPlane(aNewPlane.plane);
+       }
+      } else { // if it is not auto
+       foreach(QString aPrsEntry, myPresentations) {
+         _PTR(ChildIterator) aRefIter = aStudy->NewChildIterator(aSObject);      
+         for (; aRefIter->More(); aRefIter->Next()) {
+           _PTR(SObject) aObj = aRefIter->Value();
+           _PTR(SObject) aRefPrsObject;
+           if (aObj->ReferencedObject(aRefPrsObject)) { // If it is referenced on current plane
+             if (QString(aRefPrsObject->GetID().c_str()) == aPrsEntry) {
+               getPrs(aPrsEntry)->AddClippingPlane(aNewPlane.plane);
+             }
+           }
+         }
+       }
+       aItem->setCheckState(Qt::Unchecked);
+       // Check current presentation
+       int aPrsNum = myPrsList->currentRow();
+       if (aPrsNum >= 0) {
+         if (containsPlane(getPrs(myPresentations.at(aPrsNum)), aNewPlane))
+           aItem->setCheckState(Qt::Checked);
+       }
+      }
+      myPlanesList->setItem(i, 0, aItem);
+      myPlanesList->setItem(i, 1, aCheckItem);
+      myPlanes.append(aNewPlane);
+    }
+  }
+  myPlanesList->setHorizontalHeaderLabels(QString(tr("PLANES_TABLE_TITLES")).split(","));
+  if (myViewWindow)
+  myViewWindow->Repaint();*/
+  connect(myPlanesList, SIGNAL(cellChanged(int,int)), this, SLOT(onCellChanged(int,int)));
+}
+
+
+//*************************************************************************
+void VisuGUI_ClippingPanel::init()
+{
+  myViewWindow = VISU::GetViewWindow<SVTK_Viewer>(myModule);
+  if (myViewWindow) 
+    connect(myViewWindow, SIGNAL(destroyed(QObject*)), this, SLOT(onWindowDestroyed(QObject*)));
+  fillPrsList();
+  fillPlanesList();
+}
+
+void VisuGUI_ClippingPanel::onWindowDestroyed(QObject* theWnd)
+{
+  if (theWnd == myViewWindow) {
+    myViewWindow = 0;
+  }
+}
+
+//*************************************************************************
+//void VisuGUI_ClippingPanel::showEvent(QShowEvent* event)
+//{
+//  VisuGUI_Panel::showEvent(event);
+//}
+
+//*************************************************************************
+// void VisuGUI_ClippingPanel::hideEvent(QHideEvent* event)
+// {
+//   disconnect(myModule, SIGNAL(presentationCreated()), this, SLOT(onPresentationCreate()));
+//   VisuGUI_Panel::hideEvent(event);
+// }
+
+//*************************************************************************
+void VisuGUI_ClippingPanel::onPresentationCreate(VISU::Prs3d_i* thePrs)
+{
+  myPrsList->addItem(getPrsName(thePrs));
+  string aEntry = thePrs->GetEntry();
+  if (aEntry.length() == 0) {
+    VISU::ColoredPrs3d_i* aColPrs = dynamic_cast<VISU::ColoredPrs3d_i*>(thePrs);
+    if (aColPrs)
+      aEntry = aColPrs->GetHolderEntry();
+  }
+
+  myPresentations.append(aEntry.c_str());
+  VISU_ClippingPlaneMgr& aMgr = getPlanesMgr();
+  for (int i = 0; i < aMgr.GetClippingPlanesNb(); i++) {
+    VISU_CutPlaneFunction* aPlane = aMgr.GetClippingPlane(i);
+    if (aPlane->isAuto())
+      aMgr.ApplyClippingPlane(thePrs, i);
+  }
+  /*  for (int i = 0; i < myPlanes.size(); i++) {
+    const PlaneDef& aPlane = myPlanes.at(i);
+    if (aPlane.isAuto)
+      thePrs->AddClippingPlane(aPlane.plane);
+      }*/
+}
+
+//*************************************************************************
+/*PlaneDef VisuGUI_ClippingPanel::createEmptyPlane()
+{
+  PlaneDef aPlane;
+  aPlane.name = QString("Plane");
+  aPlane.plane = CutPlaneFunction::New();
+  aPlane.plane->Delete();
+  aPlane.plane->SetOrigin(0.,0.,0.);
+  aPlane.plane->SetNormal(0.,0.,1.);
+  aPlane.isAuto = true;
+  return aPlane;
+}*/
+
+//*************************************************************************
+/*void VisuGUI_ClippingPanel::updatePlane(_PTR(SObject) theObject, PlaneDef& thePlane)
+{
+  thePlane.name = QString(theObject->GetName().c_str());
+  thePlane.plane->setPlaneObject(theObject);
+
+  _PTR(GenericAttribute) anAttr;
+  if (theObject->FindAttribute(anAttr, "AttributeSequenceOfReal")) {
+    _PTR(AttributeSequenceOfReal) aArray(anAttr);
+    thePlane.plane->SetOrigin(aArray->Value(1), aArray->Value(2), aArray->Value(3));
+    thePlane.plane->SetNormal(aArray->Value(4), aArray->Value(5), aArray->Value(6));
+  }
+  if (theObject->FindAttribute(anAttr, "AttributeInteger")) {
+    _PTR(AttributeInteger) aFlag(anAttr);
+    thePlane.isAuto = (aFlag->Value() == 1);
+  }
+}*/
+  
+//*************************************************************************
+void VisuGUI_ClippingPanel::onNewPlane()
+{
+  disconnect(myPlaneDlg, SIGNAL(accepted()), this, SLOT(onNewPlane()));
+  disconnect(myPlaneDlg, SIGNAL(rejected()), this, SLOT(onCancelDialog()));
+  disconnect(myPlanesList, SIGNAL(cellChanged(int,int)), this, SLOT(onCellChanged(int,int)));
+  //_PTR(SObject) aPlaneSObj = myPlaneDlg->getPlaneObj();
+  int aId = myPlaneDlg->planeId();
+  VISU_ClippingPlaneMgr& aMgr = getPlanesMgr();
+
+  VISU_CutPlaneFunction* aPlane = aMgr.GetClippingPlane(aId);
+  //PlaneDef aNewPlane = createEmptyPlane();
+  //updatePlane(aPlaneSObj, aNewPlane);
+  int aRow = myPlanesList->rowCount();
+  myPlanesList->insertRow(aRow);
+
+  //QTableWidgetItem* aItem = new QTableWidgetItem(aNewPlane.name);
+  QTableWidgetItem* aItem = new QTableWidgetItem(aPlane->getName().c_str());
+  QTableWidgetItem* aCheckItem = new QTableWidgetItem();
+  aCheckItem->setCheckState((myNonActivePlanes->checkState() == Qt::Checked)? 
+                           Qt::Unchecked : Qt::Checked);
+  //aNewPlane.plane->setActive(myNonActivePlanes->checkState() != Qt::Checked);
+  aPlane->setActive(myNonActivePlanes->checkState() != Qt::Checked);
+  //if (aNewPlane.isAuto) {
+  if (aPlane->isAuto()) {
+    aItem->setFlags(0);
+    aItem->setCheckState(Qt::Checked);
+//     for (int i = 0; i < myPresentations.size(); i++) {
+//       getPrs(myPresentations.at(i))->AddClippingPlane(aNewPlane.plane);
+//     }
+  } else {
+    aItem->setCheckState(Qt::Unchecked);
+  }
+  myPlanesList->setItem(aRow, 0, aItem);
+  myPlanesList->setItem(aRow, 1, aCheckItem);
+  //myPlanes.append(aNewPlane);
+
+  delete myPlaneDlg;
+  myPlaneDlg = 0;
+
+  setPlanesVisible(myShowPlanes->checkState() == Qt::Checked);
+  
+  if (myViewWindow)
+    myViewWindow->Repaint();
+  connect(myPlanesList, SIGNAL(cellChanged(int,int)), this, SLOT(onCellChanged(int,int)));
+}
+
+//*************************************************************************
+void VisuGUI_ClippingPanel::onPlaneEdited() 
+{
+  disconnect(myPlaneDlg, SIGNAL(accepted()), this, SLOT(onNewPlane()));
+  disconnect(myPlaneDlg, SIGNAL(rejected()), this, SLOT(onCancelDialog()));
+  disconnect(myPlanesList, SIGNAL(cellChanged(int,int)), this, SLOT(onCellChanged(int,int)));
+  //_PTR(SObject) aPlaneSObj = myPlaneDlg->getPlaneObj();
+
+  int aId = myPlaneDlg->planeId();
+  VISU_ClippingPlaneMgr& aMgr = getPlanesMgr();
+  VISU_CutPlaneFunction* aPlane = aMgr.GetClippingPlane(aId);
+  //  PlaneDef aPlane = myPlanes.at(myEditingPlanePos);
+  //updatePlane(aPlaneSObj, aPlane);
+
+  //QTableWidgetItem* aItem = myPlanesList->item(myEditingPlanePos, 0);
+  QTableWidgetItem* aItem = myPlanesList->item(aId, 0);
+  //  if (aPlane.isAuto) {
+  if (aPlane->isAuto()) {
+    aItem->setCheckState(Qt::Checked);    
+    aItem->setFlags(0);
+//     _PTR(Study) aStudy = VISU::GetCStudy( VISU::GetAppStudy( myModule ) );
+//     _PTR(ChildIterator) aIter = aStudy->NewChildIterator(aPlaneSObj);
+//     for (; aIter->More(); aIter->Next()) {
+//       _PTR(SObject) aObj = aIter->Value();
+//       VISU::DeleteSObject(myModule, aStudy, aObj);
+//     }
+     VISU::UpdateObjBrowser(myModule);
+  } else {
+    aItem->setCheckState(Qt::Unchecked);
+    aItem->setFlags(Qt::ItemIsEnabled | Qt::ItemIsUserCheckable);
+    int aPrsNum = myPrsList->currentRow();
+    if (aPrsNum >= 0) {
+      if (VISU_ClippingPlaneMgr::ContainsPlane(getPrs(myPresentations.at(aPrsNum)), aPlane))
+       aItem->setCheckState(Qt::Checked);
+    }
+  }
+
+  delete myPlaneDlg;
+  myPlaneDlg = 0;
+
+  //myPlanes.replace(myEditingPlanePos, aPlane);
+  setPlanesVisible(myShowPlanes->checkState() == Qt::Checked);
+
+  if (myViewWindow)
+    myViewWindow->Repaint();
+  connect(myPlanesList, SIGNAL(cellChanged(int,int)), this, SLOT(onCellChanged(int,int)));
+}
+
+//*************************************************************************
+void VisuGUI_ClippingPanel::onEdit()
+{
+  if (!isVISUDataReady()) return;
+  if (myPlaneDlg) return;
+
+  int aRow = myPlanesList->currentRow();
+  if (aRow < 0) return;
+
+  //  const PlaneDef& aPlane = myPlanes.at(aRow);
+
+  myPlaneDlg = new VisuGUI_ClippingPlaneDlg(myModule);
+  //myPlaneDlg->setPlaneObj(aPlane.plane->getPlaneObject());
+  myPlaneDlg->setPlaneId(aRow);
+  connect(myPlaneDlg, SIGNAL(accepted()), this, SLOT(onPlaneEdited()));
+  connect(myPlaneDlg, SIGNAL(rejected()), this, SLOT(onCancelDialog()));
+  //myEditingPlanePos = aRow;
+  myPlaneDlg->show();
+}
+
+//*************************************************************************
+void VisuGUI_ClippingPanel::onNew()
+{
+  if (!isVISUDataReady()) return;
+
+  if (myPlaneDlg) return;
+
+  myPlaneDlg = new VisuGUI_ClippingPlaneDlg(myModule);
+  connect(myPlaneDlg, SIGNAL(accepted()), this, SLOT(onNewPlane()));
+  connect(myPlaneDlg, SIGNAL(rejected()), this, SLOT(onCancelDialog()));
+  myPlaneDlg->show();
+}
+
+//*************************************************************************
+void VisuGUI_ClippingPanel::onPlaneDelete()
+{
+  if (!isVISUDataReady()) return;
+  if (myPlaneDlg) return;
+
+  _PTR(Study) aStudy = VISU::GetCStudy( VISU::GetAppStudy( myModule ) );
+  
+  
+  int aRow = myPlanesList->currentRow();
+  if (aRow < 0) return;
+
+  //  const PlaneDef& aPlane = myPlanes.at(aRow);
+  VISU_ClippingPlaneMgr& aMgr = getPlanesMgr();
+  VISU_CutPlaneFunction* aPlane = aMgr.GetClippingPlane(aRow);
+  QMessageBox::StandardButton aRes = 
+    QMessageBox::warning(VISU::GetDesktop(myModule), 
+                        tr("TIT_DELETE_PLANE"), 
+                        tr("MSG_DELETE_PLANE").arg(aPlane->getName().c_str()), 
+                        QMessageBox::Yes | QMessageBox::No, 
+                        QMessageBox::No);
+  if (aRes == QMessageBox::Yes) {
+    aMgr.DeleteClippingPlane(aRow);
+    /*    short aTag1 = aPlane.plane->getPlaneObject()->Tag();
+    for (int i = 0; i < myPresentations.size(); i++) {
+      VISU::Prs3d_i* aPrs = getPrs(myPresentations.at(i));
+      for (int j = aPrs->GetNumberOfClippingPlanes()-1; j > -1; j--) {
+       CutPlaneFunction* aPln = dynamic_cast<CutPlaneFunction*>(aPrs->GetClippingPlane(j));
+       if (aPln) {
+         short aTag2 = aPln->getPlaneObject()->Tag();
+         if (aTag1 == aTag2) {
+           aPrs->RemoveClippingPlane(j);
+         }
+       }
+      }
+    }
+
+    _PTR(SObject) aSObj = aPlane.plane->getPlaneObject();
+    _PTR(StudyBuilder) aBuilder = aStudy->NewBuilder();
+    aBuilder->RemoveObject(aSObj);
+    */
+    myPlanesList->removeRow(aRow);
+    //myPlanes.removeAt(aRow);
+    
+    VISU::UpdateObjBrowser(myModule);
+    
+    if (myViewWindow)
+      myViewWindow->Repaint();
+  }
+}
+
+//*************************************************************************
+bool VisuGUI_ClippingPanel::isVISUDataReady() 
+{
+  _PTR(Study) aStudy = VISU::GetCStudy( VISU::GetAppStudy( myModule ) );
+
+  _PTR(SComponent) aVisuSO = aStudy->FindComponent("VISU");
+  if (!aVisuSO) return false;
+
+  if(aStudy->GetProperties()->IsLocked()) return false;
+  return true;
+}
+
+//*************************************************************************
+void VisuGUI_ClippingPanel::onApply()
+{
+  if (myIsApplied) return;
+  
+  //PlaneDef aPlane;
+  int i;
+  VISU_ClippingPlaneMgr& aMgr = getPlanesMgr();
+  for (i = 0; i < aMgr.GetClippingPlanesNb(); i++) {
+    aMgr.GetClippingPlane(i)->setActive((myPlanesList->item(i, 1)->checkState() == Qt::Checked));
+  }
+//   for(i = 0; i < myPlanes.size(); i++) {
+//     aPlane = myPlanes.at(i);
+//     aPlane.plane->setActive((myPlanesList->item(i, 1)->checkState() == Qt::Checked));
+//   }
+  myIsApplied = true;
+  
+  int aPrsNum = myPrsList->currentRow();
+  if (aPrsNum > -1) {
+    //    for(i = 0; i < myPlanes.size(); i++) {
+    for(i = 0; i < aMgr.GetClippingPlanesNb(); i++) {
+      applyPlaneToPrs(i, aPrsNum, (myPlanesList->item(i, 0)->checkState() == Qt::Checked));
+    }
+  //myCheckedPlanes.clear();
+    VISU::UpdateObjBrowser(myModule);
+  }
+  if (myViewWindow)
+    myViewWindow->Repaint();
+}
+
+//*************************************************************************
+void VisuGUI_ClippingPanel::setPlanesNonActive(bool theState)
+{
+  //PlaneDef aPlane;
+  disconnect(myPlanesList, SIGNAL(cellChanged(int,int)), this, SLOT(onCellChanged(int,int)));
+  //for (int i = 0; i < myPlanes.size(); i++) {
+  VISU_ClippingPlaneMgr& aMgr = getPlanesMgr();
+  VISU_CutPlaneFunction* aPlane = 0;
+  for (int i = 0; i < aMgr.GetClippingPlanesNb(); i++) {
+    //aPlane = myPlanes.at(i);
+    aPlane = aMgr.GetClippingPlane(i);
+    //aPlane.plane->setActive(!theState);
+    aPlane->setActive(!theState);
+    myPlanesList->item(i, 1)->setCheckState((theState)? Qt::Unchecked : Qt::Checked);
+  }
+  if (myViewWindow)
+    myViewWindow->Repaint();
+  connect(myPlanesList, SIGNAL(cellChanged(int,int)), this, SLOT(onCellChanged(int,int)));
+}
+
+//*************************************************************************
+void VisuGUI_ClippingPanel::setPlanesVisible(bool theVisible)
+{
+  if (!myViewWindow) return;
+
+  if (theVisible) {
+    // Hide previous
+    setPlanesVisible(false);
+
+    double aBounds[6];
+    ComputeVisiblePropBounds(myViewWindow->getRenderer(), aBounds);
+    VISU_ClippingPlaneMgr& aMgr = getPlanesMgr();
+    //for (int i = 0; i < myPlanes.size(); i++) {
+    for (int i = 0; i < aMgr.GetClippingPlanesNb(); i++) {
+      //PreviewPlane* aPreview = new PreviewPlane(myViewWindow, myPlanes.at(i), aBounds);
+      PreviewPlane* aPreview = new PreviewPlane(myViewWindow, aMgr.GetClippingPlane(i), aBounds);
+      aPreview->setVisible(true);
+      myPreview.append(aPreview);
+    }
+  } else {
+    PreviewPlane* aPreview;
+    while (myPreview.size() > 0) {
+      aPreview = myPreview.last();
+      myPreview.removeLast();
+      delete aPreview;
+    }
+  }
+  myViewWindow->Repaint();
+}
+
+//*************************************************************************
+void VisuGUI_ClippingPanel::onCancelDialog()
+{
+  disconnect(myPlaneDlg, SIGNAL(accepted()), this, SLOT(onNewPlane()));
+  disconnect(myPlaneDlg, SIGNAL(rejected()), this, SLOT(onCancelDialog()));
+
+  delete myPlaneDlg;
+  myPlaneDlg = 0;
+}
+
+
+//*************************************************************************
+void VisuGUI_ClippingPanel::onWindowActivated(SUIT_ViewWindow* theWindow)
+{
+  setPlanesVisible(false);
+  myViewWindow = dynamic_cast<SVTK_ViewWindow*>(theWindow);
+  if (myViewWindow) 
+    connect(myViewWindow, SIGNAL(destroyed(QObject*)), this, SLOT(onWindowDestroyed(QObject*)));
+  setPlanesVisible(myShowPlanes->checkState() == Qt::Checked);
+}
+
+//*************************************************************************
+void VisuGUI_ClippingPanel::onCellChanged(int row, int col)
+{
+  //PlaneDef aPlane = myPlanes.at(row);
+  VISU_ClippingPlaneMgr& aMgr = getPlanesMgr();
+  VISU_CutPlaneFunction* aPlane = aMgr.GetClippingPlane(row);
+  bool isChecked = (myPlanesList->item(row, col)->checkState() == Qt::Checked);
+  if (col == 1) {  // activate column clicked
+    if (isAutoApply()) 
+      //aPlane.plane->setActive(isChecked);
+      aPlane->setActive(isChecked);
+    else {
+      myIsApplied = false;
+      return;
+    }
+  } else { // Plane checked
+    
+    //if (aPlane.isAuto) return;
+    if (aPlane->isAuto()) return;
+
+    if (!isAutoApply()) {
+      //myCheckedPlanes.append(row);
+      myIsApplied = false;
+      return;
+    }
+    int aPrsNum = myPrsList->currentRow();
+    if (aPrsNum < 0) return;
+
+    applyPlaneToPrs(row, aPrsNum, isChecked);
+    VISU::UpdateObjBrowser(myModule);
+  }
+  if (myViewWindow)
+    myViewWindow->Repaint();
+}
+
+//*************************************************************************
+void VisuGUI_ClippingPanel::applyPlaneToPrs(int thePlaneNum, int thePrsNum, bool isChecked)
+{
+  VISU::Prs3d_i* aPrs = getPrs(myPresentations.at(thePrsNum));
+  VISU_ClippingPlaneMgr& aMgr = getPlanesMgr();
+  if (isChecked) { // Apply
+    aMgr.ApplyClippingPlane(aPrs, thePlaneNum);
+  } else { // Detach
+    aMgr.DetachClippingPlane(aPrs, thePlaneNum);
+  }
+  /*  PlaneDef aPlane = myPlanes.at(thePlaneNum);
+  _PTR(Study) aStudy = VISU::GetCStudy( VISU::GetAppStudy( myModule ) );
+  _PTR(StudyBuilder) aBuilder = aStudy->NewBuilder();
+  VISU::Prs3d_i* aPrs = getPrs(myPresentations.at(thePrsNum));
+  _PTR(SObject) aSObject = aPlane.plane->getPlaneObject();
+  _PTR(SObject) aPrsSObj = aStudy->FindObjectID(aPrs->GetEntry());
+  if (isChecked) {
+    if (!containsPlane(aPrs, aPlane)) {
+      aPrs->AddClippingPlane(aPlane.plane);
+    
+      if(!aStudy->GetProperties()->IsLocked()) {
+       _PTR(SObject) aNewObj = aBuilder->NewObject(aSObject);
+       aBuilder->Addreference(aNewObj, aPrsSObj);
+      }
+    }
+  } else {
+    for (int i = 0; i < aPrs->GetNumberOfClippingPlanes(); i++) {
+      if (aPrs->GetClippingPlane(i) == aPlane.plane.GetPointer()) {
+       aPrs->RemoveClippingPlane(i);
+       break;
+      }
+    }
+    if(!aStudy->GetProperties()->IsLocked()) {
+      _PTR(ChildIterator) aIter = aStudy->NewChildIterator(aSObject);
+      for (; aIter->More(); aIter->Next()) {
+       _PTR(SObject) aRefObj = aIter->Value();
+       if(aRefObj) {
+         _PTR(SObject) aRefPrsObject;
+         if (aRefObj->ReferencedObject(aRefPrsObject)) {
+           if (QString(aRefPrsObject->GetID().c_str()) == QString(aPrs->GetEntry().c_str())) {
+             VISU::DeleteSObject(myModule, aStudy, aRefObj);
+             break;
+           }
+         }
+       }
+      }
+    }
+    }*/
+}
+
+//*************************************************************************
+/*bool VisuGUI_ClippingPanel::containsPlane(VISU::Prs3d_i* thePrs, const PlaneDef& thePlane)
+{
+  //bool isContains = false;
+  for (int i = 0; i < thePrs->GetNumberOfClippingPlanes(); i++) {
+    if (thePrs->GetClippingPlane(i) == thePlane.plane.GetPointer()) {
+      return true;
+    }
+  }
+  return false;
+}*/
+
+
+//*************************************************************************
+void VisuGUI_ClippingPanel::onObjectDelete(QString theEntry)
+{
+  disconnect(myPrsList, SIGNAL(currentRowChanged(int)), this, SLOT(onPrsSelected(int)));
+  int i = 0;
+  foreach (QString aPrsEntry, myPresentations) {
+    VISU::Prs3d_i* aPrs = getPrs(aPrsEntry);
+    if (aPrs) {
+      QString aID(aPrs->GetEntry().c_str());
+      if (aID == theEntry) {
+       myPresentations.removeAt(i);
+       myPrsList->takeItem(i);
+       break;
+      }
+      i++;
+    }
+  }
+  connect(myPrsList, SIGNAL(currentRowChanged(int)), this, SLOT(onPrsSelected(int)));
+  onPrsSelected(myPrsList->currentRow());
+}
+
+//*************************************************************************
+void VisuGUI_ClippingPanel::onPrsSelected(int thePrs)
+{
+  if (thePrs < 0) return;
+  if (thePrs > myPresentations.size()) return;
+  disconnect(myPlanesList, SIGNAL(cellChanged(int,int)), this, SLOT(onCellChanged(int,int)));
+  VISU::Prs3d_i* aPrs = getPrs(myPresentations.at(thePrs));
+  if (!aPrs) return;
+  //QListOfPlanes::const_iterator aIt;
+  VISU_ClippingPlaneMgr& aMgr = getPlanesMgr();
+  for (int i = 0; i < aMgr.GetClippingPlanesNb(); i++) {
+    QTableWidgetItem* aItem = myPlanesList->item(i, 0);
+    VISU_CutPlaneFunction* aPlane = aMgr.GetClippingPlane(i);
+    if (!aPlane->isAuto())
+      aItem->setCheckState(VISU_ClippingPlaneMgr::ContainsPlane(aPrs, aPlane)? 
+                          Qt::Checked : Qt::Unchecked);
+  }
+  /*  for (aIt = myPlanes.begin(), i = 0; aIt != myPlanes.end(); ++aIt, i++) {
+    QTableWidgetItem* aItem = myPlanesList->item(i, 0);
+    const PlaneDef& aPlane = *aIt;
+    if (!aPlane.isAuto)
+      aItem->setCheckState(containsPlane(aPrs, aPlane)? Qt::Checked : Qt::Unchecked);    
+      }*/
+  connect(myPlanesList, SIGNAL(cellChanged(int,int)), this, SLOT(onCellChanged(int,int)));
+}
+
+//*************************************************************************
+bool VisuGUI_ClippingPanel::isAutoApply() const
+{
+  return myAutoApply->checkState() == Qt::Checked;
+}
+
+
+//*************************************************************************
+VISU::Prs3d_i* VisuGUI_ClippingPanel::getPrs(QString theEntry)
+{
+  VISU::TObjectInfo anObjectInfo = VISU::GetObjectByEntry(VISU::GetAppStudy(myModule), 
+                                                         qPrintable(theEntry));
+  return VISU::GetPrs3dFromBase(anObjectInfo.myBase);
+}
+
+
+//*************************************************************************
+void VisuGUI_ClippingPanel::onHelp()
+{
+  QString aHelpFileName = "clipping_planes_page.html";
+  LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication());
+  if (app)
+    app->onHelpContextModule(myModule ? app->moduleName(myModule->moduleName()) : QString(""), aHelpFileName);
+  else {
+    QString platform;
+#ifdef WIN32
+    platform = "winapplication";
+#else
+    platform = "application";
+#endif
+    SUIT_MessageBox::warning(0, QObject::tr("WRN_WARNING"),
+                             QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
+                             arg(app->resourceMgr()->stringValue("ExternalBrowser", platform)).arg(aHelpFileName),
+                             QObject::tr("BUT_OK"));
+  }
+}
diff --git a/src/VISUGUI/VisuGUI_ClippingPanel.h b/src/VISUGUI/VisuGUI_ClippingPanel.h
new file mode 100644 (file)
index 0000000..53d23cb
--- /dev/null
@@ -0,0 +1,192 @@
+// Copyright (C) 2005  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+// 
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either 
+// version 2.1 of the License.
+// 
+// This library is distributed in the hope that it will be useful 
+// but WITHOUT ANY WARRANTY; without even the implied warranty of 
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public  
+// License along with this library; if not, write to the Free Software 
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#ifndef DIALOGBOX_CLIPPINGPANEL_H
+#define DIALOGBOX_CLIPPINGPANEL_H
+
+
+class VisuGUI;
+class QListWidget;
+class QTableWidget;
+class VisuGUI_ClippingPlaneDlg;
+class QCheckBox;
+class SVTK_ViewWindow;
+class SUIT_ViewWindow;
+class vtkPolyDataMapper;
+class vtkImageData;
+class vtkCutter;
+
+#include "VISU_Prs3d_i.hh"
+#include "VisuGUI_Panel.h"
+//#include <VisuGUI_SegmentationMgr.h>
+#include <VISU_ClippingPlaneMgr.hxx>
+
+#include <QList>
+#include <vtkActor.h>
+#include <vtkPlane.h>
+
+#include <SALOMEDSClient_SObject.hxx>
+
+
+/*class CutPlaneFunction: public vtkPlane
+{
+public:
+  static CutPlaneFunction* New();
+
+  vtkTypeMacro(CutPlaneFunction, vtkPlane);
+
+  virtual double EvaluateFunction(double x[3]);
+  virtual double EvaluateFunction(double x, double y, double z);
+
+  void setActive(bool theActive);
+  bool isActive() const { return myIsActive; }
+
+  void setPlaneObject(_PTR(SObject) aSOPlane) { mySObject = aSOPlane; }
+  _PTR(SObject) getPlaneObject() const { return mySObject; }
+
+protected:
+  CutPlaneFunction();
+  ~CutPlaneFunction();
+
+private:
+  bool myIsActive;
+  _PTR(SObject) mySObject;
+};
+
+
+
+struct PlaneDef
+{
+  vtkSmartPointer<CutPlaneFunction> plane;
+  bool isAuto;
+  QString name;
+};
+*/
+
+class PreviewPlane
+{
+public:
+  //PreviewPlane(SVTK_ViewWindow* theWindow, const PlaneDef& thePlane, const double* theBounds);
+  PreviewPlane(SVTK_ViewWindow* theWindow, VISU_CutPlaneFunction* thePlane, const double* theBounds);
+  ~PreviewPlane();
+
+  void setVisible(bool theVisible)
+  { myActor->SetVisibility(theVisible); }
+
+private:
+  SVTK_ViewWindow* myWindow;
+
+  vtkActor* myActor;
+  vtkPolyDataMapper* myMapper;
+  const double* myBounds;
+  vtkPlane* myPlane;
+  vtkImageData* myBox;
+  vtkCutter* myCutter;
+};
+
+
+//typedef QList<PlaneDef> QListOfPlanes;
+typedef QList<vtkPlane*> ListOfvtkPlanes;
+typedef QList<PreviewPlane*> ListOfPreview;
+
+
+
+
+
+class VisuGUI_ClippingPanel: public VisuGUI_Panel
+{
+  Q_OBJECT
+public:
+  VisuGUI_ClippingPanel(VisuGUI* theModule);
+  ~VisuGUI_ClippingPanel();
+
+  void init();
+
+  //protected:
+  //virtual void showEvent(QShowEvent* event);
+  //virtual void hideEvent(QHideEvent* event);
+
+public slots:
+  void onPresentationCreate(VISU::Prs3d_i* thePrs);
+
+protected slots:
+  virtual void onApply();
+  virtual void onHelp();
+
+private slots:
+  void onNew();
+  void onNewPlane();
+  void onEdit();
+  void onPlaneEdited();
+  void onPlaneDelete();
+  void onCancelDialog();
+  void setPlanesNonActive(bool theState);
+  void setPlanesVisible(bool theVisible);
+  void onWindowActivated(SUIT_ViewWindow* theWindow);
+  void onCellChanged(int row, int col);
+  void onObjectDelete(QString theEntry);
+  void onPrsSelected(int thePrs);
+  void onWindowDestroyed(QObject* theWnd);
+
+ private:
+  void fillPrsList();
+  void fillPlanesList();
+
+  bool isAutoApply() const;
+
+  VISU_ClippingPlaneMgr& getPlanesMgr() const;
+
+
+  //void updatePlane(_PTR(SObject) theObject, PlaneDef& thePlane);
+  //PlaneDef createEmptyPlane();
+  //static bool containsPlane(VISU::Prs3d_i* thePrs, const PlaneDef& thePlane);
+
+  QString getPrsName(VISU::Prs3d_i* thePrs);
+
+  bool isVISUDataReady();
+
+  void applyPlaneToPrs(int thePlaneNum, int thePrsNum, bool isChecked);
+
+  //QList<VISU::Prs3d_i*> getPrsList(_PTR(Study) theStudy, _PTR(SObject) theObject);
+  QStringList getPrsList(_PTR(Study) theStudy, _PTR(SObject) theObject);
+  VISU::Prs3d_i* getPrs(QString theEntry);
+
+  VisuGUI*   myModule;
+
+  QListWidget* myPrsList;
+  QTableWidget* myPlanesList;
+
+  QCheckBox* myShowPlanes;
+  QCheckBox* myNonActivePlanes;
+  QCheckBox* myAutoApply;
+  
+  //QListOfPlanes myPlanes;
+  //  QList<VISU::Prs3d_i*> myPresentations;
+  QStringList myPresentations; // Stores entries of presentation objects
+  ListOfPreview myPreview;
+
+  VisuGUI_ClippingPlaneDlg* myPlaneDlg;
+  //int myEditingPlanePos;
+  SVTK_ViewWindow* myViewWindow;
+  bool myIsApplied;
+  //QList<int> myCheckedPlanes;
+};
+
+#endif
diff --git a/src/VISUGUI/VisuGUI_ClippingPlaneDlg.cxx b/src/VISUGUI/VisuGUI_ClippingPlaneDlg.cxx
new file mode 100644 (file)
index 0000000..972a7a2
--- /dev/null
@@ -0,0 +1,410 @@
+// Copyright (C) 2005  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+// 
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either 
+// version 2.1 of the License.
+// 
+// This library is distributed in the hope that it will be useful 
+// but WITHOUT ANY WARRANTY; without even the implied warranty of 
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public  
+// License along with this library; if not, write to the Free Software 
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#include "VisuGUI_ClippingPlaneDlg.h"
+#include "VisuGUI.h"
+#include "VisuGUI_Tools.h"
+#include "VisuGUI_ViewTools.h"
+
+#include <VISU_Gen_i.hh>
+
+#include <LightApp_Application.h>
+#include <SUIT_Desktop.h>
+#include <SUIT_Session.h>
+#include <SUIT_ViewManager.h>
+#include <SUIT_MessageBox.h>
+#include <SUIT_ResourceMgr.h>
+#include <QtxDoubleSpinBox.h>
+#include <SVTK_ViewWindow.h>
+#include <VTKViewer_Utilities.h>
+
+#include <QVBoxLayout>
+#include <QHBoxLayout>
+#include <QLineEdit>
+#include <QWidget>
+#include <QGroupBox>
+#include <QGridLayout>
+#include <QCheckBox>
+#include <QPushButton>
+
+#include <vtkCallbackCommand.h>
+#include <vtkImplicitPlaneWidget.h>
+
+
+#define SIZEFACTOR 1.1
+
+
+
+
+//****************************************************************
+//****************************************************************
+//****************************************************************
+VisuGUI_ClippingPlaneDlg::VisuGUI_ClippingPlaneDlg(VisuGUI* theModule)
+  : QDialog(VISU::GetDesktop(theModule), Qt::WindowTitleHint | Qt::WindowSystemMenuHint ),
+    myModule(theModule),
+    myCallback( vtkCallbackCommand::New() ),
+    myPreviewWidget(0),
+    myViewWindow(0),
+    myPlaneId(-1)
+{
+  myViewWindow = VISU::GetActiveViewWindow<SVTK_ViewWindow>(myModule);
+  ComputeVisiblePropBounds(myViewWindow->getRenderer(), myBounds);
+
+  setWindowTitle(tr("TITLE"));
+  setSizeGripEnabled(true);
+  setModal(false);
+
+  myCallback->SetClientData(this); 
+  myCallback->SetCallback(VisuGUI_ClippingPlaneDlg::ProcessEvents);
+
+  QVBoxLayout* aMainLayout = new QVBoxLayout(this);
+
+  QWidget* aPlanesWgt = new QWidget(this);
+  aMainLayout->addWidget(aPlanesWgt);
+  QVBoxLayout* aFrameLayout = new QVBoxLayout(aPlanesWgt);
+
+  QWidget* aNameBox = new QWidget(aPlanesWgt);
+  aFrameLayout->addWidget(aNameBox);
+  QHBoxLayout* aNameLayout = new QHBoxLayout(aNameBox);
+
+  aNameLayout->addWidget(new QLabel(tr("LBL_NAME"), aPlanesWgt));
+  myNameEdt = new QLineEdit();
+  
+  _PTR(Study) aStudy = VISU::GetCStudy(VISU::GetAppStudy(myModule));
+  _PTR(SObject) aFolderSO;
+  if (VISU::getClippingPlanesFolder(aStudy, aFolderSO)) {
+    _PTR(ChildIterator) aIter = aStudy->NewChildIterator(aFolderSO);
+    int i = 1;
+    for (; aIter->More(); aIter->Next()) i++;
+
+    myNameEdt->setText(QString("Plane %1").arg(i));
+  }
+  aNameLayout->addWidget(myNameEdt);
+
+  QGroupBox* aOriginGroup = new QGroupBox( tr( "ORIGIN_TITLE" ), aPlanesWgt );
+  aFrameLayout->addWidget(aOriginGroup);
+  QHBoxLayout* aOriginLayout = new QHBoxLayout(aOriginGroup);
+
+  aOriginLayout->addWidget( new QLabel("X", aOriginGroup) );
+  myXOrigin = new QtxDoubleSpinBox( -1000.0, 1000.0, 0.1, aOriginGroup );
+  myXOrigin->setValue( 0.0 );
+  connect(myXOrigin, SIGNAL(valueChanged(double)), this, SLOT(onValueChanged()));
+  aOriginLayout->addWidget( myXOrigin );
+
+  aOriginLayout->addWidget( new QLabel("Y", aOriginGroup) );
+  myYOrigin = new QtxDoubleSpinBox( -1000.0, 1000, 0.1, aOriginGroup );
+  myYOrigin->setValue( 0.0 );
+  connect(myYOrigin, SIGNAL(valueChanged(double)), this, SLOT(onValueChanged()));
+  aOriginLayout->addWidget( myYOrigin );
+
+  aOriginLayout->addWidget( new QLabel("Z", aOriginGroup) );
+  myZOrigin = new QtxDoubleSpinBox( -1000.0, 1000.0, 0.1, aOriginGroup );
+  myZOrigin->setValue( 0.0 );
+  connect(myZOrigin, SIGNAL(valueChanged(double)), this, SLOT(onValueChanged()));
+  aOriginLayout->addWidget( myZOrigin );
+  
+  QGroupBox* aDirGroup = new QGroupBox( tr( "DIRECTION_TITLE" ), aPlanesWgt );
+  aFrameLayout->addWidget(aDirGroup);
+  QHBoxLayout* aDirLayout = new QHBoxLayout(aDirGroup);
+
+  aDirLayout->addWidget( new QLabel("dX", aDirGroup) );
+  myXDir = new QtxDoubleSpinBox( -1000.0, 1000.0, 0.1, aDirGroup );
+  myXDir->setValue( 0.0 );
+  connect(myXDir, SIGNAL(valueChanged(double)), this, SLOT(onValueChanged()));
+  aDirLayout->addWidget( myXDir );
+
+  aDirLayout->addWidget( new QLabel("dY", aDirGroup) );
+  myYDir = new QtxDoubleSpinBox( -1000.0, 1000.0, 0.1, aDirGroup );
+  myYDir->setValue( 0.0 );
+  connect(myYDir, SIGNAL(valueChanged(double)), this, SLOT(onValueChanged()));
+  aDirLayout->addWidget( myYDir );
+
+  aDirLayout->addWidget( new QLabel("dZ", aDirGroup) );
+  myZDir = new QtxDoubleSpinBox( -1000.0, 1000.0, 0.1, aDirGroup );
+  myZDir->setValue( 1.0 );
+  connect(myZDir, SIGNAL(valueChanged(double)), this, SLOT(onValueChanged()));
+  aDirLayout->addWidget( myZDir );
+
+  myAutoApply = new QCheckBox(tr("CHK_AUTOAPPLY"), aPlanesWgt);
+  myAutoApply->setCheckState(Qt::Checked);
+  aFrameLayout->addWidget(myAutoApply);
+
+  // Dialog buttons
+  QGroupBox* aGroupButtons = new QGroupBox (this);
+  aMainLayout->addWidget(aGroupButtons);
+
+  QSizePolicy aSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed );
+  QHBoxLayout* aButtonsLayout = new QHBoxLayout(aGroupButtons);
+
+  QPushButton* aBtnOk = new QPushButton(tr("BUT_OK"), aGroupButtons);
+  aButtonsLayout->addWidget(aBtnOk);
+
+  aButtonsLayout->addStretch();
+
+  QPushButton* aBtnClose = new QPushButton(tr("BUT_CANCEL"), aGroupButtons);
+  aButtonsLayout->addWidget(aBtnClose);
+
+  QPushButton* aBtnHelp = new QPushButton(tr("BUT_HELP"), aGroupButtons);
+  aButtonsLayout->addWidget(aBtnHelp);
+
+  connect(aBtnOk   , SIGNAL(clicked()), this, SLOT(accept()));
+  connect(aBtnClose, SIGNAL(clicked()), this, SLOT(reject()));
+  connect(aBtnHelp , SIGNAL(clicked()), this, SLOT(onHelp()));
+
+
+  myPreviewWidget = createPreviewWidget();
+  myViewWindow->Repaint();
+}
+
+VisuGUI_ClippingPlaneDlg::~VisuGUI_ClippingPlaneDlg()
+{
+  if (myPreviewWidget) {
+    myPreviewWidget->Off();
+    myPreviewWidget->Delete();
+  }
+  myPreviewWidget = 0;
+  myCallback->Delete();
+}
+
+//****************************************************************
+void VisuGUI_ClippingPlaneDlg::ProcessEvents(vtkObject* theObject, 
+                                            unsigned long theEvent,
+                                            void* theClientData, 
+                                            void* vtkNotUsed(theCallData))
+{
+  vtkImplicitPlaneWidget* aWidget = vtkImplicitPlaneWidget::SafeDownCast(theObject);
+  if (aWidget == NULL) return;
+  if (theClientData == NULL) return;
+
+  VisuGUI_ClippingPlaneDlg* aDlg = (VisuGUI_ClippingPlaneDlg*) theClientData;
+
+  double aOrigin[3];
+  double aDir[3];
+
+  switch(theEvent){
+  case vtkCommand::InteractionEvent:
+    aWidget->GetOrigin(aOrigin);
+    aWidget->GetNormal(aDir);
+
+    aDlg->setOrigin(aOrigin);
+    aDlg->setDirection(aDir);
+
+    break;
+  }
+}
+
+//****************************************************************
+void VisuGUI_ClippingPlaneDlg::setOrigin(double theVal[3])
+{
+  myXOrigin->setValue(theVal[0]);
+  myYOrigin->setValue(theVal[1]);
+  myZOrigin->setValue(theVal[2]);
+}
+
+//****************************************************************
+void VisuGUI_ClippingPlaneDlg::setDirection(double theVal[3])
+{
+  myXDir->setValue(theVal[0]);
+  myYDir->setValue(theVal[1]);
+  myZDir->setValue(theVal[2]);
+}
+
+//****************************************************************
+void VisuGUI_ClippingPlaneDlg::onValueChanged()
+{
+  if (!myPreviewWidget) return;
+  double aOrigin[3];
+  double aDir[3];
+  aOrigin[0] = myXOrigin->value();
+  aOrigin[1] = myYOrigin->value();
+  aOrigin[2] = myZOrigin->value();
+
+  aDir[0] = myXDir->value();
+  aDir[1] = myYDir->value();
+  aDir[2] = myZDir->value();
+
+  myPreviewWidget->SetOrigin(aOrigin);
+  myPreviewWidget->SetNormal(aDir);
+  myViewWindow->Repaint();
+}
+
+//****************************************************************
+vtkImplicitPlaneWidget* VisuGUI_ClippingPlaneDlg::createPreviewWidget()
+{
+  vtkImplicitPlaneWidget* aPlaneWgt = vtkImplicitPlaneWidget::New();
+  aPlaneWgt->SetInteractor(myViewWindow->getInteractor());
+  aPlaneWgt->SetPlaceFactor(SIZEFACTOR);
+  aPlaneWgt->ScaleEnabledOff();
+  aPlaneWgt->PlaceWidget(myBounds[0],myBounds[1],myBounds[2],myBounds[3],myBounds[4],myBounds[5]);
+  aPlaneWgt->SetOrigin(0,0,0);
+  aPlaneWgt->SetNormal(0,0,1);
+  aPlaneWgt->On();
+
+  //aPlaneWgt->OutlineTranslationOff();
+  //aPlaneWgt->ScaleEnabledOn();
+  aPlaneWgt->AddObserver(vtkCommand::InteractionEvent, 
+                        myCallback.GetPointer(), 
+                        0.);
+  return aPlaneWgt;
+}
+
+
+//****************************************************************
+void VisuGUI_ClippingPlaneDlg::setPlaneId(int theId)
+{
+  myPlaneId = theId;
+  VISU_ClippingPlaneMgr& aMgr = VISU::GetVisuGen(myModule)->GetClippingPlaneMgr();
+
+  VISU_CutPlaneFunction* aPlane =  aMgr.GetClippingPlane(myPlaneId);
+  if (aPlane) {
+    myNameEdt->setText(QString(aPlane->getName().c_str()));
+    double aOrigin[3], aDir[3];
+    aPlane->GetOrigin(aOrigin);
+    aPlane->GetNormal(aDir);
+
+    myXOrigin->setValue(aOrigin[0]);
+    myYOrigin->setValue(aOrigin[1]);
+    myZOrigin->setValue(aOrigin[2]);
+    myPreviewWidget->SetOrigin(aOrigin);
+
+    myXDir->setValue(aDir[0]);
+    myYDir->setValue(aDir[1]);
+    myZDir->setValue(aDir[2]);
+
+    myPreviewWidget->SetNormal(aDir);
+
+    myAutoApply->setCheckState((aPlane->isAuto())? Qt::Checked : Qt::Unchecked);
+    myViewWindow->Repaint();
+  }
+}
+/*void VisuGUI_ClippingPlaneDlg::setPlaneObj(_PTR(SObject) thePlaneObj)
+{
+  myPlaneObj = thePlaneObj;
+
+  myNameEdt->setText(QString(myPlaneObj->GetName().c_str()));
+
+  _PTR(GenericAttribute) anAttr;
+  if (myPlaneObj->FindAttribute(anAttr, "AttributeSequenceOfReal")) {
+    _PTR(AttributeSequenceOfReal) aArray(anAttr);
+    myXOrigin->setValue(aArray->Value(1));
+    myYOrigin->setValue(aArray->Value(2));
+    myZOrigin->setValue(aArray->Value(3));
+
+    myPreviewWidget->SetOrigin(aArray->Value(1), aArray->Value(2), aArray->Value(3));
+
+    myXDir->setValue(aArray->Value(4));
+    myYDir->setValue(aArray->Value(5));
+    myZDir->setValue(aArray->Value(6));
+
+    myPreviewWidget->SetNormal(aArray->Value(4), aArray->Value(5), aArray->Value(6));
+  }
+  if (myPlaneObj->FindAttribute(anAttr, "AttributeInteger")) {
+    _PTR(AttributeInteger) aFlag(anAttr);
+    myAutoApply->setCheckState((aFlag->Value() == 1)? Qt::Checked : Qt::Unchecked);
+  }
+
+  myViewWindow->Repaint();
+}*/
+
+//****************************************************************
+void VisuGUI_ClippingPlaneDlg::accept()
+{
+  _PTR(Study) aStudy = VISU::GetCStudy( VISU::GetAppStudy( myModule ) );
+  if(!aStudy->GetProperties()->IsLocked()) {
+    VISU_ClippingPlaneMgr& aMgr = VISU::GetVisuGen(myModule)->GetClippingPlaneMgr();
+    if (myPlaneId == -1) { // Create a New plane
+      myPlaneId = aMgr.CreateClippingPlane(myXOrigin->value(), myYOrigin->value(), myZOrigin->value(),
+                                          myXDir->value(), myYDir->value(), myZDir->value(),
+                                          myAutoApply->checkState() == Qt::Checked,
+                                          qPrintable(myNameEdt->text()));
+    } else { // Edit Plane
+      aMgr.EditClippingPlane(myPlaneId,
+                            myXOrigin->value(), myYOrigin->value(), myZOrigin->value(),
+                            myXDir->value(), myYDir->value(), myZDir->value(),
+                            myAutoApply->checkState() == Qt::Checked,
+                            qPrintable(myNameEdt->text()));
+    }
+    VISU::UpdateObjBrowser(myModule);
+  }
+  /*  _PTR(Study) aStudy = VISU::GetCStudy( VISU::GetAppStudy( myModule ) );
+  if(!aStudy->GetProperties()->IsLocked()) {
+    _PTR(SObject) aFolder;
+    if (VISU::getClippingPlanesFolder(aStudy, aFolder)) {
+      _PTR(StudyBuilder) aBuilder = aStudy->NewBuilder();
+      if (myPlaneObj == 0) { // Create a New plane
+       myPlaneObj = aBuilder->NewObject(aFolder);
+      } 
+      // Save Name
+      _PTR(GenericAttribute) anAttr;
+      anAttr = aBuilder->FindOrCreateAttribute(myPlaneObj,"AttributeName");
+      _PTR(AttributeName) aName(anAttr);
+      aName->SetValue(myNameEdt->text().toStdString());
+
+      //Save Parameters
+      double aParams[6];
+      aParams[0] = myXOrigin->value();
+      aParams[1] = myYOrigin->value();
+      aParams[2] = myZOrigin->value();
+      aParams[3] = myXDir->value();
+      aParams[4] = myYDir->value();
+      aParams[5] = myZDir->value();
+
+      anAttr = aBuilder->FindOrCreateAttribute(myPlaneObj,"AttributeSequenceOfReal");
+      _PTR(AttributeSequenceOfReal) aArray(anAttr);
+      if (aArray->Length() == 6) {
+       for (int i = 0; i < 6; i++)
+         aArray->ChangeValue(i+1, aParams[i]);
+      } else {
+       for (int i = 0; i < 6; i++)
+         aArray->Add(aParams[i]);
+      }
+      // Save Bool Flag
+      anAttr = aBuilder->FindOrCreateAttribute(myPlaneObj,"AttributeInteger");
+      _PTR(AttributeInteger) aFlag(anAttr);
+      aFlag->SetValue((myAutoApply->checkState() == Qt::Checked)? 1 : 0);
+
+      VISU::UpdateObjBrowser(myModule);
+    }
+    }*/
+  QDialog::accept();
+}
+
+
+//****************************************************************
+void VisuGUI_ClippingPlaneDlg::onHelp()
+{
+  QString aHelpFileName = "clipping_planes_page.html";
+  LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication());
+  if (app)
+    app->onHelpContextModule(myModule ? app->moduleName(myModule->moduleName()) : QString(""), aHelpFileName);
+  else {
+    QString platform;
+#ifdef WIN32
+    platform = "winapplication";
+#else
+    platform = "application";
+#endif
+    SUIT_MessageBox::warning(0, QObject::tr("WRN_WARNING"),
+                             QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
+                             arg(app->resourceMgr()->stringValue("ExternalBrowser", platform)).arg(aHelpFileName),
+                             QObject::tr("BUT_OK"));
+  }
+}
+
diff --git a/src/VISUGUI/VisuGUI_ClippingPlaneDlg.h b/src/VISUGUI/VisuGUI_ClippingPlaneDlg.h
new file mode 100644 (file)
index 0000000..e443c79
--- /dev/null
@@ -0,0 +1,93 @@
+// Copyright (C) 2005  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+// 
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either 
+// version 2.1 of the License.
+// 
+// This library is distributed in the hope that it will be useful 
+// but WITHOUT ANY WARRANTY; without even the implied warranty of 
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public  
+// License along with this library; if not, write to the Free Software 
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#ifndef DIALOGBOX_CLIPPINGPLANEDLG_H
+#define DIALOGBOX_CLIPPINGPLANEDLG_H
+
+class VisuGUI;
+class QLineEdit;
+class QCheckBox;
+
+class QtxDoubleSpinBox;
+class vtkImplicitPlaneWidget;
+class vtkCallbackCommand;
+class vtkObject;
+class SVTK_ViewWindow;
+
+#include <QDialog>
+#include <vtkSmartPointer.h>
+#include "VisuGUI_ClippingPanel.h"
+#include <SALOMEDSClient_SObject.hxx>
+
+
+class VisuGUI_ClippingPlaneDlg: public QDialog
+{
+  Q_OBJECT
+public:
+  VisuGUI_ClippingPlaneDlg(VisuGUI* theModule);
+  ~VisuGUI_ClippingPlaneDlg();
+
+  void setOrigin(double theVal[3]);
+  void setDirection(double theVal[3]);
+
+  void setPlaneId(int theId);
+  int planeId() const { return myPlaneId; }
+  //void setPlaneObj(_PTR(SObject) thePlaneObj);
+  //_PTR(SObject) getPlaneObj() const { return myPlaneObj; }
+
+protected slots:
+  virtual void accept();
+
+private slots:
+  void onHelp();
+  void onValueChanged();
+
+ private:
+  //void setEmptyPlane(PlaneDef& thePlane) const;
+  vtkImplicitPlaneWidget* createPreviewWidget();
+
+
+  static void ProcessEvents(vtkObject* theObject, unsigned long theEvent,
+                           void* theClientData, void* theCallData);
+
+  VisuGUI*   myModule;
+  SVTK_ViewWindow* myViewWindow;
+
+  QLineEdit* myNameEdt;
+
+  QtxDoubleSpinBox* myXOrigin;
+  QtxDoubleSpinBox* myYOrigin;
+  QtxDoubleSpinBox* myZOrigin;
+  QtxDoubleSpinBox* myXDir;
+  QtxDoubleSpinBox* myYDir;
+  QtxDoubleSpinBox* myZDir;
+
+  QCheckBox* myAutoApply;
+
+  vtkImplicitPlaneWidget* myPreviewWidget;
+  vtkSmartPointer<vtkCallbackCommand> myCallback;
+
+  double myBounds[6];
+  //_PTR(SObject) myPlaneObj;
+  int myPlaneId;
+};
+
+#endif
index 73035a805cc62d2028e38e463ef21c5e3e27375e..a6129feb9a27bb73c32a2fb63a568f0187b05326 100644 (file)
@@ -260,8 +260,9 @@ bool VisuGUI_DeformedShapeDlg::onApply()
 //  Create and Edit
 ////////////////////////////////////////////////////////////////////////////////
 
-void VisuGUI_DeformedShapeDlg::CreatePrs3d(VisuGUI* theModule)
+VISU::Prs3d_i* VisuGUI_DeformedShapeDlg::CreatePrs3d(VisuGUI* theModule)
 {
+  VISU::DeformedShape_i* aPrs3d = NULL;
   _PTR(SObject) aTimeStamp;
   Handle(SALOME_InteractiveObject) anIO;
   VISU::ColoredPrs3d_i::EPublishInStudyMode aPublishInStudyMode;
@@ -278,10 +279,10 @@ void VisuGUI_DeformedShapeDlg::CreatePrs3d(VisuGUI* theModule)
          QString aFieldName = aRestoringMap["myFieldName"];
          QString aTimeStampId = aRestoringMap["myTimeStampId"];
          
-         typedef VISU::DeformedShape_i TPrs3d_i; 
+         //typedef VISU::DeformedShape_i TPrs3d_i; 
          
-         TPrs3d_i* aPrs3d =
-           VISU::CreatePrs3dFromFactory<TPrs3d_i>(theModule,
+         aPrs3d =
+           VISU::CreatePrs3dFromFactory<VISU::DeformedShape_i>(theModule,
                                                   aTimeStamp,
                                                   aMeshName.toLatin1().data(),
                                                   (VISU::Entity)anEntity.toInt(),
@@ -313,6 +314,7 @@ void VisuGUI_DeformedShapeDlg::CreatePrs3d(VisuGUI* theModule)
          }
        }
     }
+  return aPrs3d;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
index 1449af505b771ccc08ce27a9f7dc6711cf8864ad..d8ed8e7a90e5a5bd8adfdfd11d44fec5dca2829a 100644 (file)
@@ -70,7 +70,7 @@ public:
 
     virtual int  storeToPrsObject(VISU::ColoredPrs3d_i* thePrs);
 
-    static void CreatePrs3d(VisuGUI*  theModule);
+    static VISU::Prs3d_i* CreatePrs3d(VisuGUI*  theModule);
     static void EditPrs3d(VisuGUI* theModule, VISU::Prs3d_i* thePrs3d, Handle(SALOME_InteractiveObject)& theIO);
 
     void updatePrsCopy();
index 9cf7e830f2dd0f990a1261e9f6d835601f23c934..df6fbc230f33cca7e0ba749660a1d712bca10b4a 100644 (file)
@@ -33,7 +33,7 @@
 #include "VISU_ViewManager_i.hh"
 #include "VISU_Actor.h"
 
-#include "VVTK_ViewModel.h"
+//#include "VVTK_ViewModel.h"
 
 #include <SVTK_ViewModel.h>
 #include <SVTK_ViewWindow.h>
@@ -80,10 +80,10 @@ SALOME_Prs* VisuGUI_Displayer::buildPresentation( const QString& theEntry, SALOM
     SALOME_View* aView = theView ? theView : GetActiveView();
     VISU::VISUType aType = aBase->GetType();
     VISU::Prs3d_var aPrs3d = VISU::Prs3d::_narrow(aBase);
-    if( aView && (!CORBA::is_nil(aPrs3d) || aType == VISU::TCOLOREDPRS3DHOLDER) ){
-      SVTK_Viewer* aViewer = dynamic_cast<VVTK_Viewer*>( aView );
-      if (!aViewer)
-       aViewer = dynamic_cast<SVTK_Viewer*>( aView );
+    if(!CORBA::is_nil(aPrs3d) || aType == VISU::TCOLOREDPRS3DHOLDER){
+      SVTK_Viewer* aViewer = dynamic_cast<SVTK_Viewer*>( aView );
+      //if (!aViewer)
+      //aViewer = dynamic_cast<SVTK_Viewer*>( aView );
       if( aViewer ){
        SUIT_ViewManager* aViewManager = aViewer->getViewManager();
        SUIT_ViewWindow* aWindow = aViewManager->getActiveView();
@@ -294,7 +294,7 @@ bool VisuGUI_Displayer::canBeDisplayed( const QString& entry, const QString& vie
       dynamic_cast<VISU::Container_i*>( VISU::GetServant( anObj ).in() ) )
     return true;
 
-  if( viewer_type==SVTK_Viewer::Type() || viewer_type==VVTK_Viewer::Type())
+  if( viewer_type==SVTK_Viewer::Type() /*|| viewer_type==VVTK_Viewer::Type()*/)
   {
     VISU::Base_i* aBase = dynamic_cast<VISU::Base_i*>(VISU::GetServant(anObj).in());
 
diff --git a/src/VISUGUI/VisuGUI_FeatureEdgesPanel.cxx b/src/VISUGUI/VisuGUI_FeatureEdgesPanel.cxx
new file mode 100644 (file)
index 0000000..17f7557
--- /dev/null
@@ -0,0 +1,215 @@
+//  VISU VISUGUI : GUI of VISU component
+//
+//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+//
+//  File   : VisuGUI_FeatureEdgesPanel.cxx
+//  Author : Oleg Uvarov
+//  Module : VISU
+
+#include "VisuGUI_FeatureEdgesPanel.h"
+
+#include "VisuGUI.h"
+#include "VisuGUI_Tools.h"
+#include "VisuGUI_ViewTools.h"
+
+#include <QCheckBox>
+#include <QGroupBox>
+#include <QKeyEvent>
+#include <QLabel>
+#include <QLayout>
+#include <QPushButton>
+
+#include <QtxDoubleSpinBox.h>
+
+#include <SUIT_MessageBox.h>
+#include <SUIT_Session.h>
+#include <SUIT_ResourceMgr.h>
+
+#include <SalomeApp_Application.h>
+
+#include <LightApp_SelectionMgr.h>
+
+VisuGUI_FeatureEdgesPanel::VisuGUI_FeatureEdgesPanel( const VisuGUI* theModule, QWidget* theParent ) :
+  VisuGUI_Panel( tr( "WINDOW_TITLE" ), theModule, theParent, ApplyBtn | CloseBtn | HelpBtn ),
+  myActor( 0 )
+{
+  QVBoxLayout* aTopLayout = new QVBoxLayout( mainFrame() );
+  myGrp = new QGroupBox( tr( "FEATURE_EDGES_PROPERTIES" ), mainFrame() );
+
+  QGridLayout* aLayout = new QGridLayout( myGrp );
+  aLayout->setAlignment( Qt::AlignTop );
+
+  QLabel* anAngleLbl = new QLabel( tr( "FEATURE_EDGES_ANGLE" ), myGrp );
+  myAngleSpinBox = new QtxDoubleSpinBox( 0.0, 90.0, 10.0, myGrp );
+
+  myFeatureEdgesCB = new QCheckBox( tr( "SHOW_FEATURE_EDGES" ), myGrp );
+  myBoundaryEdgesCB = new QCheckBox( tr( "SHOW_BOUNDARY_EDGES" ), myGrp );
+  myManifoldEdgesCB = new QCheckBox( tr( "SHOW_MANIFOLD_EDGES" ), myGrp );
+  myNonManifoldEdgesCB = new QCheckBox( tr( "SHOW_NON_MANIFOLD_EDGES" ), myGrp );
+
+  //myColoringCB = new QCheckBox( tr( "FEATURE_EDGES_COLORING" ), myGrp );
+
+  aLayout->addWidget( anAngleLbl, 0, 0 );
+  aLayout->addWidget( myAngleSpinBox, 0, 1 );
+  aLayout->addWidget( myFeatureEdgesCB, 1, 0, 1, 2 );
+  aLayout->addWidget( myBoundaryEdgesCB, 2, 0, 1, 2 );
+  aLayout->addWidget( myManifoldEdgesCB, 3, 0, 1, 2 );
+  aLayout->addWidget( myNonManifoldEdgesCB, 4, 0, 1, 2 );
+  //aLayout->addWidget( myColoringCB, 5, 0, 1, 2 );
+
+  aTopLayout->addWidget( myGrp );
+
+  SalomeApp_Application* anApp =
+    dynamic_cast<SalomeApp_Application*>( SUIT_Session::session()->activeApplication() );
+  LightApp_SelectionMgr* aSelectionMgr = anApp->selectionMgr();
+  connect( aSelectionMgr, SIGNAL( currentSelectionChanged() ), this, SLOT( onSelectionEvent() ) );
+}
+
+VisuGUI_FeatureEdgesPanel::~VisuGUI_FeatureEdgesPanel()
+{
+}
+
+void VisuGUI_FeatureEdgesPanel::showEvent( QShowEvent* theEvent )
+{
+  onSelectionEvent();
+
+  VisuGUI_Panel::showEvent(theEvent);
+}
+
+VISU_Actor* VisuGUI_FeatureEdgesPanel::getSelectedActor() const
+{
+  SVTK_ViewWindow* aViewWindow = VISU::GetActiveViewWindow<SVTK_ViewWindow>( myModule );
+  if( !aViewWindow )
+    return 0;
+
+  _PTR(SObject) aSObject;
+  VISU::Prs3d_i* aPrs3d = 0;
+  Handle(SALOME_InteractiveObject) anIO;
+
+  VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects( myModule );
+  if( aSelectionInfo.size() != 1 )
+    return 0;
+
+  VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
+  VISU::TObjectInfo anObjectInfo = aSelectionItem.myObjectInfo;
+  aPrs3d = GetPrs3dFromBase( anObjectInfo.myBase );
+  if( !aPrs3d )
+    return 0;
+
+  anIO = aSelectionItem.myIO;
+  aSObject = anObjectInfo.mySObject;
+  
+  VISU_Actor* anActor =
+    VISU::FindActor( VISU::GetAppStudy( myModule ), aViewWindow, aSObject->GetID().c_str() );
+
+  return anActor;
+}
+
+void VisuGUI_FeatureEdgesPanel::onSelectionEvent()
+{
+  myActor = getSelectedActor();
+  bool anIsSelected = myActor && myActor->IsFeatureEdgesAllowed();
+
+  myGrp->setEnabled( anIsSelected );
+  myApply->setEnabled( anIsSelected );
+
+  if( !anIsSelected )
+    return;
+
+  if( !myActor->IsFeatureEdgesAllowed() )
+    return;
+
+  float anAngle = myActor->GetFeatureEdgesAngle();
+
+  bool anIsFeatureEdges = false,
+       anIsBoundaryEdges = false,
+       anIsManifoldEdges = false,
+       anIsNonManifoldEdges = false;
+  myActor->GetFeatureEdgesFlags( anIsFeatureEdges,
+                                anIsBoundaryEdges,
+                                anIsManifoldEdges,
+                                anIsNonManifoldEdges );
+
+  float aColoring = myActor->GetFeatureEdgesColoring();
+
+  myAngleSpinBox->setValue( anAngle );
+  myFeatureEdgesCB->setChecked( anIsFeatureEdges );
+  myBoundaryEdgesCB->setChecked( anIsBoundaryEdges );
+  myManifoldEdgesCB->setChecked( anIsManifoldEdges );
+  myNonManifoldEdgesCB->setChecked( anIsNonManifoldEdges );
+  //myColoringCB->setChecked( aColoring );
+}
+
+void VisuGUI_FeatureEdgesPanel::onApply()
+{
+  if( myActor )
+  {
+    myActor->SetFeatureEdgesAngle( myAngleSpinBox->value() );
+    myActor->SetFeatureEdgesFlags( myFeatureEdgesCB->isChecked(),
+                                  myBoundaryEdgesCB->isChecked(),
+                                  myManifoldEdgesCB->isChecked(),
+                                  myNonManifoldEdgesCB->isChecked() );
+    //myActor->SetFeatureEdgesColoring( myColoringCB->isChecked() );
+    myActor->Update();
+  }
+
+  VisuGUI_Panel::onApply();
+}
+
+void VisuGUI_FeatureEdgesPanel::onClose()
+{
+  close();
+  VisuGUI_Panel::onClose();
+}
+
+void VisuGUI_FeatureEdgesPanel::onHelp()
+{
+  QString aHelpFileName = "feature_edges_page.html";
+  LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication());
+  if (app)
+    app->onHelpContextModule(myModule ? app->moduleName(myModule->moduleName()) : QString(""), aHelpFileName);
+  else {
+    QString platform;
+#ifdef WIN32
+    platform = "winapplication";
+#else
+    platform = "application";
+#endif
+    SUIT_MessageBox::warning(0, QObject::tr("WRN_WARNING"),
+                             QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
+                             arg(app->resourceMgr()->stringValue("ExternalBrowser", platform)).arg(aHelpFileName) );
+  }
+
+  VisuGUI_Panel::onHelp();
+}
+
+void VisuGUI_FeatureEdgesPanel::keyPressEvent( QKeyEvent* e )
+{
+  VisuGUI_Panel::keyPressEvent( e );
+  if ( e->isAccepted() )
+    return;
+
+  if ( e->key() == Qt::Key_F1 )
+    {
+      e->accept();
+      onHelp();
+    }
+}
diff --git a/src/VISUGUI/VisuGUI_FeatureEdgesPanel.h b/src/VISUGUI/VisuGUI_FeatureEdgesPanel.h
new file mode 100644 (file)
index 0000000..649c8ad
--- /dev/null
@@ -0,0 +1,74 @@
+//  VISU VISUGUI : GUI of VISU component
+//
+//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
+// 
+//  This library is free software; you can redistribute it and/or 
+//  modify it under the terms of the GNU Lesser General Public 
+//  License as published by the Free Software Foundation; either 
+//  version 2.1 of the License. 
+// 
+//  This library is distributed in the hope that it will be useful, 
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of 
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
+//  Lesser General Public License for more details. 
+// 
+//  You should have received a copy of the GNU Lesser General Public 
+//  License along with this library; if not, write to the Free Software 
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
+// 
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+//
+//  File   : VisuGUI_FeatureEdgesPanel.h
+//  Author : Oleg Uvarov
+//  Module : VISU
+
+#ifndef VISUGUI_FEATUREEDGESPANEL_H
+#define VISUGUI_FEATUREEDGESPANEL_H
+
+#include <VisuGUI_Panel.h>
+
+class QCheckBox;
+class QGroupBox;
+
+class QtxDoubleSpinBox;
+
+class VISU_Actor;
+
+class VisuGUI_FeatureEdgesPanel: public VisuGUI_Panel
+{
+  Q_OBJECT
+
+public:
+  VisuGUI_FeatureEdgesPanel( const VisuGUI* theModule, QWidget* theParent = 0 );
+  virtual ~VisuGUI_FeatureEdgesPanel ();
+
+protected:
+  virtual void              keyPressEvent( QKeyEvent* theEvent );
+  virtual void              showEvent( QShowEvent* theEvent );
+
+private slots:
+  virtual void              onApply();
+  virtual void              onClose();
+  virtual void              onHelp();
+
+  void                      onSelectionEvent();
+
+private:
+  VISU_Actor*               getSelectedActor() const;
+
+private:
+  QGroupBox*                myGrp;
+
+  QtxDoubleSpinBox*         myAngleSpinBox;
+  QCheckBox*                myFeatureEdgesCB;
+  QCheckBox*                myBoundaryEdgesCB;
+  QCheckBox*                myManifoldEdgesCB;
+  QCheckBox*                myNonManifoldEdgesCB;
+  QCheckBox*                myColoringCB;
+
+  VISU_Actor*               myActor;
+};
+
+#endif
diff --git a/src/VISUGUI/VisuGUI_FilterScalarsDlg.cxx b/src/VISUGUI/VisuGUI_FilterScalarsDlg.cxx
new file mode 100644 (file)
index 0000000..d3ff902
--- /dev/null
@@ -0,0 +1,165 @@
+// Copyright (C) 2005  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+// 
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either 
+// version 2.1 of the License.
+// 
+// This library is distributed in the hope that it will be useful 
+// but WITHOUT ANY WARRANTY; without even the implied warranty of 
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public  
+// License along with this library; if not, write to the Free Software 
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#include "VisuGUI_FilterScalarsDlg.h"
+#include "VISU_ColoredPrs3d_i.hh"
+#include "VISU_ColoredPrs3dHolder_i.hh"
+
+#include "VisuGUI.h"
+#include "VisuGUI_Tools.h"
+
+#include <SalomeApp_Application.h>
+#include <LightApp_SelectionMgr.h>
+
+#include <SUIT_Desktop.h>
+#include <SUIT_MessageBox.h>
+#include <SUIT_Session.h>
+#include <SUIT_ResourceMgr.h>
+
+#include <QPushButton>
+#include <QVBoxLayout>
+#include <QHBoxLayout>
+#include <QGroupBox>
+#include <QLabel>
+#include <QLineEdit>
+#include <QDoubleValidator>
+  
+
+VisuGUI_FilterScalarsDlg::VisuGUI_FilterScalarsDlg( VisuGUI* theModule )
+  : QDialog(VISU::GetDesktop(theModule), Qt::WindowTitleHint | Qt::WindowSystemMenuHint ),
+    myVisuGUI( theModule )
+{
+  setModal( false );
+  setWindowTitle(tr("TITLE"));
+  setSizeGripEnabled(true);
+  setAttribute( Qt::WA_DeleteOnClose, true );
+  
+  QVBoxLayout* aMainLayout = new QVBoxLayout(this);
+  
+  myRangeBox = new QGroupBox(this);
+  myRangeBox->setTitle(tr("BOXTITLE"));
+  myRangeBox->setCheckable(true);
+  aMainLayout->addWidget(myRangeBox);
+
+  QHBoxLayout* aBoxLayout = new QHBoxLayout(myRangeBox);
+  aBoxLayout->addWidget(new QLabel(tr("MINLBL"), myRangeBox));
+  myMinEdit = new QLineEdit( myRangeBox );
+  myMinEdit->setValidator( new QDoubleValidator(myMinEdit) );
+  aBoxLayout->addWidget(myMinEdit);
+
+  aBoxLayout->addWidget(new QLabel(tr("MAXLBL"), myRangeBox));
+  myMaxEdit = new QLineEdit( myRangeBox );
+  myMaxEdit->setValidator( new QDoubleValidator(myMaxEdit) );
+  aBoxLayout->addWidget(myMaxEdit);
+
+  QGroupBox* aGroupButtons = new QGroupBox(this);
+  QHBoxLayout* aButtonsLayout = new QHBoxLayout(aGroupButtons);
+
+  QPushButton* aBtnOk = new QPushButton(tr("BUT_OK"), aGroupButtons);
+  aBtnOk->setAutoDefault(true);
+  aBtnOk->setDefault(true);
+  aButtonsLayout->addWidget(aBtnOk);
+
+  QPushButton* aBtnCancel = new QPushButton(tr("BUT_CANCEL"), aGroupButtons);
+  aBtnCancel->setAutoDefault(true);
+  aButtonsLayout->addWidget(aBtnCancel);
+
+  aButtonsLayout->addStretch();
+
+  QPushButton* aBtnHelp = new QPushButton(tr("BUT_HELP"), aGroupButtons);
+  aBtnHelp->setAutoDefault(true);
+  aButtonsLayout->addWidget(aBtnHelp);
+
+  aMainLayout->addWidget(aGroupButtons);
+
+  connect(aBtnOk,     SIGNAL(clicked()), this, SLOT(accept()));
+  connect(aBtnCancel, SIGNAL(clicked()), this, SLOT(reject()));
+  connect(aBtnHelp,   SIGNAL(clicked()), this, SLOT(onHelp()));
+
+  SalomeApp_Application* anApp = theModule->getApp();
+  LightApp_SelectionMgr* aSelectionMgr = anApp->selectionMgr();
+  connect( aSelectionMgr, SIGNAL( currentSelectionChanged() ), this, SLOT( onSelectionEvent() ) );
+
+  onSelectionEvent();
+}
+
+
+VisuGUI_FilterScalarsDlg::~VisuGUI_FilterScalarsDlg()
+{}
+
+void VisuGUI_FilterScalarsDlg::onSelectionEvent()
+{
+  typedef SALOME::GenericObjPtr< VISU::ColoredPrs3d_i  > TColoredPrs3dPtr;
+  VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects( myVisuGUI );
+  myColoredPrs3d = TColoredPrs3dPtr();
+  if ( !aSelectionInfo.empty() ) {
+    VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
+    if ( VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase ) {
+      if ( VISU::ColoredPrs3d_i* aColoredPrs3d = dynamic_cast< VISU::ColoredPrs3d_i* >( aBase ) ) {
+       myColoredPrs3d = aColoredPrs3d;
+      } else if (VISU::ColoredPrs3dHolder_i* aHolder = 
+                dynamic_cast< VISU::ColoredPrs3dHolder_i* >( aBase )) {
+       myColoredPrs3d = aHolder->GetPrs3dDevice();
+      }
+      if (myColoredPrs3d.get() != NULL) {
+       myRangeBox->setChecked( myColoredPrs3d->IsScalarFilterUsed() );
+       myMinEdit->setText( QString::number( myColoredPrs3d->GetScalarFilterMin() ) );
+       myMaxEdit->setText( QString::number( myColoredPrs3d->GetScalarFilterMax() ) );
+       setEnabled( true );
+       return;
+      }
+    }
+  }
+  setEnabled( false );
+  return;
+}
+
+void VisuGUI_FilterScalarsDlg::accept()
+{
+  myColoredPrs3d->SetScalarFilterRange( myMinEdit->text().toDouble(), myMaxEdit->text().toDouble() );
+  myColoredPrs3d->UseScalarFiltering( myRangeBox->isChecked() );
+  myColoredPrs3d->UpdateActors();
+  QDialog::accept();
+}
+
+void VisuGUI_FilterScalarsDlg::reject()
+{
+  QDialog::reject();
+}
+  
+void VisuGUI_FilterScalarsDlg::onHelp()
+{
+  QString aHelpFileName = "filterbyscalars_page.html";
+  LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication());
+  if (app)
+    app->onHelpContextModule(myVisuGUI ? app->moduleName(myVisuGUI->moduleName()) : QString(""), aHelpFileName);
+  else {
+    QString platform;
+#ifdef WIN32
+    platform = "winapplication";
+#else
+    platform = "application";
+#endif
+    SUIT_MessageBox::warning(0, tr("WRN_WARNING"),
+                             tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
+                             arg(app->resourceMgr()->stringValue("ExternalBrowser", platform)).arg(aHelpFileName),
+                             tr("BUT_OK"));
+  }
+}
diff --git a/src/VISUGUI/VisuGUI_FilterScalarsDlg.h b/src/VISUGUI/VisuGUI_FilterScalarsDlg.h
new file mode 100644 (file)
index 0000000..fdbb1f2
--- /dev/null
@@ -0,0 +1,75 @@
+//  VISU VISUGUI : GUI of VISU component
+//
+//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+//
+//
+//  File   : VisuGUI_FilterScalarsDlg.h
+//  Author : vsv
+//  Module : VISU
+
+
+#ifndef VISUGUI_FILTERSCALARSDLG_H
+#define VISUGUI_FILTERSCALARSDLG_H
+
+#include <QDialog>
+
+#include "SALOME_GenericObjPointer.hh"
+
+class VisuGUI;
+
+class QLineEdit;
+class QGroupBox;
+
+namespace VISU
+{
+  class ColoredPrs3d_i;
+}
+
+
+class VisuGUI_FilterScalarsDlg: public QDialog
+{
+  Q_OBJECT;
+
+ public:
+  VisuGUI_FilterScalarsDlg( VisuGUI* theModule );
+  ~VisuGUI_FilterScalarsDlg();
+
+protected slots:
+
+  virtual void accept();
+  virtual void reject(); 
+
+private slots:
+
+  void onHelp();
+  void onSelectionEvent();
+
+private:
+  VisuGUI* myVisuGUI;
+  SALOME::GenericObjPtr< VISU::ColoredPrs3d_i > myColoredPrs3d;
+
+  QGroupBox* myRangeBox;
+  QLineEdit* myMinEdit;
+  QLineEdit* myMaxEdit;
+};
+
+
+#endif
diff --git a/src/VISUGUI/VisuGUI_FindPane.cxx b/src/VISUGUI/VisuGUI_FindPane.cxx
new file mode 100644 (file)
index 0000000..61b436e
--- /dev/null
@@ -0,0 +1,366 @@
+//  VISU VISUGUI : GUI of VISU component
+//
+//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
+// 
+//  This library is free software; you can redistribute it and/or 
+//  modify it under the terms of the GNU Lesser General Public 
+//  License as published by the Free Software Foundation; either 
+//  version 2.1 of the License. 
+// 
+//  This library is distributed in the hope that it will be useful, 
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of 
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
+//  Lesser General Public License for more details. 
+// 
+//  You should have received a copy of the GNU Lesser General Public 
+//  License along with this library; if not, write to the Free Software 
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
+// 
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+//  File   : VisuGUI_FindPane.cxx
+//  Author : Oleg Uvarov
+//  Module : VISU
+
+#include "VisuGUI_FindPane.h"
+#include "VisuGUI_Tools.h"
+
+#include "VISU_Actor.h"
+#include "VISU_Event.h"
+#include "VISU_GaussPtsAct.h"
+
+#include "VISU_IDMapper.hxx"
+#include "VISU_GaussPointsPL.hxx"
+#include "VISU_ConvertorUtils.hxx"
+
+#include "SUIT_MessageBox.h"
+#include "SUIT_ResourceMgr.h"
+
+#include <QComboBox>
+#include <QLabel>
+#include <QLayout>
+#include <QListWidget>
+#include <QLineEdit>
+#include <QToolButton>
+
+#include <vtkCellData.h>
+#include <vtkDataArray.h>
+#include <vtkDataSet.h>
+#include <vtkMapper.h>
+#include <vtkPointData.h>
+
+#define PAGE_SIZE 10
+
+VisuGUI_FindPane::VisuGUI_FindPane( QWidget* theParent ) :
+  QGroupBox( theParent ),
+  myCurrentPage( 0 ),
+  myActor( 0 )
+{
+  setTitle( tr( "FIND_TITLE" ) );
+
+  QGridLayout* aTopLayout = new QGridLayout( this );
+
+  QLabel* aConditionLabel = new QLabel( tr( "CONDITION" ), this );
+
+  myConditionBox = new QComboBox( this );
+  myConditionBox->addItems( QStringList()
+                           << tr( "MINIMUM" )
+                           << tr( "MAXIMUM" )
+                           << "="
+                           << "<="
+                           << ">="
+                           << tr( "BETWEEN" ) );
+
+  connect( myConditionBox, SIGNAL( currentIndexChanged( int ) ), this, SLOT( onConditionChanged( int ) ) );
+
+  QDoubleValidator* aDoubleValidator = new QDoubleValidator( this );
+
+  myLeftValue = new QLineEdit( this );
+  myLeftValue->setValidator( aDoubleValidator );
+
+  myDashLabel = new QLabel( "-", this );
+
+  myRightValue = new QLineEdit( this );
+  myRightValue->setValidator( aDoubleValidator );
+
+  QToolButton* anApplyBtn = new QToolButton( this );
+  anApplyBtn->setIcon( VISU::GetResourceMgr()->loadPixmap( "VISU", tr( "ICON_APPLY" ) ) );
+  connect( anApplyBtn, SIGNAL( clicked() ), this, SLOT( onApply() ) );
+
+
+  QWidget* anIdsWidget = new QWidget( this );
+  QGridLayout* anIdsLayout = new QGridLayout( anIdsWidget );
+  anIdsLayout->setMargin( 0 );
+
+  myIdsListWidget = new QListWidget( anIdsWidget );
+  myIdsListWidget->setFlow( QListView::LeftToRight );
+  myIdsListWidget->setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOn );
+  myIdsListWidget->setFixedHeight( 45 );
+
+  connect( myIdsListWidget, SIGNAL( itemSelectionChanged() ), this, SLOT( onIdChanged() ) );
+
+  myPageLabel = new QLabel( anIdsWidget );
+  myPageLabel->setAlignment( Qt::AlignHCenter );
+
+  myPrevBtn = new QToolButton( anIdsWidget );
+  myPrevBtn->setIcon( VISU::GetResourceMgr()->loadPixmap( "VISU", tr( "ICON_SLIDER_PREVIOUS" ) ) );
+  connect( myPrevBtn, SIGNAL( clicked() ), this, SLOT( onPrevPage() ) );
+
+  myNextBtn = new QToolButton( anIdsWidget );
+  myNextBtn->setIcon( VISU::GetResourceMgr()->loadPixmap( "VISU", tr( "ICON_SLIDER_NEXT" ) ) );
+  connect( myNextBtn, SIGNAL( clicked() ), this, SLOT( onNextPage() ) );
+
+  anIdsLayout->addWidget( myIdsListWidget, 0, 0, 2, 1 );
+  anIdsLayout->addWidget( myPageLabel,     0, 1, 1, 2 );
+  anIdsLayout->addWidget( myPrevBtn,       1, 1 );
+  anIdsLayout->addWidget( myNextBtn,       1, 2 );
+
+
+  aTopLayout->addWidget( aConditionLabel, 0, 0, 1, 5 );
+  aTopLayout->addWidget( myConditionBox,  1, 0 );
+  aTopLayout->addWidget( myLeftValue,     1, 1 );
+  aTopLayout->addWidget( myDashLabel,     1, 2 );
+  aTopLayout->addWidget( myRightValue,    1, 3 );
+  aTopLayout->addWidget( anApplyBtn,      1, 4 );
+  aTopLayout->addWidget( anIdsWidget,     2, 0, 1, 5 );
+
+  onConditionChanged( 0 );
+
+  setSelectionMode( ActorSelection );
+}
+
+VisuGUI_FindPane::~VisuGUI_FindPane()
+{
+}
+
+void VisuGUI_FindPane::setSelectionMode( const Selection_Mode theSelectionMode )
+{
+  if( mySelectionMode != theSelectionMode )
+    clearIds();
+
+  mySelectionMode = theSelectionMode;
+  setEnabled( mySelectionMode != ActorSelection );
+}
+
+
+void VisuGUI_FindPane::setActor( VISU_Actor* theActor )
+{
+  if( myActor != theActor )
+    clearIds();
+
+  myActor = theActor;
+}
+
+void VisuGUI_FindPane::onConditionChanged( int theId )
+{
+  myLeftValue->setEnabled( theId >= 2 );
+  myDashLabel->setEnabled( theId == 5 );
+  myRightValue->setEnabled( theId == 5 );
+}
+
+void VisuGUI_FindPane::onApply()
+{
+  if( !isValid() )
+  {
+    SUIT_MessageBox::warning( this, tr( "WRN_VISU" ), tr( "INCORRECT_VALUES" ) );
+    return;
+  }
+
+  myIdsListWidget->clear();
+
+  if( !myActor )
+    return;
+
+  vtkDataSet* aDataSet = myActor->GetInput();
+
+  vtkDataArray* aScalars = 0;
+  if( mySelectionMode == NodeSelection )
+    aScalars = aDataSet->GetPointData()->GetScalars();
+  else if( mySelectionMode == CellSelection )
+    aScalars = aDataSet->GetCellData()->GetScalars();
+  else if( mySelectionMode == GaussPointSelection )
+  {
+    if( VISU_GaussPtsAct* aGaussPtsAct = dynamic_cast<VISU_GaussPtsAct*>( myActor ) )
+      aScalars = aGaussPtsAct->GetInput()->GetPointData()->GetScalars();
+  }
+
+
+  if( !aScalars )
+    return;
+
+  int aCondition = myConditionBox->currentIndex();
+  double aLeftValue = myLeftValue->text().toDouble();
+  double aRightValue = myRightValue->text().toDouble();
+
+  myIdsList.clear();
+
+  double eps = 1.0 / VTK_LARGE_FLOAT;
+
+  double anExtremum = 0;
+  if( aCondition == 0 )
+    anExtremum = VTK_LARGE_FLOAT;
+  else if( aCondition == 1 )
+    anExtremum = -VTK_LARGE_FLOAT;
+
+  for( int aVTKId = 0, aNbVal = aScalars->GetNumberOfTuples(); aVTKId < aNbVal; aVTKId++ )
+  {
+    double aValue = *aScalars->GetTuple( aVTKId );
+
+    TFindId anId( -1, -1 );
+    if( mySelectionMode == NodeSelection )
+      anId.first = VISU::GetNodeObjID( aDataSet, aVTKId );
+    else if( mySelectionMode == CellSelection )
+      anId.first = VISU::GetElemObjID( aDataSet, aVTKId );
+    else if( mySelectionMode == GaussPointSelection )
+    {
+      if( VISU_GaussPtsAct* aGaussPtsAct = dynamic_cast<VISU_GaussPtsAct*>( myActor ) )
+      {
+       VISU::TGaussPointID aGaussPointID = aGaussPtsAct->GetGaussPointsPL()->GetObjID( aVTKId );
+       anId.first = aGaussPointID.first;
+       anId.second = aGaussPointID.second;
+      }
+    }
+    //printf( "(%d) <%d - %d> %f\n", aVTKId, anId.first, anId.second, aValue );
+
+    if( anId.first < 0 ||
+       anId.second < 0 && mySelectionMode == GaussPointSelection )
+      continue;
+
+    bool ok = false;
+    switch( aCondition )
+    {
+    case 0: // Minimum
+      ok = ( aValue - anExtremum ) < eps;
+      break;
+    case 1: // Maximum
+      ok = ( aValue - anExtremum ) > -eps;
+      break;
+    case 2: // =
+      ok = fabs( aValue - aLeftValue ) < eps;
+      break;
+    case 3: // <=
+      ok = ( aValue - aLeftValue ) < eps;
+      break;
+    case 4: // >=
+      ok = ( aValue - aLeftValue ) > -eps;
+      break;
+    case 5: // Between
+      ok = ( aValue - aLeftValue ) > -eps && ( aValue - aRightValue ) < eps;
+      break;
+    default:
+      ok = true;
+      break;
+    }
+
+    if( ok )
+    {
+      if( aCondition <= 1 && fabs( aValue - anExtremum ) > eps )
+      {
+       anExtremum = aValue;
+       myIdsList.clear();
+      }
+      if( !myIdsList.contains( anId ) )
+        myIdsList.append( anId );
+    }
+  }
+
+  qSort( myIdsList );
+
+  myCurrentPage = 0;
+  displayIds();
+}
+
+void VisuGUI_FindPane::onIdChanged()
+{
+  int aFirstId = -1, aSecondId = -1;
+
+  QList<QListWidgetItem*> aSelectedItems = myIdsListWidget->selectedItems();
+  if( aSelectedItems.size() == 1 )
+  {
+    QString aStr = aSelectedItems.first()->text();
+
+    bool ok = false;
+    aFirstId = aStr.toInt( &ok );
+    if( !ok ) // try to parse the string as a pair of ids - "[aFirstId aSecondId]"
+    {
+      aStr.remove( '[' );
+      aStr.remove( ']' );
+      aFirstId = aStr.section( ' ', 0, 0 ).toInt( &ok );
+      if( !ok )
+       aFirstId = -1;
+      else
+      {
+       ok = false;
+       aSecondId = aStr.section( ' ', 1, 1 ).toInt( &ok );
+       if( !ok )
+         aSecondId = -1;
+      }
+    }
+  }
+
+  emit idChanged( aFirstId, aSecondId );
+}
+
+void VisuGUI_FindPane::onPrevPage()
+{
+  myCurrentPage--;
+  displayIds();
+}
+
+void VisuGUI_FindPane::onNextPage()
+{
+  myCurrentPage++;
+  displayIds();
+}
+
+bool VisuGUI_FindPane::isValid() const
+{
+  bool ok = false;;
+  double aLeftValue = myLeftValue->text().toDouble( &ok );
+  if( myLeftValue->isEnabled() && !ok )
+    return false;
+
+  ok = false;
+  double aRightValue = myRightValue->text().toDouble( &ok );
+  if( myRightValue->isEnabled() && ( !ok || aRightValue < aLeftValue ) )
+    return false;
+
+  return true;
+}
+
+void VisuGUI_FindPane::clearIds()
+{
+  myIdsList.clear();
+  myCurrentPage = 0;
+
+  displayIds();
+}
+
+void VisuGUI_FindPane::displayIds()
+{
+  myIdsListWidget->clear();
+
+  int aSize = myIdsList.size();
+
+  myPrevBtn->setEnabled( myCurrentPage != 0 );
+  myNextBtn->setEnabled( ( myCurrentPage + 1 ) * PAGE_SIZE < aSize );
+  myPageLabel->setText( QString( "Page %1/%2" )
+                       .arg( aSize > 0 ? myCurrentPage + 1 : 0 )
+                       .arg( aSize > 0 ? ( aSize - 1 ) / PAGE_SIZE + 1 : 0 ) );
+
+  int aFirstIndex = myCurrentPage * PAGE_SIZE;
+  int aLastIndex = aFirstIndex + PAGE_SIZE - 1;
+  if( aLastIndex >= aSize )
+    aLastIndex = aSize - 1;
+
+  for( int anIndex = aFirstIndex; anIndex <= aLastIndex; anIndex++ )
+  {
+    TFindId anId = myIdsList[ anIndex ];
+    int aFirstId = anId.first, aSecondId = anId.second;
+    QString aStr = aSecondId < 0 ?
+      QString( "%1" ).arg( aFirstId ) :
+      QString( "[%1 %2]" ).arg( aFirstId ).arg( aSecondId );
+    myIdsListWidget->addItem( aStr );
+  }
+}
diff --git a/src/VISUGUI/VisuGUI_FindPane.h b/src/VISUGUI/VisuGUI_FindPane.h
new file mode 100644 (file)
index 0000000..3e36a20
--- /dev/null
@@ -0,0 +1,94 @@
+//  VISU VISUGUI : GUI of VISU component
+//
+//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
+// 
+//  This library is free software; you can redistribute it and/or 
+//  modify it under the terms of the GNU Lesser General Public 
+//  License as published by the Free Software Foundation; either 
+//  version 2.1 of the License. 
+// 
+//  This library is distributed in the hope that it will be useful, 
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of 
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
+//  Lesser General Public License for more details. 
+// 
+//  You should have received a copy of the GNU Lesser General Public 
+//  License along with this library; if not, write to the Free Software 
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
+// 
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+//  File   : VisuGUI_FindPane.h
+//  Author : Oleg Uvarov
+//  Module : VISU
+
+#ifndef VISUGUI_FINDPANE_H
+#define VISUGUI_FINDPANE_H
+
+#include <SVTK_Selection.h>
+
+#include <QGroupBox>
+
+class QComboBox;
+class QLabel;
+class QLineEdit;
+class QListWidget;
+class QToolButton;
+
+class VISU_Actor;
+
+typedef QPair<int,int> TFindId;
+typedef QList<TFindId> TListFindId;
+
+//! Find pane.
+/*!
+ * Used for filter and highlight mesh-elements by their scalar values.
+ */
+class VisuGUI_FindPane : public QGroupBox
+{
+  Q_OBJECT
+
+public:
+  VisuGUI_FindPane( QWidget* theParent );
+  ~VisuGUI_FindPane();
+
+public:
+  void             setSelectionMode( const Selection_Mode );
+  void             setActor( VISU_Actor* );
+
+protected slots:
+  void             onConditionChanged( int );
+  void             onApply();
+
+  void             onIdChanged();
+  void             onPrevPage();
+  void             onNextPage();
+
+private:
+  bool             isValid() const;
+  void             clearIds();
+  void             displayIds();
+
+signals:
+  void             idChanged( int, int );
+
+private:
+  QComboBox*       myConditionBox;
+  QLineEdit*       myLeftValue;
+  QLabel*          myDashLabel;
+  QLineEdit*       myRightValue;
+
+  QListWidget*     myIdsListWidget;
+  QLabel*          myPageLabel;
+  QToolButton*     myPrevBtn;
+  QToolButton*     myNextBtn;
+
+  int              myCurrentPage;
+  TListFindId      myIdsList;
+
+  Selection_Mode   mySelectionMode;
+  VISU_Actor*      myActor;
+};
+
+#endif
diff --git a/src/VISUGUI/VisuGUI_GaussPointsSelectionPane.cxx b/src/VISUGUI/VisuGUI_GaussPointsSelectionPane.cxx
new file mode 100644 (file)
index 0000000..4d5595d
--- /dev/null
@@ -0,0 +1,515 @@
+//  VISU VISUGUI : GUI of VISU component
+//
+//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
+// 
+//  This library is free software; you can redistribute it and/or 
+//  modify it under the terms of the GNU Lesser General Public 
+//  License as published by the Free Software Foundation; either 
+//  version 2.1 of the License. 
+// 
+//  This library is distributed in the hope that it will be useful, 
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of 
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
+//  Lesser General Public License for more details. 
+// 
+//  You should have received a copy of the GNU Lesser General Public 
+//  License along with this library; if not, write to the Free Software 
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
+// 
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+//  File   : VisuGUI_GaussPointsSelectionPane.cxx
+//  Author : Oleg Uvarov
+//  Module : VISU
+
+#include "VisuGUI_GaussPointsSelectionPane.h"
+#include "VisuGUI_ViewTools.h"
+
+#include "VISU_GaussPtsAct.h"
+#include "VISU_GaussPtsSettings.h"
+#include "VISU_GaussPointsPL.hxx"
+#include "VISU_PickingSettings.h"
+
+#include "SUIT_MessageBox.h"
+#include "SUIT_ResourceMgr.h"
+#include "SUIT_Session.h"
+
+#include "CAM_Module.h"
+
+#include "SVTK_Selector.h"
+#include "SVTK_ViewWindow.h"
+//#include "SVTK_MainWindow.h"
+#include "SVTK_RenderWindowInteractor.h"
+
+#include "VTKViewer_Algorithm.h"
+#include "SVTK_Functor.h"
+
+#include <vtkActorCollection.h>
+#include <vtkCallbackCommand.h>
+#include <vtkObjectFactory.h>
+#include <vtkRenderer.h>
+#include <vtkGenericRenderWindowInteractor.h>
+#include <vtkSmartPointer.h>
+
+#include "utilities.h"
+
+#include <QCheckBox>
+#include <QComboBox>
+#include <QGroupBox>
+#include <QLabel>
+#include <QLayout>
+#include <QPushButton>
+#include <QVBoxLayout>
+#include <QKeyEvent>
+#include <QIntValidator>
+#include <QToolButton>
+
+#include "LightApp_Application.h"
+
+namespace
+{
+  struct SelectorHelper
+  {
+  public:
+    SelectorHelper( const SalomeApp_Module* theModule ):
+      myModule( theModule )
+    {}
+
+    bool
+    get()
+    {
+      bool aResult = false;
+      myMapIndex.Clear();
+      mySelector = NULL;
+      myPipeLine = NULL;
+      myActor = NULL;
+
+      SVTK_RenderWindowInteractor* anInteractor = NULL;
+      if( SVTK_ViewWindow* aViewWindow = VISU::GetActiveViewWindow<SVTK_ViewWindow>( myModule ) )
+       //if( SVTK_MainWindow* aMainWindow = aViewWindow->getMainWindow() )
+         anInteractor = aViewWindow->GetInteractor();
+
+      if ( !anInteractor )
+       return aResult;
+      
+      mySelector = anInteractor->GetSelector();
+      if ( !mySelector )
+       return aResult;
+      
+      const SALOME_ListIO& aListIO = mySelector->StoredIObjects();
+      if ( aListIO.Extent() != 1 ) 
+       return aResult;
+      
+      myIO = aListIO.First();
+      if ( mySelector->HasIndex( myIO ) )
+       mySelector->GetIndex(myIO, myMapIndex);
+       
+      myActor = SVTK::Find<VISU_GaussPtsAct>(anInteractor->getRenderer()->GetActors(),
+                                            SVTK::TIsSameIObject<VISU_GaussPtsAct>( myIO ));
+      if ( !myActor )
+       return aResult;
+      
+      myPipeLine = myActor->GetGaussPointsPL();
+
+      return true;
+    }
+
+    const SalomeApp_Module* myModule;
+    TColStd_IndexedMapOfInteger myMapIndex;
+    Handle(SALOME_InteractiveObject) myIO;
+    SVTK_Selector* mySelector;
+
+    VISU_GaussPointsPL* myPipeLine;
+    VISU_GaussPtsAct* myActor;
+  };
+
+
+  
+  class GaussPtsIDValidator: public QIntValidator
+  {
+  public:
+    GaussPtsIDValidator( const SalomeApp_Module* theModule,
+                        QObject * theParent ):
+      QIntValidator( 0, VTK_LARGE_ID, theParent ),
+      myHelper(theModule)
+    {}
+
+    virtual 
+    State
+    validate ( QString & theInput, int & thePos ) const
+    {
+      if ( QIntValidator::validate( theInput, thePos ) == QValidator::Invalid)
+       return QValidator::Invalid;
+      
+      if ( !myHelper.get() )
+       return QValidator::Invalid;
+
+      return QValidator::Acceptable;
+    }
+
+  protected:
+    mutable SelectorHelper myHelper;
+  };
+
+
+  class GaussCellIDValidator: public GaussPtsIDValidator
+  {
+  public:
+    GaussCellIDValidator( QLineEdit* theLocalPointLabel,
+                         const SalomeApp_Module* theModule,
+                         QObject * theParent ):
+      GaussPtsIDValidator( theModule, theParent ),
+      myLocalPointLineEdit( theLocalPointLabel )
+    {}
+
+    virtual 
+    State
+    validate ( QString & theInput, int & thePos ) const
+    {
+      if( theInput.isEmpty() )
+       return QValidator::Acceptable;
+
+      if ( GaussPtsIDValidator::validate( theInput, thePos ) == QValidator::Invalid)
+       return QValidator::Invalid;
+
+      VISU::TCellID aCellID = theInput.toInt();
+      VISU::TLocalPntID aLocalPntID = myLocalPointLineEdit->text().toInt();
+      VISU::PGaussPtsIDMapper anIDMapper = myHelper.myPipeLine->GetGaussPtsIDMapper();
+      if ( anIDMapper->GetVTKID( VISU::TGaussPointID( aCellID, aLocalPntID ) ) < 0 )
+       return QValidator::Intermediate;
+
+      return QValidator::Acceptable;
+    }
+
+  private:
+    QLineEdit* myLocalPointLineEdit;
+  };
+
+
+  class GaussLocalPointIDValidator: public GaussPtsIDValidator
+  {
+  public:
+    GaussLocalPointIDValidator( QLineEdit* theParentElementLineEdit,
+                               const SalomeApp_Module* theModule,
+                               QObject * theParent ):
+      GaussPtsIDValidator( theModule, theParent ),
+      myParentElementLineEdit( theParentElementLineEdit )
+    {}
+
+    virtual 
+    State
+    validate ( QString & theInput, int & thePos ) const
+    {
+      if( theInput.isEmpty() )
+       return QValidator::Acceptable;
+
+      if ( GaussPtsIDValidator::validate( theInput, thePos ) == QValidator::Invalid)
+       return QValidator::Invalid;
+
+      VISU::TLocalPntID aLocalPntID = theInput.toInt();
+      VISU::TCellID aCellID = myParentElementLineEdit->text().toInt();
+      VISU::PGaussPtsIDMapper anIDMapper = myHelper.myPipeLine->GetGaussPtsIDMapper();
+      if ( anIDMapper->GetVTKID( VISU::TGaussPointID( aCellID, aLocalPntID ) ) < 0 )
+       return QValidator::Intermediate;
+
+      return QValidator::Acceptable;
+    }
+
+  private:
+    QLineEdit* myParentElementLineEdit;
+  };
+}
+
+
+VisuGUI_ValidatedLineEdit::VisuGUI_ValidatedLineEdit( QWidget* parent ):
+  QLineEdit( parent )
+{
+  connect( this, SIGNAL( textChanged( const QString& ) ), this, SLOT( MarkValidated( const QString& ) ) );
+}
+
+void VisuGUI_ValidatedLineEdit::MarkValidated( const QString& theText )
+{
+  if ( !validator() )
+    return;
+  
+  int aPos;
+  QString aText( theText );
+  QPalette pal = palette();
+  switch ( validator()->validate( aText, aPos ) ) {
+  case QValidator::Invalid:
+  case QValidator::Intermediate:
+    pal.setColor( foregroundRole(), QColor( 255, 0, 0 ));
+    setPalette( pal );
+    break;
+  case QValidator::Acceptable:
+    pal.setColor( foregroundRole(), QColor( 0, 0, 0 ));
+    setPalette( pal );
+    break;
+  }
+}
+
+//---------------------------------------------------------------------------------
+
+VisuGUI_GaussPointsSelectionPane::VisuGUI_GaussPointsSelectionPane( const SalomeApp_Module* theModule,
+                                                                   QWidget* theParent ) :
+  QWidget( theParent ),
+  myModule( theModule ),
+  myEventCallbackCommand( vtkCallbackCommand::New() )
+{
+  myPriority = 0.0;
+  myEventCallbackCommand->Delete();
+  myEventCallbackCommand->SetClientData(this); 
+  myEventCallbackCommand->SetCallback(VisuGUI_GaussPointsSelectionPane::ProcessEvents);
+
+  QVBoxLayout* TopLayout = new QVBoxLayout( this );
+  //TopLayout->setSpacing(6);
+
+  // Display parent mesh element
+  QGroupBox* PositionGroup = new QGroupBox( tr( "DATA_POSITION" ), this );
+  QGridLayout* PositionGroupLayout = new QGridLayout (PositionGroup);
+  PositionGroupLayout->setAlignment(Qt::AlignTop | Qt::AlignLeft);
+  //PositionGroupLayout->setSpacing(6);
+
+  QLabel* ParentElementLabel = new QLabel( tr( "PARENT_ELEMENT" ), PositionGroup );
+  ParentElementLabel->setToolTip( tr( "PARENT_ELEMENT_TIP" ) );
+  myParentElementLineEdit = new VisuGUI_ValidatedLineEdit( PositionGroup );
+  connect( myParentElementLineEdit, SIGNAL( textChanged( const QString& ) ), this, SLOT( onSelectionValidate() ) );
+  connect( myParentElementLineEdit, SIGNAL( returnPressed() ), this, SLOT( onSelectionApply() ) );
+
+  QToolButton* ParentElementBtn = new QToolButton( PositionGroup );
+  ParentElementBtn->setIcon( VISU::GetResourceMgr()->loadPixmap("VISU", tr( "ICON_OK" ) ) );
+  connect(ParentElementBtn, SIGNAL(clicked()), this, SLOT(onSelectionApply()));
+
+  QLabel* LocalPointLabel = new QLabel( tr( "LOCAL_POINT" ), PositionGroup );
+  LocalPointLabel->setToolTip( tr( "LOCAL_POINT_TIP" ) );
+  myLocalPointLineEdit = new VisuGUI_ValidatedLineEdit( PositionGroup );
+  connect( myLocalPointLineEdit,    SIGNAL( textChanged( const QString& ) ), this, SLOT( onSelectionValidate() ) );
+  connect( myLocalPointLineEdit,    SIGNAL( returnPressed() ), this, SLOT( onSelectionApply() ) );
+
+  QToolButton* LocalPointBtn = new QToolButton( PositionGroup );
+  LocalPointBtn->setIcon( VISU::GetResourceMgr()->loadPixmap("VISU", tr( "ICON_OK" ) ) );
+  connect(LocalPointBtn, SIGNAL(clicked()), this, SLOT(onSelectionApply()));
+
+  myCellIDValidator = new GaussCellIDValidator( myLocalPointLineEdit, myModule, myParentElementLineEdit );
+  myParentElementLineEdit->setValidator( myCellIDValidator );
+
+  myLocalPointIDValidator = new GaussLocalPointIDValidator( myParentElementLineEdit, myModule, myLocalPointLineEdit );
+  myLocalPointLineEdit->setValidator( myLocalPointIDValidator );
+
+  myDisplayParentMeshCheckBox = new QCheckBox( tr( "DISPLAY_PARENT_MESH" ), PositionGroup );
+
+  PositionGroupLayout->addWidget( ParentElementLabel,          0, 0, 1, 3 );
+  PositionGroupLayout->addWidget( myParentElementLineEdit,     0, 3 );
+  PositionGroupLayout->addWidget( ParentElementBtn,            0, 4 );
+  PositionGroupLayout->addWidget( LocalPointLabel,             1, 0, 1, 3 );
+  PositionGroupLayout->addWidget( myLocalPointLineEdit,        1, 3 );
+  PositionGroupLayout->addWidget( LocalPointBtn,               1, 4 );
+  PositionGroupLayout->addWidget( myDisplayParentMeshCheckBox, 2, 0, 1, 5 );
+
+  connect( myDisplayParentMeshCheckBox, SIGNAL( toggled( bool ) ), this, SLOT( onApplyDisplayParentMesh( bool ) ) );
+
+  TopLayout->addWidget( PositionGroup );
+  TopLayout->addStretch();
+}
+
+VisuGUI_GaussPointsSelectionPane::~VisuGUI_GaussPointsSelectionPane()
+{
+}
+
+void VisuGUI_GaussPointsSelectionPane::update()
+{
+  VISU_PickingSettings* aPickingSettings = VISU_PickingSettings::Get();
+  myDisplayParentMeshCheckBox->setChecked( aPickingSettings->GetDisplayParentMesh() );
+}
+
+void VisuGUI_GaussPointsSelectionPane::setIds( const int theParentId, const int theLocalId )
+{
+  myParentElementLineEdit->setText( theParentId < 0 ? "" : QString::number( theParentId ) );
+  myLocalPointLineEdit->setText( theLocalId < 0 ? "" : QString::number( theLocalId ) );
+  onSelectionApply();
+}
+
+void VisuGUI_GaussPointsSelectionPane::setInteractor( SVTK_RenderWindowInteractor* theInteractor )
+{
+  //printf( "VisuGUI_GaussPointsSelectionPane::setInteractor( %p )\n", theInteractor );
+  vtkGenericRenderWindowInteractor* aDevice = theInteractor->GetDevice();
+  if( aDevice->HasObserver(vtkCommand::KeyPressEvent) )
+    aDevice->RemoveObservers(vtkCommand::KeyPressEvent);
+
+  //printf( "AddObserver(vtkCommand::KeyPressEvent)\n" );
+  aDevice->AddObserver(vtkCommand::KeyPressEvent, 
+                      myEventCallbackCommand.GetPointer(), 
+                      myPriority);
+
+  if( aDevice->HasObserver(vtkCommand::EndPickEvent) )
+    aDevice->RemoveObservers(vtkCommand::EndPickEvent);
+
+  //printf( "AddObserver(vtkCommand::EndPickEvent)\n" );
+  aDevice->AddObserver(vtkCommand::EndPickEvent, 
+                      myEventCallbackCommand.GetPointer(), 
+                      myPriority);
+}
+
+SVTK_RenderWindowInteractor* VisuGUI_GaussPointsSelectionPane::getInteractor()
+{
+  if( SVTK_ViewWindow* aViewWindow = VISU::GetActiveViewWindow<SVTK_ViewWindow>( myModule ) )
+  {
+    //if( SVTK_MainWindow* aMainWindow = aViewWindow->getMainWindow() )
+    //{
+      SVTK_RenderWindowInteractor* anInteractor = aViewWindow->GetInteractor();
+      return anInteractor;
+      //}
+  }
+  return 0;
+}
+
+void VisuGUI_GaussPointsSelectionPane::ProcessEvents(vtkObject* vtkNotUsed(theObject),
+                                                    unsigned long theEvent,
+                                                    void* theClientData,
+                                                    void* vtkNotUsed(theCallData))
+{
+  VisuGUI_GaussPointsSelectionPane* self = reinterpret_cast<VisuGUI_GaussPointsSelectionPane*>(theClientData);
+
+  switch(theEvent){
+  case vtkCommand::KeyPressEvent:
+    self->KeyPressed();
+    break;
+  case vtkCommand::EndPickEvent:
+    self->SelectionEvent();
+    break;
+  }
+}
+
+void VisuGUI_GaussPointsSelectionPane::KeyPressed()
+{
+  //printf( "VisuGUI_GaussPointsSelectionPane::KeyPressed()\n" );
+  if( getInteractor()->GetDevice()->GetKeyCode() == 'P' )
+  {
+    VISU_PickingSettings* aPickingSettings = VISU_PickingSettings::Get();
+
+    bool aDisplayParentMesh = !aPickingSettings->GetDisplayParentMesh();
+    myDisplayParentMeshCheckBox->setChecked( aDisplayParentMesh );
+
+    aPickingSettings->SetDisplayParentMesh( aDisplayParentMesh );
+    aPickingSettings->InvokeEvent(VISU::UpdatePickingSettingsEvent,NULL);
+  }
+}
+
+void VisuGUI_GaussPointsSelectionPane::SelectionEvent()
+{
+  //printf( "VisuGUI_GaussPointsSelectionPane::SelectionEvent()\n" );
+  clearIDControls();
+
+  SelectorHelper aHelper( myModule );
+  if( aHelper.get() )
+  {
+    const TColStd_IndexedMapOfInteger& aMapIndex = aHelper.myMapIndex;
+    if( aMapIndex.Extent() == 1 )
+    {
+      int anObjId = aHelper.myMapIndex(1);
+      VISU::TGaussPointID aGaussPointID = aHelper.myPipeLine->GetObjID( anObjId );
+      VISU::TCellID aCellID = aGaussPointID.first;
+      VISU::TLocalPntID aLocalPntID = aGaussPointID.second;
+
+      myParentElementLineEdit->setText( QString::number( aCellID ) );
+      myLocalPointLineEdit->setText( QString::number( aLocalPntID ) );
+    }
+  }
+}
+
+void VisuGUI_GaussPointsSelectionPane::onSelectionValidate() 
+{
+  myParentElementLineEdit->MarkValidated( myParentElementLineEdit->text() );
+  myLocalPointLineEdit->MarkValidated( myLocalPointLineEdit->text() );
+}
+
+void VisuGUI_GaussPointsSelectionPane::onSelectionApply() 
+{
+  //printf( "VisuGUI_GaussPointsSelectionPane::onSelectionApply()\n" );
+  SelectorHelper aHelper( myModule );
+  if( !aHelper.get() )
+    return;
+
+  vtkIdType anObjVtkId = -1;
+  VISU::TCellID aCellId;
+  VISU::TLocalPntID aLocalPntId;
+
+  bool ok = false;
+  aCellId = myParentElementLineEdit->text().toInt( &ok );
+  if( ok )
+  {
+    ok = false;
+    aLocalPntId = myLocalPointLineEdit->text().toInt( &ok );
+    if( ok )
+    {
+      VISU::PGaussPtsIDMapper anIDMapper = aHelper.myPipeLine->GetGaussPtsIDMapper();
+      anObjVtkId = anIDMapper->GetVTKID( VISU::TGaussPointID( aCellId, aLocalPntId ) );
+    }
+  }
+
+  if( anObjVtkId < 0 )
+    aHelper.mySelector->ClearIndex();
+  else
+  {
+    aHelper.myMapIndex.Clear();
+    aHelper.myMapIndex.Add( anObjVtkId );
+    aHelper.mySelector->AddOrRemoveIndex( aHelper.myIO, aHelper.myMapIndex, false );
+  }
+  aHelper.myActor->Highlight( aHelper.myIO );
+  getInteractor()->GetDevice()->CreateTimer( VTKI_TIMER_FIRST );
+}
+
+void VisuGUI_GaussPointsSelectionPane::clearIDControls()
+{
+  myParentElementLineEdit->setText( "" );
+  myLocalPointLineEdit->setText( "" );
+}
+
+void VisuGUI_GaussPointsSelectionPane::apply()
+{
+  onSelectionApply();
+}
+
+void VisuGUI_GaussPointsSelectionPane::onApplyDisplayParentMesh( bool theValue )
+{
+  VISU_PickingSettings* aPickingSettings = VISU_PickingSettings::Get();
+  aPickingSettings->SetDisplayParentMesh( theValue );
+  aPickingSettings->InvokeEvent( VISU::UpdatePickingSettingsEvent,NULL );
+}
+
+/*
+void VisuGUI_GaussPointsSelectionPane::Help()
+{
+  QString aHelpFileName = "picking.htm";
+  LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication());
+  if (app)
+    app->onHelpContextModule(app->activeModule() ? app->moduleName(app->activeModule()->moduleName()) : QString(""), aHelpFileName);
+  else {
+    QString platform;
+#ifdef WIN32
+    platform = "winapplication";
+#else
+    platform = "application";
+#endif
+    SUIT_MessageBox::warning( 0,
+                             QObject::tr("WRN_WARNING"),
+                             QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
+                               arg(app->resourceMgr()->stringValue("ExternalBrowser", platform)).arg(aHelpFileName),
+                             QObject::tr("BUT_OK"));
+  }
+}
+
+void VisuGUI_GaussPointsSelectionPane::keyPressEvent( QKeyEvent* e )
+{
+  QDialog::keyPressEvent( e );
+  if ( e->isAccepted() )
+    return;
+
+  if ( e->key() == Qt::Key_F1 )
+    {
+      e->accept();
+      Help();
+    }
+}
+*/
diff --git a/src/VISUGUI/VisuGUI_GaussPointsSelectionPane.h b/src/VISUGUI/VisuGUI_GaussPointsSelectionPane.h
new file mode 100644 (file)
index 0000000..a344063
--- /dev/null
@@ -0,0 +1,123 @@
+//  VISU VISUGUI : GUI of VISU component
+//
+//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
+// 
+//  This library is free software; you can redistribute it and/or 
+//  modify it under the terms of the GNU Lesser General Public 
+//  License as published by the Free Software Foundation; either 
+//  version 2.1 of the License. 
+// 
+//  This library is distributed in the hope that it will be useful, 
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of 
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
+//  Lesser General Public License for more details. 
+// 
+//  You should have received a copy of the GNU Lesser General Public 
+//  License along with this library; if not, write to the Free Software 
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
+// 
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+//  File   : VisuGUI_GaussPointsSelectionPane.h
+//  Author : Oleg Uvarov
+//  Module : VISU
+
+#ifndef VISUGUI_GAUSSPOINTSSELECTIONPANE_H
+#define VISUGUI_GAUSSPOINTSSELECTIONPANE_H
+
+#include <vtkObject.h>
+#include <vtkSmartPointer.h>
+
+#include <QLineEdit>
+
+class vtkActorCollection;
+class vtkCallbackCommand;
+class vtkImageData;
+
+class QLabel;
+class QComboBox;
+class QCheckBox;
+class QPushButton;
+
+class QtxAction;
+
+class VISU_GaussPtsAct;
+class VISU_PickingSettings;
+
+class SalomeApp_Module;
+class SVTK_RenderWindowInteractor;
+class VisuGUI_ValidatedLineEdit;
+
+//! Picking Dialog.
+/*!
+ * Uses for set up picking preferenses and apply
+ * them to all actors in the current renderer.
+ */
+class VisuGUI_GaussPointsSelectionPane : public QWidget
+{
+  Q_OBJECT
+
+public:
+  VisuGUI_GaussPointsSelectionPane( const SalomeApp_Module* theModule, QWidget* theParent );
+
+  ~VisuGUI_GaussPointsSelectionPane();
+
+  //! update dialog contents.
+  void                                  update();
+
+  void                                  setIds( const int, const int );
+
+  void                                  setInteractor( SVTK_RenderWindowInteractor* );
+
+  void                                  apply();
+  //void                                  help();
+
+protected:
+  SVTK_RenderWindowInteractor*          getInteractor();
+
+protected slots:
+  void                                  onSelectionValidate();
+  void                                  onSelectionApply();
+
+private slots:
+  void                                  onApplyDisplayParentMesh( bool );
+
+private:
+  static void                           ProcessEvents(vtkObject* theObject, 
+                                                     unsigned long theEvent,
+                                                     void* theClientData, 
+                                                     void* theCallData);
+
+  void                                  KeyPressed();
+  void                                  SelectionEvent();
+  //void                                  keyPressEvent( QKeyEvent* e );
+
+  void                                  clearIDControls();
+
+private:
+  const SalomeApp_Module*               myModule;
+
+  QCheckBox*                            myDisplayParentMeshCheckBox;
+
+  VisuGUI_ValidatedLineEdit*            myParentElementLineEdit;
+  VisuGUI_ValidatedLineEdit*            myLocalPointLineEdit;
+
+  QValidator*                           myCellIDValidator;
+  QValidator*                           myLocalPointIDValidator;
+
+  float                                 myPriority;
+  vtkSmartPointer<vtkCallbackCommand>   myEventCallbackCommand;
+};
+
+class VisuGUI_ValidatedLineEdit : public QLineEdit
+{
+  Q_OBJECT;
+public:
+  VisuGUI_ValidatedLineEdit( QWidget* parent );
+  
+public slots:
+  void MarkValidated( const QString& theText );
+};
+
+#endif
diff --git a/src/VISUGUI/VisuGUI_InputPanel.cxx b/src/VISUGUI/VisuGUI_InputPanel.cxx
new file mode 100755 (executable)
index 0000000..ec223e6
--- /dev/null
@@ -0,0 +1,141 @@
+//  VISU VISUGUI : GUI of VISU component
+//
+//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+//
+//  File   : VisuGUI_InputPanel.cxx
+//  Author : Oleg Uvarov
+//  Module : VISU
+
+#include "VisuGUI_InputPanel.h"
+#include "VisuGUI_BasePanel.h"
+
+#include <QVBoxLayout>
+
+/*!
+ * \brief Constructor creates enmpty docable window with invisible QVBox
+          to be used as container of child widgets
+ */
+VisuGUI_InputPanel::VisuGUI_InputPanel( QWidget* theParent )
+: QtxDockWidget( tr( "WINDOW_TITLE" ), theParent ),
+  myCurrentPanel( 0 )
+{
+  myGrp = new QWidget( this );
+  new QVBoxLayout( myGrp );
+  setWidget( myGrp );
+}
+
+/*!
+ * \brief Destructor: VisuGUI_InputPanel
+ */
+VisuGUI_InputPanel::~VisuGUI_InputPanel()
+{
+}
+
+/*!
+  \brief Shows thePanel in input panel. If there is visible 
+         panel then it is hidden 
+  \param thePanel widget
+*/
+void VisuGUI_InputPanel::showPanel( VisuGUI_BasePanel* thePanel )
+{
+  if ( !thePanel )
+    return;
+
+  setUpdatesEnabled( false );
+
+  if ( myCurrentPanel )
+    myCurrentPanel->hide();
+
+  if( isEmpty() )
+    show();
+
+  if ( !myPanels.contains( thePanel ) )
+  {
+    myPanels.insert( thePanel, true );
+    thePanel->setParent( myGrp );
+    myGrp->layout()->addWidget( thePanel );
+    connect( thePanel, SIGNAL( bpClose() ), this, SLOT( onClosePanel() ) );
+  }
+
+  thePanel->show();
+  myCurrentPanel = thePanel;
+  myPanels[ thePanel ] = true;
+
+  setUpdatesEnabled( true );
+  repaint();
+}
+
+/*!
+  \brief Hides thePanel in input panel. 
+  \param thePanel widget
+*/
+void VisuGUI_InputPanel::hidePanel( VisuGUI_BasePanel* thePanel )
+{
+  if ( !thePanel || myCurrentPanel != thePanel )
+    return;
+
+  thePanel->hide();
+  myCurrentPanel = 0;
+  myPanels[ thePanel ] = false;
+
+  if( isEmpty() )
+    hide();
+}
+
+/*!
+  \brief Hide all children panels
+*/
+void VisuGUI_InputPanel::clear()
+{
+  if ( myCurrentPanel )
+    hidePanel( myCurrentPanel );
+}
+
+/*!
+  \brief Returns true if no panels are shown
+*/
+bool VisuGUI_InputPanel::isEmpty() const
+{
+  QMap<VisuGUI_BasePanel*, bool>::const_iterator it = myPanels.begin(), itEnd = myPanels.end();
+  for( ; it != itEnd; ++it )
+  {
+    if( it.value() )
+      return false;
+  }
+  return true;
+}
+
+/*!
+  \brief Returns true if the panel is shown
+*/
+bool VisuGUI_InputPanel::isShown( VisuGUI_BasePanel* thePanel ) const
+{
+  return myPanels[ thePanel ];
+}
+
+/*!
+  \brief Close panel which emits signal close().
+*/
+void VisuGUI_InputPanel::onClosePanel()
+{
+  if( VisuGUI_BasePanel* aPanel = dynamic_cast<VisuGUI_BasePanel*>( sender() ) )
+    hidePanel( aPanel );
+}
diff --git a/src/VISUGUI/VisuGUI_InputPanel.h b/src/VISUGUI/VisuGUI_InputPanel.h
new file mode 100755 (executable)
index 0000000..b295b0b
--- /dev/null
@@ -0,0 +1,66 @@
+//  VISU VISUGUI : GUI of VISU component
+//
+//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+//
+//  File   : VisuGUI_InputPanel.cxx
+//  Author : Oleg Uvarov
+//  Module : VISU
+
+#ifndef VISUGUI_INPUTPANEL_H
+#define VISUGUI_INPUTPANEL_H
+
+#include <QtxDockWidget.h>
+
+#include <QMap>
+
+class VisuGUI_BasePanel;
+
+/*!
+ * class VisuGUI_InputPanel
+ * Dockable window. Container for GUI controls
+ */
+class VisuGUI_InputPanel : public QtxDockWidget
+{
+  Q_OBJECT
+  
+public:
+  VisuGUI_InputPanel( QWidget* theParent = 0 );
+  virtual ~VisuGUI_InputPanel();
+
+  void showPanel( VisuGUI_BasePanel* thePanel );
+  void hidePanel( VisuGUI_BasePanel* thePanel );
+  void clear();
+
+  bool isEmpty() const;
+  bool isShown( VisuGUI_BasePanel* thePanel ) const;
+
+protected slots:
+  void onClosePanel();
+
+private:
+  QWidget* myGrp;
+  QMap<VisuGUI_BasePanel*, bool> myPanels;
+  VisuGUI_BasePanel* myCurrentPanel;
+};
+
+#endif
+
+
index 4dd635c718a763f5abefb1ae1d55acbcfec252c5..d3cdeefeedb09140f60e18b7491bcbaf8bf98c1c 100644 (file)
 #include "SALOMEDSClient_ClientFactory.hxx"
 #include "SALOMEDSClient_IParameters.hxx"
 
-#include "VVTK_ViewManager.h"
-#include "VVTK_ViewWindow.h"
-#include "VVTK_ViewModel.h"
+//#include "VVTK_ViewManager.h"
+//#include "VVTK_ViewWindow.h"
+//#include "VVTK_ViewModel.h"
 
 #include "SVTK_ViewModel.h"
 #include "SVTK_ViewManager.h"
-#include "SVTK_MainWindow.h"
+#include "SVTK_ViewWindow.h"
 #include "SVTK_RenderWindowInteractor.h"
 #include "VISU_Event.h"
 
@@ -65,8 +65,6 @@
 #include "VISU_GaussPtsAct.h"
 #include "VisuGUI_GaussPointsDlg.h"
 
-#include "VisuGUI_Slider.h"
-
 #include "VISU_Gen_i.hh"
 #include "VISU_Result_i.hh"
 #include "VISU_CutLines_i.hh"
@@ -81,7 +79,7 @@
 #include "VISU_SphereWidget.hxx"
 
 #include "SalomeApp_Study.h"
-#include "VVTK_MainWindow.h"
+//#include "VVTK_MainWindow.h"
 #include "VISU_View_i.hh"
 
 #ifndef DISABLE_VTKVIEWER
 
 #include <sstream>
 
+
 #ifdef _DEBUG_
 static int MYDEBUG = 0;
 #else
@@ -159,12 +158,12 @@ namespace VISU
 {
   //---------------------------------------------------------------
   typedef void (SUIT_ViewWindow::* TViewVisibility)();
-  void
-  SetViewVisibility(SalomeApp_Application* app,
-                   TViewVisibility theViewVisibility)
+  void SetViewVisibility(SalomeApp_Application* app,
+                        TViewVisibility theViewVisibility)
   {
     ViewManagerList l;
-    app->viewManagers( VVTK_Viewer::Type(), l );
+    //app->viewManagers( VVTK_Viewer::Type(), l );
+    app->viewManagers( SVTK_Viewer::Type(), l );
     ViewManagerList::const_iterator anIt = l.begin(), aLast = l.end();
     for( ; anIt!=aLast; anIt++ )
       if( SUIT_ViewManager* aViewManager = *anIt )
@@ -181,24 +180,20 @@ namespace VISU
 }
 
 //---------------------------------------------------------------
-VisuGUI_Module::
-VisuGUI_Module() :
+VisuGUI_Module::VisuGUI_Module() : 
   VisuGUI()
 {
 }
 
 
 //---------------------------------------------------------------
-VisuGUI_Module::
-~VisuGUI_Module()
+VisuGUI_Module::~VisuGUI_Module()
 {
 }
 
 
 //---------------------------------------------------------------
-void
-VisuGUI_Module::
-initialize( CAM_Application* theApp )
+void VisuGUI_Module::initialize( CAM_Application* theApp )
 {
   VisuGUI::initialize( theApp );
 
@@ -212,9 +207,9 @@ initialize( CAM_Application* theApp )
   createMenu( SAVE_VISU_STATE, fileMenu, 9, -1 );
 
   QPixmap aPixmap;
-  aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_GAUSS_NEW_VIEWER"));
-  createAction( GAUSS_NEW_VIEWER,
-               tr("MEN_GAUSS_NEW_VIEWER"),
+  /*  aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_GAUSS_NEW_VIEWER"));
+  createAction( GAUSS_NEW_VIEWER, 
+               tr("MEN_GAUSS_NEW_VIEWER"), 
                aPixmap,
                 tr("MEN_GAUSS_NEW_VIEWER"),
                tr("MEN_GAUSS_NEW_VIEWER"),
@@ -226,12 +221,12 @@ initialize( CAM_Application* theApp )
   int windowMenu = createMenu( tr( "MEN_DESK_WINDOW" ), -1, 100 );
   int newWinMenu = createMenu( tr( "MEN_DESK_NEWWINDOW" ), windowMenu, -1, 0 );
   createMenu( action( GAUSS_NEW_VIEWER ), newWinMenu, -1 );
-
+  */
   // Add actions to menus
   createMenu( tr( "MEN_GAUSS" ), -1, -1, 30 );
   //createMenu( GAUSS_CREATE_PRS, aMenuId, 10 );
 
-  QString aViewerType = VVTK_Viewer::Type();
+  QString aViewerType = SVTK_Viewer::Type();
   SUIT_Accel* accel = getApp()->accel();
   accel->setActionKey( SUIT_Accel::PanLeft, Qt::Key_Left, aViewerType );
   accel->setActionKey( SUIT_Accel::PanRight, Qt::Key_Right, aViewerType );
@@ -245,10 +240,10 @@ initialize( CAM_Application* theApp )
   accel->setActionKey( SUIT_Accel::RotateDown, Qt::CTRL+Qt::Key_Down, aViewerType );
   accel->setActionKey( SVTK::PlusSpeedIncrementEvent, Qt::Key_Plus, aViewerType );
   accel->setActionKey( SVTK::MinusSpeedIncrementEvent, Qt::Key_Minus, aViewerType );
-
+  
   connect( getApp(), SIGNAL( viewManagerAdded( SUIT_ViewManager* ) ),
            this, SLOT( OnViewManagerAdded (SUIT_ViewManager*) ) );
-
+  
   // Prepare popup menus
   QtxPopupMgr* mgr = popupMgr();
   QString aRule;
@@ -302,7 +297,7 @@ initialize( CAM_Application* theApp )
 #ifndef DISABLE_VTKVIEWER
 #ifndef DISABLE_SALOMEOBJECT
   viewers.append( SVTK_Viewer::Type() );
-  viewers.append( VVTK_Viewer::Type() );
+  //viewers.append( VVTK_Viewer::Type() );
 #else
   viewers.append( VTKViewer_Viewer::Type() );
 #endif
@@ -359,14 +354,14 @@ initialize( CAM_Application* theApp )
                 this, SLOT(OnSaveConfiguration()));
   mgr->insert( action( GAUSS_SAVE_CONFIGURATION ), -1, -1, -1 );
   mgr->setRule( action( GAUSS_SAVE_CONFIGURATION ),
-    "selcount>=0 and client='VVTK' and activeView='VVTK'" );
+    "selcount>=0 and client='SVTK' and activeView='SVTK'" );
 
   createAction( GAUSS_OVERWRITE_CONFIGURATION, tr("MEN_OVERWRITE_CONFIGURATION"), QIcon(),
                 tr("MEN_OVERWRITE_CONFIGURATION"), "", 0, this, false,
                 this, SLOT(OnOverwriteConfiguration()));
   mgr->insert( action( GAUSS_OVERWRITE_CONFIGURATION ), -1, -1, -1 );
   mgr->setRule( action( GAUSS_OVERWRITE_CONFIGURATION ),
-    "selcount>0 and type='VISU::TGAUSSVIEW' and activeView='VVTK'" );
+    "selcount>0 and type='VISU::TGAUSSVIEW' and activeView='SVTK'" );
 
   createAction( GAUSS_RESTORE_CONFIGURATION, tr("MEN_RESTORE_CONFIGURATION"), QIcon(),
                 tr("MEN_RESTORE_CONFIGURATION"), "", 0, this, false,
@@ -376,61 +371,55 @@ initialize( CAM_Application* theApp )
   "selcount=1 and type='VISU::TGAUSSVIEW'" );
 }
 
-//---------------------------------------------------------------
-bool
-VisuGUI_Module::
-activateModule( SUIT_Study* theStudy )
-{
-  VisuGUI::activateModule( theStudy );
-
-  SetViewVisibility(getApp(),&SUIT_ViewWindow::show);
+// //---------------------------------------------------------------
+// bool VisuGUI_Module::activateModule( SUIT_Study* theStudy )
+// {
+//   VisuGUI::activateModule( theStudy );
 
-  return true;
-}
+//   //SetViewVisibility(getApp(),&SUIT_ViewWindow::show);
 
+//   return true;
+// }
 
 //---------------------------------------------------------------
-bool
-VisuGUI_Module::
-deactivateModule( SUIT_Study* theStudy )
-{
-  VisuGUI::deactivateModule( theStudy );
+// bool VisuGUI_Module::deactivateModule( SUIT_Study* theStudy )
+// {
+//   return VisuGUI::deactivateModule( theStudy );
 
-  SetViewVisibility(getApp(),&SUIT_ViewWindow::hide);
+//   //SetViewVisibility(getApp(),&SUIT_ViewWindow::hide);
 
-  return true;
-}
+//   //return true;
+// }
 
 
 //---------------------------------------------------------------
-SUIT_ViewManager*
-VisuGUI_Module::
-onCreateViewManager()
-{
-  SalomeApp_Application* anApp = getApp();
-  SUIT_ResourceMgr* aResourceMgr = anApp->resourceMgr();
-  VVTK_ViewManager* aViewManager = new VVTK_ViewManager( anApp->activeStudy(), anApp->desktop() );
-  VVTK_Viewer* aViewer = (VVTK_Viewer*)aViewManager->getViewModel();
-  aViewer->setBackgroundColor( aResourceMgr->colorValue( "VTKViewer", "background", aViewer->backgroundColor() ) );
-  aViewer->setTrihedronSize( aResourceMgr->integerValue( "VTKViewer", "trihedron_size", aViewer->trihedronSize() ),
-                            aResourceMgr->booleanValue( "VTKViewer", "relative_size", aViewer->trihedronRelative() ) );
-  new LightApp_VTKSelector( aViewer, anApp->selectionMgr() );
-  anApp->addViewManager( aViewManager );
-
-  VVTK_ViewWindow* aViewWindow = ( VVTK_ViewWindow* )aViewManager->createViewWindow();
-  if( aViewWindow )
-  {
-    new VisuGUI_Slider( this, aViewWindow, anApp->selectionMgr() );
-  }
-
-  return aViewer->getViewManager();
-}
+// SUIT_ViewManager* VisuGUI_Module::onCreateViewManager()
+// {
+//   SalomeApp_Application* anApp = getApp();
+//   SUIT_ResourceMgr* aResourceMgr = anApp->resourceMgr();
+//   VVTK_ViewManager* aViewManager = new VVTK_ViewManager( anApp->activeStudy(), anApp->desktop() );
+//   VVTK_Viewer* aViewer = (VVTK_Viewer*)aViewManager->getViewModel();
+//   aViewer->setBackgroundColor( aResourceMgr->colorValue( "VTKViewer", "background", aViewer->backgroundColor() ) );
+//   aViewer->setProjectionMode( aResourceMgr->integerValue( "VTKViewer", "projection_mode", aViewer->projectionMode() ) );
+//   aViewer->setTrihedronSize( aResourceMgr->integerValue( "VTKViewer", "trihedron_size", aViewer->trihedronSize() ),
+//                          aResourceMgr->booleanValue( "VTKViewer", "relative_size", aViewer->trihedronRelative() ) );
+//   aViewer->setIncrementalSpeed( aResourceMgr->integerValue( "VTKViewer", "speed_value", aViewer->incrementalSpeed() ),
+//                             aResourceMgr->integerValue( "VTKViewer", "speed_mode", aViewer->incrementalSpeedMode() ) );
+//   aViewer->setInteractionStyle( aResourceMgr->integerValue( "VTKViewer", "navigation_mode", aViewer->interactionStyle() ) );
+//   aViewer->setSpacemouseButtons( aResourceMgr->integerValue( "VTKViewer", "spacemouse_func1_btn", aViewer->spacemouseBtn(1) ),
+//                              aResourceMgr->integerValue( "VTKViewer", "spacemouse_func2_btn", aViewer->spacemouseBtn(1) ),
+//                              aResourceMgr->integerValue( "VTKViewer", "spacemouse_func5_btn", aViewer->spacemouseBtn(1) ) );
+
+//   new LightApp_VTKSelector( aViewer, anApp->selectionMgr() );
+
+//   anApp->addViewManager( aViewManager );
+
+//   return aViewer->getViewManager();
+// }
 
 
 //---------------------------------------------------------------
-void
-VisuGUI_Module::
-createPreferences()
+void VisuGUI_Module::createPreferences()
 {
   VisuGUI::createPreferences();
 
@@ -438,15 +427,13 @@ createPreferences()
   createInsideCursorPreferences();
   createOutsideCursorPreferences();
   createPickingPreferences();
-  createSpaceMousePreferences();
-  createRecorderPreferences();
+  // createSpaceMousePreferences();
+  //createRecorderPreferences();
 }
 
 
 //---------------------------------------------------------------
-void
-VisuGUI_Module::
-createGaussPointsPreferences()
+void VisuGUI_Module::createGaussPointsPreferences()
 {
   int gaussTab = addPreference( tr( "VISU_GAUSS_PREF_TAB_TTL" ) );
   int primitiveGr = addPreference( tr( "VISU_GAUSS_PREF_PRIMITIVE_GROUP_TTL" ), gaussTab );
@@ -567,13 +554,49 @@ createGaussPointsPreferences()
   setPreferenceProperty( spacingPref, "min", 0.01 );
   setPreferenceProperty( spacingPref, "max", 1.0 );
   setPreferenceProperty( spacingPref, "step", 0.01 );
+
+  // spacemouse
+  int spacemouseGr = addPreference( tr( "VISU_SPACEMOUSE_PREF" ), gaussTab );
+  setPreferenceProperty( spacemouseGr, "columns", 2 );
+  int spacemousePref3 = addPreference( tr( "VISU_SPACEMOUSE_PREF_3" ), spacemouseGr,
+                                       LightApp_Preferences::Selector, "VISU",
+                                       "spacemouse_func3_btn" ); //decrease_gauss_point_magnification
+  int spacemousePref4 = addPreference( tr( "VISU_SPACEMOUSE_PREF_4" ), spacemouseGr,
+                                       LightApp_Preferences::Selector, "VISU",
+                                       "spacemouse_func4_btn" ); //increase_gauss_point_magnification
+  values.clear();
+  values.append( tr( "VISU_SPACEMOUSE_PREF_BTN_1" ) );
+  values.append( tr( "VISU_SPACEMOUSE_PREF_BTN_2" ) );
+  values.append( tr( "VISU_SPACEMOUSE_PREF_BTN_3" ) );
+  values.append( tr( "VISU_SPACEMOUSE_PREF_BTN_4" ) );
+  values.append( tr( "VISU_SPACEMOUSE_PREF_BTN_5" ) );
+  values.append( tr( "VISU_SPACEMOUSE_PREF_BTN_6" ) );
+  values.append( tr( "VISU_SPACEMOUSE_PREF_BTN_7" ) );
+  values.append( tr( "VISU_SPACEMOUSE_PREF_BTN_8" ) );
+  values.append( tr( "VISU_SPACEMOUSE_PREF_BTN_*" ) );
+  values.append( tr( "VISU_SPACEMOUSE_PREF_BTN_10" ) );
+  values.append( tr( "VISU_SPACEMOUSE_PREF_BTN_11" ) );
+  indices.clear();
+  indices.append( 1 );
+  indices.append( 2 );
+  indices.append( 3 );
+  indices.append( 4 );
+  indices.append( 5 );
+  indices.append( 6 );
+  indices.append( 7 );
+  indices.append( 8 );
+  indices.append( 9 ); // == button_*
+  indices.append( 10 );
+  indices.append( 11 );
+  setPreferenceProperty( spacemousePref3, "strings", values );
+  setPreferenceProperty( spacemousePref3, "indexes", indices );
+  setPreferenceProperty( spacemousePref4, "strings", values );
+  setPreferenceProperty( spacemousePref4, "indexes", indices );
 }
 
 
 //---------------------------------------------------------------
-void
-VisuGUI_Module::
-createInsideCursorPreferences()
+void VisuGUI_Module::createInsideCursorPreferences()
 {
   int insideCursorTab = addPreference( tr( "VISU_GAUSS_INSIDE_CURSOR_PREF_TAB_TTL" ) );
 
@@ -659,9 +682,7 @@ createInsideCursorPreferences()
 
 
 //---------------------------------------------------------------
-void
-VisuGUI_Module::
-createOutsideCursorPreferences()
+void VisuGUI_Module::createOutsideCursorPreferences()
 {
   int outsideCursorTab = addPreference( tr( "VISU_GAUSS_OUTSIDE_CURSOR_PREF_TAB_TTL" ) );
 
@@ -733,9 +754,7 @@ createOutsideCursorPreferences()
 
 
 //---------------------------------------------------------------
-void
-VisuGUI_Module::
-createPickingPreferences()
+void VisuGUI_Module::createPickingPreferences()
 {
   int pickingTab = addPreference( tr( "VISU_PICKING_PREF_TAB_TTL" ) );
 
@@ -772,6 +791,10 @@ createPickingPreferences()
   int infoWindowGr = addPreference( tr( "VISU_PICKING_PREF_INFO_WINDOW_GROUP_TTL" ), pickingTab );
   setPreferenceProperty( infoWindowGr, "columns", 2 );
 
+  int infoWindowPref = addPreference( tr( "VISU_PICKING_PREF_INFO_WINDOW" ), infoWindowGr,
+                                     LightApp_Preferences::Bool, "VISU", "picking_info_window" );
+  setPreferenceProperty( infoWindowPref, "columns", 2 );
+
   int transparencyPref = addPreference( tr( "VISU_PICKING_PREF_TRANSPARENCY" ), infoWindowGr,
                                        LightApp_Preferences::IntSpin, "VISU", "picking_transparency" );
   setPreferenceProperty( transparencyPref, "min", 0 );
@@ -793,6 +816,10 @@ createPickingPreferences()
   int cameraGr = addPreference( tr( "VISU_PICKING_PREF_CAMERA_GROUP_TTL" ), pickingTab );
   setPreferenceProperty( cameraGr, "columns", 2 );
 
+  int cameraPref = addPreference( tr( "VISU_PICKING_PREF_CAMERA_MOVEMENT" ), cameraGr,
+                                 LightApp_Preferences::Bool, "VISU", "picking_camera_movement" );
+  setPreferenceProperty( cameraPref, "columns", 2 );
+
   int zoomFactorPref = addPreference( tr( "VISU_PICKING_PREF_ZOOM_FACTOR" ), cameraGr,
                                      LightApp_Preferences::DblSpin, "VISU", "picking_zoom_factor" );
   setPreferenceProperty( zoomFactorPref, "min", 0.1 );
@@ -814,9 +841,7 @@ createPickingPreferences()
 
 
 //---------------------------------------------------------------
-void
-VisuGUI_Module::
-createSpaceMousePreferences()
+void VisuGUI_Module::createSpaceMousePreferences()
 {
   int mouseTab = addPreference( tr( "VISU_MOUSE_PREF_TAB_TLT" ) );
 
@@ -894,9 +919,7 @@ createSpaceMousePreferences()
 
 
 //---------------------------------------------------------------
-void
-VisuGUI_Module::
-createRecorderPreferences()
+void VisuGUI_Module::createRecorderPreferences()
 {
   int recorderTab = addPreference( tr( "VISU_RECORDER_PREF_TAB_TTL" ) );
 
@@ -930,29 +953,26 @@ createRecorderPreferences()
 
 
 //---------------------------------------------------------------
-void
-VisuGUI_Module::
-OnCreateGaussPoints()
+void VisuGUI_Module::OnCreateGaussPoints()
 {
   double initialTime = vtkTimerLog::GetCPUTime();
-  CreatePrs3d<VISU::GaussPoints_i, VisuGUI_GaussPointsDlg, 1>(this, VVTK_Viewer::Type());
+  //CreatePrs3d<VISU::GaussPoints_i, VisuGUI_GaussPointsDlg, 1>(this, VVTK_Viewer::Type());
+  Prs3d_i* aPrs = CreatePrs3d<VISU::GaussPoints_i, VisuGUI_GaussPointsDlg, 1>(this, SVTK_Viewer::Type());
+  if (aPrs)
+    emit presentationCreated(aPrs);
   INFOS( "VisuGUI_Module::OnCreateGaussPoints() : Gauss Points created in " <<
         vtkTimerLog::GetCPUTime() - initialTime << " seconds" );
 }
 
-void
-VisuGUI_Module::
-OnViewManagerAdded(SUIT_ViewManager* viewMgr)
-{
-  QString type = viewMgr->getViewModel()->getType();
-  if ( type == VVTK_Viewer::Type() )
-    connect( viewMgr, SIGNAL( viewCreated( SUIT_ViewWindow* ) ),
-             this, SLOT( OnViewCreated( SUIT_ViewWindow* ) ) );
-}
+// void VisuGUI_Module::OnViewManagerAdded(SUIT_ViewManager* viewMgr)
+// {
+//   QString type = viewMgr->getViewModel()->getType();
+//   if ( type == VVTK_Viewer::Type() ) 
+//     connect( viewMgr, SIGNAL( viewCreated( SUIT_ViewWindow* ) ),
+//              this, SLOT( OnViewCreated( SUIT_ViewWindow* ) ) );
+// }
 
-void
-VisuGUI_Module::
-OnViewCreated(SUIT_ViewWindow* view)
+void VisuGUI_Module::OnViewCreated(SUIT_ViewWindow* view)
 {
   SVTK_ViewWindow* viewWindow = dynamic_cast<SVTK_ViewWindow*>( view );
   if ( viewWindow ) {
@@ -965,45 +985,41 @@ OnViewCreated(SUIT_ViewWindow* view)
   }
 }
 
-void
-VisuGUI_Module::
-setProperty( SVTK_ViewWindow* viewWindow, const QString& pref )
+void VisuGUI_Module::setProperty( SVTK_ViewWindow* viewWindow, const QString& pref )
 {
   if ( !viewWindow )
     return;
 
   SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
-  SVTK_MainWindow* aMainWindow = viewWindow->getMainWindow();
+  //SVTK_MainWindow* aMainWindow = viewWindow->getMainWindow();
   int val;
   if ( pref == "speed_increment" ) {
-    val = resMgr->integerValue( "VISU", pref, 10 );
-    aMainWindow->InvokeEvent( SVTK::SetSpeedIncrementEvent, &val );
+    val = resMgr->integerValue( "VTKViewer", pref, 10 );
+    viewWindow->InvokeEvent( SVTK::SetSpeedIncrementEvent, &val );
   }
   else if ( pref == "spacemouse_func1_btn" ) {
-    val = resMgr->integerValue( "VISU", pref, 1 );
-    aMainWindow->InvokeEvent( SVTK::SetSMDecreaseSpeedEvent, &val );
+    val = resMgr->integerValue( "VTKViewer", pref, 1 );
+    viewWindow->InvokeEvent( SVTK::SetSMDecreaseSpeedEvent, &val );
   }
   else if ( pref == "spacemouse_func2_btn" ) {
-    val = resMgr->integerValue( "VISU", pref, 2 );
-    aMainWindow->InvokeEvent( SVTK::SetSMIncreaseSpeedEvent, &val );
+    val = resMgr->integerValue( "VTKViewer", pref, 2 );
+    viewWindow->InvokeEvent( SVTK::SetSMIncreaseSpeedEvent, &val );
   }
   else if ( pref == "spacemouse_func3_btn" ) {
     val = resMgr->integerValue( "VISU", pref, 10 );
-    aMainWindow->InvokeEvent( VISU::SetSMDecreaseMagnificationEvent, &val );
+    viewWindow->InvokeEvent( VISU::SetSMDecreaseMagnificationEvent, &val );
   }
   else if ( pref == "spacemouse_func4_btn" ) {
     val = resMgr->integerValue( "VISU", pref, 11 );
-    aMainWindow->InvokeEvent( VISU::SetSMIncreaseMagnificationEvent, &val );
+    viewWindow->InvokeEvent( VISU::SetSMIncreaseMagnificationEvent, &val );
   }
   else if ( pref == "spacemouse_func5_btn" ) {
-    val = resMgr->integerValue( "VISU", pref, 9 );
-    aMainWindow->InvokeEvent( SVTK::SetSMDominantCombinedSwitchEvent, &val );
+    val = resMgr->integerValue( "VTKViewer", pref, 9 );
+    viewWindow->InvokeEvent( SVTK::SetSMDominantCombinedSwitchEvent, &val );
   }
 }
 
-void
-VisuGUI_Module::
-setProperty( SVTK_ViewManager* vm, const QString& prop )
+void VisuGUI_Module::setProperty( SVTK_ViewManager* vm, const QString& prop )
 {
   if ( !vm )
     return;
@@ -1013,43 +1029,37 @@ setProperty( SVTK_ViewManager* vm, const QString& prop )
     setProperty( dynamic_cast<SVTK_ViewWindow*>( windows[i] ), prop );
 }
 
-void
-VisuGUI_Module::
-preferencesChanged( const QString& group, const QString& pref )
+void VisuGUI_Module::preferencesChanged( const QString& group, const QString& pref )
 {
   VisuGUI::preferencesChanged(group,pref);
 
-  if ( group == "VISU" && ( pref == "speed_increment" || pref == "spacemouse_func1_btn" ||
-                           pref == "spacemouse_func2_btn" || pref == "spacemouse_func3_btn" ||
-                           pref == "spacemouse_func4_btn" || pref == "spacemouse_func5_btn" ) ) {
+//   if ( group == "VISU" && ( pref == "speed_increment" || pref == "spacemouse_func1_btn" ||
+//                         pref == "spacemouse_func2_btn" || pref == "spacemouse_func3_btn" || 
+//                         pref == "spacemouse_func4_btn" || pref == "spacemouse_func5_btn" ) ) {
 
-    // update properties of VVTK view windows
-    SUIT_ViewManager* vm = getApp()->getViewManager( VVTK_Viewer::Type(), false );
-    if ( vm )
-      setProperty( dynamic_cast<SVTK_ViewManager*>( vm ), pref );
-  }
+//     // update properties of VVTK view windows
+//     SUIT_ViewManager* vm = getApp()->getViewManager( VVTK_Viewer::Type(), false );
+//     if ( vm ) 
+//       setProperty( dynamic_cast<SVTK_ViewManager*>( vm ), pref );
+//   }
 }
 
 
 //---------------------------------------------------------------
-SUIT_ViewManager*
-VisuGUI_Module::
-getViewManager(const QString& theType,
+SUIT_ViewManager* VisuGUI_Module::getViewManager(const QString& theType, 
                const bool theIsCreate)
 {
   if (SUIT_ViewManager* aViewManager = VisuGUI::getViewManager(theType,theIsCreate))
     return aViewManager;
 
-  if (theIsCreate && theType == VVTK_Viewer::Type())
-    return onCreateViewManager();
+//   if (theIsCreate && theType == VVTK_Viewer::Type())
+//     return onCreateViewManager();
 
   return NULL;
 }
 
 //---------------------------------------------------------------
-void
-VisuGUI_Module::
-OnEditGaussPoints()
+void VisuGUI_Module::OnEditGaussPoints()
 {
   VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
   if(aSelectionInfo.empty())
@@ -1059,10 +1069,13 @@ OnEditGaussPoints()
   Handle(SALOME_InteractiveObject) anIO = aSelectionItem.myIO;
 
   if(VISU::Prs3d_i* aPrs3d = VISU::GetPrs3dToModify(this, aSelectionItem.myObjectInfo.myBase)){
-    // Create VVTK_ViewWindow, if it does not exist
-    if (VVTK_ViewWindow* aViewWindow = GetViewWindow<VVTK_Viewer>(this)) {
+    if (SVTK_ViewWindow* aViewWindow = GetViewWindow<SVTK_Viewer>(this)) {
       EditPrs3d<VISU::GaussPoints_i, VisuGUI_GaussPointsDlg, 1>(this, anIO, aPrs3d, aViewWindow);
     }
+    // Create VVTK_ViewWindow, if it does not exist
+//     if (VVTK_ViewWindow* aViewWindow = GetViewWindow<VVTK_Viewer>(this)) {
+//       EditPrs3d<VISU::GaussPoints_i, VisuGUI_GaussPointsDlg, 1>(this, anIO, aPrs3d, aViewWindow);
+//     }
   }
 }
 
@@ -1070,10 +1083,9 @@ OnEditGaussPoints()
 //---------------------------------------------------------------
 namespace
 {
-  void
-  GetViewParams(VVTK_MainWindow* theViewWindow,
-               const char* theSuffix,
-               std::ostringstream& theStr)
+  /*  void   GetViewParams(VVTK_MainWindow* theViewWindow,
+                      const char* theSuffix,
+                      std::ostringstream& theStr)
   {
     vtkFloatingPointType aColor[3];
     vtkRenderer* aRenderer = theViewWindow->getRenderer();
@@ -1110,12 +1122,11 @@ namespace
     Storable::DataToStream(theStr,(std::string("myScaleFactor") + theSuffix + "[1]").c_str(),aScaleFactor[1]);
     Storable::DataToStream(theStr,(std::string("myScaleFactor") + theSuffix + "[2]").c_str(),aScaleFactor[2]);
   }
-
+  */
   //---------------------------------------------------------------
-  void
-  SetViewParams(VVTK_MainWindow* theViewWindow,
-               const char* theSuffix,
-               const Storable::TRestoringMap& theMap)
+  /*  void SetViewParams(VVTK_MainWindow* theViewWindow,
+                    const char* theSuffix,
+                    const Storable::TRestoringMap& theMap)
   {
     vtkFloatingPointType aColor[3];
     aColor[0] = Storable::FindValue(theMap,std::string("myColor") + theSuffix + ".R").toDouble();
@@ -1152,11 +1163,10 @@ namespace
     aScaleFactor[2] = Storable::FindValue(theMap,std::string("myScaleFactor") + theSuffix + "[2]").toDouble();
     theViewWindow->SetScale(aScaleFactor);
   }
-
+  */
   //---------------------------------------------------------------
-  void
-  GetViewParams(VVTK_MainWindow1* theViewWindow,
-               std::ostringstream& theStr)
+  /*  void   GetViewParams(VVTK_MainWindow1* theViewWindow,
+                      std::ostringstream& theStr)
   {
     GetViewParams(theViewWindow,"1",theStr);
 
@@ -1198,35 +1208,31 @@ namespace
       Storable::DataToStream(theStr,"mySegmentationMode",aSegmentationMode.c_str());
     }
   }
-
+  */
   //---------------------------------------------------------------
-  void
-  SetViewParams(VVTK_MainWindow1* theViewWindow,
-               const Storable::TRestoringMap& theMap)
+  /*void SetViewParams(VVTK_MainWindow1* theViewWindow,
+                    const Storable::TRestoringMap& theMap)
   {
     SetViewParams(theViewWindow,"1",theMap);
   }
 
-
+  */
   //---------------------------------------------------------------
-  void
-  GetViewParams(VVTK_MainWindow2* theViewWindow,
-               std::ostringstream& theStr)
+  /*void GetViewParams(VVTK_MainWindow2* theViewWindow,
+                    std::ostringstream& theStr)
   {
     GetViewParams(theViewWindow,"2",theStr);
   }
 
-  void
-  SetViewParams(VVTK_MainWindow2* theViewWindow,
-               const Storable::TRestoringMap& theMap)
+  void SetViewParams(VVTK_MainWindow2* theViewWindow,
+                    const Storable::TRestoringMap& theMap)
   {
     SetViewParams(theViewWindow,"2",theMap);
   }
-
+  */
 
   //---------------------------------------------------------------
-  std::string
-  GetViewParams(VVTK_ViewWindow* theViewWindow)
+  /*std::string GetViewParams(VVTK_ViewWindow* theViewWindow)
   {
     std::ostringstream aStream;
 
@@ -1241,7 +1247,7 @@ namespace
 
     return aStream.str();
   }
-
+  */
   //---------------------------------------------------------------
   struct TSelection
   {
@@ -1266,8 +1272,7 @@ namespace
       myVisibleEntries(theVisibleEntries)
     {}
 
-    void
-    operator()(VISU_GaussPtsAct* theActor)
+    void operator()(VISU_GaussPtsAct* theActor) 
     {
       if(theActor->GetVisibility()){
        const Handle(SALOME_InteractiveObject)& anIO = theActor->getIO();
@@ -1276,9 +1281,8 @@ namespace
     }
   };
 
-  void
-  GetGaussPointsSelection(VVTK_ViewWindow* theViewWindow,
-                         TVisibleEntries& theVisibleEntries)
+  /*void GetGaussPointsSelection(SVTK_ViewWindow* theViewWindow,
+                              TVisibleEntries& theVisibleEntries)
   {
     // First find all visible Gauss Points presentations
     vtkRenderer* aRenderer = theViewWindow->getRenderer();
@@ -1307,16 +1311,14 @@ namespace
       }
     }
   }
-
+  */
 
   //---------------------------------------------------------------
-  inline
-  void
-  CreateReference(_PTR(Study) theStudyDocument,
-                 _PTR(StudyBuilder) theStudyBuilder,
-                 _PTR(SObject) theFatherSObject,
-                 const string& theRefEntry,
-                 const TSelection& theSelection)
+  inline void CreateReference(_PTR(Study) theStudyDocument,
+                             _PTR(StudyBuilder) theStudyBuilder,
+                             _PTR(SObject) theFatherSObject, 
+                             const string& theRefEntry,
+                             const TSelection& theSelection)
   {
     _PTR(SObject) aNewObj = theStudyBuilder->NewObject(theFatherSObject);
     _PTR(SObject) aRefSObj = theStudyDocument->FindObjectID(theRefEntry);
@@ -1335,11 +1337,10 @@ namespace
 
 
   //---------------------------------------------------------------
-  void
-  SetGaussPointsSelection(VisuGUI* theModule,
-                         VVTK_ViewWindow* theViewWindow,
-                         _PTR(Study) theCStudy,
-                         _PTR(SObject) theSObject)
+  /*void SetGaussPointsSelection(VisuGUI* theModule,
+                              SVTK_ViewWindow* theViewWindow,
+                              _PTR(Study) theCStudy,
+                              _PTR(SObject) theSObject)
   {
     SVTK_Selector* aSelector = theViewWindow->GetSelector();
     aSelector->ClearIObjects();
@@ -1354,7 +1355,7 @@ namespace
        PortableServer::ServantBase_var aServant = VISU::GetServant(anObject);
        if(VISU::Prs3d_i* aPrs3d = dynamic_cast<VISU::Prs3d_i*>(aServant.in())){
          // To set visiblity
-         VISU::UpdateViewer(theModule, aPrs3d, /*disp_only = */anIsFirst, /*highlight = */false);
+         VISU::UpdateViewer(theModule, aPrs3d, anIsFirst, false);
          anIsFirst = false;
 
          // To update selection
@@ -1378,12 +1379,11 @@ namespace
 
     aSelector->EndPickCallback(); // To invoke selection changed signal
   }
-
+  */
 
   //---------------------------------------------------------------
-  void
-  OnStoreConfiguration(SalomeApp_Module* theModule,
-                      bool theIsNew)
+  /*void OnStoreConfiguration(SalomeApp_Module* theModule,
+                           bool theIsNew)
   {
     _PTR(Study) aCStudy = GetCStudy(GetAppStudy(theModule));
     if (CheckLock(aCStudy,GetDesktop(theModule)))
@@ -1392,7 +1392,7 @@ namespace
     LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(theModule);
 
     SUIT_ViewManager* aViewManager = theModule->getApp()->activeViewManager();
-    if(aViewManager->getType() == VVTK_Viewer::Type()){
+        if(aViewManager->getType() == VVTK_Viewer::Type()){
       SUIT_ViewWindow* aWindow = aViewManager->getActiveView();
       VVTK_ViewWindow* aViewWindow = dynamic_cast<VVTK_ViewWindow*>(aWindow);
 
@@ -1466,49 +1466,42 @@ namespace
        //UpdateObjBrowser(theModule,true,aSObject);
        UpdateObjBrowser(theModule,true);
       }
-    }
-  }
+    } 
+    }*/
 
 
   //---------------------------------------------------------------
-  template<class TMainWindow>
-  void
-  SetMainWindowParams(VisuGUI* theModule,
-                     _PTR(SObject) theSObject,
-                     VVTK_ViewWindow* theViewWindow,
-                     TMainWindow* theMainWindow)
+/*  template<class TMainWindow>
+  void SetMainWindowParams(VisuGUI* theModule,
+                          _PTR(SObject) theSObject,
+                          VVTK_ViewWindow* theViewWindow,
+                          TMainWindow* theMainWindow)
   {
     _PTR(Study) aCStudy = GetCStudy(GetAppStudy(theModule));
 
     Storable::TRestoringMap aMap = Storable::GetStorableMap(theSObject);
     if(!aMap.empty())
       SetViewParams(theMainWindow, aMap);
-  }
+      }*/
 }
 
 
 //---------------------------------------------------------------
-void
-VisuGUI_Module::
-OnSaveConfiguration()
-{
-  ::OnStoreConfiguration(this,true);
-}
+// void VisuGUI_Module::OnSaveConfiguration()
+// {
+//   ::OnStoreConfiguration(this,true);
+// }
 
 
 //---------------------------------------------------------------
-void
-VisuGUI_Module::
-OnOverwriteConfiguration()
-{
-  ::OnStoreConfiguration(this,false);
-}
+// void VisuGUI_Module::OnOverwriteConfiguration()
+// {
+//   ::OnStoreConfiguration(this,false);
+// }
 
 
 //---------------------------------------------------------------
-void
-VisuGUI_Module::
-OnRestoreConfiguration()
+/*void VisuGUI_Module::OnRestoreConfiguration()
 {
   LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
 
@@ -1524,9 +1517,8 @@ OnRestoreConfiguration()
     myConfigSObject = aSObject;
     Storable::TRestoringMap aMap = Storable::GetStorableMap(aSObject);
     if(!aMap.empty()){
-      SUIT_ViewWindow* aWindow = aViewManager->getActiveView();
-      VVTK_ViewWindow* aViewWindow = dynamic_cast<VVTK_ViewWindow*>(aWindow);
-
+      SUIT_ViewWindow* aViewWindow = aViewManager->getActiveView();
+      
       Selection_Mode aSelectionMode = Storable::FindValue(aMap,"mySelectionMode").toInt();
       SVTK_Selector* aSelector = aViewWindow->GetSelector();
       aSelector->SetSelectionMode(aSelectionMode);
@@ -1594,37 +1586,35 @@ OnRestoreConfiguration()
       SetGaussPointsSelection(this,aViewWindow,aCStudy,aSObject);
     }
   }
-}
+}*/
 
 
 //---------------------------------------------------------------
-bool
-VisuGUI_Module::
-eventFilter( QObject * theWatched, QEvent * theEvent )
-{
-  bool aRet = VisuGUI::eventFilter(theWatched,theEvent);
-  if(theEvent->type() == QEvent::Show){
-    if(SUIT_ViewManager* aViewManager = getViewManager(VVTK_Viewer::Type(),false)){
-      SUIT_ViewWindow* aWindow = aViewManager->getActiveView();
-      VVTK_ViewWindow* aViewWindow = dynamic_cast<VVTK_ViewWindow*>(aWindow);
-      if(VVTK_MainWindow1* aMainWindow = aViewWindow->getMainWindow1()){
-       SVTK_RenderWindowInteractor* anInteractor = aMainWindow->GetInteractor();
-       if(theWatched == anInteractor){
-         SetMainWindowParams(this,myConfigSObject,aViewWindow,aMainWindow);
-         anInteractor->removeEventFilter(this);
-       }
-      }
-      if(VVTK_MainWindow2* aMainWindow = aViewWindow->getMainWindow2()){
-       SVTK_RenderWindowInteractor* anInteractor = aMainWindow->GetInteractor();
-       if(theWatched == aMainWindow->GetInteractor()){
-         SetMainWindowParams(this,myConfigSObject,aViewWindow,aMainWindow);
-         anInteractor->removeEventFilter(this);
-       }
-      }
-    }
-  }
-  return aRet;
-}
+//bool VisuGUI_Module::eventFilter( QObject * theWatched, QEvent * theEvent )
+//{
+//  bool aRet = VisuGUI::eventFilter(theWatched,theEvent);
+//   if(theEvent->type() == QEvent::Show){
+//     if(SUIT_ViewManager* aViewManager = getViewManager(VVTK_Viewer::Type(),false)){
+//       SUIT_ViewWindow* aWindow = aViewManager->getActiveView();
+//       VVTK_ViewWindow* aViewWindow = dynamic_cast<VVTK_ViewWindow*>(aWindow);
+//       if(VVTK_MainWindow1* aMainWindow = aViewWindow->getMainWindow1()){
+//     SVTK_RenderWindowInteractor* anInteractor = aMainWindow->GetInteractor();
+//     if(theWatched == anInteractor){
+//       SetMainWindowParams(this,myConfigSObject,aViewWindow,aMainWindow);
+//       anInteractor->removeEventFilter(this);
+//     }
+//       }
+//       if(VVTK_MainWindow2* aMainWindow = aViewWindow->getMainWindow2()){
+//     SVTK_RenderWindowInteractor* anInteractor = aMainWindow->GetInteractor();
+//     if(theWatched == aMainWindow->GetInteractor()){
+//       SetMainWindowParams(this,myConfigSObject,aViewWindow,aMainWindow);
+//       anInteractor->removeEventFilter(this);
+//     }
+//       }
+//     }
+//   }
+//  return aRet;
+//}
 
 
 const char gSeparator = '_'; // character used to separate parameter names
@@ -1645,7 +1635,7 @@ void VisuGUI_Module::storeVisualParameters(int savePoint)
   _PTR(IParameters) ip = ClientFactory::getIParameters(ap);
 
   // viewers counters are used for storing view_numbers in IParameters
-  int svtkViewers( 0 ), vvtkViewers( 0 ), plotViewers( 0 );
+  int svtkViewers( 0 ), /*vvtkViewers( 0 ),*/ plotViewers( 0 );
 
   // componentName is used for encoding of entries when storing them in IParameters
   _PTR(SComponent) visuEng = ClientFindOrCreateVisuComponent( studyDS );
@@ -1657,7 +1647,7 @@ void VisuGUI_Module::storeVisualParameters(int savePoint)
   // saving VVTK viewer parameters.  VVTK (Gauss Viewers) are NOT created by SalomeApp since
   // VVTK is declared in VISU, so here we store VVTK view window parameters.
   // VisuGUI_Module::restoreVisualParameters() creates VVTK_Views and restores its parameters.
-  ip->setProperty( "ActiveGaussViewer", "-1" );
+  /*  ip->setProperty( "ActiveGaussViewer", "-1" ); 
   getApp()->viewManagers( VVTK_Viewer::Type(), lst );
   for ( it = lst.begin(); it != lst.end(); it++ ) {
     if ( SUIT_ViewWindow* vwin = (*it)->getActiveView() ) {
@@ -1674,7 +1664,7 @@ void VisuGUI_Module::storeVisualParameters(int savePoint)
       vvtkViewers++;
     }
   }
-
+  */
   // VISU module opens one SVTK viewer in activateModule().  This causes a bug in save-restore visual
   // parameters: it no SVTK view was saved, we need NOT any SVTK on restore.  Here we store if any is open..
   /*
@@ -1686,17 +1676,17 @@ void VisuGUI_Module::storeVisualParameters(int savePoint)
   // main cycle to store parameters of displayed objects
   lst.clear();
   getApp()->viewManagers( lst );
-  vvtkViewers = svtkViewers = plotViewers = 0;
+  /*vvtkViewers = */svtkViewers = plotViewers = 0;
   for ( it = lst.begin(); it != lst.end(); it++ ) {
     SUIT_ViewManager* vman = *it;
     QString vType = vman->getType();
     int* viewsCounter = vType == SVTK_Viewer::Type()    ? &svtkViewers :
-                        vType == VVTK_Viewer::Type()    ? &vvtkViewers :
+      //vType == VVTK_Viewer::Type()    ? &vvtkViewers :
                         vType == SPlot2d_Viewer::Type() ? &plotViewers : 0;
 
     // saving VTK actors' properties
-    if ( vType == SVTK_Viewer::Type() ||  // processing SVTK and VVTK viewers in the same
-        vType == VVTK_Viewer::Type() ) { // way (VVTK_ViewWindow inherits SVTK_ViewWindow)
+    if ( vType == SVTK_Viewer::Type() /*||  // processing SVTK and VVTK viewers in the same
+                                       vType == VVTK_Viewer::Type()*/ ) { // way (VVTK_ViewWindow inherits SVTK_ViewWindow)       
 
       QVector<SUIT_ViewWindow*> views = vman->getViews();
       for ( int i = 0, iEnd = vman->getViewsCount(); i < iEnd; i++ ) {
@@ -1783,8 +1773,8 @@ void VisuGUI_Module::storeVisualParameters(int savePoint)
          QList<Plot2d_Curve*> curves;
           QList<Plot2d_Curve*>::Iterator itCurve;
          plotVF->getCurves( curves );
-
-         Plot2d_Curve* curve;
+         
+         //Plot2d_Curve* curve;
          for ( itCurve = curves.begin(); itCurve != curves.end(); itCurve++ ) {
            if ( SPlot2d_Curve* sCurve = dynamic_cast<SPlot2d_Curve*>( *itCurve ) ) {
              if ( sCurve->hasIO() ) {
@@ -1853,24 +1843,24 @@ void VisuGUI_Module::restoreVisualParameters(int savePoint)
     std::vector<std::string> paramValues = ip->getAllParameterValues( *entIt );
     std::vector<std::string>::iterator namesIt = paramNames.begin();
     std::vector<std::string>::iterator valuesIt = paramValues.begin();
-
-    if ( *entIt == "GaussViewer" ) {
-      // parameter names are view window's captions, values - visual parameters.
-      for ( ; namesIt != paramNames.end(); ++namesIt, ++valuesIt ) {
-       SUIT_ViewManager* vman = onCreateViewManager();
-       SUIT_ViewWindow* vwin = vman->getActiveView();
-       vwin->setWindowTitle( (*namesIt).c_str() );
-
-       // wait untill the window is really shown.  This step fixes MANY bugs..
-       while ( !vwin->isVisible() )
-         qApp->processEvents();
-
-       vwin->setVisualParameters( (*valuesIt).c_str() );
-      }
-      continue; // skip to next entry
-    }
-
-    // entry is a normal entry - it should be "decoded" (setting base adress of component)
+    
+//     if ( *entIt == "GaussViewer" ) {
+//       // parameter names are view window's captions, values - visual parameters.
+//       for ( ; namesIt != paramNames.end(); ++namesIt, ++valuesIt ) {
+//     SUIT_ViewManager* vman = onCreateViewManager();
+//     SUIT_ViewWindow* vwin = vman->getActiveView(); 
+//     vwin->setWindowTitle( (*namesIt).c_str() );
+
+//     // wait untill the window is really shown.  This step fixes MANY bugs..
+//     while ( !vwin->isVisible() )
+//       qApp->processEvents();
+
+//     vwin->setVisualParameters( (*valuesIt).c_str() );
+//       }
+//       continue; // skip to next entry
+//     }
+    
+    // entry is a normal entry - it should be "decoded" (setting base adress of component) 
     QString entry( ip->decodeEntry( *entIt ).c_str() );
 
     //SRN: Added a check that the entry corresponds to Standard_Real object in the Study
@@ -1890,8 +1880,8 @@ void VisuGUI_Module::restoreVisualParameters(int savePoint)
 
       //      cout << " -- " << viewerType << ": entry = " << entry.latin1() << ", paramName = " << paramName << endl;
 
-      if ( viewerType == SVTK_Viewer::Type().toLatin1().data() ||
-          viewerType == VVTK_Viewer::Type().toLatin1().data() ) {
+      if ( viewerType == SVTK_Viewer::Type().toLatin1().data() /*||
+                                                                viewerType == VVTK_Viewer::Type().toLatin1().data()*/ ) {
 
        // used as inner map key for locating the actor.
        QString viewerTypeIndex = QString( viewerType.c_str() ) + QString::number( viewIndex );
@@ -1966,7 +1956,12 @@ void VisuGUI_Module::restoreVisualParameters(int savePoint)
            if ( !prs )
              continue;
 
-           prs->RemoveAllClippingPlanes();
+           //prs->RemoveAllClippingPlanes();
+           for (int i = prs->GetNumberOfClippingPlanes() - 1; i >= 0 ; i--) {
+             OrientedPlane* aPlane = dynamic_cast<OrientedPlane*>(prs->GetClippingPlane(i));
+             if (aPlane) 
+               prs->RemoveClippingPlane(i);
+           }
            if ( val != "Off" ) {
              QStringList vals = val.split( gDigitsSep, QString::SkipEmptyParts );
              if ( vals.count() == 6 ) { // format check: 6 float values
@@ -2012,8 +2007,8 @@ void VisuGUI_Module::restoreVisualParameters(int savePoint)
     SUIT_ViewModel* vmodel = (*it)->getViewModel();
     if ( !vmodel )
       continue;
-    if ( vmodel->getType() == SVTK_Viewer::Type() ||  // processing SVTK and VVTK viewers
-        vmodel->getType() == VVTK_Viewer::Type() ) { // in the same way
+    if ( vmodel->getType() == SVTK_Viewer::Type() /*||  // processing SVTK and VVTK viewers
+                                                   vmodel->getType() == VVTK_Viewer::Type()*/ ) { // in the same way 
       SVTK_ViewWindow* vtkView = (SVTK_ViewWindow*) (*it)->getActiveView();
       vtkView->getRenderer()->ResetCameraClippingRange();
       vtkView->Repaint();
@@ -2039,19 +2034,19 @@ void VisuGUI_Module::restoreVisualParameters(int savePoint)
   */
 
   // if active Gauss Viewer is set ( != -1) then raise the gauss view window.
-  bool ok;
-  QString activeGaussViewerStr = ip->getProperty( "ActiveGaussViewer" ).c_str();
-  int activeGaussViewer = activeGaussViewerStr.toInt( &ok );
-  if ( ok && activeGaussViewer != -1 ) {
-    lst.clear();
-    getApp()->viewManagers( VVTK_Viewer::Type(), lst );
-    if ( activeGaussViewer >= 0 && activeGaussViewer < lst.count() ) {
-      SUIT_ViewWindow* activeView = lst.at( activeGaussViewer )->getActiveView();
-      if ( activeView ) {
-       activeView->activateWindow();
-       //activeView->setFocus();
-      }
-    }
-  }
+//   bool ok;
+//   QString activeGaussViewerStr = ip->getProperty( "ActiveGaussViewer" ).c_str();
+//   int activeGaussViewer = activeGaussViewerStr.toInt( &ok );
+//   if ( ok && activeGaussViewer != -1 ) {
+//     lst.clear();
+//     getApp()->viewManagers( VVTK_Viewer::Type(), lst );
+//     if ( activeGaussViewer >= 0 && activeGaussViewer < lst.count() ) {
+//       SUIT_ViewWindow* activeView = lst.at( activeGaussViewer )->getActiveView();
+//       if ( activeView ) {
+//     activeView->activateWindow();
+//     //activeView->setFocus();
+//       }          
+//     }
+//   }
 }
 
index 02abf76e08c74e5d7465f7466a0245f6a23b9ce7..606ff7d420a75afcbd0bc6a70ccdec35da60c51d 100644 (file)
@@ -50,9 +50,9 @@ public:
   virtual
   ~VisuGUI_Module();
 
-  virtual
-  bool
-  eventFilter( QObject * theWatched, QEvent * theEvent );
+  //  virtual
+  //  bool
+  //  eventFilter( QObject * theWatched, QEvent * theEvent );
 
   //! Redifined method of the module initializing.
   virtual
@@ -81,16 +81,12 @@ public:
   void
   restoreVisualParameters(int savePoint);
 
-public slots:
+  //public slots:
   //! Reimplemented method of the module deactivation.
-  virtual 
-  bool
-  deactivateModule( SUIT_Study* );
+  //  virtual bool deactivateModule( SUIT_Study* );
 
   //! Reimplemented method of the module activation.
-  virtual 
-  bool
-  activateModule( SUIT_Study* );
+  //  virtual bool activateModule( SUIT_Study* );
 
 protected:
   //! Create preferences for Gauss Points presentation.
@@ -123,8 +119,8 @@ protected:
   createRecorderPreferences();
 
 protected slots:
-  SUIT_ViewManager*
-  onCreateViewManager();
+  //  SUIT_ViewManager*
+  //  onCreateViewManager();
 
   void
   OnCreateGaussPoints();
@@ -132,8 +128,8 @@ protected slots:
   void
   OnViewCreated(SUIT_ViewWindow*);
 
-  void 
-  OnViewManagerAdded(SUIT_ViewManager*);
+  //  void 
+  //OnViewManagerAdded(SUIT_ViewManager*);
 
   //! Reimplemented method of the Gauss Points edition.
   virtual
@@ -141,25 +137,26 @@ protected slots:
   OnEditGaussPoints();
 
   //! Virtual method of saving configuration.
-  virtual
-  void
-  OnSaveConfiguration();
+  //  virtual
+  //  void
+  //  OnSaveConfiguration();
 
   //! Virtual method of overwriting configuration.
-  virtual
-  void
-  OnOverwriteConfiguration();
+  //  virtual
+  //  void
+  //  OnOverwriteConfiguration();
 
   //! Virtual method of restoring configuration.
-  virtual
-  void
-  OnRestoreConfiguration();
+  //  virtual
+  //  void
+  //  OnRestoreConfiguration();
 
 protected:
   _PTR(SObject) myConfigSObject;
 
   void setProperty( SVTK_ViewWindow*, const QString& );  // set a property (speed_increment, etc ) for SVTK ViewWindow
   void setProperty( SVTK_ViewManager*, const QString& ); // set a property for SVTK ViewWindow // set only 1 property for all ViewWindows of given view manager
+
 };
 
 #endif
diff --git a/src/VISUGUI/VisuGUI_Panel.cxx b/src/VISUGUI/VisuGUI_Panel.cxx
new file mode 100755 (executable)
index 0000000..6e0b55b
--- /dev/null
@@ -0,0 +1,241 @@
+//  VISU VISUGUI : GUI of VISU component
+//
+//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+//
+//  File   : VisuGUI_Panel.cxx
+//  Author : Oleg Uvarov
+//  Module : VISU
+
+#include "VisuGUI_Panel.h"
+
+#include "VisuGUI.h"
+#include "VisuGUI_Tools.h"
+
+#include "SUIT_ResourceMgr.h"
+
+#include <QScrollArea>
+#include <QHBoxLayout>
+#include <QVBoxLayout>
+#include <QApplication>
+#include <QPushButton>
+
+/*!
+  \class MainFrame
+  \internal
+  \brief Frame inserted in viewport with redefined sizeHint method 
+         in order to avoid unreasonable increasing of viewport size
+*/
+class VisuGUI_Panel::MainFrame : public QFrame
+{
+public:
+  /*!
+    \brief Constructor.
+    \param theParent parent widget
+  */
+  MainFrame( QWidget* theParent = 0 )
+  : QFrame( theParent )
+  {
+  }
+  
+  /*!
+    \brief Gets frame size hint
+    \return frame size hint
+  */
+  virtual QSize sizeHint() const
+  {
+    return minimumSizeHint();
+  }
+};
+
+/*!
+  \class VisuGUI_Panel
+  \brief Base class for VISU interactive dockable panels.
+
+  Set of classes is derived from this class and are intended for representing widgets 
+  (GUI controls) for different operations. VisuGUI_Panel consists of main frame 
+  inserted in scroll view and four push buttons. So all widgets of derived sub-panels 
+  should be inherited from mainframe() instead of \93this\94 pointer.
+*/
+
+/*!
+  \brief Constructor creates panels look and feel
+  \param theName name of the panel
+  \param theParent parent widget
+*/
+VisuGUI_Panel::VisuGUI_Panel( const QString& theName, 
+                             const VisuGUI* theModule, 
+                             QWidget* theParent,
+                             const int theBtns  )
+  : QtxDockWidget( theName, theParent ),
+    myModule( theModule ),
+    myOK( 0 ),
+    myApply( 0 ),
+    myClose( 0 ),
+    myHelp( 0 )
+{
+  QWidget* aGrp = new QWidget( this );
+  setWidget( aGrp );
+
+  // Create scroll view
+  myView = new QScrollArea( aGrp );
+
+  // Create main frame
+  myMainFrame = new MainFrame( myView );
+  myMainFrame->setFrameStyle( QFrame::Plain | QFrame::NoFrame );
+  
+  myView->setWidget( myMainFrame );
+  myView->setAlignment( Qt::AlignCenter );
+  myView->setWidgetResizable( true );
+  myView->setMinimumWidth( myMainFrame->sizeHint().width() + 22 );
+  
+  // Create buttons
+  QWidget* aBtnWg = new QWidget( aGrp );
+  QHBoxLayout* aBtnWgLayout = new QHBoxLayout( aBtnWg );
+
+  aBtnWgLayout->addStretch();
+
+  if( theBtns & OKBtn )
+  {
+    myOK = new QPushButton( tr( "BUT_OK" ), aBtnWg );
+    aBtnWgLayout->addWidget( myOK );
+    connect( myOK, SIGNAL( clicked() ), SLOT( onOK() ) );
+  }
+  if( theBtns & ApplyBtn )
+  {
+    myApply = new QPushButton( tr( "BUT_APPLY" ), aBtnWg );
+    aBtnWgLayout->addWidget( myApply );
+    connect( myApply, SIGNAL( clicked() ), SLOT( onApply() ) );
+  }
+  if( theBtns & CloseBtn )
+  {
+    myClose = new QPushButton( tr( "BUT_CLOSE" ), aBtnWg );
+    aBtnWgLayout->addWidget( myClose );
+    connect( myClose, SIGNAL( clicked() ), SLOT( onClose() ) );
+  }
+  if( theBtns & HelpBtn )
+  {
+    myHelp = new QPushButton( tr( "BUT_HELP" ), aBtnWg );
+    aBtnWgLayout->addWidget( myHelp );
+    connect( myHelp, SIGNAL( clicked() ), SLOT( onHelp() ) );
+  }
+
+  aBtnWgLayout->addStretch();
+
+  // fill layout
+  QVBoxLayout* aLay = new QVBoxLayout( aGrp );
+  aLay->setContentsMargins( 0, 0, 0, 0 );
+  aLay->addWidget( myView, 1 );
+  aLay->addWidget( aBtnWg );
+}
+
+/*!
+  \brief Destructor
+*/
+VisuGUI_Panel::~VisuGUI_Panel()
+{
+}
+
+/*!
+  \brief Verifies validity of input data
+
+  This virtual method should be redefined in derived classes. Usually operator 
+  corresponding to the sub-panel calls this method to check validity of input 
+  data when Apply/OK button is pressed.
+
+  \param theErrMsg Error message. 
+  
+        If data is invalid when panel can return message using this parameter given 
+        clear explanation what is wrong
+
+  \return TRUE if data is valid, FALSE otherwise 
+*/
+bool VisuGUI_Panel::isValid( QString& /*theErrMsg*/ )
+{
+  return true;
+}
+/*!
+  \brief Virtual methods should be redefined in derived classes and 
+         clears all GUI controls
+*/
+void VisuGUI_Panel::clear()
+{
+}
+
+/*!
+  \brief Virtual slot called when \93OK\94 button pressed emits corresponding signal.
+
+  This slot moves focus in OK button before emitting signal. Mainly it provides 
+  application with correct moving data from currently edited controls to internal 
+  structure. For example QTable moves data from cell editor to table item when 
+  focus is out.
+
+*/
+void VisuGUI_Panel::onOK()
+{
+  if ( myOK )
+  {
+    myOK->setFocus();
+    qApp->processEvents();
+  }
+}
+
+/*!
+  \brief Virtual slot called when \93Apply\94 button pressed emits corresponding signal.
+  \sa onOK
+*/
+void VisuGUI_Panel::onApply()
+{
+  if ( myApply )
+  {
+    myApply->setFocus();
+    qApp->processEvents();
+  }
+}
+
+/*!
+  \brief Virtual slot called when \93Close\94 button pressed emits corresponding signal.
+  \sa onOK
+*/
+void VisuGUI_Panel::onClose()
+{
+  if ( myClose )
+    myClose->setFocus();
+}
+
+/*!
+  \brief Virtual slot called when \93Help\94 button pressed emits corresponding signal.
+  \sa onOK
+*/
+void VisuGUI_Panel::onHelp()
+{
+  if ( myHelp )
+    myHelp->setFocus();
+}
+
+/*!
+  \brief Gets frame inserted in scroll view. All controls of derived 
+         panels should use it as parent
+  \return QFrame* object 
+*/
+QFrame* VisuGUI_Panel::mainFrame()
+{
+  return myMainFrame;
+}
diff --git a/src/VISUGUI/VisuGUI_Panel.h b/src/VISUGUI/VisuGUI_Panel.h
new file mode 100755 (executable)
index 0000000..bd513ab
--- /dev/null
@@ -0,0 +1,83 @@
+//  VISU VISUGUI : GUI of VISU component
+//
+//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+//
+//  File   : VisuGUI_Panel.cxx
+//  Author : Oleg Uvarov
+//  Module : VISU
+
+#ifndef VISUGUI_PANEL_H
+#define VISUGUI_PANEL_H
+
+#include <QtxDockWidget.h>
+
+class QFrame;
+class QScrollArea;
+class QPushButton;
+
+class VisuGUI;
+
+class VisuGUI_Panel : public QtxDockWidget
+{
+  Q_OBJECT
+
+  class MainFrame;
+
+public:
+  enum { OKBtn      = 0x0001,
+         ApplyBtn   = 0x0002,
+         CloseBtn   = 0x0004,
+         HelpBtn    = 0x0008, 
+         AllBtn = OKBtn | ApplyBtn | CloseBtn | HelpBtn
+  };
+
+public:
+  VisuGUI_Panel( const QString& theName,
+                const VisuGUI* theModule,
+                QWidget* theParent,
+                const int theBtns = AllBtn ); 
+  virtual ~VisuGUI_Panel();
+
+  virtual bool              isValid( QString& theMessage );
+  virtual void              clear();
+
+protected slots:
+  virtual void              onOK();
+  virtual void              onApply();
+  virtual void              onClose();
+  virtual void              onHelp();
+
+protected:
+  QFrame*                   mainFrame();
+
+protected:
+  QScrollArea*              myView;
+  QFrame*                   myMainFrame;
+
+  QPushButton*              myOK;
+  QPushButton*              myApply;
+  QPushButton*              myClose;
+  QPushButton*              myHelp;
+
+  const VisuGUI*            myModule;
+};
+
+#endif
index d8110578183490425a2b3a415651c1000e8f3b49..9554ce2f2aa5fd14f8f8face22aa9db312c57465 100644 (file)
@@ -636,6 +636,7 @@ VisuGUI_ScalarBarPane::VisuGUI_ScalarBarPane( QWidget* parent, bool thePreview )
   MinEdit->setValidator( new QDoubleValidator(this) );
   MinEdit->setText( "0.0" );
   QLabel* MinLabel = new QLabel (tr("LBL_MIN"), aGB);
+  MinLabel->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ) );
   MinLabel->setBuddy(MinEdit);
 
   MaxEdit = new QLineEdit( aGB );
@@ -644,17 +645,18 @@ VisuGUI_ScalarBarPane::VisuGUI_ScalarBarPane( QWidget* parent, bool thePreview )
   MaxEdit->setValidator( new QDoubleValidator(this) );
   MaxEdit->setText( "0.0" );
   QLabel* MaxLabel = new QLabel (tr("LBL_MAX"), aGB);
+  MaxLabel->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ) );
   MaxLabel->setBuddy(MaxEdit);
 
-  RangeGroupLayout->addWidget( myModeLbl, 0, 0 );
-  RangeGroupLayout->addWidget( myModeCombo, 0, 1, 1, 4);
-  RangeGroupLayout->addWidget( CBLog, 1, 0, 1, 4);
-  RangeGroupLayout->addWidget( RBFrange, 2, 0, 1, 2);
-  RangeGroupLayout->addWidget( RBIrange, 2, 2, 1, 2);
-  RangeGroupLayout->addWidget( MinLabel, 3, 0 );
-  RangeGroupLayout->addWidget( MinEdit,  3, 1 );
-  RangeGroupLayout->addWidget( MaxLabel, 3, 2 );
-  RangeGroupLayout->addWidget( MaxEdit,  3, 3 );
+  RangeGroupLayout->addWidget( myModeLbl, 0, 0, 1, 1 );
+  RangeGroupLayout->addWidget( myModeCombo, 0, 1, 1, 2);
+  RangeGroupLayout->addWidget( CBLog, 0, 3, 1, 1);
+  RangeGroupLayout->addWidget( RBFrange, 1, 0, 1, 2);
+  RangeGroupLayout->addWidget( RBIrange, 1, 2, 1, 2);
+  RangeGroupLayout->addWidget( MinLabel, 2, 0 );
+  RangeGroupLayout->addWidget( MinEdit,  2, 1 );
+  RangeGroupLayout->addWidget( MaxLabel, 2, 2 );
+  RangeGroupLayout->addWidget( MaxEdit,  2, 3 );
 
   //TopLayout->addWidget( RangeGroup );
 
@@ -784,14 +786,7 @@ VisuGUI_ScalarBarPane::VisuGUI_ScalarBarPane( QWidget* parent, bool thePreview )
   // Save check box ===========================================================
   QWidget* aSaveBox = new QWidget(this);
   aMainLayout->addWidget( aSaveBox );
-  QVBoxLayout* aVBLay = new QVBoxLayout( aSaveBox );
-  if (!thePreview) {
-    CBSave = new QCheckBox (tr("SAVE_DEFAULT_CHK"), aSaveBox);
-    aVBLay->addWidget( CBSave );
-  }
-  else {
-    CBSave = 0;
-  }
+  QHBoxLayout* aVBLay = new QHBoxLayout( aSaveBox );
   aVBLay->addWidget( myTextBtn = new QPushButton("Text properties...", aSaveBox) );
   aVBLay->addWidget( myBarBtn  = new QPushButton("Bar properties...",  aSaveBox) );
   
@@ -801,13 +796,24 @@ VisuGUI_ScalarBarPane::VisuGUI_ScalarBarPane( QWidget* parent, bool thePreview )
 
   QGroupBox* CheckGroup = new QGroupBox("", this );
   aMainLayout->addWidget( CheckGroup );
-  QGridLayout* CheckGroupLayout = new QGridLayout( CheckGroup );
+  QHBoxLayout* CheckGroupLayout = new QHBoxLayout( CheckGroup );
   
   myPreviewCheck = new QCheckBox(tr("LBL_SHOW_PREVIEW"), CheckGroup);
   myPreviewCheck->setChecked(false);
-  CheckGroupLayout->addWidget(myPreviewCheck , 0, 0 );
-
-  if ( thePreview ) {
+  //myPreviewCheck->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
+  CheckGroupLayout->addWidget(myPreviewCheck);
+  
+// RKV : Begin
+  CBDistr = new QCheckBox (tr("SHOW_DISTRIBUTION"), CheckGroup);
+  //CBDistr->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
+  CheckGroupLayout->addWidget(CBDistr);
+// RKV : End
+  if (!thePreview) {
+    CBSave = new QCheckBox (tr("SAVE_DEFAULT_CHK"), CheckGroup);
+    CheckGroupLayout->addWidget( CBSave );
+  }
+  else {
+    CBSave = 0;
     myPreviewCheck->hide();
     CheckGroup->hide();
   }
@@ -833,6 +839,9 @@ VisuGUI_ScalarBarPane::VisuGUI_ScalarBarPane( QWidget* parent, bool thePreview )
   connect( myTextBtn,      SIGNAL( clicked() ),              this, SLOT( onTextPref() ) );
   connect( myBarBtn,       SIGNAL( clicked() ),              this, SLOT( onBarPref() ) );
   connect( myPreviewCheck, SIGNAL( toggled( bool )),         this, SLOT( onPreviewCheck( bool ) ) );
+  
+  connect( CBDistr,        SIGNAL( toggled( bool ) ),        this, SLOT( onShowDistribution( bool ) )); // RKV
+  
   connect( ColorSpin,      SIGNAL( valueChanged( int ) ),    this, SLOT( updatePreview() ));
   connect( LabelSpin,      SIGNAL( valueChanged( int ) ),    this, SLOT( updatePreview() ));
   connect( WidthSpin,      SIGNAL( valueChanged( double ) ), this, SLOT( updatePreview() ));
@@ -903,6 +912,7 @@ void VisuGUI_ScalarBarPane::storeToResources() {
     aResourceMgr->setValue("VISU", "scalar_range_type", 0);
   
   aResourceMgr->setValue("VISU", "scalar_bar_logarithmic", isLogarithmic());
+  aResourceMgr->setValue("VISU", "scalar_bar_show_distribution", isShowDistribution()); // RKV
  
   ////
 
@@ -1040,6 +1050,7 @@ void VisuGUI_ScalarBarPane::initFromPrsObject(VISU::ColoredPrs3d_i* thePrs)
   setRange( myScalarMap->GetMin(), myScalarMap->GetMax(), myScalarMap->IsRangeFixed() );
 
   setScalarBarData( myScalarMap->GetNbColors(), myScalarMap->GetLabels() );
+  setShowDistribution( myScalarMap->GetIsDistributionVisible() );
 
   // "Title"
   CORBA::String_var aTitle = myScalarMap->GetTitle();
@@ -1153,20 +1164,22 @@ void VisuGUI_ScalarBarPane::createScalarBar()
     myScalarMapPL->SetScaling(VISU::LOGARITHMIC);
   else
     myScalarMapPL->SetScaling(VISU::LINEAR);
-  vtkFloatingPointType theRange[2];
-  if(RBFrange->isChecked()) {
-    theRange[0] = myScalarMap->GetSourceMin();
-    theRange[1] = myScalarMap->GetSourceMax();
+
+  if ( RBFrange->isChecked() ) {
+    myScalarMapPL->SetSourceRange();
   } else {
-    theRange[0] = (vtkFloatingPointType)MinEdit->text().toDouble();
-    theRange[1] = (vtkFloatingPointType)MaxEdit->text().toDouble();
+    vtkFloatingPointType aRange[2];
+    aRange[0] = (vtkFloatingPointType)MinEdit->text().toDouble();
+    aRange[1] = (vtkFloatingPointType)MaxEdit->text().toDouble();
+    myScalarMapPL->SetScalarRange( aRange );
   }
-  myScalarMapPL->SetScalarRange(theRange);
-  myScalarMapPL->SetNbColors(sbCol);
-  
+
+  myScalarMapPL->SetNbColors(sbCol);  
   myScalarMapPL->Update();
   
   aScalarBarActor->SetLookupTable(myScalarMapPL->GetBarTable());
+  aScalarBarActor->SetDistribution( myScalarMapPL->GetDistribution() );
+  aScalarBarActor->SetDistributionVisibility( isShowDistribution() );
   
   if (!myTextDlg->getTitleText().isEmpty()) {
     VISU::PValForTime aValForTime;
@@ -1300,13 +1313,14 @@ int VisuGUI_ScalarBarPane::storeToPrsObject(VISU::ColoredPrs3d_i* thePrs) {
   else
     myScalarMap->SetScaling(VISU::LINEAR);
 
-  if (RBFrange->isChecked()) {
+  if ( RBFrange->isChecked() ) {
     myScalarMap->SetSourceRange();
   } else {
-    myScalarMap->SetRange(MinEdit->text().toDouble(), MaxEdit->text().toDouble());
+    myScalarMap->SetRange( MinEdit->text().toDouble(), MaxEdit->text().toDouble() );
   }
   myScalarMap->SetNbColors(ColorSpin->value());
   myScalarMap->SetLabels(LabelSpin->value());
+  myScalarMap->SetIsDistributionVisible(isShowDistribution()); // RKV
 
   if (isToSave()) storeToResources();
 
@@ -1394,13 +1408,19 @@ void VisuGUI_ScalarBarPane::onFieldRange( bool isOn )
 void VisuGUI_ScalarBarPane::onImposedRange( bool isOn )
 {
   if (isOn) {
-    myScalarMap->SetRange(myScalarMap->GetMin(), myScalarMap->GetMax());
+    myScalarMap->SetRange( myScalarMap->GetMin(), myScalarMap->GetMax() );
     MinEdit->setEnabled( true );
     MaxEdit->setEnabled( true );
     changeScalarMode(myModeCombo->currentIndex());
   }
 }
 
+void VisuGUI_ScalarBarPane::onShowDistribution( bool isOn )
+{
+  myScalarMap->SetIsDistributionVisible(isOn);
+  updatePreview();
+}
+
 void VisuGUI_ScalarBarPane::changeRange( int )
 {
   if ( RBFrange->isChecked() ) {
@@ -1408,7 +1428,7 @@ void VisuGUI_ScalarBarPane::changeRange( int )
     MinEdit->setEnabled( false );
     MaxEdit->setEnabled( false );
   } else {
-    myScalarMap->SetRange(myScalarMap->GetMin(), myScalarMap->GetMax());
+    myScalarMap->SetRange( myScalarMap->GetMin(), myScalarMap->GetMax() );
     MinEdit->setEnabled( true );
     MaxEdit->setEnabled( true );
   }
@@ -1536,6 +1556,18 @@ void VisuGUI_ScalarBarPane::setLogarithmic( bool on ) {
   CBLog->setChecked( on );
 }
 
+//----------------------------------------------------------------------------
+bool VisuGUI_ScalarBarPane::isShowDistribution() {
+  return CBDistr->isChecked();
+}
+
+
+//----------------------------------------------------------------------------
+void VisuGUI_ScalarBarPane::setShowDistribution( bool on ) {
+  CBDistr->setChecked( on );
+}
+
+// RKV : End
 //----------------------------------------------------------------------------
 bool VisuGUI_ScalarBarPane::isToSave() {
   return CBSave ? CBSave->isChecked() : false;
index 86c0705a9e01fd0caea568b8daa385a4b65fd73a..01fefefd76c201fd4ec7f9e5c0f9c090d1f8e563 100644 (file)
@@ -175,6 +175,8 @@ class VisuGUI_ScalarBarPane : public QWidget//QVBox
   int     getNbLabels();
   bool    isLogarithmic();
   void    setLogarithmic( bool on );
+  bool    isShowDistribution();
+  void    setShowDistribution( bool on );
   bool    isToSave();
 
   void storeToResources();
@@ -205,6 +207,8 @@ class VisuGUI_ScalarBarPane : public QWidget//QVBox
 
   QCheckBox*      CBSave;
   QCheckBox*      CBLog;
+  QCheckBox*      CBDistr;
+
   QLabel*         myModeLbl;
   QComboBox*      myModeCombo;
   QPushButton*    myTextBtn;
@@ -229,6 +233,8 @@ class VisuGUI_ScalarBarPane : public QWidget//QVBox
   void onBarPref();
   void onPreviewCheck(bool thePreview);
   void updatePreview();
+  void onFilterByScalars(bool); // RKV
+  void onShowDistribution(bool); // RKV
 
  private:
   void createScalarBar();
index 0fb0c6d4cc6ea224a7122fb67e71c3243ff3824c..21dc5ee5afb18d68fe796800b9be2b38ba3b862d 100644 (file)
@@ -280,61 +280,68 @@ namespace VISU
 
   //---------------------------------------------------------------
   template<class TPrs3d_i, class TViewer, class TDlg, int IsDlgModal>
-  void
+  TPrs3d_i*
   CreatePrs3dInViewer(VisuGUI* theModule,
                      _PTR(SObject) theTimeStampSObj,
                      ColoredPrs3d_i::EPublishInStudyMode thePublishInStudyMode)
   {
+    TPrs3d_i* aPrs = 0;
     // Create new TViewWindow instance, if it does not exist.
     typedef typename TViewer::TViewWindow TViewWindow;
     if (!GetViewWindow<TViewer>(theModule))
-      return;
+      return aPrs;
 
-    CreateAndEditPrs3d<TPrs3d_i,TViewer,TDlg,IsDlgModal>
-      (theModule,theTimeStampSObj,thePublishInStudyMode);
+    aPrs = CreateAndEditPrs3d<TPrs3d_i,TViewer,TDlg,IsDlgModal>
+              (theModule,theTimeStampSObj,thePublishInStudyMode);
 
     theModule->application()->putInfo(QObject::tr("INF_DONE"));
+    return aPrs;
   }
 
 
   //----------------------------------------------------------------------------
   template<class TPrs3d_i, class TDlg, int IsDlgModal>
-  void
+  TPrs3d_i*
   CreatePrs3d(VisuGUI* theModule,
              const QString& theDesiredViewerType = QString())
   {
+    TPrs3d_i* aPrs = 0;
     if (CheckLock(GetCStudy(GetAppStudy(theModule)),GetDesktop(theModule)))
-      return;
+      return aPrs;
 
     _PTR(SObject) aTimeStampSObj;
     Handle(SALOME_InteractiveObject) anIO;
     ColoredPrs3d_i::EPublishInStudyMode aPublishInStudyMode;
     if (!CheckTimeStamp(theModule,aTimeStampSObj,anIO,aPublishInStudyMode))
-      return;
-
-    if(aPublishInStudyMode == VISU::ColoredPrs3d_i::EPublishIndependently){
-      CreatePrs3dInViewer<TPrs3d_i,VVTK_Viewer,TDlg,0>
-       (theModule,aTimeStampSObj,aPublishInStudyMode);
-      return;
+      return aPrs;
+
+    if(/*aPublishInStudyMode == */VISU::ColoredPrs3d_i::EPublishIndependently){
+      //      CreatePrs3dInViewer<TPrs3d_i,VVTK_Viewer,TDlg,0>
+      //       (theModule,aTimeStampSObj,aPublishInStudyMode);
+      aPrs = CreatePrs3dInViewer<TPrs3d_i,SVTK_Viewer,TDlg,0>
+               (theModule,aTimeStampSObj,aPublishInStudyMode);
+      return aPrs;
     }else{
       if(theDesiredViewerType.isNull()){
-       if (SUIT_ViewManager* aViewManager = theModule->getApp()->activeViewManager())
-         if (aViewManager->getType() == VVTK_Viewer::Type()){ 
-           CreatePrs3dInViewer<TPrs3d_i,VVTK_Viewer,TDlg,IsDlgModal>
-             (theModule,aTimeStampSObj,aPublishInStudyMode);
-           return;
-         }
-       CreatePrs3dInViewer<TPrs3d_i,SVTK_Viewer,TDlg,IsDlgModal>
-         (theModule,aTimeStampSObj,aPublishInStudyMode);
+       if (/*SUIT_ViewManager* aViewManager = */theModule->getApp()->activeViewManager())
+         /*if (aViewManager->getType() == VVTK_Viewer::Type()){ 
+           aPrs = CreatePrs3dInViewer<TPrs3d_i,VVTK_Viewer,TDlg,IsDlgModal>
+                     (theModule,aTimeStampSObj,aPublishInStudyMode);
+           return aPrs;
+           }*/
+       aPrs = CreatePrs3dInViewer<TPrs3d_i,SVTK_Viewer,TDlg,IsDlgModal>
+                  (theModule,aTimeStampSObj,aPublishInStudyMode);
       }else{
-       if(theDesiredViewerType == VVTK_Viewer::Type())
-         CreatePrs3dInViewer<TPrs3d_i,VVTK_Viewer,TDlg,IsDlgModal>
-           (theModule,aTimeStampSObj,aPublishInStudyMode);
-       else
-         CreatePrs3dInViewer<TPrs3d_i,SVTK_Viewer,TDlg,IsDlgModal>
-           (theModule,aTimeStampSObj,aPublishInStudyMode);
+       /*if(theDesiredViewerType == VVTK_Viewer::Type()) {
+         aPrs = CreatePrs3dInViewer<TPrs3d_i,VVTK_Viewer,TDlg,IsDlgModal>
+                    (theModule,aTimeStampSObj,aPublishInStudyMode);
+                    } else {*/
+         aPrs = CreatePrs3dInViewer<TPrs3d_i,SVTK_Viewer,TDlg,IsDlgModal>
+                    (theModule,aTimeStampSObj,aPublishInStudyMode);
+         //}
       }
     }
+    return aPrs;
   }
 
 
index c4b6d44e20b8a21ebe181d267c8964075c86e907..e2ceec1f7ad4c2f4a241b8cbac0d8d5ea0f7d240 100644 (file)
 //  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
-//
+//  Copyright (C) 2005  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
+// 
+//  This library is free software; you can redistribute it and/or 
+//  modify it under the terms of the GNU Lesser General Public 
+//  License as published by the Free Software Foundation; either 
+//  version 2.1 of the License. 
+// 
+//  This library is distributed in the hope that it will be useful, 
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of 
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
+//  Lesser General Public License for more details. 
+// 
+//  You should have received a copy of the GNU Lesser General Public 
+//  License along with this library; if not, write to the Free Software 
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
+// 
 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 //
 //
 //  File   : VisuGUI_Selection.cxx
-//  Author : Laurent CORNABE & Hubert ROLLAND
+//  Author : Sergey Anikin 
 //  Module : VISU
-//  $Header$
 
 #include "VisuGUI_Selection.h"
 
-#include "VisuGUI.h"
-#include "VisuGUI_Tools.h"
 #include "VisuGUI_ViewTools.h"
+#include "VisuGUI_Tools.h"
+
+#include "VISU_Result_i.hh"
+#include "VISU_Gen_i.hh"
 
 #include "VISU_Actor.h"
-#include "VISU_PrsObject_i.hh"
-#include "VISU_Prs3d_i.hh"
-#include "VISU_PipeLine.hxx"
+#include "VISU_ScalarMapAct.h"
 
 #include "SalomeApp_Study.h"
-#include "SalomeApp_Application.h"
-#include "LightApp_Application.h"
-#include "LightApp_SelectionMgr.h"
-#include "LightApp_VTKSelector.h"
-
-#include "SUIT_Desktop.h"
-#include "SUIT_MessageBox.h"
-#include "SUIT_ViewWindow.h"
-#include "SUIT_Session.h"
-#include "SUIT_ResourceMgr.h"
-
-#include "SALOME_ListIO.hxx"
-#include "SALOME_ListIteratorOfListIO.hxx"
-
-#include "SVTK_ViewWindow.h"
-#include "SVTK_Selector.h"
-
-#include "VISU_ConvertorUtils.hxx"
-
-#include "utilities.h"
-
-// OCCT Includes
-#include <TColStd_IndexedMapOfInteger.hxx>
-#include <TColStd_MapOfInteger.hxx>
-
-// QT Includes
-#include <QLabel>
-#include <QSpinBox>
-#include <QListWidget>
-#include <QLayout>
-#include <QButtonGroup>
-#include <QRadioButton>
-#include <QValidator>
-#include <QPushButton>
-#include <QStackedWidget>
-#include <QGroupBox>
-#include <QLineEdit>
-#include <QValidator>
-#include <QTableWidget>
-#include <QVBoxLayout>
-#include <QHBoxLayout>
-#include <QKeyEvent>
-#include <QHeaderView>
-
-// VTK Includes
-#include <vtkDataSetMapper.h>
-#include <vtkDataSet.h>
-#include <vtkPointData.h>
-#include <vtkCellData.h>
-#include <vtkCell.h>
-
-// STL Includes
-#include <map>
-
-using namespace std;
-
-
-inline
-QString
-GetNumber( const VISU::TStructuredId& theStructuredId,
-          size_t theId )
+#include "LightApp_Study.h"
+
+using namespace VISU;
+
+//////////////////////////////////////////////////
+// Class: VisuGUI_Selection
+//////////////////////////////////////////////////
+
+
+//---------------------------------------------------------------
+QVariant VisuGUI_Selection::parameter( const int ind, const QString& p ) const
 {
-  if ( theStructuredId[theId] < 0 )
-    return "-";
-  
-  return QString::number( theStructuredId[theId] );
+  QVariant val( LightApp_Selection::parameter( ind, p ) );
+  if ( !val.isValid() ) {
+    if      ( p == "type"           ) val = QVariant( type( ind ) );
+    else if ( p == "nbComponents"   ) val = QVariant( nbComponents( ind ) );
+    else if ( p == "medEntity"   ) val = QVariant( medEntity( ind ) );
+    else if ( p == "medSource"   ) val = QVariant( medSource( ind ) );
+    else if ( p == "representation" ) val = QVariant( representation( ind ) );
+    else if ( p == "nbTimeStamps"   ) val = QVariant( nbTimeStamps( ind ) );
+    else if ( p == "nbChildren"     ) val = QVariant( nbChildren( ind ) );
+    else if ( p == "nbNamedChildren") val = QVariant( nbNamedChildren( ind ) );
+    else if ( p == "isVisible"      ) val = QVariant( isVisible( ind ) );
+    else if ( p == "isShrunk"       ) val = QVariant( isShrunk( ind ) );
+    else if ( p == "hasActor"       ) val = QVariant( hasActor( ind ) );
+    else if ( p == "isShading"      ) val = QVariant( isShading( ind ) );
+    else if ( p == "isScalarMapAct" ) val = QVariant( isScalarMapAct( ind ) );
+    else if ( p == "isVisuComponent") val = QVariant( isVisuComponent( ind ) );
+    else if ( p == "fullResolution"   ) val = QVariant( fullResolution( ind ) );
+    else if ( p == "mediumResolution"   ) val = QVariant( mediumResolution( ind ) );
+    else if ( p == "lowResolution"   ) val = QVariant( lowResolution( ind ) );
+    else if ( p == "resolutionState"   ) val = QVariant( resolutionState( ind ) );
+  }
+
+  return val;
 }
 
 
-VisuGUI_SelectionDlg::VisuGUI_SelectionDlg (const SalomeApp_Module* theModule):
-  QDialog(VISU::GetDesktop(theModule), 
-         Qt::WindowTitleHint | Qt::WindowSystemMenuHint ),//WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | WDestructiveClose),
-  mySelectionMgr(NULL),
-  myModule(theModule)
+//---------------------------------------------------------------
+// Macro for converting VISU enumeration items into corresponding strings
+#define ENUM2STRING( x, y ) \
+  case y: \
+    x = QString( #y ); \
+    break
+
+QString VisuGUI_Selection::type( const int ind ) const
 {
-  setModal( false ); 
-  setAttribute( Qt::WA_DeleteOnClose, true );
-  setWindowTitle( tr("WINDOW_TITLE" ) );
-  setSizeGripEnabled(true);
-
-  QGridLayout* TopLayout = new QGridLayout (this);
-  TopLayout->setSpacing(6);
-  TopLayout->setMargin(11);
-  TopLayout->setRowStretch(0, 0);
-  TopLayout->setRowStretch(1, 0);
-  TopLayout->setRowStretch(2, 1);
-  TopLayout->setRowStretch(3, 0);
-
-  QGroupBox* aTypeBox = new QGroupBox (tr("MODE_TITLE"), this);
-  QHBoxLayout* aHBox = new QHBoxLayout();
-  QButtonGroup* aBtnGroup = new QButtonGroup();
-
-  QRadioButton* aBtn = new QRadioButton (tr("MODE_POINT"), aTypeBox);
-  aHBox->addWidget( aBtn );
-  aBtnGroup->addButton( aBtn, 0 );
-
-  aBtn = new QRadioButton (tr("MODE_CELL"), aTypeBox);
-  aHBox->addWidget( aBtn );
-  aBtnGroup->addButton( aBtn, 1 );
-
-  aBtn = new QRadioButton (tr("MODE_ACTOR"), aTypeBox);
-  aHBox->addWidget( aBtn );
-  aBtnGroup->addButton( aBtn, 2 );
-  
-  aBtnGroup->button(0)->setChecked(true);
+  QString aResStr;
+  SalomeApp_Study* aStudy = GetStudy();
+  if ( !aStudy )
+    return aResStr;
+
+  VISU::TObjectInfo anObjectInfo = VISU::GetObjectByEntry(aStudy, (const char*)entry( ind ).toLatin1());
+  VISU::Storable::TRestoringMap aMap = VISU::Storable::GetStorableMap(anObjectInfo.mySObject);
+
+  VISU::Base_i* aBase = anObjectInfo.myBase;
+  if(aBase){
+    VISU::VISUType aType = aBase->GetType();
+    if(aType == VISU::TCOLOREDPRS3DHOLDER){
+      CORBA::Object_var anObject = ClientSObjectToObject(anObjectInfo.mySObject);
+      VISU::ColoredPrs3dHolder_var aHolder = VISU::ColoredPrs3dHolder::_narrow(anObject);
+      aType = aHolder->GetPrsType();
+    }
+    switch (aType) {
+      ENUM2STRING( aResStr, VISU::TVISUGEN );
+      ENUM2STRING( aResStr, VISU::TRESULT );
+      ENUM2STRING( aResStr, VISU::TTABLE );
+      ENUM2STRING( aResStr, VISU::TCURVE );
+      ENUM2STRING( aResStr, VISU::TCONTAINER );
+      ENUM2STRING( aResStr, VISU::TMESH );
+      ENUM2STRING( aResStr, VISU::TSCALARMAP );
+      ENUM2STRING( aResStr, VISU::TISOSURFACES );
+      ENUM2STRING( aResStr, VISU::TDEFORMEDSHAPE );
+      ENUM2STRING( aResStr, VISU::TSCALARMAPONDEFORMEDSHAPE );
+      ENUM2STRING( aResStr, VISU::TCUTPLANES );
+      ENUM2STRING( aResStr, VISU::TCUTLINES );
+      ENUM2STRING( aResStr, VISU::TVECTORS );
+      ENUM2STRING( aResStr, VISU::TSTREAMLINES );
+      ENUM2STRING( aResStr, VISU::TPLOT3D );
+      ENUM2STRING( aResStr, VISU::TANIMATION );
+    }
+  }
 
-  connect(aBtnGroup, SIGNAL(buttonClicked(int)), this, SLOT(onSelectionChange(int)));
+  if(aResStr.isNull()){
+    VISU::VISUType aType = VISU::Storable::RestoringMap2Type(aMap);
+    switch (aType) {
+      ENUM2STRING( aResStr, VISU::TENTITY );
+      ENUM2STRING( aResStr, VISU::TFAMILY );
+      ENUM2STRING( aResStr, VISU::TGROUP );
+      ENUM2STRING( aResStr, VISU::TVIEW3D );
+      ENUM2STRING( aResStr, VISU::TFIELD );
+      ENUM2STRING( aResStr, VISU::TTIMESTAMP );
+    }
+  }
 
-  aTypeBox->setLayout(aHBox);
-  TopLayout->addWidget(aTypeBox, 0, 0);
+  if(aResStr.isNull()){
+    bool anIsExist;
+    QString aVal = VISU::Storable::FindValue(aMap, "myComment", &anIsExist);
+    if ( anIsExist && aVal != "MESH" )
+      aResStr = "VISU::T" + aVal;
+  }
+
+  return aResStr;
+}
 
-  QWidget* aNamePane = new QWidget (this);
-  QGridLayout* aNameLay = new QGridLayout (aNamePane);
 
-  QLabel* aMeshLbl = new QLabel (tr("MESH_NAME_LBL"), aNamePane);
-  myMeshName = new QLabel (aNamePane);
+//---------------------------------------------------------------
+QString VisuGUI_Selection::nbComponents( const int ind ) const
+{
+  QString aResStr;
+  SalomeApp_Study* aStudy = GetStudy();
+  if ( !aStudy )
+    return aResStr;
+
+  VISU::TObjectInfo anObjectInfo = VISU::GetObjectByEntry(aStudy, (const char*)entry( ind ).toLatin1());
+  VISU::Storable::TRestoringMap aMap = VISU::Storable::GetStorableMap(anObjectInfo.mySObject);
+
+  bool isExist;
+  QString aVal = VISU::Storable::FindValue(aMap,"myNumComponent",&isExist);
+  if ( isExist )
+    aResStr = aVal;
+  return aResStr;
+}
+
 
-  QLabel* aFieldLbl = new QLabel (tr("FIELD_NAME_LBL"), aNamePane);
-  myFieldName = new QLabel (aNamePane);
+//---------------------------------------------------------------
+QString VisuGUI_Selection::resolutions( const int ind ) const
+{
+  QString aResStr;
+  SalomeApp_Study* aStudy = GetStudy();
+  if ( !aStudy )
+    return aResStr;
 
-  aNameLay->addWidget(aMeshLbl, 0, 0);
-  aNameLay->addWidget(myMeshName, 0, 1);
-  aNameLay->addWidget(aFieldLbl, 1, 0);
-  aNameLay->addWidget(myFieldName, 1, 1);
+  VISU::TObjectInfo anObjectInfo = VISU::GetObjectByEntry(aStudy, entry( ind ).toLatin1().data());
+  VISU::Storable::TRestoringMap aMap = VISU::Storable::GetStorableMap(anObjectInfo.mySObject);
 
-  TopLayout->addWidget(aNamePane, 1, 0);
+  bool isExist;
+  QString aVal = VISU::Storable::FindValue(aMap,"myResolutions",&isExist);
+  if ( isExist )
+    aResStr = aVal;
 
-  myWidgetStack = new QStackedWidget (this);
+  return aResStr;
+}
 
-  // Create Points pane
-  myPointsPane = new QWidget (myWidgetStack);
-  QVBoxLayout* aVBoxLayout = new QVBoxLayout(myPointsPane);
 
-  QGroupBox* aDataGrp = new QGroupBox ( tr("POINT_DATA_TITLE"), myPointsPane);
-  QGridLayout* aGridLay = new QGridLayout (aDataGrp);
-  aGridLay->setSpacing(6);
+//---------------------------------------------------------------
+QString VisuGUI_Selection::resolution( const int ind, char theResoltuion ) const
+{
+  QString aResStr;
 
-  aGridLay->addWidget( new QLabel (tr("DATA_ID_LBL"), aDataGrp) , 0, 0 );
-  aGridLay->addWidget( new QLabel (tr("DATA_SCALAR_LBL"), aDataGrp), 1, 0 );
-  aGridLay->addWidget( new QLabel (tr("DATA_VECTOR_LBL"), aDataGrp), 2, 0 );
-  
-  myIDValLbl = new QLineEdit ("", aDataGrp);
-  aGridLay->addWidget( myIDValLbl, 0, 1 );
-  QIntValidator* aIntValidator = new QIntValidator (myIDValLbl);
-  aIntValidator->setBottom(0);
-  myIDValLbl->setValidator(aIntValidator);
-  connect(myIDValLbl, SIGNAL(textChanged(const QString&)), this, SLOT(onPointIdEdit(const QString&)));
-
-  myScalarValLbl = new QLabel ("", aDataGrp);
-  aGridLay->addWidget( myScalarValLbl, 1, 1 );  
+  QString aResolutions = resolutions( ind );
+  if(aResolutions.isEmpty())
+    return aResStr;
   
-  myVectorValLbl = new QLabel ("", aDataGrp);
-  myVectorValLbl->setMinimumWidth(150);
-  aGridLay->addWidget( myVectorValLbl, 2, 1 );  
-
-  aVBoxLayout->addWidget( aDataGrp );
-
-  QGroupBox* aCoordGrp = new QGroupBox ( tr("POINT_COORD_TITLE"), myPointsPane);
-  aGridLay = new QGridLayout (aCoordGrp);
-  aGridLay->setSpacing(6);
-
-  aGridLay->addWidget( new QLabel ("X:", aCoordGrp), 0, 0 );
-  myXValLbl = new QLabel ("", aCoordGrp);
-  aGridLay->addWidget( myXValLbl, 0, 1 );
-  //ENK: 23.11.2006 - PAL13176 - EDF228 VISU : Enhancement of structured datas processing
-  aGridLay->addWidget( new QLabel ("I:", aCoordGrp), 0, 2 );
-  myIValLbl = new QLabel ("-", aCoordGrp);
-  aGridLay->addWidget( myIValLbl, 0, 3 );
-  //ENK: 23.11.2006
-  aGridLay->addWidget( new QLabel ("Y:", aCoordGrp), 1, 0 );
-  myYValLbl = new QLabel ("", aCoordGrp);
-  aGridLay->addWidget( myYValLbl, 1, 1 );
-  //ENK: 23.11.2006 - PAL13176 - EDF228 VISU : Enhancement of structured datas processing
-  aGridLay->addWidget( new QLabel ("J:", aCoordGrp), 1, 2 );
-  myJValLbl = new QLabel ("-", aCoordGrp);
-  aGridLay->addWidget( myJValLbl, 1, 3 );
-  //ENK: 23.11.2006
-  aGridLay->addWidget( new QLabel ("Z:",aCoordGrp ), 2, 0 );
-  myZValLbl = new QLabel ("", aCoordGrp);
-  aGridLay->addWidget( myZValLbl, 2, 1 );
-  //ENK: 23.11.2006 - PAL13176 - EDF228 VISU : Enhancement of structured datas processing
-  aGridLay->addWidget( new QLabel ("K:", aCoordGrp), 2, 2 );
-  myKValLbl = new QLabel ("-", aCoordGrp);
-  aGridLay->addWidget( myKValLbl, 2, 3 );
-  //ENK: 23.11.2006
-
-  aVBoxLayout->addWidget( aCoordGrp );
-
-  myWidgetStack->addWidget(myPointsPane);
-
-  // Create Cells pane
-  myCellsPane = new QWidget (myWidgetStack);
-  QGridLayout* aCellLayout = new QGridLayout (myCellsPane);
-  aCellLayout->setSpacing(6);
-  aCellLayout->setRowStretch(0, 0);
-  aCellLayout->setRowStretch(1, 1);
-
-  QGroupBox* aCellGrp = new QGroupBox( tr("CELL_DATA_TITLE"), myCellsPane);
-  aGridLay = new QGridLayout (aCellGrp);
-
-  aGridLay->addWidget( new QLabel (tr("DATA_ID_LBL"), aCellGrp), 0, 0);
-  myCellIDValLbl = new QLineEdit ("", aCellGrp);
-  myCellIDValLbl->setValidator(aIntValidator);
-  aGridLay->addWidget( myCellIDValLbl, 0, 1);
-  connect(myCellIDValLbl, SIGNAL(textChanged(const QString&)), this, SLOT(onCellIdEdit(const QString&)));
-
-  aGridLay->addWidget( new QLabel (tr("DATA_SCALAR_LBL"), aCellGrp), 1, 0);
-  myCellScalarValLbl = new QLabel ("", aCellGrp);
-  aGridLay->addWidget( myCellScalarValLbl, 1, 1);
-  aGridLay->addWidget( new QLabel (tr("DATA_VECTOR_LBL"), aCellGrp), 2, 0);
-  myCellVectorValLbl = new QLabel ("", aCellGrp);
-  aGridLay->addWidget(myCellVectorValLbl , 2, 1);
-
-  aCellLayout->addWidget(aCellGrp, 0, 0);
-
-  myListPoints = new QTableWidget (myCellsPane);
-  myListPoints->setEditTriggers( QAbstractItemView::NoEditTriggers );
-  myListPoints->setColumnCount(9);
-  myListPoints->setRowCount(0);
-  myListPoints->setColumnWidth(0, 40);
-  myListPoints->setColumnWidth(1, 40);
-  myListPoints->setColumnWidth(2, 40);
-  myListPoints->setColumnWidth(3, 40);
-  myListPoints->setColumnWidth(4, 40);//ENK: 23.11.2006 - PAL13176 - EDF228 VISU : Enhancement of structured datas processing
-  myListPoints->setColumnWidth(5, 40);//ENK: 23.11.2006 - PAL13176 - EDF228 VISU : Enhancement of structured datas processing
-  myListPoints->setColumnWidth(6, 40);//ENK: 23.11.2006 - PAL13176 - EDF228 VISU : Enhancement of structured datas processing
-  myListPoints->setSelectionMode(QAbstractItemView::NoSelection);
-
-  QStringList aLabels;
-  aLabels.append( "ID" );
-  aLabels.append( "X" );
-  aLabels.append( "Y" );
-  aLabels.append( "Z" );
-  aLabels.append( "I" );//ENK: 23.11.2006 - PAL13176 - EDF228 VISU : Enhancement of structured datas processing
-  aLabels.append( "J" );//ENK: 23.11.2006 - PAL13176 - EDF228 VISU : Enhancement of structured datas processing
-  aLabels.append( "K" );//ENK: 23.11.2006 - PAL13176 - EDF228 VISU : Enhancement of structured datas processing
-  aLabels.append( tr("CELL_DATA_SCALAR_HDR") );
-  aLabels.append( tr("CELL_DATA_VECTOR_HDR") );
-  myListPoints->setHorizontalHeaderLabels( aLabels );
-
-  aCellLayout->addWidget(myListPoints, 1, 0);
-
-  myWidgetStack->addWidget(myCellsPane);
-
-  // Actor Pane
-  myActorsPane = new QWidget (myWidgetStack);
-  aVBoxLayout = new QVBoxLayout(myActorsPane);  
-  aVBoxLayout->setSpacing(6);
-
-  QGroupBox* aPosGrp = new QGroupBox (tr("ACTOR_DATA_POSITION_TITLE"), myActorsPane);
-  aGridLay = new QGridLayout (aPosGrp);
-  aGridLay->setSpacing(6);
-  aGridLay->addWidget( new QLabel ("X:", aPosGrp), 0, 0);
-  myXPosLbl = new QLabel ("0", aPosGrp);
-  aGridLay->addWidget( myXPosLbl, 0, 1);
-  aGridLay->addWidget( new QLabel ("Y:", aPosGrp), 1, 0);
-  myYPosLbl = new QLabel ("0", aPosGrp);
-  aGridLay->addWidget( myYPosLbl, 1, 1);
-  aGridLay->addWidget( new QLabel ("Z:", aPosGrp), 2, 0);
-  myZPosLbl = new QLabel ("0", aPosGrp);
-  aGridLay->addWidget( myZPosLbl, 2, 1);
-
-  aVBoxLayout->addWidget( aPosGrp );
-
-  QGroupBox* aSizeGrp = new QGroupBox ( tr("ACTOR_DATA_SIZE_TITLE"), myActorsPane);
-  aGridLay = new QGridLayout (aSizeGrp);
-  aGridLay->setSpacing(6);
-  aGridLay->addWidget( new QLabel ("dX:", aSizeGrp ), 0, 0);
-  myDXLbl = new QLabel ("0", aSizeGrp);
-  aGridLay->addWidget( myDXLbl, 0, 1);
-  aGridLay->addWidget( new QLabel ("dY:", aSizeGrp ), 1, 0);
-  myDYLbl = new QLabel ("0", aSizeGrp);
-  aGridLay->addWidget( myDYLbl, 1, 1);
-  aGridLay->addWidget( new QLabel ("dZ:", aSizeGrp ), 2, 0);
-  myDZLbl = new QLabel ("0", aSizeGrp);
-  aGridLay->addWidget( myDZLbl, 2, 1);
-
-  aVBoxLayout->addWidget( aSizeGrp );
-
-  myWidgetStack->addWidget(myActorsPane);
-
-
-  TopLayout->addWidget(myWidgetStack, 2, 0);
-
-  // Create buttons group
-  QWidget* aBtnBox = new QWidget (this);  
-  QHBoxLayout* aBtnLayout = new QHBoxLayout( aBtnBox);
-  aBtnLayout->addStretch();
-
-  QPushButton* aCloseBtn = new QPushButton (tr("BUT_CLOSE"), aBtnBox);
-  aBtnLayout->addWidget(aCloseBtn);
-  connect(aCloseBtn, SIGNAL(clicked()), this, SLOT(close()));
-
-  QPushButton* aHelpBtn = new QPushButton (tr("BUT_HELP"), aBtnBox);
-  aBtnLayout->addWidget(aHelpBtn);
-  connect(aHelpBtn, SIGNAL(clicked()), this, SLOT(onHelp()));
-
-  TopLayout->addWidget(aBtnBox, 3, 0);
-
-  SalomeApp_Application* anApp = dynamic_cast<SalomeApp_Application*>
-    (SUIT_Session::session()->activeApplication());
-  mySelectionMgr = anApp->selectionMgr();
-  connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(onSelectionEvent()));
-
-  //connect(visuGUI, SIGNAL(SignalCloseAllDialogs()), this, SLOT(close()));
-
-  myFl = false;
-
-  // Activate Points pane
-  myWidgetStack->setCurrentWidget(myPointsPane);
-  if (SVTK_ViewWindow* aViewWindow = VISU::GetActiveViewWindow<SVTK_ViewWindow>(myModule))
-    aViewWindow->SetSelectionMode(NodeSelection);
-  onSelectionEvent();
+  if(aResolutions.indexOf(theResoltuion) != -1)
+    aResStr = "1";
+  else
+    aResStr = "0";
+
+  return aResStr;
 }
 
-VisuGUI_SelectionDlg::~VisuGUI_SelectionDlg()
+
+//---------------------------------------------------------------
+QString VisuGUI_Selection::fullResolution( const int ind ) const
 {
-  SVTK_ViewWindow* aViewWindow = VISU::GetActiveViewWindow<SVTK_ViewWindow>(myModule);
-  if ( !aViewWindow )
-    return;
-
-  switch ( aViewWindow->SelectionMode() ) {
-  case NodeSelection:
-  case CellSelection:
-    aViewWindow->SetSelectionMode(ActorSelection);
-    break;
-  }
+  return resolution( ind, 'F');
 }
 
-void VisuGUI_SelectionDlg::onSelectionChange (int theId)
+
+//---------------------------------------------------------------
+QString VisuGUI_Selection::mediumResolution( const int ind ) const
 {
-  SVTK_ViewWindow* aViewWindow = VISU::GetActiveViewWindow<SVTK_ViewWindow>(myModule);
-  if (!aViewWindow) return;
-
-  switch (theId) {
-  case 0: // Points
-    myWidgetStack->setCurrentWidget(myPointsPane);
-    aViewWindow->SetSelectionMode(NodeSelection);
-    onPointIdEdit(myIDValLbl->text());
-    break;
-  case 1: // Cells
-    myWidgetStack->setCurrentWidget(myCellsPane);
-    aViewWindow->SetSelectionMode(CellSelection);
-    onCellIdEdit(myCellIDValLbl->text());
-    break;
-  case 2: // Actor
-    myWidgetStack->setCurrentWidget(myActorsPane);
-    aViewWindow->SetSelectionMode(ActorSelection);
-    onSelectionEvent();
-  }
+  return resolution( ind, 'M');
 }
 
 
-void VisuGUI_SelectionDlg::closeEvent (QCloseEvent* theEvent)
+//---------------------------------------------------------------
+QString VisuGUI_Selection::lowResolution( const int ind ) const
 {
-  QDialog::closeEvent(theEvent);
+  return resolution( ind, 'L');
 }
 
-template<class TData> QString getValue(TData* theData, int theId){
-  if (vtkDataArray *aScalar = theData->GetScalars()){
-    vtkFloatingPointType aVal = aScalar->GetTuple1(theId);
-    return QString::number(aVal);
-  } else {
-    return QString("No data");
+
+//---------------------------------------------------------------
+QString VisuGUI_Selection::resolutionState( const int ind ) const
+{
+  QString aResStr;
+  SalomeApp_Study* aStudy = GetStudy();
+  if ( !aStudy )
+    return aResStr;
+
+  VISU::TObjectInfo anObjectInfo = VISU::GetObjectByEntry(aStudy, entry( ind ).toLatin1().data());
+  VISU::Storable::TRestoringMap aMap = VISU::Storable::GetStorableMap(anObjectInfo.mySObject);
+
+  bool isExist;
+  QString aVal = VISU::Storable::FindValue(aMap,"myState",&isExist);
+  if ( isExist ) {
+    if ( aVal.toInt() == VISU::Result::FULL )
+      aResStr = "F";
+    if ( aVal.toInt() == VISU::Result::MEDIUM )
+      aResStr = "M";
+    if ( aVal.toInt() == VISU::Result::LOW )
+      aResStr = "L";
+    if ( aVal.toInt() == VISU::Result::HIDDEN )
+      aResStr = "H";
   }
+
+  return aResStr;
 }
 
-template<class TData> QString getVector(TData* theData, int theId){
-  if (vtkDataArray *aVector = theData->GetVectors()) {
-    vtkFloatingPointType *aVal = aVector->GetTuple3(theId);
-    return QString("%1; %2; %3").arg(aVal[0]).arg(aVal[1]).arg(aVal[2]);
-  } else {
-    return QString("No data");
+
+//---------------------------------------------------------------
+QString VisuGUI_Selection::medEntity( const int ind ) const
+{
+  SalomeApp_Study* aStudy = GetStudy();
+  if ( !aStudy )
+    return QString();
+
+  VISU::TObjectInfo anObjectInfo = VISU::GetObjectByEntry(aStudy, (const char*)entry( ind ).toLatin1());
+  VISU::Storable::TRestoringMap aMap = VISU::Storable::GetStorableMap(anObjectInfo.mySObject);
+
+  bool isExist;
+  QString aVal = VISU::Storable::FindValue(aMap,"myEntityId",&isExist);
+  if ( isExist ) {
+    using namespace VISU;
+    TEntity anEntityId = TEntity(aVal.toInt());
+    switch(anEntityId){
+    case NODE_ENTITY :
+      return "NODE_ENTITY";
+    case EDGE_ENTITY :
+      return "EDGE_ENTITY";
+    case FACE_ENTITY :
+      return "FACE_ENTITY";
+    case CELL_ENTITY :
+      return "CELL_ENTITY";
+    default:
+      return QString();
+    }
   }
+  return QString();
 }
 
-#define ABS(a) (a>=0)?a:-a
-
-void VisuGUI_SelectionDlg::onSelectionEvent() {
-  SVTK_ViewWindow* aViewWindow = VISU::GetActiveViewWindow<SVTK_ViewWindow>(myModule);
-  if (!aViewWindow)
-    return;
-
-  switch (aViewWindow->SelectionMode()) {
-  case NodeSelection:
-  case CellSelection:
-  case ActorSelection:
-    break;
-  default:
-    close();
-    delete this;
-    return;
+QString VisuGUI_Selection::medSource( const int ind ) const
+{
+  _PTR(Study) aStudyDS = GetStudy()->studyDS();
+  if(_PTR(SObject) aSObject = aStudyDS->FindObjectID((const char*)entry(ind).toLatin1())){
+    VISU::Result_var aRes;
+    if(VISU::Result_i* aResult = CheckResult(myModule,aSObject,aRes)){
+      using namespace VISU;
+      Result_i::ECreationId aCreationId = aResult->GetCreationId();
+      switch(aCreationId){
+      case Result_i::eImportFile :
+       return "eImportFile";
+      case Result_i::eCopyAndImportFile :
+       return "eCopyAndImportFile";
+      case Result_i::eImportMed :
+       return "eImportMed";
+      case Result_i::eImportMedField :
+       return "eImportMedField";
+      default:
+       return QString();
+      }      
+    }
   }
+  return QString();
+}
 
-  if (myFl)
-    return;
-  myFl = true;
+QString VisuGUI_Selection::nbTimeStamps( const int ind ) const
+{
+  QString aResStr;
+  SalomeApp_Study* aStudy = GetStudy();
+  if ( !aStudy )
+    return aResStr;
+
+  VISU::TObjectInfo anObjectInfo = VISU::GetObjectByEntry(aStudy, (const char*)entry( ind ).toLatin1());
+  VISU::Storable::TRestoringMap aMap = VISU::Storable::GetStorableMap(anObjectInfo.mySObject);
+
+  bool isExist;
+  const QString& aVal = VISU::Storable::FindValue(aMap,"myNbTimeStamps",&isExist);
+  if ( isExist )
+    aResStr = aVal;
+  return aResStr;
+}
 
-  int aType = myWidgetStack->indexOf(myWidgetStack->currentWidget());
 
-  SVTK_Selector* aSelector = aViewWindow->GetSelector();
+//----------------------------------------------------------------------------
+template<class TPopupFunctor>
+struct TPopupDispatcher
+{
+  QString
+  operator()(const SalomeApp_Module* theModule, 
+            const QString& theEntry)
+  {
+    if(SUIT_ViewManager* aViewManager = theModule->getApp()->activeViewManager()){
+      QString aType = aViewManager->getType();
+      TPopupFunctor aFunctor;
+      if(aType == SVTK_Viewer::Type())
+       return aFunctor.template Get<SVTK_Viewer>(theModule, theEntry);
+      //else if(aType == VVTK_Viewer::Type())
+      //return aFunctor.template Get<VVTK_Viewer>(theModule, theEntry);
+    }
+    return QString();
+  }    
+};
+
+
+//----------------------------------------------------------------------------
+template<class TViewer>
+bool
+GetPrs3dSelectionInfo(const SalomeApp_Module* theModule,
+                     const QString& theEntry,
+                     VISU::Prs3d_i*& thePrs3d,
+                     SVTK_ViewWindow*& theViewWindow,
+                     VISU_Actor*& thenActor)
+{
+  VISU::TObjectInfo anObjectInfo = VISU::GetObjectByEntry(GetAppStudy(theModule), (const char*)theEntry.toLatin1());
+  thePrs3d = GetPrs3dFromBase(anObjectInfo.myBase);
+  if(!thePrs3d)
+    return false;
+  
+  typedef typename TViewer::TViewWindow TViewWindow;
+  theViewWindow = GetActiveViewWindow<TViewWindow>(theModule);
+  if(!theViewWindow)
+    return false;
+  
+  thenActor = FindActor(theViewWindow, thePrs3d);
+  if(!thenActor)
+    return false;
+  
+  return true;
+}
 
-  _PTR(SObject) aSObject;
-  VISU::Prs3d_i* aPrs3d = NULL;
-  Handle(SALOME_InteractiveObject) anIO;
 
-  VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(myModule);
-  if(aSelectionInfo.size() == 1){
-    // Get selected SObject
-    VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
-    VISU::TObjectInfo anObjectInfo = aSelectionItem.myObjectInfo;
-    aPrs3d = GetPrs3dFromBase(anObjectInfo.myBase);
-    if(aPrs3d){
-      anIO = aSelectionItem.myIO;
-      aSObject = anObjectInfo.mySObject;
-    }
+//----------------------------------------------------------------------------
+struct TViewFunctor
+{
+  template<class TViewer>
+  QString
+  Get(const SalomeApp_Module* theModule, 
+      const QString& theEntry)
+  {
+    VISU_Actor* anActor = NULL;
+    VISU::Prs3d_i* aPrs3d = NULL;
+    SVTK_ViewWindow* aViewWindow = NULL;
+    if(!GetPrs3dSelectionInfo<TViewer>(theModule, theEntry, aPrs3d, aViewWindow, anActor))
+      return QString();
+    
+    return get(aPrs3d, aViewWindow, anActor);
   }
   
+  QString
+  virtual
+  get(VISU::Prs3d_i* thePrs3d,
+      SVTK_ViewWindow* theViewWindow,
+      VISU_Actor* theActor)
+  {
+    return QString();
+  }
+};
 
-  if (aPrs3d) {
-    QString aMeshName("NULL"), aFieldName("NULL");
-    if (aSObject) {
-      VISU::Storable::TRestoringMap aMap = VISU::Storable::GetStorableMap(aSObject);
-      if (!aMap.empty()) {
-       aMeshName  = VISU::Storable::FindValue(aMap, "myMeshName");
-       aFieldName = VISU::Storable::FindValue(aMap, "myFieldName");
-      }
-    }
 
-    myMeshName ->setText((aMeshName  == "NULL") ? QString("No name") : aMeshName);
-    myFieldName->setText((aFieldName == "NULL") ? QString("No name") : aFieldName);
-
-    VISU_Actor* anVISUActor =
-      VISU::FindActor(VISU::GetAppStudy(myModule), aViewWindow, aSObject->GetID().c_str());
-    if (anVISUActor) {
-      vtkFloatingPointType aCoord[6];
-      anVISUActor->GetBounds(aCoord);
-      myXPosLbl->setText(QString::number( aCoord[0] ));
-      myYPosLbl->setText(QString::number( aCoord[2] ));
-      myZPosLbl->setText(QString::number( aCoord[4] ));
-
-      myDXLbl->setText(QString::number( ABS(aCoord[1]-aCoord[0]) ));
-      myDYLbl->setText(QString::number( ABS(aCoord[3]-aCoord[2]) ));
-      myDZLbl->setText(QString::number( ABS(aCoord[5]-aCoord[4]) ));
-
-      TColStd_IndexedMapOfInteger aMapIndex;
-      typedef std::vector<vtkFloatingPointType> TCoordArray;
-      typedef map<int, TCoordArray> TPointCoordsMap;
-      TPointCoordsMap aPointCoordsMap;
-
-      aSelector->GetIndex(anIO, aMapIndex);
-
-      vtkDataSet* aDataSet = anVISUActor->GetMapper()->GetInput();
-      vtkPointData* aPntData = aDataSet->GetPointData();
-
-      for (int ind = 1; ind <= aMapIndex.Extent(); ind++) {
-        int anID = aMapIndex(ind);
-
-        switch (aType) {
-        case 0:
-          {
-           int aVTKID = anVISUActor->GetNodeVTKID(anID);
-           if(aVTKID >= 0){
-           if ( aVTKID >= 0 ) {
-             vtkFloatingPointType* aCoord = anVISUActor->GetNodeCoord(anID);
-             myXValLbl->setText( QString::number( aCoord[0] ) );
-             myYValLbl->setText( QString::number( aCoord[1] ) );
-             myZValLbl->setText( QString::number( aCoord[2] ) );
-             myIDValLbl->setText( QString::number( anID ) );
-             
-              if ( !VISU::IsElnoData( aDataSet ) ) {
-               myScalarValLbl->setText( getValue( aPntData, aVTKID ) );
-               myVectorValLbl->setText( getVector( aPntData, aVTKID ) );
-             } else {
-               myScalarValLbl->setText( "< ELNO data >" );
-               myVectorValLbl->setText( "< ELNO data >" );
-             }
-
-             const VISU::PIDMapper& aMapper = aPrs3d->GetPipeLine()->GetIDMapper();
-             VISU::TStructuredId aStructuredId = aMapper->GetIndexesOfNode( anID );
-             myKValLbl->setText( GetNumber( aStructuredId, 2 ) );
-             myJValLbl->setText( GetNumber( aStructuredId, 1 ) );
-             myIValLbl->setText( GetNumber( aStructuredId, 0 ) );
-            }
-          }
-          break;
-         }
-        case 1:
-          {
-            vtkCellData* aCellData = aDataSet->GetCellData();
-            vtkCell* aCell = anVISUActor->GetElemCell(anID);
-           int aVTKID = anVISUActor->GetElemVTKID(anID);
-            if (aCell != NULL) {
-              int aNbOfPoints = aCell->GetNumberOfPoints();
-              if ( aNbOfPoints > 0 ) {
-                myCellIDValLbl->setText( QString::number(anID) );
-                myCellScalarValLbl->setText(getValue(aCellData, aVTKID));
-                myCellVectorValLbl->setText(getVector(aCellData, aVTKID));
-
-                vtkIdList *aPointList = aCell->GetPointIds();
-                for (int i = 0; i < aNbOfPoints; i++) {
-                  int aNodeVTKId = aPointList->GetId(i);
-                  vtkFloatingPointType* aCoord = aDataSet->GetPoint(aNodeVTKId);
-                 vtkIdType aNodeObjId = anVISUActor->GetNodeObjId(aNodeVTKId);
-                 TCoordArray aCoordArray(aCoord, aCoord + 3);
-                  aPointCoordsMap[aNodeObjId] = aCoordArray;
-                }
-              }
-            }
-          }
-          break;
-        }
-      }
+//----------------------------------------------------------------------------
+struct TGetRepesentationFunctor: TViewFunctor
+{
+  QString
+  virtual
+  get(VISU::Prs3d_i* thePrs3d,
+      SVTK_ViewWindow* theViewWindow,
+      VISU_Actor* theActor)
+  {
+    QString aResStr;
+    switch (theActor->GetRepresentation()) {
+      ENUM2STRING( aResStr, VISU::POINT );
+      ENUM2STRING( aResStr, VISU::WIREFRAME );
+      ENUM2STRING( aResStr, VISU::SHADED );
+      ENUM2STRING( aResStr, VISU::INSIDEFRAME );
+      ENUM2STRING( aResStr, VISU::SURFACEFRAME );
+      ENUM2STRING( aResStr, VISU::FEATURE_EDGES );
+    }      
+    return aResStr;
+  }
+};
 
-      myListPoints->setRowCount(aPointCoordsMap.size());
-      TPointCoordsMap::const_iterator anIter = aPointCoordsMap.begin();
-
-      const VISU::PIDMapper& aMapper = aPrs3d->GetPipeLine()->GetIDMapper();
-      for (int i = 0; anIter != aPointCoordsMap.end() && i < myListPoints->rowCount(); anIter++, i++) {
-       myListPoints->model()->setHeaderData( i, Qt::Vertical, QVariant(QString::number( i )), Qt::DisplayRole );
-        vtkIdType aNodeObjId = anIter->first;
-       //ENK: 23.11.2006 - PAL13176 - EDF228 VISU : Enhancement of structured datas processing
-       VISU::TStructuredId aStructuredId = aMapper->GetIndexesOfNode(aNodeObjId);
-       QString aI = GetNumber(aStructuredId, 0);
-       QString aJ = GetNumber(aStructuredId, 1);
-       QString aK = GetNumber(aStructuredId, 2);
-       //ENK: 23.11.2006
-
-       QAbstractItemModel* aModel = myListPoints->model();
-       aModel->setData( aModel->index(i,0), QVariant(QString::number( aNodeObjId )), Qt::DisplayRole );
-        const TCoordArray& aCoordArray = anIter->second;
-       aModel->setData( aModel->index(i,1), QVariant(QString::number( aCoordArray[0] )), Qt::DisplayRole );
-       aModel->setData( aModel->index(i,2), QVariant(QString::number( aCoordArray[1] )), Qt::DisplayRole );
-       aModel->setData( aModel->index(i,3), QVariant(QString::number( aCoordArray[2] )), Qt::DisplayRole );
-       aModel->setData( aModel->index(i,4), QVariant( aI ), Qt::DisplayRole );//ENK: 23.11.2006 - PAL13176
-       aModel->setData( aModel->index(i,5), QVariant( aJ ), Qt::DisplayRole );//ENK: 23.11.2006 - PAL13176
-       aModel->setData( aModel->index(i,6), QVariant( aK ), Qt::DisplayRole );//ENK: 23.11.2006 - PAL13176
-
-       vtkIdType aNodeVTKId = anVISUActor->GetNodeVTKID(aNodeObjId);
-       aModel->setData( aModel->index(i,7), QVariant(getValue(aPntData, aNodeVTKId)), Qt::DisplayRole );
-       aModel->setData( aModel->index(i,8), QVariant(getVector(aPntData, aNodeVTKId)), Qt::DisplayRole );
+QString VisuGUI_Selection::representation( const int ind ) const
+{
+  return TPopupDispatcher<TGetRepesentationFunctor>()(myModule, entry(ind));
+}
+
+//----------------------------------------------------------------------------
+SalomeApp_Study* VisuGUI_Selection::GetStudy() const
+  
+{
+  LightApp_Study* aLightStudy = const_cast<LightApp_Study*>( study() );
+  return dynamic_cast<SalomeApp_Study*>( aLightStudy );
+}
+
+//----------------------------------------------------------------------------
+int VisuGUI_Selection::nbChild( const int ind, const bool named ) const
+{
+  int cnt = 0;
+  SalomeApp_Study* aSStudy = GetStudy();
+  if ( !aSStudy )
+    return cnt;
+  _PTR(Study) aStudy =  GetCStudy( aSStudy );
+  if ( aStudy ){
+    _PTR(SObject) SO = aStudy->FindObjectID( (const char*)entry( ind ).toLatin1() );
+    if ( SO ){
+      for ( _PTR(ChildIterator) Iter = aStudy->NewChildIterator( SO ); Iter->More(); Iter->Next() ) {
+       _PTR(SObject) refSO;
+       if ( !Iter->Value()->ReferencedObject( refSO ) && ( !named || Iter->Value()->GetName().size() ) )
+         cnt++;
       }
-      //for(int aColumnId = 0; aColumnId < 9; aColumnId++)
-      myListPoints->resizeColumnsToContents();
     }
-  } else {
-    clearFields();
   }
-  myFl = false;
+  return cnt;
 }
-#undef ABS
-
-
-void VisuGUI_SelectionDlg::clearFields() {
-  int aType = myWidgetStack->indexOf(myWidgetStack->currentWidget());
-  switch (aType) {
-  case 0:
-    myXValLbl->setText( "" );
-    myYValLbl->setText( "" );
-    myZValLbl->setText( "" );
-    myIValLbl->setText( "-" );//ENK: 23.11.2006 - PAL13176
-    myJValLbl->setText( "-" );//ENK: 23.11.2006 - PAL13176
-    myKValLbl->setText( "-" );//ENK: 23.11.2006 - PAL13176
-    myScalarValLbl->setText("");
-    myVectorValLbl->setText("");
-    break;
-  case 1:
-    myCellScalarValLbl->setText("");
-    myCellVectorValLbl->setText("");
-    myListPoints->setRowCount(0);
-    break;
-  case 2:
-    myXPosLbl->setText("");
-    myYPosLbl->setText("");
-    myZPosLbl->setText("");
-    myDXLbl->setText("");
-    myDYLbl->setText("");
-    myDZLbl->setText("");
-  }
+
+//----------------------------------------------------------------------------
+QString VisuGUI_Selection::nbChildren( const int ind ) const
+{
+  QString aResStr;
+  aResStr.setNum( nbChild( ind, false ) );
+  return aResStr;
+}
+
+//----------------------------------------------------------------------------
+QString VisuGUI_Selection::nbNamedChildren( const int ind ) const
+{
+  QString aResStr;
+  aResStr.setNum( nbChild( ind, true ) );
+  return aResStr;
 }
 
-typedef  vtkIdType (VISU_PipeLine::* TGetVTKIdMethod)(vtkIdType theID);
 
-bool onIdEdit (const QString& theText,
-               TGetVTKIdMethod theMethod,
-               bool theIsCell,
-              const SalomeApp_Module* theModule,
-               QLabel* theMeshName,
-               QString theValue,
-               QLabel* theFieldName)
+//----------------------------------------------------------------------------
+struct TIsVisibleFunctor: TViewFunctor
 {
-  SVTK_ViewWindow* aViewWindow = VISU::GetActiveViewWindow<SVTK_ViewWindow>(theModule);
-  if (!aViewWindow) 
-    return false;
-  SVTK_Selector* aSelector = aViewWindow->GetSelector();
-
-  _PTR(SObject) aSObject;
-  VISU::Prs3d_i* aPrs3d = NULL;
-  Handle(SALOME_InteractiveObject) anIO;
-
-  VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(theModule);
-  if(aSelectionInfo.size() == 1){
-    // Get selected SObject
-    VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
-    VISU::TObjectInfo anObjectInfo = aSelectionItem.myObjectInfo;
-    aPrs3d = GetPrs3dFromBase(anObjectInfo.myBase);
-    if(aPrs3d){
-      anIO = aSelectionItem.myIO;
-      aSObject = anObjectInfo.mySObject;
-    }
+  QString
+  virtual
+  get(VISU::Prs3d_i* thePrs3d,
+      SVTK_ViewWindow* theViewWindow,
+      VISU_Actor* theActor)
+  {
+    return theActor->GetVisibility() ? "true" : "false";
   }
-  if (aPrs3d) {
-    int anObjId = theText.toInt();
-    VISU_PipeLine* aPipeLine = aPrs3d->GetPipeLine();
-    int aVTKId = (aPipeLine->*theMethod)(anObjId);
-    if(aVTKId < 0)
-      return false;
-
-    TColStd_MapOfInteger newIndices;
-    newIndices.Add(anObjId);
-    aSelector->AddOrRemoveIndex(anIO, newIndices, false);
-    aViewWindow->highlight(anIO, true, true);
-
-    return true;
-
-  } else {
-    theMeshName->setText(theValue);
-    theFieldName->setText("");
+};
+
+QString VisuGUI_Selection::isVisible( const int ind ) const
+{
+  return TPopupDispatcher<TIsVisibleFunctor>()(myModule, entry(ind));
+}
+
+
+//----------------------------------------------------------------------------
+struct TIsShrunkFunctor: TViewFunctor
+{
+  QString
+  virtual
+  get(VISU::Prs3d_i* thePrs3d,
+      SVTK_ViewWindow* theViewWindow,
+      VISU_Actor* theActor)
+  {
+    return theActor->IsShrunk() ? "1" : "0";
   }
-  return false;
+};
+
+QString VisuGUI_Selection::isShrunk( const int ind ) const
+{
+  return TPopupDispatcher<TIsShrunkFunctor>()(myModule, entry(ind));
 }
 
-void VisuGUI_SelectionDlg::onPointIdEdit (const QString& theText)
+
+//----------------------------------------------------------------------------
+QString VisuGUI_Selection::hasActor( const int ind ) const
 {
-  if (myFl) return;
-  TGetVTKIdMethod aMethod = &VISU_PipeLine::GetNodeVTKID;
-  bool anIsSelected = onIdEdit(theText,
-                              aMethod,
-                              false,
-                              myModule,
-                              myMeshName,
-                              tr("WRN_NO_AVAILABLE_DATA"),
-                              myFieldName);
-  if (anIsSelected)
-    // as selection manager doesn't send signal currentSelectionChanged()
-    onSelectionEvent();
-  else
-    clearFields();
+  return representation( ind ).isEmpty() ? "0" : "1";
 }
 
-void VisuGUI_SelectionDlg::onCellIdEdit (const QString& theText)
+
+//----------------------------------------------------------------------------
+struct TIsShadingFunctor: TViewFunctor
 {
-  if (myFl) return;
-  TGetVTKIdMethod aMethod = &VISU_PipeLine::GetElemVTKID;
-  bool anIsSelected = onIdEdit(theText,
-                              aMethod,
-                              true,
-                              myModule,
-                              myMeshName,
-                              tr("WRN_NO_AVAILABLE_DATA"),
-                              myFieldName);
-  if (anIsSelected)
-    // as selection manager doesn't send signal currentSelectionChanged()
-    onSelectionEvent();
-  else
-    clearFields();
+  QString
+  virtual
+  get(VISU::Prs3d_i* thePrs3d,
+      SVTK_ViewWindow* theViewWindow,
+      VISU_Actor* theActor)
+  {
+    if(VISU_ScalarMapAct* anActor = dynamic_cast<VISU_ScalarMapAct*>(theActor))
+      return anActor->IsShading() ? "1" : "0";
+    return QString();
+  }
+};
+
+QString VisuGUI_Selection::isShading( const int ind ) const
+{
+  return TPopupDispatcher<TIsShadingFunctor>()(myModule, entry(ind));
 }
 
-void VisuGUI_SelectionDlg::onHelp()
+
+//----------------------------------------------------------------------------
+struct TIsScalarMapActFunctor: TViewFunctor
 {
-  QString aHelpFileName = "selection_info_page.html";
-  LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication());
-  if (app)
-    app->onHelpContextModule(myModule ? app->moduleName(myModule->moduleName()) : QString(""), aHelpFileName);
-  else {
-    QString platform;
-#ifdef WIN32
-    platform = "winapplication";
-#else
-    platform = "application";
-#endif
-    SUIT_MessageBox::warning(0, QObject::tr("WRN_WARNING"),
-                             QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
-                             arg(app->resourceMgr()->stringValue("ExternalBrowser", platform)).arg(aHelpFileName) );
+  QString
+  virtual
+  get(VISU::Prs3d_i* thePrs3d,
+      SVTK_ViewWindow* theViewWindow,
+      VISU_Actor* theActor)
+  {
+    return dynamic_cast<VISU_ScalarMapAct*>(theActor)? "1" : "0";
   }
+};
+
+
+//---------------------------------------------------------------
+QString VisuGUI_Selection::isScalarMapAct( const int ind ) const
+{
+  return TPopupDispatcher<TIsScalarMapActFunctor>()(myModule, entry(ind));
 }
 
-void VisuGUI_SelectionDlg::keyPressEvent( QKeyEvent* e )
+
+//----------------------------------------------------------------------------
+bool VisuGUI_Selection::isVisuComponent( const int ind ) const
 {
-  QDialog::keyPressEvent( e );
-  if ( e->isAccepted() )
-    return;
-
-  if ( e->key() == Qt::Key_F1 )
-    {
-      e->accept();
-      onHelp();
-    }
+  SalomeApp_Study* study = GetStudy();
+  if ( !study )
+    return false;
+  
+  _PTR(SObject) obj = study->studyDS()->FindObjectID( (const char*)entry( ind ).toLatin1() );
+  if ( !obj )
+    return false;
+  CORBA::Object_var anObj = VISU::ClientSObjectToObject( obj );
+  if( CORBA::is_nil( anObj ) )
+    return false;
+
+  return dynamic_cast<VISU::VISU_Gen_i*>( VISU::GetServant( anObj ).in() );
 }
index 0e6d2de1ee8be013a8d0be274b818b01b6e583be..184547e36c4ced2299bb515552b8147f3f487836 100644 (file)
@@ -1,6 +1,6 @@
 //  VISU VISUGUI : GUI of VISU component
 //
-//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  Copyright (C) 2005  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
 // 
 //  This library is free software; you can redistribute it and/or 
 //
 //
 //  File   : VisuGUI_Selection.h
-//  Author : Laurent CORNABE & Hubert ROLLAND 
+//  Author : Sergey Anikin 
 //  Module : VISU
-//  $Header$
 
 #ifndef VisuGUI_Selection_HeaderFile
 #define VisuGUI_Selection_HeaderFile
 
-#include <QDialog>
+#include <LightApp_Selection.h>
 
-class QLabel;
-class QStackedWidget;
-//class QVBox;
-class QLineEdit;
-class QTableWidget;
-class LightApp_SelectionMgr;
-class SalomeApp_Application;
-class SalomeApp_Module;
+//////////////////////////////////////////////////
+// Class: VisuGUI_Selection
+//////////////////////////////////////////////////
 
-class VisuGUI_SelectionDlg: public QDialog {
-  Q_OBJECT
+class SalomeApp_Module;
+class SalomeApp_Study;
 
+class VisuGUI_Selection : public LightApp_Selection
+{
 public:
-  VisuGUI_SelectionDlg (const SalomeApp_Module* theModule);
-  virtual ~VisuGUI_SelectionDlg ();
-
-private:
-  void keyPressEvent( QKeyEvent* e );
-
-protected:
-  void closeEvent (QCloseEvent* theEvent);
-
-private slots:
-  void onSelectionChange (int theId);
-  void onSelectionEvent ();
-  void onPointIdEdit (const QString& theText);
-  void onCellIdEdit (const QString& theText);
-  void onHelp();
+  VisuGUI_Selection( SalomeApp_Module* theModule )
+    : LightApp_Selection(), myModule( theModule ) {};
+  virtual ~VisuGUI_Selection() {};
 
- private:
-  void clearFields ();
+  virtual QVariant parameter( const int, const QString& ) const;
 
-  QLabel* myMeshName;
-  QLabel* myFieldName;
-
-  QStackedWidget* myWidgetStack;
-  QWidget* myPointsPane;
-  QWidget* myCellsPane;
-  QLabel* myXValLbl;
-  QLabel* myYValLbl;
-  QLabel* myZValLbl;
-  //ENK: 23.11.2006 - PAL13176 - EDF228 VISU : Enhancement of structured datas processing
-  QLabel* myIValLbl; //!< used for structured mesh selection
-  QLabel* myJValLbl; //!< used for structured mesh selection
-  QLabel* myKValLbl; //!< used for structured mesh selection
-  //ENK: 23.11.2006
-
-  QLineEdit* myIDValLbl;
-  QLabel* myScalarValLbl;
-  QLabel* myVectorValLbl;
+private:
+  QString          type( const int ) const;
+  QString          nbComponents( const int ) const;
+  QString          medEntity( const int ) const;
+  QString          medSource( const int ) const;
+  QString          nbTimeStamps( const int ) const;
+  QString          representation( const int ) const;
+  QString          nbChildren( const int ) const;
+  QString          nbNamedChildren( const int ) const;
+  QString          isVisible( const int ) const;
+  QString          isShrunk( const int ) const;
+  QString          hasActor( const int ) const;
+  QString          isShading( const int ) const;
+  QString          isScalarMapAct( const int ) const;
+  bool             isVisuComponent( const int ) const;
+
+  QString          fullResolution( const int ) const;
+  QString          mediumResolution( const int ) const;
+  QString          lowResolution( const int ) const;
+  QString          resolutionState( const int ) const;
 
-  QTableWidget* myListPoints;
-  QLineEdit* myCellIDValLbl;
-  QLabel* myCellScalarValLbl;
-  QLabel* myCellVectorValLbl;
+private:
+  int              nbChild( const int, const bool ) const;
+  SalomeApp_Study* GetStudy() const;
 
-  QWidget* myActorsPane;
-  QLabel* myXPosLbl;
-  QLabel* myYPosLbl;
-  QLabel* myZPosLbl;
-  QLabel* myDXLbl;
-  QLabel* myDYLbl;
-  QLabel* myDZLbl;
+  QString          resolutions( const int ) const;
+  QString          resolution( const int, char theResoltuion ) const;
 
-  const SalomeApp_Module* myModule;
-  LightApp_SelectionMgr* mySelectionMgr;
-  bool myFl;
+private:
+  SalomeApp_Module* myModule;
 };
 
 #endif
diff --git a/src/VISUGUI/VisuGUI_SelectionPanel.cxx b/src/VISUGUI/VisuGUI_SelectionPanel.cxx
new file mode 100644 (file)
index 0000000..6257e40
--- /dev/null
@@ -0,0 +1,794 @@
+//  VISU VISUGUI : GUI of VISU component
+//
+//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+//
+//
+//  File   : VisuGUI_SelectionPanel.h
+//  Author : Laurent CORNABE & Hubert ROLLAND
+//  Module : VISU
+//  $Header$
+
+#include "VisuGUI_SelectionPanel.h"
+
+#include "VisuGUI.h"
+#include "VisuGUI_Tools.h"
+#include "VisuGUI_ViewTools.h"
+#include "VisuGUI_SelectionPrefDlg.h"
+#include "VisuGUI_GaussPointsSelectionPane.h"
+#include "VisuGUI_FindPane.h"
+
+#include "VISU_Event.h"
+
+#include "VISU_Actor.h"
+#include "VISU_PrsObject_i.hh"
+#include "VISU_Prs3d_i.hh"
+#include "VISU_PipeLine.hxx"
+#include "VISU_GaussPointsPL.hxx"
+#include "VISU_GaussPtsSettings.h"
+#include "VISU_PickingSettings.h"
+
+#include "SalomeApp_Study.h"
+#include "SalomeApp_Application.h"
+#include "LightApp_Application.h"
+#include "LightApp_SelectionMgr.h"
+#include "LightApp_VTKSelector.h"
+
+#include "SUIT_Desktop.h"
+#include "SUIT_MessageBox.h"
+#include "SUIT_ViewWindow.h"
+#include "SUIT_Session.h"
+#include "SUIT_ResourceMgr.h"
+
+#include "SALOME_ListIO.hxx"
+#include "SALOME_ListIteratorOfListIO.hxx"
+
+#include "SVTK_ViewWindow.h"
+//#include "SVTK_MainWindow.h"
+#include "SVTK_Selector.h"
+#include "SVTK_RenderWindowInteractor.h"
+
+#include "utilities.h"
+
+// OCCT Includes
+#include <TColStd_IndexedMapOfInteger.hxx>
+#include <TColStd_MapOfInteger.hxx>
+
+// QT Includes
+#include <QLabel>
+#include <QSpinBox>
+#include <QListWidget>
+#include <QLayout>
+#include <QButtonGroup>
+#include <QRadioButton>
+#include <QValidator>
+#include <QPushButton>
+#include <QToolButton>
+#include <QGroupBox>
+#include <QLineEdit>
+#include <QValidator>
+#include <QTableWidget>
+#include <QVBoxLayout>
+#include <QHBoxLayout>
+#include <QKeyEvent>
+#include <QHeaderView>
+#include <QTabWidget>
+#include <QScrollArea>
+
+// VTK Includes
+#include <vtkDataSetMapper.h>
+#include <vtkDataSet.h>
+#include <vtkPointData.h>
+#include <vtkCellData.h>
+#include <vtkCell.h>
+
+// STL Includes
+#include <map>
+
+using namespace std;
+
+class CustomIntValidator: public QIntValidator
+{
+public:
+  CustomIntValidator( QObject * theParent ):
+    QIntValidator( 0, VTK_LARGE_ID, theParent )
+  {}
+
+  virtual 
+  State
+  validate( QString& theInput, int& thePos ) const
+  {
+    if( theInput.isEmpty() )
+      return QValidator::Acceptable;
+
+    return QIntValidator::validate( theInput, thePos );
+  }
+};
+
+VisuGUI_SelectionPanel::VisuGUI_SelectionPanel( const VisuGUI* theModule, QWidget* theParent ) :
+  VisuGUI_Panel( tr("WINDOW_TITLE" ), theModule, theParent, CloseBtn | HelpBtn ),
+  myPreferencesDlg( 0 )
+{
+  QVBoxLayout* TopLayout = new QVBoxLayout ( mainFrame() );
+
+  QWidget* aNamePane = new QWidget (mainFrame());
+  QGridLayout* aNameLay = new QGridLayout (aNamePane);
+
+  QLabel* aMeshLbl = new QLabel (tr("MESH_NAME_LBL"), aNamePane);
+  myMeshName = new QLabel (aNamePane);
+  myMeshName->setText(tr("WRN_NO_AVAILABLE_DATA"));
+
+  QLabel* aFieldLbl = new QLabel (tr("FIELD_NAME_LBL"), aNamePane);
+  myFieldName = new QLabel (aNamePane);
+
+  aNameLay->addWidget(aMeshLbl, 0, 0);
+  aNameLay->addWidget(myMeshName, 0, 1);
+  aNameLay->addWidget(aFieldLbl, 1, 0);
+  aNameLay->addWidget(myFieldName, 1, 1);
+
+  TopLayout->addWidget(aNamePane);
+
+  myTabWidget = new QTabWidget( mainFrame() );
+
+  // Labels for header of points' and cells' tables
+  QStringList aLabels;
+  aLabels.append( "ID" );
+  aLabels.append( "X" );
+  aLabels.append( "Y" );
+  aLabels.append( "Z" );
+  aLabels.append( "I" );
+  aLabels.append( "J" );
+  aLabels.append( "K" );
+  aLabels.append( tr("DATA_SCALAR_HDR") );
+  aLabels.append( tr("DATA_VECTOR_HDR") );
+
+  // Create Points pane
+  myPointsPane = new QWidget (mainFrame());
+  QVBoxLayout* aVBoxLayout = new QVBoxLayout(myPointsPane);
+
+  QGroupBox* aDataGrp = new QGroupBox ( tr("POINT_DATA_TITLE"), myPointsPane);
+  QGridLayout* aGridLay = new QGridLayout (aDataGrp);
+
+  aGridLay->addWidget( new QLabel (tr("DATA_ID_LBL"), aDataGrp) , 0, 0 );
+  
+  myIDValLbl = new QLineEdit ("", aDataGrp);
+  aGridLay->addWidget( myIDValLbl, 0, 1 );
+  CustomIntValidator* aIntValidator = new CustomIntValidator (myIDValLbl);
+  aIntValidator->setBottom(0);
+  myIDValLbl->setValidator(aIntValidator);
+  connect(myIDValLbl, SIGNAL(returnPressed()), this, SLOT(onPointIdEdit()));
+
+  QToolButton* anIDBtn = new QToolButton( aDataGrp );
+  anIDBtn->setIcon( VISU::GetResourceMgr()->loadPixmap("VISU", tr( "ICON_OK" ) ) );
+  aGridLay->addWidget( anIDBtn, 0, 2 );
+  connect(anIDBtn, SIGNAL(clicked()), this, SLOT(onPointIdEdit()));
+
+  aVBoxLayout->addWidget( aDataGrp );
+
+  myListPoints = new QTableWidget (myPointsPane);
+  myListPoints->setEditTriggers( QAbstractItemView::NoEditTriggers );
+  myListPoints->setColumnCount(9);
+  myListPoints->setRowCount(0);
+  myListPoints->setColumnWidth(0, 40);
+  myListPoints->setColumnWidth(1, 40);
+  myListPoints->setColumnWidth(2, 40);
+  myListPoints->setColumnWidth(3, 40);
+  myListPoints->setColumnWidth(4, 40);
+  myListPoints->setColumnWidth(5, 40);
+  myListPoints->setColumnWidth(6, 40);
+  myListPoints->setSelectionMode(QAbstractItemView::NoSelection);
+  myListPoints->setHorizontalHeaderLabels( aLabels );
+
+  aVBoxLayout->addWidget(myListPoints, 1, 0);
+
+  // Create Cells pane
+  myCellsPane = new QWidget (mainFrame());
+  QGridLayout* aCellLayout = new QGridLayout (myCellsPane);
+  aCellLayout->setRowStretch(0, 0);
+  aCellLayout->setRowStretch(1, 1);
+
+  QGroupBox* aCellGrp = new QGroupBox( tr("CELL_DATA_TITLE"), myCellsPane);
+  aGridLay = new QGridLayout (aCellGrp);
+
+  aGridLay->addWidget( new QLabel (tr("DATA_ID_LBL"), aCellGrp), 0, 0);
+  myCellIDValLbl = new QLineEdit ("", aCellGrp);
+  myCellIDValLbl->setValidator(aIntValidator);
+  aGridLay->addWidget( myCellIDValLbl, 0, 1);
+  connect(myCellIDValLbl, SIGNAL(returnPressed()), this, SLOT(onCellIdEdit()));
+
+  QToolButton* aCellIDBtn = new QToolButton( aDataGrp );
+  aCellIDBtn->setIcon( VISU::GetResourceMgr()->loadPixmap("VISU", tr( "ICON_OK" ) ) );
+  aGridLay->addWidget( aCellIDBtn, 0, 2 );
+  connect(aCellIDBtn, SIGNAL(clicked()), this, SLOT(onCellIdEdit()));
+
+  aGridLay->addWidget( new QLabel (tr("DATA_SCALAR_LBL"), aCellGrp), 1, 0);
+  myCellScalarValLbl = new QLabel ("", aCellGrp);
+  aGridLay->addWidget( myCellScalarValLbl, 1, 1, 1, 2);
+  aGridLay->addWidget( new QLabel (tr("DATA_VECTOR_LBL"), aCellGrp), 2, 0);
+  myCellVectorValLbl = new QLabel ("", aCellGrp);
+  aGridLay->addWidget(myCellVectorValLbl , 2, 1, 1, 2);
+
+  aCellLayout->addWidget(aCellGrp, 0, 0);
+
+  myCellListPoints = new QTableWidget (myCellsPane);
+  myCellListPoints->setEditTriggers( QAbstractItemView::NoEditTriggers );
+  myCellListPoints->setColumnCount(9);
+  myCellListPoints->setRowCount(0);
+  myCellListPoints->setColumnWidth(0, 40);
+  myCellListPoints->setColumnWidth(1, 40);
+  myCellListPoints->setColumnWidth(2, 40);
+  myCellListPoints->setColumnWidth(3, 40);
+  myCellListPoints->setColumnWidth(4, 40);
+  myCellListPoints->setColumnWidth(5, 40);
+  myCellListPoints->setColumnWidth(6, 40);
+  myCellListPoints->setSelectionMode(QAbstractItemView::NoSelection);
+  myCellListPoints->setHorizontalHeaderLabels( aLabels );
+
+  aCellLayout->addWidget(myCellListPoints, 1, 0);
+
+  // Actor Pane
+  myActorsPane = new QWidget (mainFrame());
+  aVBoxLayout = new QVBoxLayout(myActorsPane);  
+
+  QGroupBox* aPosGrp = new QGroupBox (tr("ACTOR_DATA_POSITION_TITLE"), myActorsPane);
+  aGridLay = new QGridLayout (aPosGrp);
+  aGridLay->addWidget( new QLabel ("X:", aPosGrp), 0, 0);
+  myXPosLbl = new QLabel ("0", aPosGrp);
+  aGridLay->addWidget( myXPosLbl, 0, 1);
+  aGridLay->addWidget( new QLabel ("Y:", aPosGrp), 1, 0);
+  myYPosLbl = new QLabel ("0", aPosGrp);
+  aGridLay->addWidget( myYPosLbl, 1, 1);
+  aGridLay->addWidget( new QLabel ("Z:", aPosGrp), 2, 0);
+  myZPosLbl = new QLabel ("0", aPosGrp);
+  aGridLay->addWidget( myZPosLbl, 2, 1);
+
+  aVBoxLayout->addWidget( aPosGrp );
+
+  QGroupBox* aSizeGrp = new QGroupBox ( tr("ACTOR_DATA_SIZE_TITLE"), myActorsPane);
+  aGridLay = new QGridLayout (aSizeGrp);
+  aGridLay->addWidget( new QLabel ("dX:", aSizeGrp ), 0, 0);
+  myDXLbl = new QLabel ("0", aSizeGrp);
+  aGridLay->addWidget( myDXLbl, 0, 1);
+  aGridLay->addWidget( new QLabel ("dY:", aSizeGrp ), 1, 0);
+  myDYLbl = new QLabel ("0", aSizeGrp);
+  aGridLay->addWidget( myDYLbl, 1, 1);
+  aGridLay->addWidget( new QLabel ("dZ:", aSizeGrp ), 2, 0);
+  myDZLbl = new QLabel ("0", aSizeGrp);
+  aGridLay->addWidget( myDZLbl, 2, 1);
+
+  aVBoxLayout->addWidget( aSizeGrp );
+  aVBoxLayout->addStretch();
+
+  // Gauss Points Pane
+  myGaussPointsPane = new VisuGUI_GaussPointsSelectionPane( myModule, mainFrame() );
+
+  // Add panes to tab widget
+  myTabWidget->addTab(myActorsPane, tr("MODE_ACTOR"));
+  myTabWidget->addTab(myCellsPane,  tr("MODE_CELL"));
+  myTabWidget->addTab(myPointsPane, tr("MODE_POINT"));
+  myTabWidget->addTab(myGaussPointsPane, tr("MODE_GAUSS_POINT"));
+
+  connect( myTabWidget, SIGNAL( currentChanged( int ) ), this, SLOT( onSelectionModeChanged( int ) ) );
+
+  TopLayout->addWidget( myTabWidget );
+
+  // Find Pane
+  myFindPane = new VisuGUI_FindPane( mainFrame() );
+
+  connect( myFindPane, SIGNAL( idChanged( int, int ) ), this, SLOT( onIdChanged( int, int ) ) );
+
+  TopLayout->addWidget( myFindPane );
+
+  // Preferences button
+  QPushButton* aPrefBtn = new QPushButton( tr( "SELECTION_PREFERENCES" ),  mainFrame() );
+  connect( aPrefBtn, SIGNAL( clicked() ), this, SLOT( onPreferences() ) );
+
+  TopLayout->addWidget( aPrefBtn );
+
+  SalomeApp_Application* anApp =
+    dynamic_cast<SalomeApp_Application*>( SUIT_Session::session()->activeApplication() );
+  LightApp_SelectionMgr* aSelectionMgr = anApp->selectionMgr();
+  connect( aSelectionMgr, SIGNAL( currentSelectionChanged() ), this, SLOT( onSelectionEvent() ) );
+
+  connect( this, SIGNAL( selectionModeChanged( int ) ), myModule, SLOT( OnSwitchSelectionMode( int ) ) );
+
+  myFl = false;
+
+  // Activate Points pane
+  myTabWidget->setCurrentWidget(myActorsPane);
+  if (SVTK_ViewWindow* aViewWindow = VISU::GetActiveViewWindow<SVTK_ViewWindow>(myModule))
+    aViewWindow->SetSelectionMode(ActorSelection);
+  onSelectionEvent();
+}
+
+VisuGUI_SelectionPanel::~VisuGUI_SelectionPanel()
+{
+  if( myPreferencesDlg )
+  {
+    delete myPreferencesDlg;
+    myPreferencesDlg = 0;
+  }
+}
+
+VisuGUI_SelectionPrefDlg* VisuGUI_SelectionPanel::preferencesDlg()
+{
+  if( !myPreferencesDlg )
+    myPreferencesDlg = new VisuGUI_SelectionPrefDlg();
+  myPreferencesDlg->update();
+  return myPreferencesDlg;
+}
+
+void VisuGUI_SelectionPanel::setSelectionMode( int theId )
+{
+  //printf( "VisuGUI_SelectionPanel::setSelectionMode( %d )\n", theId );
+  myTabWidget->setCurrentIndex( theId );
+}
+
+void VisuGUI_SelectionPanel::onSelectionModeChanged( int theId )
+{
+  //printf( "VisuGUI_SelectionPanel::onSelectionModeChanged( %d )\n", theId );
+  SVTK_ViewWindow* aViewWindow = VISU::GetActiveViewWindow<SVTK_ViewWindow>(myModule);
+  if (!aViewWindow) return;
+
+  switch (theId) {
+  case 0: // Actor
+    aViewWindow->SetSelectionMode(ActorSelection);
+    onSelectionEvent();
+    break;
+  case 1: // Cells
+    aViewWindow->SetSelectionMode(CellSelection);
+    onCellIdEdit();
+    break;
+  case 2: // Points
+    aViewWindow->SetSelectionMode(NodeSelection);
+    onPointIdEdit();
+    break;
+  case 3: // Gauss Points
+    aViewWindow->SetSelectionMode(GaussPointSelection);
+    myGaussPointsPane->update();
+    onSelectionEvent();
+    break;
+  }
+
+  myFindPane->setSelectionMode( aViewWindow->SelectionMode() );
+
+  emit selectionModeChanged( theId );
+}
+
+void VisuGUI_SelectionPanel::showEvent( QShowEvent* theEvent )
+{
+  VisuGUI_Panel::showEvent(theEvent);
+}
+
+void VisuGUI_SelectionPanel::closeEvent( QCloseEvent* theEvent )
+{
+  onClose();
+  VisuGUI_Panel::closeEvent(theEvent);
+}
+
+template<class TData> QString getValue(TData* theData, int theId){
+  if (vtkDataArray *aScalar = theData->GetScalars()){
+    vtkFloatingPointType aVal = aScalar->GetTuple1(theId);
+    return QString::number(aVal);
+  } else {
+    return QString("No data");
+  }
+}
+
+template<class TData> QString getVector(TData* theData, int theId){
+  if (vtkDataArray *aVector = theData->GetVectors()) {
+    vtkFloatingPointType *aVal = aVector->GetTuple3(theId);
+    return QString("%1; %2; %3").arg(aVal[0]).arg(aVal[1]).arg(aVal[2]);
+  } else {
+    return QString("No data");
+  }
+}
+
+void VisuGUI_SelectionPanel::onSelectionEvent() {
+  SVTK_ViewWindow* aViewWindow = VISU::GetActiveViewWindow<SVTK_ViewWindow>(myModule);
+  if (!aViewWindow)
+    return;
+
+  switch (aViewWindow->SelectionMode()) {
+  case ActorSelection:
+  case CellSelection:
+  case NodeSelection:
+  case GaussPointSelection:
+    break;
+  default:
+    close();
+    return;
+  }
+
+  if (myFl)
+    return;
+  myFl = true;
+
+  int aType = myTabWidget->currentIndex();
+
+  //if(SVTK_MainWindow* aMainWindow = aViewWindow->getMainWindow())
+  //{
+    SVTK_RenderWindowInteractor* anInteractor = aViewWindow->GetInteractor();
+    myGaussPointsPane->setInteractor(anInteractor);
+    //}
+
+  SVTK_Selector* aSelector = aViewWindow->GetSelector();
+
+  _PTR(SObject) aSObject;
+  VISU::Prs3d_i* aPrs3d = NULL;
+  Handle(SALOME_InteractiveObject) anIO;
+
+  VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(myModule);
+  if(aSelectionInfo.size() == 1){
+    // Get selected SObject
+    VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
+    VISU::TObjectInfo anObjectInfo = aSelectionItem.myObjectInfo;
+    aPrs3d = GetPrs3dFromBase(anObjectInfo.myBase);
+    if(aPrs3d){
+      anIO = aSelectionItem.myIO;
+      aSObject = anObjectInfo.mySObject;
+    }
+  }
+  
+  clearFields();
+
+  if (aPrs3d) {
+    QString aMeshName("NULL"), aFieldName("NULL");
+    if (aSObject) {
+      VISU::Storable::TRestoringMap aMap = VISU::Storable::GetStorableMap(aSObject);
+      if (!aMap.empty()) {
+       aMeshName  = VISU::Storable::FindValue(aMap, "myMeshName");
+       aFieldName = VISU::Storable::FindValue(aMap, "myFieldName");
+      }
+    }
+
+    myMeshName ->setText((aMeshName  == "NULL") ? QString("No name") : aMeshName);
+    myFieldName->setText((aFieldName == "NULL") ? QString("No name") : aFieldName);
+
+    VISU_Actor* anVISUActor =
+      VISU::FindActor(VISU::GetAppStudy(myModule), aViewWindow, aSObject->GetID().c_str());
+    myFindPane->setActor( anVISUActor );
+    if (anVISUActor) {
+      vtkFloatingPointType aCoord[6];
+      anVISUActor->GetBounds(aCoord);
+      myXPosLbl->setText(QString::number( aCoord[0] ));
+      myYPosLbl->setText(QString::number( aCoord[2] ));
+      myZPosLbl->setText(QString::number( aCoord[4] ));
+
+      myDXLbl->setText(QString::number( fabs(aCoord[1]-aCoord[0]) ));
+      myDYLbl->setText(QString::number( fabs(aCoord[3]-aCoord[2]) ));
+      myDZLbl->setText(QString::number( fabs(aCoord[5]-aCoord[4]) ));
+
+      TColStd_IndexedMapOfInteger aMapIndex;
+      typedef std::vector<vtkFloatingPointType> TCoordArray;
+      typedef map<int, TCoordArray> TPointCoordsMap;
+      TPointCoordsMap aPointCoordsMap;
+
+      aSelector->GetIndex(anIO, aMapIndex);
+
+      vtkDataSet* aDataSet = anVISUActor->GetMapper()->GetInput();
+      vtkPointData* aPntData = aDataSet->GetPointData();
+
+      QTableWidget* aTable = 0;
+      if( aType == 1 )
+       aTable = myCellListPoints;
+      else if( aType == 2 )
+       aTable = myListPoints;
+
+      if( !aTable )
+      {
+       myFl = false;
+       return;
+      }
+
+      bool aSingleSelection = aMapIndex.Extent() == 1;
+
+      for (int ind = 1; ind <= aMapIndex.Extent(); ind++) {
+        int anID = aMapIndex(ind);
+
+        switch (aType) {
+        case 2:
+          {
+           int aVTKID = anVISUActor->GetNodeVTKID(anID);
+           if(aVTKID >= 0){
+             vtkFloatingPointType* aCoord = anVISUActor->GetNodeCoord(anID);
+
+             if( aSingleSelection )
+               myIDValLbl->setText( QString::number(anID) );
+
+             vtkIdType aNodeObjId = anVISUActor->GetNodeObjId(aVTKID);
+             TCoordArray aCoordArray(aCoord, aCoord + 3);
+             aPointCoordsMap[aNodeObjId] = aCoordArray;
+           }
+          }
+          break;
+        case 1:
+          {
+            vtkCellData* aCellData = aDataSet->GetCellData();
+            vtkCell* aCell = anVISUActor->GetElemCell(anID);
+           int aVTKID = anVISUActor->GetElemVTKID(anID);
+            if (aCell != NULL) {
+              int aNbOfPoints = aCell->GetNumberOfPoints();
+              if ( aNbOfPoints > 0 ) {
+               if( aSingleSelection )
+               {
+                 myCellIDValLbl->setText( QString::number(anID) );
+                 myCellScalarValLbl->setText(getValue(aCellData, aVTKID));
+                 myCellVectorValLbl->setText(getVector(aCellData, aVTKID));
+               }
+
+                vtkIdList *aPointList = aCell->GetPointIds();
+                for (int i = 0; i < aNbOfPoints; i++) {
+                  int aNodeVTKId = aPointList->GetId(i);
+                  vtkFloatingPointType* aCoord = aDataSet->GetPoint(aNodeVTKId);
+                 vtkIdType aNodeObjId = anVISUActor->GetNodeObjId(aNodeVTKId);
+                 TCoordArray aCoordArray(aCoord, aCoord + 3);
+                  aPointCoordsMap[aNodeObjId] = aCoordArray;
+                }
+              }
+            }
+          }
+          break;
+        }
+      }
+
+      aTable->setRowCount(aPointCoordsMap.size());
+      TPointCoordsMap::const_iterator anIter = aPointCoordsMap.begin();
+
+      const VISU::PIDMapper& aMapper = aPrs3d->GetPipeLine()->GetIDMapper();
+      for (int i = 0; anIter != aPointCoordsMap.end() && i < aTable->rowCount(); anIter++, i++) {
+       aTable->model()->setHeaderData( i, Qt::Vertical, QVariant(QString::number( i )), Qt::DisplayRole );
+        vtkIdType aNodeObjId = anIter->first;
+       
+       VISU::TIdTypeVector aVec = aMapper->GetIndexesOfNode(aNodeObjId);
+       QString aI,aJ,aK;
+       aI = "-";
+       aJ = "-";
+       aK = "-";
+       switch(aVec.size()){
+       case 3:
+         aK = QString::number(aVec[2]);
+       case 2:
+         aJ = QString::number(aVec[1]);
+       case 1:
+         aI = QString::number(aVec[0]);
+         break;
+       }
+       
+       QAbstractItemModel* aModel = aTable->model();
+       aModel->setData( aModel->index(i,0), QVariant(QString::number( aNodeObjId )), Qt::DisplayRole );
+        const TCoordArray& aCoordArray = anIter->second;
+       aModel->setData( aModel->index(i,1), QVariant(QString::number( aCoordArray[0] )), Qt::DisplayRole );
+       aModel->setData( aModel->index(i,2), QVariant(QString::number( aCoordArray[1] )), Qt::DisplayRole );
+       aModel->setData( aModel->index(i,3), QVariant(QString::number( aCoordArray[2] )), Qt::DisplayRole );
+       aModel->setData( aModel->index(i,4), QVariant( aI ), Qt::DisplayRole );
+       aModel->setData( aModel->index(i,5), QVariant( aJ ), Qt::DisplayRole );
+       aModel->setData( aModel->index(i,6), QVariant( aK ), Qt::DisplayRole );
+
+       vtkIdType aNodeVTKId = anVISUActor->GetNodeVTKID(aNodeObjId);
+       aModel->setData( aModel->index(i,7), QVariant(getValue(aPntData, aNodeVTKId)), Qt::DisplayRole );
+       aModel->setData( aModel->index(i,8), QVariant(getVector(aPntData, aNodeVTKId)), Qt::DisplayRole );
+      }
+      //for(int aColumnId = 0; aColumnId < 9; aColumnId++)
+      aTable->resizeColumnsToContents();
+    }
+  }
+  myFl = false;
+}
+
+void VisuGUI_SelectionPanel::clearFields() {
+  int aType = myTabWidget->currentIndex();
+  switch (aType) {
+  case 2:
+    myIDValLbl->setText( "" );
+    myListPoints->setRowCount(0);
+    break;
+  case 1:
+    myCellIDValLbl->setText( "" );
+    myCellScalarValLbl->setText("");
+    myCellVectorValLbl->setText("");
+    myCellListPoints->setRowCount(0);
+    break;
+  case 0:
+    myXPosLbl->setText("");
+    myYPosLbl->setText("");
+    myZPosLbl->setText("");
+    myDXLbl->setText("");
+    myDYLbl->setText("");
+    myDZLbl->setText("");
+  }
+}
+
+typedef  vtkIdType (VISU_PipeLine::* TGetVTKIdMethod)(vtkIdType theID);
+
+bool onIdEdit (const QString& theText,
+               TGetVTKIdMethod theMethod,
+               bool theIsCell,
+              const SalomeApp_Module* theModule,
+               QLabel* theMeshName,
+               QString theValue,
+               QLabel* theFieldName)
+{
+  SVTK_ViewWindow* aViewWindow = VISU::GetActiveViewWindow<SVTK_ViewWindow>(theModule);
+  if (!aViewWindow) 
+    return false;
+  SVTK_Selector* aSelector = aViewWindow->GetSelector();
+
+  _PTR(SObject) aSObject;
+  VISU::Prs3d_i* aPrs3d = NULL;
+  Handle(SALOME_InteractiveObject) anIO;
+
+  VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(theModule);
+  if(aSelectionInfo.size() == 1){
+    // Get selected SObject
+    VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
+    VISU::TObjectInfo anObjectInfo = aSelectionItem.myObjectInfo;
+    aPrs3d = GetPrs3dFromBase(anObjectInfo.myBase);
+    if(aPrs3d){
+      anIO = aSelectionItem.myIO;
+      aSObject = anObjectInfo.mySObject;
+    }
+  }
+  if (aPrs3d) {
+    bool ok = false;
+    int anObjId = theText.toInt( &ok );
+    if( !ok )
+      anObjId = -1;
+
+    VISU_PipeLine* aPipeLine = aPrs3d->GetPipeLine();
+
+    if( dynamic_cast<VISU_GaussPointsPL*>( aPipeLine ) )
+      return false;
+
+    if( anObjId < 0 )
+      aSelector->ClearIndex();
+    else
+    {
+      int aVTKId = (aPipeLine->*theMethod)(anObjId);
+      if(aVTKId < 0)
+       return false;
+
+      TColStd_MapOfInteger newIndices;
+      newIndices.Add(anObjId);
+      aSelector->AddOrRemoveIndex(anIO, newIndices, false);
+    }
+
+    aViewWindow->highlight(anIO, true, true);
+
+    //if( SVTK_MainWindow* aMainWindow = aViewWindow->getMainWindow() )
+    //{
+      SVTK_RenderWindowInteractor* anInteractor = aViewWindow->GetInteractor();
+      VISU_Actor* anActor = SVTK::Find<VISU_Actor>(anInteractor->getRenderer()->GetActors(),
+                                                  SVTK::TIsSameIObject<VISU_Actor>( anIO ));
+      anActor->Highlight( anIO );
+      //}
+
+    return true;
+
+  } else {
+    theMeshName->setText(theValue);
+    theFieldName->setText("");
+  }
+  return false;
+}
+
+void VisuGUI_SelectionPanel::onPointIdEdit ()
+{
+  if (myFl) return;
+  TGetVTKIdMethod aMethod = &VISU_PipeLine::GetNodeVTKID;
+  bool anIsSelected = onIdEdit(myIDValLbl->text(),
+                              aMethod,
+                              false,
+                              myModule,
+                              myMeshName,
+                              tr("WRN_NO_AVAILABLE_DATA"),
+                              myFieldName);
+  if (anIsSelected)
+    // as selection manager doesn't send signal currentSelectionChanged()
+    onSelectionEvent();
+  else
+    clearFields();
+}
+
+void VisuGUI_SelectionPanel::onCellIdEdit ()
+{
+  if (myFl) return;
+  TGetVTKIdMethod aMethod = &VISU_PipeLine::GetElemVTKID;
+  bool anIsSelected = onIdEdit(myCellIDValLbl->text(),
+                              aMethod,
+                              true,
+                              myModule,
+                              myMeshName,
+                              tr("WRN_NO_AVAILABLE_DATA"),
+                              myFieldName);
+  if (anIsSelected)
+    // as selection manager doesn't send signal currentSelectionChanged()
+    onSelectionEvent();
+  else
+    clearFields();
+}
+
+void VisuGUI_SelectionPanel::onIdChanged( int theFirstId, int theSecondId )
+{
+  //printf( "VisuGUI_SelectionPanel::onIdChanged( %d, %d )\n", theFirstId, theSecondId );
+  int aType = myTabWidget->currentIndex();
+  if( aType == 1 )
+  {
+    myCellIDValLbl->setText( theFirstId < 0 ? "" : QString::number( theFirstId ) );
+    onCellIdEdit();
+  }
+  else if( aType == 2 )
+  {
+    myIDValLbl->setText( theFirstId < 0 ? "" : QString::number( theFirstId ) );
+    onPointIdEdit();
+  }
+  else if( aType == 3 )
+    myGaussPointsPane->setIds( theFirstId, theSecondId );
+}
+
+void VisuGUI_SelectionPanel::onPreferences()
+{
+  preferencesDlg()->exec();
+}
+
+void VisuGUI_SelectionPanel::onApply()
+{
+  VisuGUI_Panel::onApply();
+}
+
+void VisuGUI_SelectionPanel::onClose()
+{
+  close();
+  VisuGUI_Panel::onClose();
+}
+
+void VisuGUI_SelectionPanel::onHelp()
+{
+  QString aHelpFileName = "selection_info_page.html";
+  LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication());
+  if (app)
+    app->onHelpContextModule(myModule ? app->moduleName(myModule->moduleName()) : QString(""), aHelpFileName);
+  else {
+    QString platform;
+#ifdef WIN32
+    platform = "winapplication";
+#else
+    platform = "application";
+#endif
+    SUIT_MessageBox::warning(0, QObject::tr("WRN_WARNING"),
+                             QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
+                             arg(app->resourceMgr()->stringValue("ExternalBrowser", platform)).arg(aHelpFileName) );
+  }
+
+  VisuGUI_Panel::onHelp();
+}
+
+void VisuGUI_SelectionPanel::keyPressEvent( QKeyEvent* e )
+{
+  VisuGUI_Panel::keyPressEvent( e );
+  if ( e->isAccepted() )
+    return;
+
+  if ( e->key() == Qt::Key_F1 )
+    {
+      e->accept();
+      onHelp();
+    }
+}
diff --git a/src/VISUGUI/VisuGUI_SelectionPanel.h b/src/VISUGUI/VisuGUI_SelectionPanel.h
new file mode 100644 (file)
index 0000000..b4db3d6
--- /dev/null
@@ -0,0 +1,113 @@
+//  VISU VISUGUI : GUI of VISU component
+//
+//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
+// 
+//  This library is free software; you can redistribute it and/or 
+//  modify it under the terms of the GNU Lesser General Public 
+//  License as published by the Free Software Foundation; either 
+//  version 2.1 of the License. 
+// 
+//  This library is distributed in the hope that it will be useful, 
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of 
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
+//  Lesser General Public License for more details. 
+// 
+//  You should have received a copy of the GNU Lesser General Public 
+//  License along with this library; if not, write to the Free Software 
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
+// 
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+//
+//
+//  File   : VisuGUI_SelectionPanel.h
+//  Author : Laurent CORNABE & Hubert ROLLAND 
+//  Module : VISU
+//  $Header$
+
+#ifndef VISUGUI_SELECTIONPANEL_H
+#define VISUGUI_SELECTIONPANEL_H
+
+#include <VisuGUI_Panel.h>
+
+class QLabel;
+class QLineEdit;
+class QTableWidget;
+class QTabWidget;
+
+class VisuGUI_GaussPointsSelectionPane;
+class VisuGUI_FindPane;
+class VisuGUI_SelectionPrefDlg;
+
+class VisuGUI_SelectionPanel: public VisuGUI_Panel
+{
+  Q_OBJECT
+
+public:
+  VisuGUI_SelectionPanel( const VisuGUI* theModule, QWidget* theParent = 0 );
+  virtual ~VisuGUI_SelectionPanel ();
+
+public:
+  void                      setSelectionMode( int theId );
+
+protected:
+  virtual void              keyPressEvent( QKeyEvent* theEvent );
+  virtual void              showEvent( QShowEvent* theEvent );
+  virtual void              closeEvent( QCloseEvent* theEvent );
+
+private slots:
+  virtual void              onApply();
+  virtual void              onClose();
+  virtual void              onHelp();
+
+  void                      onPreferences();
+
+  void                      onSelectionModeChanged( int theId );
+  void                      onSelectionEvent();
+  void                      onPointIdEdit();
+  void                      onCellIdEdit();
+
+  void                      onIdChanged( int theFirstId, int theSecondId );
+
+signals:
+  void                      selectionModeChanged( int );
+
+private:
+  VisuGUI_SelectionPrefDlg* preferencesDlg();
+  void                      clearFields();
+
+private:
+  QLabel*                   myMeshName;
+  QLabel*                   myFieldName;
+
+  QTabWidget*               myTabWidget;
+  QWidget*                  myPointsPane;
+  QWidget*                  myCellsPane;
+
+  QLineEdit*                myIDValLbl;
+  QTableWidget*             myListPoints;
+
+  QLineEdit*                myCellIDValLbl;
+  QLabel*                   myCellScalarValLbl;
+  QLabel*                   myCellVectorValLbl;
+  QTableWidget*             myCellListPoints;
+
+  QWidget*                  myActorsPane;
+  QLabel*                   myXPosLbl;
+  QLabel*                   myYPosLbl;
+  QLabel*                   myZPosLbl;
+  QLabel*                   myDXLbl;
+  QLabel*                   myDYLbl;
+  QLabel*                   myDZLbl;
+
+  VisuGUI_GaussPointsSelectionPane* myGaussPointsPane;
+
+  VisuGUI_FindPane*         myFindPane;
+
+  VisuGUI_SelectionPrefDlg* myPreferencesDlg;
+
+  bool                      myFl;
+};
+
+#endif
diff --git a/src/VISUGUI/VisuGUI_SelectionPrefDlg.cxx b/src/VISUGUI/VisuGUI_SelectionPrefDlg.cxx
new file mode 100644 (file)
index 0000000..0027b49
--- /dev/null
@@ -0,0 +1,300 @@
+//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
+// 
+//  This library is free software; you can redistribute it and/or 
+//  modify it under the terms of the GNU Lesser General Public 
+//  License as published by the Free Software Foundation; either 
+//  version 2.1 of the License. 
+// 
+//  This library is distributed in the hope that it will be useful, 
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of 
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
+//  Lesser General Public License for more details. 
+// 
+//  You should have received a copy of the GNU Lesser General Public 
+//  License along with this library; if not, write to the Free Software 
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
+// 
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+//
+//
+//  File   : VisuGUI_SelectionPrefDlg.cxx
+//  Author : Oleg UVAROV
+//  Module : SALOME
+
+#include "VisuGUI_SelectionPrefDlg.h"
+#include "VisuGUI.h"
+
+#include "VISU_PickingSettings.h"
+
+#include <SUIT_Session.h>
+#include <SUIT_Application.h>
+#include <SUIT_Desktop.h>
+#include <SUIT_Tools.h>
+#include <SUIT_MessageBox.h>
+#include <SUIT_ResourceMgr.h>
+
+#include <LightApp_Application.h>
+
+#include <QtxColorButton.h>
+#include <QtxDoubleSpinBox.h>
+#include <QtxIntSpinBox.h>
+
+#include <QComboBox>
+#include <QGroupBox>
+#include <QKeyEvent>
+#include <QLabel>
+#include <QLayout>
+#include <QLineEdit>
+#include <QPushButton>
+
+using namespace std;
+
+/*!
+  Constructor
+*/
+VisuGUI_SelectionPrefDlg::VisuGUI_SelectionPrefDlg( QWidget* parent )
+    : QDialog( parent ? parent : SUIT_Session::session()->activeApplication()->desktop(), 
+              Qt::WindowTitleHint | Qt::WindowSystemMenuHint )
+{
+  setWindowTitle( tr("TLT_SELECTION_PREFERENCES") );
+  setSizeGripEnabled( TRUE );
+  setModal( true );
+
+  QVBoxLayout* topLayout = new QVBoxLayout( this );
+  topLayout->setMargin( 11 ); topLayout->setSpacing( 6 );
+
+  // Cursor (gauss points)
+  QGroupBox* CursorGroup = new QGroupBox( tr( "CURSOR_TITLE" ), this );
+  QGridLayout* CursorGroupLayout = new QGridLayout (CursorGroup);
+  CursorGroupLayout->setAlignment(Qt::AlignTop | Qt::AlignCenter);
+  CursorGroupLayout->setSpacing(6);
+  CursorGroupLayout->setMargin(11);
+
+  QLabel* CursorSizeLabel = new QLabel( tr( "CURSOR_SIZE" ), CursorGroup );
+  myCursorSizeSpinBox = new QtxDoubleSpinBox( 0, 1, 0.1, CursorGroup );
+  myCursorSizeSpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
+
+  QLabel* PyramidHeightLabel = new QLabel( tr( "PYRAMID_HEIGHT" ), CursorGroup );
+  double aHeightMin=1.e-7;
+  double aHeightMax=10.;
+  double aHeightStep=0.1;
+  myPyramidHeightSpinBox = new QtxDoubleSpinBox(aHeightMin, aHeightMax, aHeightStep, CursorGroup );
+  myPyramidHeightSpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
+  
+  QLabel* SelectionColorLabel = new QLabel( tr( "SELECTION_COLOR" ), CursorGroup );
+  mySelectionColorButton = new QtxColorButton( CursorGroup );
+  mySelectionColorButton->setColor( Qt::blue );
+
+  CursorGroupLayout->addWidget( CursorSizeLabel, 0, 0 );
+  CursorGroupLayout->addWidget( myCursorSizeSpinBox, 0, 1 );
+  CursorGroupLayout->addWidget( PyramidHeightLabel, 1, 0 );
+  CursorGroupLayout->addWidget( myPyramidHeightSpinBox, 1, 1 );
+  CursorGroupLayout->addWidget( SelectionColorLabel, 2, 0 );
+  CursorGroupLayout->addWidget( mySelectionColorButton, 2, 1 );
+
+  topLayout->addWidget( CursorGroup );
+
+  // Tolerance (gauss points)
+  QGroupBox* ToleranceGroup = new QGroupBox( tr( "TOLERANCE_TITLE" ), this );
+  QGridLayout* ToleranceGroupLayout = new QGridLayout (ToleranceGroup);
+  ToleranceGroupLayout->setAlignment(Qt::AlignTop | Qt::AlignCenter);
+  ToleranceGroupLayout->setSpacing(6);
+  ToleranceGroupLayout->setMargin(11);
+
+  QLabel* PointToleranceLabel = new QLabel( tr( "POINT_TOLERANCE" ), ToleranceGroup );
+  myPointToleranceSpinBox = new QtxDoubleSpinBox( 0.001, 10.0, 0.01, ToleranceGroup );
+  myPointToleranceSpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
+
+  ToleranceGroupLayout->addWidget( PointToleranceLabel, 0, 0 );
+  ToleranceGroupLayout->addWidget( myPointToleranceSpinBox, 0, 1 );
+
+  topLayout->addWidget( ToleranceGroup );
+
+  // Information window
+  myInfoWindowGroup = new QGroupBox( tr( "INFO_WINDOW_TITLE" ), this );
+  myInfoWindowGroup->setCheckable( true );
+
+  QGridLayout* InfoWindowGroupLayout = new QGridLayout (myInfoWindowGroup);
+  InfoWindowGroupLayout->setAlignment(Qt::AlignTop | Qt::AlignCenter);
+
+  QLabel* TransparencyLabel = new QLabel( tr( "TRANSPARENCY" ), myInfoWindowGroup );
+  myTransparencySpinBox = new QtxIntSpinBox( 0, 100, 10, myInfoWindowGroup );
+  myTransparencySpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
+
+  InfoWindowGroupLayout->addWidget( TransparencyLabel, 0, 0 );
+  InfoWindowGroupLayout->addWidget( myTransparencySpinBox, 0, 1 );
+
+  QLabel* PositionLabel = new QLabel( tr( "POSITION" ), myInfoWindowGroup );
+  myPositionComboBox = new QComboBox( myInfoWindowGroup );
+  myPositionComboBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
+
+  myPositionComboBox->addItem( tr( "BELOW_POINT" ) );
+  myPositionComboBox->addItem( tr( "TOP_LEFT_CORNER" ) );
+
+  InfoWindowGroupLayout->addWidget( TransparencyLabel, 0, 0 );
+  InfoWindowGroupLayout->addWidget( myTransparencySpinBox, 0, 1 );
+  InfoWindowGroupLayout->addWidget( PositionLabel, 1, 0 );
+  InfoWindowGroupLayout->addWidget( myPositionComboBox, 1, 1 );
+
+  topLayout->addWidget( myInfoWindowGroup );
+
+  // Movement of the camera
+  myCameraGroup = new QGroupBox( tr( "CAMERA_TITLE" ), this );
+  myCameraGroup->setCheckable( true );
+
+  QGridLayout* CameraGroupLayout = new QGridLayout (myCameraGroup);
+  CameraGroupLayout->setAlignment(Qt::AlignTop | Qt::AlignCenter);
+
+  QLabel* ZoomFactorLabel = new QLabel( tr( "ZOOM_FACTOR" ), myCameraGroup );
+  myZoomFactorSpinBox = new QtxDoubleSpinBox( 0.1, 10.0, 0.1, myCameraGroup );
+  myZoomFactorSpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
+
+  QLabel* StepNumberLabel = new QLabel( tr( "STEP_NUMBER" ), myCameraGroup );
+  StepNumberLabel->setToolTip( tr( "STEP_NUMBER_TIP" ) );
+  myStepNumberSpinBox = new QtxIntSpinBox( 1, 100, 1, myCameraGroup );
+  myStepNumberSpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
+
+  CameraGroupLayout->addWidget( ZoomFactorLabel, 0, 0 );
+  CameraGroupLayout->addWidget( myZoomFactorSpinBox, 0, 1 );
+  CameraGroupLayout->addWidget( StepNumberLabel, 1, 0 );
+  CameraGroupLayout->addWidget( myStepNumberSpinBox, 1, 1 );
+
+  topLayout->addWidget( myCameraGroup );
+
+  // Common buttons
+  QGroupBox* GroupButtons = new QGroupBox( this );
+  QHBoxLayout* GroupButtonsLayout = new QHBoxLayout( GroupButtons );
+  GroupButtonsLayout->setAlignment( Qt::AlignTop );
+  GroupButtonsLayout->setMargin( 11 ); GroupButtonsLayout->setSpacing( 6 );
+  
+  myButtonOk = new QPushButton( GroupButtons );
+  myButtonOk->setText( tr( "BUT_OK"  ) );
+  myButtonOk->setAutoDefault( TRUE ); myButtonOk->setDefault( TRUE );
+  GroupButtonsLayout->addWidget( myButtonOk );
+
+  myButtonApply = new QPushButton( GroupButtons );
+  myButtonApply->setText( tr( "BUT_APPLY"  ) );
+  myButtonApply->setAutoDefault( TRUE );
+  GroupButtonsLayout->addWidget( myButtonApply );
+
+  GroupButtonsLayout->addStretch();
+  
+  myButtonCancel = new QPushButton( GroupButtons );
+  myButtonCancel->setText( tr( "BUT_CANCEL"  ) );
+  myButtonCancel->setAutoDefault( TRUE );
+  GroupButtonsLayout->addWidget( myButtonCancel );
+
+  myButtonHelp = new QPushButton( GroupButtons );
+  myButtonHelp->setText( tr( "BUT_HELP"  ) );
+  myButtonHelp->setAutoDefault( TRUE );
+  GroupButtonsLayout->addWidget( myButtonHelp );
+  /***************************************************************/
+  
+  //topLayout->addWidget( GroupC1 );
+  topLayout->addWidget( GroupButtons );
+  
+  // signals and slots connections
+  connect( myButtonOk,     SIGNAL( clicked() ), this, SLOT( accept() ) );
+  connect( myButtonApply,  SIGNAL( clicked() ), this, SLOT( onApply() ) );
+  connect( myButtonCancel, SIGNAL( clicked() ), this, SLOT( reject() ) );
+  connect( myButtonHelp,   SIGNAL( clicked() ), this, SLOT( onHelp() ) );
+  
+  /* Move widget on the botton right corner of main widget */
+  SUIT_Tools::centerWidget( this, parent );
+}
+
+/*!
+  Destructor
+*/
+VisuGUI_SelectionPrefDlg::~VisuGUI_SelectionPrefDlg()
+{
+}
+
+void VisuGUI_SelectionPrefDlg::update()
+{
+  VISU_PickingSettings* aPickingSettings = VISU_PickingSettings::Get();
+
+  myCursorSizeSpinBox->setValue( aPickingSettings->GetCursorSize() );
+  myPyramidHeightSpinBox->setValue( aPickingSettings->GetPyramidHeight() );
+  myPointToleranceSpinBox->setValue( aPickingSettings->GetPointTolerance() );
+
+  vtkFloatingPointType* aColor = aPickingSettings->GetColor();
+  mySelectionColorButton->setColor( QColor( ( int )( aColor[0] * 255.0 ),
+                                           ( int )( aColor[1] * 255.0 ),
+                                           ( int )( aColor[2] * 255.0 ) ) );
+
+  myInfoWindowGroup->setChecked( aPickingSettings->GetInfoWindowEnabled() );
+  myTransparencySpinBox->setValue( int(aPickingSettings->GetInfoWindowTransparency() * 100.0) );
+  myPositionComboBox->setCurrentIndex( aPickingSettings->GetInfoWindowPosition() );
+  myCameraGroup->setChecked( aPickingSettings->GetCameraMovementEnabled() );
+  myZoomFactorSpinBox->setValue( aPickingSettings->GetZoomFactor() );
+  myStepNumberSpinBox->setValue( aPickingSettings->GetStepNumber() );
+}
+
+void VisuGUI_SelectionPrefDlg::accept()
+{
+  onApply();
+
+  QDialog::accept();
+}
+
+void VisuGUI_SelectionPrefDlg::onApply()
+{
+  VISU_PickingSettings* aPickingSettings = VISU_PickingSettings::Get();
+
+  aPickingSettings->SetCursorSize( myCursorSizeSpinBox->value() );
+  aPickingSettings->SetPyramidHeight( myPyramidHeightSpinBox->value() );
+  aPickingSettings->SetPointTolerance( myPointToleranceSpinBox->value() );
+
+  QColor aButtonColor = mySelectionColorButton->color();
+  vtkFloatingPointType aColor[3];
+  aColor[0] = aButtonColor.red() / 255.0;
+  aColor[1] = aButtonColor.green() / 255.0;
+  aColor[2] = aButtonColor.blue() / 255.0;
+  aPickingSettings->SetColor( aColor );
+
+  aPickingSettings->SetInfoWindowEnabled( myInfoWindowGroup->isChecked() );
+  aPickingSettings->SetInfoWindowTransparency( myTransparencySpinBox->value() / 100.0 );
+  aPickingSettings->SetInfoWindowPosition( myPositionComboBox->currentIndex() );
+  aPickingSettings->SetCameraMovementEnabled( myCameraGroup->isChecked() );
+  aPickingSettings->SetZoomFactor( myZoomFactorSpinBox->value() );
+  aPickingSettings->SetStepNumber( myStepNumberSpinBox->value() );
+
+  aPickingSettings->InvokeEvent( VISU::UpdatePickingSettingsEvent,NULL );
+}
+
+void VisuGUI_SelectionPrefDlg::onHelp()
+{
+  QString aHelpFileName = "selection_preferences_page.html";
+  LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication());
+  if (app) {
+    VisuGUI* aVisuGUI = dynamic_cast<VisuGUI*>( app->activeModule() );
+    app->onHelpContextModule(aVisuGUI ? app->moduleName(aVisuGUI->moduleName()) : QString(""), aHelpFileName);
+  }
+  else {
+    QString platform;
+#ifdef WIN32
+    platform = "winapplication";
+#else
+    platform = "application";
+#endif
+    SUIT_MessageBox::warning(0, QObject::tr("WRN_WARNING"),
+                             QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
+                             arg(app->resourceMgr()->stringValue("ExternalBrowser", platform)).arg(aHelpFileName) );
+  }
+}
+
+void VisuGUI_SelectionPrefDlg::keyPressEvent( QKeyEvent* e )
+{
+  QDialog::keyPressEvent( e );
+  if ( e->isAccepted() )
+    return;
+
+  if ( e->key() == Qt::Key_F1 )
+    {
+      e->accept();
+      onHelp();
+    }
+}
diff --git a/src/VISUGUI/VisuGUI_SelectionPrefDlg.h b/src/VISUGUI/VisuGUI_SelectionPrefDlg.h
new file mode 100644 (file)
index 0000000..878710d
--- /dev/null
@@ -0,0 +1,79 @@
+//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
+// 
+//  This library is free software; you can redistribute it and/or 
+//  modify it under the terms of the GNU Lesser General Public 
+//  License as published by the Free Software Foundation; either 
+//  version 2.1 of the License. 
+// 
+//  This library is distributed in the hope that it will be useful, 
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of 
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
+//  Lesser General Public License for more details. 
+// 
+//  You should have received a copy of the GNU Lesser General Public 
+//  License along with this library; if not, write to the Free Software 
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
+// 
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+//
+//
+//  File   : VisuGUI_SelectionPrefDlg.cxx
+//  Author : Oleg UVAROV
+//  Module : SALOME
+
+#ifndef VisuGUI_SELECTIONPREFDLG_H
+#define VisuGUI_SELECTIONPREFDLG_H
+
+#include <QDialog>
+
+class QComboBox;
+class QGroupBox;
+class QPushButton;
+
+class QtxColorButton;
+class QtxDoubleSpinBox;
+class QtxIntSpinBox;
+
+class VisuGUI_SelectionPrefDlg : public QDialog
+{ 
+  Q_OBJECT
+
+public:
+  VisuGUI_SelectionPrefDlg( QWidget* parent = 0 );
+  ~VisuGUI_SelectionPrefDlg();
+    
+public:
+  void                      update();
+
+private:
+  void                      keyPressEvent( QKeyEvent* e );
+    
+protected slots:
+  void                      accept();
+
+  void                      onApply();
+  void                      onHelp();
+  
+private:
+  QtxDoubleSpinBox*         myCursorSizeSpinBox;
+  QtxDoubleSpinBox*         myPyramidHeightSpinBox;
+  QtxColorButton*           mySelectionColorButton;
+  QtxDoubleSpinBox*         myPointToleranceSpinBox;
+
+  QGroupBox*                myInfoWindowGroup;
+  QtxIntSpinBox*            myTransparencySpinBox;
+  QComboBox*                myPositionComboBox;
+
+  QGroupBox*                myCameraGroup;
+  QtxDoubleSpinBox*         myZoomFactorSpinBox;
+  QtxIntSpinBox*            myStepNumberSpinBox;
+
+  QPushButton*              myButtonOk;
+  QPushButton*              myButtonApply;
+  QPushButton*              myButtonCancel;
+  QPushButton*              myButtonHelp;
+};
+
+#endif // VisuGUI_SELECTIONPREFDLG_H
index 64379d60b13ed6b4b51d360e32eef9e76f4364e1..52684c1bcdcadf7a06b535c5fc59dd8e7422cd1b 100644 (file)
 
 #include "VISU_Actor.h"
 
-#include "VVTK_MainWindow.h"
-#include "VVTK_ViewWindow.h"
-
 #include "VISU_Gen_i.hh"
-#include "VisuGUI_Module.h"
+#include "VisuGUI.h"
 #include "VisuGUI_Tools.h"
 #include "VisuGUI_Prs3dTools.h"
 
 #include "VTKViewer_Algorithm.h"
 #include "SVTK_Functor.h"
 
+#include "QtxDockWidget.h"
+#include "QtxDoubleSpinBox.h"
+
 #include <vtkActorCollection.h>
 #include <vtkRenderer.h>
 
+#include <QMainWindow>
 #include <QComboBox>
 #include <QFont>
 #include <QLabel>
 #include <QToolTip>
 #include <QSlider>
 #include <QSpinBox>
+#include <QGroupBox>
+#include <QCheckBox>
+#include <QRadioButton>
 #include <QTimer>
+#include <QAction>
 
 /*!
   Constructor
 */
-VisuGUI_Slider::VisuGUI_Slider( VisuGUI_Module* theModule, 
-                               VVTK_ViewWindow* theViewWindow,
+VisuGUI_Slider::VisuGUI_Slider( VisuGUI* theModule, 
+                               QMainWindow* theParent,
                                LightApp_SelectionMgr* theSelectionMgr )
-  : QtxToolBar( tr("TOOLBAR_TITLE"), theViewWindow->getMainWindow1() ),
-    myModule( theModule ),
-    myMainWindow( theViewWindow->getMainWindow1() ),
-    mySelectionMgr( theSelectionMgr )
+  : QWidget( theParent )
+  , myViewManager( VISU::GetVisuGen( theModule )->GetViewManager() )
+  , mySelectionMgr( theSelectionMgr )
+  , myModule( theModule )
 {
-  //setLabel();
-  //setCloseMode(QDockWindow::Undocked);
-  setMovable( true );
-
-  VISU::ViewManager_var aViewManager = VISU::GetVisuGen( myModule )->GetViewManager();
-  VISU::View_var aView = aViewManager->GetCurrentView();
-  if(!CORBA::is_nil(aView.in()))
-    myView3D = VISU::View3D::_narrow(aView);
+  setWindowTitle( tr("TITLE") );
+  setObjectName( tr("TITLE") );
 
   SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
 
-  //setHorizontallyStretchable( true );
-
-  QWidget* aWidget = new QWidget( this );
-  aWidget->setFocusPolicy(Qt::StrongFocus);
-  myWidgetAction = addWidget( aWidget );
-
-  QGridLayout* aLayout = new QGridLayout( aWidget );
-  aLayout->setMargin( 11 );
-  aLayout->setSpacing( 6 );
-
-  // Slider and time stamps
-  myFirstTimeStamp = new QLabel( aWidget );
-  myFirstTimeStamp->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
-  aLayout->addWidget( myFirstTimeStamp, 0, 0, Qt::AlignHCenter );
-
-  mySlider = new QSlider( aWidget );
-  mySlider->setMinimum( 0 );
-  mySlider->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
-  mySlider->setOrientation( Qt::Horizontal );
-  mySlider->setTracking( false );
-  mySlider->setFocusPolicy(Qt::StrongFocus);
-  aLayout->addWidget( mySlider, 0, 1, 1, 8 );
-
-  myLastTimeStamp = new QLabel( aWidget );
-  myLastTimeStamp->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
-  aLayout->addWidget( myLastTimeStamp, 0, 9, Qt::AlignHCenter );
-
-  myTimeStampsNumber = new QLabel( aWidget );
-  myTimeStampsNumber->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
-  aLayout->addWidget( myTimeStampsNumber, 0, 10, Qt::AlignHCenter );
-
-  QLabel* aCacheMemoryLabel = new QLabel( tr( "CACHE_MEMORY" ), aWidget );
-  aCacheMemoryLabel->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
-  aLayout->addWidget( aCacheMemoryLabel, 0, 11 );
-
-  myCacheMemory = new QLabel( aWidget );
-  myCacheMemory->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
-  QFontMetrics fm( myCacheMemory->font() );
-  myCacheMemory->setFixedWidth( fm.width( "9.99E+99 Mb" ) );
-
-  aLayout->addWidget( myCacheMemory, 0, 12 );
-
-  // Buttons
-#ifdef ENABLE_AVI_AND_MORE_BUTTONS
-  myMoreButton = new QToolButton( aWidget );
-  myMoreButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
-  myMoreButton->setEnabled( false );
-  myMoreButton->setCheckble( true );
-  myMoreButton->setIcon( aResourceMgr->loadPixmap( "VISU", tr( "ICON_SLIDER_MORE" ) ) );
-  QToolTip::add( myMoreButton, tr( "MORE" ) );
-  aLayout->addWidget( myMoreButton, 1, 0 );
-
-  myAVIButton = new QToolButton( aWidget );
-  myAVIButton->setEnabled( false );
-  myAVIButton->setCheckble( true );
-  myAVIButton->setIcon( aResourceMgr->loadPixmap( "VISU", tr( "ICON_SLIDER_AVI" ) ) );
-  QToolTip::add( myAVIButton, tr( "AVI" ) );
-  aLayout->addWidget( myAVIButton, 1, 1 );
-#endif
-
-  aLayout->addItem( new QSpacerItem( 24, 24, QSizePolicy::Expanding, QSizePolicy::Minimum ), 1, 2 );
-
-  myFirstButton = new QToolButton( aWidget );
-  myFirstButton->setIcon( aResourceMgr->loadPixmap( "VISU", tr( "ICON_SLIDER_FIRST" ) ) );
-  aLayout->addWidget( myFirstButton, 1, 3 );
-
-  myPreviousButton = new QToolButton( aWidget );
-  myPreviousButton->setIcon( aResourceMgr->loadPixmap( "VISU", tr( "ICON_SLIDER_PREVIOUS" ) ) );
-  aLayout->addWidget( myPreviousButton, 1, 4 );
-
-  myPlayButton = new QToolButton( aWidget );
-  myPlayButton->setIcon( aResourceMgr->loadPixmap( "VISU", tr( "ICON_SLIDER_PLAY" ) ) );
-  myPlayButton->setCheckable( true );
-  aLayout->addWidget( myPlayButton, 1, 5 );
-
-  myNextButton = new QToolButton( aWidget );
-  myNextButton->setIcon( aResourceMgr->loadPixmap( "VISU", tr( "ICON_SLIDER_NEXT" ) ) );
-  aLayout->addWidget( myNextButton, 1, 6 );
-
-  myLastButton = new QToolButton( aWidget );
-  myLastButton->setIcon( aResourceMgr->loadPixmap( "VISU", tr( "ICON_SLIDER_LAST" ) ) );
-  aLayout->addWidget( myLastButton, 1, 7 );
-
-  aLayout->addItem( new QSpacerItem( 24, 24, QSizePolicy::Expanding, QSizePolicy::Minimum ), 1, 8 );
-
-  myTimeStampStrings = new QComboBox( aWidget );
-  myTimeStampStrings->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
-  myTimeStampStrings->setFocusPolicy(Qt::StrongFocus);
-  aLayout->addWidget( myTimeStampStrings, 1, 9 );
-
-  myTimeStampIndices = new QComboBox( aWidget );
-  myTimeStampIndices->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
-  myTimeStampIndices->setFocusPolicy(Qt::StrongFocus);
-  aLayout->addWidget( myTimeStampIndices, 1, 10 );
-
-  // Speed
-  QLabel* aSpeedLabel = new QLabel( tr( "SPEED" ), aWidget );
-  aSpeedLabel->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
-  aLayout->addWidget( aSpeedLabel, 1, 11 );
-
-  mySpeedBox = new QSpinBox( aWidget );
-  mySpeedBox->setMinimum( 1 );
-  mySpeedBox->setMaximum( 100 );
-  mySpeedBox->setSingleStep( 1 );
-  mySpeedBox->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
-  mySpeedBox->setFocusPolicy(Qt::StrongFocus);
-  mySpeedBox->setValue( 50 );
-  aLayout->addWidget( mySpeedBox, 1, 12 );
+  //----------------------------------------------------------------------------
+  QVBoxLayout* aVBoxLayout = new QVBoxLayout( this );
+
+  QTabWidget* aTabWidget = new QTabWidget( this );
+  aTabWidget->setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Fixed );
+
+  aVBoxLayout->addWidget( aTabWidget );
+
+  {
+    QWidget* aParent = new QWidget();
+    {
+      QGridLayout* aGridLayout = new QGridLayout( aParent );
+      {
+       myFirstTimeStamp = new QLabel( aParent );
+       myFirstTimeStamp->setAlignment( Qt::AlignRight | Qt::AlignTrailing | Qt::AlignVCenter );
+       myFirstTimeStamp->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed );
+       aGridLayout->addWidget( myFirstTimeStamp, 0, 0, 1, 1 );
+       
+       mySlider = new QSlider( aParent );
+       mySlider->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed );
+       mySlider->setFocusPolicy( Qt::StrongFocus );
+       mySlider->setOrientation( Qt::Horizontal );
+       mySlider->setTracking( false );
+       mySlider->setMinimum( 0 );
+       aGridLayout->addWidget( mySlider, 0, 1, 1, 3 );
+       
+       myLastTimeStamp = new QLabel( aParent );
+       aGridLayout->addWidget( myLastTimeStamp, 0, 4, 1, 1 );
+      }     
+      {
+       myFirstButton = new QToolButton( aParent );
+       myFirstButton->setIcon( aResourceMgr->loadPixmap( "VISU", tr( "ICON_SLIDER_FIRST" ) ) );
+       myFirstButton->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed );
+       aGridLayout->addWidget( myFirstButton, 1, 0, 1, 1 );
+
+       myPreviousButton = new QToolButton( aParent );
+       myPreviousButton->setIcon( aResourceMgr->loadPixmap( "VISU", tr( "ICON_SLIDER_PREVIOUS" ) ) );
+       myPreviousButton->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed );
+       aGridLayout->addWidget( myPreviousButton, 1, 1, 1, 1 );
+
+       myPlayButton = new QToolButton( aParent );
+       myPlayButton->setIcon( aResourceMgr->loadPixmap( "VISU", tr( "ICON_SLIDER_PLAY" ) ) );
+       myPlayButton->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed );
+       myPlayButton->setCheckable( true );
+       aGridLayout->addWidget( myPlayButton, 1, 2, 1, 1 );
+
+       myNextButton = new QToolButton( aParent );
+       myNextButton->setIcon( aResourceMgr->loadPixmap( "VISU", tr( "ICON_SLIDER_NEXT" ) ) );
+       myNextButton->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed );
+       aGridLayout->addWidget( myNextButton, 1, 3, 1, 1 );
+
+       myLastButton = new QToolButton( aParent );
+       myLastButton->setIcon( aResourceMgr->loadPixmap( "VISU", tr( "ICON_SLIDER_LAST" ) ) );
+       myLastButton->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed );
+       aGridLayout->addWidget( myLastButton, 1, 4, 1, 1 );
+      }
+      {
+       myTimeStampIndexes = new QComboBox( aParent );
+       myTimeStampIndexes->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed );
+       myTimeStampIndexes->setFocusPolicy( Qt::StrongFocus );
+       aGridLayout->addWidget( myTimeStampIndexes, 2, 0, 1, 2 );
+
+       myIsCycled = new QToolButton( aParent );
+       myIsCycled->setText( tr( "IS_CYCLED" ) );
+       myIsCycled->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed );
+       myIsCycled->setLayoutDirection( Qt::LeftToRight );
+       myIsCycled->setCheckable( true );
+       //myIsCycled->setEnabled( false );
+       aGridLayout->addWidget( myIsCycled, 2, 2, 1, 1 );
+
+       myTimeStampStrings = new QComboBox( aParent );
+       myTimeStampStrings->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed );
+       myTimeStampStrings->setFocusPolicy( Qt::StrongFocus );
+       aGridLayout->addWidget( myTimeStampStrings, 2, 3, 1, 2 );
+      }
+    }
+
+    aTabWidget->addTab( aParent, tr( "NAVIGATION_TAB" ) );
+    myPlayTab = aParent;
+  }
+
+  {
+    QWidget* aParent = new QWidget();
+    {
+      QVBoxLayout* aVBoxLayout = new QVBoxLayout( aParent );
+      {
+       QHBoxLayout* aHBoxLayout = new QHBoxLayout();
+       
+       myMinimalMemoryButton = new QRadioButton( tr( "MINIMAL_MEMORY" ), aParent );
+       aHBoxLayout->addWidget( myMinimalMemoryButton );        
+
+       QSpacerItem* aSpacerItem = new QSpacerItem( 16, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );     
+       aHBoxLayout->addItem( aSpacerItem );
+
+       myLimitedMemoryButton = new QRadioButton( tr( "LIMITED_MEMORY" ), aParent );
+       myLimitedMemoryButton->setChecked( true );
+       aHBoxLayout->addWidget( myLimitedMemoryButton );
+       
+       myLimitedMemory = new QtxDoubleSpinBox( aParent );
+       myLimitedMemory->setMaximum( 10000 );
+       myLimitedMemory->setValue( 512 );
+       aHBoxLayout->addWidget( myLimitedMemory );
+       
+       QLabel* aMemoryDimensionLabel = new QLabel( aParent );
+       aMemoryDimensionLabel->setText( tr( "MEMORY_UNITS" ) );
+       aHBoxLayout->addWidget( aMemoryDimensionLabel );
+       
+       aVBoxLayout->addLayout( aHBoxLayout );
+      }
+      {
+       QHBoxLayout* aHBoxLayout = new QHBoxLayout();
+           
+       QLabel* aUsedMemoryLabel = new QLabel( tr( "USED_BY_CACHE" ), aParent );
+       aUsedMemoryLabel->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed );
+       aHBoxLayout->addWidget( aUsedMemoryLabel );
+       
+       myUsedMemory = new QLineEdit( aParent );
+       myUsedMemory->setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Fixed );
+       //myUsedMemory->setEnabled( false );
+       aHBoxLayout->addWidget( myUsedMemory );
+           
+       QSpacerItem* aSpacerItem = new QSpacerItem( 16, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );     
+       aHBoxLayout->addItem( aSpacerItem );
+
+       QLabel* aFreeMemoryLabel = new QLabel( tr( "AVAILABLE_MEMORY" ), aParent );
+       aHBoxLayout->addWidget( aFreeMemoryLabel );
+    
+       myFreeMemory = new QLineEdit( aParent );
+       myFreeMemory->setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Fixed );
+       //myFreeMemory->setEnabled( false );
+       aHBoxLayout->addWidget( myFreeMemory );
+
+       aVBoxLayout->addLayout( aHBoxLayout );
+      }
+      {
+       QHBoxLayout* aHBoxLayout = new QHBoxLayout();
+       
+       QLabel* aLabel = new QLabel( tr( "SPEED" ), aParent );
+       aLabel->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed );
+       aHBoxLayout->addWidget( aLabel );   
+      
+       mySpeedSlider = new QSlider( aParent );
+       mySpeedSlider->setMinimum( 1 );
+       mySpeedSlider->setMaximum( 100 );
+       mySpeedSlider->setValue( mySpeedSlider->maximum() / 2 );
+       mySpeedSlider->setPageStep( mySpeedSlider->maximum() / 5 );
+       mySpeedSlider->setTickInterval( mySpeedSlider->pageStep() );    
+       mySpeedSlider->setOrientation( Qt::Horizontal );
+       mySpeedSlider->setTickPosition( QSlider::TicksBelow );
+       aHBoxLayout->addWidget( mySpeedSlider );   
+       
+       aVBoxLayout->addLayout( aHBoxLayout );
+      }
+      
+      aTabWidget->addTab( aParent, tr( "PROPERTIES_TAB" ) );
+    }
+  }
+
+  {
+    QSpacerItem* aSpacerItem = new QSpacerItem( 16, 20, QSizePolicy::Minimum, QSizePolicy::Expanding );
+    aVBoxLayout->addItem( aSpacerItem );
+  }
+
+
+  //----------------------------------------------------------------------------
+  myPlayPixmap = aResourceMgr->loadPixmap( "VISU", tr( "ICON_SLIDER_PLAY" ) );
+  myPausePixmap = aResourceMgr->loadPixmap( "VISU", tr( "ICON_SLIDER_PAUSE" ) );
 
   myTimer = new QTimer( this );
 
   // Common
+  connect( theModule, SIGNAL( moduleDeactivated() ), SLOT( onModuleDeactivated() ) );
+
+  connect( theModule, SIGNAL( moduleActivated() ), SLOT( onModuleActivated() ) );
+
   connect( mySelectionMgr, SIGNAL( currentSelectionChanged() ), SLOT( onSelectionChanged() ) );
 
   connect( myTimeStampStrings, SIGNAL( activated( int ) ),    SLOT( onTimeStampActivated( int ) ) );
-  connect( myTimeStampIndices, SIGNAL( activated( int ) ),    SLOT( onTimeStampActivated( int ) ) );
+  connect( myTimeStampIndexes, SIGNAL( activated( int ) ),    SLOT( onTimeStampActivated( int ) ) );
 
   connect( myFirstButton,      SIGNAL( clicked() ),           SLOT( onFirst() ) );
   connect( myPreviousButton,   SIGNAL( clicked() ),           SLOT( onPrevious() ) );
@@ -213,22 +275,85 @@ VisuGUI_Slider::VisuGUI_Slider( VisuGUI_Module* theModule,
 
   connect( mySlider,           SIGNAL( valueChanged( int ) ), SLOT( onValueChanged( int ) ) );
 
-  connect( mySpeedBox,         SIGNAL( valueChanged( int ) ), SLOT( onSpeedChanged( int ) ) );
+  connect( mySpeedSlider,      SIGNAL( valueChanged( int ) ), SLOT( onSpeedChanged( int ) ) );
 
   connect( myTimer,            SIGNAL( timeout() ),           SLOT( onTimeout() ) );
 
+  //----------------------------------------------------------------------------
+  connect( myLimitedMemoryButton, SIGNAL( toggled( bool ) ), this, SLOT( onMemoryModeChanged( bool ) ) );
+  connect( myLimitedMemory, SIGNAL( valueChanged( double ) ), this, SLOT( onMemorySizeChanged( double ) ) );
+
+  //----------------------------------------------------------------------------
   enableControls( false );
 
-  myMainWindow->addToolBar( Qt::BottomToolBarArea, this );
+  QtxDockWidget* aQtxDockWidget = new QtxDockWidget( true, theParent );
+  theParent->addDockWidget( Qt::BottomDockWidgetArea , aQtxDockWidget );
+  aQtxDockWidget->setObjectName( objectName() );
+  aQtxDockWidget->setWidget( this );
+  
+  myToggleViewAction = aQtxDockWidget->toggleViewAction();
+  myToggleViewAction->setIcon( QIcon( aResourceMgr->loadPixmap( "VISU", tr( "ICON_SLIDER_PANEL" ) ) ) );
+  myToggleViewAction->setToolTip( tr( "MEN_SLIDER_PANE" ) );
+  myToggleViewAction->setText( tr( "MEN_SLIDER_PANE" ) );
+  myToggleViewAction->setCheckable( true );
+  aQtxDockWidget->setVisible( false );
+
+  connect( myToggleViewAction, SIGNAL( toggled( bool ) ), this, SLOT( onToggleView( bool ) ) );
 }
 
-/*!
-  Destructor
-*/
+
+//----------------------------------------------------------------------------
 VisuGUI_Slider::~VisuGUI_Slider()
 {
 }
 
+
+//----------------------------------------------------------------------------
+QAction* VisuGUI_Slider::toggleViewAction()
+{
+  return myToggleViewAction;
+}
+
+
+//----------------------------------------------------------------------------
+void VisuGUI_Slider::onModuleDeactivated()
+{
+  setHidden( true );
+}
+
+
+//----------------------------------------------------------------------------
+void VisuGUI_Slider::onModuleActivated()
+{
+  setHidden( false );
+}
+
+
+//----------------------------------------------------------------------------
+void VisuGUI_Slider::onMemoryModeChanged( bool )
+{
+  using namespace VISU;
+  SALOMEDS::Study_var aStudy = GetDSStudy( GetCStudy( GetAppStudy( myModule ) ) );
+  VISU::ColoredPrs3dCache_var aCache = GetVisuGen( myModule )->GetColoredPrs3dCache( aStudy );
+
+  if ( myLimitedMemoryButton->isChecked() ) {
+    aCache->SetMemoryMode( VISU::ColoredPrs3dCache::LIMITED );
+    aCache->SetLimitedMemory( myLimitedMemory->value() );
+  } else
+    aCache->SetMemoryMode( VISU::ColoredPrs3dCache::MINIMAL );
+
+  myLimitedMemory->setEnabled( myLimitedMemoryButton->isChecked() );
+}
+
+
+//----------------------------------------------------------------------------
+void VisuGUI_Slider::onMemorySizeChanged( double )
+{
+  onMemoryModeChanged( myLimitedMemoryButton->isChecked() );
+}
+
+
+//----------------------------------------------------------------------------
 bool VisuGUI_Slider::checkHolderList()
 {
   THolderList aHolderList;
@@ -243,16 +368,19 @@ bool VisuGUI_Slider::checkHolderList()
   return myHolderList.empty();
 }
 
+
+//----------------------------------------------------------------------------
 void VisuGUI_Slider::enableControls( bool on )
 {
-  widgetForAction( myWidgetAction  )->setEnabled( on );
+  myPlayTab->setEnabled( on );
+
   if( on )
   {
     if( checkHolderList() )
       return;
 
     myTimeStampStrings->clear();
-    myTimeStampIndices->clear();
+    myTimeStampIndexes->clear();
 
     VISU::ColoredPrs3dHolder_var aHolder = myHolderList.front();
 
@@ -264,7 +392,6 @@ void VisuGUI_Slider::enableControls( bool on )
 
     myFirstTimeStamp->setText( aTimeStampsRange[0].myTime.in() );
     myLastTimeStamp->setText( aTimeStampsRange[aLength-1].myTime.in() );
-    myTimeStampsNumber->setText( QString("(") + QString::number( aLength ) + ")" );
 
     int aPageStep = aLength / 10;
     aPageStep = std::max(aPageStep, 1);
@@ -278,7 +405,7 @@ void VisuGUI_Slider::enableControls( bool on )
       QString aTime = anInfo.myTime.in();
 
       myTimeStampStrings->addItem( aTime );
-      myTimeStampIndices->addItem( QString::number( aNumber ) );
+      myTimeStampIndexes->addItem( QString::number( aNumber ) );
 
       if( aNumber == aTimeStampNumber )
        a_current_index = an_index;
@@ -287,18 +414,31 @@ void VisuGUI_Slider::enableControls( bool on )
     myTimeStampStrings->setFont(myTimeStampStrings->font());
     myTimeStampStrings->updateGeometry();
     
-    myTimeStampIndices->setFont(myTimeStampStrings->font());
-    myTimeStampIndices->updateGeometry();
+    myTimeStampIndexes->setFont(myTimeStampStrings->font());
+    myTimeStampIndexes->updateGeometry();
 
     if( a_current_index > mySlider->maximum() )
       mySlider->setMaximum( aLength-1 );
 
     myTimeStampStrings->setCurrentIndex( a_current_index );
-    myTimeStampIndices->setCurrentIndex( a_current_index );
+    myTimeStampIndexes->setCurrentIndex( a_current_index );
     mySlider->setValue( a_current_index );
 
     if( a_current_index <= mySlider->maximum() )
       mySlider->setMaximum( aLength-1 );
+
+    using namespace VISU;
+    SALOMEDS::Study_var aStudy = GetDSStudy( GetCStudy( GetAppStudy( myModule ) ) );
+    VISU::ColoredPrs3dCache_var aCache = GetVisuGen( myModule )->GetColoredPrs3dCache( aStudy );
+
+    long aMb = 1024 * 1024;
+    double aLimitedMemory = aCache->GetLimitedMemory();
+    myLimitedMemory->setValue( aLimitedMemory );
+
+    double aFreeMemory = (double)VISU_PipeLine::GetAvailableMemory( 2048 * aMb ) / (double)aMb;
+    double anUsedMemory = aCache->GetMemorySize();
+    double aLimitedMemoryMax = max( anUsedMemory + aFreeMemory, aLimitedMemory );
+    myLimitedMemory->setMaximum( aLimitedMemoryMax );
   }
   else
   {
@@ -307,18 +447,31 @@ void VisuGUI_Slider::enableControls( bool on )
 
 }
 
+
+//----------------------------------------------------------------------------
 void VisuGUI_Slider::updateMemoryState()
 {
   if( checkHolderList() )
     return;
 
   VISU::ColoredPrs3dHolder_var aHolder = myHolderList.front();
-
   VISU::ColoredPrs3dCache_var aCache = aHolder->GetCache();
+
   CORBA::Float aCacheMemory = aCache->GetMemorySize();
-  myCacheMemory->setText( QString::number( double( aCacheMemory ), 'E', 2 ) + " Mb" );
+  myUsedMemory->setText( QString::number( double( aCacheMemory ), 'E', 2 ) + " Mb" );
+  myUsedMemory->setFont( myUsedMemory->font() );
+  myUsedMemory->updateGeometry();
+    
+
+  long aMb = 1024 * 1024;
+  double aFreeMemory = (double)VISU_PipeLine::GetAvailableMemory( 2048 * aMb ) / (double)aMb;
+  myFreeMemory->setText( QString::number( double( aFreeMemory ), 'E', 2 ) + " Mb" );
+  myFreeMemory->setFont( myFreeMemory->font() );
+  myFreeMemory->updateGeometry();
 }
 
+
+//----------------------------------------------------------------------------
 void VisuGUI_Slider::onSelectionChanged()
 {
   //cout << "VisuGUI_Slider::onSelectionChanged()" << endl;
@@ -354,22 +507,31 @@ void VisuGUI_Slider::onSelectionChanged()
     }
   }
 
-  enableControls( !checkHolderList() );
+  VISU::View_var aView = myViewManager->GetCurrentView();
+
+  enableControls( !checkHolderList() && !CORBA::is_nil( aView.in() ) );
+
   updateMemoryState();
 }
 
+
+//----------------------------------------------------------------------------
 void VisuGUI_Slider::onTimeStampActivated( int value )
 {
   mySlider->setValue( value );
   onValueChanged( value );
 }
 
+
+//----------------------------------------------------------------------------
 void VisuGUI_Slider::onFirst()
 {
   int value = mySlider->minimum();
   mySlider->setValue( value );
 }
 
+
+//----------------------------------------------------------------------------
 void VisuGUI_Slider::onPrevious()
 {
   int value = mySlider->value() - 1;
@@ -377,23 +539,35 @@ void VisuGUI_Slider::onPrevious()
     mySlider->setValue( value );
 }
 
+
+//----------------------------------------------------------------------------
 void VisuGUI_Slider::onPlay( bool on )
 {
-  SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
   if( on )
   {
-    myPlayButton->setIcon( aResourceMgr->loadPixmap( "VISU", tr( "ICON_SLIDER_PAUSE" ) ) );
+    myPlayButton->setIcon( myPausePixmap );
 
-    int delay = int(5000.0 / double(mySpeedBox->value()));
+    int delay = int( 50.0 * mySpeedSlider->maximum() / mySpeedSlider->value() );
     myTimer->start( delay );
   }
   else
   {
     myTimer->stop();
-    myPlayButton->setIcon( aResourceMgr->loadPixmap( "VISU", tr( "ICON_SLIDER_PLAY" ) ) );
+    myPlayButton->setIcon( myPlayPixmap );
+  }
+}
+
+
+//----------------------------------------------------------------------------
+void VisuGUI_Slider::onToggleView( bool on )
+{
+  if ( !on ) {
+    onPlay( on );
   }
 }
 
+
+//----------------------------------------------------------------------------
 void VisuGUI_Slider::onNext()
 {
   int value = mySlider->value() + 1;
@@ -401,34 +575,46 @@ void VisuGUI_Slider::onNext()
     mySlider->setValue( value );
 }
 
+
+//----------------------------------------------------------------------------
 void VisuGUI_Slider::onLast()
 {
   int value = mySlider->maximum();
   mySlider->setValue( value );
 }
 
+
+//----------------------------------------------------------------------------
 void VisuGUI_Slider::onValueChanged( int value )
 {
-  if( checkHolderList() ){
+  if ( checkHolderList() ) {
     enableControls( false );
     return;
   }
 
   myTimeStampStrings->setCurrentIndex( value );
-  myTimeStampIndices->setCurrentIndex( value );
+  myTimeStampIndexes->setCurrentIndex( value );
 
   VISU::ColoredPrs3dHolder_var aHolder = myHolderList.front();
 
   VISU::ColoredPrs3dHolder::TimeStampsRange_var aTimeStampsRange = aHolder->GetTimeStampsRange();
   CORBA::Long aLength = aTimeStampsRange->length();
-  if(value < 0 || aLength <= value)
+  if ( value < 0 || aLength <= value )
     return;
 
   VISU::ColoredPrs3dHolder::BasicInput_var anInput = aHolder->GetBasicInput();
   CORBA::Long aTimeStampNumber = anInput->myTimeStampNumber;
   CORBA::Long aNumber = aTimeStampsRange[ value ].myNumber;
-  if(aNumber == aTimeStampNumber)
+  if ( aNumber == aTimeStampNumber )
+    return;
+
+  VISU::View_var aView = myViewManager->GetCurrentView();
+  if ( CORBA::is_nil( aView.in() ) ) {
+    enableControls( false );
     return;
+  }
+
+  VISU::View3D_var aView3D = VISU::View3D::_narrow( aView );
 
   THolderList::const_iterator anIter = myHolderList.begin();
   THolderList::const_iterator anIterEnd = myHolderList.end();
@@ -444,27 +630,40 @@ void VisuGUI_Slider::onValueChanged( int value )
 
     QApplication::setOverrideCursor(Qt::WaitCursor);
     
-    aHolder->Apply( aPrs3d, anInput, myView3D );
+    aHolder->Apply( aPrs3d, anInput, aView3D );
     
     QApplication::restoreOverrideCursor();
   }
 
+  aView3D->Destroy();
+
   updateMemoryState();
 }
 
+
+//----------------------------------------------------------------------------
 void VisuGUI_Slider::onSpeedChanged( int value )
 {
   if(myPlayButton->isChecked()){
-    int delay = int(5000.0 / double(mySpeedBox->value()));
+    int delay = int( 50.0 * mySpeedSlider->maximum() / mySpeedSlider->value() );
     myTimer->start( delay );
   }
 }
 
+
+//----------------------------------------------------------------------------
 void VisuGUI_Slider::onTimeout()
 {
   int value = mySlider->value();
-  if( value < mySlider->maximum() )
+  if ( value < mySlider->maximum() ) {
     onNext();
-  else
-    myPlayButton->setChecked( false );
+  } else {
+    if ( myIsCycled->isChecked() )
+      onFirst();
+    else
+      myPlayButton->setChecked( false );
+  }
 }
+
+
+//----------------------------------------------------------------------------
index 1347b6503022db9dac9eb4fb27c19cede443c7d1..9bf08483b90b9c00881cb4127cc757d040e0d49a 100644 (file)
@@ -28,7 +28,9 @@
 #ifndef VisuGUI_Slider_HeaderFile
 #define VisuGUI_Slider_HeaderFile
 
-#include "QtxToolBar.h"
+#include <QWidget>
+#include <QPixmap>
+
 #include <vector>
 
 #include "SALOMEconfig.h"
@@ -45,24 +47,28 @@ class QLineEdit;
 class QToolButton;
 class QSlider;
 class QSpinBox;
+class QCheckBox;
+class QRadioButton;
+class QMainWindow;
 class QTimer;
 class QAction;
 
-class VVTK_ViewWindow;
-class VVTK_MainWindow;
+class QtxDoubleSpinBox;
 class LightApp_SelectionMgr;
+class VisuGUI;
 
-class VisuGUI_Module;
-
-class VisuGUI_Slider : public QtxToolBar
+class VisuGUI_Slider : public QWidget
 {
-  Q_OBJECT
+  Q_OBJECT;
 
 public:
-  VisuGUI_Slider( VisuGUI_Module* theModule, 
-                 VVTK_ViewWindow* theViewWindow,
+  VisuGUI_Slider( VisuGUI* theModule, 
+                 QMainWindow* theParent,
                  LightApp_SelectionMgr* theSelectionMgr );
+
   virtual ~VisuGUI_Slider();
+  
+  QAction* toggleViewAction();
 
 public slots:
   virtual void     onSelectionChanged();
@@ -81,29 +87,32 @@ public slots:
 
   virtual void     onTimeout();
 
+  virtual void     onToggleView( bool );
+
+  void onMemoryModeChanged( bool );
+  void onMemorySizeChanged( double );
+
+protected slots:
+  void onModuleDeactivated();
+  void onModuleActivated();
+
 protected:
   virtual void     enableControls( bool );
   virtual void     updateMemoryState();
   virtual bool     checkHolderList();
 
 private:
-  VisuGUI_Module*  myModule;
-  VVTK_MainWindow* myMainWindow;
   LightApp_SelectionMgr* mySelectionMgr;
-  VISU::View3D_var myView3D;
+  VISU::ViewManager_var  myViewManager;
+  VisuGUI*               myModule;
 
   QSlider*         mySlider;
   QLabel*          myFirstTimeStamp;
   QLabel*          myLastTimeStamp;
-  QLabel*          myTimeStampsNumber;
 
-  QLabel*          myCacheMemory;
-
-#ifdef ENABLE_AVI_AND_MORE_BUTTONS
-  QToolButton*     myMoreButton;
-  QToolButton*     myAVIButton;
-#endif
+  QWidget* myPlayTab;
 
+  QToolButton*     myIsCycled;
   QToolButton*     myFirstButton;
   QToolButton*     myPreviousButton;
   QToolButton*     myPlayButton;
@@ -111,16 +120,24 @@ private:
   QToolButton*     myLastButton;
 
   QComboBox*       myTimeStampStrings;
-  QComboBox*       myTimeStampIndices;
+  QComboBox*       myTimeStampIndexes;
+
+  QSlider*         mySpeedSlider;
 
-  QSpinBox*        mySpeedBox;
+  QRadioButton*     myMinimalMemoryButton;
+  QRadioButton*     myLimitedMemoryButton;
+  QtxDoubleSpinBox* myLimitedMemory;
 
-  QTimer*          myTimer;
+  QLineEdit*      myUsedMemory;
+  QLineEdit*      myFreeMemory;
 
   typedef std::vector<VISU::ColoredPrs3dHolder_var> THolderList;
-  THolderList      myHolderList;
+  THolderList     myHolderList;
   
-  QAction*         myWidgetAction;
+  QTimer*         myTimer;
+  QPixmap         myPlayPixmap;
+  QPixmap         myPausePixmap;
+  QAction*        myToggleViewAction;
 };
 
 #endif
diff --git a/src/VISUGUI/VisuGUI_Sweep.cxx b/src/VISUGUI/VisuGUI_Sweep.cxx
new file mode 100644 (file)
index 0000000..1b5ee03
--- /dev/null
@@ -0,0 +1,534 @@
+//  VISU VISUGUI : GUI of VISU component
+//
+//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+//
+//
+//  File   : VisuGUI_Slider.cxx
+//  Author : Oleg UVAROV
+//  Module : VISU
+
+#include "VisuGUI_Sweep.h"
+
+#include "SUIT_ResourceMgr.h"
+
+#include "LightApp_SelectionMgr.h"
+
+#include "VISU_Actor.h"
+
+#include "VisuGUI.h"
+#include "VisuGUI_Tools.h"
+#include "VISU_ColoredPrs3d_i.hh"
+#include "VISU_Actor.h"
+
+#include "QtxDockWidget.h"
+#include "QtxIntSpinBox.h"
+#include "QtxDoubleSpinBox.h"
+
+#include <QMainWindow>
+#include <QComboBox>
+#include <QFont>
+#include <QLabel>
+#include <QLayout>
+#include <QLineEdit>
+#include <QToolButton>
+#include <QToolTip>
+#include <QSlider>
+#include <QGroupBox>
+#include <QCheckBox>
+#include <QRadioButton>
+#include <QTimer>
+#include <QAction>
+
+#include <vtkMath.h>
+
+/*!
+  Constructor
+*/
+VisuGUI_Sweep::VisuGUI_Sweep( VisuGUI* theModule, 
+                             QMainWindow* theParent,
+                             LightApp_SelectionMgr* theSelectionMgr )
+  : QWidget( theParent )
+  , myModule( theModule )
+  , myViewWindow( NULL )
+{
+  setWindowTitle( tr("TITLE") );
+  setObjectName( tr("TITLE") );
+
+  SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
+
+  //----------------------------------------------------------------------------
+  QVBoxLayout* aVBoxLayout = new QVBoxLayout( this );
+
+  QTabWidget* aTabWidget = new QTabWidget( this );
+  aTabWidget->setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Fixed );
+  aVBoxLayout->addWidget( aTabWidget );
+
+  {
+    QWidget* aNavigationTab = new QWidget();
+    {
+      QVBoxLayout* aVBoxLayout = new QVBoxLayout( aNavigationTab );
+      {
+       QHBoxLayout* aHBoxLayout = new QHBoxLayout();
+       
+       QLabel* aStartSweepPosition = new QLabel( aNavigationTab );
+       aStartSweepPosition->setText( tr( "START_SWEEP_POSITION" ) );
+       aHBoxLayout->addWidget( aStartSweepPosition );
+      
+       mySweepSlider = new QSlider( aNavigationTab );
+       mySweepSlider->setOrientation( Qt::Horizontal );
+       mySweepSlider->setMinimum( 0 );
+       aHBoxLayout->addWidget( mySweepSlider );
+       
+       QLabel* anEndSweepPosition = new QLabel( aNavigationTab );
+       anEndSweepPosition->setText( tr( "END_SWEEP_POSITION" ) );
+       aHBoxLayout->addWidget( anEndSweepPosition );
+       
+       aVBoxLayout->addLayout( aHBoxLayout );
+      }
+      {
+       QHBoxLayout* aHBoxLayout = new QHBoxLayout();
+      
+       myFirstButton = new QToolButton( aNavigationTab );
+       myFirstButton->setIcon( aResourceMgr->loadPixmap( "VISU", tr( "ICON_SLIDER_FIRST" ) ) );
+       myFirstButton->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed );
+       connect( myFirstButton, SIGNAL( clicked() ), SLOT( onFirst() ) );
+       aHBoxLayout->addWidget( myFirstButton );
+       
+       myPreviousButton = new QToolButton( aNavigationTab );
+       myPreviousButton->setIcon( aResourceMgr->loadPixmap( "VISU", tr( "ICON_SLIDER_PREVIOUS" ) ) );
+       myPreviousButton->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed );
+       connect( myPreviousButton, SIGNAL( clicked() ), SLOT( onPrevious() ) );
+       aHBoxLayout->addWidget( myPreviousButton );
+       
+       myPlayButton = new QToolButton( aNavigationTab );
+       myPlayButton->setIcon( aResourceMgr->loadPixmap( "VISU", tr( "ICON_SLIDER_PLAY" ) ) );
+       myPlayButton->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed );
+       myPlayButton->setCheckable( true );
+       aHBoxLayout->addWidget( myPlayButton );
+       
+       myNextButton = new QToolButton( aNavigationTab );
+       myNextButton->setIcon( aResourceMgr->loadPixmap( "VISU", tr( "ICON_SLIDER_NEXT" ) ) );
+       myNextButton->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed );
+       connect( myNextButton, SIGNAL( clicked() ), SLOT( onNext() ) );
+       aHBoxLayout->addWidget( myNextButton );
+       
+       myLastButton = new QToolButton( aNavigationTab );
+       myLastButton->setIcon( aResourceMgr->loadPixmap( "VISU", tr( "ICON_SLIDER_LAST" ) ) );
+       myLastButton->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed );
+       connect( myLastButton, SIGNAL( clicked() ), SLOT( onLast() ) );
+       aHBoxLayout->addWidget( myLastButton );
+       
+       aVBoxLayout->addLayout( aHBoxLayout );
+      }
+      {
+       QHBoxLayout* aHBoxLayout = new QHBoxLayout();
+      
+       QToolButton* aStopButton = new QToolButton( aNavigationTab );
+       aStopButton->setIcon( aResourceMgr->loadPixmap( "VISU", tr( "ICON_SWEEP_STOP" ) ) );
+       aStopButton->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed );
+       aStopButton->setCheckable( false );
+       connect( aStopButton, SIGNAL( clicked( ) ), SLOT( onStop( ) ) );
+       aHBoxLayout->addWidget( aStopButton );
+       
+       myIsCycled = new QCheckBox( aNavigationTab );
+       myIsCycled->setText( tr( "IS_CYCLED" ) );
+       myIsCycled->setChecked( true );
+       aHBoxLayout->addWidget( myIsCycled );
+       
+       aVBoxLayout->addLayout( aHBoxLayout );
+      }
+
+      aTabWidget->addTab( aNavigationTab, tr( "NAVIGATION_TAB" ) );
+    }
+  }
+  {
+    QWidget* aPropertiesTab = new QWidget();
+    {
+      QGridLayout* aGridLayout = new QGridLayout( aPropertiesTab );     
+      {
+       QHBoxLayout* aHBoxLayout = new QHBoxLayout();
+       
+       QLabel* aModeAnnotation = new QLabel( aPropertiesTab );
+       aModeAnnotation->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Preferred );
+       aModeAnnotation->setText( tr( "MODE" ) );
+       aHBoxLayout->addWidget( aModeAnnotation );
+       
+       mySweepMode = new QComboBox( aPropertiesTab );
+       mySweepMode->insertItems( 0, QStringList() 
+                                 << tr( "LINEAR" ) 
+                                 << tr( "COSINUSOIDAL" ) 
+                                 << tr( "SINUSOIDAL" ) );
+       mySweepMode->setCurrentIndex( aResourceMgr->integerValue( "VISU", "sweeping_modes", 0 ) );
+       aHBoxLayout->addWidget( mySweepMode );
+       
+       myIntervals = new QComboBox( aPropertiesTab );
+       myIntervals->insertItems( 0, QStringList() 
+                                 << tr( "[ 0, +PI ]" ) 
+                                 << tr( "[ -PI, +PI ]" ) );
+       myIntervals->setCurrentIndex( aResourceMgr->integerValue( "VISU", "sweeping_is2PI", 0 ) );
+       aHBoxLayout->addWidget( myIntervals );
+       
+       aGridLayout->addLayout( aHBoxLayout, 0, 0, 1, 2 );
+      }
+      
+      QLabel* aNumberOfStepsAnnotation = new QLabel( aPropertiesTab );
+      aNumberOfStepsAnnotation->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Preferred );
+      aNumberOfStepsAnnotation->setText( tr( "NUMBER_OF_STEPS" ) );
+      aGridLayout->addWidget( aNumberOfStepsAnnotation, 1, 0, 1, 1 );
+      
+      myNumberOfSteps = new QtxIntSpinBox( aPropertiesTab );
+      connect( myNumberOfSteps, SIGNAL( valueChanged( int ) ), SLOT( onNumberOfStepsChanged( int ) ) );
+      myNumberOfSteps->setValue( aResourceMgr->integerValue( "VISU", "sweeping_number_steps", 40 ) );
+      aGridLayout->addWidget( myNumberOfSteps, 1, 1, 1, 1 );
+      
+      QLabel* aStepDelayAnnotation = new QLabel( aPropertiesTab );
+      aStepDelayAnnotation->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Preferred );
+      aStepDelayAnnotation->setText( tr( "DELAY_BETWEEN_STEPS" ) );
+      aGridLayout->addWidget( aStepDelayAnnotation, 2, 0, 1, 1 );
+      
+      myStepDelay = new QtxDoubleSpinBox( aPropertiesTab );
+      myStepDelay->setValue( aResourceMgr->doubleValue("VISU", "sweeping_time_step", 0.1) );
+      aGridLayout->addWidget( myStepDelay, 2, 1, 1, 1 );
+    }
+
+    aTabWidget->addTab( aPropertiesTab, tr( "PROPERTIES_TAB" ) );
+  }
+
+  {
+    QSpacerItem* aSpacerItem = new QSpacerItem( 16, 20, QSizePolicy::Minimum, QSizePolicy::Expanding );
+    aVBoxLayout->addItem( aSpacerItem );
+  }
+
+
+  //----------------------------------------------------------------------------
+  QtxDockWidget* aQtxDockWidget = new QtxDockWidget( true, theParent );
+  theParent->addDockWidget( Qt::BottomDockWidgetArea , aQtxDockWidget );
+  aQtxDockWidget->setObjectName( objectName() );
+  aQtxDockWidget->setWidget( this );
+
+  myToggleViewAction = aQtxDockWidget->toggleViewAction();
+  myToggleViewAction->setIcon( QIcon( aResourceMgr->loadPixmap( "VISU", tr( "ICON_SWEEP_PANEL" ) ) ) );
+  myToggleViewAction->setToolTip( tr( "MEN_SWEEP_PANE" ) );
+  myToggleViewAction->setText( tr( "MEN_SWEEP_PANE" ) );
+  myToggleViewAction->setCheckable( true );
+  aQtxDockWidget->setVisible( false );
+
+  connect( myToggleViewAction, SIGNAL( toggled( bool ) ), this, SLOT( onToggleView( bool ) ) );
+
+  //----------------------------------------------------------------------------
+  myTimer = new QTimer( this );
+
+  myPlayPixmap = aResourceMgr->loadPixmap( "VISU", tr( "ICON_SLIDER_PLAY" ) );
+  myPausePixmap = aResourceMgr->loadPixmap( "VISU", tr( "ICON_SLIDER_PAUSE" ) );
+
+  connect( myTimer, SIGNAL( timeout() ), SLOT( onTimeout() ) );
+
+  connect( myPlayButton, SIGNAL( toggled( bool ) ), SLOT( onPlay( bool ) ) );
+
+  connect( mySweepSlider, SIGNAL( valueChanged( int ) ), SLOT( onValueChanged( int ) ) );
+
+  connect( myStepDelay, SIGNAL( valueChanged( double ) ), SLOT( onDelayChanged( double ) ) );
+
+  connect( mySweepMode, SIGNAL( currentIndexChanged( int ) ), SLOT( onModeChanged( int ) ) );
+
+  connect( theModule, SIGNAL( moduleDeactivated() ), SLOT( onModuleDeactivated() ) );
+
+  connect( theModule, SIGNAL( moduleActivated() ), SLOT( onModuleActivated() ) );
+
+  connect( theSelectionMgr, SIGNAL( currentSelectionChanged() ), SLOT( onSelectionChanged() ) );
+
+  onSelectionChanged();
+  
+  onModeChanged( mySweepMode->currentIndex() );
+}
+
+
+//----------------------------------------------------------------------------
+VisuGUI_Sweep::~VisuGUI_Sweep()
+{}
+
+
+//----------------------------------------------------------------------------
+QAction* VisuGUI_Sweep::toggleViewAction()
+{
+  return myToggleViewAction;
+}
+
+
+//----------------------------------------------------------------------------
+void VisuGUI_Sweep::onModuleDeactivated()
+{
+  setHidden( true );
+
+  onEnable( true );
+}
+
+
+//----------------------------------------------------------------------------
+void VisuGUI_Sweep::onModuleActivated()
+{
+  setHidden( false );
+}
+
+
+//----------------------------------------------------------------------------
+namespace
+{
+  struct TEnabler
+  {
+    VisuGUI_Sweep* myWidget;
+    bool& myIsValidSelection;
+
+    TEnabler( VisuGUI_Sweep* theWidget, bool& theIsValidSelection )
+      : myWidget( theWidget )
+      , myIsValidSelection( theIsValidSelection )
+    {}
+    
+    ~TEnabler()
+    {
+      myWidget->onEnable( !myIsValidSelection );
+    }
+  };
+}
+
+
+//----------------------------------------------------------------------------
+void VisuGUI_Sweep::onSelectionChanged()
+{
+  VISU_Actor* anActor = NULL;
+  VISU::Prs3d_i* aPrs3d = NULL;
+  SVTK_ViewWindow* aViewWindow = NULL;
+
+  bool anIsValidSelection = VISU::GetPrs3dSelectionInfo( myModule, aPrs3d, aViewWindow, anActor );
+
+  // To instantiate special helper class which will analyze validity of selection 
+  // and make appropritate actions
+  TEnabler anEnabler( this, anIsValidSelection );
+
+  anIsValidSelection &= bool( aViewWindow );
+
+  // To keep the pointer on the view window properly it is necessary to get known when
+  // it will be destroyed
+  if ( myViewWindow != aViewWindow ) {
+    if ( myViewWindow )
+      disconnect( myViewWindow, SIGNAL( destroyed( QObject * ) ), this, SLOT( onSelectionChanged() ) );
+
+    myViewWindow = aViewWindow;
+
+    if ( myViewWindow )
+      connect( myViewWindow, SIGNAL( destroyed( QObject * ) ), this, SLOT( onSelectionChanged() ) );
+  }
+
+  VISU::ColoredPrs3d_i* aColoredPrs3d = dynamic_cast< VISU::ColoredPrs3d_i* >( aPrs3d );
+  anIsValidSelection &= ( aColoredPrs3d && aColoredPrs3d->IsTimeStampFixed() );
+
+  if ( myColoredPrs3d ) {
+    myColoredPrs3d->SetMapScale( 1.0 );
+    myColoredPrs3d->UpdateActors();
+  }
+
+  myColoredPrs3d = aColoredPrs3d;
+
+  anIsValidSelection &= ( anActor && anActor->GetVisibility() );
+
+  myActor = anActor;
+}
+
+
+//----------------------------------------------------------------------------
+void VisuGUI_Sweep::onValueChanged( int value )
+{
+  bool anIsValidSelection = ( myColoredPrs3d && myActor.GetPointer() );
+
+  if ( !anIsValidSelection )
+    return;
+
+  QApplication::setOverrideCursor(Qt::WaitCursor);
+
+  int aSweepMode = mySweepMode->currentIndex();
+  int aNbSteps = myNumberOfSteps->value();
+  
+  double anArgument = double( value ) / aNbSteps;
+
+  int anIntervalMode = myIntervals->currentIndex();
+  // To correct the input value according to the given interval mode
+  if ( aSweepMode != 0 ) {
+    switch ( anIntervalMode ) {
+    case 0 :
+      anArgument = vtkMath::Pi() * anArgument;
+      break;
+    case 1 :
+      anArgument = -vtkMath::Pi() + 2.0 * vtkMath::Pi() * anArgument;
+      break;
+    default :
+      break;
+    }
+  }
+  
+  // To correct the input value according to the given sweep mode
+  double aValue = anArgument;
+  switch ( aSweepMode ) {
+  case 1 :
+    aValue = ( 1.0 - cos( anArgument ) ) / 2.0;
+    break;
+  case 2 :
+    aValue = sin( anArgument - vtkMath::Pi() / 2.0 );
+    break;
+  default :
+    break;
+  }
+
+  try {
+    myColoredPrs3d->SetMapScale( aValue );
+    myColoredPrs3d->UpdateActor( myActor );
+    myViewWindow->Repaint();
+  } catch (std::exception& exc) {
+    INFOS( "Follow exception was occured :\n" << exc.what() );
+  } catch (...) {
+    INFOS( "Unknown exception was occured!" );
+  }
+
+  QApplication::restoreOverrideCursor();
+}
+
+
+//----------------------------------------------------------------------------
+void VisuGUI_Sweep::onDelayChanged( double value )
+{
+  myTimer->start( int( value * 1000 ) );
+}
+
+
+//----------------------------------------------------------------------------
+void VisuGUI_Sweep::onNumberOfStepsChanged( int value )
+{
+  int anOldNumberOfSteps = mySweepSlider->maximum();
+  mySweepSlider->setMaximum( value );
+
+  double aValue = double( value );
+
+  double aNewSweepValue = aValue / anOldNumberOfSteps * mySweepSlider->value();
+  mySweepSlider->setValue( int( aNewSweepValue + 1 ) );
+
+  double aNewPageStep = aValue / 10;
+  mySweepSlider->setPageStep( int( aNewPageStep + 1 ) );
+}
+
+
+//----------------------------------------------------------------------------
+void VisuGUI_Sweep::onModeChanged( int )
+{
+  myIntervals->setEnabled( mySweepMode->currentIndex() != 0 );
+}
+
+
+//----------------------------------------------------------------------------
+void VisuGUI_Sweep::onFirst()
+{
+  mySweepSlider->setValue( mySweepSlider->minimum() );
+}
+
+
+//----------------------------------------------------------------------------
+void VisuGUI_Sweep::onPrevious()
+{
+  mySweepSlider->setValue( mySweepSlider->value() - 1 );
+}
+
+void VisuGUI_Sweep::onNext()
+{
+  mySweepSlider->setValue( mySweepSlider->value() + 1 );
+}
+
+void VisuGUI_Sweep::onLast()
+{
+  mySweepSlider->setValue( mySweepSlider->maximum() );
+}
+
+//----------------------------------------------------------------------------
+void VisuGUI_Sweep::onPlay( bool on )
+{
+  if ( on ) {
+    myPlayButton->setIcon( myPausePixmap );
+    myTimer->start( int( myStepDelay->value() * 1000 ) );
+    myPlayButton->setChecked( true );
+  } else {
+    myTimer->stop();
+    myPlayButton->setChecked( false );
+    myPlayButton->setIcon( myPlayPixmap );
+  }
+}
+
+
+//----------------------------------------------------------------------------
+void VisuGUI_Sweep::onToggleView( bool on )
+{
+  if ( !on ) {
+    onPlay( on );
+  }
+}
+
+
+//----------------------------------------------------------------------------
+void VisuGUI_Sweep::onStop()
+{
+  onPlay( false );
+  mySweepSlider->setValue( mySweepSlider->maximum() );
+
+  if ( myViewWindow )
+    myViewWindow->Repaint();
+}
+
+
+//----------------------------------------------------------------------------
+void VisuGUI_Sweep::onEnable( bool on )
+{
+  onStop();
+
+  mySweepSlider->setEnabled( !on );
+  
+  myFirstButton->setEnabled( !on );
+  myPreviousButton->setEnabled( !on );
+  
+  myPlayButton->setEnabled( !on );
+  
+  myNextButton->setEnabled( !on );
+  myLastButton->setEnabled( !on );
+}
+
+
+//----------------------------------------------------------------------------
+void VisuGUI_Sweep::onTimeout()
+{
+  int value = mySweepSlider->value();
+  if ( value < mySweepSlider->maximum() ) {
+    mySweepSlider->setValue( value + 1 );
+  } else {
+    if ( myIsCycled->isChecked() )
+      mySweepSlider->setValue( 0 );
+    else
+      myPlayButton->setChecked( false );
+    //myStopButton->setEnabled( false );
+  }
+}
+
+
+//----------------------------------------------------------------------------
diff --git a/src/VISUGUI/VisuGUI_Sweep.h b/src/VISUGUI/VisuGUI_Sweep.h
new file mode 100644 (file)
index 0000000..0911747
--- /dev/null
@@ -0,0 +1,142 @@
+//  VISU VISUGUI : GUI of VISU component
+//
+//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+//
+//
+//  File   : VisuGUI_Sweep.h
+//  Author : Oleg UVAROV
+//  Module : VISU
+
+#ifndef VisuGUI_Sweep_HeaderFile
+#define VisuGUI_Sweep_HeaderFile
+
+#include "SALOME_GenericObjPointer.hh"
+
+#include <vtkSmartPointer.h>
+
+#include <QWidget>
+#include <QPixmap>
+
+class QComboBox;
+class QToolButton;
+class QSlider;
+class QSpinBox;
+class QCheckBox;
+class QMainWindow;
+class QTimer;
+class QAction;
+
+class QtxIntSpinBox;
+class QtxDoubleSpinBox;
+
+class LightApp_SelectionMgr;
+class SVTK_ViewWindow;
+class VISU_Actor;
+class VisuGUI;
+
+
+namespace VISU
+{
+  class ColoredPrs3d_i;
+}
+
+
+//----------------------------------------------------------------------------
+class VisuGUI_Sweep : public QWidget
+{
+  Q_OBJECT;
+
+public:
+  VisuGUI_Sweep( VisuGUI* theModule, 
+                QMainWindow* theParent,
+                LightApp_SelectionMgr* theSelectionMgr );
+
+  virtual ~VisuGUI_Sweep();
+
+  QAction* toggleViewAction();
+
+public slots:
+  virtual void     onSelectionChanged();
+
+  virtual void     onFirst();
+
+  virtual void     onPrevious();
+
+  virtual void     onPlay( bool );
+
+  virtual void     onNext();
+
+  virtual void     onLast();
+
+  virtual void     onStop();
+
+  virtual void     onEnable( bool );
+
+  virtual void     onValueChanged( int );
+
+  virtual void     onDelayChanged( double );
+
+  virtual void     onNumberOfStepsChanged( int );
+
+  virtual void     onModeChanged( int );
+
+  virtual void     onTimeout();
+
+  virtual void     onToggleView( bool );
+
+  void             onModuleDeactivated();
+
+  void             onModuleActivated();
+
+private:
+  QSlider*          mySweepSlider;
+
+  QToolButton*      myFirstButton;
+  QToolButton*      myPreviousButton;
+  QToolButton*      myPlayButton;
+  QToolButton*      myNextButton;
+  QToolButton*      myLastButton;
+
+  QCheckBox*        myIsCycled;
+
+  QComboBox*        mySweepMode;
+  QtxIntSpinBox*    myNumberOfSteps;
+
+  QComboBox*        myIntervals;
+  QtxDoubleSpinBox* myStepDelay;
+
+  QTimer*           myTimer;
+  QPixmap           myPlayPixmap;
+  QPixmap           myPausePixmap;
+  QAction*          myToggleViewAction;
+
+  VisuGUI*          myModule;
+  SVTK_ViewWindow*  myViewWindow;
+
+  vtkSmartPointer< VISU_Actor > myActor;
+  SALOME::GenericObjPtr< VISU::ColoredPrs3d_i > myColoredPrs3d;
+};
+
+
+//----------------------------------------------------------------------------
+
+
+#endif
index 678fd590b4e1796dd56d4f501d9f33ee3a641f01..07b5fa49e2229ce476fece649e69db9d4875baf0 100644 (file)
@@ -37,7 +37,7 @@
 #include "VISU_Prs3d_i.hh"
 #include "VISU_Result_i.hh"
 #include "VISU_Table_i.hh"
-#include "VISU_Mesh_i.hh"
+//#include "VISU_Mesh_i.hh"
 #include "VISU_ViewManager_i.hh"
 
 #include "VISU_Actor.h"
@@ -1177,8 +1177,7 @@ namespace VISU
 
   //************************************************************
   // Others
-
-  void
+  VISU::Mesh_i*
   CreateMesh(VisuGUI* theModule,
             const Handle(SALOME_InteractiveObject)& theIO,
             SVTK_ViewWindow* theViewWindow)
@@ -1193,11 +1192,11 @@ namespace VISU
     VISU::Result_var aResult;
     VISU::Result_i* pResult = CheckResult(theModule, aResultSObj, aResult);
     if (pResult == NULL)
-      return;
+      return NULL;
 
     Storable::TRestoringMap aMap = Storable::GetStorableMap(aResultSObj);
     if (aMap.empty())
-      return;
+      return NULL;
 
     CORBA::Object_var aMesh;
     string aComment = Storable::FindValue(aMap,"myComment").toLatin1().data();
@@ -1235,7 +1234,7 @@ namespace VISU
       SUIT_MessageBox::warning (GetDesktop(theModule),
                                 QObject::tr("WRN_VISU"),
                                 QObject::tr("ERR_CANT_BUILD_PRESENTATION") );
-      return;
+      return NULL;
     }
 
     if (theViewWindow) {
@@ -1269,6 +1268,7 @@ namespace VISU
     theModule->application()->putInfo(QObject::tr("INF_DONE"));
     // Make "Save" button active
     theModule->getApp()->updateActions();
+    return pPresent;
   }
 
   // ========================================================================================
@@ -1311,6 +1311,7 @@ namespace VISU
         case VISU::TPLOT3D:
        case VISU::TSCALARMAPONDEFORMEDSHAPE:
        case VISU::TDEFORMEDSHAPEANDSCALARMAP:
+       case VISU::TMESH:
           {
             PortableServer::ServantBase_var aServant = VISU::GetServant(aCORBAObject);
             if (aServant.in()) {
@@ -1447,4 +1448,21 @@ namespace VISU
     spinBox->setDecimals( decimals );
   }
   //------------------------------------------------------------
+  bool getClippingPlanesFolder(_PTR(Study) theStudy, _PTR(SObject)& theSObject)
+  {
+    _PTR(SComponent) aVisuSO = theStudy->FindComponent("VISU");
+    if (!aVisuSO) return false;
+    _PTR(SObject) aFolder = theStudy->FindObject(CLIP_PLANES_FOLDER);
+    if (!aFolder) {
+      _PTR(StudyBuilder) aBuilder = theStudy->NewBuilder();
+      aFolder = aBuilder->NewObject(aVisuSO);
+      
+      _PTR(GenericAttribute) anAttr;
+      anAttr = aBuilder->FindOrCreateAttribute(aFolder,"AttributeName");
+      _PTR(AttributeName) aName(anAttr);
+      aName->SetValue(CLIP_PLANES_FOLDER);
+    }
+    theSObject = aFolder;
+    return true;
+  }
 }
index e5d8510b97b03ae2b32d713aab757db9a1cc4e52..156b9a3611d11b3dbe62cfe4818f3f102810f456 100644 (file)
@@ -58,6 +58,7 @@ class VisuGUI;
 
 #include <vector>
 #include <utility>
+#include "VISU_Mesh_i.hh"
 
 namespace VISU 
 {
@@ -121,6 +122,11 @@ namespace VISU
 
   VISU::Prs3d_i*                       GetPrs3dFromBase(Base_i* theBase);
 
+  bool                                 GetPrs3dSelectionInfo( const SalomeApp_Module* theModule,
+                                                             VISU::Prs3d_i*& thePrs3d,
+                                                             SVTK_ViewWindow*& theViewWindow,
+                                                             VISU_Actor*& thenActor );
+
   //----------------------------------------------------------------------------
   void                                 Add(LightApp_SelectionMgr* theSelectionMgr,
                                           const Handle(SALOME_InteractiveObject)& theIO);
@@ -215,9 +221,9 @@ namespace VISU
   /*! Create mesh presentation and display it in \a theViewWindow.
    *  If \a theViewWindow is NULL, no displaying will be done.
    */
-  void CreateMesh(VisuGUI* theModule,
-                 const Handle(SALOME_InteractiveObject)& theIO,
-                 SVTK_ViewWindow* theViewWindow);
+  VISU::Mesh_i* CreateMesh(VisuGUI* theModule,
+                          const Handle(SALOME_InteractiveObject)& theIO,
+                          SVTK_ViewWindow* theViewWindow);
   
   // Others
   std::vector<VISU::Prs3d_i*> GetPrs3dList (const SalomeApp_Module* theModule,
@@ -232,6 +238,10 @@ namespace VISU
                               VISU::Prs3d_i* thePrs3d);
   void initSpinBox( QSpinBox*, int, int, int = 1 );
   void initSpinBox( QDoubleSpinBox*, double, double, double = 0.1, int = 6 );
+
+#define CLIP_PLANES_FOLDER "Clipping Planes"
+
+  bool getClippingPlanesFolder(_PTR(Study) theStudy, _PTR(SObject)& theSObject);
 }
 
 #endif
diff --git a/src/VISUGUI/VisuGUI_ViewExtender.cxx b/src/VISUGUI/VisuGUI_ViewExtender.cxx
new file mode 100644 (file)
index 0000000..21ab0c0
--- /dev/null
@@ -0,0 +1,149 @@
+//  VISU VISUGUI : GUI of VISU component
+//
+//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+//
+//
+//  File   : VisuGUI_ViewExtender.cxx
+//  Author : Vitaly Smetannikov
+//  Module : VISU
+
+
+
+#include "VisuGUI_ViewExtender.h"
+
+#include "VisuGUI.h"
+#include "VisuGUI_SegmentationMgr.h"
+#include "VisuGUI_ViewTools.h"
+#include "VisuGUI_Tools.h"
+#include <VTKViewer_Actor.h>
+
+#include <LightApp_SelectionMgr.h>
+#include <SalomeApp_Application.h>
+
+#include <VISU_PipeLine.hxx>
+#include <SUIT_ViewManager.h>
+#include <SUIT_ViewWindow.h>
+
+#include <SVTK_ViewModel.h>
+#include <SVTK_ViewWindow.h>
+
+
+
+//using namespace std;
+
+VisuGUI_ViewExtender::VisuGUI_ViewExtender(VisuGUI* theModule):
+  myModule(theModule)
+{
+}
+
+//****************************************************************
+VisuGUI_ViewExtender::~VisuGUI_ViewExtender()
+{
+  QMapIterator<SVTK_ViewWindow*, VisuGUI_SegmentationMgr*> aIt(myViewMgrMap);
+  while (aIt.hasNext()) {
+    aIt.next();
+    delete aIt.value();
+  }
+}
+
+//****************************************************************
+int VisuGUI_ViewExtender::createToolbar(SUIT_ViewWindow* theView)
+{
+  SVTK_ViewWindow* aViewWindow = dynamic_cast<SVTK_ViewWindow*>(theView);
+  if (!aViewWindow) return -1;
+
+  VisuGUI_SegmentationMgr* aMgr = getSegmentationMgr(aViewWindow);
+  return aMgr->createToolbar(theView->toolMgr());
+}
+
+//****************************************************************
+void VisuGUI_ViewExtender::contextMenuPopup(QMenu* theMenu)
+{
+//   SVTK_ViewWindow* aViewWindow = VISU::GetActiveViewWindow<SVTK_ViewWindow>(myModule);
+//   if (!aViewWindow) return;
+
+//   SalomeApp_Application* anApp = myModule->getApp();
+//   LightApp_SelectionMgr* aSelectionMgr = VISU::GetSelectionMgr(myModule);
+//   myListIO.Clear();
+//   aSelectionMgr->selectedObjects(myListIO);
+//   if (myListIO.IsEmpty()) return;
+
+//   theMenu->addSeparator();
+//   theMenu->addAction(tr("VISU_SETPLANES_MNU"), this, SLOT(onSetPlanes()));
+}
+
+
+//****************************************************************
+void VisuGUI_ViewExtender::activate(SUIT_ViewModel* theViewer)
+{
+  // Connect to signal on destroy ViewWindow
+  SVTK_Viewer* aViewer = dynamic_cast<SVTK_Viewer*>(theViewer);
+  if (aViewer) {
+    if (!myViewers.contains(aViewer)) {
+      SUIT_ViewManager* aMgr = aViewer->getViewManager();
+      connect(aMgr, SIGNAL(deleteView(SUIT_ViewWindow*)), 
+             this, SLOT(onViewDeleted(SUIT_ViewWindow*)));
+      connect(aViewer, SIGNAL(actorAdded(SVTK_ViewWindow*, VTKViewer_Actor*)), 
+             this, SLOT(onAddActor(SVTK_ViewWindow*, VTKViewer_Actor*)));
+      myViewers.append(aViewer);
+    }
+  }
+}
+
+//****************************************************************
+void VisuGUI_ViewExtender::deactivate(SUIT_ViewModel*)
+{
+  QMapIterator<SVTK_ViewWindow*, VisuGUI_SegmentationMgr*> aIt(myViewMgrMap);
+  while (aIt.hasNext()) {
+    aIt.next();
+    aIt.value()->deactivate();
+  }
+}
+
+
+//****************************************************************
+VisuGUI_SegmentationMgr* VisuGUI_ViewExtender::getSegmentationMgr(SVTK_ViewWindow* theWindow)
+{
+  if (myViewMgrMap.contains(theWindow)) 
+    return myViewMgrMap[theWindow];
+  
+  VisuGUI_SegmentationMgr* aMgr = new VisuGUI_SegmentationMgr(myModule, theWindow);
+  myViewMgrMap[theWindow] = aMgr;
+  return aMgr;
+}
+
+//****************************************************************
+void VisuGUI_ViewExtender::onViewDeleted(SUIT_ViewWindow* theWindow)
+{
+  SVTK_ViewWindow* aWindow = dynamic_cast<SVTK_ViewWindow*>(theWindow);
+  if (!aWindow) return;
+
+  if (!myViewMgrMap.contains(aWindow)) return;
+  delete myViewMgrMap[aWindow];
+  myViewMgrMap.remove(aWindow);
+}
+
+//****************************************************************
+void VisuGUI_ViewExtender::onAddActor(SVTK_ViewWindow* theWindow, VTKViewer_Actor* theActor)
+{
+  if (!myViewMgrMap.contains(theWindow)) return;
+  myViewMgrMap[theWindow]->onAddActor(theActor);
+}
diff --git a/src/VISUGUI/VisuGUI_ViewExtender.h b/src/VISUGUI/VisuGUI_ViewExtender.h
new file mode 100644 (file)
index 0000000..2193a38
--- /dev/null
@@ -0,0 +1,93 @@
+//  VISU VISUGUI : GUI of VISU component
+//
+//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+//
+//
+//  File   : VisuGUI_ViewExtender.h
+//  Author : Vitaly Smetannikov
+//  Module : VISU
+
+
+#ifndef VisuGUI_ViewExtender_HeaderFile
+#define VisuGUI_ViewExtender_HeaderFile
+
+#include <CAM_ViewExtender.h>
+#include <SALOME_ListIO.hxx>
+#include <QObject>
+#include <QMap>
+
+class VisuGUI;
+//class QtxAction;
+//class QDialog;
+
+class VisuGUI_SegmentationMgr;
+class SVTK_Viewer;
+class SVTK_ViewWindow;
+class SUIT_ViewWindow;
+class VTKViewer_Actor;
+
+
+class VisuGUI_ViewExtender:  public QObject, public CAM_ViewExtender
+{
+  Q_OBJECT
+
+ public:
+  VisuGUI_ViewExtender(VisuGUI* theModule);
+
+  virtual ~VisuGUI_ViewExtender();
+
+  virtual int createToolbar(SUIT_ViewWindow* theView);
+  virtual void contextMenuPopup(QMenu* theMenu);
+
+  virtual void activate(SUIT_ViewModel*);
+  virtual void deactivate(SUIT_ViewModel*);
+
+  VisuGUI_SegmentationMgr* getSegmentationMgr(SVTK_ViewWindow* theWindow);
+
+private slots:
+  //  void onPlanesMgr();
+  // void onDialogDestroy(); 
+  // void onShowPlanes(bool);
+  // void onDeactivatePlanes(bool);
+ void onViewDeleted(SUIT_ViewWindow* theWindow);
+ void onAddActor(SVTK_ViewWindow* theWindow, VTKViewer_Actor* theActor);
+
+ private:
+
+ //enum { ClippingPlaneMgrId, ShowClippingPlanesId, DeactivateClippingPlanesId };
+
+ //QMap<int, QtxAction*> myActionsMap;
+  VisuGUI* myModule;
+
+  //QDialog* myNonModalDlg;
+
+  //VisuGUI_SegmentationMgr* mySegmentationMgr;
+  QMap<SVTK_ViewWindow*, VisuGUI_SegmentationMgr*> myViewMgrMap;
+
+  QList<SVTK_Viewer*> myViewers;
+
+  //SALOME_ListIO myListIO;
+  
+};
+
+
+#endif
index d61e29bb7927256864455d53adae904a3ba5cbfa..55e733fa86b92b15dfabc0a67f2057ea01760f68 100644 (file)
@@ -42,8 +42,8 @@
 #include "SalomeApp_Module.h"
 #include "SalomeApp_Application.h"
 
-#include "VVTK_ViewModel.h"
-#include "VVTK_ViewWindow.h"
+//#include "VVTK_ViewModel.h"
+//#include "VVTK_ViewWindow.h"
 
 #include "SVTK_Functor.h"
 #include "SVTK_ViewModel.h"
@@ -65,7 +65,7 @@
 #include <vtkActorCollection.h>
 #include <vtkRenderer.h>
 
-class VVTK_Viewer;
+//class VVTK_Viewer;
 
 namespace VISU 
 {
index bb8bd237cb91644ef077c020676dd758d0552171..b6b07c848f9a66bc586c2d31307480288fdcba51 100644 (file)
@@ -60,7 +60,8 @@ salomeinclude_HEADERS = \
        VISU_MonoColorPrs_i.hh \
        VISU_Deformation_i.hh \
        VISU_OptionalDeformation_i.hh \
-       SALOME_GenericObjPointer.hh
+       SALOME_GenericObjPointer.hh \
+       VISU_ClippingPlaneMgr.hxx
 
 
 libVISUEngineImpl_la_SOURCES = \
@@ -97,7 +98,8 @@ libVISUEngineImpl_la_SOURCES = \
        VISU_MonoColorPrs_i.cc \
        VISU_Deformation_i.cc \
        VISU_OptionalDeformation_i.cc \
-       SALOME_GenericObjPointer.cc
+       SALOME_GenericObjPointer.cc \
+       VISU_ClippingPlaneMgr.cxx
 
 MOC_FILES = VISU_TimeAnimation_moc.cxx
 nodist_libVISUEngineImpl_la_SOURCES= $(MOC_FILES)
@@ -119,7 +121,6 @@ libVISUEngineImpl_la_CPPFLAGS= \
        -I$(srcdir)/../CONVERTOR \
        -I$(srcdir)/../PIPELINE \
        -I$(srcdir)/../OBJECT \
-       -I$(srcdir)/../VVTK \
        -I$(srcdir)/../GUITOOLS \
        -I$(top_builddir)/idl \
        -I$(top_builddir)/salome_adm/unix
@@ -154,7 +155,6 @@ libVISUEngineImpl_la_LIBADD= \
        ../CONVERTOR/libVisuConvertor.la \
        ../PIPELINE/libVisuPipeLine.la \
        ../OBJECT/libVisuObject.la \
-       ../VVTK/libVVTK.la \
        ../GUITOOLS/libVISUGUITOOLS.la
 
 if MED_ENABLE_MULTIPR
diff --git a/src/VISU_I/VISU_ClippingPlaneMgr.cxx b/src/VISU_I/VISU_ClippingPlaneMgr.cxx
new file mode 100644 (file)
index 0000000..f314d41
--- /dev/null
@@ -0,0 +1,507 @@
+//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
+// 
+//  This library is free software; you can redistribute it and/or 
+//  modify it under the terms of the GNU Lesser General Public 
+//  License as published by the Free Software Foundation; either 
+//  version 2.1 of the License. 
+// 
+//  This library is distributed in the hope that it will be useful, 
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of 
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
+//  Lesser General Public License for more details. 
+// 
+//  You should have received a copy of the GNU Lesser General Public 
+//  License along with this library; if not, write to the Free Software 
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
+// 
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+
+
+#include "VISU_ClippingPlaneMgr.hxx"
+#include "VISU_ColoredPrs3dHolder_i.hh"
+
+//#include CORBA_SERVER_HEADER(SALOMEDS)
+//#include CORBA_SERVER_HEADER(SALOMEDS_Attributes)
+
+#include "SALOMEDSClient_GenericAttribute.hxx"
+#include "SALOMEDSClient_AttributeName.hxx"
+#include "SALOMEDSClient_AttributeSequenceOfReal.hxx"
+#include "SALOMEDSClient_AttributeInteger.hxx"
+
+
+#include <vtkImplicitFunctionCollection.h>
+
+
+#define CLIP_PLANES_FOLDER "Clipping Planes"
+
+
+//*************************************************************
+VISU_ClippingPlaneMgr::VISU_ClippingPlaneMgr()
+{
+  myPlanes = vtkImplicitFunctionCollection::New();
+}
+
+//*************************************************************
+VISU_ClippingPlaneMgr::~VISU_ClippingPlaneMgr()
+{
+  myPlanes->Delete();
+}
+
+//*************************************************************
+void VISU_ClippingPlaneMgr::SetStudy(_PTR(Study) theStudy)
+{
+  myStudy = theStudy;
+  myPlanes->RemoveAllItems();
+  _PTR(SObject) aFolder = GetClippingPlanesFolder(false);
+  if (aFolder) {
+    _PTR(ChildIterator) aIter = myStudy->NewChildIterator(aFolder);
+    int i;
+    for (i = 0; aIter->More(); aIter->Next(), i++) { // For each plane
+      _PTR(SObject) aSObject = aIter->Value();
+      VISU_CutPlaneFunction* aPlane = VISU_CutPlaneFunction::New();
+      aPlane->setPlaneObject(aSObject);
+      aPlane->setName(aSObject->GetName());
+      
+      _PTR(GenericAttribute) anAttr;
+      if (aSObject->FindAttribute(anAttr, "AttributeSequenceOfReal")) {
+       _PTR(AttributeSequenceOfReal) aArray(anAttr);
+       aPlane->SetOrigin(aArray->Value(1), aArray->Value(2), aArray->Value(3));
+       aPlane->SetNormal(aArray->Value(4), aArray->Value(5), aArray->Value(6));
+      }
+      if (aSObject->FindAttribute(anAttr, "AttributeInteger")) {
+       _PTR(AttributeInteger) aFlag(anAttr);
+       aPlane->setAuto(aFlag->Value() == 1);
+      } else
+       aPlane->setAuto(false);
+
+      applyPlaneToAll(aPlane);
+      myPlanes->AddItem(aPlane);
+    }
+  }
+}
+
+
+void VISU_ClippingPlaneMgr::applyPlaneToAll(VISU_CutPlaneFunction* thePlane)
+{
+  _PTR(SComponent) aVisuSO = myStudy->FindComponent("VISU");
+  _PTR(ChildIterator) aChildIter = myStudy->NewChildIterator(aVisuSO);
+  for (aChildIter->InitEx(true); aChildIter->More(); aChildIter->Next()) {
+    _PTR(SObject) aSObject = aChildIter->Value();
+    CORBA::Object_var anObject = VISU::ClientSObjectToObject(aSObject);
+    if(VISU::Base_i* aBase = dynamic_cast<VISU::Base_i*>(VISU::GetServant(anObject).in())) {
+      VISU::Prs3d_i* aPrs;
+      if(aBase->GetType() == VISU::TCOLOREDPRS3DHOLDER){
+       CORBA::Object_var anObject = aBase->_this();
+       VISU::ColoredPrs3dHolder_var aHolder = VISU::ColoredPrs3dHolder::_narrow(anObject);
+       VISU::Prs3d_var aPrs3d = aHolder->GetDevice();
+       aPrs = dynamic_cast<VISU::Prs3d_i*>(VISU::GetServant(aPrs3d).in());
+      } else {
+       aPrs = dynamic_cast<VISU::Prs3d_i*>(aBase);
+      }
+      if (aPrs) {
+       if (!ContainsPlane(aPrs, thePlane)) {
+         if (thePlane->isAuto())
+           aPrs->AddClippingPlane(thePlane);
+         else {
+           string aPrsEntry = aPrs->GetEntry();
+           if (aPrsEntry.length() == 0) {
+             VISU::ColoredPrs3d_i* aColPrs = dynamic_cast<VISU::ColoredPrs3d_i*>(aPrs);
+             if (aColPrs)
+               aPrsEntry = aColPrs->GetHolderEntry();
+           }
+           
+           _PTR(SObject) aSObject = thePlane->getPlaneObject();
+           _PTR(ChildIterator) aRefIter = myStudy->NewChildIterator(aSObject);   
+           for (; aRefIter->More(); aRefIter->Next()) {
+             _PTR(SObject) aObj = aRefIter->Value();
+             _PTR(SObject) aRefPrsObject;
+             if (aObj->ReferencedObject(aRefPrsObject)) { // If it is referenced on current plane
+               if (aRefPrsObject->GetID() == aPrsEntry) {
+                 aPrs->AddClippingPlane(thePlane);
+               }
+             }
+           }
+         }
+       }
+      }
+    }
+  } 
+}
+
+//*************************************************************
+long VISU_ClippingPlaneMgr::CreateClippingPlane(double X,double  Y, double Z, 
+                                               double dX, double dY, double dZ, 
+                                               bool isAuto, const char* name)
+{
+  _PTR(SObject) aObjPtr = CreateClippingPlaneObject(X, Y, Z, dX, dY, dZ, isAuto, name);
+  return myPlanes->GetNumberOfItems() - 1;
+}
+
+
+//*************************************************************
+_PTR(SObject) VISU_ClippingPlaneMgr::CreateClippingPlaneObject(double X,double  Y, double Z, 
+                                                              double dX, double dY, double dZ, 
+                                                              bool isAuto, const char* name)
+{
+  _PTR(SObject) aPlaneObj;
+  if(!myStudy->GetProperties()->IsLocked()) {
+    _PTR(SObject) aFolder = GetClippingPlanesFolder(true);
+    if (aFolder) {
+      _PTR(StudyBuilder) aBuilder = myStudy->NewBuilder();
+      aPlaneObj = aBuilder->NewObject(aFolder);
+
+      // Save Name
+      _PTR(GenericAttribute) anAttr;
+      anAttr = aBuilder->FindOrCreateAttribute(aPlaneObj,"AttributeName");
+      _PTR(AttributeName) aName(anAttr);
+      aName->SetValue(name);
+
+      //Save Parameters
+      double aParams[6];
+      aParams[0] = X;
+      aParams[1] = Y;
+      aParams[2] = Z;
+      aParams[3] = dX;
+      aParams[4] = dY;
+      aParams[5] = dZ;
+
+      anAttr = aBuilder->FindOrCreateAttribute(aPlaneObj,"AttributeSequenceOfReal");
+      _PTR(AttributeSequenceOfReal) aArray(anAttr);
+      if (aArray->Length() == 6) {
+       for (int i = 0; i < 6; i++)
+         aArray->ChangeValue(i+1, aParams[i]);
+      } else {
+       for (int i = 0; i < 6; i++)
+         aArray->Add(aParams[i]);
+      }
+      // Save Bool Flag
+      anAttr = aBuilder->FindOrCreateAttribute(aPlaneObj,"AttributeInteger");
+      _PTR(AttributeInteger) aFlag(anAttr);
+      aFlag->SetValue(isAuto? 1 : 0);
+
+      vtkSmartPointer<VISU_CutPlaneFunction> aPlane = VISU_CutPlaneFunction::New();
+      aPlane->Delete(); //vtkSmartPointer specific
+      aPlane->setPlaneObject(aPlaneObj);
+      aPlane->SetOrigin(X, Y, Z);
+      aPlane->SetNormal(dX, dY, dZ);
+      aPlane->setName(name);
+      aPlane->setAuto(isAuto);
+      applyPlaneToAll(aPlane);
+      myPlanes->AddItem(aPlane.GetPointer());
+    }
+  }
+  return aPlaneObj;
+}
+  
+
+//*************************************************************
+void VISU_ClippingPlaneMgr::EditClippingPlane(long id, double X,double  Y, double Z, 
+                                             double dX, double dY, double dZ, 
+                                             bool isAuto, const char* name)
+{
+  VISU_CutPlaneFunction* aPlane = GetClippingPlane(id);
+  if (aPlane != NULL) {
+    _PTR(SObject) aSObj = aPlane->getPlaneObject();
+    aPlane->SetOrigin(X, Y, Z);
+    aPlane->SetNormal(dX, dY, dZ);
+    aPlane->setName(name);
+    aPlane->setAuto(isAuto);
+
+    if(!myStudy->GetProperties()->IsLocked()) {
+      _PTR(GenericAttribute) anAttr;
+      if (aSObj->FindAttribute(anAttr, "AttributeSequenceOfReal")) {
+       _PTR(AttributeSequenceOfReal) aArray(anAttr);
+       aArray->ChangeValue(1, X);
+       aArray->ChangeValue(2, Y);
+       aArray->ChangeValue(3, Z);
+       aArray->ChangeValue(4, dX);
+       aArray->ChangeValue(5, dY);
+       aArray->ChangeValue(6, dZ);
+      }
+      if (aSObj->FindAttribute(anAttr, "AttributeInteger")) {
+       _PTR(AttributeInteger) aFlag(anAttr);
+       aFlag->SetValue(isAuto? 1 : 0);
+      }
+      if (aSObj->FindAttribute(anAttr, "AttributeName")) {
+       _PTR(AttributeName) aName(anAttr);
+       aName->SetValue(name);
+      }
+      // Remove references on presentations if it becomes Auto plane
+      _PTR(SObject) aPlaneSObj = aPlane->getPlaneObject();
+      if (aPlane->isAuto()) {
+       _PTR(ChildIterator) aIter = myStudy->NewChildIterator(aPlaneSObj);
+       _PTR(StudyBuilder) aBuilder = myStudy->NewBuilder();
+       for (; aIter->More(); aIter->Next()) {
+         _PTR(SObject) aObj = aIter->Value();
+         aBuilder->RemoveObject(aObj);
+       }
+      } 
+    }
+  }
+}
+
+
+
+//*************************************************************
+  /* Returns clipping plane by its Id */
+VISU_CutPlaneFunction* VISU_ClippingPlaneMgr::GetClippingPlane(long id)
+{
+  if ((id < 0) || (id >= GetClippingPlanesNb()))
+    return NULL;
+  return (VISU_CutPlaneFunction*) myPlanes->GetItemAsObject(id);
+}
+
+//*************************************************************
+  /* Returns -1 if Plane is not exists */
+int VISU_ClippingPlaneMgr::GetPlaneId(VISU_CutPlaneFunction* thePlane)
+{
+  int aTag = thePlane->getPlaneObject()->Tag();
+  int aRes = -1;
+  VISU_CutPlaneFunction* aPlane;
+  for (int i = 0; i < GetClippingPlanesNb(); i++) {
+    aPlane = GetClippingPlane(i);
+    if (aPlane->getPlaneObject()->Tag() == aTag) {
+      aRes = i;
+      break;
+    }
+  }
+  return aRes;
+}
+
+  
+//*************************************************************
+  /* Deletes clipping plane by its Id */
+bool VISU_ClippingPlaneMgr::DeleteClippingPlane(long id)
+{
+  _PTR(SObject) aFolder = GetClippingPlanesFolder(false);
+  if (aFolder) {
+    VISU_CutPlaneFunction* aPlane = GetClippingPlane(id);
+    if (aPlane != NULL) {
+      _PTR(SComponent) aVisuSO = myStudy->FindComponent("VISU");
+      _PTR(ChildIterator) aChildIter = myStudy->NewChildIterator(aVisuSO);
+      for (aChildIter->InitEx(true); aChildIter->More(); aChildIter->Next()) {
+       _PTR(SObject) aSObject = aChildIter->Value();
+       CORBA::Object_var anObject = VISU::ClientSObjectToObject(aSObject);
+       if(VISU::Base_i* aBase = dynamic_cast<VISU::Base_i*>(VISU::GetServant(anObject).in())) {
+         VISU::Prs3d_i* aPrs;
+         if(aBase->GetType() == VISU::TCOLOREDPRS3DHOLDER){
+           CORBA::Object_var anObject = aBase->_this();
+           VISU::ColoredPrs3dHolder_var aHolder = VISU::ColoredPrs3dHolder::_narrow(anObject);
+           VISU::Prs3d_var aPrs3d = aHolder->GetDevice();
+           aPrs = dynamic_cast<VISU::Prs3d_i*>(VISU::GetServant(aPrs3d).in());
+         } else
+           aPrs = dynamic_cast<VISU::Prs3d_i*>(aBase);
+
+         if (aPrs) {
+           if (ContainsPlane(aPrs, aPlane)) {
+             short aTag1 = aPlane->getPlaneObject()->Tag();
+             for (int j = aPrs->GetNumberOfClippingPlanes()-1; j > -1; j--) {
+               VISU_CutPlaneFunction* aPln = dynamic_cast<VISU_CutPlaneFunction*>
+                 (aPrs->GetClippingPlane(j));
+               if (aPln) {
+                 short aTag2 = aPln->getPlaneObject()->Tag();
+                 if (aTag1 == aTag2) {
+                   aPrs->RemoveClippingPlane(j);
+                   break;
+                 }
+               }
+             }
+           }
+         }
+       }
+      }   
+      _PTR(SObject) aSObj = aPlane->getPlaneObject();
+      if (aSObj) {
+       _PTR(StudyBuilder) aBuilder = myStudy->NewBuilder();
+       aBuilder->RemoveObject(aSObj);
+      }
+      return true;
+    }
+  }
+  return false;
+}
+
+//*************************************************************
+bool VISU_ClippingPlaneMgr::ContainsPlane(VISU::Prs3d_ptr thePrs, VISU_CutPlaneFunction* thePlane)
+{
+  VISU::Prs3d_i* aPrs = dynamic_cast<VISU::Prs3d_i*>(VISU::GetServant(thePrs).in());
+  return ContainsPlane(aPrs, thePlane);
+}
+
+//*************************************************************
+bool VISU_ClippingPlaneMgr::ContainsPlane(VISU::Prs3d_i* thePrs, VISU_CutPlaneFunction* thePlane)
+{
+  VISU::Prs3d_i* aPrs = thePrs;
+  if (thePrs->GetType() == VISU::TCOLOREDPRS3DHOLDER) {
+    VISU::ColoredPrs3dHolder_i* aHolder = dynamic_cast<VISU::ColoredPrs3dHolder_i*>(thePrs);
+    if (!aHolder) return false;
+    aPrs = aHolder->GetPrs3dDevice();
+  }
+  string aEntry = thePlane->getPlaneObject()->GetID();
+  for (int i = 0; i < thePrs->GetNumberOfClippingPlanes(); i++) {
+    VISU_CutPlaneFunction* aPlane = dynamic_cast<VISU_CutPlaneFunction*>(thePrs->GetClippingPlane(i));
+    if (aPlane) {
+      if (aPlane->getPlaneObject()->GetID() == aEntry) {
+       return true;
+      }
+    }
+  }
+  return false;
+}
+
+  
+//*************************************************************
+  /* Applyes a clipping plane with Id to presentation thePrs */
+bool VISU_ClippingPlaneMgr::ApplyClippingPlane(VISU::Prs3d_i* thePrs, long id) 
+{
+  //VISU::Prs3d_i* aPrs = dynamic_cast<VISU::Prs3d_i*>(VISU::GetServant(thePrs).in());
+  if (!thePrs) return false;
+
+  VISU_CutPlaneFunction* aPlane = GetClippingPlane(id);
+  if (!aPlane) return false;
+  if (!ContainsPlane(thePrs, aPlane)) {
+    thePrs->AddClippingPlane(aPlane);
+    if (!aPlane->isAuto()) {
+      string aEntry = thePrs->GetEntry();
+      if (aEntry.length() == 0) {
+       VISU::ColoredPrs3d_i* aColPrs = dynamic_cast<VISU::ColoredPrs3d_i*>(thePrs);
+       if (aColPrs)
+         aEntry = aColPrs->GetHolderEntry();
+      }
+      if(!myStudy->GetProperties()->IsLocked()) {
+       _PTR(StudyBuilder) aBuilder = myStudy->NewBuilder();
+       _PTR(SObject) aPrsSObj = myStudy->FindObjectID(aEntry);
+       _PTR(SObject) aSObject = aPlane->getPlaneObject();
+       _PTR(SObject) aNewObj = aBuilder->NewObject(aSObject);
+       aBuilder->Addreference(aNewObj, aPrsSObj);
+      }
+    }
+    return true;
+  }
+  return false;
+}
+
+//*************************************************************
+bool VISU_ClippingPlaneMgr::DetachClippingPlane(VISU::Prs3d_i* thePrs, long id) 
+{
+  VISU_CutPlaneFunction* aPlane = GetClippingPlane(id);
+  //VISU::Prs3d_i* aPrs = dynamic_cast<VISU::Prs3d_i*>(VISU::GetServant(thePrs).in());
+  if (aPlane && thePrs) {
+    if (ContainsPlane(thePrs, aPlane)) {
+      bool isRemoved = false;
+      short aTag1 = aPlane->getPlaneObject()->Tag();
+      for (int j = thePrs->GetNumberOfClippingPlanes()-1; j > -1; j--) {
+       VISU_CutPlaneFunction* aPln = dynamic_cast<VISU_CutPlaneFunction*>
+         (thePrs->GetClippingPlane(j));
+       if (aPln) {
+         short aTag2 = aPln->getPlaneObject()->Tag();
+         if (aTag1 == aTag2) {
+           thePrs->RemoveClippingPlane(j);
+           isRemoved = true;
+           break;
+         }
+       }
+      }
+      if(!myStudy->GetProperties()->IsLocked()) {
+       _PTR(SObject) aSObject = aPlane->getPlaneObject();
+       _PTR(StudyBuilder) aBuilder = myStudy->NewBuilder();
+
+       string aEntry = thePrs->GetEntry();
+       if (aEntry.length() == 0) {
+         VISU::ColoredPrs3d_i* aColPrs = dynamic_cast<VISU::ColoredPrs3d_i*>(thePrs);
+         if (aColPrs)
+           aEntry = aColPrs->GetHolderEntry();
+       }
+       _PTR(ChildIterator) aIter = myStudy->NewChildIterator(aSObject);
+       for (; aIter->More(); aIter->Next()) {
+         _PTR(SObject) aRefObj = aIter->Value();
+         if(aRefObj) {
+           _PTR(SObject) aRefPrsObject;
+           if (aRefObj->ReferencedObject(aRefPrsObject)) {
+             if (aRefPrsObject->GetID() == aEntry) {
+               aBuilder->RemoveObject(aRefObj);
+               break;
+             }
+           }
+         }
+       }
+      }
+      return isRemoved;
+    }
+  }
+  return false;
+}
+
+  
+//*************************************************************
+  /* Get number of clipping planes */
+long VISU_ClippingPlaneMgr::GetClippingPlanesNb() 
+{
+  return myPlanes->GetNumberOfItems();
+}
+
+
+//*************************************************************
+_PTR(SObject) VISU_ClippingPlaneMgr::GetClippingPlanesFolder(bool toCreate)
+{
+  _PTR(SObject) aFolder;
+  _PTR(SComponent) aVisuSO = myStudy->FindComponent("VISU");
+  if (!aVisuSO) return aFolder;
+
+  aFolder = myStudy->FindObject(CLIP_PLANES_FOLDER);
+  if (!aFolder && toCreate) {
+    _PTR(StudyBuilder) aBuilder = myStudy->NewBuilder();
+    aFolder = aBuilder->NewObject(aVisuSO);
+    
+    _PTR(GenericAttribute) anAttr;
+    anAttr = aBuilder->FindOrCreateAttribute(aFolder,"AttributeName");
+    _PTR(AttributeName) aName(anAttr);
+    aName->SetValue(CLIP_PLANES_FOLDER);
+  }
+  return aFolder;
+}
+
+
+
+
+//****************************************************************
+//****************************************************************
+//****************************************************************
+VISU_CutPlaneFunction* VISU_CutPlaneFunction::New()
+{
+  return new VISU_CutPlaneFunction();
+}
+
+void VISU_CutPlaneFunction::setActive(bool theActive) 
+{ 
+  myIsActive = theActive; 
+  Modified();
+}
+
+double VISU_CutPlaneFunction::EvaluateFunction(double x[3])
+{
+  if (myIsActive)
+    return vtkPlane::EvaluateFunction(x);
+  else 
+    return -1;
+}
+
+double VISU_CutPlaneFunction::EvaluateFunction(double x, double y, double z)
+{
+  if (myIsActive)
+    return vtkPlane::EvaluateFunction(x,y,z);
+  else 
+    return -1;
+}
+  
+VISU_CutPlaneFunction::VISU_CutPlaneFunction():
+  myIsActive(true)
+{
+
+}
+
+VISU_CutPlaneFunction::~VISU_CutPlaneFunction()
+{
+}
+
diff --git a/src/VISU_I/VISU_ClippingPlaneMgr.hxx b/src/VISU_I/VISU_ClippingPlaneMgr.hxx
new file mode 100644 (file)
index 0000000..78d5cf5
--- /dev/null
@@ -0,0 +1,132 @@
+
+//  VISU OBJECT : interactive object for VISU entities implementation
+//
+//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+//
+//  File   : VISU_ClippingPlaneMgr.hxx
+//  Author : VSV
+//  Module : VISU
+
+
+#ifndef _VISU_ClippingPlane_H_
+#define _VISU_ClippingPlane_H_
+
+#include "VISU_I.hxx"
+#include "VISUConfig.hh"
+#include "SALOME_Component_i.hxx"
+#include "VISU_ColoredPrs3d_i.hh"
+
+#include <vtkPlane.h>
+#include <string>
+
+class vtkImplicitFunctionCollection;
+
+
+class VISU_CutPlaneFunction: public vtkPlane
+{
+public:
+  static VISU_CutPlaneFunction* New();
+
+  vtkTypeMacro(VISU_CutPlaneFunction, vtkPlane);
+
+  virtual double EvaluateFunction(double x[3]);
+  virtual double EvaluateFunction(double x, double y, double z);
+
+  void setActive(bool theActive);
+  bool isActive() const { return myIsActive; }
+
+  void setPlaneObject(_PTR(SObject) aSOPlane) { mySObject = aSOPlane; }
+  _PTR(SObject) getPlaneObject() const { return mySObject; }
+
+  void setName(string theName) { myName = theName; }
+  string getName() const { return myName; }
+  
+  void setAuto(bool isAuto) { myIsAuto = isAuto; }
+  bool isAuto() const { return myIsAuto; }
+
+protected:
+  VISU_CutPlaneFunction();
+  ~VISU_CutPlaneFunction();
+
+private:
+  bool myIsActive;
+  _PTR(SObject) mySObject;
+  string myName;
+  bool myIsAuto;
+};
+
+
+
+class VISU_ClippingPlaneMgr {
+public:
+  VISU_ClippingPlaneMgr();
+  ~VISU_ClippingPlaneMgr();
+
+  void SetStudy(_PTR(Study) theStudy);
+
+
+  long CreateClippingPlane(double X,double  Y, double Z, 
+                          double dX, double dY, double dZ, 
+                          bool isAuto, const char* name);
+
+  void EditClippingPlane(long id, double X,double  Y, double Z, 
+                          double dX, double dY, double dZ, 
+                          bool isAuto, const char* name);
+
+  _PTR(SObject) CreateClippingPlaneObject(double X,double  Y, double Z, 
+                                         double dX, double dY, double dZ, 
+                                         bool isAuto, const char* name);
+  
+  /* Returns clipping plane by its Id */
+  VISU_CutPlaneFunction* GetClippingPlane(long id);
+
+  /* Returns -1 if Plane is not exists */
+  int GetPlaneId(VISU_CutPlaneFunction* thePlane);
+  
+  /* Deletes clipping plane by its Id */
+  bool DeleteClippingPlane(long id);
+  
+  /* Applyes a clipping plane with Id to presentation thePrs */
+  bool ApplyClippingPlane(VISU::Prs3d_i* thePrs, long id);
+
+  bool DetachClippingPlane(VISU::Prs3d_i* thePrs, long id);
+  
+  /* Get number of clipping planes */
+  long GetClippingPlanesNb();
+
+  _PTR(SObject) GetClippingPlanesFolder(bool toCreate);
+
+  static bool ContainsPlane(VISU::Prs3d_ptr thePrs, VISU_CutPlaneFunction* thePlane);
+  static bool ContainsPlane(VISU::Prs3d_i* thePrs, VISU_CutPlaneFunction* thePlane);
+
+  vtkImplicitFunctionCollection* GetPlanesList() const { return myPlanes; }
+
+
+private:
+  void applyPlaneToAll(VISU_CutPlaneFunction* thePlane);
+
+
+  _PTR(Study) myStudy;
+
+  vtkImplicitFunctionCollection* myPlanes;
+};
+
+#endif
index 9e833c82d6324beb75a27722a235efe4217107a7..88168a37aee9de7ad2ae137dd674c80634b2843d 100644 (file)
@@ -39,8 +39,8 @@
 
 #include "VTKViewer_Algorithm.h"
 #include "SVTK_Functor.h"
+#include "SVTK_ViewWindow.h"
 
-#include "VVTK_ViewWindow.h"
 #include "SUIT_ResourceMgr.h"
 
 #include <vtkRenderWindow.h>
@@ -365,6 +365,15 @@ VISU::ColoredPrs3dCache_i
 {
   std::string aFolderName = VISU::ColoredPrs3dCache_i::GetFolderName();
   SALOMEDS::SObject_var aSObject = theStudy->FindObject(aFolderName.c_str());
+  if (CORBA::is_nil(aSObject)) {
+    aSObject = theStudy->FindObject("3D Cache System");
+    if (!CORBA::is_nil(aSObject)) {
+      SALOMEDS::StudyBuilder_var aBuilder = theStudy->NewBuilder();
+      SALOMEDS::GenericAttribute_var anAttr = aBuilder->FindOrCreateAttribute( aSObject, "AttributeName" );
+      SALOMEDS::AttributeName_var aNameAttr = SALOMEDS::AttributeName::_narrow( anAttr );
+      aNameAttr->SetValue( GetFolderName().c_str() );
+    }
+  }
   if(!CORBA::is_nil(aSObject)){
     CORBA::Object_var anObject = aSObject->GetObject();
     VISU::ColoredPrs3dCache_var aCache = VISU::ColoredPrs3dCache::_narrow(anObject);
@@ -477,7 +486,8 @@ std::string
 VISU::ColoredPrs3dCache_i
 ::GetFolderName() 
 { 
-  return "3D Cache System"; 
+  //return "3D Cache System"; 
+  return "Presentations"; 
 }
 
 //----------------------------------------------------------------------------
index 1f153a755e49979edb4e88f7df6c6e989769d0e3..69c50255d1e2e5d26d6ad8b06b799765ea69dd1c 100644 (file)
@@ -180,7 +180,8 @@ ColoredPrs3d_i(EPublishInStudyMode thePublishInStudyMode) :
   myOrientation( VISU::ColoredPrs3dBase::HORIZONTAL ),
   myColoredPL(NULL),
   myIsFixedRange(false),
-  myIsRestored(true)
+  myIsRestored(true)/* RKV : Begin*/,
+  myIsDistributionVisible(false)/* RKV : End*/
 {}
 
 //---------------------------------------------------------------
@@ -694,17 +695,21 @@ VISU::ColoredPrs3d_i
     SetNbColors(anOrigin->GetNbColors());
     
     SetUnitsVisible(anOrigin->IsUnitsVisible());
+    SetIsDistributionVisible(anOrigin->GetIsDistributionVisible());
     SetLabelsFormat(anOrigin->GetLabelsFormat());
 
     SetBarOrientation(anOrigin->GetBarOrientation());
     
     SetMinMaxController( anOrigin );
 
-    if(anOrigin->IsRangeFixed())
-      SetRange(anOrigin->GetMin(), anOrigin->GetMax());
+    if ( anOrigin->IsRangeFixed() )
+      SetRange( anOrigin->GetMin(), anOrigin->GetMax() );
     else
       SetSourceRange();
 
+    SetScalarFilterRange( anOrigin->GetScalarFilterMin(), anOrigin->GetScalarFilterMax() );
+    UseScalarFiltering( anOrigin->IsScalarFilterUsed() );
+
     SetPosition(anOrigin->GetPosX(), anOrigin->GetPosY());
     SetSize(anOrigin->GetWidth(), anOrigin->GetHeight());
     SetRatios(anOrigin->GetTitleWidth(), anOrigin->GetTitleHeight(),
@@ -778,21 +783,74 @@ VISU::ColoredPrs3d_i
   return myColoredPL->GetScalarRange()[1];
 }
 
+
 //----------------------------------------------------------------------------
 void
 VISU::ColoredPrs3d_i
-::SetRange(CORBA::Double theMin, CORBA::Double theMax)
+::SetRange( CORBA::Double theMin, CORBA::Double theMax )
 {
   VISU::TSetModified aModified(this);
 
   vtkFloatingPointType aScalarRange[2] = {theMin, theMax};
   ProcessVoidEvent(new TVoidMemFun1ArgEvent<VISU_ColoredPL, vtkFloatingPointType*>
                   (GetSpecificPL(), &VISU_ColoredPL::SetScalarRange, aScalarRange));
-
   UseFixedRange(true);
 }
 
 
+//----------------------------------------------------------------------------
+void
+VISU::ColoredPrs3d_i
+::SetScalarFilterRange( CORBA::Double theMin, CORBA::Double theMax )
+{
+  VISU::TSetModified aModified(this);
+
+  vtkFloatingPointType aScalarRange[ 2 ] = { theMin, theMax };
+  ProcessVoidEvent(new TVoidMemFun1ArgEvent<VISU_ColoredPL, vtkFloatingPointType*>
+                  (GetSpecificPL(), &VISU_ColoredPL::SetScalarFilterRange, aScalarRange) );
+}
+
+
+//----------------------------------------------------------------------------
+CORBA::Double
+VISU::ColoredPrs3d_i
+::GetScalarFilterMin()
+{
+  vtkFloatingPointType aScalarRange[ 2 ];
+  GetSpecificPL()->GetScalarFilterRange( aScalarRange );
+
+  return aScalarRange[ 0 ];
+}
+
+
+//----------------------------------------------------------------------------
+CORBA::Double
+VISU::ColoredPrs3d_i
+::GetScalarFilterMax()
+{
+  vtkFloatingPointType aScalarRange[ 2 ];
+  GetSpecificPL()->GetScalarFilterRange( aScalarRange );
+
+  return aScalarRange[ 1 ];
+}
+
+
+//----------------------------------------------------------------------------
+CORBA::Boolean
+VISU::ColoredPrs3d_i
+::IsScalarFilterUsed()
+{
+  return myColoredPL->IsScalarFilterUsed();
+}
+
+//----------------------------------------------------------------------------
+void
+VISU::ColoredPrs3d_i
+::UseScalarFiltering( CORBA::Boolean theUseScalarFilter )
+{
+  return myColoredPL->UseScalarFiltering( theUseScalarFilter );
+}
+
 //----------------------------------------------------------------------------
 void
 VISU::ColoredPrs3d_i
@@ -805,7 +863,7 @@ VISU::ColoredPrs3d_i
     ProcessVoidEvent(new TVoidMemFunEvent<VISU_ColoredPL>
                     (GetSpecificPL(), &VISU_ColoredPL::SetSourceRange));
   }else{
-    vtkFloatingPointType aScalarRange[2] = {GetSourceMin(), GetSourceMax()};
+    vtkFloatingPointType aScalarRange[ 2 ] = {GetSourceMin(), GetSourceMax()};
     ProcessVoidEvent(new TVoidMemFun1ArgEvent<VISU_ColoredPL, vtkFloatingPointType*>
                     (GetSpecificPL(), &VISU_ColoredPL::SetScalarRange, aScalarRange));
   }
@@ -1433,12 +1491,15 @@ VISU::ColoredPrs3d_i
 
   // Scalar Range
   int aRangeType = aResourceMgr->integerValue("VISU" , "scalar_range_type", 0);
-  if(aRangeType == 1){
+  if ( aRangeType == 1 ) {
     float aMin = aResourceMgr->doubleValue("VISU", "scalar_range_min", 0);
     float aMax = aResourceMgr->doubleValue("VISU", "scalar_range_max", 0);
-    SetRange(aMin, aMax);
+    SetRange( aMin, aMax );
   }
-  UseFixedRange(aRangeType == 1);
+  UseFixedRange( aRangeType == 1 );
+
+  bool isFiltered = aResourceMgr->booleanValue("VISU", "scalar_bar_filter_by_scalars", false);
+  UseScalarFiltering( isFiltered );
 
   int aNumberOfColors = aResourceMgr->integerValue( "VISU", "scalar_bar_num_colors", 64 );
   SetNbColors(aNumberOfColors);
@@ -1446,6 +1507,8 @@ VISU::ColoredPrs3d_i
   bool isUnits = aResourceMgr->booleanValue( "VISU", "scalar_bar_display_units", true );
   SetUnitsVisible(isUnits);
 
+  SetIsDistributionVisible( aResourceMgr->booleanValue("VISU", "scalar_bar_show_distribution", false) ); // RKV
+  
   QString aLabelsFormat = aResourceMgr->stringValue( "VISU", "scalar_bar_label_format", "%-#6.3g" );
   SetLabelsFormat(aLabelsFormat.toLatin1().data());
 
@@ -1603,10 +1666,20 @@ VISU::ColoredPrs3d_i
 
   Build(ERestore);
 
-  SetScalarMode(VISU::Storable::FindValue(theMap,"myScalarMode").toInt());
-  float aMin = VISU::Storable::FindValue(theMap,"myScalarRange[0]").toDouble();
-  float aMax = VISU::Storable::FindValue(theMap,"myScalarRange[1]").toDouble();
-  SetRange(aMin, aMax);
+  SetScalarMode(VISU::Storable::FindValue( theMap,"myScalarMode" ).toInt() );
+  {
+    float aMin = VISU::Storable::FindValue( theMap, "myScalarRange[0]" ).toDouble();
+    float aMax = VISU::Storable::FindValue( theMap, "myScalarRange[1]" ).toDouble();
+    SetRange( aMin, aMax );
+  }
+  {
+    bool isFiltered = VISU::Storable::FindValue( theMap, "myIsFilteredByScalars", "0" ).toInt();
+    float aMin = VISU::Storable::FindValue( theMap, "myScalarFilterRange[0]" ).toDouble();
+    float aMax = VISU::Storable::FindValue( theMap, "myScalarFilterRange[1]" ).toDouble();
+    SetScalarFilterRange( aMin, aMax );
+    UseScalarFiltering( isFiltered );
+  }
+  SetIsDistributionVisible(VISU::Storable::FindValue(theMap,"myIsDistributionVisible", "0").toInt());
 
   UseFixedRange(VISU::Storable::FindValue(theMap,"myIsFixedRange", "0").toInt());
 
@@ -1676,6 +1749,12 @@ VISU::ColoredPrs3d_i
   Storable::DataToStream( theStr, "myScalarRange[0]", GetMin() );
   Storable::DataToStream( theStr, "myScalarRange[1]", GetMax() );
   Storable::DataToStream( theStr, "myIsFixedRange",   IsRangeFixed() );
+  
+  Storable::DataToStream( theStr, "myIsFilteredByScalars",  IsScalarFilterUsed() );
+  Storable::DataToStream( theStr, "myScalarFilterRange[0]", GetScalarFilterMin() );
+  Storable::DataToStream( theStr, "myScalarFilterRange[1]", GetScalarFilterMax() );
+
+  Storable::DataToStream( theStr, "myIsDistributionVisible", GetIsDistributionVisible() ); // RKV
 
   Storable::DataToStream( theStr, "myNumberOfColors", int(GetNbColors()) );
   Storable::DataToStream( theStr, "myOrientation",    myOrientation );
@@ -1740,6 +1819,15 @@ VISU::ColoredPrs3d_i
 }
 
 
+//----------------------------------------------------------------------------
+void
+VISU::ColoredPrs3d_i
+::SetMapScale(double theMapScale)
+{
+  GetSpecificPL()->SetMapScale(theMapScale);
+}
+
+
 //----------------------------------------------------------------------------
 void
 VISU::ColoredPrs3d_i
@@ -1832,3 +1920,25 @@ VISU::ColoredPrs3d_i
     aStudyBuilder->CommitCommand();
   return this;
 }
+
+//----------------------------------------------------------------------------
+void
+VISU::ColoredPrs3d_i
+::SetIsDistributionVisible(CORBA::Boolean isVisible)
+{
+  if( myIsDistributionVisible != isVisible ){
+    VISU::TSetModified aModified(this);
+    myIsDistributionVisible = isVisible;
+    myParamsTime.Modified();
+  }
+}
+
+//----------------------------------------------------------------------------
+CORBA::Boolean
+VISU::ColoredPrs3d_i
+::GetIsDistributionVisible()
+{
+  return myIsDistributionVisible;
+}
+
+//----------------------------------------------------------------------------
index c2035a2125f7c68fb711d2d28f3e1fd5c07b46ac..df1e0c84b6ff297ecaaffe62b6f23d238407c077 100644 (file)
@@ -355,6 +355,40 @@ namespace VISU
     CORBA::Boolean
     IsUnitsVisible();
 
+    /*!  
+     * Set the visibility of a distribution curve.
+     * \param theIs is used to switch on/off the visibility of a distribution curve.
+     */
+    virtual void SetIsDistributionVisible(CORBA::Boolean theIs);
+    
+    //! Gets current visibility of a distribution curve
+    virtual CORBA::Boolean GetIsDistributionVisible();
+    
+    //! Gets current filtering by scalars mode
+    virtual CORBA::Boolean IsScalarFilterUsed();
+    
+    virtual void UseScalarFiltering( CORBA::Boolean theUseScalarFilter );
+
+    /*!
+     * Sets scalar range - min and max boundaries of the scalar bar.
+     * \param theMin  Min boundary of the scalar bar.
+     * \param theMax  Max boundary of the scalar bar.
+     * \param theIsFilter  if true then filter by scalars.
+     */
+    virtual
+    void
+    SetScalarFilterRange( CORBA::Double theMin, CORBA::Double theMax );
+
+    //----------------------------------------------------------------------------
+    virtual
+    CORBA::Double
+    GetScalarFilterMin();
+
+    //----------------------------------------------------------------------------
+    virtual
+    CORBA::Double
+    GetScalarFilterMax();
+
     //----------------------------------------------------------------------------
     //! Gets memory size actually used by the presentation (Mb).
     virtual
@@ -537,6 +571,10 @@ namespace VISU
                  vtkFloatingPointType theG, 
                  vtkFloatingPointType theB);
 
+    virtual
+    void
+    SetMapScale(double theMapScale = 1.0);
+
     VISU_ColoredPL* 
     GetSpecificPL() const
     { 
@@ -673,6 +711,8 @@ namespace VISU
     VISU_ColoredPL* myColoredPL;
     bool myIsFixedRange;
 
+    bool myIsDistributionVisible; // RKV
+
   };
 
 
index 93da7d73de5e9c6ff0a6132542431448f491cd81..46c50b8b3d805f35a7dd9fcac94c9ddfcf21768e 100644 (file)
@@ -179,6 +179,28 @@ namespace VISU
 
 
   //---------------------------------------------------------------------------
+  void SetClippingPlane(Prs3d_i* thePrs, string theName,
+                       std::ostream& theStr,
+                       std::string thePrefix) 
+  {
+    VISU_CutPlaneFunction* aPlane;
+    VISU_Gen_i* aGen = VISU_Gen_i::GetVisuGenImpl();
+    VISU_ClippingPlaneMgr& aMgr = aGen->GetClippingPlaneMgr();
+    int aId;
+    for (int i = 0; i < thePrs->GetNumberOfClippingPlanes(); i++) {
+      aPlane = dynamic_cast<VISU_CutPlaneFunction*>(thePrs->GetClippingPlane(i));
+      if (aPlane) {
+       if (!aPlane->isAuto()) {
+         aId = aMgr.GetPlaneId(aPlane);
+         if (aId > -1) {
+           theStr<<thePrefix<<"aVisu.ApplyClippingPlane("<<theName<<", "<<aId<<")"<<endl;
+         }
+       }
+      }
+    }
+  }
+  
+
   void
   Prs3dToPython(VISU::Prs3d_i* theServant,
                std::ostream& theStr,
@@ -188,6 +210,7 @@ namespace VISU
     float x, y, z;
     theServant->GetOffset(x,y,z);
     theStr<<thePrefix<<theName<<".SetOffset("<<x<<", "<<y<<", "<<z<<")"<<endl;
+    SetClippingPlane(theServant, theName, theStr, thePrefix);
   }
 
   //---------------------------------------------------------------------------
@@ -997,7 +1020,7 @@ namespace VISU
     }
   }
 
-  
+
 
   //---------------------------------------------------------------------------
   void
@@ -1967,6 +1990,35 @@ namespace VISU
     theStr<<thePrefix<<endl;
   }
 
+
+  void
+  DumpClippingPlanesToPython(SALOMEDS::Study_ptr theStudy,
+                            CORBA::Boolean theIsPublished,
+                            CORBA::Boolean& theIsValidScript,
+                            SALOMEDS::SObject_ptr theSObject,
+                            std::ostream& theStr,
+                            std::string thePrefix,
+                            VISU_ClippingPlaneMgr& thePlaneMgr)
+  {
+
+    if(!theIsPublished) return;
+
+    VISU_CutPlaneFunction* aPlane;
+    double aOrigin[3], aDir[3];
+    for (int i = 0; i < thePlaneMgr.GetClippingPlanesNb(); i++) {
+      aPlane = thePlaneMgr.GetClippingPlane(i);
+      aPlane->GetOrigin(aOrigin);
+      aPlane->GetNormal(aDir);
+
+      theStr<<thePrefix<<"aVisu.CreateClippingPlane("<<
+       aOrigin[0]<<","<<aOrigin[1]<<","<<aOrigin[2]<<","<<
+       aDir[0]<<","<<aDir[1]<<","<<aDir[2]<<","<<
+       aPlane->isAuto()<<",\""<<aPlane->getName()<<"\")"<<endl;      
+    }
+    theStr<<endl;
+  }  
+
+
   //---------------------------------------------------------------------------
   Engines::TMPFile*
   VISU_Gen_i::
@@ -2007,6 +2059,16 @@ namespace VISU
     aStr<<endl;
 
     SALOMEDS::SComponent_var aComponent = FindOrCreateVisuComponent(aStudy);
+
+    VISU::DumpClippingPlanesToPython(aStudy,
+                                    theIsPublished,
+                                    theIsValidScript,
+                                    aComponent.in(),
+                                    aStr,
+                                    aPrefix, 
+                                    myClippingPlaneMgr);
+
+
     VISU::DumpChildrenToPython(aStudy,
                               theIsPublished,
                               theIsValidScript,
@@ -2044,6 +2106,7 @@ namespace VISU
                                 aStr,
                                 aPrefix);
 
+
     //Output the script that sets up the visul parameters.
     if(theIsPublished) {
       char* script = aStudy->GetDefaultScript("Post-Pro", aPrefix.c_str());
index 2fa9381553e457210e8ead41a852ce8c4c2fa56e..2204b1637ae06c399b5f04923de891bc3230e032 100644 (file)
@@ -851,7 +851,11 @@ VISU_Actor*
 VISU::GaussPoints_i
 ::CreateActor() 
 {
-  return OnCreateActor1();
+  VISU_GaussPtsAct* anActor = VISU_GaussPtsAct::New();
+  if(OnCreateActor(anActor))
+    return anActor;
+  return NULL;
+  //  return OnCreateActor1();
 }
 
 //----------------------------------------------------------------------------
index 0732d55896f97f31208498c2fb378c061f1522f2..3f73561ad8aab2c2503eb9987c430278e0c54690 100644 (file)
@@ -258,6 +258,7 @@ namespace VISU
       CORBA::String_var aStudyName = aListOfOpenStudies[0];
       //aFileInfo.setFile(aStudyName.in());
       myStudyDocument = aStudyManager->GetStudyByName(aStudyName/*aFileInfo.baseName()*/);
+      myClippingPlaneMgr.SetStudy(GetStudy(myStudyDocument));
     }else
       if(MYDEBUG) MESSAGE("VISU_Gen_i::VISU_Gen_i : there is no opened study in StudyManager !!!");
   }
@@ -538,6 +539,7 @@ namespace VISU
       std::string aStudyName (aName.in());
       if(MYDEBUG) MESSAGE("StudyId = " << theStudy->StudyId() << "; Name = '" << aName.in() << "'");
       myStudyDocument = SALOMEDS::Study::_duplicate(theStudy);
+      myClippingPlaneMgr.SetStudy(GetStudy(myStudyDocument));
 
       ProcessVoidEvent(new TEvent(aStudyName));
 
@@ -1430,4 +1432,74 @@ namespace VISU
   {
     return ColoredPrs3dCache_i::GetInstance(theStudy);
   }
+
+    
+  CORBA::Long VISU_Gen_i::CreateClippingPlane(CORBA::Double X,CORBA::Double  Y, CORBA::Double Z, 
+                                             CORBA::Double dX, CORBA::Double dY, CORBA::Double dZ, 
+                                             CORBA::Boolean isAuto, const char* name)
+  {
+    return myClippingPlaneMgr.CreateClippingPlane(X, Y, Z, dX, dY, dZ, isAuto, name);
+  }
+
+    
+  void VISU_Gen_i::EditClippingPlane(CORBA::Long id, CORBA::Double X,CORBA::Double  Y, CORBA::Double Z, 
+                                    CORBA::Double dX, CORBA::Double dY, CORBA::Double dZ, 
+                                    CORBA::Boolean isAuto, const char* name)
+  {
+    myClippingPlaneMgr.EditClippingPlane(id, X, Y, Z, dX, dY, dZ, isAuto, name);
+  }
+  
+    /* Returns clipping plane by its Id */
+  VISU::ClippingPlane* VISU_Gen_i::GetClippingPlane(CORBA::Long id)
+  {
+    VISU_CutPlaneFunction* aPlane = myClippingPlaneMgr.GetClippingPlane(id);
+    
+    if (aPlane != NULL) {
+      double aOrigin[3];
+      double aDir[3];
+      aPlane->GetOrigin(aOrigin);
+      aPlane->GetNormal(aDir);
+
+      VISU::ClippingPlane* aRetPlane = new VISU::ClippingPlane;
+      aRetPlane->X = aOrigin[0];
+      aRetPlane->Y = aOrigin[1];
+      aRetPlane->Z = aOrigin[2];
+      aRetPlane->dX = aDir[0];
+      aRetPlane->dY = aDir[1];
+      aRetPlane->dZ = aDir[2];
+      aRetPlane->isAuto = aPlane->isAuto();
+
+      aRetPlane->name = aPlane->getName().c_str();
+      return aRetPlane;
+    }
+    return NULL;
+  }
+    
+    /* Deletes clipping plane by its Id */
+  CORBA::Boolean VISU_Gen_i::DeleteClippingPlane(CORBA::Long id)
+  {
+    return myClippingPlaneMgr.DeleteClippingPlane(id);
+  }
+    
+    /* Applyes a clipping plane with Id to presentation thePrs */
+  CORBA::Boolean VISU_Gen_i::ApplyClippingPlane(Prs3d_ptr thePrs, CORBA::Long id)
+  {
+    VISU::Prs3d_i* aPrs = dynamic_cast<VISU::Prs3d_i*>(VISU::GetServant(thePrs).in());
+    return myClippingPlaneMgr.ApplyClippingPlane(aPrs, id);
+  }
+
+    /* Detaches a clipping plane with Id from presentation thePrs */
+  CORBA::Boolean VISU_Gen_i::DetachClippingPlane(Prs3d_ptr thePrs, CORBA::Long id)
+  {
+    VISU::Prs3d_i* aPrs = dynamic_cast<VISU::Prs3d_i*>(VISU::GetServant(thePrs).in());
+    return myClippingPlaneMgr.DetachClippingPlane(aPrs, id);
+  }
+    
+    /* Get number of clipping planes */
+  CORBA::Long VISU_Gen_i::GetClippingPlanesNb()
+  {
+    return myClippingPlaneMgr.GetClippingPlanesNb();
+  }
+
+
 }
index 1043ed2a240ac5f2bad5f27f3f0f900d1a452df2..63cbf179d281ae3af6a7a5f971deb121b13a0b25 100644 (file)
@@ -30,6 +30,7 @@
 #include "SALOME_Component_i.hxx"
 #include "SALOME_NamingService.hxx"
 #include "VISU_ColoredPrs3d_i.hh"
+#include "VISU_ClippingPlaneMgr.hxx"
 
 #include <string>
 
@@ -41,6 +42,8 @@ namespace VISU
                     public virtual Base_i
   {
     SALOMEDS::Study_var myStudyDocument;
+    VISU_ClippingPlaneMgr myClippingPlaneMgr;
+
     VISU_Gen_i(const VISU::VISU_Gen_i &);
   public:
     VISU_Gen_i(CORBA::ORB_ptr theORB,
@@ -361,6 +364,33 @@ namespace VISU
     virtual
     VISU::ColoredPrs3dCache_ptr
     GetColoredPrs3dCache(SALOMEDS::Study_ptr theStudy);
+
+    
+    virtual CORBA::Long CreateClippingPlane(CORBA::Double X,CORBA::Double  Y, CORBA::Double Z, 
+                                           CORBA::Double dX, CORBA::Double dY, CORBA::Double dZ, 
+                                           CORBA::Boolean isAuto, const char* name);
+
+    virtual void EditClippingPlane(CORBA::Long id, CORBA::Double X,CORBA::Double  Y, CORBA::Double Z, 
+                                    CORBA::Double dX, CORBA::Double dY, CORBA::Double dZ, 
+                                    CORBA::Boolean isAuto, const char* name);
+
+    /* Returns clipping plane by its Id */
+    virtual VISU::ClippingPlane* GetClippingPlane(CORBA::Long id);
+    
+    /* Deletes clipping plane by its Id */
+    virtual CORBA::Boolean DeleteClippingPlane(CORBA::Long id);
+    
+    /* Applyes a clipping plane with Id to presentation thePrs */
+    virtual CORBA::Boolean ApplyClippingPlane(Prs3d_ptr thePrs, CORBA::Long id);
+    
+    /* Detaches a clipping plane with Id from presentation thePrs */
+    virtual CORBA::Boolean DetachClippingPlane(Prs3d_ptr thePrs, CORBA::Long id);
+    
+    /* Get number of clipping planes */
+    virtual CORBA::Long GetClippingPlanesNb();
+
+    VISU_ClippingPlaneMgr& GetClippingPlaneMgr() { return myClippingPlaneMgr; }
+
   };
 }
 
index 3886da2a42acb95097643ce18e64a995218f43a3..71c9a0e2924f29223771945f719fff924f895eea 100644 (file)
@@ -510,6 +510,14 @@ VISU::Mesh_i
     SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
     bool toShrink  = aResourceMgr->booleanValue("VISU", "mesh_shrink", false);
     if (toShrink) anActor->SetShrink();
+
+    anActor->SetFeatureEdgesAngle( aResourceMgr->doubleValue("VISU", "feature_edges_angle", 0.0) );
+    anActor->SetFeatureEdgesFlags( aResourceMgr->booleanValue("VISU", "show_feature_edges", false),
+                                  aResourceMgr->booleanValue("VISU", "show_boundary_edges", false),
+                                  aResourceMgr->booleanValue("VISU", "show_manifold_edges", false),
+                                  aResourceMgr->booleanValue("VISU", "show_non_manifold_edges", false) );
+    anActor->SetFeatureEdgesColoring( aResourceMgr->booleanValue("VISU", "feature_edges_coloring", false) );
+
     UpdateActor(anActor);
   }catch (...) {
     anActor->Delete();
index 55e2bd1d28b7ec46c1bd113747b28a1a30c94299..d0cf322edae0ded2c97114337c263827069b8110 100644 (file)
@@ -593,6 +593,12 @@ GetClippingPlane(vtkIdType theID) const
   return GetPipeLine()->GetClippingPlane(theID);
 }
 
+//----------------------------------------------------------------------------
+void VISU::Prs3d_i::RemoveClippingPlane(vtkIdType theID)
+{
+  GetPipeLine()->RemoveClippingPlane(theID);
+}
+
 //----------------------------------------------------------------------------
 void
 VISU::Prs3d_i
index 461df40f597689fcd4b01b9d3388bd3cffbc3b80..60fd16afbe99c01ae13f438f97d59cffee98b358 100644 (file)
@@ -223,6 +223,8 @@ namespace VISU
     vtkPlane* 
     GetClippingPlane(vtkIdType theID) const;
 
+    void RemoveClippingPlane(vtkIdType theID);
+
     void
     SetPlaneParam(vtkFloatingPointType theDir[3], 
                  vtkFloatingPointType theDist, 
index f0aba10aa462ef2d6295845bffa0eef745bc9a00..602a49cb7b0b3aff2504d79d0aa6eb388084cc22 100644 (file)
@@ -378,14 +378,6 @@ VISU::ScalarMap_i
   TSuperClass::CreatePipeLine(myScalarMapPL);
 }
 
-//----------------------------------------------------------------------------
-void
-VISU::ScalarMap_i
-::SetMapScale(double theMapScale)
-{
-  GetSpecificPL()->SetMapScale(theMapScale);
-}
-
 //----------------------------------------------------------------------------
 VISU_Actor* 
 VISU::ScalarMap_i
@@ -402,6 +394,14 @@ VISU::ScalarMap_i
     anActor->SetRepresentation(aDispMode);
     if (toShrink && !toSupressShrinking) anActor->SetShrink();
     anActor->SetShading(toUseShading);
+
+    anActor->SetFeatureEdgesAngle( aResourceMgr->doubleValue("VISU", "feature_edges_angle", 0.0) );
+    anActor->SetFeatureEdgesFlags( aResourceMgr->booleanValue("VISU", "show_feature_edges", false),
+                                  aResourceMgr->booleanValue("VISU", "show_boundary_edges", false),
+                                  aResourceMgr->booleanValue("VISU", "show_manifold_edges", false),
+                                  aResourceMgr->booleanValue("VISU", "show_non_manifold_edges", false) );
+    anActor->SetFeatureEdgesColoring( aResourceMgr->booleanValue("VISU", "feature_edges_coloring", false) );
+
     UpdateActor(anActor);
   }catch(...){
     anActor->Delete();
@@ -424,8 +424,21 @@ VISU::ScalarMap_i
 ::UpdateActor(VISU_ActorBase* theActor) 
 {
   if(VISU_ScalarMapAct* anActor = dynamic_cast<VISU_ScalarMapAct*>(theActor)){
+    VISU_LookupTable * aLookupTable = GetSpecificPL()->GetBarTable();
+
+    if ( IsScalarFilterUsed() ) {
+      aLookupTable->ForceBuild();
+      static unsigned char MARK_COLOR[] = { 255, 255, 255 };
+      aLookupTable->MarkValueByColor( GetScalarFilterMin(), MARK_COLOR );
+      aLookupTable->MarkValueByColor( GetScalarFilterMax(), MARK_COLOR );
+    }
+
     VISU_ScalarBarActor *aScalarBar = anActor->GetScalarBar();
-    aScalarBar->SetLookupTable(GetSpecificPL()->GetBarTable());
+    aScalarBar->SetLookupTable( aLookupTable );
+
+    //aScalarBar->SetDistribution( GetSpecificPL()->GetDistribution() );
+    //aScalarBar->SetDistributionVisibility( GetIsDistributionVisible() );
+
     aScalarBar->SetTitle(GetScalarBarTitle().c_str());
     aScalarBar->SetOrientation(GetBarOrientation());
     aScalarBar->GetPositionCoordinate()->SetCoordinateSystemToNormalizedViewport();
index 44a7ba96ed6875d1deedca2519bed2824d3131ee..ef19121c73b61bdb5804fffb2971d884e653dbbb 100644 (file)
@@ -163,10 +163,6 @@ namespace VISU
     Restore(SALOMEDS::SObject_ptr theSObject,
            const Storable::TRestoringMap& theMap);
 
-    virtual
-    void
-    SetMapScale(double theMapScale = 1.0);
-
     virtual 
     void
     SameAs(const Prs3d_i* theOrigin);
index c388740b97160ecc9c86c5b3aea591e1bb323d5c..8ebf690fab08b0234f9abb6090a4ac7b981f1382 100644 (file)
@@ -28,6 +28,7 @@
 #define VISU_View_i_HeaderFile
 
 #include "VISUConfig.hh"
+#include "SALOME_GenericObj_i.hh"
 
 class QWidget;
 
@@ -46,7 +47,8 @@ namespace VISU
   class Curve_i;
 
   class VISU_I_EXPORT View_i : public virtual POA_VISU::View,
-                 public virtual Storable
+                              public virtual SALOME::GenericObj_i,
+                              public virtual Storable
   {
   public:
     View_i (SalomeApp_Application *theApplication,
@@ -125,7 +127,7 @@ namespace VISU
 
   //===========================================================================
   class VISU_I_EXPORT XYPlot_i : public virtual POA_VISU::XYPlot,
-                   public virtual View_i
+                                public virtual View_i
   {
   public:
     typedef VISU::XYPlot TInterface;
@@ -216,7 +218,7 @@ namespace VISU
 
   //===========================================================================
   class VISU_I_EXPORT View3D_i : public virtual POA_VISU::View3D,
-                   public virtual View_i
+                                public virtual View_i
   {
   public:
     typedef VISU::View3D TInterface;