Salome HOME
SMH: Preparation version 3.0.0 - merge (HEAD+POLYWORK) T_3_0_0_a1
authorsmh <smh@opencascade.com>
Tue, 7 Jun 2005 13:22:20 +0000 (13:22 +0000)
committersmh <smh@opencascade.com>
Tue, 7 Jun 2005 13:22:20 +0000 (13:22 +0000)
192 files changed:
INSTALL
Makefile.in
adm_local/unix/make_commence.in
adm_local/unix/make_conclude.in
bin/VERSION
configure.in.base
idl/SMESH_Filter.idl
idl/SMESH_Group.idl
idl/SMESH_Mesh.idl
idl/SMESH_Pattern.idl
resources/SMESHCatalog.xml
resources/SMESH_en.xml
resources/mesh_polygon.png [new file with mode: 0644]
resources/mesh_polyhedron.png [new file with mode: 0644]
src/Controls/SMESH_Controls.cxx
src/Controls/SMESH_ControlsDef.hxx
src/DriverMED/DriverMED_R_SMESHDS_Mesh.cxx
src/DriverMED/DriverMED_W_SMESHDS_Mesh.cxx
src/DriverSTL/DriverSTL_R_SMDS_Mesh.cxx
src/OBJECT/Makefile.in
src/OBJECT/SMESH_Actor.cxx
src/OBJECT/SMESH_Actor.h
src/OBJECT/SMESH_ActorDef.h
src/OBJECT/SMESH_ActorUtils.cxx
src/OBJECT/SMESH_DeviceActor.cxx
src/OBJECT/SMESH_DeviceActor.h
src/OBJECT/SMESH_Object.cxx
src/OBJECT/SMESH_ObjectDef.h
src/SMDS/Makefile.in
src/SMDS/SMDS_Mesh.cxx
src/SMDS/SMDS_Mesh.hxx
src/SMDS/SMDS_MeshElement.hxx
src/SMDS/SMDS_MeshGroup.cxx
src/SMDS/SMDS_MeshIDFactory.cxx
src/SMDS/SMDS_MeshIDFactory.hxx
src/SMDS/SMDS_PolygonalFaceOfNodes.cxx [new file with mode: 0644]
src/SMDS/SMDS_PolygonalFaceOfNodes.hxx [new file with mode: 0644]
src/SMDS/SMDS_PolyhedralVolumeOfNodes.cxx [new file with mode: 0644]
src/SMDS/SMDS_PolyhedralVolumeOfNodes.hxx [new file with mode: 0644]
src/SMDS/SMDS_VolumeTool.cxx
src/SMDS/SMDS_VolumeTool.hxx
src/SMESH/SMESH_Mesh.cxx
src/SMESH/SMESH_Mesh.hxx
src/SMESH/SMESH_MeshEditor.cxx
src/SMESH/SMESH_MeshEditor.hxx
src/SMESH/SMESH_Pattern.cxx
src/SMESH/SMESH_Pattern.hxx
src/SMESH/SMESH_subMesh.cxx
src/SMESHDS/SMESHDS_Command.cxx
src/SMESHDS/SMESHDS_Command.hxx
src/SMESHDS/SMESHDS_CommandType.hxx
src/SMESHDS/SMESHDS_Mesh.cxx
src/SMESHDS/SMESHDS_Mesh.hxx
src/SMESHDS/SMESHDS_Script.cxx
src/SMESHDS/SMESHDS_Script.hxx
src/SMESHFiltersSelection/Makefile.in
src/SMESHFiltersSelection/SMESH_LogicalFilter.cxx
src/SMESHFiltersSelection/SMESH_LogicalFilter.hxx
src/SMESHFiltersSelection/SMESH_NumberFilter.cxx
src/SMESHFiltersSelection/SMESH_NumberFilter.hxx
src/SMESHFiltersSelection/SMESH_Type.h
src/SMESHFiltersSelection/SMESH_TypeFilter.cxx
src/SMESHFiltersSelection/SMESH_TypeFilter.hxx
src/SMESHGUI/Makefile.in
src/SMESHGUI/SMESHGUI.cxx
src/SMESHGUI/SMESHGUI.h
src/SMESHGUI/SMESHGUI_AddMeshElementDlg.cxx
src/SMESHGUI/SMESHGUI_AddMeshElementDlg.h
src/SMESHGUI/SMESHGUI_AddSubMeshDlg.cxx
src/SMESHGUI/SMESHGUI_AddSubMeshDlg.h
src/SMESHGUI/SMESHGUI_ClippingDlg.cxx
src/SMESHGUI/SMESHGUI_ClippingDlg.h
src/SMESHGUI/SMESHGUI_CreateHypothesesDlg.cxx
src/SMESHGUI/SMESHGUI_CreateHypothesesDlg.h
src/SMESHGUI/SMESHGUI_CreatePatternDlg.cxx
src/SMESHGUI/SMESHGUI_CreatePatternDlg.h
src/SMESHGUI/SMESHGUI_CreatePolyhedralVolumeDlg.cxx [new file with mode: 0644]
src/SMESHGUI/SMESHGUI_CreatePolyhedralVolumeDlg.h [new file with mode: 0644]
src/SMESHGUI/SMESHGUI_DeleteGroupDlg.cxx
src/SMESHGUI/SMESHGUI_DeleteGroupDlg.h
src/SMESHGUI/SMESHGUI_EditHypothesesDlg.cxx
src/SMESHGUI/SMESHGUI_EditHypothesesDlg.h
src/SMESHGUI/SMESHGUI_ExtrusionAlongPathDlg.cxx
src/SMESHGUI/SMESHGUI_ExtrusionAlongPathDlg.h
src/SMESHGUI/SMESHGUI_ExtrusionDlg.cxx
src/SMESHGUI/SMESHGUI_ExtrusionDlg.h
src/SMESHGUI/SMESHGUI_Filter.cxx
src/SMESHGUI/SMESHGUI_Filter.h
src/SMESHGUI/SMESHGUI_FilterDlg.cxx
src/SMESHGUI/SMESHGUI_FilterDlg.h
src/SMESHGUI/SMESHGUI_FilterLibraryDlg.cxx
src/SMESHGUI/SMESHGUI_FilterUtils.cxx
src/SMESHGUI/SMESHGUI_GEOMGenUtils.cxx
src/SMESHGUI/SMESHGUI_GEOMGenUtils.h
src/SMESHGUI/SMESHGUI_GroupDlg.cxx
src/SMESHGUI/SMESHGUI_GroupDlg.h
src/SMESHGUI/SMESHGUI_GroupOpDlg.cxx
src/SMESHGUI/SMESHGUI_GroupOpDlg.h
src/SMESHGUI/SMESHGUI_GroupUtils.cxx
src/SMESHGUI/SMESHGUI_HypothesesUtils.cxx
src/SMESHGUI/SMESHGUI_HypothesesUtils.h
src/SMESHGUI/SMESHGUI_InitMeshDlg.cxx
src/SMESHGUI/SMESHGUI_InitMeshDlg.h
src/SMESHGUI/SMESHGUI_MergeNodesDlg.cxx
src/SMESHGUI/SMESHGUI_MergeNodesDlg.h
src/SMESHGUI/SMESHGUI_MeshInfosDlg.cxx
src/SMESHGUI/SMESHGUI_MeshInfosDlg.h
src/SMESHGUI/SMESHGUI_MeshPatternDlg.cxx
src/SMESHGUI/SMESHGUI_MeshPatternDlg.h
src/SMESHGUI/SMESHGUI_MoveNodesDlg.cxx
src/SMESHGUI/SMESHGUI_MoveNodesDlg.h
src/SMESHGUI/SMESHGUI_MultiEditDlg.cxx
src/SMESHGUI/SMESHGUI_MultiEditDlg.h
src/SMESHGUI/SMESHGUI_NodesDlg.cxx
src/SMESHGUI/SMESHGUI_NodesDlg.h
src/SMESHGUI/SMESHGUI_PatternUtils.cxx
src/SMESHGUI/SMESHGUI_PatternWidget.cxx
src/SMESHGUI/SMESHGUI_PrecisionDlg.cxx
src/SMESHGUI/SMESHGUI_Preferences_ColorDlg.cxx
src/SMESHGUI/SMESHGUI_Preferences_ColorDlg.h
src/SMESHGUI/SMESHGUI_Preferences_ScalarBarDlg.cxx
src/SMESHGUI/SMESHGUI_Preferences_ScalarBarDlg.h
src/SMESHGUI/SMESHGUI_RemoveElementsDlg.cxx
src/SMESHGUI/SMESHGUI_RemoveElementsDlg.h
src/SMESHGUI/SMESHGUI_RemoveNodesDlg.cxx
src/SMESHGUI/SMESHGUI_RemoveNodesDlg.h
src/SMESHGUI/SMESHGUI_RenumberingDlg.cxx
src/SMESHGUI/SMESHGUI_RenumberingDlg.h
src/SMESHGUI/SMESHGUI_RevolutionDlg.cxx
src/SMESHGUI/SMESHGUI_RevolutionDlg.h
src/SMESHGUI/SMESHGUI_RotationDlg.cxx
src/SMESHGUI/SMESHGUI_RotationDlg.h
src/SMESHGUI/SMESHGUI_Selection.cxx [new file with mode: 0644]
src/SMESHGUI/SMESHGUI_Selection.h [new file with mode: 0644]
src/SMESHGUI/SMESHGUI_SewingDlg.cxx
src/SMESHGUI/SMESHGUI_SewingDlg.h
src/SMESHGUI/SMESHGUI_SingleEditDlg.cxx
src/SMESHGUI/SMESHGUI_SingleEditDlg.h
src/SMESHGUI/SMESHGUI_SmoothingDlg.cxx
src/SMESHGUI/SMESHGUI_SmoothingDlg.h
src/SMESHGUI/SMESHGUI_SpinBox.cxx
src/SMESHGUI/SMESHGUI_SpinBox.h
src/SMESHGUI/SMESHGUI_StandardMeshInfosDlg.cxx
src/SMESHGUI/SMESHGUI_StandardMeshInfosDlg.h
src/SMESHGUI/SMESHGUI_Swig.cxx
src/SMESHGUI/SMESHGUI_SymmetryDlg.cxx
src/SMESHGUI/SMESHGUI_SymmetryDlg.h
src/SMESHGUI/SMESHGUI_TranslationDlg.cxx
src/SMESHGUI/SMESHGUI_TranslationDlg.h
src/SMESHGUI/SMESHGUI_TransparencyDlg.cxx
src/SMESHGUI/SMESHGUI_TransparencyDlg.h
src/SMESHGUI/SMESHGUI_Utils.cxx
src/SMESHGUI/SMESHGUI_Utils.h
src/SMESHGUI/SMESHGUI_VTKUtils.cxx
src/SMESHGUI/SMESHGUI_VTKUtils.h
src/SMESHGUI/SMESHGUI_XmlHandler.cxx
src/SMESHGUI/SMESHGUI_aParameter.cxx
src/SMESHGUI/SMESHGUI_aParameterDlg.cxx
src/SMESHGUI/SMESHGUI_aParameterDlg.h
src/SMESHGUI/SMESH_images.po [new file with mode: 0644]
src/SMESHGUI/SMESH_msg_en.po
src/SMESH_I/Makefile.in
src/SMESH_I/SMESH_DumpPython.cxx [new file with mode: 0644]
src/SMESH_I/SMESH_Filter_i.cxx
src/SMESH_I/SMESH_Filter_i.hxx
src/SMESH_I/SMESH_Gen_i.cxx
src/SMESH_I/SMESH_Gen_i.hxx
src/SMESH_I/SMESH_Group_i.cxx
src/SMESH_I/SMESH_Group_i.hxx
src/SMESH_I/SMESH_MEDFamily_i.hxx
src/SMESH_I/SMESH_MEDMesh_i.hxx
src/SMESH_I/SMESH_MeshEditor_i.cxx
src/SMESH_I/SMESH_MeshEditor_i.hxx
src/SMESH_I/SMESH_Mesh_i.cxx
src/SMESH_I/SMESH_Mesh_i.hxx
src/SMESH_I/SMESH_Pattern_i.cxx
src/SMESH_I/SMESH_Pattern_i.hxx
src/SMESH_I/SMESH_PythonDump.hxx [new file with mode: 0644]
src/SMESH_SWIG/Makefile.in
src/StdMeshers/StdMeshers_Quadrangle_2D.cxx
src/StdMeshersGUI/Makefile.in
src/StdMeshersGUI/StdMeshersGUI.cxx
src/StdMeshersGUI/StdMeshersGUI_CreateHypothesisDlg.cxx
src/StdMeshersGUI/StdMeshersGUI_CreateStdHypothesisDlg.cxx
src/StdMeshersGUI/StdMeshers_images.po [new file with mode: 0644]
src/StdMeshers_I/StdMeshers_Arithmetic1D_i.cxx
src/StdMeshers_I/StdMeshers_Deflection1D_i.cxx
src/StdMeshers_I/StdMeshers_LocalLength_i.cxx
src/StdMeshers_I/StdMeshers_MaxElementArea_i.cxx
src/StdMeshers_I/StdMeshers_MaxElementVolume_i.cxx
src/StdMeshers_I/StdMeshers_NumberOfSegments_i.cxx
src/StdMeshers_I/StdMeshers_StartEndLength_i.cxx

diff --git a/INSTALL b/INSTALL
index 72bd5f169843c79a2ac8a73656c131d05d861ede..d9e6d956d07d7b95827ceb5969ac44b1808a193d 100644 (file)
--- a/INSTALL
+++ b/INSTALL
@@ -1,5 +1,6 @@
-This is the version 2.2.0 of SMESH
+This is the version 3.0.0 of SMESH
 Compatible with :
-        - KERNEL 2.2.0
-       - GEOM 2.2.0
-       - MED 2.2.0
+        - KERNEL 3.0.0
+       - GUI 3.0.0
+       - GEOM 3.0.0
+       - MED 3.0.0
index dfbd2629a219fe073b359d930f3a4971f1398649..c659cb280f1e3901b19e0edd730916397ce61c1b 100644 (file)
@@ -53,6 +53,8 @@ mesh_line.png \
 mesh_move_node.png \
 mesh_orientation.png \
 mesh.png \
+mesh_polygon.png \
+mesh_polyhedron.png \
 mesh_pyramid_n.png \
 mesh_pyramid.png \
 mesh_quad_n.png \
index 5e2ad5bb8f18b8ec9a3dc617105eedf98e775e04..e7e10c9a58137c7eda1749796f360a4cdd51de6d 100644 (file)
@@ -67,7 +67,7 @@ QT_MT_LIBS = @QT_MT_LIBS@
 
 MOC = @MOC@
 UIC = @UIC@
-
+MSG2QM = @MSG2QM@
 
 #QWT
 
index 9eac1df82d9369dde8411078c708681f6338d3a5..f4827fd31992c2fbd3f07a95da943ba0ad3c2f66 100644 (file)
@@ -327,11 +327,7 @@ distclean: clean
        $(SWIG) $(SWIG_FLAGS) -o $@ $<
 
 $(top_builddir)/share/salome/resources/%.qm: %.po
-       if test -e ${KERNEL_ROOT_DIR}/bin/salome/msg2qm ; then \
-               ${KERNEL_ROOT_DIR}/bin/salome/msg2qm $< $@ ; \
-       else \
-               $(top_builddir)/bin/salome/msg2qm $< $@ ; \
-       fi
+               $(MSG2QM) $< $@ ; \
 
 #------------------------------------------------------------------------------
 # The following section of this makefile contains dependencies between the
index 44f7b56ffbf10548452bf334f76b5f32c4b9ee57..e0c447a4d2c9135bf8bdd549e8d457bd941dfa89 100755 (executable)
@@ -1,2 +1,2 @@
-THIS IS SALOME - SMESH VERSION: 2.2.0
+THIS IS SALOME - SMESH VERSION: 3.0.0
 
index 2e65ed14023864016eec5b7cdcd08ac5e5184e26..71cdbb9d6774fec54afaabe2233466475522aec4 100644 (file)
@@ -217,6 +217,14 @@ echo
 
 CHECK_QT
 
+echo
+echo ---------------------------------------------
+echo testing MSG2QM
+echo ---------------------------------------------
+echo
+
+CHECK_MSG2QM
+
 echo
 echo ---------------------------------------------
 echo testing VTK
index 0644362d43c076c62ea248d457856d9897f53ae1..929afb67a533196a54a3ec3fcadbb4564614952e 100644 (file)
@@ -278,7 +278,7 @@ module SMESH
   /*!
   *  Filter
   */
-  interface Filter: SALOME::GenericObj
+  interface Filter: SALOME::GenericObj, SMESH_IDSource
   {
     /*!
     * Structure containing information about one criterion
@@ -312,6 +312,8 @@ module SMESH
     typedef sequence<Criterion> Criteria;
 
     void          SetPredicate( in Predicate thePredicate );
+    void          SetMesh( in SMESH_Mesh theMesh );
+
     long_array    GetElementsId( in SMESH_Mesh theMesh );
     ElementType   GetElementType();
     Predicate     GetPredicate();
index a39c3445d00f2e876350a289bca476abcc79ab6f..37657674bf4f41da09810991f347e283cfa83f62 100644 (file)
@@ -33,6 +33,8 @@
 
 module SMESH
 {
+  interface Predicate;
+
   /*!
    * SMESH_Group: base interface of group object
    */
@@ -98,11 +100,13 @@ module SMESH
      * Adds elements to the group
      */
     long Add( in long_array elem_ids );
+    long AddByPredicate( in Predicate thePredicate );
 
     /*!
      * Removes elements from the group
      */
     long Remove( in long_array elem_ids );
+    long RemoveByPredicate( in Predicate thePredicate );
 
   };
   /*!
index e380a6a099d8a23404af36365190aa1778d8e7b2..53579df6a210624d812957228f2e035927f6df08 100644 (file)
@@ -58,14 +58,17 @@ module SMESH
       ADD_EDGE,
       ADD_TRIANGLE,
       ADD_QUADRANGLE,
+      ADD_POLYGON,
       ADD_TETRAHEDRON,
       ADD_PYRAMID,
       ADD_PRISM,
       ADD_HEXAHEDRON,
+      ADD_POLYHEDRON,
       REMOVE_NODE,
       REMOVE_ELEMENT,
       MOVE_NODE,
       CHANGE_ELEMENT_NODES,
+      CHANGE_POLYHEDRON_NODES,
       RENUMBER
     };
 
@@ -375,6 +378,9 @@ module SMESH
     long NbQuadrangles()
       raises (SALOME::SALOME_Exception);
 
+    long NbPolygons()
+      raises (SALOME::SALOME_Exception);
+
     long NbVolumes()
       raises (SALOME::SALOME_Exception);
 
@@ -390,6 +396,9 @@ module SMESH
     long NbPrisms()
       raises (SALOME::SALOME_Exception);
 
+    long NbPolyhedrons()
+      raises (SALOME::SALOME_Exception);
+
     long NbSubMesh()
       raises (SALOME::SALOME_Exception);
 
@@ -461,7 +470,7 @@ module SMESH
       raises (SALOME::SALOME_Exception);
   };
   
-  /* 
+  /*!
    * This interface makes modifications on the Mesh - removing elements and nodes etc.
    */
   interface NumericalFunctor;
@@ -480,6 +489,25 @@ module SMESH
 
     boolean AddVolume(in long_array IDsOfNodes);
 
+    //boolean AddPolygonalFace (in long_array IdsOfNodes);
+
+    /*!
+     *  Create volume of many faces, giving nodes for each face.
+     *  \param IdsOfNodes List of node IDs for volume creation face by face.
+     *  \param Quantities List of integer values, Quantities[i]
+     *         gives quantity of nodes in face number i.
+     */
+    boolean AddPolyhedralVolume (in long_array IdsOfNodes,
+                                in long_array Quantities);
+
+    /*!
+     *  Create volume of many faces, giving IDs of existing faces.
+     *  \param IdsOfFaces List of face IDs for volume creation.
+     *  \note The created volume will refer only to nodes
+     *        of the given faces, not to the faces itself.
+     */
+    boolean AddPolyhedralVolumeByFaces (in long_array IdsOfFaces);
+
     boolean MoveNode(in long NodeID, in double x, in double y, in double z);
 
     boolean InverseDiag(in long NodeID1, in long NodeID2);
@@ -521,6 +549,18 @@ module SMESH
                         in double          MaxAspectRatio,
                         in Smooth_Method   Method);
 
+    boolean SmoothParametric(in long_array    IDsOfElements,
+                             in long_array    IDsOfFixedNodes,
+                             in long          MaxNbOfIterations,
+                             in double        MaxAspectRatio,
+                             in Smooth_Method Method);
+
+    boolean SmoothParametricObject(in SMESH_IDSource  theObject,
+                                   in long_array      IDsOfFixedNodes,
+                                   in long            MaxNbOfIterations,
+                                   in double          MaxAspectRatio,
+                                   in Smooth_Method   Method);
+
     void RenumberNodes();
 
     void RenumberElements();
@@ -637,7 +677,9 @@ module SMESH
                               in long LastNodeID1,
                               in long FirstNodeID2,
                               in long SecondNodeID2,
-                              in long LastNodeID2);
+                              in long LastNodeID2,
+                             in boolean CreatePolygons,
+                             in boolean CreatePolyedrs);
 
     Sew_Error SewConformFreeBorders (in long FirstNodeID1,
                                      in long SecondNodeID1,
@@ -649,7 +691,9 @@ module SMESH
                                in long SecondNodeIDOnFreeBorder,
                                in long LastNodeIDOnFreeBorder,
                                in long FirstNodeIDOnSide,
-                               in long LastNodeIDOnSide);
+                               in long LastNodeIDOnSide,
+                              in boolean CreatePolygons,
+                              in boolean CreatePolyedrs);
 
     Sew_Error SewSideElements (in long_array IDsOfSide1Elements,
                                in long_array IDsOfSide2Elements,
index fa1d7dd119bba1b3159e12e7eb15d19664af21d3..d2324a0b215336a8f88b89b7ccfb3e72dd370d29 100644 (file)
@@ -103,9 +103,15 @@ module SMESH
 
     /*!
      * Create nodes and elements in <theMesh> using nodes
-     * coordinates computed by either of Apply...() methods
+     * coordinates computed by either of Apply...() methods.
+     * If CreatePolygons is TRUE, replace adjacent faces by polygons
+     * to keep mesh conformity.
+     * If CreatePolyedrs is TRUE, replace adjacent volumes by polyedrs
+     * to keep mesh conformity.
      */
-    boolean MakeMesh(in SMESH_Mesh theMesh);
+    boolean MakeMesh (in SMESH_Mesh theMesh,
+                     in boolean    CreatePolygons,
+                     in boolean    CreatePolyedrs);
 
     /*!
      * Return the loaded pattern in the string form to be saved in file
index 76072ee742910ff6d7810a349aed65d4bd8ccc65..e66eb085d8904920f7ae06c9718fc09cc8ae8477 100644 (file)
@@ -16,7 +16,7 @@
                <component-username>Mesh</component-username>
                <component-type>MESH</component-type>
                <component-author>NRI</component-author>
-               <component-version>2.2.0</component-version>
+               <component-version>3.0.0</component-version>
                <component-comment>Mesh component</component-comment>
                <component-multistudy>1</component-multistudy>
                <component-icone>ModuleMesh.png</component-icone>
index 0bbbc4597578c079d0240d6c87b269bda6b491ac..7d314c75df252290c08ab99d2a2e2f41b0fc227b 100644 (file)
      <popup-item item-id="401" pos-id="" label-id="Edge" icon-id="mesh_line.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
      <popup-item item-id="4021" pos-id="" label-id="Triangle" icon-id="mesh_triangle.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
      <popup-item item-id="4022" pos-id="" label-id="Quadrangle" icon-id="mesh_quad.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
+     <popup-item item-id="4023" pos-id="" label-id="Polygon" icon-id="mesh_polygon.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
      <popup-item item-id="4031" pos-id="" label-id="Tetrahedron" icon-id="mesh_tetra.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
      <popup-item item-id="4032" pos-id="" label-id="Hexahedron" icon-id="mesh_hexa.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
+     <popup-item item-id="4033" pos-id="" label-id="Polyhedron" icon-id="mesh_polyhedron.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
      </submenu>
      <endsubmenu />
      <submenu label-id="Remove" item-id="403" pos-id="">
      <toolbutton-item item-id="401" label-id="Edge" icon-id="mesh_line.png" tooltip-id="Add Edge" accel-id="" toggle-id="" execute-action=""/>
      <toolbutton-item item-id="4021" label-id="Triangle" icon-id="mesh_triangle.png" tooltip-id="Add Triangle" accel-id="" toggle-id="" execute-action=""/>
      <toolbutton-item item-id="4022" label-id="Quadrangle" icon-id="mesh_quad.png" tooltip-id="Add Quadrangle" accel-id="" toggle-id="" execute-action=""/>
+     <toolbutton-item item-id="4023" label-id="Polygon" icon-id="mesh_polygon.png" tooltip-id="Add Polygon" accel-id="" toggle-id="" execute-action=""/>
      <toolbutton-item item-id="4031" label-id="Tetrahedron" icon-id="mesh_tetra.png" tooltip-id="Add Tetrahedron" accel-id="" toggle-id="" execute-action=""/>
      <toolbutton-item item-id="4032" label-id="Hexahedron" icon-id="mesh_hexa.png" tooltip-id="Add Hexahedron" accel-id="" toggle-id="" execute-action=""/>
+     <toolbutton-item item-id="4033" label-id="Polyhedron" icon-id="mesh_polyhedron.png" tooltip-id="Add Polyhedron" accel-id="" toggle-id="" execute-action=""/>
    <separatorTB/>
      <toolbutton-item item-id="4041" label-id="Nodes" icon-id="mesh_rem_node.png" tooltip-id="Remove Nodes" accel-id="" toggle-id="" execute-action=""/>
      <toolbutton-item item-id="4042" label-id="Elements" icon-id="mesh_rem_element.png" tooltip-id="Remove Elements" accel-id="" toggle-id="" execute-action=""/>
diff --git a/resources/mesh_polygon.png b/resources/mesh_polygon.png
new file mode 100644 (file)
index 0000000..a1f671b
Binary files /dev/null and b/resources/mesh_polygon.png differ
diff --git a/resources/mesh_polyhedron.png b/resources/mesh_polyhedron.png
new file mode 100644 (file)
index 0000000..f475dec
Binary files /dev/null and b/resources/mesh_polyhedron.png differ
index 4aa92f1d286bdc826d53061b31d4f8753dbdec10..3dd59cf5dadbdf63cc4afdab916c7009b4387666 100644 (file)
@@ -81,7 +81,7 @@ namespace{
     return aDist;
   }
 
-  int getNbMultiConnection( SMDS_Mesh* theMesh, const int theId )
+  int getNbMultiConnection( const SMDS_Mesh* theMesh, const int theId )
   {
     if ( theMesh == 0 )
       return 0;
@@ -137,7 +137,7 @@ NumericalFunctor::NumericalFunctor():
   myPrecision = -1;
 }
 
-void NumericalFunctor::SetMesh( SMDS_Mesh* theMesh )
+void NumericalFunctor::SetMesh( const SMDS_Mesh* theMesh )
 {
   myMesh = theMesh;
 }
@@ -213,26 +213,17 @@ double MinimumAngle::GetValue( const TSequenceOfXYZ& P )
 {
   double aMin;
 
-  if ( P.size() == 3 )
-  {
-    double A0 = getAngle( P( 3 ), P( 1 ), P( 2 ) );
-    double A1 = getAngle( P( 1 ), P( 2 ), P( 3 ) );
-    double A2 = getAngle( P( 2 ), P( 3 ), P( 1 ) );
-
-    aMin = Min( A0, Min( A1, A2 ) );
-  }
-  else if ( P.size() == 4 )
-  {
-    double A0 = getAngle( P( 4 ), P( 1 ), P( 2 ) );
-    double A1 = getAngle( P( 1 ), P( 2 ), P( 3 ) );
-    double A2 = getAngle( P( 2 ), P( 3 ), P( 4 ) );
-    double A3 = getAngle( P( 3 ), P( 4 ), P( 1 ) );
-    
-    aMin = Min( Min( A0, A1 ), Min( A2, A3 ) );
-  }
-  else
+  if (P.size() <3)
     return 0.;
+
+  aMin = getAngle(P( P.size() ), P( 1 ), P( 2 ));
+  aMin = Min(aMin,getAngle(P( P.size()-1 ), P( P.size() ), P( 1 )));
   
+  for (int i=2; i<P.size();i++){
+      double A0 = getAngle( P( i-1 ), P( i ), P( i+1 ) );
+    aMin = Min(aMin,A0);
+  }
+
   return aMin * 180 / PI;
 }
 
@@ -354,7 +345,7 @@ namespace{
     gp_Vec aVec2( P( 3 ) - P( 1 ) );
     gp_Vec aVec3( P( 4 ) - P( 1 ) );
     gp_Vec anAreaVec( aVec1 ^ aVec2 );
-    return abs(aVec3 * anAreaVec) / 6.0;
+    return fabs(aVec3 * anAreaVec) / 6.0;
   }
 
   inline double getMaxHeight(double theLen[6])
@@ -638,8 +629,8 @@ double Warping::ComputeA( const gp_XYZ& thePnt1,
   if ( L < Precision::Confusion())
     return 0.;
 
-  gp_XYZ GI = ( thePnt2 - thePnt1 ) / 2. - theG;
-  gp_XYZ GJ = ( thePnt3 - thePnt2 ) / 2. - theG;
+  gp_XYZ GI = ( thePnt2 + thePnt1 ) / 2. - theG;
+  gp_XYZ GJ = ( thePnt3 + thePnt2 ) / 2. - theG;
   gp_XYZ N  = GI.Crossed( GJ );
 
   if ( N.Modulus() < gp::Resolution() )
@@ -771,12 +762,17 @@ SMDSAbs_ElementType Skew::GetType() const
 */
 double Area::GetValue( const TSequenceOfXYZ& P )
 {
+  double aArea = 0;
   if ( P.size() == 3 )
     return getArea( P( 1 ), P( 2 ), P( 3 ) );
-  else if ( P.size() == 4 )
-    return getArea( P( 1 ), P( 2 ), P( 3 ) ) + getArea( P( 1 ), P( 3 ), P( 4 ) );
+  else if (P.size() > 3)
+    aArea = getArea( P( 1 ), P( 2 ), P( 3 ) );
   else
     return 0;
+
+  for (int i=4; i<=P.size(); i++)
+    aArea += getArea(P(1),P(i-1),P(i));
+  return aArea;
 }
 
 double Area::GetBadRate( double Value, int /*nbNodes*/ ) const
@@ -1034,7 +1030,6 @@ double MultiConnection2D::GetValue( long theElementId )
   int aResult = 0;
   
   if (GetPoints(theElementId,P)){
-    double  aVal;
     const SMDS_MeshElement* anFaceElem = myMesh->FindElement( theElementId );
     SMDSAbs_ElementType aType = anFaceElem->GetType();
     
@@ -1116,7 +1111,6 @@ void MultiConnection2D::GetValues(MValues& theValues){
   SMDS_FaceIteratorPtr anIter = myMesh->facesIterator();
   for(; anIter->more(); ){
     const SMDS_MeshFace* anElem = anIter->next();
-    long anElemId = anElem->GetID();
     SMDS_ElemIteratorPtr aNodesIter = anElem->nodesIterator();
     long aNodeId[3];
 
@@ -1176,7 +1170,7 @@ BadOrientedVolume::BadOrientedVolume()
   myMesh = 0;
 }
 
-void BadOrientedVolume::SetMesh( SMDS_Mesh* theMesh )
+void BadOrientedVolume::SetMesh( const SMDS_Mesh* theMesh )
 {
   myMesh = theMesh;
 }
@@ -1207,7 +1201,7 @@ FreeBorders::FreeBorders()
   myMesh = 0;
 }
 
-void FreeBorders::SetMesh( SMDS_Mesh* theMesh )
+void FreeBorders::SetMesh( const SMDS_Mesh* theMesh )
 {
   myMesh = theMesh;
 }
@@ -1232,7 +1226,7 @@ FreeEdges::FreeEdges()
   myMesh = 0;
 }
 
-void FreeEdges::SetMesh( SMDS_Mesh* theMesh )
+void FreeEdges::SetMesh( const SMDS_Mesh* theMesh )
 {
   myMesh = theMesh;
 }
@@ -1379,7 +1373,7 @@ RangeOfIds::RangeOfIds()
 // name    : SetMesh
 // Purpose : Set mesh 
 //=======================================================================
-void RangeOfIds::SetMesh( SMDS_Mesh* theMesh )
+void RangeOfIds::SetMesh( const SMDS_Mesh* theMesh )
 {
   myMesh = theMesh;
 }
@@ -1581,7 +1575,7 @@ Comparator::Comparator():
 Comparator::~Comparator()
 {}
 
-void Comparator::SetMesh( SMDS_Mesh* theMesh )
+void Comparator::SetMesh( const SMDS_Mesh* theMesh )
 {
   if ( myFunctor )
     myFunctor->SetMesh( theMesh );
@@ -1666,7 +1660,7 @@ bool LogicalNOT::IsSatisfy( long theId )
   return myPredicate && !myPredicate->IsSatisfy( theId );
 }
 
-void LogicalNOT::SetMesh( SMDS_Mesh* theMesh )
+void LogicalNOT::SetMesh( const SMDS_Mesh* theMesh )
 {
   if ( myPredicate )
     myPredicate->SetMesh( theMesh );
@@ -1693,7 +1687,7 @@ LogicalBinary::LogicalBinary()
 LogicalBinary::~LogicalBinary()
 {}
 
-void LogicalBinary::SetMesh( SMDS_Mesh* theMesh )
+void LogicalBinary::SetMesh( const SMDS_Mesh* theMesh )
 {
   if ( myPredicate1 )
     myPredicate1->SetMesh( theMesh );
@@ -1767,11 +1761,10 @@ void Filter::SetPredicate( PredicatePtr thePredicate )
   myPredicate = thePredicate;
 }
 
-
 template<class TElement, class TIterator, class TPredicate> 
-void FillSequence(const TIterator& theIterator,
-                 TPredicate& thePredicate,
-                 Filter::TIdSequence& theSequence)
+inline void FillSequence(const TIterator& theIterator,
+                        TPredicate& thePredicate,
+                        Filter::TIdSequence& theSequence)
 {
   if ( theIterator ) {
     while( theIterator->more() ) {
@@ -1783,40 +1776,46 @@ void FillSequence(const TIterator& theIterator,
   }
 }
 
-Filter::TIdSequence
-Filter::GetElementsId( SMDS_Mesh* theMesh )
+void
+Filter::
+GetElementsId( const SMDS_Mesh* theMesh, 
+              PredicatePtr thePredicate, 
+              TIdSequence& theSequence )
 {
-  TIdSequence aSequence;
-  if ( !theMesh || !myPredicate ) return aSequence;
+  theSequence.clear();
+
+  if ( !theMesh || !thePredicate ) 
+    return;
 
-  myPredicate->SetMesh( theMesh );
+  thePredicate->SetMesh( theMesh );
 
-  SMDSAbs_ElementType aType = myPredicate->GetType();
+  SMDSAbs_ElementType aType = thePredicate->GetType();
   switch(aType){
-  case SMDSAbs_Node:{
-    FillSequence<const SMDS_MeshNode*>(theMesh->nodesIterator(),myPredicate,aSequence);
+  case SMDSAbs_Node:
+    FillSequence<const SMDS_MeshNode*>(theMesh->nodesIterator(),thePredicate,theSequence);
     break;
-  }
-  case SMDSAbs_Edge:{
-    FillSequence<const SMDS_MeshElement*>(theMesh->edgesIterator(),myPredicate,aSequence);
+  case SMDSAbs_Edge:
+    FillSequence<const SMDS_MeshElement*>(theMesh->edgesIterator(),thePredicate,theSequence);
     break;
-  }
-  case SMDSAbs_Face:{
-    FillSequence<const SMDS_MeshElement*>(theMesh->facesIterator(),myPredicate,aSequence);
+  case SMDSAbs_Face:
+    FillSequence<const SMDS_MeshElement*>(theMesh->facesIterator(),thePredicate,theSequence);
     break;
-  }
-  case SMDSAbs_Volume:{
-    FillSequence<const SMDS_MeshElement*>(theMesh->volumesIterator(),myPredicate,aSequence);
+  case SMDSAbs_Volume:
+    FillSequence<const SMDS_MeshElement*>(theMesh->volumesIterator(),thePredicate,theSequence);
     break;
-  }
-  case SMDSAbs_All:{
-    FillSequence<const SMDS_MeshElement*>(theMesh->edgesIterator(),myPredicate,aSequence);
-    FillSequence<const SMDS_MeshElement*>(theMesh->facesIterator(),myPredicate,aSequence);
-    FillSequence<const SMDS_MeshElement*>(theMesh->volumesIterator(),myPredicate,aSequence);
+  case SMDSAbs_All:
+    FillSequence<const SMDS_MeshElement*>(theMesh->edgesIterator(),thePredicate,theSequence);
+    FillSequence<const SMDS_MeshElement*>(theMesh->facesIterator(),thePredicate,theSequence);
+    FillSequence<const SMDS_MeshElement*>(theMesh->volumesIterator(),thePredicate,theSequence);
     break;
   }
-  }
-  return aSequence;
+}
+
+void
+Filter::GetElementsId( const SMDS_Mesh* theMesh,
+                      Filter::TIdSequence& theSequence )
+{
+  GetElementsId(theMesh,myPredicate,theSequence);
 }
 
 /*
@@ -1880,7 +1879,7 @@ ManifoldPart::~ManifoldPart()
   myMesh = 0;
 }
 
-void ManifoldPart::SetMesh( SMDS_Mesh* theMesh )
+void ManifoldPart::SetMesh( const SMDS_Mesh* theMesh )
 {
   myMesh = theMesh;
   process();
@@ -2209,7 +2208,7 @@ ElementsOnSurface::~ElementsOnSurface()
   myMesh = 0;
 }
 
-void ElementsOnSurface::SetMesh( SMDS_Mesh* theMesh )
+void ElementsOnSurface::SetMesh( const SMDS_Mesh* theMesh )
 { 
   if ( myMesh == theMesh )
     return;
index 339157e6cc12e262d5cbc61d1112a3663dfd6cf1..02336ebbcec1e286f6842afd7939f56eb54bc513 100644 (file)
@@ -97,14 +97,14 @@ namespace SMESH{
     {
     public:
       ~Functor(){}
-      virtual void SetMesh( SMDS_Mesh* theMesh ) = 0;
+      virtual void SetMesh( const SMDS_Mesh* theMesh ) = 0;
       virtual SMDSAbs_ElementType GetType() const = 0;
     };
 
     class NumericalFunctor: public virtual Functor{
     public:
       NumericalFunctor();
-      virtual void SetMesh( SMDS_Mesh* theMesh );
+      virtual void SetMesh( const SMDS_Mesh* theMesh );
       virtual double GetValue( long theElementId );
       virtual double GetValue(const TSequenceOfXYZ& thePoints) { return -1.0;};
       virtual SMDSAbs_ElementType GetType() const = 0;
@@ -117,7 +117,7 @@ namespace SMESH{
       static bool GetPoints(const SMDS_MeshElement* theElem, 
                            TSequenceOfXYZ& theRes);
     protected:
-      SMDS_Mesh* myMesh;
+      const SMDS_Mesh* myMesh;
       long       myPrecision;
     };
   
@@ -295,12 +295,12 @@ namespace SMESH{
     class FreeBorders: public virtual Predicate{
     public:
       FreeBorders();
-      virtual void SetMesh( SMDS_Mesh* theMesh );
+      virtual void SetMesh( const SMDS_Mesh* theMesh );
       virtual bool IsSatisfy( long theElementId );
       virtual SMDSAbs_ElementType GetType() const;
             
     protected:
-      SMDS_Mesh* myMesh;
+      const SMDS_Mesh* myMesh;
     };
    
 
@@ -311,12 +311,12 @@ namespace SMESH{
     class BadOrientedVolume: public virtual Predicate{
     public:
       BadOrientedVolume();
-      virtual void SetMesh( SMDS_Mesh* theMesh );
+      virtual void SetMesh( const SMDS_Mesh* theMesh );
       virtual bool IsSatisfy( long theElementId );
       virtual SMDSAbs_ElementType GetType() const;
             
     protected:
-      SMDS_Mesh* myMesh;
+      const SMDS_Mesh* myMesh;
     };
    
 
@@ -327,7 +327,7 @@ namespace SMESH{
     class FreeEdges: public virtual Predicate{
     public:
       FreeEdges();
-      virtual void SetMesh( SMDS_Mesh* theMesh );
+      virtual void SetMesh( const SMDS_Mesh* theMesh );
       virtual bool IsSatisfy( long theElementId );
       virtual SMDSAbs_ElementType GetType() const;
       static bool IsFreeEdge( const SMDS_MeshNode** theNodes, const int theFaceId  );
@@ -342,7 +342,7 @@ namespace SMESH{
       void GetBoreders(TBorders& theBorders);
       
     protected:
-      SMDS_Mesh* myMesh;
+      const SMDS_Mesh* myMesh;
     };
     typedef boost::shared_ptr<FreeEdges> FreeEdgesPtr;
 
@@ -359,7 +359,7 @@ namespace SMESH{
     {
     public:
                                     RangeOfIds();
-      virtual void                  SetMesh( SMDS_Mesh* theMesh );
+      virtual void                  SetMesh( const SMDS_Mesh* theMesh );
       virtual bool                  IsSatisfy( long theNodeId );
       virtual SMDSAbs_ElementType   GetType() const;
       virtual void                  SetType( SMDSAbs_ElementType theType );
@@ -369,7 +369,7 @@ namespace SMESH{
       bool                          SetRangeStr( const TCollection_AsciiString& );
 
     protected:
-      SMDS_Mesh*                    myMesh;
+      const SMDS_Mesh*              myMesh;
 
       TColStd_SequenceOfInteger     myMin;
       TColStd_SequenceOfInteger     myMax;
@@ -389,7 +389,7 @@ namespace SMESH{
     public:
       Comparator();
       virtual ~Comparator();
-      virtual void SetMesh( SMDS_Mesh* theMesh );
+      virtual void SetMesh( const SMDS_Mesh* theMesh );
       virtual void SetMargin(double theValue);
       virtual void SetNumFunctor(NumericalFunctorPtr theFunct);
       virtual bool IsSatisfy( long theElementId ) = 0;
@@ -449,7 +449,7 @@ namespace SMESH{
       LogicalNOT();
       virtual ~LogicalNOT();
       virtual bool IsSatisfy( long theElementId );
-      virtual void SetMesh( SMDS_Mesh* theMesh );
+      virtual void SetMesh( const SMDS_Mesh* theMesh );
       virtual void SetPredicate(PredicatePtr thePred);
       virtual SMDSAbs_ElementType GetType() const;
   
@@ -467,7 +467,7 @@ namespace SMESH{
     public:
       LogicalBinary();
       virtual ~LogicalBinary();
-      virtual void SetMesh( SMDS_Mesh* theMesh );
+      virtual void SetMesh( const SMDS_Mesh* theMesh );
       virtual void SetPredicate1(PredicatePtr thePred);
       virtual void SetPredicate2(PredicatePtr thePred);
       virtual SMDSAbs_ElementType GetType() const;
@@ -532,7 +532,7 @@ namespace SMESH{
       
       ManifoldPart();
       ~ManifoldPart();
-      virtual void SetMesh( SMDS_Mesh* theMesh );
+      virtual void SetMesh( const SMDS_Mesh* theMesh );
       // inoke when all parameters already set
       virtual bool IsSatisfy( long theElementId );
       virtual      SMDSAbs_ElementType GetType() const;
@@ -560,7 +560,7 @@ namespace SMESH{
                               TVectorOfFacePtr& theFaces ) const;
 
     private:
-      SMDS_Mesh*            myMesh;
+      const SMDS_Mesh*      myMesh;
       TColStd_MapOfInteger  myMapIds;
       TColStd_MapOfInteger  myMapBadGeomIds;
       TVectorOfFacePtr      myAllFacePtr;
@@ -582,7 +582,7 @@ namespace SMESH{
     public:
       ElementsOnSurface();
       ~ElementsOnSurface();
-      virtual void SetMesh( SMDS_Mesh* theMesh );
+      virtual void SetMesh( const SMDS_Mesh* theMesh );
       virtual bool IsSatisfy( long theElementId );
       virtual      SMDSAbs_ElementType GetType() const;
 
@@ -597,7 +597,7 @@ namespace SMESH{
       bool    isOnSurface( const SMDS_MeshNode* theNode ) const;
 
     private:
-      SMDS_Mesh*            myMesh;
+      const SMDS_Mesh*      myMesh;
       TColStd_MapOfInteger  myIds;
       SMDSAbs_ElementType   myType;
       Handle(Geom_Surface)  mySurf;
@@ -615,9 +615,20 @@ namespace SMESH{
       Filter();
       virtual ~Filter();
       virtual void SetPredicate(PredicatePtr thePred);
+
       typedef std::vector<long> TIdSequence;
-      virtual TIdSequence GetElementsId( SMDS_Mesh* theMesh );
-  
+
+      virtual 
+      void
+      GetElementsId( const SMDS_Mesh* theMesh,
+                    TIdSequence& theSequence );
+
+      static
+      void
+      GetElementsId( const SMDS_Mesh* theMesh, 
+                    PredicatePtr thePredicate,
+                    TIdSequence& theSequence );
+      
     protected:
       PredicatePtr myPredicate;
     };
index 1433e3208a970c74ef6d00e1f498552e3100d94d..1a00746042374f9401e848c6196d5c0c1f2c0e43 100644 (file)
@@ -268,7 +268,175 @@ Driver_Mesh::Status DriverMED_R_SMESHDS_Mesh::Perform()
          MED::TGeom::const_iterator anTGeomIter = aTGeom.begin();
          for(; anTGeomIter != aTGeom.end(); anTGeomIter++){
            const EGeometrieElement& aGeom = anTGeomIter->first;
-           if(aGeom == ePOINT1) continue;
+
+           if (aGeom == ePOINT1) {
+              continue;
+
+            } else if (aGeom == ePOLYGONE) {
+              PPolygoneInfo aPolygoneInfo = aMed->GetPPolygoneInfo(aMeshInfo,anEntity,aGeom);
+              EBooleen anIsElemNum = takeNumbers ? aPolygoneInfo->IsElemNum() : eFAUX;
+
+              TElemNum aConn  = aPolygoneInfo->GetConnectivite();
+              TElemNum aIndex = aPolygoneInfo->GetIndex();
+
+              TInt nbPolygons = aPolygoneInfo->GetNbElem();
+
+              for (TInt iPG = 0; iPG < nbPolygons; iPG++) {
+                // get nodes
+                TInt aCurrPG_FirstNodeIndex = aIndex[iPG] - 1;
+                int nbNodes = aPolygoneInfo->GetNbConn(iPG);
+                std::vector<int> nodes_ids (nbNodes);
+                //for (TInt inode = 0; inode < nbNodes; inode++) {
+                //  nodes_ids[inode] = aConn[aCurrPG_FirstNodeIndex + inode];
+                //}
+#ifdef _EDF_NODE_IDS_
+               if (anIsNodeNum) {
+                 for (TInt inode = 0; inode < nbNodes; inode++) {
+                   nodes_ids[inode] = aNodeInfo->GetElemNum(aConn[aCurrPG_FirstNodeIndex + inode] - 1);
+                 }
+               } else {
+                 for (TInt inode = 0; inode < nbNodes; inode++) {
+                   nodes_ids[inode] = aConn[aCurrPG_FirstNodeIndex + inode];
+                 }
+               }
+#else
+               for (TInt inode = 0; inode < nbNodes; inode++) {
+                 nodes_ids[inode] = aConn[aCurrPG_FirstNodeIndex + inode];
+               }
+#endif
+
+                bool isRenum = false;
+                SMDS_MeshElement* anElement = NULL;
+                TInt aFamNum = aPolygoneInfo->GetFamNum(iPG);
+
+                try {
+                  if (anIsElemNum) {
+                    anElement = myMesh->AddPolygonalFaceWithID
+                      (nodes_ids, aPolygoneInfo->GetElemNum(iPG));
+                  }
+                  if (!anElement) {
+                    std::vector<const SMDS_MeshNode*> nodes (nbNodes);
+                    for (int inode = 0; inode < nbNodes; inode++) {
+                      nodes[inode] = FindNode(myMesh, nodes_ids[inode]);
+                    }
+                    anElement = myMesh->AddPolygonalFace(nodes);
+                    isRenum = anIsElemNum;
+                  }
+                } catch (const std::exception& exc) {
+                  aResult = DRS_FAIL;
+                } catch (...) {
+                  aResult = DRS_FAIL;
+                }
+
+                if (!anElement) {
+                  aResult = DRS_WARN_SKIP_ELEM;
+                } else {
+                  if (isRenum) {
+                    anIsElemNum = eFAUX;
+                    takeNumbers = false;
+                    if (aResult < DRS_WARN_RENUMBER)
+                      aResult = DRS_WARN_RENUMBER;
+                  }
+                  if (myFamilies.find(aFamNum) != myFamilies.end()) {
+                    // Save reference to this element from its family
+                    myFamilies[aFamNum]->AddElement(anElement);
+                    myFamilies[aFamNum]->SetType(anElement->GetType());
+                  }
+                }
+              } // for (TInt iPG = 0; iPG < nbPolygons; iPG++)
+              continue;
+
+            } else if (aGeom == ePOLYEDRE) {
+              PPolyedreInfo aPolyedreInfo = aMed->GetPPolyedreInfo(aMeshInfo,anEntity,aGeom);
+              EBooleen anIsElemNum = takeNumbers ? aPolyedreInfo->IsElemNum() : eFAUX;
+
+              TElemNum aConn       = aPolyedreInfo->GetConnectivite();
+              TElemNum aFacesIndex = aPolyedreInfo->GetFacesIndex();
+              TElemNum aIndex      = aPolyedreInfo->GetIndex();
+
+              TInt nbPolyedres = aPolyedreInfo->GetNbElem();
+
+              for (int iPE = 0; iPE < nbPolyedres; iPE++) {
+                // get faces
+                int aCurrPE_FirstFaceIndex = aIndex[iPE] - 1;
+                int aNextPE_FirstFaceIndex = aIndex[iPE + 1] - 1;
+                int nbFaces = aNextPE_FirstFaceIndex - aCurrPE_FirstFaceIndex;
+                std::vector<int> quantities (nbFaces);
+                for (int iFa = 0; iFa < nbFaces; iFa++) {
+                  int aCurrFace_FirstNodeIndex = aFacesIndex[aCurrPE_FirstFaceIndex + iFa] - 1;
+                  int aNextFace_FirstNodeIndex = aFacesIndex[aCurrPE_FirstFaceIndex + iFa + 1] - 1;
+
+                  int nbNodes = aNextFace_FirstNodeIndex - aCurrFace_FirstNodeIndex;
+                  quantities[iFa] = nbNodes;
+                }
+
+                // get nodes
+                int aCurrPE_FirstNodeIndex = aFacesIndex[aCurrPE_FirstFaceIndex] - 1;
+                int nbPENodes = aPolyedreInfo->GetNbConn(iPE);
+                std::vector<int> nodes_ids (nbPENodes);
+                //for (int inode = 0; inode < nbPENodes; inode++) {
+                //  nodes_ids[inode] = aConn[aCurrPE_FirstNodeIndex + inode];
+                //}
+#ifdef _EDF_NODE_IDS_
+               if (anIsNodeNum) {
+                 for (int inode = 0; inode < nbPENodes; inode++) {
+                   nodes_ids[inode] = aNodeInfo->GetElemNum(aConn[aCurrPE_FirstNodeIndex + inode] - 1);
+                 }
+               } else {
+                 for (int inode = 0; inode < nbPENodes; inode++) {
+                   nodes_ids[inode] = aConn[aCurrPE_FirstNodeIndex + inode];
+                 }
+               }
+#else
+               for (int inode = 0; inode < nbPENodes; inode++) {
+                 nodes_ids[inode] = aConn[aCurrPE_FirstNodeIndex + inode];
+               }
+#endif
+
+                bool isRenum = false;
+                SMDS_MeshElement* anElement = NULL;
+                TInt aFamNum = aPolyedreInfo->GetFamNum(iPE);
+
+                try {
+                  if (anIsElemNum) {
+                    anElement = myMesh->AddPolyhedralVolumeWithID
+                      (nodes_ids, quantities, aPolyedreInfo->GetElemNum(iPE));
+                  }
+                  if (!anElement) {
+                    std::vector<const SMDS_MeshNode*> nodes (nbPENodes);
+                    for (int inode = 0; inode < nbPENodes; inode++) {
+                      nodes[inode] = FindNode(myMesh, nodes_ids[inode]);
+                    }
+                    anElement = myMesh->AddPolyhedralVolume(nodes, quantities);
+                    isRenum = anIsElemNum;
+                  }
+                } catch (const std::exception& exc) {
+                  aResult = DRS_FAIL;
+                } catch (...) {
+                  aResult = DRS_FAIL;
+                }
+
+                if (!anElement) {
+                  aResult = DRS_WARN_SKIP_ELEM;
+                } else {
+                  if (isRenum) {
+                    anIsElemNum = eFAUX;
+                    takeNumbers = false;
+                    if (aResult < DRS_WARN_RENUMBER)
+                      aResult = DRS_WARN_RENUMBER;
+                  }
+                  if (myFamilies.find(aFamNum) != myFamilies.end()) {
+                    // Save reference to this element from its family
+                    myFamilies[aFamNum]->AddElement(anElement);
+                    myFamilies[aFamNum]->SetType(anElement->GetType());
+                  }
+                }
+              } // for (int iPE = 0; iPE < nbPolyedres; iPE++)
+              continue;
+
+            } else {
+            }
+
            PCellInfo aCellInfo = aMed->GetPCellInfo(aMeshInfo,anEntity,aGeom);
            EBooleen anIsElemNum = takeNumbers ? aCellInfo->IsElemNum() : eFAUX;
            TInt aNbElems = aCellInfo->GetNbElem();
@@ -343,6 +511,8 @@ Driver_Mesh::Status DriverMED_R_SMESHDS_Mesh::Perform()
              SMDS_MeshElement* anElement = NULL;
              TInt aFamNum = aCellInfo->GetFamNum(iElem);
              try{
+                //MESSAGE("Try to create element # " << iElem << " with id = "
+                //        << aCellInfo->GetElemNum(iElem));
                switch(aGeom){
                case eSEG2:
                case eSEG3:
@@ -586,7 +756,7 @@ void DriverMED_R_SMESHDS_Mesh::GetGroup(SMESHDS_Group* theGroup)
       for (; anElemsIter != anElements.end(); anElemsIter++)
       {
         element = *anElemsIter;
-        theGroup->SMDSGroup().Add(element);
+       theGroup->SMDSGroup().Add(element);
       }
       if ( element )
         theGroup->SetType( element->GetType() );
index edd5418c4cb574a0b54a2924ad12c5b636e920d2..82e134adfd93c63021cf5d63645bd886b2e0bff6 100644 (file)
@@ -33,6 +33,8 @@
 #include "SMESHDS_Mesh.hxx"
 #include "SMDS_MeshElement.hxx"
 #include "SMDS_MeshNode.hxx"
+#include "SMDS_PolyhedralVolumeOfNodes.hxx"
+
 #include "utilities.h"
 
 #include "MED_Utilities.hxx"
@@ -61,7 +63,7 @@ void DriverMED_W_SMESHDS_Mesh::SetFile(const std::string& theFileName,
 
 void DriverMED_W_SMESHDS_Mesh::SetFile(const std::string& theFileName)
 {
-  return SetFile(theFileName,MED::eV2_1);
+  return SetFile(theFileName,MED::eV2_2);
 }
 
 void DriverMED_W_SMESHDS_Mesh::SetMeshName(const std::string& theMeshName)
@@ -440,6 +442,16 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
       MED::TIntVector aQuadConn;
       aQuadConn.reserve(aNbElems*aNbQuadConn);
 
+      MED::TIntVector aPolygoneElemNums;
+      aPolygoneElemNums.reserve(aNbElems);
+      MED::TIntVector aPolygoneInds;
+      aPolygoneInds.reserve(aNbElems + 1);
+      aPolygoneInds.push_back(1); // reference on the first element in the connectivities
+      MED::TIntVector aPolygoneFamilyNums;
+      aPolygoneFamilyNums.reserve(aNbElems);
+      MED::TIntVector aPolygoneConn;
+      aPolygoneConn.reserve(aNbElems*aNbQuadConn);
+
       for(TInt iElem = 0; iElem < aNbElems && anIter->more(); iElem++){
        const SMDS_MeshFace* anElem = anIter->next();
        TInt aNbNodes = anElem->NbNodes();
@@ -448,41 +460,42 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
        MED::TIntVector* anElemNums;
         MED::TIntVector* aFamilyNums;
        MED::TIntVector* aConnectivity;
-       switch(aNbNodes){
-       case 3:
-         aNbConnectivity = aNbTriaConn;
-         anElemNums = &anTriaElemNums;
-         aFamilyNums = &aTriaFamilyNums;
-         aConnectivity = &aTriaConn;
-         break;
-       case 4:
-         aNbConnectivity = aNbQuadConn;
-         anElemNums = &aQuadElemNums;
-         aFamilyNums = &aQuadFamilyNums;
-         aConnectivity = &aQuadConn;
-         break;
-       }
+        if (anElem->IsPoly()) {
+         aNbConnectivity = aNbNodes;
+          anElemNums = &aPolygoneElemNums;
+          aFamilyNums = &aPolygoneFamilyNums;
+          aConnectivity = &aPolygoneConn;
+        } else {
+          switch(aNbNodes){
+          case 3:
+            aNbConnectivity = aNbTriaConn;
+            anElemNums = &anTriaElemNums;
+            aFamilyNums = &aTriaFamilyNums;
+            aConnectivity = &aTriaConn;
+            break;
+          case 4:
+            aNbConnectivity = aNbQuadConn;
+            anElemNums = &aQuadElemNums;
+            aFamilyNums = &aQuadFamilyNums;
+            aConnectivity = &aQuadConn;
+            break;
+          default:
+            break;
+          }
+        }
        MED::TIntVector aVector(aNbNodes);
        for(TInt iNode = 0; aNodesIter->more(); iNode++){
          const SMDS_MeshElement* aNode = aNodesIter->next();
+#ifdef _EDF_NODE_IDS_
+         aVector[iNode] = aNodeIdMap[aNode->GetID()];
+#else
          aVector[iNode] = aNode->GetID();
+#endif
        }
 
        TInt aSize = aConnectivity->size();
        aConnectivity->resize(aSize+aNbConnectivity);
-       // There is some differnce between SMDS and MED in cells mapping
-#ifdef _EDF_NODE_IDS_
-       switch(aNbNodes){
-       case 4:
-         (*aConnectivity)[aSize+0] = aNodeIdMap[aVector[0]];
-         (*aConnectivity)[aSize+1] = aNodeIdMap[aVector[1]];
-         (*aConnectivity)[aSize+2] = aNodeIdMap[aVector[3]];  
-         (*aConnectivity)[aSize+3] = aNodeIdMap[aVector[2]];  
-       default:
-         for(TInt iNode = 0; iNode < aNbNodes; iNode++) 
-           (*aConnectivity)[aSize+iNode] = aNodeIdMap[aVector[iNode]];
-       }
-#else
+       // There is some differences between SMDS and MED in cells mapping
        switch(aNbNodes){
        case 4:
          (*aConnectivity)[aSize+0] = aVector[0];
@@ -493,7 +506,13 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
          for(TInt iNode = 0; iNode < aNbNodes; iNode++) 
            (*aConnectivity)[aSize+iNode] = aVector[iNode];
        }
-#endif
+
+        if (anElem->IsPoly()) {
+          // fill indices for polygonal element
+          TInt aPrevPos = aPolygoneInds.back();
+          aPolygoneInds.push_back(aPrevPos + aNbNodes);
+        }
+
        anElemNums->push_back(anElem->GetID());
 
         if (anElemFamMap.find(anElem) != anElemFamMap.end())
@@ -523,6 +542,22 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
        MESSAGE("Perform - anEntity = "<<SMDS_MED_ENTITY<<"; aGeom = "<<eQUAD4<<"; aNbElems = "<<aNbElems);
        myMed->SetCellInfo(aCellInfo);
       }
+      if(TInt aNbElems = aPolygoneElemNums.size()){
+        // add one element in connectivities,
+        // referenced by the last element in indices
+        aPolygoneConn.push_back(0);
+
+       PPolygoneInfo aCellInfo = myMed->CrPolygoneInfo(aMeshInfo,
+                                                        SMDS_MED_ENTITY,
+                                                        ePOLYGONE,
+                                                        SMDS_MED_CONNECTIVITY,
+                                                        aPolygoneConn,
+                                                        aPolygoneInds,
+                                                        aPolygoneFamilyNums,
+                                                        aPolygoneElemNums);
+       MESSAGE("Perform - anEntity = "<<SMDS_MED_ENTITY<<"; aGeom = "<<ePOLYGONE<<"; aNbElems = "<<aNbElems);
+       myMed->SetPolygoneInfo(aCellInfo);
+      }
     }
 
     // Storing SMDS Volumes
@@ -563,74 +598,111 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
       MED::TIntVector aHexaConn;
       aHexaConn.reserve(aNbElems*aNbHexaConn);
 
+      MED::TIntVector aPolyedreElemNums;
+      aPolyedreElemNums.reserve(aNbElems);
+      MED::TIntVector aPolyedreInds;
+      aPolyedreInds.reserve(aNbElems + 1);
+      aPolyedreInds.push_back(1); // reference on the first element in the faces
+      MED::TIntVector aPolyedreFaces;
+      aPolyedreFaces.reserve(aNbElems + 1);
+      aPolyedreFaces.push_back(1); // reference on the first element in the connectivities
+      MED::TIntVector aPolyedreFamilyNums;
+      aPolyedreFamilyNums.reserve(aNbElems);
+      MED::TIntVector aPolyedreConn;
+      aPolyedreConn.reserve(aNbElems*aNbHexaConn);
+
       for(TInt iElem = 0; iElem < aNbElems && anIter->more(); iElem++){
        const SMDS_MeshVolume* anElem = anIter->next();
-       TInt aNbNodes = anElem->NbNodes();
-       SMDS_ElemIteratorPtr aNodesIter = anElem->nodesIterator();
-       TInt aNbConnectivity;
-       MED::TIntVector* anElemNums;
-       MED::TIntVector* aFamilyNums;
-       MED::TIntVector* aConnectivity;
-       switch(aNbNodes){
-       case 4:
-         aNbConnectivity = aNbTetraConn;
-         anElemNums = &anTetraElemNums;
-         aFamilyNums = &aTetraFamilyNums;
-         aConnectivity = &aTetraConn;
-         break;
-       case 5:
-         aNbConnectivity = aNbPyraConn;
-         anElemNums = &anPyraElemNums;
-         aFamilyNums = &aPyraFamilyNums;
-         aConnectivity = &aPyraConn;
-         break;
-       case 6:
-         aNbConnectivity = aNbPentaConn;
-         anElemNums = &anPentaElemNums;
-         aFamilyNums = &aPentaFamilyNums;
-         aConnectivity = &aPentaConn;
-         break;
-       case 8:
-         aNbConnectivity = aNbHexaConn;
-         anElemNums = &aHexaElemNums;
-         aFamilyNums = &aHexaFamilyNums;
-         aConnectivity = &aHexaConn;
-       }
 
-       MED::TIntVector aVector(aNbNodes);
-       for(TInt iNode = 0; aNodesIter->more(); iNode++){
-         const SMDS_MeshElement* aNode = aNodesIter->next();
-         aVector[iNode] = aNode->GetID();
-       }
-       TInt aSize = aConnectivity->size();
-       aConnectivity->resize(aSize+aNbConnectivity);
-       // There is some difference between SMDS and MED in cells mapping
+        MED::TIntVector* anElemNums;
+        MED::TIntVector* aFamilyNums;
+
+        if (anElem->IsPoly()) {
+          const SMDS_PolyhedralVolumeOfNodes* aPolyedre =
+            (const SMDS_PolyhedralVolumeOfNodes*) anElem;
+          if (!aPolyedre) {
+            MESSAGE("Warning: bad volumic element");
+            continue;
+          }
+
+          anElemNums = &aPolyedreElemNums;
+          aFamilyNums = &aPolyedreFamilyNums;
+
+          TInt aNodeId, aNbFaces = aPolyedre->NbFaces();
+          for (int iface = 1; iface <= aNbFaces; iface++) {
+            int aNbFaceNodes = aPolyedre->NbFaceNodes(iface);
+            for (int inode = 1; inode <= aNbFaceNodes; inode++) {
+              aNodeId = aPolyedre->GetFaceNode(iface, inode)->GetID();
 #ifdef _EDF_NODE_IDS_
-       switch(aNbNodes){
-       case 5:
-         (*aConnectivity)[aSize+0] = aNodeIdMap[aVector[0]];
-         (*aConnectivity)[aSize+1] = aNodeIdMap[aVector[3]];
-         (*aConnectivity)[aSize+2] = aNodeIdMap[aVector[2]];  
-         (*aConnectivity)[aSize+3] = aNodeIdMap[aVector[1]];  
-         (*aConnectivity)[aSize+4] = aNodeIdMap[aVector[4]];  
-       default:
-         for(TInt iNode = 0; iNode < aNbNodes; iNode++) 
-           (*aConnectivity)[aSize+iNode] = aNodeIdMap[aVector[iNode]];
-       }
+              aPolyedreConn.push_back(aNodeIdMap[aNodeId]);
 #else
-       switch(aNbNodes){
-       case 5:
-         (*aConnectivity)[aSize+0] = aVector[0];
-         (*aConnectivity)[aSize+1] = aVector[3];
-         (*aConnectivity)[aSize+2] = aVector[2];  
-         (*aConnectivity)[aSize+3] = aVector[1];  
-         (*aConnectivity)[aSize+4] = aVector[4];  
-       default:
-         for(TInt iNode = 0; iNode < aNbNodes; iNode++) 
-           (*aConnectivity)[aSize+iNode] = aVector[iNode];
-       }
+              aPolyedreConn.push_back(aNodeId);
 #endif
-       anElemNums->push_back(anElem->GetID());
+            }
+            TInt aPrevPos = aPolyedreFaces.back();
+            aPolyedreFaces.push_back(aPrevPos + aNbFaceNodes);
+          }
+          TInt aPrevPos = aPolyedreInds.back();
+          aPolyedreInds.push_back(aPrevPos + aNbFaces);
+
+        } else {
+          TInt aNbNodes = anElem->NbNodes();
+          SMDS_ElemIteratorPtr aNodesIter = anElem->nodesIterator();
+          TInt aNbConnectivity;
+          MED::TIntVector* aConnectivity;
+          switch(aNbNodes){
+          case 4:
+            aNbConnectivity = aNbTetraConn;
+            anElemNums = &anTetraElemNums;
+            aFamilyNums = &aTetraFamilyNums;
+            aConnectivity = &aTetraConn;
+            break;
+          case 5:
+            aNbConnectivity = aNbPyraConn;
+            anElemNums = &anPyraElemNums;
+            aFamilyNums = &aPyraFamilyNums;
+            aConnectivity = &aPyraConn;
+            break;
+          case 6:
+            aNbConnectivity = aNbPentaConn;
+            anElemNums = &anPentaElemNums;
+            aFamilyNums = &aPentaFamilyNums;
+            aConnectivity = &aPentaConn;
+            break;
+          case 8:
+            aNbConnectivity = aNbHexaConn;
+            anElemNums = &aHexaElemNums;
+            aFamilyNums = &aHexaFamilyNums;
+            aConnectivity = &aHexaConn;
+          }
+
+          TInt aSize = aConnectivity->size();
+          aConnectivity->resize(aSize + aNbConnectivity);
+
+          MED::TIntVector aVector(aNbNodes);
+          for(TInt iNode = 0; aNodesIter->more(); iNode++){
+            const SMDS_MeshElement* aNode = aNodesIter->next();
+#ifdef _EDF_NODE_IDS_
+            aVector[iNode] = aNodeIdMap[aNode->GetID()];
+#else
+            aVector[iNode] = aNode->GetID();
+#endif
+          }
+          // There is some difference between SMDS and MED in cells mapping
+          switch(aNbNodes){
+          case 5:
+            (*aConnectivity)[aSize+0] = aVector[0];
+            (*aConnectivity)[aSize+1] = aVector[3];
+            (*aConnectivity)[aSize+2] = aVector[2];  
+            (*aConnectivity)[aSize+3] = aVector[1];  
+            (*aConnectivity)[aSize+4] = aVector[4];  
+          default:
+            for(TInt iNode = 0; iNode < aNbNodes; iNode++) 
+              (*aConnectivity)[aSize+iNode] = aVector[iNode];
+          }
+        }
+
+        anElemNums->push_back(anElem->GetID());
 
         if (anElemFamMap.find(anElem) != anElemFamMap.end())
           aFamilyNums->push_back(anElemFamMap[anElem]);
@@ -682,6 +754,23 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
        MESSAGE("Perform - anEntity = "<<SMDS_MED_ENTITY<<"; aGeom = "<<eHEXA8<<"; aNbElems = "<<aNbElems);
        myMed->SetCellInfo(aCellInfo);
       }
+      if(TInt aNbElems = aPolyedreElemNums.size()){
+        // add one element in connectivities,
+        // referenced by the last element in faces
+        aPolyedreConn.push_back(0);
+
+       PPolyedreInfo aCellInfo = myMed->CrPolyedreInfo(aMeshInfo,
+                                                        SMDS_MED_ENTITY,
+                                                        ePOLYEDRE,
+                                                        SMDS_MED_CONNECTIVITY,
+                                                        aPolyedreConn,
+                                                        aPolyedreFaces,
+                                                        aPolyedreInds,
+                                                        aPolyedreFamilyNums,
+                                                        aPolyedreElemNums);
+       MESSAGE("Perform - anEntity = "<<SMDS_MED_ENTITY<<"; aGeom = "<<ePOLYEDRE<<"; aNbElems = "<<aNbElems);
+       myMed->SetPolyedreInfo(aCellInfo);
+      }
     }
   }catch(const std::exception& exc){
     INFOS("Follow exception was cought:\n\t"<<exc.what());
index 93c2cff5bfd0dcbeab51d5f2f033a76ea5c5032a..2064453af0c8a91a3abbe646b226a305acbe1d33 100644 (file)
 //  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
 
 #include <stdio.h>
-
-#include "DriverSTL_R_SMDS_Mesh.h"
-
-#include "SMDS_Mesh.hxx"
-#include "SMDS_MeshElement.hxx"
-#include "SMDS_MeshNode.hxx"
 #include <gp_Pnt.hxx>
-#include <OSD_Path.hxx>
-#include <OSD_File.hxx>
-#include <OSD_FromWhere.hxx>
-#include <OSD_Protection.hxx>
-#include <OSD_SingleProtection.hxx>
-#include <NCollection_DataMap.hxx>
-#include <Standard_NoMoreObject.hxx>
-
-#include "utilities.h"
-
-static const int HEADER_SIZE           =  84;
-static const int SIZEOF_STL_FACET      =  50;
-//static const int STL_MIN_FILE_SIZE     = 284;
-static const int ASCII_LINES_PER_FACET =   7;
-
-static Standard_Real tab1[3];
-static Standard_Real tab2[3];
-
-typedef NCollection_DataMap<gp_Pnt,SMDS_MeshNode*> DriverSTL_DataMapOfPntNodePtr;
-//typedef NCollection_BaseCollection<SMDS_MeshNodePtr> DriverSTL_ColOfNodePtr;
-
 //=======================================================================
 //function : HashCode
 //purpose  : 
 //=======================================================================
 inline Standard_Integer HashCode
-  (const gp_Pnt& point, const Standard_Integer Upper)
+  (const gp_Pnt& point,  Standard_Integer Upper)
 {
   union 
     {
@@ -63,7 +36,8 @@ inline Standard_Integer HashCode
 
   return ::HashCode(U.I[0]/23+U.I[1]/19+U.I[2]/17+U.I[3]/13+U.I[4]/11+U.I[5]/7,Upper);
 }
-
+static Standard_Real tab1[3];
+static Standard_Real tab2[3];
 //=======================================================================
 //function : IsEqual
 //purpose  : 
@@ -75,7 +49,32 @@ inline Standard_Boolean IsEqual
   point2.Coord(tab2[0],tab2[1],tab2[2]);  
   return (memcmp(tab1,tab2,sizeof(tab1)) == 0);
 }
+#include "DriverSTL_R_SMDS_Mesh.h"
+
+#include "SMDS_Mesh.hxx"
+#include "SMDS_MeshElement.hxx"
+#include "SMDS_MeshNode.hxx"
+
+#include <OSD_Path.hxx>
+#include <OSD_File.hxx>
+#include <OSD_FromWhere.hxx>
+#include <OSD_Protection.hxx>
+#include <OSD_SingleProtection.hxx>
+#include <Standard_NoMoreObject.hxx>
 
+#include "utilities.h"
+
+static const int HEADER_SIZE           =  84;
+static const int SIZEOF_STL_FACET      =  50;
+//static const int STL_MIN_FILE_SIZE     = 284;
+static const int ASCII_LINES_PER_FACET =   7;
+
+
+//typedef NCollection_BaseCollection<SMDS_MeshNodePtr> DriverSTL_ColOfNodePtr;
+
+
+#include <NCollection_DataMap.hxx>
+typedef NCollection_DataMap<gp_Pnt,SMDS_MeshNode*> DriverSTL_DataMapOfPntNodePtr;
 //=======================================================================
 //function : DriverSTL_R_SMDS_Mesh
 //purpose  : 
index bc91acb4af0d4d32c5af5b6e338848adf173570f..8cf070ccf99b7651d97d2ff073892930dbf1bab7 100644 (file)
@@ -50,9 +50,9 @@ LIB_CLIENT_IDL = SALOME_Exception.idl \
 BIN = 
 BIN_SRC        =
 
-CPPFLAGS+=$(OCC_INCLUDES) $(VTK_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome \
+CPPFLAGS+=$(OCC_INCLUDES) $(VTK_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome -I${GUI_ROOT_DIR}/include/salome \
          $(BOOST_CPPFLAGS) $(QT_INCLUDES)
-LDFLAGS+=$(OCC_KERNEL_LIBS) $(VTK_LIBS) -L${KERNEL_ROOT_DIR}/lib/salome -lSMDS \
-         -lSalomeGUI -lSalomeObject -lSMESHControls
+LDFLAGS+=$(OCC_KERNEL_LIBS) $(VTK_LIBS) -L${KERNEL_ROOT_DIR}/lib/salome -L${GUI_ROOT_DIR}/lib/salome -lSMDS \
+         -lSalomeApp -lSalomeObject -lSMESHControls
 
 @CONCLUDE@
index 004399a7f4cdbb6923a31111b53e091e4cd0290d..3db87dba4085d86f0f466b5e1c53d3a2befcff10 100644 (file)
@@ -31,9 +31,9 @@
 #include "SMESH_ActorUtils.h"
 #include "SMESH_DeviceActor.h"
 #include "SMESH_ControlsDef.hxx"
-#include "SALOME_ExtractUnstructuredGrid.h"
+#include <VTKViewer_ExtractUnstructuredGrid.h>
 
-#include "QAD_Config.h"
+//#include "QAD_Config.h"
 #include <qstringlist.h>
 
 #include <vtkTimeStamp.h>
@@ -73,7 +73,7 @@
 #include "utilities.h"
 
 #ifdef _DEBUG_
-static int MYDEBUG = 0;
+static int MYDEBUG = 1;
 #else
 static int MYDEBUG = 0;
 #endif
@@ -118,7 +118,7 @@ SMESH_ActorDef::SMESH_ActorDef()
   float aLineWidth = SMESH::GetFloat("SMESH:SettingsWidth",1);
 
   vtkMatrix4x4 *aMatrix = vtkMatrix4x4::New();
-  SALOME_ExtractUnstructuredGrid* aFilter = NULL;
+  VTKViewer_ExtractUnstructuredGrid* aFilter = NULL;
 
   //Definition 2D and 3D divices of the actor
   //-----------------------------------------
@@ -142,7 +142,7 @@ SMESH_ActorDef::SMESH_ActorDef()
   my2DActor->SetBackfaceProperty(myBackSurfaceProp);
   my2DActor->SetRepresentation(SMESH_DeviceActor::eSurface);
   aFilter = my2DActor->GetExtractUnstructuredGrid();
-  aFilter->SetModeOfChanging(SALOME_ExtractUnstructuredGrid::eAdding);
+  aFilter->SetModeOfChanging(VTKViewer_ExtractUnstructuredGrid::eAdding);
   aFilter->RegisterCellsWithType(VTK_TRIANGLE);
   aFilter->RegisterCellsWithType(VTK_POLYGON);
   aFilter->RegisterCellsWithType(VTK_QUAD);
@@ -154,13 +154,13 @@ SMESH_ActorDef::SMESH_ActorDef()
   my3DActor->SetBackfaceProperty(myBackSurfaceProp);
   my3DActor->SetRepresentation(SMESH_DeviceActor::eSurface);
   aFilter = my3DActor->GetExtractUnstructuredGrid();
-  aFilter->SetModeOfChanging(SALOME_ExtractUnstructuredGrid::eAdding);
+  aFilter->SetModeOfChanging(VTKViewer_ExtractUnstructuredGrid::eAdding);
   aFilter->RegisterCellsWithType(VTK_TETRA);
   aFilter->RegisterCellsWithType(VTK_VOXEL);
   aFilter->RegisterCellsWithType(VTK_HEXAHEDRON);
   aFilter->RegisterCellsWithType(VTK_WEDGE);
   aFilter->RegisterCellsWithType(VTK_PYRAMID);
-
+  aFilter->RegisterCellsWithType(VTK_CONVEX_POINT_SET);
 
   //Definition 1D divice of the actor
   //---------------------------------
@@ -181,7 +181,7 @@ SMESH_ActorDef::SMESH_ActorDef()
   my1DActor->SetProperty(myEdgeProp);
   my1DActor->SetRepresentation(SMESH_DeviceActor::eSurface);
   aFilter = my1DActor->GetExtractUnstructuredGrid();
-  aFilter->SetModeOfChanging(SALOME_ExtractUnstructuredGrid::eAdding);
+  aFilter->SetModeOfChanging(VTKViewer_ExtractUnstructuredGrid::eAdding);
   aFilter->RegisterCellsWithType(VTK_LINE);
 
   my1DProp = vtkProperty::New();
@@ -206,7 +206,7 @@ SMESH_ActorDef::SMESH_ActorDef()
   my1DExtActor->SetProperty(my1DExtProp);
   my1DExtActor->SetRepresentation(SMESH_DeviceActor::eInsideframe);
   aFilter = my1DExtActor->GetExtractUnstructuredGrid();
-  aFilter->SetModeOfChanging(SALOME_ExtractUnstructuredGrid::eAdding);
+  aFilter->SetModeOfChanging(VTKViewer_ExtractUnstructuredGrid::eAdding);
   aFilter->RegisterCellsWithType(VTK_LINE);
 
 
@@ -227,7 +227,7 @@ SMESH_ActorDef::SMESH_ActorDef()
   myNodeActor->SetProperty(myNodeProp);
   myNodeActor->SetRepresentation(SMESH_DeviceActor::ePoint);
   aFilter = myNodeActor->GetExtractUnstructuredGrid();
-  aFilter->SetModeOfExtraction(SALOME_ExtractUnstructuredGrid::ePoints);
+  aFilter->SetModeOfExtraction(VTKViewer_ExtractUnstructuredGrid::ePoints);
 
 
   //Definition of Pickable and Highlitable engines
@@ -288,38 +288,38 @@ SMESH_ActorDef::SMESH_ActorDef()
 
   vtkTextProperty* aScalarBarTitleProp = vtkTextProperty::New();
 
-  if ( QAD_CONFIG->hasSetting( "SMESH:ScalarBarTitleColor" ) ) {
+/*  if ( QAD_CONFIG->hasSetting( "SMESH:ScalarBarTitleColor" ) ) {
     QStringList aTColor = QStringList::split(  ":", QAD_CONFIG->getSetting( "SMESH:ScalarBarTitleColor" ), false );
     aScalarBarTitleProp->SetColor( ( aTColor.count() > 0 ? aTColor[0].toInt()/255. : 1.0 ),
-                                  ( aTColor.count() > 1 ? aTColor[1].toInt()/255. : 1.0 ), 
+                                  ( aTColor.count() > 1 ? aTColor[1].toInt()/255. : 1.0 ),
                                   ( aTColor.count() > 2 ? aTColor[2].toInt()/255. : 1.0 ) );
   }
-  else
+  else*/
     aScalarBarTitleProp->SetColor( 1.0, 1.0, 1.0 );
 
   aScalarBarTitleProp->SetFontFamilyToArial();
-  if( QAD_CONFIG->hasSetting( "SMESH:ScalarBarTitleFont" ) ){
+  /*if( QAD_CONFIG->hasSetting( "SMESH:ScalarBarTitleFont" ) ){
     if ( QAD_CONFIG->getSetting( "SMESH:ScalarBarTitleFont" ) == "Arial" )
       aScalarBarTitleProp->SetFontFamilyToArial();
     else if ( QAD_CONFIG->getSetting( "SMESH:ScalarBarTitleFont" ) == "Courier" )
       aScalarBarTitleProp->SetFontFamilyToCourier();
     else if ( QAD_CONFIG->getSetting( "SMESH:ScalarBarTitleFont" ) == "Times" )
       aScalarBarTitleProp->SetFontFamilyToTimes();
-  }
+  }*/
 
-  if ( QAD_CONFIG->getSetting( "SMESH:ScalarBarTitleBold" ) == "true" )
+  /*if ( QAD_CONFIG->getSetting( "SMESH:ScalarBarTitleBold" ) == "true" )
     aScalarBarTitleProp->BoldOn();
-  else
+  else*/
     aScalarBarTitleProp->BoldOff();
 
-  if ( QAD_CONFIG->getSetting( "SMESH:ScalarBarTitleItalic" ) == "true" )
+  /*if ( QAD_CONFIG->getSetting( "SMESH:ScalarBarTitleItalic" ) == "true" )
     aScalarBarTitleProp->ItalicOn();
-  else
+  else*/
     aScalarBarTitleProp->ItalicOff();
 
-  if ( QAD_CONFIG->getSetting( "SMESH:ScalarBarTitleShadow" ) == "true" )
+  /*if ( QAD_CONFIG->getSetting( "SMESH:ScalarBarTitleShadow" ) == "true" )
     aScalarBarTitleProp->ShadowOn();
-  else
+  else*/
     aScalarBarTitleProp->ShadowOff();
 
   myScalarBarActor->SetTitleTextProperty( aScalarBarTitleProp );
@@ -327,74 +327,74 @@ SMESH_ActorDef::SMESH_ActorDef()
 
   vtkTextProperty* aScalarBarLabelProp = vtkTextProperty::New();
 
-  if ( QAD_CONFIG->hasSetting( "SMESH:ScalarBarLabelColor" ) ) {
+  /*if ( QAD_CONFIG->hasSetting( "SMESH:ScalarBarLabelColor" ) ) {
     QStringList aTColor = QStringList::split(  ":", QAD_CONFIG->getSetting( "SMESH:ScalarBarLabelColor" ), false );
     aScalarBarLabelProp->SetColor( ( aTColor.count() > 0 ? aTColor[0].toInt()/255. : 1.0 ),
-                                  ( aTColor.count() > 1 ? aTColor[1].toInt()/255. : 1.0 ), 
+                                  ( aTColor.count() > 1 ? aTColor[1].toInt()/255. : 1.0 ),
                                   ( aTColor.count() > 2 ? aTColor[2].toInt()/255. : 1.0 ) );
   }
-  else
+  else*/
     aScalarBarLabelProp->SetColor( 1.0, 1.0, 1.0 );
 
   aScalarBarLabelProp->SetFontFamilyToArial();
-  if( QAD_CONFIG->hasSetting( "SMESH:ScalarBarLabelFont" ) ){
+  /*if( QAD_CONFIG->hasSetting( "SMESH:ScalarBarLabelFont" ) ){
     if ( QAD_CONFIG->getSetting( "SMESH:ScalarBarLabelFont" ) == "Arial" )
       aScalarBarLabelProp->SetFontFamilyToArial();
     else if ( QAD_CONFIG->getSetting( "SMESH:ScalarBarLabelFont" ) == "Courier" )
       aScalarBarLabelProp->SetFontFamilyToCourier();
     else if ( QAD_CONFIG->getSetting( "SMESH:ScalarBarLabelFont" ) == "Times" )
       aScalarBarLabelProp->SetFontFamilyToTimes();
-  }
+  }*/
 
-  if ( QAD_CONFIG->getSetting( "SMESH:ScalarBarLabelBold" ) == "true" )
+  /*if ( QAD_CONFIG->getSetting( "SMESH:ScalarBarLabelBold" ) == "true" )
     aScalarBarLabelProp->BoldOn();
-  else
+  else*/
     aScalarBarLabelProp->BoldOff();
 
-  if ( QAD_CONFIG->getSetting( "SMESH:ScalarBarLabelItalic" ) == "true" )
+  /*if ( QAD_CONFIG->getSetting( "SMESH:ScalarBarLabelItalic" ) == "true" )
     aScalarBarLabelProp->ItalicOn();
-  else
+  else*/
     aScalarBarLabelProp->ItalicOff();
 
-  if ( QAD_CONFIG->getSetting( "SMESH:ScalarBarLabelShadow" ) == "true" )
+  /*if ( QAD_CONFIG->getSetting( "SMESH:ScalarBarLabelShadow" ) == "true" )
     aScalarBarLabelProp->ShadowOn();
-  else
+  else*/
     aScalarBarLabelProp->ShadowOff();
 
   myScalarBarActor->SetLabelTextProperty( aScalarBarLabelProp );
   aScalarBarLabelProp->Delete();
 
-  if ( QAD_CONFIG->getSetting("SMESH:ScalarBarOrientation") == "Horizontal" )
+  /*if ( QAD_CONFIG->getSetting("SMESH:ScalarBarOrientation") == "Horizontal" )
     myScalarBarActor->SetOrientationToHorizontal();
-  else
+  else*/
     myScalarBarActor->SetOrientationToVertical();
 
-  float aXVal = QAD_CONFIG->getSetting("SMESH:ScalarBarOrientation") == "Horizontal" ? 0.20 : 0.01;
-  if ( QAD_CONFIG->hasSetting( "SMESH:ScalarBarXPosition" ) )
-    aXVal = QAD_CONFIG->getSetting( "SMESH:ScalarBarXPosition" ).toFloat();
-  float aYVal = QAD_CONFIG->getSetting("SMESH:ScalarBarOrientation") == "Horizontal" ? 0.01 : 0.1;
-  if ( QAD_CONFIG->hasSetting( "SMESH:ScalarBarYPosition" ) )
-    aYVal = QAD_CONFIG->getSetting( "SMESH:ScalarBarYPosition" ).toFloat();
+  float aXVal = 0.01; //QAD_CONFIG->getSetting("SMESH:ScalarBarOrientation") == "Horizontal" ? 0.20 : 0.01;
+  //if ( QAD_CONFIG->hasSetting( "SMESH:ScalarBarXPosition" ) )
+  //  aXVal = QAD_CONFIG->getSetting( "SMESH:ScalarBarXPosition" ).toFloat();
+  float aYVal = 0.1; //QAD_CONFIG->getSetting("SMESH:ScalarBarOrientation") == "Horizontal" ? 0.01 : 0.1;
+  //if ( QAD_CONFIG->hasSetting( "SMESH:ScalarBarYPosition" ) )
+  //  aYVal = QAD_CONFIG->getSetting( "SMESH:ScalarBarYPosition" ).toFloat();
   myScalarBarActor->SetPosition( aXVal, aYVal );
 
-  float aWVal = QAD_CONFIG->getSetting("SMESH:ScalarBarOrientation") == "Horizontal" ? 0.60 : 0.10;
-  if ( QAD_CONFIG->hasSetting( "SMESH:ScalarBarWidth" ) )
-    aWVal = QAD_CONFIG->getSetting( "SMESH:ScalarBarWidth" ).toFloat();
+  float aWVal = 0.1; //QAD_CONFIG->getSetting("SMESH:ScalarBarOrientation") == "Horizontal" ? 0.60 : 0.10;
+  //if ( QAD_CONFIG->hasSetting( "SMESH:ScalarBarWidth" ) )
+  //  aWVal = QAD_CONFIG->getSetting( "SMESH:ScalarBarWidth" ).toFloat();
   myScalarBarActor->SetWidth( aWVal );
 
-  float aHVal = QAD_CONFIG->getSetting("SMESH:ScalarBarOrientation") == "Horizontal" ? 0.12 : 0.80;
-  if ( QAD_CONFIG->hasSetting( "SMESH:ScalarBarHeight" ) )
-    aHVal = QAD_CONFIG->getSetting( "SMESH:ScalarBarHeight" ).toFloat();
+  float aHVal = 0.8; //QAD_CONFIG->getSetting("SMESH:ScalarBarOrientation") == "Horizontal" ? 0.12 : 0.80;
+  //if ( QAD_CONFIG->hasSetting( "SMESH:ScalarBarHeight" ) )
+  //  aHVal = QAD_CONFIG->getSetting( "SMESH:ScalarBarHeight" ).toFloat();
   myScalarBarActor->SetHeight( aHVal );
 
   int anIntVal = 5;
-  if ( QAD_CONFIG->hasSetting( "SMESH:ScalarBarNbOfLabels" ) )
-    anIntVal = QAD_CONFIG->getSetting("SMESH:ScalarBarNbOfLabels").toInt();
+  //if ( QAD_CONFIG->hasSetting( "SMESH:ScalarBarNbOfLabels" ) )
+  //  anIntVal = QAD_CONFIG->getSetting("SMESH:ScalarBarNbOfLabels").toInt();
   myScalarBarActor->SetNumberOfLabels(anIntVal == 0? 5: anIntVal);
 
   anIntVal = 64;
-  if ( QAD_CONFIG->hasSetting( "SMESH:ScalarBarNbOfColors" ) )
-    anIntVal = QAD_CONFIG->getSetting("SMESH:ScalarBarNbOfColors").toInt();
+  //if ( QAD_CONFIG->hasSetting( "SMESH:ScalarBarNbOfColors" ) )
+  //  anIntVal = QAD_CONFIG->getSetting("SMESH:ScalarBarNbOfColors").toInt();
   myScalarBarActor->SetMaximumNumberOfColors(anIntVal == 0? 64: anIntVal);
 
 
@@ -405,7 +405,7 @@ SMESH_ActorDef::SMESH_ActorDef()
   myPtsMaskPoints = vtkMaskPoints::New();
   myPtsMaskPoints->SetInput(myPointsNumDataSet);
   myPtsMaskPoints->SetOnRatio(1);
-    
+
   myPtsSelectVisiblePoints = vtkSelectVisiblePoints::New();
   myPtsSelectVisiblePoints->SetInput(myPtsMaskPoints->GetOutput());
   myPtsSelectVisiblePoints->SelectInvisibleOff();
@@ -623,7 +623,7 @@ SetControlMode(eControl theMode,
               bool theCheckEntityMode)
 {
   myControlMode = eNone;
-  theCheckEntityMode &= QAD_CONFIG->getSetting("SMESH:DispayEntity") == "true";
+  //theCheckEntityMode &= QAD_CONFIG->getSetting("SMESH:DispayEntity") == "true";
 
   my1DActor->GetMapper()->SetScalarVisibility(false);
   my2DActor->GetMapper()->SetScalarVisibility(false);
@@ -851,8 +851,9 @@ bool SMESH_ActorDef::Init(TVisualObjPtr theVisualObj,
   //SetIsShrunkable(theGrid->GetNumberOfCells() > 10);
   SetIsShrunkable(true);
   
-  QString aMode = QAD_CONFIG->getSetting("SMESH:DisplayMode");
+  //QString aMode = QAD_CONFIG->getSetting("SMESH:DisplayMode");
   SetRepresentation(-1);
+  /*
   if(aMode.compare("Wireframe") == 0){
     SetRepresentation(eEdge);
   }else if(aMode.compare("Shading") == 0){
@@ -860,11 +861,11 @@ bool SMESH_ActorDef::Init(TVisualObjPtr theVisualObj,
   }else if(aMode.compare("Nodes") == 0){
     SetRepresentation(ePoint);
   }
-
-  aMode = QAD_CONFIG->getSetting("SMESH:Shrink");
+  */
+  /*aMode = QAD_CONFIG->getSetting("SMESH:Shrink");
   if(aMode == "yes"){
     SetShrink();
-  }
+  }*/
 
   myTimeStamp->Modified();
   Modified();
@@ -882,7 +883,7 @@ vtkDataSet* SMESH_ActorDef::GetInput(){
 }
 
 
-void SMESH_ActorDef::SetTransform(SALOME_Transform* theTransform){
+void SMESH_ActorDef::SetTransform(VTKViewer_Transform* theTransform){
   myNodeActor->SetTransform(theTransform);
   myBaseActor->SetTransform(theTransform);
 
@@ -1101,10 +1102,10 @@ void SMESH_ActorDef::SetEntityMode(unsigned int theMode){
   myBaseActor->myGeomFilter->SetInside(myEntityMode != myEntityState);
 
   myEntityMode = theMode;
-  SALOME_ExtractUnstructuredGrid* aFilter = NULL;
+  VTKViewer_ExtractUnstructuredGrid* aFilter = NULL;
   aFilter = myBaseActor->GetExtractUnstructuredGrid();
   aFilter->ClearRegisteredCellsWithType();
-  aFilter->SetModeOfChanging(SALOME_ExtractUnstructuredGrid::eAdding);
+  aFilter->SetModeOfChanging(VTKViewer_ExtractUnstructuredGrid::eAdding);
   
   if(myEntityMode & eEdges){
     if (MYDEBUG) MESSAGE("EDGES");
@@ -1255,13 +1256,13 @@ void SMESH_ActorDef::UpdateHighlight(){
       myHighlitableActor->SetHighlited(anIsVisible);
       myHighlitableActor->SetVisibility(anIsVisible);
       myHighlitableActor->GetExtractUnstructuredGrid()->
-       SetModeOfExtraction(SALOME_ExtractUnstructuredGrid::eCells);
+       SetModeOfExtraction(VTKViewer_ExtractUnstructuredGrid::eCells);
       myHighlitableActor->SetRepresentation(SMESH_DeviceActor::eWireframe);
     }else if(myRepresentation == ePoint || GetPointRepresentation()){
       myHighlitableActor->SetHighlited(anIsVisible);
       myHighlitableActor->SetVisibility(anIsVisible);
       myHighlitableActor->GetExtractUnstructuredGrid()->
-       SetModeOfExtraction(SALOME_ExtractUnstructuredGrid::ePoints);
+       SetModeOfExtraction(VTKViewer_ExtractUnstructuredGrid::ePoints);
       myHighlitableActor->SetRepresentation(SMESH_DeviceActor::ePoint);
     }
   }
index dcb8d11e8b89ad029b78622179011aacad005e43..cc4345e362cb28c1507b6c49a89d85a3d41647e4 100644 (file)
@@ -29,7 +29,7 @@
 #ifndef SMESH_ACTOR_H
 #define SMESH_ACTOR_H
 
-#include "SALOME_Actor.h"
+#include <SALOME_Actor.h>
 #include "SMESH_Object.h"
 
 class vtkUnstructuredGrid;
index e6925d30eb05194b5c015476fd0e405b8de6656d..1928f65185d363a497f36e8f32a1aa30ac85531e 100644 (file)
@@ -50,7 +50,7 @@ public:
     return *this;
   }
   TVTKSmartPtr& operator=(T* r){ vtkSmartPointer<T>::operator=(r); return *this;}
-  T* Get() const { return GetPointer();}
+  T* Get() const { return this->GetPointer();}
 };
 
 
@@ -147,7 +147,7 @@ class SMESH_ActorDef : public SMESH_Actor{
   virtual bool GetPointRepresentation();
 
   virtual float* GetBounds();
-  virtual void SetTransform(SALOME_Transform* theTransform); 
+  virtual void SetTransform(VTKViewer_Transform* theTransform); 
 
   virtual vtkUnstructuredGrid* GetUnstructuredGrid();
   virtual vtkDataSet* GetInput();
index fdaa86c251d9f09a99fa622439afb9f024c00a6a..7e71257b264a4ed94802014e0adc0f33d5ada02e 100644 (file)
@@ -20,7 +20,7 @@
 
 #include "SMESH_ActorUtils.h"
 
-#include "QAD_Config.h"
+//#include "QAD_Config.h"
 #include "utilities.h"
 
 #include <vtkUnstructuredGrid.h>
@@ -36,9 +36,10 @@ namespace SMESH{
 
   float GetFloat(const QString& theValue, float theDefault){
     if(theValue.isEmpty()) return theDefault;
-    QString aValue = QAD_CONFIG->getSetting(theValue);
-    if(aValue.isEmpty()) return theDefault;
-    return aValue.toFloat();
+    //QString aValue = QAD_CONFIG->getSetting(theValue);
+    //if(aValue.isEmpty())
+      return theDefault;
+    //return aValue.toFloat();
   }
 
   void WriteUnstructuredGrid(vtkUnstructuredGrid* theGrid, const char* theFileName){
index 962ad1ed8c12f04a210b8ce34e97f659fac19a3a..3548aaefe33244b272a83704f958bab77908bf22 100644 (file)
 #include "SMESH_ControlsDef.hxx"
 #include "SMESH_ActorUtils.h"
 
-#include "SALOME_Transform.h"
-#include "SALOME_TransformFilter.h"
-#include "SALOME_PassThroughFilter.h"
-#include "SALOME_ExtractUnstructuredGrid.h"
+#include <VTKViewer_Transform.h>
+#include <VTKViewer_TransformFilter.h>
+#include <VTKViewer_PassThroughFilter.h>
+#include <VTKViewer_ExtractUnstructuredGrid.h>
 
 // VTK Includes
 #include <vtkObjectFactory.h>
@@ -100,16 +100,16 @@ SMESH_DeviceActor::SMESH_DeviceActor()
   myExtractGeometry->SetReleaseDataFlag(true);
   myIsImplicitFunctionUsed = false;
 
-  myExtractUnstructuredGrid = SALOME_ExtractUnstructuredGrid::New();
+  myExtractUnstructuredGrid = VTKViewer_ExtractUnstructuredGrid::New();
     
   myMergeFilter = vtkMergeFilter::New();
 
-  myGeomFilter = SALOME_GeometryFilter::New();
+  myGeomFilter = VTKViewer_GeometryFilter::New();
 
-  myTransformFilter = SALOME_TransformFilter::New();
+  myTransformFilter = VTKViewer_TransformFilter::New();
 
   for(int i = 0; i < 6; i++)
-    myPassFilter.push_back(SALOME_PassThroughFilter::New());
+    myPassFilter.push_back(VTKViewer_PassThroughFilter::New());
 }
 
 
@@ -231,7 +231,7 @@ void SMESH_DeviceActor::SetUnstructuredGrid(vtkUnstructuredGrid* theGrid){
 }
 
 
-SALOME_ExtractUnstructuredGrid* SMESH_DeviceActor::GetExtractUnstructuredGrid(){
+VTKViewer_ExtractUnstructuredGrid* SMESH_DeviceActor::GetExtractUnstructuredGrid(){
   return myExtractUnstructuredGrid;
 }
 
@@ -300,7 +300,7 @@ void SMESH_DeviceActor::SetExtControlMode(SMESH::Controls::FunctorPtr theFunctor
   bool anIsInitialized = theFunctor;
   myExtractUnstructuredGrid->ClearRegisteredCells();
   myExtractUnstructuredGrid->ClearRegisteredCellsWithType();
-  myExtractUnstructuredGrid->SetModeOfChanging(SALOME_ExtractUnstructuredGrid::ePassAll);
+  myExtractUnstructuredGrid->SetModeOfChanging(VTKViewer_ExtractUnstructuredGrid::ePassAll);
   myVisualObj->UpdateFunctor(theFunctor);
 
   using namespace SMESH::Controls;
@@ -436,12 +436,12 @@ void SMESH_DeviceActor::SetExtControlMode(SMESH::Controls::FunctorPtr theFunctor
 {
   myExtractUnstructuredGrid->ClearRegisteredCells();
   myExtractUnstructuredGrid->ClearRegisteredCellsWithType();
-  myExtractUnstructuredGrid->SetModeOfChanging(SALOME_ExtractUnstructuredGrid::ePassAll);
+  myExtractUnstructuredGrid->SetModeOfChanging(VTKViewer_ExtractUnstructuredGrid::ePassAll);
   myVisualObj->UpdateFunctor(theFunctor);
 
   using namespace SMESH::Controls;
   if(FreeBorders* aFreeBorders = dynamic_cast<FreeBorders*>(theFunctor.get())){
-    myExtractUnstructuredGrid->SetModeOfChanging(SALOME_ExtractUnstructuredGrid::eAdding);
+    myExtractUnstructuredGrid->SetModeOfChanging(VTKViewer_ExtractUnstructuredGrid::eAdding);
     vtkUnstructuredGrid* aGrid = myVisualObj->GetUnstructuredGrid();
     vtkIdType aNbCells = aGrid->GetNumberOfCells();
     for( vtkIdType i = 0; i < aNbCells; i++ ){
@@ -516,7 +516,7 @@ unsigned long int SMESH_DeviceActor::GetMTime(){
 }
 
 
-void SMESH_DeviceActor::SetTransform(SALOME_Transform* theTransform){
+void SMESH_DeviceActor::SetTransform(VTKViewer_Transform* theTransform){
   myTransformFilter->SetTransform(theTransform);
 }
 
index 96dd92ce659141b586f6e19870e5225e89e485bf..88da39f94b4a9ab9ce5ee42b917ea98df39457f3 100644 (file)
@@ -29,7 +29,7 @@
 #ifndef SMESH_DEVICE_ACTOR_H
 #define SMESH_DEVICE_ACTOR_H
 
-#include "SALOME_GeometryFilter.h"
+#include <VTKViewer_GeometryFilter.h>
 #include "SMESH_Controls.hxx"
 #include "SMESH_Object.h"
 
@@ -46,10 +46,10 @@ class vtkScalarBarActor;
 class vtkLookupTable;
 class vtkImplicitBoolean;
 
-class SALOME_Transform;
-class SALOME_TransformFilter;
-class SALOME_PassThroughFilter;
-class SALOME_ExtractUnstructuredGrid;
+class VTKViewer_Transform;
+class VTKViewer_TransformFilter;
+class VTKViewer_PassThroughFilter;
+class VTKViewer_ExtractUnstructuredGrid;
 
 class SMESH_ExtractGeometry;
 
@@ -71,7 +71,7 @@ class SMESH_DeviceActor: public vtkLODActor{
   virtual int GetElemObjId(int theVtkID);
   virtual vtkCell* GetElemCell(int theObjID);
 
-  virtual void SetTransform(SALOME_Transform* theTransform); 
+  virtual void SetTransform(VTKViewer_Transform* theTransform); 
   virtual unsigned long int GetMTime();
 
   float GetShrinkFactor();
@@ -89,7 +89,7 @@ class SMESH_DeviceActor: public vtkLODActor{
   virtual void SetVisibility(int theMode);
   virtual int GetVisibility();
 
-  SALOME_ExtractUnstructuredGrid* GetExtractUnstructuredGrid();
+  VTKViewer_ExtractUnstructuredGrid* GetExtractUnstructuredGrid();
   vtkUnstructuredGrid* GetUnstructuredGrid();
 
   void SetControlMode(SMESH::Controls::FunctorPtr theFunctor,
@@ -122,12 +122,12 @@ class SMESH_DeviceActor: public vtkLODActor{
   bool myIsImplicitFunctionUsed;
 
   vtkMergeFilter* myMergeFilter;
-  SALOME_ExtractUnstructuredGrid* myExtractUnstructuredGrid;
+  VTKViewer_ExtractUnstructuredGrid* myExtractUnstructuredGrid;
 
   bool myStoreClippingMapping;
-  SALOME_GeometryFilter *myGeomFilter;
-  SALOME_TransformFilter *myTransformFilter;
-  std::vector<SALOME_PassThroughFilter*> myPassFilter;
+  VTKViewer_GeometryFilter *myGeomFilter;
+  VTKViewer_TransformFilter *myTransformFilter;
+  std::vector<VTKViewer_PassThroughFilter*> myPassFilter;
 
   vtkShrinkFilter* myShrinkFilter;
   bool myIsShrinkable;
index 24023bacf401ea6bc438647eaea39e03ce2b216d..885ee3de35b4b66aed1a34dcc8e1166956a27870 100644 (file)
@@ -31,7 +31,7 @@
 #include "SMDS_Mesh.hxx"
 #include "SMESH_Actor.h"
 #include "SMESH_ControlsDef.hxx"
-#include "SALOME_ExtractUnstructuredGrid.h"
+#include <VTKViewer_ExtractUnstructuredGrid.h>
 
 #include CORBA_SERVER_HEADER(SALOME_Exception)
 
@@ -160,6 +160,30 @@ namespace{
   }
 
 
+  inline void AddPolygonsWithID(SMDS_Mesh* theMesh, 
+                                SMESH::log_array_var& theSeq,
+                                CORBA::Long theId)
+  {
+    const SMESH::long_array& anIndexes = theSeq[theId].indexes;
+    CORBA::Long anIndexId = 0, aNbElems = theSeq[theId].number;
+
+    for (CORBA::Long anElemId = 0; anElemId < aNbElems; anElemId++) {
+      int aFaceId = anIndexes[anIndexId++];
+
+      int aNbNodes = anIndexes[anIndexId++];
+      std::vector<int> nodes_ids (aNbNodes);
+      for (int i = 0; i < aNbNodes; i++) {
+        nodes_ids[i] = anIndexes[anIndexId++];
+      }
+
+      SMDS_MeshElement* anElem = theMesh->AddPolygonalFaceWithID(nodes_ids, aFaceId);
+      if (!anElem)
+       EXCEPTION(runtime_error, "SMDS_Mesh::FindElement - cannot AddPolygonalFaceWithID for ID = "
+                  << anElemId);
+    }
+  }
+
+
   inline void AddTetrasWithID(SMDS_Mesh* theMesh, 
                              SMESH::log_array_var& theSeq,
                              CORBA::Long theId)
@@ -175,7 +199,7 @@ namespace{
                                                          anIndexes[anIndexId+4],
                                                          anIndexes[anIndexId]);
       if(!anElem)
-       EXCEPTION(runtime_error,"SMDS_Mesh::FindElement - cannot AddFaceWithID for ID = "<<anElemId);
+       EXCEPTION(runtime_error,"SMDS_Mesh::FindElement - cannot AddVolumeWithID for ID = "<<anElemId);
     }
   }
 
@@ -196,7 +220,7 @@ namespace{
                                                          anIndexes[anIndexId+5],
                                                          anIndexes[anIndexId]);
       if(!anElem)
-       EXCEPTION(runtime_error,"SMDS_Mesh::FindElement - cannot AddFaceWithID for ID = "<<anElemId);
+       EXCEPTION(runtime_error,"SMDS_Mesh::FindElement - cannot AddVolumeWithID for ID = "<<anElemId);
     }
   }
 
@@ -218,7 +242,7 @@ namespace{
                                                          anIndexes[anIndexId+6],
                                                          anIndexes[anIndexId]);
       if(!anElem)
-       EXCEPTION(runtime_error,"SMDS_Mesh::FindElement - cannot AddFaceWithID for ID = "<<anElemId);
+       EXCEPTION(runtime_error,"SMDS_Mesh::FindElement - cannot AddVolumeWithID for ID = "<<anElemId);
     }
   }
 
@@ -242,7 +266,69 @@ namespace{
                                                          anIndexes[anIndexId+8],
                                                          anIndexes[anIndexId]);
       if(!anElem)
-       EXCEPTION(runtime_error,"SMDS_Mesh::FindElement - cannot AddFaceWithID for ID = "<<anElemId);
+       EXCEPTION(runtime_error,"SMDS_Mesh::FindElement - cannot AddVolumeWithID for ID = "<<anElemId);
+    }
+  }
+
+
+  inline void AddPolyhedronsWithID (SMDS_Mesh* theMesh, 
+                                    SMESH::log_array_var& theSeq,
+                                    CORBA::Long theId)
+  {
+    const SMESH::long_array& anIndexes = theSeq[theId].indexes;
+    CORBA::Long anIndexId = 0, aNbElems = theSeq[theId].number;
+
+    for (CORBA::Long anElemId = 0; anElemId < aNbElems; anElemId++) {
+      int aFaceId = anIndexes[anIndexId++];
+
+      int aNbNodes = anIndexes[anIndexId++];
+      std::vector<int> nodes_ids (aNbNodes);
+      for (int i = 0; i < aNbNodes; i++) {
+        nodes_ids[i] = anIndexes[anIndexId++];
+      }
+
+      int aNbFaces = anIndexes[anIndexId++];
+      std::vector<int> quantities (aNbFaces);
+      for (int i = 0; i < aNbFaces; i++) {
+        quantities[i] = anIndexes[anIndexId++];
+      }
+
+      SMDS_MeshElement* anElem =
+        theMesh->AddPolyhedralVolumeWithID(nodes_ids, quantities, aFaceId);
+      if (!anElem)
+       EXCEPTION(runtime_error, "SMDS_Mesh::FindElement - cannot AddPolyhedralVolumeWithID for ID = "
+                  << anElemId);
+    }
+  }
+
+
+  inline void ChangePolyhedronNodes (SMDS_Mesh* theMesh, 
+                                     SMESH::log_array_var& theSeq,
+                                     CORBA::Long theId)
+  {
+    const SMESH::long_array& anIndexes = theSeq[theId].indexes;
+    CORBA::Long iind = 0, aNbElems = theSeq[theId].number;
+
+    for (CORBA::Long anElemId = 0; anElemId < aNbElems; anElemId++)
+    {
+      // find element
+      const SMDS_MeshElement* elem = FindElement(theMesh, anIndexes[iind++]);
+      // nb nodes
+      int nbNodes = anIndexes[iind++];
+      // nodes
+      std::vector<const SMDS_MeshNode*> aNodes (nbNodes);
+      for (int iNode = 0; iNode < nbNodes; iNode++) {
+        aNodes[iNode] = FindNode(theMesh, anIndexes[iind++]);
+      }
+      // nb faces
+      int nbFaces = anIndexes[iind++];
+      // quantities
+      std::vector<int> quantities (nbFaces);
+      for (int iFace = 0; iFace < nbFaces; iFace++) {
+        quantities[iFace] = anIndexes[iind++];
+      }
+      // change
+      theMesh->ChangePolyhedronNodes(elem, aNodes, quantities);
     }
   }
 
@@ -258,6 +344,7 @@ namespace{
 // purpose  : Get type of VTK cell
 //=================================================================================
 static inline vtkIdType getCellType( const SMDSAbs_ElementType theType,
+                                    const bool thePoly,
                                      const int theNbNodes )
 {
   switch( theType )
@@ -265,17 +352,19 @@ static inline vtkIdType getCellType( const SMDSAbs_ElementType theType,
     case SMDSAbs_Edge: 
       return theNbNodes == 2 ? VTK_LINE : VTK_EMPTY_CELL;
 
-    case SMDSAbs_Face  : 
-      if      ( theNbNodes == 3 ) return VTK_TRIANGLE;
-      else if ( theNbNodes == 4 ) return VTK_QUAD;
-      else                        return VTK_EMPTY_CELL;
+    case SMDSAbs_Face  :
+      if (thePoly && theNbNodes>2 ) return VTK_POLYGON;
+      else if ( theNbNodes == 3 )   return VTK_TRIANGLE;
+      else if ( theNbNodes == 4 )   return VTK_QUAD;
+      else return VTK_EMPTY_CELL;
       
-    case SMDSAbs_Volume: 
-      if      ( theNbNodes == 4 ) return VTK_TETRA;
-      else if ( theNbNodes == 5 ) return VTK_PYRAMID;
-      else if ( theNbNodes == 6 ) return VTK_WEDGE;
-      else if ( theNbNodes == 8 ) return VTK_HEXAHEDRON;
-      else                        return VTK_EMPTY_CELL;
+    case SMDSAbs_Volume:
+      if (thePoly && theNbNodes>3 ) return VTK_CONVEX_POINT_SET;
+      else if ( theNbNodes == 4 )   return VTK_TETRA;
+      else if ( theNbNodes == 5 )   return VTK_PYRAMID;
+      else if ( theNbNodes == 6 )   return VTK_WEDGE;
+      else if ( theNbNodes == 8 )   return VTK_HEXAHEDRON;
+      else return VTK_EMPTY_CELL;
 
     default: return VTK_EMPTY_CELL;
   }
@@ -287,15 +376,12 @@ static inline vtkIdType getCellType( const SMDSAbs_ElementType theType,
 //=================================================================================
 SMESH_VisualObjDef::SMESH_VisualObjDef()
 {
-  if(MYDEBUG) MESSAGE("SMESH_MeshObj - "<<this);
   myGrid = vtkUnstructuredGrid::New();
 }
 SMESH_VisualObjDef::~SMESH_VisualObjDef()
 {
-  if(MYDEBUG) {
-    MESSAGE("~SMESH_MeshObj - "<<this);
-    myGrid->DebugOn();
-  }
+  if ( MYDEBUG )
+    MESSAGE( "~SMESH_MeshObj - myGrid->GetReferenceCount() = " << myGrid->GetReferenceCount() );
   myGrid->Delete();
 }
 
@@ -545,35 +631,37 @@ void SMESH_VisualObjDef::buildElemPrs()
         SMDS_ElemIteratorPtr aNodesIter = anElem->nodesIterator();
        switch(aType){
        case SMDSAbs_Volume:{
-         int* aConnectivities = NULL;
+         std::vector<int> aConnectivities;
          GetConnect(aNodesIter,aConnect);
          // Convertions connectivities from SMDS to VTK
-         switch(aNbNodes){
-         case 4:{
+         if (anElem->IsPoly() && aNbNodes > 3) { // POLYEDRE
+           for (int k = 0; k < aNbNodes; k++) {
+             aConnectivities.push_back(k);
+           }
+
+         } else if (aNbNodes == 4) {
            static int anIds[] = {0,2,1,3};
-           aConnectivities = anIds;
-           break;
-         }
-         case 5:{
+           for (int k = 0; k < aNbNodes; k++) aConnectivities.push_back(anIds[k]);
+
+         } else if (aNbNodes == 5) {
            static int anIds[] = {0,3,2,1,4};
-           aConnectivities = anIds;
-           break;
-         }
-         case 6:{
+           for (int k = 0; k < aNbNodes; k++) aConnectivities.push_back(anIds[k]);
+
+         } else if (aNbNodes == 6) {
            static int anIds[] = {0,1,2,3,4,5};
-           aConnectivities = anIds;
-           break;
-         }
-         case 8:{
+           for (int k = 0; k < aNbNodes; k++) aConnectivities.push_back(anIds[k]);
+
+         } else if (aNbNodes == 8) {
            static int anIds[] = {0,3,2,1,4,7,6,5};
-           aConnectivities = anIds;
-           break;
-         }}
+           for (int k = 0; k < aNbNodes; k++) aConnectivities.push_back(anIds[k]);
 
-         if(aConnectivities)
-           for( vtkIdType aNodeId = 0; aNodeId < aNbNodes; aNodeId++ )
+         } else {
+          }
+
+         if (aConnectivities.size() > 0) {
+           for (vtkIdType aNodeId = 0; aNodeId < aNbNodes; aNodeId++)
              SetId(anIdList,mySMDS2VTKNodes,aConnect,aNodeId,aConnectivities[aNodeId]);
-         
+         }
          break;
        }
        default:
@@ -584,7 +672,7 @@ void SMESH_VisualObjDef::buildElemPrs()
        }
 
         aConnectivity->InsertNextCell( anIdList );
-        aCellTypesArray->InsertNextValue( getCellType( aType, aNbNodes ) );
+        aCellTypesArray->InsertNextValue( getCellType( aType, anElem->IsPoly(), aNbNodes ) );
 
         iElem++;
       }
@@ -628,7 +716,7 @@ bool SMESH_VisualObjDef::GetEdgeNodes( const int theElemId,
     
   int nbNodes = anElem->NbNodes();
 
-  if ( theEdgeNum < 1 || theEdgeNum > 4 || nbNodes != 3 && nbNodes != 4 || theEdgeNum > nbNodes )
+  if ( theEdgeNum < 0 || theEdgeNum > 3 || nbNodes != 3 && nbNodes != 4 || theEdgeNum > nbNodes )
     return false;
 
   int anIds[ nbNodes ];
@@ -637,10 +725,10 @@ bool SMESH_VisualObjDef::GetEdgeNodes( const int theElemId,
   while( anIter->more() )
     anIds[ i++ ] = anIter->next()->GetID();
 
-  if ( nbNodes != theEdgeNum )
+  if ( theEdgeNum < nbNodes - 1 )
   {
-    theNodeId1 = anIds[ theEdgeNum - 1 ];
-    theNodeId2 = anIds[ theEdgeNum ];
+    theNodeId1 = anIds[ theEdgeNum ];
+    theNodeId2 = anIds[ theEdgeNum + 1 ];
   }
   else
   {
@@ -697,25 +785,27 @@ void SMESH_MeshObj::Update( int theIsClear )
     
     if( !aLength )
       return;
-      
+
     for ( CORBA::Long anId = 0; anId < aLength; anId++)
     {
       const SMESH::double_array& aCoords = aSeq[anId].coords;
       const SMESH::long_array& anIndexes = aSeq[anId].indexes;
       CORBA::Long anElemId = 0, aNbElems = aSeq[anId].number;
       CORBA::Long aCommand = aSeq[anId].commandType;
-      
+
       switch(aCommand)
       {
-        case SMESH::ADD_NODE       : AddNodesWithID   ( myMesh, aSeq, anId ); break;
-        case SMESH::ADD_EDGE       : AddEdgesWithID   ( myMesh, aSeq, anId ); break;
-        case SMESH::ADD_TRIANGLE   : AddTriasWithID   ( myMesh, aSeq, anId ); break;
-        case SMESH::ADD_QUADRANGLE : AddQuadsWithID   ( myMesh, aSeq, anId ); break;
-        case SMESH::ADD_TETRAHEDRON: AddTetrasWithID  ( myMesh, aSeq, anId ); break;
-        case SMESH::ADD_PYRAMID    : AddPiramidsWithID( myMesh, aSeq, anId ); break;
-        case SMESH::ADD_PRISM      : AddPrismsWithID  ( myMesh, aSeq, anId ); break;
-        case SMESH::ADD_HEXAHEDRON : AddHexasWithID   ( myMesh, aSeq, anId ); break;
-        
+        case SMESH::ADD_NODE       : AddNodesWithID      ( myMesh, aSeq, anId ); break;
+        case SMESH::ADD_EDGE       : AddEdgesWithID      ( myMesh, aSeq, anId ); break;
+        case SMESH::ADD_TRIANGLE   : AddTriasWithID      ( myMesh, aSeq, anId ); break;
+        case SMESH::ADD_QUADRANGLE : AddQuadsWithID      ( myMesh, aSeq, anId ); break;
+        case SMESH::ADD_POLYGON    : AddPolygonsWithID   ( myMesh, aSeq, anId ); break;
+        case SMESH::ADD_TETRAHEDRON: AddTetrasWithID     ( myMesh, aSeq, anId ); break;
+        case SMESH::ADD_PYRAMID    : AddPiramidsWithID   ( myMesh, aSeq, anId ); break;
+        case SMESH::ADD_PRISM      : AddPrismsWithID     ( myMesh, aSeq, anId ); break;
+        case SMESH::ADD_HEXAHEDRON : AddHexasWithID      ( myMesh, aSeq, anId ); break;
+        case SMESH::ADD_POLYHEDRON : AddPolyhedronsWithID( myMesh, aSeq, anId ); break;
+
         case SMESH::REMOVE_NODE:
           for( ; anElemId < aNbElems; anElemId++ )
             myMesh->RemoveNode( FindNode( myMesh, anIndexes[anElemId] ) );
@@ -743,8 +833,8 @@ void SMESH_MeshObj::Update( int theIsClear )
             // nb nodes
             int nbNodes = anIndexes[i++];
             // nodes
-            ASSERT( nbNodes < 9 );
-            const SMDS_MeshNode* aNodes[ 8 ];
+            //ASSERT( nbNodes < 9 );
+            const SMDS_MeshNode* aNodes[ nbNodes ];
             for ( int iNode = 0; iNode < nbNodes; iNode++ )
               aNodes[ iNode ] = FindNode( myMesh, anIndexes[i++] );
             // change
@@ -752,6 +842,9 @@ void SMESH_MeshObj::Update( int theIsClear )
           }
           break;
 
+        case SMESH::CHANGE_POLYHEDRON_NODES:
+          ChangePolyhedronNodes(myMesh, aSeq, anId);
+          break;
         case SMESH::RENUMBER:
           for(CORBA::Long i=0; anElemId < aNbElems; anElemId++, i+=3)
           {
index 14df168d704545d36f7518ed211d244b9958d2ca..134b47b10ba6ae6a714b10d252ba6c69ad4d7a0e 100644 (file)
@@ -30,7 +30,7 @@
 #define SMESH_OBJECTDEF_H
 
 // IDL Headers
-#include "SALOMEconfig.h"
+#include <SALOMEconfig.h>
 #include CORBA_SERVER_HEADER(SMESH_Mesh)
 #include CORBA_SERVER_HEADER(SMESH_Group)
 
index d64abd6fe753a254ba54839f98d59ef05d8c88b4..e066e25e0bbb35d9cb600a6540e5f579f5f2d944 100644 (file)
@@ -55,8 +55,10 @@ LIB_SRC = \
        SMDS_IteratorOfElements.cxx \
        SMDS_VolumeOfFaces.cxx \
        SMDS_VolumeOfNodes.cxx \
+       SMDS_PolyhedralVolumeOfNodes.cxx \
        SMDS_FaceOfEdges.cxx \
        SMDS_FaceOfNodes.cxx \
+       SMDS_PolygonalFaceOfNodes.cxx \
        SMDS_VolumeTool.cxx
 #      SMDS_Tria3OfNodes.cxx \
 #      SMDS_HexahedronOfNodes.cxx
@@ -107,8 +109,10 @@ EXPORT_HEADERS= \
        SMDS_IteratorOfElements.hxx \
        SMDS_VolumeOfFaces.hxx \
        SMDS_VolumeOfNodes.hxx \
+       SMDS_PolyhedralVolumeOfNodes.hxx \
        SMDS_FaceOfEdges.hxx \
        SMDS_FaceOfNodes.hxx \
+       SMDS_PolygonalFaceOfNodes.hxx \
        SMDS_VolumeTool.hxx
 #      SMDS_Tria3OfNodes.hxx \
 #      SMDS_HexahedronOfNodes.hxx
index 763d61c47eb53d493a7a87c896eea73c3c86dd48..0058da87809121f013470ed8cc9ec0f88e86e49c 100644 (file)
@@ -29,6 +29,8 @@
 #include "SMDS_VolumeOfFaces.hxx"
 #include "SMDS_FaceOfNodes.hxx"
 #include "SMDS_FaceOfEdges.hxx"
+#include "SMDS_PolyhedralVolumeOfNodes.hxx"
+#include "SMDS_PolygonalFaceOfNodes.hxx"
 
 #include <algorithm>
 #include <map>
@@ -786,6 +788,126 @@ SMDS_MeshVolume* SMDS_Mesh::AddVolumeWithID(const SMDS_MeshFace * f1,
   return volume;
 }
 
+///////////////////////////////////////////////////////////////////////////////
+/// Add a polygon defined by its nodes IDs
+///////////////////////////////////////////////////////////////////////////////
+
+SMDS_MeshFace* SMDS_Mesh::AddPolygonalFaceWithID (std::vector<int> nodes_ids,
+                                                  const int        ID)
+{
+  int nbNodes = nodes_ids.size();
+  std::vector<const SMDS_MeshNode*> nodes (nbNodes);
+  for (int i = 0; i < nbNodes; i++) {
+    nodes[i] = (SMDS_MeshNode *)myNodeIDFactory->MeshElement(nodes_ids[i]);
+    if (!nodes[i]) return NULL;
+  }
+  return SMDS_Mesh::AddPolygonalFaceWithID(nodes, ID); 
+}
+
+///////////////////////////////////////////////////////////////////////////////
+/// Add a polygon defined by its nodes
+///////////////////////////////////////////////////////////////////////////////
+
+SMDS_MeshFace* SMDS_Mesh::AddPolygonalFaceWithID
+                          (std::vector<const SMDS_MeshNode*> nodes,
+                           const int                         ID)
+{
+  SMDS_MeshFace * face;
+
+  if (hasConstructionEdges())
+  {
+    MESSAGE("Error : Not implemented");
+    return NULL;
+  }
+  else
+  {
+    face = new SMDS_PolygonalFaceOfNodes(nodes);
+    myFaces.Add(face);
+  }
+
+  if (!registerElement(ID, face)) {
+    RemoveElement(face, false);
+    face = NULL;
+  }
+  return face;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+/// Add a polygon defined by its nodes.
+/// An ID is automatically affected to the created face.
+///////////////////////////////////////////////////////////////////////////////
+
+SMDS_MeshFace* SMDS_Mesh::AddPolygonalFace (std::vector<const SMDS_MeshNode*> nodes)
+{
+  return SMDS_Mesh::AddPolygonalFaceWithID(nodes, myElementIDFactory->GetFreeID());
+}
+
+///////////////////////////////////////////////////////////////////////////////
+/// Create a new polyhedral volume and add it to the mesh. 
+/// @param ID The ID of the new volume
+/// @return The created volume or NULL if an element with this ID already exists
+/// or if input nodes are not found.
+///////////////////////////////////////////////////////////////////////////////
+
+SMDS_MeshVolume * SMDS_Mesh::AddPolyhedralVolumeWithID
+                             (std::vector<int> nodes_ids,
+                              std::vector<int> quantities,
+                              const int        ID)
+{
+  int nbNodes = nodes_ids.size();
+  std::vector<const SMDS_MeshNode*> nodes (nbNodes);
+  for (int i = 0; i < nbNodes; i++) {
+    nodes[i] = (SMDS_MeshNode *)myNodeIDFactory->MeshElement(nodes_ids[i]);
+    if (!nodes[i]) return NULL;
+  }
+  return SMDS_Mesh::AddPolyhedralVolumeWithID(nodes, quantities, ID);
+}
+
+///////////////////////////////////////////////////////////////////////////////
+/// Create a new polyhedral volume and add it to the mesh. 
+/// @param ID The ID of the new volume
+/// @return The created  volume
+///////////////////////////////////////////////////////////////////////////////
+
+SMDS_MeshVolume* SMDS_Mesh::AddPolyhedralVolumeWithID
+                            (std::vector<const SMDS_MeshNode*> nodes,
+                             std::vector<int>                  quantities,
+                             const int                         ID)
+{
+  SMDS_MeshVolume* volume;
+  if (hasConstructionFaces()) {
+    MESSAGE("Error : Not implemented");
+    return NULL;
+  } else if (hasConstructionEdges()) {
+    MESSAGE("Error : Not implemented");
+    return NULL;
+  } else {
+    volume = new SMDS_PolyhedralVolumeOfNodes(nodes, quantities);
+    myVolumes.Add(volume);
+  }
+
+  if (!registerElement(ID, volume)) {
+    RemoveElement(volume, false);
+    volume = NULL;
+  }
+  return volume;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+/// Create a new polyhedral volume and add it to the mesh. 
+/// @return The created  volume
+///////////////////////////////////////////////////////////////////////////////
+
+SMDS_MeshVolume* SMDS_Mesh::AddPolyhedralVolume
+                            (std::vector<const SMDS_MeshNode*> nodes,
+                             std::vector<int>                  quantities)
+{
+  int ID = myElementIDFactory->GetFreeID();
+  SMDS_MeshVolume * v = SMDS_Mesh::AddPolyhedralVolumeWithID(nodes, quantities, ID);
+  if (v == NULL) myElementIDFactory->ReleaseID(ID);
+  return v;
+}
+
 ///////////////////////////////////////////////////////////////////////////////
 /// Registers element with the given ID, maintains inverse connections
 ///////////////////////////////////////////////////////////////////////////////
@@ -966,10 +1088,25 @@ bool SMDS_Mesh::ChangeElementNodes(const SMDS_MeshElement * elem,
   }
   case SMDSAbs_Face: {
     const SMDS_FaceOfNodes* face = dynamic_cast<const SMDS_FaceOfNodes*>( elem );
-    if ( face )
+    if ( face ) {
       Ok = const_cast<SMDS_FaceOfNodes*>( face )->ChangeNodes( nodes, nbnodes );
+    } else {
+      /// ??? begin
+      const SMDS_PolygonalFaceOfNodes* face = dynamic_cast<const SMDS_PolygonalFaceOfNodes*>(elem);
+      if (face) {
+        Ok = const_cast<SMDS_PolygonalFaceOfNodes*>(face)->ChangeNodes(nodes, nbnodes);
+      }
+      /// ??? end
+    }
     break;
   }
+  //case SMDSAbs_PolygonalFace: {
+  //  const SMDS_PolygonalFaceOfNodes* face = dynamic_cast<const SMDS_PolygonalFaceOfNodes*>(elem);
+  //  if (face) {
+  //    Ok = const_cast<SMDS_PolygonalFaceOfNodes*>(face)->ChangeNodes(nodes, nbnodes);
+  //  }
+  //  break;
+  //}
   case SMDSAbs_Volume: {
     const SMDS_VolumeOfNodes* vol = dynamic_cast<const SMDS_VolumeOfNodes*>( elem );
     if ( vol )
@@ -1007,6 +1144,62 @@ bool SMDS_Mesh::ChangeElementNodes(const SMDS_MeshElement * elem,
   return Ok;
 }
 
+//=======================================================================
+//function : ChangePolyhedronNodes
+//purpose  : to change nodes of polyhedral volume
+//=======================================================================
+bool SMDS_Mesh::ChangePolyhedronNodes (const SMDS_MeshElement * elem,
+                                       std::vector<const SMDS_MeshNode*> nodes,
+                                       std::vector<int>                  quantities)
+{
+  if (elem->GetType() != SMDSAbs_Volume) {
+    MESSAGE("WRONG ELEM TYPE");
+    return false;
+  }
+
+  const SMDS_PolyhedralVolumeOfNodes* vol = dynamic_cast<const SMDS_PolyhedralVolumeOfNodes*>(elem);
+  if (!vol) {
+    return false;
+  }
+
+  // keep current nodes of elem
+  set<const SMDS_MeshElement*> oldNodes;
+  SMDS_ElemIteratorPtr itn = elem->nodesIterator();
+  while (itn->more()) {
+    oldNodes.insert(itn->next());
+  }
+
+  // change nodes
+  bool Ok = const_cast<SMDS_PolyhedralVolumeOfNodes*>(vol)->ChangeNodes(nodes, quantities);
+  if (!Ok) {
+    return false;
+  }
+
+  // update InverseElements
+
+  // AddInverseElement to new nodes
+  int nbnodes = nodes.size();
+  for (int i = 0; i < nbnodes; i++) {
+    if (oldNodes.find(nodes[i]) == oldNodes.end()) {
+      // new node
+      const_cast<SMDS_MeshNode*>(nodes[i])->AddInverseElement(elem);
+    } else {
+      // remove from oldNodes a node that remains in elem
+      oldNodes.erase(nodes[i]);
+    }
+  }
+
+  // RemoveInverseElement from the nodes removed from elem
+  set<const SMDS_MeshElement*>::iterator it;
+  for (it = oldNodes.begin(); it != oldNodes.end(); it++) {
+    SMDS_MeshNode * n = static_cast<SMDS_MeshNode *>
+      (const_cast<SMDS_MeshElement *>( *it ));
+    n->RemoveInverseElement(elem);
+  }
+
+  return Ok;
+}
+
 //=======================================================================
 //function : FindEdge
 //purpose  :
@@ -1192,6 +1385,55 @@ const SMDS_MeshElement* SMDS_Mesh::FindElement(int IDelem) const
        return myElementIDFactory->MeshElement(IDelem);
 }
 
+//=======================================================================
+//function : FindFace
+//purpose  : find polygon
+//=======================================================================
+
+const SMDS_MeshFace* SMDS_Mesh::FindFace (std::vector<int> nodes_ids) const
+{
+  int nbnodes = nodes_ids.size();
+  std::vector<const SMDS_MeshNode *> poly_nodes (nbnodes);
+  for (int inode = 0; inode < nbnodes; inode++) {
+    const SMDS_MeshNode * node = FindNode(nodes_ids[inode]);
+    if (node == NULL) return NULL;
+  }
+  return FindFace(poly_nodes);
+}
+
+const SMDS_MeshFace* SMDS_Mesh::FindFace (std::vector<const SMDS_MeshNode *> nodes)
+{
+  int nbNodes = nodes.size();
+  if (nbNodes < 1) return NULL;
+
+  bool isFound = true;
+  const SMDS_MeshFace * face;
+  set<const SMDS_MeshFace *> faces;
+
+  for (int inode = 0; inode < nbNodes && isFound; inode++) {
+    set<const SMDS_MeshFace *> new_faces;
+
+    SMDS_ElemIteratorPtr itF = nodes[inode]->facesIterator();
+    while (itF->more()) {
+      face = static_cast<const SMDS_MeshFace *>(itF->next());
+      if (face->NbNodes() == nbNodes) {
+        if (inode == 0 || faces.find(face) != faces.end()) {
+          new_faces.insert(face);
+        }
+      }
+    }
+    faces = new_faces;
+    if (new_faces.size() == 0) {
+      isFound = false;
+    }
+  }
+
+  if (isFound)
+    return face;
+
+  return NULL;
+}
+
 //=======================================================================
 //function : DumpNodes
 //purpose  : 
@@ -1743,7 +1985,8 @@ void SMDS_Mesh::RemoveElement(const SMDS_MeshElement *        elem,
   // get finite elements built on elem
   set<const SMDS_MeshElement*> * s1;
   if (!hasConstructionEdges() && elem->GetType() == SMDSAbs_Edge ||
-      !hasConstructionFaces() && elem->GetType() == SMDSAbs_Face)
+      !hasConstructionFaces() && elem->GetType() == SMDSAbs_Face ||
+      elem->GetType() == SMDSAbs_Volume)
   {
     s1 = new set<const SMDS_MeshElement*>();
     s1->insert(elem);
@@ -1936,4 +2179,3 @@ void SMDS_Mesh::Renumber (const bool isNodes, const int  startID, const int  del
     ID += deltaID;
   }
 }
-
index 1aa9dda929b099a928470653511f18faefdef086..9d59a3ddff3c0360510ef3651b5504dfd847e34d 100644 (file)
@@ -201,6 +201,28 @@ public:
                                      const SMDS_MeshFace * f5,
                                      const SMDS_MeshFace * f6);
 
+  virtual SMDS_MeshFace* AddPolygonalFaceWithID (std::vector<int> nodes_ids,
+                                                 const int        ID);
+
+  virtual SMDS_MeshFace* AddPolygonalFaceWithID (std::vector<const SMDS_MeshNode*> nodes,
+                                                 const int                         ID);
+
+  virtual SMDS_MeshFace* AddPolygonalFace (std::vector<const SMDS_MeshNode*> nodes);
+
+  virtual SMDS_MeshVolume* AddPolyhedralVolumeWithID
+                           (std::vector<int> nodes_ids,
+                            std::vector<int> quantities,
+                            const int        ID);
+
+  virtual SMDS_MeshVolume* AddPolyhedralVolumeWithID
+                           (std::vector<const SMDS_MeshNode*> nodes,
+                            std::vector<int>                  quantities,
+                            const int                         ID);
+
+  virtual SMDS_MeshVolume* AddPolyhedralVolume
+                           (std::vector<const SMDS_MeshNode*> nodes,
+                            std::vector<int>                  quantities);
+
   virtual void RemoveElement(const SMDS_MeshElement *        elem,
                              std::list<const SMDS_MeshElement *>& removedElems,
                              std::list<const SMDS_MeshElement *>& removedNodes,
@@ -217,6 +239,9 @@ public:
   static bool ChangeElementNodes(const SMDS_MeshElement * elem,
                                  const SMDS_MeshNode    * nodes[],
                                  const int                nbnodes);
+  static bool ChangePolyhedronNodes(const SMDS_MeshElement * elem,
+                                    std::vector<const SMDS_MeshNode*> nodes,
+                                    std::vector<int>                  quantities);
 
   virtual void Renumber (const bool isNodes, const int startID = 1, const int deltaID = 1);
   // Renumber all nodes or elements.
@@ -235,6 +260,10 @@ public:
                                        const SMDS_MeshNode *n2,
                                        const SMDS_MeshNode *n3,
                                        const SMDS_MeshNode *n4);
+
+  const SMDS_MeshFace *FindFace(std::vector<int> nodes_ids) const;
+  static const SMDS_MeshFace* FindFace(std::vector<const SMDS_MeshNode *> nodes);
+
   int MaxNodeID() const;
   int MinNodeID() const;
   int MaxElementID() const;
index 3d9d13afe40d2298918c7ccfb68d4d642f219a2b..b9f61351b37ceeff2b652c00243fe3f95be3e07c 100644 (file)
@@ -59,6 +59,8 @@ class SMDS_MeshElement:public SMDS_MeshObject
 
        ///Return the type of the current element
        virtual SMDSAbs_ElementType GetType() const = 0;
+       virtual bool IsPoly() const { return false; };
+
        friend std::ostream & operator <<(std::ostream & OS, const SMDS_MeshElement *);
        friend bool SMDS_MeshElementIDFactory::BindID(int ID,SMDS_MeshElement*elem);
 
index 0acb246a8bfd32d8477fc6009e33f352ea766810..0cb481c501c0c38f13c2bd9d966c274625c271fd 100644 (file)
@@ -125,7 +125,7 @@ void SMDS_MeshGroup::Add(const SMDS_MeshElement * theElem)
        // the type of the group is determined by the first element added
        if (myElements.empty()) myType = theElem->GetType();
        else if (theElem->GetType() != myType)
-               MESSAGE("SMDS_MeshGroup::Add : Type Mismatch");
+         MESSAGE("SMDS_MeshGroup::Add : Type Mismatch "<<theElem->GetType()<<"!="<<myType);
        
        myElements.insert(theElem);
 }
index 96314592de10318b74ff108f3e67fdae9a8ca67a..536b2f7835974448c9f8af4f2dc8a1297508e09b 100644 (file)
@@ -44,8 +44,9 @@ int SMDS_MeshIDFactory::GetFreeID()
        if (myPoolOfID.empty()) return ++myMaxID;
        else
        {
-               int ID = myPoolOfID.top();
-               myPoolOfID.pop();
+                set<int>::iterator i = myPoolOfID.begin();
+               int ID = *i;//myPoolOfID.top();
+               myPoolOfID.erase( i );//myPoolOfID.pop();
                return ID;
        }
 }
@@ -56,5 +57,27 @@ int SMDS_MeshIDFactory::GetFreeID()
 //=======================================================================
 void SMDS_MeshIDFactory::ReleaseID(const int ID)
 {
-  if (ID > 0 && ID < myMaxID) myPoolOfID.push(ID);
+  if ( ID > 0 )
+  {
+    if ( ID < myMaxID )
+    {
+      myPoolOfID.insert(ID);
+    }
+    else if ( ID == myMaxID )
+    {
+      --myMaxID;
+      if ( !myPoolOfID.empty() ) // assure that myMaxID is not in myPoolOfID
+      {
+        set<int>::iterator i = --myPoolOfID.end();
+        while ( i != myPoolOfID.begin() && myMaxID == *i ) {
+          --myMaxID; --i;
+        }
+        if ( myMaxID == *i )
+          --myMaxID; // begin of myPoolOfID reached
+        else
+          ++i;
+        myPoolOfID.erase( i, myPoolOfID.end() );
+      }
+    }
+  }
 }
index 62b2d4c008235812d41c066a103e7fadeb5bb4fc..8a6425ac2512b4b8023e2df34afb7d2286a78b88 100644 (file)
@@ -28,7 +28,7 @@
 #define _SMDS_MeshIDFactory_HeaderFile
 
 #include "SMDS_MeshObject.hxx"
-#include <stack>
+#include <set>
 
 
 class SMDS_MeshIDFactory:public SMDS_MeshObject
@@ -40,7 +40,7 @@ class SMDS_MeshIDFactory:public SMDS_MeshObject
   protected:
        SMDS_MeshIDFactory();
        int myMaxID;
-       std::stack<int> myPoolOfID;
+       std::set<int> myPoolOfID;
 };
 
 #endif
diff --git a/src/SMDS/SMDS_PolygonalFaceOfNodes.cxx b/src/SMDS/SMDS_PolygonalFaceOfNodes.cxx
new file mode 100644 (file)
index 0000000..38abf18
--- /dev/null
@@ -0,0 +1,174 @@
+//  SMESH SMDS : implementaion of Salome mesh data structure
+//
+//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
+// 
+//  This library is free software; you can redistribute it and/or 
+//  modify it under the terms of the GNU Lesser General Public 
+//  License as published by the Free Software Foundation; either 
+//  version 2.1 of the License. 
+// 
+//  This library is distributed in the hope that it will be useful, 
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of 
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
+//  Lesser General Public License for more details. 
+// 
+//  You should have received a copy of the GNU Lesser General Public 
+//  License along with this library; if not, write to the Free Software 
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
+// 
+//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+
+#ifdef _MSC_VER
+#pragma warning(disable:4786)
+#endif
+
+#include "SMDS_PolygonalFaceOfNodes.hxx"
+
+#include "SMDS_IteratorOfElements.hxx"
+//#include "SMDS_MeshNode.hxx"
+#include "utilities.h"
+
+using namespace std;
+
+//=======================================================================
+//function : Constructor
+//purpose  : 
+//=======================================================================
+SMDS_PolygonalFaceOfNodes::SMDS_PolygonalFaceOfNodes
+                          (std::vector<const SMDS_MeshNode *> nodes)
+{
+  myNodes = nodes;
+}
+
+//=======================================================================
+//function : GetType
+//purpose  : 
+//=======================================================================
+SMDSAbs_ElementType SMDS_PolygonalFaceOfNodes::GetType() const
+{
+  return SMDSAbs_Face;
+  //return SMDSAbs_PolygonalFace;
+}
+
+//=======================================================================
+//function : ChangeNodes
+//purpose  : 
+//=======================================================================
+bool SMDS_PolygonalFaceOfNodes::ChangeNodes (std::vector<const SMDS_MeshNode *> nodes)
+{
+  if (nodes.size() < 3)
+    return false;
+
+  myNodes = nodes;
+
+  return true;
+}
+
+//=======================================================================
+//function : ChangeNodes
+//purpose  : to support the same interface, as SMDS_FaceOfNodes
+//=======================================================================
+bool SMDS_PolygonalFaceOfNodes::ChangeNodes (const SMDS_MeshNode* nodes[],
+                                             const int            nbNodes)
+{
+  if (nbNodes < 3)
+    return false;
+
+  myNodes.resize(nbNodes);
+  int i = 0;
+  for (; i < nbNodes; i++) {
+    myNodes[i] = nodes[i];
+  }
+
+  return true;
+}
+
+//=======================================================================
+//function : NbNodes
+//purpose  : 
+//=======================================================================
+int SMDS_PolygonalFaceOfNodes::NbNodes() const
+{
+  return myNodes.size();
+}
+
+//=======================================================================
+//function : NbEdges
+//purpose  : 
+//=======================================================================
+int SMDS_PolygonalFaceOfNodes::NbEdges() const
+{
+  return NbNodes();
+}
+
+//=======================================================================
+//function : NbFaces
+//purpose  : 
+//=======================================================================
+int SMDS_PolygonalFaceOfNodes::NbFaces() const
+{
+  return 1;
+}
+
+//=======================================================================
+//function : Print
+//purpose  : 
+//=======================================================================
+void SMDS_PolygonalFaceOfNodes::Print(ostream & OS) const
+{
+  OS << "polygonal face <" << GetID() << " > : ";
+  int i, nbNodes = myNodes.size();
+  for (i = 0; i < nbNodes - 1; i++)
+    OS << myNodes[i] << ",";
+  OS << myNodes[i] << ") " << endl;
+}
+
+//=======================================================================
+//function : elementsIterator
+//purpose  : 
+//=======================================================================
+class SMDS_PolygonalFaceOfNodes_MyIterator:public SMDS_ElemIterator
+{
+  //const SMDS_MeshNode* const *mySet;
+  const std::vector<const SMDS_MeshNode *> mySet;
+  //int myLength;
+  int index;
+ public:
+  //SMDS_PolygonalFaceOfNodes_MyIterator(const SMDS_MeshNode* const *s, int l):
+  //  mySet(s),myLength(l),index(0) {}
+  SMDS_PolygonalFaceOfNodes_MyIterator(const std::vector<const SMDS_MeshNode *> s):
+    mySet(s),index(0) {}
+
+  bool more()
+  {
+    return index < mySet.size();
+  }
+
+  const SMDS_MeshElement* next()
+  {
+    index++;
+    return mySet[index-1];
+  }
+};
+
+SMDS_ElemIteratorPtr SMDS_PolygonalFaceOfNodes::elementsIterator
+                                         (SMDSAbs_ElementType type) const
+{
+  switch(type)
+  {
+  case SMDSAbs_Face:
+    return SMDS_MeshElement::elementsIterator(SMDSAbs_Face);
+  case SMDSAbs_Node:
+    return SMDS_ElemIteratorPtr(new SMDS_PolygonalFaceOfNodes_MyIterator(myNodes));
+  case SMDSAbs_Edge:
+    MESSAGE("Error : edge iterator for SMDS_PolygonalFaceOfNodes not implemented");
+    break;
+  default:
+    return SMDS_ElemIteratorPtr
+      (new SMDS_IteratorOfElements
+       (this,type,SMDS_ElemIteratorPtr
+        (new SMDS_PolygonalFaceOfNodes_MyIterator(myNodes))));
+  }
+  return SMDS_ElemIteratorPtr();
+}
diff --git a/src/SMDS/SMDS_PolygonalFaceOfNodes.hxx b/src/SMDS/SMDS_PolygonalFaceOfNodes.hxx
new file mode 100644 (file)
index 0000000..5677462
--- /dev/null
@@ -0,0 +1,60 @@
+//  SMESH SMDS : implementaion of Salome mesh data structure
+//
+//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
+// 
+//  This library is free software; you can redistribute it and/or 
+//  modify it under the terms of the GNU Lesser General Public 
+//  License as published by the Free Software Foundation; either 
+//  version 2.1 of the License. 
+// 
+//  This library is distributed in the hope that it will be useful, 
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of 
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
+//  Lesser General Public License for more details. 
+// 
+//  You should have received a copy of the GNU Lesser General Public 
+//  License along with this library; if not, write to the Free Software 
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
+// 
+//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+
+#ifndef _SMDS_PolygonalFaceOfNodes_HeaderFile
+#define _SMDS_PolygonalFaceOfNodes_HeaderFile
+
+#include "SMDS_MeshFace.hxx"
+//#include "SMDS_FaceOfNodes.hxx"
+#include "SMDS_MeshNode.hxx"
+#include "SMDS_Iterator.hxx"
+
+#include <iostream>
+
+//class SMDS_PolygonalFaceOfNodes:public SMDS_FaceOfNodes
+class SMDS_PolygonalFaceOfNodes:public SMDS_MeshFace
+{
+ public:
+  SMDS_PolygonalFaceOfNodes (std::vector<const SMDS_MeshNode *> nodes);
+
+  virtual SMDSAbs_ElementType GetType() const;
+  virtual bool IsPoly() const { return true; };
+
+  bool ChangeNodes (std::vector<const SMDS_MeshNode *> nodes);
+
+  bool ChangeNodes (const SMDS_MeshNode* nodes[],
+                    const int            nbNodes);
+  // to support the same interface, as SMDS_FaceOfNodes
+
+  virtual int NbNodes() const;
+  virtual int NbEdges() const;
+  virtual int NbFaces() const;
+
+  virtual void Print (std::ostream & OS) const;
+
+ protected:
+  virtual SMDS_ElemIteratorPtr elementsIterator (SMDSAbs_ElementType type) const;
+
+ private:
+  std::vector<const SMDS_MeshNode *> myNodes;
+};
+
+#endif
diff --git a/src/SMDS/SMDS_PolyhedralVolumeOfNodes.cxx b/src/SMDS/SMDS_PolyhedralVolumeOfNodes.cxx
new file mode 100644 (file)
index 0000000..8b26134
--- /dev/null
@@ -0,0 +1,182 @@
+//  SMESH SMDS : implementaion of Salome mesh data structure
+//
+//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
+// 
+//  This library is free software; you can redistribute it and/or 
+//  modify it under the terms of the GNU Lesser General Public 
+//  License as published by the Free Software Foundation; either 
+//  version 2.1 of the License. 
+// 
+//  This library is distributed in the hope that it will be useful, 
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of 
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
+//  Lesser General Public License for more details. 
+// 
+//  You should have received a copy of the GNU Lesser General Public 
+//  License along with this library; if not, write to the Free Software 
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
+// 
+//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+
+#ifdef _MSC_VER
+#pragma warning(disable:4786)
+#endif
+
+#include "SMDS_PolyhedralVolumeOfNodes.hxx"
+#include "SMDS_MeshNode.hxx"
+#include "utilities.h"
+
+#include <set>
+
+using namespace std;
+
+//=======================================================================
+//function : Constructor
+//purpose  : Create a volume of many faces
+//=======================================================================
+SMDS_PolyhedralVolumeOfNodes::SMDS_PolyhedralVolumeOfNodes
+                                (std::vector<const SMDS_MeshNode *> nodes,
+                                 std::vector<int>                   quantities)
+: SMDS_VolumeOfNodes(NULL, NULL, NULL, NULL)
+{
+  ChangeNodes(nodes, quantities);
+}
+
+//=======================================================================
+//function : GetType
+//purpose  : 
+//=======================================================================
+SMDSAbs_ElementType SMDS_PolyhedralVolumeOfNodes::GetType() const
+{
+//  return SMDSAbs_PolyhedralVolume;
+  return SMDSAbs_Volume;
+}
+
+//=======================================================================
+//function : ChangeNodes
+//purpose  : 
+//=======================================================================
+bool SMDS_PolyhedralVolumeOfNodes::ChangeNodes (std::vector<const SMDS_MeshNode *> nodes,
+                                                std::vector<int>                   quantities)
+{
+  myNodesByFaces = nodes;
+  myQuantities = quantities;
+
+  // Init fields of parent class
+  int aNbNodes = 0;
+  std::set<const SMDS_MeshNode *> aSet;
+  int nodes_len = nodes.size();
+  for (int j = 0; j < nodes_len; j++) {
+    if (aSet.find(nodes[j]) == aSet.end()) {
+      aSet.insert(nodes[j]);
+      aNbNodes++;
+    }
+  }
+
+  int k = 0;
+  const SMDS_MeshNode* aNodes [aNbNodes];
+  std::set<const SMDS_MeshNode *>::iterator anIter = aSet.begin();
+  for (; anIter != aSet.end(); anIter++, k++) {
+    aNodes[k] = *anIter;
+  }
+
+  //SMDS_VolumeOfNodes::ChangeNodes(aNodes, aNbNodes);
+  delete [] myNodes;
+  //myNbNodes = nodes.size();
+  myNbNodes = aNbNodes;
+  myNodes = new const SMDS_MeshNode* [myNbNodes];
+  for (int i = 0; i < myNbNodes; i++) {
+    //myNodes[i] = nodes[i];
+    myNodes[i] = aNodes[i];
+  }
+
+  return true;
+}
+
+//=======================================================================
+//function : NbEdges
+//purpose  : 
+//=======================================================================
+int SMDS_PolyhedralVolumeOfNodes::NbEdges() const
+{
+  int nbEdges = 0;
+
+  for (int ifa = 0; ifa < myQuantities.size(); ifa++) {
+    nbEdges += myQuantities[ifa];
+  }
+  nbEdges /= 2;
+
+  return nbEdges;
+}
+
+//=======================================================================
+//function : NbFaces
+//purpose  : 
+//=======================================================================
+int SMDS_PolyhedralVolumeOfNodes::NbFaces() const
+{
+  return myQuantities.size();
+}
+
+//=======================================================================
+//function : NbFaceNodes
+//purpose  : 
+//=======================================================================
+int SMDS_PolyhedralVolumeOfNodes::NbFaceNodes (const int face_ind) const
+{
+  if (face_ind < 1 || myQuantities.size() < face_ind)
+    return 0;
+  return myQuantities[face_ind - 1];
+}
+
+//=======================================================================
+//function : GetFaceNode
+//purpose  : 
+//=======================================================================
+const SMDS_MeshNode* SMDS_PolyhedralVolumeOfNodes::GetFaceNode (const int face_ind,
+                                                                const int node_ind) const
+{
+  if (node_ind < 1 || NbFaceNodes(face_ind) < node_ind)
+    return NULL;
+
+  int i, first_node = 0;
+  for (i = 0; i < face_ind - 1; i++) {
+    first_node += myQuantities[i];
+  }
+
+  return myNodesByFaces[first_node + node_ind - 1];
+}
+
+//=======================================================================
+//function : Print
+//purpose  : 
+//=======================================================================
+void SMDS_PolyhedralVolumeOfNodes::Print (ostream & OS) const
+{
+  OS << "polyhedral volume <" << GetID() << "> : ";
+
+  int faces_len = myQuantities.size();
+  //int nodes_len = myNodesByFaces.size();
+  int cur_first_node = 0;
+
+  int i, j;
+  for (i = 0; i < faces_len; i++) {
+    OS << "face_" << i << " (";
+    for (j = 0; j < myQuantities[i] - 1; j++) {
+      OS << myNodesByFaces[cur_first_node + j] << ",";
+    }
+    OS << myNodesByFaces[cur_first_node + j] << ") ";
+    cur_first_node += myQuantities[i];
+  }
+}
+
+//=======================================================================
+//function : ChangeNodes
+//purpose  : usage disabled
+//=======================================================================
+bool SMDS_PolyhedralVolumeOfNodes::ChangeNodes (const SMDS_MeshNode* nodes[],
+                                                const int            nbNodes)
+{
+  return false;
+}
diff --git a/src/SMDS/SMDS_PolyhedralVolumeOfNodes.hxx b/src/SMDS/SMDS_PolyhedralVolumeOfNodes.hxx
new file mode 100644 (file)
index 0000000..d7cfeee
--- /dev/null
@@ -0,0 +1,72 @@
+//  SMESH SMDS : implementaion of Salome mesh data structure
+//
+//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
+// 
+//  This library is free software; you can redistribute it and/or 
+//  modify it under the terms of the GNU Lesser General Public 
+//  License as published by the Free Software Foundation; either 
+//  version 2.1 of the License. 
+// 
+//  This library is distributed in the hope that it will be useful, 
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of 
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
+//  Lesser General Public License for more details. 
+// 
+//  You should have received a copy of the GNU Lesser General Public 
+//  License along with this library; if not, write to the Free Software 
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
+// 
+//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+//
+//
+//
+//  File   : SMDS_PolyhedralVolumeOfNodes.hxx
+//  Module : SMESH
+
+#ifndef _SMDS_PolyhedralVolumeOfNodes_HeaderFile
+#define _SMDS_PolyhedralVolumeOfNodes_HeaderFile
+
+#include "SMDS_VolumeOfNodes.hxx"
+
+class SMDS_PolyhedralVolumeOfNodes:public SMDS_VolumeOfNodes
+{
+ public:
+  SMDS_PolyhedralVolumeOfNodes (std::vector<const SMDS_MeshNode *> nodes,
+                                std::vector<int>                   quantities);
+
+  //virtual ~SMDS_PolyhedralVolumeOfNodes();
+
+  virtual SMDSAbs_ElementType GetType() const; 
+  virtual bool IsPoly() const { return true; };
+
+  bool ChangeNodes (std::vector<const SMDS_MeshNode *> nodes,
+                    std::vector<int>                   quantities);
+
+  //virtual int NbNodes() const;
+  virtual int NbEdges() const;
+  virtual int NbFaces() const;
+
+  int NbFaceNodes (const int face_ind) const;
+  // 1 <= face_ind <= NbFaces()
+
+  const SMDS_MeshNode* GetFaceNode (const int face_ind, const int node_ind) const;
+  // 1 <= face_ind <= NbFaces()
+  // 1 <= node_ind <= NbFaceNodes()
+
+  virtual void Print (std::ostream & OS) const;
+
+ protected:
+  //virtual SMDS_ElemIteratorPtr elementsIterator (SMDSAbs_ElementType type) const;
+
+ private:
+  // usage disabled
+  bool ChangeNodes (const SMDS_MeshNode* nodes[],
+                    const int            nbNodes);
+
+ private:
+  std::vector<const SMDS_MeshNode *> myNodesByFaces;
+  std::vector<int> myQuantities;
+};
+
+#endif
index 034486801b7a0e4dbe02099a40681e535cd54c20..dd98851eb8f84f9239f18fd5a1e6bded4ec87b69 100644 (file)
 
 #include "SMDS_MeshElement.hxx"
 #include "SMDS_MeshNode.hxx"
+#include "SMDS_PolyhedralVolumeOfNodes.hxx"
+
+#include "utilities.h"
+
 #include <map>
 #include <float.h>
 #include <math.h>
@@ -200,19 +204,36 @@ double XYZ::Magnitude() {
 
 SMDS_VolumeTool::SMDS_VolumeTool ()
      : myVolume( 0 ),
+       myPolyedre( 0 ),
        myVolForward( true ),
        myNbFaces( 0 ),
        myVolumeNbNodes( 0 ),
-       myExternalFaces( false )
+       myVolumeNodes( NULL ),
+       myExternalFaces( false ),
+       myFaceNbNodes( 0 ),
+       myCurFace( -1 ),
+       myFaceNodeIndices( NULL ),
+       myFaceNodes( NULL )
 {
 }
+
 //=======================================================================
 //function : SMDS_VolumeTool
 //purpose  : 
 //=======================================================================
 
 SMDS_VolumeTool::SMDS_VolumeTool (const SMDS_MeshElement* theVolume)
-     : myExternalFaces( false )
+     : myVolume( 0 ),
+       myPolyedre( 0 ),
+       myVolForward( true ),
+       myNbFaces( 0 ),
+       myVolumeNbNodes( 0 ),
+       myVolumeNodes( NULL ),
+       myExternalFaces( false ),
+       myFaceNbNodes( 0 ),
+       myCurFace( -1 ),
+       myFaceNodeIndices( NULL ),
+       myFaceNodes( NULL )
 {
   Set( theVolume );
 }
@@ -224,6 +245,14 @@ SMDS_VolumeTool::SMDS_VolumeTool (const SMDS_MeshElement* theVolume)
 
 SMDS_VolumeTool::~SMDS_VolumeTool()
 {
+  if (myVolumeNodes != NULL) {
+    delete [] myVolumeNodes;
+    myVolumeNodes = NULL;
+  }
+  if (myFaceNodes != NULL) {
+    delete [] myFaceNodes;
+    myFaceNodes = NULL;
+  }
 }
 
 //=======================================================================
@@ -234,58 +263,75 @@ SMDS_VolumeTool::~SMDS_VolumeTool()
 bool SMDS_VolumeTool::Set (const SMDS_MeshElement* theVolume)
 {
   myVolume = 0;
+  myPolyedre = 0;
+
   myVolForward = true;
-  myCurFace = -1;
-  myVolumeNbNodes = 0;
   myNbFaces = 0;
+  myVolumeNbNodes = 0;
+  if (myVolumeNodes != NULL) {
+    delete [] myVolumeNodes;
+    myVolumeNodes = NULL;
+  }
+
+  myExternalFaces = false;
+  myFaceNbNodes = 0;
+
+  myCurFace = -1;
+  myFaceNodeIndices = NULL;
+  if (myFaceNodes != NULL) {
+    delete [] myFaceNodes;
+    myFaceNodes = NULL;
+  }
+
   if ( theVolume && theVolume->GetType() == SMDSAbs_Volume )
   {
+    myVolume = theVolume;
+
+    myNbFaces = theVolume->NbFaces();
     myVolumeNbNodes = theVolume->NbNodes();
-    switch ( myVolumeNbNodes ) {
-    case 4:
-    case 5:
-    case 6:
-    case 8:
-      {
-      myVolume = theVolume;
-      myNbFaces = theVolume->NbFaces();
-
-      // set volume nodes
-      int iNode = 0;
-      SMDS_ElemIteratorPtr nodeIt = myVolume->nodesIterator();
-      while ( nodeIt->more() )
-        myVolumeNodes[ iNode++ ] = static_cast<const SMDS_MeshNode*>( nodeIt->next() );
-
-      // nb nodes in each face
-      if ( myVolumeNbNodes == 4 )
-        myFaceNbNodes = Tetra_nbN;
-      else if ( myVolumeNbNodes == 5 )
-        myFaceNbNodes = Pyramid_nbN;
-      else if ( myVolumeNbNodes == 6 )
-        myFaceNbNodes = Penta_nbN;
-      else
-        myFaceNbNodes = Hexa_nbN;
-
-      // define volume orientation
-      XYZ botNormal;
-      GetFaceNormal( 0, botNormal.x, botNormal.y, botNormal.z );
-      const SMDS_MeshNode* topNode = myVolumeNodes[ myVolumeNbNodes - 1 ];
-      const SMDS_MeshNode* botNode = myVolumeNodes[ 0 ];
-      XYZ upDir (topNode->X() - botNode->X(),
-                 topNode->Y() - botNode->Y(),
-                 topNode->Z() - botNode->Z() );
-      myVolForward = ( botNormal.Dot( upDir ) < 0 );
-      break;
+
+    // set volume nodes
+    int iNode = 0;
+    myVolumeNodes = new const SMDS_MeshNode* [myVolumeNbNodes];
+    SMDS_ElemIteratorPtr nodeIt = myVolume->nodesIterator();
+    while ( nodeIt->more() ) {
+      myVolumeNodes[ iNode++ ] = static_cast<const SMDS_MeshNode*>( nodeIt->next() );
     }
-    default: myVolume = 0;
+
+    if (myVolume->IsPoly()) {
+      myPolyedre = static_cast<const SMDS_PolyhedralVolumeOfNodes*>( myVolume );
+      if (!myPolyedre) {
+        MESSAGE("Warning: bad volumic element");
+        return false;
+      }
+    } else {
+      switch ( myVolumeNbNodes ) {
+      case 4:
+      case 5:
+      case 6:
+      case 8: {
+        // define volume orientation
+        XYZ botNormal;
+        GetFaceNormal( 0, botNormal.x, botNormal.y, botNormal.z );
+        const SMDS_MeshNode* topNode = myVolumeNodes[ myVolumeNbNodes - 1 ];
+        const SMDS_MeshNode* botNode = myVolumeNodes[ 0 ];
+        XYZ upDir (topNode->X() - botNode->X(),
+                   topNode->Y() - botNode->Y(),
+                   topNode->Z() - botNode->Z() );
+        myVolForward = ( botNormal.Dot( upDir ) < 0 );
+        break;
+      }
+      default:
+        break;
+      }
     }
   }
   return ( myVolume != 0 );
 }
 
 //=======================================================================
-//function : GetInverseNodes
-//purpose  : Return nodes vector of an inverse volume
+//function : Inverse
+//purpose  : Inverse volume
 //=======================================================================
 
 #define SWAP_NODES(nodes,i1,i2)           \
@@ -298,6 +344,11 @@ void SMDS_VolumeTool::Inverse ()
 {
   if ( !myVolume ) return;
 
+  if (myVolume->IsPoly()) {
+    MESSAGE("Warning: attempt to inverse polyhedral volume");
+    return;
+  }
+
   myVolForward = !myVolForward;
   myCurFace = -1;
 
@@ -372,9 +423,9 @@ void SMDS_VolumeTool::SetExternalNormal ()
 
 int SMDS_VolumeTool::NbFaceNodes( int faceIndex )
 {
-  if ( !setFace( faceIndex ))
-    return 0;
-  return myFaceNbNodes[ faceIndex ];
+    if ( !setFace( faceIndex ))
+      return 0;
+    return myFaceNbNodes;
 }
 
 //=======================================================================
@@ -402,6 +453,10 @@ const SMDS_MeshNode** SMDS_VolumeTool::GetFaceNodes( int faceIndex )
 
 const int* SMDS_VolumeTool::GetFaceNodesIndices( int faceIndex )
 {
+  if (myVolume->IsPoly()) {
+    MESSAGE("Warning: attempt to obtain FaceNodesIndices of polyhedral volume");
+    return NULL;
+  }
   if ( !setFace( faceIndex ))
     return 0;
   return myFaceNodeIndices;
@@ -419,10 +474,10 @@ bool SMDS_VolumeTool::GetFaceNodes (int                        faceIndex,
     return false;
 
   theFaceNodes.clear();
-  int iNode, nbNode = myFaceNbNodes[ faceIndex ];
+  int iNode, nbNode = myFaceNbNodes;
   for ( iNode = 0; iNode < nbNode; iNode++ )
     theFaceNodes.insert( myFaceNodes[ iNode ]);
-  
+
   return true;
 }
 
@@ -436,6 +491,16 @@ bool SMDS_VolumeTool::IsFaceExternal( int faceIndex )
   if ( myExternalFaces || !myVolume )
     return true;
 
+  if (myVolume->IsPoly()) {
+    XYZ aNormal, baryCenter, p0 (myPolyedre->GetFaceNode(faceIndex + 1, 1));
+    GetFaceNormal(faceIndex, aNormal.x, aNormal.y, aNormal.z);
+    GetBaryCenter(baryCenter.x, baryCenter.y, baryCenter.z);
+    XYZ insideVec (baryCenter - p0);
+    if (insideVec.Dot(aNormal) > 0)
+      return false;
+    return true;
+  }
+
   switch ( myVolumeNbNodes ) {
   case 4:
   case 5:
@@ -482,7 +547,6 @@ bool SMDS_VolumeTool::GetFaceNormal (int faceIndex, double & X, double & Y, doub
   return true;
 }
 
-
 //=======================================================================
 //function : GetFaceArea
 //purpose  : Return face area
@@ -490,6 +554,11 @@ bool SMDS_VolumeTool::GetFaceNormal (int faceIndex, double & X, double & Y, doub
 
 double SMDS_VolumeTool::GetFaceArea( int faceIndex )
 {
+  if (myVolume->IsPoly()) {
+    MESSAGE("Warning: attempt to obtain area of a face of polyhedral volume");
+    return 0;
+  }
+
   if ( !setFace( faceIndex ))
     return 0;
 
@@ -500,7 +569,7 @@ double SMDS_VolumeTool::GetFaceArea( int faceIndex )
   XYZ aVec13( p3 - p1 );
   double area = aVec12.Crossed( aVec13 ).Magnitude() * 0.5;
 
-  if ( myFaceNbNodes[ faceIndex ] == 4 ) {
+  if ( myFaceNbNodes == 4 ) {
     XYZ p4 ( myFaceNodes[3] );
     XYZ aVec14( p4 - p1 );
     area += aVec14.Crossed( aVec13 ).Magnitude() * 0.5;
@@ -516,12 +585,17 @@ double SMDS_VolumeTool::GetFaceArea( int faceIndex )
 int SMDS_VolumeTool::GetOppFaceIndex( int faceIndex ) const
 {
   int ind = -1;
+  if (myVolume->IsPoly()) {
+    MESSAGE("Warning: attempt to obtain opposite face on polyhedral volume");
+    return ind;
+  }
+
   if ( faceIndex >= 0 && faceIndex < NbFaces() ) {
     switch ( myVolumeNbNodes ) {
     case 6:
       if ( faceIndex == 0 || faceIndex == 1 )
         ind = 1 - faceIndex;
-      break;
+        break;
     case 8:
       ind = faceIndex + ( faceIndex % 2 ? -1 : 1 );
       break;
@@ -542,6 +616,33 @@ bool SMDS_VolumeTool::IsLinked (const SMDS_MeshNode* theNode1,
   if ( !myVolume )
     return false;
 
+  if (myVolume->IsPoly()) {
+    if (!myPolyedre) {
+      MESSAGE("Warning: bad volumic element");
+      return false;
+    }
+    bool isLinked = false;
+    int iface;
+    for (iface = 1; iface <= myNbFaces && !isLinked; iface++) {
+      int inode, nbFaceNodes = myPolyedre->NbFaceNodes(iface);
+
+      for (inode = 1; inode <= nbFaceNodes && !isLinked; inode++) {
+        const SMDS_MeshNode* curNode = myPolyedre->GetFaceNode(iface, inode);
+
+        if (curNode == theNode1 || curNode == theNode2) {
+          int inextnode = (inode == nbFaceNodes) ? 1 : inode + 1;
+          const SMDS_MeshNode* nextNode = myPolyedre->GetFaceNode(iface, inextnode);
+
+          if ((curNode == theNode1 && nextNode == theNode2) ||
+              (curNode == theNode2 && nextNode == theNode1)) {
+            isLinked = true;
+          }
+        }
+      }
+    }
+    return isLinked;
+  }
+
   // find nodes indices
   int i1 = -1, i2 = -1;
   for ( int i = 0; i < myVolumeNbNodes; i++ ) {
@@ -562,6 +663,10 @@ bool SMDS_VolumeTool::IsLinked (const SMDS_MeshNode* theNode1,
 bool SMDS_VolumeTool::IsLinked (const int theNode1Index,
                                 const int theNode2Index) const
 {
+  if (myVolume->IsPoly()) {
+    return IsLinked(myVolumeNodes[theNode1Index], myVolumeNodes[theNode2Index]);
+  }
+
   int minInd = theNode1Index < theNode2Index ? theNode1Index : theNode2Index;
   int maxInd = theNode1Index < theNode2Index ? theNode2Index : theNode1Index;
 
@@ -617,7 +722,6 @@ int SMDS_VolumeTool::GetNodeIndex(const SMDS_MeshNode* theNode) const
   return -1;
 }
 
-
 //=======================================================================
 //function : IsFreeFace
 //purpose  : check that only one volume is build on the face nodes
@@ -626,11 +730,12 @@ int SMDS_VolumeTool::GetNodeIndex(const SMDS_MeshNode* theNode) const
 bool SMDS_VolumeTool::IsFreeFace( int faceIndex )
 {
   const int free = true;
-  if ( !setFace( faceIndex ))
+
+  if (!setFace( faceIndex ))
     return !free;
 
   const SMDS_MeshNode** nodes = GetFaceNodes( faceIndex );
-  int nbFaceNodes = NbFaceNodes( faceIndex );
+  int nbFaceNodes = myFaceNbNodes;
 
   // evaluate nb of face nodes shared by other volume
   int maxNbShared = -1;
@@ -706,7 +811,7 @@ bool SMDS_VolumeTool::IsFreeFace( int faceIndex )
       // check traingle parts 1 & 3
       if ( isShared[1] && isShared[3] )
         return !free; // is not free
-      // check traingle parts 0 & 2;
+      // check triangle parts 0 & 2;
       // 0 part could not be checked in the loop; check it here
       if ( isShared[2] && prevLinkShared &&
           volume.IsLinked( nodes[ 0 ], nodes[ 1 ] ) &&
@@ -741,7 +846,7 @@ int SMDS_VolumeTool::GetFaceIndex( const set<const SMDS_MeshNode*>& theFaceNodes
 //purpose  : Return index of a face formed by theFaceNodes
 //=======================================================================
 
-int SMDS_VolumeTool::GetFaceIndex( const set<int>& theFaceNodesIndices )
+/*int SMDS_VolumeTool::GetFaceIndex( const set<int>& theFaceNodesIndices )
 {
   for ( int iFace = 0; iFace < myNbFaces; iFace++ ) {
     const int* nodes = GetFaceNodesIndices( iFace );
@@ -753,7 +858,7 @@ int SMDS_VolumeTool::GetFaceIndex( const set<int>& theFaceNodesIndices )
       return iFace;
   }
   return -1;
-}
+}*/
 
 //=======================================================================
 //function : setFace
@@ -768,44 +873,163 @@ bool SMDS_VolumeTool::setFace( int faceIndex )
   if ( myCurFace == faceIndex )
     return true;
 
+  myCurFace = -1;
+
   if ( faceIndex < 0 || faceIndex >= NbFaces() )
     return false;
 
-  // choose face node indices
-  switch ( myVolumeNbNodes ) {
-  case 4:
-    if ( myExternalFaces )
-      myFaceNodeIndices = myVolForward ? Tetra_F[ faceIndex ] : Tetra_RE[ faceIndex ];
-    else
-      myFaceNodeIndices = myVolForward ? Tetra_F[ faceIndex ] : Tetra_R[ faceIndex ];
-    break;
-  case 5:
-    if ( myExternalFaces )
-      myFaceNodeIndices = myVolForward ? Pyramid_F[ faceIndex ] : Pyramid_RE[ faceIndex ];
-    else
-      myFaceNodeIndices = myVolForward ? Pyramid_F[ faceIndex ] : Pyramid_R[ faceIndex ];
-    break;
-  case 6:
-    if ( myExternalFaces )
-      myFaceNodeIndices = myVolForward ? Penta_FE[ faceIndex ] : Penta_RE[ faceIndex ];
-    else
-      myFaceNodeIndices = myVolForward ? Penta_F[ faceIndex ] : Penta_R[ faceIndex ];
-    break;
-  case 8:
-    if ( myExternalFaces )
-      myFaceNodeIndices = myVolForward ? Hexa_FE[ faceIndex ] : Hexa_RE[ faceIndex ];
-    else
-      myFaceNodeIndices = Hexa_F[ faceIndex ];
-    break;
-  default: return false;
+  if (myFaceNodes != NULL) {
+    delete [] myFaceNodes;
+    myFaceNodes = NULL;
   }
 
-  // set face nodes
-  int iNode, nbNode = myFaceNbNodes[ faceIndex ];
-  for ( iNode = 0; iNode <= nbNode; iNode++ )
-    myFaceNodes[ iNode ] = myVolumeNodes[ myFaceNodeIndices[ iNode ]];
+  if (myVolume->IsPoly()) {
+    if (!myPolyedre) {
+      MESSAGE("Warning: bad volumic element");
+      return false;
+    }
+
+    // check orientation
+    bool isGoodOri = true;
+    if (myExternalFaces) {
+      // get natural orientation
+      XYZ aNormal, baryCenter, p0 (myPolyedre->GetFaceNode(faceIndex + 1, 1));
+      SMDS_VolumeTool vTool (myPolyedre);
+      vTool.GetFaceNormal(faceIndex, aNormal.x, aNormal.y, aNormal.z);
+      vTool.GetBaryCenter(baryCenter.x, baryCenter.y, baryCenter.z);
+      XYZ insideVec (baryCenter - p0);
+      if (insideVec.Dot(aNormal) > 0)
+        isGoodOri = false;
+    }
+
+    // set face nodes
+    int iNode;
+    myFaceNbNodes = myPolyedre->NbFaceNodes(faceIndex + 1);
+    myFaceNodes = new const SMDS_MeshNode* [myFaceNbNodes + 1];
+    if (isGoodOri) {
+      for ( iNode = 0; iNode < myFaceNbNodes; iNode++ )
+        myFaceNodes[ iNode ] = myPolyedre->GetFaceNode(faceIndex + 1, iNode + 1);
+    } else {
+      for ( iNode = 0; iNode < myFaceNbNodes; iNode++ )
+        myFaceNodes[ iNode ] = myPolyedre->GetFaceNode(faceIndex + 1, myFaceNbNodes - iNode);
+    }
+    myFaceNodes[ myFaceNbNodes ] = myFaceNodes[ 0 ]; // last = first
+
+  } else {
+    // choose face node indices
+    switch ( myVolumeNbNodes ) {
+    case 4:
+      myFaceNbNodes = Tetra_nbN[ faceIndex ];
+      if ( myExternalFaces )
+        myFaceNodeIndices = myVolForward ? Tetra_F[ faceIndex ] : Tetra_RE[ faceIndex ];
+      else
+        myFaceNodeIndices = myVolForward ? Tetra_F[ faceIndex ] : Tetra_R[ faceIndex ];
+      break;
+    case 5:
+      myFaceNbNodes = Pyramid_nbN[ faceIndex ];
+      if ( myExternalFaces )
+        myFaceNodeIndices = myVolForward ? Pyramid_F[ faceIndex ] : Pyramid_RE[ faceIndex ];
+      else
+        myFaceNodeIndices = myVolForward ? Pyramid_F[ faceIndex ] : Pyramid_R[ faceIndex ];
+      break;
+    case 6:
+      myFaceNbNodes = Penta_nbN[ faceIndex ];
+      if ( myExternalFaces )
+        myFaceNodeIndices = myVolForward ? Penta_FE[ faceIndex ] : Penta_RE[ faceIndex ];
+      else
+        myFaceNodeIndices = myVolForward ? Penta_F[ faceIndex ] : Penta_R[ faceIndex ];
+      break;
+    case 8:
+      myFaceNbNodes = Hexa_nbN[ faceIndex ];
+      if ( myExternalFaces )
+        myFaceNodeIndices = myVolForward ? Hexa_FE[ faceIndex ] : Hexa_RE[ faceIndex ];
+      else
+        myFaceNodeIndices = Hexa_F[ faceIndex ];
+      break;
+    default:
+      return false;
+    }
+
+    // set face nodes
+    myFaceNodes = new const SMDS_MeshNode* [myFaceNbNodes + 1];
+    for ( int iNode = 0; iNode <= myFaceNbNodes; iNode++ )
+      myFaceNodes[ iNode ] = myVolumeNodes[ myFaceNodeIndices[ iNode ]];
+  }
 
   myCurFace = faceIndex;
 
   return true;
 }
+
+//=======================================================================
+//function : GetType
+//purpose  : return VolumeType by nb of nodes in a volume
+//=======================================================================
+
+SMDS_VolumeTool::VolumeType SMDS_VolumeTool::GetType(int nbNodes)
+{
+  switch ( nbNodes ) {
+  case 4: return TETRA;
+  case 5: return PYRAM;
+  case 6: return PENTA;
+  case 8: return HEXA;
+  default:return UNKNOWN;
+  }
+}
+
+//=======================================================================
+//function : NbFaces
+//purpose  : return nb of faces by volume type
+//=======================================================================
+
+int SMDS_VolumeTool::NbFaces( VolumeType type )
+{
+  switch ( type ) {
+  case TETRA: return 4;
+  case PYRAM: return 5;
+  case PENTA: return 5;
+  case HEXA : return 6;
+  default:    return 0;
+  }
+}
+
+//=======================================================================
+//function : GetFaceNodesIndices
+//purpose  : Return the array of face nodes indices
+//           To comfort link iteration, the array
+//           length == NbFaceNodes( faceIndex ) + 1 and
+//           the last node index == the first one.
+//=======================================================================
+
+const int* SMDS_VolumeTool::GetFaceNodesIndices(VolumeType type,
+                                                int        faceIndex,
+                                                bool       external)
+{
+  switch ( type ) {
+  case TETRA: return Tetra_F[ faceIndex ];
+  case PYRAM: return Pyramid_F[ faceIndex ];
+  case PENTA: return external ? Penta_FE[ faceIndex ] : Penta_F[ faceIndex ];
+  case HEXA:  return external ? Hexa_FE[ faceIndex ] : Hexa_F[ faceIndex ];
+  default:;
+  }
+  return 0;
+}
+
+//=======================================================================
+//function : NbFaceNodes
+//purpose  : Return number of nodes in the array of face nodes
+//=======================================================================
+
+int SMDS_VolumeTool::NbFaceNodes(VolumeType type,
+                                 int        faceIndex )
+{
+  switch ( type ) {
+  case TETRA: return Tetra_nbN[ faceIndex ];
+  case PYRAM: return Pyramid_nbN[ faceIndex ];
+  case PENTA: return Penta_nbN[ faceIndex ];
+  case HEXA:  return Hexa_nbN[ faceIndex ];
+  default:;
+  }
+  return 0;
+}
+
index 99e7dc1763800377f1cd6a851f6fcac4da59635b..89732b1da2c265a8f4c40ec8f1eb3de77b7a4622 100644 (file)
@@ -32,6 +32,7 @@
 
 class SMDS_MeshElement;
 class SMDS_MeshNode;
+class SMDS_PolyhedralVolumeOfNodes;
 
 #include <vector>
 #include <set>
@@ -149,26 +150,52 @@ class SMDS_VolumeTool
   // Return index of a face formed by theFaceNodes.
   // Return -1 if a face not found
 
-  int GetFaceIndex( const std::set<int>& theFaceNodesIndices );
+  //int GetFaceIndex( const std::set<int>& theFaceNodesIndices );
   // Return index of a face formed by theFaceNodesIndices
   // Return -1 if a face not found
 
+  // ------------------------
+  // static methods for faces
+  // ------------------------
+
+  enum VolumeType { UNKNOWN, TETRA, PYRAM, PENTA, HEXA };
+
+  static VolumeType GetType(int nbNodes);
+  // return VolumeType by nb of nodes in a volume
+
+  static int NbFaces( VolumeType type );
+  // return nb of faces by volume type
+
+  static const int* GetFaceNodesIndices(VolumeType type,
+                                        int        faceIndex,
+                                        bool       external);
+  // Return the array of face nodes indices
+  // To comfort link iteration, the array
+  // length == NbFaceNodes( faceIndex ) + 1 and
+  // the last node index == the first one.
+
+  static int NbFaceNodes(VolumeType type,
+                         int        faceIndex );
+  // Return number of nodes in the array of face nodes
 
  private:
 
   bool setFace( int faceIndex );
 
   const SMDS_MeshElement* myVolume;
+  const SMDS_PolyhedralVolumeOfNodes* myPolyedre;
+
   bool                    myVolForward;
   int                     myNbFaces;
   int                     myVolumeNbNodes;
-  const SMDS_MeshNode*    myVolumeNodes[ 8 ];
+  const SMDS_MeshNode**   myVolumeNodes;
 
   bool                    myExternalFaces;
-  int*                    myFaceNodeIndices;
-  int*                    myFaceNbNodes;
-  const SMDS_MeshNode*    myFaceNodes[ 5 ];
+
   int                     myCurFace;
+  int                     myFaceNbNodes;
+  int*                    myFaceNodeIndices;
+  const SMDS_MeshNode**   myFaceNodes;
 
 };
 #endif
index e3bf98a5d40c1690f1d74198bcf49f68b71a5970..308456021be04dd5705e11f232379155f971161b 100644 (file)
@@ -79,7 +79,7 @@ static int MYDEBUG = 0;
 SMESH_Mesh::SMESH_Mesh(int localId, int studyId, SMESH_Gen * gen, SMESHDS_Document * myDocument)
 : _groupId( 0 )
 {
-  INFOS("SMESH_Mesh::SMESH_Mesh; this = "<<this);
+  INFOS("SMESH_Mesh::SMESH_Mesh(int localId)");
        _id = localId;
        _studyId = studyId;
        _gen = gen;
@@ -97,7 +97,7 @@ SMESH_Mesh::SMESH_Mesh(int localId, int studyId, SMESH_Gen * gen, SMESHDS_Docume
 
 SMESH_Mesh::~SMESH_Mesh()
 {
-  INFOS("SMESH_Mesh::~SMESH_Mesh; this = "<<this);
+  INFOS("SMESH_Mesh::~SMESH_Mesh");
 
   // delete groups
   map < int, SMESH_Group * >::iterator itg;
@@ -660,6 +660,24 @@ throw(SALOME_Exception)
   return aSubMesh;
 }
 
+//=============================================================================
+/*!
+ * Get the SMESH_subMesh object implementation. Dont create it, return null
+ * if it does not exist.
+ */
+//=============================================================================
+
+SMESH_subMesh *SMESH_Mesh::GetSubMeshContaining(const int aShapeID)
+throw(SALOME_Exception)
+{
+  Unexpect aCatch(SalomeException);
+  
+  map <int, SMESH_subMesh *>::iterator i_sm = _mapSubMesh.find(aShapeID);
+  if (i_sm == _mapSubMesh.end())
+    return NULL;
+  return i_sm->second;
+}
+
 //=======================================================================
 //function : IsUsedHypothesis
 //purpose  : Return True if anHyp is used to mesh aSubShape
@@ -833,7 +851,12 @@ int SMESH_Mesh::NbTriangles() throw(SALOME_Exception)
   int Nb = 0;
   
   SMDS_FaceIteratorPtr itFaces=_myMeshDS->facesIterator();
-  while(itFaces->more()) if(itFaces->next()->NbNodes()==3) Nb++;
+  //while(itFaces->more()) if(itFaces->next()->NbNodes()==3) Nb++;
+  const SMDS_MeshFace * curFace;
+  while (itFaces->more()) {
+    curFace = itFaces->next();
+    if (!curFace->IsPoly() && curFace->NbNodes() == 3) Nb++;
+  }
   return Nb;
 }
 
@@ -846,7 +869,25 @@ int SMESH_Mesh::NbQuadrangles() throw(SALOME_Exception)
   int Nb = 0;
   
   SMDS_FaceIteratorPtr itFaces=_myMeshDS->facesIterator();
-  while(itFaces->more()) if(itFaces->next()->NbNodes()==4) Nb++;
+  //while(itFaces->more()) if(itFaces->next()->NbNodes()==4) Nb++;
+  const SMDS_MeshFace * curFace;
+  while (itFaces->more()) {
+    curFace = itFaces->next();
+    if (!curFace->IsPoly() && curFace->NbNodes() == 4) Nb++;
+  }
+  return Nb;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+/// Return the number of polygonal faces in the mesh. This method run in O(n)
+///////////////////////////////////////////////////////////////////////////////
+int SMESH_Mesh::NbPolygons() throw(SALOME_Exception)
+{
+  Unexpect aCatch(SalomeException);
+  int Nb = 0;
+  SMDS_FaceIteratorPtr itFaces = _myMeshDS->facesIterator();
+  while (itFaces->more())
+    if (itFaces->next()->IsPoly()) Nb++;
   return Nb;
 }
 
@@ -866,7 +907,12 @@ int SMESH_Mesh::NbTetras() throw(SALOME_Exception)
   Unexpect aCatch(SalomeException);
   int Nb = 0;
   SMDS_VolumeIteratorPtr itVolumes=_myMeshDS->volumesIterator();
-  while(itVolumes->more()) if(itVolumes->next()->NbNodes()==4) Nb++;
+  //while(itVolumes->more()) if(itVolumes->next()->NbNodes()==4) Nb++;
+  const SMDS_MeshVolume * curVolume;
+  while (itVolumes->more()) {
+    curVolume = itVolumes->next();
+    if (!curVolume->IsPoly() && curVolume->NbNodes() == 4) Nb++;
+  }
   return Nb;
 }
 
@@ -875,7 +921,12 @@ int SMESH_Mesh::NbHexas() throw(SALOME_Exception)
   Unexpect aCatch(SalomeException);
   int Nb = 0;
   SMDS_VolumeIteratorPtr itVolumes=_myMeshDS->volumesIterator();
-  while(itVolumes->more()) if(itVolumes->next()->NbNodes()==8) Nb++;
+  //while(itVolumes->more()) if(itVolumes->next()->NbNodes()==8) Nb++;
+  const SMDS_MeshVolume * curVolume;
+  while (itVolumes->more()) {
+    curVolume = itVolumes->next();
+    if (!curVolume->IsPoly() && curVolume->NbNodes() == 8) Nb++;
+  }
   return Nb;
 }
 
@@ -884,7 +935,12 @@ int SMESH_Mesh::NbPyramids() throw(SALOME_Exception)
   Unexpect aCatch(SalomeException);
   int Nb = 0;
   SMDS_VolumeIteratorPtr itVolumes=_myMeshDS->volumesIterator();
-  while(itVolumes->more()) if(itVolumes->next()->NbNodes()==5) Nb++;
+  //while(itVolumes->more()) if(itVolumes->next()->NbNodes()==5) Nb++;
+  const SMDS_MeshVolume * curVolume;
+  while (itVolumes->more()) {
+    curVolume = itVolumes->next();
+    if (!curVolume->IsPoly() && curVolume->NbNodes() == 5) Nb++;
+  }
   return Nb;
 }
 
@@ -893,7 +949,22 @@ int SMESH_Mesh::NbPrisms() throw(SALOME_Exception)
   Unexpect aCatch(SalomeException);
   int Nb = 0;
   SMDS_VolumeIteratorPtr itVolumes=_myMeshDS->volumesIterator();
-  while(itVolumes->more()) if(itVolumes->next()->NbNodes()==6) Nb++;
+  //while(itVolumes->more()) if(itVolumes->next()->NbNodes()==6) Nb++;
+  const SMDS_MeshVolume * curVolume;
+  while (itVolumes->more()) {
+    curVolume = itVolumes->next();
+    if (!curVolume->IsPoly() && curVolume->NbNodes() == 6) Nb++;
+  }
+  return Nb;
+}
+
+int SMESH_Mesh::NbPolyhedrons() throw(SALOME_Exception)
+{
+  Unexpect aCatch(SalomeException);
+  int Nb = 0;
+  SMDS_VolumeIteratorPtr itVolumes = _myMeshDS->volumesIterator();
+  while (itVolumes->more())
+    if (itVolumes->next()->IsPoly()) Nb++;
   return Nb;
 }
 
@@ -992,8 +1063,8 @@ void SMESH_Mesh::RemoveGroup (const int theGroupID)
   if (_mapGroup.find(theGroupID) == _mapGroup.end())
     return;
   GetMeshDS()->RemoveGroup( _mapGroup[theGroupID]->GetGroupDS() );
-  delete _mapGroup[theGroupID];
   _mapGroup.erase (theGroupID);
+  delete _mapGroup[theGroupID];
 }
 
 //=============================================================================
index 2864deade7a565b904604cc8e02f82e38d94a2e8..a91a8861bf0157125b55dfc93d7fe91c1a55cafe 100644 (file)
@@ -129,6 +129,9 @@ public:
   SMESH_subMesh *GetSubMeshContaining(const TopoDS_Shape & aSubShape)
     throw(SALOME_Exception);
   
+  SMESH_subMesh *GetSubMeshContaining(const int aShapeID)
+    throw(SALOME_Exception);
+  
   const list < SMESH_subMesh * >&
   GetSubMeshUsingHypothesis(SMESHDS_Hypothesis * anHyp)
     throw(SALOME_Exception);
@@ -165,6 +168,8 @@ public:
   int NbTriangles() throw(SALOME_Exception);
   
   int NbQuadrangles() throw(SALOME_Exception);
+
+  int NbPolygons() throw(SALOME_Exception);
   
   int NbVolumes() throw(SALOME_Exception);
   
@@ -173,9 +178,11 @@ public:
   int NbHexas() throw(SALOME_Exception);
   
   int NbPyramids() throw(SALOME_Exception);
-  
+
   int NbPrisms() throw(SALOME_Exception);
   
+  int NbPolyhedrons() throw(SALOME_Exception);
+  
   int NbSubMesh() throw(SALOME_Exception);
   
   int NbGroup() const { return _mapGroup.size(); }
index dfc453b80d5fadb4d0c456c9bb39b2869612f466..94b59dced6ce99b79cb4cab0c12f4cf0adc8745e 100644 (file)
 
 #include "SMESH_MeshEditor.hxx"
 
-#include "SMESH_ControlsDef.hxx"
-
 #include "SMDS_FaceOfNodes.hxx"
 #include "SMDS_VolumeTool.hxx"
+#include "SMDS_EdgePosition.hxx"
+#include "SMDS_PolyhedralVolumeOfNodes.hxx"
+#include "SMDS_FacePosition.hxx"
+#include "SMDS_SpacePosition.hxx"
+
 #include "SMESHDS_Group.hxx"
 #include "SMESHDS_Mesh.hxx"
+
 #include "SMESH_subMesh.hxx"
 #include "SMESH_ControlsDef.hxx"
 
 #include <gp_Trsf.hxx>
 #include <gp_Lin.hxx>
 #include <gp_XYZ.hxx>
+#include <gp_XY.hxx>
 #include <gp.hxx>
 #include <gp_Pln.hxx>
 #include <BRep_Tool.hxx>
-#include <SMDS_EdgePosition.hxx>
 #include <Geom_Curve.hxx>
-
+#include <Geom_Surface.hxx>
+#include <Geom2d_Curve.hxx>
+#include <Extrema_GenExtPS.hxx>
+#include <Extrema_POnSurf.hxx>
+#include <GeomAdaptor_Surface.hxx>
+#include <ElCLib.hxx>
 
 #include <map>
 
-#include "utilities.h"
-
 using namespace std;
 using namespace SMESH::Controls;
 
@@ -494,11 +501,38 @@ bool SMESH_MeshEditor::Reorient (const SMDS_MeshElement * theElem)
   }
   case SMDSAbs_Volume:
   {
-    SMDS_VolumeTool vTool;
-    if ( !vTool.Set( theElem ))
-      return false;
-    vTool.Inverse();
-    return GetMeshDS()->ChangeElementNodes( theElem, vTool.GetNodes(), vTool.NbNodes() );
+    if (theElem->IsPoly()) {
+      const SMDS_PolyhedralVolumeOfNodes* aPolyedre =
+        static_cast<const SMDS_PolyhedralVolumeOfNodes*>( theElem );
+      if (!aPolyedre) {
+        MESSAGE("Warning: bad volumic element");
+        return false;
+      }
+
+      int nbFaces = aPolyedre->NbFaces();
+      vector<const SMDS_MeshNode *> poly_nodes;
+      vector<int> quantities (nbFaces);
+
+      // reverse each face of the polyedre
+      for (int iface = 1; iface <= nbFaces; iface++) {
+        int inode, nbFaceNodes = aPolyedre->NbFaceNodes(iface);
+        quantities[iface - 1] = nbFaceNodes;
+
+        for (inode = nbFaceNodes; inode >= 1; inode--) {
+          const SMDS_MeshNode* curNode = aPolyedre->GetFaceNode(iface, inode);
+          poly_nodes.push_back(curNode);
+        }
+      }
+
+      return GetMeshDS()->ChangePolyhedronNodes( theElem, poly_nodes, quantities );
+
+    } else {
+      SMDS_VolumeTool vTool;
+      if ( !vTool.Set( theElem ))
+        return false;
+      vTool.Inverse();
+      return GetMeshDS()->ChangeElementNodes( theElem, vTool.GetNodes(), vTool.NbNodes() );
+    }
   }
   default:;
   }
@@ -977,12 +1011,12 @@ bool SMESH_MeshEditor::TriToQuad (set<const SMDS_MeshElement*> &       theElems,
 }
 
 
-#define DUMPSO(txt) \
+/*#define DUMPSO(txt) \
 //  cout << txt << endl;
 //=============================================================================
-/*!
- *
- */
+//
+//
+//
 //=============================================================================
 static void swap( int i1, int i2, int idNodes[], gp_Pnt P[] )
 {
@@ -1254,7 +1288,7 @@ bool SMESH_MeshEditor::SortHexaNodes (const SMDS_Mesh * theMesh,
 //   }
 
   return true;
-}
+}*/
 
 //=======================================================================
 //function : laplacianSmooth
@@ -1262,52 +1296,76 @@ bool SMESH_MeshEditor::SortHexaNodes (const SMDS_Mesh * theMesh,
 //           connected to that node along an element edge
 //=======================================================================
 
-void laplacianSmooth(SMESHDS_Mesh *                       theMesh,
-                     const SMDS_MeshNode*                 theNode,
-                     const set<const SMDS_MeshElement*> & theElems,
-                     const set<const SMDS_MeshNode*> &    theFixedNodes)
+void laplacianSmooth(const SMDS_MeshNode*                 theNode,
+                     const Handle(Geom_Surface)&          theSurface,
+                     map< const SMDS_MeshNode*, gp_XY* >& theUVMap)
 {
   // find surrounding nodes
+
   set< const SMDS_MeshNode* > nodeSet;
   SMDS_ElemIteratorPtr elemIt = theNode->GetInverseElementIterator();
   while ( elemIt->more() )
   {
     const SMDS_MeshElement* elem = elemIt->next();
-    if ( theElems.find( elem ) == theElems.end() )
+    if ( elem->GetType() != SMDSAbs_Face )
       continue;
 
-    int i = 0, iNode = 0;
-    const SMDS_MeshNode* aNodes [4];
+    // put all nodes in array
+    int nbNodes = 0, iNode = 0;
+    vector< const SMDS_MeshNode*> aNodes( elem->NbNodes() );
     SMDS_ElemIteratorPtr itN = elem->nodesIterator();
     while ( itN->more() )
     {
-      aNodes[ i ] = static_cast<const SMDS_MeshNode*>( itN->next() );
-      if ( aNodes[ i ] == theNode )
-        iNode = i;
-      else
-        nodeSet.insert( aNodes[ i ] );
-      i++;
-    }
-    if ( elem->NbNodes() == 4 ) { // remove an opposite node
-      iNode += ( iNode < 2 ) ? 2 : -2;
-      nodeSet.erase( aNodes[ iNode ]);
+      aNodes[ nbNodes ] = static_cast<const SMDS_MeshNode*>( itN->next() );
+      if ( aNodes[ nbNodes ] == theNode )
+        iNode = nbNodes; // index of theNode within aNodes
+      nbNodes++;
     }
+    // add linked nodes
+    int iAfter = ( iNode + 1 == nbNodes ) ? 0 : iNode + 1;
+    nodeSet.insert( aNodes[ iAfter ]);
+    int iBefore = ( iNode == 0 ) ? nbNodes - 1 : iNode - 1;
+    nodeSet.insert( aNodes[ iBefore ]);
   }
 
   // compute new coodrs
+
   double coord[] = { 0., 0., 0. };
   set< const SMDS_MeshNode* >::iterator nodeSetIt = nodeSet.begin();
   for ( ; nodeSetIt != nodeSet.end(); nodeSetIt++ ) {
     const SMDS_MeshNode* node = (*nodeSetIt);
-    coord[0] += node->X();
-    coord[1] += node->Y();
-    coord[2] += node->Z();
+    if ( theSurface.IsNull() ) { // smooth in 3D
+      coord[0] += node->X();
+      coord[1] += node->Y();
+      coord[2] += node->Z();
+    }
+    else { // smooth in 2D
+      ASSERT( theUVMap.find( node ) != theUVMap.end() );
+      gp_XY* uv = theUVMap[ node ];
+      coord[0] += uv->X();
+      coord[1] += uv->Y();
+    }
   }
-  double nbNodes = nodeSet.size();
-  theMesh->MoveNode (theNode,
-                     coord[0]/nbNodes,
-                     coord[1]/nbNodes,
-                     coord[2]/nbNodes);
+  int nbNodes = nodeSet.size();
+  if ( !nbNodes )
+    return;
+  coord[0] /= nbNodes;
+  coord[1] /= nbNodes;
+
+  if ( !theSurface.IsNull() ) {
+    ASSERT( theUVMap.find( theNode ) != theUVMap.end() );
+    theUVMap[ theNode ]->SetCoord( coord[0], coord[1] );
+    gp_Pnt p3d = theSurface->Value( coord[0], coord[1] );
+    coord[0] = p3d.X();
+    coord[1] = p3d.Y();
+    coord[2] = p3d.Z();
+  }
+  else
+    coord[2] /= nbNodes;
+
+  // move node
+
+  const_cast< SMDS_MeshNode* >( theNode )->setXYZ(coord[0],coord[1],coord[2]);
 }
 
 //=======================================================================
@@ -1316,23 +1374,23 @@ void laplacianSmooth(SMESHDS_Mesh *                       theMesh,
 //           surrounding elements
 //=======================================================================
 
-void centroidalSmooth(SMESHDS_Mesh *                       theMesh,
-                      const SMDS_MeshNode*                 theNode,
-                      const set<const SMDS_MeshElement*> & theElems,
-                      const set<const SMDS_MeshNode*> &    theFixedNodes)
+void centroidalSmooth(const SMDS_MeshNode*                 theNode,
+                      const Handle(Geom_Surface)&          theSurface,
+                      map< const SMDS_MeshNode*, gp_XY* >& theUVMap)
 {
   gp_XYZ aNewXYZ(0.,0.,0.);
   SMESH::Controls::Area anAreaFunc;
   double totalArea = 0.;
   int nbElems = 0;
 
+  // compute new XYZ
+
   SMDS_ElemIteratorPtr elemIt = theNode->GetInverseElementIterator();
   while ( elemIt->more() )
   {
     const SMDS_MeshElement* elem = elemIt->next();
-    if ( theElems.find( elem ) == theElems.end() )
+    if ( elem->GetType() != SMDSAbs_Face )
       continue;
-
     nbElems++;
 
     gp_XYZ elemCenter(0.,0.,0.);
@@ -1343,6 +1401,11 @@ void centroidalSmooth(SMESHDS_Mesh *                       theMesh,
       const SMDS_MeshNode* aNode = static_cast<const SMDS_MeshNode*>( itN->next() );
       gp_XYZ aP( aNode->X(), aNode->Y(), aNode->Z() );
       aNodePoints.push_back( aP );
+      if ( !theSurface.IsNull() ) { // smooth in 2D
+        ASSERT( theUVMap.find( aNode ) != theUVMap.end() );
+        gp_XY* uv = theUVMap[ aNode ];
+        aP.SetCoord( uv->X(), uv->Y(), 0. );
+      }
       elemCenter += aP;
     }
     double elemArea = anAreaFunc.GetValue( aNodePoints );
@@ -1351,10 +1414,38 @@ void centroidalSmooth(SMESHDS_Mesh *                       theMesh,
     aNewXYZ += elemCenter * elemArea;
   }
   aNewXYZ /= totalArea;
-  theMesh->MoveNode (theNode,
-                     aNewXYZ.X(),
-                     aNewXYZ.Y(),
-                     aNewXYZ.Z());
+  if ( !theSurface.IsNull() ) {
+    ASSERT( theUVMap.find( theNode ) != theUVMap.end() );
+    theUVMap[ theNode ]->SetCoord( aNewXYZ.X(), aNewXYZ.Y() );
+    aNewXYZ = theSurface->Value( aNewXYZ.X(), aNewXYZ.Y() ).XYZ();
+  }
+
+  // move node
+
+  const_cast< SMDS_MeshNode* >( theNode )->setXYZ(aNewXYZ.X(),aNewXYZ.Y(),aNewXYZ.Z());
+}
+
+//=======================================================================
+//function : getClosestUV
+//purpose  : return UV of closest projection
+//=======================================================================
+
+static bool getClosestUV (Extrema_GenExtPS& projector,
+                          const gp_Pnt&     point,
+                          gp_XY &           result)
+{
+  projector.Perform( point );
+  if ( projector.IsDone() ) {
+    double u, v, minVal = DBL_MAX;
+    for ( int i = projector.NbExt(); i > 0; i-- )
+      if ( projector.Value( i ) < minVal ) {
+        minVal = projector.Value( i );
+        projector.Point( i ).Parameter( u, v );
+      }
+    result.SetCoord( u, v );
+    return true;
+  }
+  return false;
 }
 
 //=======================================================================
@@ -1371,124 +1462,465 @@ void SMESH_MeshEditor::Smooth (set<const SMDS_MeshElement*> & theElems,
                                set<const SMDS_MeshNode*> &    theFixedNodes,
                                const SmoothMethod             theSmoothMethod,
                                const int                      theNbIterations,
-                               double                         theTgtAspectRatio)
+                               double                         theTgtAspectRatio,
+                               const bool                     the2D)
 {
   MESSAGE((theSmoothMethod==LAPLACIAN ? "LAPLACIAN" : "CENTROIDAL") << "--::Smooth()");
 
+  if ( theTgtAspectRatio < 1.0 )
+    theTgtAspectRatio = 1.0;
+
+  SMESH::Controls::AspectRatio aQualityFunc;
+
   SMESHDS_Mesh* aMesh = GetMeshDS();
+  
   if ( theElems.empty() ) {
-    // add all faces
+    // add all faces to theElems
     SMDS_FaceIteratorPtr fIt = aMesh->facesIterator();
     while ( fIt->more() )
       theElems.insert( fIt->next() );
   }
+  // get all face ids theElems are on
+  set< int > faceIdSet;
+  set< const SMDS_MeshElement* >::iterator itElem;
+  if ( the2D )
+    for ( itElem = theElems.begin(); itElem != theElems.end(); itElem++ ) {
+      int fId = FindShape( *itElem );
+      // check that corresponding submesh exists and a shape is face
+      if (fId &&
+          faceIdSet.find( fId ) == faceIdSet.end() &&
+          aMesh->MeshElements( fId )) {
+        TopoDS_Shape F = aMesh->IndexToShape( fId );
+        if ( !F.IsNull() && F.ShapeType() == TopAbs_FACE )
+          faceIdSet.insert( fId );
+      }
+    }
+  faceIdSet.insert( 0 ); // to smooth elements that are not on any TopoDS_Face
 
-  set<const SMDS_MeshNode*> setMovableNodes;
-
-  // Fill setMovableNodes
+  // ===============================================
+  // smooth elements on each TopoDS_Face separately
+  // ===============================================
 
-  map< const SMDS_MeshNode*, int > mapNodeNbFaces;
-  set< const SMDS_MeshElement* >::iterator itElem;
-  for ( itElem = theElems.begin(); itElem != theElems.end(); itElem++ )
+  set< int >::reverse_iterator fId = faceIdSet.rbegin(); // treate 0 fId at the end
+  for ( ; fId != faceIdSet.rend(); ++fId )
   {
-    const SMDS_MeshElement* elem = (*itElem);
-    if ( !elem || elem->GetType() != SMDSAbs_Face )
-      continue;
-
-    SMDS_ElemIteratorPtr itN = elem->nodesIterator();
-    while ( itN->more() ) {
-      const SMDS_MeshNode* node =
-        static_cast<const SMDS_MeshNode*>( itN->next() );
+    // get face surface and submesh
+    Handle(Geom_Surface) surface;
+    SMESHDS_SubMesh* faceSubMesh = 0;
+    TopoDS_Face face;
+    double fToler2 = 0, vPeriod = 0., uPeriod = 0., f,l;
+    double u1 = 0, u2 = 0, v1 = 0, v2 = 0;
+    bool isUPeriodic = false, isVPeriodic = false;
+    if ( *fId ) {
+      face = TopoDS::Face( aMesh->IndexToShape( *fId ));
+      surface = BRep_Tool::Surface( face );
+      faceSubMesh = aMesh->MeshElements( *fId );
+      fToler2 = BRep_Tool::Tolerance( face );
+      fToler2 *= fToler2 * 10.;
+      isUPeriodic = surface->IsUPeriodic();
+      if ( isUPeriodic )
+        vPeriod = surface->UPeriod();
+      isVPeriodic = surface->IsVPeriodic();
+      if ( isVPeriodic )
+        uPeriod = surface->VPeriod();
+      surface->Bounds( u1, u2, v1, v2 );
+    }
+    // ---------------------------------------------------------
+    // for elements on a face, find movable and fixed nodes and
+    // compute UV for them
+    // ---------------------------------------------------------
+    bool checkBoundaryNodes = false;
+    set<const SMDS_MeshNode*> setMovableNodes;
+    map< const SMDS_MeshNode*, gp_XY* > uvMap, uvMap2;
+    list< gp_XY > listUV; // uvs the 2 uvMaps refer to
+    list< const SMDS_MeshElement* > elemsOnFace;
+
+    Extrema_GenExtPS projector;
+    GeomAdaptor_Surface surfAdaptor;
+    if ( !surface.IsNull() ) {
+      surfAdaptor.Load( surface );
+      projector.Initialize( surfAdaptor, 20,20, 1e-5,1e-5 );
+    }
+    int nbElemOnFace = 0;
+    itElem = theElems.begin();
+     // loop on not yet smoothed elements: look for elems on a face
+    while ( itElem != theElems.end() )
+    {
+      if ( faceSubMesh && nbElemOnFace == faceSubMesh->NbElements() )
+        break; // all elements found
 
-      if ( theFixedNodes.find( node ) != theFixedNodes.end() )
+      const SMDS_MeshElement* elem = (*itElem);
+      if ( !elem || elem->GetType() != SMDSAbs_Face || elem->NbNodes() < 3 ||
+          ( faceSubMesh && !faceSubMesh->Contains( elem ))) {
+        ++itElem;
         continue;
+      }
+      elemsOnFace.push_back( elem );
+      theElems.erase( itElem++ );
+      nbElemOnFace++;
 
-      // if node is on edge => it is fixed
-      SMDS_PositionPtr aPositionPtr = node->GetPosition();
-      if ( aPositionPtr.get() &&
-          (aPositionPtr->GetTypeOfPosition() == SMDS_TOP_EDGE ||
-           aPositionPtr->GetTypeOfPosition() == SMDS_TOP_VERTEX)) {
-        theFixedNodes.insert( node );
+      // get movable nodes of elem
+      const SMDS_MeshNode* node;
+      SMDS_TypeOfPosition posType;
+      SMDS_ElemIteratorPtr itN = elem->nodesIterator();
+      while ( itN->more() ) {
+        node = static_cast<const SMDS_MeshNode*>( itN->next() );
+        const SMDS_PositionPtr& pos = node->GetPosition();
+        posType = pos.get() ? pos->GetTypeOfPosition() : SMDS_TOP_3DSPACE;
+        if (posType != SMDS_TOP_EDGE &&
+            posType != SMDS_TOP_VERTEX && 
+            theFixedNodes.find( node ) == theFixedNodes.end())
+        {
+          // check if all faces around the node are on faceSubMesh
+          // because a node on edge may be bound to face
+          SMDS_ElemIteratorPtr eIt = node->GetInverseElementIterator();
+          bool all = true;
+          if ( faceSubMesh ) {
+            while ( eIt->more() && all ) {
+              const SMDS_MeshElement* e = eIt->next();
+              if ( e->GetType() == SMDSAbs_Face )
+                all = faceSubMesh->Contains( e );
+            }
+          }
+          if ( all )
+            setMovableNodes.insert( node );
+          else
+            checkBoundaryNodes = true;
+        }
+        if ( posType == SMDS_TOP_3DSPACE )
+          checkBoundaryNodes = true;
+      }
+
+      if ( surface.IsNull() )
         continue;
+
+      // get nodes to check UV
+      list< const SMDS_MeshNode* > uvCheckNodes;
+      itN = elem->nodesIterator();
+      while ( itN->more() ) {
+        node = static_cast<const SMDS_MeshNode*>( itN->next() );
+        if ( uvMap.find( node ) == uvMap.end() )
+          uvCheckNodes.push_back( node );
+        // add nodes of elems sharing node
+//         SMDS_ElemIteratorPtr eIt = node->GetInverseElementIterator();
+//         while ( eIt->more() ) {
+//           const SMDS_MeshElement* e = eIt->next();
+//           if ( e != elem && e->GetType() == SMDSAbs_Face ) {
+//             SMDS_ElemIteratorPtr nIt = e->nodesIterator();
+//             while ( nIt->more() ) {
+//               const SMDS_MeshNode* n =
+//                 static_cast<const SMDS_MeshNode*>( nIt->next() );
+//               if ( uvMap.find( n ) == uvMap.end() )
+//                 uvCheckNodes.push_back( n );
+//             }
+//           }
+//         }
+      }
+      // check UV on face
+      list< const SMDS_MeshNode* >::iterator n = uvCheckNodes.begin();
+      for ( ; n != uvCheckNodes.end(); ++n )
+      {
+        node = *n;
+        gp_XY uv( 0, 0 );
+        const SMDS_PositionPtr& pos = node->GetPosition();
+        posType = pos.get() ? pos->GetTypeOfPosition() : SMDS_TOP_3DSPACE;
+        // get existing UV
+        switch ( posType ) {
+        case SMDS_TOP_FACE: {
+          SMDS_FacePosition* fPos = ( SMDS_FacePosition* ) pos.get();
+          uv.SetCoord( fPos->GetUParameter(), fPos->GetVParameter() );
+          break;
+        }
+        case SMDS_TOP_EDGE: {
+          TopoDS_Shape S = aMesh->IndexToShape( pos->GetShapeId() );
+          Handle(Geom2d_Curve) pcurve;
+          if ( !S.IsNull() && S.ShapeType() == TopAbs_EDGE )
+            pcurve = BRep_Tool::CurveOnSurface( TopoDS::Edge( S ), face, f,l );
+          if ( !pcurve.IsNull() ) {
+            double u = (( SMDS_EdgePosition* ) pos.get() )->GetUParameter();
+            uv = pcurve->Value( u ).XY();
+          }
+          break;
+        }
+        case SMDS_TOP_VERTEX: {
+          TopoDS_Shape S = aMesh->IndexToShape( pos->GetShapeId() );
+          if ( !S.IsNull() && S.ShapeType() == TopAbs_VERTEX )
+            uv = BRep_Tool::Parameters( TopoDS::Vertex( S ), face ).XY();
+          break;
+        }
+        default:;
+        }
+        // check existing UV
+        bool project = true;
+        gp_Pnt pNode ( node->X(), node->Y(), node->Z() );
+        double dist1 = DBL_MAX, dist2 = 0;
+        if ( posType != SMDS_TOP_3DSPACE ) {
+          dist1 = pNode.SquareDistance( surface->Value( uv.X(), uv.Y() ));
+          project = dist1 > fToler2;
+        }
+        if ( project ) { // compute new UV
+          gp_XY newUV;
+          if ( !getClosestUV( projector, pNode, newUV )) {
+            MESSAGE("Node Projection Failed " << node);
+          }
+          else {
+            if ( isUPeriodic )
+              newUV.SetX( ElCLib::InPeriod( newUV.X(), u1, u2 ));
+            if ( isVPeriodic )
+              newUV.SetY( ElCLib::InPeriod( newUV.Y(), v1, v2 ));
+            // check new UV
+            if ( posType != SMDS_TOP_3DSPACE )
+              dist2 = pNode.SquareDistance( surface->Value( newUV.X(), newUV.Y() ));
+            if ( dist2 < dist1 )
+              uv = newUV;
+          }
+        }
+        // store UV in the map
+        listUV.push_back( uv );
+        uvMap.insert( make_pair( node, &listUV.back() ));
+      }
+    } // loop on not yet smoothed elements
+
+    if ( !faceSubMesh || nbElemOnFace != faceSubMesh->NbElements() )
+      checkBoundaryNodes = true;
+
+    // fix nodes on mesh boundary
+
+    if ( checkBoundaryNodes )
+    {
+      typedef pair<const SMDS_MeshNode*, const SMDS_MeshNode*> TLink;
+      map< TLink, int > linkNbMap; // how many times a link encounters in elemsOnFace
+      map< TLink, int >::iterator link_nb;
+      // put all elements links to linkNbMap
+      list< const SMDS_MeshElement* >::iterator elemIt = elemsOnFace.begin();
+      for ( ; elemIt != elemsOnFace.end(); ++elemIt )
+      {
+        // put elem nodes in array
+        vector< const SMDS_MeshNode* > nodes;
+        nodes.reserve( (*elemIt)->NbNodes() + 1 );
+        SMDS_ElemIteratorPtr itN = (*elemIt)->nodesIterator();
+        while ( itN->more() )
+          nodes.push_back( static_cast<const SMDS_MeshNode*>( itN->next() ));
+        nodes.push_back( nodes.front() );
+        // loop on elem links: insert them in linkNbMap
+        for ( int iN = 1; iN < nodes.size(); ++iN ) {
+          TLink link;
+          if ( nodes[ iN-1 ]->GetID() < nodes[ iN ]->GetID() )
+            link = make_pair( nodes[ iN-1 ], nodes[ iN ] );
+          else
+            link = make_pair( nodes[ iN ], nodes[ iN-1 ] );
+          link_nb = linkNbMap.find( link );
+          if ( link_nb == linkNbMap.end() )
+            linkNbMap.insert( make_pair ( link, 1 ));
+          else
+            link_nb->second++;
+        }
+      }
+      // remove nodes that are in links encountered only once from setMovableNodes
+      for ( link_nb = linkNbMap.begin(); link_nb != linkNbMap.end(); ++link_nb ) {
+        if ( link_nb->second == 1 ) {
+          setMovableNodes.erase( link_nb->first.first );
+          setMovableNodes.erase( link_nb->first.second );
+        }
       }
-      // fill mapNodeNbFaces in order to detect fixed boundary nodes
-      map<const SMDS_MeshNode*,int>::iterator nodeNbFacesIt =
-        mapNodeNbFaces.find ( node );
-      if ( nodeNbFacesIt == mapNodeNbFaces.end() )
-        mapNodeNbFaces.insert( map<const SMDS_MeshNode*,int>::value_type( node, 1 ));
-      else
-        (*nodeNbFacesIt).second++;
     }
-  }
-  // put not fixed nodes in setMovableNodes
-  map<const SMDS_MeshNode*,int>::iterator nodeNbFacesIt =
-    mapNodeNbFaces.begin();
-  for ( ; nodeNbFacesIt != mapNodeNbFaces.end(); nodeNbFacesIt++ ) {
-    const SMDS_MeshNode* node = (*nodeNbFacesIt).first;
-    // a node is on free boundary if it is shared by 1-2 faces
-    if ( (*nodeNbFacesIt).second > 2 )
-      setMovableNodes.insert( node );
-    else
-      theFixedNodes.insert( node );
-  }
 
-  // SMOOTHING //
+    // -----------------------------------------------------
+    // for nodes on seam edge, compute one more UV ( uvMap2 );
+    // find movable nodes linked to nodes on seam and which
+    // are to be smoothed using the second UV ( uvMap2 )
+    // -----------------------------------------------------
 
-  if ( theTgtAspectRatio < 1.0 )
-    theTgtAspectRatio = 1.0;
+    set<const SMDS_MeshNode*> nodesNearSeam; // to smooth using uvMap2
+    if ( !surface.IsNull() )
+    {
+      TopExp_Explorer eExp( face, TopAbs_EDGE );
+      for ( ; eExp.More(); eExp.Next() )
+      {
+        TopoDS_Edge edge = TopoDS::Edge( eExp.Current() );
+        if ( !BRep_Tool::IsClosed( edge, face ))
+          continue;
+        SMESHDS_SubMesh* sm = aMesh->MeshElements( edge );
+        if ( !sm ) continue;
+        // find out which parameter varies for a node on seam
+        double f,l;
+        gp_Pnt2d uv1, uv2;
+        Handle(Geom2d_Curve) pcurve = BRep_Tool::CurveOnSurface( edge, face, f, l );
+        if ( pcurve.IsNull() ) continue;
+        uv1 = pcurve->Value( f );
+        edge.Reverse();
+        pcurve = BRep_Tool::CurveOnSurface( edge, face, f, l );
+        if ( pcurve.IsNull() ) continue;
+        uv2 = pcurve->Value( f );
+        int iPar = Abs( uv1.X() - uv2.X() ) > Abs( uv1.Y() - uv2.Y() ) ? 1 : 2;
+        // assure uv1 < uv2
+        if ( uv1.Coord( iPar ) > uv2.Coord( iPar )) {
+          gp_Pnt2d tmp = uv1; uv1 = uv2; uv2 = tmp;
+        }
+        // get nodes on seam and its vertices
+        list< const SMDS_MeshNode* > seamNodes;
+        SMDS_NodeIteratorPtr nSeamIt = sm->GetNodes();
+        while ( nSeamIt->more() )
+          seamNodes.push_back( nSeamIt->next() );
+        TopExp_Explorer vExp( edge, TopAbs_VERTEX );
+        for ( ; vExp.More(); vExp.Next() ) {
+          sm = aMesh->MeshElements( vExp.Current() );
+          if ( sm ) {
+            nSeamIt = sm->GetNodes();
+            while ( nSeamIt->more() )
+              seamNodes.push_back( nSeamIt->next() );
+          }
+        }
+        // loop on nodes on seam
+        list< const SMDS_MeshNode* >::iterator noSeIt = seamNodes.begin();
+        for ( ; noSeIt != seamNodes.end(); ++noSeIt )
+        {
+          const SMDS_MeshNode* nSeam = *noSeIt;
+          map< const SMDS_MeshNode*, gp_XY* >::iterator n_uv = uvMap.find( nSeam );
+          if ( n_uv == uvMap.end() )
+            continue;
+          // set the first UV
+          n_uv->second->SetCoord( iPar, uv1.Coord( iPar ));
+          // set the second UV
+          listUV.push_back( *n_uv->second );
+          listUV.back().SetCoord( iPar, uv2.Coord( iPar ));
+          if ( uvMap2.empty() )
+            uvMap2 = uvMap; // copy the uvMap contents
+          uvMap2[ nSeam ] = &listUV.back();
+
+          // collect movable nodes linked to ones on seam in nodesNearSeam
+          SMDS_ElemIteratorPtr eIt = nSeam->GetInverseElementIterator();
+          while ( eIt->more() )
+          {
+            const SMDS_MeshElement* e = eIt->next();
+            if ( e->GetType() != SMDSAbs_Face )
+              continue;
+            int nbUseMap1 = 0, nbUseMap2 = 0;
+            SMDS_ElemIteratorPtr nIt = e->nodesIterator();
+            while ( nIt->more() )
+            {
+              const SMDS_MeshNode* n =
+                static_cast<const SMDS_MeshNode*>( nIt->next() );
+              if (n == nSeam ||
+                  setMovableNodes.find( n ) == setMovableNodes.end() )
+                continue;
+              // add only nodes being closer to uv2 than to uv1
+              gp_Pnt pMid (0.5 * ( n->X() + nSeam->X() ),
+                           0.5 * ( n->Y() + nSeam->Y() ),
+                           0.5 * ( n->Z() + nSeam->Z() ));
+              gp_XY uv;
+              getClosestUV( projector, pMid, uv );
+              if ( uv.Coord( iPar ) > uvMap[ n ]->Coord( iPar ) ) {
+                nodesNearSeam.insert( n );
+                nbUseMap2++;
+              }
+              else
+                nbUseMap1++;
+            }
+            // for centroidalSmooth all element nodes must
+            // be on one side of a seam
+            if ( theSmoothMethod == CENTROIDAL && nbUseMap1 && nbUseMap2 )
+            {
+              SMDS_ElemIteratorPtr nIt = e->nodesIterator();
+              while ( nIt->more() ) {
+                const SMDS_MeshNode* n =
+                  static_cast<const SMDS_MeshNode*>( nIt->next() );
+                setMovableNodes.erase( n );
+              }
+            }
+          }
+        } // loop on nodes on seam 
+      } // loop on edge of a face
+    } // if ( !face.IsNull() )
 
-  SMESH::Controls::AspectRatio aQualityFunc;
+    if ( setMovableNodes.empty() ) {
+      MESSAGE( "Face id : " << *fId << " - NO SMOOTHING: no nodes to move!!!");
+      continue; // goto next face
+    }
 
-  for ( int it = 0; it < theNbIterations; it++ )
-  {
-    Standard_Real maxDisplacement = 0.;
-    set<const SMDS_MeshNode*>::iterator movableNodesIt
-      = setMovableNodes.begin();
-    for ( ; movableNodesIt != setMovableNodes.end(); movableNodesIt++ )
+    // -------------
+    // SMOOTHING //
+    // -------------
+
+    int it = -1;
+    double maxRatio = -1., maxDisplacement = -1.;
+    set<const SMDS_MeshNode*>::iterator nodeToMove;
+    for ( it = 0; it < theNbIterations; it++ )
     {
-      const SMDS_MeshNode* node = (*movableNodesIt);
-      gp_XYZ aPrevPos ( node->X(), node->Y(), node->Z() );
+      maxDisplacement = 0.;
+      nodeToMove = setMovableNodes.begin();
+      for ( ; nodeToMove != setMovableNodes.end(); nodeToMove++ )
+      {
+        const SMDS_MeshNode* node = (*nodeToMove);
+        gp_XYZ aPrevPos ( node->X(), node->Y(), node->Z() );
 
-      // smooth
-      if ( theSmoothMethod == LAPLACIAN )
-        laplacianSmooth( aMesh, node, theElems, theFixedNodes );
-      else
-        centroidalSmooth( aMesh, node, theElems, theFixedNodes );
+        // smooth
+        bool map2 = ( nodesNearSeam.find( node ) != nodesNearSeam.end() );
+        if ( theSmoothMethod == LAPLACIAN )
+          laplacianSmooth( node, surface, map2 ? uvMap2 : uvMap );
+        else
+          centroidalSmooth( node, surface, map2 ? uvMap2 : uvMap );
 
-      // displacement
-      gp_XYZ aNewPos ( node->X(), node->Y(), node->Z() );
-      Standard_Real aDispl = (aPrevPos - aNewPos).SquareModulus();
-      if ( aDispl > maxDisplacement )
-        maxDisplacement = aDispl;
-    }
-    // no node movement => exit
-    if ( maxDisplacement < 1.e-16 ) {
-      MESSAGE("-- no node movement -- maxDisplacement: " << maxDisplacement << " it "<< it);
-      break;
-    }
+        // node displacement
+        gp_XYZ aNewPos ( node->X(), node->Y(), node->Z() );
+        Standard_Real aDispl = (aPrevPos - aNewPos).SquareModulus();
+        if ( aDispl > maxDisplacement )
+          maxDisplacement = aDispl;
+      }
+      // no node movement => exit
+      if ( maxDisplacement < 1.e-16 ) {
+        MESSAGE("-- no node movement --");
+        break;
+      }
+
+      // check elements quality
+      maxRatio  = 0;
+      list< const SMDS_MeshElement* >::iterator elemIt = elemsOnFace.begin();
+      for ( ; elemIt != elemsOnFace.end(); ++elemIt )
+      {
+        const SMDS_MeshElement* elem = (*elemIt);
+        if ( !elem || elem->GetType() != SMDSAbs_Face )
+          continue;
+        SMESH::Controls::TSequenceOfXYZ aPoints;
+        if ( aQualityFunc.GetPoints( elem, aPoints )) {
+          double aValue = aQualityFunc.GetValue( aPoints );
+          if ( aValue > maxRatio )
+            maxRatio = aValue;
+        }
+      }
+      if ( maxRatio <= theTgtAspectRatio ) {
+        MESSAGE("-- quality achived --");
+        break;
+      }
+      if (it+1 == theNbIterations) {
+        MESSAGE("-- Iteration limit exceeded --");
+      }
+    } // smoothing iterations
+
+    MESSAGE(" Face id: " << *fId <<
+            " Nb iterstions: " << it <<
+            " Displacement: " << maxDisplacement <<
+            " Aspect Ratio " << maxRatio);
 
-    // check elements quality
-    double maxRatio  = 0;
-    for ( itElem = theElems.begin(); itElem != theElems.end(); itElem++ )
+    // ---------------------------------------
+    // new nodes positions are computed,
+    // record movement in DS and set new UV
+    // ---------------------------------------
+
+    nodeToMove = setMovableNodes.begin();
+    for ( ; nodeToMove != setMovableNodes.end(); nodeToMove++ )
     {
-      const SMDS_MeshElement* elem = (*itElem);
-      if ( !elem || elem->GetType() != SMDSAbs_Face )
-        continue;
-      SMESH::Controls::TSequenceOfXYZ aPoints;
-      if ( aQualityFunc.GetPoints( elem, aPoints )) {
-        double aValue = aQualityFunc.GetValue( aPoints );
-        if ( aValue > maxRatio )
-          maxRatio = aValue;
+      SMDS_MeshNode* node = const_cast< SMDS_MeshNode* > (*nodeToMove);
+      aMesh->MoveNode( node, node->X(), node->Y(), node->Z() );
+      map< const SMDS_MeshNode*, gp_XY* >::iterator node_uv = uvMap.find( node );
+      if ( node_uv != uvMap.end() ) {
+        gp_XY* uv = node_uv->second;
+        node->SetPosition
+          ( SMDS_PositionPtr( new SMDS_FacePosition( *fId, uv->X(), uv->Y() )));
       }
     }
-    if ( maxRatio <= theTgtAspectRatio ) {
-      MESSAGE("-- quality achived -- maxRatio " << maxRatio << " it "<< it);
-      break;
-    }
-    if (it+1 == theNbIterations) {
-      MESSAGE("-- Iteration limit exceeded --");
-    }
-  }
+
+  } // loop on face ids
 }
 
 //=======================================================================
@@ -1593,6 +2025,8 @@ static void sweepElement(SMESHDS_Mesh*                         aMesh,
     SMDS_MeshElement* aNewElem = 0;
     switch ( nbNodes )
     {
+    case 0:
+      return;
     case 1: { // NODE
       if ( nbSame == 0 )
         aNewElem = aMesh->AddEdge( prevNod[ 0 ], nextNod[ 0 ] );
@@ -1615,8 +2049,8 @@ static void sweepElement(SMESHDS_Mesh*                         aMesh,
                                      nextNod[ i0 ], nextNod[ 1 ], nextNod[ i2 ] );
 
       else if ( nbSame == 1 )  // --- pyramid
-        aNewElem = aMesh->AddVolume (prevNod[ iBeforeSame ], prevNod[ iAfterSame ],
-                                     nextNod[ iAfterSame ],  nextNod[ iBeforeSame ],
+        aNewElem = aMesh->AddVolume (prevNod[ iBeforeSame ],  prevNod[ iAfterSame ],
+                                     nextNod[ iAfterSame ], nextNod[ iBeforeSame ],
                                      nextNod[ iSameNode ]);
 
       else // 2 same nodes:      --- tetrahedron
@@ -1632,12 +2066,12 @@ static void sweepElement(SMESHDS_Mesh*                         aMesh,
 
       else if ( nbSame == 1 )  // --- pyramid + pentahedron
       {
-        aNewElem = aMesh->AddVolume (prevNod[ iBeforeSame ], prevNod[ iAfterSame ],
-                                     nextNod[ iAfterSame ],  nextNod[ iBeforeSame ],
+        aNewElem = aMesh->AddVolume (prevNod[ iBeforeSame ],  prevNod[ iAfterSame ],
+                                     nextNod[ iAfterSame ], nextNod[ iBeforeSame ],
                                      nextNod[ iSameNode ]);
         newElems.push_back( aNewElem );
-        aNewElem = aMesh->AddVolume (prevNod[ iAfterSame ],  prevNod[ iOpposSame ],
-                                     prevNod[ iBeforeSame ], nextNod[ iAfterSame ],
+        aNewElem = aMesh->AddVolume (prevNod[ iAfterSame ], prevNod[ iOpposSame ],
+                                     prevNod[ iBeforeSame ],  nextNod[ iAfterSame ],
                                      nextNod[ iOpposSame ],  nextNod[ iBeforeSame ] );
       }
       else if ( nbSame == 2 )  // pentahedron
@@ -1645,18 +2079,41 @@ static void sweepElement(SMESHDS_Mesh*                         aMesh,
         if ( prevNod[ iBeforeSame ] == nextNod[ iBeforeSame ] )
           // iBeforeSame is same too
           aNewElem = aMesh->AddVolume (prevNod[ iBeforeSame ], prevNod[ iOpposSame ],
-                                       nextNod[ iOpposSame ],  prevNod[ iSameNode ],
+                                       nextNod[ iOpposSame ], prevNod[ iSameNode ],
                                        prevNod[ iAfterSame ],  nextNod[ iAfterSame ]);
         else
           // iAfterSame is same too
-          aNewElem = aMesh->AddVolume (prevNod[ iSameNode ],   prevNod[ iBeforeSame ],
+          aNewElem = aMesh->AddVolume (prevNod[ iSameNode ], prevNod[ iBeforeSame ],
                                        nextNod[ iBeforeSame ], prevNod[ iAfterSame ],
                                        prevNod[ iOpposSame ],  nextNod[ iOpposSame ]);
       }
       break;
     }
-    default:
-      return;
+    default: {
+      // realized for extrusion only
+      vector<const SMDS_MeshNode*> polyedre_nodes (nbNodes*2 + 4*nbNodes);
+      vector<int> quantities (nbNodes + 2);
+
+      quantities[0] = nbNodes; // bottom of prism
+      for (int inode = 0; inode < nbNodes; inode++) {
+        polyedre_nodes[inode] = prevNod[inode];
+      }
+
+      quantities[1] = nbNodes; // top of prism
+      for (int inode = 0; inode < nbNodes; inode++) {
+        polyedre_nodes[nbNodes + inode] = nextNod[inode];
+      }
+
+      for (int iface = 0; iface < nbNodes; iface++) {
+        quantities[iface + 2] = 4;
+        int inextface = (iface == nbNodes - 1) ? 0 : iface + 1;
+        polyedre_nodes[2*nbNodes + 4*iface + 0] = prevNod[iface];
+        polyedre_nodes[2*nbNodes + 4*iface + 1] = prevNod[inextface];
+        polyedre_nodes[2*nbNodes + 4*iface + 2] = nextNod[inextface];
+        polyedre_nodes[2*nbNodes + 4*iface + 3] = nextNod[iface];
+      }
+      aNewElem = aMesh->AddPolyhedralVolume (polyedre_nodes, quantities);
+    }
     }
     if ( aNewElem )
       newElems.push_back( aNewElem );
@@ -1790,6 +2247,16 @@ static void makeWalls (SMESHDS_Mesh*                 aMesh,
               aMesh->AddFace( nodes[ 0 ], nodes[ 1 ], nodes[ 2 ] ); break;
             case 4:
               aMesh->AddFace( nodes[ 0 ], nodes[ 1 ], nodes[ 2 ], nodes[ 3 ] ); break;
+            default:
+              {
+                int nbPolygonNodes = vTool.NbFaceNodes( *ind );
+                vector<const SMDS_MeshNode*> polygon_nodes (nbPolygonNodes);
+                for (int inode = 0; inode < nbPolygonNodes; inode++) {
+                  polygon_nodes[inode] = nodes[inode];
+                }
+                aMesh->AddPolygonalFace(polygon_nodes);
+                break;
+              }
             }
           }
           // go to the next volume
@@ -1818,6 +2285,17 @@ static void makeWalls (SMESHDS_Mesh*                 aMesh,
             !aMesh->FindFace( nodes[ 0 ], nodes[ 1 ], nodes[ 2 ], nodes[ 3 ]))
           aMesh->AddFace( nodes[ 0 ], nodes[ 1 ], nodes[ 2 ], nodes[ 3 ] );
         break;
+      default:
+        {
+          int nbPolygonNodes = lastVol.NbFaceNodes( iF );
+          vector<const SMDS_MeshNode*> polygon_nodes (nbPolygonNodes);
+          for (int inode = 0; inode < nbPolygonNodes; inode++) {
+            polygon_nodes[inode] = nodes[inode];
+          }
+          if (!hasFreeLinks || !aMesh->FindFace(polygon_nodes))
+            aMesh->AddPolygonalFace(polygon_nodes);
+        }
+        break;
       }
     }
 
@@ -2320,7 +2798,7 @@ void SMESH_MeshEditor::Transform (set<const SMDS_MeshElement*> & theElems,
     SMDS_ElemIteratorPtr itN = elem->nodesIterator();
     while ( itN->more() ) {
 
-      // check if a node has been already transormed
+      // check if a node has been already transformed
       const SMDS_MeshNode* node =
         static_cast<const SMDS_MeshNode*>( itN->next() );
       if (nodeMap.find( node ) != nodeMap.end() )
@@ -2334,8 +2812,12 @@ void SMESH_MeshEditor::Transform (set<const SMDS_MeshElement*> & theElems,
       const SMDS_MeshNode * newNode = node;
       if ( theCopy )
         newNode = aMesh->AddNode( coord[0], coord[1], coord[2] );
-      else
+      else {
         aMesh->MoveNode( node, coord[0], coord[1], coord[2] );
+        // node position on shape becomes invalid
+        const_cast< SMDS_MeshNode* > ( node )->SetPosition
+          ( SMDS_SpacePosition::originSpacePosition() );
+      }
       nodeMap.insert( TNodeNodeMap::value_type( node, newNode ));
 
       // keep inverse elements
@@ -2386,6 +2868,82 @@ void SMESH_MeshEditor::Transform (set<const SMDS_MeshElement*> & theElems,
     int nbNodes = elem->NbNodes();
     int elemType = elem->GetType();
 
+    if (elem->IsPoly()) {
+      // Polygon or Polyhedral Volume
+      switch ( elemType ) {
+      case SMDSAbs_Face:
+        {
+          vector<const SMDS_MeshNode*> poly_nodes (nbNodes);
+          int iNode = 0;
+          SMDS_ElemIteratorPtr itN = elem->nodesIterator();
+          while (itN->more()) {
+            const SMDS_MeshNode* node =
+              static_cast<const SMDS_MeshNode*>(itN->next());
+            TNodeNodeMap::iterator nodeMapIt = nodeMap.find(node);
+            if (nodeMapIt == nodeMap.end())
+              break; // not all nodes transformed
+            if (needReverse) {
+              // reverse mirrored faces and volumes
+              poly_nodes[nbNodes - iNode - 1] = (*nodeMapIt).second;
+            } else {
+              poly_nodes[iNode] = (*nodeMapIt).second;
+            }
+            iNode++;
+          }
+          if ( iNode != nbNodes )
+            continue; // not all nodes transformed
+
+          if ( theCopy ) {
+            aMesh->AddPolygonalFace(poly_nodes);
+          } else {
+            aMesh->ChangePolygonNodes(elem, poly_nodes);
+          }
+        }
+        break;
+      case SMDSAbs_Volume:
+        {
+          // ATTENTION: Reversing is not yet done!!!
+          const SMDS_PolyhedralVolumeOfNodes* aPolyedre =
+            (const SMDS_PolyhedralVolumeOfNodes*) elem;
+          if (!aPolyedre) {
+            MESSAGE("Warning: bad volumic element");
+            continue;
+          }
+
+          vector<const SMDS_MeshNode*> poly_nodes;
+          vector<int> quantities;
+
+          bool allTransformed = true;
+          int nbFaces = aPolyedre->NbFaces();
+          for (int iface = 1; iface <= nbFaces && allTransformed; iface++) {
+            int nbFaceNodes = aPolyedre->NbFaceNodes(iface);
+            for (int inode = 1; inode <= nbFaceNodes && allTransformed; inode++) {
+              const SMDS_MeshNode* node = aPolyedre->GetFaceNode(iface, inode);
+              TNodeNodeMap::iterator nodeMapIt = nodeMap.find(node);
+              if (nodeMapIt == nodeMap.end()) {
+                allTransformed = false; // not all nodes transformed
+              } else {
+                poly_nodes.push_back((*nodeMapIt).second);
+              }
+            }
+            quantities.push_back(nbFaceNodes);
+          }
+          if ( !allTransformed )
+            continue; // not all nodes transformed
+
+          if ( theCopy ) {
+            aMesh->AddPolyhedralVolume(poly_nodes, quantities);
+          } else {
+            aMesh->ChangePolyhedronNodes(elem, poly_nodes, quantities);
+          }
+        }
+        break;
+      default:;
+      }
+      continue;
+    }
+
+    // Regular elements
     int* i = index[ FORWARD ];
     if ( needReverse && nbNodes > 2) // reverse mirrored faces and volumes
       if ( elemType == SMDSAbs_Face )
@@ -2498,6 +3056,88 @@ void SMESH_MeshEditor::FindCoincidentNodes (set<const SMDS_MeshNode*> & theNodes
   }
 }
 
+//=======================================================================
+//function : SimplifyFace
+//purpose  : 
+//=======================================================================
+int SMESH_MeshEditor::SimplifyFace (const vector<const SMDS_MeshNode *> faceNodes,
+                                    vector<const SMDS_MeshNode *>&      poly_nodes,
+                                    vector<int>&                        quantities) const
+{
+  int nbNodes = faceNodes.size();
+
+  if (nbNodes < 3)
+    return 0;
+
+  set<const SMDS_MeshNode*> nodeSet;
+
+  // get simple seq of nodes
+  const SMDS_MeshNode* simpleNodes[ nbNodes ];
+  int iSimple = 0, nbUnique = 0;
+
+  simpleNodes[iSimple++] = faceNodes[0];
+  nbUnique++;
+  for (int iCur = 1; iCur < nbNodes; iCur++) {
+    if (faceNodes[iCur] != simpleNodes[iSimple - 1]) {
+      simpleNodes[iSimple++] = faceNodes[iCur];
+      if (nodeSet.insert( faceNodes[iCur] ).second)
+        nbUnique++;
+    }
+  }
+  int nbSimple = iSimple;
+  if (simpleNodes[nbSimple - 1] == simpleNodes[0]) {
+    nbSimple--;
+    iSimple--;
+  }
+
+  if (nbUnique < 3)
+    return 0;
+
+  // separate loops
+  int nbNew = 0;
+  bool foundLoop = (nbSimple > nbUnique);
+  while (foundLoop) {
+    foundLoop = false;
+    set<const SMDS_MeshNode*> loopSet;
+    for (iSimple = 0; iSimple < nbSimple && !foundLoop; iSimple++) {
+      const SMDS_MeshNode* n = simpleNodes[iSimple];
+      if (!loopSet.insert( n ).second) {
+        foundLoop = true;
+
+        // separate loop
+        int iC = 0, curLast = iSimple;
+        for (; iC < curLast; iC++) {
+          if (simpleNodes[iC] == n) break;
+        }
+        int loopLen = curLast - iC;
+        if (loopLen > 2) {
+          // create sub-element
+          nbNew++;
+          quantities.push_back(loopLen);
+          for (; iC < curLast; iC++) {
+            poly_nodes.push_back(simpleNodes[iC]);
+          }
+        }
+        // shift the rest nodes (place from the first loop position)
+        for (iC = curLast + 1; iC < nbSimple; iC++) {
+          simpleNodes[iC - loopLen] = simpleNodes[iC];
+        }
+        nbSimple -= loopLen;
+        iSimple -= loopLen;
+      }
+    } // for (iSimple = 0; iSimple < nbSimple; iSimple++)
+  } // while (foundLoop)
+
+  if (iSimple > 2) {
+    nbNew++;
+    quantities.push_back(iSimple);
+    for (int i = 0; i < iSimple; i++)
+      poly_nodes.push_back(simpleNodes[i]);
+  }
+
+  return nbNew;
+}
+
 //=======================================================================
 //function : MergeNodes
 //purpose  : In each group, the cdr of nodes are substituted by the first one
@@ -2572,6 +3212,88 @@ void SMESH_MeshEditor::MergeNodes (TListOfListOfNodes & theGroupsOfNodes)
     int nbUniqueNodes = nodeSet.size();
     if ( nbNodes != nbUniqueNodes ) // some nodes stick
     {
+      // Polygons and Polyhedral volumes
+      if (elem->IsPoly()) {
+
+        if (elem->GetType() == SMDSAbs_Face) {
+          // Polygon
+          vector<const SMDS_MeshNode *> face_nodes (nbNodes);
+          int inode = 0;
+          for (; inode < nbNodes; inode++) {
+            face_nodes[inode] = curNodes[inode];
+          }
+
+          vector<const SMDS_MeshNode *> polygons_nodes;
+          vector<int> quantities;
+          int nbNew = SimplifyFace(face_nodes, polygons_nodes, quantities);
+
+          if (nbNew > 0) {
+            inode = 0;
+            for (int iface = 0; iface < nbNew - 1; iface++) {
+              int nbNodes = quantities[iface];
+              vector<const SMDS_MeshNode *> poly_nodes (nbNodes);
+              for (int ii = 0; ii < nbNodes; ii++, inode++) {
+                poly_nodes[ii] = polygons_nodes[inode];
+              }
+              SMDS_MeshElement* newElem = aMesh->AddPolygonalFace(poly_nodes);
+              if (aShapeId)
+                aMesh->SetMeshElementOnShape(newElem, aShapeId);
+            }
+            aMesh->ChangeElementNodes(elem, &polygons_nodes[inode], quantities[nbNew - 1]);
+          } else {
+            rmElemIds.push_back(elem->GetID());
+          }
+
+        } else if (elem->GetType() == SMDSAbs_Volume) {
+          // Polyhedral volume
+          if (nbUniqueNodes < 4) {
+            rmElemIds.push_back(elem->GetID());
+          } else {
+            // each face has to be analized in order to check volume validity
+            const SMDS_PolyhedralVolumeOfNodes* aPolyedre =
+              static_cast<const SMDS_PolyhedralVolumeOfNodes*>( elem );
+            if (aPolyedre) {
+              int nbFaces = aPolyedre->NbFaces();
+
+              vector<const SMDS_MeshNode *> poly_nodes;
+              vector<int> quantities;
+
+              for (int iface = 1; iface <= nbFaces; iface++) {
+                int nbFaceNodes = aPolyedre->NbFaceNodes(iface);
+                vector<const SMDS_MeshNode *> faceNodes (nbFaceNodes);
+
+                for (int inode = 1; inode <= nbFaceNodes; inode++) {
+                  const SMDS_MeshNode * faceNode = aPolyedre->GetFaceNode(iface, inode);
+                  TNodeNodeMap::iterator nnIt = nodeNodeMap.find(faceNode);
+                  if (nnIt != nodeNodeMap.end()) { // faceNode sticks
+                    faceNode = (*nnIt).second;
+                  }
+                  faceNodes[inode - 1] = faceNode;
+                }
+
+                SimplifyFace(faceNodes, poly_nodes, quantities);
+              }
+
+              if (quantities.size() > 3) {
+                // to be done: remove coincident faces
+              }
+
+              if (quantities.size() > 3)
+                aMesh->ChangePolyhedronNodes(elem, poly_nodes, quantities);
+              else
+                rmElemIds.push_back(elem->GetID());
+
+            } else {
+              rmElemIds.push_back(elem->GetID());
+            }
+          }
+        } else {
+        }
+
+        continue;
+      }
+
+      // Regular elements
       switch ( nbNodes ) {
       case 2: ///////////////////////////////////// EDGE
         isOk = false; break;
@@ -2813,10 +3535,41 @@ void SMESH_MeshEditor::MergeNodes (TListOfListOfNodes & theGroupsOfNodes)
 
     } // if ( nbNodes != nbUniqueNodes ) // some nodes stick
     
-    if ( isOk )
-      aMesh->ChangeElementNodes( elem, uniqueNodes, nbUniqueNodes );
-    else
+    if ( isOk ) {
+      if (elem->IsPoly() && elem->GetType() == SMDSAbs_Volume) {
+        // Change nodes of polyedre
+        const SMDS_PolyhedralVolumeOfNodes* aPolyedre =
+          static_cast<const SMDS_PolyhedralVolumeOfNodes*>( elem );
+        if (aPolyedre) {
+          int nbFaces = aPolyedre->NbFaces();
+
+          vector<const SMDS_MeshNode *> poly_nodes;
+          vector<int> quantities (nbFaces);
+
+          for (int iface = 1; iface <= nbFaces; iface++) {
+            int inode, nbFaceNodes = aPolyedre->NbFaceNodes(iface);
+            quantities[iface - 1] = nbFaceNodes;
+
+            for (inode = 1; inode <= nbFaceNodes; inode++) {
+              const SMDS_MeshNode* curNode = aPolyedre->GetFaceNode(iface, inode);
+
+              TNodeNodeMap::iterator nnIt = nodeNodeMap.find( curNode );
+              if (nnIt != nodeNodeMap.end()) { // curNode sticks
+                curNode = (*nnIt).second;
+              }
+              poly_nodes.push_back(curNode);
+            }
+          }
+          aMesh->ChangePolyhedronNodes( elem, poly_nodes, quantities );
+        }
+      } else {
+        // Change regular element or polygon
+        aMesh->ChangeElementNodes( elem, uniqueNodes, nbUniqueNodes );
+      }
+    } else {
+      // Remove invalid regular element or invalid polygon
       rmElemIds.push_back( elem->GetID() );
+    }
 
   } // loop on elements
 
@@ -3091,7 +3844,9 @@ SMESH_MeshEditor::Sew_Error
                                    const SMDS_MeshNode* theSideFirstNode,
                                    const SMDS_MeshNode* theSideSecondNode,
                                    const SMDS_MeshNode* theSideThirdNode,
-                                   bool                 theSideIsFreeBorder)
+                                   const bool           theSideIsFreeBorder,
+                                   const bool           toCreatePolygons,
+                                   const bool           toCreatePolyedrs)
 {
   MESSAGE("::SewFreeBorder()");
   Sew_Error aResult = SEW_OK;
@@ -3202,7 +3957,7 @@ SMESH_MeshEditor::Sew_Error
     LinkID_Gen aLinkID_Gen( GetMeshDS() );
     set<long> foundSideLinkIDs, checkedLinkIDs;
     SMDS_VolumeTool volume;
-    const SMDS_MeshNode* faceNodes[ 4 ];
+    //const SMDS_MeshNode* faceNodes[ 4 ];
 
     const SMDS_MeshNode*    sideNode;
     const SMDS_MeshElement* sideElem;
@@ -3230,6 +3985,7 @@ SMESH_MeshEditor::Sew_Error
         const SMDS_MeshElement* elem = invElemIt->next();
         // prepare data for a loop on links, of a face or a volume
         int iPrevNode, iNode = 0, nbNodes = elem->NbNodes();
+        const SMDS_MeshNode* faceNodes[ nbNodes ];
         bool isVolume = volume.Set( elem );
         const SMDS_MeshNode** nodes = isVolume ? volume.GetNodes() : faceNodes;
         if ( isVolume ) // --volume
@@ -3313,7 +4069,7 @@ SMESH_MeshEditor::Sew_Error
     }
     while ( sideNode != theSideSecondNode );
 
-    if ( hasVolumes && sideNodes.size () != bordNodes.size() ) {
+    if ( hasVolumes && sideNodes.size () != bordNodes.size() && !toCreatePolyedrs) {
       MESSAGE("VOLUME SPLITTING IS FORBIDDEN");
       return SEW_VOLUMES_TO_SPLIT; // volume splitting is forbidden
     }
@@ -3437,15 +4193,19 @@ SMESH_MeshEditor::Sew_Error
           list<const SMDS_MeshNode*> & nodeList = (*insertMapIt).second;
           const SMDS_MeshNode* n12 = nodeList.front(); nodeList.pop_front();
           const SMDS_MeshNode* n22 = nodeList.front(); nodeList.pop_front();
-          InsertNodesIntoLink( elem, n12, n22, nodeList );
+          InsertNodesIntoLink( elem, n12, n22, nodeList, toCreatePolygons );
           // 2. perform insertion into the link of adjacent faces
           while (true) {
             const SMDS_MeshElement* adjElem = findAdjacentFace( n12, n22, elem );
             if ( adjElem )
-              InsertNodesIntoLink( adjElem, n12, n22, nodeList );
+              InsertNodesIntoLink( adjElem, n12, n22, nodeList, toCreatePolygons );
             else
               break;
           }
+          if (toCreatePolyedrs) {
+            // perform insertion into the links of adjacent volumes
+            UpdateVolumes(n12, n22, nodeList);
+          }
           // 3. find an element appeared on n1 and n2 after the insertion
           insertMap.erase( elem );
           elem = findAdjacentFace( n1, n2, 0 );
@@ -3485,18 +4245,22 @@ SMESH_MeshEditor::Sew_Error
       const SMDS_MeshNode* n1 = nodeList.front(); nodeList.pop_front();
       const SMDS_MeshNode* n2 = nodeList.front(); nodeList.pop_front();
 
-      InsertNodesIntoLink( elem, n1, n2, nodeList );
+      InsertNodesIntoLink( elem, n1, n2, nodeList, toCreatePolygons );
 
       if ( !theSideIsFreeBorder ) {
         // look for and insert nodes into the faces adjacent to elem
         while (true) {
           const SMDS_MeshElement* adjElem = findAdjacentFace( n1, n2, elem );
           if ( adjElem )
-            InsertNodesIntoLink( adjElem, n1, n2, nodeList );
+            InsertNodesIntoLink( adjElem, n1, n2, nodeList, toCreatePolygons );
           else
             break;
         }
       }
+      if (toCreatePolyedrs) {
+        // perform insertion into the links of adjacent volumes
+        UpdateVolumes(n1, n2, nodeList);
+      }
     }
 
   } // end: insert new nodes
@@ -3515,14 +4279,15 @@ SMESH_MeshEditor::Sew_Error
 void SMESH_MeshEditor::InsertNodesIntoLink(const SMDS_MeshElement*     theFace,
                                            const SMDS_MeshNode*        theBetweenNode1,
                                            const SMDS_MeshNode*        theBetweenNode2,
-                                           list<const SMDS_MeshNode*>& theNodesToInsert)
+                                           list<const SMDS_MeshNode*>& theNodesToInsert,
+                                           const bool                  toCreatePoly)
 {
   if ( theFace->GetType() != SMDSAbs_Face ) return;
 
   // find indices of 2 link nodes and of the rest nodes
   int iNode = 0, il1, il2, i3, i4;
   il1 = il2 = i3 = i4 = -1;
-  const SMDS_MeshNode* nodes[ 8 ];
+  const SMDS_MeshNode* nodes[ theFace->NbNodes() ];
   SMDS_ElemIteratorPtr nodeIt = theFace->nodesIterator();
   while ( nodeIt->more() ) {
     const SMDS_MeshNode* n = static_cast<const SMDS_MeshNode*>( nodeIt->next() );
@@ -3541,11 +4306,12 @@ void SMESH_MeshEditor::InsertNodesIntoLink(const SMDS_MeshElement*     theFace,
 
   // arrange link nodes to go one after another regarding the face orientation
   bool reverse = ( Abs( il2 - il1 ) == 1 ? il2 < il1 : il1 < il2 );
+  list<const SMDS_MeshNode *> aNodesToInsert = theNodesToInsert;
   if ( reverse ) {
     iNode = il1;
     il1 = il2;
     il2 = iNode;
-    theNodesToInsert.reverse();
+    aNodesToInsert.reverse();
   }
   // check that not link nodes of a quadrangles are in good order
   int nbFaceNodes = theFace->NbNodes();
@@ -3555,13 +4321,59 @@ void SMESH_MeshEditor::InsertNodesIntoLink(const SMDS_MeshElement*     theFace,
     i4 = iNode;
   } 
 
-  // put theNodesToInsert between theBetweenNode1 and theBetweenNode2
-  int nbLinkNodes = 2 + theNodesToInsert.size();
+  if (toCreatePoly || theFace->IsPoly()) {
+
+    iNode = 0;
+    vector<const SMDS_MeshNode *> poly_nodes (nbFaceNodes + aNodesToInsert.size());
+
+    // add nodes of face up to first node of link
+    bool isFLN = false;
+    nodeIt = theFace->nodesIterator();
+    while ( nodeIt->more() && !isFLN ) {
+      const SMDS_MeshNode* n = static_cast<const SMDS_MeshNode*>( nodeIt->next() );
+      poly_nodes[iNode++] = n;
+      if (n == nodes[il1]) {
+        isFLN = true;
+      }
+    }
+
+    // add nodes to insert
+    list<const SMDS_MeshNode*>::iterator nIt = aNodesToInsert.begin();
+    for (; nIt != aNodesToInsert.end(); nIt++) {
+      poly_nodes[iNode++] = *nIt;
+    }
+
+    // add nodes of face starting from last node of link
+    while ( nodeIt->more() ) {
+      const SMDS_MeshNode* n = static_cast<const SMDS_MeshNode*>( nodeIt->next() );
+      poly_nodes[iNode++] = n;
+    }
+
+    // edit or replace the face
+    SMESHDS_Mesh *aMesh = GetMeshDS();
+
+    if (theFace->IsPoly()) {
+      aMesh->ChangePolygonNodes(theFace, poly_nodes);
+
+    } else {
+      int aShapeId = FindShape( theFace );
+
+      SMDS_MeshElement* newElem = aMesh->AddPolygonalFace(poly_nodes);
+      if ( aShapeId && newElem )
+        aMesh->SetMeshElementOnShape( newElem, aShapeId );
+
+      aMesh->RemoveElement(theFace);
+    }
+    return;
+  }
+
+  // put aNodesToInsert between theBetweenNode1 and theBetweenNode2
+  int nbLinkNodes = 2 + aNodesToInsert.size();
   const SMDS_MeshNode* linkNodes[ nbLinkNodes ];
   linkNodes[ 0 ] = nodes[ il1 ];
   linkNodes[ nbLinkNodes - 1 ] = nodes[ il2 ];
-  list<const SMDS_MeshNode*>::iterator nIt = theNodesToInsert.begin();
-  for ( iNode = 1; nIt != theNodesToInsert.end(); nIt++ ) {
+  list<const SMDS_MeshNode*>::iterator nIt = aNodesToInsert.begin();
+  for ( iNode = 1; nIt != aNodesToInsert.end(); nIt++ ) {
     linkNodes[ iNode++ ] = *nIt;
   }
   // decide how to split a quadrangle: compare possible variants
@@ -3632,6 +4444,87 @@ void SMESH_MeshEditor::InsertNodesIntoLink(const SMDS_MeshElement*     theFace,
   aMesh->ChangeElementNodes( theFace, newNodes, iSplit == iBestQuad ? 4 : 3 );
 }
 
+//=======================================================================
+//function : UpdateVolumes
+//purpose  : 
+//=======================================================================
+void SMESH_MeshEditor::UpdateVolumes (const SMDS_MeshNode*        theBetweenNode1,
+                                      const SMDS_MeshNode*        theBetweenNode2,
+                                      list<const SMDS_MeshNode*>& theNodesToInsert)
+{
+  SMDS_ElemIteratorPtr invElemIt = theBetweenNode1->GetInverseElementIterator();
+  while (invElemIt->more()) { // loop on inverse elements of theBetweenNode1
+    const SMDS_MeshElement* elem = invElemIt->next();
+    if (elem->GetType() != SMDSAbs_Volume)
+      continue;
+
+    // check, if current volume has link theBetweenNode1 - theBetweenNode2
+    SMDS_VolumeTool aVolume (elem);
+    if (!aVolume.IsLinked(theBetweenNode1, theBetweenNode2))
+      continue;
+
+    // insert new nodes in all faces of the volume, sharing link theBetweenNode1 - theBetweenNode2
+    int iface, nbFaces = aVolume.NbFaces();
+    vector<const SMDS_MeshNode *> poly_nodes;
+    vector<int> quantities (nbFaces);
+
+    for (iface = 0; iface < nbFaces; iface++) {
+      int nbFaceNodes = aVolume.NbFaceNodes(iface), nbInserted = 0;
+      // faceNodes will contain (nbFaceNodes + 1) nodes, last = first
+      const SMDS_MeshNode** faceNodes = aVolume.GetFaceNodes(iface);
+
+      for (int inode = 0; inode < nbFaceNodes; inode++) {
+        poly_nodes.push_back(faceNodes[inode]);
+
+        if (nbInserted == 0) {
+          if (faceNodes[inode] == theBetweenNode1) {
+            if (faceNodes[inode + 1] == theBetweenNode2) {
+              nbInserted = theNodesToInsert.size();
+
+              // add nodes to insert
+              list<const SMDS_MeshNode*>::iterator nIt = theNodesToInsert.begin();
+              for (; nIt != theNodesToInsert.end(); nIt++) {
+                poly_nodes.push_back(*nIt);
+              }
+            }
+          } else if (faceNodes[inode] == theBetweenNode2) {
+            if (faceNodes[inode + 1] == theBetweenNode1) {
+              nbInserted = theNodesToInsert.size();
+
+              // add nodes to insert in reversed order
+              list<const SMDS_MeshNode*>::iterator nIt = theNodesToInsert.end();
+              nIt--;
+              for (; nIt != theNodesToInsert.begin(); nIt--) {
+                poly_nodes.push_back(*nIt);
+              }
+              poly_nodes.push_back(*nIt);
+            }
+          } else {
+          }
+        }
+      }
+      quantities[iface] = nbFaceNodes + nbInserted;
+    }
+
+    // Replace or update the volume
+    SMESHDS_Mesh *aMesh = GetMeshDS();
+
+    if (elem->IsPoly()) {
+      aMesh->ChangePolyhedronNodes(elem, poly_nodes, quantities);
+
+    } else {
+      int aShapeId = FindShape( elem );
+
+      SMDS_MeshElement* newElem =
+        aMesh->AddPolyhedralVolume(poly_nodes, quantities);
+      if (aShapeId && newElem)
+        aMesh->SetMeshElementOnShape(newElem, aShapeId);
+
+      aMesh->RemoveElement(elem);
+    }
+  }
+}
+
 //=======================================================================
 //function : SewSideElements
 //purpose  : 
@@ -3763,17 +4656,31 @@ SMESH_MeshEditor::Sew_Error
           bool isNewFace = setOfFaceNodeSet.insert( faceNodeSet ).second;
           if ( isNewFace ) {
             // no such a face is given but it still can exist, check it
-            if ( nbNodes == 3 )
+            if ( nbNodes == 3 ) {
               aFreeFace = aMesh->FindFace( fNodes[0],fNodes[1],fNodes[2] );
-            else
+            } else if ( nbNodes == 4 ) {
               aFreeFace = aMesh->FindFace( fNodes[0],fNodes[1],fNodes[2],fNodes[3] );
+            } else {
+              vector<const SMDS_MeshNode *> poly_nodes (nbNodes);
+              for (int inode = 0; inode < nbNodes; inode++) {
+                poly_nodes[inode] = fNodes[inode];
+              }
+              aFreeFace = aMesh->FindFace(poly_nodes);
+            }
           }
           if ( !aFreeFace ) {
             // create a temporary face
-            if ( nbNodes == 3 )
+            if ( nbNodes == 3 ) {
               aFreeFace = aTmpFacesMesh.AddFace( fNodes[0],fNodes[1],fNodes[2] );
-            else
+            } else if ( nbNodes == 4 ) {
               aFreeFace = aTmpFacesMesh.AddFace( fNodes[0],fNodes[1],fNodes[2],fNodes[3] );
+            } else {
+              vector<const SMDS_MeshNode *> poly_nodes (nbNodes);
+              for (int inode = 0; inode < nbNodes; inode++) {
+                poly_nodes[inode] = fNodes[inode];
+              }
+              aFreeFace = aTmpFacesMesh.AddPolygonalFace(poly_nodes);
+            }
           }
           if ( aFreeFace )
             freeFaceList.push_back( aFreeFace );
index 677d9c033596a54021628fd99c3ebe8e4c13fa25..0bb91f730c6f4dc91fd5a6d37cab829a070ff4de 100644 (file)
@@ -98,13 +98,16 @@ class SMESH_MeshEditor {
                std::set<const SMDS_MeshNode*> &    theFixedNodes,
                const SmoothMethod                  theSmoothMethod,
                const int                           theNbIterations,
-               double                              theTgtAspectRatio = 1.0);
+               double                              theTgtAspectRatio = 1.0,
+               const bool                          the2D = true);
   // Smooth theElements using theSmoothMethod during theNbIterations
   // or until a worst element has aspect ratio <= theTgtAspectRatio.
   // Aspect Ratio varies in range [1.0, inf].
   // If theElements is empty, the whole mesh is smoothed.
   // theFixedNodes contains additionally fixed nodes. Nodes built
   // on edges and boundary nodes are always fixed.
+  // If the2D, smoothing is performed using UV parameters of nodes
+  // on geometrical faces
 
 
   void RotationSweep (std::set<const SMDS_MeshElement*> & theElements,
@@ -154,6 +157,12 @@ class SMESH_MeshEditor {
   // Return list of group of nodes close to each other within theTolerance.
   // Search among theNodes or in the whole mesh if theNodes is empty.
 
+  int SimplifyFace (const vector<const SMDS_MeshNode *> faceNodes,
+                    vector<const SMDS_MeshNode *>&      poly_nodes,
+                    vector<int>&                        quantities) const;
+  // Split face, defined by <faceNodes>, into several faces by repeating nodes.
+  // Is used by MergeNodes()
+
   void MergeNodes (TListOfListOfNodes & theNodeGroups);
   // In each group, the cdr of nodes are substituted by the first one
   // in all elements.
@@ -189,7 +198,9 @@ class SMESH_MeshEditor {
                            const SMDS_MeshNode* theSide2FirstNode,
                            const SMDS_MeshNode* theSide2SecondNode,
                            const SMDS_MeshNode* theSide2ThirdNode = 0,
-                           bool                 theSide2IsFreeBorder = true);
+                           const bool           theSide2IsFreeBorder = true,
+                           const bool           toCreatePolygons = false,
+                           const bool           toCreatePolyedrs = false);
   // Sew the free border to the side2 by replacing nodes in
   // elements on the free border with nodes of the elements
   // of the side 2. If nb of links in the free border and
@@ -226,20 +237,27 @@ class SMESH_MeshEditor {
   void InsertNodesIntoLink(const SMDS_MeshElement*          theFace,
                            const SMDS_MeshNode*             theBetweenNode1,
                            const SMDS_MeshNode*             theBetweenNode2,
-                           std::list<const SMDS_MeshNode*>& theNodesToInsert);
-  // insert theNodesToInsert into theFace between theBetweenNode1
-  // and theBetweenNode2 and split theElement.
-
-  static int SortQuadNodes (const SMDS_Mesh * theMesh,
-                            int               theNodeIds[] );
-  // Set 4 nodes of a quadrangle face in a good order.
-  // Swap 1<->2 or 2<->3 nodes and correspondingly return
-  // 1 or 2 else 0.
-
-  static bool SortHexaNodes (const SMDS_Mesh * theMesh,
-                             int               theNodeIds[] );
-  // Set 8 nodes of a hexahedron in a good order.
-  // Return success status
+                           std::list<const SMDS_MeshNode*>& theNodesToInsert,
+                           const bool                       toCreatePoly = false);
+  // insert theNodesToInsert into theFace between theBetweenNode1 and theBetweenNode2.
+  // If toCreatePoly is true, replace theFace by polygon, else split theFace.
+
+  void UpdateVolumes (const SMDS_MeshNode*             theBetweenNode1,
+                      const SMDS_MeshNode*             theBetweenNode2,
+                      std::list<const SMDS_MeshNode*>& theNodesToInsert);
+  // insert theNodesToInsert into all volumes, containing link
+  // theBetweenNode1 - theBetweenNode2, between theBetweenNode1 and theBetweenNode2.
+
+//  static int SortQuadNodes (const SMDS_Mesh * theMesh,
+//                            int               theNodeIds[] );
+//  // Set 4 nodes of a quadrangle face in a good order.
+//  // Swap 1<->2 or 2<->3 nodes and correspondingly return
+//  // 1 or 2 else 0.
+//
+//  static bool SortHexaNodes (const SMDS_Mesh * theMesh,
+//                             int               theNodeIds[] );
+//  // Set 8 nodes of a hexahedron in a good order.
+//  // Return success status
 
   static void AddToSameGroups (const SMDS_MeshElement* elemToAdd,
                                const SMDS_MeshElement* elemInGroups,
index 0aeffec35e495ac8023ea97466360befeea2adcd..fb9b5afc17fb107d97f16f3725b3adfc2df84d55 100644 (file)
@@ -58,6 +58,7 @@
 #include "SMDS_MeshElement.hxx"
 #include "SMDS_MeshFace.hxx"
 #include "SMDS_MeshNode.hxx"
+#include "SMDS_VolumeTool.hxx"
 #include "SMESHDS_Group.hxx"
 #include "SMESHDS_Mesh.hxx"
 #include "SMESHDS_SubMesh.hxx"
@@ -297,8 +298,8 @@ bool SMESH_Pattern::Load (const char* theFileContents)
 
   while ( readLine( fields, lineBeg, clearFields ))
   {
-    myElemPointIDs.push_back( list< int >() );
-    list< int >& elemPoints = myElemPointIDs.back();
+    myElemPointIDs.push_back( TElemDef() );
+    TElemDef& elemPoints = myElemPointIDs.back();
     for ( fIt = fields.begin(); fIt != fields.end(); fIt++ )
     {
       int pointIndex = getInt( *fIt );
@@ -379,11 +380,11 @@ bool SMESH_Pattern::Save (ostream& theFile)
   }
   // elements
   theFile << "!!! Indices of points of " << myElemPointIDs.size() << " elements:" << endl;
-  list<list< int > >::const_iterator epIt = myElemPointIDs.begin();
+  list<TElemDef >::const_iterator epIt = myElemPointIDs.begin();
   for ( ; epIt != myElemPointIDs.end(); epIt++ )
   {
-    const list< int > & elemPoints = *epIt;
-    list< int >::const_iterator iIt = elemPoints.begin();
+    const TElemDef & elemPoints = *epIt;
+    TElemDef::const_iterator iIt = elemPoints.begin();
     for ( ; iIt != elemPoints.end(); iIt++ )
       theFile << " " << *iIt;
     theFile << endl;
@@ -594,8 +595,8 @@ bool SMESH_Pattern::Load (SMESH_Mesh*        theMesh,
     SMDS_FaceIteratorPtr fIt = aMeshDS->facesIterator();
     while ( fIt->more() )
     {
-      myElemPointIDs.push_back( list< int >() );
-      list< int >& elemPoints = myElemPointIDs.back();
+      myElemPointIDs.push_back( TElemDef() );
+      TElemDef& elemPoints = myElemPointIDs.back();
       SMDS_ElemIteratorPtr nIt = fIt->next()->nodesIterator();
       while ( nIt->more() )
       {
@@ -814,8 +815,8 @@ bool SMESH_Pattern::Load (SMESH_Mesh*        theMesh,
       SMDS_ElemIteratorPtr elemIt = fSubMesh->GetElements();
       while ( elemIt->more() ) {
         SMDS_ElemIteratorPtr nIt = elemIt->next()->nodesIterator();
-        myElemPointIDs.push_back( list< int >() );
-        list< int >& elemPoints = myElemPointIDs.back();
+        myElemPointIDs.push_back( TElemDef() );
+        TElemDef& elemPoints = myElemPointIDs.back();
         while ( nIt->more() )
           elemPoints.push_back( nodePointIDMap[ nIt->next() ]);
       }
@@ -2456,7 +2457,7 @@ bool SMESH_Pattern::Apply (const SMDS_MeshFace* theFace,
                            const int            theNodeIndexOnKeyPoint1,
                            const bool           theReverse)
 {
-  MESSAGE(" ::Apply(MeshFace) " );
+//  MESSAGE(" ::Apply(MeshFace) " );
 
   if ( !IsLoaded() ) {
     MESSAGE( "Pattern not loaded" );
@@ -2609,80 +2610,6 @@ inline static bool isDefined(const gp_XYZ& theXYZ)
   return theXYZ.X() < 1.e100;
 }
 
-//=======================================================================
-//function : mergePoints
-//purpose  : Look for coincident points between myXYZs indexed with
-//           list<int> of each element of xyzIndGroups. Coincident indices
-//           are merged in myElemXYZIDs.
-//=======================================================================
-
-void SMESH_Pattern::mergePoints (map<TNodeSet, list<list<int> > >&  indGroups,
-                                 map< int, list< list< int >* > > & reverseConnectivity)
-{
-  map< TNodeSet, list< list< int > > >::iterator indListIt;
-  for ( indListIt = indGroups.begin(); indListIt != indGroups.end(); indListIt++ )
-  {
-    list<list< int > > groups = indListIt->second;
-    if ( groups.size() < 2 )
-      continue;
-
-//     const TNodeSet & nodes = indListIt->first;
-//     TNodeSet::const_iterator n = nodes.begin();
-//     for ( ; n != nodes.end(); n++ )
-//       cout << *n ;
-
-    // find tolerance
-    Bnd_Box box;
-    list< int >& indices = groups.front();
-    list< int >::iterator ind, ind1, ind2;
-    for ( ind = indices.begin(); ind != indices.end(); ind++ )
-      box.Add( gp_Pnt( myXYZ[ *ind ]));
-    double x, y, z, X, Y, Z;
-    box.Get( x, y, z, X, Y, Z );
-    gp_Pnt p( x, y, z ), P( X, Y, Z );
-    double tol2 = 1.e-4 * p.SquareDistance( P );
-
-    // compare points, replace indices
-
-    list< list< int > >::iterator grpIt1, grpIt2;
-    for ( grpIt1 = groups.begin(); grpIt1 != groups.end(); grpIt1++ )
-    {
-      list< int >& indices1 = *grpIt1;
-      grpIt2 = grpIt1;
-      for ( grpIt2++; grpIt2 != groups.end(); grpIt2++ )
-      {
-        list< int >& indices2 = *grpIt2;
-        for ( ind1 = indices1.begin(); ind1 != indices1.end(); ind1++ )
-        {
-          gp_XYZ& p1 = myXYZ[ *ind1 ];
-          ind2 = indices2.begin();
-          while ( ind2 != indices2.end() )
-          {
-            gp_XYZ& p2 = myXYZ[ *ind2 ];
-            //MESSAGE("COMP: " << *ind1 << " " << *ind2 << " X: " << p2.X() << " tol2: " << tol2);
-            if ( ( p1 - p2 ).SquareModulus() <= tol2 )
-            {
-              ASSERT( reverseConnectivity.find( *ind2 ) != reverseConnectivity.end() );
-              list< list< int >* > & elemXYZIDsList = reverseConnectivity[ *ind2 ];
-              list< list< int >* >::iterator elemXYZIDs = elemXYZIDsList.begin();
-              for ( ; elemXYZIDs != elemXYZIDsList.end(); elemXYZIDs++ )
-              {
-                ind = find( (*elemXYZIDs)->begin(), (*elemXYZIDs)->end(), *ind2 );
-                //MESSAGE( " Replace " << *ind << " with " << *ind1 );
-                myXYZ[ *ind ] = undefinedXYZ();
-                *ind = *ind1;
-              }
-              ind2 = indices2.erase( ind2 );
-            }
-            else
-              ind2++;
-          }
-        }
-      }
-    }
-  }
-}
-
 //=======================================================================
 //function : Apply
 //purpose  : Compute nodes coordinates applying
@@ -2690,9 +2617,9 @@ void SMESH_Pattern::mergePoints (map<TNodeSet, list<list<int> > >&  indGroups,
 //           will be mapped into <theNodeIndexOnKeyPoint1>-th node
 //=======================================================================
 
-bool SMESH_Pattern::Apply (std::set<const SMDS_MeshFace*> theFaces,
-                           const int                      theNodeIndexOnKeyPoint1,
-                           const bool                     theReverse)
+bool SMESH_Pattern::Apply (std::set<const SMDS_MeshFace*>& theFaces,
+                           const int                       theNodeIndexOnKeyPoint1,
+                           const bool                      theReverse)
 {
   MESSAGE(" ::Apply(set<MeshFace>) " );
 
@@ -2710,10 +2637,13 @@ bool SMESH_Pattern::Apply (std::set<const SMDS_MeshFace*> theFaces,
     return setErrorCode( ERR_APPL_BAD_NB_VERTICES );
   }
 
+  myShape.Nullify();
   myXYZ.clear();
   myElemXYZIDs.clear();
   myXYZIdToNodeMap.clear();
   myElements.clear();
+  myIdsOnBoundary.clear();
+  myReverseConnectivity.clear();
 
   myXYZ.resize( myPoints.size() * theFaces.size(), undefinedXYZ() );
   myElements.reserve( theFaces.size() );
@@ -2723,11 +2653,6 @@ bool SMESH_Pattern::Apply (std::set<const SMDS_MeshFace*> theFaces,
   for ( int i = 0; i < myPoints.size(); i++ )
     pointIndex.insert( make_pair( & myPoints[ i ], i ));
 
-  // to merge nodes on edges of the elements being refined
-  typedef set<const SMDS_MeshNode*> TLink;
-  map< TLink, list< list< int > > > linkPointIndListMap;
-  map< int, list< list< int >* > >  reverseConnectivity;
-
   int ind1 = 0; // lowest point index for a face
 
   // apply to each face in theFaces set
@@ -2741,37 +2666,45 @@ bool SMESH_Pattern::Apply (std::set<const SMDS_MeshFace*> theFaces,
     myElements.push_back( *face );
 
     // store computed points belonging to elements
-    list< list< int > >::iterator ll = myElemPointIDs.begin();
+    list< TElemDef >::iterator ll = myElemPointIDs.begin();
     for ( ; ll != myElemPointIDs.end(); ++ll )
     {
-      myElemXYZIDs.push_back();
-      list< int >& xyzIds = myElemXYZIDs.back();
-      list< int >& pIds = *ll;
-      for ( list<int>::iterator id = pIds.begin(); id != pIds.end(); id++ ) {
+      myElemXYZIDs.push_back(TElemDef());
+      TElemDef& xyzIds = myElemXYZIDs.back();
+      TElemDef& pIds = *ll;
+      for ( TElemDef::iterator id = pIds.begin(); id != pIds.end(); id++ ) {
         int pIndex = *id + ind1;
         xyzIds.push_back( pIndex );
         myXYZ[ pIndex ] = myPoints[ *id ].myXYZ.XYZ();
-        reverseConnectivity[ pIndex ].push_back( & xyzIds );
+        myReverseConnectivity[ pIndex ].push_back( & xyzIds );
       }
     }
-    // put points on links to linkPointIndListMap
+    // put points on links to myIdsOnBoundary,
+    // they will be used to sew new elements on adjacent refined elements
     int nbNodes = (*face)->NbNodes(), eID = nbNodes + 1;
     for ( int i = 0; i < nbNodes; i++ )
     {
+      list< TPoint* > & linkPoints = getShapePoints( eID++ );
       const SMDS_MeshNode* n1 = myOrderedNodes[ i ];
       const SMDS_MeshNode* n2 = myOrderedNodes[ i + 1 == nbNodes ? 0 : i + 1 ];
-      // make a link of node pointers
-      TLink link;
-      link.insert( n1 );
-      link.insert( n2 );
-      // add the link to the map
-      list< list< int > >& groups = linkPointIndListMap[ link ];
-      groups.push_back();
-      list< int >& indList = groups.back();
-      list< TPoint* > & linkPoints = getShapePoints( eID++ );
+      // make a link and a node set
+      TNodeSet linkSet, node1Set;
+      linkSet.insert( n1 );
+      linkSet.insert( n2 );
+      node1Set.insert( n1 );
       list< TPoint* >::iterator p = linkPoints.begin();
-      // map the first link point to n1
-      myXYZIdToNodeMap[ pointIndex[ *p ] + ind1 ] = n1;
+      {
+        // map the first link point to n1
+        int nId = pointIndex[ *p ] + ind1;
+        myXYZIdToNodeMap[ nId ] = n1;
+        list< list< int > >& groups = myIdsOnBoundary[ node1Set ];
+        groups.push_back(list< int > ());
+        groups.back().push_back( nId );
+      }
+      // add the linkSet to the map
+      list< list< int > >& groups = myIdsOnBoundary[ linkSet ];
+      groups.push_back(list< int > ());
+      list< int >& indList = groups.back();
       // add points to the map excluding the end points
       for ( p++; *p != linkPoints.back(); p++ )
         indList.push_back( pointIndex[ *p ] + ind1 );
@@ -2779,8 +2712,6 @@ bool SMESH_Pattern::Apply (std::set<const SMDS_MeshFace*> theFaces,
     ind1 += myPoints.size();
   }
 
-  mergePoints( linkPointIndListMap, reverseConnectivity );
-
   return !myElemXYZIDs.empty();
 }
 
@@ -2793,9 +2724,9 @@ bool SMESH_Pattern::Apply (std::set<const SMDS_MeshFace*> theFaces,
 //           node.
 //=======================================================================
 
-bool SMESH_Pattern::Apply (std::set<const SMDS_MeshVolume*> theVolumes,
-                           const int                        theNode000Index,
-                           const int                        theNode001Index)
+bool SMESH_Pattern::Apply (std::set<const SMDS_MeshVolume*> theVolumes,
+                           const int                          theNode000Index,
+                           const int                          theNode001Index)
 {
   MESSAGE(" ::Apply(set<MeshVolumes>) " );
 
@@ -2813,10 +2744,13 @@ bool SMESH_Pattern::Apply (std::set<const SMDS_MeshVolume*> theVolumes,
     return setErrorCode( ERR_APPL_BAD_NB_VERTICES );
   }
 
+  myShape.Nullify();
   myXYZ.clear();
   myElemXYZIDs.clear();
   myXYZIdToNodeMap.clear();
   myElements.clear();
+  myIdsOnBoundary.clear();
+  myReverseConnectivity.clear();
 
   myXYZ.resize( myPoints.size() * theVolumes.size(), undefinedXYZ() );
   myElements.reserve( theVolumes.size() );
@@ -2826,10 +2760,6 @@ bool SMESH_Pattern::Apply (std::set<const SMDS_MeshVolume*> theVolumes,
   for ( int i = 0; i < myPoints.size(); i++ )
     pointIndex.insert( make_pair( & myPoints[ i ], i ));
 
-  // to merge nodes on edges and faces of the elements being refined
-  map< TNodeSet, list< list< int > > > subPointIndListMap;
-  map< int, list< list< int >* > >  reverseConnectivity;
-
   int ind1 = 0; // lowest point index for an element
 
   // apply to each element in theVolumes set
@@ -2843,27 +2773,28 @@ bool SMESH_Pattern::Apply (std::set<const SMDS_MeshVolume*> theVolumes,
     myElements.push_back( *vol );
 
     // store computed points belonging to elements
-    list< list< int > >::iterator ll = myElemPointIDs.begin();
+    list< TElemDef >::iterator ll = myElemPointIDs.begin();
     for ( ; ll != myElemPointIDs.end(); ++ll )
     {
-      myElemXYZIDs.push_back();
-      list< int >& xyzIds = myElemXYZIDs.back();
-      list< int >& pIds = *ll;
-      for ( list<int>::iterator id = pIds.begin(); id != pIds.end(); id++ ) {
+      myElemXYZIDs.push_back(TElemDef());
+      TElemDef& xyzIds = myElemXYZIDs.back();
+      TElemDef& pIds = *ll;
+      for ( TElemDef::iterator id = pIds.begin(); id != pIds.end(); id++ ) {
         int pIndex = *id + ind1;
         xyzIds.push_back( pIndex );
         myXYZ[ pIndex ] = myPoints[ *id ].myXYZ.XYZ();
-        reverseConnectivity[ pIndex ].push_back( & xyzIds );
+        myReverseConnectivity[ pIndex ].push_back( & xyzIds );
       }
     }
-    // put points on edges and faces to subPointIndListMap
+    // put points on edges and faces to myIdsOnBoundary,
+    // they will be used to sew new elements on adjacent refined elements
     for ( int Id = SMESH_Block::ID_V000; Id <= SMESH_Block::ID_F1yz; Id++ )
     {
       // make a set of sub-points
       TNodeSet subNodes;
       vector< int > subIDs;
       if ( SMESH_Block::IsVertexID( Id )) {
-        // use nodes of refined volumes for merge
+        subNodes.insert( myOrderedNodes[ Id - 1 ]);
       }
       else if ( SMESH_Block::IsEdgeID( Id )) {
         SMESH_Block::GetEdgeVertexIDs( Id, subIDs );
@@ -2880,23 +2811,20 @@ bool SMESH_Pattern::Apply (std::set<const SMDS_MeshVolume*> theVolumes,
         subNodes.insert( myOrderedNodes[ subIDs.front() - 1 ]);
         subNodes.insert( myOrderedNodes[ subIDs.back() - 1 ]);
       }
-      list< list< int > >& groups = subPointIndListMap[ subNodes ];
-      groups.push_back();
-      list< int >& indList = groups.back();
       // add points
       list< TPoint* > & points = getShapePoints( Id );
       list< TPoint* >::iterator p = points.begin();
-      if ( subNodes.empty() ) // vertex case
-        myXYZIdToNodeMap[ pointIndex[ *p ] + ind1 ] = myOrderedNodes[ Id - 1 ];
-      else
-        for ( ; p != points.end(); p++ )
-          indList.push_back( pointIndex[ *p ] + ind1 );
+      list< list< int > >& groups = myIdsOnBoundary[ subNodes ];
+      groups.push_back(list< int > ());
+      list< int >& indList = groups.back();
+      for ( ; p != points.end(); p++ )
+        indList.push_back( pointIndex[ *p ] + ind1 );
+      if ( subNodes.size() == 1 ) // vertex case
+        myXYZIdToNodeMap[ indList.back() ] = myOrderedNodes[ Id - 1 ];
     }
     ind1 += myPoints.size();
   }
 
-  mergePoints( subPointIndListMap, reverseConnectivity );
-
   return !myElemXYZIDs.empty();
 }
 
@@ -3007,8 +2935,8 @@ bool SMESH_Pattern::Load (SMESH_Mesh*         theMesh,
     SMDS_ElemIteratorPtr elemIt = aSubMesh->GetElements();
     while ( elemIt->more() ) {
       SMDS_ElemIteratorPtr nIt = elemIt->next()->nodesIterator();
-      myElemPointIDs.push_back( list< int >() );
-      list< int >& elemPoints = myElemPointIDs.back();
+      myElemPointIDs.push_back( TElemDef() );
+      TElemDef& elemPoints = myElemPointIDs.back();
       while ( nIt->more() )
         elemPoints.push_back( nodePointIDMap[ nIt->next() ]);
     }
@@ -3092,7 +3020,7 @@ bool SMESH_Pattern::Apply (const SMDS_MeshVolume* theVolume,
                            const int              theNode000Index,
                            const int              theNode001Index)
 {
-  MESSAGE(" ::Apply(MeshVolume) " );
+  //MESSAGE(" ::Apply(MeshVolume) " );
 
   if (!findBoundaryPoints()) // bind ID to points
     return false;
@@ -3129,20 +3057,432 @@ bool SMESH_Pattern::Apply (const SMDS_MeshVolume* theVolume,
   return setErrorCode( ERR_OK );
 }
 
+//=======================================================================
+//function : mergePoints
+//purpose  : Merge XYZ on edges and/or faces.
+//=======================================================================
+
+void SMESH_Pattern::mergePoints (const bool uniteGroups)
+{
+  map< TNodeSet, list< list< int > > >::iterator idListIt = myIdsOnBoundary.begin();
+  for ( ; idListIt != myIdsOnBoundary.end(); idListIt++ )
+  {
+    list<list< int > >& groups = idListIt->second;
+    if ( groups.size() < 2 )
+      continue;
+
+    // find tolerance
+    const TNodeSet& nodes = idListIt->first;
+    double tol2 = 1.e-10;
+    if ( nodes.size() > 1 ) {
+      Bnd_Box box;
+      TNodeSet::const_iterator n = nodes.begin();
+      for ( ; n != nodes.end(); ++n )
+        box.Add( gp_Pnt( (*n)->X(), (*n)->Y(), (*n)->Z() ));
+      double x, y, z, X, Y, Z;
+      box.Get( x, y, z, X, Y, Z );
+      gp_Pnt p( x, y, z ), P( X, Y, Z );
+      tol2 = 1.e-4 * p.SquareDistance( P );
+    }
+
+    // to unite groups on link
+    bool unite = ( uniteGroups && nodes.size() == 2 );
+    map< double, int > distIndMap;
+    const SMDS_MeshNode* node = *nodes.begin();
+    gp_Pnt P( node->X(), node->Y(), node->Z() );
+
+    // compare points, replace indices
+
+    list< int >::iterator ind1, ind2;
+    list< list< int > >::iterator grpIt1, grpIt2;
+    for ( grpIt1 = groups.begin(); grpIt1 != groups.end(); grpIt1++ )
+    {
+      list< int >& indices1 = *grpIt1;
+      grpIt2 = grpIt1;
+      for ( grpIt2++; grpIt2 != groups.end(); grpIt2++ )
+      {
+        list< int >& indices2 = *grpIt2;
+        for ( ind1 = indices1.begin(); ind1 != indices1.end(); ind1++ )
+        {
+          gp_XYZ& p1 = myXYZ[ *ind1 ];
+          ind2 = indices2.begin();
+          while ( ind2 != indices2.end() )
+          {
+            gp_XYZ& p2 = myXYZ[ *ind2 ];
+            //MESSAGE("COMP: " << *ind1 << " " << *ind2 << " X: " << p2.X() << " tol2: " << tol2);
+            if ( ( p1 - p2 ).SquareModulus() <= tol2 )
+            {
+              ASSERT( myReverseConnectivity.find( *ind2 ) != myReverseConnectivity.end() );
+              list< TElemDef* > & elemXYZIDsList = myReverseConnectivity[ *ind2 ];
+              list< TElemDef* >::iterator elemXYZIDs = elemXYZIDsList.begin();
+              for ( ; elemXYZIDs != elemXYZIDsList.end(); elemXYZIDs++ )
+              {
+                //MESSAGE( " Replace " << *ind2 << " with " << *ind1 );
+                myXYZ[ *ind2 ] = undefinedXYZ();
+                replace( (*elemXYZIDs)->begin(), (*elemXYZIDs)->end(), *ind2, *ind1 );
+              }
+              ind2 = indices2.erase( ind2 );
+            }
+            else
+              ind2++;
+          }
+        }
+      }
+      if ( unite ) { // sort indices using distIndMap
+        for ( ind1 = indices1.begin(); ind1 != indices1.end(); ind1++ )
+        {
+          ASSERT( isDefined( myXYZ[ *ind1 ] ));
+          double dist = P.SquareDistance( myXYZ[ *ind1 ]);
+          distIndMap.insert( make_pair( dist, *ind1 ));
+        }
+      }
+    }
+    if ( unite ) { // put all sorted indices into the first group
+      list< int >& g = groups.front();
+      g.clear();
+      map< double, int >::iterator dist_ind = distIndMap.begin();
+      for ( ; dist_ind != distIndMap.end(); dist_ind++ )
+        g.push_back( dist_ind->second );
+    }
+  } // loop on myIdsOnBoundary
+}
+
+//=======================================================================
+//function : makePolyElements
+//purpose  : prepare intermediate data to create Polygons and Polyhedrons
+//=======================================================================
+
+void SMESH_Pattern::
+  makePolyElements(const vector< const SMDS_MeshNode* >& theNodes,
+                   const bool                            toCreatePolygons,
+                   const bool                            toCreatePolyedrs)
+{
+  myPolyElemXYZIDs.clear();
+  myPolyElems.clear();
+  myPolyElems.reserve( myIdsOnBoundary.size() );
+
+  // make a set of refined elements
+  set< const SMDS_MeshElement* > avoidSet, elemSet;
+  avoidSet.insert( myElements.begin(), myElements.end() );
+
+  map< TNodeSet, list< list< int > > >::iterator indListIt, nn_IdList;
+
+  if ( toCreatePolygons )
+  {
+    int lastFreeId = myXYZ.size();
+
+    // loop on links of refined elements
+    indListIt = myIdsOnBoundary.begin();
+    for ( ; indListIt != myIdsOnBoundary.end(); indListIt++ )
+    {
+      const TNodeSet & linkNodes = indListIt->first;
+      if ( linkNodes.size() != 2 )
+        continue; // skip face
+      const SMDS_MeshNode* n1 = * linkNodes.begin();
+      const SMDS_MeshNode* n2 = * linkNodes.rbegin();
+
+      list<list< int > >& idGroups = indListIt->second; // ids of nodes to build
+      if ( idGroups.empty() || idGroups.front().empty() )
+        continue;
+
+      // find not refined face having n1-n2 link
+
+      while (true)
+      {
+        const SMDS_MeshElement* face =
+          SMESH_MeshEditor::FindFaceInSet( n1, n2, elemSet, avoidSet );
+        if ( face )
+        {
+          avoidSet.insert ( face );
+          myPolyElems.push_back( face );
+
+          // some links of <face> are split;
+          // make list of xyz for <face>
+          myPolyElemXYZIDs.push_back(TElemDef());
+          TElemDef & faceNodeIds = myPolyElemXYZIDs.back();
+          // loop on links of a <face>
+          SMDS_ElemIteratorPtr nIt = face->nodesIterator();
+          int i = 0, nbNodes = face->NbNodes();
+          vector<const SMDS_MeshNode*> nodes( nbNodes + 1 );
+          while ( nIt->more() )
+            nodes[ i++ ] = static_cast<const SMDS_MeshNode*>( nIt->next() );
+          nodes[ i ] = nodes[ 0 ];
+          for ( i = 0; i < nbNodes; ++i )
+          {
+            // look for point mapped on a link
+            TNodeSet faceLinkNodes;
+            faceLinkNodes.insert( nodes[ i ] );
+            faceLinkNodes.insert( nodes[ i + 1 ] );
+            if ( faceLinkNodes == linkNodes )
+              nn_IdList = indListIt;
+            else
+              nn_IdList = myIdsOnBoundary.find( faceLinkNodes );
+            // add face point ids
+            faceNodeIds.push_back( ++lastFreeId );
+            myXYZIdToNodeMap.insert( make_pair( lastFreeId, nodes[ i ]));
+            if ( nn_IdList != myIdsOnBoundary.end() )
+            {
+              // there are points mapped on a link
+              list< int >& mappedIds = nn_IdList->second.front();
+              if ( isReversed( nodes[ i ], mappedIds ))
+                faceNodeIds.insert (faceNodeIds.end(),mappedIds.rbegin(), mappedIds.rend() );
+              else
+                faceNodeIds.insert (faceNodeIds.end(),mappedIds.begin(), mappedIds.end() );
+            }
+          } // loop on links of a <face>
+        } // if ( face )
+        else
+          break;
+      } // while (true)
+
+      if ( myIs2D && idGroups.size() > 1 ) {
+
+        // sew new elements on 2 refined elements sharing n1-n2 link
+
+        list< int >& idsOnLink = idGroups.front();
+        // temporarily add ids of link nodes to idsOnLink
+        bool rev = isReversed( n1, idsOnLink );
+        for ( int i = 0; i < 2; ++i )
+        {
+          TNodeSet nodeSet;
+          nodeSet.insert( i ? n2 : n1 );
+          ASSERT( myIdsOnBoundary.find( nodeSet ) != myIdsOnBoundary.end() );
+          list<list< int > >& groups = myIdsOnBoundary[ nodeSet ];
+          int nodeId = groups.front().front();
+          bool append = i;
+          if ( rev ) append = !append;
+          if ( append )
+            idsOnLink.push_back( nodeId );
+          else
+            idsOnLink.push_front( nodeId );
+        }
+        list< int >::iterator id = idsOnLink.begin();
+        for ( ; id != idsOnLink.end(); ++id ) // loop on XYZ ids on a link
+        {
+          list< TElemDef* >& elemDefs = myReverseConnectivity[ *id ]; // elems sharing id
+          list< TElemDef* >::iterator pElemDef = elemDefs.begin();
+          for ( ; pElemDef != elemDefs.end(); pElemDef++ ) // loop on elements sharing id
+          {
+            TElemDef* pIdList = *pElemDef; // ptr on list of ids making element up
+            // look for <id> in element definition
+            TElemDef::iterator idDef = find( pIdList->begin(), pIdList->end(), *id );
+            ASSERT ( idDef != pIdList->end() );
+            // look for 2 neighbour ids of <id> in element definition
+            for ( int prev = 0; prev < 2; ++prev ) {
+              TElemDef::iterator idDef2 = idDef;
+              if ( prev )
+                idDef2 = ( idDef2 == pIdList->begin() ) ? --pIdList->end() : --idDef2;
+              else
+                idDef2 = ( ++idDef2 == pIdList->end() ) ? pIdList->begin() : idDef2;
+              // look for idDef2 on a link starting from id
+              list< int >::iterator id2 = find( id, idsOnLink.end(), *idDef2 );
+              if ( id2 != idsOnLink.end() && id != --id2 ) { // found not next to id
+                // insert ids located on link between <id> and <id2>
+                // into the element definition between idDef and idDef2
+                if ( prev )
+                  for ( ; id2 != id; --id2 )
+                    pIdList->insert( idDef, *id2 );
+                else {
+                  list< int >::iterator id1 = id;
+                  for ( ++id1, ++id2; id1 != id2; ++id1 )
+                    pIdList->insert( idDef2, *id1 );
+                }
+              }
+            }
+          }
+        }
+        // remove ids of link nodes
+        idsOnLink.pop_front();
+        idsOnLink.pop_back();
+      }
+    } // loop on myIdsOnBoundary
+  } // if ( toCreatePolygons )
+
+  if ( toCreatePolyedrs )
+  {
+    // check volumes adjacent to the refined elements
+    SMDS_VolumeTool volTool;
+    vector<const SMDS_MeshElement*>::iterator refinedElem = myElements.begin();
+    for ( ; refinedElem != myElements.end(); ++refinedElem )
+    {
+      // loop on nodes of refinedElem
+      SMDS_ElemIteratorPtr nIt = (*refinedElem)->nodesIterator();
+      while ( nIt->more() ) {
+        const SMDS_MeshNode* node = static_cast<const SMDS_MeshNode*>( nIt->next() );
+        // loop on inverse elements of node
+        SMDS_ElemIteratorPtr eIt = node->GetInverseElementIterator();
+        while ( eIt->more() )
+        {
+          const SMDS_MeshElement* elem = eIt->next();
+          if ( !volTool.Set( elem ) || !avoidSet.insert( elem ).second )
+            continue; // skip faces or refined elements
+          // add polyhedron definition
+          myPolyhedronQuantities.push_back(vector<int> ());
+          myPolyElemXYZIDs.push_back(TElemDef());
+          vector<int>& quantity = myPolyhedronQuantities.back();
+          TElemDef &   elemDef  = myPolyElemXYZIDs.back();
+          // get definitions of new elements on volume faces
+          bool makePoly = false;
+          for ( int iF = 0; iF < volTool.NbFaces(); ++iF )
+          {
+            if ( getFacesDefinition(volTool.GetFaceNodes( iF ),
+                                    volTool.NbFaceNodes( iF ),
+                                    theNodes, elemDef, quantity))
+              makePoly = true;
+          }
+          if ( makePoly )
+            myPolyElems.push_back( elem );
+          else {
+            myPolyhedronQuantities.pop_back();
+            myPolyElemXYZIDs.pop_back();
+          }
+        }
+      }
+    }
+  }
+}
+
+//=======================================================================
+//function : getFacesDefinition
+//purpose  : return faces definition for a volume face defined by theBndNodes
+//=======================================================================
+
+bool SMESH_Pattern::
+  getFacesDefinition(const SMDS_MeshNode**                 theBndNodes,
+                     const int                             theNbBndNodes,
+                     const vector< const SMDS_MeshNode* >& theNodes,
+                     list< int >&                          theFaceDefs,
+                     vector<int>&                          theQuantity)
+{
+  bool makePoly = false;
+//   cout << "FROM FACE NODES: " <<endl;
+//   for ( int i = 0; i < theNbBndNodes; ++i )
+//     cout << theBndNodes[ i ];
+
+  set< const SMDS_MeshNode* > bndNodeSet;
+  for ( int i = 0; i < theNbBndNodes; ++i )
+    bndNodeSet.insert( theBndNodes[ i ]);
+
+  map< TNodeSet, list< list< int > > >::iterator nn_IdList;
+
+  // make a set of all nodes on a face
+  set< int > ids;
+  if ( !myIs2D ) { // for 2D, merge only edges
+    nn_IdList = myIdsOnBoundary.find( bndNodeSet );
+    if ( nn_IdList != myIdsOnBoundary.end() ) {
+      makePoly = true;
+      list< int > & faceIds = nn_IdList->second.front();
+      ids.insert( faceIds.begin(), faceIds.end() );
+    }
+  }
+  //bool hasIdsInFace = !ids.empty();
+
+  // add ids on links and bnd nodes
+  int lastFreeId = Max( myXYZIdToNodeMap.rbegin()->first, theNodes.size() );
+  TElemDef faceDef; // definition for the case if there is no new adjacent volumes
+  for ( int iN = 0; iN < theNbBndNodes; ++iN )
+  {
+    // add id of iN-th bnd node
+    TNodeSet nSet;
+    nSet.insert( theBndNodes[ iN ] );
+    nn_IdList = myIdsOnBoundary.find( nSet );
+    int bndId = ++lastFreeId;
+    if ( nn_IdList != myIdsOnBoundary.end() ) {
+      bndId = nn_IdList->second.front().front();
+      ids.insert( bndId );
+    }
+    else 
+      myXYZIdToNodeMap.insert( make_pair( bndId, theBndNodes[ iN ] ));
+    faceDef.push_back( bndId );
+    // add ids on a link
+    TNodeSet linkNodes;
+    linkNodes.insert( theBndNodes[ iN ]);
+    linkNodes.insert( theBndNodes[ iN + 1 == theNbBndNodes ? 0 : iN + 1 ]);
+    nn_IdList = myIdsOnBoundary.find( linkNodes );
+    if ( nn_IdList != myIdsOnBoundary.end() ) {
+      makePoly = true;
+      list< int > & linkIds = nn_IdList->second.front();
+      ids.insert( linkIds.begin(), linkIds.end() );
+      if ( isReversed( theBndNodes[ iN ], linkIds ))
+        faceDef.insert( faceDef.end(), linkIds.begin(), linkIds.end() );
+      else
+        faceDef.insert( faceDef.end(), linkIds.rbegin(), linkIds.rend() );
+    }
+  }
+
+  // find faces definition of new volumes
+
+  bool defsAdded = false;
+  if ( !myIs2D ) { // for 2D, merge only edges
+    SMDS_VolumeTool vol;
+    set< TElemDef* > checkedVolDefs;
+    set< int >::iterator id = ids.begin();
+    for ( ; id != ids.end(); ++id )
+    {
+      // definitions of volumes sharing id
+      list< TElemDef* >& defList = myReverseConnectivity[ *id ];
+      ASSERT( !defList.empty() );
+      // loop on volume definitions
+      list< TElemDef* >::iterator pIdList = defList.begin();
+      for ( ; pIdList != defList.end(); ++pIdList)
+      {
+        if ( !checkedVolDefs.insert( *pIdList ).second )
+          continue; // skip already checked volume definition
+        vector< int > idVec;
+        idVec.reserve( (*pIdList)->size() );
+        idVec.insert( idVec.begin(), (*pIdList)->begin(), (*pIdList)->end() );
+        // loop on face defs of a volume
+        SMDS_VolumeTool::VolumeType volType = vol.GetType( idVec.size() );
+        if ( volType == SMDS_VolumeTool::UNKNOWN )
+          continue;
+        int nbFaces = vol.NbFaces( volType );
+        for ( int iF = 0; iF < nbFaces; ++iF )
+        {
+          const int* nodeInds = vol.GetFaceNodesIndices( volType, iF, true );
+          int iN, nbN = vol.NbFaceNodes( volType, iF );
+          // check if all nodes of a faces are in <ids>
+          bool all = true;
+          for ( iN = 0; iN < nbN && all; ++iN ) {
+            int nodeId = idVec[ nodeInds[ iN ]];
+            all = ( ids.find( nodeId ) != ids.end() );
+          }
+          if ( all ) {
+            // store a face definition
+            for ( iN = 0; iN < nbN; ++iN ) {
+              theFaceDefs.push_back( idVec[ nodeInds[ iN ]]);
+            }
+            theQuantity.push_back( nbN );
+            defsAdded = true;
+          }
+        }
+      }
+    }
+  }
+  if ( !defsAdded ) {
+    theQuantity.push_back( faceDef.size() );
+    theFaceDefs.splice( theFaceDefs.end(), faceDef, faceDef.begin(), faceDef.end() );
+  }
+
+  return makePoly;
+}
+
 //=======================================================================
 //function : MakeMesh
 //purpose  : Create nodes and elements in <theMesh> using nodes
 //           coordinates computed by either of Apply...() methods
 //=======================================================================
 
-bool SMESH_Pattern::MakeMesh(SMESH_Mesh* theMesh)
+bool SMESH_Pattern::MakeMesh(SMESH_Mesh* theMesh,
+                             const bool  toCreatePolygons,
+                             const bool  toCreatePolyedrs)
 {
   MESSAGE(" ::MakeMesh() " );
   if ( !myIsComputed )
     return setErrorCode( ERR_MAKEM_NOT_COMPUTED );
 
+  mergePoints( toCreatePolygons );
+
   SMESHDS_Mesh* aMeshDS = theMesh->GetMeshDS();
-  SMESH_MeshEditor editor( theMesh ); 
 
   // clear elements and nodes existing on myShape
 
@@ -3165,18 +3505,16 @@ bool SMESH_Pattern::MakeMesh(SMESH_Mesh* theMesh)
 
   bool onMeshElements = ( !myElements.empty() );
 
-  // loop on sub-shapes of myShape: create nodes and build point-node map
-
-  vector< const SMDS_MeshNode* >       nodesVector;
-  map< TPoint*, const SMDS_MeshNode* > pointNodeMap;
+  vector< const SMDS_MeshNode* > nodesVector; // i-th point/xyz -> node
   if ( onMeshElements )
   {
-    nodesVector.resize( myXYZ.size() );
+    nodesVector.resize( Max( myXYZ.size(), myXYZIdToNodeMap.rbegin()->first ), 0 );
+    map< int, const SMDS_MeshNode*>::iterator i_node = myXYZIdToNodeMap.begin();
+    for ( ; i_node != myXYZIdToNodeMap.end(); i_node++ ) {
+      nodesVector[ i_node->first ] = i_node->second;
+    }
     for ( int i = 0; i < myXYZ.size(); ++i ) {
-      map< int, const SMDS_MeshNode*>::iterator idNode = myXYZIdToNodeMap.find( i );
-      if ( idNode != myXYZIdToNodeMap.end() )
-        nodesVector[ i ] = idNode->second;
-      else if ( isDefined( myXYZ[ i ] ))
+      if ( !nodesVector[ i ] && isDefined( myXYZ[ i ] ) )
         nodesVector[ i ] = aMeshDS->AddNode (myXYZ[ i ].X(),
                                              myXYZ[ i ].Y(),
                                              myXYZ[ i ].Z());
@@ -3184,6 +3522,14 @@ bool SMESH_Pattern::MakeMesh(SMESH_Mesh* theMesh)
   }
   else
   {
+    nodesVector.resize( myPoints.size(), 0 );
+
+    // to find point index
+    map< TPoint*, int > pointIndex;
+    for ( int i = 0; i < myPoints.size(); i++ )
+      pointIndex.insert( make_pair( & myPoints[ i ], i ));
+
+    // loop on sub-shapes of myShape: create nodes
     map< int, list< TPoint* > >::iterator idPointIt = myShapeIDToPointsMap.begin();
     for ( ; idPointIt != myShapeIDToPointsMap.end(); idPointIt++ )
     {
@@ -3198,12 +3544,14 @@ bool SMESH_Pattern::MakeMesh(SMESH_Mesh* theMesh)
       for ( ; pIt != points.end(); pIt++ )
       {
         TPoint* point = *pIt;
-        if ( pointNodeMap.find( point ) != pointNodeMap.end() )
+        int pIndex = pointIndex[ point ];
+        if ( nodesVector [ pIndex ] )
           continue;
         SMDS_MeshNode* node = aMeshDS->AddNode (point->myXYZ.X(),
                                                 point->myXYZ.Y(),
                                                 point->myXYZ.Z());
-        pointNodeMap.insert( make_pair( point, node ));
+        nodesVector [ pIndex ] = node;
+
         if ( subMeshDS ) {
           switch ( S.ShapeType() ) {
           case TopAbs_VERTEX: {
@@ -3232,62 +3580,126 @@ bool SMESH_Pattern::MakeMesh(SMESH_Mesh* theMesh)
       }
     }
   }
-  
+
   // create elements
 
-  // shapes and groups myElements are on
+  if ( onMeshElements )
+  {
+    // prepare data to create poly elements
+    makePolyElements( nodesVector, toCreatePolygons, toCreatePolyedrs );
+
+    // refine elements
+    createElements( theMesh, nodesVector, myElemXYZIDs, myElements );
+    // sew old and new elements
+    createElements( theMesh, nodesVector, myPolyElemXYZIDs, myPolyElems );
+  }
+  else
+  {
+    createElements( theMesh, nodesVector, myElemPointIDs, myElements );
+  }
+
+//   const map<int,SMESHDS_SubMesh*>& sm = aMeshDS->SubMeshes();
+//   map<int,SMESHDS_SubMesh*>::const_iterator i_sm = sm.begin();
+//   for ( ; i_sm != sm.end(); i_sm++ )
+//   {
+//     cout << " SM " << i_sm->first << " ";
+//     TopAbs::Print( aMeshDS->IndexToShape( i_sm->first ).ShapeType(), cout)<< " ";
+//     //SMDS_ElemIteratorPtr GetElements();
+//     SMDS_NodeIteratorPtr nit = i_sm->second->GetNodes();
+//     while ( nit->more() )
+//       cout << nit->next()->GetID() << " ";
+//     cout << endl;
+//   }
+  return setErrorCode( ERR_OK );
+}
+
+//=======================================================================
+//function : createElements
+//purpose  : add elements to the mesh
+//=======================================================================
+
+void SMESH_Pattern::createElements(SMESH_Mesh*                            theMesh,
+                                   const vector<const SMDS_MeshNode* >&   theNodesVector,
+                                   const list< TElemDef > &               theElemNodeIDs,
+                                   const vector<const SMDS_MeshElement*>& theElements)
+{
+  SMESHDS_Mesh* aMeshDS = theMesh->GetMeshDS();
+  SMESH_MeshEditor editor( theMesh ); 
+
+  bool onMeshElements = !theElements.empty();
+
+  // shapes and groups theElements are on
   vector< int > shapeIDs;
   vector< list< SMESHDS_Group* > > groups;
+  set< const SMDS_MeshNode* > shellNodes;
   if ( onMeshElements )
   {
-    shapeIDs.resize( myElements.size() );
-    groups.resize( myElements.size() );
+    shapeIDs.resize( theElements.size() );
+    groups.resize( theElements.size() );
     const set<SMESHDS_GroupBase*>& allGroups = aMeshDS->GetGroups();
     set<SMESHDS_GroupBase*>::const_iterator grIt;
-    for ( int i = 0; i < myElements.size(); i++ )
+    for ( int i = 0; i < theElements.size(); i++ )
     {
-      shapeIDs[ i ] = editor.FindShape( myElements[ i ] );
+      shapeIDs[ i ] = editor.FindShape( theElements[ i ] );
       for ( grIt = allGroups.begin(); grIt != allGroups.end(); grIt++ ) {
         SMESHDS_Group* group = dynamic_cast<SMESHDS_Group*>( *grIt );
-        if ( group && group->SMDSGroup().Contains( myElements[ i ] ))
+        if ( group && group->SMDSGroup().Contains( theElements[ i ] ))
           groups[ i ].push_back( group );
       }
     }
+    // get all nodes bound to shells because their SpacePosition is not set
+    // by SMESHDS_Mesh::SetNodeInVolume()
+    TopoDS_Shape aMainShape = aMeshDS->ShapeToMesh();
+    if ( !aMainShape.IsNull() ) {
+      TopExp_Explorer shellExp( aMainShape, TopAbs_SHELL );
+      for ( ; shellExp.More(); shellExp.Next() )
+      {
+        SMESHDS_SubMesh * sm = aMeshDS->MeshElements( shellExp.Current() );
+        if ( sm ) {
+          SMDS_NodeIteratorPtr nIt = sm->GetNodes();
+          while ( nIt->more() )
+            shellNodes.insert( nIt->next() );
+        }
+      }
+    }
   }
-  int nbElems = myElemPointIDs.size(); // nb elements in a pattern
+   // nb new elements per a refined element
+  int nbNewElemsPerOld = 1;
+  if ( onMeshElements )
+    nbNewElemsPerOld = theElemNodeIDs.size() / theElements.size();
 
-  list<list< int > >::iterator epIt, epEnd;
-  if ( onMeshElements ) {
-    epIt  = myElemXYZIDs.begin();
-    epEnd = myElemXYZIDs.end();
-  }
-  else {
-    epIt  = myElemPointIDs.begin();
-    epEnd = myElemPointIDs.end();
-  }
-  for ( int iElem = 0; epIt != epEnd; epIt++, iElem++ )
+  bool is2d = myIs2D;
+
+  list< TElemDef >::const_iterator enIt = theElemNodeIDs.begin();
+  list< vector<int> >::iterator quantity = myPolyhedronQuantities.begin();
+  for ( int iElem = 0; enIt != theElemNodeIDs.end(); enIt++, iElem++ )
   {
-    list< int > & elemPoints = *epIt;
+    const TElemDef & elemNodeInd = *enIt;
     // retrieve nodes
-    const SMDS_MeshNode* nodes[ 8 ];
-    list< int >::iterator iIt = elemPoints.begin();
+    vector< const SMDS_MeshNode* > nodes( elemNodeInd.size() );
+    TElemDef::const_iterator id = elemNodeInd.begin();
     int nbNodes;
-    for ( nbNodes = 0; iIt != elemPoints.end(); iIt++ ) {
-      if ( onMeshElements )
-        nodes[ nbNodes++ ] = nodesVector[ *iIt ];
+    for ( nbNodes = 0; id != elemNodeInd.end(); id++ ) {
+      if ( *id < theNodesVector.size() )
+        nodes[ nbNodes++ ] = theNodesVector[ *id ];
       else
-        nodes[ nbNodes++ ] = pointNodeMap[ & myPoints[ *iIt ]];
+        nodes[ nbNodes++ ] = myXYZIdToNodeMap[ *id ];
+    }
+    // dim of refined elem
+    int elemIndex = iElem / nbNewElemsPerOld; // refined element index
+    if ( onMeshElements ) {
+      is2d = ( theElements[ elemIndex ]->GetType() == SMDSAbs_Face );
     }
     // add an element
     const SMDS_MeshElement* elem = 0;
-    if ( myIs2D ) {
+    if ( is2d ) {
       switch ( nbNodes ) {
       case 3:
         elem = aMeshDS->AddFace( nodes[0], nodes[1], nodes[2] ); break;
       case 4:
         elem = aMeshDS->AddFace( nodes[0], nodes[1], nodes[2], nodes[3] ); break;
       default:
-        ASSERT( nbNodes < 8 );
+        elem = aMeshDS->AddPolygonalFace( nodes );
       }
     }
     else {
@@ -3304,13 +3716,12 @@ bool SMESH_Pattern::MakeMesh(SMESH_Mesh* theMesh)
         elem = aMeshDS->AddVolume (nodes[0], nodes[1], nodes[2], nodes[3],
                                    nodes[4], nodes[5], nodes[6], nodes[7] ); break;
       default:
-        ASSERT( nbNodes < 8 );
+        elem = aMeshDS->AddPolyhedralVolume( nodes, *quantity++ );
       }
     }
     // set element on a shape
     if ( elem && onMeshElements ) // applied to mesh elements
     {
-      int elemIndex = iElem / nbElems;
       int shapeID = shapeIDs[ elemIndex ];
       if ( shapeID > 0 ) {
         aMeshDS->SetMeshElementOnShape( elem, shapeID );
@@ -3325,11 +3736,14 @@ bool SMESH_Pattern::MakeMesh(SMESH_Mesh* theMesh)
         while ( noIt->more() ) {
           SMDS_MeshNode* node = const_cast<SMDS_MeshNode*>
             ( static_cast<const SMDS_MeshNode*>( noIt->next() ));
-          if ( !node->GetPosition() || !node->GetPosition()->GetShapeId() ) {
+          if (!node->GetPosition()->GetShapeId() &&
+              shellNodes.find( node ) == shellNodes.end() ) {
             if ( S.ShapeType() == TopAbs_FACE )
               aMeshDS->SetNodeOnFace( node, shapeID );
-            else
+            else {
               aMeshDS->SetNodeInVolume( node, shapeID );
+              shellNodes.insert( node );
+            }
           }
         }
       }
@@ -3342,7 +3756,7 @@ bool SMESH_Pattern::MakeMesh(SMESH_Mesh* theMesh)
       aMeshDS->SetMeshElementOnShape( elem, myShape );
   }
 
-  // make that SMESH_subMesh::_computeState = COMPUTE_OK
+  // make that SMESH_subMesh::_computeState == COMPUTE_OK
   // so that operations with hypotheses will erase the mesh being built
 
   SMESH_subMesh * subMesh;
@@ -3353,22 +3767,46 @@ bool SMESH_Pattern::MakeMesh(SMESH_Mesh* theMesh)
   }
   if ( onMeshElements ) {
     list< int > elemIDs;
-    for ( int i = 0; i < myElements.size(); i++ )
+    for ( int i = 0; i < theElements.size(); i++ )
     {
-      int shapeID = shapeIDs[ i ];
-      if ( shapeID > 0 ) {
-        TopoDS_Shape S = aMeshDS->IndexToShape( shapeID );
-        subMesh = theMesh->GetSubMeshContaining( S );
-        if ( subMesh )
-          subMesh->ComputeStateEngine( SMESH_subMesh::CHECK_COMPUTE_STATE );
-      }
-      elemIDs.push_back( myElements[ i ]->GetID() );
+      subMesh = theMesh->GetSubMeshContaining( shapeIDs[ i ] );
+      if ( subMesh )
+        subMesh->ComputeStateEngine( SMESH_subMesh::CHECK_COMPUTE_STATE );
+
+      elemIDs.push_back( theElements[ i ]->GetID() );
     }
     // remove refined elements
     editor.Remove( elemIDs, false );
   }
+}
 
-  return setErrorCode( ERR_OK );
+//=======================================================================
+//function : isReversed
+//purpose  : check xyz ids order in theIdsList taking into account
+//           theFirstNode on a link
+//=======================================================================
+
+bool SMESH_Pattern::isReversed(const SMDS_MeshNode* theFirstNode,
+                               const list< int >&   theIdsList) const
+{
+  if ( theIdsList.size() < 2 )
+    return false;
+
+  gp_Pnt Pf ( theFirstNode->X(), theFirstNode->Y(), theFirstNode->Z() );
+  gp_Pnt P[2];
+  list<int>::const_iterator id = theIdsList.begin();
+  for ( int i = 0; i < 2; ++i, ++id ) {
+    if ( *id < myXYZ.size() )
+      P[ i ] = myXYZ[ *id ];
+    else {
+      map< int, const SMDS_MeshNode*>::const_iterator i_n;
+      i_n = myXYZIdToNodeMap.find( *id );
+      ASSERT( i_n != myXYZIdToNodeMap.end() );
+      const SMDS_MeshNode* n = i_n->second;
+      P[ i ].SetCoord( n->X(), n->Y(), n->Z() );
+    }
+  }
+  return Pf.SquareDistance( P[ 1 ] ) < Pf.SquareDistance( P[ 0 ] );
 }
 
 
@@ -3539,11 +3977,11 @@ bool SMESH_Pattern::findBoundaryPoints()
 
     typedef pair< TPoint*, TPoint*> TLink;
     set< TLink > linkSet;
-    list<list< int > >::iterator epIt = myElemPointIDs.begin();
+    list<TElemDef >::iterator epIt = myElemPointIDs.begin();
     for ( ; epIt != myElemPointIDs.end(); epIt++ )
     {
-      list< int > & elemPoints = *epIt;
-      list< int >::iterator pIt = elemPoints.begin();
+      TElemDef & elemPoints = *epIt;
+      TElemDef::iterator pIt = elemPoints.begin();
       int prevP = elemPoints.back();
       for ( ; pIt != elemPoints.end(); pIt++ ) {
         TPoint* p1 = & myPoints[ prevP ];
@@ -3768,6 +4206,9 @@ bool SMESH_Pattern::setShapeToMesh(const TopoDS_Shape& theShape)
     return setErrorCode( ERR_APPL_BAD_NB_VERTICES );
   }
 
+  myElements.clear(); // not refine elements
+  myElemXYZIDs.clear();
+
   myShapeIDMap.Clear();
   myShape = theShape;
   return true;
index 670578ce459d1e04bfb6eab8028309fb57c9d848..373d2ef25a18dda7016eb541fd904bf48776e0b2 100644 (file)
@@ -100,9 +100,9 @@ class SMESH_Pattern {
   // the loaded pattern to <theFace>. The first key-point
   // will be mapped into <theNodeIndexOnKeyPoint1>-th node
 
-  bool Apply (std::set<const SMDS_MeshFace*> theFaces,
-              const int                      theNodeIndexOnKeyPoint1,
-              const bool                     theReverse);
+  bool Apply (std::set<const SMDS_MeshFace*>& theFaces,
+              const int                       theNodeIndexOnKeyPoint1,
+              const bool                      theReverse);
   // Compute nodes coordinates applying
   // the loaded pattern to <theFaces>. The first key-point
   // will be mapped into <theNodeIndexOnKeyPoint1>-th node
@@ -116,9 +116,9 @@ class SMESH_Pattern {
   // (0,0,1) key-point will be mapped into <theNode000Index>-th
   // node.
 
-  bool Apply (std::set<const SMDS_MeshVolume*> theVolumes,
-              const int                        theNode000Index,
-              const int                        theNode001Index);
+  bool Apply (std::set<const SMDS_MeshVolume*>& theVolumes,
+              const int                         theNode000Index,
+              const int                         theNode001Index);
   // Compute nodes coordinates applying
   // the loaded pattern to <theVolumes>. The (0,0,0) key-point
   // will be mapped into <theNode000Index>-th node. The
@@ -128,7 +128,9 @@ class SMESH_Pattern {
   bool GetMappedPoints ( std::list<const gp_XYZ *> & thePoints ) const;
   // Return nodes coordinates computed by Apply() method
 
-  bool MakeMesh(SMESH_Mesh* theMesh);
+  bool MakeMesh(SMESH_Mesh* theMesh,
+                const bool toCreatePolygons = false,
+                const bool toCreatePolyedrs = false);
   // Create nodes and elements in <theMesh> using nodes
   // coordinates computed by either of Apply...() methods
 
@@ -271,41 +273,80 @@ class SMESH_Pattern {
   // are appended to theEdgesPointsList
 
   typedef std::set<const SMDS_MeshNode*> TNodeSet;
-  void mergePoints (std::map<TNodeSet,std::list<std::list<int> > >&  xyzIndGroups,
-                    std::map< int, std::list< std::list< int >* > >& reverseConnectivity);
-  // Look for coincident points between myXYZs indexed with
-  // list<int> of each element of xyzIndGroups. Coincident indices
-  // are merged in myElemXYZIDs using reverseConnectivity.
 
+  void mergePoints (const bool uniteGroups);
+  // Merge XYZ on edges and/or faces.
+
+  void makePolyElements(const std::vector< const SMDS_MeshNode* >& theNodes,
+                        const bool                                 toCreatePolygons,
+                        const bool                                 toCreatePolyedrs);
+  // prepare intermediate data to create Polygons and Polyhedrons
+
+  void createElements(SMESH_Mesh*                                 theMesh,
+                      const std::vector<const SMDS_MeshNode* >&   theNodesVector,
+                      const std::list< std::list< int > > &       theElemNodeIDs,
+                      const std::vector<const SMDS_MeshElement*>& theElements);
+  // add elements to the mesh
+
+  bool getFacesDefinition(const SMDS_MeshNode**                      theBndNodes,
+                          const int                                  theNbBndNodes,
+                          const std::vector< const SMDS_MeshNode* >& theNodes,
+                          std::list< int >&                          theFaceDefs,
+                          std::vector<int>&                          theQuantity);
+  // fill faces definition for a volume face defined by theBndNodes
+  // return true if a face definition changes
+  
+
+  bool isReversed(const SMDS_MeshNode*    theFirstNode,
+                  const std::list< int >& theIdsList) const;
+  // check xyz ids order in theIdsList taking into account
+  // theFirstNode on a link
+                  
  private:
   // fields
 
-  bool                              myIs2D;
-  std::vector< TPoint >             myPoints;
-  std::list< int >                  myKeyPointIDs;
-  std::list< std::list< int > >     myElemPointIDs;
+  typedef std::list< int > TElemDef; // element definition is its nodes ids
+
+  bool                                 myIs2D;
+  std::vector< TPoint >                myPoints;
+  std::list< int >                     myKeyPointIDs;
+  std::list< TElemDef >                myElemPointIDs;
 
-  ErrorCode                         myErrorCode;
-  bool                              myIsComputed;
-  bool                              myIsBoundaryPointsFound;
+  ErrorCode                            myErrorCode;
+  bool                                 myIsComputed;
+  bool                                 myIsBoundaryPointsFound;
 
-  TopoDS_Shape                      myShape;
+  TopoDS_Shape                         myShape;
   // all functions assure that shapes are indexed so that first go
   // ordered vertices, then ordered edge, then faces and maybe a shell
-  TopTools_IndexedMapOfOrientedShape myShapeIDMap;
-  //TopTools_IndexedMapOfShape        myShapeIDMap;
-  std::map< int, list< TPoint* > >  myShapeIDToPointsMap;
+  TopTools_IndexedMapOfOrientedShape   myShapeIDMap;
+  std::map< int, list< TPoint* > >     myShapeIDToPointsMap;
 
   // for the 2d case:
   // nb of key-points in each of pattern boundaries
-  std::list< int >                  myNbKeyPntInBoundary;
+  std::list< int >                     myNbKeyPntInBoundary;
 
+  
   // to compute while applying to mesh elements, not to shapes
-  std::vector<gp_XYZ>               myXYZ;
-  std::list< std::list< int > >     myElemXYZIDs;
-  std::map< int, const SMDS_MeshNode*> myXYZIdToNodeMap; // map id to node of a refined element
-  std::vector<const SMDS_MeshElement*> myElements; // refined elements
-  std::vector<const SMDS_MeshNode*> myOrderedNodes;
+
+  std::vector<gp_XYZ>                  myXYZ;            // XYZ of nodes to create
+  std::list< TElemDef >                myElemXYZIDs;     // new elements definitions
+  std::map< int, const SMDS_MeshNode*> myXYZIdToNodeMap; // map XYZ id to node of a refined element
+  std::vector<const SMDS_MeshElement*> myElements;       // refined elements
+  std::vector<const SMDS_MeshNode*>    myOrderedNodes;
+
+   // elements to replace with polygon or polyhedron
+  std::vector<const SMDS_MeshElement*> myPolyElems;
+  // definitions of new poly elements
+  std::list< TElemDef >                myPolyElemXYZIDs;
+  std::list< std::vector<int> >        myPolyhedronQuantities;
+
+  // map a boundary to XYZs on it;
+  // a boundary (edge or face) is defined as a set of its nodes,
+  // XYZs on a boundary are indices of myXYZ s
+  std::map<TNodeSet,std::list<std::list<int> > >  myIdsOnBoundary;
+  // map XYZ id to element it is in
+  std::map< int, std::list< TElemDef* > >         myReverseConnectivity;
 };
 
 
index dd93a999fae7da7ed86e4e26c4c8bc17d0b50715..163a8a45f2fa8318209896546a951ada83c365f8 100644 (file)
@@ -792,17 +792,20 @@ SMESH_Hypothesis::Hypothesis_Status
       ASSERT(algo);
       if (!algo->CheckHypothesis((*_father),_subShape, ret ))
       {
+        //two applying algo on the same shape not allowed
+        _meshDS->RemoveHypothesis(_subShape, anHyp);
         if ( !SMESH_Hypothesis::IsStatusFatal( ret ))
           // ret should be fatal: anHyp was not added
           ret = SMESH_Hypothesis::HYP_INCOMPATIBLE;
       }
+      else if (SMESH_Hypothesis::IsStatusFatal( ret ))
+      {
+        _meshDS->RemoveHypothesis(_subShape, anHyp);
+      }
       else if (!_father->IsUsedHypothesis(  anHyp, _subShape ))
-        ret = SMESH_Hypothesis::HYP_INCOMPATIBLE;
-
-      if (SMESH_Hypothesis::IsStatusFatal( ret ))
       {
-        MESSAGE("do not add extra hypothesis");
         _meshDS->RemoveHypothesis(_subShape, anHyp);
+        ret = SMESH_Hypothesis::HYP_INCOMPATIBLE;
       }
       else
       {
@@ -812,19 +815,11 @@ SMESH_Hypothesis::Hypothesis_Status
     }
     case ADD_ALGO: {           //already existing algo : on father ?
       SMESH_Algo* algo = gen->GetAlgo((*_father), _subShape);
-      if ( algo->CheckHypothesis((*_father),_subShape, aux_ret )) {
-        // check if algo changes
-        SMESH_HypoFilter f;
-        f.Init(   SMESH_HypoFilter::IsAlgo() );
-        f.And(    SMESH_HypoFilter::IsApplicableTo( _subShape ));
-        f.AndNot( SMESH_HypoFilter::Is( algo ));
-        const SMESH_Hypothesis * prevAlgo = _father->GetHypothesis( _subShape, f, true );
-        if (prevAlgo && 
-            string(algo->GetName()) != string(prevAlgo->GetName()) )
-          modifiedHyp = true;
-      }
+      if ( algo->CheckHypothesis((*_father),_subShape, aux_ret ))
+        SetAlgoState(HYP_OK);
       else
         SetAlgoState(MISSING_HYP);
+      modifiedHyp = true;
       break;
     }
     case REMOVE_HYP: {
@@ -845,13 +840,13 @@ SMESH_Hypothesis::Hypothesis_Status
       }
       else
       {
-        if ( algo->CheckHypothesis((*_father),_subShape, aux_ret )) {
-          // check if algo remains
-          if ( anHyp != algo && strcmp( anHyp->GetName(), algo->GetName()) )
-            modifiedHyp = true;
-        }
+        if ( algo->CheckHypothesis((*_father),_subShape, aux_ret ))
+          SetAlgoState(HYP_OK);
         else
           SetAlgoState(MISSING_HYP);
+        // check if same algo remains
+        if ( anHyp != algo && strcmp( anHyp->GetName(), algo->GetName()) )
+          modifiedHyp = true;
       }
       break;
     }
@@ -860,6 +855,7 @@ SMESH_Hypothesis::Hypothesis_Status
       ASSERT(algo);
       if ( algo->CheckHypothesis((*_father),_subShape, aux_ret ))
       {
+        SetAlgoState(HYP_OK);
         if (_father->IsUsedHypothesis( anHyp, _subShape )) // new Hyp
           modifiedHyp = true;
       }
@@ -867,35 +863,27 @@ SMESH_Hypothesis::Hypothesis_Status
         SetAlgoState(MISSING_HYP);
       break;
     }
-    case ADD_FATHER_ALGO: {
+    case ADD_FATHER_ALGO: {    // a new algo on father
       SMESH_Algo* algo = gen->GetAlgo((*_father), _subShape);
-      if ( algo == anHyp ) { // a new algo on father
-        if ( algo->CheckHypothesis((*_father),_subShape, aux_ret )) {
-          // check if algo changes
-          SMESH_HypoFilter f;
-          f.Init(   SMESH_HypoFilter::IsAlgo() );
-          f.And(    SMESH_HypoFilter::IsApplicableTo( _subShape ));
-          f.AndNot( SMESH_HypoFilter::Is( algo ));
-          const SMESH_Hypothesis* prevAlgo = _father->GetHypothesis( _subShape, f, true );
-          if (prevAlgo && 
-              string(algo->GetName()) != string(prevAlgo->GetName()) )
-            modifiedHyp = true;
-        }
+      if ( algo == anHyp ) {
+        if ( algo->CheckHypothesis((*_father),_subShape, aux_ret ))
+          SetAlgoState(HYP_OK);
         else
           SetAlgoState(MISSING_HYP);
+        modifiedHyp = true;
       }
       break;
     }
     case REMOVE_FATHER_HYP: {
       SMESH_Algo* algo = gen->GetAlgo((*_father), _subShape);
       ASSERT(algo);
-      if ( algo->CheckHypothesis((*_father),_subShape, aux_ret )) {
-        // is there the same local hyp or maybe a new father algo applied?
-        if ( !GetSimilarAttached( _subShape, anHyp ) )
-          modifiedHyp = true;
-      }
+      if ( algo->CheckHypothesis((*_father),_subShape, aux_ret ))
+        SetAlgoState(HYP_OK);
       else
         SetAlgoState(MISSING_HYP);
+      // is there the same local hyp or maybe a new father algo applied?
+      if ( !GetSimilarAttached( _subShape, anHyp ) )
+        modifiedHyp = true;
       break;
     }
     case REMOVE_FATHER_ALGO: {
@@ -906,13 +894,13 @@ SMESH_Hypothesis::Hypothesis_Status
       }
       else
       {
-        if ( algo->CheckHypothesis((*_father),_subShape, aux_ret )) {
-          // check if algo changes
-          if ( string(algo->GetName()) != string( anHyp->GetName()) )
-            modifiedHyp = true;
-        }
+        if ( algo->CheckHypothesis((*_father),_subShape, aux_ret ))
+          SetAlgoState(HYP_OK);
         else
           SetAlgoState(MISSING_HYP);
+        // is there the same local algo or maybe a new father algo applied?
+        if ( !GetSimilarAttached( _subShape, anHyp ))
+          modifiedHyp = true;
       }
       break;
     }
@@ -1047,7 +1035,7 @@ void SMESH_subMesh::CleanDependsOn()
        for (its = dependson.begin(); its != dependson.end(); its++)
        {
                SMESH_subMesh *sm = (*its).second;
-               //SCRUTE((*its).first);
+               //              SCRUTE((*its).first);
                sm->ComputeStateEngine(CLEAN);
        }
 }
@@ -1497,21 +1485,21 @@ void SMESH_subMesh::UpdateDependantsState(const compute_event theEvent)
 
 void SMESH_subMesh::CleanDependants()
 {
+  //MESSAGE("SMESH_subMesh::CleanDependants: shape type " << _subShape.ShapeType() );
+
   TopTools_ListIteratorOfListOfShape it( _father->GetAncestors( _subShape ));
   for (; it.More(); it.Next())
   {
     const TopoDS_Shape& ancestor = it.Value();
-    // PAL8021. do not go upper than SOLID, else ComputeStateEngine(CLEANDEP)
-    // will erase mesh on other shapes in a compound
-    if ( ancestor.ShapeType() >= TopAbs_SOLID ) {
-      SMESH_subMesh *aSubMesh = _father->GetSubMeshContaining(ancestor);
-      if (aSubMesh)
-        aSubMesh->ComputeStateEngine(CLEANDEP);
-    }
+    //MESSAGE("ancestor shape type " << ancestor.ShapeType() );
+    SMESH_subMesh *aSubMesh = _father->GetSubMeshContaining(ancestor);
+    if (aSubMesh)
+      aSubMesh->ComputeStateEngine(CLEANDEP);
   }
   ComputeStateEngine(CLEAN);
 }
 
+
 //=============================================================================
 /*!
  *
index 4e7dc3f3bfd0a89df0d86a2dc43224acecf9404f..b55b5af1c3694f09d57b5d540711f252dd094804 100644 (file)
@@ -224,6 +224,57 @@ void SMESHDS_Command::AddVolume(int NewVolID,
        myNumber++;
 }
 
+//=======================================================================
+//function : AddPolygonalFace
+//purpose  : 
+//=======================================================================
+void SMESHDS_Command::AddPolygonalFace (const int        ElementID,
+                                        std::vector<int> nodes_ids)
+{
+  if (!myType == SMESHDS_AddPolygon) {
+    MESSAGE("SMESHDS_Command::AddPolygonalFace : Bad Type");
+    return;
+  }
+  myIntegers.push_back(ElementID);
+
+  int i, nbNodes = nodes_ids.size();
+  myIntegers.push_back(nbNodes);
+  for (i = 0; i < nbNodes; i++) {
+    myIntegers.push_back(nodes_ids[i]);
+  }
+
+  myNumber++;
+}
+
+//=======================================================================
+//function : AddPolyhedralVolume
+//purpose  : 
+//=======================================================================
+void SMESHDS_Command::AddPolyhedralVolume (const int        ElementID,
+                                           std::vector<int> nodes_ids,
+                                           std::vector<int> quantities)
+{
+  if (!myType == SMESHDS_AddPolyhedron) {
+    MESSAGE("SMESHDS_Command::AddPolyhedralVolume : Bad Type");
+    return;
+  }
+  myIntegers.push_back(ElementID);
+
+  int i, nbNodes = nodes_ids.size();
+  myIntegers.push_back(nbNodes);
+  for (i = 0; i < nbNodes; i++) {
+    myIntegers.push_back(nodes_ids[i]);
+  }
+
+  int nbFaces = quantities.size();
+  myIntegers.push_back(nbFaces);
+  for (i = 0; i < nbFaces; i++) {
+    myIntegers.push_back(quantities[i]);
+  }
+
+  myNumber++;
+}
+
 //=======================================================================
 //function : 
 //purpose  : 
@@ -263,7 +314,7 @@ void SMESHDS_Command::ChangeElementNodes(int ElementID, int nodes[], int nbnodes
 {
   if (!myType == SMESHDS_ChangeElementNodes)
   {
-    MESSAGE("SMESHDS_Command::RemoveElement : Bad Type");
+    MESSAGE("SMESHDS_Command::ChangeElementNodes : Bad Type");
     return;
   }
   myIntegers.push_back(ElementID);
@@ -274,6 +325,36 @@ void SMESHDS_Command::ChangeElementNodes(int ElementID, int nodes[], int nbnodes
   myNumber++;
 }
 
+//=======================================================================
+//function : ChangePolyhedronNodes
+//purpose  : 
+//=======================================================================
+void SMESHDS_Command::ChangePolyhedronNodes (const int ElementID,
+                                             std::vector<int> nodes_ids,
+                                             std::vector<int> quantities)
+{
+  if (myType != SMESHDS_ChangePolyhedronNodes)
+  {
+    MESSAGE("SMESHDS_Command::ChangePolyhedronNodes : Bad Type");
+    return;
+  }
+  myIntegers.push_back(ElementID);
+
+  int i, nbNodes = nodes_ids.size();
+  myIntegers.push_back(nbNodes);
+  for (i = 0; i < nbNodes; i++) {
+    myIntegers.push_back(nodes_ids[i]);
+  }
+
+  int nbFaces = quantities.size();
+  myIntegers.push_back(nbFaces);
+  for (i = 0; i < nbFaces; i++) {
+    myIntegers.push_back(quantities[i]);
+  }
+
+  myNumber++;
+}
+
 //=======================================================================
 //function : Renumber
 //purpose  : 
index b72b21b86b8d37693e018d145a2db3dca3495c8c..3ecd762f30cbfd8e0d8c8155a249bdb671998c52 100644 (file)
@@ -29,6 +29,7 @@
 
 #include "SMESHDS_CommandType.hxx"
 #include <list>
+#include <vector>
 
 class SMESHDS_Command
 {
@@ -48,10 +49,18 @@ class SMESHDS_Command
                int idnode4, int idnode5, int idnode6);
        void AddVolume(int NewVolID, int idnode1, int idnode2, int idnode3,
                int idnode4, int idnode5, int idnode6, int idnode7, int idnode8);
+        void AddPolygonalFace (const int        ElementID,
+                               std::vector<int> nodes_ids);
+        void AddPolyhedralVolume (const int        ElementID,
+                                  std::vector<int> nodes_ids,
+                                  std::vector<int> quantities);
        void MoveNode(int NewNodeID, double x, double y, double z);
        void RemoveNode(int NodeID);
        void RemoveElement(int ElementID);
        void ChangeElementNodes(int ElementID, int nodes[], int nbnodes);
+       void ChangePolyhedronNodes(const int ElementID,
+                                   std::vector<int> nodes_ids,
+                                   std::vector<int> quantities);
        void Renumber (const bool isNodes, const int startID, const int deltaID);
        SMESHDS_CommandType GetType();
        int GetNumber();
index e906020cb34a47183f03eda4ffd5779c6e42fbad..f2c505b1f66f12444696adc8681c39b3a76244d4 100644 (file)
@@ -34,14 +34,17 @@ enum SMESHDS_CommandType {
  SMESHDS_AddEdge,
  SMESHDS_AddTriangle,
  SMESHDS_AddQuadrangle,
+ SMESHDS_AddPolygon,
  SMESHDS_AddTetrahedron,
  SMESHDS_AddPyramid,
  SMESHDS_AddPrism,
  SMESHDS_AddHexahedron,
+ SMESHDS_AddPolyhedron,
  SMESHDS_RemoveNode,
  SMESHDS_RemoveElement,
  SMESHDS_MoveNode,
  SMESHDS_ChangeElementNodes,
+ SMESHDS_ChangePolyhedronNodes,
  SMESHDS_Renumber
 };
 
index d3e5d6bb85c8930d390e1ff3b3cbb8245c5a27dc..ded954d0ce39c9e9cdf7921c4159bb8d01e3cef7 100644 (file)
@@ -171,8 +171,9 @@ bool SMESHDS_Mesh::ChangeElementNodes(const SMDS_MeshElement * elem,
   if ( ! SMDS_Mesh::ChangeElementNodes( elem, nodes, nbnodes ))
     return false;
 
-  ASSERT( nbnodes < 9 );
-  int i, IDs[ 8 ];
+  //ASSERT( nbnodes < 9 );
+  //int i, IDs[ 8 ];
+  int i, IDs[ nbnodes ];
   for ( i = 0; i < nbnodes; i++ )
     IDs [ i ] = nodes[ i ]->GetID();
   myScript->ChangeElementNodes( elem->GetID(), IDs, nbnodes);
@@ -180,6 +181,49 @@ bool SMESHDS_Mesh::ChangeElementNodes(const SMDS_MeshElement * elem,
   return true;
 }
 
+//=======================================================================
+//function : ChangePolygonNodes
+//purpose  : 
+//=======================================================================
+bool SMESHDS_Mesh::ChangePolygonNodes
+                   (const SMDS_MeshElement * elem,
+                    std::vector<const SMDS_MeshNode*> nodes)
+{
+  ASSERT(nodes.size() > 3);
+
+  int nb = nodes.size();
+  const SMDS_MeshNode* nodes_array [nb];
+  for (int inode = 0; inode < nb; inode++) {
+    nodes_array[inode] = nodes[inode];
+  }
+
+  return ChangeElementNodes(elem, nodes_array, nb);
+}
+
+//=======================================================================
+//function : ChangePolyhedronNodes
+//purpose  : 
+//=======================================================================
+bool SMESHDS_Mesh::ChangePolyhedronNodes
+                   (const SMDS_MeshElement * elem,
+                    std::vector<const SMDS_MeshNode*> nodes,
+                    std::vector<int>                  quantities)
+{
+  ASSERT(nodes.size() > 3);
+
+  if (!SMDS_Mesh::ChangePolyhedronNodes(elem, nodes, quantities))
+    return false;
+
+  int i, len = nodes.size();
+  std::vector<int> nodes_ids (len);
+  for (i = 0; i < len; i++) {
+    nodes_ids[i] = nodes[i]->GetID();
+  }
+  myScript->ChangePolyhedronNodes(elem->GetID(), nodes_ids, quantities);
+
+  return true;
+}
+
 //=======================================================================
 //function : Renumber
 //purpose  : 
@@ -472,6 +516,100 @@ SMDS_MeshVolume* SMESHDS_Mesh::AddVolume(const SMDS_MeshNode * n1,
                                 n8->GetID());
   return anElem;
 }
+
+//=======================================================================
+//function : AddPolygonalFace
+//purpose  : 
+//=======================================================================
+SMDS_MeshFace* SMESHDS_Mesh::AddPolygonalFaceWithID (std::vector<int> nodes_ids,
+                                                     const int        ID)
+{
+  SMDS_MeshFace *anElem = SMDS_Mesh::AddPolygonalFaceWithID(nodes_ids, ID);
+  if (anElem) {
+    myScript->AddPolygonalFace(ID, nodes_ids);
+  }
+  return anElem;
+}
+
+SMDS_MeshFace* SMESHDS_Mesh::AddPolygonalFaceWithID
+                             (std::vector<const SMDS_MeshNode*> nodes,
+                              const int                         ID)
+{
+  SMDS_MeshFace *anElem = SMDS_Mesh::AddPolygonalFaceWithID(nodes, ID);
+  if (anElem) {
+    int i, len = nodes.size();
+    std::vector<int> nodes_ids (len);
+    for (i = 0; i < len; i++) {
+      nodes_ids[i] = nodes[i]->GetID();
+    }
+    myScript->AddPolygonalFace(ID, nodes_ids);
+  }
+  return anElem;
+}
+
+SMDS_MeshFace* SMESHDS_Mesh::AddPolygonalFace
+                             (std::vector<const SMDS_MeshNode*> nodes)
+{
+  SMDS_MeshFace *anElem = SMDS_Mesh::AddPolygonalFace(nodes);
+  if (anElem) {
+    int i, len = nodes.size();
+    std::vector<int> nodes_ids (len);
+    for (i = 0; i < len; i++) {
+      nodes_ids[i] = nodes[i]->GetID();
+    }
+    myScript->AddPolygonalFace(anElem->GetID(), nodes_ids);
+  }
+  return anElem;
+}
+
+//=======================================================================
+//function : AddPolyhedralVolume
+//purpose  : 
+//=======================================================================
+SMDS_MeshVolume* SMESHDS_Mesh::AddPolyhedralVolumeWithID (std::vector<int> nodes_ids,
+                                                          std::vector<int> quantities,
+                                                          const int        ID)
+{
+  SMDS_MeshVolume *anElem = SMDS_Mesh::AddPolyhedralVolumeWithID(nodes_ids, quantities, ID);
+  if (anElem) {
+    myScript->AddPolyhedralVolume(ID, nodes_ids, quantities);
+  }
+  return anElem;
+}
+
+SMDS_MeshVolume* SMESHDS_Mesh::AddPolyhedralVolumeWithID
+                               (std::vector<const SMDS_MeshNode*> nodes,
+                                std::vector<int>                  quantities,
+                                const int                         ID)
+{
+  SMDS_MeshVolume *anElem = SMDS_Mesh::AddPolyhedralVolumeWithID(nodes, quantities, ID);
+  if (anElem) {
+    int i, len = nodes.size();
+    std::vector<int> nodes_ids (len);
+    for (i = 0; i < len; i++) {
+      nodes_ids[i] = nodes[i]->GetID();
+    }
+    myScript->AddPolyhedralVolume(ID, nodes_ids, quantities);
+  }
+  return anElem;
+}
+
+SMDS_MeshVolume* SMESHDS_Mesh::AddPolyhedralVolume
+                               (std::vector<const SMDS_MeshNode*> nodes,
+                                std::vector<int>                  quantities)
+{
+  SMDS_MeshVolume *anElem = SMDS_Mesh::AddPolyhedralVolume(nodes, quantities);
+  if (anElem) {
+    int i, len = nodes.size();
+    std::vector<int> nodes_ids (len);
+    for (i = 0; i < len; i++) {
+      nodes_ids[i] = nodes[i]->GetID();
+    }
+    myScript->AddPolyhedralVolume(anElem->GetID(), nodes_ids, quantities);
+  }
+  return anElem;
+}
+
 //=======================================================================
 //function : removeFromContainers
 //purpose  : 
@@ -738,13 +876,14 @@ bool SMESHDS_Mesh::IsGroupOfSubShapes (const TopoDS_Shape& theShape) const
 /// Return the sub mesh linked to the a given TopoDS_Shape or NULL if the given
 /// TopoDS_Shape is unknown
 ///////////////////////////////////////////////////////////////////////////////
-SMESHDS_SubMesh * SMESHDS_Mesh::MeshElements(const TopoDS_Shape & S)
+SMESHDS_SubMesh * SMESHDS_Mesh::MeshElements(const TopoDS_Shape & S) const
 {
   if (myShape.IsNull()) MESSAGE("myShape is NULL");
 
   int Index = ShapeToIndex(S);
-  if (myShapeIndexToSubMesh.find(Index)!=myShapeIndexToSubMesh.end())
-    return myShapeIndexToSubMesh[Index];
+  TShapeIndexToSubMesh::const_iterator anIter = myShapeIndexToSubMesh.find(Index);
+  if (anIter != myShapeIndexToSubMesh.end())
+    return anIter->second;
   else
     return NULL;
 }
@@ -895,7 +1034,7 @@ TopoDS_Shape SMESHDS_Mesh::IndexToShape(int ShapeIndex)
 //function : ShapeToIndex
 //purpose  : 
 //=======================================================================
-int SMESHDS_Mesh::ShapeToIndex(const TopoDS_Shape & S)
+int SMESHDS_Mesh::ShapeToIndex(const TopoDS_Shape & S) const
 {
   if (myShape.IsNull())
     MESSAGE("myShape is NULL");
index 459d30848aa5c34c7d27f0c93419ba460ad45b6e..86b9071c114cac6251169a2ef3d00da43c5b0c06 100644 (file)
@@ -158,12 +158,39 @@ public:
                                     const SMDS_MeshNode * n7,
                                     const SMDS_MeshNode * n8);
   
+  virtual SMDS_MeshFace* AddPolygonalFaceWithID (std::vector<int> nodes_ids,
+                                                 const int        ID);
+
+  virtual SMDS_MeshFace* AddPolygonalFaceWithID (std::vector<const SMDS_MeshNode*> nodes,
+                                                 const int                         ID);
+
+  virtual SMDS_MeshFace* AddPolygonalFace (std::vector<const SMDS_MeshNode*> nodes);
+
+  virtual SMDS_MeshVolume* AddPolyhedralVolumeWithID
+                           (std::vector<int> nodes_ids,
+                            std::vector<int> quantities,
+                            const int        ID);
+
+  virtual SMDS_MeshVolume* AddPolyhedralVolumeWithID
+                           (std::vector<const SMDS_MeshNode*> nodes,
+                            std::vector<int>                  quantities,
+                            const int                         ID);
+
+  virtual SMDS_MeshVolume* AddPolyhedralVolume
+                           (std::vector<const SMDS_MeshNode*> nodes,
+                            std::vector<int>                  quantities);
+
   void MoveNode(const SMDS_MeshNode *, double x, double y, double z);
   virtual void RemoveNode(const SMDS_MeshNode *);
   void RemoveElement(const SMDS_MeshElement *);
   bool ChangeElementNodes(const SMDS_MeshElement * elem,
                           const SMDS_MeshNode    * nodes[],
                           const int                nbnodes);
+  bool ChangePolygonNodes(const SMDS_MeshElement * elem,
+                          std::vector<const SMDS_MeshNode*> nodes);
+  bool ChangePolyhedronNodes(const SMDS_MeshElement * elem,
+                             std::vector<const SMDS_MeshNode*> nodes,
+                             std::vector<int>                  quantities);
   void Renumber (const bool isNodes, const int startID=1, const int deltaID=1);
 
   void SetNodeInVolume(SMDS_MeshNode * aNode, const TopoDS_Shell & S);
@@ -177,7 +204,7 @@ public:
                               const TopoDS_Shape & S);
   TopoDS_Shape ShapeToMesh() const;
   bool HasMeshElements(const TopoDS_Shape & S);
-  SMESHDS_SubMesh * MeshElements(const TopoDS_Shape & S);
+  SMESHDS_SubMesh * MeshElements(const TopoDS_Shape & S) const;
   SMESHDS_SubMesh * MeshElements(const int Index);
   std::list<int> SubMeshIndices();
   const std::map<int,SMESHDS_SubMesh*>& SubMeshes()
@@ -187,7 +214,7 @@ public:
   const std::list<const SMESHDS_Hypothesis*>& GetHypothesis(const TopoDS_Shape & S) const;
   SMESHDS_Script * GetScript();
   void ClearScript();
-  int ShapeToIndex(const TopoDS_Shape & aShape);
+  int ShapeToIndex(const TopoDS_Shape & aShape) const;
   TopoDS_Shape IndexToShape(int ShapeIndex);
 
   SMESHDS_SubMesh * NewSubMesh(int Index);
@@ -219,9 +246,15 @@ private:
 
   int                        myMeshID;
   TopoDS_Shape               myShape;
+
+  typedef std::map<int,SMESHDS_SubMesh*> TShapeIndexToSubMesh;
+  TShapeIndexToSubMesh myShapeIndexToSubMesh;
+
   TopTools_IndexedMapOfShape myIndexToShape;
-  std::map<int,SMESHDS_SubMesh*>  myShapeIndexToSubMesh;
-  std::set<SMESHDS_GroupBase*>    myGroups;
+
+  typedef std::set<SMESHDS_GroupBase*> TGroups;
+  TGroups myGroups;
+
   SMESHDS_Script*            myScript;
 };
 
index 97e158432d20bcfa7f5c2fbc525b29fdcf176e9c..369ab4697cbe43cb4641553849c6ec89ccc0bb3d 100644 (file)
@@ -148,6 +148,27 @@ void SMESHDS_Script::AddVolume(int NewID,
                                                idnode5, idnode6, idnode7, idnode8);
 }
 
+//=======================================================================
+//function : AddPolygonalFace
+//purpose  : 
+//=======================================================================
+void SMESHDS_Script::AddPolygonalFace (int NewFaceID, std::vector<int> nodes_ids)
+{
+  getCommand(SMESHDS_AddPolygon)->AddPolygonalFace(NewFaceID, nodes_ids);
+}
+
+//=======================================================================
+//function : AddPolyhedralVolume
+//purpose  : 
+//=======================================================================
+void SMESHDS_Script::AddPolyhedralVolume (int NewID,
+                                          std::vector<int> nodes_ids,
+                                          std::vector<int> quantities)
+{
+  getCommand(SMESHDS_AddPolyhedron)->AddPolyhedralVolume
+    (NewID, nodes_ids, quantities);
+}
+
 //=======================================================================
 //function : 
 //purpose  : 
@@ -185,6 +206,18 @@ void SMESHDS_Script::ChangeElementNodes(int ElementID, int nodes[], int nbnodes)
   getCommand(SMESHDS_ChangeElementNodes)->ChangeElementNodes( ElementID, nodes, nbnodes );
 }
 
+//=======================================================================
+//function : ChangePolyhedronNodes
+//purpose  : 
+//=======================================================================
+void SMESHDS_Script::ChangePolyhedronNodes (const int        ElementID,
+                                            std::vector<int> nodes_ids,
+                                            std::vector<int> quantities)
+{
+  getCommand(SMESHDS_ChangePolyhedronNodes)->ChangePolyhedronNodes
+    (ElementID, nodes_ids, quantities);
+}
+
 //=======================================================================
 //function : Renumber
 //purpose  : 
index e51d3ec98d3da2e2901b4a596c3b789c23b7c9d6..3874facfcecdc9f895d2eaea615967df5a906035 100644 (file)
@@ -30,6 +30,7 @@
 #include "SMESHDS_Command.hxx"
 
 #include <list>
+#include <vector>
 
 
 class SMESHDS_Script
@@ -48,10 +49,20 @@ class SMESHDS_Script
                int idnode4, int idnode5, int idnode6);
        void AddVolume(int NewVolID, int idnode1, int idnode2, int idnode3,
                int idnode4, int idnode5, int idnode6, int idnode7, int idnode8);
-       void MoveNode(int NewNodeID, double x, double y, double z);
+
+        void AddPolygonalFace (const int NewFaceID,
+                               std::vector<int> nodes_ids);
+       void AddPolyhedralVolume (const int NewVolID,
+                                  std::vector<int> nodes_ids,
+                                  std::vector<int> quantities);
+
+        void MoveNode(int NewNodeID, double x, double y, double z);
        void RemoveNode(int NodeID);
        void RemoveElement(int ElementID);
        void ChangeElementNodes(int ElementID, int nodes[], int nbnodes);
+       void ChangePolyhedronNodes(const int        ElementID,
+                                   std::vector<int> nodes_ids,
+                                   std::vector<int> quantities);
        void Renumber (const bool isNodes, const int startID, const int deltaID);
        void Clear();
        const std::list<SMESHDS_Command*> & GetCommands();
index fa9869176d876f4a4265e928cb182f2d36b78c40..e9c388166552bc17097c66dcba5dee650e653b8b 100644 (file)
@@ -58,14 +58,16 @@ LIB_CLIENT_IDL = SALOME_Exception.idl \
 # header files 
 EXPORT_HEADERS= SMESH_Type.h \
                SMESH_TypeFilter.hxx \
-               Handle_SMESH_TypeFilter.hxx \
                SMESH_NumberFilter.hxx \
                SMESH_LogicalFilter.hxx
 
 # additionnal information to compil and link file
-CPPFLAGS += $(OCC_INCLUDES) $(QT_INCLUDES) $(PYTHON_INCLUDES) $(VTK_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome -I${GEOM_ROOT_DIR}/include/salome
-CXXFLAGS += $(OCC_CXXFLAGS) -I${KERNEL_ROOT_DIR}/include/salome -I${GEOM_ROOT_DIR}/include/salome
-LDFLAGS  += $(OCC_KERNEL_LIBS) -L${GEOM_ROOT_DIR}/lib/salome
+CPPFLAGS += $(OCC_INCLUDES) $(QT_INCLUDES) $(PYTHON_INCLUDES) $(VTK_INCLUDES) \
+            -I${KERNEL_ROOT_DIR}/include/salome -I${GUI_ROOT_DIR}/include/salome \
+            -I${GEOM_ROOT_DIR}/include/salome -I${BOOSTDIR}
+CXXFLAGS += $(OCC_CXXFLAGS) -I${KERNEL_ROOT_DIR}/include/salome -I${GUI_ROOT_DIR}/include/salome \
+            -I${GEOM_ROOT_DIR}/include/salome -I${BOOSTDIR}
+LDFLAGS  += $(OCC_KERNEL_LIBS) -L${GUI_ROOT_DIR}/lib/salome -L${GEOM_ROOT_DIR}/lib/salome -lSalomeApp -lsuit
 
 # additional file to be cleaned
 MOSTLYCLEAN =
@@ -73,4 +75,3 @@ CLEAN =
 DISTCLEAN =
 
 @CONCLUDE@
-
index 47b6356aed42a6d6ebc634da81101d484c02279f..18631a40574dfd62bf207a798aa40b912946c621 100644 (file)
@@ -1,49 +1,17 @@
-//  SALOME SALOMEGUI : implementation of desktop and GUI kernel
-//
-//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
-// 
-//  This library is free software; you can redistribute it and/or 
-//  modify it under the terms of the GNU Lesser General Public 
-//  License as published by the Free Software Foundation; either 
-//  version 2.1 of the License. 
-// 
-//  This library is distributed in the hope that it will be useful, 
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of 
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
-//  Lesser General Public License for more details. 
-// 
-//  You should have received a copy of the GNU Lesser General Public 
-//  License along with this library; if not, write to the Free Software 
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
-// 
-//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
-//
-//
-//              
 //  File   : SMESH_LogicalFilter.cxx
-//  Author : Sergey LITONIN
 //  Module : SMESH
 
 #include "SMESH_LogicalFilter.hxx"
 
-/*
-  Class       : SMESH_LogicalFilter
-  Description : Filter for combaining several filters with logical operation (OR or AND)
-*/
-
-IMPLEMENT_STANDARD_HANDLE( SMESH_LogicalFilter, SALOME_Filter )
-IMPLEMENT_STANDARD_RTTIEXT( SMESH_LogicalFilter, SALOME_Filter )
-
 //=======================================================================
 // name    : SMESH_LogicalFilter::SMESH_LogicalFilter
 // Purpose : Constructor
 //=======================================================================
-SMESH_LogicalFilter::SMESH_LogicalFilter( const SMESH_ListOfFilter& theFilters,
-                                        const int                theLogOp )
+SMESH_LogicalFilter::SMESH_LogicalFilter (const QPtrList<SUIT_SelectionFilter>& theFilters,
+                                          const int                             theLogOp)
 {
-  myFilters = theFilters;
-  myLogOp = theLogOp;
+  setFilters(theFilters); 
+  setOperation(theLogOp);
 }
 
 //=======================================================================
@@ -58,91 +26,56 @@ SMESH_LogicalFilter::~SMESH_LogicalFilter()
 // name    : SMESH_LogicalFilter::IsOk
 // Purpose : Verify validity of entry object
 //=======================================================================
-Standard_Boolean SMESH_LogicalFilter::IsOk( const Handle(SALOME_InteractiveObject)& theIO ) const
+bool SMESH_LogicalFilter::isOk (const SUIT_DataOwner* owner) const
 {
-  SMESH_ListOfFilter::Iterator anIter( myFilters );
-  for ( ; anIter.More(); anIter.Next() )
+  bool res = true;
+  QPtrListIterator<SUIT_SelectionFilter> it (myFilters);
+  SUIT_SelectionFilter* filter;
+  for (; ((filter = it.current()) != 0) && res; ++it)
   {
-    Handle(SALOME_Filter) aFilter = anIter.Value();
-    if ( !aFilter.IsNull() )
-    {
-      if ( myLogOp == LO_OR &&  anIter.Value()->IsOk( theIO ) )
-        return true;
-      if ( myLogOp == LO_AND && !anIter.Value()->IsOk( theIO ) )
-        return false;
-    }
+    if (myOperation == LO_OR && filter->isOk(owner))
+      return true;
+    if (myOperation == LO_AND && !filter->isOk(owner))
+      return false;
+    if (myOperation == LO_NOT)
+      return !filter->isOk(owner);
   }
 
-  return myLogOp == LO_OR ? false : true;
+  return (myOperation != LO_OR);
 }
 
 //=======================================================================
-// name    : SMESH_LogicalFilter::SetFilters
+// name    : SMESH_LogicalFilter::setFilters
 // Purpose : Set new list of filters. Old wilters are removed
 //=======================================================================
-void SMESH_LogicalFilter::SetFilters( const SMESH_ListOfFilter& theFilters )
+void SMESH_LogicalFilter::setFilters (const QPtrList<SUIT_SelectionFilter>& theFilters)
 {
   myFilters = theFilters;
 }
 
 //=======================================================================
-// name    : SMESH_LogicalFilter::SetLogOp
+// name    : SMESH_LogicalFilter::setOperation
 // Purpose : Set logical operation
 //=======================================================================
-void SMESH_LogicalFilter::SetLogOp( const int theLogOp )
+void SMESH_LogicalFilter::setOperation (const int theLogOp)
 {
-  myLogOp = theLogOp;
+  myOperation = theLogOp;
 }
 
 //=======================================================================
-// name    : SMESH_LogicalFilter::GetFilters
+// name    : SMESH_LogicalFilter::getFilters
 // Purpose : Get list of filters
 //=======================================================================
-const SMESH_ListOfFilter& SMESH_LogicalFilter::GetFilters() const
+const QPtrList<SUIT_SelectionFilter> SMESH_LogicalFilter::getFilters() const
 {
   return myFilters;
 }
 
 //=======================================================================
-// name    : SMESH_LogicalFilter::GetLogOp
+// name    : SMESH_LogicalFilter::getOperation
 // Purpose : Get logical operation
 //=======================================================================
-int SMESH_LogicalFilter::GetLogOp() const
+int SMESH_LogicalFilter::getOperation() const
 {
-  return myLogOp;
+  return myOperation;
 }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
index ec10f865b062eb2781fb3cefdd6962ed25e862d6..a453bb13d6efb865bce60376d0f45b5bd07baccd 100644 (file)
-//  SALOME SALOMEGUI : implementation of desktop and GUI kernel
-//
-//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
-// 
-//  This library is free software; you can redistribute it and/or 
-//  modify it under the terms of the GNU Lesser General Public 
-//  License as published by the Free Software Foundation; either 
-//  version 2.1 of the License. 
-// 
-//  This library is distributed in the hope that it will be useful, 
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of 
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
-//  Lesser General Public License for more details. 
-// 
-//  You should have received a copy of the GNU Lesser General Public 
-//  License along with this library; if not, write to the Free Software 
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
-// 
-//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
-//
-//
-//
 //  File   : SMESH_LogicalFilter.hxx
-//  Author : Sergey LITONIN
 //  Module : SMESH
 
 #ifndef _SMESH_LogicalFilter_HeaderFile
 #define _SMESH_LogicalFilter_HeaderFile
 
-#include "SALOME_Filter.hxx"
+#include <SUIT_SelectionFilter.h>
 
-#include <Standard_DefineHandle.hxx>
-#include <NCollection_StdBase.hxx>
-#include <NCollection_DefineList.hxx>
+#include <qptrlist.h>
 
-DEFINE_STANDARD_HANDLE( SMESH_LogicalFilter, SALOME_Filter )
-
-DEFINE_BASECOLLECTION( SMESH_FilterColl, Handle(SALOME_Filter) )
-DEFINE_LIST( SMESH_ListOfFilter, SMESH_FilterColl, Handle(SALOME_Filter) )
-
-
-/*
-  Class       : SMESH_LogicalFilter
-  Description : Filter for combaining several filters with logical operation (OR or AND)
-*/
-
-class SMESH_LogicalFilter : public SALOME_Filter
+class SMESH_LogicalFilter : public SUIT_SelectionFilter
 {
-public:
-
-  enum { LO_OR, LO_AND, LO_UNDEFINED };
+ public:
+  enum { LO_OR, LO_AND, LO_NOT, LO_UNDEFINED };
 
-public:
+ public:
+  SMESH_LogicalFilter (const QPtrList<SUIT_SelectionFilter>&,
+                       const int);
+  virtual ~SMESH_LogicalFilter();
 
-                              SMESH_LogicalFilter( const SMESH_ListOfFilter&, const int  );
+  virtual bool isOk (const SUIT_DataOwner*) const;
 
-
-  virtual                     ~SMESH_LogicalFilter();
-  virtual                     Standard_Boolean IsOk( const Handle(SALOME_InteractiveObject)& ) const;
-
-  void                        SetFilters( const SMESH_ListOfFilter& );
-  void                        SetLogOp( const int );
-  const SMESH_ListOfFilter&    GetFilters() const;
-  int                         GetLogOp() const;
+  void                                 setFilters (const QPtrList<SUIT_SelectionFilter>&);
+  void                                 setOperation (const int);
+  const QPtrList<SUIT_SelectionFilter> getFilters() const;
+  int                                  getOperation() const;
 
 private:
-
-  SMESH_ListOfFilter           myFilters;
-  int                         myLogOp;
-
-public:
-  DEFINE_STANDARD_RTTI( SMESH_LogicalFilter )
+  QPtrList<SUIT_SelectionFilter>  myFilters;
+  int                             myOperation;
 };
 
 #endif
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
index 8a7c43a588a4d6cd3542e86d8f85778495b7dfd5..3f0cd8834bfbc16666048532837aa1941f8c356b 100644 (file)
@@ -1,84 +1,65 @@
-//  SALOME SALOMEGUI : implementation of desktop and GUI kernel
-//
-//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
-// 
-//  This library is free software; you can redistribute it and/or 
-//  modify it under the terms of the GNU Lesser General Public 
-//  License as published by the Free Software Foundation; either 
-//  version 2.1 of the License. 
-// 
-//  This library is distributed in the hope that it will be useful, 
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of 
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
-//  Lesser General Public License for more details. 
-// 
-//  You should have received a copy of the GNU Lesser General Public 
-//  License along with this library; if not, write to the Free Software 
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
-// 
-//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
-//
-//
-//              
 //  File   : SMESH_NumberFilter.cxx
-//  Author : Sergey LITONIN
 //  Module : SMESH
 
 #include "SMESH_NumberFilter.hxx"
+
 #include "GEOMBase.h"
-#include "TopTools_MapOfShape.hxx"
-#include "TopExp_Explorer.hxx"
-#include "SALOME_InteractiveObject.hxx"
-#include "QAD_Application.h"
-#include "QAD_Desktop.h"
 
+#include "SUIT_Application.h"
+#include "SUIT_Session.h"
+
+#include "SalomeApp_Study.h"
+#include "SalomeApp_DataOwner.h"
 
-/*
-  Class       : SMESH_NumberFilter
-  Description : Filter for geom objects.
-                Filter geom objects by number of subshapes of the given type
-*/
+#include "SALOME_InteractiveObject.hxx"
+#include "SALOMEDSClient_SObject.hxx"
+#include "SALOMEDS_SObject.hxx"
+
+#include <TopTools_MapOfShape.hxx>
+#include <TopExp_Explorer.hxx>
 
-IMPLEMENT_STANDARD_HANDLE( SMESH_NumberFilter, SALOME_TypeFilter )
-IMPLEMENT_STANDARD_RTTIEXT( SMESH_NumberFilter, SALOME_TypeFilter )
+/*!
+ *  Class       : SMESH_NumberFilter
+ *  Description : Filter for geom objects.
+ *                Filter geom objects by number of subshapes of the given type
+ */
 
 //=======================================================================
 // name    : SMESH_NumberFilter::SMESH_NumberFilter
 // Purpose : Constructor
 //=======================================================================
-SMESH_NumberFilter::SMESH_NumberFilterconst char*            theKind,
+SMESH_NumberFilter::SMESH_NumberFilter (const char*            theKind,
                                         const TopAbs_ShapeEnum theSubShapeType,
                                         const int              theNumber,
                                         const TopAbs_ShapeEnum theShapeType,
                                         GEOM::GEOM_Object_ptr  theMainObj,
-                                        const bool             theIsClosedOnly )
-: SALOME_TypeFilter( (char*)theKind )
+                                        const bool             theIsClosedOnly)
 {
+  myKind = (char*)theKind;
   mySubShapeType = theSubShapeType;
   myNumber = theNumber;
   myIsClosedOnly = theIsClosedOnly;
-  myShapeTypes.Add( theShapeType );
-  myMainObj = GEOM::GEOM_Object::_duplicate( theMainObj );
+  myShapeTypes.Add(theShapeType);
+  myMainObj = GEOM::GEOM_Object::_duplicate(theMainObj);
 }
 
 //=======================================================================
 // name    : SMESH_NumberFilter::SMESH_NumberFilter
 // Purpose : Constructor
 //=======================================================================
-SMESH_NumberFilter::SMESH_NumberFilterconst char*                 theKind,
+SMESH_NumberFilter::SMESH_NumberFilter (const char*                 theKind,
                                         const TopAbs_ShapeEnum      theSubShapeType,
                                         const int                   theNumber,
                                         const TColStd_MapOfInteger& theShapeTypes,
                                         GEOM::GEOM_Object_ptr       theMainObj,
                                         const bool                  theIsClosedOnly )
-: SALOME_TypeFilter( (char*)theKind )
 {
+  myKind = (char*)theKind;
   mySubShapeType = theSubShapeType;
   myNumber = theNumber;
   myIsClosedOnly = theIsClosedOnly;
   myShapeTypes = theShapeTypes;
-  myMainObj = GEOM::GEOM_Object::_duplicate( theMainObj );
+  myMainObj = GEOM::GEOM_Object::_duplicate(theMainObj);
 }
 
 SMESH_NumberFilter::~SMESH_NumberFilter()
@@ -89,52 +70,53 @@ SMESH_NumberFilter::~SMESH_NumberFilter()
 // name    : SMESH_NumberFilter::SMESH_NumberFilter
 // Purpose : Verify validity of entry object
 //=======================================================================
-Standard_Boolean SMESH_NumberFilter::IsOk( const Handle(SALOME_InteractiveObject)& theObj ) const
+bool SMESH_NumberFilter::isOk (const SUIT_DataOwner* theDataOwner) const
 {
-  if ( theObj.IsNull() || !SALOME_TypeFilter::IsOk( theObj ) )
+  if (!theDataOwner)
     return false;
 
   // Get geom object from IO
-  GEOM::GEOM_Object_var aGeomObj = getGeom( theObj );
-  if ( aGeomObj->_is_nil() )
+  GEOM::GEOM_Object_var aGeomObj = getGeom(theDataOwner);
+  if (aGeomObj->_is_nil())
     return false;
 
   // Get shape from geom object and verify its parameters
   TopoDS_Shape aShape;
-  if ( !GEOMBase::GetShape( aGeomObj, aShape ) ||
-        aShape.IsNull() ||
-        !myShapeTypes.Contains( aShape.ShapeType() ) ||
-        myIsClosedOnly && aShape.ShapeType() == TopAbs_SHELL && !aShape.Closed() )
+  if (!GEOMBase::GetShape(aGeomObj, aShape) ||
+      aShape.IsNull() ||
+      !myShapeTypes.Contains(aShape.ShapeType()))
     return false;
-                        
+
+  if (myIsClosedOnly && aShape.ShapeType() == TopAbs_SHELL && !aShape.Closed())
+    return false;
+
   // Verify whether shape of entry object is sub-shape of myMainObj
-  if ( !myMainObj->_is_nil() )
-  {
+  if (!myMainObj->_is_nil()) {
     TopoDS_Shape aMainShape;
-    if ( !GEOMBase::GetShape( myMainObj, aMainShape ) )
+    if (!GEOMBase::GetShape(myMainObj, aMainShape))
       return false;
 
     bool isFound = false;
     TopAbs_ShapeEnum aShapeType = aShape.ShapeType();
-    TopExp_Explorer anExp( aMainShape, aShapeType );
-    for ( ; anExp.More(); anExp.Next() )
-      if ( anExp.Current() == aShape )
-      {
+    TopExp_Explorer anExp (aMainShape, aShapeType);
+    for (; anExp.More(); anExp.Next()) {
+      if (anExp.Current() == aShape) {
         isFound = true;
         break;
       }
-    if ( !isFound )
+    }
+    if (!isFound)
       return false;
   }
+
   // Verify number of sub-shapes
-  if ( mySubShapeType == TopAbs_SHAPE );
+  if (mySubShapeType == TopAbs_SHAPE);
     return true;
 
-  int nbShapes = 0;
-  TopExp_Explorer anExp2( aShape, mySubShapeType );
+  TopExp_Explorer anExp2 (aShape, mySubShapeType);
   TopTools_MapOfShape aMap;
-  for ( ; anExp2.More(); anExp2.Next() )
-    aMap.Add( anExp2.Current() );
+  for (; anExp2.More(); anExp2.Next())
+    aMap.Add(anExp2.Current());
 
   return myNumber == aMap.Extent();
 }
@@ -143,83 +125,76 @@ Standard_Boolean SMESH_NumberFilter::IsOk( const Handle(SALOME_InteractiveObject
 // name    : SMESH_NumberFilter::getGeom
 // Purpose : Retrieve geom object from SALOME_InteractiveObject
 //=======================================================================
-GEOM::GEOM_Object_ptr SMESH_NumberFilter::getGeom(
-  const Handle(SALOME_InteractiveObject)& theObj ) const
+GEOM::GEOM_Object_ptr SMESH_NumberFilter::getGeom
+  (const SUIT_DataOwner* theDataOwner) const
 {
-  if ( theObj->isComponentType( "GEOM" ) )
-  {
-    Standard_Boolean aRes = Standard_False;
-    GEOM::GEOM_Object_var aGeomObj = GEOMBase::ConvertIOinGEOMObject( theObj, aRes );
-    return aRes ? aGeomObj._retn() : GEOM::GEOM_Object::_nil();
-  }
-  else
-  {
-    // Get geom object corresponding to the mesh
-    SALOMEDS::Study_var aStudy = QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument();
-    SALOMEDS::SObject_var aSO = aStudy->FindObjectID( theObj->getEntry() );
-    if ( aSO->_is_nil() )
-      return GEOM::GEOM_Object::_nil();
-
-    SALOMEDS::ChildIterator_var anIter = aStudy->NewChildIterator( aSO );
-    for( ; anIter->More(); anIter->Next() )
-    {
-      SALOMEDS::SObject_var aSO = anIter->Value();
-      SALOMEDS::SObject_var aRefSO;
-
-      GEOM::GEOM_Object_var aMeshShape = GEOM::GEOM_Object::_narrow(
-        aSO->ReferencedObject( aRefSO )? aRefSO->GetObject() : aSO->GetObject() );
-
-      if ( !aMeshShape->_is_nil() )
-        return aMeshShape._retn();
-    }
+  const SalomeApp_DataOwner* owner =
+    dynamic_cast<const SalomeApp_DataOwner*>(theDataOwner);
+  SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>
+    (SUIT_Session::session()->activeApplication()->activeStudy());
+
+  GEOM::GEOM_Object_var anObj;
+
+  if (!owner || !appStudy)
+    return GEOM::GEOM_Object::_nil();
 
+  _PTR(Study) study = appStudy->studyDS();
+  QString entry = owner->entry();
+
+  _PTR(SObject) aSO(study->FindObjectID(entry.latin1()));
+  if (!aSO)
     return GEOM::GEOM_Object::_nil();
+
+  CORBA::Object_var anObject = _CAST(SObject,aSO)->GetObject();
+  anObj = GEOM::GEOM_Object::_narrow(anObject);
+  if (!CORBA::is_nil(anObj))
+    return anObj._retn();
+
+  // Get geom object corresponding to the mesh
+  _PTR(ChildIterator) anIter = study->NewChildIterator(aSO);
+  for (; anIter->More(); anIter->Next()) {
+    _PTR(SObject) aSO = anIter->Value();
+    if (!aSO)
+      continue;
+    _PTR(SObject) aRefSO;
+    _PTR(SObject) anObj;
+    if (aSO->ReferencedObject(aRefSO))
+      anObj = aRefSO;
+
+    if (!anObj)
+      anObj = aSO;
+
+    anObject = _CAST(SObject,anObj)->GetObject();
+    GEOM::GEOM_Object_var aMeshShape = GEOM::GEOM_Object::_narrow(anObject);
+
+    if (!aMeshShape->_is_nil())
+      return aMeshShape._retn();
   }
-}
 
+  return GEOM::GEOM_Object::_nil();
+}
 
-void SMESH_NumberFilter::SetSubShapeType( const TopAbs_ShapeEnum theSubShapeType )
+void SMESH_NumberFilter::SetSubShapeType (const TopAbs_ShapeEnum theSubShapeType)
 {
   mySubShapeType = theSubShapeType;
 }
 
-void SMESH_NumberFilter::SetNumber( const int theNumber )
+void SMESH_NumberFilter::SetNumber (const int theNumber)
 {
   myNumber = theNumber;
 }
 
-void SMESH_NumberFilter::SetClosedOnly( const bool theIsClosedOnly )
+void SMESH_NumberFilter::SetClosedOnly (const bool theIsClosedOnly)
 {
   myIsClosedOnly = theIsClosedOnly;
 }
 
-void SMESH_NumberFilter::SetShapeType( const TopAbs_ShapeEnum theShapeType )
+void SMESH_NumberFilter::SetShapeType (const TopAbs_ShapeEnum theShapeType)
 {
   myShapeTypes.Add( theShapeType );
 }
 
-void SMESH_NumberFilter::SetMainShape( GEOM::GEOM_Object_ptr theMainObj )
+void SMESH_NumberFilter::SetMainShape (GEOM::GEOM_Object_ptr theMainObj)
 {
-  myMainObj = GEOM::GEOM_Object::_duplicate( theMainObj );
+  myMainObj = GEOM::GEOM_Object::_duplicate(theMainObj);
 }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
index a4fc8df16dee84428b30ff952cb7c722f141894e..6b341129374162fae8959a730f6e289440bff7f9 100644 (file)
-//  SALOME SALOMEGUI : implementation of desktop and GUI kernel
-//
-//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
-// 
-//  This library is free software; you can redistribute it and/or 
-//  modify it under the terms of the GNU Lesser General Public 
-//  License as published by the Free Software Foundation; either 
-//  version 2.1 of the License. 
-// 
-//  This library is distributed in the hope that it will be useful, 
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of 
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
-//  Lesser General Public License for more details. 
-// 
-//  You should have received a copy of the GNU Lesser General Public 
-//  License along with this library; if not, write to the Free Software 
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
-// 
-//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
-//
-//
-//
 //  File   : SMESH_NumberFilter.hxx
-//  Author : Sergey LITONIN
 //  Module : SMESH
 
 #ifndef _SMESH_NumberFilter_HeaderFile
 #define _SMESH_NumberFilter_HeaderFile
 
-#include <Standard_DefineHandle.hxx>
-#include "SALOME_TypeFilter.hxx"
+#include "SUIT_SelectionFilter.h"
+
 #include <TopAbs_ShapeEnum.hxx>
 #include <TColStd_MapOfInteger.hxx>
 
 #include <SALOMEconfig.h>
-#include CORBA_SERVER_HEADER(SMESH_Mesh)
 #include CORBA_SERVER_HEADER(GEOM_Gen)
 
-DEFINE_STANDARD_HANDLE( SMESH_NumberFilter, SALOME_TypeFilter )
-
-/*
-  Class       : SMESH_NumberFilter
-  Description : Filter for geom or smesh objects.
-                Filter geom objects by number of subshapes of the given type
-                Parameters of constructor:
-                * theSubShapeType - Type of subshape
-                * theNumber       - Number of subshapes. Object is selected if it contains theNumber of
-                                    theSubShapeType sub-shapes
-                * theShapeType    - This map specifies types of object to be selected
-                * theMainObject   - Sub-shapes of this object is selected only
-                * theIsClosedOnly - Closed shapes is selected if this parameter is true
-*/
-class SMESH_NumberFilter : public SALOME_TypeFilter
+class SUIT_DataOwner;
+
+/*!
 Class       : SMESH_NumberFilter
 Description : Filter for geom or smesh objects.
               Filter geom objects by number of subshapes of the given type
               Parameters of constructor:
               * theSubShapeType - Type of subshape
               * theNumber       - Number of subshapes. Object is selected if it contains theNumber of
                                   theSubShapeType sub-shapes
               * theShapeType    - This map specifies types of object to be selected
               * theMainObject   - Sub-shapes of this object is selected only
               * theIsClosedOnly - Closed shapes is selected if this parameter is true
+ */
+class SMESH_NumberFilter : public SUIT_SelectionFilter
 {
-
-public:
-
-                        SMESH_NumberFilter( const char*            theKind,
-                                            const TopAbs_ShapeEnum theSubShapeType,
-                                            const int              theNumber,
-                                            const TopAbs_ShapeEnum theShapeType = TopAbs_SHAPE,
-                                            GEOM::GEOM_Object_ptr  theMainObj = GEOM::GEOM_Object::_nil(),
-                                            const bool             theIsClosedOnly = false );
-
-                        SMESH_NumberFilter( const char*                 theKind,
-                                            const TopAbs_ShapeEnum      theSubShapeType,
-                                            const int                   theNumber,
-                                            const TColStd_MapOfInteger& theShapeTypes,
-                                            GEOM::GEOM_Object_ptr       theMainObj = GEOM::GEOM_Object::_nil(),
-                                            const bool                  theIsClosedOnly = false );
-                                        
-  virtual               ~SMESH_NumberFilter();
-  virtual               Standard_Boolean IsOk( const Handle(SALOME_InteractiveObject)& ) const;
-  
-  void                  SetSubShapeType( const TopAbs_ShapeEnum );
-  void                  SetNumber( const int );
-  void                  SetClosedOnly( const bool );
-  void                  SetShapeType( const TopAbs_ShapeEnum );
-  void                  SetShapeTypes( const TColStd_MapOfInteger& );
-  void                  SetMainShape( GEOM::GEOM_Object_ptr );
-
-private:
-  GEOM::GEOM_Object_ptr getGeom( const Handle(SALOME_InteractiveObject)& theObj ) const;
-
-                                  
-private:
+ public:
+  SMESH_NumberFilter (const char*            theKind,
+                      const TopAbs_ShapeEnum theSubShapeType,
+                      const int              theNumber,
+                      const TopAbs_ShapeEnum theShapeType = TopAbs_SHAPE,
+                      GEOM::GEOM_Object_ptr  theMainObj = GEOM::GEOM_Object::_nil(),
+                      const bool             theIsClosedOnly = false );
+
+  SMESH_NumberFilter (const char*                 theKind,
+                      const TopAbs_ShapeEnum      theSubShapeType,
+                      const int                   theNumber,
+                      const TColStd_MapOfInteger& theShapeTypes,
+                      GEOM::GEOM_Object_ptr       theMainObj = GEOM::GEOM_Object::_nil(),
+                      const bool                  theIsClosedOnly = false );
+
+  virtual ~SMESH_NumberFilter();
+
+  virtual bool isOk (const SUIT_DataOwner*) const;
+
+  void SetSubShapeType (const TopAbs_ShapeEnum);
+  void SetNumber       (const int);
+  void SetClosedOnly   (const bool);
+  void SetShapeType    (const TopAbs_ShapeEnum);
+  void SetShapeTypes   (const TColStd_MapOfInteger&);
+  void SetMainShape    (GEOM::GEOM_Object_ptr);
+
+ private:
+  GEOM::GEOM_Object_ptr getGeom (const SUIT_DataOwner*) const;
+
+ private:
+  char*                 myKind;
   TopAbs_ShapeEnum      mySubShapeType;
   int                   myNumber;
   bool                  myIsClosedOnly;
   TColStd_MapOfInteger  myShapeTypes;
   GEOM::GEOM_Object_var myMainObj;
-  
-public:
-  DEFINE_STANDARD_RTTI( SMESH_NumberFilter )
 };
 
 #endif
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
index a3ba79fa06320a7e1ef7a2d5a967057c21cee1dc..f80b9cc2808a78b52795b2d1fd46234e3e0e16e2 100644 (file)
@@ -7,6 +7,9 @@
 //  Copyright : Open CASCADE 2002
 //  $Header$
 
+#ifndef SMESH_TYPE_HEADER
+#define SMESH_TYPE_HEADER
+
 enum MeshObjectType {
   HYPOTHESIS,
   ALGORITHM,
@@ -20,3 +23,5 @@ enum MeshObjectType {
   SUBMESH_COMPOUND,
   GROUP
 };
+
+#endif
index 9f17ae1b4e0f5d40ff6a9821af3ef69f10d2380b..5e98287df5541ea4724d70b505dc72a3e64c321d 100644 (file)
@@ -1,44 +1,38 @@
-//  File      : SMESH_TypeFilter.cxx
-//  Created   : Fri Dec 07 09:57:24 2001
-//  Author    : Nicolas REJNERI
-//  Project   : SALOME
-//  Module    : SMESH
-//  Copyright : Open CASCADE
-//  $Header$
+#include "SMESH_TypeFilter.hxx"
 
-#include "SMESH_TypeFilter.ixx"
+#include <SUIT_Session.h>
 
-#include "SALOME_InteractiveObject.hxx"
-#include "SALOME_TypeFilter.hxx"
+#include <SalomeApp_Study.h>
+#include <SalomeApp_DataOwner.h>
 
-#include "utilities.h"
-#include "QAD_Application.h"
-#include "QAD_Desktop.h"
-#include "QAD_Study.h"
-
-using namespace std;
-
-SMESH_TypeFilter::SMESH_TypeFilter(MeshObjectType aType) 
+SMESH_TypeFilter::SMESH_TypeFilter (MeshObjectType theType) 
 {
-  myKind = aType;
+  myType = theType;
 }
 
-Standard_Boolean SMESH_TypeFilter::IsOk(const Handle(SALOME_InteractiveObject)& anObj) const 
+SMESH_TypeFilter::~SMESH_TypeFilter() 
 {
-  Handle(SALOME_TypeFilter) meshFilter = new SALOME_TypeFilter( "SMESH" );
-  if ( !meshFilter->IsOk(anObj) ) 
-    return false;
+}
 
+bool SMESH_TypeFilter::isOk (const SUIT_DataOwner* theDataOwner) const
+{
   bool Ok = false;
 
-  if ( anObj->hasEntry() ) {
-    QAD_Study* ActiveStudy = QAD_Application::getDesktop()->getActiveStudy();
-    SALOMEDS::Study_var aStudy = ActiveStudy->getStudyDocument();
-    SALOMEDS::SObject_var obj = aStudy->FindObjectID( anObj->getEntry() );
+  const SalomeApp_DataOwner* owner =
+    dynamic_cast<const SalomeApp_DataOwner*>(theDataOwner);
+  SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>
+    (SUIT_Session::session()->activeApplication()->activeStudy());
+
+  if (owner && appStudy) {
+    _PTR(Study) study = appStudy->studyDS();
+    QString entry = owner->entry();
+
+    _PTR(SObject) obj (study->FindObjectID(entry.latin1()));
+    if (!obj) return false;
+
+    _PTR(SObject) objFather = obj->GetFather();
+    _PTR(SComponent) objComponent = obj->GetFatherComponent();
 
-    SALOMEDS::SObject_var objFather = obj->GetFather();
-    SALOMEDS::SComponent_var objComponent = obj->GetFatherComponent();
-    
     int aLevel = obj->Depth() - objComponent->Depth();
 
     // Max level under the component is 4:
@@ -55,10 +49,10 @@ Standard_Boolean SMESH_TypeFilter::IsOk(const Handle(SALOME_InteractiveObject)&
     // 4       |     |- Applied algorithms ( selectable in Use Case Browser )
     //         |- Group Of Nodes
 
-    if ( aLevel <= 0 )
+    if (aLevel <= 0)
       return false;
 
-    switch ( myKind )
+    switch (myType)
       {
       case HYPOTHESIS:
        {
@@ -133,3 +127,8 @@ Standard_Boolean SMESH_TypeFilter::IsOk(const Handle(SALOME_InteractiveObject)&
   }
   return Ok;
 }
+
+MeshObjectType SMESH_TypeFilter::type() const 
+{
+  return myType;
+}
index 9e98ab8b8e2510c762513e8c7217bfb48ab083a8..442d72dadb83e69f3a25a1c3d12287415b7b5b13 100644 (file)
@@ -1,95 +1,25 @@
-// File generated by CPPExt (Transient)
-//
-//                     Copyright (C) 1991,1995 by
-//  
-//                      MATRA DATAVISION, FRANCE
-//  
-// This software is furnished in accordance with the terms and conditions
-// of the contract and with the inclusion of the above copyright notice.
-// This software or any other copy thereof may not be provided or otherwise
-// be made available to any other person. No title to an ownership of the
-// software is hereby transferred.
-//  
-// At the termination of the contract, the software and all copies of this
-// software must be deleted.
-//
+//  File   : SMESH_TypeFilter.hxx
+//  Module : SMESH
+
 #ifndef _SMESH_TypeFilter_HeaderFile
 #define _SMESH_TypeFilter_HeaderFile
 
-#ifndef _Handle_SMESH_TypeFilter_HeaderFile
-#include "Handle_SMESH_TypeFilter.hxx"
-#endif
-
-#include "SALOME_InteractiveObject.hxx"
-#include "SALOME_Filter.hxx"
 #include "SMESH_Type.h"
+#include "SUIT_SelectionFilter.h"
 
-// Open CASCADE Includes
-#include <Standard.hxx>
-
-class SMESH_TypeFilter : public SALOME_Filter {
+class SUIT_DataOwner;
 
+class SMESH_TypeFilter : public SUIT_SelectionFilter
+{
 public:
+  SMESH_TypeFilter (MeshObjectType theType);
+  ~SMESH_TypeFilter();
 
-    inline void* operator new(size_t,void* anAddress) 
-      {
-        return anAddress;
-      }
-    inline void* operator new(size_t size) 
-      { 
-        return Standard::Allocate(size); 
-      }
-    inline void  operator delete(void *anAddress) 
-      { 
-        if (anAddress) Standard::Free((Standard_Address&)anAddress); 
-      }
-//    inline void  operator delete(void *anAddress, size_t size) 
-//      { 
-//        if (anAddress) Standard::Free((Standard_Address&)anAddress,size); 
-//      }
- // Methods PUBLIC
- // 
-Standard_EXPORT SMESH_TypeFilter(MeshObjectType aType);
-Standard_EXPORT virtual  Standard_Boolean IsOk(const Handle(SALOME_InteractiveObject)& anobj) const;
-Standard_EXPORT ~SMESH_TypeFilter();
-
-
-
-
- // Type management
- //
- Standard_EXPORT friend Handle_Standard_Type& SMESH_TypeFilter_Type_();
- Standard_EXPORT const Handle(Standard_Type)& DynamicType() const;
- Standard_EXPORT Standard_Boolean            IsKind(const Handle(Standard_Type)&) const;
+  virtual bool isOk (const SUIT_DataOwner*) const;
+  MeshObjectType type() const;
 
 protected:
-
- // Methods PROTECTED
- // 
-
-
- // Fields PROTECTED
- //
-MeshObjectType myKind;
-
-private: 
-
- // Methods PRIVATE
- // 
-
-
- // Fields PRIVATE
- //
-
-
+  MeshObjectType myType;
 };
 
-
-
-
-
-// other inline functions and methods (like "C++: function call" methods)
-//
-
-
 #endif
index bc02829e315fb45d20b9e7671a0abe498de9e0b0..8c89e17722731e3bd0dd51d5bbb803aee14af11d 100644 (file)
@@ -43,15 +43,16 @@ EXPORT_HEADERS= SMESHGUI_Swig.hxx \
                SMESHGUI_HypothesesUtils.h \
                SMESHGUI_SpinBox.h \
                SMESHGUI_aParameter.h \
-               SMESHGUI_aParameterDlg.h
+               SMESHGUI_aParameterDlg.h \
+               SMESHGUI_Selection.h
 
 # .po files to transform in .qm
 PO_FILES = \
-          SMESH_icons.po \
+          SMESH_images.po \
           SMESH_msg_en.po
 
 # Libraries targets
-LIB = libSMESHGUI.la
+LIB = libSMESH.la
 LIB_SRC =      SMESHGUI.cxx \
                SMESHGUI_PatternWidget.cxx \
                SMESHGUI_CreatePatternDlg.cxx \
@@ -96,7 +97,6 @@ LIB_SRC =     SMESHGUI.cxx \
                SMESHGUI_SewingDlg.cxx \
                SMESHGUI_MergeNodesDlg.cxx \
                SMESHGUI_Utils.cxx \
-               SMESHGUI_SMESHGenUtils.cxx \
                SMESHGUI_GEOMGenUtils.cxx \
                SMESHGUI_MeshUtils.cxx \
                SMESHGUI_GroupUtils.cxx \
@@ -104,7 +104,9 @@ LIB_SRC =   SMESHGUI.cxx \
                SMESHGUI_PatternUtils.cxx \
                SMESHGUI_HypothesesUtils.cxx \
                SMESHGUI_PrecisionDlg.cxx \
-               SMESHGUI_VTKUtils.cxx 
+               SMESHGUI_VTKUtils.cxx \
+               SMESHGUI_Selection.cxx \
+               SMESHGUI_CreatePolyhedralVolumeDlg.cxx 
 
 LIB_MOC = \
                SMESHGUI.h \
@@ -146,7 +148,8 @@ LIB_MOC = \
                SMESHGUI_SymmetryDlg.h \
                SMESHGUI_SewingDlg.h \
                SMESHGUI_PrecisionDlg.h \
-               SMESHGUI_MergeNodesDlg.h
+               SMESHGUI_MergeNodesDlg.h \
+               SMESHGUI_CreatePolyhedralVolumeDlg.h
     
 LIB_CLIENT_IDL = SALOME_Exception.idl \
                 GEOM_Gen.idl \
@@ -171,13 +174,14 @@ LIB_SERVER_IDL =
 #BIN = SMESHBin
 
 CPPFLAGS += $(QT_INCLUDES) $(VTK_INCLUDES) $(OGL_INCLUDES) $(OCC_INCLUDES) $(PYTHON_INCLUDES) \
-            -I${KERNEL_ROOT_DIR}/include/salome -I${GEOM_ROOT_DIR}/include/salome \
-            $(BOOST_CPPFLAGS)
+            -I${KERNEL_ROOT_DIR}/include/salome -I${GUI_ROOT_DIR}/include/salome \
+            -I${GEOM_ROOT_DIR}/include/salome $(BOOST_CPPFLAGS)
 
-CXXFLAGS += -I${KERNEL_ROOT_DIR}/include/salome -I${GEOM_ROOT_DIR}/include/salome
+CXXFLAGS += -I${KERNEL_ROOT_DIR}/include/salome -I${GUI_ROOT_DIR}/include/salome \
+            -I${GEOM_ROOT_DIR}/include/salome
 
 
-LDFLAGS += -lSMESHObject -lSMESHFiltersSelection -lSMDS -lSMESHControls -lDlgRef $(OCC_KERNEL_LIBS) -lTKBO -L${KERNEL_ROOT_DIR}/lib/salome -lVTKViewer -lSalomeGUI -lSalomePrs -lSalomeNS -lqsplitterP -lSalomeLifeCycleCORBA -lOpUtil -lSalomeObject -lEvent -lSALOMELocalTrace -lSalomeVTKFilter -lOCCViewer -L${GEOM_ROOT_DIR}/lib/salome -lGEOMGUI -lGEOMClient -lGEOMFiltersSelection -lGEOMBase -lGEOMObject
+LDFLAGS += -lSMESHObject -lSMESHFiltersSelection -lSMDS -lSMESHControls -lDlgRef $(OCC_KERNEL_LIBS) -lTKBO -L${KERNEL_ROOT_DIR}/lib/salome -L${GUI_ROOT_DIR}/lib/salome -lVTKViewer -lSalomeApp -lSalomePrs -lSalomeNS -lSalomeLifeCycleCORBA -lOpUtil -lSalomeObject -lEvent -lSALOMELocalTrace -lSVTK -lOCCViewer -L${GEOM_ROOT_DIR}/lib/salome -lGEOM -lGEOMClient -lGEOMBase -lGEOMObject
 
 LDFLAGSFORBIN += $(LDFLAGS)
 
index 34c82ee213ee397bdc8dea3f004e8e669432c7c2..21faa6d72de5aa43773c36975af51dcd45defdb3 100644 (file)
@@ -3,11 +3,11 @@
 //  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 
+//  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 
@@ -15,7 +15,7 @@
 // 
 //  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 
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 // 
 //  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
 //
 #include "SMESHGUI_MergeNodesDlg.h"
 #include "SMESHGUI_MeshPatternDlg.h"
 #include "SMESHGUI_PrecisionDlg.h"
+#include "SMESHGUI_Selection.h"
+#include "SMESHGUI_CreatePolyhedralVolumeDlg.h"
 
-#include "VTKViewer_ViewFrame.h"
-#include "VTKViewer_InteractorStyleSALOME.h"
-#include "VTKViewer_RenderWindowInteractor.h"
+#include <SVTK_InteractorStyle.h>
+#include <SVTK_RenderWindowInteractor.h>
 
 #include "SMESH_Actor.h"
 #include "SMESH_Object.h"
-
-#include "QAD.h"
-#include "QAD_Tools.h"
-#include "QAD_Config.h"
-#include "QAD_Settings.h"
-#include "QAD_RightFrame.h"
-#include "QAD_MessageBox.h"
-#include "QAD_Resource.h"
-#include "QAD_FileDlg.h"
-#include "QAD_Desktop.h"
-#include "QAD_ResourceMgr.h"
-#include "QAD_WaitCursor.h"
+#include "SMESH_TypeFilter.hxx"
+
+#include "SUIT_Tools.h"
+#include "SUIT_MessageBox.h"
+#include "SUIT_ResourceMgr.h"
+#include "SUIT_FileDlg.h"
+#include "SUIT_Desktop.h"
+#include "SUIT_ResourceMgr.h"
+#include "SUIT_OverrideCursor.h"
+#include "SUIT_Study.h"
+#include "SUIT_Session.h"
 
 #include "SALOME_NamingService.hxx"
 #include "SALOME_ListIteratorOfListIO.hxx"
 #include "SALOME_InteractiveObject.hxx"
+#include "SALOME_ListIO.hxx"
+#include <SALOME_LifeCycleCORBA.hxx>
+
+#include "OB_Browser.h"
+
+#include "QtxPopupMgr.h"
+
+#include "SalomeApp_Application.h"
+#include "SalomeApp_NameDlg.h"
+#include "SalomeApp_DataOwner.h"
+#include "SalomeApp_ImportOperation.h"
+#include "SalomeApp_Tools.h"
+#include "SalomeApp_Study.h"
+#include "SalomeApp_VTKSelector.h"
 
-#include "SALOMEGUI_Desktop.h"
-#include "SALOMEGUI_NameDlg.h"
-#include "SALOMEGUI_ImportOperation.h"
-#include "SALOMEGUI_QtCatchCorbaException.hxx"
+#include <SVTK_ViewWindow.h>
+#include <SVTK_ViewModel.h>
 
 #include "SMESHGUI_Utils.h"
-#include "SMESHGUI_SMESHGenUtils.h"
 #include "SMESHGUI_GEOMGenUtils.h"
 #include "SMESHGUI_MeshUtils.h"
 #include "SMESHGUI_GroupUtils.h"
 #include <qlist.h>
 #include <qwidget.h>
 #include <qevent.h>
+#include <qaction.h>
 #include <qradiobutton.h>
 
 #include <boost/shared_ptr.hpp>
 
 #include "utilities.h"
 
+#include "SALOMEDS_Study.hxx"
+#include "SALOMEDSClient_StudyBuilder.hxx"
+#include "SALOMEDSClient_SComponent.hxx"
+
 using namespace std;
 
 namespace{
   // Decalarations
   //=============================================================
-  void ImportMeshesFromFile(QAD_Desktop * parent, 
-                           SMESH::SMESH_Gen_ptr theComponentMesh,
+  void ImportMeshesFromFile(SMESH::SMESH_Gen_ptr theComponentMesh,
                            int theCommandID);
 
-  void ExportMeshToFile(QAD_Desktop * parent, int theCommandID);
+  void ExportMeshToFile(int theCommandID);
 
   void SetDisplayMode(int theCommandID);
 
@@ -153,8 +168,7 @@ namespace{
 
   // Definitions
   //=============================================================
-  void ImportMeshesFromFile(QAD_Desktop * parent, 
-                           SMESH::SMESH_Gen_ptr theComponentMesh,
+  void ImportMeshesFromFile(SMESH::SMESH_Gen_ptr theComponentMesh,
                            int theCommandID)
   {
     QStringList filter;
@@ -168,14 +182,14 @@ namespace{
     }else if (theCommandID == 111){
       filter.append(QObject::tr("DAT files (*.dat)"));
     }
-    QString filename = QAD_FileDlg::getFileName(parent,
+    QString filename = SUIT_FileDlg::getFileName(SMESHGUI::desktop(),
                                                "",
                                                filter,
                                                QObject::tr("Import mesh"),
                                                true);
     if(!filename.isEmpty()) {
-      QAD_WaitCursor wc;
-      SALOMEDS::Study_var aStudy = SMESH::GetActiveStudyDocument();
+      SUIT_OverrideCursor wc;
+      _PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
 
       try {
        SMESH::mesh_array_var aMeshes = new SMESH::mesh_array;
@@ -191,13 +205,13 @@ namespace{
            SMESH::DriverMED_ReadStatus res;
            aMeshes = theComponentMesh->CreateMeshesFromMED(filename.latin1(),res);
            if ( res != SMESH::DRS_OK ) {
-             wc.stop();
-             QAD_MessageBox::warn1(QAD_Application::getDesktop(),
+             wc.suspend();
+             SUIT_MessageBox::warn1(SMESHGUI::desktop(),
                                    QObject::tr("SMESH_WRN_WARNING"),
                                    QObject::tr(QString("SMESH_DRS_%1").arg(res)),
                                    QObject::tr("SMESH_BUT_OK"));
              aMeshes->length( 0 );
-             wc.start();
+             wc.resume();
            }
            break;
          }
@@ -205,10 +219,10 @@ namespace{
 
        bool isEmpty = false;
        for ( int i = 0, iEnd = aMeshes->length(); i < iEnd; i++ ) {
-         SALOMEDS::SObject_var aMeshSO = SMESH::FindSObject( aMeshes[i] );
-         if ( !aMeshSO->_is_nil() ) {
-           SALOMEDS::StudyBuilder_var aBuilder = aStudy->NewBuilder();
-           SALOMEDS::AttributePixMap_var aPixmap = SALOMEDS::AttributePixMap::_narrow( aBuilder->FindOrCreateAttribute( aMeshSO, "AttributePixMap" ) );
+         _PTR(SObject) aMeshSO = SMESH::FindSObject( aMeshes[i] );
+         if ( aMeshSO ) {
+           _PTR(StudyBuilder) aBuilder = aStudy->NewBuilder();
+           _PTR(AttributePixMap) aPixmap = aBuilder->FindOrCreateAttribute( aMeshSO, "AttributePixMap" );
            aPixmap->SetPixMap("ICON_SMESH_TREE_MESH_IMPORTED");
            if ( theCommandID == 112 ) // mesh names aren't taken from the file for UNV import
              SMESH::SetName( aMeshSO, QFileInfo(filename).fileName() );
@@ -217,43 +231,50 @@ namespace{
        }
 
        if ( isEmpty ) {
-         wc.stop();
-         QAD_MessageBox::warn1(QAD_Application::getDesktop(),
+         wc.suspend();
+         SUIT_MessageBox::warn1(SMESHGUI::desktop(),
                                QObject::tr("SMESH_WRN_WARNING"),
                                QObject::tr("SMESH_DRS_EMPTY"),
                                QObject::tr("SMESH_BUT_OK"));
-         wc.start();
+         wc.resume();
        }
       }
       catch (const SALOME::SALOME_Exception& S_ex){
-       wc.stop();
-       QtCatchCorbaException(S_ex);
-       wc.start();
+       wc.suspend();
+       SalomeApp_Tools::QtCatchCorbaException(S_ex);
+       wc.resume();
       }
     }
   }
 
 
-  void ExportMeshToFile(QAD_Desktop * parent, int theCommandID)
+  void ExportMeshToFile( int theCommandID )
   {
-    SALOME_Selection *aSel = SALOME_Selection::Selection(SMESH::GetActiveStudy()->getSelection());
-    if(aSel->IObjectCount()){
-      Handle(SALOME_InteractiveObject) anIObject = aSel->firstIObject();
+    SalomeApp_SelectionMgr *aSel = SMESHGUI::selectionMgr();
+    SALOME_ListIO selected;
+    if( aSel )
+      aSel->selectedObjects( selected );
+
+    if(selected.Extent()){
+      Handle(SALOME_InteractiveObject) anIObject = selected.First();
       SMESH::SMESH_Mesh_var aMesh = SMESH::IObjectToInterface<SMESH::SMESH_Mesh>(anIObject);
       if ( !aMesh->_is_nil() ) {
        QString aFilter, aTitle = QObject::tr("Export mesh");
        QMap<QString, SMESH::MED_VERSION> aFilterMap;
        switch ( theCommandID ) {
+       case 125:
        case 122:
          aFilterMap.insert( QObject::tr("MED 2.1 (*.med)"), SMESH::MED_V2_1 );
          aFilterMap.insert( QObject::tr("MED 2.2 (*.med)"), SMESH::MED_V2_2 );
          break;
+       case 124:
        case 121:
          aFilter = QObject::tr("DAT files (*.dat)");
          break;
+       case 126:
        case 123: {
          if(aMesh->NbPyramids()){
-           int aRet = QAD_MessageBox::warn2(QAD_Application::getDesktop(),
+           int aRet = SUIT_MessageBox::warn2(SMESHGUI::desktop(),
                                             QObject::tr("SMESH_WRN_WARNING"),
                                             QObject::tr("SMESH_EXPORT_UNV").arg(anIObject->getName()),
                                             QObject::tr("SMESH_BUT_YES"),
@@ -267,39 +288,55 @@ namespace{
        default:
          return;
        }}
-       
+
        QString aFilename;
        SMESH::MED_VERSION aFormat;
-       
-       if ( theCommandID != 122)
-         aFilename = QAD_FileDlg::getFileName(parent, "", aFilter, aTitle, false);
+
+       if ( theCommandID != 122 && theCommandID != 125 )
+         aFilename = SUIT_FileDlg::getFileName(SMESHGUI::desktop(), "", aFilter, aTitle, false);
        else
          {
            QStringList filters;
            for ( QMap<QString, SMESH::MED_VERSION>::const_iterator it = aFilterMap.begin(); it != aFilterMap.end(); ++it )
              filters.push_back( it.key() );
            
-           QAD_FileDlg* fd = new QAD_FileDlg( parent, false, true, true );
+           SUIT_FileDlg* fd = new SUIT_FileDlg( SMESHGUI::desktop(), false, true, true );
            fd->setCaption( aTitle );
            fd->setFilters( filters );
            fd->exec();
            aFilename = fd->selectedFile();
            aFormat = aFilterMap[fd->selectedFilter()];
            delete fd;
+           if( !aFilename.isEmpty()
+               && (aMesh->NbPolygons()>0 or aMesh->NbPolyhedrons()>0) 
+               && aFormat==SMESH::MED_V2_1){
+             int aRet = SUIT_MessageBox::warn2(SMESHGUI::desktop(),
+                                              QObject::tr("SMESH_WRN_WARNING"),
+                                              QObject::tr("SMESH_EXPORT_MED_V2_1").arg(anIObject->getName()),
+                                              QObject::tr("SMESH_BUT_YES"),
+                                              QObject::tr("SMESH_BUT_NO"),
+                                              0,1,0);
+             if(aRet){
+               return;
+             }
+           }
          }
        if ( !aFilename.isEmpty() ) {
          // Check whether the file already exists and delete it if yes
          QFile aFile( aFilename );
          if ( aFile.exists() )
            aFile.remove();
-         QAD_WaitCursor wc;
+         SUIT_OverrideCursor wc;
          switch ( theCommandID ) {
+         case 125:
          case 122:
            aMesh->ExportToMED( aFilename.latin1(), false, aFormat ); // currently, automatic groups are never created
            break;
+         case 124:
          case 121:
            aMesh->ExportDAT( aFilename.latin1() );
            break;
+         case 126:
          case 123:
            aMesh->ExportUNV( aFilename.latin1() );
            break;
@@ -309,8 +346,8 @@ namespace{
        }
       }
     }
-  }  
-  
+  }
+
   inline void InverseEntityMode(unsigned int& theOutputMode,
                                unsigned int theMode)
   {
@@ -322,9 +359,13 @@ namespace{
   }
 
   void SetDisplayEntity(int theCommandID){
-    SALOME_Selection *Sel = SALOME_Selection::Selection(SMESH::GetActiveStudy()->getSelection());
-    if(Sel->IObjectCount() >= 1){
-      SALOME_ListIteratorOfListIO It(Sel->StoredIObjects());
+    SalomeApp_SelectionMgr *aSel = SMESHGUI::selectionMgr();
+    SALOME_ListIO selected;
+    if( aSel )
+      aSel->selectedObjects( selected );
+
+    if(selected.Extent() >= 1){
+      SALOME_ListIteratorOfListIO It( selected );
       for(; It.More(); It.Next()){
        Handle(SALOME_InteractiveObject) IObject = It.Value();
        if(IObject->hasEntry()){
@@ -353,20 +394,24 @@ namespace{
   }
 
   void SetDisplayMode(int theCommandID){
-    SALOME_Selection *Sel = SALOME_Selection::Selection(SMESH::GetActiveStudy()->getSelection());
-    if(Sel->IObjectCount() >= 1){
+    SalomeApp_SelectionMgr *aSel = SMESHGUI::selectionMgr();
+    SALOME_ListIO selected;
+    if( aSel )
+      aSel->selectedObjects( selected );
+
+    if(selected.Extent() >= 1){
       switch(theCommandID){
       case 1134:{
        SMESHGUI::GetSMESHGUI()->EmitSignalDeactivateDialog();
-       new SMESHGUI_ClippingDlg(QAD_Application::getDesktop(),"",false);
+       new SMESHGUI_ClippingDlg( SMESHGUI::GetSMESHGUI(), "", false );
        return;
       }
       case 1133:{
        SMESHGUI::GetSMESHGUI()->EmitSignalDeactivateDialog();
-       new SMESHGUI_TransparencyDlg(QAD_Application::getDesktop(),"",false);
+       new SMESHGUI_TransparencyDlg( SMESHGUI::desktop(), "", false );
        return;
       }}
-      SALOME_ListIteratorOfListIO It(Sel->StoredIObjects());
+      SALOME_ListIteratorOfListIO It( selected );
       for(; It.More(); It.Next()){
        Handle(SALOME_InteractiveObject) IObject = It.Value();
        if(IObject->hasEntry()){
@@ -379,7 +424,7 @@ namespace{
              anActor->SetRepresentation(SMESH_Actor::eSurface);
              break;
            case 213:
-             if(anActor->IsShrunk()) 
+             if(anActor->IsShrunk())
                anActor->UnShrink();
              else
                anActor->SetShrink();
@@ -394,36 +439,36 @@ namespace{
              int c1 = int (color[1] * 255);
              int c2 = int (color[2] * 255);
              QColor c(c0, c1, c2);
-             
+
              float edgecolor[3];
              anActor->GetEdgeColor(edgecolor[0], edgecolor[1], edgecolor[2]);
              c0 = int (edgecolor[0] * 255);
              c1 = int (edgecolor[1] * 255);
              c2 = int (edgecolor[2] * 255);
              QColor e(c0, c1, c2);
-             
+
              float backfacecolor[3];
              anActor->GetBackSufaceColor(backfacecolor[0], backfacecolor[1], backfacecolor[2]);
              c0 = int (backfacecolor[0] * 255);
              c1 = int (backfacecolor[1] * 255);
              c2 = int (backfacecolor[2] * 255);
              QColor b(c0, c1, c2);
-             
+
              float nodecolor[3];
              anActor->GetNodeColor(nodecolor[0], nodecolor[1], nodecolor[2]);
              c0 = int (nodecolor[0] * 255);
              c1 = int (nodecolor[1] * 255);
              c2 = int (nodecolor[2] * 255);
              QColor n(c0, c1, c2);
-             
+
              int Edgewidth = (int)anActor->GetLineWidth();
              if(Edgewidth == 0)
                Edgewidth = 1;
              int intValue = int(anActor->GetNodeSize());
              float Shrink = anActor->GetShrinkFactor();
-             
-             SMESHGUI_Preferences_ColorDlg *aDlg = 
-               new SMESHGUI_Preferences_ColorDlg(QAD_Application::getDesktop(),"");
+
+             SMESHGUI_Preferences_ColorDlg *aDlg =
+               new SMESHGUI_Preferences_ColorDlg(SMESHGUI::desktop(),"");
              aDlg->SetColor(1, c);
              aDlg->SetColor(2, e);
              aDlg->SetColor(3, n);
@@ -438,27 +483,27 @@ namespace{
                QColor backfacecolor = aDlg->GetColor(4);
                /* actor color and backface color */
                anActor->SetSufaceColor(float (color.red()) / 255.,
-                                        float (color.green()) / 255., 
+                                        float (color.green()) / 255.,
                                         float (color.blue()) / 255.);
-               anActor->SetBackSufaceColor(float (backfacecolor.red()) / 255., 
+               anActor->SetBackSufaceColor(float (backfacecolor.red()) / 255.,
                                             float (backfacecolor.green()) / 255.,
                                             float (backfacecolor.blue()) / 255.);
-               
+
                /* edge color */
                anActor->SetEdgeColor(float (edgecolor.red()) / 255.,
                                       float (edgecolor.green()) / 255.,
                                       float (edgecolor.blue()) / 255.);
-               
+
                /* Shrink factor and size edges */
                anActor->SetShrinkFactor(aDlg->GetIntValue(3) / 100.);
                anActor->SetLineWidth(aDlg->GetIntValue(1));
-               
+
                /* Nodes color and size */
                anActor->SetNodeColor(float (nodecolor.red()) / 255.,
                               float (nodecolor.green()) / 255.,
                                       float (nodecolor.blue()) / 255.);
                anActor->SetNodeSize(aDlg->GetIntValue(2));
-               
+
                delete aDlg;
              }
              break;
@@ -473,94 +518,59 @@ namespace{
 
   void SetDisplaySettings()
   {
+    SUIT_ResourceMgr* mgr = SMESHGUI::resourceMgr();
+    if( !mgr )
+      return;
+
     SMESHGUI::GetSMESHGUI()->EmitSignalDeactivateDialog();
     SMESHGUI_Preferences_ColorDlg *aDlg =
-      new SMESHGUI_Preferences_ColorDlg(QAD_Application::getDesktop(), "");
-
-    QColor color;
-    QString SCr, SCg, SCb;
-    SCr = QAD_CONFIG->getSetting("SMESH:SettingsFillColorRed");
-    SCg = QAD_CONFIG->getSetting("SMESH:SettingsFillColorGreen");
-    SCb = QAD_CONFIG->getSetting("SMESH:SettingsFillColorBlue");
-    if (!SCr.isEmpty() && !SCg.isEmpty() && !SCb.isEmpty())
-      color = QColor(SCr.toInt(), SCg.toInt(), SCb.toInt());
-    else color = QColor(0, 170, 255);
+      new SMESHGUI_Preferences_ColorDlg(SMESHGUI::desktop(), "");
+
+    QColor color = mgr->colorValue( "SMESH", "SettingsFillColor", QColor(0, 170, 255) );
     aDlg->SetColor(1, color);
-    
-    SCr = QAD_CONFIG->getSetting("SMESH:SettingsOutlineColorRed");
-    SCg = QAD_CONFIG->getSetting("SMESH:SettingsOutlineColorGreen");
-    SCb = QAD_CONFIG->getSetting("SMESH:SettingsOutlineColorBlue");
-    if (!SCr.isEmpty() && !SCg.isEmpty() && !SCb.isEmpty())
-      color = QColor(SCr.toInt(), SCg.toInt(), SCb.toInt());
-    else color = QColor(0, 170, 255);
+
+    color = mgr->colorValue( "SMESH", "SettingsOutlineColor", QColor(0, 170, 255) );
     aDlg->SetColor(2, color);
-    
-    SCr = QAD_CONFIG->getSetting("SMESH:SettingsNodeColorRed");
-    SCg = QAD_CONFIG->getSetting("SMESH:SettingsNodeColorGreen");
-    SCb = QAD_CONFIG->getSetting("SMESH:SettingsNodeColorBlue");
-    if (!SCr.isEmpty() && !SCg.isEmpty() && !SCb.isEmpty())
-      color = QColor(SCr.toInt(), SCg.toInt(), SCb.toInt());
-    else color = Qt::red;
+
+    color = mgr->colorValue( "SMESH", "SettingsNodeColor", Qt::red );
     aDlg->SetColor(3, color);
-    
-    QString SBr = QAD_CONFIG->getSetting("SMESH:SettingsBackFaceColorRed");
-    QString SBg = QAD_CONFIG->getSetting("SMESH:SettingsBackFaceColorGreen");
-    QString SBb = QAD_CONFIG->getSetting("SMESH:SettingsBackFaceColorBlue");
-    if (!SCr.isEmpty() && !SCg.isEmpty() && !SCb.isEmpty())
-      color = QColor(SBr.toInt(), SBg.toInt(), SBb.toInt());
-    else color = Qt::blue;
+
+    color = mgr->colorValue( "SMESH", "SettingsBackFaceColor", Qt::blue );
     aDlg->SetColor(4, color);
-    
-    QString intValue = QAD_CONFIG->getSetting("SMESH:SettingsWidth");
-    if (intValue.isEmpty()) intValue = "1";
-    aDlg->SetIntValue(1, intValue.toInt());
-    intValue = QAD_CONFIG->getSetting("SMESH:SettingsNodesSize");
-    if (intValue.isEmpty()) intValue = "3";
-    aDlg->SetIntValue(2, intValue.toInt());
-    intValue = QAD_CONFIG->getSetting("SMESH:SettingsShrinkCoeff");
-    if (intValue.isEmpty()) intValue = "75";
-    aDlg->SetIntValue(3, intValue.toInt());
-    
+
+    int iVal = mgr->integerValue( "SMESH", "SettingsWidth", 1 );
+    aDlg->SetIntValue(1, iVal);
+
+    iVal = mgr->integerValue( "SMESH", "SettingsNodesSize", 3 );
+    aDlg->SetIntValue(2, iVal);
+
+    iVal = mgr->integerValue( "SMESH", "SettingsShrinkCoeff", 75 );
+    aDlg->SetIntValue(3, iVal);
+
     if (aDlg->exec()) {
-      QColor colorFill = aDlg->GetColor(1);
-      QAD_CONFIG->addSetting("SMESH:SettingsFillColorRed", colorFill.red());
-      QAD_CONFIG->addSetting("SMESH:SettingsFillColorGreen", colorFill.green());
-      QAD_CONFIG->addSetting("SMESH:SettingsFillColorBlue", colorFill.blue());
-      
-      QColor colorOutline = aDlg->GetColor(2);
-      QAD_CONFIG->addSetting("SMESH:SettingsOutlineColorRed", colorOutline.red());
-      QAD_CONFIG->addSetting("SMESH:SettingsOutlineColorGreen", colorOutline.green());
-      QAD_CONFIG->addSetting("SMESH:SettingsOutlineColorBlue", colorOutline.blue());
-      
-      QColor colorNode = aDlg->GetColor(3);
-      QAD_CONFIG->addSetting("SMESH:SettingsNodeColorRed", colorNode.red());
-      QAD_CONFIG->addSetting("SMESH:SettingsNodeColorGreen", colorNode.green());
-      QAD_CONFIG->addSetting("SMESH:SettingsNodeColorBlue", colorNode.blue());
-      
-      QColor colorBackFace = aDlg->GetColor(4);
-      QAD_CONFIG->addSetting("SMESH:SettingsBackFaceColorRed", colorBackFace.red());
-      QAD_CONFIG->addSetting("SMESH:SettingsBackFaceColorGreen", colorBackFace.green());
-      QAD_CONFIG->addSetting("SMESH:SettingsBackFaceColorBlue", colorBackFace.blue());
-      
-      int width = aDlg->GetIntValue(1);
-      QAD_CONFIG->addSetting("SMESH:SettingsWidth", width);
-      
-      int nodes_size = aDlg->GetIntValue(2);
-      QAD_CONFIG->addSetting("SMESH:SettingsNodesSize", nodes_size);
-      
-      int shrink_coeff = aDlg->GetIntValue(3);
-      QAD_CONFIG->addSetting("SMESH:SettingsShrinkCoeff", shrink_coeff);
+      mgr->setValue( "SMESH", "SettingsFillColor", aDlg->GetColor(1) );
+      mgr->setValue( "SMESH", "SettingsOutlineColor", aDlg->GetColor(2) );
+      mgr->setValue( "SMESH", "SettingsNodeColor", aDlg->GetColor(3) );
+      mgr->setValue( "SMESH", "SettingsBackFaceColor", aDlg->GetColor(4) );
+
+      mgr->setValue( "SMESH", "SettingsWidth", aDlg->GetIntValue(1) );
+      mgr->setValue( "SMESH", "SettingsNodesSize", aDlg->GetIntValue(2) );
+      mgr->setValue( "SMESH", "SettingsShrinkCoeff", aDlg->GetIntValue(3) );
     }
     
     delete aDlg;
   }
-  
+
   
   void Control( int theCommandID )
   {
-    SALOME_Selection *Sel = SALOME_Selection::Selection( SMESH::GetActiveStudy()->getSelection() );
-    if(Sel){
-      Handle(SALOME_InteractiveObject) anIO = Sel->firstIObject();
+    SalomeApp_SelectionMgr *aSel = SMESHGUI::selectionMgr();
+    SALOME_ListIO selected;
+    if( aSel )
+      aSel->selectedObjects( selected );
+
+    if( !selected.IsEmpty() ){
+      Handle(SALOME_InteractiveObject) anIO = selected.First();
       if(!anIO.IsNull()){
        QString aTitle;
        SMESH_Actor::eControl aControl = SMESH_Actor::eNone;
@@ -625,7 +635,7 @@ namespace{
       }
     }
   }
-  
+
 
   bool CheckOIType(const Handle(SALOME_InteractiveObject) & theIO,
                   MeshObjectType                           theType,
@@ -633,25 +643,31 @@ namespace{
                   QString &                                theOutTypeName)
   {
     SMESH_TypeFilter aTypeFilter( theType );
-    if ( aTypeFilter.IsOk( theIO )) {
-      theOutTypeName = theInTypeName;
-      return true;
+    QString entry;
+    if( !theIO.IsNull() )
+    {
+      entry = theIO->getEntry();
+      SalomeApp_DataOwner owner( entry );
+      if ( aTypeFilter.isOk( &owner )) {
+        theOutTypeName = theInTypeName;
+        return true;
+      }
     }
     return false;
   }
-    
+
 
   QString CheckTypeObject(const Handle(SALOME_InteractiveObject) & theIO)
   {
-    SALOMEDS::Study_var aStudy = SMESH::GetActiveStudyDocument();
-    SALOMEDS::SObject_var aSObj = aStudy->FindObjectID(theIO->getEntry());
-    if (!aSObj->_is_nil()) {
-      SALOMEDS::SComponent_var aSComp = aSObj->GetFatherComponent();
-      CORBA::String_var anID = aSComp->GetID();
+    _PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
+    _PTR(SObject) aSObj = aStudy->FindObjectID(theIO->getEntry());
+    if (aSObj) {
+      _PTR(SComponent) aSComp = aSObj->GetFatherComponent();
+      CORBA::String_var anID = aSComp->GetID().c_str();
       if (!strcmp(anID.in(),theIO->getEntry()))
        return "Component";
     }
-    
+
     QString aTypeName;
     if (
        CheckOIType ( theIO, HYPOTHESIS,    "Hypothesis", aTypeName ) ||
@@ -661,25 +677,21 @@ namespace{
        CheckOIType ( theIO, GROUP,         "Group",      aTypeName )
        )
       return aTypeName;
-    
+
     return "NoType";
   }
 
 
   QString CheckHomogeneousSelection()
   {
-    QAD_Study* aStudy = SMESH::GetActiveStudy();
-    SALOME_Selection *aSel = SALOME_Selection::Selection(aStudy->getSelection());
-    /* copy the list */
-    SALOME_ListIO List;
-    SALOME_ListIteratorOfListIO Itinit(aSel->StoredIObjects());
-    for (; Itinit.More(); Itinit.Next())
-      {
-       List.Append(Itinit.Value());
-      }
-
-    QString RefType = CheckTypeObject(aSel->firstIObject());
-    SALOME_ListIteratorOfListIO It(List);
+    //SUIT_Study* aStudy = SMESH::GetActiveStudy();
+    SalomeApp_SelectionMgr *aSel = SMESHGUI::selectionMgr();
+    SALOME_ListIO selected;
+    if( aSel )
+      aSel->selectedObjects( selected );
+
+    QString RefType = CheckTypeObject(selected.First());
+    SALOME_ListIteratorOfListIO It(selected);
     for (; It.More(); It.Next())
       {
        Handle(SALOME_InteractiveObject) IObject = It.Value();
@@ -687,87 +699,91 @@ namespace{
        if (Type.compare(RefType) != 0)
          return "Heterogeneous Selection";
       }
-    
-    aSel->ClearIObjects();
-    SALOME_ListIteratorOfListIO It1(List);
-    for (; It1.More(); It1.Next())
-      {
-       int res = aSel->AddIObject(It1.Value());
-       if (res == -1)
-         aStudy->highlight(It1.Value(), false);
-       if (res == 0)
-         aStudy->highlight(It1.Value(), true);
-      }
+
     return RefType;
   }
 
   void OnEditDelete()
   {
     // VSR 17/11/04: check if all objects selected belong to SMESH component --> start
-    QString aParentComponent = ((SALOMEGUI_Desktop*)QAD_Application::getDesktop())->getComponentFromSelection();
-    if ( aParentComponent != QAD_Application::getDesktop()->getActiveComponent() )  {
-      QAD_MessageBox::warn1 ( QAD_Application::getDesktop(),
-                             QObject::tr("ERR_ERROR"), 
-                             QObject::tr("NON_SMESH_OBJECTS_SELECTED").arg(QAD_Application::getDesktop()->getComponentUserName( "SMESH" )),
+    SalomeApp_SelectionMgr* aSel = SMESHGUI::selectionMgr();
+    SALOME_ListIO selected; aSel->selectedObjects( selected );
+
+    QString aParentComponent = QString::null;
+    for( SALOME_ListIteratorOfListIO anIt( selected ); anIt.More(); anIt.Next() )
+    {
+      QString cur = anIt.Value()->getComponentDataType();
+      if( aParentComponent.isNull() )
+        aParentComponent = cur;
+      else if( !aParentComponent.isEmpty() && aParentComponent!=cur )
+        aParentComponent = "";
+    }
+
+    if ( aParentComponent != SMESHGUI::GetSMESHGUI()->name() )  {
+      SUIT_MessageBox::warn1 ( SMESHGUI::desktop(),
+                             QObject::tr("ERR_ERROR"),
+                             QObject::tr("NON_SMESH_OBJECTS_SELECTED").arg( SMESHGUI::GetSMESHGUI()->moduleName() ),
                              QObject::tr("BUT_OK") );
       return;
     }
     // VSR 17/11/04: check if all objects selected belong to SMESH component <-- finish
-    if (QAD_MessageBox::warn2
-       (QAD_Application::getDesktop(),
+    if (SUIT_MessageBox::warn2
+       (SMESHGUI::desktop(),
         QObject::tr("SMESH_WRN_WARNING"),
         QObject::tr("SMESH_REALLY_DELETE"),
         QObject::tr("SMESH_BUT_YES"), QObject::tr("SMESH_BUT_NO"), 1, 0, 0) != 1)
       return;
 
-    QAD_Study* anActiveStudy = SMESH::GetActiveStudy();
-    int nbSf = anActiveStudy->getStudyFramesCount();
-    
-    SALOMEDS::Study_var aStudy = SMESH::GetActiveStudyDocument();
-    SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder();
-    SALOMEDS::GenericAttribute_var anAttr;
-    SALOMEDS::AttributeIOR_var anIOR;
-    
-    SALOME_Selection *Sel = SALOME_Selection::Selection(anActiveStudy->getSelection());
-    SALOME_ListIteratorOfListIO It(Sel->StoredIObjects());
+    SalomeApp_Application* anApp = dynamic_cast<SalomeApp_Application*>( SUIT_Session::session()->activeApplication() );
+    SUIT_ViewManager* vm = anApp->activeViewManager();
+    int nbSf = vm->getViewsCount();
+
+    _PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
+    _PTR(StudyBuilder) aStudyBuilder = aStudy->NewBuilder();
+    _PTR(GenericAttribute) anAttr;
+    _PTR(AttributeIOR) anIOR;
+
+    SALOME_ListIteratorOfListIO It(selected);
 
     aStudyBuilder->NewCommand();  // There is a transaction
     for(; It.More(); It.Next()){
       Handle(SALOME_InteractiveObject) IObject = It.Value();
       if(IObject->hasEntry()){
-       SALOMEDS::SObject_var SO = aStudy->FindObjectID(IObject->getEntry());
-       
+       _PTR(SObject) SO = aStudy->FindObjectID(IObject->getEntry());
+
        /* Erase child graphical objects */
-       SALOMEDS::ChildIterator_var it = aStudy->NewChildIterator(SO);
+       _PTR(ChildIterator) it = aStudy->NewChildIterator(SO);
        for(it->InitEx(true); it->More(); it->Next()){
-         SALOMEDS::SObject_var CSO = it->Value();
+         _PTR(SObject) CSO = it->Value();
          if(CSO->FindAttribute(anAttr, "AttributeIOR")){
-           anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
-           
+           anIOR = anAttr;
+
+           QPtrVector<SUIT_ViewWindow> aViews = vm->getViews();
            for(int i = 0; i < nbSf; i++){
-             QAD_StudyFrame *sf = anActiveStudy->getStudyFrame(i);
-             CORBA::String_var anEntry = CSO->GetID();
+             SUIT_ViewWindow *sf = aViews[i];
+             CORBA::String_var anEntry = CSO->GetID().c_str();
              if(SMESH_Actor* anActor = SMESH::FindActorByEntry(sf,anEntry.in())){
                SMESH::RemoveActor(sf,anActor);
              }
            }
          }
        }
-       
+
        /* Erase main graphical object */
+       QPtrVector<SUIT_ViewWindow> aViews = vm->getViews();
        for(int i = 0; i < nbSf; i++){
-         QAD_StudyFrame *sf = anActiveStudy->getStudyFrame(i);
+         SUIT_ViewWindow *sf = aViews[i];
          if(SMESH_Actor* anActor = SMESH::FindActorByEntry(sf,IObject->getEntry())){
            SMESH::RemoveActor(sf,anActor);
          }
        }
-       
+
        // Remove object(s) from data structures
-       SALOMEDS::SObject_var obj = aStudy->FindObjectID(IObject->getEntry());
-       if(!obj->_is_nil()){
-         SMESH::SMESH_GroupBase_var aGroup = SMESH::SMESH_GroupBase::_narrow(obj->GetObject());
-         SMESH::SMESH_subMesh_var   aSubMesh = SMESH::SMESH_subMesh::_narrow(obj->GetObject());
-         
+       _PTR(SObject) obj = aStudy->FindObjectID(IObject->getEntry());
+       if(obj){
+         SMESH::SMESH_GroupBase_var aGroup = SMESH::SMESH_GroupBase::_narrow( SMESH::SObjectToObject( obj ) );
+         SMESH::SMESH_subMesh_var   aSubMesh = SMESH::SMESH_subMesh::_narrow( SMESH::SObjectToObject( obj ) );
+
          if ( !aGroup->_is_nil() ) {                          // DELETE GROUP
            SMESH::SMESH_Mesh_var aMesh = aGroup->GetMesh();
            aMesh->RemoveGroup( aGroup );
@@ -778,23 +794,23 @@ namespace{
          }
          else {// default action: remove SObject from the study
            // san - it's no use opening a transaction here until UNDO/REDO is provided in SMESH
-           //QAD_Operation *op = new SALOMEGUI_ImportOperation(myActiveStudy);
+           //SUIT_Operation *op = new SALOMEGUI_ImportOperation(myActiveStudy);
            //op->start();
            aStudyBuilder->RemoveObjectWithChildren( obj );
            //op->finish();
          }
        }
-       
+
       } /* IObject->hasEntry() */
     } /* more/next */
     aStudyBuilder->CommitCommand();
-    
-    /* Clear any previous selection */
-    Sel->ClearIObjects();
-    anActiveStudy->updateObjBrowser();
-  }
 
+    /* Clear any previous selection */
+    SALOME_ListIO selected1;
+    aSel->setSelectedObjects( selected1 );
 
+    SMESHGUI::GetSMESHGUI()->updateObjBrowser();
+  }
 }
 
 //=============================================================================
@@ -833,21 +849,36 @@ private:
   QFont   myFont;
 };
 
+extern "C" {
+  Standard_EXPORT CAM_Module* createModule()
+  {
+    return SMESHGUI::GetSMESHGUI();
+  }
+}
+
+SMESH::SMESH_Gen_var SMESHGUI::myComponentSMESH = SMESH::SMESH_Gen::_nil();
+
 //=============================================================================
 /*!
  *
  */
 //=============================================================================
-SMESHGUI::SMESHGUI( const QString& theName, QObject* theParent ) :
-  SALOMEGUI( theName, theParent )
+SMESHGUI::SMESHGUI() :
+  SalomeApp_Module( "SMESH" )
 {
+  if ( CORBA::is_nil( myComponentSMESH ) )
+  {
+    SALOME_LifeCycleCORBA* ls = new SALOME_LifeCycleCORBA( getApp()->namingService() );
+    Engines::Component_var comp = ls->FindOrLoad_Component( "FactoryServer", "SMESH" );
+    myComponentSMESH = SMESH::SMESH_Gen::_narrow( comp );
+  }
+
   myActiveDialogBox = 0 ;
   myState = -1 ;
 
-  SMESH::GetSMESHGen();
   SMESH::GetFilterManager();
   SMESH::GetPattern();
-
+  
   /* load resources for all available meshers */
   SMESH::InitAvailableHypotheses();
 }
@@ -862,6 +893,30 @@ SMESHGUI::~SMESHGUI()
   SMESH::GetFilterManager()->Destroy();
 }
 
+//=============================================================================
+/*!
+ *
+ */
+//=============================================================================
+SalomeApp_SelectionMgr* SMESHGUI::selectionMgr()
+{
+  SalomeApp_Application* anApp = dynamic_cast<SalomeApp_Application*>( SUIT_Session::session()->activeApplication() );
+  if( anApp )
+    return dynamic_cast<SalomeApp_SelectionMgr*>( anApp->selectionMgr() );
+  else
+    return 0;
+}
+
+//=============================================================================
+/*!
+ *
+ */
+//=============================================================================
+SUIT_ResourceMgr* SMESHGUI::resourceMgr()
+{
+  return dynamic_cast<SUIT_ResourceMgr*>( SUIT_Session::session()->resourceMgr() );
+}
+
 //=============================================================================
 /*!
  *
@@ -869,19 +924,24 @@ SMESHGUI::~SMESHGUI()
 //=============================================================================
 SMESHGUI* SMESHGUI::GetSMESHGUI()
 {
-  static SMESHGUI aSMESHGUI;
-  aSMESHGUI.myActiveStudy = SMESH::GetActiveStudy();
-  SMESH::GetSMESHGen()->SetCurrentStudy( SMESH::GetActiveStudyDocument() );
+  static SMESHGUI* aSMESHGUI = NULL;
+  if( !aSMESHGUI )
+    aSMESHGUI = new SMESHGUI();
+
+  if(_PTR(Study) aStudy = SMESH::GetActiveStudyDocument())
+    GetSMESHGen()->SetCurrentStudy( _CAST(Study,aStudy)->GetStudy() );
 
+  SUIT_ResourceMgr* mgr = resourceMgr();
+  if( mgr )
   /* Automatic Update flag */
-  aSMESHGUI.myAutomaticUpdate = ( QAD_CONFIG->getSetting( "SMESH:AutomaticUpdate" ).compare( "true" ) == 0 );
+    aSMESHGUI->myAutomaticUpdate = ( mgr->stringValue( "SMESH", "AutomaticUpdate" ).compare( "true" ) == 0 );
 
-  return &aSMESHGUI;
+  return aSMESHGUI;
 }
 
 extern "C"
 {
-  Standard_EXPORT SALOMEGUI* GetComponentGUI() {
+  Standard_EXPORT SMESHGUI* GetComponentGUI() {
     return SMESHGUI::GetSMESHGUI();
   }
 }
@@ -893,8 +953,7 @@ extern "C"
 //=============================================================================
 void SMESHGUI::SetState(int aState)
 {
-  this->myState = aState;
-  return;
+  myState = aState;
 }
 
 //=============================================================================
@@ -904,8 +963,7 @@ void SMESHGUI::SetState(int aState)
 //=============================================================================
 void SMESHGUI::ResetState()
 {
-  this->myState = -1;
-  return;
+  myState = -1;
 }
 
 //=============================================================================
@@ -915,8 +973,7 @@ void SMESHGUI::ResetState()
 //=============================================================================
 void SMESHGUI::EmitSignalDeactivateDialog()
 {
-  emit this->SignalDeactivateActiveDialog();
-  return;
+  emit SignalDeactivateActiveDialog();
 }
 
 //=============================================================================
@@ -926,8 +983,7 @@ void SMESHGUI::EmitSignalDeactivateDialog()
 //=============================================================================
 void SMESHGUI::EmitSignalStudyFrameChanged()
 {
-  emit this->SignalStudyFrameChanged();
-  return;
+  emit SignalStudyFrameChanged();
 }
 
 //=============================================================================
@@ -938,7 +994,6 @@ void SMESHGUI::EmitSignalStudyFrameChanged()
 void SMESHGUI::EmitSignalCloseAllDialogs()
 {
   emit SignalCloseAllDialogs();
-  return;
 }
 
 //=============================================================================
@@ -948,7 +1003,7 @@ void SMESHGUI::EmitSignalCloseAllDialogs()
 //=============================================================================
 QDialog *SMESHGUI::GetActiveDialogBox()
 {
-  return this->myActiveDialogBox;
+  return myActiveDialogBox;
 }
 
 //=============================================================================
@@ -958,7 +1013,7 @@ QDialog *SMESHGUI::GetActiveDialogBox()
 //=============================================================================
 void SMESHGUI::SetActiveDialogBox(QDialog * aDlg)
 {
-  this->myActiveDialogBox = (QDialog *) aDlg;
+  myActiveDialogBox = (QDialog *) aDlg;
   return;
 }
 
@@ -967,19 +1022,13 @@ void SMESHGUI::SetActiveDialogBox(QDialog * aDlg)
  *
  */
 //=============================================================================
-QAD_Study *SMESHGUI::GetActiveStudy()
+SUIT_Desktop* SMESHGUI::desktop()
 {
-  return this->myActiveStudy;
-}
-
-//=============================================================================
-/*!
- *
- */
-//=============================================================================
-QAD_Desktop *SMESHGUI::GetDesktop()
-{
-  return QAD_Application::getDesktop();
+  SalomeApp_Application* app = dynamic_cast<SalomeApp_Application*>( SUIT_Session::session()->activeApplication() );
+  if( app )
+    return app->desktop();
+  else
+    return 0;
 }
 
 //=============================================================================
@@ -987,23 +1036,13 @@ QAD_Desktop *SMESHGUI::GetDesktop()
  *
  */
 //=============================================================================
-bool SMESHGUI::ActiveStudyChanged(QAD_Desktop* parent)
+SalomeApp_Study* SMESHGUI::activeStudy()
 {
-  MESSAGE("SMESHGUI::activeStudyChanged init.");
-  QAD_Study* prevStudy = myActiveStudy;
-  /* Create or retrieve an object SMESHGUI */
-  MESSAGE("Active study changed : prev study =" << prevStudy);
-  SMESHGUI::GetSMESHGUI();
-  EmitSignalStudyFrameChanged();
-  MESSAGE("Active study changed : active study =" << myActiveStudy);
-  if ( prevStudy != myActiveStudy ) {
-    EmitSignalCloseAllDialogs();
-    MESSAGE("Active study changed : SMESHGUI nullified" << endl);
-    //smeshGUI = 0;
-    SMESH::UpdateSelectionProp();
-  }
-  MESSAGE("SMESHGUI::activeStudyChanged done.");
-  return true;
+  SUIT_Application* app = SUIT_Session::session()->activeApplication();
+  if( app )
+    return dynamic_cast<SalomeApp_Study*>( app->activeStudy() );
+  else
+    return NULL;
 }
 
 //=============================================================================
@@ -1016,7 +1055,7 @@ bool SMESHGUI::DefineDlgPosition(QWidget * aDlg, int &x, int &y)
   /* Here the position is on the bottom right corner - 10 */
   // aDlg->resize(QSize().expandedTo(aDlg->minimumSizeHint()));
   aDlg->adjustSize();
-  QAD_Desktop *PP = QAD_Application::getDesktop();
+  SUIT_Desktop *PP = desktop();
   x = abs(PP->x() + PP->size().width() - aDlg->size().width() - 10);
   y = abs(PP->y() + PP->size().height() - aDlg->size().height() - 10);
   return true;
@@ -1027,14 +1066,14 @@ bool SMESHGUI::DefineDlgPosition(QWidget * aDlg, int &x, int &y)
  *
  */
 //=============================================================================
-static int isStudyLocked(const SALOMEDS::Study_var& theStudy){
+static int isStudyLocked(_PTR(Study) theStudy){
   return theStudy->GetProperties()->IsLocked();
 }
 
-static bool checkLock(const SALOMEDS::Study_var& theStudy) {
+static bool checkLock(_PTR(Study) theStudy) {
   if (isStudyLocked(theStudy)) {
-    QAD_MessageBox::warn1 ( (QWidget*)QAD_Application::getDesktop(),
-                          QObject::tr("WRN_WARNING"), 
+    SUIT_MessageBox::warn1 ( SMESHGUI::desktop(),
+                          QObject::tr("WRN_WARNING"),
                           QObject::tr("WRN_STUDY_LOCKED"),
                           QObject::tr("BUT_OK") );
     return true;
@@ -1044,12 +1083,12 @@ static bool checkLock(const SALOMEDS::Study_var& theStudy) {
 
 //=======================================================================
 //function : CheckActiveStudyLocked
-//purpose  : 
+//purpose  :
 //=======================================================================
 
-bool SMESHGUI::ActiveStudyLocked()
+bool SMESHGUI::isActiveStudyLocked()
 {
-  SALOMEDS::Study_var aStudy = myActiveStudy->getStudyDocument();
+  _PTR(Study) aStudy = activeStudy()->studyDS();
   return checkLock( aStudy );
 }
 
@@ -1058,38 +1097,61 @@ bool SMESHGUI::ActiveStudyLocked()
  *
  */
 //=============================================================================
-bool SMESHGUI::OnGUIEvent(int theCommandID, QAD_Desktop * parent)
+bool SMESHGUI::OnGUIEvent( int theCommandID )
 {
-  SALOMEDS::Study_var aStudy = SMESH::GetActiveStudyDocument(); //Document OCAF de l'etude active
+  SalomeApp_Application* anApp = dynamic_cast<SalomeApp_Application*>( application() );
+  if( !anApp )
+    return false;
+
+  _PTR(Study) aStudy = SMESH::GetActiveStudyDocument(); //Document OCAF de l'etude active
+  SUIT_ResourceMgr* mgr = resourceMgr();
+  if( !mgr )
+    return false;
+
+  SUIT_ViewManager* vm = application()->activeViewManager();
+  if( !vm )
+    return false;
+
+  SUIT_ViewWindow* view =vm->getActiveView();
+  SVTK_ViewWindow* vtkwnd = dynamic_cast<SVTK_ViewWindow*>( view );
+
+  QAction* act = action( theCommandID );
 
   switch (theCommandID)        {
   case 33:                                     // DELETE
     if(checkLock(aStudy)) break;
     ::OnEditDelete();
     break;
-    
+
   case 113:                                    // IMPORT
   case 112:
   case 111:
     {
       if(checkLock(aStudy)) break;
-      ::ImportMeshesFromFile(parent,SMESH::GetSMESHGen(),theCommandID);
+      ::ImportMeshesFromFile(GetSMESHGen(),theCommandID);
       break;
     }
 
   case 122:                                    // EXPORT MED
   case 121:
   case 123:
+  case 124:
+  case 125:
+  case 126:
     {
-      ::ExportMeshToFile(parent, theCommandID);
+      ::ExportMeshToFile(theCommandID);
       break;
     }
 
   case 200:                                    // SCALAR BAR
     {
-      SALOME_Selection *Sel = SALOME_Selection::Selection( myActiveStudy->getSelection() );
-      if( Sel && Sel->IObjectCount() ) {
-       Handle(SALOME_InteractiveObject) anIO = Sel->firstIObject();
+      SalomeApp_SelectionMgr *aSel = SMESHGUI::selectionMgr();
+      SALOME_ListIO selected;
+      if( aSel )
+        aSel->selectedObjects( selected );
+
+      if( selected.Extent() ) {
+       Handle(SALOME_InteractiveObject) anIO = selected.First();
        if( anIO->hasEntry() ) {
          if( SMESH_Actor* anActor = SMESH::FindActorByEntry( anIO->getEntry() ) ) {
            anActor->SetControlMode( SMESH_Actor::eNone );
@@ -1100,8 +1162,12 @@ bool SMESHGUI::OnGUIEvent(int theCommandID, QAD_Desktop * parent)
     }
   case 201:
     {
-      SALOME_Selection* Sel = SALOME_Selection::Selection( myActiveStudy->getSelection() );
-      SMESHGUI_Preferences_ScalarBarDlg::ScalarBarProperties( parent, Sel );
+      SalomeApp_SelectionMgr *aSel = SMESHGUI::selectionMgr();
+      SALOME_ListIO selected;
+      if( aSel )
+        aSel->selectedObjects( selected );
+
+      SMESHGUI_Preferences_ScalarBarDlg::ScalarBarProperties( desktop(), aSel );
       break;
     }
 
@@ -1142,10 +1208,14 @@ bool SMESHGUI::OnGUIEvent(int theCommandID, QAD_Desktop * parent)
       case 301:        anAction = SMESH::eDisplay; break;
       case 302:        anAction = SMESH::eDisplayOnly; break;
       }
-      
-      SALOME_Selection *Sel = SALOME_Selection::Selection(myActiveStudy->getSelection());
-      if (myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK) {
-       SALOME_ListIteratorOfListIO It(Sel->StoredIObjects());
+
+      SalomeApp_SelectionMgr *aSel = SMESHGUI::selectionMgr();
+      SALOME_ListIO selected;
+      if( aSel )
+        aSel->selectedObjects( selected );
+
+      if ( vtkwnd ) {
+       SALOME_ListIteratorOfListIO It(selected);
        for (; It.More(); It.Next()) {
          Handle(SALOME_InteractiveObject) IOS = It.Value();
          if (IOS->hasEntry()) {
@@ -1153,20 +1223,22 @@ bool SMESHGUI::OnGUIEvent(int theCommandID, QAD_Desktop * parent)
          }
        }
       }
-      Sel->ClearIObjects();
+      SALOME_ListIO selected1;
+      aSel->setSelectedObjects( selected1 );
       break;
     }
 
   case 400:                                    // NODES
     {
       if(checkLock(aStudy)) break;
-      if (myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK) {
+
+      if ( vtkwnd ) {
        EmitSignalDeactivateDialog();
-       SALOME_Selection *Sel = SALOME_Selection::Selection(myActiveStudy->getSelection());
-       new SMESHGUI_NodesDlg(parent, "", Sel);
+
+       new SMESHGUI_NodesDlg( desktop(), "", SMESHGUI::selectionMgr() );
       }
       else {
-       QAD_MessageBox::warn1(QAD_Application::getDesktop(),
+       SUIT_MessageBox::warn1(desktop(),
                              tr("SMESH_WRN_WARNING"), 
                              tr("SMESH_WRN_VIEWER_VTK"),
                              tr("SMESH_BUT_OK"));
@@ -1176,100 +1248,101 @@ bool SMESHGUI::OnGUIEvent(int theCommandID, QAD_Desktop * parent)
 
   case 2151:  // FILTER
   {
-    if ( myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK )
+    if ( vtkwnd )
     {
       EmitSignalDeactivateDialog();
-      new SMESHGUI_FilterDlg( parent, SMESH::EDGE );
+      new SMESHGUI_FilterDlg( this, SMESH::EDGE );
     }
     break;
   }
-    
+
   case 406:                                    // MOVE NODE
     {
-      if ( myActiveStudy->getActiveStudyFrame()->getTypeView() != VIEW_VTK )
+      if ( !vtkwnd )
       {
-        QAD_MessageBox::warn1( GetDesktop(), tr( "SMESH_WRN_WARNING" ),
+        SUIT_MessageBox::warn1( desktop(), tr( "SMESH_WRN_WARNING" ),
           tr( "NOT_A_VTK_VIEWER" ),tr( "SMESH_BUT_OK" ) );
         break;
       }
-      
+
       if(checkLock(aStudy)) break;
-      SALOME_Selection *Sel = SALOME_Selection::Selection( myActiveStudy->getSelection() );
-      new SMESHGUI_MoveNodesDlg( parent, Sel );
+      new SMESHGUI_MoveNodesDlg(this);
       break;
     }
-    
-  case 701:                                    // COMPUTE MESH 
+
+  case 701:                                    // COMPUTE MESH
     {
       if(checkLock(aStudy)) break;
-      if (myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK) {
-       SALOME_Selection *Sel = SALOME_Selection::Selection(myActiveStudy->getSelection());
-       int nbSel = Sel->IObjectCount();
+      if ( vtkwnd ) {
+       SalomeApp_SelectionMgr *Sel = selectionMgr();
+       SALOME_ListIO selected; Sel->selectedObjects( selected );
+
+       int nbSel = selected.Extent();
        if (nbSel != 1){
          break;
        }
 
        SMESH::SMESH_Mesh_var aMesh;
        SMESH::SMESH_subMesh_var aSubMesh;
-       Handle(SALOME_InteractiveObject) IObject = Sel->firstIObject();
+       Handle(SALOME_InteractiveObject) IObject = selected.First();
        if (IObject->hasEntry()){
-         SALOMEDS::SObject_var aMeshSObj = aStudy->FindObjectID(IObject->getEntry());
+         _PTR(SObject) aMeshSObj = aStudy->FindObjectID(IObject->getEntry());
          GEOM::GEOM_Object_var aShapeObject = SMESH::GetShapeOnMeshOrSubMesh( aMeshSObj );
          if ( aShapeObject->_is_nil() ) {
            // imported mesh
            break;
          }
-         if(!aMeshSObj->_is_nil()) {
+         if( aMeshSObj ) {
            SMESH::SMESH_Mesh_var aMesh = SMESH::SObjectToInterface<SMESH::SMESH_Mesh>(aMeshSObj);
            SMESH::SMESH_subMesh_var aSubMesh = SMESH::SObjectToInterface<SMESH::SMESH_subMesh>(aMeshSObj);
-           
+
            if (!aMesh->_is_nil()){
              GEOM::GEOM_Object_var refShapeObject = SMESH::GetShapeOnMeshOrSubMesh(aMeshSObj);
              if (!refShapeObject->_is_nil()) {
-               if(!SMESH::GetSMESHGen()->IsReadyToCompute(aMesh,refShapeObject)){
-                 QAD_MessageBox::warn1(QAD_Application::getDesktop(), 
+               if(!GetSMESHGen()->IsReadyToCompute(aMesh,refShapeObject)){
+                 SUIT_MessageBox::warn1(desktop(),
                                        tr("SMESH_WRN_WARNING"),
                                        tr("SMESH_WRN_MISSING_PARAMETERS"),
                                        tr("SMESH_BUT_OK"));
                  break;
                }
                try{
-                 if (SMESH::GetSMESHGen()->Compute(aMesh,refShapeObject))
+                 if (GetSMESHGen()->Compute(aMesh,refShapeObject))
                     SMESH::ModifiedMesh(aMeshSObj,true);
                  // TO Do : change icon of all submeshes
                   else
-                    QAD_MessageBox::warn1(QAD_Application::getDesktop(), 
+                    SUIT_MessageBox::warn1(desktop(), 
                                           tr("SMESH_WRN_WARNING"),
                                           tr("SMESH_WRN_COMPUTE_FAILED"),
                                           tr("SMESH_BUT_OK"));
                }
                catch(const SALOME::SALOME_Exception & S_ex){
-                 QtCatchCorbaException(S_ex);
+                 SalomeApp_Tools::QtCatchCorbaException(S_ex);
                }
              }
            }else if(!aSubMesh->_is_nil()){
              aMesh = aSubMesh->GetFather();
              GEOM::GEOM_Object_var refShapeObject = SMESH::GetShapeOnMeshOrSubMesh(aMeshSObj);
              if(!refShapeObject->_is_nil()){
-               bool compute = SMESH::GetSMESHGen()->IsReadyToCompute(aMesh,refShapeObject);
+               bool compute = GetSMESHGen()->IsReadyToCompute(aMesh,refShapeObject);
                if(!compute){
-                 QAD_MessageBox::warn1(QAD_Application::getDesktop(), 
+                 SUIT_MessageBox::warn1(desktop(), 
                                        tr("SMESH_WRN_WARNING"),
                                        tr("SMESH_WRN_MISSING_PARAMETERS"),
                                        tr("SMESH_BUT_OK"));
                  break;
                }
                try{
-                 if ( SMESH::GetSMESHGen()->Compute(aMesh,refShapeObject) )
+                 if ( GetSMESHGen()->Compute(aMesh,refShapeObject) )
                     SMESH::ModifiedMesh(aMeshSObj,true);
                  // TO Do : change icon of all submeshes
                   else
-                    QAD_MessageBox::warn1(QAD_Application::getDesktop(), 
+                    SUIT_MessageBox::warn1(desktop(),
                                           tr("SMESH_WRN_WARNING"),
                                           tr("SMESH_WRN_COMPUTE_FAILED"),
                                           tr("SMESH_BUT_OK"));
                }catch(const SALOME::SALOME_Exception & S_ex){
-                 QtCatchCorbaException(S_ex);
+                 SalomeApp_Tools::QtCatchCorbaException(S_ex);
                }
              }
            }
@@ -1284,13 +1357,13 @@ bool SMESHGUI::OnGUIEvent(int theCommandID, QAD_Desktop * parent)
          if(!anActor){
            anActor = SMESH::CreateActor(aStudy,IObject->getEntry());
            if(anActor){
-             SMESH::DisplayActor(myActiveStudy->getActiveStudyFrame(),anActor); //apo
+             SMESH::DisplayActor(view,anActor); //apo
              SMESH::FitAll();
            }
          }
        }
       }else{
-       QAD_MessageBox::warn1(QAD_Application::getDesktop(),
+       SUIT_MessageBox::warn1(desktop(),
                              tr("SMESH_WRN_WARNING"), 
                              tr("SMESH_WRN_VIEWER_VTK"),
                              tr("SMESH_BUT_OK"));
@@ -1298,28 +1371,26 @@ bool SMESHGUI::OnGUIEvent(int theCommandID, QAD_Desktop * parent)
       break;
     }
 
-  case 702:                                    // ADD SUB MESH 
+  case 702:                                    // ADD SUB MESH
     {
       if(checkLock(aStudy)) break;
-      if (myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK) {
+      if( vtkwnd ) {
        EmitSignalDeactivateDialog();
-       SALOME_Selection *Sel = SALOME_Selection::Selection(myActiveStudy->getSelection());
-       new SMESHGUI_AddSubMeshDlg(parent, "", Sel);
+       new SMESHGUI_AddSubMeshDlg( this );
       }
       else {
-       QAD_MessageBox::warn1(QAD_Application::getDesktop(),
+       SUIT_MessageBox::warn1(desktop(),
                              tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"),
                              tr("SMESH_BUT_OK"));
       }
       break;
     }
-    
-  case 703:                                    // INIT MESH 
+
+  case 703:                                    // INIT MESH
     {
       if(checkLock(aStudy)) break;
       EmitSignalDeactivateDialog();
-      SALOME_Selection *Sel = SALOME_Selection::Selection(myActiveStudy->getSelection());
-      new SMESHGUI_InitMeshDlg(parent, "", Sel);
+      new SMESHGUI_InitMeshDlg( this );
       break;
     }
 
@@ -1327,8 +1398,7 @@ bool SMESHGUI::OnGUIEvent(int theCommandID, QAD_Desktop * parent)
     {
       if(checkLock(aStudy)) break;
       EmitSignalDeactivateDialog();
-      SALOME_Selection *Sel = SALOME_Selection::Selection(myActiveStudy->getSelection());
-      new SMESHGUI_EditHypothesesDlg(parent, "", Sel);
+      new SMESHGUI_EditHypothesesDlg( this );
       break;
     }
 
@@ -1336,8 +1406,7 @@ bool SMESHGUI::OnGUIEvent(int theCommandID, QAD_Desktop * parent)
     {
       if(checkLock(aStudy)) break;
       EmitSignalDeactivateDialog();
-      SALOME_Selection *Sel = SALOME_Selection::Selection(myActiveStudy->getSelection());
-      new SMESHGUI_EditHypothesesDlg(parent, "", Sel);
+      new SMESHGUI_EditHypothesesDlg( this );
       break;
     }
 
@@ -1345,49 +1414,46 @@ bool SMESHGUI::OnGUIEvent(int theCommandID, QAD_Desktop * parent)
     {
       if(checkLock(aStudy)) break;
       EmitSignalDeactivateDialog();
-      SALOME_Selection *Sel = SALOME_Selection::Selection(myActiveStudy->getSelection());
-      new SMESHGUI_EditHypothesesDlg(parent, "", Sel);
+      new SMESHGUI_EditHypothesesDlg( this );
       break;
     }
 
   case 407: // DIAGONAL INVERSION
   case 408: // Delete diagonal
     {
-      if ( myActiveStudy->getActiveStudyFrame()->getTypeView() != VIEW_VTK )
+      if ( !vtkwnd )
       {
-        QAD_MessageBox::warn1( GetDesktop(), tr( "SMESH_WRN_WARNING" ),
+        SUIT_MessageBox::warn1( desktop(), tr( "SMESH_WRN_WARNING" ),
           tr( "NOT_A_VTK_VIEWER" ),tr( "SMESH_BUT_OK" ) );
         break;
       }
 
       if ( checkLock( aStudy ) )
         break;
-        
-      SALOME_Selection *aSel =
-        SALOME_Selection::Selection( myActiveStudy->getSelection() );
+
       /*Standard_Boolean aRes;
       SMESH::SMESH_Mesh_var aMesh = SMESH::IObjectToInterface<SMESH::SMESH_Mesh>(IObject);
       if ( aMesh->_is_nil() )
       {
-        QAD_MessageBox::warn1(GetDesktop(), tr( "SMESH_WRN_WARNING" ),
+        SUIT_MessageBox::warn1(GetDesktop(), tr( "SMESH_WRN_WARNING" ),
           tr( "SMESH_BAD_SELECTION" ), tr( "SMESH_BUT_OK" ) );
         break;
       }
       */
       EmitSignalDeactivateDialog();
       if ( theCommandID == 407 )
-        new SMESHGUI_TrianglesInversionDlg( parent, aSel );
+        new SMESHGUI_TrianglesInversionDlg(this);
       else
-        new SMESHGUI_UnionOfTwoTrianglesDlg( parent, aSel );
+        new SMESHGUI_UnionOfTwoTrianglesDlg(this);
       break;
     }
     case 409: // Change orientation
     case 410: // Union of triangles
     case 411: // Cutting of quadrangles
     {
-      if ( myActiveStudy->getActiveStudyFrame()->getTypeView() != VIEW_VTK )
+      if ( !vtkwnd )
       {
-        QAD_MessageBox::warn1( GetDesktop(), tr( "SMESH_WRN_WARNING" ),
+        SUIT_MessageBox::warn1( desktop(), tr( "SMESH_WRN_WARNING" ),
           tr( "NOT_A_VTK_VIEWER" ),tr( "SMESH_BUT_OK" ) );
         break;
       }
@@ -1395,17 +1461,14 @@ bool SMESHGUI::OnGUIEvent(int theCommandID, QAD_Desktop * parent)
       if ( checkLock( aStudy ) )
         break;
 
-      SALOME_Selection *aSel =
-        SALOME_Selection::Selection( myActiveStudy->getSelection() );
-
       EmitSignalDeactivateDialog();
-      SMESHGUI_MultiEditDlg* aDlg;
+      SMESHGUI_MultiEditDlg* aDlg = NULL;
       if ( theCommandID == 409 )
-        aDlg = new SMESHGUI_ChangeOrientationDlg( parent, aSel );
+        aDlg = new SMESHGUI_ChangeOrientationDlg(this);
       else if ( theCommandID == 410 )
-        aDlg = new SMESHGUI_UnionOfTrianglesDlg( parent, aSel );
+        aDlg = new SMESHGUI_UnionOfTrianglesDlg(this);
       else
-        aDlg = new SMESHGUI_CuttingOfQuadsDlg( parent, aSel );
+        aDlg = new SMESHGUI_CuttingOfQuadsDlg(this);
 
       int x, y ;
       DefineDlgPosition( aDlg, x, y );
@@ -1416,13 +1479,12 @@ bool SMESHGUI::OnGUIEvent(int theCommandID, QAD_Desktop * parent)
   case 412: // Smoothing
     {
       if(checkLock(aStudy)) break;
-      if (myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK) {
+      if( vtkwnd ) {
        EmitSignalDeactivateDialog();
-       SALOME_Selection *Sel = SALOME_Selection::Selection(myActiveStudy->getSelection());
-       new SMESHGUI_SmoothingDlg(parent, "", Sel);
+       new SMESHGUI_SmoothingDlg( this );
       }
       else {
-       QAD_MessageBox::warn1(QAD_Application::getDesktop(),
+       SUIT_MessageBox::warn1(desktop(),
                              tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"),
                              tr("SMESH_BUT_OK"));
       }
@@ -1430,29 +1492,26 @@ bool SMESHGUI::OnGUIEvent(int theCommandID, QAD_Desktop * parent)
     }
   case 413: // Extrusion
     {
-      if(checkLock(aStudy)) break;
-      if (myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK) {
+      if (checkLock(aStudy)) break;
+      if (vtkwnd) {
        EmitSignalDeactivateDialog();
-       SALOME_Selection *Sel = SALOME_Selection::Selection(myActiveStudy->getSelection());
-       new SMESHGUI_ExtrusionDlg(parent, "", Sel);
-      }
-      else {
-       QAD_MessageBox::warn1(QAD_Application::getDesktop(),
-                             tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"),
-                             tr("SMESH_BUT_OK"));
+       new SMESHGUI_ExtrusionDlg ( this );
+      } else {
+       SUIT_MessageBox::warn1(desktop(),
+                               tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"),
+                               tr("SMESH_BUT_OK"));
       }
       break;
     }
   case 414: // Revolution
     {
       if(checkLock(aStudy)) break;
-      if (myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK) {
+      if( vtkwnd ) {
        EmitSignalDeactivateDialog();
-       SALOME_Selection *Sel = SALOME_Selection::Selection(myActiveStudy->getSelection());
-       new SMESHGUI_RevolutionDlg(parent, "", Sel);
+       new SMESHGUI_RevolutionDlg( this );
       }
       else {
-       QAD_MessageBox::warn1(QAD_Application::getDesktop(),
+       SUIT_MessageBox::warn1(desktop(),
                              tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"),
                              tr("SMESH_BUT_OK"));
       }
@@ -1462,15 +1521,13 @@ bool SMESHGUI::OnGUIEvent(int theCommandID, QAD_Desktop * parent)
     {
       if ( checkLock( aStudy ) )
         break;
-      if ( myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK )
+      if ( vtkwnd )
       {
         EmitSignalDeactivateDialog();
-        SALOME_Selection *Sel = SALOME_Selection::Selection(
-          myActiveStudy->getSelection() );
-        new SMESHGUI_MeshPatternDlg( parent, Sel );
+        new SMESHGUI_MeshPatternDlg( this );
       }
       else {
-       QAD_MessageBox::warn1(QAD_Application::getDesktop(),
+       SUIT_MessageBox::warn1(desktop(),
                              tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"),
                              tr("SMESH_BUT_OK"));
       }
@@ -1478,16 +1535,14 @@ bool SMESHGUI::OnGUIEvent(int theCommandID, QAD_Desktop * parent)
     }
   case 416: // Extrusion along a path
     {
-      if(checkLock(aStudy)) break;
-      if (myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK) {
+      if (checkLock(aStudy)) break;
+      if (vtkwnd) {
        EmitSignalDeactivateDialog();
-       SALOME_Selection *Sel = SALOME_Selection::Selection(myActiveStudy->getSelection());
-       new SMESHGUI_ExtrusionAlongPathDlg(parent, Sel);
-      }
-      else {
-       QAD_MessageBox::warn1(QAD_Application::getDesktop(),
-                             tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"),
-                             tr("SMESH_BUT_OK"));
+       new SMESHGUI_ExtrusionAlongPathDlg( this );
+      } else {
+       SUIT_MessageBox::warn1(desktop(),
+                               tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"),
+                               tr("SMESH_BUT_OK"));
       }
       break;
     }
@@ -1496,13 +1551,18 @@ bool SMESHGUI::OnGUIEvent(int theCommandID, QAD_Desktop * parent)
       if(checkLock(aStudy)) break;
       EmitSignalDeactivateDialog();
       SMESH::SMESH_Mesh_var aMesh = SMESH::SMESH_Mesh::_nil();
-      SALOME_Selection *Sel = SALOME_Selection::Selection(myActiveStudy->getSelection());
-      int nbSel = Sel->IObjectCount();
+
+      SalomeApp_SelectionMgr *aSel = SMESHGUI::selectionMgr();
+      SALOME_ListIO selected;
+      if( aSel )
+        aSel->selectedObjects( selected );
+
+      int nbSel = selected.Extent();
       if (nbSel == 1) {
        // check if mesh is selected
-        aMesh = SMESH::GetMeshByIO(Sel->firstIObject());
+        aMesh = SMESH::GetMeshByIO( selected.First() );
       }
-      SMESHGUI_GroupDlg *aDlg = new SMESHGUI_GroupDlg(parent, "", Sel, aMesh);
+      SMESHGUI_GroupDlg *aDlg = new SMESHGUI_GroupDlg( this, "", aMesh);
       aDlg->show();
       break;
     }
@@ -1511,15 +1571,20 @@ bool SMESHGUI::OnGUIEvent(int theCommandID, QAD_Desktop * parent)
     {
       if(checkLock(aStudy)) break;
       EmitSignalDeactivateDialog();
-      SALOME_Selection *Sel = SALOME_Selection::Selection(myActiveStudy->getSelection());
-      int nbSel = Sel->IObjectCount();
+
+      SalomeApp_SelectionMgr *aSel = SMESHGUI::selectionMgr();
+      SALOME_ListIO selected;
+      if( aSel )
+        aSel->selectedObjects( selected );
+
+      int nbSel = selected.Extent();
       if (nbSel == 1) {
        // check if submesh is selected
-       Handle(SALOME_InteractiveObject) IObject = Sel->firstIObject();
+       Handle(SALOME_InteractiveObject) IObject = selected.First();
        if (IObject->hasEntry()) {
-         SALOMEDS::SObject_var aSObj = aStudy->FindObjectID(IObject->getEntry());
-         if(!aSObj->_is_nil()) {
-           SMESH::SMESH_subMesh_var aSubMesh = SMESH::SMESH_subMesh::_narrow(aSObj->GetObject());
+         _PTR(SObject) aSObj = aStudy->FindObjectID(IObject->getEntry());
+         if( aSObj ) {
+           SMESH::SMESH_subMesh_var aSubMesh = SMESH::SMESH_subMesh::_narrow( SMESH::SObjectToObject( aSObj ) );
            if (!aSubMesh->_is_nil()) {
              try {
                SMESH::SMESH_Mesh_var aMesh = aSubMesh->GetFather();
@@ -1546,9 +1611,10 @@ bool SMESHGUI::OnGUIEvent(int theCommandID, QAD_Desktop * parent)
                  SMESH::SMESH_Group_var aGroup = SMESH::AddGroup(aMesh, SMESH::VOLUME, aName + "_Volumes");
                  aGroup->Add(aVolumes.inout());
                }
-               myActiveStudy->updateObjBrowser(true);
+               updateObjBrowser();
+               
              }catch(const SALOME::SALOME_Exception & S_ex){
-               QtCatchCorbaException(S_ex);
+               SalomeApp_Tools::QtCatchCorbaException(S_ex);
              }
            }
          }
@@ -1561,9 +1627,13 @@ bool SMESHGUI::OnGUIEvent(int theCommandID, QAD_Desktop * parent)
     {
       if(checkLock(aStudy)) break;
       EmitSignalDeactivateDialog();
-      SALOME_Selection *Sel = SALOME_Selection::Selection(myActiveStudy->getSelection());
-      SALOME_ListIO IOs; IOs = Sel->StoredIObjects(); // list copy
-      SALOME_ListIteratorOfListIO It (IOs);
+
+      SalomeApp_SelectionMgr *aSel = SMESHGUI::selectionMgr();
+      SALOME_ListIO selected;
+      if( aSel )
+        aSel->selectedObjects( selected );
+
+      SALOME_ListIteratorOfListIO It (selected);
       int nbSelectedGroups = 0;
       for ( ; It.More(); It.Next() )
       {
@@ -1571,13 +1641,13 @@ bool SMESHGUI::OnGUIEvent(int theCommandID, QAD_Desktop * parent)
           SMESH::IObjectToInterface<SMESH::SMESH_Group>(It.Value());
         if (!aGroup->_is_nil()) {
          nbSelectedGroups++;
-          SMESHGUI_GroupDlg *aDlg = new SMESHGUI_GroupDlg(parent, "", Sel, aGroup);
+          SMESHGUI_GroupDlg *aDlg = new SMESHGUI_GroupDlg( this, "", aGroup);
           aDlg->show();
        }
       }
       if (nbSelectedGroups == 0)
        {
-         SMESHGUI_GroupDlg *aDlg = new SMESHGUI_GroupDlg(parent, "", Sel, SMESH::SMESH_Group::_nil());
+         SMESHGUI_GroupDlg *aDlg = new SMESHGUI_GroupDlg( this, "", SMESH::SMESH_Group::_nil());
          aDlg->show();
        }
       break;
@@ -1611,15 +1681,13 @@ bool SMESHGUI::OnGUIEvent(int theCommandID, QAD_Desktop * parent)
         break;
 
       EmitSignalDeactivateDialog();
-      SALOME_Selection *Sel = SALOME_Selection::Selection(
-        myActiveStudy->getSelection() );
 
       int aMode;
       if      ( theCommandID == 810 ) aMode = SMESHGUI_GroupOpDlg::UNION;
       else if ( theCommandID == 811 ) aMode = SMESHGUI_GroupOpDlg::INTERSECT;
       else                            aMode = SMESHGUI_GroupOpDlg::CUT;
 
-      ( new SMESHGUI_GroupOpDlg( parent, Sel, aMode ) )->show();
+      ( new SMESHGUI_GroupOpDlg( desktop(), SMESHGUI::selectionMgr(), aMode ) )->show();
       break;
     }
 
@@ -1629,68 +1697,68 @@ bool SMESHGUI::OnGUIEvent(int theCommandID, QAD_Desktop * parent)
         break;
 
       EmitSignalDeactivateDialog();
-      SALOME_Selection *Sel = SALOME_Selection::Selection(
-        myActiveStudy->getSelection() );
 
-      ( new SMESHGUI_DeleteGroupDlg( parent, Sel ) )->show();
+      new SMESHGUI_DeleteGroupDlg( desktop(), SMESHGUI::selectionMgr() );
       break;
     }
 
   case 900:                                    // MESH INFOS
     {
       EmitSignalDeactivateDialog();
-      SALOME_Selection *Sel =
-       SALOME_Selection::Selection(myActiveStudy->getSelection());
-      if ( Sel->IObjectCount() > 1 ) { // a dlg for each IO
-        SALOME_ListIO IOs; IOs = Sel->StoredIObjects(); // list copy
-        SALOME_ListIteratorOfListIO It (IOs);
+      SalomeApp_SelectionMgr *aSel = SMESHGUI::selectionMgr();
+      SALOME_ListIO selected;
+      if( aSel )
+        aSel->selectedObjects( selected );
+
+      if ( selected.Extent() > 1 ) { // a dlg for each IO
+        SALOME_ListIO IOs;
+        SALOME_ListIteratorOfListIO It (selected);
         for ( ; It.More(); It.Next() ) {
-          Sel->ClearIObjects();
-          Sel->AddIObject( It.Value() );
-          new SMESHGUI_MeshInfosDlg(parent, "", false);
+         IOs.Clear(); IOs.Append( It.Value() );
+         aSel->setSelectedObjects( IOs );
+          new SMESHGUI_MeshInfosDlg(this, "", false);
         }
         // restore selection
-        Sel->ClearIObjects();
-        for (It.Initialize( IOs ) ; It.More(); It.Next() )
-          Sel->AddIObject( It.Value() );
+        aSel->setSelectedObjects( selected );
       }
       else
-        new SMESHGUI_MeshInfosDlg(parent, "", false);
+        new SMESHGUI_MeshInfosDlg(this, "", false);
       break;
     }
 
   case 902:                                    // STANDARD MESH INFOS
     {
       EmitSignalDeactivateDialog();
-      SALOME_Selection *Sel =
-       SALOME_Selection::Selection(myActiveStudy->getSelection());
-      if ( Sel->IObjectCount() > 1 ) { // a dlg for each IO
-        SALOME_ListIO IOs; IOs = Sel->StoredIObjects(); // list copy
-        SALOME_ListIteratorOfListIO It (IOs);
+      SalomeApp_SelectionMgr *aSel = SMESHGUI::selectionMgr();
+      SALOME_ListIO selected;
+      if( aSel )
+        aSel->selectedObjects( selected );
+
+      if ( selected.Extent() > 1 ) { // a dlg for each IO
+        SALOME_ListIO IOs;
+        SALOME_ListIteratorOfListIO It (selected);
         for ( ; It.More(); It.Next() ) {
-          Sel->ClearIObjects();
-          Sel->AddIObject( It.Value() );
-          new SMESHGUI_StandardMeshInfosDlg(parent, "", false);
+         IOs.Clear();
+         IOs.Append( It.Value() );
+         aSel->setSelectedObjects( IOs );
+          new SMESHGUI_StandardMeshInfosDlg(desktop(), "", false);
         }
         // restore selection
-        Sel->ClearIObjects();
-        for (It.Initialize( IOs ) ; It.More(); It.Next() )
-          Sel->AddIObject( It.Value() );
+       aSel->setSelectedObjects( selected );
       }
       else
-        new SMESHGUI_StandardMeshInfosDlg(parent, "", false);
+        new SMESHGUI_StandardMeshInfosDlg(desktop(), "", false);
       break;
     } 
     
   case 1001:                                   // AUTOMATIC UPDATE PREFERENCES
     {
-      parent->menuBar()->setItemChecked(1001, !parent->menuBar()->isItemChecked(1001));
-      if (parent->menuBar()->isItemChecked(1001)) {
-       QAD_CONFIG->addSetting("SMESH:AutomaticUpdate", "true");
+      if (act->isOn()) {
+       mgr->setValue( "SMESH", "AutomaticUpdate", true );
        myAutomaticUpdate = true;
       }
       else {
-       QAD_CONFIG->addSetting("SMESH:AutomaticUpdate", "false");
+       mgr->setValue( "SMESH", "AutomaticUpdate", false );
        myAutomaticUpdate = false;
       }
       break;
@@ -1704,126 +1772,90 @@ bool SMESHGUI::OnGUIEvent(int theCommandID, QAD_Desktop * parent)
 
   case 1005:
     {
-      SMESHGUI_Preferences_ScalarBarDlg::ScalarBarPreferences( parent );
+      SMESHGUI_Preferences_ScalarBarDlg::ScalarBarPreferences( desktop() );
       break;
     }
 
   case 10070:
     {
-      ( new SMESHGUI_PrecisionDlg( parent ) )->exec();
+      ( new SMESHGUI_PrecisionDlg( desktop() ) )->exec();
       break;
     }
 
   case 10071:
     {
-      parent->menuBar()->setItemChecked(10071, !parent->menuBar()->isItemChecked(10071));
-      if (parent->menuBar()->isItemChecked(10071)) {
-       QAD_CONFIG->addSetting("SMESH:DispayEntity","true");
+      if (act->isOn()) {
+       mgr->setValue( "SMESH", "DispayEntity", true );
       }
       else {
-       QAD_CONFIG->addSetting("SMESH:DispayEntity","false");
+       mgr->setValue( "SMESH", "DispayEntity", false );
       }
       break;
     }
-  case 1006: 
+  case 1006:
     {
       SMESHGUI_Preferences_SelectionDlg* aDlg = 
-       new SMESHGUI_Preferences_SelectionDlg(parent);
-
-      QColor aColor;
-      QString SCr, SCg, SCb;
-      SCr = QAD_CONFIG->getSetting("SMESH:SettingsPreSelectColorRed");
-      SCg = QAD_CONFIG->getSetting("SMESH:SettingsPreSelectColorGreen");
-      SCb = QAD_CONFIG->getSetting("SMESH:SettingsPreSelectColorBlue");
-      if (!SCr.isEmpty() && !SCg.isEmpty() && !SCb.isEmpty())
-       aColor = QColor(SCr.toInt(), SCg.toInt(), SCb.toInt());
-      else aColor = Qt::cyan;
+       new SMESHGUI_Preferences_SelectionDlg(desktop());
+
+      QColor aColor = mgr->colorValue( "SMESH", "SettingsPreSelectColor", Qt::cyan );
       aDlg->SetColor(1, aColor);
 
-      SCr = QAD_CONFIG->getSetting("SMESH:SettingsItemSelectColorRed");
-      SCg = QAD_CONFIG->getSetting("SMESH:SettingsItemSelectColorGreen");
-      SCb = QAD_CONFIG->getSetting("SMESH:SettingsItemSelectColorBlue");
-      if (!SCr.isEmpty() && !SCg.isEmpty() && !SCb.isEmpty())
-       aColor = QColor(SCr.toInt(), SCg.toInt(), SCb.toInt());
-      else aColor = Qt::yellow;
+      aColor = mgr->colorValue( "SMESH", "SettingsItemSelectColor", Qt::yellow );
       aDlg->SetColor(2, aColor);
 
-      SCr = QAD_CONFIG->getSetting("SMESH:SettingsSelectColorRed");
-      SCg = QAD_CONFIG->getSetting("SMESH:SettingsSelectColorGreen");
-      SCb = QAD_CONFIG->getSetting("SMESH:SettingsSelectColorBlue");
-      if (!SCr.isEmpty() && !SCg.isEmpty() && !SCb.isEmpty())
-       aColor = QColor(SCr.toInt(), SCg.toInt(), SCb.toInt());
-      else aColor = Qt::white;
+      aColor = mgr->colorValue( "SMESH", "SettingsSelectColor", Qt::white );
       aDlg->SetColor(3, aColor);
 
-      QString SW1 = QAD_CONFIG->getSetting("SMESH:SettingsPreSelectWidth");
-      if (SW1.isEmpty()) SW1 = "5";
-      aDlg->SetWidth(1, SW1.toInt());
-
-      QString SW2 = QAD_CONFIG->getSetting("SMESH:SettingsItemSelectWidth");
-      if (SW2.isEmpty()) SW2 = "5";
-      aDlg->SetWidth(2, SW2.toInt());
-
-      QString SP1 = QAD_CONFIG->getSetting("SMESH:SettingsNodeSelectTol");
-      if (SP1.isEmpty()) SP1 = "0.025";
-      aDlg->SetPrecision(1, SP1.toDouble());
-
-      QString SP2 = QAD_CONFIG->getSetting("SMESH:SettingsElementsSelectTol");
-      if (SP2.isEmpty()) SP2 = "0.001";
-      aDlg->SetPrecision(2, SP2.toDouble());
+      aDlg->SetWidth(1, mgr->integerValue( "SMESH", "SettingsPreSelectWidth", 5 ) );
+      aDlg->SetWidth(2, mgr->integerValue( "SMESH", "SettingsItemSelectWidth", 5 ) );
+      aDlg->SetPrecision(1, mgr->doubleValue( "SMESH", "SettingsNodeSelectTol", 0.025 ) );
+      aDlg->SetPrecision(2, mgr->doubleValue( "SMESH", "SettingsElementsSelectTol", 0.001 ) );
 
       if (aDlg->exec()) {
-       QColor aPreColor = aDlg->GetColor(1);
-       QAD_CONFIG->addSetting("SMESH:SettingsPreSelectColorRed", aPreColor.red());
-       QAD_CONFIG->addSetting("SMESH:SettingsPreSelectColorGreen", aPreColor.green());
-       QAD_CONFIG->addSetting("SMESH:SettingsPreSelectColorBlue", aPreColor.blue());
-
-       QColor aSelColor = aDlg->GetColor(2);
-       QAD_CONFIG->addSetting("SMESH:SettingsItemSelectColorRed", aSelColor.red());
-       QAD_CONFIG->addSetting("SMESH:SettingsItemSelectColorGreen", aSelColor.green());
-       QAD_CONFIG->addSetting("SMESH:SettingsItemSelectColorBlue", aSelColor.blue());
-
-       QColor aHiColor = aDlg->GetColor(3);
-       QAD_CONFIG->addSetting("SMESH:SettingsSelectColorRed", aHiColor.red());
-       QAD_CONFIG->addSetting("SMESH:SettingsSelectColorGreen", aHiColor.green());
-       QAD_CONFIG->addSetting("SMESH:SettingsSelectColorBlue", aHiColor.blue());
-
-       int aPreWidth = aDlg->GetWidth(1);
-       QAD_CONFIG->addSetting("SMESH:SettingsPreSelectWidth", aPreWidth);
-       int aSelWidth = aDlg->GetWidth(2);
-       QAD_CONFIG->addSetting("SMESH:SettingsItemSelectWidth", aSelWidth);
-
-       double aTolNodes = aDlg->GetPrecision(1);
-       QAD_CONFIG->addSetting("SMESH:SettingsNodeSelectTol", aTolNodes);
-       double aTolItems = aDlg->GetPrecision(2);
-       QAD_CONFIG->addSetting("SMESH:SettingsElementsSelectTol", aTolItems);
+        QColor aPreColor = aDlg->GetColor(1),
+              aSelColor = aDlg->GetColor(2),
+              aHiColor = aDlg->GetColor(3);
+       int aPreWidth = aDlg->GetWidth(1),
+           aSelWidth = aDlg->GetWidth(2);
+       double aTolNodes = aDlg->GetPrecision(1),
+              aTolItems = aDlg->GetPrecision(2);
+
+       mgr->setValue( "SMESH", "SettingsPreSelectColor", aPreColor );
+       mgr->setValue( "SMESH", "SettingsItemSelectColor", aSelColor );
+       mgr->setValue( "SMESH", "SettingsSelectColor", aHiColor );
+
+       mgr->setValue( "SMESH", "SettingsPreSelectWidth", aPreWidth );
+       mgr->setValue( "SMESH", "SettingsItemSelectWidth", aSelWidth );
+       mgr->setValue( "SMESH", "SettingsNodeSelectTol", aTolNodes );
+       mgr->setValue( "SMESH", "SettingsElementsSelectTol", aTolItems );
 
        // update current study settings
        SMESH::UpdateSelectionProp();
 
-       QAD_StudyFrame* studyFrame = myActiveStudy->getActiveStudyFrame();
-       if (studyFrame->getTypeView() == VIEW_VTK) {
-         VTKViewer_ViewFrame* aViewFrame = SMESH::GetVtkViewFrame(studyFrame);
+       if( vtkwnd ) {
          // update VTK viewer properties
-         VTKViewer_RenderWindowInteractor* anInteractor = aViewFrame->getRWInteractor();
+         SVTK_RenderWindowInteractor* anInteractor =
+           dynamic_cast<SVTK_RenderWindowInteractor*>( vtkwnd->getRWInteractor() );
          if (anInteractor) {
-           anInteractor->SetSelectionProp(aSelColor.red()/255., aSelColor.green()/255., 
+           anInteractor->SetSelectionProp(aSelColor.red()/255., aSelColor.green()/255.,
                                           aSelColor.blue()/255., aSelWidth);
            anInteractor->SetSelectionTolerance(aTolNodes, aTolItems);
-           VTKViewer_InteractorStyleSALOME* aStyle = anInteractor->GetInteractorStyleSALOME();
+           SVTK_InteractorStyle* aStyle =
+             dynamic_cast<SVTK_InteractorStyle*>( anInteractor->GetInteractorStyle() );
+
            if (aStyle)
-             aStyle->setPreselectionProp(aPreColor.red()/255., aPreColor.green()/255., 
+             aStyle->setPreselectionProp(aPreColor.red()/255., aPreColor.green()/255.,
                                          aPreColor.blue()/255., aPreWidth);
          }
          // update actors
-         vtkRenderer* aRenderer = aViewFrame->getRenderer();
+         vtkRenderer* aRenderer = vtkwnd->getRenderer();
          vtkActorCollection *aCollection = aRenderer->GetActors();
          aCollection->InitTraversal();
          while(vtkActor *anAct = aCollection->GetNextActor()){
            if(SMESH_Actor *anActor = dynamic_cast<SMESH_Actor*>(anAct)){
-             anActor->SetHighlightColor(aHiColor.red()/255., aHiColor.green()/255., 
+             anActor->SetHighlightColor(aHiColor.red()/255., aHiColor.green()/255.,
                                         aHiColor.blue()/255.);
-             anActor->SetPreHighlightColor(aPreColor.red()/255., aPreColor.green()/255., 
+             anActor->SetPreHighlightColor(aPreColor.red()/255., aPreColor.green()/255.,
                                            aPreColor.blue()/255.);
            }
          }
@@ -1836,12 +1868,16 @@ bool SMESHGUI::OnGUIEvent(int theCommandID, QAD_Desktop * parent)
   case 1100:                                   // EDIT HYPOTHESIS
     {
       if(checkLock(aStudy)) break;
-      SALOME_Selection *Sel =
-        SALOME_Selection::Selection(myActiveStudy->getSelection());
-      int nbSel = Sel->IObjectCount();
+
+      SalomeApp_SelectionMgr *aSel = SMESHGUI::selectionMgr();
+      SALOME_ListIO selected;
+      if( aSel )
+        aSel->selectedObjects( selected );
+
+      int nbSel = selected.Extent();
 
       if (nbSel == 1) {
-       SMESH::SMESH_Hypothesis_var Hyp = SMESH::IObjectToInterface<SMESH::SMESH_Hypothesis>(Sel->firstIObject());
+       SMESH::SMESH_Hypothesis_var Hyp = SMESH::IObjectToInterface<SMESH::SMESH_Hypothesis>(selected.First());
 
         /* Look for all mesh objects that have this hypothesis affected in order to flag as ModifiedMesh */
         /* At end below '...->updateObjBrowser(true)' will change icon of mesh objects                   */
@@ -1867,65 +1903,76 @@ bool SMESHGUI::OnGUIEvent(int theCommandID, QAD_Desktop * parent)
     {
       if ( checkLock( aStudy ) )
         break;
-        
-      SALOME_Selection *Sel =
-        SALOME_Selection::Selection( myActiveStudy->getSelection() );
-        
-      SALOME_ListIteratorOfListIO It( Sel->StoredIObjects() );
+
+      SalomeApp_SelectionMgr *aSel = SMESHGUI::selectionMgr();
+      SALOME_ListIO selected;
+      if( aSel )
+        aSel->selectedObjects( selected );
+
+      SALOME_ListIteratorOfListIO It( selected );
       for ( ; It.More(); It.Next() )
       {
         Handle(SALOME_InteractiveObject) IObject = It.Value();
-        SALOMEDS::SObject_var obj = aStudy->FindObjectID( IObject->getEntry() );
-        SALOMEDS::GenericAttribute_var anAttr;
-        SALOMEDS::AttributeName_var aName;
-        if ( !obj->_is_nil() )
+        _PTR(SObject) obj = aStudy->FindObjectID( IObject->getEntry() );
+        _PTR(GenericAttribute) anAttr;
+        _PTR(AttributeName) aName;
+        if ( obj )
         {
           if ( obj->FindAttribute(anAttr, "AttributeName") )
           {
-            aName = SALOMEDS::AttributeName::_narrow( anAttr );
-            QString newName = QString(aName->Value());
-            newName = SALOMEGUI_NameDlg::getName( QAD_Application::getDesktop(), newName );
+            aName = anAttr;
+            QString newName = QString(aName->Value().c_str());
+            newName = SalomeApp_NameDlg::getName( desktop(), newName );
             if ( !newName.isEmpty() )
             {
-              myActiveStudy->renameIObject( IObject, newName );
+              //old source: aStudy->renameIObject( IObject, newName );
+             aName->SetValue( newName.latin1() );
 
               // if current object is group update group's name
              SMESH::SMESH_GroupBase_var aGroup =
                 SMESH::IObjectToInterface<SMESH::SMESH_GroupBase>(IObject);
               if (!aGroup->_is_nil() )
                 aGroup->SetName( newName.latin1() );
+               
+             updateObjBrowser();
             }
           }
         }
       }
       break;
     }
-    
+
   case 1102:                                   // REMOVE HYPOTHESIS / ALGORITHMS
     {
       if(checkLock(aStudy)) break;
-      QAD_WaitCursor wc;
-      SALOME_Selection *Sel = SALOME_Selection::Selection(myActiveStudy->getSelection());
-      SALOME_ListIteratorOfListIO It(Sel->StoredIObjects());
+      SUIT_OverrideCursor wc;
+
+      SalomeApp_SelectionMgr *aSel = SMESHGUI::selectionMgr();
+      SALOME_ListIO selected;
+      if( aSel )
+        aSel->selectedObjects( selected );
+
+      SALOME_ListIteratorOfListIO It(selected);
       for (int i = 0; It.More(); It.Next(), i++) {
        Handle(SALOME_InteractiveObject) IObject = It.Value();
        SMESH::RemoveHypothesisOrAlgorithmOnMesh(IObject);
       }
-      Sel->ClearIObjects();
-      myActiveStudy->updateObjBrowser(true);
+      SALOME_ListIO selected1;
+      aSel->setSelectedObjects( selected1 );
+      updateObjBrowser();
       break;
     }
 
   case 401:                                    // GEOM::EDGE
   case 4021:                                   // TRIANGLE
   case 4022:                                   // QUAD
+  case 4023:                                   // POLYGON
   case 4031:                                   // TETRA
   case 4032:                                   // HEXA
     {
       if(checkLock(aStudy)) break;
-      if (myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK) {
+      if ( vtkwnd ) {
        EmitSignalDeactivateDialog();
-       SALOME_Selection *Sel = SALOME_Selection::Selection(myActiveStudy->getSelection());
         SMDSAbs_ElementType type    = SMDSAbs_Edge;
         int                 nbNodes = 2;
         switch (theCommandID) {
@@ -1935,30 +1982,46 @@ bool SMESHGUI::OnGUIEvent(int theCommandID, QAD_Desktop * parent)
           type = SMDSAbs_Face; nbNodes = 4; break;
         case 4031:                                      // TETRA
           type = SMDSAbs_Volume; nbNodes = 4; break;
+       case 4023:                                      // POLYGON
+         type = SMDSAbs_Face; nbNodes = 5; break;     // 5 - identificator for POLYGON
         case 4032:                                      // HEXA
           type = SMDSAbs_Volume; nbNodes = 8; break;
+       case 4033:                                      // POLYHEDRE
+         type = SMDSAbs_Volume; nbNodes = 9; break; // 9 - identificator for POLYHEDRE
         default:;
         }
-       new SMESHGUI_AddMeshElementDlg(parent, "", Sel, type, nbNodes);
+       new SMESHGUI_AddMeshElementDlg( this, "", type, nbNodes);
       }
       else {
-       QAD_MessageBox::warn1(QAD_Application::getDesktop(),
+       SUIT_MessageBox::warn1(desktop(),
+                             tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"),
+                             tr("SMESH_BUT_OK"));
+      }
+      break;
+    }
+  case 4033:                                   // POLYHEDRON
+    {
+      if(checkLock(aStudy)) break;
+      if ( vtkwnd ) {
+       EmitSignalDeactivateDialog();
+       new SMESHGUI_CreatePolyhedralVolumeDlg(this, "", FALSE );
+      }
+      else {
+       SUIT_MessageBox::warn1(SMESHGUI::desktop(),
                              tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"),
                              tr("SMESH_BUT_OK"));
       }
       break;
     }
-
   case 4041:                                   // REMOVES NODES
     {
       if(checkLock(aStudy)) break;
-      if (myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK) {
+      if ( vtkwnd ) {
        EmitSignalDeactivateDialog();
-       SALOME_Selection *Sel = SALOME_Selection::Selection(myActiveStudy->getSelection());
-       new SMESHGUI_RemoveNodesDlg(parent, "", Sel);
+       new SMESHGUI_RemoveNodesDlg(this);
       }
       else {
-       QAD_MessageBox::warn1(QAD_Application::getDesktop(),
+       SUIT_MessageBox::warn1(desktop(),
                              tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"),
                              tr("SMESH_BUT_OK"));
       }
@@ -1967,14 +2030,13 @@ bool SMESHGUI::OnGUIEvent(int theCommandID, QAD_Desktop * parent)
   case 4042:                                   // REMOVES ELEMENTS
     {
       if(checkLock(aStudy)) break;
-      if (myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK) {
+      if( vtkwnd ) {
        EmitSignalDeactivateDialog();
-       SALOME_Selection *Sel = SALOME_Selection::Selection(myActiveStudy->getSelection());
-       new SMESHGUI_RemoveElementsDlg(parent, "", Sel);
+       new SMESHGUI_RemoveElementsDlg(this);
       }
       else
        {
-         QAD_MessageBox::warn1(QAD_Application::getDesktop(),
+         SUIT_MessageBox::warn1(desktop(),
                                tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"),
                                tr("SMESH_BUT_OK"));
        }
@@ -1983,14 +2045,13 @@ bool SMESHGUI::OnGUIEvent(int theCommandID, QAD_Desktop * parent)
   case 4051:                                   // RENUMBERING NODES
     {
       if(checkLock(aStudy)) break;
-      if (myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK) {
+      if( vtkwnd ) {
        EmitSignalDeactivateDialog();
-       SALOME_Selection *Sel = SALOME_Selection::Selection(myActiveStudy->getSelection());
-       new SMESHGUI_RenumberingDlg(parent, "", Sel, 0);
+       new SMESHGUI_RenumberingDlg(desktop(), "", selectionMgr(), 0);
       }
       else
        {
-         QAD_MessageBox::warn1(QAD_Application::getDesktop(),
+         SUIT_MessageBox::warn1(desktop(),
                                tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"),
                                tr("SMESH_BUT_OK"));
        }
@@ -1999,14 +2060,13 @@ bool SMESHGUI::OnGUIEvent(int theCommandID, QAD_Desktop * parent)
   case 4052:                                   // RENUMBERING ELEMENTS
     {
       if(checkLock(aStudy)) break;
-      if (myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK) {
+      if ( vtkwnd ) {
        EmitSignalDeactivateDialog();
-       SALOME_Selection *Sel = SALOME_Selection::Selection(myActiveStudy->getSelection());
-       new SMESHGUI_RenumberingDlg(parent, "", Sel, 1);
+       new SMESHGUI_RenumberingDlg(desktop(), "", selectionMgr(), 1);
       }
       else
        {
-         QAD_MessageBox::warn1(QAD_Application::getDesktop(),
+         SUIT_MessageBox::warn1(desktop(),
                                tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"),
                                tr("SMESH_BUT_OK"));
        }
@@ -2015,13 +2075,12 @@ bool SMESHGUI::OnGUIEvent(int theCommandID, QAD_Desktop * parent)
   case 4061:                                   // TRANSLATION
     {
       if(checkLock(aStudy)) break;
-      if (myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK) {
+      if ( vtkwnd ) {
        EmitSignalDeactivateDialog();
-       SALOME_Selection *Sel = SALOME_Selection::Selection(myActiveStudy->getSelection());
-       new SMESHGUI_TranslationDlg(parent, "", Sel);
+       new SMESHGUI_TranslationDlg( this );
       }
       else {
-       QAD_MessageBox::warn1(QAD_Application::getDesktop(),
+       SUIT_MessageBox::warn1(desktop(),
                              tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"),
                              tr("SMESH_BUT_OK"));
       }
@@ -2030,13 +2089,12 @@ bool SMESHGUI::OnGUIEvent(int theCommandID, QAD_Desktop * parent)
   case 4062:                                   // ROTATION
     {
       if(checkLock(aStudy)) break;
-      if (myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK) {
+      if( vtkwnd ) {
        EmitSignalDeactivateDialog();
-       SALOME_Selection *Sel = SALOME_Selection::Selection(myActiveStudy->getSelection());
-       new SMESHGUI_RotationDlg(parent, "", Sel);
+       new SMESHGUI_RotationDlg( this );
       }
       else {
-       QAD_MessageBox::warn1(QAD_Application::getDesktop(),
+       SUIT_MessageBox::warn1(desktop(),
                              tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"),
                              tr("SMESH_BUT_OK"));
       }
@@ -2045,13 +2103,12 @@ bool SMESHGUI::OnGUIEvent(int theCommandID, QAD_Desktop * parent)
   case 4063:                                   // SYMMETRY 
     {
       if(checkLock(aStudy)) break;
-      if (myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK) {
+      if(vtkwnd) {
        EmitSignalDeactivateDialog();
-       SALOME_Selection *Sel = SALOME_Selection::Selection(myActiveStudy->getSelection());
-       new SMESHGUI_SymmetryDlg(parent, "", Sel);
+       new SMESHGUI_SymmetryDlg( this );
       }
       else {
-       QAD_MessageBox::warn1(QAD_Application::getDesktop(),
+       SUIT_MessageBox::warn1(desktop(),
                              tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"),
                              tr("SMESH_BUT_OK"));
       }
@@ -2060,13 +2117,12 @@ bool SMESHGUI::OnGUIEvent(int theCommandID, QAD_Desktop * parent)
   case 4064:                                   // SEWING
     {
       if(checkLock(aStudy)) break;
-      if (myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK) {
+      if(vtkwnd) {
        EmitSignalDeactivateDialog();
-       SALOME_Selection *Sel = SALOME_Selection::Selection(myActiveStudy->getSelection());
-       new SMESHGUI_SewingDlg(parent, "", Sel);
+       new SMESHGUI_SewingDlg( this );
       }
       else {
-       QAD_MessageBox::warn1(QAD_Application::getDesktop(),
+       SUIT_MessageBox::warn1(desktop(),
                              tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"),
                              tr("SMESH_BUT_OK"));
       }
@@ -2075,13 +2131,12 @@ bool SMESHGUI::OnGUIEvent(int theCommandID, QAD_Desktop * parent)
   case 4065:                                   // MERGE NODES
     {
       if(checkLock(aStudy)) break;
-      if (myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK) {
+      if(vtkwnd) {
        EmitSignalDeactivateDialog();
-       SALOME_Selection *Sel = SALOME_Selection::Selection(myActiveStudy->getSelection());
-       new SMESHGUI_MergeNodesDlg(parent, "", Sel);
+       new SMESHGUI_MergeNodesDlg( this );
       }
       else {
-       QAD_MessageBox::warn1(QAD_Application::getDesktop(),
+       SUIT_MessageBox::warn1(desktop(),
                              tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"),
                              tr("SMESH_BUT_OK"));
       }
@@ -2093,14 +2148,14 @@ bool SMESHGUI::OnGUIEvent(int theCommandID, QAD_Desktop * parent)
     {
       if(checkLock(aStudy)) break;
       EmitSignalDeactivateDialog();
-      new SMESHGUI_CreateHypothesesDlg (parent, "", FALSE, false);
+      new SMESHGUI_CreateHypothesesDlg ( this, "", FALSE, false );
       break;
     }
   case 5010: // ALGO
     {
       if(checkLock(aStudy)) break;
       EmitSignalDeactivateDialog();
-      new SMESHGUI_CreateHypothesesDlg (parent, "", FALSE, true);
+      new SMESHGUI_CreateHypothesesDlg ( this, "", FALSE, true);
       break;
     }
 
@@ -2114,11 +2169,11 @@ bool SMESHGUI::OnGUIEvent(int theCommandID, QAD_Desktop * parent)
       aTypes.append( SMESH::FACE );
       aTypes.append( SMESH::VOLUME );
     }
-    new SMESHGUI_FilterLibraryDlg( parent, aTypes, SMESHGUI_FilterLibraryDlg::EDIT );
+    new SMESHGUI_FilterLibraryDlg( desktop(), aTypes, SMESHGUI_FilterLibraryDlg::EDIT );
   }
   break;
 
-  case 6017:                                   // CONTROLS 
+  case 6017:                                   // CONTROLS
   case 6016:
   case 6015:
   case 6014:
@@ -2130,13 +2185,16 @@ bool SMESHGUI::OnGUIEvent(int theCommandID, QAD_Desktop * parent)
   case 6019:
   case 6002:
   case 6003:
-  case 6004:    
-    if ( myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK ) {
-      SALOME_Selection *Sel = SALOME_Selection::Selection(myActiveStudy->getSelection());
-      if ( Sel->IObjectCount() == 1 && Sel->firstIObject()->hasEntry() ) {
-       SALOMEDS::SObject_var SO = aStudy->FindObjectID( Sel->firstIObject()->getEntry() );
-       if ( !SO->_is_nil() ) {
-         CORBA::Object_var aObject = SO->GetObject();
+  case 6004:
+    if ( vtkwnd ) {
+
+      SalomeApp_SelectionMgr* mgr = selectionMgr();
+      SALOME_ListIO selected; mgr->selectedObjects( selected );
+
+      if ( selected.Extent() == 1 && selected.First()->hasEntry() ) {
+       _PTR(SObject) SO = aStudy->FindObjectID( selected.First()->getEntry() );
+       if ( SO ) {
+         CORBA::Object_var aObject = SMESH::SObjectToObject( SO );
          SMESH::SMESH_Mesh_var      aMesh    = SMESH::SMESH_Mesh::_narrow( aObject );
          SMESH::SMESH_subMesh_var   aSubMesh = SMESH::SMESH_subMesh::_narrow( aObject );
          SMESH::SMESH_GroupBase_var aGroup   = SMESH::SMESH_GroupBase::_narrow( aObject );
@@ -2146,14 +2204,14 @@ bool SMESHGUI::OnGUIEvent(int theCommandID, QAD_Desktop * parent)
          }
        }
       }
-      QAD_MessageBox::warn1(GetDesktop(), 
+      SUIT_MessageBox::warn1(desktop(),
                            tr( "SMESH_WRN_WARNING" ),
-                           tr( "SMESH_BAD_SELECTION" ), 
+                           tr( "SMESH_BAD_SELECTION" ),
                            tr( "SMESH_BUT_OK" ) );
       break;
     }
     else {
-      QAD_MessageBox::warn1(GetDesktop(), 
+      SUIT_MessageBox::warn1(desktop(),
                            tr( "SMESH_WRN_WARNING" ),
                            tr( "NOT_A_VTK_VIEWER" ), 
                            tr( "SMESH_BUT_OK" ) );
@@ -2161,9 +2219,11 @@ bool SMESHGUI::OnGUIEvent(int theCommandID, QAD_Desktop * parent)
     break;
   case 9010:
     {
-      SALOME_Selection *Sel = SALOME_Selection::Selection(myActiveStudy->getSelection());
-      if (Sel->IObjectCount() == 1)    {
-       Handle(SALOME_InteractiveObject) anIObject = Sel->firstIObject();
+      SalomeApp_SelectionMgr* mgr = selectionMgr();
+      SALOME_ListIO selected; mgr->selectedObjects( selected );
+
+      if (selected.Extent() == 1)      {
+       Handle(SALOME_InteractiveObject) anIObject = selected.First();
        if(anIObject->hasEntry())
          if(SMESH_Actor *anActor = SMESH::FindActorByEntry(anIObject->getEntry())){
            anActor->SetPointsLabeled( !anActor->GetPointsLabeled() );
@@ -2173,9 +2233,11 @@ bool SMESHGUI::OnGUIEvent(int theCommandID, QAD_Desktop * parent)
     }
   case 9011:
     {
-      SALOME_Selection *Sel = SALOME_Selection::Selection(myActiveStudy->getSelection());
-      if (Sel->IObjectCount() == 1)    {
-       Handle(SALOME_InteractiveObject) anIObject = Sel->firstIObject();
+      SalomeApp_SelectionMgr* mgr = selectionMgr();
+      SALOME_ListIO selected; mgr->selectedObjects( selected );
+
+      if (selected.Extent() == 1)      {
+       Handle(SALOME_InteractiveObject) anIObject = selected.First();
        if(anIObject->hasEntry())
          if(SMESH_Actor *anActor = SMESH::FindActorByEntry(anIObject->getEntry())){
            anActor->SetCellsLabeled( !anActor->GetCellsLabeled() );
@@ -2186,41 +2248,40 @@ bool SMESHGUI::OnGUIEvent(int theCommandID, QAD_Desktop * parent)
   case 10001:                          // DISPLAY MODE PREFERENCE
     {
       // Wireframe
-      parent->menuBar()->setItemChecked(10001, true);
-      parent->menuBar()->setItemChecked(10002, false);
-      parent->menuBar()->setItemChecked(10004, false);
-      parent->menuBar()->setItemEnabled(10003, true);
-      QAD_CONFIG->addSetting("SMESH:DisplayMode", "Wireframe");
+      act->setOn( true );
+      action( 10002 )->setOn( false );
+      action( 10004 )->setOn( false );
+      action( 10003 )->setOn( true );
+      mgr->setValue( "SMESH", "DisplayMode", "Wireframe");
       break;
     }
   case 10002:
     {
-      parent->menuBar()->setItemChecked(10002, true);
-      parent->menuBar()->setItemChecked(10001, false);
-      parent->menuBar()->setItemChecked(10004, false);
-      parent->menuBar()->setItemEnabled(10003, true);
-      QAD_CONFIG->addSetting("SMESH:DisplayMode", "Shading");
+      act->setOn( true );
+      action( 10001 )->setOn( false );
+      action( 10004 )->setOn( false );
+      action( 10003 )->setOn( true );
+      mgr->setValue( "SMESH", "DisplayMode", "Shading");
       break;
     }
   case 10003:
     {
-      parent->menuBar()->setItemChecked(10003,!parent->menuBar()->isItemChecked(10003));
-      QAD_CONFIG->addSetting("SMESH:Shrink", parent->menuBar()->isItemChecked(10003) ? "yes" : "no");
+      mgr->setValue( "SMESH", "Shrink", act->isOn() );
       break;
     }
   case 10004:
     {
-      parent->menuBar()->setItemChecked(10001, false);
-      parent->menuBar()->setItemChecked(10004, true);
-      parent->menuBar()->setItemChecked(10002, false);
-      parent->menuBar()->setItemEnabled(10003, false);
-      QAD_CONFIG->addSetting("SMESH:DisplayMode", "Nodes");
+      act->setOn( true );
+      action( 10001 )->setOn( false );
+      action( 10002 )->setOn( false );
+      action( 10003 )->setOn( false );
+      mgr->setValue( "SMESH", "DisplayMode", "Nodes" );
       break;
     }
-    
+
   }
 
-  myActiveStudy->updateObjBrowser(true);
+  updateObjBrowser();
   return true;
 }
 
@@ -2229,8 +2290,7 @@ bool SMESHGUI::OnGUIEvent(int theCommandID, QAD_Desktop * parent)
  *
  */
 //=============================================================================
-bool SMESHGUI::OnMousePress(QMouseEvent * pe, QAD_Desktop * parent,
-                           QAD_StudyFrame * studyFrame)
+bool SMESHGUI::OnMousePress( QMouseEvent * pe, SUIT_ViewWindow * wnd )
 {
   return false;
 }
@@ -2240,8 +2300,7 @@ bool SMESHGUI::OnMousePress(QMouseEvent * pe, QAD_Desktop * parent,
  *
  */
 //=============================================================================
-bool SMESHGUI::OnMouseMove(QMouseEvent * pe, QAD_Desktop * parent,
-                          QAD_StudyFrame * studyFrame)
+bool SMESHGUI::OnMouseMove( QMouseEvent * pe, SUIT_ViewWindow * wnd )
 {
   return true;
 }
@@ -2251,8 +2310,7 @@ bool SMESHGUI::OnMouseMove(QMouseEvent * pe, QAD_Desktop * parent,
  *
  */
 //=============================================================================
-bool SMESHGUI::OnKeyPress(QKeyEvent * pe, QAD_Desktop * parent,
-                         QAD_StudyFrame * studyFrame)
+bool SMESHGUI::OnKeyPress( QKeyEvent * pe, SUIT_ViewWindow * wnd )
 {
   return true;
 }
@@ -2262,436 +2320,770 @@ bool SMESHGUI::OnKeyPress(QKeyEvent * pe, QAD_Desktop * parent,
  *
  */
 //=============================================================================
-bool SMESHGUI::SetSettings(QAD_Desktop * parent)
+bool SMESHGUI::SetSettings(SUIT_Desktop* parent)
 {
   MESSAGE("SMESHGUI::SetSettings.");
   SMESHGUI::GetSMESHGUI();
+  
+  SUIT_ResourceMgr* mgr = resourceMgr();
+  if( !mgr )
+    return false;
 
-  /* Display mode */
+  // Display mode
   QString DisplayMode = "Shading";
-  if ( QAD_CONFIG->hasSetting("SMESH:DisplayMode") )
-    DisplayMode = QAD_CONFIG->getSetting("SMESH:DisplayMode");
+  if ( mgr->hasValue("SMESH","DisplayMode") )
+    DisplayMode = mgr->stringValue("SMESH","DisplayMode");
   else
-    QAD_CONFIG->addSetting("SMESH:DisplayMode", "Shading");
+    mgr->setValue("SMESH","DisplayMode", "Shading");
 
   bool Shrink = false;
-  if ( QAD_CONFIG->hasSetting("SMESH:Shrink") )
-    Shrink = QAD_CONFIG->getSetting("SMESH:Shrink") == "yes";
+  if ( mgr->hasValue("SMESH","Shrink") )
+    Shrink = mgr->stringValue("SMESH","Shrink") == "yes";
 
   if (DisplayMode == "Wireframe") {
     // wireframe
-    parent->menuBar()->setItemChecked(10004, false);
-    parent->menuBar()->setItemChecked(10002, false);
-    parent->menuBar()->setItemChecked(10001, true);
-    parent->menuBar()->setItemEnabled(10003, true);
+    action( 10004 )->setOn( false );
+    action( 10002 )->setOn( false );
+    action( 10001 )->setOn( true );
+    action( 10003 )->setOn( true );
   }
   else if (DisplayMode == "Nodes") {
     // poins
-    parent->menuBar()->setItemChecked(10004, true);
-    parent->menuBar()->setItemChecked(10002, false);
-    parent->menuBar()->setItemChecked(10001, false);
-    parent->menuBar()->setItemEnabled(10003, false);
+    action( 10004 )->setOn( true );
+    action( 10002 )->setOn( false );
+    action( 10001 )->setOn( false );
+    action( 10003 )->setOn( false );
   }
   else {
     // default is shading
-    parent->menuBar()->setItemChecked(10004, false);
-    parent->menuBar()->setItemChecked(10002, true);
-    parent->menuBar()->setItemChecked(10001, false);
-    parent->menuBar()->setItemEnabled(10003, true);
+    action( 10004 )->setOn( false );
+    action( 10002 )->setOn( true );
+    action( 10001 )->setOn( false );
+    action( 10003 )->setOn( true );
   }
-  parent->menuBar()->setItemChecked(10003, Shrink);
+  action( 10003 )->setOn( Shrink );
 
-  /* Automatic Update */
-  QString AutoUpdate = QAD_CONFIG->getSetting("SMESH:AutomaticUpdate");
-  if (AutoUpdate.compare("true") == 0) {
-    parent->menuBar()->setItemChecked(1001, true);
+  // Automatic Update
+  if ( mgr->booleanValue( "SMESH","AutomaticUpdate", false ) ) {
+    action( 1001 )->setOn( true );
     myAutomaticUpdate = true;
   }
   else {
-    parent->menuBar()->setItemChecked(1001, false);
+    action( 1001 )->setOn( false );
     myAutomaticUpdate = false;
   }
 
-  QString anIsDisplayEntity = QAD_CONFIG->getSetting("SMESH:DispayEntity");
-  if(anIsDisplayEntity.compare("true") == 0)
-    parent->menuBar()->setItemChecked(10071,true);
+  if ( mgr->booleanValue( "SMESH","DispayEntity", false ) )
+    action( 10071 )->setOn( true );
   else
-    parent->menuBar()->setItemChecked(10071,false);
+    action( 10071 )->setOn( false );
 
-  /* Selection */
+  // Selection
   SMESH::UpdateSelectionProp();
 
-  /* menus disable */
-  parent->menuBar()->setItemEnabled(111, false);       // IMPORT DAT
+  // menus disable
+  //action( 111 )->setEnabled( false );        // IMPORT DAT
   //parent->menuBar()->setItemEnabled(112, false);     // IMPORT UNV
 
   return true;
 }
 
 //=============================================================================
-/*!
- *
+/*! Method:  BuildPresentation(const Handle(SALOME_InteractiveObject)& theIO)
+ *  Purpose: ensures that the actor for the given <theIO> exists in the active VTK view
  */
 //=============================================================================
-void SMESHGUI::DefinePopup(QString & theContext, QString & theParent, QString & theObject)
+void SMESHGUI::BuildPresentation( const Handle(SALOME_InteractiveObject) & theIO,
+                                  SUIT_ViewWindow* wnd )
 {
-  // NRI : Temporary added
-  //  if ( myStudy->GetProperties()->IsLocked() ) {
-  //    theObject = "NothingSelected";
-  //    theContext = "NothingSelected";
-  //  }
-  // NRI
-
-  SALOME_Selection *Sel = SALOME_Selection::Selection( myActiveStudy->getSelection() );
-  int nbSel = Sel->IObjectCount();
-  switch ( nbSel ) {
-  case 0:
-    theObject = "NothingSelected";
-    theContext = "NothingSelected";
-    break;
-  case 1:
-    if ( myState == 800 && Sel->HasIndex( Sel->firstIObject() ) )
-      theObject = "Elements";
-    else
-      theObject = ::CheckTypeObject( Sel->firstIObject() );
-    theContext = "";
-    break;
-  default:
-    theObject = ::CheckHomogeneousSelection();
-    theContext = "";
+  if(theIO->hasEntry()){
+    //SUIT_ViewWindow* wnd = SMESH::GetActiveWindow();
+    SMESH::UpdateView(wnd,SMESH::eDisplay,theIO->getEntry());
   }
 }
 
-//=============================================================================
-/*!
- *
- */
-//=============================================================================
-bool SMESHGUI::CustomPopup(QAD_Desktop* parent, QPopupMenu* popup, const QString& theContext,
-                          const QString& theParent, const QString& theObject)
+//=======================================================================
+// function : createSMESHAction
+// purpose  :
+//=======================================================================
+void SMESHGUI::createSMESHAction( const int id, const QString& po_id, const QString& icon_id, const int key, const bool toggle  )
+{
+  QIconSet icon;
+  QWidget* parent = application()->desktop();
+  SUIT_ResourceMgr* resMgr = resourceMgr();
+  QPixmap pix;
+  if ( icon_id.length() )
+    pix = resMgr->loadPixmap( "SMESH", tr( icon_id ) );
+  else
+    pix = resMgr->loadPixmap( "SMESH", tr( QString( "ICO_" )+po_id ) );
+  if ( !pix.isNull() )
+    icon = QIconSet( pix );
+
+  QString tooltip    = tr( QString( "TOP_" )+po_id ),
+          menu       = tr( QString( "MEN_" )+po_id ),
+          status_bar = tr( QString( "STB_" )+po_id );
+
+  createAction( id, tooltip, icon, menu, status_bar, key, parent, toggle, this, SLOT( OnGUIEvent() )  );
+}
+
+//=======================================================================
+// function : createPopupItem
+// purpose  :
+//=======================================================================
+void SMESHGUI::createPopupItem( const int id,
+                                const QString& clients,
+                                const QString& types,
+                                const QString& theRule,
+                               const int pId )
 {
-  // get active study frame
-  QAD_StudyFrame* studyFrame = myActiveStudy->getActiveStudyFrame();
+  int parentId = pId;
+  if( pId!=-1 )
+    parentId = popupMgr()->actionId( action( pId ) );
+
+  if( !popupMgr()->contains( popupMgr()->actionId( action( id ) ) ) )
+    popupMgr()->insert( action( id ), parentId, 0 );
+
+  QChar lc = popupMgr()->equality();
+  QString rule = "(%1) and (%2) and (%3)";
+  rule = rule.arg( QString( "%1>0" ).arg( popupMgr()->selCountParam() ) );
+  rule = rule.arg( QString( "%1client in {%2}" ).arg( lc ).arg( clients ) );
+  rule = rule.arg( QString( "%1type in {%2}" ).arg( lc ).arg( types ) );
+  rule += theRule;
+
+  bool cont = myRules.contains( id );
+  if( cont )
+    rule = QString( "%1 or (%2)" ).arg( myRules[ id ] ).arg( rule );
+
+  popupMgr()->setRule( action( id ), rule, true );
+  myRules[ id ] = QString( cont ? "%1" : "(%1)" ).arg( rule );
+}
+
+//=======================================================================
+// function : initialize
+// purpose  :
+//=======================================================================
+void SMESHGUI::initialize( CAM_Application* app )
+{
+  SalomeApp_Module::initialize( app );
+
+  // ----- create actions --------------
+
+  createSMESHAction(  111, "DAT", "", (CTRL+Key_B) );
+  createSMESHAction(  112, "UNV", "", (CTRL+Key_U) );
+  createSMESHAction(  113, "MED", "", (CTRL+Key_M) );
+  createSMESHAction(  114, "NUM" );
+  createSMESHAction(  121, "DAT" );
+  createSMESHAction(  122, "MED" );
+  createSMESHAction(  123, "UNV" );
+  createSMESHAction(  124, "EXPORT_DAT" );
+  createSMESHAction(  125, "EXPORT_MED" );
+  createSMESHAction(  126, "EXPORT_UNV" );
+  createSMESHAction(   33, "DELETE",          "ICON_DELETE" );
+  createSMESHAction( 5105, "SEL_FILTER_LIB" );
+  createSMESHAction( 5000, "CREATE_HYPO",     "ICON_HYPO" );
+  createSMESHAction( 5010, "CREATE_ALG",      "ICON_PATTERN_2d" );
+  createSMESHAction(  701, "COMPUTE",         "ICON_COMPUTE" );
+  createSMESHAction(  702, "LOCAL_HYPO",      "ICON_DLG_ADD_SUBMESH" );
+  createSMESHAction(  703, "GLOBAL_HYPO",     "ICON_DLG_INIT_MESH" );
+  createSMESHAction(  704, "EDIT_HYPO",       "ICON_DLG_EDIT_MESH" );
+  createSMESHAction(  705, "EDIT_GLOBAL_HYPO","ICON_DLG_EDIT_MESH" );
+  createSMESHAction(  706, "EDIT_LOCAL_HYPO", "ICON_DLG_EDIT_MESH" );
+  createSMESHAction(  801, "CREATE_GROUP",    "ICON_SMESH_TREE_GROUP" );
+  createSMESHAction(  802, "CONSTRUCT_GROUP", "ICON_CONSTRUCT_GROUP" );
+  createSMESHAction(  803, "EDIT_GROUP",      "ICON_EDIT_GROUP" );
+  createSMESHAction(  804, "ADD" );
+  createSMESHAction(  805, "REMOVE" );
+  createSMESHAction(  810, "UN_GROUP",        "ICON_UNION" );
+  createSMESHAction(  811, "INT_GROUP",       "ICON_INTERSECT" );
+  createSMESHAction(  812, "CUT_GROUP",       "ICON_CUT" );
+  createSMESHAction(  813, "DEL_GROUP",       "ICON_DEL_GROUP" );
+  createSMESHAction(  900, "ADV_INFO",        "ICON_ADV_INFO" );
+  createSMESHAction(  902, "STD_INFO",        "ICON_STD_INFO" );
+  createSMESHAction( 6001, "LENGTH",          "ICON_LENGTH" );
+  createSMESHAction( 6002, "FREE_EDGE",       "ICON_FREE_EDGE" );
+  createSMESHAction( 6003, "FREE_BORDER",     "ICON_FREE_EDGE_2D" );
+  createSMESHAction( 6004, "CONNECTION",      "ICON_CONNECTION" );
+  createSMESHAction( 6011, "AREA",            "ICON_AREA" );
+  createSMESHAction( 6012, "TAPER",           "ICON_TAPER" );
+  createSMESHAction( 6013, "ASPECT",          "ICON_ASPECT" );
+  createSMESHAction( 6014, "MIN_ANG",         "ICON_ANGLE" );
+  createSMESHAction( 6015, "WRAP",            "ICON_WRAP" );
+  createSMESHAction( 6016, "SKEW",            "ICON_SKEW" );
+  createSMESHAction( 6017, "ASPECT_3D",       "ICON_ASPECT_3D" );
+  createSMESHAction( 6018, "LENGTH_2D",       "ICON_LENGTH_2D" );
+  createSMESHAction( 6019, "CONNECTION_2D",   "ICON_CONNECTION_2D" );
+  createSMESHAction(  400, "NODE",            "ICON_DLG_NODE" );
+  createSMESHAction(  401, "EDGE",            "ICON_DLG_EDGE" );
+  createSMESHAction( 4021, "TRIANGLE",        "ICON_DLG_TRIANGLE" );
+  createSMESHAction( 4022, "QUAD",            "ICON_DLG_QUADRANGLE" );
+  createSMESHAction( 4031, "TETRA",           "ICON_DLG_TETRAS" );
+  createSMESHAction( 4032, "HEXA",            "ICON_DLG_HEXAS" );
+  createSMESHAction( 4041, "NODES",           "ICON_DLG_REM_NODE" );
+  createSMESHAction( 4042, "ELEMENTS",        "ICON_DLG_REM_ELEMENT" );
+  createSMESHAction( 4051, "NODES",           "ICON_DLG_RENUMBERING_NODES" );
+  createSMESHAction( 4052, "ELEMENTS",        "ICON_DLG_RENUMBERING_ELEMENTS" );
+  createSMESHAction( 4061, "TRANS",           "ICON_SMESH_TRANSLATION_VECTOR" );
+  createSMESHAction( 4062, "ROT",             "ICON_DLG_ROTATION" );
+  createSMESHAction( 4063, "SYM",             "ICON_SMESH_SYMMETRY_PLANE" );
+  createSMESHAction( 4064, "SEW",             "ICON_SMESH_SEWING_FREEBORDERS" );
+  createSMESHAction( 4065, "MERGE",           "ICON_SMESH_MERGE_NODES" );
+  createSMESHAction(  406, "MOVE",            "ICON_DLG_MOVE_NODE" );
+  createSMESHAction(  407, "INV",             "ICON_DLG_MESH_DIAGONAL" );
+  createSMESHAction(  408, "UNION2",          "ICON_UNION2TRI" );
+  createSMESHAction(  409, "ORIENT",          "ICON_DLG_MESH_ORIENTATION" );
+  createSMESHAction(  410, "UNION",           "ICON_UNIONTRI" );
+  createSMESHAction(  411, "CUT",             "ICON_CUTQUAD" );
+  createSMESHAction(  412, "SMOOTH",          "ICON_DLG_SMOOTHING" );
+  createSMESHAction(  413, "EXTRUSION",       "ICON_EXTRUSION" );
+  createSMESHAction(  414, "REVOLUTION",      "ICON_REVOLUTION" );
+  createSMESHAction(  415, "MAP",             "ICON_MAP" );
+  createSMESHAction(  416, "EXTRUSION_ALONG", "ICON_EXTRUSION_ALONG" );
+  createSMESHAction( 10001, "WIRE",           "ICON_WIRE",   0, true );
+  createSMESHAction( 10002, "SHADE",          "ICON_SHADE",  0, true );
+  createSMESHAction( 10003, "SHRINK",         "ICON_SHRINK", 0, true );
+  createSMESHAction( 10004, "NODES",          "ICON_POINTS", 0, true );
+  createSMESHAction( 1001, "AUTO_UPD", "", 0, true );
+  createSMESHAction( 1003, "COLORS" );
+  createSMESHAction( 1005, "SCALAR_BAR" );
+  createSMESHAction( 1006, "SELECTION" );
+  createSMESHAction( 10070, "PRECISION", "", 0, true );
+  createSMESHAction( 10071, "DISP_ENT", "", 0, true );
+  createSMESHAction(  200, "RESET" );
+  createSMESHAction(  201, "SCALAR_BAR_PROP" );
+  createSMESHAction(  211, "WIRE",           "ICON_WIRE" );
+  createSMESHAction(  212, "SHADE",          "ICON_SHADE" );
+  createSMESHAction(  213, "SHRINK",         "ICON_SHRINK" );
+  createSMESHAction(  214, "UPDATE",         "ICON_UPDATE" );
+  createSMESHAction(  215, "NODES",          "ICON_POINTS" );
+  createSMESHAction(  217, "EDGES",          "ICON_DLG_EDGE" );
+  createSMESHAction(  218, "FACES",          "ICON_DLG_TRIANGLE" );
+  createSMESHAction(  219, "VOLUMES",        "ICON_DLG_TETRAS" );
+  createSMESHAction(  220, "ALL" );
+  createSMESHAction( 1101, "RENAME" );
+  createSMESHAction( 9010, "NUM_NODES" );
+  createSMESHAction( 9011, "NUM_ELEMENTS" );
+  createSMESHAction( 1131, "DISPMODE" );
+  createSMESHAction( 1132, "COLORS" );
+  createSMESHAction( 1133, "TRANSP" );
+  createSMESHAction( 1134, "CLIP" );
+  createSMESHAction( 1135, "DISP_ENT" );
+  createSMESHAction( 2000, "CTRL" );
   
-  // get parent component which selected object(s) belongs to
-  QString parentComp = ( (SALOMEGUI_Desktop*)parent )->getComponentFromSelection();
+  createSMESHAction( 300, "ERASE" );
+  createSMESHAction( 301, "DISPLAY" );
+  createSMESHAction( 302, "DISPLAY_ONLY" );
+
+  // ----- create menu --------------
+  int fileId   = createMenu( tr( "MEN_FILE" ),   -1,  1 ),
+      editId   = createMenu( tr( "MEN_EDIT" ),   -1,  3 ),
+      toolsId  = createMenu( tr( "MEN_TOOLS" ),  -1,  5, 10 ),
+      hypoId   = createMenu( tr( "MEN_HYPO" ),   -1, 50, 10 ),
+      meshId   = createMenu( tr( "MEN_MESH" ),   -1, 70, 10 ),
+      ctrlId   = createMenu( tr( "MEN_CTRL" ),   -1, 60, 10 ),
+      modifyId = createMenu( tr( "MEN_MODIFY" ), -1, 40, 10 ),
+      prefId   = createMenu( tr( "MEN_PREF" ),   -1,  4, 10 ),
+      viewId   = createMenu( tr( "MEN_VIEW" ),   -1,  2 );
+
+  createMenu( separator(), fileId );
+
+  int importId = createMenu( tr( "MEN_IMPORT" ), fileId, 11, 10 ),
+      exportId = createMenu( tr( "MEN_EXPORT" ), fileId, 12, 10 ),
+
+      addId    = createMenu( tr( "MEN_ADD" ),    modifyId, 402 ),
+      removeId = createMenu( tr( "MEN_REMOVE" ), modifyId, 403 ),
+      renumId  = createMenu( tr( "MEN_RENUM" ),  modifyId, 404 ),
+      transfId = createMenu( tr( "MEN_TRANSF" ), modifyId, 405 ),
+
+      meshPrefId = createMenu( tr( "MEN_MESH" ), prefId, 100 ),
+
+      dispModeId = createMenu( tr( "MEN_DISPMODE" ), meshPrefId, 1000 ),
+      qualityId  = createMenu( tr( "MEN_QUALITY" ),  meshPrefId, 1007 );
+
+  createMenu( 111, importId, -1 );
+  createMenu( 112, importId, -1 );
+  createMenu( 113, importId, -1 );
+
+  createMenu( 121, exportId, -1 );
+  createMenu( 122, exportId, -1 );
+  createMenu( 123, exportId, -1 );
+
+  createMenu( separator(), fileId, 10 );
+
+  createMenu( 33, editId, -1 );
+
+  createMenu( 5105, toolsId, -1 );
+
+  createMenu( 5000, hypoId, -1 );
+  createMenu( 5010, hypoId, -1 );
+
+  createMenu( 703, meshId, -1 );
+  createMenu( 702, meshId, -1 );
+  createMenu( 704, meshId, -1 );
+  createMenu( separator(), meshId, -1 );
+  createMenu( 701, meshId, -1 );
+  createMenu( separator(), meshId, -1 );
+  createMenu( 801, meshId, -1 );
+  createMenu( 802, meshId, -1 );
+  createMenu( 803, meshId, -1 );
+  createMenu( separator(), meshId, -1 );
+  createMenu( 810, meshId, -1 );
+  createMenu( 811, meshId, -1 );
+  createMenu( 812, meshId, -1 );
+  createMenu( separator(), meshId, -1 );
+  createMenu( 813, meshId, -1 );
+  createMenu( separator(), meshId, -1 );
+  createMenu( 900, meshId, -1 );
+  createMenu( 902, meshId, -1 );
+  createMenu( separator(), meshId, -1 );
+
+  createMenu( 6003, ctrlId, -1 );
+  createMenu( 6001, ctrlId, -1 );
+  createMenu( 6004, ctrlId, -1 );
+  createMenu( separator(), ctrlId, -1 );
+  createMenu( 6002, ctrlId, -1 );
+  createMenu( 6018, ctrlId, -1 );
+  createMenu( 6019, ctrlId, -1 );
+  createMenu( 6011, ctrlId, -1 );
+  createMenu( 6012, ctrlId, -1 );
+  createMenu( 6013, ctrlId, -1 );
+  createMenu( 6014, ctrlId, -1 );
+  createMenu( 6015, ctrlId, -1 );
+  createMenu( 6016, ctrlId, -1 );
+  createMenu( separator(), ctrlId, -1 );
+  createMenu( 6017, ctrlId, -1 );
+  createMenu( separator(), ctrlId, -1 );
+
+  createMenu( 400, addId, -1 );
+  createMenu( 401, addId, -1 );
+  createMenu( 4021, addId, -1 );
+  createMenu( 4022, addId, -1 );
+  createMenu( 4031, addId, -1 );
+  createMenu( 4032, addId, -1 );
+
+  createMenu( 4041, removeId, -1 );
+  createMenu( 4042, removeId, -1 );
+
+  createMenu( 4051, renumId, -1 );
+  createMenu( 4052, renumId, -1 );
+
+  createMenu( 4061, transfId, -1 );
+  createMenu( 4062, transfId, -1 );
+  createMenu( 4063, transfId, -1 );
+  createMenu( 4064, transfId, -1 );
+  createMenu( 4065, transfId, -1 );
+
+  createMenu( 406, modifyId, -1 );
+  createMenu( 407, modifyId, -1 );
+  createMenu( 408, modifyId, -1 );
+  createMenu( 409, modifyId, -1 );
+  createMenu( 410, modifyId, -1 );
+  createMenu( 411, modifyId, -1 );
+  createMenu( 412, modifyId, -1 );
+  createMenu( 413, modifyId, -1 );
+  createMenu( 416, modifyId, -1 );
+  createMenu( 414, modifyId, -1 );
+  createMenu( 415, modifyId, -1 );
+
+  createMenu( 10001, dispModeId, -1 );
+  createMenu( 10002, dispModeId, -1 );
+  createMenu( 10004, dispModeId, -1 );
+  createMenu( 10003, dispModeId, -1 );
+
+  createMenu( 1001, prefId, -1 );
+  createMenu( separator(), prefId, -1 );
+  createMenu( 1003, prefId, -1 );
+  createMenu( separator(), prefId, -1 );
+  createMenu( 1005, prefId, -1 );
+  createMenu( separator(), prefId, -1 );
+  createMenu( 1006, prefId, -1 );
+  createMenu( separator(), prefId, -1 );
+
+  createMenu( 10070, qualityId, -1 );
+  createMenu( 10071, qualityId, -1 );
+
+  createMenu( separator(), prefId, -1 );
+
+  createMenu( 214, viewId, -1 );
+
+  // ----- create toolbars --------------
+  int meshTb     = createTool( tr( "TB_MESH" ) ),
+      hypoTb     = createTool( tr( "TB_HYPO" ) ),
+      ctrlTb     = createTool( tr( "TB_CTRL" ) ),
+      addRemTb   = createTool( tr( "TB_ADD_REMOVE" ) ),
+      modifyTb   = createTool( tr( "TB_MODIFY" ) ),
+      dispModeTb = createTool( tr( "TB_DISP_MODE" ) );
+
+  createTool( 703, meshTb );
+  createTool( 702, meshTb );
+  createTool( 704, meshTb );
+  createTool( separator(), meshTb );
+  createTool( 701, meshTb );
+  createTool( separator(), meshTb );
+  createTool( 801, meshTb );
+  createTool( 802, meshTb );
+  createTool( 803, meshTb );
+  createTool( separator(), meshTb );
+  createTool( 900, meshTb );
+  createTool( 902, meshTb );
+  createTool( separator(), meshTb );
+
+  createTool( 5000, hypoTb );
+  createTool( 5010, hypoTb );
+
+  createTool( 6001, ctrlTb );
+  createTool( 6003, ctrlTb );
+  createTool( 6004, ctrlTb );
+  createTool( separator(), ctrlTb );
+  createTool( 6002, ctrlTb );
+  createTool( 6018, ctrlTb );
+  createTool( 6019, ctrlTb );
+  createTool( 6011, ctrlTb );
+  createTool( 6012, ctrlTb );
+  createTool( 6013, ctrlTb );
+  createTool( 6014, ctrlTb );
+  createTool( 6015, ctrlTb );
+  createTool( 6016, ctrlTb );
+  createTool( separator(), ctrlTb );
+  createTool( 6017, ctrlTb );
+  createTool( separator(), ctrlTb );
+
+  createTool( 400, addRemTb );
+  createTool( 401, addRemTb );
+  createTool( 4021, addRemTb );
+  createTool( 4022, addRemTb );
+  createTool( 4031, addRemTb );
+  createTool( 4032, addRemTb );
+  createTool( separator(), addRemTb );
+  createTool( 4041, addRemTb );
+  createTool( 4042, addRemTb );
+  createTool( separator(), addRemTb );
+  createTool( 4051, addRemTb );
+  createTool( 4052, addRemTb );
+  createTool( separator(), addRemTb );
+  createTool( 4061, addRemTb );
+  createTool( 4062, addRemTb );
+  createTool( 4063, addRemTb );
+  createTool( 4064, addRemTb );
+  createTool( 4065, addRemTb );
+  createTool( separator(), addRemTb );
+
+  createTool( 406, modifyTb );
+  createTool( 407, modifyTb );
+  createTool( 408, modifyTb );
+  createTool( 409, modifyTb );
+  createTool( 410, modifyTb );
+  createTool( 411, modifyTb );
+  createTool( 412, modifyTb );
+  createTool( 413, modifyTb );
+  createTool( 416, modifyTb );
+  createTool( 414, modifyTb );
+  createTool( 415, modifyTb );
+
+  createTool( 214, dispModeTb );
+
+
+  myRules.clear();
+  QString OB = "'ObjectBrowser'",
+         View = "'" + SVTK_Viewer::Type() + "'",
+         pat = "'%1'",
+         mesh    = pat.arg( SMESHGUI_Selection::typeName( MESH ) ),
+         group   = pat.arg( SMESHGUI_Selection::typeName( GROUP ) ),
+         hypo    = pat.arg( SMESHGUI_Selection::typeName( HYPOTHESIS ) ),
+         algo    = pat.arg( SMESHGUI_Selection::typeName( ALGORITHM ) ),
+         elems   = QString( "'%1' '%2' '%3' '%4' '%5'" ).
+                       arg( SMESHGUI_Selection::typeName( SUBMESH_VERTEX ) ).
+                      arg( SMESHGUI_Selection::typeName( SUBMESH_EDGE ) ).
+                      arg( SMESHGUI_Selection::typeName( SUBMESH_FACE ) ).
+                      arg( SMESHGUI_Selection::typeName( SUBMESH_SOLID ) ).
+                      arg( SMESHGUI_Selection::typeName( SUBMESH_COMPOUND ) ),
+          subMesh = elems,
+         mesh_group = mesh + " " + subMesh + " " + group,
+         hyp_alg = hypo + " " + algo;
+
+  // popup for object browser
+
+  createPopupItem( 705, OB, mesh, "&& isComputable");      // EDIT_GLOBAL_HYPO
+  createPopupItem( 706, OB, subMesh, "&& isComputable" );  // EDIT_LOCAL_HYPO
+  createPopupItem( 803, OB, group );                       // EDIT_GROUP
+  popupMgr()->insert( separator(), -1, 0 );
+  createPopupItem( 701, OB, mesh, "&& isComputable" );     // COMPUTE
+  createPopupItem( 214, OB, mesh_group );                  // UPDATE
+  createPopupItem( 900, OB, mesh_group );                  // ADV_INFO
+  createPopupItem( 902, OB, mesh );                        // STD_INFO
+  popupMgr()->insert( separator(), -1, 0 );
+  createPopupItem( 801, OB, mesh );                        // CREATE_GROUP
+  createPopupItem( 802, OB, subMesh );                     // CONSTRUCT_GROUP
+  popupMgr()->insert( separator(), -1, 0 );
+  createPopupItem( 1100, OB, hypo );                       // EDIT HYPOTHESIS
+  createPopupItem( 1102, OB, hyp_alg, "&& hasReference" ); // REMOVE HYPOTHESIS / ALGORITHMS
+  createPopupItem( 1101, OB, mesh_group + " " + hyp_alg ); // RENAME
+  popupMgr()->insert( separator(), -1, 0 );
+  createPopupItem( 125, OB, mesh );                        // EXPORT_MED
+  createPopupItem( 126, OB, mesh );                        // EXPORT_UNV
+  createPopupItem( 33, OB, subMesh + " " + group );        // DELETE
+  popupMgr()->insert( separator(), -1, 0 );
+
+  // popup for viewer
+  createPopupItem( 803, View, group ); // EDIT_GROUP
+  createPopupItem( 804, View, elems ); // ADD
+  createPopupItem( 805, View, elems ); // REMOVE
+  popupMgr()->insert( separator(), -1, 0 );
+  createPopupItem( 214, View, mesh_group ); // UPDATE
+  createPopupItem( 900, View, mesh_group ); // ADV_INFO
+  createPopupItem( 902, View, mesh );       // STD_INFO
+  popupMgr()->insert( separator(), -1, 0 );
+
+  int anId;
+  QString
+    isInvisible("not( isVisible )"),
+    isEmpty("numberOfNodes = 0"),
+    isNotEmpty("numberOfNodes <> 0"),
+
+    // has nodes, edges, etc in VISIBLE! actor
+    hasNodes("(numberOfNodes > 0 && isVisible)"),
+    hasElems("count( elemTypes ) > 0"),
+    hasDifferentElems("count( elemTypes ) > 1"),
+    hasEdges("{'Edge'} in elemTypes"),
+    hasFaces("{'Face'} in elemTypes"),
+    hasVolumes("{'Volume'} in elemTypes");
+
+  QString aSelCount = popupMgr()->selCountParam() + "= 1";
+  QString aClient = QString( popupMgr()->equality() )+ "client in {" + View + "}";
+  QString aType = QString( popupMgr()->equality() ) + "type in {" + mesh_group + "}";
+  QString aMeshInVTK = aClient + "&&" + aType + "&&" + aSelCount;
+  
+  //-------------------------------------------------
+  // Numbering
+  //-------------------------------------------------
+  anId = popupMgr()->insert( tr( "MEN_NUM" ), -1, -1 );
 
-  // get selection
-  SALOME_Selection* Sel = SALOME_Selection::Selection( myActiveStudy->getSelection() );
-  int nbSel = Sel->IObjectCount();
+  popupMgr()->insert( action( 9010 ), anId, -1 );
+  popupMgr()->setRule( action( 9010 ), aMeshInVTK + "&&" + hasNodes, true );
+  popupMgr()->setRule( action( 9010 ), "{'Point'} in labeledTypes", false );
 
-  if ( nbSel == 0 ) {
-    popup->clear();
-  }
-  else if ( nbSel == 1 ) {
-    if ( parentComp != parent->getActiveComponent() ) {
-      // object not belongs to SMESH module - remove all commands except common Display/Erase...
-      while ( 1 ) {
-       int id = popup->idAt( 0 );
-       if ( id <= QAD_TopLabel_Popup_ID )
-         popup->removeItemAt( 0 );
-       else
-         break;
-      }
-    }
-    else {
-      // get selected interactive object 
-      Handle(SALOME_InteractiveObject) IObject = Sel->firstIObject();
-      SALOMEDS::SObject_var SO = SMESH::GetActiveStudyDocument()->FindObjectID( IObject->getEntry() );
-      // find popup menu's TopLabel item
-      int topItem = popup->indexOf( QAD_TopLabel_Popup_ID );
-      if ( topItem >= 0 ) {
-       if ( theParent == "Viewer" ) {
-         // set bold font for popup menu's TopLabel item (Viewer popup)
-         QFont fnt = popup->font(); fnt.setBold( TRUE );
-         popup->removeItem( QAD_TopLabel_Popup_ID );
-         popup->insertItem( new CustomItem( QString( IObject->getName() ), fnt ), QAD_TopLabel_Popup_ID, topItem );
-       }
-       else if ( theParent == "ObjectBrowser" ) {
-         // remove popup menu's TopLabel item (Object Browser popup)
-         popup->removeItem( QAD_TopLabel_Popup_ID );
-       }
-      }
+  popupMgr()->insert( action( 9011 ), anId, -1 );
+  popupMgr()->setRule( action( 9011 ), aMeshInVTK + "&&" + hasElems, true );
+  popupMgr()->setRule( action( 9011 ), "{'Cell'} in labeledTypes", false );
 
-      if ( theObject == "Hypothesis" || theObject == "Algorithm" ) {
-       // remove Display/Erase commands
-       popup->removeItem( QAD_Display_Popup_ID );
-       popup->removeItem( QAD_DisplayOnly_Popup_ID );
-       popup->removeItem( QAD_Erase_Popup_ID );
-       // remove "Unassign ..." command if hyp/algo is not assigned
-       if ( SO->_is_nil() || !IObject->hasReference()/* !IsReferencedObject( SO ) */)
-         popup->removeItem( 1102 );
-      }
-      else if ( theObject == "Mesh" || theObject == "SubMesh" || theObject == "Group" ) {
-       // get actor
-       GEOM::GEOM_Object_var aShapeObject = SMESH::GetShapeOnMeshOrSubMesh( SO );
-       if ( aShapeObject->_is_nil() ) {
-         // imported mesh
-         popup->removeItem( 701 ); // Compute
-         popup->removeItem( 705 ); // Edit hypothesis
-         popup->removeItem( 706 ); // ...
-       }
-        SMESH::SMESH_GroupOnGeom_var aGeomGroup =
-          SMESH::SMESH_GroupOnGeom::_narrow( SO->GetObject() );
-        if ( !aGeomGroup->_is_nil()  ) // group linked on geometry
-         popup->removeItem( 803 ); // EDIT GROUP
-          
-       SMESH_Actor* anActor = SMESH::FindActorByEntry(IObject->getEntry());
-       // if object has actor
-       if ( anActor && studyFrame->getTypeView() == VIEW_VTK ) {
-         VTKViewer_RenderWindowInteractor* myRenderInter = SMESH::GetCurrentVtkView()->getRWInteractor();
-         if ( myRenderInter->isVisible( IObject ) ) {
-           popup->removeItem( QAD_Display_Popup_ID );
-           popup->setItemChecked( 9010, anActor->GetPointsLabeled() ); // Numbering / Display Nodes #
-           popup->setItemChecked( 9011, anActor->GetCellsLabeled() );  // Numbering / Display Elements #
-           TVisualObjPtr aVisualObj = anActor->GetObject();
-           int aNbEdges = aVisualObj->GetNbEntities(SMDSAbs_Edge);
-           int aNbFaces = aVisualObj->GetNbEntities(SMDSAbs_Face);
-           int aNbVolumes = aVisualObj->GetNbEntities(SMDSAbs_Volume);
-
-           QMenuItem* mi = popup->findItem( 1131 );
-           if ( mi && mi->popup() ) {
-             int  prType = anActor->GetRepresentation();
-             // Display Mode / Wireframe
-             if(aNbVolumes == 0 && aNbFaces == 0 && aNbEdges == 0){
-               mi->popup()->removeItem( 211 );
-             }else{
-               mi->popup()->setItemChecked( 211, prType == SMESH_Actor::eEdge );
-             }
-             // Display Mode / Shading
-             if(aNbFaces == 0 && aNbVolumes == 0){
-               mi->popup()->removeItem( 212 );
-             }else{
-               mi->popup()->setItemChecked( 212, prType == SMESH_Actor::eSurface );
-             }
-             // Display Mode / Points
-             mi->popup()->setItemChecked( 215, prType == SMESH_Actor::ePoint );  
-             // Display Mode / Shrink
-             bool isShrunk = anActor->IsShrunk();
-             bool isShrunkable = anActor->IsShrunkable();
-             mi->popup()->setItemChecked( 213, isShrunk );   
-             mi->popup()->setItemEnabled( 213, prType != SMESH_Actor::ePoint && isShrunkable);
-           }
+  popupMgr()->insert( separator(), -1, -1 );
 
-           // Display Entity
-           mi = popup->findItem( 1135 );
-           int aIsSomething=0;
-           if (aNbVolumes>0) aIsSomething++;
-           if (aNbFaces>0) aIsSomething++;
-           if (aNbEdges>0) aIsSomething++;
-           if ( mi && (aIsSomething <= 1)){
-             popup->removeItem(1135);
-           }else if ( mi && mi->popup() ) {
-             QPopupMenu* aPopup = mi->popup();
-             unsigned int aMode = anActor->GetEntityMode();
-             
-             bool aIsVolumesMode = aMode & SMESH_Actor::eVolumes;
-             bool aIsFacesMode   = aMode & SMESH_Actor::eFaces;
-             bool aIsEdgesMode   = aMode & SMESH_Actor::eEdges;
-             
-             if(aNbVolumes == 0)
-               aPopup->removeItem( 219 );
-             else
-               aPopup->setItemChecked( 219, aIsVolumesMode );
+  //-------------------------------------------------
+  // Display Mode
+  //-------------------------------------------------
+  anId = popupMgr()->insert( tr( "MEN_DISPMODE" ), -1, -1 );
 
-             if(aNbFaces == 0)
-               aPopup->removeItem( 218 );
-             else
-               aPopup->setItemChecked( 218, aIsFacesMode );
+  popupMgr()->insert( action( 211 ), anId, -1 ); // WIRE
+  popupMgr()->setRule( action( 211 ), aMeshInVTK + "&&" + hasElems, true );
+  popupMgr()->setRule( action( 211 ), "displayMode = 'eEdge'", false );
 
+  popupMgr()->insert( action( 212 ), anId, -1 ); // SHADE
+  popupMgr()->setRule( action( 212 ),aMeshInVTK+ "&& (" + hasFaces + "||" + hasVolumes + ")",true);
+  popupMgr()->setRule( action( 212 ), "displayMode = 'eSurface'", false );
 
-             if(aNbEdges == 0)
-               aPopup->removeItem( 217 );
-             else
-               aPopup->setItemChecked( 217, aIsEdgesMode );
+  popupMgr()->insert( action( 215 ), anId, -1 ); // POINTS
+  popupMgr()->setRule( action( 215 ), aMeshInVTK + "&&" + hasNodes, true );
+  popupMgr()->setRule( action( 215 ), "displayMode = 'ePoint'", false );
 
+  popupMgr()->insert( separator(), anId, -1 );
 
-             bool aIsRemove = (aNbVolumes == 0 || aIsVolumesMode);
-             aIsRemove &= (aNbFaces == 0 || aIsFacesMode);
-             aIsRemove &= (aNbEdges == 0 || aIsEdgesMode);
+  popupMgr()->insert( action( 213 ), anId, -1 ); // SHRINK
+  popupMgr()->setRule( action( 213 ), aMeshInVTK + "&& shrinkMode <> 'IsNotShrinkable' && displayMode <> 'ePoint'",true);
+  popupMgr()->setRule( action( 213 ), "shrinkMode = 'IsShrunk'", false );
 
-             if(aIsRemove)
-               aPopup->removeItem( 220 );
-           }
+  //-------------------------------------------------
+  // Display Entity
+  //-------------------------------------------------
+  QString aDiffElemsInVTK = aMeshInVTK + "&&" + hasDifferentElems;
 
-           // Controls
-           mi = popup->findItem( 2000 );
-           if ( mi && mi->popup() ) {
-             SMESH_Actor::eControl cMode = anActor->GetControlMode();
-             switch ( cMode ) {
-             case SMESH_Actor::eLength:
-               mi->popup()->setItemChecked( 6001, true ); break;
-             case SMESH_Actor::eLength2D:
-               mi->popup()->setItemChecked( 6018, true ); break;
-             case SMESH_Actor::eFreeEdges:
-               mi->popup()->setItemChecked( 6002, true );
-               mi->popup()->removeItem( 201 );
-               break;
-             case SMESH_Actor::eFreeBorders:
-               mi->popup()->setItemChecked( 6003, true );
-               mi->popup()->removeItem( 201 );
-               break;
-             case SMESH_Actor::eMultiConnection:
-               mi->popup()->setItemChecked( 6004, true ); break;
-             case SMESH_Actor::eMultiConnection2D:
-               mi->popup()->setItemChecked( 6019, true ); break;
-             case SMESH_Actor::eArea:
-               mi->popup()->setItemChecked( 6011, true ); break;
-             case SMESH_Actor::eTaper:
-               mi->popup()->setItemChecked( 6012, true ); break;
-             case SMESH_Actor::eAspectRatio:
-               mi->popup()->setItemChecked( 6013, true ); break;
-             case SMESH_Actor::eAspectRatio3D:
-               mi->popup()->setItemChecked( 6017, true ); break;
-             case SMESH_Actor::eMinimumAngle:
-               mi->popup()->setItemChecked( 6014, true ); break;
-             case SMESH_Actor::eWarping:
-               mi->popup()->setItemChecked( 6015, true ); break;
-             case SMESH_Actor::eSkew:
-               mi->popup()->setItemChecked( 6016, true ); break;
-             case SMESH_Actor::eNone:
-             default:
-               mi->popup()->removeItem( 200 );
-               mi->popup()->removeItem( 201 );
-               break;
-             }
-             TVisualObjPtr aVisualObj = anActor->GetObject();
-             if(aNbEdges == 0){
-               mi->popup()->removeItem( 6001 );
-               mi->popup()->removeItem( 6003 );
-               mi->popup()->removeItem( 6004 );
-             }
-             if(aNbFaces == 0){
-               mi->popup()->removeItem( 6018 );
-               mi->popup()->removeItem( 6002 );
-               mi->popup()->removeItem( 6011 );
-               mi->popup()->removeItem( 6012 );
-               mi->popup()->removeItem( 6013 );
-               mi->popup()->removeItem( 6014 );
-               mi->popup()->removeItem( 6015 );
-               mi->popup()->removeItem( 6016 );
-               mi->popup()->removeItem( 6019 );
-             }
-             if(aNbVolumes == 0){
-               mi->popup()->removeItem( 6017 );
-             }
-             if(aNbFaces == 0 && aNbEdges == 0 && aNbVolumes == 0)
-               popup->removeItem( 2000 );                         // Scalar Bar
-           }
-         }
-         else {
-           popup->removeItem( QAD_Erase_Popup_ID );
-           popup->removeItem( 114 );                              // Numbering popup menu
-           popup->removeItem( 1131 );                             // Display mode
-           popup->removeItem( 1132 );                             // Color / size
-           popup->removeItem( 1133 );                             // Transparency
-           popup->removeItem( 1134 );                             // Clipping
-           popup->removeItem( 2000 );                             // Scalar Bar
-         }
-         // VSR 03/02/05 - check if actor is empty ----- start -----
-         vtkUnstructuredGrid* vtkGrid = anActor->GetUnstructuredGrid();
-         if ( vtkGrid->GetNumberOfPoints() + vtkGrid->GetNumberOfCells() == 0 ) {
-           popup->removeItem( QAD_Display_Popup_ID );
-           popup->removeItem( QAD_DisplayOnly_Popup_ID );
-           popup->removeItem( QAD_Erase_Popup_ID );
-         }
-         // VSR 03/02/05 - check if actor is empty ----- finish -----
-       }
-       else {
-         // object doesn't have actor
-         CORBA::Object_var anObject = SO->GetObject();
-         bool bDisplay = false;
-         if ( !CORBA::is_nil( anObject ) ) {
-           SMESH::SMESH_Mesh_var aMeshObj = SMESH::SMESH_Mesh::_narrow( anObject );
-           if ( !aMeshObj->_is_nil() && ( aMeshObj->NbNodes() > 0 || aMeshObj->NbFaces() > 0  || aMeshObj->NbVolumes() > 0 ) )
-             bDisplay = true;
-           SMESH::SMESH_subMesh_var aSubMeshObj = SMESH::SMESH_subMesh::_narrow( anObject );
-           if ( !aSubMeshObj->_is_nil() && ( aSubMeshObj->GetNumberOfNodes(false) > 0 || aSubMeshObj->GetNumberOfElements() > 0 ) )
-             bDisplay = true;
-           SMESH::SMESH_GroupBase_var aGroupObj = SMESH::SMESH_GroupBase::_narrow( anObject );
-           if ( !aGroupObj->_is_nil() && aGroupObj->Size() > 0 )
-             bDisplay = true;
-         }
-         if ( !bDisplay ) {
-           popup->removeItem( QAD_Display_Popup_ID );
-           popup->removeItem( QAD_DisplayOnly_Popup_ID );
-         }
-         popup->removeItem( QAD_Erase_Popup_ID );
-         popup->removeItem( 114 );                              // Numbering popup menu
-         popup->removeItem( 1131 );                             // Display mode
-         popup->removeItem( 1132 );                             // Color / size
-         popup->removeItem( 1133 );                             // Transparency
-         popup->removeItem( 1134 );                             // Clipping
-         popup->removeItem( 2000 );                             // Scalar Bar
-       }
-      }
-      else if( theObject!="Component" ) {
-       // another SMESH object
-       popup->removeItem( QAD_Display_Popup_ID );
-       popup->removeItem( QAD_DisplayOnly_Popup_ID );
-       popup->removeItem( QAD_Erase_Popup_ID );
-      }
-    }
-  }
-  else {
-    // multiple selection
-    if ( parentComp != parent->getActiveComponent() ) {
-      // object not belongs to SMESH module - remove all commands except common Display/Erase...
-      while ( 1 )      {
-       int id = popup->idAt( 0 );
-       if ( id <= QAD_TopLabel_Popup_ID )
-         popup->removeItemAt( 0 );
-       else
-         break;
-      }
-      if ( parentComp.isNull() ) {
-       // objects from different components are selected
-       popup->removeItem( QAD_DisplayOnly_Popup_ID );
-       popup->removeItem( QAD_Display_Popup_ID );
-       popup->removeItem( QAD_Erase_Popup_ID );
-      }
-    }
-    else {
-      QString type = ::CheckHomogeneousSelection();
-      if ( type != "Heterogeneous Selection" ) {
-       int topItem = popup->indexOf( QAD_TopLabel_Popup_ID );
-       if ( topItem >= 0 ) {
-         // set bold font for popup menu's TopLabel item
-         QFont fnt = popup->font(); fnt.setBold( TRUE );
-         popup->removeItem( QAD_TopLabel_Popup_ID );
-         popup->insertItem( new CustomItem( QString("%1 ").arg( nbSel ) + type + "(s) ", fnt ), QAD_TopLabel_Popup_ID, topItem );
-       }
-      }
-    }
-  }
-  return false;
+  anId = popupMgr()->insert( tr( "MEN_DISP_ENT" ), -1, -1 );
+
+  popupMgr()->insert( action( 217 ), anId, -1 ); // EDGES
+  popupMgr()->setRule( action( 217 ), aDiffElemsInVTK + "&&" + hasEdges, true );
+  popupMgr()->setRule( action( 217 ), "{'Edge'} in entityMode", false );
+
+  popupMgr()->insert( action( 218 ), anId, -1 ); // FACES
+  popupMgr()->setRule( action( 218 ), aDiffElemsInVTK + "&&" + hasFaces, true );
+  popupMgr()->setRule( action( 218 ), "{'Face'} in entityMode", false );
+
+  popupMgr()->insert( action( 219 ), anId, -1 ); // VOLUMES
+  popupMgr()->setRule( action( 219 ), aDiffElemsInVTK + "&&" + hasVolumes, true );
+  popupMgr()->setRule( action( 219 ), "{'Volume'} in entityMode", false );
+
+  popupMgr()->insert( separator(), anId, -1 );
+
+  popupMgr()->insert( action( 220 ), anId, -1 ); // ALL
+  popupMgr()->setRule( action( 220 ), aDiffElemsInVTK + "&& not( elemTypes in entityMode )", true );
+
+  //-------------------------------------------------
+  // Color / Size
+  //-------------------------------------------------
+  popupMgr()->insert( action( 1132 ), -1, -1 );
+  popupMgr()->setRule( action( 1132 ), aMeshInVTK + "&& isVisible", true );
+
+  //-------------------------------------------------
+  // Transparency
+  //-------------------------------------------------
+  popupMgr()->insert( action( 1133 ), -1, -1 );
+  popupMgr()->setRule( action( 1133 ), aMeshInVTK + "&& isVisible", true );
+
+  //-------------------------------------------------
+  // Clipping
+  //-------------------------------------------------
+  popupMgr()->insert( action( 1134 ), -1, -1 );
+  popupMgr()->setRule( action( 1134 ), aMeshInVTK + "&& isVisible", true );
+
+  popupMgr()->insert( separator(), -1, -1 );
+
+  //-------------------------------------------------
+  // Controls
+  //-------------------------------------------------
+  QString
+    aMeshInVtkHasEdges = aMeshInVTK + "&&" + hasEdges,
+    aMeshInVtkHasFaces = aMeshInVTK + "&&" + hasFaces,
+    aMeshInVtkHasVolumes = aMeshInVTK + "&&" + hasVolumes;
+
+  anId = popupMgr()->insert( tr( "MEN_CTRL" ), -1, -1 );
+
+  popupMgr()->insert( action( 200 ), anId, -1 ); // RESET
+  popupMgr()->setRule( action( 200 ), aMeshInVTK + "&& controlMode <> 'eNone'", true );
+
+  popupMgr()->insert( separator(), anId, -1 );
+
+  popupMgr()->insert( action( 6003 ), anId, -1 ); // FREE_BORDER
+  popupMgr()->setRule( action( 6003 ), aMeshInVtkHasEdges, true );
+  popupMgr()->setRule( action( 6003 ), "&& controlMode = 'eFreeEdges'", true );
+
+  popupMgr()->insert( action( 6001 ), anId, -1 ); // LENGTH
+  popupMgr()->setRule( action( 6001 ), aMeshInVtkHasEdges, true );
+  popupMgr()->setRule( action( 6001 ), "&& controlMode = 'eLength'", true );
+
+  popupMgr()->insert( action( 6004 ), anId, -1 ); // CONNECTION
+  popupMgr()->setRule( action( 6004 ), aMeshInVtkHasEdges, true );
+  popupMgr()->setRule( action( 6004 ), "&& controlMode = 'eMultiConnection'", true );
+
+  popupMgr()->insert( separator(), anId, -1 );
+
+  popupMgr()->insert( action( 6002 ), anId, -1 ); // FREE_EDGE
+  popupMgr()->setRule( action( 6002 ), aMeshInVtkHasFaces, true );
+  popupMgr()->setRule( action( 6002 ), "&& controlMode = 'eFreeBorders'", true );
+
+  popupMgr()->insert( action( 6018 ), anId, -1 ); // LENGTH_2D
+  popupMgr()->setRule( action( 6018 ), aMeshInVtkHasFaces, true );
+  popupMgr()->setRule( action( 6018 ), "&& controlMode = 'eLength2D'", true );
+
+  popupMgr()->insert( action( 6019 ), anId, -1 ); // CONNECTION_2D
+  popupMgr()->setRule( action( 6019 ), aMeshInVtkHasFaces, true );
+  popupMgr()->setRule( action( 6019 ), "&& controlMode = 'eMultiConnection2D'", true );
+
+  popupMgr()->insert( action( 6011 ), anId, -1 ); // AREA
+  popupMgr()->setRule( action( 6011 ), aMeshInVtkHasFaces, true );
+  popupMgr()->setRule( action( 6011 ), "&& controlMode = 'eArea'", true );
+
+  popupMgr()->insert( action( 6012 ), anId, -1 ); // TAPER
+  popupMgr()->setRule( action( 6012 ), aMeshInVtkHasFaces, true );
+  popupMgr()->setRule( action( 6012 ), "&& controlMode = 'eTaper'", true );
+
+  popupMgr()->insert( action( 6013 ), anId, -1 ); // ASPECT
+  popupMgr()->setRule( action( 6013 ), aMeshInVtkHasFaces, true );
+  popupMgr()->setRule( action( 6013 ), "&& controlMode = 'eAspectRatio'", true );
+
+  popupMgr()->insert( action( 6014 ), anId, -1 ); // MIN_ANG
+  popupMgr()->setRule( action( 6014 ), aMeshInVtkHasFaces, true );
+  popupMgr()->setRule( action( 6014 ), "&& controlMode = 'eMinimumAngle'", true );
+
+  popupMgr()->insert( action( 6015 ), anId, -1 ); // WRAP
+  popupMgr()->setRule( action( 6015 ), aMeshInVtkHasFaces, true );
+  popupMgr()->setRule( action( 6015 ), "&& controlMode = 'eWarping'", true );
+
+  popupMgr()->insert( action( 6016 ), anId, -1 ); // SKEW
+  popupMgr()->setRule( action( 6016 ), aMeshInVtkHasFaces, true );
+  popupMgr()->setRule( action( 6016 ), "&& controlMode = 'eSkew'", true );
+
+  popupMgr()->insert( separator(), anId, -1 );
+
+  popupMgr()->insert( action( 6017 ), anId, -1 ); // ASPECT_3D
+  popupMgr()->setRule( action( 6017 ), aMeshInVtkHasVolumes, true );
+  popupMgr()->setRule( action( 6017 ), "&& controlMode = 'eAspectRatio3D'", true );
+
+  popupMgr()->insert( separator(), anId, -1 );
+
+  popupMgr()->insert( action( 201 ), anId, -1 ); // SCALAR_BAR_PROP
+  popupMgr()->setRule( action( 201 ), aMeshInVTK + "&& controlMode <> 'eNone'", true );
+
+  popupMgr()->insert( separator(), -1, -1 );
+
+  //-------------------------------------------------
+  // Display / Erase
+  //-------------------------------------------------
+  aClient = "($client in {'VTKViewer' 'ObjectBrowser'})";
+  QString aRule = aClient + " and " + aType + " and " + aSelCount;
+  popupMgr()->insert( action( 301 ), -1, -1 ); // DISPLAY
+  popupMgr()->setRule( action( 301 ), aRule + "&&" + isNotEmpty + "&&" + isInvisible, true);
+
+  popupMgr()->insert( action( 300 ), -1, -1 ); // ERASE
+  popupMgr()->setRule( action( 300 ), aRule + "&&" + isNotEmpty + "&& isVisible", true );
+
+  popupMgr()->insert( action( 302 ), -1, -1 ); // DISPLAY_ONLY
+  popupMgr()->setRule( action( 302 ), aRule + "&&" + isNotEmpty, true );
+
+  popupMgr()->insert( separator(), -1, -1 );
 }
 
-//=============================================================================
-/*! Method:  BuildPresentation(const Handle(SALOME_InteractiveObject)& theIO)
- *  Purpose: ensures that the actor for the given <theIO> exists in the active VTK view
- */
-//=============================================================================
-void SMESHGUI::BuildPresentation( const Handle(SALOME_InteractiveObject) & theIO,
-                                  QAD_ViewFrame* )
+void SMESHGUI::activateModule( SUIT_Study* study )
 {
-  if(theIO->hasEntry()){
-    QAD_Study* aStudy = SMESHGUI::GetSMESHGUI()->GetActiveStudy();
-    QAD_StudyFrame *aStudyFrame = aStudy->getActiveStudyFrame();
-    SMESH::UpdateView(aStudyFrame,SMESH::eDisplay,theIO->getEntry());
-  }
+  SalomeApp_Module::activateModule( study );
+
+  setMenuShown( true );
+  setToolShown( true );
+
+  //SetSettings( desktop() );
 }
 
-void SMESHGUI::SupportedViewType(int *buffer, int bufferSize)
+void SMESHGUI::deactivateModule( SUIT_Study* study )
 {
-  if (!buffer || !bufferSize)
+  setMenuShown( false );
+  setToolShown( false );
+
+  EmitSignalCloseAllDialogs();
+  
+  SalomeApp_Module::deactivateModule( study );
+}
+
+void SMESHGUI::OnGUIEvent()
+{
+  const QObject* obj = sender();
+  if ( !obj || !obj->inherits( "QAction" ) )
     return;
-  buffer[0] = (int)VIEW_VTK;
+  int id = actionId((QAction*)obj);
+  if ( id != -1 )
+    OnGUIEvent( id );
 }
 
-void SMESHGUI::Deactivate()
+SMESH::SMESH_Gen_var SMESHGUI::GetSMESHGen()
 {
-  if ( SMESHGUI::GetSMESHGUI() ) {
-    SMESHGUI::GetSMESHGUI()->EmitSignalCloseAllDialogs();
-  }
+  return myComponentSMESH;
+}
+
+QString SMESHGUI::engineIOR() const
+{
+  CORBA::ORB_var anORB = getApp()->orb();
+  CORBA::String_var anIOR = anORB->object_to_string(GetSMESHGen());
+  return anIOR.in();
+}
+
+void SMESHGUI::contextMenuPopup( const QString& client, QPopupMenu* menu, QString& /*title*/ )
+{
+  SMESHGUI_Selection sel( client, selectionMgr() );
+  popupMgr()->updatePopup( menu, &sel );
+}
+
+void SMESHGUI::windows( QMap<int, int>& aMap ) const
+{
+  aMap.insert( SalomeApp_Application::WT_ObjectBrowser, Qt::DockLeft );
+  aMap.insert( SalomeApp_Application::WT_PyConsole, Qt::DockBottom );
+}
+
+void SMESHGUI::viewManagers( QStringList& list ) const
+{
+  list.append( SVTK_Viewer::Type() );
 }
index 4905f783f9e499d429166805147839652a76f3b9..3ed5b2922b441efad5a024fccf2d6da11916abaf 100644 (file)
@@ -11,7 +11,7 @@
 //  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. 
+//  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 
 #define SMESHGUI_HeaderFile
 
 // SALOME Includes
-#include "SALOMEGUI.h"
-#include "SALOME_InteractiveObject.hxx"
+#include <SalomeApp_Module.h>
+#include <SALOME_InteractiveObject.hxx>
 
-class QAD_Desktop;
-class QAD_Study;
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(SMESH_Gen)
 
 class QDialog;
 
+class SUIT_Desktop;
+class SUIT_Study;
+class SUIT_ViewWindow;
+class SUIT_ResourceMgr;
+class SUIT_ViewManager;
+
+class SalomeApp_Study;
+class SalomeApp_SelectionMgr;
+
 
 //=================================================================================
 // class    : SMESHGUI
 // purpose  :
 //=================================================================================
-class SMESHGUI : public SALOMEGUI
+class SMESHGUI : public SalomeApp_Module
 {
   Q_OBJECT;
 
-private :
-  QAD_Desktop* myDesktop;
-  QAD_Study* myActiveStudy;
-  QDialog* myActiveDialogBox;
-
-  int myState;
-  bool myAutomaticUpdate;
-
 public :
-  SMESHGUI( const QString& name = "", QObject* parent = 0 );
-  static SMESHGUI*    GetSMESHGUI() ;
+  SMESHGUI();
   ~SMESHGUI();
 
-  QAD_Desktop*        GetDesktop() ;
-  QAD_Study*          GetActiveStudy() ;
-  bool                ActiveStudyLocked();
+  static SMESH::SMESH_Gen_var     GetSMESHGen();
+  static SMESHGUI*                GetSMESHGUI();
+  static SalomeApp_SelectionMgr*  selectionMgr();
+  static SUIT_ResourceMgr*        resourceMgr();
+  static SUIT_Desktop*            desktop() ;
+  static SalomeApp_Study*         activeStudy();
+  bool                            isActiveStudyLocked();
+
+  virtual QString     engineIOR() const;
+  virtual void        initialize( CAM_Application* );
+  virtual void        windows( QMap<int, int>& ) const;
+  virtual void        viewManagers( QStringList& ) const;
 
-  QDialog*            GetActiveDialogBox() ;               
-  void                SetActiveDialogBox(QDialog* aDlg) ;  
+  QDialog*            GetActiveDialogBox() ;
+  void                SetActiveDialogBox(QDialog* aDlg) ;
 
-  void                ResetState() ;                       
+  void                ResetState() ;
   void                SetState(int aState) ;
   bool                DefineDlgPosition(QWidget* aDlg, int& x, int& y) ;
 
-  virtual bool OnGUIEvent        (int theCommandID, QAD_Desktop* parent);
-  virtual bool OnMousePress      (QMouseEvent* pe, QAD_Desktop* parent, QAD_StudyFrame* studyFrame);
-  virtual bool OnMouseMove       (QMouseEvent* pe, QAD_Desktop* parent, QAD_StudyFrame* studyFrame);
-  virtual bool OnKeyPress        (QKeyEvent* pe, QAD_Desktop* parent, QAD_StudyFrame* studyFrame);
-  virtual bool ActiveStudyChanged( QAD_Desktop* parent );
-  virtual bool SetSettings       ( QAD_Desktop* parent );
-  virtual void DefinePopup       ( QString & theContext, QString & theParent, QString & theObject );
-  virtual bool CustomPopup       ( QAD_Desktop* parent, QPopupMenu* popup, const QString & theContext,
-                                   const QString & theParent, const QString & theObject );
-  virtual void BuildPresentation ( const Handle(SALOME_InteractiveObject)& theIO,
-                                   QAD_ViewFrame* = 0 );
-  virtual void SupportedViewType (int* buffer, int bufferSize);
-  virtual void Deactivate        ();
-
-  /* Non modal dialog boxes magement */
+  virtual bool OnGUIEvent        ( int id );
+  virtual bool OnMousePress      ( QMouseEvent*, SUIT_ViewWindow* );
+  virtual bool OnMouseMove       ( QMouseEvent*, SUIT_ViewWindow* );
+  virtual bool OnKeyPress        ( QKeyEvent*, SUIT_ViewWindow* );
+
+  virtual void contextMenuPopup( const QString&, QPopupMenu*, QString& );
+
+  virtual bool SetSettings       ( SUIT_Desktop* );
+  virtual void BuildPresentation ( const Handle(SALOME_InteractiveObject)&,
+                                   SUIT_ViewWindow* = 0 );
+
+  /* Non modal dialog boxes management */
   void EmitSignalDeactivateDialog() ;
   void EmitSignalStudyFrameChanged() ;
   void EmitSignalCloseAllDialogs() ;
 
+public slots:
+  virtual void                deactivateModule( SUIT_Study* );
+  virtual void                activateModule( SUIT_Study* );
+
+private slots:
+  void OnGUIEvent();
+
 signals:
   void SignalDeactivateActiveDialog() ;
   void SignalStudyFrameChanged() ;
   void SignalCloseAllDialogs() ;
 
+protected:
+  void createSMESHAction( const int, const QString&, const QString& = QString(""),
+                          const int = 0, const bool = false );
+  void createPopupItem( const int, const QString&, const QString&,
+                        const QString& = QString::null, const int = -1 );
+
+private :
+  static SMESH::SMESH_Gen_var      myComponentSMESH;
+  QDialog*                         myActiveDialogBox;
+  int                              myState;
+  bool                             myAutomaticUpdate;
+  QMap<int,QString>                myRules;
 };
 
 
index f7860c7995278b8538da5a60c824de1af44fe0ba..a15542896d3dc1096a00767baafa98bea2f529b3 100644 (file)
@@ -1,23 +1,23 @@
 //  SMESH SMESHGUI : GUI for SMESH component
 //
 //  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
-// 
-//  This library is free software; you can redistribute it and/or 
-//  modify it under the terms of the GNU Lesser General Public 
-//  License as published by the Free Software Foundation; either 
-//  version 2.1 of the License. 
-// 
-//  This library is distributed in the hope that it will be useful, 
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of 
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
-//  Lesser General Public License for more details. 
-// 
-//  You should have received a copy of the GNU Lesser General Public 
-//  License along with this library; if not, write to the Free Software 
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
-// 
-//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
 //
 //
 //
 #include "SMESHGUI_MeshUtils.h"
 #include "SMESHGUI_IdValidator.h"
 #include "SMESH_ActorUtils.h"
-#include "VTKViewer_ViewFrame.h"
+
 #include "SMDS_Mesh.hxx"
 #include "SMESH_Actor.h"
 
-#include "QAD_Application.h"
-#include "QAD_Desktop.h"
-#include "QAD_MessageBox.h"
+#include "SUIT_Session.h"
+
+#include "SVTK_Selection.h"
+#include "SVTK_Selector.h"
+#include "SALOME_ListIO.hxx"
+#include "SALOME_ListIteratorOfListIO.hxx"
+
+#include "SalomeApp_Study.h"
+#include "SalomeApp_Application.h"
+
+#include "SVTK_ViewModel.h"
+#include "SVTK_ViewWindow.h"
 
 #include "utilities.h"
 
+// OCCT Includes
+#include <TColStd_MapOfInteger.hxx>
+#include <TColStd_IndexedMapOfInteger.hxx>
+
+// VTK Includes
 #include <vtkCell.h>
 #include <vtkIdList.h>
 #include <vtkIntArray.h>
 #include <qcheckbox.h>
 #include <qregexp.h>
 
+// STL includes
 #include <list>
-#include <TColStd_IndexedMapOfInteger.hxx>
 
 using namespace std;
 
-namespace SMESH{
+namespace SMESH {
 
-  class TElementSimulation{
-    QAD_Study* myStudy;
-    QAD_StudyFrame* myStudyFrame;
-    VTKViewer_ViewFrame* myViewFrame;
+  class TElementSimulation {
+    SalomeApp_Application* myApplication;
+    SUIT_ViewWindow* myViewWindow;
+    SVTK_ViewWindow* myVTKViewWindow;
 
-    SALOME_Actor *myPreviewActor;
+    SALOME_ActormyPreviewActor;
     vtkDataSetMapper* myMapper;
     vtkUnstructuredGrid* myGrid;
 
   public:
-
-    TElementSimulation(QAD_Study* theStudy):
-      myStudy(theStudy),
-      myStudyFrame(theStudy->getActiveStudyFrame()),
-      myViewFrame(GetVtkViewFrame(theStudy->getActiveStudyFrame()))
+    TElementSimulation (SalomeApp_Application* theApplication)
     {
+      myApplication = theApplication;
+      SUIT_ViewManager* mgr = theApplication->activeViewManager();
+      if (!mgr) return;
+      myViewWindow = mgr->getActiveView();
+      myVTKViewWindow = GetVtkViewWindow(myViewWindow);
+
       myGrid = vtkUnstructuredGrid::New();
-  
+
       // Create and display actor
       myMapper = vtkDataSetMapper::New();
-      myMapper->SetInput( myGrid );
+      myMapper->SetInput(myGrid);
 
       myPreviewActor = SALOME_Actor::New();
       myPreviewActor->PickableOff();
       myPreviewActor->VisibilityOff();
-      myPreviewActor->SetMapper( myMapper );
+      myPreviewActor->SetMapper(myMapper);
 
       vtkProperty* aProp = vtkProperty::New();
       float anRGB[3];
@@ -109,7 +124,7 @@ namespace SMESH{
       anRGB[1] = GetFloat("SMESH:SettingsFillColorGreen", 170)/255.;
       anRGB[2] = GetFloat("SMESH:SettingsFillColorBlue", 255)/255.;
       aProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
-      myPreviewActor->SetProperty( aProp );
+      myPreviewActor->SetProperty(aProp);
       aProp->Delete();
 
       vtkProperty* aBackProp = vtkProperty::New();
@@ -117,39 +132,41 @@ namespace SMESH{
       anRGB[1] = GetFloat("SMESH:SettingsBackFaceColorGreen", 0)/255.;
       anRGB[2] = GetFloat("SMESH:SettingsBackFaceColorBlue", 255)/255.;
       aBackProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
-      myPreviewActor->SetBackfaceProperty( aBackProp );
+      myPreviewActor->SetBackfaceProperty(aBackProp);
       aBackProp->Delete();
 
-      myViewFrame->AddActor( myPreviewActor );
-
+      myVTKViewWindow->AddActor(myPreviewActor);
     }
 
-
     typedef std::vector<vtkIdType> TVTKIds;
-    void SetPosition(SMESH_Actor* theActor, 
-                    vtkIdType theType, 
-                    const TVTKIds& theIds)
+    void SetPosition (SMESH_Actor* theActor,
+                      vtkIdType theType,
+                      const TVTKIds& theIds)
     {
       vtkUnstructuredGrid *aGrid = theActor->GetUnstructuredGrid();
       myGrid->SetPoints(aGrid->GetPoints());
 
       const int* aConn = NULL;
-      switch(theType){
-      case VTK_TETRA:{
-       static int anIds[] = {0,2,1,3};
-       aConn = anIds;
-       break;
+      switch (theType) {
+      case VTK_TETRA:
+        {
+          static int anIds[] = {0,2,1,3};
+          aConn = anIds;
+          break;
+        }
+      case VTK_PYRAMID:
+        {
+          static int anIds[] = {0,3,2,1,4};
+          aConn = anIds;
+          break;
+        }
+      case VTK_HEXAHEDRON:
+        {
+          static int anIds[] = {0,3,2,1,4,7,6,5};
+          aConn = anIds;
+          break;
+        }
       }
-      case VTK_PYRAMID:{
-       static int anIds[] = {0,3,2,1,4};
-       aConn = anIds;
-       break;
-      }
-      case VTK_HEXAHEDRON:{
-       static int anIds[] = {0,3,2,1,4,7,6,5};
-       aConn = anIds;
-       break;
-      }}
 
       myGrid->Reset();
       vtkIdList *anIds = vtkIdList::New();
@@ -170,15 +187,17 @@ namespace SMESH{
     }
 
 
-    void SetVisibility(bool theVisibility){
+    void SetVisibility (bool theVisibility)
+    {
       myPreviewActor->SetVisibility(theVisibility);
       RepaintCurrentView();
     }
 
 
-    ~TElementSimulation(){
-      if(FindVtkViewFrame(myStudy,myStudyFrame)){
-       myViewFrame->RemoveActor(myPreviewActor);
+    ~TElementSimulation()
+    {
+      if (FindVtkViewWindow(myApplication->activeViewManager(), myViewWindow)) {
+       myVTKViewWindow->RemoveActor(myPreviewActor);
       }
       myPreviewActor->Delete();
 
@@ -187,35 +206,40 @@ namespace SMESH{
 
       myGrid->Delete();
     }
-
   };
-
 }
 
 //=================================================================================
-// class    : SMESHGUI_AddMeshElementDlg()
-// purpose  : 
+// function : SMESHGUI_AddMeshElementDlg()
+// purpose  : constructor
 //=================================================================================
-SMESHGUI_AddMeshElementDlg::SMESHGUI_AddMeshElementDlg( QWidget* parent, const char* name,
-                                                       SALOME_Selection* Sel, 
-                                                       SMDSAbs_ElementType ElementType, int nbNodes,
-                                                       bool modal, WFlags fl )
-    : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu |
-              Qt::WDestructiveClose)
+SMESHGUI_AddMeshElementDlg::SMESHGUI_AddMeshElementDlg( SMESHGUI* theModule,
+                                                       const char* name,
+                                                        SMDSAbs_ElementType ElementType, int nbNodes,
+                                                        bool modal, WFlags fl)
+     : QDialog( SMESH::GetDesktop( theModule ), name, modal, WStyle_Customize | WStyle_NormalBorder |
+                WStyle_Title | WStyle_SysMenu | Qt::WDestructiveClose),
+     mySMESHGUI( theModule ),
+     mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ),
+     myViewWindow( SMESH::GetViewWindow( theModule ) ),
+     mySelector( myViewWindow->GetSelector() )
 {
-  mySimulation = new SMESH::TElementSimulation(SMESH::GetActiveStudy());
+  SalomeApp_Application* anApp = dynamic_cast<SalomeApp_Application*>
+    (SUIT_Session::session()->activeApplication());
+  myIsPoly = false;
+  mySimulation = new SMESH::TElementSimulation (anApp);
 
   // verify nb nodes and type
   myNbNodes = nbNodes;
   myElementType = ElementType;
-  switch ( ElementType ) {
+  switch (ElementType) {
   case SMDSAbs_Face:
-    if ( myNbNodes != 3 && myNbNodes != 4 )
-      myNbNodes = 3;
-    break;
+//     if (myNbNodes != 3 && myNbNodes != 4)
+//       myNbNodes = 3;
+//     break;
   case SMDSAbs_Volume:
-    if ( myNbNodes != 4 && myNbNodes != 8 ) //(nbNodes < 4 || nbNodes > 8 || nbNodes == 7)
-      myNbNodes = 4;
+//     if (myNbNodes != 4 && myNbNodes != 8) //(nbNodes < 4 || nbNodes > 8 || nbNodes == 7)
+//       myNbNodes = 4;
     break;
   default:
     myElementType = SMDSAbs_Edge;
@@ -223,126 +247,133 @@ SMESHGUI_AddMeshElementDlg::SMESHGUI_AddMeshElementDlg( QWidget* parent, const c
   }
 
   QString elemName;
-  switch ( myNbNodes ) {
-  case 2: elemName = "EDGE"; break;
-  case 3: elemName = "TRIANGLE"; break;
-  case 4: elemName =
-    myElementType == SMDSAbs_Face ? elemName = "QUADRANGLE" : elemName = "TETRAS"; break;
-//   case 5:
-//   case 6:
-  default: // 8
+  if (myNbNodes == 2)
+    elemName = "EDGE";
+  else if (myNbNodes == 3)
+    elemName = "TRIANGLE";
+  else if (myNbNodes == 4)
+    if (myElementType == SMDSAbs_Face)
+      elemName = "QUADRANGLE";
+    else
+      elemName = "TETRAS";
+  else if (myNbNodes == 8)
     elemName = "HEXAS";
+  else if (myElementType == SMDSAbs_Face){
+    elemName = "POLYGON";
+    myIsPoly = true;
   }
-  QString iconName      = tr( QString("ICON_DLG_%1").arg(elemName) );
-  QString buttonGrTitle = tr( QString("SMESH_%1").arg(elemName) );
-  QString caption       = tr( QString("SMESH_ADD_%1_TITLE").arg(elemName) );
-  QString grBoxTitle    = tr( QString("SMESH_ADD_%1").arg(elemName) );
-    
-  QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "SMESH", iconName ));
-  QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "SMESH", tr("ICON_SELECT")));
+  
+  QString iconName      = tr(QString("ICON_DLG_%1").arg(elemName));
+  QString buttonGrTitle = tr(QString("SMESH_%1").arg(elemName));
+  QString caption       = tr(QString("SMESH_ADD_%1_TITLE").arg(elemName));
+  QString grBoxTitle    = tr(QString("SMESH_ADD_%1").arg(elemName));
+
+  QPixmap image0 (SMESHGUI::resourceMgr()->loadPixmap("SMESH", iconName));
+  QPixmap image1 (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_SELECT")));
 
-  if ( !name )
-    setName( "SMESHGUI_AddMeshElementDlg" );
-  resize( 303, 185 ); 
-  setCaption( caption );
+  if (!name)
+    setName("SMESHGUI_AddMeshElementDlg");
+  resize(303, 185);
+  setCaption(caption);
 
-  setSizeGripEnabled( TRUE );
-  SMESHGUI_AddMeshElementDlgLayout = new QGridLayout( this ); 
-  SMESHGUI_AddMeshElementDlgLayout->setSpacing( 6 );
-  SMESHGUI_AddMeshElementDlgLayout->setMargin( 11 );
+  setSizeGripEnabled(TRUE);
+  SMESHGUI_AddMeshElementDlgLayout = new QGridLayout(this);
+  SMESHGUI_AddMeshElementDlgLayout->setSpacing(6);
+  SMESHGUI_AddMeshElementDlgLayout->setMargin(11);
 
   /***************************************************************/
-  GroupConstructors = new QButtonGroup( this, "GroupConstructors" );
-  GroupConstructors->setTitle( buttonGrTitle );
-  
-  GroupConstructors->setExclusive( TRUE );
-  GroupConstructors->setColumnLayout(0, Qt::Vertical );
-  GroupConstructors->layout()->setSpacing( 0 );
-  GroupConstructors->layout()->setMargin( 0 );
-  GroupConstructorsLayout = new QGridLayout( GroupConstructors->layout() );
-  GroupConstructorsLayout->setAlignment( Qt::AlignTop );
-  GroupConstructorsLayout->setSpacing( 6 );
-  GroupConstructorsLayout->setMargin( 11 );
-  Constructor1 = new QRadioButton( GroupConstructors, "Constructor1" );
-  Constructor1->setText( tr( ""  ) );
-  Constructor1->setPixmap( image0 );
-  Constructor1->setChecked( TRUE );
-  Constructor1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, Constructor1->sizePolicy().hasHeightForWidth() ) );
-  Constructor1->setMinimumSize( QSize( 50, 0 ) );
-  GroupConstructorsLayout->addWidget( Constructor1, 0, 0 );
-  QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
-  GroupConstructorsLayout->addItem( spacer, 0, 1 );
-  SMESHGUI_AddMeshElementDlgLayout->addWidget( GroupConstructors, 0, 0 );
-    
+  GroupConstructors = new QButtonGroup(this, "GroupConstructors");
+  GroupConstructors->setTitle(buttonGrTitle);
+
+  GroupConstructors->setExclusive(TRUE);
+  GroupConstructors->setColumnLayout(0, Qt::Vertical);
+  GroupConstructors->layout()->setSpacing(0);
+  GroupConstructors->layout()->setMargin(0);
+  GroupConstructorsLayout = new QGridLayout(GroupConstructors->layout());
+  GroupConstructorsLayout->setAlignment(Qt::AlignTop);
+  GroupConstructorsLayout->setSpacing(6);
+  GroupConstructorsLayout->setMargin(11);
+  Constructor1 = new QRadioButton(GroupConstructors, "Constructor1");
+  Constructor1->setText(tr("" ));
+  Constructor1->setPixmap(image0);
+  Constructor1->setChecked(TRUE);
+  Constructor1->setSizePolicy(QSizePolicy((QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, Constructor1->sizePolicy().hasHeightForWidth()));
+  Constructor1->setMinimumSize(QSize(50, 0));
+  GroupConstructorsLayout->addWidget(Constructor1, 0, 0);
+  QSpacerItem* spacer = new QSpacerItem(20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
+  GroupConstructorsLayout->addItem(spacer, 0, 1);
+  SMESHGUI_AddMeshElementDlgLayout->addWidget(GroupConstructors, 0, 0);
+
   /***************************************************************/
-  GroupButtons = new QGroupBox( this, "GroupButtons" );
-  GroupButtons->setGeometry( QRect( 10, 10, 281, 48 ) ); 
-  GroupButtons->setTitle( tr( ""  ) );
-  GroupButtons->setColumnLayout(0, Qt::Vertical );
-  GroupButtons->layout()->setSpacing( 0 );
-  GroupButtons->layout()->setMargin( 0 );
-  GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
-  GroupButtonsLayout->setAlignment( Qt::AlignTop );
-  GroupButtonsLayout->setSpacing( 6 );
-  GroupButtonsLayout->setMargin( 11 );
-  buttonCancel = new QPushButton( GroupButtons, "buttonCancel" );
-  buttonCancel->setText( tr( "SMESH_BUT_CLOSE"  ) );
-  buttonCancel->setAutoDefault( TRUE );
-  GroupButtonsLayout->addWidget( buttonCancel, 0, 3 );
-  buttonApply = new QPushButton( GroupButtons, "buttonApply" );
-  buttonApply->setText( tr( "SMESH_BUT_APPLY"  ) );
-  buttonApply->setAutoDefault( TRUE );
-  GroupButtonsLayout->addWidget( buttonApply, 0, 1 );
-  QSpacerItem* spacer_9 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
-  GroupButtonsLayout->addItem( spacer_9, 0, 2 );
-  buttonOk = new QPushButton( GroupButtons, "buttonOk" );
-  buttonOk->setText( tr( "SMESH_BUT_OK"  ) );
-  buttonOk->setAutoDefault( TRUE );
-  buttonOk->setDefault( TRUE );
-  GroupButtonsLayout->addWidget( buttonOk, 0, 0 );
-  SMESHGUI_AddMeshElementDlgLayout->addWidget( GroupButtons, 2, 0 );
+  GroupButtons = new QGroupBox(this, "GroupButtons");
+  GroupButtons->setGeometry(QRect(10, 10, 281, 48));
+  GroupButtons->setTitle(tr("" ));
+  GroupButtons->setColumnLayout(0, Qt::Vertical);
+  GroupButtons->layout()->setSpacing(0);
+  GroupButtons->layout()->setMargin(0);
+  GroupButtonsLayout = new QGridLayout(GroupButtons->layout());
+  GroupButtonsLayout->setAlignment(Qt::AlignTop);
+  GroupButtonsLayout->setSpacing(6);
+  GroupButtonsLayout->setMargin(11);
+  buttonCancel = new QPushButton(GroupButtons, "buttonCancel");
+  buttonCancel->setText(tr("SMESH_BUT_CLOSE" ));
+  buttonCancel->setAutoDefault(TRUE);
+  GroupButtonsLayout->addWidget(buttonCancel, 0, 3);
+  buttonApply = new QPushButton(GroupButtons, "buttonApply");
+  buttonApply->setText(tr("SMESH_BUT_APPLY" ));
+  buttonApply->setAutoDefault(TRUE);
+  GroupButtonsLayout->addWidget(buttonApply, 0, 1);
+  QSpacerItem* spacer_9 = new QSpacerItem(20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
+  GroupButtonsLayout->addItem(spacer_9, 0, 2);
+  buttonOk = new QPushButton(GroupButtons, "buttonOk");
+  buttonOk->setText(tr("SMESH_BUT_OK" ));
+  buttonOk->setAutoDefault(TRUE);
+  buttonOk->setDefault(TRUE);
+  GroupButtonsLayout->addWidget(buttonOk, 0, 0);
+  SMESHGUI_AddMeshElementDlgLayout->addWidget(GroupButtons, 2, 0);
 
   /***************************************************************/
-  GroupC1 = new QGroupBox( this, "GroupC1" );
-  GroupC1->setTitle( grBoxTitle );
-
-  GroupC1->setMinimumSize( QSize( 0, 0 ) );
-  GroupC1->setFrameShape( QGroupBox::Box );
-  GroupC1->setFrameShadow( QGroupBox::Sunken );
-  GroupC1->setColumnLayout(0, Qt::Vertical );
-  GroupC1->layout()->setSpacing( 0 );
-  GroupC1->layout()->setMargin( 0 );
-  GroupC1Layout = new QGridLayout( GroupC1->layout() );
-  GroupC1Layout->setAlignment( Qt::AlignTop );
-  GroupC1Layout->setSpacing( 6 );
-  GroupC1Layout->setMargin( 11 );
-  TextLabelC1A1 = new QLabel( GroupC1, "TextLabelC1A1" );
-  TextLabelC1A1->setText( tr( "SMESH_ID_NODES"  ) );
-  TextLabelC1A1->setMinimumSize( QSize( 50, 0 ) );
-  TextLabelC1A1->setFrameShape( QLabel::NoFrame );
-  TextLabelC1A1->setFrameShadow( QLabel::Plain );
-  GroupC1Layout->addWidget( TextLabelC1A1, 0, 0 );
-  SelectButtonC1A1 = new QPushButton( GroupC1, "SelectButtonC1A1" );
-  SelectButtonC1A1->setText( tr( ""  ) );
-  SelectButtonC1A1->setPixmap( image1 );
-  SelectButtonC1A1->setToggleButton( FALSE );
-  GroupC1Layout->addWidget( SelectButtonC1A1, 0, 1 );
-  LineEditC1A1 = new QLineEdit( GroupC1, "LineEditC1A1" );
-//  LineEditC1A1->setReadOnly( TRUE );
-  LineEditC1A1->setValidator( new SMESHGUI_IdValidator( this, "validator", myNbNodes ));
-  GroupC1Layout->addWidget( LineEditC1A1, 0, 2 );
-
-  if ( myElementType == SMDSAbs_Face ) {
-    Reverse = new QCheckBox( GroupC1, "Reverse" );
-    Reverse->setText( tr( "SMESH_REVERSE"  ) );
-    GroupC1Layout->addWidget( Reverse, 1, 0 );
+  GroupC1 = new QGroupBox(this, "GroupC1");
+  GroupC1->setTitle(grBoxTitle);
+
+  GroupC1->setMinimumSize(QSize(0, 0));
+  GroupC1->setFrameShape(QGroupBox::Box);
+  GroupC1->setFrameShadow(QGroupBox::Sunken);
+  GroupC1->setColumnLayout(0, Qt::Vertical);
+  GroupC1->layout()->setSpacing(0);
+  GroupC1->layout()->setMargin(0);
+  GroupC1Layout = new QGridLayout(GroupC1->layout());
+  GroupC1Layout->setAlignment(Qt::AlignTop);
+  GroupC1Layout->setSpacing(6);
+  GroupC1Layout->setMargin(11);
+  TextLabelC1A1 = new QLabel(GroupC1, "TextLabelC1A1");
+  TextLabelC1A1->setText(tr("SMESH_ID_NODES" ));
+  TextLabelC1A1->setMinimumSize(QSize(50, 0));
+  TextLabelC1A1->setFrameShape(QLabel::NoFrame);
+  TextLabelC1A1->setFrameShadow(QLabel::Plain);
+  GroupC1Layout->addWidget(TextLabelC1A1, 0, 0);
+  SelectButtonC1A1 = new QPushButton(GroupC1, "SelectButtonC1A1");
+  SelectButtonC1A1->setText(tr("" ));
+  SelectButtonC1A1->setPixmap(image1);
+  SelectButtonC1A1->setToggleButton(FALSE);
+  GroupC1Layout->addWidget(SelectButtonC1A1, 0, 1);
+  LineEditC1A1 = new QLineEdit(GroupC1, "LineEditC1A1");
+//  LineEditC1A1->setReadOnly(TRUE);
+  if (!myIsPoly)
+    LineEditC1A1->setValidator(new SMESHGUI_IdValidator(this, "validator", myNbNodes));
+  GroupC1Layout->addWidget(LineEditC1A1, 0, 2);
+
+  if (myElementType == SMDSAbs_Face) {
+    Reverse = new QCheckBox(GroupC1, "Reverse");
+    Reverse->setText(tr("SMESH_REVERSE" ));
+    GroupC1Layout->addWidget(Reverse, 1, 0);
   }
   else
     Reverse = 0;
 
-  SMESHGUI_AddMeshElementDlgLayout->addWidget( GroupC1, 1, 0 );
+  SMESHGUI_AddMeshElementDlgLayout->addWidget(GroupC1, 1, 0);
 
-  Init(Sel) ; /* Initialisations */
+  Init(); /* Initialisations */
 }
 
 //=================================================================================
@@ -351,55 +382,52 @@ SMESHGUI_AddMeshElementDlg::SMESHGUI_AddMeshElementDlg( QWidget* parent, const c
 //=================================================================================
 SMESHGUI_AddMeshElementDlg::~SMESHGUI_AddMeshElementDlg()
 {
-    // no need to delete child widgets, Qt does it all for us
+  // no need to delete child widgets, Qt does it all for us
   delete mySimulation;
 }
 
-
 //=================================================================================
 // function : Init()
 // purpose  :
 //=================================================================================
-void SMESHGUI_AddMeshElementDlg::Init( SALOME_Selection* Sel )
+void SMESHGUI_AddMeshElementDlg::Init()
 {
-
   GroupC1->show();
-  Constructor1->setChecked( TRUE );
-  myEditCurrentArgument = LineEditC1A1 ;       
-  mySelection = Sel;  
-  mySMESHGUI = SMESHGUI::GetSMESHGUI() ;
-  mySMESHGUI->SetActiveDialogBox( (QDialog*)this ) ;
+  Constructor1->setChecked(TRUE);
+  myEditCurrentArgument = LineEditC1A1;
+  mySMESHGUI->SetActiveDialogBox((QDialog*)this);
 
-  myOkNodes = false ;
+  myNbOkNodes = 0;
   myActor = 0;
 
   /* signals and slots connections */
-  connect(buttonOk, SIGNAL( clicked() ),     SLOT( ClickOnOk() ) );
-  connect(buttonCancel, SIGNAL( clicked() ), SLOT( ClickOnCancel() ) ) ;
-  connect(buttonApply, SIGNAL( clicked() ),  SLOT(ClickOnApply() ) );
-
-  connect(SelectButtonC1A1, SIGNAL( clicked() ), SLOT( SetEditCurrentArgument() ) ) ;
-  connect(LineEditC1A1, SIGNAL( textChanged(const QString&) ), SLOT(onTextChange(const QString&)));
-  connect(mySMESHGUI, SIGNAL ( SignalDeactivateActiveDialog() ), SLOT( DeactivateActiveDialog()));
-  connect(mySelection, SIGNAL( currentSelectionChanged() ), SLOT( SelectionIntoArgument() ) );
+  connect(buttonOk, SIGNAL(clicked()),     SLOT(ClickOnOk()));
+  connect(buttonCancel, SIGNAL(clicked()), SLOT(ClickOnCancel()));
+  connect(buttonApply, SIGNAL(clicked()),  SLOT(ClickOnApply()));
+
+  connect(SelectButtonC1A1, SIGNAL(clicked()), SLOT(SetEditCurrentArgument()));
+  connect(LineEditC1A1, SIGNAL(textChanged(const QString&)), SLOT(onTextChange(const QString&)));
+  connect(mySMESHGUI, SIGNAL (SignalDeactivateActiveDialog()), SLOT(DeactivateActiveDialog()));
+  connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), SLOT(SelectionIntoArgument()));
   /* to close dialog if study frame change */
-  connect( mySMESHGUI, SIGNAL ( SignalStudyFrameChanged() ), SLOT( ClickOnCancel() ) ) ;
+  connect(mySMESHGUI, SIGNAL (SignalStudyFrameChanged()), SLOT(ClickOnCancel()));
 
-  if ( Reverse )
-    connect( Reverse, SIGNAL(stateChanged(int)), SLOT(CheckBox(int)) );
+  if (Reverse)
+    connect(Reverse, SIGNAL(stateChanged(int)), SLOT(CheckBox(int)));
 
-  /* Move widget on the botton right corner of main widget */
-  int x, y ;
-  mySMESHGUI->DefineDlgPosition( this, x, y ) ;
-  this->move( x, y ) ;
-  this->show() ; /* displays Dialog */
+  // Move widget on the botton right corner of main widget
+  int x, y;
+  mySMESHGUI->DefineDlgPosition(this, x, y);
+  this->move(x, y);
+  this->show(); // displays Dialog
 
   // set selection mode
   SMESH::SetPointRepresentation(true);
-  QAD_Application::getDesktop()->SetSelectionMode( NodeSelection, true );
+
+  myViewWindow->SetSelectionMode( NodeSelection );
 
   myBusy = false;
-  
+
   SelectionIntoArgument();
 }
 
@@ -409,21 +437,20 @@ void SMESHGUI_AddMeshElementDlg::Init( SALOME_Selection* Sel )
 //=================================================================================
 void SMESHGUI_AddMeshElementDlg::ClickOnApply()
 {
-  if ( myOkNodes && !mySMESHGUI->ActiveStudyLocked() ) {
-
+  if (myNbOkNodes && !mySMESHGUI->isActiveStudyLocked()) {
     myBusy = true;
     SMESH::long_array_var anArrayOfIdeces = new SMESH::long_array;
-    anArrayOfIdeces->length( myNbNodes );
-    bool reverse = ( Reverse && Reverse->isChecked() );
-    QStringList aListId = QStringList::split( " ", myEditCurrentArgument->text(), false);
-    for ( int i = 0; i < aListId.count(); i++ )
-      if ( reverse )
+    anArrayOfIdeces->length(myNbNodes);
+    bool reverse = (Reverse && Reverse->isChecked());
+    QStringList aListId = QStringList::split(" ", myEditCurrentArgument->text(), false);
+    for (int i = 0; i < aListId.count(); i++)
+      if (reverse)
         anArrayOfIdeces[i] = aListId[ myNbNodes - i - 1 ].toInt();
       else
         anArrayOfIdeces[i] = aListId[ i ].toInt();
 
     SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
-    switch ( myElementType ) {
+    switch (myElementType) {
     case SMDSAbs_Edge:
       aMeshEditor->AddEdge(anArrayOfIdeces.inout()); break;
     case SMDSAbs_Face:
@@ -432,15 +459,15 @@ void SMESHGUI_AddMeshElementDlg::ClickOnApply()
       aMeshEditor->AddVolume(anArrayOfIdeces.inout()); break;
     default:;
     }
-    
-    mySelection->ClearIObjects();
-    mySelection->AddIObject( myActor->getIO(), false );
+
+    SALOME_ListIO aList; aList.Append( myActor->getIO() );
+    mySelectionMgr->setSelectedObjects( aList, false );
 
     SMESH::UpdateView();
     mySimulation->SetVisibility(false);
 
-    buttonOk->setEnabled( false );
-    buttonApply->setEnabled( false );
+    buttonOk->setEnabled(false);
+    buttonApply->setEnabled(false);
 
     myEditCurrentArgument->setText("");
 
@@ -454,9 +481,9 @@ void SMESHGUI_AddMeshElementDlg::ClickOnApply()
 //=================================================================================
 void SMESHGUI_AddMeshElementDlg::ClickOnOk()
 {
-  this->ClickOnApply() ;
-  this->ClickOnCancel() ;
-  return ;
+  this->ClickOnApply();
+  this->ClickOnCancel();
+  return;
 }
 
 //=================================================================================
@@ -465,64 +492,73 @@ void SMESHGUI_AddMeshElementDlg::ClickOnOk()
 //=================================================================================
 void SMESHGUI_AddMeshElementDlg::ClickOnCancel()
 {
-  mySelection->ClearIObjects();
+  mySelectionMgr->clearSelected();
   mySimulation->SetVisibility(false);
   SMESH::SetPointRepresentation(false);
-  QAD_Application::getDesktop()->SetSelectionMode( ActorSelection );
-  disconnect( mySelection, 0, this, 0 );
-  mySMESHGUI->ResetState() ;
-  reject() ;
-  return ;
+  myViewWindow->SetSelectionMode( ActorSelection );
+  disconnect(mySelectionMgr, 0, this, 0);
+  mySMESHGUI->ResetState();
+  reject();
+  return;
 }
 
-//=======================================================================
-//function : onTextChange
-//purpose  : 
-//=======================================================================
-
-void SMESHGUI_AddMeshElementDlg::onTextChange(const QString& theNewText)
+//=================================================================================
+// function : onTextChange()
+// purpose  :
+//=================================================================================
+void SMESHGUI_AddMeshElementDlg::onTextChange (const QString& theNewText)
 {
-  if ( myBusy ) return;
+  if (myBusy) return;
   myBusy = true;
 
-  myOkNodes = false;
+  myNbOkNodes = 0;
 
-  buttonOk->setEnabled( false );
-  buttonApply->setEnabled( false );
+  buttonOk->setEnabled(false);
+  buttonApply->setEnabled(false);
 
   mySimulation->SetVisibility(false);
 
   // hilight entered nodes
   SMDS_Mesh* aMesh = 0;
-  if ( myActor )
+  if (myActor)
     aMesh = myActor->GetObject()->GetMesh();
-  if ( aMesh ) {
-
-    mySelection->ClearIObjects();
-    mySelection->AddIObject( myActor->getIO() );
-
-    QStringList aListId = QStringList::split( " ", theNewText, false);
-    bool allOk = true;
-    for ( int i = 0; i < aListId.count(); i++ ) {
-      const SMDS_MeshNode * n = aMesh->FindNode( aListId[ i ].toInt() );
-      if ( n ) {
-        if ( mySelection->IsIndexSelected( myActor->getIO(), n->GetID() ))
-          allOk = false;
-        else
-          mySelection->AddOrRemoveIndex (myActor->getIO(), n->GetID(), true);
+
+  if (aMesh) {
+    SALOME_ListIO aList; aList.Append( myActor->getIO() );
+    mySelectionMgr->setSelectedObjects( aList, false );
+
+    TColStd_IndexedMapOfInteger selectedIndices;
+    TColStd_MapOfInteger newIndices;
+    mySelector->GetIndex(myActor->getIO(), selectedIndices);
+
+    QStringList aListId = QStringList::split(" ", theNewText, false);
+    for (int i = 0; i < aListId.count(); i++) {
+      if( const SMDS_MeshNode * n = aMesh->FindNode( aListId[ i ].toInt() ) )
+      {
+       if( selectedIndices.Add( n->GetID() ) )
+         newIndices.Add( n->GetID() );
+       myNbOkNodes++;
       }
-      else
-        allOk = false;
     }
-    myOkNodes = (allOk && myNbNodes == aListId.count() );
-
-    if ( myOkNodes ) {
-      buttonOk->setEnabled( true );
-      buttonApply->setEnabled( true );
-      displaySimulation();
+    
+    if( newIndices.Extent()>0 )
+    {
+      mySelector->AddOrRemoveIndex( myActor->getIO(), newIndices, true );
+      myViewWindow->highlight( myActor->getIO(), true, true );
+    }
+    bool aNodesOK = false;
+    if (myIsPoly && myElementType == SMDSAbs_Face && aListId.count() >=3 ){
+      myNbOkNodes = aListId.count();
+      aNodesOK = true;
     }
   }
-
+  
+  if(myNbOkNodes) {
+    buttonOk->setEnabled(true);
+    buttonApply->setEnabled(true);
+    displaySimulation();
+  }
+  
   myBusy = false;
 }
 
@@ -532,91 +568,97 @@ void SMESHGUI_AddMeshElementDlg::onTextChange(const QString& theNewText)
 //=================================================================================
 void SMESHGUI_AddMeshElementDlg::SelectionIntoArgument()
 {
-  if ( myBusy ) return;
+  if (myBusy) return;
 
   // clear
-
-  myOkNodes = false;
+  myNbOkNodes = 0;
   myActor = 0;
 
   myBusy = true;
-  myEditCurrentArgument->setText( "" );
+  myEditCurrentArgument->setText("");
   myBusy = false;
 
-  if ( !GroupButtons->isEnabled() ) // inactive
+  if (!GroupButtons->isEnabled()) // inactive
     return;
 
-  buttonOk->setEnabled( false );
-  buttonApply->setEnabled( false );
+  buttonOk->setEnabled(false);
+  buttonApply->setEnabled(false);
 
   mySimulation->SetVisibility(false);
 //  SMESH::SetPointRepresentation(true);
 
   // get selected mesh
+  SALOME_ListIO aList;
+  mySelectionMgr->selectedObjects(aList,SVTK_Viewer::Type());
 
-  int nbSel = mySelection->IObjectCount();
-  if(nbSel != 1)
+  if (aList.Extent() != 1)
     return;
 
-  myMesh = SMESH::GetMeshByIO( mySelection->firstIObject() );
-  if ( myMesh->_is_nil() )
+  Handle(SALOME_InteractiveObject) anIO = aList.First();
+  myMesh = SMESH::GetMeshByIO(anIO);
+  if (myMesh->_is_nil())
     return;
 
-  myActor = SMESH::FindActorByEntry( mySelection->firstIObject()->getEntry() );
-  if ( !myActor )
+  myActor = SMESH::FindActorByEntry(anIO->getEntry());
+  if (!myActor)
     return;
 
   // get selected nodes
-
   QString aString = "";
-  int nbNodes = SMESH::GetNameOfSelectedNodes(mySelection, aString) ;
+  int nbNodes = SMESH::GetNameOfSelectedNodes(mySelector,myActor->getIO(),aString);
   myBusy = true;
-  myEditCurrentArgument->setText( aString );
+  myEditCurrentArgument->setText(aString);
   myBusy = false;
-  if ( myNbNodes != nbNodes )
+  if (myIsPoly && myElementType == SMDSAbs_Face && nbNodes >= 3 ) {
+    myNbNodes = nbNodes;
+  } else if (myNbNodes != nbNodes) {
     return;
+  }
 
   // OK
+  myNbOkNodes = nbNodes;
 
-  myOkNodes = true;
-
-  buttonOk->setEnabled( true );
-  buttonApply->setEnabled( true );
+  buttonOk->setEnabled(true);
+  buttonApply->setEnabled(true);
 
   displaySimulation();
 }
 
-//=======================================================================
-//function : displaySimulation
-//purpose  : 
-//=======================================================================
-
+//=================================================================================
+// function : displaySimulation()
+// purpose  :
+//=================================================================================
 void SMESHGUI_AddMeshElementDlg::displaySimulation()
 {
-  if ( myOkNodes && GroupButtons->isEnabled() )
-  {
+  if (myNbOkNodes && GroupButtons->isEnabled()) {
     SMESH::TElementSimulation::TVTKIds anIds;
-    QStringList aListId = QStringList::split( " ", myEditCurrentArgument->text(), false);
-    for ( int i = 0; i < aListId.count(); i++ )
-      anIds.push_back( myActor->GetObject()->GetNodeVTKId( aListId[ i ].toInt() ));
+    QStringList aListId = QStringList::split(" ", myEditCurrentArgument->text(), false);
+    for (int i = 0; i < aListId.count(); i++)
+      anIds.push_back(myActor->GetObject()->GetNodeVTKId(aListId[ i ].toInt()));
 
-    if ( Reverse && Reverse->isChecked() )
+    if (Reverse && Reverse->isChecked())
       reverse(anIds.begin(),anIds.end());
 
     vtkIdType aType = 0;
-    switch ( myNbNodes ) {
-    case 2: aType = VTK_LINE; break;
-    case 3: aType = VTK_TRIANGLE; break;
-    case 4: aType = myElementType == SMDSAbs_Face ? VTK_QUAD : VTK_TETRA; break;
-    case 8: aType = VTK_HEXAHEDRON; break;
-    default: return;
+    if (myIsPoly)
+      switch ( myElementType ) {
+      case SMDSAbs_Face  : aType = VTK_POLYGON; break;
+      default: return;
+      }
+    else {
+      switch (myNbNodes) {
+      case 2: aType = VTK_LINE; break;
+      case 3: aType = VTK_TRIANGLE; break;
+      case 4: aType = myElementType == SMDSAbs_Face ? VTK_QUAD : VTK_TETRA; break;
+      case 8: aType = VTK_HEXAHEDRON; break;
+      default: return;
+      }
     }
-      
+
     mySimulation->SetPosition(myActor,aType,anIds);
   }
 }
 
-
 //=================================================================================
 // function : SetEditCurrentArgument()
 // purpose  :
@@ -624,11 +666,11 @@ void SMESHGUI_AddMeshElementDlg::displaySimulation()
 void SMESHGUI_AddMeshElementDlg::SetEditCurrentArgument()
 {
   QPushButton* send = (QPushButton*)sender();
-  if(send == SelectButtonC1A1) {
-    LineEditC1A1->setFocus() ;
+  if (send == SelectButtonC1A1) {
+    LineEditC1A1->setFocus();
     myEditCurrentArgument = LineEditC1A1;
   }
-  SelectionIntoArgument() ;
+  SelectionIntoArgument();
 }
 
 //=================================================================================
@@ -637,18 +679,16 @@ void SMESHGUI_AddMeshElementDlg::SetEditCurrentArgument()
 //=================================================================================
 void SMESHGUI_AddMeshElementDlg::DeactivateActiveDialog()
 {
-  if ( GroupConstructors->isEnabled() ) {  
-    GroupConstructors->setEnabled(false) ;
-    GroupC1->setEnabled(false) ;
-    GroupButtons->setEnabled(false) ;
+  if (GroupConstructors->isEnabled()) {
+    GroupConstructors->setEnabled(false);
+    GroupC1->setEnabled(false);
+    GroupButtons->setEnabled(false);
     mySimulation->SetVisibility(false);
-    mySMESHGUI->ResetState() ;    
-    mySMESHGUI->SetActiveDialogBox(0) ;
+    mySMESHGUI->ResetState();
+    mySMESHGUI->SetActiveDialogBox(0);
   }
-  return ;
 }
 
-
 //=================================================================================
 // function : ActivateThisDialog()
 // purpose  :
@@ -656,15 +696,15 @@ void SMESHGUI_AddMeshElementDlg::DeactivateActiveDialog()
 void SMESHGUI_AddMeshElementDlg::ActivateThisDialog()
 {
   /* Emit a signal to deactivate the active dialog */
-  mySMESHGUI->EmitSignalDeactivateDialog() ;   
+  mySMESHGUI->EmitSignalDeactivateDialog();
 
-  GroupConstructors->setEnabled(true) ;
-  GroupC1->setEnabled(true) ;
-  GroupButtons->setEnabled(true) ;
+  GroupConstructors->setEnabled(true);
+  GroupC1->setEnabled(true);
+  GroupButtons->setEnabled(true);
 
   SMESH::SetPointRepresentation(true);
-  QAD_Application::getDesktop()->SetSelectionMode( NodeSelection, true );
 
+  myViewWindow->SetSelectionMode( NodeSelection );
   SelectionIntoArgument();
 }
 
@@ -672,47 +712,45 @@ void SMESHGUI_AddMeshElementDlg::ActivateThisDialog()
 // function : enterEvent()
 // purpose  :
 //=================================================================================
-void SMESHGUI_AddMeshElementDlg::enterEvent(QEvent* e)
+void SMESHGUI_AddMeshElementDlg::enterEvent (QEvent*)
 {
-  if ( GroupConstructors->isEnabled() )
-    return ;  
-  ActivateThisDialog() ;
-  return ;
+  if (GroupConstructors->isEnabled())
+    return;
+  ActivateThisDialog();
+  return;
 }
 
-
 //=================================================================================
 // function : closeEvent()
 // purpose  :
 //=================================================================================
-void SMESHGUI_AddMeshElementDlg::closeEvent( QCloseEvent* e )
+void SMESHGUI_AddMeshElementDlg::closeEvent (QCloseEvent*)
 {
   /* same than click on cancel button */
-  this->ClickOnCancel() ;
-  return ;
+  this->ClickOnCancel();
+  return;
 }
-//=======================================================================
-//function : hideEvent
-//purpose  : caused by ESC key
-//=======================================================================
 
-void SMESHGUI_AddMeshElementDlg::hideEvent ( QHideEvent * e )
+//=================================================================================
+// function : hideEvent()
+// purpose  : caused by ESC key
+//=================================================================================
+void SMESHGUI_AddMeshElementDlg::hideEvent (QHideEvent*)
 {
-  if ( !isMinimized() )
-    ClickOnCancel() ;
+  if (!isMinimized())
+    ClickOnCancel();
 }
 
-//=======================================================================
-//function : CheckBox
-//purpose  : 
-//=======================================================================
-
-void SMESHGUI_AddMeshElementDlg::CheckBox( int state )
+//=================================================================================
+// function : CheckBox()
+// purpose  :
+//=================================================================================
+void SMESHGUI_AddMeshElementDlg::CheckBox (int state)
 {
-  if ( !myOkNodes )
+  if (!myNbOkNodes)
     return;
-  
-  if ( state >= 0 ) {
+
+  if (state >= 0) {
     mySimulation->SetVisibility(false);
     displaySimulation();
   }
index 4a785bbc57009c607117c17a6a806804c9d48801..a04635c304ea6bd48587bea02d0d3ac9032cb487 100644 (file)
@@ -29,7 +29,7 @@
 #ifndef DIALOGBOX_ADD_FACE_H
 #define DIALOGBOX_ADD_FACE_H
 
-#include "SALOME_Selection.h"
+#include "SalomeApp_SelectionMgr.h"
 
 #include "SMDSAbs_ElementType.hxx"
 
@@ -51,6 +51,8 @@ class QCheckBox;
 class SMESHGUI;
 class SMESH_Actor;
 class SMDS_Mesh;
+class SVTK_ViewWindow;
+class SVTK_Selector;
 
 namespace SMESH{
   struct TElementSimulation;
@@ -69,33 +71,35 @@ class SMESHGUI_AddMeshElementDlg : public QDialog
     Q_OBJECT
 
 public:
-    SMESHGUI_AddMeshElementDlg( QWidget* parent = 0, const char* name = 0,
-                               SALOME_Selection* Sel = 0, 
+    SMESHGUI_AddMeshElementDlg( SMESHGUI*,
+                               const char* = 0, 
                                 SMDSAbs_ElementType ElementType = SMDSAbs_Edge,
                                int nbNodes = 2, bool modal = FALSE, WFlags fl = 0 );
     ~SMESHGUI_AddMeshElementDlg();
 
 private:
-
-    void Init( SALOME_Selection* Sel ) ;
-    void closeEvent( QCloseEvent* e ) ;
-    void hideEvent ( QHideEvent * );                 /* ESC key */
-    void enterEvent ( QEvent * ) ;                   /* mouse enter the QWidget */
+    void Init ();
+    void closeEvent (QCloseEvent*);
+    void hideEvent (QHideEvent*);                 /* ESC key */
+    void enterEvent (QEvent*);                    /* mouse enter the QWidget */
     void displaySimulation();
 
-    SMESHGUI*              mySMESHGUI ;              /* Current SMESHGUI object */
-    SALOME_Selection*      mySelection ;             /* User shape selection */
-    bool                   myOkNodes ;               /* to check when arguments is defined */
-    bool                   myBusy;
+    SMESHGUI*                   mySMESHGUI;              /* Current SMESHGUI object */
+    SalomeApp_SelectionMgr*     mySelectionMgr;          /* User shape selection */
+    int                         myNbOkNodes;               /* to check when arguments is defined */
+    bool                        myBusy;
+    SVTK_ViewWindow*            myViewWindow;
+    SVTK_Selector*              mySelector;
 
-    QLineEdit*             myEditCurrentArgument;    /* Current  LineEdit */
+    QLineEdit*                  myEditCurrentArgument;   /* Current  LineEdit */
 
-    int                             myElementType ;
-    int                             myNbNodes;
+    int                         myElementType;
+    int                         myNbNodes;
+    bool                        myIsPoly;
 
-    SMESH::SMESH_Mesh_var           myMesh;
-    SMESH_Actor*                    myActor;
-    SMESH::TElementSimulation*      mySimulation;
+    SMESH::SMESH_Mesh_var       myMesh;
+    SMESH_Actor*                myActor;
+    SMESH::TElementSimulation*  mySimulation;
     
     QButtonGroup* GroupConstructors;
     QRadioButton* Constructor1;
index 250323da7b5d71775e2f93a2af34f12572f0652d..b07345819021b6a48562734c4945a3670f6a71ba 100644 (file)
@@ -1,23 +1,23 @@
 //  SMESH SMESHGUI : GUI for SMESH component
 //
 //  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
-// 
-//  This library is free software; you can redistribute it and/or 
-//  modify it under the terms of the GNU Lesser General Public 
-//  License as published by the Free Software Foundation; either 
-//  version 2.1 of the License. 
-// 
-//  This library is distributed in the hope that it will be useful, 
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of 
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
-//  Lesser General Public License for more details. 
-// 
-//  You should have received a copy of the GNU Lesser General Public 
-//  License along with this library; if not, write to the Free Software 
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
-// 
-//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
 //
 //
 //
 #include "SMESHGUI_GEOMGenUtils.h"
 #include "SMESHGUI_HypothesesUtils.h"
 
+#include "SMESH_TypeFilter.hxx"
+#include "SMESH_NumberFilter.hxx"
+
 #include "GEOMBase.h"
 
-#include "QAD_Application.h"
-#include "QAD_Desktop.h"
-#include "QAD_MessageBox.h"
-#include "QAD_WaitCursor.h"
-#include "QAD_Operation.h"
+#include "SUIT_Session.h"
+#include "SUIT_MessageBox.h"
+#include "SUIT_OverrideCursor.h"
+#include "SUIT_Operation.h"
+#include "SUIT_Desktop.h"
 
+#include "SALOMEDSClient_Study.hxx"
+#include "SALOMEDS_SObject.hxx"
+#include "SALOME_ListIO.hxx"
 #include "SALOME_ListIteratorOfListIO.hxx"
-#include "SALOMEGUI_QtCatchCorbaException.hxx"
+#include "SalomeApp_Tools.h"
+
+#include "SVTK_ViewModel.h"
 
 #include "utilities.h"
 
 
 using namespace std;
 
-namespace SMESH{
-  SMESH::SMESH_subMesh_var AddSubMesh(SMESH::SMESH_Mesh_ptr theMesh, 
-                                     GEOM::GEOM_Object_ptr theShapeObject, 
-                                     const char* theMeshName )
+namespace SMESH {
+  SMESH::SMESH_subMesh_var AddSubMesh (SMESH::SMESH_Mesh_ptr theMesh,
+                                       GEOM::GEOM_Object_ptr theShapeObject,
+                                       const char* theMeshName)
   {
     SMESH::SMESH_subMesh_var aSubMesh;
     try {
-      if ( !theMesh->_is_nil() && !theShapeObject->_is_nil() )
-       aSubMesh = theMesh->GetSubMesh( theShapeObject, theMeshName );
-    }
-    catch( const SALOME::SALOME_Exception& S_ex ) {
-      QtCatchCorbaException( S_ex );
+      if (!theMesh->_is_nil() && !theShapeObject->_is_nil())
+       aSubMesh = theMesh->GetSubMesh(theShapeObject, theMeshName);
+    } catch (const SALOME::SALOME_Exception& S_ex) {
+      SalomeApp_Tools::QtCatchCorbaException(S_ex);
     }
     return aSubMesh._retn();
   }
 }
 
 //=================================================================================
-// class    : SMESHGUI_AddSubMeshDlg()
-// purpose  : Constructs a SMESHGUI_AddSubMeshDlg which is a child of 'parent', with the 
+// function : SMESHGUI_AddSubMeshDlg()
+// purpose  : Constructs a SMESHGUI_AddSubMeshDlg which is a child of 'parent', with the
 //            name 'name' and widget flags set to 'f'.
 //            The dialog will by default be modeless, unless you set 'modal' to
 //            TRUE to construct a modal dialog.
 //=================================================================================
-SMESHGUI_AddSubMeshDlg::SMESHGUI_AddSubMeshDlg( QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl )
-    : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | WDestructiveClose )
+SMESHGUI_AddSubMeshDlg::SMESHGUI_AddSubMeshDlg( SMESHGUI* theModule, const char* name,
+                                                bool modal, WFlags fl)
+     : QDialog( SMESH::GetDesktop( theModule ), name, modal, WStyle_Customize | WStyle_NormalBorder |
+                WStyle_Title | WStyle_SysMenu | WDestructiveClose),
+     mySMESHGUI( theModule ),
+     mySelectionMgr( SMESH::GetSelectionMgr( theModule ) )
 {
-    QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "SMESH",tr("ICON_SELECT")));
-    if ( !name )
-       setName( "SMESHGUI_AddSubMeshDlg" );
-    setCaption( tr( "SMESH_ADD_SUBMESH"  ) );
-    setSizeGripEnabled( TRUE );
-    QGridLayout* SMESHGUI_AddSubMeshDlgLayout = new QGridLayout( this ); 
-    SMESHGUI_AddSubMeshDlgLayout->setSpacing( 6 );
-    SMESHGUI_AddSubMeshDlgLayout->setMargin( 11 );
-    
+    QPixmap image0 (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_SELECT")));
+    if (!name)
+      setName("SMESHGUI_AddSubMeshDlg");
+    setCaption(tr("SMESH_ADD_SUBMESH"));
+    setSizeGripEnabled(TRUE);
+    QGridLayout* SMESHGUI_AddSubMeshDlgLayout = new QGridLayout(this);
+    SMESHGUI_AddSubMeshDlgLayout->setSpacing(6);
+    SMESHGUI_AddSubMeshDlgLayout->setMargin(11);
+
     /***************************************************************/
-    GroupC1 = new QGroupBox( tr( "SMESH_ARGUMENTS" ), this, "GroupC1" );
-    GroupC1->setColumnLayout(0, Qt::Vertical );
-    GroupC1->layout()->setSpacing( 0 );
-    GroupC1->layout()->setMargin( 0 );
-    QGridLayout* GroupC1Layout = new QGridLayout( GroupC1->layout() );
-    GroupC1Layout->setAlignment( Qt::AlignTop );
-    GroupC1Layout->setSpacing( 6 );
-    GroupC1Layout->setMargin( 11 );
-
-    TextLabel_NameMesh = new QLabel(  tr( "SMESH_NAME" ), GroupC1, "TextLabel_NameMesh" );
-    GroupC1Layout->addWidget( TextLabel_NameMesh, 0, 0 );
-    LineEdit_NameMesh = new QLineEdit( GroupC1, "LineEdit_NameMesh" );
-    GroupC1Layout->addWidget( LineEdit_NameMesh, 0, 2 );
-
-    TextLabelC1A1 = new QLabel( tr( "SMESH_OBJECT_MESH" ), GroupC1, "TextLabelC1A1" );
-    GroupC1Layout->addWidget( TextLabelC1A1, 1, 0 );
-    SelectButtonC1A1 = new QPushButton( GroupC1, "SelectButtonC1A1" );
-    SelectButtonC1A1->setPixmap( image0 );
-    SelectButtonC1A1->setToggleButton( FALSE );
-    GroupC1Layout->addWidget( SelectButtonC1A1, 1, 1 );
-    LineEditC1A1 = new QLineEdit( GroupC1, "LineEditC1A1" );
-    LineEditC1A1->setReadOnly( true );
-    GroupC1Layout->addWidget( LineEditC1A1, 1, 2 );
-
-    TextLabelC1A2 = new QLabel( tr( "SMESH_OBJECT_GEOM" ), GroupC1, "TextLabelC1A2" );
-    GroupC1Layout->addWidget( TextLabelC1A2, 2, 0 );
-    SelectButtonC1A2 = new QPushButton( GroupC1, "SelectButtonC1A2" );
-    SelectButtonC1A2->setPixmap( image0 );
-    SelectButtonC1A2->setToggleButton( FALSE );
-    GroupC1Layout->addWidget( SelectButtonC1A2, 2, 1 );
-    LineEditC1A2 = new QLineEdit( GroupC1, "LineEditC1A2" );
-    LineEditC1A2->setReadOnly( true );
-    GroupC1Layout->addWidget( LineEditC1A2, 2, 2 );
-
-    TextLabelC1A1Hyp = new QLabel( tr( "SMESH_OBJECT_HYPOTHESIS" ), GroupC1, "TextLabelC1A1Hyp" );
-    GroupC1Layout->addWidget( TextLabelC1A1Hyp, 3, 0 );
-    SelectButtonC1A1Hyp = new QPushButton( GroupC1, "SelectButtonC1A1Hyp" );
-    SelectButtonC1A1Hyp->setPixmap( image0 );
-    GroupC1Layout->addWidget( SelectButtonC1A1Hyp, 3, 1 );
-    LineEditC1A1Hyp = new QLineEdit( GroupC1, "LineEditC1A1Hyp" );
-    LineEditC1A1Hyp->setReadOnly( true );
-    GroupC1Layout->addWidget( LineEditC1A1Hyp, 3, 2 );
-
-    TextLabelC1A1Algo = new QLabel( tr( "SMESH_OBJECT_ALGORITHM" ), GroupC1, "TextLabelC1A1Algo" );
-    GroupC1Layout->addWidget( TextLabelC1A1Algo, 4, 0 );
-    SelectButtonC1A1Algo = new QPushButton( GroupC1, "SelectButtonC1A1Algo" );
-    SelectButtonC1A1Algo->setPixmap( image0 );
-    GroupC1Layout->addWidget( SelectButtonC1A1Algo, 4, 1 );
-    LineEditC1A1Algo = new QLineEdit( GroupC1, "LineEditC1A1Algo" );
-    LineEditC1A1Algo->setReadOnly( true );
-    GroupC1Layout->addWidget( LineEditC1A1Algo, 4, 2 );
-
-    SMESHGUI_AddSubMeshDlgLayout->addWidget( GroupC1, 1, 0 );
+    GroupC1 = new QGroupBox (tr("SMESH_ARGUMENTS"), this, "GroupC1");
+    GroupC1->setColumnLayout(0, Qt::Vertical);
+    GroupC1->layout()->setSpacing(0);
+    GroupC1->layout()->setMargin(0);
+    QGridLayout* GroupC1Layout = new QGridLayout (GroupC1->layout());
+    GroupC1Layout->setAlignment(Qt::AlignTop);
+    GroupC1Layout->setSpacing(6);
+    GroupC1Layout->setMargin(11);
+
+    TextLabel_NameMesh = new QLabel (tr("SMESH_NAME"), GroupC1, "TextLabel_NameMesh");
+    GroupC1Layout->addWidget(TextLabel_NameMesh, 0, 0);
+    LineEdit_NameMesh = new QLineEdit (GroupC1, "LineEdit_NameMesh");
+    GroupC1Layout->addWidget(LineEdit_NameMesh, 0, 2);
+
+    TextLabelC1A1 = new QLabel (tr("SMESH_OBJECT_MESH"), GroupC1, "TextLabelC1A1");
+    GroupC1Layout->addWidget(TextLabelC1A1, 1, 0);
+    SelectButtonC1A1 = new QPushButton (GroupC1, "SelectButtonC1A1");
+    SelectButtonC1A1->setPixmap(image0);
+    SelectButtonC1A1->setToggleButton(FALSE);
+    GroupC1Layout->addWidget(SelectButtonC1A1, 1, 1);
+    LineEditC1A1 = new QLineEdit (GroupC1, "LineEditC1A1");
+    LineEditC1A1->setReadOnly(true);
+    GroupC1Layout->addWidget(LineEditC1A1, 1, 2);
+
+    TextLabelC1A2 = new QLabel(tr("SMESH_OBJECT_GEOM"), GroupC1, "TextLabelC1A2");
+    GroupC1Layout->addWidget(TextLabelC1A2, 2, 0);
+    SelectButtonC1A2 = new QPushButton(GroupC1, "SelectButtonC1A2");
+    SelectButtonC1A2->setPixmap(image0);
+    SelectButtonC1A2->setToggleButton(FALSE);
+    GroupC1Layout->addWidget(SelectButtonC1A2, 2, 1);
+    LineEditC1A2 = new QLineEdit(GroupC1, "LineEditC1A2");
+    LineEditC1A2->setReadOnly(true);
+    GroupC1Layout->addWidget(LineEditC1A2, 2, 2);
+
+    TextLabelC1A1Hyp = new QLabel(tr("SMESH_OBJECT_HYPOTHESIS"), GroupC1, "TextLabelC1A1Hyp");
+    GroupC1Layout->addWidget(TextLabelC1A1Hyp, 3, 0);
+    SelectButtonC1A1Hyp = new QPushButton(GroupC1, "SelectButtonC1A1Hyp");
+    SelectButtonC1A1Hyp->setPixmap(image0);
+    GroupC1Layout->addWidget(SelectButtonC1A1Hyp, 3, 1);
+    LineEditC1A1Hyp = new QLineEdit(GroupC1, "LineEditC1A1Hyp");
+    LineEditC1A1Hyp->setReadOnly(true);
+    GroupC1Layout->addWidget(LineEditC1A1Hyp, 3, 2);
+
+    TextLabelC1A1Algo = new QLabel(tr("SMESH_OBJECT_ALGORITHM"), GroupC1, "TextLabelC1A1Algo");
+    GroupC1Layout->addWidget(TextLabelC1A1Algo, 4, 0);
+    SelectButtonC1A1Algo = new QPushButton(GroupC1, "SelectButtonC1A1Algo");
+    SelectButtonC1A1Algo->setPixmap(image0);
+    GroupC1Layout->addWidget(SelectButtonC1A1Algo, 4, 1);
+    LineEditC1A1Algo = new QLineEdit(GroupC1, "LineEditC1A1Algo");
+    LineEditC1A1Algo->setReadOnly(true);
+    GroupC1Layout->addWidget(LineEditC1A1Algo, 4, 2);
+
+    SMESHGUI_AddSubMeshDlgLayout->addWidget(GroupC1, 1, 0);
 
     /***************************************************************/
-    GroupButtons = new QGroupBox( this, "GroupButtons" );
-    GroupButtons->setColumnLayout(0, Qt::Vertical );
-    GroupButtons->layout()->setSpacing( 0 );
-    GroupButtons->layout()->setMargin( 0 );
-    QGridLayout* GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
-    GroupButtonsLayout->setAlignment( Qt::AlignTop );
-    GroupButtonsLayout->setSpacing( 6 );
-    GroupButtonsLayout->setMargin( 11 );
+    GroupButtons = new QGroupBox(this, "GroupButtons");
+    GroupButtons->setColumnLayout(0, Qt::Vertical);
+    GroupButtons->layout()->setSpacing(0);
+    GroupButtons->layout()->setMargin(0);
+    QGridLayout* GroupButtonsLayout = new QGridLayout(GroupButtons->layout());
+    GroupButtonsLayout->setAlignment(Qt::AlignTop);
+    GroupButtonsLayout->setSpacing(6);
+    GroupButtonsLayout->setMargin(11);
 
-    buttonOk = new QPushButton( tr( "SMESH_BUT_OK" ), GroupButtons, "buttonOk" );
-    buttonOk->setAutoDefault( TRUE );
-    buttonOk->setDefault( TRUE );
-    GroupButtonsLayout->addWidget( buttonOk, 0, 0 );
+    buttonOk = new QPushButton(tr("SMESH_BUT_OK"), GroupButtons, "buttonOk");
+    buttonOk->setAutoDefault(TRUE);
+    buttonOk->setDefault(TRUE);
+    GroupButtonsLayout->addWidget(buttonOk, 0, 0);
 
-    buttonApply = new QPushButton( tr( "SMESH_BUT_APPLY" ), GroupButtons, "buttonApply" );
-    buttonApply->setAutoDefault( TRUE );
-    GroupButtonsLayout->addWidget( buttonApply, 0, 1 );
+    buttonApply = new QPushButton(tr("SMESH_BUT_APPLY"), GroupButtons, "buttonApply");
+    buttonApply->setAutoDefault(TRUE);
+    GroupButtonsLayout->addWidget(buttonApply, 0, 1);
 
-    GroupButtonsLayout->addItem( new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ), 0, 2 );
+    GroupButtonsLayout->addItem(new QSpacerItem(20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum), 0, 2);
 
-    buttonCancel = new QPushButton( tr( "SMESH_BUT_CLOSE" ), GroupButtons, "buttonCancel" );
-    buttonCancel->setAutoDefault( TRUE );
-    GroupButtonsLayout->addWidget( buttonCancel, 0, 3 );
+    buttonCancel = new QPushButton(tr("SMESH_BUT_CLOSE"), GroupButtons, "buttonCancel");
+    buttonCancel->setAutoDefault(TRUE);
+    GroupButtonsLayout->addWidget(buttonCancel, 0, 3);
 
-    SMESHGUI_AddSubMeshDlgLayout->addWidget( GroupButtons, 2, 0 );
+    SMESHGUI_AddSubMeshDlgLayout->addWidget(GroupButtons, 2, 0);
 
     /***************************************************************/
-    Init( Sel ) ;
+    Init();
 }
 
-
 //=================================================================================
 // function : ~SMESHGUI_AddSubMeshDlg()
 // purpose  : Destroys the object and frees any allocated resources
 //=================================================================================
 SMESHGUI_AddSubMeshDlg::~SMESHGUI_AddSubMeshDlg()
 {
-    // no need to delete child widgets, Qt does it all for us
+  // no need to delete child widgets, Qt does it all for us
 }
 
-
 //=================================================================================
 // function : Init()
 // purpose  :
 //=================================================================================
-void SMESHGUI_AddSubMeshDlg::Init( SALOME_Selection* Sel )
+void SMESHGUI_AddSubMeshDlg::Init ()
 {
-  mySelection = Sel;
-  mySMESHGUI = SMESHGUI::GetSMESHGUI() ;
-  mySMESHGUI->SetActiveDialogBox( (QDialog*)this ) ;
+  mySMESHGUI->SetActiveDialogBox((QDialog*)this);
 
-  myGeomFilter       = new SALOME_TypeFilter( "GEOM" );
-  myMeshFilter       = new SMESH_TypeFilter( MESH );
-  myAlgorithmFilter  = new SMESH_TypeFilter( ALGORITHM );
-  myHypothesisFilter = new SMESH_TypeFilter( HYPOTHESIS );
+  //myGeomFilter       = new SALOME_TypeFilter("GEOM");
+  TColStd_MapOfInteger allTypesMap;
+  for (int i = 0; i < 10; i++)
+    allTypesMap.Add(i);
+  myGeomFilter       = new SMESH_NumberFilter ("GEOM", TopAbs_SHAPE, 0, allTypesMap);
+  myMeshFilter       = new SMESH_TypeFilter (MESH);
+  myAlgorithmFilter  = new SMESH_TypeFilter (ALGORITHM);
+  myHypothesisFilter = new SMESH_TypeFilter (HYPOTHESIS);
 
   /* signals and slots connections */
-  connect( buttonOk,     SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
-  connect( buttonApply,  SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) );
-  connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ) ;
-
-  connect( SelectButtonC1A1,     SIGNAL (clicked() ),  this, SLOT( SetEditCurrentArgument() ) ) ;
-  connect( SelectButtonC1A2,     SIGNAL (clicked() ),  this, SLOT( SetEditCurrentArgument() ) ) ;
-  connect( SelectButtonC1A1Hyp,  SIGNAL (clicked() ),  this, SLOT( SetEditCurrentArgument() ) ) ;
-  connect( SelectButtonC1A1Algo, SIGNAL (clicked() ),  this, SLOT( SetEditCurrentArgument() ) ) ;
-
-  connect( mySelection, SIGNAL( currentSelectionChanged() ),      this, SLOT( SelectionIntoArgument() ) );
-  connect( mySMESHGUI,  SIGNAL( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ;
-  connect( mySMESHGUI,  SIGNAL( SignalCloseAllDialogs() ),        this, SLOT( ClickOnCancel() ) ) ;
-  
-  int x, y ;
-  mySMESHGUI->DefineDlgPosition( this, x, y ) ;
-  this->move( x, y ) ;
-  this->show() ; 
-
-  LineEdit_NameMesh->setText( tr( "SMESH_SUBMESH" ) );
-  LineEdit_NameMesh->setFocus() ;
-  myEditCurrentArgument = LineEditC1A1 ;       
-  mySelection->ClearFilters() ;   
-  mySelection->AddFilter( myMeshFilter ) ;
+  connect(buttonOk,     SIGNAL(clicked()), this, SLOT(ClickOnOk()));
+  connect(buttonApply,  SIGNAL(clicked()), this, SLOT(ClickOnApply()));
+  connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel()));
+
+  connect(SelectButtonC1A1,     SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
+  connect(SelectButtonC1A2,     SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
+  connect(SelectButtonC1A1Hyp,  SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
+  connect(SelectButtonC1A1Algo, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
+
+  connect(mySelectionMgr, SIGNAL(currentSelectionChanged()),  this, SLOT(SelectionIntoArgument()));
+  connect(mySMESHGUI, SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog()));
+  connect(mySMESHGUI, SIGNAL(SignalCloseAllDialogs()),        this, SLOT(ClickOnCancel()));
+
+  int x, y;
+  mySMESHGUI->DefineDlgPosition(this, x, y);
+  this->move(x, y);
+  this->show();
+
+  LineEdit_NameMesh->setText(tr("SMESH_SUBMESH"));
+  LineEdit_NameMesh->setFocus();
+  myEditCurrentArgument = LineEditC1A1;
+  mySelectionMgr->clearFilters();
+  mySelectionMgr->installFilter(myMeshFilter);
 
   SelectionIntoArgument();
 }
@@ -238,8 +249,8 @@ void SMESHGUI_AddSubMeshDlg::Init( SALOME_Selection* Sel )
 //=================================================================================
 void SMESHGUI_AddSubMeshDlg::ClickOnOk()
 {
-  if ( this->ClickOnApply() )
-    this->ClickOnCancel() ;
+  if (this->ClickOnApply())
+    this->ClickOnCancel();
 }
 
 //=================================================================================
@@ -248,68 +259,69 @@ void SMESHGUI_AddSubMeshDlg::ClickOnOk()
 //=================================================================================
 bool SMESHGUI_AddSubMeshDlg::ClickOnApply()
 {
-  if (mySMESHGUI->ActiveStudyLocked())
+  if (mySMESHGUI->isActiveStudyLocked())
     return false;
 
   QString myNameSubMesh = LineEdit_NameMesh->text().stripWhiteSpace();
-  if ( myNameSubMesh.isEmpty() ) {
-    QAD_MessageBox::warn1( this, tr( "SMESH_WRN_WARNING" ), tr( "SMESH_WRN_EMPTY_NAME" ), tr( "SMESH_BUT_OK" ) );
+  if (myNameSubMesh.isEmpty()) {
+    SUIT_MessageBox::warn1(this, tr("SMESH_WRN_WARNING"),
+                           tr("SMESH_WRN_EMPTY_NAME"), tr("SMESH_BUT_OK"));
     return false;
   }
-  
-  if ( myMesh->_is_nil() || myGeomShape->_is_nil() || ( !HypoList.count() && !AlgoList.count() ) )
+
+  if (myMesh->_is_nil() || myGeomShape->_is_nil() ||
+      (!HypoList.count() && !AlgoList.count()))
     return false;
 
-  SALOMEDS::SObject_var aMeshSO = SMESH::FindSObject( myMesh );
-  GEOM::GEOM_Object_var myMainShape = SMESH::GetShapeOnMeshOrSubMesh( aMeshSO );
-  if ( myMainShape->_is_nil() )
+  _PTR(SObject) aMeshSO = SMESH::FindSObject(myMesh);
+  GEOM::GEOM_Object_var myMainShape = SMESH::GetShapeOnMeshOrSubMesh(aMeshSO);
+  if (myMainShape->_is_nil())
     return false;
 
-  QAD_WaitCursor wc;
+  SUIT_OverrideCursor wc;
 
-  QAD_Operation* op = new QAD_Operation( mySMESHGUI->GetActiveStudy() );
+  SUIT_Operation* op =
+    new SUIT_Operation (SUIT_Session::session()->activeApplication());
 
   // start transaction
   op->start();
-  
+
   // create submesh
-  SMESH::SMESH_subMesh_var aSubMesh = SMESH::AddSubMesh( myMesh, myGeomShape, myNameSubMesh ) ;
+  SMESH::SMESH_subMesh_var aSubMesh = SMESH::AddSubMesh(myMesh, myGeomShape, myNameSubMesh);
   int nbSuccess = 0;
-  
-  if ( !aSubMesh->_is_nil() ) {
+
+  if (!aSubMesh->_is_nil()) {
     // assign hypotheses
     int nbAlgo = AlgoList.count();
     int nbHyps = HypoList.count() + nbAlgo;
-    for( int i = 0; i < nbHyps; i++ ) {
-      SALOMEDS::SObject_var aHypSO = SMESH::GetActiveStudyDocument()->FindObjectID
-        ( i < nbAlgo ? AlgoList[i] : HypoList[i-nbAlgo] );
-      if ( !aHypSO->_is_nil() ) {
-       CORBA::Object_var anObject = aHypSO->GetObject();
-       if ( !CORBA::is_nil( anObject ) ) {
-         SMESH::SMESH_Hypothesis_var aHyp = SMESH::SMESH_Hypothesis::_narrow( anObject );
-         if ( !aHyp->_is_nil() )
-           if ( SMESH::AddHypothesisOnSubMesh( aSubMesh, aHyp ) )
+    for (int i = 0; i < nbHyps; i++) {
+      _PTR(SObject) aHypSOClient =
+        SMESH::GetActiveStudyDocument()->FindObjectID
+          (i < nbAlgo ? AlgoList[i].latin1() : HypoList[i-nbAlgo].latin1());
+      if (aHypSOClient) {
+       CORBA::Object_var anObject = _CAST(SObject,aHypSOClient)->GetObject();
+       if (!CORBA::is_nil(anObject)) {
+         SMESH::SMESH_Hypothesis_var aHyp = SMESH::SMESH_Hypothesis::_narrow(anObject);
+         if (!aHyp->_is_nil())
+           if (SMESH::AddHypothesisOnSubMesh(aSubMesh, aHyp))
               nbSuccess++;
-       }
-        else {
-          SCRUTE( CORBA::is_nil( anObject ));
+       } else {
+          SCRUTE(CORBA::is_nil(anObject));
         }
-      }
-      else {
-        SCRUTE( aHypSO->_is_nil() );
+      } else {
+        SCRUTE(!aHypSOClient);
       }
     }
+  } else {
+    SCRUTE(aSubMesh->_is_nil());
   }
-  else {
-    SCRUTE( aSubMesh->_is_nil() );
-  }
-  
+
   // commit transaction
-  op->finish();
-  return ( nbSuccess > 0 );
+  op->commit();
+  mySMESHGUI->updateObjBrowser();
+  return (nbSuccess > 0);
 }
 
-
 //=================================================================================
 // function : ClickOnCancel()
 // purpose  :
@@ -319,16 +331,18 @@ void SMESHGUI_AddSubMeshDlg::ClickOnCancel()
   close();
 }
 
-//=======================================================================
-//function : IsFatherOf
-//purpose  : 
-//=======================================================================
-
-static bool IsFatherOf( SALOMEDS::SObject_ptr SO, SALOMEDS::SObject_ptr fatherSO ) {
-  if ( !SO->_is_nil() && !fatherSO->_is_nil() ) {
-    SALOMEDS::SObject_var aSO = SO->GetFather();
-    while( strlen( aSO->GetID() ) >= strlen( fatherSO->GetID() ) ) {
-      if ( QString( aSO->GetID() ) == QString( fatherSO->GetID() ) )
+//=================================================================================
+// function : IsFatherOf()
+// purpose  :
+//=================================================================================
+static bool IsFatherOf (_PTR(SObject) SO, _PTR(SObject) fatherSO)
+{
+  if (SO && fatherSO) {
+    _PTR(SObject) aSO = SO->GetFather();
+    //while (strlen(aSO->GetID()) >= strlen(fatherSO->GetID())) {
+    while (aSO->GetID().length() >= fatherSO->GetID().length()) {
+      //if (QString(aSO->GetID()) == QString(fatherSO->GetID()))
+      if (aSO->GetID() == fatherSO->GetID())
        return true;
       aSO = aSO->GetFather();
     }
@@ -342,87 +356,86 @@ static bool IsFatherOf( SALOMEDS::SObject_ptr SO, SALOMEDS::SObject_ptr fatherSO
 //=================================================================================
 void SMESHGUI_AddSubMeshDlg::SelectionIntoArgument()
 {
-  QString aString = ""; 
-  int nbSel = SMESH::GetNameOfSelectedIObjects(mySelection, aString) ;
+  QString aString = "";
 
-  if ( myEditCurrentArgument == LineEditC1A1 ) {
+  SALOME_ListIO aList;
+  mySelectionMgr->selectedObjects(aList, SVTK_Viewer::Type());
+  int nbSel = SMESH::GetNameOfSelectedIObjects(mySelectionMgr, aString);
+
+  if (myEditCurrentArgument == LineEditC1A1) {
     // mesh
-    if ( nbSel != 1 ) {
+    if (nbSel != 1) {
       myMesh = SMESH::SMESH_Mesh::_nil();
       aString = "";
-    } 
-    else {
-      Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject() ;
-      myMesh = SMESH::IObjectToInterface<SMESH::SMESH_Mesh>(IO) ;
-      if( myMesh->_is_nil() ) {
+    } else {
+      Handle(SALOME_InteractiveObject) IO = aList.First();
+      myMesh = SMESH::IObjectToInterface<SMESH::SMESH_Mesh>(IO);
+      if (myMesh->_is_nil()) {
        aString = "";
       }
     }
     myGeomShape = GEOM::GEOM_Object::_nil();
-    LineEditC1A2->setText( "" );
-  }
-  else if ( myEditCurrentArgument == LineEditC1A2 ) {
+    LineEditC1A2->setText("");
+
+  } else if (myEditCurrentArgument == LineEditC1A2) {
     // geom shape
-    if ( nbSel != 1 ) {
+    if (nbSel != 1) {
       myGeomShape = GEOM::GEOM_Object::_nil();
       aString = "";
-    } 
-    else {
-      Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject() ;
-      myGeomShape = SMESH::IObjectToInterface<GEOM::GEOM_Object>(IO) ;
-      if( myGeomShape->_is_nil() || !GEOMBase::IsShape( myGeomShape ) )
-      {
+    } else {
+      Handle(SALOME_InteractiveObject) IO = aList.First();
+      myGeomShape = SMESH::IObjectToInterface<GEOM::GEOM_Object>(IO);
+      if (myGeomShape->_is_nil() || !GEOMBase::IsShape(myGeomShape)) {
         myGeomShape = GEOM::GEOM_Object::_nil();
         aString = "";
       }
-      if ( !myMesh->_is_nil() ) {
-       SALOMEDS::SObject_var aMeshSO = SMESH::FindSObject( myMesh );
-       GEOM::GEOM_Object_var aMainGeomShape = SMESH::GetShapeOnMeshOrSubMesh( aMeshSO );
-       SALOMEDS::SObject_var aMainGeomShapeSO = SMESH::FindSObject( aMainGeomShape );
-       if ( aMainGeomShapeSO->_is_nil() || !IsFatherOf( SMESH::GetActiveStudyDocument()->FindObjectID( IO->getEntry() ), aMainGeomShapeSO ) ) {
+      if (!myMesh->_is_nil()) {
+       _PTR(SObject) aMeshSO = SMESH::FindSObject(myMesh);
+       GEOM::GEOM_Object_var aMainGeomShape = SMESH::GetShapeOnMeshOrSubMesh(aMeshSO);
+       _PTR(SObject) aMainGeomShapeSO = SMESH::FindSObject(aMainGeomShape);
+       if (!aMainGeomShapeSO ||
+            !IsFatherOf(SMESH::GetActiveStudyDocument()->FindObjectID
+                        (IO->getEntry()), aMainGeomShapeSO)) {
          myGeomShape = GEOM::GEOM_Object::_nil();
          aString = "";
-       }         
+       }
       }
     }
-  } 
-  else if ( myEditCurrentArgument == LineEditC1A1Hyp ) {
+  } else if (myEditCurrentArgument == LineEditC1A1Hyp) {
     // hypotheses
     HypoList.clear();
-    if ( nbSel >= 1 ) {
-      SALOME_ListIteratorOfListIO Itinit( mySelection->StoredIObjects() );
-      for ( ; Itinit.More(); Itinit.Next() ) {
-       HypoList.append( Itinit.Value()->getEntry() );
+    if (nbSel >= 1) {
+      SALOME_ListIteratorOfListIO Itinit (aList);
+      for (; Itinit.More(); Itinit.Next()) {
+       HypoList.append(Itinit.Value()->getEntry());
       }
-      if ( nbSel > 1 )
-       aString = tr( "%1 Hypothesis" ).arg( nbSel ) ;
-    }
-    else {
+      if (nbSel > 1)
+       aString = tr("%1 Hypothesis").arg(nbSel);
+    } else {
       aString = "";
     }
-  }
-  else if ( myEditCurrentArgument == LineEditC1A1Algo ) {
+  } else if (myEditCurrentArgument == LineEditC1A1Algo) {
     // algorithms
-    AlgoList.clear(); 
-    if ( nbSel >= 1 ) {
-      SALOME_ListIteratorOfListIO Itinit( mySelection->StoredIObjects() );
-      for ( ; Itinit.More(); Itinit.Next() ) {
-       AlgoList.append( Itinit.Value()->getEntry() );
+    AlgoList.clear();
+    if (nbSel >= 1) {
+      SALOME_ListIteratorOfListIO Itinit (aList);
+      for (; Itinit.More(); Itinit.Next()) {
+       AlgoList.append(Itinit.Value()->getEntry());
       }
-      if ( nbSel > 1 )
-       aString = tr( "%1 Algorithms" ).arg( nbSel ) ;
-    }
-    else {
+      if (nbSel > 1)
+       aString = tr("%1 Algorithms").arg(nbSel);
+    } else {
       aString = "";
     }
+  } else {
   }
-  
-  myEditCurrentArgument->setText(aString) ;
+
+  myEditCurrentArgument->setText(aString);
+  myEditCurrentArgument->setCursorPosition( 0 );
 
   UpdateControlState();
 }
 
-
 //=================================================================================
 // function : SetEditCurrentArgument()
 // purpose  :
@@ -431,27 +444,27 @@ void SMESHGUI_AddSubMeshDlg::SetEditCurrentArgument()
 {
   QPushButton* send = (QPushButton*)sender();
   if(send == SelectButtonC1A1) {
-    LineEditC1A1->setFocus() ;
+    LineEditC1A1->setFocus();
+    mySelectionMgr->clearFilters();
+    mySelectionMgr->installFilter(myMeshFilter);
     myEditCurrentArgument = LineEditC1A1;
-    mySelection->ClearFilters() ;        
-    mySelection->AddFilter(myMeshFilter) ;
   } else if (send == SelectButtonC1A2) {
-    LineEditC1A2->setFocus() ;
+    LineEditC1A2->setFocus();
+    mySelectionMgr->clearFilters();
+    mySelectionMgr->installFilter(myGeomFilter);
     myEditCurrentArgument = LineEditC1A2;
-    mySelection->ClearFilters() ;
-    mySelection->AddFilter(myGeomFilter) ;
-  } else if( send == SelectButtonC1A1Hyp ) {
-    LineEditC1A1Hyp->setFocus() ;
-    myEditCurrentArgument = LineEditC1A1Hyp ;
-    mySelection->ClearFilters() ;        
-    mySelection->AddFilter(myHypothesisFilter) ;
-  } else if( send == SelectButtonC1A1Algo ) {
-    LineEditC1A1Algo->setFocus() ;
-    myEditCurrentArgument = LineEditC1A1Algo ;
-    mySelection->ClearFilters() ;        
-    mySelection->AddFilter(myAlgorithmFilter) ;
+  } else if(send == SelectButtonC1A1Hyp) {
+    LineEditC1A1Hyp->setFocus();
+    mySelectionMgr->clearFilters();
+    mySelectionMgr->installFilter(myHypothesisFilter);
+    myEditCurrentArgument = LineEditC1A1Hyp;
+  } else if(send == SelectButtonC1A1Algo) {
+    LineEditC1A1Algo->setFocus();
+    mySelectionMgr->clearFilters();
+    mySelectionMgr->installFilter(myAlgorithmFilter);
+    myEditCurrentArgument = LineEditC1A1Algo;
   }
-  SelectionIntoArgument() ;
+  SelectionIntoArgument();
 }
 
 //=================================================================================
@@ -460,48 +473,45 @@ void SMESHGUI_AddSubMeshDlg::SetEditCurrentArgument()
 //=================================================================================
 void SMESHGUI_AddSubMeshDlg::DeactivateActiveDialog()
 {
-  if ( GroupC1->isEnabled() ) {
-    disconnect( mySelection, 0, this, 0 );
-    GroupC1->setEnabled(false) ;
-    GroupButtons->setEnabled(false) ;
+  if (GroupC1->isEnabled()) {
+    disconnect(mySelectionMgr, 0, this, 0);
+    GroupC1->setEnabled(false);
+    GroupButtons->setEnabled(false);
   }
 }
 
-
 //=================================================================================
 // function : ActivateThisDialog()
 // purpose  :
 //=================================================================================
 void SMESHGUI_AddSubMeshDlg::ActivateThisDialog()
 {
-  mySMESHGUI->EmitSignalDeactivateDialog() ;   
-  GroupC1->setEnabled(true) ;
-  GroupButtons->setEnabled(true) ;
-  connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
+  mySMESHGUI->EmitSignalDeactivateDialog();
+  GroupC1->setEnabled(true);
+  GroupButtons->setEnabled(true);
+  connect (mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
 }
 
-
 //=================================================================================
 // function : enterEvent()
 // purpose  :
 //=================================================================================
-void SMESHGUI_AddSubMeshDlg::enterEvent(QEvent* e)
+void SMESHGUI_AddSubMeshDlg::enterEvent (QEvent*)
 {
-  if ( !GroupC1->isEnabled() )
-    ActivateThisDialog() ;
+  if (!GroupC1->isEnabled())
+    ActivateThisDialog();
 }
 
-
 //=================================================================================
 // function : closeEvent()
 // purpose  :
 //=================================================================================
-void SMESHGUI_AddSubMeshDlg::closeEvent( QCloseEvent* e )
+void SMESHGUI_AddSubMeshDlg::closeEvent (QCloseEvent* e)
 {
-  disconnect( mySelection, 0, this, 0 );
-  mySMESHGUI->ResetState() ;
-  mySelection->ClearFilters() ;
-  QDialog::closeEvent( e );
+  disconnect(mySelectionMgr, 0, this, 0);
+  mySMESHGUI->ResetState();
+  mySelectionMgr->clearFilters();
+  QDialog::closeEvent(e);
 }
 
 //=================================================================================
@@ -510,14 +520,16 @@ void SMESHGUI_AddSubMeshDlg::closeEvent( QCloseEvent* e )
 //=================================================================================
 void SMESHGUI_AddSubMeshDlg::UpdateControlState()
 {
-  bool isEnabled = ( !myMesh->_is_nil() && !myGeomShape->_is_nil() && ( HypoList.count() || AlgoList.count() ) );
+  bool isEnabled = (!myMesh->_is_nil() &&
+                    !myGeomShape->_is_nil() &&
+                    (HypoList.count() || AlgoList.count()));
   bool isImportedMesh = false;
-  if ( !myMesh->_is_nil() ) {
-    SALOMEDS::SObject_var aMeshSO = SMESH::FindSObject( myMesh );
-    GEOM::GEOM_Object_var myGeomShape = SMESH::GetShapeOnMeshOrSubMesh( aMeshSO );
+  if (!myMesh->_is_nil()) {
+    _PTR(SObject) aMeshSO = SMESH::FindSObject(myMesh);
+    GEOM::GEOM_Object_var myGeomShape = SMESH::GetShapeOnMeshOrSubMesh(aMeshSO);
     isImportedMesh = myGeomShape->_is_nil();
   }
 
-  buttonOk   ->setEnabled( isEnabled && !isImportedMesh );
-  buttonApply->setEnabled( isEnabled && !isImportedMesh );
+  buttonOk   ->setEnabled(isEnabled && !isImportedMesh);
+  buttonApply->setEnabled(isEnabled && !isImportedMesh);
 }
index 3ede5c043f05a8f63698e490c358b0a095014510..20e19761827bfd041a0921cf1e7aae114fdb7e98 100644 (file)
 #ifndef DIALOGBOX_ADD_SUBMESH_H
 #define DIALOGBOX_ADD_SUBMESH_H
 
-#include "SALOME_Selection.h"
-#include "SALOME_TypeFilter.hxx"
-#include "SMESH_TypeFilter.hxx"
+//#include "SMESH_TypeFilter.hxx"
+
+#include "SUIT_SelectionFilter.h"
+#include "SalomeApp_SelectionMgr.h"
 
 // QT Includes
 #include <qdialog.h>
@@ -57,33 +58,40 @@ class SMESHGUI_AddSubMeshDlg : public QDialog
     Q_OBJECT
 
 public:
-    SMESHGUI_AddSubMeshDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 );
+    SMESHGUI_AddSubMeshDlg( SMESHGUI*,
+                           const char* name = 0,
+                           bool modal = FALSE,
+                           WFlags fl = 0);
     ~SMESHGUI_AddSubMeshDlg();
 
 protected:
-    void closeEvent( QCloseEvent* e ) ;
-    void enterEvent ( QEvent * ) ;
+    void closeEvent (QCloseEvent* e);
+    void enterEvent (QEvent *) ;
 
 private:
-    void Init( SALOME_Selection* Sel ) ;
+    void Init ();
 
     void UpdateControlState();
 
 private:
-    SMESHGUI*                     mySMESHGUI ;
-    SALOME_Selection*             mySelection ;
-             
-    SMESH::SMESH_Mesh_var         myMesh;
-    GEOM::GEOM_Object_var         myGeomShape ;
-    QLineEdit*                    myEditCurrentArgument; 
+    SMESHGUI*               mySMESHGUI;
+    SalomeApp_SelectionMgr* mySelectionMgr;
+
+    SMESH::SMESH_Mesh_var   myMesh;
+    GEOM::GEOM_Object_var   myGeomShape;
+    QLineEdit*              myEditCurrentArgument; 
 
-    Handle(SALOME_TypeFilter)     myGeomFilter;
-    Handle(SMESH_TypeFilter)      myMeshFilter;
-    Handle(SMESH_TypeFilter)      myHypothesisFilter;
-    Handle(SMESH_TypeFilter)      myAlgorithmFilter;
+    //Handle(SALOME_TypeFilter)     myMeshFilter;
+    //Handle(SMESH_TypeFilter)      myMeshFilter;
+    //Handle(SMESH_TypeFilter)      myHypothesisFilter;
+    //Handle(SMESH_TypeFilter)      myAlgorithmFilter;
+    SUIT_SelectionFilter*   myGeomFilter;
+    SUIT_SelectionFilter*   myMeshFilter;
+    SUIT_SelectionFilter*   myHypothesisFilter;
+    SUIT_SelectionFilter*   myAlgorithmFilter;
 
-    QStringList                   HypoList;
-    QStringList                   AlgoList;
+    QStringList             HypoList;
+    QStringList             AlgoList;
 
     QGroupBox*    GroupButtons;
     QPushButton*  buttonOk;
@@ -91,8 +99,8 @@ private:
     QPushButton*  buttonCancel;
 
     QGroupBox*    GroupC1;
-    QLabel*       TextLabel_NameMesh ;
-    QLineEdit*    LineEdit_NameMesh ;
+    QLabel*       TextLabel_NameMesh;
+    QLineEdit*    LineEdit_NameMesh;
     QLabel*       TextLabelC1A1;
     QPushButton*  SelectButtonC1A1;
     QLineEdit*    LineEditC1A1;
@@ -112,10 +120,10 @@ private slots:
     void ClickOnOk();
     bool ClickOnApply();
     void ClickOnCancel();
-    void SetEditCurrentArgument() ;
-    void SelectionIntoArgument() ;
-    void DeactivateActiveDialog() ;
-    void ActivateThisDialog() ;
+    void SetEditCurrentArgument();
+    void SelectionIntoArgument();
+    void DeactivateActiveDialog();
+    void ActivateThisDialog();
 };
 
 #endif // DIALOGBOX_ADD_SUBMESH_H
index 2190ea2d545a1b4a6942f3ad93b581efb9cf10d1..f415162d5e45fed3f6856b009319b87f91bee996 100644 (file)
@@ -1,23 +1,23 @@
 //  SMESH SMESHGUI : GUI for SMESH component
 //
 //  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
-// 
-//  This library is free software; you can redistribute it and/or 
-//  modify it under the terms of the GNU Lesser General Public 
-//  License as published by the Free Software Foundation; either 
-//  version 2.1 of the License. 
-// 
-//  This library is distributed in the hope that it will be useful, 
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of 
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
-//  Lesser General Public License for more details. 
-// 
-//  You should have received a copy of the GNU Lesser General Public 
-//  License along with this library; if not, write to the Free Software 
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
-// 
-//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
 //
 //
 //
 #include "SMESHGUI_Utils.h"
 #include "SMESHGUI_VTKUtils.h"
 
-#include <algorithm>
+#include "SMESH_Actor.h"
+#include "SMESH_ActorUtils.h"
+
+#include "SUIT_Session.h"
+#include "SUIT_OverrideCursor.h"
+
+#include "SALOME_ListIO.hxx"
+#include "SALOME_InteractiveObject.hxx"
+#include "SALOME_ListIteratorOfListIO.hxx"
+
+#include "SalomeApp_Application.h"
+#include "SalomeApp_SelectionMgr.h"
+
+#include "SVTK_Selector.h"
+#include "SVTK_ViewWindow.h"
 
 // QT Includes
 #include <qlabel.h>
@@ -42,6 +56,7 @@
 #include <qlayout.h>
 #include <qgroupbox.h>
 
+// VTK Includes
 #include <vtkMath.h>
 #include <vtkCamera.h>
 #include <vtkRenderer.h>
 #include <vtkDataSetMapper.h>
 #include <vtkPlaneSource.h>
 #include <vtkPolyData.h>
-
-#include "VTKViewer_ViewFrame.h"
-#include "QAD_RightFrame.h"
-#include "QAD_WaitCursor.h"
-#include "SALOME_ListIteratorOfListIO.hxx"
-#include "SMESH_Actor.h"
-#include "SALOME_Selection.h"
-#include "SALOME_InteractiveObject.hxx"
-#include "SMESH_ActorUtils.h"
-
-#include "VTKViewer_ViewFrame.h"
-#include "VTKViewer_RenderWindow.h"
-
 #include <vtkRenderer.h>
 
+// STL includes
+#include <algorithm>
+
 using namespace std;
 
 
 class OrientedPlane: public vtkPlane
 {
-  QAD_Study* myStudy;
-  QAD_StudyFrame* myStudyFrame;
-  VTKViewer_ViewFrame* myViewFrame;
-  
-  vtkDataSetMapper* myMapper;
+  SVTK_ViewWindow* myViewWindow;
 
+  vtkDataSetMapper* myMapper;
 
 public:
-  static OrientedPlane *New(){
+  static OrientedPlane *New()
+  {
     return new OrientedPlane();
   }
-  static OrientedPlane *New(QAD_Study* theStudy){
-    return new OrientedPlane(theStudy);
+  static OrientedPlane *New(SVTK_ViewWindow* theViewWindow)
+  {
+    return new OrientedPlane(theViewWindow);
   }
-  vtkTypeMacro(OrientedPlane, vtkPlane);
-  
-  
+  vtkTypeMacro (OrientedPlane, vtkPlane);
+
   SMESH::Orientation myOrientation;
   float myDistance;
   double myAngle[2];
 
   vtkPlaneSource* myPlaneSource;
   SALOME_Actor *myActor;
-  
-  void SetOrientation(SMESH::Orientation theOrientation) {myOrientation = theOrientation;}
-  SMESH::Orientation GetOrientation() {return myOrientation;}
 
-  void SetDistance(float theDistance) {myDistance = theDistance;}
-  float GetDistance() {return myDistance;}
+  void SetOrientation (SMESH::Orientation theOrientation) { myOrientation = theOrientation; }
+  SMESH::Orientation GetOrientation() { return myOrientation; }
+
+  void SetDistance (float theDistance) { myDistance = theDistance; }
+  float GetDistance() { return myDistance; }
 
-  void ShallowCopy(OrientedPlane* theOrientedPlane){
+  void ShallowCopy (OrientedPlane* theOrientedPlane)
+  {
     SetNormal(theOrientedPlane->GetNormal());
     SetOrigin(theOrientedPlane->GetOrigin());
 
@@ -120,41 +124,38 @@ public:
   }
 
 protected:
-  OrientedPlane(QAD_Study* theStudy):
+  OrientedPlane(SVTK_ViewWindow* theViewWindow):
+    myViewWindow(theViewWindow),
     myOrientation(SMESH::XY),
-    myDistance(0.5),
-    myStudy(theStudy),
-    myStudyFrame(theStudy->getActiveStudyFrame()),
-    myViewFrame(SMESH::GetVtkViewFrame(theStudy->getActiveStudyFrame()))
+    myDistance(0.5)
   {
     Init();
-    myViewFrame->AddActor( myActor );
+    myViewWindow->AddActor(myActor);
   }
 
   OrientedPlane():
     myOrientation(SMESH::XY),
-    myDistance(0.5),
-    myStudy(NULL),
-    myStudyFrame(NULL),
-    myViewFrame(NULL)
+    myViewWindow(NULL),
+    myDistance(0.5)
   {
     Init();
   }
 
-  void Init(){
+  void Init()
+  {
     myPlaneSource = vtkPlaneSource::New();
 
     myAngle[0] = myAngle[1] = 0.0;
 
     // Create and display actor
     myMapper = vtkDataSetMapper::New();
-    myMapper->SetInput( myPlaneSource->GetOutput() );
-    
+    myMapper->SetInput(myPlaneSource->GetOutput());
+
     myActor = SALOME_Actor::New();
     myActor->VisibilityOff();
     myActor->PickableOff();
     myActor->SetInfinitive(true);
-    myActor->SetMapper( myMapper );
+    myActor->SetMapper(myMapper);
 
     vtkProperty* aProp = vtkProperty::New();
     float anRGB[3];
@@ -163,40 +164,38 @@ protected:
     anRGB[2] = SMESH::GetFloat("SMESH:SettingsFillColorBlue", 255)/255.;
     aProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
     aProp->SetOpacity(0.75);
-    myActor->SetProperty( aProp );
+    myActor->SetProperty(aProp);
     aProp->Delete();
-    
+
     vtkProperty* aBackProp = vtkProperty::New();
     anRGB[0] = SMESH::GetFloat("SMESH:SettingsBackFaceColorRed", 0)/255.;
     anRGB[1] = SMESH::GetFloat("SMESH:SettingsBackFaceColorGreen", 0)/255.;
     anRGB[2] = SMESH::GetFloat("SMESH:SettingsBackFaceColorBlue", 255)/255.;
     aBackProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
     aBackProp->SetOpacity(0.75);
-    myActor->SetBackfaceProperty( aBackProp );
+    myActor->SetBackfaceProperty(aBackProp);
     aBackProp->Delete();
   }
 
   ~OrientedPlane(){
-    if(myStudy && SMESH::FindVtkViewFrame(myStudy,myStudyFrame)){
-      myViewFrame->RemoveActor(myActor);
-    }
+    myViewWindow->RemoveActor(myActor);
     myActor->Delete();
     
     myMapper->RemoveAllInputs();
     myMapper->Delete();
-    
+
     myPlaneSource->UnRegisterAllOutputs();
     myPlaneSource->Delete();
   };
-  
+
 private:
   // Not implemented.
-  OrientedPlane(const OrientedPlane&); 
-  void operator=(const OrientedPlane&);
+  OrientedPlane (const OrientedPlane&);
+  void operator= (const OrientedPlane&);
 
 };
 
-struct TSetVisiblity{
+struct TSetVisiblity {
   TSetVisiblity(int theIsVisible): myIsVisible(theIsVisible){}
   void operator()(SMESH::TVTKPlane& theOrientedPlane){
     theOrientedPlane->myActor->SetVisibility(myIsVisible);
@@ -204,173 +203,175 @@ struct TSetVisiblity{
   int myIsVisible;
 };
 
-
 //=================================================================================
 // class    : SMESHGUI_ClippingDlg()
-// purpose  : 
+// purpose  :
 //
 //=================================================================================
-SMESHGUI_ClippingDlg::SMESHGUI_ClippingDlg( QWidget* parent,
+SMESHGUI_ClippingDlg::SMESHGUI_ClippingDlg (SMESHGUI* theModule,
                                            const char* name,
                                            bool modal,
-                                           WFlags fl )
-  : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | WDestructiveClose )
+                                           WFlags fl):
+  QDialog(SMESH::GetDesktop(theModule),
+         name, 
+         modal, 
+         WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | WDestructiveClose),
+  mySelector(SMESH::GetViewWindow(theModule)->GetSelector()),
+  mySelectionMgr(SMESH::GetSelectionMgr(theModule)),
+  mySMESHGUI(theModule)
 {
-  if ( !name )
-    setName( "SMESHGUI_ClippingDlg" );
-  setCaption( tr( "SMESH_CLIPPING_TITLE"  ) );
-  setSizeGripEnabled( TRUE );
-  QGridLayout* SMESHGUI_ClippingDlgLayout = new QGridLayout( this ); 
-  SMESHGUI_ClippingDlgLayout->setSpacing( 6 );
-  SMESHGUI_ClippingDlgLayout->setMargin( 11 );
+  if (!name)
+    setName("SMESHGUI_ClippingDlg");
+  setCaption(tr("SMESH_CLIPPING_TITLE"));
+  setSizeGripEnabled(TRUE);
+  QGridLayout* SMESHGUI_ClippingDlgLayout = new QGridLayout(this);
+  SMESHGUI_ClippingDlgLayout->setSpacing(6);
+  SMESHGUI_ClippingDlgLayout->setMargin(11);
 
   // Controls for selecting, creating, deleting planes
-  QGroupBox* GroupPlanes = new QGroupBox( this, "GroupPlanes" );
-  GroupPlanes->setTitle( tr("Clipping planes") );
+  QGroupBox* GroupPlanes = new QGroupBox (this, "GroupPlanes");
+  GroupPlanes->setTitle(tr("Clipping planes"));
   GroupPlanes->setColumnLayout(0, Qt::Vertical);
-  GroupPlanes->layout()->setSpacing( 0 );
-  GroupPlanes->layout()->setMargin( 0 );
-  QGridLayout* GroupPlanesLayout = new QGridLayout( GroupPlanes->layout() );
-  GroupPlanesLayout->setAlignment( Qt::AlignTop );
-  GroupPlanesLayout->setSpacing( 6 );
-  GroupPlanesLayout->setMargin( 11 );
-  
+  GroupPlanes->layout()->setSpacing(0);
+  GroupPlanes->layout()->setMargin(0);
+  QGridLayout* GroupPlanesLayout = new QGridLayout (GroupPlanes->layout());
+  GroupPlanesLayout->setAlignment(Qt::AlignTop);
+  GroupPlanesLayout->setSpacing(6);
+  GroupPlanesLayout->setMargin(11);
+
   ComboBoxPlanes = new QComboBox(GroupPlanes, "ComboBoxPlanes");
-  GroupPlanesLayout->addWidget( ComboBoxPlanes, 0, 0 );
-  
-  QSpacerItem* spacerGP = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
-  GroupPlanesLayout->addItem( spacerGP, 0, 1 );
-  
-  buttonNew = new QPushButton( GroupPlanes, "buttonNew" );
-  buttonNew->setText( tr( "SMESH_BUT_NEW"  ) );
-  GroupPlanesLayout->addWidget( buttonNew, 0, 2 );
-  
-  buttonDelete = new QPushButton( GroupPlanes, "buttonDelete" );
-  buttonDelete->setText( tr( "SMESH_BUT_DELETE"  ) );
-  GroupPlanesLayout->addWidget( buttonDelete, 0, 3 );
+  GroupPlanesLayout->addWidget(ComboBoxPlanes, 0, 0);
+
+  QSpacerItem* spacerGP = new QSpacerItem (20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
+  GroupPlanesLayout->addItem(spacerGP, 0, 1);
+
+  buttonNew = new QPushButton (GroupPlanes, "buttonNew");
+  buttonNew->setText(tr("SMESH_BUT_NEW"));
+  GroupPlanesLayout->addWidget(buttonNew, 0, 2);
+
+  buttonDelete = new QPushButton (GroupPlanes, "buttonDelete");
+  buttonDelete->setText(tr("SMESH_BUT_DELETE"));
+  GroupPlanesLayout->addWidget(buttonDelete, 0, 3);
 
   // Controls for defining plane parameters
-  QGroupBox* GroupParameters = new QGroupBox( this, "GroupParameters" );
-  GroupParameters->setTitle( tr("SMESH_PARAMETERS") );
+  QGroupBox* GroupParameters = new QGroupBox (this, "GroupParameters");
+  GroupParameters->setTitle(tr("SMESH_PARAMETERS"));
   GroupParameters->setColumnLayout(0, Qt::Vertical);
-  GroupParameters->layout()->setSpacing( 0 );
-  GroupParameters->layout()->setMargin( 0 );
-  QGridLayout* GroupParametersLayout = new QGridLayout( GroupParameters->layout() );
-  GroupParametersLayout->setAlignment( Qt::AlignTop );
-  GroupParametersLayout->setSpacing( 6 );
-  GroupParametersLayout->setMargin( 11 );
-  
-  TextLabelOrientation = new QLabel( GroupParameters, "TextLabelOrientation" );
-  TextLabelOrientation->setText( tr("SMESH_ORIENTATION") );
-  GroupParametersLayout->addWidget( TextLabelOrientation, 0, 0 );
-  
+  GroupParameters->layout()->setSpacing(0);
+  GroupParameters->layout()->setMargin(0);
+  QGridLayout* GroupParametersLayout = new QGridLayout (GroupParameters->layout());
+  GroupParametersLayout->setAlignment(Qt::AlignTop);
+  GroupParametersLayout->setSpacing(6);
+  GroupParametersLayout->setMargin(11);
+
+  TextLabelOrientation = new QLabel(GroupParameters, "TextLabelOrientation");
+  TextLabelOrientation->setText(tr("SMESH_ORIENTATION"));
+  GroupParametersLayout->addWidget(TextLabelOrientation, 0, 0);
+
   ComboBoxOrientation = new QComboBox(GroupParameters, "ComboBoxOrientation");
-  GroupParametersLayout->addWidget( ComboBoxOrientation, 0, 1 );
-  
-  TextLabelDistance = new QLabel( GroupParameters, "TextLabelDistance" );
-  TextLabelDistance->setText( tr("SMESH_DISTANCE") );
-  GroupParametersLayout->addWidget( TextLabelDistance, 1, 0 );
-
-  SpinBoxDistance = new SMESHGUI_SpinBox( GroupParameters, "SpinBoxDistance" );
-  GroupParametersLayout->addWidget( SpinBoxDistance, 1, 1 );
-
-  TextLabelRot1 = new QLabel( GroupParameters, "TextLabelRot1" );
-  TextLabelRot1->setText( tr("Rotation around X (Y to Z):") );
-  GroupParametersLayout->addWidget( TextLabelRot1, 2, 0 );
-
-  SpinBoxRot1 = new SMESHGUI_SpinBox( GroupParameters, "SpinBoxRot1" );
-  GroupParametersLayout->addWidget( SpinBoxRot1, 2, 1 );
-  TextLabelRot2 = new QLabel( GroupParameters, "TextLabelRot2" );
-  TextLabelRot2->setText( tr("Rotation around Y (X to Z):") );
-  GroupParametersLayout->addWidget( TextLabelRot2, 3, 0 );
-  
-  SpinBoxRot2 = new SMESHGUI_SpinBox( GroupParameters, "SpinBoxRot2" );
-  GroupParametersLayout->addWidget( SpinBoxRot2, 3, 1 );
+  GroupParametersLayout->addWidget(ComboBoxOrientation, 0, 1);
+
+  TextLabelDistance = new QLabel(GroupParameters, "TextLabelDistance");
+  TextLabelDistance->setText(tr("SMESH_DISTANCE"));
+  GroupParametersLayout->addWidget(TextLabelDistance, 1, 0);
+
+  SpinBoxDistance = new SMESHGUI_SpinBox(GroupParameters, "SpinBoxDistance");
+  GroupParametersLayout->addWidget(SpinBoxDistance, 1, 1);
+
+  TextLabelRot1 = new QLabel(GroupParameters, "TextLabelRot1");
+  TextLabelRot1->setText(tr("Rotation around X (Y to Z):"));
+  GroupParametersLayout->addWidget(TextLabelRot1, 2, 0);
+
+  SpinBoxRot1 = new SMESHGUI_SpinBox(GroupParameters, "SpinBoxRot1");
+  GroupParametersLayout->addWidget(SpinBoxRot1, 2, 1);
+
+  TextLabelRot2 = new QLabel(GroupParameters, "TextLabelRot2");
+  TextLabelRot2->setText(tr("Rotation around Y (X to Z):"));
+  GroupParametersLayout->addWidget(TextLabelRot2, 3, 0);
+
+  SpinBoxRot2 = new SMESHGUI_SpinBox(GroupParameters, "SpinBoxRot2");
+  GroupParametersLayout->addWidget(SpinBoxRot2, 3, 1);
 
   PreviewCheckBox = new QCheckBox(tr("Show preview"), GroupParameters);
   PreviewCheckBox->setChecked(true);
-  GroupParametersLayout->addWidget( PreviewCheckBox, 4, 0 );
+  GroupParametersLayout->addWidget(PreviewCheckBox, 4, 0);
 
   AutoApplyCheckBox = new QCheckBox(tr("Auto Apply"), GroupParameters);
   AutoApplyCheckBox->setChecked(false);
-  GroupParametersLayout->addWidget( AutoApplyCheckBox, 4, 1 );
-   
+  GroupParametersLayout->addWidget(AutoApplyCheckBox, 4, 1);
+
   // Controls for "Ok", "Apply" and "Close" button
-  QGroupBox* GroupButtons = new QGroupBox( this, "GroupButtons" );
-  GroupButtons->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, GroupButtons->sizePolicy().hasHeightForWidth() ) );
-  GroupButtons->setGeometry( QRect( 10, 10, 281, 48 ) ); 
-  GroupButtons->setTitle( tr( ""  ) );
-  GroupButtons->setColumnLayout(0, Qt::Vertical );
-  GroupButtons->layout()->setSpacing( 0 );
-  GroupButtons->layout()->setMargin( 0 );
-  QGridLayout* GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
-  GroupButtonsLayout->setAlignment( Qt::AlignTop );
-  GroupButtonsLayout->setSpacing( 6 );
-  GroupButtonsLayout->setMargin( 11 );
-  buttonCancel = new QPushButton( GroupButtons, "buttonCancel" );
-  buttonCancel->setText( tr( "SMESH_BUT_CLOSE"  ) );
-  buttonCancel->setAutoDefault( TRUE );
-  GroupButtonsLayout->addWidget( buttonCancel, 0, 3 );
-  buttonApply = new QPushButton( GroupButtons, "buttonApply" );
-  buttonApply->setText( tr( "SMESH_BUT_APPLY"  ) );
-  buttonApply->setAutoDefault( TRUE );
-  GroupButtonsLayout->addWidget( buttonApply, 0, 1 );
-  QSpacerItem* spacer_9 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
-  GroupButtonsLayout->addItem( spacer_9, 0, 2 );
-  buttonOk = new QPushButton( GroupButtons, "buttonOk" );
-  buttonOk->setText( tr( "SMESH_BUT_OK"  ) );
-  buttonOk->setAutoDefault( TRUE );
-  buttonOk->setDefault( TRUE );
-  GroupButtonsLayout->addWidget( buttonOk, 0, 0 );
-
-  SMESHGUI_ClippingDlgLayout->addWidget( GroupPlanes,      0, 0 );
-  SMESHGUI_ClippingDlgLayout->addWidget( GroupParameters,  1, 0 );
-  SMESHGUI_ClippingDlgLayout->addWidget( GroupButtons,     2, 0 );
-  
-  mySelection = SALOME_Selection::Selection( SMESHGUI::GetSMESHGUI()->GetActiveStudy()->getSelection());
+  QGroupBox* GroupButtons = new QGroupBox(this, "GroupButtons");
+  GroupButtons->setSizePolicy(QSizePolicy((QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, GroupButtons->sizePolicy().hasHeightForWidth()));
+  GroupButtons->setGeometry(QRect(10, 10, 281, 48));
+  GroupButtons->setTitle(tr("" ));
+  GroupButtons->setColumnLayout(0, Qt::Vertical);
+  GroupButtons->layout()->setSpacing(0);
+  GroupButtons->layout()->setMargin(0);
+  QGridLayout* GroupButtonsLayout = new QGridLayout(GroupButtons->layout());
+  GroupButtonsLayout->setAlignment(Qt::AlignTop);
+  GroupButtonsLayout->setSpacing(6);
+  GroupButtonsLayout->setMargin(11);
+  buttonCancel = new QPushButton(GroupButtons, "buttonCancel");
+  buttonCancel->setText(tr("SMESH_BUT_CLOSE" ));
+  buttonCancel->setAutoDefault(TRUE);
+  GroupButtonsLayout->addWidget(buttonCancel, 0, 3);
+  buttonApply = new QPushButton(GroupButtons, "buttonApply");
+  buttonApply->setText(tr("SMESH_BUT_APPLY" ));
+  buttonApply->setAutoDefault(TRUE);
+  GroupButtonsLayout->addWidget(buttonApply, 0, 1);
+  QSpacerItem* spacer_9 = new QSpacerItem(20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
+  GroupButtonsLayout->addItem(spacer_9, 0, 2);
+  buttonOk = new QPushButton(GroupButtons, "buttonOk");
+  buttonOk->setText(tr("SMESH_BUT_OK" ));
+  buttonOk->setAutoDefault(TRUE);
+  buttonOk->setDefault(TRUE);
+  GroupButtonsLayout->addWidget(buttonOk, 0, 0);
+
+  SMESHGUI_ClippingDlgLayout->addWidget(GroupPlanes,      0, 0);
+  SMESHGUI_ClippingDlgLayout->addWidget(GroupParameters,  1, 0);
+  SMESHGUI_ClippingDlgLayout->addWidget(GroupButtons,     2, 0);
 
   // Initial state
-  SpinBoxDistance->RangeStepAndValidator( 0.0, 1.0, 0.01, 3 );
-  SpinBoxRot1->RangeStepAndValidator( -180.0, 180.0, 1, 3 );
-  SpinBoxRot2->RangeStepAndValidator( -180.0, 180.0, 1, 3 );
+  SpinBoxDistance->RangeStepAndValidator(0.0, 1.0, 0.01, 3);
+  SpinBoxRot1->RangeStepAndValidator(-180.0, 180.0, 1, 3);
+  SpinBoxRot2->RangeStepAndValidator(-180.0, 180.0, 1, 3);
 
-  ComboBoxOrientation->insertItem( tr("|| X-Y") );
-  ComboBoxOrientation->insertItem( tr("|| Y-Z") );
-  ComboBoxOrientation->insertItem( tr("|| Z-X") );
+  ComboBoxOrientation->insertItem(tr("|| X-Y"));
+  ComboBoxOrientation->insertItem(tr("|| Y-Z"));
+  ComboBoxOrientation->insertItem(tr("|| Z-X"));
 
   SpinBoxDistance->SetValue(0.5);
 
   myActor = 0;
   myIsSelectPlane = false;
   onSelectionChanged();
-  
+
   // signals and slots connections :
-  connect( ComboBoxPlanes, SIGNAL( activated( int )), this, SLOT( onSelectPlane( int ) ) );
-  connect( buttonNew, SIGNAL( clicked() ), this, SLOT( ClickOnNew() ) );
-  connect( buttonDelete, SIGNAL( clicked() ), this, SLOT( ClickOnDelete() ) );
-  connect( ComboBoxOrientation, SIGNAL( activated( int )), this, SLOT( onSelectOrientation( int ) ) );
-  connect( SpinBoxDistance, SIGNAL( valueChanged( double )), this, SLOT( SetCurrentPlaneParam() ) );
-  connect( SpinBoxRot1, SIGNAL( valueChanged( double )), this, SLOT( SetCurrentPlaneParam() ) );
-  connect( SpinBoxRot2, SIGNAL( valueChanged( double )), this, SLOT( SetCurrentPlaneParam() ) );
-  connect( PreviewCheckBox, SIGNAL( toggled( bool )), this, SLOT( OnPreviewToggle( bool ) ) );
-  connect( AutoApplyCheckBox, SIGNAL( toggled( bool )), this, SLOT( ClickOnApply() ) );
-  connect( buttonOk, SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
-  connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ) ;
-  connect( buttonApply, SIGNAL( clicked() ), this, SLOT(ClickOnApply() ) );
-  connect( SMESHGUI::GetSMESHGUI(), SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( ClickOnOk() ) ) ;
-  connect( mySelection,  SIGNAL( currentSelectionChanged() ), this, SLOT( onSelectionChanged() ) );
+  connect(ComboBoxPlanes, SIGNAL(activated(int)), this, SLOT(onSelectPlane(int)));
+  connect(buttonNew, SIGNAL(clicked()), this, SLOT(ClickOnNew()));
+  connect(buttonDelete, SIGNAL(clicked()), this, SLOT(ClickOnDelete()));
+  connect(ComboBoxOrientation, SIGNAL(activated(int)), this, SLOT(onSelectOrientation(int)));
+  connect(SpinBoxDistance, SIGNAL(valueChanged(double)), this, SLOT(SetCurrentPlaneParam()));
+  connect(SpinBoxRot1, SIGNAL(valueChanged(double)), this, SLOT(SetCurrentPlaneParam()));
+  connect(SpinBoxRot2, SIGNAL(valueChanged(double)), this, SLOT(SetCurrentPlaneParam()));
+  connect(PreviewCheckBox, SIGNAL(toggled(bool)), this, SLOT(OnPreviewToggle(bool)));
+  connect(AutoApplyCheckBox, SIGNAL(toggled(bool)), this, SLOT(ClickOnApply()));
+  connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk()));
+  connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel()));
+  connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply()));
+  connect(mySMESHGUI, SIGNAL (SignalCloseAllDialogs()), this, SLOT(ClickOnOk()));
+  connect(mySelectionMgr,  SIGNAL(currentSelectionChanged()), this, SLOT(onSelectionChanged()));
   /* to close dialog if study frame change */
-  connect( SMESHGUI::GetSMESHGUI(), SIGNAL ( SignalStudyFrameChanged() ),  this, SLOT( ClickOnCancel() ) ) ;
-  
+  connect(mySMESHGUI, SIGNAL (SignalStudyFrameChanged()), this, SLOT(ClickOnCancel()));
+
   /* Move widget on the botton right corner of main widget */
-  int x, y ;
-  SMESHGUI::GetSMESHGUI()->DefineDlgPosition( this, x, y ) ;
-  this->move( x, y ) ;
+  int x, y;
+  mySMESHGUI->DefineDlgPosition(this, x, y);
+  this->move(x, y);
   this->show();
 }
 
-
 //=================================================================================
 // function : ~SMESHGUI_ClippingDlg()
 // purpose  :
@@ -379,44 +380,45 @@ SMESHGUI_ClippingDlg::~SMESHGUI_ClippingDlg()
 {
   // no need to delete child widgets, Qt does it all for us
   std::for_each(myPlanes.begin(),myPlanes.end(),TSetVisiblity(false));
-  SMESH::RenderViewFrame(SMESH::GetCurrentVtkView());
+  SMESH::RenderViewWindow(SMESH::GetViewWindow(mySMESHGUI));
 }
 
-
+//=======================================================================
+// function : ClickOnApply()
+// purpose  :
+//=======================================================================
 void SMESHGUI_ClippingDlg::ClickOnApply()
 {
   if (!myActor)
     return;
 
-  if ( SMESHGUI::GetSMESHGUI()->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_VTK ) {
-    QAD_WaitCursor wc;
-    
+  if (SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow(mySMESHGUI)) {
+    SUIT_OverrideCursor wc;
+
     myActor->RemoveAllClippingPlanes();
 
     SMESH::TPlanes::iterator anIter = myPlanes.begin();
-    for (;anIter != myPlanes.end();anIter++){
-      OrientedPlane* anOrientedPlane = OrientedPlane::New();
+    for (; anIter != myPlanes.end(); anIter++) {
+      OrientedPlane* anOrientedPlane = OrientedPlane::New(aViewWindow);
       anOrientedPlane->ShallowCopy(anIter->GetPointer());
       myActor->AddClippingPlane(anOrientedPlane);
       anOrientedPlane->Delete();
     }
 
-    SMESH::RenderViewFrame(SMESH::GetCurrentVtkView());
+    SMESH::RenderViewWindow(aViewWindow);
   }
 }
 
-
 //=======================================================================
 // function : ClickOnOk()
 // purpose  :
 //=======================================================================
 void SMESHGUI_ClippingDlg::ClickOnOk()
 {
-  ClickOnApply() ;
-  ClickOnCancel() ;
+  ClickOnApply();
+  ClickOnCancel();
 }
 
-
 //=======================================================================
 // function : ClickOnCancel()
 // purpose  :
@@ -426,26 +428,26 @@ void SMESHGUI_ClippingDlg::ClickOnCancel()
   close();
 }
 
-
 //=================================================================================
 // function : onSelectionChanged()
 // purpose  : Called when selection is changed
 //=================================================================================
 void SMESHGUI_ClippingDlg::onSelectionChanged()
 {
-  if ( SMESHGUI::GetSMESHGUI()->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_VTK ) {
-    if ( mySelection->IObjectCount() ) {
-      Handle(SALOME_InteractiveObject) IOS = mySelection->firstIObject();
+  if (SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow(mySMESHGUI)) {
+    const SALOME_ListIO& aList = mySelector->StoredIObjects();
+    if (aList.Extent() > 0) {
+      Handle(SALOME_InteractiveObject) IOS = aList.First();
       myActor = SMESH::FindActorByEntry(IOS->getEntry());
-      if ( myActor ){
+      if (myActor) {
        std::for_each(myPlanes.begin(),myPlanes.end(),TSetVisiblity(false));
        myPlanes.clear();
 
        vtkIdType anId = 0, anEnd = myActor->GetNumberOfClippingPlanes();
-       for(; anId < anEnd; anId++){
-         if(vtkImplicitFunction* aFunction = myActor->GetClippingPlane(anId)){
+       for (; anId < anEnd; anId++) {
+         if (vtkImplicitFunction* aFunction = myActor->GetClippingPlane(anId)) {
            if(OrientedPlane* aPlane = OrientedPlane::SafeDownCast(aFunction)){
-             OrientedPlane* anOrientedPlane = OrientedPlane::New(SMESH::GetActiveStudy());
+             OrientedPlane* anOrientedPlane = OrientedPlane::New(aViewWindow);
              SMESH::TVTKPlane aTVTKPlane(anOrientedPlane);
              anOrientedPlane->Delete();
              aTVTKPlane->ShallowCopy(aPlane);
@@ -458,26 +460,25 @@ void SMESHGUI_ClippingDlg::onSelectionChanged()
                      TSetVisiblity(PreviewCheckBox->isChecked()));
       }
     }
+    SMESH::RenderViewWindow(aViewWindow);
   }
   Sinchronize();
-  SMESH::RenderViewFrame(SMESH::GetCurrentVtkView());
 }
 
-
 //=======================================================================
 // function : onSelectPlane()
 // purpose  :
 //=======================================================================
-void SMESHGUI_ClippingDlg::onSelectPlane(int theIndex)
-{  
+void SMESHGUI_ClippingDlg::onSelectPlane (int theIndex)
+{
   if (!myActor || myPlanes.empty())
     return;
-  
+
   OrientedPlane* aPlane = myPlanes[theIndex].GetPointer();
-  
+
   // Orientation
   SMESH::Orientation anOrientation = aPlane->GetOrientation();
-  
+
   // Rotations
   double aRot[2] = {aPlane->myAngle[0], aPlane->myAngle[1]};
 
@@ -486,15 +487,15 @@ void SMESHGUI_ClippingDlg::onSelectPlane(int theIndex)
   setDistance(aPlane->GetDistance());
   setRotation(aRot[0], aRot[1]);
   switch (anOrientation) {
-  case SMESH::XY: 
+  case SMESH::XY:
     ComboBoxOrientation->setCurrentItem(0);
     onSelectOrientation(0);
     break;
-  case SMESH::YZ: 
+  case SMESH::YZ:
     ComboBoxOrientation->setCurrentItem(1);
     onSelectOrientation(1);
     break;
-  case SMESH::ZX: 
+  case SMESH::ZX:
     ComboBoxOrientation->setCurrentItem(2);
     onSelectOrientation(2);
     break;
@@ -502,7 +503,6 @@ void SMESHGUI_ClippingDlg::onSelectPlane(int theIndex)
   myIsSelectPlane = false;
 }
 
-
 //=======================================================================
 // function : ClickOnNew()
 // purpose  :
@@ -511,19 +511,20 @@ void SMESHGUI_ClippingDlg::ClickOnNew()
 {
   if (!myActor)
     return;
-  
-  OrientedPlane* aPlane = OrientedPlane::New(SMESH::GetActiveStudy());
-  SMESH::TVTKPlane aTVTKPlane(aPlane);
-  myPlanes.push_back(aTVTKPlane);
 
-  if(PreviewCheckBox->isChecked())
-    aTVTKPlane->myActor->VisibilityOn();
+  if(SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow(mySMESHGUI)){
+    OrientedPlane* aPlane = OrientedPlane::New(aViewWindow);
+    SMESH::TVTKPlane aTVTKPlane(aPlane);
+    myPlanes.push_back(aTVTKPlane);
 
-  Sinchronize();
-  SetCurrentPlaneParam();
+    if (PreviewCheckBox->isChecked())
+      aTVTKPlane->myActor->VisibilityOn();
+    
+    Sinchronize();
+    SetCurrentPlaneParam();
+  }
 }
 
-
 //=======================================================================
 // function : ClickOnDelete()
 // purpose  :
@@ -532,48 +533,46 @@ void SMESHGUI_ClippingDlg::ClickOnDelete()
 {
   if (!myActor || myPlanes.empty())
     return;
-  
+
   int aPlaneIndex = ComboBoxPlanes->currentItem();
-  
+
   SMESH::TPlanes::iterator anIter = myPlanes.begin() + aPlaneIndex;
   anIter->GetPointer()->myActor->SetVisibility(false);
   myPlanes.erase(anIter);
-  
+
   if(AutoApplyCheckBox->isChecked())
     ClickOnApply();
 
   Sinchronize();
-  SMESH::RenderViewFrame(SMESH::GetCurrentVtkView());
+  SMESH::RenderViewWindow(SMESH::GetCurrentVtkView());
 }
 
-
 //=======================================================================
 // function : onSelectOrientation()
 // purpose  :
 //=======================================================================
-void SMESHGUI_ClippingDlg::onSelectOrientation(int theItem)
+void SMESHGUI_ClippingDlg::onSelectOrientation (int theItem)
 {
   if (myPlanes.empty())
     return;
-  
+
   if      (theItem == 0) {
-    TextLabelRot1->setText( tr( "Rotation around X (Y to Z):") );
-    TextLabelRot2->setText( tr( "Rotation around Y (X to Z):" ) );
+    TextLabelRot1->setText(tr("Rotation around X (Y to Z):"));
+    TextLabelRot2->setText(tr("Rotation around Y (X to Z):"));
   }
   else if (theItem == 1) {
-    TextLabelRot1->setText( tr( "Rotation around Y (Z to X):" ) );
-    TextLabelRot2->setText( tr( "Rotation around Z (Y to X):" ) );
+    TextLabelRot1->setText(tr("Rotation around Y (Z to X):"));
+    TextLabelRot2->setText(tr("Rotation around Z (Y to X):"));
   }
   else if (theItem == 2) {
-    TextLabelRot1->setText( tr( "Rotation around Z (X to Y):" ) );
-    TextLabelRot2->setText( tr( "Rotation around X (Z to Y):" ) );
+    TextLabelRot1->setText(tr("Rotation around Z (X to Y):"));
+    TextLabelRot2->setText(tr("Rotation around X (Z to Y):"));
   }
-  
+
   if((QComboBox*)sender() == ComboBoxOrientation)
     SetCurrentPlaneParam();
 }
 
-
 //=======================================================================
 // function : Sinchronize()
 // purpose  :
@@ -582,21 +581,21 @@ void SMESHGUI_ClippingDlg::Sinchronize()
 {
   int aNbPlanes = myPlanes.size();
   ComboBoxPlanes->clear();
-  
+
   QString aName;
-  for(int i = 1; i<=aNbPlanes ; i++){
+  for(int i = 1; i<=aNbPlanes; i++) {
     aName = QString(tr("Plane# %1")).arg(i);
     ComboBoxPlanes->insertItem(aName);
   }
-  
+
   int aPos = ComboBoxPlanes->count() - 1;
   ComboBoxPlanes->setCurrentItem(aPos);
-  
+
   bool anIsControlsEnable = (aPos >= 0);
-  if(anIsControlsEnable){
+  if (anIsControlsEnable) {
     onSelectPlane(aPos);
-  }else{
-    ComboBoxPlanes->insertItem( tr("No planes") );
+  } else {
+    ComboBoxPlanes->insertItem(tr("No planes"));
     SpinBoxRot1->SetValue(0.0);
     SpinBoxRot2->SetValue(0.0);
     SpinBoxDistance->SetValue(0.5);
@@ -612,37 +611,33 @@ void SMESHGUI_ClippingDlg::Sinchronize()
   SpinBoxRot2->setEnabled(anIsControlsEnable);
 }
 
-
 //=======================================================================
 // function : setRotation()
 // purpose  :
 //=======================================================================
-void SMESHGUI_ClippingDlg::setRotation( const double theRot1, const double theRot2 )
+void SMESHGUI_ClippingDlg::setRotation (const double theRot1, const double theRot2)
 {
   SpinBoxRot1->SetValue(theRot1);
   SpinBoxRot2->SetValue(theRot2);
 }
 
-
 //=======================================================================
-// function : SetCurrentPlaneParam
+// function : SetCurrentPlaneParam()
 // purpose  :
 //=======================================================================
-void
-SMESHGUI_ClippingDlg::
-SetCurrentPlaneParam()
+void SMESHGUI_ClippingDlg::SetCurrentPlaneParam()
 {
-  if(myPlanes.empty() || myIsSelectPlane)
+  if (myPlanes.empty() || myIsSelectPlane)
     return;
-  
+
   int aCurPlaneIndex = ComboBoxPlanes->currentItem();
-  
+
   OrientedPlane* aPlane = myPlanes[aCurPlaneIndex].GetPointer();
-  
+
   float aNormal[3];
   SMESH::Orientation anOrientation;
   float aDir[3][3] = {{0, 0, 0}, {0, 0, 0}};
-  {  
+  {
     static double aCoeff = vtkMath::Pi()/180.0;
 
     float aRot[2] = {getRotation1(), getRotation2()};
@@ -653,10 +648,10 @@ SetCurrentPlaneParam()
     float aV[2] = {sqrt(1.0-anU[0]*anU[0]), sqrt(1.0-anU[1]*anU[1])};
     aV[0] = aRot[0] > 0? aV[0]: -aV[0];
     aV[1] = aRot[1] > 0? aV[1]: -aV[1];
-                   
+
     switch (ComboBoxOrientation->currentItem()) {
-    case 0: 
-      anOrientation = SMESH::XY; 
+    case 0:
+      anOrientation = SMESH::XY;
 
       aDir[0][1] = anU[0];
       aDir[0][2] = aV[0];
@@ -665,8 +660,8 @@ SetCurrentPlaneParam()
       aDir[1][2] = aV[1];
 
       break;
-    case 1: 
-      anOrientation = SMESH::YZ; 
+    case 1:
+      anOrientation = SMESH::YZ;
 
       aDir[0][2] = anU[0];
       aDir[0][0] = aV[0];
@@ -675,8 +670,8 @@ SetCurrentPlaneParam()
       aDir[1][0] = aV[1];
 
       break;
-    case 2: 
-      anOrientation = SMESH::ZX; 
+    case 2:
+      anOrientation = SMESH::ZX;
 
       aDir[0][0] = anU[0];
       aDir[0][1] = aV[0];
@@ -691,10 +686,10 @@ SetCurrentPlaneParam()
     vtkMath::Normalize(aNormal);
     vtkMath::Cross(aNormal,aDir[1],aDir[0]);
   }
-  
+
   aPlane->SetOrientation(anOrientation);
   aPlane->SetDistance(getDistance());
-  
+
   myActor->SetPlaneParam(aNormal, getDistance(), aPlane);
 
   vtkDataSet* aDataSet = myActor->GetInput();
@@ -707,44 +702,48 @@ SetCurrentPlaneParam()
                        {aDir[1][0]*aDel, aDir[1][1]*aDel, aDir[1][2]*aDel}};
   float aParam, aPnt0[3], aPnt1[3], aPnt2[3];
 
-  float aPnt01[3] = {aPnt[0] - aDelta[0][0] - aDelta[1][0], 
-                    aPnt[1] - aDelta[0][1] - aDelta[1][1], 
+  float aPnt01[3] = {aPnt[0] - aDelta[0][0] - aDelta[1][0],
+                    aPnt[1] - aDelta[0][1] - aDelta[1][1],
                     aPnt[2] - aDelta[0][2] - aDelta[1][2]};
-  float aPnt02[3] = {aPnt01[0] + aNormal[0], 
-                     aPnt01[1] + aNormal[1], 
+  float aPnt02[3] = {aPnt01[0] + aNormal[0],
+                     aPnt01[1] + aNormal[1],
                      aPnt01[2] + aNormal[2]};
   vtkPlane::IntersectWithLine(aPnt01,aPnt02,aNormal,anOrigin,aParam,aPnt0);
 
-  float aPnt11[3] = {aPnt[0] - aDelta[0][0] + aDelta[1][0], 
-                    aPnt[1] - aDelta[0][1] + aDelta[1][1], 
+  float aPnt11[3] = {aPnt[0] - aDelta[0][0] + aDelta[1][0],
+                    aPnt[1] - aDelta[0][1] + aDelta[1][1],
                     aPnt[2] - aDelta[0][2] + aDelta[1][2]};
-  float aPnt12[3] = {aPnt11[0] + aNormal[0], 
-                    aPnt11[1] + aNormal[1], 
+  float aPnt12[3] = {aPnt11[0] + aNormal[0],
+                    aPnt11[1] + aNormal[1],
                     aPnt11[2] + aNormal[2]};
   vtkPlane::IntersectWithLine(aPnt11,aPnt12,aNormal,anOrigin,aParam,aPnt1);
-  
-  float aPnt21[3] = {aPnt[0] + aDelta[0][0] - aDelta[1][0], 
-                    aPnt[1] + aDelta[0][1] - aDelta[1][1], 
+
+  float aPnt21[3] = {aPnt[0] + aDelta[0][0] - aDelta[1][0],
+                    aPnt[1] + aDelta[0][1] - aDelta[1][1],
                     aPnt[2] + aDelta[0][2] - aDelta[1][2]};
-  float aPnt22[3] = {aPnt21[0] + aNormal[0], 
-                    aPnt21[1] + aNormal[1], 
+  float aPnt22[3] = {aPnt21[0] + aNormal[0],
+                    aPnt21[1] + aNormal[1],
                     aPnt21[2] + aNormal[2]};
   vtkPlane::IntersectWithLine(aPnt21,aPnt22,aNormal,anOrigin,aParam,aPnt2);
-  
+
   vtkPlaneSource* aPlaneSource = aPlane->myPlaneSource;
   aPlaneSource->SetNormal(aNormal[0],aNormal[1],aNormal[2]);
   aPlaneSource->SetOrigin(aPnt0[0],aPnt0[1],aPnt0[2]);
   aPlaneSource->SetPoint1(aPnt1[0],aPnt1[1],aPnt1[2]);
   aPlaneSource->SetPoint2(aPnt2[0],aPnt2[1],aPnt2[2]);
-  
+
   if(AutoApplyCheckBox->isChecked())
     ClickOnApply();
-  
-  SMESH::RenderViewFrame(SMESH::GetCurrentVtkView());
-}
 
+  SMESH::RenderViewWindow(SMESH::GetCurrentVtkView());
+}
 
-void SMESHGUI_ClippingDlg::OnPreviewToggle(bool theIsToggled){
+//=======================================================================
+// function : OnPreviewToggle()
+// purpose  :
+//=======================================================================
+void SMESHGUI_ClippingDlg::OnPreviewToggle (bool theIsToggled)
+{
   std::for_each(myPlanes.begin(),myPlanes.end(),TSetVisiblity(theIsToggled));
-  SMESH::RenderViewFrame(SMESH::GetCurrentVtkView());
+  SMESH::RenderViewWindow(SMESH::GetCurrentVtkView());
 }
index 6a2bb493ffffec99751f753d70a0dd25b7a545dd..28872443402c3745bdc63155a2bf030bd13c74a1 100644 (file)
@@ -45,18 +45,22 @@ class QPushButton;
 class QTable;
 class QCheckBox;
 class QComboBox;
-class SALOME_Selection;
+
+class SalomeApp_SelectionMgr;
+class SVTK_Selector;
+
+class SMESHGUI;
 class SMESH_Actor;
 
 class OrientedPlane;
 
 
-namespace SMESH{
-  
+namespace SMESH {
+
   typedef vtkSmartPointer<OrientedPlane> TVTKPlane;
   typedef std::vector<TVTKPlane> TPlanes;
   enum Orientation {XY, YZ, ZX};
-  
+
 };
 
 
@@ -65,30 +69,32 @@ namespace SMESH{
 // purpose  :
 //=================================================================================
 class SMESHGUI_ClippingDlg : public QDialog
-{ 
+{
     Q_OBJECT
 
 public:
-    SMESHGUI_ClippingDlg( QWidget* parent = 0,
+    SMESHGUI_ClippingDlg (SMESHGUI* theModule,
                          const char* name = 0,
                          bool modal = false,
-                         WFlags fl = 0 );
-
-    float  getDistance()  {return  (float)SpinBoxDistance->GetValue();}
-    void   setDistance( const float theDistance) {SpinBoxDistance->SetValue(theDistance);}
-    double getRotation1() {return SpinBoxRot1->GetValue();}
-    double getRotation2() {return SpinBoxRot2->GetValue();}
-    void   setRotation( const double theRot1, const double theRot2 );
-    void Sinchronize();
-    
+                         WFlags fl = 0);
+
+    float  getDistance()  { return  (float)SpinBoxDistance->GetValue(); }
+    void   setDistance (const float theDistance) { SpinBoxDistance->SetValue(theDistance); }
+    double getRotation1() { return SpinBoxRot1->GetValue(); }
+    double getRotation2() { return SpinBoxRot2->GetValue(); }
+    void   setRotation (const double theRot1, const double theRot2);
+    void   Sinchronize();
+
     ~SMESHGUI_ClippingDlg();
 
 private:
 
-    SALOME_Selection* mySelection;
-    SMESH_Actor*      myActor;
-    SMESH::TPlanes    myPlanes;
-    
+    SalomeApp_SelectionMgr* mySelectionMgr;
+    SVTK_Selector*          mySelector;
+    SMESHGUI*               mySMESHGUI;
+    SMESH_Actor*            myActor;
+    SMESH::TPlanes          myPlanes;
+
     QComboBox*        ComboBoxPlanes;
     QPushButton*      buttonNew;
     QPushButton*      buttonDelete;
@@ -107,20 +113,19 @@ private:
     QPushButton*      buttonApply;
 
     bool myIsSelectPlane;
-    
+
 public slots:
-    
-    void onSelectPlane(int theIndex);
+
+    void onSelectPlane (int theIndex);
     void ClickOnNew();
     void ClickOnDelete();
-    void onSelectOrientation(int theItem);
+    void onSelectOrientation (int theItem);
     void SetCurrentPlaneParam();
     void onSelectionChanged();
-    void OnPreviewToggle(bool theIsToggled);
+    void OnPreviewToggle (bool theIsToggled);
     void ClickOnOk();
     void ClickOnCancel();
     void ClickOnApply();
 };
 
 #endif // DIALOGBOX_TRANSPARENCYDLG_H
-
index 19d6b90fa9686a0f3c85ca7a7f7c6e25912cc3dd..5e3e4b090218e6eae58a8fbf50876f3f7b547271 100644 (file)
@@ -1,21 +1,21 @@
 //  SMESH SMESHGUI : GUI for SMESH component
 //
 //  Copyright (C) 2003  CEA
-// 
-//  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 
-// 
+//
+//  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.org
 //
 //
 //  Module : SMESH
 //  $Header$
 
-// QT Includes
-#include <qbuttongroup.h>
-#include <qgroupbox.h>
-#include <qpushbutton.h>
-#include <qlayout.h>
-#include <qlistview.h>
-#include <qheader.h>
-
-#include "QAD_Application.h"
-#include "QAD_Desktop.h"
-
-#include "SALOME_ListIteratorOfListIO.hxx"
-
 #include "SMESHGUI_CreateHypothesesDlg.h"
+
 #include "SMESHGUI_HypothesesUtils.h"
 #include "SMESHGUI_Hypotheses.h"
 #include "SMESHGUI_Utils.h"
 #include "SMESHGUI.h"
 
+#include "SUIT_Desktop.h"
+#include "SUIT_ResourceMgr.h"
+
+#include "SALOME_ListIteratorOfListIO.hxx"
+
 #include "utilities.h"
 
+// QT Includes
+#include <qbuttongroup.h>
+#include <qgroupbox.h>
+#include <qpushbutton.h>
+#include <qlayout.h>
+#include <qlistview.h>
+#include <qheader.h>
+
 using namespace std;
 
 //=================================================================================
-// class    : SMESHGUI_CreateHypothesesDlg()
-// purpose  : Constructs a SMESHGUI_CreateHypothesesDlg which is a child of 'parent', with the 
+// function : SMESHGUI_CreateHypothesesDlg()
+// purpose  : Constructs a SMESHGUI_CreateHypothesesDlg which is a child of 'parent', with the
 //            name 'name' and widget flags set to 'f'.
 //            The dialog will by default be modeless, unless you set 'modal' to
 //            TRUE to construct a modal dialog.
 //=================================================================================
-SMESHGUI_CreateHypothesesDlg::SMESHGUI_CreateHypothesesDlg (QWidget* parent,
+SMESHGUI_CreateHypothesesDlg::SMESHGUI_CreateHypothesesDlg (SMESHGUI* theModule,
                                                             const char* name,
                                                             bool modal,
                                                             bool isAlgo)
-     : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | WDestructiveClose ),
-       myIsAlgo( isAlgo )
+     : QDialog( SMESH::GetDesktop( theModule ), name, modal, WStyle_Customize | WStyle_NormalBorder |
+               WStyle_Title | WStyle_SysMenu | WDestructiveClose),
+       myIsAlgo(isAlgo),
+       mySMESHGUI( theModule )
 {
-  MESSAGE("SMESHGUI_CreateHypothesesDlg");
-
-  if ( !name )
-    setName( "SMESHGUI_CreateHypothesesDlg" );
-  setCaption( isAlgo ? tr( "SMESH_CREATE_ALGORITHMS"  ) : tr( "SMESH_CREATE_HYPOTHESES"  ) );
-  setSizeGripEnabled( TRUE );
+  if (!name)
+    setName("SMESHGUI_CreateHypothesesDlg");
+  setCaption(isAlgo ? tr("SMESH_CREATE_ALGORITHMS" ) : tr("SMESH_CREATE_HYPOTHESES" ));
+  setSizeGripEnabled(TRUE);
 
-  QGridLayout* SMESHGUI_CreateHypothesesDlgLayout = new QGridLayout( this ); 
-  SMESHGUI_CreateHypothesesDlgLayout->setSpacing( 6 );
-  SMESHGUI_CreateHypothesesDlgLayout->setMargin( 11 );
+  QGridLayout* SMESHGUI_CreateHypothesesDlgLayout = new QGridLayout(this);
+  SMESHGUI_CreateHypothesesDlgLayout->setSpacing(6);
+  SMESHGUI_CreateHypothesesDlgLayout->setMargin(11);
 
   /***************************************************************/
-  GroupAlgorithms = new QGroupBox( this, "GroupAlgorithms" );
-  GroupAlgorithms->setTitle( isAlgo ? tr("SMESH_AVAILABLE_ALGORITHMS") : tr("SMESH_AVAILABLE_HYPOTHESES") );
-  GroupAlgorithms->setColumnLayout(0, Qt::Vertical );
-  GroupAlgorithms->layout()->setSpacing( 0 );
-  GroupAlgorithms->layout()->setMargin( 0 );
-
-  QGridLayout* hypLayout = new QGridLayout( GroupAlgorithms->layout() );
-  hypLayout->setGeometry( QRect( 12, 18, 139, 250 ) ); 
-  hypLayout->setAlignment( Qt::AlignTop );
-  hypLayout->setSpacing( 6 );
-  hypLayout->setMargin( 11 );
-
-  ListAlgoDefinition = new QListView( GroupAlgorithms, "ListAlgoDefinition" );
-  ListAlgoDefinition->setMinimumSize( 400, 200 );
+  GroupAlgorithms = new QGroupBox(this, "GroupAlgorithms");
+  GroupAlgorithms->setTitle(isAlgo ? tr("SMESH_AVAILABLE_ALGORITHMS") : tr("SMESH_AVAILABLE_HYPOTHESES"));
+  GroupAlgorithms->setColumnLayout(0, Qt::Vertical);
+  GroupAlgorithms->layout()->setSpacing(0);
+  GroupAlgorithms->layout()->setMargin(0);
+
+  QGridLayout* hypLayout = new QGridLayout(GroupAlgorithms->layout());
+  hypLayout->setGeometry(QRect(12, 18, 139, 250));
+  hypLayout->setAlignment(Qt::AlignTop);
+  hypLayout->setSpacing(6);
+  hypLayout->setMargin(11);
+
+  ListAlgoDefinition = new QListView(GroupAlgorithms, "ListAlgoDefinition");
+  ListAlgoDefinition->setMinimumSize(400, 200);
   ListAlgoDefinition->addColumn("");
   ListAlgoDefinition->header()->hide();
   ListAlgoDefinition->setSelectionMode(QListView::Single);
   ListAlgoDefinition->setResizeMode(QListView::AllColumns);
-  ListAlgoDefinition->setRootIsDecorated( true );
+  ListAlgoDefinition->setRootIsDecorated(true);
 
-  hypLayout->addWidget( ListAlgoDefinition, 0, 0 );
-  SMESHGUI_CreateHypothesesDlgLayout->addWidget( GroupAlgorithms, 0, 0 );
+  hypLayout->addWidget(ListAlgoDefinition, 0, 0);
+  SMESHGUI_CreateHypothesesDlgLayout->addWidget(GroupAlgorithms, 0, 0);
 
   /***************************************************************/
-  GroupButtons = new QGroupBox( this, "GroupButtons" );
-  GroupButtons->setColumnLayout( 0, Qt::Vertical );
-  GroupButtons->layout()->setSpacing( 0 );
-  GroupButtons->layout()->setMargin( 0 );
-  QGridLayout* GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
-  GroupButtonsLayout->setAlignment( Qt::AlignTop );
-  GroupButtonsLayout->setSpacing( 6 );
-  GroupButtonsLayout->setMargin( 11 );
-
-  buttonApply = new QPushButton( GroupButtons, "buttonApply" );
-  buttonApply->setText( tr( "SMESH_BUT_CREATE"  ) );
-  buttonApply->setAutoDefault( TRUE );
-  buttonApply->setDefault( FALSE );
-  buttonApply->setEnabled( FALSE ) ;
-  GroupButtonsLayout->addWidget( buttonApply, 0, 1 );
-
-  QSpacerItem* spacer_9 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
-  GroupButtonsLayout->addItem( spacer_9, 0, 2 );
-
-  buttonCancel = new QPushButton( GroupButtons, "buttonCancel" );
-  buttonCancel->setText( tr( "SMESH_BUT_CLOSE"  ) );
-  buttonCancel->setAutoDefault( TRUE );
-  buttonCancel->setDefault( TRUE );
-  buttonCancel->setEnabled( TRUE ) ;
-  GroupButtonsLayout->addWidget( buttonCancel, 0, 3 );
-
-  SMESHGUI_CreateHypothesesDlgLayout->addWidget( GroupButtons, 1, 0 );
+  GroupButtons = new QGroupBox(this, "GroupButtons");
+  GroupButtons->setColumnLayout(0, Qt::Vertical);
+  GroupButtons->layout()->setSpacing(0);
+  GroupButtons->layout()->setMargin(0);
+  QGridLayout* GroupButtonsLayout = new QGridLayout(GroupButtons->layout());
+  GroupButtonsLayout->setAlignment(Qt::AlignTop);
+  GroupButtonsLayout->setSpacing(6);
+  GroupButtonsLayout->setMargin(11);
+
+  buttonApply = new QPushButton(GroupButtons, "buttonApply");
+  buttonApply->setText(tr("SMESH_BUT_CREATE" ));
+  buttonApply->setAutoDefault(TRUE);
+  buttonApply->setDefault(FALSE);
+  buttonApply->setEnabled(FALSE);
+  GroupButtonsLayout->addWidget(buttonApply, 0, 1);
+
+  QSpacerItem* spacer_9 = new QSpacerItem(20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
+  GroupButtonsLayout->addItem(spacer_9, 0, 2);
+
+  buttonCancel = new QPushButton(GroupButtons, "buttonCancel");
+  buttonCancel->setText(tr("SMESH_BUT_CLOSE" ));
+  buttonCancel->setAutoDefault(TRUE);
+  buttonCancel->setDefault(TRUE);
+  buttonCancel->setEnabled(TRUE);
+  GroupButtonsLayout->addWidget(buttonCancel, 0, 3);
+
+  SMESHGUI_CreateHypothesesDlgLayout->addWidget(GroupButtons, 1, 0);
   /***************************************************************/
 
   Init();
@@ -136,7 +137,7 @@ SMESHGUI_CreateHypothesesDlg::SMESHGUI_CreateHypothesesDlg (QWidget* parent,
 //=================================================================================
 SMESHGUI_CreateHypothesesDlg::~SMESHGUI_CreateHypothesesDlg()
 {
-    // no need to delete child widgets, Qt does it all for us
+  // no need to delete child widgets, Qt does it all for us
 }
 
 //=================================================================================
@@ -145,25 +146,24 @@ SMESHGUI_CreateHypothesesDlg::~SMESHGUI_CreateHypothesesDlg()
 //=================================================================================
 void SMESHGUI_CreateHypothesesDlg::Init()
 {
-  mySMESHGUI = SMESHGUI::GetSMESHGUI() ;
-  mySMESHGUI->SetActiveDialogBox( (QDialog*)this ) ;
+  mySMESHGUI->SetActiveDialogBox((QDialog*)this);
 
   InitAlgoDefinition();
 
   /* signals and slots connections */
-  connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ) ;
-  connect( buttonApply , SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) ) ;
-
-//  connect( mySMESHGUI, SIGNAL ( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ;
-  connect( mySMESHGUI, SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ) ;
-  connect( ListAlgoDefinition, SIGNAL( selectionChanged() ), this, SLOT( onSelectionChanged() ) );
-  connect( ListAlgoDefinition, SIGNAL( doubleClicked(QListViewItem*) ),    this, SLOT( onDoubleClicked(QListViewItem*) ) );
-
-  int x, y ;
-  mySMESHGUI->DefineDlgPosition( this, x, y ) ;
-  this->move( x, y ) ;
-  this->show() ; 
+  connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel()));
+  connect(buttonApply , SIGNAL(clicked()), this, SLOT(ClickOnApply()));
+
+//  connect(mySMESHGUI, SIGNAL (SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog()));
+  connect(mySMESHGUI, SIGNAL (SignalCloseAllDialogs()), this, SLOT(ClickOnCancel()));
+
+  connect(ListAlgoDefinition, SIGNAL(selectionChanged()), this, SLOT(onSelectionChanged()));
+  connect(ListAlgoDefinition, SIGNAL(doubleClicked(QListViewItem*)), this, SLOT(onDoubleClicked(QListViewItem*)));
+
+  int x, y;
+  mySMESHGUI->DefineDlgPosition(this, x, y);
+  this->move(x, y);
+  this->show();
 }
 
 //=================================================================================
@@ -172,7 +172,7 @@ void SMESHGUI_CreateHypothesesDlg::Init()
 //=================================================================================
 void SMESHGUI_CreateHypothesesDlg::ClickOnCancel()
 {
-  close() ;
+  close();
 }
 
 //=================================================================================
@@ -181,29 +181,26 @@ void SMESHGUI_CreateHypothesesDlg::ClickOnCancel()
 //=================================================================================
 void SMESHGUI_CreateHypothesesDlg::ClickOnApply()
 {
-  if (mySMESHGUI->ActiveStudyLocked())
+  if (mySMESHGUI->isActiveStudyLocked())
     return;
   QListViewItem* item = ListAlgoDefinition->selectedItem();
-  if ( !item )
+  if (!item)
     return;
-  QString aHypType = item->text( 1 );
+  QString aHypType = item->text(1);
   MESSAGE("Apply " << aHypType);
   char* sHypType = (char*)aHypType.latin1();
 
   HypothesisData* aHypData = SMESH::GetHypothesisData(sHypType);
-  if ( !aHypData ) 
+  if (!aHypData)
     return;
   QString aClientLibName = aHypData->ClientLibName;
   MESSAGE("Client lib name = " << aClientLibName);
 
-  if (aClientLibName == "")
-  {
+  if (aClientLibName == "") {
     // Call hypothesis creation server method (without GUI)
     QString aHypName = aHypData->Label;
     SMESH::CreateHypothesis(sHypType, aHypName, myIsAlgo);
-  }
-  else
-  {
+  } else {
     // Get hypotheses creator client (GUI)
     SMESHGUI_GenericHypothesisCreator* aCreator =
       SMESH::GetHypothesisCreator(sHypType);
@@ -222,29 +219,29 @@ void SMESHGUI_CreateHypothesesDlg::ClickOnApply()
 //=================================================================================
 void SMESHGUI_CreateHypothesesDlg::ActivateThisDialog()
 {
-  mySMESHGUI->EmitSignalDeactivateDialog() ;   
-  GroupButtons->setEnabled(true) ;
-  return ;
+  mySMESHGUI->EmitSignalDeactivateDialog();
+  GroupButtons->setEnabled(true);
+  return;
 }
 
 //=================================================================================
 // function : enterEvent()
 // purpose  :
 //=================================================================================
-void SMESHGUI_CreateHypothesesDlg::enterEvent(QEvent* e)
+void SMESHGUI_CreateHypothesesDlg::enterEvent (QEvent*)
 {
-  ActivateThisDialog() ;
-  return ;
+  ActivateThisDialog();
+  return;
 }
 
 //=================================================================================
 // function : closeEvent()
 // purpose  :
 //=================================================================================
-void SMESHGUI_CreateHypothesesDlg::closeEvent( QCloseEvent* e )
+void SMESHGUI_CreateHypothesesDlg::closeEvent (QCloseEvent* e)
 {
   mySMESHGUI->ResetState();
-  QDialog::closeEvent( e );
+  QDialog::closeEvent(e);
 }
 
 //=================================================================================
@@ -254,16 +251,16 @@ void SMESHGUI_CreateHypothesesDlg::closeEvent( QCloseEvent* e )
 void SMESHGUI_CreateHypothesesDlg::onSelectionChanged()
 {
   QListViewItem* item = ListAlgoDefinition->selectedItem();
-  buttonApply->setEnabled( item && item->depth() > 0 ) ;
+  buttonApply->setEnabled(item && item->depth() > 0);
 }
 
 //=================================================================================
 // function : onDoubleClicked()
 // purpose  :
 //=================================================================================
-void SMESHGUI_CreateHypothesesDlg::onDoubleClicked(QListViewItem* i)
+void SMESHGUI_CreateHypothesesDlg::onDoubleClicked (QListViewItem* i)
 {
-  if ( i && i->depth() > 0 )
+  if (i && i->depth() > 0)
     this->ClickOnApply();
 }
 
@@ -275,24 +272,23 @@ void SMESHGUI_CreateHypothesesDlg::InitAlgoDefinition()
 {
   ListAlgoDefinition->clear();
   QStringList HypList = SMESH::GetAvailableHypotheses(myIsAlgo);
-  for ( int i = 0; i < HypList.count(); ++i ) {
-    HypothesisData* aHypData = SMESH::GetHypothesisData( HypList[i] );
+  for (int i = 0; i < HypList.count(); ++i) {
+    HypothesisData* aHypData = SMESH::GetHypothesisData(HypList[i]);
     QListViewItem* parentItem = 0;
     QListViewItem* childItem = ListAlgoDefinition->firstChild();
-    while ( childItem ) {
-      if ( childItem->text(0) == aHypData->PluginName ) {
+    while (childItem) {
+      if (childItem->text(0) == aHypData->PluginName) {
        parentItem = childItem;
        break;
       }
       childItem = childItem->nextSibling();
     }
-    if ( !parentItem ) 
-      parentItem = new QListViewItem( ListAlgoDefinition, aHypData->PluginName );
-    parentItem->setOpen( true );
-    QListViewItem* aItem = new QListViewItem( parentItem, aHypData->Label, HypList[i] );
-    QPixmap aPixMap (QAD_Desktop::getResourceManager()->loadPixmap
-                     ("SMESH", tr(aHypData->IconId)));
-    if ( !aPixMap.isNull() )
-      aItem->setPixmap( 0, aPixMap );
+    if (!parentItem)
+      parentItem = new QListViewItem(ListAlgoDefinition, aHypData->PluginName);
+    parentItem->setOpen(true);
+    QListViewItem* aItem = new QListViewItem(parentItem, aHypData->Label, HypList[i]);
+    QPixmap aPixMap (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr(aHypData->IconId)));
+    if (!aPixMap.isNull())
+      aItem->setPixmap(0, aPixMap);
   }
 }
index e3ee5a9ce859067035a157c624bdedb054209ce3..e2bb65a6741ee371ec0c3353ae34e4380c1009a2 100644 (file)
@@ -57,7 +57,7 @@ class SMESHGUI_CreateHypothesesDlg : public QDialog
     Q_OBJECT
 
 public:
-    SMESHGUI_CreateHypothesesDlg (QWidget* parent = 0,
+    SMESHGUI_CreateHypothesesDlg (SMESHGUI*,
                                  const char* name = 0,
                                  bool modal = FALSE,
                                  bool isAlgo = FALSE);
index fd903bbc62b8126813ed9a5d6388b611176b0402..a7990a79ac0792e8255352bf4fbefb511e1d89dd 100755 (executable)
-//  SMESH SMESHGUI : GUI for SMESH component\r
-//\r
-//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,\r
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS \r
-// \r
-//  This library is free software; you can redistribute it and/or \r
-//  modify it under the terms of the GNU Lesser General Public \r
-//  License as published by the Free Software Foundation; either \r
-//  version 2.1 of the License. \r
-// \r
-//  This library is distributed in the hope that it will be useful, \r
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of \r
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU \r
-//  Lesser General Public License for more details. \r
-// \r
-//  You should have received a copy of the GNU Lesser General Public \r
-//  License along with this library; if not, write to the Free Software \r
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA \r
-// \r
-//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org \r
-//\r
-//\r
-//\r
-//  File   : SMESHGUI_CreatePatternDlg.cxx\r
-//  Author : Sergey LITONIN\r
-//  Module : SMESH\r
-\r
-#include "SMESHGUI_CreatePatternDlg.h"\r
-\r
-#include "QAD_Desktop.h"\r
-#include "QAD_FileDlg.h"\r
-\r
-#include "SMESHGUI_PatternWidget.h"\r
-#include "SMESHGUI_SpinBox.h"\r
-#include "SMESHGUI.h"\r
-#include "SALOME_Selection.h"\r
-#include "SALOME_ListIteratorOfListOfFilter.hxx"\r
-#include "SALOMEGUI_QtCatchCorbaException.hxx"\r
-#include "SMESH_NumberFilter.hxx"\r
-#include "SMESHGUI_Utils.h"\r
-#include "SMESHGUI_VTKUtils.h"\r
-#include "SMESHGUI_PatternUtils.h"\r
-\r
-#include <TColStd_MapOfInteger.hxx>\r
-\r
-#include <qframe.h>\r
-#include <qlayout.h>\r
-#include <qlineedit.h>\r
-#include <qpushbutton.h>\r
-#include <qgroupbox.h>\r
-#include <qlabel.h>\r
-#include <qradiobutton.h>\r
-#include <qcheckbox.h>\r
-#include <qbuttongroup.h>\r
-#include <qmessagebox.h>\r
-#include <qapplication.h>\r
-\r
-#define SPACING 5\r
-#define MARGIN  10\r
-\r
-/*\r
-  Class       : SMESHGUI_CreatePatternDlg\r
-  Description : Dialog to specify filters for VTK viewer\r
-*/\r
-\r
-//=======================================================================\r
-// name    : SMESHGUI_CreatePatternDlg::SMESHGUI_CreatePatternDlg\r
-// Purpose : Constructor\r
-//=======================================================================\r
-SMESHGUI_CreatePatternDlg::SMESHGUI_CreatePatternDlg( QWidget*          theParent,\r
-                                                      SALOME_Selection* theSelection,\r
-                                                      const int         theType,\r
-                                                      const char*       theName )\r
-: QDialog( theParent, theName, false,\r
-           WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )\r
-{\r
-  setCaption( tr( "CAPTION" ) );\r
-\r
-  QVBoxLayout* aDlgLay = new QVBoxLayout( this, MARGIN, SPACING );\r
-\r
-  QFrame* aMainFrame = createMainFrame  ( this );\r
-  QFrame* aBtnFrame  = createButtonFrame( this );\r
-\r
-  aDlgLay->addWidget( aMainFrame );\r
-  aDlgLay->addWidget( aBtnFrame );\r
-\r
-  aDlgLay->setStretchFactor( aMainFrame, 1 );\r
-\r
-  Init( theSelection, theType );\r
-}\r
-\r
-//=======================================================================\r
-// name    : SMESHGUI_CreatePatternDlg::createMainFrame\r
-// Purpose : Create frame containing dialog's input fields\r
-//=======================================================================\r
-QFrame* SMESHGUI_CreatePatternDlg::createMainFrame( QWidget* theParent )\r
-{\r
-  QPixmap iconSlct( QAD_Desktop::getResourceManager()->loadPixmap( "SMESH", tr( "ICON_SELECT" ) ) );\r
-  QPixmap icon2d  ( QAD_Desktop::getResourceManager()->loadPixmap( "SMESH", tr( "ICON_PATTERN_2d" ) ) );\r
-  QPixmap icon3d  ( QAD_Desktop::getResourceManager()->loadPixmap( "SMESH", tr( "ICON_PATTERN_3d" ) ) );\r
-\r
-  QPixmap iconSample2d( QAD_Desktop::getResourceManager()->loadPixmap( "SMESH", tr( "ICON_PATTERN_SAMPLE_2D" ) ) );\r
-\r
-  QGroupBox* aMainGrp = new QGroupBox( 1, Qt::Horizontal, theParent );\r
-  aMainGrp->setFrameStyle( QFrame::NoFrame );\r
-  aMainGrp->setInsideMargin( 0 );\r
-\r
-  // Pattern type group\r
-\r
-  myTypeGrp = new QButtonGroup( 1, Qt::Vertical, tr( "PATTERN_TYPE" ), aMainGrp );\r
-  mySwitch2d = new QRadioButton( myTypeGrp );\r
-  mySwitch3d = new QRadioButton( myTypeGrp );\r
-  mySwitch2d->setPixmap( icon2d );\r
-  mySwitch3d->setPixmap( icon3d );\r
-  myTypeGrp->insert( mySwitch2d, Type_2d );\r
-  myTypeGrp->insert( mySwitch3d, Type_3d );\r
-\r
-  QGroupBox* aPatternGrp = new QGroupBox( 1, Qt::Horizontal, tr( "PATTERN" ), aMainGrp );\r
-\r
-  // Mesh and pattern name group\r
-  \r
-  QGroupBox* aMeshGrp = new QGroupBox( 1, Qt::Vertical, aPatternGrp );\r
-  aMeshGrp->setFrameStyle( QFrame::NoFrame );\r
-  aMeshGrp->setInsideMargin( 0 );\r
-  \r
-  new QLabel( tr( "MESH_OR_SUBMESH" ), aMeshGrp );\r
-\r
-  QPushButton* aSelBtn = new QPushButton( aMeshGrp );\r
-  aSelBtn->setPixmap( iconSlct );\r
-  myMeshEdit = new QLineEdit( aMeshGrp );\r
-  myMeshEdit->setReadOnly( true );\r
-\r
-  QGroupBox* aPattGrp = new QGroupBox( 1, Qt::Vertical, aPatternGrp );\r
-  aPattGrp->setFrameStyle( QFrame::NoFrame );\r
-  aPattGrp->setInsideMargin( 0 );\r
-  \r
-  new QLabel( tr( "PATTERN_NAME" ), aPattGrp );\r
-  myName = new QLineEdit( aPattGrp );\r
-\r
-  // Picture 2d\r
-  \r
-  myPicture2d = new SMESHGUI_PatternWidget( aPatternGrp ),\r
-  myPicture2d->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ) );\r
-\r
-  // Project check box\r
-  \r
-  myProjectChk = new QCheckBox( tr( "PROJECT" ), aPatternGrp );\r
-  \r
-  // Connect signals and slots\r
-\r
-  connect( myTypeGrp,    SIGNAL( clicked( int )  ), SLOT( onTypeChanged( int ) ) );\r
-  connect( myProjectChk, SIGNAL( toggled( bool ) ), SLOT( onProject( bool )    ) );\r
-  connect( aSelBtn,      SIGNAL( clicked()       ), SLOT( onSelBtnClicked() ) );\r
-\r
-  return aMainGrp;\r
-}\r
-\r
-//=======================================================================\r
-// name    : SMESHGUI_CreatePatternDlg::createButtonFrame\r
-// Purpose : Create frame containing buttons\r
-//=======================================================================\r
-QFrame* SMESHGUI_CreatePatternDlg::createButtonFrame( QWidget* theParent )\r
-{\r
-  QFrame* aFrame = new QFrame( theParent );\r
-  aFrame->setFrameStyle( QFrame::Box | QFrame::Sunken );\r
-\r
-  myOkBtn    = new QPushButton( tr( "SMESH_BUT_OK"     ), aFrame );\r
-  mySaveBtn  = new QPushButton( tr( "SAVE"             ), aFrame );\r
-  myCloseBtn = new QPushButton( tr( "SMESH_BUT_CANCEL" ), aFrame );\r
-\r
-  QSpacerItem* aSpacer = new QSpacerItem( 0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum );\r
-\r
-  QHBoxLayout* aLay = new QHBoxLayout( aFrame, MARGIN, SPACING );\r
-\r
-  aLay->addWidget( myOkBtn );\r
-  aLay->addWidget( mySaveBtn );\r
-  aLay->addItem( aSpacer);\r
-  aLay->addWidget( myCloseBtn );\r
-\r
-  connect( myOkBtn,    SIGNAL( clicked() ), SLOT( onOk() ) );\r
-  connect( myCloseBtn, SIGNAL( clicked() ), SLOT( onClose() ) ) ;\r
-  connect( mySaveBtn, SIGNAL( clicked() ), SLOT( onSave() ) );\r
-\r
-  return aFrame;\r
-}\r
-\r
-//=======================================================================\r
-// name    : SMESHGUI_CreatePatternDlg::~SMESHGUI_CreatePatternDlg\r
-// Purpose : Destructor\r
-//=======================================================================\r
-SMESHGUI_CreatePatternDlg::~SMESHGUI_CreatePatternDlg()\r
-{\r
-}\r
-\r
-//=======================================================================\r
-// name    : SMESHGUI_CreatePatternDlg::onProject\r
-// Purpose : SLOT. Called when state of "Project nodes on ther face"\r
-//           checkbox is changed\r
-//=======================================================================\r
-void SMESHGUI_CreatePatternDlg::onProject( bool )\r
-{\r
-  loadFromObject( false );\r
-  displayPreview();\r
-}\r
-\r
-//=======================================================================\r
-// name    : SMESHGUI_CreatePatternDlg::Init\r
-// Purpose : Init dialog fields, connect signals and slots, show dialog\r
-//=======================================================================\r
-void SMESHGUI_CreatePatternDlg::Init( SALOME_Selection* theSelection, const int theType )\r
-{\r
-  myIsLoaded  = false;\r
-  myType      = -1;\r
-  myNbPoints  = -1;\r
-  mySelection = theSelection;\r
-  mySubMesh   = SMESH::SMESH_subMesh::_nil();\r
-  myMesh      = SMESH::SMESH_Mesh::_nil();\r
-  myGeomObj   = GEOM::GEOM_Object::_nil();\r
-  myPattern   = SMESH::SMESH_Pattern::_nil();\r
-  \r
-  erasePreview();\r
-\r
-  SMESHGUI* aSMESHGUI = SMESHGUI::GetSMESHGUI();\r
-  aSMESHGUI->SetActiveDialogBox( ( QDialog* )this );\r
-\r
-  // selection and SMESHGUI\r
-  connect( mySelection, SIGNAL( currentSelectionChanged() ), SLOT( onSelectionDone() ) );\r
-  connect( aSMESHGUI, SIGNAL( SignalDeactivateActiveDialog() ), SLOT( onDeactivate() ) );\r
-  connect( aSMESHGUI, SIGNAL( SignalCloseAllDialogs() ), SLOT( onClose() ) );\r
-\r
-  mySwitch2d->setEnabled( theType == Type_2d );\r
-  mySwitch3d->setEnabled( theType == Type_3d );\r
-\r
-  if ( theType == Type_2d )\r
-    myProjectChk->show();\r
-  else\r
-    myProjectChk->hide();\r
-  \r
-  myTypeGrp->setButton( theType );\r
-  onTypeChanged( theType );\r
-  \r
-  myName->setText( getDefaultName() );\r
-  myMeshEdit->setText( "" );\r
-\r
-  setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding ) );\r
-  qApp->processEvents();\r
-  updateGeometry();\r
-  myPicture2d->updateGeometry();\r
-  adjustSize();\r
-  resize( minimumSize() );\r
-\r
-  activateSelection();\r
-  onSelectionDone();\r
-\r
-  int x, y ;\r
-  aSMESHGUI->DefineDlgPosition( this, x, y );\r
-  this->move( x, y );\r
-  this->show();\r
-}\r
-\r
-//=======================================================================\r
-// name    : SMESHGUI_CreatePatternDlg::SetMesh\r
-// Purpose : Set mesh to dialog\r
-//=======================================================================\r
-void SMESHGUI_CreatePatternDlg::SetMesh( SMESH::SMESH_Mesh_ptr thePtr )\r
-{\r
-  myMesh = SMESH::SMESH_Mesh::_duplicate( thePtr );\r
-  mySubMesh = SMESH::SMESH_subMesh::_nil();\r
-\r
-  bool isValidMesh = false;\r
-  if ( !myMesh->_is_nil() )\r
-  {\r
-    SALOMEDS::SObject_var aSobj = SMESH::FindSObject( thePtr );\r
-    CORBA::String_var anEntry = aSobj->GetID();\r
-    Handle(SALOME_InteractiveObject) anIObj =\r
-      new SALOME_InteractiveObject( anEntry.in(), "SMESH" );\r
-\r
-    const SALOME_ListOfFilter& aList = mySelection->StoredFilters();\r
-    SALOME_ListIteratorOfListOfFilter anIter( aList );\r
-    for ( ; anIter.More(); anIter.Next() )\r
-      if ( !anIter.Value()->IsOk( anIObj ) )\r
-        break;\r
-\r
-    if ( !anIter.More() )\r
-      isValidMesh = true;\r
-  }\r
-\r
-\r
-  if ( isValidMesh )\r
-  {\r
-    SALOMEDS::SObject_var aSO = SMESH::FindSObject( myMesh.in() );\r
-    myMeshEdit->setText( aSO->GetName() );\r
-    myGeomObj = getGeom( aSO );\r
-  }\r
-  else\r
-  {\r
-    myMeshEdit->setText( "" );\r
-    myGeomObj = GEOM::GEOM_Object::_nil();\r
-  }\r
-\r
-  if ( myType == Type_2d )\r
-  {\r
-    loadFromObject( false );\r
-    displayPreview();\r
-  }\r
-}\r
-\r
-//=======================================================================\r
-// name    : SMESHGUI_CreatePatternDlg::isValid\r
-// Purpose : Verify validity of entry data\r
-//=======================================================================\r
-bool SMESHGUI_CreatePatternDlg::isValid()\r
-{\r
-  if ( myGeomObj->_is_nil() )\r
-  {\r
-    QMessageBox::information( SMESHGUI::GetSMESHGUI()->GetDesktop(),\r
-      tr( "SMESH_INSUFFICIENT_DATA" ), tr( "SMESHGUI_INVALID_PARAMETERS" ), QMessageBox::Ok );\r
-    return false;\r
-  }\r
-  else\r
-    return true;\r
-}\r
-\r
-\r
-\r
-//=======================================================================\r
-// name    : SMESHGUI_CreatePatternDlg::getDefaultName\r
-// Purpose : Get default pattern name\r
-//=======================================================================\r
-QString SMESHGUI_CreatePatternDlg::getDefaultName() const\r
-{\r
-  return myType == Type_2d ? tr( "DEFAULT_2D" ) : tr( "DEFAULT_3D" );\r
-}\r
-\r
-//=======================================================================\r
-// name    : SMESHGUI_CreatePatternDlg::onSave\r
-// Purpose : SLOT called when "Save" button pressed. Build pattern and\r
-\r
-//           save it to disk\r
-//=======================================================================\r
-void SMESHGUI_CreatePatternDlg::onSave()\r
-{\r
-  try\r
-  {\r
-    if ( !isValid() )\r
-      return;\r
-\r
-    if ( !myIsLoaded )\r
-      loadFromObject( true );\r
-\r
-    // Load pattern from object\r
-    if ( !myIsLoaded )\r
-      return;\r
-\r
-    ///////////////////////////////////////////////////////\r
-    QAD_FileDlg* aDlg = new QAD_FileDlg( this, false );\r
-    aDlg->setCaption( tr( "SAVE_PATTERN" ) );\r
-    aDlg->setMode( QFileDialogP::AnyFile );\r
-    aDlg->setFilters( tr( "PATTERN_FILT" ) );\r
-    if ( myName->text() != "" )\r
-      aDlg->setSelection( myName->text() );\r
-\r
-    if ( aDlg->exec() != Accepted )\r
-      return;\r
-\r
-    QString fName = aDlg->selectedFile();\r
-    if ( fName.isEmpty() )\r
-      return;\r
-\r
-    if ( QFileInfo( fName ).extension().isEmpty() )\r
-      fName = autoExtension( fName );\r
-\r
-    fName = QDir::convertSeparators( fName );\r
-\r
-    QString aData( myPattern->GetString() );\r
-    long aLen = aData.length();\r
-\r
-    QFile aFile( fName );\r
-    aFile.open( IO_WriteOnly );\r
-    long aWritten = aFile.writeBlock( aData, aLen );\r
-    aFile.close();\r
-\r
-    if ( aWritten != aLen )\r
-    {\r
-      QMessageBox::information( SMESHGUI::GetSMESHGUI()->GetDesktop(),\r
-        tr( "SMESH_ERROR" ), tr( "ERROR_OF_SAVING" ), QMessageBox::Ok );\r
-    }\r
-    else\r
-    {\r
-      QAD_Application::getDesktop()->SetSelectionMode( ActorSelection );\r
-      disconnect( mySelection, 0, this, 0 );\r
-      disconnect( SMESHGUI::GetSMESHGUI(), 0, this, 0 );\r
-      SMESHGUI::GetSMESHGUI()->ResetState();\r
-      accept();\r
-      emit NewPattern();\r
-    }\r
-  }\r
-  catch( const SALOME::SALOME_Exception& S_ex )\r
-  {\r
-    QtCatchCorbaException( S_ex );\r
-  }\r
-  catch( ... )\r
-  {\r
-  }\r
-}\r
-\r
-//=======================================================================\r
-// name    : SMESHGUI_CreatePatternDlg::GetPatternName\r
-// Purpose : Get name of pattern\r
-//=======================================================================\r
-QString SMESHGUI_CreatePatternDlg::GetPatternName() const\r
-{\r
-  return myName->text();\r
-}\r
-\r
-//=======================================================================\r
-// name    : SMESHGUI_CreatePatternDlg::GetPattern\r
-// Purpose : Get result pattern\r
-//=======================================================================\r
-SMESH::SMESH_Pattern_ptr SMESHGUI_CreatePatternDlg::GetPattern()\r
-{\r
-  return myPattern.in();\r
-}\r
-\r
-//=======================================================================\r
-// name    : SMESHGUI_CreatePatternDlg::onOk\r
-// Purpose : SLOT called when "Ok" button pressed.\r
-//=======================================================================\r
-void SMESHGUI_CreatePatternDlg::onOk()\r
-{\r
-  try\r
-  {\r
-    if ( !isValid() )\r
-      return;\r
-\r
-    if ( !myIsLoaded )\r
-      loadFromObject( true );\r
-\r
-    // Load pattern from object\r
-    if ( !myIsLoaded )\r
-      return;\r
-    else\r
-    {\r
-      QAD_Application::getDesktop()->SetSelectionMode( ActorSelection );\r
-      disconnect( mySelection, 0, this, 0 );\r
-      disconnect( SMESHGUI::GetSMESHGUI(), 0, this, 0 );\r
-      SMESHGUI::GetSMESHGUI()->ResetState();\r
-      accept();\r
-      emit NewPattern();\r
-    }\r
-  }\r
-  catch( const SALOME::SALOME_Exception& S_ex )\r
-  {\r
-    QtCatchCorbaException( S_ex );\r
-  }\r
-  catch( ... )\r
-  {\r
-  }\r
-}\r
-\r
-//=======================================================================\r
-// name    : SMESHGUI_CreatePatternDlg::onClose\r
-// Purpose : SLOT called when "Close" button pressed. Close dialog\r
-//=======================================================================\r
-void SMESHGUI_CreatePatternDlg::onClose()\r
-{\r
-  QAD_Application::getDesktop()->SetSelectionMode( ActorSelection );\r
-  disconnect( mySelection, 0, this, 0 );\r
-  disconnect( SMESHGUI::GetSMESHGUI(), 0, this, 0 );\r
-  SMESHGUI::GetSMESHGUI()->ResetState();\r
-  reject();\r
-  emit Close();\r
-}\r
-\r
-//=======================================================================\r
-// name    : SMESHGUI_CreatePatternDlg::loadFromObject\r
-// Purpose : Load pattern from geom object corresponding to the mesh/submesh\r
-//=======================================================================\r
-bool SMESHGUI_CreatePatternDlg::loadFromObject( const bool theMess )\r
-{\r
-  try\r
-  {\r
-    myIsLoaded = false;\r
-    \r
-    if ( myPattern->_is_nil() )\r
-      myPattern = SMESH::GetPattern();\r
-\r
-    if ( myMesh->_is_nil() && mySubMesh->_is_nil() || myGeomObj->_is_nil() )\r
-      return false;\r
-\r
-    SMESH::SMESH_Mesh_ptr aMesh = mySubMesh->_is_nil() ? myMesh.in() : mySubMesh->GetFather();\r
-\r
-    myIsLoaded = myType == Type_2d\r
-      ? myPattern->LoadFromFace( aMesh, myGeomObj, myProjectChk->isChecked() )\r
-      : myPattern->LoadFrom3DBlock( aMesh, myGeomObj );\r
-\r
-    if ( !myIsLoaded && theMess )\r
-    {\r
-      QString aMess;\r
-      SMESH::SMESH_Pattern::ErrorCode aCode = myPattern->GetErrorCode();\r
-      \r
-      if      ( aCode == SMESH::SMESH_Pattern::ERR_LOAD_EMPTY_SUBMESH   ) aMess = tr( "ERR_LOAD_EMPTY_SUBMESH" );\r
-      else if ( aCode == SMESH::SMESH_Pattern::ERR_LOADF_NARROW_FACE    ) aMess = tr( "ERR_LOADF_NARROW_FACE" );\r
-      else if ( aCode == SMESH::SMESH_Pattern::ERR_LOADF_CLOSED_FACE    ) aMess = tr( "ERR_LOADF_CLOSED_FACE" );\r
-      else if ( aCode == SMESH::SMESH_Pattern::ERR_LOADV_BAD_SHAPE      ) aMess = tr( "ERR_LOADV_BAD_SHAPE" );\r
-      else if ( aCode == SMESH::SMESH_Pattern::ERR_LOADV_COMPUTE_PARAMS ) aMess = tr( "ERR_LOADV_COMPUTE_PARAMS" );\r
-      else                                                                aMess = tr( "ERROR_OF_CREATION" );\r
-\r
-      QMessageBox::information(\r
-        SMESHGUI::GetSMESHGUI()->GetDesktop(), tr( "SMESH_ERROR" ), aMess, QMessageBox::Ok );\r
-    }\r
-\r
-  }\r
-  catch( const SALOME::SALOME_Exception& S_ex )\r
-  {\r
-    QtCatchCorbaException( S_ex );\r
-  }\r
-    \r
-  return myIsLoaded;\r
-}\r
-\r
-//=======================================================================\r
-// name    : SMESHGUI_CreatePatternDlg::getGeom\r
-// Purpose : Retrieve geom object from SObject\r
-//=======================================================================\r
-GEOM::GEOM_Object_ptr SMESHGUI_CreatePatternDlg::getGeom( SALOMEDS::SObject_ptr theSO )\r
-{\r
-  if ( theSO->_is_nil() )\r
-    return GEOM::GEOM_Object::_nil();\r
-\r
-  SALOMEDS::Study_var aStudy =\r
-    SMESHGUI::GetSMESHGUI()->GetActiveStudy()->getStudyDocument();\r
-\r
-  SALOMEDS::ChildIterator_var anIter = aStudy->NewChildIterator( theSO );\r
-  for( ; anIter->More(); anIter->Next() )\r
-  {\r
-    SALOMEDS::SObject_var aSO = anIter->Value();\r
-    SALOMEDS::SObject_var aRefSO;\r
-\r
-    GEOM::GEOM_Object_var aMeshShape = GEOM::GEOM_Object::_narrow(\r
-      aSO->ReferencedObject( aRefSO )? aRefSO->GetObject() : aSO->GetObject() );\r
-\r
-    if ( !aMeshShape->_is_nil() )\r
-      return aMeshShape._retn();\r
-  }\r
-  return GEOM::GEOM_Object::_nil();\r
-}\r
-\r
-//=======================================================================\r
-// name    : SMESHGUI_CreatePatternDlg::onSelectionDone\r
-// Purpose : SLOT called when selection changed\r
-//=======================================================================\r
-void SMESHGUI_CreatePatternDlg::onSelectionDone()\r
-{\r
-  try\r
-  {\r
-    if ( mySelection->IObjectCount() != 1 )\r
-      return;\r
-\r
-    // Get mesh or sub-mesh from selection\r
-    Handle(SALOME_InteractiveObject) anIO = mySelection->firstIObject();\r
-    SMESH::SMESH_Mesh_var aMesh = SMESH::IObjectToInterface<SMESH::SMESH_Mesh>( anIO );\r
-    SMESH::SMESH_subMesh_var aSubMesh = SMESH::IObjectToInterface<SMESH::SMESH_subMesh>( anIO );\r
-    if ( aMesh->_is_nil() && aSubMesh->_is_nil() )\r
-      return;\r
-\r
-    // Get geom object corresponding to the mesh\r
-    SALOMEDS::SObject_var aSO;\r
-    if ( !aMesh->_is_nil() )\r
-      aSO = SMESH::FindSObject( aMesh.in() );\r
-    else\r
-      aSO = SMESH::FindSObject( aSubMesh.in() );\r
-\r
-\r
-    GEOM::GEOM_Object_var aGeomObj = getGeom( aSO );\r
-    if ( aGeomObj->_is_nil() )\r
-      return;\r
-\r
-    myGeomObj = aGeomObj;\r
-\r
-    // init class fields\r
-    if ( !aMesh->_is_nil() )\r
-    {\r
-      myMesh = aMesh;\r
-      mySubMesh = SMESH::SMESH_subMesh::_nil();\r
-    }\r
-    else\r
-    {\r
-      mySubMesh = aSubMesh;\r
-      myMesh = SMESH::SMESH_Mesh::_nil();\r
-    }\r
-\r
-    QString aName;\r
-    SMESH::GetNameOfSelectedIObjects( mySelection, aName );\r
-    myMeshEdit->setText( aName );\r
-\r
-    if ( myType == Type_2d )\r
-    {\r
-      loadFromObject( true );\r
-      displayPreview();\r
-    }\r
-  }\r
-  catch( ... )\r
-  {\r
-    myMesh = SMESH::SMESH_Mesh::_nil();\r
-    mySubMesh = SMESH::SMESH_subMesh::_nil();\r
-    myGeomObj = GEOM::GEOM_Object::_nil();\r
-    erasePreview();\r
-  }\r
-}\r
-\r
-//=======================================================================\r
-// name    : SMESHGUI_CreatePatternDlg::onDeactivate\r
-// Purpose : SLOT called when dialog must be deativated\r
-//=======================================================================\r
-void SMESHGUI_CreatePatternDlg::onDeactivate()\r
-{\r
-  disconnect( mySelection, 0, this, 0 );\r
-  setEnabled( false );\r
-}\r
-\r
-//=======================================================================\r
-// name    : SMESHGUI_CreatePatternDlg::enterEvent\r
-// Purpose : Event filter\r
-//=======================================================================\r
-void SMESHGUI_CreatePatternDlg::enterEvent( QEvent* )\r
-{\r
-  SMESHGUI::GetSMESHGUI()->EmitSignalDeactivateDialog();\r
-  setEnabled( true );\r
-  activateSelection();\r
-  connect( mySelection, SIGNAL( currentSelectionChanged() ), SLOT( onSelectionDone() ) );\r
-}\r
-\r
-\r
-//=================================================================================\r
-// function : closeEvent()\r
-// purpose  : Close dialog box\r
-//=================================================================================\r
-void SMESHGUI_CreatePatternDlg::closeEvent( QCloseEvent* e )\r
-{\r
-  onClose() ;\r
-}\r
-\r
-//=======================================================================\r
-// name    : SMESHGUI_CreatePatternDlg::onSelBtnClicked\r
-// Purpose : SLOT. Called when -> button clicked.\r
-//=======================================================================\r
-void SMESHGUI_CreatePatternDlg::onSelBtnClicked()\r
-{\r
-  onSelectionDone();\r
-}\r
-\r
-//================================================================\r
-// Function : SMESHGUI_CreatePatternDlg::autoExtension\r
-// Purpose  : Append extension to the file name\r
-//================================================================\r
-QString SMESHGUI_CreatePatternDlg::autoExtension( const QString& theFileName ) const\r
-{\r
-  QString anExt = theFileName.section( '.', -1 );\r
-  return anExt != "smp" && anExt != "SMP" ? theFileName + ".smp" : theFileName;\r
-}\r
-\r
-//=======================================================================\r
-// name    : SMESHGUI_CreatePatternDlg::displayPreview\r
-// Purpose : Display preview\r
-//=======================================================================\r
-void SMESHGUI_CreatePatternDlg::displayPreview()\r
-{\r
-\r
-  // Redisplay preview in dialog\r
-\r
-  try\r
-  {\r
-    if ( !myIsLoaded )\r
-      erasePreview();\r
-    else\r
-    {\r
-      SMESH::point_array_var pnts = myPattern->GetPoints();\r
-      SMESH::long_array_var keyPoints = myPattern->GetKeyPoints();\r
-      SMESH::array_of_long_array_var elemPoints = myPattern->GetElementPoints(false);\r
-\r
-      if ( pnts->length()       == 0 ||\r
-           keyPoints->length()  == 0 ||\r
-           elemPoints->length() == 0 )\r
-      {\r
-        myIsLoaded = false;\r
-        erasePreview();\r
-        return;\r
-      }\r
-\r
-      PointVector aPoints( pnts->length() );\r
-      QValueVector<int> aKeyPoints( keyPoints->length() );\r
-      ConnectivityVector anElemPoints( elemPoints->length() );\r
-\r
-      for ( int i = 0, n = pnts->length(); i < n; i++ )\r
-        aPoints[ i ] = pnts[ i ];\r
-\r
-      for ( int i2 = 0, n2 = keyPoints->length(); i2 < n2; i2++ )\r
-        aKeyPoints[ i2 ] = keyPoints[ i2 ];\r
-\r
-      for ( int i3 = 0, n3 = elemPoints->length(); i3 < n3; i3++ )\r
-      {\r
-        QValueVector<int> aVec( elemPoints[ i3 ].length() );\r
-        for ( int i4 = 0, n4 = elemPoints[ i3 ].length(); i4 < n4; i4++ )\r
-          aVec[ i4 ] = elemPoints[ i3 ][ i4 ];\r
-\r
-        anElemPoints[ i3 ] = aVec;\r
-      }\r
-\r
-      myPicture2d->SetPoints( aPoints, aKeyPoints, anElemPoints );\r
-    }\r
-\r
-    return;\r
-  }\r
-  catch( const SALOME::SALOME_Exception& S_ex )\r
-  {\r
-    QtCatchCorbaException( S_ex );\r
-  }\r
-  catch( ... )\r
-  {\r
-  }\r
-  erasePreview();\r
-}\r
-\r
-//=======================================================================\r
-// name    : SMESHGUI_CreatePatternDlg::erasePreview\r
-// Purpose : Erase preview\r
-//=======================================================================\r
-void SMESHGUI_CreatePatternDlg::erasePreview()\r
-\r
-{\r
-  // Erase preview in 2D viewer\r
-  myPicture2d->SetPoints( PointVector(), QValueVector<int>(), ConnectivityVector() );\r
-}\r
-\r
-//=======================================================================\r
-// name    : SMESHGUI_CreatePatternDlg::activateSelection\r
-// Purpose : Activate selection in accordance with current pattern type\r
-//=======================================================================\r
-void SMESHGUI_CreatePatternDlg::activateSelection()\r
-{\r
-  mySelection->ClearFilters();\r
-  QAD_Application::getDesktop()->SetSelectionMode( ActorSelection );\r
-  \r
-  if ( myType == Type_2d )\r
-  {\r
-    mySelection->AddFilter(\r
-      new SMESH_NumberFilter( "SMESH", TopAbs_SHAPE, -1, TopAbs_FACE ) );\r
-  }\r
-  else\r
-  {\r
-    TColStd_MapOfInteger aTypes;\r
-    aTypes.Add( TopAbs_SHELL );\r
-    aTypes.Add( TopAbs_SOLID );\r
-    mySelection->AddFilter( new SMESH_NumberFilter(\r
-      "SMESH", TopAbs_FACE, 6, aTypes, GEOM::GEOM_Object::_nil(), true ) );\r
-  }\r
-}\r
-\r
-//=======================================================================\r
-// name    : SMESHGUI_CreatePatternDlg::onTypeChanged\r
-// Purpose : SLOT. Called when pattern type changed.\r
-//           Change dialog's look and feel\r
-//=======================================================================\r
-void SMESHGUI_CreatePatternDlg::onTypeChanged( int theType )\r
-{\r
-  if ( myType == theType )\r
-    return;\r
-\r
-  myType = theType;\r
-\r
-  if ( theType == Type_2d )\r
-    myPicture2d->show();\r
-  else\r
-    myPicture2d->hide();\r
-}\r
-\r
-\r
-\r
-\r
-\r
-\r
-\r
-\r
-\r
-\r
-\r
-\r
-\r
-\r
-\r
-\r
-\r
-\r
-\r
-\r
-\r
+//  SMESH SMESHGUI : GUI for SMESH component
+//
+//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//
+//  File   : SMESHGUI_CreatePatternDlg.cxx
+//  Author : Sergey LITONIN
+//  Module : SMESH
+
+#include "SMESHGUI_CreatePatternDlg.h"
+
+#include "SMESHGUI.h"
+#include "SMESHGUI_SpinBox.h"
+#include "SMESHGUI_PatternWidget.h"
+#include "SMESHGUI_Utils.h"
+#include "SMESHGUI_VTKUtils.h"
+#include "SMESHGUI_PatternUtils.h"
+#include "SMESHGUI_GEOMGenUtils.h"
+
+#include "SMESH_NumberFilter.hxx"
+
+#include "SUIT_ResourceMgr.h"
+#include "SUIT_Desktop.h"
+#include "SUIT_FileDlg.h"
+
+#include "SalomeApp_Study.h"
+#include "SalomeApp_DataOwner.h"
+#include "SalomeApp_SelectionMgr.h"
+#include "SalomeApp_Tools.h"
+
+#include "SALOMEDS_SObject.hxx"
+
+#include "SALOME_ListIO.hxx"
+#include "SVTK_ViewModel.h"
+#include "SVTK_ViewWindow.h"
+#include "SVTK_Selector.h"
+#include "SVTK_Selection.h"
+
+// OCCT Includes
+#include <TColStd_MapOfInteger.hxx>
+
+// QT Includes
+#include <qframe.h>
+#include <qlayout.h>
+#include <qlineedit.h>
+#include <qpushbutton.h>
+#include <qgroupbox.h>
+#include <qlabel.h>
+#include <qradiobutton.h>
+#include <qcheckbox.h>
+#include <qbuttongroup.h>
+#include <qmessagebox.h>
+#include <qapplication.h>
+
+#define SPACING 5
+#define MARGIN  10
+
+/*!
+ *  Class       : SMESHGUI_CreatePatternDlg
+ *  Description : Dialog to specify filters for VTK viewer
+ */
+
+//=======================================================================
+// function : SMESHGUI_CreatePatternDlg()
+// purpose  : Constructor
+//=======================================================================
+SMESHGUI_CreatePatternDlg::SMESHGUI_CreatePatternDlg( SMESHGUI*   theModule,
+                                                      const int   theType,
+                                                      const char* theName)
+     : QDialog( SMESH::GetDesktop( theModule ), theName, false,
+                WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu),
+     mySMESHGUI( theModule ),
+     mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ),
+     myViewWindow( SMESH::GetViewWindow( theModule ) ),
+     mySelector( myViewWindow->GetSelector() )
+{
+  setCaption(tr("CAPTION"));
+
+  QVBoxLayout* aDlgLay = new QVBoxLayout (this, MARGIN, SPACING);
+
+  QFrame* aMainFrame = createMainFrame  (this);
+  QFrame* aBtnFrame  = createButtonFrame(this);
+
+  aDlgLay->addWidget(aMainFrame);
+  aDlgLay->addWidget(aBtnFrame);
+
+  aDlgLay->setStretchFactor(aMainFrame, 1);
+
+  Init(theType);
+}
+
+//=======================================================================
+// function : createMainFrame()
+// purpose  : Create frame containing dialog's input fields
+//=======================================================================
+QFrame* SMESHGUI_CreatePatternDlg::createMainFrame (QWidget* theParent)
+{
+  QPixmap iconSlct     (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_SELECT")));
+  QPixmap icon2d       (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_PATTERN_2d")));
+  QPixmap icon3d       (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_PATTERN_3d")));
+  QPixmap iconSample2d (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_PATTERN_SAMPLE_2D")));
+
+  QGroupBox* aMainGrp = new QGroupBox(1, Qt::Horizontal, theParent);
+  aMainGrp->setFrameStyle(QFrame::NoFrame);
+  aMainGrp->setInsideMargin(0);
+
+  // Pattern type group
+
+  myTypeGrp = new QButtonGroup (1, Qt::Vertical, tr("PATTERN_TYPE"), aMainGrp);
+  mySwitch2d = new QRadioButton (myTypeGrp);
+  mySwitch3d = new QRadioButton (myTypeGrp);
+  mySwitch2d->setPixmap(icon2d);
+  mySwitch3d->setPixmap(icon3d);
+  myTypeGrp->insert(mySwitch2d, Type_2d);
+  myTypeGrp->insert(mySwitch3d, Type_3d);
+
+  QGroupBox* aPatternGrp = new QGroupBox(1, Qt::Horizontal, tr("PATTERN"), aMainGrp);
+
+  // Mesh and pattern name group
+
+  QGroupBox* aMeshGrp = new QGroupBox(1, Qt::Vertical, aPatternGrp);
+  aMeshGrp->setFrameStyle(QFrame::NoFrame);
+  aMeshGrp->setInsideMargin(0);
+
+  new QLabel(tr("MESH_OR_SUBMESH"), aMeshGrp);
+
+  QPushButton* aSelBtn = new QPushButton(aMeshGrp);
+  aSelBtn->setPixmap(iconSlct);
+  myMeshEdit = new QLineEdit(aMeshGrp);
+  myMeshEdit->setReadOnly(true);
+
+  QGroupBox* aPattGrp = new QGroupBox(1, Qt::Vertical, aPatternGrp);
+  aPattGrp->setFrameStyle(QFrame::NoFrame);
+  aPattGrp->setInsideMargin(0);
+
+  new QLabel(tr("PATTERN_NAME"), aPattGrp);
+  myName = new QLineEdit(aPattGrp);
+
+  // Picture 2d
+
+  myPicture2d = new SMESHGUI_PatternWidget(aPatternGrp),
+  myPicture2d->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding));
+
+  // Project check box
+
+  myProjectChk = new QCheckBox(tr("PROJECT"), aPatternGrp);
+
+  // Connect signals and slots
+
+  connect(myTypeGrp,    SIGNAL(clicked(int) ), SLOT(onTypeChanged(int)));
+  connect(myProjectChk, SIGNAL(toggled(bool)), SLOT(onProject(bool)   ));
+  connect(aSelBtn,      SIGNAL(clicked()      ), SLOT(onSelBtnClicked()));
+
+  return aMainGrp;
+}
+
+//=======================================================================
+// function : createButtonFrame()
+// purpose  : Create frame containing buttons
+//=======================================================================
+QFrame* SMESHGUI_CreatePatternDlg::createButtonFrame (QWidget* theParent)
+{
+  QFrame* aFrame = new QFrame(theParent);
+  aFrame->setFrameStyle(QFrame::Box | QFrame::Sunken);
+
+  myOkBtn    = new QPushButton(tr("SMESH_BUT_OK"    ), aFrame);
+  mySaveBtn  = new QPushButton(tr("SAVE"            ), aFrame);
+  myCloseBtn = new QPushButton(tr("SMESH_BUT_CANCEL"), aFrame);
+
+  QSpacerItem* aSpacer = new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum);
+
+  QHBoxLayout* aLay = new QHBoxLayout(aFrame, MARGIN, SPACING);
+
+  aLay->addWidget(myOkBtn);
+  aLay->addWidget(mySaveBtn);
+  aLay->addItem(aSpacer);
+  aLay->addWidget(myCloseBtn);
+
+  connect(myOkBtn,    SIGNAL(clicked()), SLOT(onOk()));
+  connect(myCloseBtn, SIGNAL(clicked()), SLOT(onClose()));
+  connect(mySaveBtn, SIGNAL(clicked()), SLOT(onSave()));
+
+  return aFrame;
+}
+
+//=======================================================================
+// function : ~SMESHGUI_CreatePatternDlg()
+// purpose  : Destructor
+//=======================================================================
+SMESHGUI_CreatePatternDlg::~SMESHGUI_CreatePatternDlg()
+{
+  // no need to delete child widgets, Qt does it all for us
+}
+
+//=======================================================================
+// function : onProject()
+// purpose  : SLOT. Called when state of "Project nodes on ther face"
+//            checkbox is changed
+//=======================================================================
+void SMESHGUI_CreatePatternDlg::onProject (bool)
+{
+  loadFromObject(false);
+  displayPreview();
+}
+
+//=======================================================================
+// function : Init()
+// purpose  : Init dialog fields, connect signals and slots, show dialog
+//=======================================================================
+void SMESHGUI_CreatePatternDlg::Init( const int theType )
+{
+  myIsLoaded     = false;
+  myType         = -1;
+  myNbPoints     = -1;
+  mySubMesh      = SMESH::SMESH_subMesh::_nil();
+  myMesh         = SMESH::SMESH_Mesh::_nil();
+  myGeomObj      = GEOM::GEOM_Object::_nil();
+  myPattern      = SMESH::SMESH_Pattern::_nil();
+
+  erasePreview();
+
+  mySMESHGUI->SetActiveDialogBox((QDialog*)this);
+
+  // selection and SMESHGUI
+  connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), SLOT(onSelectionDone()));
+  connect(mySMESHGUI, SIGNAL(SignalDeactivateActiveDialog()), SLOT(onDeactivate()));
+  connect(mySMESHGUI, SIGNAL(SignalCloseAllDialogs()), SLOT(onClose()));
+
+  mySwitch2d->setEnabled(theType == Type_2d);
+  mySwitch3d->setEnabled(theType == Type_3d);
+
+  if (theType == Type_2d)
+    myProjectChk->show();
+  else
+    myProjectChk->hide();
+
+  myTypeGrp->setButton(theType);
+  onTypeChanged(theType);
+
+  myName->setText(getDefaultName());
+  myMeshEdit->setText("");
+
+  setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding));
+  qApp->processEvents();
+  updateGeometry();
+  myPicture2d->updateGeometry();
+  adjustSize();
+  resize(minimumSize());
+
+  activateSelection();
+  onSelectionDone();
+
+  int x, y;
+  mySMESHGUI->DefineDlgPosition(this, x, y);
+  this->move(x, y);
+  this->show();
+}
+
+//=======================================================================
+// function : SetMesh()
+// purpose  : Set mesh to dialog
+//=======================================================================
+void SMESHGUI_CreatePatternDlg::SetMesh (SMESH::SMESH_Mesh_ptr thePtr)
+{
+  myMesh = SMESH::SMESH_Mesh::_duplicate(thePtr);
+  mySubMesh = SMESH::SMESH_subMesh::_nil();
+
+  bool isValidMesh = false;
+  if (!myMesh->_is_nil())
+  {
+    _PTR(SObject) aSobj = SMESH::FindSObject(myMesh.in());
+    //Handle(SALOME_InteractiveObject) anIObj =
+    //  new SALOME_InteractiveObject(aSobj->GetID().c_str(), "SMESH");
+    SUIT_DataOwnerPtr anIObj (new SalomeApp_DataOwner(aSobj->GetID().c_str()));
+
+    isValidMesh = mySelectionMgr->isOk(anIObj);
+  }
+
+  if (isValidMesh) {
+    _PTR(SObject) aSO = SMESH::FindSObject(myMesh.in());
+    myMeshEdit->setText(aSO->GetName().c_str());
+    myGeomObj = SMESH::GetGeom(aSO);
+  } else {
+    myMeshEdit->setText("");
+    myGeomObj = GEOM::GEOM_Object::_nil();
+  }
+
+  if (myType == Type_2d) {
+    loadFromObject(false);
+    displayPreview();
+  }
+}
+
+//=======================================================================
+// function : isValid()
+// purpose  : Verify validity of entry data
+//=======================================================================
+bool SMESHGUI_CreatePatternDlg::isValid()
+{
+  if (myGeomObj->_is_nil()) {
+    QMessageBox::information(SMESH::GetDesktop( mySMESHGUI ),
+                             tr("SMESH_INSUFFICIENT_DATA"),
+                             tr("SMESHGUI_INVALID_PARAMETERS"),
+                             QMessageBox::Ok);
+    return false;
+  }
+  else
+    return true;
+}
+
+//=======================================================================
+// function : getDefaultName()
+// purpose  : Get default pattern name
+//=======================================================================
+QString SMESHGUI_CreatePatternDlg::getDefaultName() const
+{
+  return myType == Type_2d ? tr("DEFAULT_2D") : tr("DEFAULT_3D");
+}
+
+//=======================================================================
+// function : onSave()
+// purpose  : SLOT called when "Save" button pressed. Build pattern and
+//           save it to disk
+//=======================================================================
+void SMESHGUI_CreatePatternDlg::onSave()
+{
+  try {
+    if (!isValid())
+      return;
+
+    if (!myIsLoaded)
+      loadFromObject(true);
+
+    // Load pattern from object
+    if (!myIsLoaded)
+      return;
+
+    ///////////////////////////////////////////////////////
+    SUIT_FileDlg* aDlg = new SUIT_FileDlg (this, false);
+    aDlg->setCaption(tr("SAVE_PATTERN"));
+    aDlg->setMode(QFileDialog::AnyFile);
+    aDlg->setFilters(tr("PATTERN_FILT"));
+    if (myName->text() != "")
+      aDlg->setSelection(myName->text());
+
+    if (aDlg->exec() != Accepted)
+      return;
+
+    QString fName = aDlg->selectedFile();
+    if (fName.isEmpty())
+      return;
+
+    if (QFileInfo(fName).extension().isEmpty())
+      fName = autoExtension(fName);
+
+    fName = QDir::convertSeparators(fName);
+
+    QString aData (myPattern->GetString());
+    long aLen = aData.length();
+
+    QFile aFile (fName);
+    aFile.open(IO_WriteOnly);
+    long aWritten = aFile.writeBlock(aData, aLen);
+    aFile.close();
+
+    if (aWritten != aLen) {
+      QMessageBox::information(SMESH::GetDesktop( mySMESHGUI ), tr("SMESH_ERROR"),
+                               tr("ERROR_OF_SAVING"), QMessageBox::Ok);
+    } else {
+      //SUIT_Application::getDesktop()->setSelectionModes(ActorSelection);
+      myViewWindow->SetSelectionMode(ActorSelection);
+      disconnect(mySelectionMgr, 0, this, 0);
+      disconnect(mySMESHGUI, 0, this, 0);
+      mySMESHGUI->ResetState();
+      accept();
+      emit NewPattern();
+    }
+  } catch (const SALOME::SALOME_Exception& S_ex) {
+    SalomeApp_Tools::QtCatchCorbaException(S_ex);
+  } catch (...) {
+  }
+}
+
+//=======================================================================
+// function : GetPatternName()
+// purpose  : Get name of pattern
+//=======================================================================
+QString SMESHGUI_CreatePatternDlg::GetPatternName() const
+{
+  return myName->text();
+}
+
+//=======================================================================
+// function : GetPattern()
+// purpose  : Get result pattern
+//=======================================================================
+SMESH::SMESH_Pattern_ptr SMESHGUI_CreatePatternDlg::GetPattern()
+{
+  return myPattern.in();
+}
+
+//=======================================================================
+// function : onOk()
+// purpose  : SLOT called when "Ok" button pressed.
+//=======================================================================
+void SMESHGUI_CreatePatternDlg::onOk()
+{
+  try {
+    if (!isValid())
+      return;
+
+    if (!myIsLoaded)
+      loadFromObject(true);
+
+    // Load pattern from object
+    if (!myIsLoaded) {
+      return;
+    } else {
+      //SUIT_Application::getDesktop()->setSelectionModes(ActorSelection);
+      myViewWindow->SetSelectionMode(ActorSelection);
+      disconnect(mySelectionMgr, 0, this, 0);
+      disconnect(mySMESHGUI, 0, this, 0);
+      mySMESHGUI->ResetState();
+      accept();
+      emit NewPattern();
+    }
+  } catch (const SALOME::SALOME_Exception& S_ex) {
+    SalomeApp_Tools::QtCatchCorbaException(S_ex);
+  } catch (...) {
+  }
+}
+
+//=======================================================================
+// function : onClose()
+// purpose  : SLOT called when "Close" button pressed. Close dialog
+//=======================================================================
+void SMESHGUI_CreatePatternDlg::onClose()
+{
+  myViewWindow->SetSelectionMode(ActorSelection);
+  disconnect(mySelectionMgr, 0, this, 0);
+  disconnect(mySMESHGUI, 0, this, 0);
+  mySMESHGUI->ResetState();
+  reject();
+  emit Close();
+}
+
+//=======================================================================
+// function : loadFromObject()
+// purpose  : Load pattern from geom object corresponding to the mesh/submesh
+//=======================================================================
+bool SMESHGUI_CreatePatternDlg::loadFromObject (const bool theMess)
+{
+  try {
+    myIsLoaded = false;
+
+    if (myPattern->_is_nil())
+      myPattern = SMESH::GetPattern();
+
+    if (myMesh->_is_nil() && mySubMesh->_is_nil() || myGeomObj->_is_nil())
+      return false;
+
+    SMESH::SMESH_Mesh_ptr aMesh = mySubMesh->_is_nil() ? myMesh.in() : mySubMesh->GetFather();
+
+    myIsLoaded = myType == Type_2d
+      ? myPattern->LoadFromFace(aMesh, myGeomObj, myProjectChk->isChecked())
+      : myPattern->LoadFrom3DBlock(aMesh, myGeomObj);
+
+    if (!myIsLoaded && theMess) {
+      QString aMess;
+      SMESH::SMESH_Pattern::ErrorCode aCode = myPattern->GetErrorCode();
+
+      if      (aCode == SMESH::SMESH_Pattern::ERR_LOAD_EMPTY_SUBMESH  ) aMess = tr("ERR_LOAD_EMPTY_SUBMESH");
+      else if (aCode == SMESH::SMESH_Pattern::ERR_LOADF_NARROW_FACE   ) aMess = tr("ERR_LOADF_NARROW_FACE");
+      else if (aCode == SMESH::SMESH_Pattern::ERR_LOADF_CLOSED_FACE   ) aMess = tr("ERR_LOADF_CLOSED_FACE");
+      else if (aCode == SMESH::SMESH_Pattern::ERR_LOADV_BAD_SHAPE     ) aMess = tr("ERR_LOADV_BAD_SHAPE");
+      else if (aCode == SMESH::SMESH_Pattern::ERR_LOADV_COMPUTE_PARAMS) aMess = tr("ERR_LOADV_COMPUTE_PARAMS");
+      else                                                              aMess = tr("ERROR_OF_CREATION");
+
+      QMessageBox::information(SMESH::GetDesktop( mySMESHGUI ),
+                               tr("SMESH_ERROR"), aMess, QMessageBox::Ok);
+    }
+  } catch (const SALOME::SALOME_Exception& S_ex) {
+    SalomeApp_Tools::QtCatchCorbaException(S_ex);
+  }
+
+  return myIsLoaded;
+}
+
+//=======================================================================
+// function : onSelectionDone()
+// purpose  : SLOT called when selection changed
+//=======================================================================
+void SMESHGUI_CreatePatternDlg::onSelectionDone()
+{
+  try {
+    SALOME_ListIO aList;
+    mySelectionMgr->selectedObjects(aList, SVTK_Viewer::Type());
+    if (aList.Extent() != 1)
+      return;
+
+    // Get mesh or sub-mesh from selection
+    Handle(SALOME_InteractiveObject) anIO = aList.First();
+    SMESH::SMESH_Mesh_var aMesh = SMESH::IObjectToInterface<SMESH::SMESH_Mesh>(anIO);
+    SMESH::SMESH_subMesh_var aSubMesh = SMESH::IObjectToInterface<SMESH::SMESH_subMesh>(anIO);
+    if (aMesh->_is_nil() && aSubMesh->_is_nil())
+      return;
+
+    // Get geom object corresponding to the mesh
+    _PTR(SObject) aSO;
+    if (!aMesh->_is_nil())
+      aSO = SMESH::FindSObject(aMesh.in());
+    else
+      aSO = SMESH::FindSObject(aSubMesh.in());
+
+    GEOM::GEOM_Object_var aGeomObj = SMESH::GetGeom(aSO);
+    if (aGeomObj->_is_nil())
+      return;
+
+    myGeomObj = aGeomObj;
+
+    // init class fields
+    if (!aMesh->_is_nil()) {
+      myMesh = aMesh;
+      mySubMesh = SMESH::SMESH_subMesh::_nil();
+    } else {
+      mySubMesh = aSubMesh;
+      myMesh = SMESH::SMESH_Mesh::_nil();
+    }
+
+    QString aName;
+    SMESH::GetNameOfSelectedIObjects(mySelectionMgr, aName);
+    myMeshEdit->setText(aName);
+
+    if (myType == Type_2d) {
+      loadFromObject(true);
+      displayPreview();
+    }
+  } catch (...) {
+    myMesh = SMESH::SMESH_Mesh::_nil();
+    mySubMesh = SMESH::SMESH_subMesh::_nil();
+    myGeomObj = GEOM::GEOM_Object::_nil();
+    erasePreview();
+  }
+}
+
+//=======================================================================
+// function : onDeactivate()
+// purpose  : SLOT called when dialog must be deativated
+//=======================================================================
+void SMESHGUI_CreatePatternDlg::onDeactivate()
+{
+  disconnect(mySelectionMgr, 0, this, 0);
+  setEnabled(false);
+}
+
+//=======================================================================
+// function : enterEvent()
+// purpose  : Event filter
+//=======================================================================
+void SMESHGUI_CreatePatternDlg::enterEvent (QEvent*)
+{
+  mySMESHGUI->EmitSignalDeactivateDialog();
+  setEnabled(true);
+  activateSelection();
+  connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), SLOT(onSelectionDone()));
+}
+
+//=================================================================================
+// function : closeEvent()
+// purpose  : Close dialog box
+//=================================================================================
+void SMESHGUI_CreatePatternDlg::closeEvent (QCloseEvent*)
+{
+  onClose();
+}
+
+//=======================================================================
+// function : onSelBtnClicked()
+// purpose  : SLOT. Called when -> button clicked.
+//=======================================================================
+void SMESHGUI_CreatePatternDlg::onSelBtnClicked()
+{
+  onSelectionDone();
+}
+
+//================================================================
+// function : autoExtension()
+// purpose  : Append extension to the file name
+//================================================================
+QString SMESHGUI_CreatePatternDlg::autoExtension (const QString& theFileName) const
+{
+  QString anExt = theFileName.section('.', -1);
+  return anExt != "smp" && anExt != "SMP" ? theFileName + ".smp" : theFileName;
+}
+
+//=======================================================================
+// function : displayPreview()
+// purpose  : Display preview
+//=======================================================================
+void SMESHGUI_CreatePatternDlg::displayPreview()
+{
+  // Redisplay preview in dialog
+  try {
+    if (!myIsLoaded) {
+      erasePreview();
+    } else {
+      SMESH::point_array_var pnts = myPattern->GetPoints();
+      SMESH::long_array_var keyPoints = myPattern->GetKeyPoints();
+      SMESH::array_of_long_array_var elemPoints = myPattern->GetElementPoints(false);
+
+      if (pnts->length()       == 0 ||
+          keyPoints->length()  == 0 ||
+          elemPoints->length() == 0) {
+        myIsLoaded = false;
+        erasePreview();
+        return;
+      }
+
+      PointVector aPoints (pnts->length());
+      QValueVector<int> aKeyPoints (keyPoints->length());
+      ConnectivityVector anElemPoints (elemPoints->length());
+
+      for (int i = 0, n = pnts->length(); i < n; i++)
+        aPoints[ i ] = pnts[ i ];
+
+      for (int i2 = 0, n2 = keyPoints->length(); i2 < n2; i2++)
+        aKeyPoints[ i2 ] = keyPoints[ i2 ];
+
+      for (int i3 = 0, n3 = elemPoints->length(); i3 < n3; i3++) {
+        QValueVector<int> aVec (elemPoints[ i3 ].length());
+        for (int i4 = 0, n4 = elemPoints[ i3 ].length(); i4 < n4; i4++)
+          aVec[ i4 ] = elemPoints[ i3 ][ i4 ];
+
+        anElemPoints[ i3 ] = aVec;
+      }
+
+      myPicture2d->SetPoints(aPoints, aKeyPoints, anElemPoints);
+    }
+
+    return;
+
+  } catch (const SALOME::SALOME_Exception& S_ex) {
+    SalomeApp_Tools::QtCatchCorbaException(S_ex);
+  } catch (...) {
+  }
+  erasePreview();
+}
+
+//=======================================================================
+// function : erasePreview()
+// purpose  : Erase preview
+//=======================================================================
+void SMESHGUI_CreatePatternDlg::erasePreview()
+{
+  // Erase preview in 2D viewer
+  myPicture2d->SetPoints(PointVector(), QValueVector<int>(), ConnectivityVector());
+}
+
+//=======================================================================
+// function : activateSelection()
+// purpose  : Activate selection in accordance with current pattern type
+//=======================================================================
+void SMESHGUI_CreatePatternDlg::activateSelection()
+{
+  mySelectionMgr->clearFilters();
+  //SUIT_Application::getDesktop()->setSelectionModes(ActorSelection);
+  myViewWindow->SetSelectionMode(ActorSelection);
+
+  if (myType == Type_2d) {
+    mySelectionMgr->installFilter(new SMESH_NumberFilter
+      ("SMESH", TopAbs_SHAPE, -1, TopAbs_FACE));
+  } else {
+    TColStd_MapOfInteger aTypes;
+    aTypes.Add(TopAbs_SHELL);
+    aTypes.Add(TopAbs_SOLID);
+    mySelectionMgr->installFilter(new SMESH_NumberFilter
+      ("SMESH", TopAbs_FACE, 6, aTypes, GEOM::GEOM_Object::_nil(), true));
+  }
+}
+
+//=======================================================================
+// function : onTypeChanged()
+// purpose  : SLOT. Called when pattern type changed.
+//            Change dialog's look and feel
+//=======================================================================
+void SMESHGUI_CreatePatternDlg::onTypeChanged (int theType)
+{
+  if (myType == theType)
+    return;
+
+  myType = theType;
+
+  if (theType == Type_2d)
+    myPicture2d->show();
+  else
+    myPicture2d->hide();
+}
index 40fbfe1b749bd74b262452e97ecc546a66f1a887..d0ff40e63bb6966b85d8e12d26d4bb2ce0fc12ec 100755 (executable)
-//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,\r
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS \r
-// \r
-//  This library is free software; you can redistribute it and/or \r
-//  modify it under the terms of the GNU Lesser General Public \r
-//  License as published by the Free Software Foundation; either \r
-//  version 2.1 of the License. \r
-// \r
-//  This library is distributed in the hope that it will be useful, \r
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of \r
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU \r
-//  Lesser General Public License for more details. \r
-// \r
-//  You should have received a copy of the GNU Lesser General Public \r
-//  License along with this library; if not, write to the Free Software \r
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA \r
-// \r
-//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org \r
-//\r
-//\r
-//\r
-//  File   : SMESHGUI_CreatePatternDlg.h\r
-//  Author : Sergey LITONIN\r
-//  Module : SMESH\r
-\r
-\r
-#ifndef SMESHGUI_CreatePatternDlg_H\r
-#define SMESHGUI_CreatePatternDlg_H\r
-\r
-#include <qdialog.h>\r
-\r
-// IDL Headers\r
-#include <SALOMEconfig.h>\r
-#include CORBA_SERVER_HEADER(GEOM_Gen)\r
-#include CORBA_SERVER_HEADER(SMESH_Mesh)\r
-#include CORBA_SERVER_HEADER(SMESH_Pattern)\r
-\r
-class SMESHGUI_PatternWidget;\r
-class QCloseEvent;\r
-class QFrame;\r
-class QLineEdit;\r
-class SMESHGUI_SpinBox;\r
-class QPushButton;\r
-class SALOME_Selection;\r
-class QRadioButton;\r
-class QCheckBox;\r
-class QButtonGroup;\r
-class QLabel;\r
-\r
-/*\r
-  Class       : SMESHGUI_CreatePatternDlg\r
-  Description : Dialog to specify filters for VTK viewer\r
-*/\r
-\r
-class SMESHGUI_CreatePatternDlg : public QDialog\r
-{\r
-  Q_OBJECT\r
-\r
-public:\r
-  \r
-  enum { Type_2d, Type_3d };\r
-\r
-public:\r
-                              SMESHGUI_CreatePatternDlg( QWidget*,\r
-                                                         SALOME_Selection*,\r
-                                                         const int,\r
-                                                         const char* = 0 );\r
-  virtual                     ~SMESHGUI_CreatePatternDlg();\r
-\r
-  void                        Init( SALOME_Selection*, const int );\r
-  QString                     GetPatternName() const;\r
-  SMESH::SMESH_Pattern_ptr    GetPattern();\r
-  void                        SetMesh( SMESH::SMESH_Mesh_ptr );\r
-  \r
-signals:\r
-\r
-  void                        NewPattern();\r
-  void                        Close();\r
-    \r
-private:\r
-\r
-  void                        closeEvent( QCloseEvent* e ) ;\r
-  void                        enterEvent ( QEvent * ) ;            \r
-  \r
-private slots:\r
-\r
-  void                        onOk();\r
-  void                        onSave();\r
-  void                        onClose();\r
-\r
-  void                        onDeactivate();\r
-\r
-  void                        onSelectionDone();\r
-  void                        onTypeChanged( int );\r
-  void                        onProject( bool );\r
-  void                        onSelBtnClicked();\r
-\r
-private:\r
-\r
-  QFrame*                     createButtonFrame( QWidget* );\r
-  QFrame*                     createMainFrame  ( QWidget* );\r
-  void                        displayPreview();\r
-  void                        erasePreview();\r
-  void                        activateSelection();\r
-  QString                     autoExtension( const QString& theFileName ) const;\r
-  bool                        isValid();\r
-  bool                        loadFromObject( const bool = true );\r
-  QString                     getDefaultName() const;\r
-  GEOM::GEOM_Object_ptr       getGeom( SALOMEDS::SObject_ptr );\r
-\r
-private:\r
-\r
-  QPushButton*                myOkBtn;\r
-  QPushButton*                mySaveBtn;\r
-  QPushButton*                myCloseBtn;\r
-\r
-  QButtonGroup*               myTypeGrp;\r
-  QRadioButton*               mySwitch2d;\r
-  QRadioButton*               mySwitch3d;\r
-  QRadioButton*               mySwitchSMESH_Pattern3d;\r
-\r
-  QLineEdit*                  myMeshEdit;\r
-  QLineEdit*                  myName;\r
-\r
-  SMESHGUI_PatternWidget*     myPicture2d;\r
-  \r
-  QCheckBox*                  myProjectChk;\r
-    \r
-  SALOME_Selection*           mySelection;\r
-  int                         myNbPoints;\r
-  int                         myType;\r
-\r
-  SMESH::SMESH_Mesh_var       myMesh;\r
-  SMESH::SMESH_subMesh_var    mySubMesh;\r
-  GEOM::GEOM_Object_var       myGeomObj;\r
-\r
-  SMESH::SMESH_Pattern_var    myPattern;\r
-  bool                        myIsLoaded;\r
-};\r
-\r
-#endif\r
-\r
-\r
-\r
-\r
-\r
-\r
-\r
-\r
-\r
-\r
-\r
-\r
-\r
-\r
-\r
-\r
-\r
+//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//
+//  File   : SMESHGUI_CreatePatternDlg.h
+//  Author : Sergey LITONIN
+//  Module : SMESH
+
+
+#ifndef SMESHGUI_CreatePatternDlg_H
+#define SMESHGUI_CreatePatternDlg_H
+
+#include <qdialog.h>
+
+// IDL Headers
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(GEOM_Gen)
+#include CORBA_SERVER_HEADER(SMESH_Mesh)
+#include CORBA_SERVER_HEADER(SMESH_Pattern)
+
+class SMESHGUI_PatternWidget;
+class SALOMEDSClient_SObject;
+
+class QCloseEvent;
+class QFrame;
+class QLineEdit;
+class SMESHGUI_SpinBox;
+class QPushButton;
+class SalomeApp_SelectionMgr;
+class QRadioButton;
+class QCheckBox;
+class QButtonGroup;
+class QLabel;
+class SVTK_ViewWindow;
+class SVTK_Selector;
+class SMESHGUI;
+
+/*!
+ *  Class       : SMESHGUI_CreatePatternDlg
+ *  Description : Dialog to specify filters for VTK viewer
+ */
+
+class SMESHGUI_CreatePatternDlg : public QDialog
+{
+  Q_OBJECT
+
+public:
+  enum { Type_2d, Type_3d };
+
+public:
+                           SMESHGUI_CreatePatternDlg( SMESHGUI*,
+                                                     const int,
+                                                     const char* = 0);
+  virtual                  ~SMESHGUI_CreatePatternDlg();
+
+  void                     Init(const int);
+  QString                  GetPatternName() const;
+  SMESH::SMESH_Pattern_ptr GetPattern();
+  void                     SetMesh (SMESH::SMESH_Mesh_ptr);
+
+signals:
+
+  void                     NewPattern();
+  void                     Close();
+
+private:
+
+  void                     closeEvent (QCloseEvent* e);
+  void                     enterEvent (QEvent*);
+
+private slots:
+
+  void                     onOk();
+  void                     onSave();
+  void                     onClose();
+
+  void                     onDeactivate();
+
+  void                     onSelectionDone();
+  void                     onTypeChanged (int);
+  void                     onProject (bool);
+  void                     onSelBtnClicked();
+
+private:
+
+  QFrame*                  createButtonFrame (QWidget*);
+  QFrame*                  createMainFrame   (QWidget*);
+  void                     displayPreview();
+  void                     erasePreview();
+  void                     activateSelection();
+  QString                  autoExtension (const QString& theFileName) const;
+  bool                     isValid();
+  bool                     loadFromObject (const bool = true);
+  QString                  getDefaultName() const;
+  GEOM::GEOM_Object_ptr    getGeom (SALOMEDSClient_SObject*) const;
+
+private:
+
+  QPushButton*             myOkBtn;
+  QPushButton*             mySaveBtn;
+  QPushButton*             myCloseBtn;
+
+  QButtonGroup*            myTypeGrp;
+  QRadioButton*            mySwitch2d;
+  QRadioButton*            mySwitch3d;
+  QRadioButton*            mySwitchSMESH_Pattern3d;
+
+  QLineEdit*               myMeshEdit;
+  QLineEdit*               myName;
+
+  SMESHGUI_PatternWidget*  myPicture2d;
+
+  QCheckBox*               myProjectChk;
+
+  SMESHGUI*                mySMESHGUI;
+  SVTK_ViewWindow*         myViewWindow;
+  SVTK_Selector*           mySelector;
+  SalomeApp_SelectionMgr*  mySelectionMgr;
+  int                      myNbPoints;
+  int                      myType;
+
+  SMESH::SMESH_Mesh_var    myMesh;
+  SMESH::SMESH_subMesh_var mySubMesh;
+  GEOM::GEOM_Object_var    myGeomObj;
+
+  SMESH::SMESH_Pattern_var myPattern;
+  bool                     myIsLoaded;
+};
+
+#endif
diff --git a/src/SMESHGUI/SMESHGUI_CreatePolyhedralVolumeDlg.cxx b/src/SMESHGUI/SMESHGUI_CreatePolyhedralVolumeDlg.cxx
new file mode 100644 (file)
index 0000000..3a572c8
--- /dev/null
@@ -0,0 +1,1003 @@
+//  SMESH SMESHGUI : GUI for SMESH component
+//
+//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
+// 
+//  This library is free software; you can redistribute it and/or 
+//  modify it under the terms of the GNU Lesser General Public 
+//  License as published by the Free Software Foundation; either 
+//  version 2.1 of the License. 
+// 
+//  This library is distributed in the hope that it will be useful, 
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of 
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
+//  Lesser General Public License for more details. 
+// 
+//  You should have received a copy of the GNU Lesser General Public 
+//  License along with this library; if not, write to the Free Software 
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
+// 
+//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+//
+//
+//
+//  File   : SMESHGUI_CreatePolyhedralVolumeDlg.cxx
+//  Author : Michael ZORIN
+//  Module : SMESH
+//  $Header: 
+
+#include "SMESHGUI_CreatePolyhedralVolumeDlg.h"
+
+#include "SMESHGUI.h"
+#include "SMESHGUI_Utils.h"
+#include "SMESHGUI_VTKUtils.h"
+#include "SMESHGUI_MeshUtils.h"
+#include "SMESHGUI_IdValidator.h"
+#include "SMESH_ActorUtils.h"
+#include "SMESHGUI_SpinBox.h"
+#include "SMESH_Actor.h"
+#include "SMESH_TypeFilter.hxx"
+#include "SMDS_Mesh.hxx"
+
+#include "VTKViewer_ViewWindow.h"
+
+#include "SUIT_ResourceMgr.h"
+
+#include "SalomeApp_Application.h"
+#include "SalomeApp_Study.h"
+#include "SUIT_Desktop.h"
+#include "SUIT_MessageBox.h"
+#include "SalomeApp_SelectionMgr.h"
+#include "utilities.h"
+
+#include "SVTK_ViewWindow.h"
+#include "SVTK_Selector.h"
+
+#include <TColStd_MapIteratorOfMapOfInteger.hxx>
+#include <TColStd_ListOfInteger.hxx>
+#include <TColStd_ListIteratorOfListOfInteger.hxx>
+
+#include <vtkCell.h>
+#include <vtkIdList.h>
+#include <vtkIntArray.h>
+#include <vtkCellArray.h>
+#include <vtkUnsignedCharArray.h>
+#include <vtkUnstructuredGrid.h>
+#include <vtkDataSetMapper.h>
+
+// QT Includes
+#include <qapplication.h>
+#include <qbuttongroup.h>
+#include <qgroupbox.h>
+#include <qlabel.h>
+#include <qlineedit.h>
+#include <qpushbutton.h>
+#include <qradiobutton.h>
+#include <qcheckbox.h>
+#include <qlayout.h>
+#include <qspinbox.h> 
+#include <qpixmap.h>
+#include <qlistbox.h>
+
+// IDL Headers
+#include "SALOMEconfig.h"
+#include CORBA_SERVER_HEADER(SMESH_Group)
+
+using namespace std;
+
+namespace SMESH{
+
+class TPolySimulation{
+    SVTK_ViewWindow* myViewWindow;
+
+    SALOME_Actor *myPreviewActor;
+    vtkDataSetMapper* myMapper;
+    vtkUnstructuredGrid* myGrid;
+
+  public:
+
+    TPolySimulation(SalomeApp_Application* app)
+    {
+      SUIT_ViewManager* mgr = app->activeViewManager();
+      myViewWindow = mgr ? dynamic_cast<SVTK_ViewWindow*>( mgr->getActiveView() ) : NULL;
+
+      myGrid = vtkUnstructuredGrid::New();
+  
+      // Create and display actor
+      myMapper = vtkDataSetMapper::New();
+      myMapper->SetInput( myGrid );
+
+      myPreviewActor = SALOME_Actor::New();
+      myPreviewActor->PickableOff();
+      myPreviewActor->VisibilityOff();
+      myPreviewActor->SetMapper( myMapper );
+
+      vtkProperty* aProp = vtkProperty::New();
+      float anRGB[3];
+      anRGB[0] = GetFloat("SMESH:SettingsFillColorRed", 0)/255.;
+      anRGB[1] = GetFloat("SMESH:SettingsFillColorGreen", 170)/255.;
+      anRGB[2] = GetFloat("SMESH:SettingsFillColorBlue", 255)/255.;
+      aProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
+      myPreviewActor->SetProperty( aProp );
+      aProp->Delete();
+
+      vtkProperty* aBackProp = vtkProperty::New();
+      anRGB[0] = GetFloat("SMESH:SettingsBackFaceColorRed", 0)/255.;
+      anRGB[1] = GetFloat("SMESH:SettingsBackFaceColorGreen", 0)/255.;
+      anRGB[2] = GetFloat("SMESH:SettingsBackFaceColorBlue", 255)/255.;
+      aBackProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
+      myPreviewActor->SetBackfaceProperty( aBackProp );
+      aBackProp->Delete();
+
+      myViewWindow->AddActor( myPreviewActor );
+
+    }
+
+
+    typedef std::vector<vtkIdType> TVTKIds;
+    void SetPosition(SMESH_Actor* theActor, 
+                    vtkIdType theType, 
+                    const TVTKIds& theIds,
+                    bool theReset=true)
+    {
+      vtkUnstructuredGrid *aGrid = theActor->GetUnstructuredGrid();
+      myGrid->SetPoints(aGrid->GetPoints());
+
+      if (theReset) ResetGrid(theReset);
+      
+      vtkIdList *anIds = vtkIdList::New();
+
+      for (int i = 0, iEnd = theIds.size(); i < iEnd; i++)
+       anIds->InsertId(i,theIds[i]);
+
+      myGrid->InsertNextCell(theType,anIds);
+      anIds->Delete();
+
+      myGrid->Modified();
+
+      SetVisibility(true);
+    }
+  
+    void ResetGrid(bool theReset=true){
+      if (theReset) myGrid->Reset();
+    }
+
+    void SetVisibility(bool theVisibility){
+      myPreviewActor->SetVisibility(theVisibility);
+      RepaintCurrentView();
+    }
+
+
+    ~TPolySimulation(){
+        if( myViewWindow )
+         myViewWindow->RemoveActor(myPreviewActor);
+
+      myPreviewActor->Delete();
+
+      myMapper->RemoveAllInputs();
+      myMapper->Delete();
+
+      myGrid->Delete();
+    }
+
+  };
+}
+
+//=================================================================================
+// class    : SMESHGUI_CreatePolyhedralVolumeDlgDlg()
+// purpose  : 
+//=================================================================================
+SMESHGUI_CreatePolyhedralVolumeDlg::SMESHGUI_CreatePolyhedralVolumeDlg( SMESHGUI* theModule, const char* name,
+                                                                       bool modal, WFlags fl )
+  : QDialog( SMESH::GetDesktop( theModule ), name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | Qt::WDestructiveClose),
+    mySMESHGUI( theModule ),
+    mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ),
+    myViewWindow( SMESH::GetViewWindow( theModule ) ),
+    mySelector( myViewWindow->GetSelector() )
+{
+  QPixmap image0( SMESHGUI::resourceMgr()->loadPixmap( "SMESH",tr("ICON_SELECT")));
+
+  if ( !name )
+    setName( "SMESHGUI_CreatePolyhedralVolumeDlg" );
+  resize( 300, 185 ); 
+  setCaption( tr( "SMESH_CREATE_POLYHEDRAL_VOLUME_TITLE" ) );
+  setSizeGripEnabled( TRUE );
+  SMESHGUI_CreatePolyhedralVolumeDlgLayout = new QGridLayout( this ); 
+  SMESHGUI_CreatePolyhedralVolumeDlgLayout->setSpacing( 6 );
+  SMESHGUI_CreatePolyhedralVolumeDlgLayout->setMargin( 11 );
+
+  /***************************************************************/
+  GroupConstructors = new QButtonGroup( this, "GroupConstructors" );
+  GroupConstructors->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)0, 0, 0, GroupConstructors->sizePolicy().hasHeightForWidth() ) );
+  GroupConstructors->setTitle( tr( "SMESH_ELEMENTS_TYPE" ) );
+  GroupConstructors->setExclusive( TRUE );
+  GroupConstructors->setColumnLayout(0, Qt::Vertical );
+  GroupConstructors->layout()->setSpacing( 0 );
+  GroupConstructors->layout()->setMargin( 0 );
+  GroupConstructorsLayout = new QGridLayout( GroupConstructors->layout() );
+  GroupConstructorsLayout->setAlignment( Qt::AlignTop );
+  GroupConstructorsLayout->setSpacing( 6 );
+  GroupConstructorsLayout->setMargin( 11 );
+  RadioButton1= new QRadioButton( GroupConstructors, "RadioButton1" );
+  RadioButton1->setText( tr( "MESH_NODE"  ) );
+  GroupConstructorsLayout->addWidget( RadioButton1, 0, 0 );
+  RadioButton2= new QRadioButton( GroupConstructors, "RadioButton2" );
+  RadioButton2->setText( tr( "SMESH_FACE"  ) );
+  GroupConstructorsLayout->addWidget( RadioButton2, 0, 2  );
+  SMESHGUI_CreatePolyhedralVolumeDlgLayout->addWidget( GroupConstructors, 0, 0 );
+  
+  /***************************************************************/
+  GroupButtons = new QGroupBox( this, "GroupButtons" );
+  GroupButtons->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, GroupButtons->sizePolicy().hasHeightForWidth() ) );
+  GroupButtons->setGeometry( QRect( 10, 10, 281, 48 ) ); 
+  GroupButtons->setTitle( tr( ""  ) );
+  GroupButtons->setColumnLayout(0, Qt::Vertical );
+  GroupButtons->layout()->setSpacing( 0 );
+  GroupButtons->layout()->setMargin( 0 );
+  GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
+  GroupButtonsLayout->setAlignment( Qt::AlignTop );
+  GroupButtonsLayout->setSpacing( 6 );
+  GroupButtonsLayout->setMargin( 11 );
+  buttonCancel = new QPushButton( GroupButtons, "cancel" );
+  buttonCancel->setText( tr( "SMESH_BUT_CLOSE"  ) );
+  buttonCancel->setAutoDefault( TRUE );
+  GroupButtonsLayout->addWidget( buttonCancel, 0, 3 );
+  buttonApply = new QPushButton( GroupButtons, "apply" );
+  buttonApply->setText( tr( "SMESH_BUT_APPLY"  ) );
+  buttonApply->setAutoDefault( TRUE );
+  GroupButtonsLayout->addWidget( buttonApply, 0, 1 );
+  QSpacerItem* spacer_9 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
+  GroupButtonsLayout->addItem( spacer_9, 0, 2 );
+  buttonOk = new QPushButton( GroupButtons, "ok" );
+  buttonOk->setText( tr( "SMESH_BUT_OK"  ) );
+  buttonOk->setAutoDefault( TRUE );
+  buttonOk->setDefault( TRUE );
+  GroupButtonsLayout->addWidget( buttonOk, 0, 0 );
+  SMESHGUI_CreatePolyhedralVolumeDlgLayout->addWidget( GroupButtons, 2, 0 );
+
+  /***************************************************************/
+  GroupContent = new QGroupBox( this, "GroupContent" );
+  GroupContent->setTitle( tr( "SMESH_CONTENT" ) );
+  GroupContent->setColumnLayout(0, Qt::Vertical );
+  GroupContent->layout()->setSpacing( 0 );
+  GroupContent->layout()->setMargin( 0 );
+  GroupContentLayout = new QGridLayout( GroupContent->layout() );
+  GroupContentLayout->setAlignment( Qt::AlignTop );
+  GroupContentLayout->setSpacing( 6 );
+  GroupContentLayout->setMargin( 11 );
+
+  QFrame* anIds = new QFrame(GroupContent, "anIds");
+  QGridLayout* aLayout = new QGridLayout(anIds, 1, 3);
+  aLayout->setSpacing(6);
+  aLayout->setAutoAdd(false);
+  
+  TextLabelIds = new QLabel( anIds, "TextLabelIds" );
+  TextLabelIds->setText( tr( "SMESH_ID_NODES" ) );
+  TextLabelIds->setFixedWidth(74);
+  aLayout->addWidget( TextLabelIds, 0, 0 );
+
+  SelectElementsButton  = new QPushButton( anIds, "SelectElementsButton" );
+  SelectElementsButton->setText( tr( "" ) );
+  SelectElementsButton->setPixmap( image0 );
+  SelectElementsButton->setToggleButton( FALSE );
+  aLayout->addWidget( SelectElementsButton, 0, 1 );
+
+  LineEditElements  = new QLineEdit( anIds, "LineEditElements" );
+  LineEditElements->setValidator( new SMESHGUI_IdValidator( this, "validator" ));
+  aLayout->addWidget( LineEditElements, 0, 2 );
+  
+  GroupContentLayout->addMultiCellWidget(anIds, 0, 0, 0, 1);
+
+  myFacesByNodesLabel = new QLabel(GroupContent, "faces by nodes label");
+  myFacesByNodesLabel->setText(tr("FACES_BY_NODES"));
+  GroupContentLayout->addWidget( myFacesByNodesLabel, 1, 0 );
+
+  myFacesByNodes = new QListBox(GroupContent, "faces by nodes list");
+  myFacesByNodes->setSelectionMode(QListBox::Extended);
+  myFacesByNodes->setMinimumHeight(150);
+  GroupContentLayout->addMultiCellWidget( myFacesByNodes, 2, 4, 0, 0 );
+
+  AddButton = new QPushButton(GroupContent, "add");
+  AddButton->setText(tr("SMESH_BUT_ADD"));
+  AddButton->setMaximumWidth(85);
+  GroupContentLayout->addWidget( AddButton, 2, 1 );
+
+  RemoveButton = new QPushButton(GroupContent, "remove");
+  RemoveButton->setText(tr("SMESH_BUT_REMOVE"));
+  RemoveButton->setMaximumWidth(85);
+  GroupContentLayout->addWidget( RemoveButton, 3, 1 );
+
+  Preview = new QCheckBox( GroupContent, "Preview" );
+  Preview->setText( tr( "SMESH_POLYEDRE_PREVIEW"  ) );
+  GroupContentLayout->addWidget( Preview , 5, 0 );
+  
+  SMESHGUI_CreatePolyhedralVolumeDlgLayout->addWidget( GroupContent, 1, 0 );
+  
+  GroupContent->show();
+  RadioButton1->setChecked( TRUE );
+  mySMESHGUI->SetActiveDialogBox( (QDialog*)this ) ;
+  
+  Init();
+}
+
+//=================================================================================
+// function : ~SMESHGUI_CreatePolyhedralVolumeDlg()
+// purpose  : Destroys the object and frees any allocated resources
+//=================================================================================
+SMESHGUI_CreatePolyhedralVolumeDlg::~SMESHGUI_CreatePolyhedralVolumeDlg()
+{
+  // no need to delete child widgets, Qt does it all for us
+  delete mySimulation;
+}
+
+static bool busy = false;
+//=================================================================================
+// function : Init()
+// purpose  :
+//=================================================================================
+void SMESHGUI_CreatePolyhedralVolumeDlg::Init()
+{
+  myEditCurrentArgument = LineEditElements;
+  mySMESHGUI->SetActiveDialogBox( (QDialog*)this ) ;
+
+  myNbOkElements = 0;
+  myActor = 0;
+
+  mySimulation = new SMESH::TPolySimulation( dynamic_cast<SalomeApp_Application*>( mySMESHGUI->application() ) );
+
+  /* signals and slots connections */
+  connect(buttonOk, SIGNAL( clicked() ),     SLOT( ClickOnOk() ) );
+  connect(buttonCancel, SIGNAL( clicked() ), SLOT( ClickOnCancel() ) ) ;
+  connect(buttonApply, SIGNAL( clicked() ),  SLOT(ClickOnApply() ) );
+
+  connect( GroupConstructors, SIGNAL(clicked(int) ), SLOT( ConstructorsClicked(int) ) );
+  connect(SelectElementsButton, SIGNAL( clicked() ), SLOT( SetEditCurrentArgument() ) ) ;
+  connect(LineEditElements, SIGNAL( textChanged(const QString&) ), SLOT(onTextChange(const QString&)));
+
+  connect(myFacesByNodes, SIGNAL(selectionChanged()), this, SLOT(onListSelectionChanged()));
+  connect(AddButton, SIGNAL(clicked()), this, SLOT(onAdd()));
+  connect(RemoveButton, SIGNAL(clicked()), this, SLOT(onRemove()));
+  
+  connect( mySMESHGUI, SIGNAL ( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ;
+  connect( mySelectionMgr, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
+  connect( Preview, SIGNAL(toggled(bool)), this, SLOT(ClickOnPreview(bool)));
+  /* to close dialog if study change */
+  connect( mySMESHGUI, SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ) ;
+  
+  /* Move widget on the botton right corner of main widget */
+  int x, y ;
+  mySMESHGUI->DefineDlgPosition( this, x, y ) ;
+  this->move( x, y ) ;
+  this->show() ; /* displays Dialog */
+
+  ConstructorsClicked(0);
+  SelectionIntoArgument();
+}
+
+
+//=================================================================================
+// function : ConstructorsClicked()
+// purpose  : Radio button management
+//=================================================================================
+void SMESHGUI_CreatePolyhedralVolumeDlg::ConstructorsClicked(int constructorId)
+{
+  disconnect(mySelectionMgr, 0, this, 0);
+
+  SALOME_ListIO aList;
+  mySelectionMgr->setSelectedObjects( aList );
+  myEditCurrentArgument->clear();
+  myNbOkElements = 0;
+  buttonApply->setEnabled(false);
+  buttonOk->setEnabled(false);
+  mySimulation->SetVisibility(false);
+
+  switch(constructorId)
+    {
+    case 0 :
+      { 
+       if ( myActor ){
+          myActor->SetPointRepresentation(true);
+       }
+        else
+          SMESH::SetPointRepresentation(true);
+       myViewWindow->SetSelectionMode(NodeSelection);
+       
+       AddButton->setEnabled(false);
+       RemoveButton->setEnabled(false);
+       TextLabelIds->setText( tr( "SMESH_ID_NODES" ) );
+       myFacesByNodesLabel->show();
+       myFacesByNodes->clear();
+       myFacesByNodes->show();
+       AddButton->show();
+       RemoveButton->show();
+       Preview->show();
+       break;
+      }
+    case 1 :
+      {
+       SMESH::SetPointRepresentation(false);
+       myViewWindow->SetSelectionMode(FaceSelection);
+       
+       TextLabelIds->setText( tr( "SMESH_ID_FACES" ) );
+       myFacesByNodesLabel->hide();
+       myFacesByNodes->hide();
+       AddButton->hide();
+       RemoveButton->hide();
+       Preview->show();
+       break;
+      }
+    }
+  
+  connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
+}
+
+//=================================================================================
+// function : ClickOnPreview()
+// purpose  :
+//=================================================================================
+void SMESHGUI_CreatePolyhedralVolumeDlg::ClickOnPreview(bool theToggled){
+  Preview->setChecked(theToggled);
+  displaySimulation();
+}
+
+//=================================================================================
+// function : ClickOnApply()
+// purpose  :
+//=================================================================================
+void SMESHGUI_CreatePolyhedralVolumeDlg::ClickOnApply()
+{
+  if ( myNbOkElements>0 && !mySMESHGUI->isActiveStudyLocked())
+    {
+      busy = true;
+      if (GetConstructorId() == 0)
+       {
+         SMESH::long_array_var anIdsOfNodes = new SMESH::long_array;
+         SMESH::long_array_var aQuantities  = new SMESH::long_array;
+
+         aQuantities->length( myFacesByNodes->count() );
+
+         TColStd_ListOfInteger aNodesIds;
+
+         QListBoxItem* anItem;
+         int aNbQuantities = 0;
+         for (anItem = myFacesByNodes->firstItem(); anItem != 0; anItem = anItem->next()) {
+           QStringList anIds = QStringList::split(" ", anItem->text());
+           int aNbNodesInFace = 0;
+           for (QStringList::iterator it = anIds.begin(); it != anIds.end(); ++it, ++aNbNodesInFace)
+             aNodesIds.Append( (*it).toInt() );
+
+           aQuantities[aNbQuantities++] = aNbNodesInFace;
+         }
+
+         anIdsOfNodes->length(aNodesIds.Extent());
+
+         int aNbIdsOfNodes = 0;
+         TColStd_ListIteratorOfListOfInteger It;
+         It.Initialize(aNodesIds);
+         for(;It.More();It.Next())
+           anIdsOfNodes[aNbIdsOfNodes++] = It.Value();
+           
+         try{
+           SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
+           QApplication::setOverrideCursor(Qt::waitCursor);
+           aMeshEditor->AddPolyhedralVolume(anIdsOfNodes, aQuantities);
+           QApplication::restoreOverrideCursor();
+         }catch(SALOME::SALOME_Exception& exc){
+           INFOS("Follow exception was cought:\n\t"<<exc.details.text);
+         }catch(std::exception& exc){
+           INFOS("Follow exception was cought:\n\t"<<exc.what());
+         }catch(...){
+           INFOS("Unknown exception was cought !!!");
+         }
+       }
+      else if (GetConstructorId() == 1)
+       {
+         SMESH::long_array_var anIdsOfFaces = new SMESH::long_array;
+         
+         QStringList aListId = QStringList::split( " ", myEditCurrentArgument->text() );
+         anIdsOfFaces->length(aListId.count());
+         for ( int i = 0; i < aListId.count(); i++ )
+           anIdsOfFaces[i] = aListId[i].toInt();
+         
+         try{
+           SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
+           QApplication::setOverrideCursor(Qt::waitCursor);
+           aMeshEditor->AddPolyhedralVolumeByFaces(anIdsOfFaces);
+           QApplication::restoreOverrideCursor();
+         }catch(SALOME::SALOME_Exception& exc){
+           INFOS("Follow exception was cought:\n\t"<<exc.details.text);
+         }catch(std::exception& exc){
+           INFOS("Follow exception was cought:\n\t"<<exc.what());
+         }catch(...){
+           INFOS("Unknown exception was cought !!!");
+         }
+       }
+      
+      SALOME_ListIO aList;
+      mySelectionMgr->setSelectedObjects( aList );
+      mySimulation->SetVisibility(false);
+      SMESH::UpdateView();
+      ConstructorsClicked( GetConstructorId() );
+      busy = false;
+    }
+}
+
+//=================================================================================
+// function : ClickOnOk()
+// purpose  :
+//=================================================================================
+void SMESHGUI_CreatePolyhedralVolumeDlg::ClickOnOk()
+{
+  ClickOnApply() ;
+  ClickOnCancel() ;
+}
+
+       
+//=================================================================================
+// function : ClickOnCancel()
+// purpose  :
+//=================================================================================
+void SMESHGUI_CreatePolyhedralVolumeDlg::ClickOnCancel()
+{
+  mySelectionMgr->clearFilters();
+  SALOME_ListIO aList;
+  mySelectionMgr->setSelectedObjects( aList );
+  SMESH::SetPointRepresentation(false);
+  mySimulation->SetVisibility(false);
+  myViewWindow->SetSelectionMode( ActorSelection );
+  disconnect( mySelectionMgr, 0, this, 0 );
+  mySMESHGUI->ResetState() ;
+  reject() ;
+}
+
+//=======================================================================
+//function : onTextChange
+//purpose  : 
+//=======================================================================
+
+void SMESHGUI_CreatePolyhedralVolumeDlg::onTextChange(const QString& theNewText)
+{
+  if ( busy ) return;
+  busy = true;
+
+  mySimulation->SetVisibility(false);
+
+  SMDS_Mesh* aMesh = 0;
+  if ( myActor )
+    aMesh = myActor->GetObject()->GetMesh();
+
+  if (GetConstructorId() == 0)
+  {
+    if ( aMesh ) {
+      SALOME_ListIO aList; aList.Append( myActor->getIO() );
+      mySelectionMgr->setSelectedObjects( aList );
+
+      TColStd_IndexedMapOfInteger selectedIndices;
+      TColStd_MapOfInteger newIndices;
+      mySelector->GetIndex( myActor->getIO(), selectedIndices);
+
+      QStringList aListId = QStringList::split( " ", theNewText, false);
+      for ( int i = 0; i < aListId.count(); i++ ) {
+       const SMDS_MeshNode * n = aMesh->FindNode( aListId[ i ].toInt() );
+       if ( n ) {
+           /*if ( mySelectionMgr->IsIndexSelected( myActor->getIO(), n->GetID() ))
+             allOk = false;
+           else
+             mySelectionMgr->AddOrRemoveIndex (myActor->getIO(), n->GetID(), true);*/
+         if (selectedIndices.Add(n->GetID()))
+           newIndices.Add(n->GetID());
+         myNbOkElements++;
+        }
+      }
+
+      if (newIndices.Extent() > 0){
+       mySelector->AddOrRemoveIndex( myActor->getIO(), newIndices, true );
+       myViewWindow->highlight( myActor->getIO(), true, true );
+      }
+
+/*     bool aNodesOK = false;
+       if (aListId.count() >= 3)
+         aNodesOK = true;
+
+       allOk = (allOk && aNodesOK);*/
+       
+      if ( myNbOkElements>0 && aListId.count()>=3)
+       AddButton->setEnabled(true);
+       else
+         AddButton->setEnabled(false);
+
+//     if (allOk && !myOkElements)
+       displaySimulation();
+      }
+    }
+  else if (GetConstructorId() == 1)
+  {
+    myNbOkElements = 0;
+    buttonOk->setEnabled( false );
+    buttonApply->setEnabled( false );
+      
+      // check entered ids of faces and hilight them
+    QStringList aListId;
+    if ( aMesh ) {
+      SALOME_ListIO aList; aList.Append( myActor->getIO() );
+      mySelectionMgr->setSelectedObjects( aList );
+
+      TColStd_IndexedMapOfInteger selectedIndices;
+      TColStd_MapOfInteger newIndices;
+      mySelector->GetIndex( myActor->getIO(), selectedIndices);
+
+      aListId = QStringList::split( " ", theNewText, false);
+
+      for ( int i = 0; i < aListId.count(); i++ ) {
+       const SMDS_MeshElement * e = aMesh->FindElement( aListId[ i ].toInt() );
+       if ( e ) {
+         /*if ( mySelectionMgr->IsIndexSelected( myActor->getIO(), e->GetID() ))
+           myOkElements = false;
+         else
+           mySelectionMgr->AddOrRemoveIndex (myActor->getIO(), e->GetID(), true);*/
+         if (selectedIndices.Add(e->GetID()))
+             newIndices.Add(e->GetID());
+         myNbOkElements++;  
+       }
+      }
+
+      if (newIndices.Extent() > 0){
+       mySelector->AddOrRemoveIndex( myActor->getIO(), newIndices, true );
+       myViewWindow->highlight( myActor->getIO(), true, true );
+      }
+
+      if ( myNbOkElements ) {
+       if (aListId.count()>1){ 
+         buttonOk->setEnabled( true );
+         buttonApply->setEnabled( true );
+       }
+       else{
+         buttonOk->setEnabled( false );
+         buttonApply->setEnabled( false );
+       }
+       displaySimulation();
+      }
+    }
+  }
+  busy = false;
+}
+
+//=================================================================================
+// function : SelectionIntoArgument()
+// purpose  : Called when selection as changed or other case
+//=================================================================================
+void SMESHGUI_CreatePolyhedralVolumeDlg::SelectionIntoArgument()
+{
+  if ( busy ) return;
+  
+  // clear
+  
+  if (GetConstructorId() == 1 || myFacesByNodes->count() <= 1)
+    {
+      myNbOkElements = 0;
+      AddButton->setEnabled(false);
+      buttonOk->setEnabled( false );
+      buttonApply->setEnabled( false );
+    }
+
+  myActor = 0;
+
+  busy = true;
+  myEditCurrentArgument->setText( "" );
+  busy = false;
+  if ( !GroupButtons->isEnabled() ) // inactive
+    return;
+  
+  mySimulation->SetVisibility(false);
+  
+  // get selected mesh
+  
+  SALOME_ListIO selected;
+  mySelectionMgr->selectedObjects( selected );
+  int nbSel = selected.Extent();
+  if(nbSel != 1){
+    return;
+  }
+  
+  myMesh = SMESH::GetMeshByIO( selected.First() );
+  if ( myMesh->_is_nil() )
+    return;
+  
+  myActor = SMESH::FindActorByObject(myMesh);
+  if ( !myActor )
+    return;
+  
+  // get selected nodes/faces
+  QString aString = "";
+  switch(GetConstructorId()){
+  case 0:{
+    int anbNodes = SMESH::GetNameOfSelectedNodes(mySelector, myActor->getIO(), aString);
+    if (anbNodes >= 3)
+      AddButton->setEnabled(true);
+    else 
+      break;
+    busy = true;
+    myEditCurrentArgument->setText( aString );
+    busy = false;
+    break;
+  }
+  case 1:{
+    // get selected faces
+    int aNbFaces = SMESH::GetNameOfSelectedElements(mySelector, myActor->getIO(), aString);
+    if (aNbFaces<=1)
+      return;
+    busy = true;
+    myEditCurrentArgument->setText( aString );
+    busy = false;
+    
+    // OK
+    myNbOkElements = 1;
+    buttonOk->setEnabled( true );
+    buttonApply->setEnabled( true );
+    break;
+  }
+  default: return;
+  }
+  
+  displaySimulation();
+}
+
+//=======================================================================
+//function : displaySimulation
+//purpose  : 
+//=======================================================================
+void SMESHGUI_CreatePolyhedralVolumeDlg::displaySimulation()
+{
+  if ( (myNbOkElements || AddButton->isEnabled()) && GroupButtons->isEnabled() && myActor)
+    {
+      SMESH::TPolySimulation::TVTKIds aVTKIds;
+      vtkIdType aType = VTK_CONVEX_POINT_SET ;
+      if (GetConstructorId() == 0){
+       if(!Preview->isChecked()) myActor->SetEntityMode(SMESH_Actor::eFaces);
+       else myActor->SetEntityMode(SMESH_Actor::eVolumes);
+       if (!AddButton->isEnabled()){
+         QListBoxItem* anItem;
+         mySimulation->ResetGrid(true);
+         for (anItem = myFacesByNodes->firstItem(); anItem != 0; anItem = anItem->next()) {
+           QStringList anIds = QStringList::split(" ", anItem->text());
+           SMESH::TPolySimulation::TVTKIds aVTKIds_faces;
+           for (QStringList::iterator it = anIds.begin(); it != anIds.end(); ++it){
+             vtkIdType aId = myActor->GetObject()->GetNodeVTKId( (*it).toInt() ) ;
+             aVTKIds.push_back(aId);
+             aVTKIds_faces.push_back(aId);
+           }
+           if(!Preview->isChecked()){
+             aType = VTK_POLYGON;
+             mySimulation->SetPosition(myActor, aType, aVTKIds_faces,false);
+           }
+         }
+         if(Preview->isChecked()){
+           mySimulation->SetPosition(myActor, aType, aVTKIds);
+         }
+       } else {
+         // add ids from edit line
+         QStringList anEditIds = QStringList::split( " ", myEditCurrentArgument->text(), false);
+         myActor->SetEntityMode(SMESH_Actor::eFaces);
+         for ( int i = 0; i < anEditIds.count(); i++ )
+           aVTKIds.push_back( myActor->GetObject()->GetNodeVTKId( anEditIds[ i ].toInt() ));
+         aType = VTK_POLYGON;
+         mySimulation->SetPosition(myActor, aType, aVTKIds);
+       }
+      }else if(GetConstructorId() == 1){
+       SMDS_Mesh* aMesh = 0;
+       if ( myActor ){
+         aMesh = myActor->GetObject()->GetMesh();
+         if (Preview->isChecked())
+           myActor->SetEntityMode(SMESH_Actor::eVolumes);
+         else
+           myActor->SetEntityMode(SMESH_Actor::eFaces);
+       }
+       if ( aMesh ) {
+         QStringList aListId = QStringList::split( " ", myEditCurrentArgument->text(), false);
+         for ( int i = 0; i < aListId.count(); i++ )
+           {
+             const SMDS_MeshElement * anElem = aMesh->FindElement( aListId[ i ].toInt() );
+             if ( !anElem )
+               return;
+             
+             SMDS_ElemIteratorPtr anIter = anElem->nodesIterator();
+             SMESH::TPolySimulation::TVTKIds aVTKIds_faces;
+             while( anIter->more() )
+               if ( const SMDS_MeshNode* aNode = (SMDS_MeshNode*)anIter->next() ){
+                 vtkIdType aId = myActor->GetObject()->GetNodeVTKId( aNode->GetID() ) ;
+                 aVTKIds.push_back(aId);
+                 aVTKIds_faces.push_back(aId);
+               }
+             if(!Preview->isChecked()){
+               aType = VTK_POLYGON;
+               mySimulation->SetPosition(myActor, aType, aVTKIds_faces);
+             }
+           }
+         if(Preview->isChecked())
+           mySimulation->SetPosition(myActor, aType, aVTKIds);
+       }
+      }
+    }  
+}
+
+//=================================================================================
+// function : SetEditCurrentArgument()
+// purpose  :
+//=================================================================================
+void SMESHGUI_CreatePolyhedralVolumeDlg::SetEditCurrentArgument()
+{
+  QPushButton* send = (QPushButton*)sender();
+  if(send == SelectElementsButton) {
+    LineEditElements->setFocus() ;
+    myEditCurrentArgument = LineEditElements;
+  }
+  SelectionIntoArgument();
+}
+
+//=================================================================================
+// function : DeactivateActiveDialog()
+// purpose  :
+//=================================================================================
+void SMESHGUI_CreatePolyhedralVolumeDlg::DeactivateActiveDialog()
+{
+  if ( GroupConstructors->isEnabled() ) {
+    GroupConstructors->setEnabled(false) ;
+    GroupContent->setEnabled(false) ;
+    GroupButtons->setEnabled(false) ;
+    mySimulation->SetVisibility(false);
+    mySMESHGUI->ResetState() ;    
+    mySMESHGUI->SetActiveDialogBox(0) ;
+  }
+}
+
+
+//=================================================================================
+// function : ActivateThisDialog()
+// purpose  :
+//=================================================================================
+void SMESHGUI_CreatePolyhedralVolumeDlg::ActivateThisDialog()
+{
+  /* Emit a signal to deactivate the active dialog */
+  mySMESHGUI->EmitSignalDeactivateDialog() ;   
+  GroupConstructors->setEnabled(true) ;
+  GroupContent->setEnabled(true) ;
+  GroupButtons->setEnabled(true) ;
+  
+  mySMESHGUI->SetActiveDialogBox( (QDialog*)this ) ;
+
+  myViewWindow->SetSelectionMode( FaceSelection );
+  SelectionIntoArgument();
+}
+
+
+//=================================================================================
+// function : enterEvent()
+// purpose  :
+//=================================================================================
+void SMESHGUI_CreatePolyhedralVolumeDlg::enterEvent(QEvent* e)
+{
+  if ( GroupConstructors->isEnabled() )
+    return ;  
+  ActivateThisDialog() ;
+}
+
+
+//=================================================================================
+// function : closeEvent()
+// purpose  :
+//=================================================================================
+void SMESHGUI_CreatePolyhedralVolumeDlg::closeEvent( QCloseEvent* e )
+{
+  /* same than click on cancel button */
+  this->ClickOnCancel() ;
+}
+
+
+//=======================================================================
+//function : hideEvent
+//purpose  : caused by ESC key
+//=======================================================================
+
+void SMESHGUI_CreatePolyhedralVolumeDlg::hideEvent ( QHideEvent * e )
+{
+  if ( !isMinimized() )
+    ClickOnCancel();
+}
+
+
+//=================================================================================
+// function : GetConstructorId()
+// purpose  : 
+//=================================================================================
+int SMESHGUI_CreatePolyhedralVolumeDlg::GetConstructorId()
+{ 
+  if ( GroupConstructors != NULL && GroupConstructors->selected() != NULL )
+    return GroupConstructors->id( GroupConstructors->selected() );
+  return -1;
+}
+
+//=================================================================================
+// function : onAdd()
+// purpose  :
+//=================================================================================
+void SMESHGUI_CreatePolyhedralVolumeDlg::onAdd()
+{
+  SALOME_ListIO selected;
+  mySelectionMgr->selectedObjects( selected );
+  int aNbSel = selected.Extent();
+  if (aNbSel == 0 || !myActor || myMesh->_is_nil()) return;
+
+  busy = true;
+
+  if ( !(myEditCurrentArgument->text().isEmpty()) )
+    {
+      myFacesByNodes->insertItem(myEditCurrentArgument->text());
+      //myFacesByNodes->setSelected(myFacesByNodes->count() - 1, true);
+      myNbOkElements = 1;
+      myEditCurrentArgument->clear();
+      AddButton->setEnabled(false);
+      RemoveButton->setEnabled(true);
+      buttonOk->setEnabled( true );
+      if(myFacesByNodes->count()>1) buttonApply->setEnabled( true );
+    }
+  busy = false;
+  onListSelectionChanged();
+  displaySimulation();
+}
+
+//=================================================================================
+// function : onRemove()
+// purpose  :
+//=================================================================================
+void SMESHGUI_CreatePolyhedralVolumeDlg::onRemove()
+{
+  busy = true;
+  for (int i = myFacesByNodes->count(); i > 0; i--) {
+    if (myFacesByNodes->isSelected(i-1)) {
+      myFacesByNodes->removeItem(i-1);
+    }
+  }
+  if (myFacesByNodes->count() < 1){
+    myNbOkElements = 0;
+    RemoveButton->setEnabled(false);
+    buttonOk->setEnabled( false );
+    buttonApply->setEnabled( false );
+  } 
+  else if (myFacesByNodes->count() == 1){
+    myNbOkElements = 0;
+    buttonOk->setEnabled( false );
+    buttonApply->setEnabled( false );
+  }
+  displaySimulation();
+  busy = false;
+  onListSelectionChanged();
+}
+
+//=================================================================================
+// function : onListSelectionChanged()
+// purpose  : Called when selection in element list is changed
+//=================================================================================
+void SMESHGUI_CreatePolyhedralVolumeDlg::onListSelectionChanged()
+{
+  if (busy || !myActor) return;
+  busy = true;
+
+  SALOME_ListIO list;
+  mySelectionMgr->setSelectedObjects( list );
+  TColStd_MapOfInteger aIndexes;
+  QListBoxItem* anItem;
+  for (anItem = myFacesByNodes->firstItem(); anItem != 0; anItem = anItem->next()) {
+    if (anItem->isSelected()) {
+      QStringList anIds = QStringList::split(" ", anItem->text());
+      for (QStringList::iterator it = anIds.begin(); it != anIds.end(); ++it)
+       aIndexes.Add((*it).toInt());
+    }
+  }
+  mySelector->AddOrRemoveIndex(myActor->getIO(), aIndexes, true );
+  myViewWindow->highlight( myActor->getIO(), true, true );
+  list.Append( myActor->getIO() );
+  mySelectionMgr->setSelectedObjects( list );
+  
+  busy = false;
+}
diff --git a/src/SMESHGUI/SMESHGUI_CreatePolyhedralVolumeDlg.h b/src/SMESHGUI/SMESHGUI_CreatePolyhedralVolumeDlg.h
new file mode 100644 (file)
index 0000000..ba7cf2c
--- /dev/null
@@ -0,0 +1,135 @@
+//  SMESH SMESHGUI : GUI for SMESH component
+//
+//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
+// 
+//  This library is free software; you can redistribute it and/or 
+//  modify it under the terms of the GNU Lesser General Public 
+//  License as published by the Free Software Foundation; either 
+//  version 2.1 of the License. 
+// 
+//  This library is distributed in the hope that it will be useful, 
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of 
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
+//  Lesser General Public License for more details. 
+// 
+//  You should have received a copy of the GNU Lesser General Public 
+//  License along with this library; if not, write to the Free Software 
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
+// 
+//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+//
+//
+//
+//  File   : SMESHGUI_CreatePolyhedralVolumeDlg.h
+//  Author : Michael ZORIN
+//  Module : SMESH
+//  $Header: 
+
+#ifndef DIALOGBOX_CREATEPOLYHEDRAL_H
+#define DIALOGBOX_CREATEPOLYHEDRAL_H
+
+// QT Includes
+#include <qdialog.h>
+
+class QGridLayout; 
+class QButtonGroup;
+class QGroupBox;
+class QListBox;
+class QLabel;
+class QLineEdit;
+class QPushButton;
+class QRadioButton;
+class QCheckBox;
+class SMESHGUI;
+class SMESH_Actor;
+class SVTK_Selector;
+class SVTK_ViewWindow;
+class SalomeApp_SelectionMgr;
+
+namespace SMESH{
+  struct TPolySimulation;
+}
+
+// IDL Headers
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(SMESH_Mesh)
+
+//=================================================================================
+// class    : SMESHGUI_CreatePolyhedralVolumeDlg
+// purpose  :
+//=================================================================================
+class SMESHGUI_CreatePolyhedralVolumeDlg : public QDialog
+{ 
+    Q_OBJECT
+
+public:
+    SMESHGUI_CreatePolyhedralVolumeDlg( SMESHGUI*, const char* name = 0, bool modal = FALSE, WFlags fl = 0 );
+    ~SMESHGUI_CreatePolyhedralVolumeDlg();
+
+private:
+
+    void Init() ;
+    void closeEvent( QCloseEvent* e ) ;
+    void enterEvent ( QEvent * ) ;                          /* mouse enter the QWidget */
+    void hideEvent ( QHideEvent * );                        /* ESC key */
+    int  GetConstructorId();
+    void displaySimulation();
+    
+    SMESHGUI*                     mySMESHGUI ;              /* Current SMESHGUI object */
+    SalomeApp_SelectionMgr*       mySelectionMgr ;             /* User shape selection */
+    SVTK_ViewWindow*              myViewWindow;
+    SVTK_Selector*                mySelector;
+    QString                       myIDs;
+    int                           myNbOkElements ;            /* to check when elements are defined */
+
+    QLineEdit*                    myEditCurrentArgument;
+   
+    SMESH::SMESH_Mesh_var         myMesh;
+    SMESH_Actor*                  myActor;
+    SMESH::TPolySimulation*       mySimulation;
+    
+    QButtonGroup* GroupConstructors;
+    QRadioButton* RadioButton1;
+    QRadioButton* RadioButton2;
+    QCheckBox* Preview;
+    QGroupBox* GroupButtons;
+    QPushButton* buttonOk;
+    QPushButton* buttonCancel;
+    QPushButton* buttonApply;
+    QGroupBox* GroupContent;
+    QLabel* TextLabelIds;
+    QPushButton* SelectElementsButton;
+    QLineEdit* LineEditElements;
+    QListBox* myFacesByNodes;
+    QLabel* myFacesByNodesLabel;
+    QPushButton* AddButton;
+    QPushButton* RemoveButton;
+       
+    public slots:
+
+    void onAdd();
+    void onRemove();
+
+    private slots:
+
+    void ConstructorsClicked(int constructorId);
+    void ClickOnPreview(bool theToggled);
+    void ClickOnOk();
+    void ClickOnCancel();
+    void ClickOnApply();
+    void SetEditCurrentArgument() ;
+    void SelectionIntoArgument() ;
+    void DeactivateActiveDialog() ;
+    void ActivateThisDialog() ;
+    void onTextChange(const QString&);
+    void onListSelectionChanged();
+    
+protected:
+    QGridLayout* SMESHGUI_CreatePolyhedralVolumeDlgLayout;
+    QGridLayout* GroupConstructorsLayout;
+    QGridLayout* GroupButtonsLayout;
+    QGridLayout* GroupContentLayout;
+};
+
+#endif // DIALOGBOX_CREATEPOLYHEDRAL_H
index db93adf3b9649e2695af7f1c518614669ed2eee6..b71866823d94bb66f4c53a70b73f3d233668094d 100644 (file)
@@ -1,23 +1,23 @@
 //  SMESH SMESHGUI : GUI for SMESH component
 //
 //  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
-// 
-//  This library is free software; you can redistribute it and/or 
-//  modify it under the terms of the GNU Lesser General Public 
-//  License as published by the Free Software Foundation; either 
-//  version 2.1 of the License. 
-// 
-//  This library is distributed in the hope that it will be useful, 
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of 
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
-//  Lesser General Public License for more details. 
-// 
-//  You should have received a copy of the GNU Lesser General Public 
-//  License along with this library; if not, write to the Free Software 
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
-// 
-//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
 //
 //
 //
 #include "SMESHGUI_DeleteGroupDlg.h"
 
 #include "SMESHGUI.h"
-#include "SMESH_TypeFilter.hxx"
 #include "SMESHGUI_Utils.h"
 #include "SMESHGUI_VTKUtils.h"
 
-#include "QAD_Desktop.h"
-#include "SALOME_Selection.h"
+#include "SMESH_TypeFilter.hxx"
+
+#include "SUIT_Desktop.h"
+
+#include "SalomeApp_Study.h"
+#include "SalomeApp_SelectionMgr.h"
+
+#include "SVTK_Selection.h"
+#include "SALOME_ListIO.hxx"
 #include "SALOME_ListIteratorOfListIO.hxx"
 
+// QT Includes
 #include <qframe.h>
 #include <qlayout.h>
 #include <qpushbutton.h>
 #include <qlist.h>
 #include <qmessagebox.h>
 
+// IDL Headers
 #include "SALOMEconfig.h"
 #include CORBA_SERVER_HEADER(SMESH_Mesh)
 
 #define SPACING 5
 #define MARGIN  10
 
-/*
-  Class       : SMESHGUI_DeleteGroupDlg
-  Description : Delete groups and their contents
-*/
-
-//=======================================================================
-// name    : SMESHGUI_DeleteGroupDlg::SMESHGUI_DeleteGroupDlg
-// Purpose : Constructor
-//=======================================================================
-SMESHGUI_DeleteGroupDlg::SMESHGUI_DeleteGroupDlg( QWidget*          theParent, 
-                                                  SALOME_Selection* theSelection )
-: QDialog( theParent, "SMESHGUI_DeleteGroupDlg", false, 
-           WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
+/*!
 Class       : SMESHGUI_DeleteGroupDlg
 Description : Delete groups and their contents
+ */
+
+//=================================================================================
+// function : SMESHGUI_DeleteGroupDlg()
+// purpose  : Constructor
+//=================================================================================
+SMESHGUI_DeleteGroupDlg::SMESHGUI_DeleteGroupDlg (QWidget*          theParent,
+                                                  SalomeApp_SelectionMgr* theSelection)
+     : QDialog(theParent, "SMESHGUI_DeleteGroupDlg", false,
+               WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu)
 {
-  setCaption( tr( "CAPTION" ) );
+  setCaption(tr("CAPTION"));
 
-  QVBoxLayout* aDlgLay = new QVBoxLayout( this, MARGIN, SPACING );
+  QVBoxLayout* aDlgLay = new QVBoxLayout(this, MARGIN, SPACING);
 
-  QFrame* aMainFrame = createMainFrame  ( this );
-  QFrame* aBtnFrame  = createButtonFrame( this );
+  QFrame* aMainFrame = createMainFrame  (this);
+  QFrame* aBtnFrame  = createButtonFrame(this);
 
-  aDlgLay->addWidget( aMainFrame );
-  aDlgLay->addWidget( aBtnFrame );
+  aDlgLay->addWidget(aMainFrame);
+  aDlgLay->addWidget(aBtnFrame);
 
-  aDlgLay->setStretchFactor( aMainFrame, 1 );
+  aDlgLay->setStretchFactor(aMainFrame, 1);
 
-  Init( theSelection ) ; 
+  Init(theSelection);
 }
 
-//=======================================================================
-// name    : SMESHGUI_DeleteGroupDlg::createMainFrame
-// Purpose : Create frame containing dialog's input fields
-//=======================================================================
-QFrame* SMESHGUI_DeleteGroupDlg::createMainFrame( QWidget* theParent )
+//=================================================================================
+// function : createMainFrame()
+// purpose  : Create frame containing dialog's input fields
+//=================================================================================
+QFrame* SMESHGUI_DeleteGroupDlg::createMainFrame (QWidget* theParent)
 {
-  QGroupBox* aMainGrp = new QGroupBox( 1, Qt::Horizontal, tr( "SELECTED_GROUPS" ), theParent );
-  
-  myListBox = new QListBox( aMainGrp );
-  myListBox->setMinimumHeight( 100 );
-  myListBox->setSelectionMode( QListBox::NoSelection );
-  myListBox->setRowMode( QListBox::FitToWidth );
-  
+  QGroupBox* aMainGrp =
+    new QGroupBox(1, Qt::Horizontal, tr("SELECTED_GROUPS"), theParent);
+
+  myListBox = new QListBox(aMainGrp);
+  myListBox->setMinimumHeight(100);
+  myListBox->setSelectionMode(QListBox::NoSelection);
+  myListBox->setRowMode(QListBox::FitToWidth);
+
   return aMainGrp;
 }
 
-//=======================================================================
-// name    : SMESHGUI_DeleteGroupDlg::createButtonFrame
-// Purpose : Create frame containing buttons
-//=======================================================================
-QFrame* SMESHGUI_DeleteGroupDlg::createButtonFrame( QWidget* theParent )
+//=================================================================================
+// function : createButtonFrame()
+// purpose  : Create frame containing buttons
+//=================================================================================
+QFrame* SMESHGUI_DeleteGroupDlg::createButtonFrame (QWidget* theParent)
 {
-  QFrame* aFrame = new QFrame( theParent );
-  aFrame->setFrameStyle( QFrame::Box | QFrame::Sunken );
+  QFrame* aFrame = new QFrame(theParent);
+  aFrame->setFrameStyle(QFrame::Box | QFrame::Sunken);
 
-  myOkBtn     = new QPushButton( tr( "SMESH_BUT_OK"    ), aFrame );
-  myApplyBtn  = new QPushButton( tr( "SMESH_BUT_APPLY" ), aFrame );
-  myCloseBtn  = new QPushButton( tr( "SMESH_BUT_CLOSE" ), aFrame );
+  myOkBtn     = new QPushButton(tr("SMESH_BUT_OK"   ), aFrame);
+  myApplyBtn  = new QPushButton(tr("SMESH_BUT_APPLY"), aFrame);
+  myCloseBtn  = new QPushButton(tr("SMESH_BUT_CLOSE"), aFrame);
 
-  QSpacerItem* aSpacer = new QSpacerItem( 0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum );
+  QSpacerItem* aSpacer = new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum);
 
-  QHBoxLayout* aLay = new QHBoxLayout( aFrame, MARGIN, SPACING );
+  QHBoxLayout* aLay = new QHBoxLayout(aFrame, MARGIN, SPACING);
+
+  aLay->addWidget(myOkBtn);
+  aLay->addWidget(myApplyBtn);
+  aLay->addItem(aSpacer);
+  aLay->addWidget(myCloseBtn);
 
-  aLay->addWidget( myOkBtn );
-  aLay->addWidget( myApplyBtn );
-  aLay->addItem( aSpacer);
-  aLay->addWidget( myCloseBtn );
-  
   // connect signals and slots
-  connect( myOkBtn,    SIGNAL( clicked() ), SLOT( onOk() ) );
-  connect( myCloseBtn, SIGNAL( clicked() ), SLOT( onClose() ) ) ;
-  connect( myApplyBtn, SIGNAL( clicked() ), SLOT( onApply() ) );
-  
+  connect(myOkBtn,    SIGNAL(clicked()), SLOT(onOk()));
+  connect(myCloseBtn, SIGNAL(clicked()), SLOT(onClose()));
+  connect(myApplyBtn, SIGNAL(clicked()), SLOT(onApply()));
+
   return aFrame;
 }
 
-//=======================================================================
-// name    : SMESHGUI_DeleteGroupDlg::~SMESHGUI_DeleteGroupDlg
+//=================================================================================
+// name    : ~SMESHGUI_DeleteGroupDlg()
 // Purpose : Destructor
-//=======================================================================
+//=================================================================================
 SMESHGUI_DeleteGroupDlg::~SMESHGUI_DeleteGroupDlg()
 {
 }
 
-//=======================================================================
-// name    : SMESHGUI_DeleteGroupDlg::Init
-// Purpose : Init dialog fields, connect signals and slots, show dialog
-//=======================================================================
-void SMESHGUI_DeleteGroupDlg::Init( SALOME_Selection* theSelection )
+//=================================================================================
+// function : Init()
+// purpose  : Init dialog fields, connect signals and slots, show dialog
+//=================================================================================
+void SMESHGUI_DeleteGroupDlg::Init (SalomeApp_SelectionMgr* theSelection)
 {
   myBlockSelection = false;
-  mySelection = theSelection;  
+  mySelectionMgr = theSelection;
   SMESHGUI* aSMESHGUI = SMESHGUI::GetSMESHGUI();
-  aSMESHGUI->SetActiveDialogBox( ( QDialog* )this ) ;
-  
+  aSMESHGUI->SetActiveDialogBox((QDialog*)this);
+
   // selection and SMESHGUI
-  connect( mySelection, SIGNAL( currentSelectionChanged() ), SLOT( onSelectionDone() ) );
-  connect( aSMESHGUI, SIGNAL( SignalDeactivateActiveDialog() ), SLOT( onDeactivate() ) );
-  connect( aSMESHGUI, SIGNAL( SignalCloseAllDialogs() ), SLOT( onClose() ) );
-  
-  int x, y ;
-  aSMESHGUI->DefineDlgPosition( this, x, y );
-  this->move( x, y );
-  this->show(); 
+  connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), SLOT(onSelectionDone()));
+  connect(aSMESHGUI, SIGNAL(SignalDeactivateActiveDialog()), SLOT(onDeactivate()));
+  connect(aSMESHGUI, SIGNAL(SignalCloseAllDialogs()), SLOT(onClose()));
+
+  int x, y;
+  aSMESHGUI->DefineDlgPosition(this, x, y);
+  this->move(x, y);
+  this->show();
 
   // set selection mode
-  QAD_Application::getDesktop()->SetSelectionMode( ActorSelection, true ); 
-  mySelection->AddFilter( new SMESH_TypeFilter( GROUP ) );
+#ifdef NEW_GUI
+  mySelectionMgr->setSelectionModes(ActorSelection, true);
+#else
+  mySelectionMgr->setSelectionModes(ActorSelection);
+#endif
+  mySelectionMgr->installFilter(new SMESH_TypeFilter(GROUP));
   onSelectionDone();
 
   return;
 }
 
-//=======================================================================
-// name    : SMESHGUI_DeleteGroupDlg::isValid
-// Purpose : Verify validity of input data
-//=======================================================================
+//=================================================================================
+// function : isValid()
+// purpose  : Verify validity of input data
+//=================================================================================
 bool SMESHGUI_DeleteGroupDlg::isValid()
 {
-  if ( myListBox->count() == 0 )
-  {
-    QMessageBox::information( SMESHGUI::GetSMESHGUI()->GetDesktop(),
-      tr( "SMESH_INSUFFICIENT_DATA" ), tr( "NO_SELECTED_GROUPS" ), QMessageBox::Ok ); 
+  if (myListBox->count() == 0) {
+    QMessageBox::information(SMESHGUI::desktop(), tr("SMESH_INSUFFICIENT_DATA"),
+                             tr("NO_SELECTED_GROUPS"), QMessageBox::Ok);
     return false;
   }
-  
-  return !SMESHGUI::GetSMESHGUI()->ActiveStudyLocked();
+
+  return !SMESHGUI::GetSMESHGUI()->isActiveStudyLocked();
 }
 
-//=======================================================================
-// name    : SMESHGUI_DeleteGroupDlg::onApply
-// Purpose : SLOT called when "Apply" button pressed. 
-//=======================================================================
+//=================================================================================
+// function : onApply()
+// purpose  : SLOT called when "Apply" button pressed.
+//=================================================================================
 bool SMESHGUI_DeleteGroupDlg::onApply()
 {
-  if ( !isValid() )
+  if (!isValid())
     return false;
 
   myBlockSelection = true;
-  
+
   QValueList<SMESH::SMESH_GroupBase_var>::iterator anIter;
-  for ( anIter = myListGrp.begin(); anIter != myListGrp.end(); ++anIter )
-  {
+  for (anIter = myListGrp.begin(); anIter != myListGrp.end(); ++anIter) {
     SMESH::SMESH_Mesh_ptr aMesh = (*anIter)->GetMesh();
-    if ( !aMesh->_is_nil() )
-      aMesh->RemoveGroupWithContents( *anIter );
+    if (!aMesh->_is_nil())
+      aMesh->RemoveGroupWithContents(*anIter);
   }
 
   myListBox->clear();
   myListGrp.clear();
-  mySelection->ClearIObjects();
+  mySelectionMgr->clearSelected();
   SMESH::UpdateView();
-  SMESHGUI::GetSMESHGUI()->GetActiveStudy()->updateObjBrowser( true );
-   
+  SMESHGUI::GetSMESHGUI()->updateObjBrowser(true);
+
   myBlockSelection = false;
   return true;
 }
 
-//=======================================================================
-// name    : SMESHGUI_DeleteGroupDlg::onOk
-// Purpose : SLOT called when "Ok" button pressed. 
-//=======================================================================
+//=================================================================================
+// function : onOk()
+// purpose  : SLOT called when "Ok" button pressed.
+//=================================================================================
 void SMESHGUI_DeleteGroupDlg::onOk()
 {
-  if ( onApply() )
+  if (onApply())
     onClose();
 }
 
-//=======================================================================
-// name    : SMESHGUI_DeleteGroupDlg::onClose
-// Purpose : SLOT called when "Close" button pressed. Close dialog
-//=======================================================================
+//=================================================================================
+// function : onClose()
+// purpose  : SLOT called when "Close" button pressed. Close dialog
+//=================================================================================
 void SMESHGUI_DeleteGroupDlg::onClose()
 {
-  QAD_Application::getDesktop()->SetSelectionMode( ActorSelection );
-  disconnect( mySelection, 0, this, 0 );
-  disconnect( SMESHGUI::GetSMESHGUI(), 0, this, 0 );
-  SMESHGUI::GetSMESHGUI()->ResetState() ;
-  mySelection->ClearFilters();
+  mySelectionMgr->setSelectionModes(ActorSelection);
+  disconnect(mySelectionMgr, 0, this, 0);
+  disconnect(SMESHGUI::GetSMESHGUI(), 0, this, 0);
+  SMESHGUI::GetSMESHGUI()->ResetState();
+  mySelectionMgr->clearFilters();
   reject();
 }
 
-//=======================================================================
-// name    : SMESHGUI_DeleteGroupDlg::onSelectionDone
-// Purpose : SLOT called when selection changed
-//=======================================================================
+//=================================================================================
+// function : onSelectionDone()
+// purpose  : SLOT called when selection changed
+//=================================================================================
 void SMESHGUI_DeleteGroupDlg::onSelectionDone()
 {
-  if ( myBlockSelection )
+  if (myBlockSelection)
     return;
-  
+
   myListGrp.clear();
   QStringList aNames;
-  
-  const SALOME_ListIO& aListIO = mySelection->StoredIObjects();
-  SALOME_ListIteratorOfListIO anIter( aListIO );
-  for( ; anIter.More(); anIter.Next() )
-  {
-    SMESH::SMESH_GroupBase_var aGroup = 
-      SMESH::IObjectToInterface<SMESH::SMESH_GroupBase>( anIter.Value() );
-    if ( !aGroup->_is_nil() )
-    {
-      aNames.append( aGroup->GetName() );
-      myListGrp.append( aGroup );
+
+  SALOME_ListIO aListIO;
+  mySelectionMgr->selectedObjects(aListIO);
+  SALOME_ListIteratorOfListIO anIter (aListIO);
+  for (; anIter.More(); anIter.Next()) {
+    SMESH::SMESH_GroupBase_var aGroup =
+      SMESH::IObjectToInterface<SMESH::SMESH_GroupBase>(anIter.Value());
+    if (!aGroup->_is_nil()) {
+      aNames.append(aGroup->GetName());
+      myListGrp.append(aGroup);
     }
   }
-    
+
   myListBox->clear();
-  myListBox->insertStringList( aNames );
+  myListBox->insertStringList(aNames);
 }
 
-//=======================================================================
-// name    : SMESHGUI_DeleteGroupDlg::onDeactivate
-// Purpose : SLOT called when dialog must be deativated
-//=======================================================================
+//=================================================================================
+// function : onDeactivate()
+// purpose  : SLOT called when dialog must be deativated
+//=================================================================================
 void SMESHGUI_DeleteGroupDlg::onDeactivate()
 {
-  mySelection->ClearFilters();
-  setEnabled( false );
+  mySelectionMgr->clearFilters();
+  setEnabled(false);
 }
 
-//=======================================================================
-// name    : SMESHGUI_DeleteGroupDlg::enterEvent
-// Purpose : Event filter
-//=======================================================================
-void SMESHGUI_DeleteGroupDlg::enterEvent( QEvent* )
+//=================================================================================
+// function : enterEvent()
+// purpose  : Event filter
+//=================================================================================
+void SMESHGUI_DeleteGroupDlg::enterEvent (QEvent*)
 {
-  SMESHGUI::GetSMESHGUI()->EmitSignalDeactivateDialog() ;   
-  setEnabled( true );
-  QAD_Application::getDesktop()->SetSelectionMode( ActorSelection, true ); 
-  mySelection->AddFilter( new SMESH_TypeFilter( GROUP ) );
+  SMESHGUI::GetSMESHGUI()->EmitSignalDeactivateDialog();
+  setEnabled(true);
+#ifdef NEW_GUI
+  mySelectionMgr->setSelectionModes(ActorSelection, true);
+#else
+  mySelectionMgr->setSelectionModes(ActorSelection);
+#endif
+  mySelectionMgr->installFilter(new SMESH_TypeFilter (GROUP));
 }
 
-
 //=================================================================================
 // function : closeEvent()
 // purpose  :
 //=================================================================================
-void SMESHGUI_DeleteGroupDlg::closeEvent( QCloseEvent* )
+void SMESHGUI_DeleteGroupDlg::closeEvent (QCloseEvent*)
 {
-  onClose() ;
+  onClose();
 }
-
index 1669dc705793de2e9d54f0e18ce137ca0e9df52f..1d86778a7d3366c47db0fabe5ad27fce239507c4 100644 (file)
 class QCloseEvent;
 class QFrame;
 class QPushButton;
-class SALOME_Selection;
+class SalomeApp_SelectionMgr;
 class QListBox;
 
-/*
-  Class       : SMESHGUI_DeleteGroupDlg
-  Description : Delete groups and their contents
-*/
+/*!
 Class       : SMESHGUI_DeleteGroupDlg
 Description : Delete groups and their contents
+ */
 
 class SMESHGUI_DeleteGroupDlg : public QDialog
-{ 
+{
   Q_OBJECT
-    
+
 public:
-                                     SMESHGUI_DeleteGroupDlg( QWidget*, SALOME_Selection* );
-  virtual                            ~SMESHGUI_DeleteGroupDlg();
+                          SMESHGUI_DeleteGroupDlg (QWidget*,
+                                                  SalomeApp_SelectionMgr*);
+  virtual                 ~SMESHGUI_DeleteGroupDlg();
+
+  void                    Init (SalomeApp_SelectionMgr*);
 
-  void                               Init( SALOME_Selection* ) ;
-  
 private:
 
-  void                               closeEvent( QCloseEvent* e ) ;
-  void                               enterEvent ( QEvent * ) ;            
-  
+  void                    closeEvent (QCloseEvent*);
+  void                    enterEvent (QEvent*);
+
 private slots:
 
-  void                               onOk();
-  bool                               onApply();
-  void                               onClose();
+  void                    onOk();
+  bool                    onApply();
+  void                    onClose();
 
-  void                               onDeactivate();
+  void                    onDeactivate();
 
-  void                               onSelectionDone();
+  void                    onSelectionDone();
 
 private:
 
-  QFrame*                            createButtonFrame( QWidget* );
-  QFrame*                            createMainFrame  ( QWidget* );
-  bool                               isValid();
-  
+  QFrame*                 createButtonFrame (QWidget*);
+  QFrame*                 createMainFrame   (QWidget*);
+  bool                    isValid();
+
 private:
 
-  QPushButton*                       myOkBtn;
-  QPushButton*                       myApplyBtn;
-  QPushButton*                       myCloseBtn;
-  QListBox*                          myListBox;
-  SALOME_Selection*                  mySelection;
-  
+  QPushButton*            myOkBtn;
+  QPushButton*            myApplyBtn;
+  QPushButton*            myCloseBtn;
+  QListBox*               myListBox;
+  SalomeApp_SelectionMgr* mySelectionMgr;
+
   QValueList<SMESH::SMESH_GroupBase_var> myListGrp;
   bool                                   myBlockSelection;
-  
 };
 
 #endif
-
-
-
-
-
index 2d162996a61f4f802591562e11171649b49b4b7e..16feafbc57a0c3eabfbccb78fbaa6e1cd527c800 100644 (file)
@@ -1,23 +1,23 @@
 //  SMESH SMESHGUI : GUI for SMESH component
 //
 //  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
-// 
-//  This library is free software; you can redistribute it and/or 
-//  modify it under the terms of the GNU Lesser General Public 
-//  License as published by the Free Software Foundation; either 
-//  version 2.1 of the License. 
-// 
-//  This library is distributed in the hope that it will be useful, 
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of 
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
-//  Lesser General Public License for more details. 
-// 
-//  You should have received a copy of the GNU Lesser General Public 
-//  License along with this library; if not, write to the Free Software 
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
-// 
-//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
 //
 //
 //
 #include "SMESHGUI_GEOMGenUtils.h"
 #include "SMESHGUI_HypothesesUtils.h"
 
+#include "SMESH_TypeFilter.hxx"
+#include "SMESH_NumberFilter.hxx"
+
+#include "SALOME_ListIO.hxx"
 #include "SALOME_ListIteratorOfListIO.hxx"
 
-#include "QAD_Application.h"
-#include "QAD_Desktop.h"
-#include "QAD_WaitCursor.h"
-#include "QAD_Operation.h"
+#include "SALOMEDSClient_Study.hxx"
+#include "SALOMEDSClient_AttributeIOR.hxx"
+#include "SALOMEDSClient_AttributeName.hxx"
 
-#include "SALOMEconfig.h"
-#include CORBA_CLIENT_HEADER(SALOMEDS_Attributes)
+#include "SUIT_Session.h"
+#include "SUIT_OverrideCursor.h"
+#include "SUIT_Operation.h"
+#include "SUIT_Desktop.h"
 
 #include "utilities.h"
 
+#include "SVTK_ViewModel.h"
+
 // QT Includes
 #include <qgroupbox.h>
 #include <qlabel.h>
@@ -67,10 +74,10 @@ public:
   enum { RTTI_IOR = 1000 };
 
 public:
-  ListBoxIOR( QListBox* listbox, 
+  ListBoxIOR (QListBox* listbox,
               const char* ior,
               const QString& text = QString::null)
-  : QListBoxText( listbox, text ), myIOR( ior ) {}
+  : QListBoxText(listbox, text), myIOR(ior) {}
   virtual ~ListBoxIOR() {};
   virtual int rtti() const { return RTTI_IOR; }
   const char* GetIOR() { return myIOR.c_str(); }
@@ -81,12 +88,12 @@ private:
 
 #define ALLOW_CHANGE_SHAPE 0
 
-int findItem( QListBox* listBox, const string& ior )
+int findItem (QListBox* listBox, const string& ior)
 {
-  for ( int i = 0; i < listBox->count(); i++ ) {
-    if ( listBox->item( i )->rtti() == ListBoxIOR::RTTI_IOR ) {
-      ListBoxIOR* anItem = ( ListBoxIOR* )( listBox->item( i ) );
-      if ( anItem && ior == string( anItem->GetIOR() ) )
+  for (int i = 0; i < listBox->count(); i++) {
+    if (listBox->item(i)->rtti() == ListBoxIOR::RTTI_IOR) {
+      ListBoxIOR* anItem = (ListBoxIOR*)(listBox->item(i));
+      if (anItem && ior == string(anItem->GetIOR()))
        return i;
     }
   }
@@ -94,215 +101,218 @@ int findItem( QListBox* listBox, const string& ior )
 }
 
 //=================================================================================
-// class    : SMESHGUI_EditHypothesesDlg()
-// purpose  : Constructs a SMESHGUI_EditHypothesesDlg which is a child of 'parent', with the 
+// function : SMESHGUI_EditHypothesesDlg()
+// purpose  : Constructs a SMESHGUI_EditHypothesesDlg which is a child of 'parent', with the
 //            name 'name' and widget flags set to 'f'.
 //            The dialog will by default be modeless, unless you set 'modal' to
 //            TRUE to construct a modal dialog.
 //=================================================================================
-SMESHGUI_EditHypothesesDlg::SMESHGUI_EditHypothesesDlg( QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl )
-  : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | WDestructiveClose ),
-    myImportedMesh( false )
+SMESHGUI_EditHypothesesDlg::SMESHGUI_EditHypothesesDlg (SMESHGUI* theModule, const char* name,
+                                                        bool modal, WFlags fl)
+     : QDialog( SMESH::GetDesktop( theModule ), name, modal, WStyle_Customize | WStyle_NormalBorder |
+                WStyle_Title | WStyle_SysMenu | WDestructiveClose),
+    myImportedMesh(false),
+    mySMESHGUI( theModule ),
+    mySelectionMgr( SMESH::GetSelectionMgr( theModule ) )
 {
-    QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "SMESH",tr("ICON_SELECT")));
-    if ( !name )
-        setName( "SMESHGUI_EditHypothesesDlg" );
-    setCaption( tr( "SMESH_EDIT_HYPOTHESES"  ) );
-    setSizeGripEnabled( TRUE );
-    QGridLayout* SMESHGUI_EditHypothesesDlgLayout = new QGridLayout( this ); 
-    SMESHGUI_EditHypothesesDlgLayout->setSpacing( 6 );
-    SMESHGUI_EditHypothesesDlgLayout->setMargin( 11 );
+    QPixmap image0 (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_SELECT")));
+    if (!name)
+      setName("SMESHGUI_EditHypothesesDlg");
+    setCaption(tr("SMESH_EDIT_HYPOTHESES"));
+    setSizeGripEnabled(TRUE);
+    QGridLayout* SMESHGUI_EditHypothesesDlgLayout = new QGridLayout(this);
+    SMESHGUI_EditHypothesesDlgLayout->setSpacing(6);
+    SMESHGUI_EditHypothesesDlgLayout->setMargin(11);
 
     /***************************************************************/
-    GroupC1 = new QGroupBox( tr( "SMESH_ARGUMENTS" ), this, "GroupC1" );
-    GroupC1->setColumnLayout(0, Qt::Vertical );
-    GroupC1->layout()->setSpacing( 0 );
-    GroupC1->layout()->setMargin( 0 );
-    QGridLayout* GroupC1Layout = new QGridLayout( GroupC1->layout() );
-    GroupC1Layout->setAlignment( Qt::AlignTop );
-    GroupC1Layout->setSpacing( 6 );
-    GroupC1Layout->setMargin( 11 );
-
-    TextLabelC1A1 = new QLabel( tr( "SMESH_OBJECT_MESHorSUBMESH" ), GroupC1, "TextLabelC1A1" );
-    GroupC1Layout->addWidget( TextLabelC1A1, 0, 0 );
-    SelectButtonC1A1 = new QPushButton( GroupC1, "SelectButtonC1A1" );
-    SelectButtonC1A1->setPixmap( image0 );
-    GroupC1Layout->addWidget( SelectButtonC1A1, 0, 1 );
-    LineEditC1A1 = new QLineEdit( GroupC1, "LineEditC1A1" );
-    LineEditC1A1->setReadOnly( true );
-    GroupC1Layout->addWidget( LineEditC1A1, 0, 2 );
-
-    TextLabelC1A2 = new QLabel( tr( "SMESH_OBJECT_GEOM" ), GroupC1, "TextLabelC1A2" );
-    GroupC1Layout->addWidget( TextLabelC1A2, 1, 0 );
-    SelectButtonC1A2 = new QPushButton( GroupC1, "SelectButtonC1A2" );
-    SelectButtonC1A2->setPixmap( image0 );
-    SelectButtonC1A2->setToggleButton( FALSE );
-    GroupC1Layout->addWidget( SelectButtonC1A2, 1, 1 );
-    LineEditC1A2 = new QLineEdit( GroupC1, "LineEditC1A2" );
-    LineEditC1A2->setReadOnly( true );
-    GroupC1Layout->addWidget( LineEditC1A2, 1, 2 );
-
-    SMESHGUI_EditHypothesesDlgLayout->addWidget( GroupC1, 0, 0 );
+    GroupC1 = new QGroupBox(tr("SMESH_ARGUMENTS"), this, "GroupC1");
+    GroupC1->setColumnLayout(0, Qt::Vertical);
+    GroupC1->layout()->setSpacing(0);
+    GroupC1->layout()->setMargin(0);
+    QGridLayout* GroupC1Layout = new QGridLayout(GroupC1->layout());
+    GroupC1Layout->setAlignment(Qt::AlignTop);
+    GroupC1Layout->setSpacing(6);
+    GroupC1Layout->setMargin(11);
+
+    TextLabelC1A1 = new QLabel(tr("SMESH_OBJECT_MESHorSUBMESH"), GroupC1, "TextLabelC1A1");
+    GroupC1Layout->addWidget(TextLabelC1A1, 0, 0);
+    SelectButtonC1A1 = new QPushButton(GroupC1, "SelectButtonC1A1");
+    SelectButtonC1A1->setPixmap(image0);
+    GroupC1Layout->addWidget(SelectButtonC1A1, 0, 1);
+    LineEditC1A1 = new QLineEdit(GroupC1, "LineEditC1A1");
+    LineEditC1A1->setReadOnly(true);
+    GroupC1Layout->addWidget(LineEditC1A1, 0, 2);
+
+    TextLabelC1A2 = new QLabel(tr("SMESH_OBJECT_GEOM"), GroupC1, "TextLabelC1A2");
+    GroupC1Layout->addWidget(TextLabelC1A2, 1, 0);
+    SelectButtonC1A2 = new QPushButton(GroupC1, "SelectButtonC1A2");
+    SelectButtonC1A2->setPixmap(image0);
+    SelectButtonC1A2->setToggleButton(FALSE);
+    GroupC1Layout->addWidget(SelectButtonC1A2, 1, 1);
+    LineEditC1A2 = new QLineEdit(GroupC1, "LineEditC1A2");
+    LineEditC1A2->setReadOnly(true);
+    GroupC1Layout->addWidget(LineEditC1A2, 1, 2);
+
+    SMESHGUI_EditHypothesesDlgLayout->addWidget(GroupC1, 0, 0);
 
     /***************************************************************/
-    GroupHypotheses = new QGroupBox( tr( "SMESH_HYPOTHESES" ), this, "GroupHypotheses" );
-    GroupHypotheses->setColumnLayout(0, Qt::Vertical );
-    GroupHypotheses->layout()->setSpacing( 0 );
-    GroupHypotheses->layout()->setMargin( 0 );
-    QGridLayout* grid_3 = new QGridLayout( GroupHypotheses->layout() );
-    grid_3->setAlignment( Qt::AlignTop );
-    grid_3->setSpacing( 6 );
-    grid_3->setMargin( 11 );
+    GroupHypotheses = new QGroupBox(tr("SMESH_HYPOTHESES"), this, "GroupHypotheses");
+    GroupHypotheses->setColumnLayout(0, Qt::Vertical);
+    GroupHypotheses->layout()->setSpacing(0);
+    GroupHypotheses->layout()->setMargin(0);
+    QGridLayout* grid_3 = new QGridLayout(GroupHypotheses->layout());
+    grid_3->setAlignment(Qt::AlignTop);
+    grid_3->setSpacing(6);
+    grid_3->setMargin(11);
 
-    TextHypDefinition = new QLabel( tr( "SMESH_AVAILABLE" ), GroupHypotheses, "TextHypDefinition" );
-    grid_3->addWidget( TextHypDefinition, 0, 0 );
+    TextHypDefinition = new QLabel(tr("SMESH_AVAILABLE"), GroupHypotheses, "TextHypDefinition");
+    grid_3->addWidget(TextHypDefinition, 0, 0);
 
-    ListHypDefinition = new QListBox( GroupHypotheses, "ListHypDefinition" );
-    ListHypDefinition->setMinimumSize( 100, 100 );
-    grid_3->addWidget( ListHypDefinition, 1, 0 );
+    ListHypDefinition = new QListBox(GroupHypotheses, "ListHypDefinition");
+    ListHypDefinition->setMinimumSize(100, 100);
+    grid_3->addWidget(ListHypDefinition, 1, 0);
 
-    TextHypAssignation = new QLabel( tr( "SMESH_EDIT_USED" ), GroupHypotheses, "TextHypAssignation" );
-    grid_3->addWidget( TextHypAssignation, 0, 1 );
+    TextHypAssignation = new QLabel(tr("SMESH_EDIT_USED"), GroupHypotheses, "TextHypAssignation");
+    grid_3->addWidget(TextHypAssignation, 0, 1);
 
-    ListHypAssignation = new QListBox( GroupHypotheses, "ListHypAssignation" );
-    ListHypAssignation->setMinimumSize( 100, 100 );
-    grid_3->addWidget( ListHypAssignation, 1, 1 );
+    ListHypAssignation = new QListBox(GroupHypotheses, "ListHypAssignation");
+    ListHypAssignation->setMinimumSize(100, 100);
+    grid_3->addWidget(ListHypAssignation, 1, 1);
 
-    SMESHGUI_EditHypothesesDlgLayout->addWidget( GroupHypotheses, 1, 0 );
+    SMESHGUI_EditHypothesesDlgLayout->addWidget(GroupHypotheses, 1, 0);
 
     /***************************************************************/
-    GroupAlgorithms = new QGroupBox( tr( "SMESH_ADD_ALGORITHM" ), this, "GroupAlgorithms" );
-    GroupAlgorithms->setColumnLayout(0, Qt::Vertical );
-    GroupAlgorithms->layout()->setSpacing( 0 );
-    GroupAlgorithms->layout()->setMargin( 0 );
-    QGridLayout* grid_4 = new QGridLayout( GroupAlgorithms->layout() );
-    grid_4->setAlignment( Qt::AlignTop );
-    grid_4->setSpacing( 6 );
-    grid_4->setMargin( 11 );
+    GroupAlgorithms = new QGroupBox(tr("SMESH_ADD_ALGORITHM"), this, "GroupAlgorithms");
+    GroupAlgorithms->setColumnLayout(0, Qt::Vertical);
+    GroupAlgorithms->layout()->setSpacing(0);
+    GroupAlgorithms->layout()->setMargin(0);
+    QGridLayout* grid_4 = new QGridLayout(GroupAlgorithms->layout());
+    grid_4->setAlignment(Qt::AlignTop);
+    grid_4->setSpacing(6);
+    grid_4->setMargin(11);
 
-    TextAlgoDefinition = new QLabel( tr( "SMESH_AVAILABLE" ), GroupAlgorithms, "TextAlgoDefinition" );
-    grid_4->addWidget( TextAlgoDefinition, 0, 0 );
+    TextAlgoDefinition = new QLabel(tr("SMESH_AVAILABLE"), GroupAlgorithms, "TextAlgoDefinition");
+    grid_4->addWidget(TextAlgoDefinition, 0, 0);
 
-    ListAlgoDefinition = new QListBox( GroupAlgorithms, "ListAlgoDefinition" );
-    ListAlgoDefinition->setMinimumSize( 100, 100 );
-    grid_4->addWidget( ListAlgoDefinition, 1, 0 );
+    ListAlgoDefinition = new QListBox(GroupAlgorithms, "ListAlgoDefinition");
+    ListAlgoDefinition->setMinimumSize(100, 100);
+    grid_4->addWidget(ListAlgoDefinition, 1, 0);
 
-    TextAlgoAssignation = new QLabel( tr( "SMESH_EDIT_USED" ), GroupAlgorithms, "TextAlgoAssignation" );
-    grid_4->addWidget( TextAlgoAssignation, 0, 1 );
+    TextAlgoAssignation = new QLabel(tr("SMESH_EDIT_USED"), GroupAlgorithms, "TextAlgoAssignation");
+    grid_4->addWidget(TextAlgoAssignation, 0, 1);
 
-    ListAlgoAssignation = new QListBox( GroupAlgorithms, "ListAlgoAssignation" );
-    ListAlgoAssignation ->setMinimumSize( 100, 100 );
-    grid_4->addWidget( ListAlgoAssignation, 1, 1 );
+    ListAlgoAssignation = new QListBox(GroupAlgorithms, "ListAlgoAssignation");
+    ListAlgoAssignation ->setMinimumSize(100, 100);
+    grid_4->addWidget(ListAlgoAssignation, 1, 1);
 
-    SMESHGUI_EditHypothesesDlgLayout->addWidget( GroupAlgorithms, 2, 0 );
+    SMESHGUI_EditHypothesesDlgLayout->addWidget(GroupAlgorithms, 2, 0);
 
     /***************************************************************/
-    GroupButtons = new QGroupBox( this, "GroupButtons" );
-    GroupButtons->setColumnLayout(0, Qt::Vertical );
-    GroupButtons->layout()->setSpacing( 0 );
-    GroupButtons->layout()->setMargin( 0 );
-    QGridLayout* GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
-    GroupButtonsLayout->setAlignment( Qt::AlignTop );
-    GroupButtonsLayout->setSpacing( 6 );
-    GroupButtonsLayout->setMargin( 11 );
-
-    buttonOk = new QPushButton( tr( "SMESH_BUT_OK" ), GroupButtons, "buttonOk" );
-    buttonOk->setAutoDefault( TRUE );
-    buttonOk->setDefault( FALSE );
-    GroupButtonsLayout->addWidget( buttonOk, 0, 0 );
-
-    buttonApply = new QPushButton( tr( "SMESH_BUT_APPLY" ), GroupButtons, "buttonApply" );
-    buttonApply->setAutoDefault( TRUE );
-    buttonApply->setDefault( FALSE );
-    GroupButtonsLayout->addWidget( buttonApply, 0, 1 );
-
-    GroupButtonsLayout->addItem( new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ), 0, 2 );
-
-    buttonCancel = new QPushButton( tr( "SMESH_BUT_CLOSE" ), GroupButtons, "buttonCancel" );
-    buttonCancel->setAutoDefault( TRUE );
-    buttonCancel->setDefault( TRUE );
-    buttonCancel->setEnabled( TRUE ) ;
-    GroupButtonsLayout->addWidget( buttonCancel, 0, 3 );
-
-    SMESHGUI_EditHypothesesDlgLayout->addWidget( GroupButtons, 4, 0 );
+    GroupButtons = new QGroupBox(this, "GroupButtons");
+    GroupButtons->setColumnLayout(0, Qt::Vertical);
+    GroupButtons->layout()->setSpacing(0);
+    GroupButtons->layout()->setMargin(0);
+    QGridLayout* GroupButtonsLayout = new QGridLayout(GroupButtons->layout());
+    GroupButtonsLayout->setAlignment(Qt::AlignTop);
+    GroupButtonsLayout->setSpacing(6);
+    GroupButtonsLayout->setMargin(11);
+
+    buttonOk = new QPushButton(tr("SMESH_BUT_OK"), GroupButtons, "buttonOk");
+    buttonOk->setAutoDefault(TRUE);
+    buttonOk->setDefault(FALSE);
+    GroupButtonsLayout->addWidget(buttonOk, 0, 0);
+
+    buttonApply = new QPushButton(tr("SMESH_BUT_APPLY"), GroupButtons, "buttonApply");
+    buttonApply->setAutoDefault(TRUE);
+    buttonApply->setDefault(FALSE);
+    GroupButtonsLayout->addWidget(buttonApply, 0, 1);
+
+    GroupButtonsLayout->addItem(new QSpacerItem(20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum), 0, 2);
+
+    buttonCancel = new QPushButton(tr("SMESH_BUT_CLOSE"), GroupButtons, "buttonCancel");
+    buttonCancel->setAutoDefault(TRUE);
+    buttonCancel->setDefault(TRUE);
+    buttonCancel->setEnabled(TRUE);
+    GroupButtonsLayout->addWidget(buttonCancel, 0, 3);
+
+    SMESHGUI_EditHypothesesDlgLayout->addWidget(GroupButtons, 4, 0);
 
     /***************************************************************/
-    Init(Sel) ;
+    Init();
 }
 
-
 //=================================================================================
 // function : ~SMESHGUI_EditHypothesesDlg()
 // purpose  : Destroys the object and frees any allocated resources
 //=================================================================================
 SMESHGUI_EditHypothesesDlg::~SMESHGUI_EditHypothesesDlg()
 {
-    // no need to delete child widgets, Qt does it all for us
+  // no need to delete child widgets, Qt does it all for us
 }
 
-
 //=================================================================================
 // function : Init()
 // purpose  :
 //=================================================================================
-void SMESHGUI_EditHypothesesDlg::Init( SALOME_Selection* Sel )
+void SMESHGUI_EditHypothesesDlg::Init()
 {
-  mySelection = Sel;
-  mySMESHGUI = SMESHGUI::GetSMESHGUI() ;
-  mySMESHGUI->SetActiveDialogBox( (QDialog*)this ) ;
+  mySMESHGUI->SetActiveDialogBox((QDialog*)this);
 
   InitHypDefinition();
   InitAlgoDefinition();
 
-  myGeomFilter = new SALOME_TypeFilter( "GEOM" );
-  myMeshOrSubMeshFilter = new SMESH_TypeFilter( MESHorSUBMESH );
+  //myGeomFilter = new SALOME_TypeFilter ("GEOM");
+  TColStd_MapOfInteger allTypesMap;
+  for (int i = 0; i < 10; i++)
+    allTypesMap.Add(i);
+  myGeomFilter          = new SMESH_NumberFilter ("GEOM", TopAbs_SHAPE, 0, allTypesMap);
+  myMeshOrSubMeshFilter = new SMESH_TypeFilter (MESHorSUBMESH);
 
   myGeomShape = GEOM::GEOM_Object::_nil();
   myMesh = SMESH::SMESH_Mesh::_nil();
   mySubMesh = SMESH::SMESH_subMesh::_nil();
 
   /* signals and slots connections */
-  connect( buttonOk,     SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
-  connect( buttonApply,  SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) );
-  connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) );
-
-  connect( SelectButtonC1A1, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ;
-  connect( SelectButtonC1A2, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ;
-
-  connect( mySelection, SIGNAL( currentSelectionChanged() ),      this, SLOT( SelectionIntoArgument() ) );
-  connect( mySMESHGUI,  SIGNAL( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ;
-  connect( mySMESHGUI,  SIGNAL( SignalCloseAllDialogs() ),        this, SLOT( ClickOnCancel() ) ) ;
-  connect( ListHypAssignation,  SIGNAL( doubleClicked(QListBoxItem*) ), this, SLOT( removeItem(QListBoxItem*) ) );
-  connect( ListAlgoAssignation, SIGNAL( doubleClicked(QListBoxItem*) ), this, SLOT( removeItem(QListBoxItem*) ) );
-  connect( ListHypDefinition,  SIGNAL( doubleClicked(QListBoxItem*) ), this, SLOT( addItem(QListBoxItem*) ) );
-  connect( ListAlgoDefinition, SIGNAL( doubleClicked(QListBoxItem*) ), this, SLOT( addItem(QListBoxItem*) ) );
-
-  int x, y ;
-  mySMESHGUI->DefineDlgPosition( this, x, y ) ;
-  this->move( x, y ) ;
-  this->show() ; 
-
-  LineEditC1A1->setFocus() ;
+  connect(buttonOk,     SIGNAL(clicked()), this, SLOT(ClickOnOk()));
+  connect(buttonApply,  SIGNAL(clicked()), this, SLOT(ClickOnApply()));
+  connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel()));
+
+  connect(SelectButtonC1A1, SIGNAL (clicked()), this, SLOT(SetEditCurrentArgument()));
+  connect(SelectButtonC1A2, SIGNAL (clicked()), this, SLOT(SetEditCurrentArgument()));
+
+  connect(mySelectionMgr, SIGNAL(currentSelectionChanged()),      this, SLOT(SelectionIntoArgument()));
+  connect(mySMESHGUI,     SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog()));
+  connect(mySMESHGUI,     SIGNAL(SignalCloseAllDialogs()),        this, SLOT(ClickOnCancel()));
+
+  connect(ListHypAssignation,  SIGNAL(doubleClicked(QListBoxItem*)), this, SLOT(removeItem(QListBoxItem*)));
+  connect(ListAlgoAssignation, SIGNAL(doubleClicked(QListBoxItem*)), this, SLOT(removeItem(QListBoxItem*)));
+
+  connect(ListHypDefinition,  SIGNAL(doubleClicked(QListBoxItem*)), this, SLOT(addItem(QListBoxItem*)));
+  connect(ListAlgoDefinition, SIGNAL(doubleClicked(QListBoxItem*)), this, SLOT(addItem(QListBoxItem*)));
+
+  int x, y;
+  mySMESHGUI->DefineDlgPosition(this, x, y);
+  this->move(x, y);
+  this->show();
+
+  LineEditC1A1->setFocus();
   myEditCurrentArgument = LineEditC1A1;
-  mySelection->ClearFilters() ;   
-  mySelection->AddFilter(myMeshOrSubMeshFilter) ;
+  mySelectionMgr->clearFilters();
+  mySelectionMgr->installFilter(myMeshOrSubMeshFilter);
 
   SelectionIntoArgument();
 
   UpdateControlState();
 }
 
-
 //=================================================================================
 // function : ClickOnOk()
 // purpose  :
 //=================================================================================
 void SMESHGUI_EditHypothesesDlg::ClickOnOk()
 {
-  if ( ClickOnApply() )
-    ClickOnCancel() ;
+  if (ClickOnApply())
+    ClickOnCancel();
 }
 
 //=================================================================================
@@ -311,40 +321,39 @@ void SMESHGUI_EditHypothesesDlg::ClickOnOk()
 //=================================================================================
 bool SMESHGUI_EditHypothesesDlg::ClickOnApply()
 {
-  if (mySMESHGUI->ActiveStudyLocked())
+  if (mySMESHGUI->isActiveStudyLocked())
     return false;
 
   bool aRes = false;
 
-  QAD_WaitCursor wc;
+  SUIT_OverrideCursor wc;
 
-  QAD_Operation* op = new QAD_Operation( mySMESHGUI->GetActiveStudy() );
+  SUIT_Operation* op = new SUIT_Operation
+    (SUIT_Session::session()->activeApplication());
 
   // start transaction
   op->start();
-  
-  if ( !myMesh->_is_nil() )
+
+  if (!myMesh->_is_nil())
     aRes = StoreMesh();
-  else if ( !mySubMesh->_is_nil() )
+  else if (!mySubMesh->_is_nil())
     aRes = StoreSubMesh();
 
-  if ( true/*aRes*/ ) // abort desynchronizes contents of a Study and a mesh on server
-  {
+  if (true/*aRes*/) { // abort desynchronizes contents of a Study and a mesh on server
     // commit transaction
-    op->finish();
+    op->commit();
     InitHypAssignation();
     InitAlgoAssignation();
-  }
-  else
+  } else {
     // abort transaction
     op->abort();
+  }
 
   UpdateControlState();
 
   return aRes;
 }
 
-
 //=================================================================================
 // function : ClickOnCancel()
 // purpose  :
@@ -354,56 +363,58 @@ void SMESHGUI_EditHypothesesDlg::ClickOnCancel()
   close();
 }
 
-
 //=================================================================================
 // function : SelectionIntoArgument()
 // purpose  : Called when selection as changed or other case
 //=================================================================================
 void SMESHGUI_EditHypothesesDlg::SelectionIntoArgument()
 {
-  QString aString = ""; 
-
-  int nbSel = SMESH::GetNameOfSelectedIObjects(mySelection, aString) ;
-  
-  if ( myEditCurrentArgument == LineEditC1A1 ) {
-    if ( nbSel != 1 ) {
-      myMesh      = SMESH::SMESH_Mesh::_nil();
-      mySubMesh   = SMESH::SMESH_subMesh::_nil();
-      aString     = "";
+  QString aString = "";
+
+  SALOME_ListIO aList;
+  mySelectionMgr->selectedObjects(aList,SVTK_Viewer::Type());
+
+  int nbSel = SMESH::GetNameOfSelectedIObjects(mySelectionMgr, aString);
+
+  if (myEditCurrentArgument == LineEditC1A1) {
+    if (nbSel != 1) {
+      myMesh    = SMESH::SMESH_Mesh::_nil();
+      mySubMesh = SMESH::SMESH_subMesh::_nil();
+      aString   = "";
     } else {
-      Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject() ;
-      myMesh = SMESH::IObjectToInterface<SMESH::SMESH_Mesh>(IO) ;
-      if(myMesh->_is_nil()){
-       mySubMesh = SMESH::IObjectToInterface<SMESH::SMESH_subMesh>(IO) ;
-       if(mySubMesh->_is_nil()){
+      Handle(SALOME_InteractiveObject) IO = aList.First();
+      myMesh = SMESH::IObjectToInterface<SMESH::SMESH_Mesh>(IO);
+      if (myMesh->_is_nil()) {
+       mySubMesh = SMESH::IObjectToInterface<SMESH::SMESH_subMesh>(IO);
+       if (mySubMesh->_is_nil()) {
          aString = "";
        }
       }
     }
-    myEditCurrentArgument->setText( aString );
-    
-    myGeomShape = GEOM::GEOM_Object::_nil(); // InitGeom() will try to retrieve a shape from myMesh or mySubMesh
+    myEditCurrentArgument->setText(aString);
+
+    // InitGeom() will try to retrieve a shape from myMesh or mySubMesh
+    myGeomShape = GEOM::GEOM_Object::_nil();
     InitGeom();
-    
+
     myImportedMesh = myGeomShape->_is_nil();
-    
+
     InitHypAssignation();
     InitAlgoAssignation();
-  }
-  else if ( myEditCurrentArgument == LineEditC1A2 ) {
-    if ( nbSel != 1 )
+
+  } else if (myEditCurrentArgument == LineEditC1A2) {
+    if (nbSel != 1) {
       myGeomShape = GEOM::GEOM_Object::_nil();
-    else {
-      Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject() ;
-      myGeomShape = SMESH::IObjectToInterface<GEOM::GEOM_Object>(IO) ;
+    else {
+      Handle(SALOME_InteractiveObject) IO = aList.First();
+      myGeomShape = SMESH::IObjectToInterface<GEOM::GEOM_Object>(IO);
     }
     InitGeom();
-  } 
+  }
 
   UpdateControlState();
 }
 
-
 //=================================================================================
 // function : SetEditCurrentArgument()
 // purpose  :
@@ -412,17 +423,17 @@ void SMESHGUI_EditHypothesesDlg::SetEditCurrentArgument()
 {
   QPushButton* send = (QPushButton*)sender();
   if(send == SelectButtonC1A1) {
-    LineEditC1A1->setFocus() ;
+    LineEditC1A1->setFocus();
     myEditCurrentArgument = LineEditC1A1;
-    mySelection->ClearFilters() ;   
-    mySelection->AddFilter(myMeshOrSubMeshFilter) ;
+    mySelectionMgr->clearFilters();
+    mySelectionMgr->installFilter(myMeshOrSubMeshFilter);
   } else if (send == SelectButtonC1A2) {
-    LineEditC1A2->setFocus() ;
+    LineEditC1A2->setFocus();
     myEditCurrentArgument = LineEditC1A2;
-    mySelection->ClearFilters() ;
-    mySelection->AddFilter(myGeomFilter) ;
-  } 
-  SelectionIntoArgument() ;
+    mySelectionMgr->clearFilters();
+    mySelectionMgr->installFilter(myGeomFilter);
+  }
+  SelectionIntoArgument();
 }
 
 //=================================================================================
@@ -431,61 +442,57 @@ void SMESHGUI_EditHypothesesDlg::SetEditCurrentArgument()
 //=================================================================================
 void SMESHGUI_EditHypothesesDlg::DeactivateActiveDialog()
 {
-  if ( GroupC1->isEnabled() ) {
-    disconnect( mySelection, 0, this, 0 );
-    GroupC1->setEnabled(false) ;
-    GroupButtons->setEnabled(false) ;
+  if (GroupC1->isEnabled()) {
+    disconnect(mySelectionMgr, 0, this, 0);
+    GroupC1->setEnabled(false);
+    GroupButtons->setEnabled(false);
   }
 }
 
-
 //=================================================================================
 // function : ActivateThisDialog()
 // purpose  :
 //=================================================================================
 void SMESHGUI_EditHypothesesDlg::ActivateThisDialog()
 {
-  mySMESHGUI->EmitSignalDeactivateDialog() ;   
-  GroupC1->setEnabled(true) ;
-  GroupButtons->setEnabled(true) ;
-  connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
+  mySMESHGUI->EmitSignalDeactivateDialog();
+  GroupC1->setEnabled(true);
+  GroupButtons->setEnabled(true);
+  connect (mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
 }
 
-
 //=================================================================================
 // function : enterEvent()
 // purpose  :
 //=================================================================================
-void SMESHGUI_EditHypothesesDlg::enterEvent(QEvent* e)
+void SMESHGUI_EditHypothesesDlg::enterEvent (QEvent*)
 {
-  if ( !GroupC1->isEnabled() )
+  if (!GroupC1->isEnabled())
     ActivateThisDialog();
 }
 
-
 //=================================================================================
 // function : closeEvent()
 // purpose  :
 //=================================================================================
-void SMESHGUI_EditHypothesesDlg::closeEvent( QCloseEvent* e )
+void SMESHGUI_EditHypothesesDlg::closeEvent (QCloseEvent* e)
 {
-  disconnect( mySelection, 0, this, 0 );
-  mySMESHGUI->ResetState() ;
-  mySelection->ClearFilters() ;
-  QDialog::closeEvent( e );
+  disconnect(mySelectionMgr, 0, this, 0);
+  mySMESHGUI->ResetState();
+  mySelectionMgr->clearFilters();
+  QDialog::closeEvent(e);
 }
 
 //=======================================================================
-//function : IsOld
-//purpose  : 
+// function : IsOld()
+// purpose  :
 //=======================================================================
-
-bool SMESHGUI_EditHypothesesDlg::IsOld(QListBoxItem* hypItem)
+bool SMESHGUI_EditHypothesesDlg::IsOld (QListBoxItem* hypItem)
 {
-  if ( hypItem->rtti() == ListBoxIOR::RTTI_IOR ) {
-    ListBoxIOR* hyp = ( ListBoxIOR* ) hypItem;
-    return (myMapOldHypos.find( hyp->GetIOR() ) != myMapOldHypos.end() ||
-            myMapOldAlgos.find( hyp->GetIOR() ) != myMapOldAlgos.end() );
+  if (hypItem->rtti() == ListBoxIOR::RTTI_IOR) {
+    ListBoxIOR* hyp = (ListBoxIOR*) hypItem;
+    return (myMapOldHypos.find(hyp->GetIOR()) != myMapOldHypos.end() ||
+            myMapOldAlgos.find(hyp->GetIOR()) != myMapOldAlgos.end());
   }
 
   return false;
@@ -495,75 +502,74 @@ bool SMESHGUI_EditHypothesesDlg::IsOld(QListBoxItem* hypItem)
 // function : removeItem()
 // purpose  :
 //=================================================================================
-void SMESHGUI_EditHypothesesDlg::removeItem(QListBoxItem* item)
+void SMESHGUI_EditHypothesesDlg::removeItem (QListBoxItem* item)
 {
   const QObject* aSender = sender();
 
   if (!item) return;
 
-  if ( aSender == ListHypAssignation ) {
-    myNbModification += IsOld( item ) ? 1 : -1;
-    ListHypAssignation->removeItem( ListHypAssignation->index( item ) );
-  } 
-  else if ( aSender == ListAlgoAssignation ) {
-    myNbModification += IsOld( item ) ? 1 : -1;
-    ListAlgoAssignation->removeItem( ListAlgoAssignation->index( item ) );
+  if (aSender == ListHypAssignation) {
+    myNbModification += IsOld(item) ? 1 : -1;
+    ListHypAssignation->removeItem(ListHypAssignation->index(item));
+  }
+  else if (aSender == ListAlgoAssignation) {
+    myNbModification += IsOld(item) ? 1 : -1;
+    ListAlgoAssignation->removeItem(ListAlgoAssignation->index(item));
   }
-
 
   UpdateControlState();
 }
 
-
 //=================================================================================
 // function : addItem()
 // purpose  :
 //=================================================================================
-void SMESHGUI_EditHypothesesDlg::addItem(QListBoxItem* item)
+void SMESHGUI_EditHypothesesDlg::addItem (QListBoxItem* item)
 {
   const QObject* aSender = sender();
 
   if (!item) return;
 
   ListBoxIOR* i = 0;
-  if ( item->rtti() == ListBoxIOR::RTTI_IOR )
+  if (item->rtti() == ListBoxIOR::RTTI_IOR)
     i = (ListBoxIOR*)item;
   if (!i) return;
-  
+
   bool isFound = false;
 
-  if ( aSender == ListHypDefinition ) {
-    for ( int j = 0, n = ListHypAssignation->count(); !isFound && j < n; j++ ) {
-      if ( ListHypAssignation->item( j )->rtti() == ListBoxIOR::RTTI_IOR ) {
-       ListBoxIOR* anItem = (ListBoxIOR*)ListHypAssignation->item( j );
-       isFound = !strcmp( anItem->GetIOR(), i->GetIOR() );
+  ListBoxIOR* anItem;
+  if (aSender == ListHypDefinition) {
+    for (int j = 0, n = ListHypAssignation->count(); !isFound && j < n; j++) {
+      if (ListHypAssignation->item(j)->rtti() == ListBoxIOR::RTTI_IOR) {
+       anItem = (ListBoxIOR*)ListHypAssignation->item(j);
+       isFound = !strcmp(anItem->GetIOR(), i->GetIOR());
       }
     }
-    if ( !isFound )
-      ListBoxIOR* anItem = new ListBoxIOR( ListHypAssignation, 
-                                          CORBA::string_dup( i->GetIOR() ), 
-                                          CORBA::string_dup( i->text().latin1() ) );
-  }
-  else if ( aSender == ListAlgoDefinition ) {
-    for ( int j = 0, n = ListAlgoAssignation->count(); !isFound && j < n; j++ ) {
-      if ( ListAlgoAssignation->item( j )->rtti() == ListBoxIOR::RTTI_IOR ) {
-       ListBoxIOR* anItem = (ListBoxIOR*)ListAlgoAssignation->item( j );
-       isFound = !strcmp( anItem->GetIOR(), i->GetIOR() );
+    if (!isFound)
+      anItem = new ListBoxIOR (ListHypAssignation,
+                               CORBA::string_dup(i->GetIOR()),
+                               CORBA::string_dup(i->text().latin1()));
+
+  } else if (aSender == ListAlgoDefinition) {
+    for (int j = 0, n = ListAlgoAssignation->count(); !isFound && j < n; j++) {
+      if (ListAlgoAssignation->item(j)->rtti() == ListBoxIOR::RTTI_IOR) {
+       anItem = (ListBoxIOR*)ListAlgoAssignation->item(j);
+       isFound = !strcmp(anItem->GetIOR(), i->GetIOR());
       }
     }
-    if ( !isFound )
-      ListBoxIOR* anItem = new ListBoxIOR( ListAlgoAssignation, 
-                                          CORBA::string_dup( i->GetIOR() ), 
-                                          CORBA::string_dup( i->text().latin1() ) );
+    if (!isFound)
+      anItem = new ListBoxIOR (ListAlgoAssignation,
+                               CORBA::string_dup(i->GetIOR()),
+                               CORBA::string_dup(i->text().latin1()));
+  } else {
   }
 
-  if ( !isFound )
-    myNbModification += IsOld( item ) ? -1 : 1;
+  if (!isFound)
+    myNbModification += IsOld(item) ? -1 : 1;
 
   UpdateControlState();
 }
 
-
 //=================================================================================
 // function : InitHypDefinition()
 // purpose  :
@@ -572,27 +578,29 @@ void SMESHGUI_EditHypothesesDlg::InitHypDefinition()
 {
   ListHypDefinition->clear();
 
-  SALOMEDS::SComponent_var father = SMESH::GetActiveStudyDocument()->FindComponent("SMESH");
-  if ( father->_is_nil() )
+  _PTR(SComponent) father = SMESH::GetActiveStudyDocument()->FindComponent("SMESH");
+  if (!father)
     return;
 
-  SALOMEDS::SObject_var           HypothesisRoot;
-  SALOMEDS::GenericAttribute_var  anAttr;
-  SALOMEDS::AttributeName_var     aName;
-  SALOMEDS::AttributeIOR_var      anIOR;
+  _PTR(SObject)          HypothesisRoot;
+  _PTR(GenericAttribute) anAttr;
+  _PTR(AttributeName)    aName;
+  _PTR(AttributeIOR)     anIOR;
 
-  int Tag_HypothesisRoot = 1;
-  if (father->FindSubObject (1, HypothesisRoot)) {
-    SALOMEDS::ChildIterator_var it = SMESH::GetActiveStudyDocument()->NewChildIterator(HypothesisRoot);
+  //int Tag_HypothesisRoot = 1;
+  if (father->FindSubObject(1, HypothesisRoot)) {
+    _PTR(ChildIterator) it =
+      SMESH::GetActiveStudyDocument()->NewChildIterator(HypothesisRoot);
+    ListBoxIOR* anItem;
     for (; it->More();it->Next()) {
-      SALOMEDS::SObject_var Obj = it->Value();
-      if (Obj->FindAttribute(anAttr, "AttributeName") ) {
-        aName = SALOMEDS::AttributeName::_narrow(anAttr);
+      _PTR(SObject) Obj = it->Value();
+      if (Obj->FindAttribute(anAttr, "AttributeName")) {
+        aName = anAttr;
         if (Obj->FindAttribute(anAttr, "AttributeIOR")) {
-          anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
-          ListBoxIOR* anItem = new ListBoxIOR( ListHypDefinition, 
-                                               anIOR->Value(), 
-                                               aName->Value() );
+          anIOR = anAttr;
+          anItem = new ListBoxIOR (ListHypDefinition,
+                                   anIOR->Value().c_str(),
+                                   aName->Value().c_str());
         }
       }
     }
@@ -606,37 +614,36 @@ void SMESHGUI_EditHypothesesDlg::InitHypDefinition()
 void SMESHGUI_EditHypothesesDlg::InitHypAssignation()
 {
   myNbModification = 0;
-//   MESSAGE ( " InitHypAssignation " << myMesh->_is_nil() )
-//   MESSAGE ( " InitHypAssignation " << mySubMesh->_is_nil() )
 
   myMapOldHypos.clear();
   ListHypAssignation->clear();
-  if ( myImportedMesh )
+  if (myImportedMesh)
     return;
 
-  SALOMEDS::SObject_var             aMorSM, AHR, aRef;
-  SALOMEDS::GenericAttribute_var    anAttr;
-  SALOMEDS::AttributeName_var       aName;
-  SALOMEDS::AttributeIOR_var        anIOR;
+  _PTR(SObject)          aMorSM, AHR, aRef;
+  _PTR(GenericAttribute) anAttr;
+  _PTR(AttributeName)    aName;
+  _PTR(AttributeIOR)     anIOR;
 
-  if ( !myMesh->_is_nil() )
-    aMorSM = SMESH::FindSObject( myMesh );
-  else if ( !mySubMesh->_is_nil() )
-    aMorSM = SMESH::FindSObject( mySubMesh );
+  if (!myMesh->_is_nil())
+    aMorSM = SMESH::FindSObject(myMesh);
+  else if (!mySubMesh->_is_nil())
+    aMorSM = SMESH::FindSObject(mySubMesh);
 
-  if ( !aMorSM->_is_nil() && aMorSM->FindSubObject (2, AHR)) {
-    SALOMEDS::ChildIterator_var it = SMESH::GetActiveStudyDocument()->NewChildIterator(AHR);
+  if (aMorSM && aMorSM->FindSubObject(2, AHR)) {
+    _PTR(ChildIterator) it =
+      SMESH::GetActiveStudyDocument()->NewChildIterator(AHR);
     for (; it->More();it->Next()) {
-      SALOMEDS::SObject_var Obj = it->Value();
-      if ( Obj->ReferencedObject(aRef) ) {
-        if (aRef->FindAttribute(anAttr, "AttributeName") ) {
-         aName = SALOMEDS::AttributeName::_narrow(anAttr);
+      _PTR(SObject) Obj = it->Value();
+      if (Obj->ReferencedObject(aRef)) {
+        if (aRef->FindAttribute(anAttr, "AttributeName")) {
+          aName = anAttr;
          if (aRef->FindAttribute(anAttr, "AttributeIOR")) {
-           anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
-           ListBoxIOR* anItem = new ListBoxIOR( ListHypAssignation, 
-                                                anIOR->Value()
-                                                aName->Value() );
-           myMapOldHypos[ anIOR->Value() ] = ListHypAssignation->index( anItem );
+            anIOR = anAttr;
+           ListBoxIOR* anItem = new ListBoxIOR (ListHypAssignation,
+                                                anIOR->Value().c_str(),
+                                                aName->Value().c_str());
+           myMapOldHypos[ anIOR->Value() ] = ListHypAssignation->index(anItem);
          }
        }
       }
@@ -652,70 +659,69 @@ void SMESHGUI_EditHypothesesDlg::InitAlgoDefinition()
 {
   ListAlgoDefinition->clear();
 
-  SALOMEDS::SComponent_var father = SMESH::GetActiveStudyDocument()->FindComponent("SMESH");
-  if ( father->_is_nil() )
+  _PTR(SComponent) father = SMESH::GetActiveStudyDocument()->FindComponent("SMESH");
+  if (!father)
     return;
 
-  SALOMEDS::SObject_var          AlgorithmsRoot;
-  SALOMEDS::GenericAttribute_var anAttr;
-  SALOMEDS::AttributeName_var    aName;
-  SALOMEDS::AttributeIOR_var     anIOR;
+  _PTR(SObject)          AlgorithmsRoot;
+  _PTR(GenericAttribute) anAttr;
+  _PTR(AttributeName)    aName;
+  _PTR(AttributeIOR)     anIOR;
 
   if (father->FindSubObject (2, AlgorithmsRoot)) {
-    SALOMEDS::ChildIterator_var it = SMESH::GetActiveStudyDocument()->NewChildIterator(AlgorithmsRoot);
+    _PTR(ChildIterator) it =
+      SMESH::GetActiveStudyDocument()->NewChildIterator(AlgorithmsRoot);
+    ListBoxIOR* anItem;
     for (; it->More();it->Next()) {
-      SALOMEDS::SObject_var Obj = it->Value();
-      if (Obj->FindAttribute(anAttr, "AttributeName") ) {
-        aName = SALOMEDS::AttributeName::_narrow(anAttr);
+      _PTR(SObject) Obj = it->Value();
+      if (Obj->FindAttribute(anAttr, "AttributeName")) {
+        aName = anAttr;
         if (Obj->FindAttribute(anAttr, "AttributeIOR")) {
-          anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
-          ListBoxIOR* anItem = new ListBoxIOR( ListAlgoDefinition, 
-                                               anIOR->Value(), 
-                                               aName->Value() );
+          anIOR = anAttr;
+          anItem = new ListBoxIOR (ListAlgoDefinition,
+                                   anIOR->Value().c_str(),
+                                   aName->Value().c_str());
         }
       }
     }
   }
 }
 
-
 //=================================================================================
 // function : InitAlgoAssignation()
 // purpose  :
 //=================================================================================
 void SMESHGUI_EditHypothesesDlg::InitAlgoAssignation()
 {
-  MESSAGE ( " InitAlgoAssignation " << myMesh->_is_nil() )
-  MESSAGE ( " InitAlgoAssignation " << mySubMesh->_is_nil() )
-
   myMapOldAlgos.clear();
   ListAlgoAssignation->clear();
-  if ( myImportedMesh )
+  if (myImportedMesh)
     return;
 
-  SALOMEDS::SObject_var             aMorSM, AHR, aRef;
-  SALOMEDS::GenericAttribute_var    anAttr;
-  SALOMEDS::AttributeName_var       aName;
-  SALOMEDS::AttributeIOR_var        anIOR;
+  _PTR(SObject)          aMorSM, AHR, aRef;
+  _PTR(GenericAttribute) anAttr;
+  _PTR(AttributeName)    aName;
+  _PTR(AttributeIOR)     anIOR;
 
-  if ( !myMesh->_is_nil() )
-    aMorSM = SMESH::FindSObject( myMesh );
-  else if ( !mySubMesh->_is_nil() )
-    aMorSM = SMESH::FindSObject( mySubMesh );
+  if (!myMesh->_is_nil())
+    aMorSM = SMESH::FindSObject(myMesh);
+  else if (!mySubMesh->_is_nil())
+    aMorSM = SMESH::FindSObject(mySubMesh);
 
-  if ( !aMorSM->_is_nil() && aMorSM->FindSubObject (3, AHR)) {
-    SALOMEDS::ChildIterator_var it = SMESH::GetActiveStudyDocument()->NewChildIterator(AHR);
+  if (aMorSM && aMorSM->FindSubObject(3, AHR)) {
+    _PTR(ChildIterator) it =
+      SMESH::GetActiveStudyDocument()->NewChildIterator(AHR);
     for (; it->More();it->Next()) {
-      SALOMEDS::SObject_var Obj = it->Value();
-      if ( Obj->ReferencedObject(aRef) ) {
-        if (aRef->FindAttribute(anAttr, "AttributeName") ) {
-         aName = SALOMEDS::AttributeName::_narrow(anAttr);
+      _PTR(SObject) Obj = it->Value();
+      if (Obj->ReferencedObject(aRef)) {
+        if (aRef->FindAttribute(anAttr, "AttributeName")) {
+         aName = anAttr;
          if (aRef->FindAttribute(anAttr, "AttributeIOR")) {
-           anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
-           ListBoxIOR* anItem = new ListBoxIOR( ListAlgoAssignation, 
-                                                anIOR->Value()
-                                                aName->Value() );
-           myMapOldAlgos[ anIOR->Value() ] = ListAlgoAssignation->index( anItem );
+           anIOR = anAttr;
+           ListBoxIOR* anItem = new ListBoxIOR (ListAlgoAssignation,
+                                                anIOR->Value().c_str(),
+                                                aName->Value().c_str());
+           myMapOldAlgos[ anIOR->Value() ] = ListAlgoAssignation->index(anItem);
          }
        }
       }
@@ -729,28 +735,29 @@ void SMESHGUI_EditHypothesesDlg::InitAlgoAssignation()
 //=================================================================================
 void SMESHGUI_EditHypothesesDlg::InitGeom()
 {
-  LineEditC1A2->setText("") ;
+  LineEditC1A2->setText("");
 
-  if ( myGeomShape->_is_nil() && !myMesh->_is_nil() ) {
-    SALOMEDS::SObject_var aMesh = SMESH::FindSObject( myMesh );
-    if ( !aMesh->_is_nil() )
+  if (myGeomShape->_is_nil() && !myMesh->_is_nil()) {
+    _PTR(SObject) aMesh = SMESH::FindSObject(myMesh);
+    if (aMesh)
       myGeomShape = SMESH::GetShapeOnMeshOrSubMesh(aMesh);
   }
-  if ( myGeomShape->_is_nil() && !mySubMesh->_is_nil() ) {
-    SALOMEDS::SObject_var aSubMesh = SMESH::FindSObject( mySubMesh );
-    if ( !aSubMesh->_is_nil() )
+  if (myGeomShape->_is_nil() && !mySubMesh->_is_nil()) {
+    _PTR(SObject) aSubMesh = SMESH::FindSObject(mySubMesh);
+    if (aSubMesh)
       myGeomShape = SMESH::GetShapeOnMeshOrSubMesh(aSubMesh);
   }
-  
-  SALOMEDS::GenericAttribute_var    anAttr;
-  SALOMEDS::AttributeName_var       aName;
-  if ( !myGeomShape->_is_nil() && (!myMesh->_is_nil() || !mySubMesh->_is_nil()) ) {
-    SALOMEDS::Study_var aStudy = SMESH::GetActiveStudyDocument();
-    SALOMEDS::SObject_var aSO = aStudy->FindObjectIOR( aStudy->ConvertObjectToIOR(myGeomShape) );
-    if ( !aSO->_is_nil() ) {
-      if (aSO->FindAttribute(anAttr, "AttributeName") ) {
-       aName = SALOMEDS::AttributeName::_narrow(anAttr);
-       LineEditC1A2->setText( QString(aName->Value()) ) ;
+
+  _PTR(GenericAttribute) anAttr;
+  _PTR(AttributeName)    aName;
+  if (!myGeomShape->_is_nil() && (!myMesh->_is_nil() || !mySubMesh->_is_nil())) {
+    _PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
+    //_PTR(SObject) aSO = aStudy->FindObjectIOR(aStudy->ConvertObjectToIOR(myGeomShape));
+    _PTR(SObject) aSO = aStudy->FindObjectID(myGeomShape->GetStudyEntry());
+    if (aSO) {
+      if (aSO->FindAttribute(anAttr, "AttributeName")) {
+       aName = anAttr;
+       LineEditC1A2->setText(QString(aName->Value().c_str()));
       }
     }
   }
@@ -762,18 +769,21 @@ void SMESHGUI_EditHypothesesDlg::InitGeom()
 //=================================================================================
 void SMESHGUI_EditHypothesesDlg::UpdateControlState()
 {
-  bool isEnabled = ( !myMesh   ->_is_nil() && !myGeomShape->_is_nil() &&   ListHypAssignation->count() && ListAlgoAssignation->count() ) ||
-                   ( !mySubMesh->_is_nil() && !myGeomShape->_is_nil() && ( ListHypAssignation->count() || ListAlgoAssignation->count() ) );
-
-  buttonOk   ->setEnabled( myNbModification && isEnabled && !myImportedMesh );
-  buttonApply->setEnabled( myNbModification && isEnabled && !myImportedMesh );
-
-  SelectButtonC1A2   ->setEnabled( ALLOW_CHANGE_SHAPE && !myImportedMesh );
-  LineEditC1A2       ->setEnabled( ALLOW_CHANGE_SHAPE && !myImportedMesh );
-  ListHypDefinition  ->setEnabled( !myImportedMesh );
-  ListHypAssignation ->setEnabled( !myImportedMesh );
-  ListAlgoDefinition ->setEnabled( !myImportedMesh );
-  ListAlgoAssignation->setEnabled( !myImportedMesh );
+  bool isEnabled = (!myMesh->_is_nil() && !myGeomShape->_is_nil() &&
+                    ListHypAssignation->count() && ListAlgoAssignation->count())
+    ||
+      (!mySubMesh->_is_nil() && !myGeomShape->_is_nil() &&
+       (ListHypAssignation->count() || ListAlgoAssignation->count()));
+
+  buttonOk   ->setEnabled(myNbModification && isEnabled && !myImportedMesh);
+  buttonApply->setEnabled(myNbModification && isEnabled && !myImportedMesh);
+
+  SelectButtonC1A2   ->setEnabled(ALLOW_CHANGE_SHAPE && !myImportedMesh);
+  LineEditC1A2       ->setEnabled(ALLOW_CHANGE_SHAPE && !myImportedMesh);
+  ListHypDefinition  ->setEnabled(!myImportedMesh);
+  ListHypAssignation ->setEnabled(!myImportedMesh);
+  ListAlgoDefinition ->setEnabled(!myImportedMesh);
+  ListAlgoAssignation->setEnabled(!myImportedMesh);
 }
 
 //=================================================================================
@@ -783,13 +793,15 @@ void SMESHGUI_EditHypothesesDlg::UpdateControlState()
 bool SMESHGUI_EditHypothesesDlg::StoreMesh()
 {
   MapIOR anOldHypos, aNewHypos;
-  if ( myGeomShape->_is_nil() )
+  if (myGeomShape->_is_nil())
     return false;
+
   // 1. Check whether the geometric shape has changed
-  SALOMEDS::SObject_var aMeshSO = SMESH::FindSObject( myMesh );
-  GEOM::GEOM_Object_var aIniGeomShape = SMESH::GetShapeOnMeshOrSubMesh( aMeshSO );
-  bool bShapeChanged = aIniGeomShape->_is_nil() || !aIniGeomShape->_is_equivalent( myGeomShape );
-  if ( bShapeChanged ) {
+  _PTR(SObject) aMeshSO = SMESH::FindSObject(myMesh);
+  GEOM::GEOM_Object_var aIniGeomShape = SMESH::GetShapeOnMeshOrSubMesh(aMeshSO);
+  bool bShapeChanged = aIniGeomShape->_is_nil() ||
+                       !aIniGeomShape->_is_equivalent(myGeomShape);
+  if (bShapeChanged) {
     // VSR : TODO : Set new shape - not supported yet by SMESH engine
     // 1. remove all old hypotheses and algorithms and also submeshes
     // 2. set new shape
@@ -797,63 +809,71 @@ bool SMESHGUI_EditHypothesesDlg::StoreMesh()
 
   int nbFail = 0;
   MapIOR::iterator it;
+
   // 2. remove not used hypotheses from the mesh
-  for ( it = myMapOldHypos.begin(); it != myMapOldHypos.end(); ++it ) {
+  for (it = myMapOldHypos.begin(); it != myMapOldHypos.end(); ++it) {
     string ior = it->first;
-    int index = findItem( ListHypAssignation, ior );
-    if ( index < 0 ) {
-      SMESH::SMESH_Hypothesis_var aHyp = SMESH::IORToInterface<SMESH::SMESH_Hypothesis>(ior.c_str());
-      if ( !aHyp->_is_nil() ){
-       if (!SMESH::RemoveHypothesisOrAlgorithmOnMesh( aMeshSO, aHyp ))
+    int index = findItem(ListHypAssignation, ior);
+    if (index < 0) {
+      SMESH::SMESH_Hypothesis_var aHyp =
+        SMESH::IORToInterface<SMESH::SMESH_Hypothesis>(ior.c_str());
+      if (!aHyp->_is_nil()) {
+       if (!SMESH::RemoveHypothesisOrAlgorithmOnMesh(aMeshSO, aHyp))
          nbFail++;
       }
     }
   }
+
   // 3. remove not used algorithms from the mesh
-  for ( it = myMapOldAlgos.begin(); it != myMapOldAlgos.end(); ++it ) {
+  for (it = myMapOldAlgos.begin(); it != myMapOldAlgos.end(); ++it) {
     string ior = it->first;
-    int index = findItem( ListAlgoAssignation, ior );
-    if ( index < 0 ) {
-      SMESH::SMESH_Hypothesis_var aHyp = SMESH::IORToInterface<SMESH::SMESH_Hypothesis>(ior.c_str());
-      if ( !aHyp->_is_nil() ){
-       if (!SMESH::RemoveHypothesisOrAlgorithmOnMesh( aMeshSO, aHyp ))
+    int index = findItem(ListAlgoAssignation, ior);
+    if (index < 0) {
+      SMESH::SMESH_Hypothesis_var aHyp =
+        SMESH::IORToInterface<SMESH::SMESH_Hypothesis>(ior.c_str());
+      if (!aHyp->_is_nil()) {
+       if (!SMESH::RemoveHypothesisOrAlgorithmOnMesh(aMeshSO, aHyp))
          nbFail++;
       }
     }
   }
+
   // 4. Add new algorithms
-  for ( int i = 0; i < ListAlgoAssignation->count(); i++ ) {
-    if ( ListAlgoAssignation->item( i )->rtti() == ListBoxIOR::RTTI_IOR ) {
-      ListBoxIOR* anItem = ( ListBoxIOR* )( ListAlgoAssignation->item( i ) );
-      if ( anItem ) {
+  for (int i = 0; i < ListAlgoAssignation->count(); i++) {
+    if (ListAlgoAssignation->item(i)->rtti() == ListBoxIOR::RTTI_IOR) {
+      ListBoxIOR* anItem = (ListBoxIOR*)(ListAlgoAssignation->item(i));
+      if (anItem) {
        string ior = anItem->GetIOR();
-       if ( myMapOldAlgos.find( ior ) == myMapOldAlgos.end() ) {
-         SMESH::SMESH_Hypothesis_var aHyp = SMESH::IORToInterface<SMESH::SMESH_Hypothesis>(ior.c_str());
-         if ( !aHyp->_is_nil() ){
-           if (!SMESH::AddHypothesisOnMesh( myMesh, aHyp ))
+       if (myMapOldAlgos.find(ior) == myMapOldAlgos.end()) {
+         SMESH::SMESH_Hypothesis_var aHyp =
+            SMESH::IORToInterface<SMESH::SMESH_Hypothesis>(ior.c_str());
+         if (!aHyp->_is_nil()) {
+           if (!SMESH::AddHypothesisOnMesh(myMesh, aHyp))
              nbFail++;
          }
        }
       }
     }
   }
+
   // 5. Add new hypotheses
-  for ( int i = 0; i < ListHypAssignation->count(); i++ ) {
-    if ( ListHypAssignation->item( i )->rtti() == ListBoxIOR::RTTI_IOR ) {
-      ListBoxIOR* anItem = ( ListBoxIOR* )( ListHypAssignation->item( i ) );
-      if ( anItem ) {
+  for (int i = 0; i < ListHypAssignation->count(); i++) {
+    if (ListHypAssignation->item(i)->rtti() == ListBoxIOR::RTTI_IOR) {
+      ListBoxIOR* anItem = (ListBoxIOR*)(ListHypAssignation->item(i));
+      if (anItem) {
        string ior = anItem->GetIOR();
-       if ( myMapOldHypos.find( ior ) == myMapOldHypos.end() ) {
-         SMESH::SMESH_Hypothesis_var aHyp = SMESH::IORToInterface<SMESH::SMESH_Hypothesis>(ior.c_str());
-         if ( !aHyp->_is_nil() ){
-           if (!SMESH::AddHypothesisOnMesh( myMesh, aHyp ))
+       if (myMapOldHypos.find(ior) == myMapOldHypos.end()) {
+         SMESH::SMESH_Hypothesis_var aHyp =
+            SMESH::IORToInterface<SMESH::SMESH_Hypothesis>(ior.c_str());
+         if (!aHyp->_is_nil()) {
+           if (!SMESH::AddHypothesisOnMesh(myMesh, aHyp))
              nbFail++;
          }
        }
       }
     }
   }
-  return ( nbFail == 0 );
+  return (nbFail == 0);
 }
 
 //=================================================================================
@@ -863,74 +883,79 @@ bool SMESHGUI_EditHypothesesDlg::StoreMesh()
 bool SMESHGUI_EditHypothesesDlg::StoreSubMesh()
 {
   MapIOR anOldHypos, aNewHypos;
-  if ( myGeomShape->_is_nil() )
+  if (myGeomShape->_is_nil())
     return false;
+
   // 1. Check whether the geometric shape has changed
-  SALOMEDS::SObject_var aSubMeshSO = SMESH::FindSObject( mySubMesh );
-  GEOM::GEOM_Object_var aIniGeomShape = SMESH::GetShapeOnMeshOrSubMesh( aSubMeshSO );
-  bool bShapeChanged = aIniGeomShape->_is_nil() || !aIniGeomShape->_is_equivalent( myGeomShape );
-  if ( bShapeChanged ) {
+  _PTR(SObject) aSubMeshSO = SMESH::FindSObject(mySubMesh);
+  GEOM::GEOM_Object_var aIniGeomShape = SMESH::GetShapeOnMeshOrSubMesh(aSubMeshSO);
+  bool bShapeChanged = aIniGeomShape->_is_nil() || !aIniGeomShape->_is_equivalent(myGeomShape);
+  if (bShapeChanged) {
     // VSR : TODO : Set new shape - not supported yet by engine
     // 1. remove all old hypotheses and algorithms
     // 2. set new shape
   }
   int nbFail = 0;
   MapIOR::iterator it;
+
   // 2. remove not used hypotheses from the submesh
-  for ( it = myMapOldHypos.begin(); it != myMapOldHypos.end(); ++it ) {
+  for (it = myMapOldHypos.begin(); it != myMapOldHypos.end(); ++it) {
     string ior = it->first;
-    int index = findItem( ListHypAssignation, ior );
-    if ( index < 0 ) {
+    int index = findItem(ListHypAssignation, ior);
+    if (index < 0) {
       SMESH::SMESH_Hypothesis_var aHyp = SMESH::IORToInterface<SMESH::SMESH_Hypothesis>(ior.c_str());
-      if ( !aHyp->_is_nil() ){
-       if (!SMESH::RemoveHypothesisOrAlgorithmOnMesh( aSubMeshSO, aHyp ))
+      if (!aHyp->_is_nil()) {
+       if (!SMESH::RemoveHypothesisOrAlgorithmOnMesh(aSubMeshSO, aHyp))
          nbFail++;
       }
     }
   }
+
   // 3. remove not used algorithms from the submesh
-  for ( it = myMapOldAlgos.begin(); it != myMapOldAlgos.end(); ++it ) {
+  for (it = myMapOldAlgos.begin(); it != myMapOldAlgos.end(); ++it) {
     string ior = it->first;
-    int index = findItem( ListAlgoAssignation, ior );
-    if ( index < 0 ) {
+    int index = findItem(ListAlgoAssignation, ior);
+    if (index < 0) {
       SMESH::SMESH_Hypothesis_var aHyp = SMESH::IORToInterface<SMESH::SMESH_Hypothesis>(ior.c_str());
-      if ( !aHyp->_is_nil() ){
-       if (!SMESH::RemoveHypothesisOrAlgorithmOnMesh( aSubMeshSO, aHyp ))
+      if (!aHyp->_is_nil()){
+       if (!SMESH::RemoveHypothesisOrAlgorithmOnMesh(aSubMeshSO, aHyp))
          nbFail++;
       }
     }
   }
+
   // 4. Add new algorithms
-  for ( int i = 0; i < ListAlgoAssignation->count(); i++ ) {
-    if ( ListAlgoAssignation->item( i )->rtti() == ListBoxIOR::RTTI_IOR ) {
-      ListBoxIOR* anItem = ( ListBoxIOR* )( ListAlgoAssignation->item( i ) );
-      if ( anItem ) {
+  for (int i = 0; i < ListAlgoAssignation->count(); i++) {
+    if (ListAlgoAssignation->item(i)->rtti() == ListBoxIOR::RTTI_IOR) {
+      ListBoxIOR* anItem = (ListBoxIOR*)(ListAlgoAssignation->item(i));
+      if (anItem) {
        string ior = anItem->GetIOR();
-       if ( myMapOldAlgos.find( ior ) == myMapOldAlgos.end() ) {
+       if (myMapOldAlgos.find(ior) == myMapOldAlgos.end()) {
          SMESH::SMESH_Hypothesis_var aHyp = SMESH::IORToInterface<SMESH::SMESH_Hypothesis>(ior.c_str());
-         if ( !aHyp->_is_nil() ){
-           if (!SMESH::AddHypothesisOnSubMesh( mySubMesh, aHyp ))
+         if (!aHyp->_is_nil()){
+           if (!SMESH::AddHypothesisOnSubMesh(mySubMesh, aHyp))
              nbFail++;
          }
        }
       }
     }
   }
+
   // 5. Add new hypotheses
-  for ( int i = 0; i < ListHypAssignation->count(); i++ ) {
-    if ( ListHypAssignation->item( i )->rtti() == ListBoxIOR::RTTI_IOR ) {
-      ListBoxIOR* anItem = ( ListBoxIOR* )( ListHypAssignation->item( i ) );
-      if ( anItem ) {
+  for (int i = 0; i < ListHypAssignation->count(); i++) {
+    if (ListHypAssignation->item(i)->rtti() == ListBoxIOR::RTTI_IOR) {
+      ListBoxIOR* anItem = (ListBoxIOR*)(ListHypAssignation->item(i));
+      if (anItem) {
        string ior = anItem->GetIOR();
-       if ( myMapOldHypos.find( ior ) == myMapOldHypos.end() ) {
+       if (myMapOldHypos.find(ior) == myMapOldHypos.end()) {
          SMESH::SMESH_Hypothesis_var aHyp = SMESH::IORToInterface<SMESH::SMESH_Hypothesis>(ior.c_str());
-         if ( !aHyp->_is_nil() ){
-           if (!SMESH::AddHypothesisOnSubMesh( mySubMesh, aHyp ))
+         if (!aHyp->_is_nil()){
+           if (!SMESH::AddHypothesisOnSubMesh(mySubMesh, aHyp))
              nbFail++;
          }
        }
       }
     }
   }
-  return ( nbFail == 0 );
+  return (nbFail == 0);
 }
index 11ca8d49469f227c12bc09b3d7b9b4e132e7ba61..6c40460e51d335347f1e978d335548e8bfdb8d14 100644 (file)
@@ -29,9 +29,9 @@
 #ifndef DIALOGBOX_EDIT_HYPOTHESES_H
 #define DIALOGBOX_EDIT_HYPOTHESES_H
 
-#include "SALOME_Selection.h"
-#include "SALOME_TypeFilter.hxx"
-#include "SMESH_TypeFilter.hxx"
+//#include "SMESH_TypeFilter.hxx"
+#include "SUIT_SelectionFilter.h"
+#include "SalomeApp_SelectionMgr.h"
 
 // QT Includes
 #include <qdialog.h>
@@ -52,26 +52,29 @@ class QListBox;
 class QListBoxItem;
 class SMESHGUI;
 
-typedef map<string, int> MapIOR;
+typedef map<std::string, int> MapIOR;
 
 //=================================================================================
 // class    : SMESHGUI_EditHypothesesDlg
 // purpose  :
 //=================================================================================
 class SMESHGUI_EditHypothesesDlg : public QDialog
-{ 
+{
     Q_OBJECT
 
 public:
-    SMESHGUI_EditHypothesesDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 );
+    SMESHGUI_EditHypothesesDlg (SMESHGUI*,
+                               const char* name = 0,
+                               bool modal = FALSE,
+                               WFlags fl = 0);
     ~SMESHGUI_EditHypothesesDlg();
 
 protected:
-    virtual void closeEvent( QCloseEvent* e ); 
-    virtual void enterEvent ( QEvent* );
+    virtual void closeEvent (QCloseEvent*);
+    virtual void enterEvent (QEvent*);
 
 private:
-    void Init( SALOME_Selection* Sel ) ;
+    void Init();
 
     void InitHypDefinition();
     void InitAlgoDefinition();
@@ -88,23 +91,25 @@ private:
     bool IsOld(QListBoxItem* hypItem);
 
 private:
-    SMESHGUI*                     mySMESHGUI ;
-    SALOME_Selection*             mySelection ;
-             
-    GEOM::GEOM_Object_var         myGeomShape ;
+    SMESHGUI*                     mySMESHGUI;
+    SalomeApp_SelectionMgr*       mySelectionMgr;
+
+    GEOM::GEOM_Object_var         myGeomShape;
     QLineEdit*                    myEditCurrentArgument; 
 
     SMESH::SMESH_Mesh_var         myMesh;
     SMESH::SMESH_subMesh_var      mySubMesh;
 
-    Handle(SALOME_TypeFilter)     myGeomFilter;
-    Handle(SMESH_TypeFilter)      myMeshOrSubMeshFilter;
+    //Handle(SALOME_TypeFilter)     myGeomFilter;
+    //Handle(SMESH_TypeFilter)      myMeshOrSubMeshFilter;
+    SUIT_SelectionFilter*         myGeomFilter;
+    SUIT_SelectionFilter*         myMeshOrSubMeshFilter;
 
     MapIOR                        myMapOldHypos, myMapOldAlgos;
     int                           myNbModification;
 
     bool                          myImportedMesh;
+
     QGroupBox*    GroupButtons;
     QPushButton*  buttonOk;
     QPushButton*  buttonApply;
@@ -134,10 +139,10 @@ private slots:
     void ClickOnOk();
     bool ClickOnApply();
     void ClickOnCancel();
-    void SetEditCurrentArgument() ;
-    void SelectionIntoArgument() ;
-    void DeactivateActiveDialog() ;
-    void ActivateThisDialog() ;
+    void SetEditCurrentArgument();
+    void SelectionIntoArgument();
+    void DeactivateActiveDialog();
+    void ActivateThisDialog();
 
     void removeItem(QListBoxItem*);
     void addItem(QListBoxItem*);
index 989518fe02b671162ec32071a150deb6d87dbf72..46222594ed97e7242cc0c7d3c3bd6ad8bdbb440a 100644 (file)
@@ -1,55 +1,70 @@
 //  SMESH SMESHGUI : GUI for SMESH component
 //
 //  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
-// 
-//  This library is free software; you can redistribute it and/or 
-//  modify it under the terms of the GNU Lesser General Public 
-//  License as published by the Free Software Foundation; either 
-//  version 2.1 of the License. 
-// 
-//  This library is distributed in the hope that it will be useful, 
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of 
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
-//  Lesser General Public License for more details. 
-// 
-//  You should have received a copy of the GNU Lesser General Public 
-//  License along with this library; if not, write to the Free Software 
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
-// 
-//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
 //
 //
 //
 //  File   : SMESHGUI_ExtrusionAlongPathDlg.cxx
 //  Author : Vadim SANDLER
 //  Module : SMESH
-//  $Header: 
+//  $Header:
 
 #include "SMESHGUI_ExtrusionAlongPathDlg.h"
+
 #include "SMESHGUI.h"
-#include "SMESHGUI_SpinBox.h"
 #include "SMESHGUI_Utils.h"
 #include "SMESHGUI_VTKUtils.h"
 #include "SMESHGUI_MeshUtils.h"
+#include "SMESHGUI_SpinBox.h"
 #include "SMESHGUI_IdValidator.h"
+
 #include "SMESH_Actor.h"
+#include "SMESH_TypeFilter.hxx"
 #include "SMESH_NumberFilter.hxx"
+#include "SMESH_LogicalFilter.hxx"
+
 #include "SMDS_Mesh.hxx"
-#include "GEOM_ShapeTypeFilter.hxx"
+
 #include "GEOMBase.h"
 
-#include "QAD_Application.h"
-#include "QAD_WaitCursor.h"
-#include "QAD_Desktop.h"
-#include "QAD_MessageBox.h"
+#include "SUIT_ResourceMgr.h"
+#include "SUIT_OverrideCursor.h"
+#include "SUIT_Desktop.h"
+#include "SUIT_MessageBox.h"
+
+#include "SVTK_ViewModel.h"
+#include "SVTK_ViewWindow.h"
+#include "SVTK_Selector.h"
+#include "SVTK_Selection.h"
+#include "SALOME_ListIO.hxx"
+
 #include "utilities.h"
 
+// OCCT Includes
 #include <BRep_Tool.hxx>
 #include <TopoDS_Shape.hxx>
 #include <TopoDS.hxx>
 #include <TopoDS_Vertex.hxx>
 #include <gp_Pnt.hxx>
+#include <TColStd_MapOfInteger.hxx>
+#include <TColStd_IndexedMapOfInteger.hxx>
 
 // QT Includes
 #include <qapplication.h>
@@ -65,6 +80,7 @@
 #include <qlayout.h>
 #include <qvalidator.h>
 #include <qptrlist.h>
+#include <qpixmap.h>
 
 // IDL Headers
 #include "SALOMEconfig.h"
 using namespace std;
 
 //=================================================================================
-// function : SMESHGUI_ExtrusionAlongPathDlg::SMESHGUI_ExtrusionAlongPathDlg()
+// function : SMESHGUI_ExtrusionAlongPathDlg()
 // purpose  : constructor
 //=================================================================================
-SMESHGUI_ExtrusionAlongPathDlg::SMESHGUI_ExtrusionAlongPathDlg( QWidget* parent, SALOME_Selection* Sel, bool modal )
-     : QDialog( parent, "SMESHGUI_ExtrusionAlongPathDlg", modal, 
-               WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | Qt::WDestructiveClose )
+SMESHGUI_ExtrusionAlongPathDlg::SMESHGUI_ExtrusionAlongPathDlg( SMESHGUI* theModule,
+                                                                bool modal )
+     : QDialog( SMESH::GetDesktop( theModule ), "SMESHGUI_ExtrusionAlongPathDlg", modal,
+                WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | Qt::WDestructiveClose),
+     mySMESHGUI( theModule ),
+     mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ),
+     myViewWindow( SMESH::GetViewWindow( theModule ) ),
+     mySelector( myViewWindow->GetSelector() )
 {
-  MESSAGE("SMESHGUI_ExtrusionAlongPathDlg::SMESHGUI_ExtrusionAlongPathDlg");
+  QPixmap edgeImage   (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_DLG_EDGE")));
+  QPixmap faceImage   (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_DLG_TRIANGLE")));
+  QPixmap selectImage (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_SELECT")));
+  QPixmap addImage    (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_APPEND")));
+  QPixmap removeImage (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_REMOVE")));
+
   myType = -1;
-  QPixmap edgeImage  ( QAD_Desktop::getResourceManager()->loadPixmap( "SMESH", tr( "ICON_DLG_EDGE" ) ) );
-  QPixmap faceImage  ( QAD_Desktop::getResourceManager()->loadPixmap( "SMESH", tr( "ICON_DLG_TRIANGLE" ) ) );
-  QPixmap selectImage( QAD_Desktop::getResourceManager()->loadPixmap( "SMESH", tr( "ICON_SELECT" ) ) );
-  QPixmap addImage   ( QAD_Desktop::getResourceManager()->loadPixmap( "SMESH", tr( "ICON_APPEND" ) ) );
-  QPixmap removeImage( QAD_Desktop::getResourceManager()->loadPixmap( "SMESH", tr( "ICON_REMOVE" ) ) );
 
-  setCaption( tr( "EXTRUSION_ALONG_PATH" ) );
-  setSizeGripEnabled( TRUE );
+  setCaption(tr("EXTRUSION_ALONG_PATH"));
+  setSizeGripEnabled(TRUE);
 
-  QGridLayout* topLayout = new QGridLayout( this ); 
-  topLayout->setSpacing( 6 ); topLayout->setMargin( 11 );
+  QGridLayout* topLayout = new QGridLayout(this);
+  topLayout->setSpacing(6);
+  topLayout->setMargin(11);
 
   /***************************************************************/
   // Elements type group box (1d / 2d elements)
-  ElementsTypeGrp = new QButtonGroup( tr( "SMESH_EXTRUSION" ), this );
-  ElementsTypeGrp->setColumnLayout( 0, Qt::Vertical );
-  ElementsTypeGrp->layout()->setSpacing( 0 );  ElementsTypeGrp->layout()->setMargin( 0 );
-  QGridLayout* ElementsTypeGrpLayout = new QGridLayout( ElementsTypeGrp->layout() );
-  ElementsTypeGrpLayout->setAlignment( Qt::AlignTop );
-  ElementsTypeGrpLayout->setSpacing( 6 ); ElementsTypeGrpLayout->setMargin( 11 );
-
-  Elements1dRB = new QRadioButton( ElementsTypeGrp );
-  Elements1dRB->setPixmap( edgeImage );
-  Elements2dRB = new QRadioButton( ElementsTypeGrp );
-  Elements2dRB->setPixmap( faceImage );
-  Elements1dRB->setChecked( true );
+  GroupConstructors = new QButtonGroup(tr("SMESH_EXTRUSION"), this);
+  GroupConstructors->setColumnLayout(0, Qt::Vertical);
+  GroupConstructors->layout()->setSpacing(0);
+  GroupConstructors->layout()->setMargin(0);
+  QGridLayout* GroupConstructorsLayout = new QGridLayout(GroupConstructors->layout());
+  GroupConstructorsLayout->setAlignment(Qt::AlignTop);
+  GroupConstructorsLayout->setSpacing(6); GroupConstructorsLayout->setMargin(11);
+
+  Elements1dRB = new QRadioButton(GroupConstructors);
+  Elements1dRB->setPixmap(edgeImage);
+  Elements2dRB = new QRadioButton(GroupConstructors);
+  Elements2dRB->setPixmap(faceImage);
+  Elements1dRB->setChecked(true);
 
   // layouting
-  ElementsTypeGrpLayout->addWidget( Elements1dRB, 0, 0 );
-  ElementsTypeGrpLayout->addWidget( Elements2dRB, 0, 2 );
-  
+  GroupConstructorsLayout->addWidget(Elements1dRB, 0, 0);
+  GroupConstructorsLayout->addWidget(Elements2dRB, 0, 2);
+
   /***************************************************************/
   // Arguments group box
-  ArgumentsGrp = new QGroupBox( tr( "EXTRUSION_1D" ), this );
-  ArgumentsGrp->setColumnLayout( 0, Qt::Vertical );
-  ArgumentsGrp->layout()->setSpacing( 0 ); ArgumentsGrp->layout()->setMargin( 0 );
-  QGridLayout* ArgumentsGrpLayout = new QGridLayout( ArgumentsGrp->layout() );
-  ArgumentsGrpLayout->setAlignment( Qt::AlignTop );
-  ArgumentsGrpLayout->setSpacing( 6 ); ArgumentsGrpLayout->setMargin( 11 );
+  GroupArguments = new QGroupBox(tr("EXTRUSION_1D"), this);
+  GroupArguments->setColumnLayout(0, Qt::Vertical);
+  GroupArguments->layout()->setSpacing(0); GroupArguments->layout()->setMargin(0);
+  QGridLayout* GroupArgumentsLayout = new QGridLayout(GroupArguments->layout());
+  GroupArgumentsLayout->setAlignment(Qt::AlignTop);
+  GroupArgumentsLayout->setSpacing(6); GroupArgumentsLayout->setMargin(11);
 
   // Controls for elements selection
-  ElementsLab = new QLabel( tr( "SMESH_ID_ELEMENTS" ), ArgumentsGrp );
+  ElementsLab = new QLabel(tr("SMESH_ID_ELEMENTS"), GroupArguments);
 
-  SelectElementsButton = new QToolButton( ArgumentsGrp );
-  SelectElementsButton->setPixmap( selectImage );
+  SelectElementsButton = new QToolButton(GroupArguments);
+  SelectElementsButton->setPixmap(selectImage);
 
-  ElementsLineEdit = new QLineEdit( ArgumentsGrp );
-  ElementsLineEdit->setValidator( new SMESHGUI_IdValidator( this ) );
+  ElementsLineEdit = new QLineEdit(GroupArguments);
+  ElementsLineEdit->setValidator(new SMESHGUI_IdValidator(this));
 
   // Controls for the whole mesh selection
-  MeshCheck = new QCheckBox( tr( "SMESH_SELECT_WHOLE_MESH" ), ArgumentsGrp );
+  MeshCheck = new QCheckBox(tr("SMESH_SELECT_WHOLE_MESH"), GroupArguments);
 
   // Controls for path selection
-  PathGrp = new QGroupBox( tr( "SMESH_PATH" ), ArgumentsGrp );
-  PathGrp->setColumnLayout( 0, Qt::Vertical );
-  PathGrp->layout()->setSpacing( 0 ); PathGrp->layout()->setMargin( 0 );
-  QGridLayout* PathGrpLayout = new QGridLayout( PathGrp->layout() );
-  PathGrpLayout->setAlignment( Qt::AlignTop );
-  PathGrpLayout->setSpacing( 6 ); PathGrpLayout->setMargin( 11 );
-  
+  PathGrp = new QGroupBox(tr("SMESH_PATH"), GroupArguments);
+  PathGrp->setColumnLayout(0, Qt::Vertical);
+  PathGrp->layout()->setSpacing(0); PathGrp->layout()->setMargin(0);
+  QGridLayout* PathGrpLayout = new QGridLayout(PathGrp->layout());
+  PathGrpLayout->setAlignment(Qt::AlignTop);
+  PathGrpLayout->setSpacing(6); PathGrpLayout->setMargin(11);
+
   // Controls for path mesh selection
-  PathMeshLab = new QLabel( tr( "SMESH_PATH_MESH" ), PathGrp );
+  PathMeshLab = new QLabel(tr("SMESH_PATH_MESH"), PathGrp);
 
-  SelectPathMeshButton = new QToolButton( PathGrp );
-  SelectPathMeshButton->setPixmap( selectImage );
+  SelectPathMeshButton = new QToolButton(PathGrp);
+  SelectPathMeshButton->setPixmap(selectImage);
 
-  PathMeshLineEdit = new QLineEdit( PathGrp );
-  PathMeshLineEdit->setReadOnly( true );
+  PathMeshLineEdit = new QLineEdit(PathGrp);
+  PathMeshLineEdit->setReadOnly(true);
 
   // Controls for path shape selection
-  PathShapeLab = new QLabel( tr( "SMESH_PATH_SHAPE" ), PathGrp );
+  PathShapeLab = new QLabel(tr("SMESH_PATH_SHAPE"), PathGrp);
 
-  SelectPathShapeButton = new QToolButton( PathGrp );
-  SelectPathShapeButton->setPixmap( selectImage );
+  SelectPathShapeButton = new QToolButton(PathGrp);
+  SelectPathShapeButton->setPixmap(selectImage);
 
-  PathShapeLineEdit = new QLineEdit( PathGrp );
-  PathShapeLineEdit->setReadOnly( true );
+  PathShapeLineEdit = new QLineEdit(PathGrp);
+  PathShapeLineEdit->setReadOnly(true);
 
   // Controls for path starting point selection
-  StartPointLab = new QLabel( tr( "SMESH_PATH_START" ), PathGrp );
+  StartPointLab = new QLabel(tr("SMESH_PATH_START"), PathGrp);
 
-  SelectStartPointButton = new QToolButton( PathGrp );
-  SelectStartPointButton->setPixmap( selectImage );
+  SelectStartPointButton = new QToolButton(PathGrp);
+  SelectStartPointButton->setPixmap(selectImage);
 
-  StartPointLineEdit = new QLineEdit( PathGrp );
-  StartPointLineEdit->setValidator( new QIntValidator( this ) );
+  StartPointLineEdit = new QLineEdit(PathGrp);
+  StartPointLineEdit->setValidator(new QIntValidator(this));
 
   // layouting
-  PathGrpLayout->addWidget( PathMeshLab,            0, 0 );
-  PathGrpLayout->addWidget( SelectPathMeshButton,   0, 1 );
-  PathGrpLayout->addWidget( PathMeshLineEdit,       0, 2 );
-  PathGrpLayout->addWidget( PathShapeLab,           1, 0 );
-  PathGrpLayout->addWidget( SelectPathShapeButton,  1, 1 );
-  PathGrpLayout->addWidget( PathShapeLineEdit,      1, 2 );
-  PathGrpLayout->addWidget( StartPointLab,          2, 0 );
-  PathGrpLayout->addWidget( SelectStartPointButton, 2, 1 );
-  PathGrpLayout->addWidget( StartPointLineEdit,     2, 2 );
+  PathGrpLayout->addWidget(PathMeshLab,            0, 0);
+  PathGrpLayout->addWidget(SelectPathMeshButton,   0, 1);
+  PathGrpLayout->addWidget(PathMeshLineEdit,       0, 2);
+  PathGrpLayout->addWidget(PathShapeLab,           1, 0);
+  PathGrpLayout->addWidget(SelectPathShapeButton,  1, 1);
+  PathGrpLayout->addWidget(PathShapeLineEdit,      1, 2);
+  PathGrpLayout->addWidget(StartPointLab,          2, 0);
+  PathGrpLayout->addWidget(SelectStartPointButton, 2, 1);
+  PathGrpLayout->addWidget(StartPointLineEdit,     2, 2);
 
   // Controls for base point defining
-  BasePointCheck = new QCheckBox( tr( "SMESH_USE_BASE_POINT" ), ArgumentsGrp );
-
-  BasePointGrp = new QGroupBox( tr( "SMESH_BASE_POINT" ), ArgumentsGrp );
-  BasePointGrp->setColumnLayout( 0, Qt::Vertical );
-  BasePointGrp->layout()->setSpacing( 0 ); BasePointGrp->layout()->setMargin( 0 );
-  QGridLayout* BasePointGrpLayout = new QGridLayout( BasePointGrp->layout() );
-  BasePointGrpLayout->setAlignment( Qt::AlignTop );
-  BasePointGrpLayout->setSpacing( 6 ); BasePointGrpLayout->setMargin( 11 );
-  
-  SelectBasePointButton = new QToolButton( BasePointGrp );
-  SelectBasePointButton->setPixmap( selectImage );
-
-  XLab  = new QLabel( tr( "SMESH_X" ), BasePointGrp );
-  XSpin = new SMESHGUI_SpinBox( BasePointGrp );
-  YLab  = new QLabel( tr( "SMESH_Y" ), BasePointGrp );
-  YSpin = new SMESHGUI_SpinBox( BasePointGrp );
-  ZLab  = new QLabel( tr( "SMESH_Z" ), BasePointGrp );
-  ZSpin = new SMESHGUI_SpinBox( BasePointGrp );
+  BasePointCheck = new QCheckBox(tr("SMESH_USE_BASE_POINT"), GroupArguments);
+
+  BasePointGrp = new QGroupBox(tr("SMESH_BASE_POINT"), GroupArguments);
+  BasePointGrp->setColumnLayout(0, Qt::Vertical);
+  BasePointGrp->layout()->setSpacing(0); BasePointGrp->layout()->setMargin(0);
+  QGridLayout* BasePointGrpLayout = new QGridLayout(BasePointGrp->layout());
+  BasePointGrpLayout->setAlignment(Qt::AlignTop);
+  BasePointGrpLayout->setSpacing(6); BasePointGrpLayout->setMargin(11);
+
+  SelectBasePointButton = new QToolButton(BasePointGrp);
+  SelectBasePointButton->setPixmap(selectImage);
+
+  XLab  = new QLabel(tr("SMESH_X"), BasePointGrp);
+  XSpin = new SMESHGUI_SpinBox(BasePointGrp);
+  YLab  = new QLabel(tr("SMESH_Y"), BasePointGrp);
+  YSpin = new SMESHGUI_SpinBox(BasePointGrp);
+  ZLab  = new QLabel(tr("SMESH_Z"), BasePointGrp);
+  ZSpin = new SMESHGUI_SpinBox(BasePointGrp);
 
   // layouting
-  BasePointGrpLayout->addWidget( SelectBasePointButton, 0, 0 );
-  BasePointGrpLayout->addWidget( XLab,                  0, 1 );
-  BasePointGrpLayout->addWidget( XSpin,                 0, 2 );
-  BasePointGrpLayout->addWidget( YLab,                  0, 3 );
-  BasePointGrpLayout->addWidget( YSpin,                 0, 4 );
-  BasePointGrpLayout->addWidget( ZLab,                  0, 5 );
-  BasePointGrpLayout->addWidget( ZSpin,                 0, 6 );
+  BasePointGrpLayout->addWidget(SelectBasePointButton, 0, 0);
+  BasePointGrpLayout->addWidget(XLab,                  0, 1);
+  BasePointGrpLayout->addWidget(XSpin,                 0, 2);
+  BasePointGrpLayout->addWidget(YLab,                  0, 3);
+  BasePointGrpLayout->addWidget(YSpin,                 0, 4);
+  BasePointGrpLayout->addWidget(ZLab,                  0, 5);
+  BasePointGrpLayout->addWidget(ZSpin,                 0, 6);
 
   // Controls for angles defining
-  AnglesCheck = new QCheckBox( tr( "SMESH_USE_ANGLES" ), ArgumentsGrp );
-  
-  AnglesGrp = new QGroupBox( tr( "SMESH_ANGLES" ), ArgumentsGrp );
-  AnglesGrp->setColumnLayout( 0, Qt::Vertical );
-  AnglesGrp->layout()->setSpacing( 0 ); AnglesGrp->layout()->setMargin( 0 );
-  QGridLayout* AnglesGrpLayout = new QGridLayout( AnglesGrp->layout() );
-  AnglesGrpLayout->setAlignment( Qt::AlignTop );
-  AnglesGrpLayout->setSpacing( 6 ); AnglesGrpLayout->setMargin( 11 );
-  
-  AnglesList = new QListBox( AnglesGrp );
-  AnglesList->setSelectionMode( QListBox::Extended );
-
-  AddAngleButton = new QToolButton( AnglesGrp ); 
-  AddAngleButton->setPixmap( addImage );
-
-  RemoveAngleButton = new QToolButton( AnglesGrp ); 
-  RemoveAngleButton->setPixmap( removeImage );
-
-  AngleSpin = new SMESHGUI_SpinBox( AnglesGrp );
+  AnglesCheck = new QCheckBox(tr("SMESH_USE_ANGLES"), GroupArguments);
+
+  AnglesGrp = new QGroupBox(tr("SMESH_ANGLES"), GroupArguments);
+  AnglesGrp->setColumnLayout(0, Qt::Vertical);
+  AnglesGrp->layout()->setSpacing(0); AnglesGrp->layout()->setMargin(0);
+  QGridLayout* AnglesGrpLayout = new QGridLayout(AnglesGrp->layout());
+  AnglesGrpLayout->setAlignment(Qt::AlignTop);
+  AnglesGrpLayout->setSpacing(6); AnglesGrpLayout->setMargin(11);
+
+  AnglesList = new QListBox(AnglesGrp);
+  AnglesList->setSelectionMode(QListBox::Extended);
+
+  AddAngleButton = new QToolButton(AnglesGrp);
+  AddAngleButton->setPixmap(addImage);
+
+  RemoveAngleButton = new QToolButton(AnglesGrp);
+  RemoveAngleButton->setPixmap(removeImage);
+
+  AngleSpin = new SMESHGUI_SpinBox(AnglesGrp);
 
   // layouting
-  QVBoxLayout* bLayout = new QVBoxLayout(); 
-  bLayout->addWidget( AddAngleButton );
-  bLayout->addSpacing( 6 );
-  bLayout->addWidget( RemoveAngleButton );
+  QVBoxLayout* bLayout = new QVBoxLayout();
+  bLayout->addWidget(AddAngleButton);
+  bLayout->addSpacing(6);
+  bLayout->addWidget(RemoveAngleButton);
   bLayout->addStretch();
-  AnglesGrpLayout->addMultiCellWidget( AnglesList, 0, 1, 0, 0 );
-  AnglesGrpLayout->addMultiCellLayout( bLayout,    0, 1, 1, 1 );
-  AnglesGrpLayout->addWidget(          AngleSpin,  0,    2    );
-  AnglesGrpLayout->setRowStretch( 1, 10 );
-  
+  AnglesGrpLayout->addMultiCellWidget(AnglesList, 0, 1, 0, 0);
+  AnglesGrpLayout->addMultiCellLayout(bLayout,    0, 1, 1, 1);
+  AnglesGrpLayout->addWidget(         AngleSpin,  0,    2   );
+  AnglesGrpLayout->setRowStretch(1, 10);
+
   // layouting
-  ArgumentsGrpLayout->addWidget(          ElementsLab,            0,    0    );
-  ArgumentsGrpLayout->addWidget(          SelectElementsButton,   0,    1    );
-  ArgumentsGrpLayout->addWidget(          ElementsLineEdit,       0,    2    );
-  ArgumentsGrpLayout->addMultiCellWidget( MeshCheck,              1, 1, 0, 2 );
-  ArgumentsGrpLayout->addMultiCellWidget( PathGrp,                2, 2, 0, 2 );
-  ArgumentsGrpLayout->addWidget(          BasePointCheck,         3,    0    );
-  ArgumentsGrpLayout->addMultiCellWidget( BasePointGrp,           3, 4, 1, 2 );
-  ArgumentsGrpLayout->addWidget(          AnglesCheck,            5,    0    );
-  ArgumentsGrpLayout->addMultiCellWidget( AnglesGrp,              5, 6, 1, 2 );
-  ArgumentsGrpLayout->setRowStretch( 6, 10 );
+  GroupArgumentsLayout->addWidget(         ElementsLab,            0,    0   );
+  GroupArgumentsLayout->addWidget(         SelectElementsButton,   0,    1   );
+  GroupArgumentsLayout->addWidget(         ElementsLineEdit,       0,    2   );
+  GroupArgumentsLayout->addMultiCellWidget(MeshCheck,              1, 1, 0, 2);
+  GroupArgumentsLayout->addMultiCellWidget(PathGrp,                2, 2, 0, 2);
+  GroupArgumentsLayout->addWidget(         BasePointCheck,         3,    0   );
+  GroupArgumentsLayout->addMultiCellWidget(BasePointGrp,           3, 4, 1, 2);
+  GroupArgumentsLayout->addWidget(         AnglesCheck,            5,    0   );
+  GroupArgumentsLayout->addMultiCellWidget(AnglesGrp,              5, 6, 1, 2);
+  GroupArgumentsLayout->setRowStretch(6, 10);
 
   /***************************************************************/
   // common buttons group box
-  ButtonsGrp = new QGroupBox( this );
-  ButtonsGrp->setColumnLayout( 0, Qt::Vertical );
-  ButtonsGrp->layout()->setSpacing( 0 ); ButtonsGrp->layout()->setMargin( 0 );
-  QGridLayout* ButtonsGrpLayout = new QGridLayout( ButtonsGrp->layout() );
-  ButtonsGrpLayout->setAlignment( Qt::AlignTop );
-  ButtonsGrpLayout->setSpacing( 6 ); ButtonsGrpLayout->setMargin( 11 );
+  GroupButtons = new QGroupBox(this);
+  GroupButtons->setColumnLayout(0, Qt::Vertical);
+  GroupButtons->layout()->setSpacing(0);
+  GroupButtons->layout()->setMargin(0);
+  QGridLayout* GroupButtonsLayout = new QGridLayout(GroupButtons->layout());
+  GroupButtonsLayout->setAlignment(Qt::AlignTop);
+  GroupButtonsLayout->setSpacing(6); GroupButtonsLayout->setMargin(11);
 
-  OkButton = new QPushButton( tr( "SMESH_BUT_OK" ), ButtonsGrp );
-  OkButton->setAutoDefault( true );
-  OkButton->setDefault( true );
+  OkButton = new QPushButton(tr("SMESH_BUT_OK"), GroupButtons);
+  OkButton->setAutoDefault(true);
+  OkButton->setDefault(true);
 
-  ApplyButton = new QPushButton( tr( "SMESH_BUT_APPLY" ), ButtonsGrp );
-  ApplyButton->setAutoDefault( true );
+  ApplyButton = new QPushButton(tr("SMESH_BUT_APPLY"), GroupButtons);
+  ApplyButton->setAutoDefault(true);
 
-  CloseButton = new QPushButton( tr( "SMESH_BUT_CLOSE" ), ButtonsGrp );
-  CloseButton->setAutoDefault( true );
+  CloseButton = new QPushButton(tr("SMESH_BUT_CLOSE"), GroupButtons);
+  CloseButton->setAutoDefault(true);
 
   // layouting
-  ButtonsGrpLayout->addWidget( OkButton,    0, 0 );
-  ButtonsGrpLayout->addWidget( ApplyButton, 0, 1 );
-  ButtonsGrpLayout->addWidget( CloseButton, 0, 3 );
-  ButtonsGrpLayout->addColSpacing( 2, 10 );
-  ButtonsGrpLayout->setColStretch( 2, 10 );
+  GroupButtonsLayout->addWidget(OkButton,    0, 0);
+  GroupButtonsLayout->addWidget(ApplyButton, 0, 1);
+  GroupButtonsLayout->addWidget(CloseButton, 0, 3);
+  GroupButtonsLayout->addColSpacing(2, 10);
+  GroupButtonsLayout->setColStretch(2, 10);
 
   /***************************************************************/
   // layouting
-  topLayout->addWidget( ElementsTypeGrp, 0, 0 );
-  topLayout->addWidget( ArgumentsGrp,    1, 0 );
-  topLayout->addWidget( ButtonsGrp,      2, 0 );
+  topLayout->addWidget(GroupConstructors, 0, 0);
+  topLayout->addWidget(GroupArguments,    1, 0);
+  topLayout->addWidget(GroupButtons,      2, 0);
 
   /***************************************************************/
   // Initialisations
-  XSpin->RangeStepAndValidator( -999999.999, +999999.999, 10.0, 3 );
-  YSpin->RangeStepAndValidator( -999999.999, +999999.999, 10.0, 3 );
-  ZSpin->RangeStepAndValidator( -999999.999, +999999.999, 10.0, 3 );
-  AngleSpin->RangeStepAndValidator( -999999.999, +999999.999, 5.0, 3 );
-  mySelection = Sel;  
-  mySMESHGUI = SMESHGUI::GetSMESHGUI() ;
-  mySMESHGUI->SetActiveDialogBox( this ) ;
-  
+  XSpin->RangeStepAndValidator(-999999.999, +999999.999, 10.0, 3);
+  YSpin->RangeStepAndValidator(-999999.999, +999999.999, 10.0, 3);
+  ZSpin->RangeStepAndValidator(-999999.999, +999999.999, 10.0, 3);
+  AngleSpin->RangeStepAndValidator(-999999.999, +999999.999, 5.0, 3);
+
+  mySMESHGUI->SetActiveDialogBox(this);
+
   // Costruction of the logical filter for the elements: mesh/sub-mesh/group
-  SMESH_ListOfFilter aListOfFilters;
-  Handle(SMESH_TypeFilter) aMeshOrSubMeshFilter = new SMESH_TypeFilter( MESHorSUBMESH );
-  if ( !aMeshOrSubMeshFilter.IsNull() )
-    aListOfFilters.Append( aMeshOrSubMeshFilter );
-  Handle(SMESH_TypeFilter) aSmeshGroupFilter = new SMESH_TypeFilter( GROUP );
-  if ( !aSmeshGroupFilter.IsNull() )
-    aListOfFilters.Append( aSmeshGroupFilter );
-  
-  myElementsFilter = new SMESH_LogicalFilter( aListOfFilters, SMESH_LogicalFilter::LO_OR );
-  
-  myPathMeshFilter = new SMESH_TypeFilter( MESH );
-  
+  SMESH_TypeFilter* aMeshOrSubMeshFilter = new SMESH_TypeFilter (MESHorSUBMESH);
+  SMESH_TypeFilter* aSmeshGroupFilter    = new SMESH_TypeFilter (GROUP);
+
+  QPtrList<SUIT_SelectionFilter> aListOfFilters;
+  if (aMeshOrSubMeshFilter) aListOfFilters.append(aMeshOrSubMeshFilter);
+  if (aSmeshGroupFilter)    aListOfFilters.append(aSmeshGroupFilter);
+
+  myElementsFilter = new SMESH_LogicalFilter (aListOfFilters, SMESH_LogicalFilter::LO_OR);
+  myPathMeshFilter = new SMESH_TypeFilter (MESH);
+
   Init();
 
   /***************************************************************/
   // signals-slots connections
-  connect( OkButton,     SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
-  connect( CloseButton,  SIGNAL( clicked() ), this, SLOT( reject() ) ) ;
-  connect( ApplyButton,  SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) );
-
-  connect( AddAngleButton,    SIGNAL( clicked() ), this, SLOT( OnAngleAdded() ) );
-  connect( RemoveAngleButton, SIGNAL( clicked() ), this, SLOT( OnAngleRemoved() ) );
-
-  connect( ElementsTypeGrp, SIGNAL( clicked( int ) ), SLOT( TypeChanged( int ) ) );
-  
-  connect( SelectElementsButton,   SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ;
-  connect( SelectPathMeshButton,   SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ;
-  connect( SelectPathShapeButton,  SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ;
-  connect( SelectStartPointButton, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ;
-  connect( SelectBasePointButton,  SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ;
-
-  connect( mySMESHGUI,  SIGNAL( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ;
-  connect( mySelection, SIGNAL( currentSelectionChanged() ),      this, SLOT( SelectionIntoArgument() ) );
-  connect( mySMESHGUI,  SIGNAL( SignalCloseAllDialogs() ),        this, SLOT( reject() ) ) ;
-
-  connect( ElementsLineEdit, SIGNAL( textChanged( const QString& ) ),
-          SLOT( onTextChange( const QString& ) ) );
-  connect( StartPointLineEdit, SIGNAL( textChanged( const QString& ) ),
-          SLOT( onTextChange( const QString& ) ) );
-
-  connect( MeshCheck,      SIGNAL( toggled( bool ) ), SLOT( onSelectMesh() ) );
-  connect( AnglesCheck,    SIGNAL( toggled( bool ) ), SLOT( onAnglesCheck() ) );
-  connect( BasePointCheck, SIGNAL( toggled( bool ) ), SLOT( onBasePointCheck() ) );
-
-  AnglesList->installEventFilter( this );
-  ElementsLineEdit->installEventFilter( this );
-  StartPointLineEdit->installEventFilter( this );
-  XSpin->editor()->installEventFilter( this );
-  YSpin->editor()->installEventFilter( this );
-  ZSpin->editor()->installEventFilter( this );
+  connect(OkButton,     SIGNAL(clicked()), this, SLOT(ClickOnOk()));
+  connect(CloseButton,  SIGNAL(clicked()), this, SLOT(reject()));
+  connect(ApplyButton,  SIGNAL(clicked()), this, SLOT(ClickOnApply()));
+
+  connect(AddAngleButton,    SIGNAL(clicked()), this, SLOT(OnAngleAdded()));
+  connect(RemoveAngleButton, SIGNAL(clicked()), this, SLOT(OnAngleRemoved()));
+
+  connect(GroupConstructors, SIGNAL(clicked(int)), SLOT(ConstructorsClicked(int)));
+
+  connect(SelectElementsButton,   SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
+  connect(SelectPathMeshButton,   SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
+  connect(SelectPathShapeButton,  SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
+  connect(SelectStartPointButton, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
+  connect(SelectBasePointButton,  SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
+
+  connect(mySMESHGUI,  SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog()));
+  connect(mySelectionMgr, SIGNAL(currentSelectionChanged()),      this, SLOT(SelectionIntoArgument()));
+  connect(mySMESHGUI,  SIGNAL(SignalCloseAllDialogs()),        this, SLOT(reject()));
+
+  connect(ElementsLineEdit, SIGNAL(textChanged(const QString&)),
+          SLOT(onTextChange(const QString&)));
+  connect(StartPointLineEdit, SIGNAL(textChanged(const QString&)),
+          SLOT(onTextChange(const QString&)));
+
+  connect(MeshCheck,      SIGNAL(toggled(bool)), SLOT(onSelectMesh()));
+  connect(AnglesCheck,    SIGNAL(toggled(bool)), SLOT(onAnglesCheck()));
+  connect(BasePointCheck, SIGNAL(toggled(bool)), SLOT(onBasePointCheck()));
+
+  AnglesList->installEventFilter(this);
+  ElementsLineEdit->installEventFilter(this);
+  StartPointLineEdit->installEventFilter(this);
+  XSpin->editor()->installEventFilter(this);
+  YSpin->editor()->installEventFilter(this);
+  ZSpin->editor()->installEventFilter(this);
 
   /***************************************************************/
   // set position and show dialog box
-  int x, y ;
-  mySMESHGUI->DefineDlgPosition( this, x, y ) ;
-  this->move( x, y ) ;
-  this->show() ; // displays Dialog
+  int x, y;
+  mySMESHGUI->DefineDlgPosition(this, x, y);
+  this->move(x, y);
+  this->show(); // displays Dialog
 }
 
 //=================================================================================
-// function : SMESHGUI_ExtrusionAlongPathDlg::~SMESHGUI_ExtrusionAlongPathDlg()
+// function : ~SMESHGUI_ExtrusionAlongPathDlg()
 // purpose  : destructor
 //=================================================================================
 SMESHGUI_ExtrusionAlongPathDlg::~SMESHGUI_ExtrusionAlongPathDlg()
 {
-  MESSAGE("SMESHGUI_ExtrusionAlongPathDlg::~SMESHGUI_ExtrusionAlongPathDlg");
   // no need to delete child widgets, Qt does it all for us
 }
 
 //=================================================================================
-// function : SMESHGUI_ExtrusionAlongPathDlg::eventFilter
-// purpose  : event filter
-//=================================================================================
-bool SMESHGUI_ExtrusionAlongPathDlg::eventFilter( QObject* object, QEvent* event )
-{
-  if ( event->type() == QEvent::KeyPress ) {
-    QKeyEvent* ke = ( QKeyEvent* )event;
-    if ( object == AnglesList ) {
-      if ( ke->key() == Key_Delete )
-       OnAngleRemoved();
-    }
-  }
-  else if ( event->type() == QEvent::FocusIn ) {
-    if ( object == ElementsLineEdit ) {
-      if ( myEditCurrentArgument != ElementsLineEdit )
-       SetEditCurrentArgument( SelectElementsButton );
-    }
-    else if ( object == StartPointLineEdit ) {
-      if ( myEditCurrentArgument != StartPointLineEdit )
-       SetEditCurrentArgument( SelectStartPointButton );
-    }
-    else if ( object == XSpin->editor() || object == YSpin->editor() || object == ZSpin->editor() ) {
-      if ( myEditCurrentArgument != XSpin )
-       SetEditCurrentArgument( SelectBasePointButton );
-    }
-  }
-  return QDialog::eventFilter( object, event );
-}
-
-//=================================================================================
-// function : SMESHGUI_ExtrusionAlongPathDlg::Init()
+// function : Init()
 // purpose  : initialization
 //=================================================================================
-void SMESHGUI_ExtrusionAlongPathDlg::Init( bool ResetControls )
+void SMESHGUI_ExtrusionAlongPathDlg::Init (bool ResetControls)
 {
-  MESSAGE("SMESHGUI_ExtrusionAlongPathDlg::Init");
   myBusy = false;
   myEditCurrentArgument = 0;
+
   myMesh      = SMESH::SMESH_Mesh::_nil();
   myIDSource  = SMESH::SMESH_IDSource::_nil();
   myMeshActor = 0;
   myPathMesh  = SMESH::SMESH_Mesh::_nil();
   myPathShape = GEOM::GEOM_Object::_nil();
-  
+
   ElementsLineEdit->clear();
   PathMeshLineEdit->clear();
   PathShapeLineEdit->clear();
   StartPointLineEdit->clear();
 
-  if( ResetControls ) {
-    XSpin->SetValue( 0.0 );
-    YSpin->SetValue( 0.0 );
-    ZSpin->SetValue( 0.0 );
-    
-    AngleSpin->SetValue( 45 );
-    MeshCheck->setChecked( false );
-    TypeChanged( 0 );
+  if (ResetControls) {
+    XSpin->SetValue(0.0);
+    YSpin->SetValue(0.0);
+    ZSpin->SetValue(0.0);
+
+    AngleSpin->SetValue(45);
+    MeshCheck->setChecked(false);
+    ConstructorsClicked(0);
     onSelectMesh();
     onAnglesCheck();
     onBasePointCheck();
   }
-  SetEditCurrentArgument( 0 );
+  SetEditCurrentArgument(0);
 }
 
 //=================================================================================
-// function : SMESHGUI_ExtrusionAlongPathDlg::TypeChanged()
-// purpose  : Called when user changes type of elements ( 1d / 2d )
+// function : ConstructorsClicked()
+// purpose  : Called when user changes type of elements (1d / 2d)
 //=================================================================================
-void SMESHGUI_ExtrusionAlongPathDlg::TypeChanged( int type )
+void SMESHGUI_ExtrusionAlongPathDlg::ConstructorsClicked (int type)
 {
-  MESSAGE("SMESHGUI_ExtrusionAlongPathDlg::TypeChanged");
-  if ( myType != type ) {
-    disconnect( mySelection, 0, this, 0 );
-    
-    if ( type == 0 )
-      ArgumentsGrp->setTitle( tr( "EXTRUSION_1D" ) );
-    else if ( type == 1 )
-      ArgumentsGrp->setTitle( tr( "EXTRUSION_2D" ) );
-    
-    // clear elements ID list
-    if ( !MeshCheck->isChecked() ) {
-      ElementsLineEdit->clear();
-    }
-    // set selection mode if necessary
-    if( myEditCurrentArgument == ElementsLineEdit ) {
-      mySelection->ClearIObjects();
-      mySelection->ClearFilters();
-      SMESH::SetPickable();
-  
-      SMESH::SetPointRepresentation( false );
-      if ( MeshCheck->isChecked() ) {
-       QAD_Application::getDesktop()->SetSelectionMode( ActorSelection );
-       mySelection->AddFilter( myElementsFilter );
-      }
-      else  {
-       if ( type == 0 )
-         QAD_Application::getDesktop()->SetSelectionMode( EdgeSelection, true );
-       if ( type == 1 )
-         QAD_Application::getDesktop()->SetSelectionMode( FaceSelection, true );
-      }
+  if (myType == type) return;
+
+  disconnect(mySelectionMgr, 0, this, 0);
+
+  if (type == 0)
+    GroupArguments->setTitle(tr("EXTRUSION_1D"));
+  else if (type == 1)
+    GroupArguments->setTitle(tr("EXTRUSION_2D"));
+
+  // clear elements ID list
+  if (!MeshCheck->isChecked()) {
+    ElementsLineEdit->clear();
+  }
+  // set selection mode if necessary
+  if (myEditCurrentArgument == ElementsLineEdit) {
+    mySelectionMgr->clearSelected();
+    mySelectionMgr->clearFilters();
+    SMESH::SetPickable();
+
+    SMESH::SetPointRepresentation(false);
+    if (MeshCheck->isChecked()) {
+      myViewWindow->SetSelectionMode(ActorSelection);
+      mySelectionMgr->installFilter(myElementsFilter);
+    } else {
+      if (type == 0)
+        myViewWindow->SetSelectionMode(EdgeSelection);
+      if (type == 1)
+        myViewWindow->SetSelectionMode(FaceSelection);
     }
-    connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
   }
-  myType = type;
-} 
+  connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
 
+  myType = type;
+}
 
 //=================================================================================
-// function : SMESHGUI_ExtrusionAlongPathDlg::ClickOnApply()
+// function : ClickOnApply()
 // purpose  : Called when user presses <Apply> button
 //=================================================================================
 bool SMESHGUI_ExtrusionAlongPathDlg::ClickOnApply()
 {
-  MESSAGE("SMESHGUI_ExtrusionAlongPathDlg::ClickOnApply");
-  if ( mySMESHGUI->ActiveStudyLocked() ) {
+  if (mySMESHGUI->isActiveStudyLocked())
     return false;
-  }
-  
-  if( myMesh->_is_nil() || MeshCheck->isChecked() && myIDSource->_is_nil() || !myMeshActor || myPathMesh->_is_nil() || myPathShape->_is_nil() ) {
+
+  if (myMesh->_is_nil() || MeshCheck->isChecked() && myIDSource->_is_nil() ||
+      !myMeshActor || myPathMesh->_is_nil() || myPathShape->_is_nil())
     return false;
-  }
 
   SMESH::long_array_var anElementsId = new SMESH::long_array;
 
-  if ( MeshCheck->isChecked() ) {
+  if (MeshCheck->isChecked()) {
     // If "Select whole mesh, submesh or group" check box is on ->
     // get all elements of the required type from the object selected
 
     // if MESH object is selected
-    if ( !CORBA::is_nil( SMESH::SMESH_Mesh::_narrow( myIDSource ) ) ) {
+    if (!CORBA::is_nil(SMESH::SMESH_Mesh::_narrow(myIDSource))) {
       // get mesh
-      SMESH::SMESH_Mesh_var aMesh = SMESH::SMESH_Mesh::_narrow( myIDSource );
+      SMESH::SMESH_Mesh_var aMesh = SMESH::SMESH_Mesh::_narrow(myIDSource);
       // get IDs from mesh...
-      if ( Elements1dRB->isChecked() )
+      if (Elements1dRB->isChecked())
        // 1d elements
-       anElementsId = aMesh->GetElementsByType( SMESH::EDGE );
-      else if ( Elements2dRB->isChecked() ) {
-       anElementsId = aMesh->GetElementsByType( SMESH::FACE );
+       anElementsId = aMesh->GetElementsByType(SMESH::EDGE);
+      else if (Elements2dRB->isChecked()) {
+       anElementsId = aMesh->GetElementsByType(SMESH::FACE);
       }
     }
     // SUBMESH is selected
-    if ( !CORBA::is_nil( SMESH::SMESH_subMesh::_narrow( myIDSource ) ) ) {
+    if (!CORBA::is_nil(SMESH::SMESH_subMesh::_narrow(myIDSource))) {
       // get submesh
-      SMESH::SMESH_subMesh_var aSubMesh = SMESH::SMESH_subMesh::_narrow( myIDSource );
+      SMESH::SMESH_subMesh_var aSubMesh = SMESH::SMESH_subMesh::_narrow(myIDSource);
       // get IDs from submesh
-      if ( Elements1dRB->isChecked() )
+      if (Elements1dRB->isChecked())
        // 1d elements
-       anElementsId = aSubMesh->GetElementsByType( SMESH::EDGE );
-      else if ( Elements2dRB->isChecked() )
+       anElementsId = aSubMesh->GetElementsByType(SMESH::EDGE);
+      else if (Elements2dRB->isChecked())
        // 2d elements
-       anElementsId = aSubMesh->GetElementsByType( SMESH::FACE );
-    }  
+       anElementsId = aSubMesh->GetElementsByType(SMESH::FACE);
+    }
     // GROUP is selected
-    if ( !CORBA::is_nil( SMESH::SMESH_GroupBase::_narrow( myIDSource ) ) ) {
+    if (!CORBA::is_nil(SMESH::SMESH_GroupBase::_narrow(myIDSource))) {
       // get smesh group
-      SMESH::SMESH_GroupBase_var aGroup = SMESH::SMESH_GroupBase::_narrow( myIDSource );
+      SMESH::SMESH_GroupBase_var aGroup = SMESH::SMESH_GroupBase::_narrow(myIDSource);
       // get IDs from group
       // 1d elements or 2d elements
-      if ( Elements1dRB->isChecked() && aGroup->GetType() == SMESH::EDGE ||
-          Elements2dRB->isChecked() && aGroup->GetType() == SMESH::FACE )
+      if (Elements1dRB->isChecked() && aGroup->GetType() == SMESH::EDGE ||
+          Elements2dRB->isChecked() && aGroup->GetType() == SMESH::FACE)
        anElementsId = aGroup->GetListOfID();
     }
-  }
-  else {
+  } else {
     // If "Select whole mesh, submesh or group" check box is off ->
     // use only elements of given type selected by user
 
     SMDS_Mesh* aMesh = myMeshActor->GetObject()->GetMesh();
-    if ( aMesh ) {
-      QStringList aListElementsId = QStringList::split( " ", ElementsLineEdit->text(), false );
+    if (aMesh) {
+      QStringList aListElementsId = QStringList::split(" ", ElementsLineEdit->text(), false);
       anElementsId = new SMESH::long_array;
-      anElementsId->length( aListElementsId.count() );
+      anElementsId->length(aListElementsId.count());
       bool bOk;
       int j = 0;
-      for ( int i = 0; i < aListElementsId.count(); i++ ) {
-       long ind = aListElementsId[ i ].toLong( &bOk );
-       if  ( bOk ) {
-         const SMDS_MeshElement* e = aMesh->FindElement( ind );
-         if ( e ) {
-           bool typeMatch = Elements1dRB->isChecked() && e->GetType() == SMDSAbs_Edge || 
+      for (int i = 0; i < aListElementsId.count(); i++) {
+       long ind = aListElementsId[ i ].toLong(&bOk);
+       if  (bOk) {
+         const SMDS_MeshElement* e = aMesh->FindElement(ind);
+         if (e) {
+           bool typeMatch = Elements1dRB->isChecked() && e->GetType() == SMDSAbs_Edge ||
                             Elements2dRB->isChecked() && e->GetType() == SMDSAbs_Face;
-           if ( typeMatch )
+           if (typeMatch)
              anElementsId[ j++ ] = ind;
          }
        }
       }
-      anElementsId->length( j );
+      anElementsId->length(j);
     }
   }
-      
-  if ( anElementsId->length() <= 0 ) {
+
+  if (anElementsId->length() <= 0) {
     return false;
   }
 
-  if ( StartPointLineEdit->text().stripWhiteSpace().isEmpty() ) {
+  if (StartPointLineEdit->text().stripWhiteSpace().isEmpty()) {
     return false;
   }
-  
+
   bool bOk;
-  long aNodeStart = StartPointLineEdit->text().toLong( &bOk );
-  if ( !bOk ) {
+  long aNodeStart = StartPointLineEdit->text().toLong(&bOk);
+  if (!bOk) {
     return false;
   }
-  
+
   // get angles
   SMESH::double_array_var anAngles = new SMESH::double_array;
-  if ( AnglesCheck->isChecked() ) {
-    anAngles->length( AnglesList->count() );
+  if (AnglesCheck->isChecked()) {
+    anAngles->length(AnglesList->count());
     int j = 0;
     bool bOk;
-    for ( int i = 0; i < AnglesList->count(); i++ ) {
-      double angle = AnglesList->text( i ).toDouble( &bOk );
-      if  ( bOk )
+    for (int i = 0; i < AnglesList->count(); i++) {
+      double angle = AnglesList->text(i).toDouble(&bOk);
+      if  (bOk)
        anAngles[ j++ ] = angle*PI/180;
     }
-    anAngles->length( j );
+    anAngles->length(j);
   }
 
   // get base point
   SMESH::PointStruct aBasePoint;
-  if ( BasePointCheck->isChecked() ) {
+  if (BasePointCheck->isChecked()) {
     aBasePoint.x = XSpin->GetValue();
     aBasePoint.y = YSpin->GetValue();
     aBasePoint.z = ZSpin->GetValue();
   }
-  
+
   try {
-    QAD_WaitCursor wc;
+    SUIT_OverrideCursor wc;
     SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
-    SMESH::SMESH_MeshEditor::Extrusion_Error retVal = 
-      aMeshEditor->ExtrusionAlongPath( anElementsId.inout(), myPathMesh, myPathShape, aNodeStart, 
-                                      AnglesCheck->isChecked(), anAngles.inout(), 
-                                      BasePointCheck->isChecked(), aBasePoint );
-
-    wc.stop();
-    switch ( retVal ) {
+    SMESH::SMESH_MeshEditor::Extrusion_Error retVal =
+      aMeshEditor->ExtrusionAlongPath(anElementsId.inout(), myPathMesh, myPathShape, aNodeStart,
+                                      AnglesCheck->isChecked(), anAngles.inout(),
+                                      BasePointCheck->isChecked(), aBasePoint);
+
+    //wc.stop();
+    wc.suspend();
+    switch (retVal) {
     case SMESH::SMESH_MeshEditor::EXTR_NO_ELEMENTS:
-      QAD_MessageBox::warn1( QAD_Application::getDesktop(),
-                            tr( "SMESH_ERROR" ),
-                            tr( "NO_ELEMENTS_SELECTED" ),
-                            tr( "SMESH_BUT_OK" ) );
+      SUIT_MessageBox::warn1(SMESHGUI::desktop(),
+                            tr("SMESH_ERROR"),
+                            tr("NO_ELEMENTS_SELECTED"),
+                            tr("SMESH_BUT_OK"));
       return false; break;
     case SMESH::SMESH_MeshEditor::EXTR_PATH_NOT_EDGE:
-      QAD_MessageBox::warn1( QAD_Application::getDesktop(),
-                            tr( "SMESH_ERROR" ),
-                            tr( "SELECTED_PATH_IS_NOT_EDGE" ),
-                            tr( "SMESH_BUT_OK" ) );
+      SUIT_MessageBox::warn1(SMESHGUI::desktop(),
+                            tr("SMESH_ERROR"),
+                            tr("SELECTED_PATH_IS_NOT_EDGE"),
+                            tr("SMESH_BUT_OK"));
       return false; break;
     case SMESH::SMESH_MeshEditor::EXTR_BAD_PATH_SHAPE:
-      QAD_MessageBox::warn1( QAD_Application::getDesktop(),
-                            tr( "SMESH_ERROR" ),
-                            tr( "BAD_SHAPE_TYPE" ),
-                            tr( "SMESH_BUT_OK" ) );
+      SUIT_MessageBox::warn1(SMESHGUI::desktop(),
+                            tr("SMESH_ERROR"),
+                            tr("BAD_SHAPE_TYPE"),
+                            tr("SMESH_BUT_OK"));
       return false; break;
     case SMESH::SMESH_MeshEditor::EXTR_BAD_STARTING_NODE:
-      QAD_MessageBox::warn1( QAD_Application::getDesktop(),
-                            tr( "SMESH_ERROR" ),
-                            tr( "EXTR_BAD_STARTING_NODE" ),
-                            tr( "SMESH_BUT_OK" ) );
+      SUIT_MessageBox::warn1(SMESHGUI::desktop(),
+                            tr("SMESH_ERROR"),
+                            tr("EXTR_BAD_STARTING_NODE"),
+                            tr("SMESH_BUT_OK"));
       return false; break;
     case SMESH::SMESH_MeshEditor::EXTR_BAD_ANGLES_NUMBER:
-      QAD_MessageBox::warn1( QAD_Application::getDesktop(),
-                            tr( "SMESH_ERROR" ),
-                            tr( "WRONG_ANGLES_NUMBER" ),
-                            tr( "SMESH_BUT_OK" ) );
+      SUIT_MessageBox::warn1(SMESHGUI::desktop(),
+                            tr("SMESH_ERROR"),
+                            tr("WRONG_ANGLES_NUMBER"),
+                            tr("SMESH_BUT_OK"));
       return false; break;
     case SMESH::SMESH_MeshEditor::EXTR_CANT_GET_TANGENT:
-      QAD_MessageBox::warn1( QAD_Application::getDesktop(),
-                            tr( "SMESH_ERROR" ),
-                            tr( "CANT_GET_TANGENT" ),
-                            tr( "SMESH_BUT_OK" ) );
+      SUIT_MessageBox::warn1(SMESHGUI::desktop(),
+                            tr("SMESH_ERROR"),
+                            tr("CANT_GET_TANGENT"),
+                            tr("SMESH_BUT_OK"));
       return false; break;
     case SMESH::SMESH_MeshEditor::EXTR_OK:
       break;
     }
-  }
-  catch( ... ) {
+  } catch (...) {
     return false;
   }
-    
-  mySelection->ClearIObjects();
+
+  mySelectionMgr->clearSelected();
   SMESH::UpdateView();
-  Init( false );
-  TypeChanged( GetConstructorId() );
+  Init(false);
+  ConstructorsClicked(GetConstructorId());
   return true;
 }
 
 //=================================================================================
-// function : SMESHGUI_ExtrusionAlongPathDlg::ClickOnOk()
+// function : ClickOnOk()
 // purpose  : Called when user presses <OK> button
 //=================================================================================
 void SMESHGUI_ExtrusionAlongPathDlg::ClickOnOk()
 {
-  MESSAGE("SMESHGUI_ExtrusionAlongPathDlg::ClickOnOk");
-  if ( !ClickOnApply() )
-    return;
-  reject();
+  if (ClickOnApply())
+    reject();
+}
+
+//=================================================================================
+// function : reject()
+// purpose  : Called when dialog box is closed
+//=================================================================================
+void SMESHGUI_ExtrusionAlongPathDlg::reject()
+{
+  disconnect(mySelectionMgr, 0, this, 0);
+  mySelectionMgr->clearFilters();
+  mySelectionMgr->clearSelected();
+  SMESH::SetPickable(); // ???
+  SMESH::SetPointRepresentation(false);
+  myViewWindow->SetSelectionMode(ActorSelection);
+  mySMESHGUI->ResetState();
+  QDialog::reject();
 }
 
 //=======================================================================
-// function : SMESHGUI_ExtrusionAlongPathDlg::onTextChange
-// purpose  : 
+// function : onTextChange()
+// purpose  :
 //=======================================================================
-
-void SMESHGUI_ExtrusionAlongPathDlg::onTextChange(const QString& theNewText)
+void SMESHGUI_ExtrusionAlongPathDlg::onTextChange (const QString& theNewText)
 {
-  MESSAGE("SMESHGUI_ExtrusionAlongPathDlg::onTextChange");
   QLineEdit* send = (QLineEdit*)sender();
-  if ( send != StartPointLineEdit && send != ElementsLineEdit )
-    send = ElementsLineEdit;
 
   // return if busy
-  if ( myBusy ) 
-    return;
+  if (myBusy) return;
 
   // set busy flag
-  SetBusy sb( this );
-  
-  if ( send == ElementsLineEdit && myEditCurrentArgument == ElementsLineEdit ) {
+  SetBusy sb (this);
+
+  if (send != StartPointLineEdit && send != ElementsLineEdit)
+    send = ElementsLineEdit;
+
+  if (send == ElementsLineEdit && myEditCurrentArgument == ElementsLineEdit) {
     // hilight entered elements
     SMDS_Mesh* aMesh = 0;
-    if ( myMeshActor )
+    if (myMeshActor)
       aMesh = myMeshActor->GetObject()->GetMesh();
-    if ( aMesh ) {
-      mySelection->ClearIObjects();
-      mySelection->AddIObject( myMeshActor->getIO() );
-      
-      QStringList aListId = QStringList::split( " ", theNewText, false );
+
+    if (aMesh) {
+      //mySelectionMgr->clearSelected();
+      //mySelectionMgr->AddIObject(myMeshActor->getIO());
+      SALOME_ListIO aList;
+      aList.Append(myMeshActor->getIO());
+      mySelectionMgr->setSelectedObjects(aList, false);
+
+      QStringList aListId = QStringList::split(" ", theNewText, false);
       bool bOk;
-      for ( int i = 0; i < aListId.count(); i++ ) {
-       long ind = aListId[ i ].toLong( &bOk );
-       if ( bOk ) {
-         const SMDS_MeshElement* e = aMesh->FindElement( ind );
-         if ( e ) {
+      const Handle(SALOME_InteractiveObject)& anIO = myMeshActor->getIO();
+      TColStd_IndexedMapOfInteger selectedIndices;
+      TColStd_MapOfInteger newIndices;
+      mySelector->GetIndex(anIO, selectedIndices);
+      for (int i = 0; i < aListId.count(); i++) {
+       long ind = aListId[ i ].toLong(&bOk);
+       if (bOk) {
+         const SMDS_MeshElement* e = aMesh->FindElement(ind);
+         if (e) {
            // check also type of element
-           bool typeMatch = Elements1dRB->isChecked() && e->GetType() == SMDSAbs_Edge || 
+           bool typeMatch = Elements1dRB->isChecked() && e->GetType() == SMDSAbs_Edge ||
                             Elements2dRB->isChecked() && e->GetType() == SMDSAbs_Face;
-           if ( typeMatch ) {
-             if ( !mySelection->IsIndexSelected( myMeshActor->getIO(), e->GetID() ) )
-               mySelection->AddOrRemoveIndex( myMeshActor->getIO(), e->GetID(), true );
+           if (typeMatch) {
+             if (selectedIndices.Add(e->GetID())) {
+                newIndices.Add(e->GetID());
+              }
            }
          }
        }
       }
+      if (newIndices.Extent() > 0) {
+        mySelector->AddOrRemoveIndex(anIO, newIndices, true);
+       myViewWindow->highlight( anIO, true, true );
+      }
     }
-  }
-  else if ( send == StartPointLineEdit && myEditCurrentArgument == StartPointLineEdit ) {
-    if ( !myPathMesh->_is_nil() ) {
-      SMESH_Actor* aPathActor = SMESH::FindActorByObject( myPathMesh );
+  } else if (send == StartPointLineEdit &&
+             myEditCurrentArgument == StartPointLineEdit) {
+    if (!myPathMesh->_is_nil()) {
+      SMESH_Actor* aPathActor = SMESH::FindActorByObject(myPathMesh);
       SMDS_Mesh* aMesh = 0;
-      if ( aPathActor )
+      if (aPathActor)
        aMesh = aPathActor->GetObject()->GetMesh();
-      if ( aMesh ) {
-       mySelection->ClearIObjects();
-       mySelection->AddIObject( aPathActor->getIO() );
-      
+      if (aMesh) {
+       //mySelectionMgr->clearSelected();
+       //mySelectionMgr->AddIObject(aPathActor->getIO());
+        SALOME_ListIO aList;
+        aList.Append(aPathActor->getIO());
+        mySelectionMgr->setSelectedObjects(aList, false);
+
        bool bOk;
-       long ind = theNewText.toLong( &bOk );
-       if ( bOk ) {
-         const SMDS_MeshNode* n = aMesh->FindNode( ind );
-         if ( n ) {
-           if ( !mySelection->IsIndexSelected( aPathActor->getIO(), n->GetID() ) ) {
-             mySelection->AddOrRemoveIndex( aPathActor->getIO(), n->GetID(), true );
+       long ind = theNewText.toLong(&bOk);
+       if (bOk) {
+         const SMDS_MeshNode* n = aMesh->FindNode(ind);
+         if (n) {
+           //if (!mySelectionMgr->IsIndexSelected(aPathActor->getIO(), n->GetID())) {
+            TColStd_IndexedMapOfInteger selectedIndices;
+            TColStd_MapOfInteger newIndices;
+            mySelector->GetIndex(aPathActor->getIO(), selectedIndices);
+            if (selectedIndices.Add(n->GetID())) {
+              newIndices.Add(n->GetID());
+             mySelector->AddOrRemoveIndex( aPathActor->getIO(), newIndices, true );
+             myViewWindow->highlight( aPathActor->getIO(), true, true );
            }
          }
        }
@@ -740,66 +757,61 @@ void SMESHGUI_ExtrusionAlongPathDlg::onTextChange(const QString& theNewText)
 }
 
 //=================================================================================
-// function : SMESHGUI_ExtrusionAlongPathDlg::SelectionIntoArgument()
+// function : SelectionIntoArgument()
 // purpose  : Called when selection as changed or other case
 //=================================================================================
 void SMESHGUI_ExtrusionAlongPathDlg::SelectionIntoArgument()
 {
-  MESSAGE("SMESHGUI_ExtrusionAlongPathDlg::SelectionIntoArgument");
-  // return if busy
-  if ( myBusy ) 
-    return;
-  
+  if (myBusy) return;
+
   // return if dialog box is inactive
-  if ( !ButtonsGrp->isEnabled() )
+  if (!GroupButtons->isEnabled())
     return;
 
   // selected objects count
-  int nbSel = mySelection->IObjectCount();
+  const SALOME_ListIO& aList = mySelector->StoredIObjects();
+  int nbSel = aList.Extent();
+  if (nbSel != 1)
+    return;
 
   // set busy flag
-  SetBusy sb( this );
+  SetBusy sb (this);
 
-  if ( myEditCurrentArgument == ElementsLineEdit ) {
+  if (myEditCurrentArgument == ElementsLineEdit) {
     // we are now selecting mesh elements (or whole mesh/submesh/group)
     // reset
     ElementsLineEdit->clear();
     myMesh      = SMESH::SMESH_Mesh::_nil();
     myIDSource  = SMESH::SMESH_IDSource::_nil();
     myMeshActor = 0;
-    
-    // only one object is acceptable
-    if( nbSel != 1 )
-      return;
 
     // try to get mesh from selection
-    Handle( SALOME_InteractiveObject ) IO = mySelection->firstIObject();
-    myMesh = SMESH::GetMeshByIO( IO );
-    if( myMesh->_is_nil() )
+    Handle(SALOME_InteractiveObject) IO = aList.First();
+    myMesh = SMESH::GetMeshByIO(IO);
+    if (myMesh->_is_nil())
       return;
     // find actor
-    myMeshActor = SMESH::FindActorByObject( myMesh );
-    if ( !myMeshActor )
+    myMeshActor = SMESH::FindActorByObject(myMesh);
+    if (!myMeshActor)
       return;
 
-    if ( MeshCheck->isChecked() ) {
+    if (MeshCheck->isChecked()) {
       // If "Select whole mesh, submesh or group" check box is on ->
       // get ID source and put it's name to the edit box
       QString aString;
-      SMESH::GetNameOfSelectedIObjects( mySelection, aString );
+      SMESH::GetNameOfSelectedIObjects(mySelectionMgr, aString);
 
-      myIDSource = SMESH::IObjectToInterface<SMESH::SMESH_IDSource>( IO );
-      ElementsLineEdit->setText( aString );
-    }
-    else {
+      myIDSource = SMESH::IObjectToInterface<SMESH::SMESH_IDSource>(IO);
+      ElementsLineEdit->setText(aString);
+    } else {
       // If "Select whole mesh, submesh or group" check box is off ->
       // try to get selected elements IDs
       QString aString;
-      int aNbUnits = SMESH::GetNameOfSelectedElements( mySelection, aString );
-      ElementsLineEdit->setText( aString );
+      //int aNbUnits = SMESH::GetNameOfSelectedElements(mySelectionMgr, aString);
+      SMESH::GetNameOfSelectedElements(mySelector, myMeshActor->getIO(), aString);
+      ElementsLineEdit->setText(aString);
     }
-  }
-  else if ( myEditCurrentArgument == PathMeshLineEdit ) {
+  } else if (myEditCurrentArgument == PathMeshLineEdit) {
     // we are now selecting path mesh
     // reset
     PathMeshLineEdit->clear();
@@ -808,21 +820,16 @@ void SMESHGUI_ExtrusionAlongPathDlg::SelectionIntoArgument()
     myPathShape = GEOM::GEOM_Object::_nil();
     StartPointLineEdit->clear();
 
-    // only one object is acceptable
-    if( nbSel != 1 )
-      return;
-
     // try to get mesh from selection
-    Handle( SALOME_InteractiveObject ) IO = mySelection->firstIObject();
-    myPathMesh = SMESH::IObjectToInterface<SMESH::SMESH_Mesh>( IO );
-    if( myPathMesh->_is_nil() )
+    Handle(SALOME_InteractiveObject) IO = aList.First();
+    myPathMesh = SMESH::IObjectToInterface<SMESH::SMESH_Mesh>(IO);
+    if(myPathMesh->_is_nil())
       return;
 
     QString aString;
-    SMESH::GetNameOfSelectedIObjects( mySelection, aString );
-    PathMeshLineEdit->setText( aString );
-  }
-  else if ( myEditCurrentArgument == PathShapeLineEdit ) {
+    SMESH::GetNameOfSelectedIObjects(mySelectionMgr, aString);
+    PathMeshLineEdit->setText(aString);
+  } else if (myEditCurrentArgument == PathShapeLineEdit) {
     // we are now selecting path mesh
     // reset
     PathShapeLineEdit->clear();
@@ -830,338 +837,322 @@ void SMESHGUI_ExtrusionAlongPathDlg::SelectionIntoArgument()
     StartPointLineEdit->clear();
 
     // return if path mesh is not yet selected
-    if ( myPathMesh->_is_nil() )
-      return;
-
-    // only one object is acceptable
-    if( nbSel != 1 )
+    if (myPathMesh->_is_nil())
       return;
 
     // try to get shape from selection
-    Handle( SALOME_InteractiveObject ) IO = mySelection->firstIObject();
-    myPathShape = SMESH::IObjectToInterface<GEOM::GEOM_Object>( IO );
-    if ( myPathShape->_is_nil() )
+    Handle(SALOME_InteractiveObject) IO = aList.First();
+    myPathShape = SMESH::IObjectToInterface<GEOM::GEOM_Object>(IO);
+    if (myPathShape->_is_nil())
       return;
 
     QString aString;
-    SMESH::GetNameOfSelectedIObjects( mySelection, aString );
-    PathShapeLineEdit->setText( aString );
-  }
-  else if ( myEditCurrentArgument == StartPointLineEdit ) {
+    SMESH::GetNameOfSelectedIObjects(mySelectionMgr, aString);
+    PathShapeLineEdit->setText(aString);
+  } else if (myEditCurrentArgument == StartPointLineEdit) {
     // we are now selecting start point of path
     // reset
     StartPointLineEdit->clear();
 
     // return if path mesh or path shape is not yet selected
-    if ( myPathMesh->_is_nil() || myPathShape->_is_nil() )
-      return;
-
-    // only one object is acceptable
-    if( nbSel != 1 )
+    if (myPathMesh->_is_nil() || myPathShape->_is_nil())
       return;
 
     // try to get shape from selection
-    Handle( SALOME_InteractiveObject ) IO = mySelection->firstIObject();
-    
+    Handle(SALOME_InteractiveObject) IO = aList.First();
+
     QString aString;
-    int aNbUnits = SMESH::GetNameOfSelectedElements( mySelection, aString );
-    if ( aNbUnits == 1 )
-      StartPointLineEdit->setText( aString.stripWhiteSpace() );
-  }
-  else if ( myEditCurrentArgument == XSpin ) {
+    int aNbUnits = SMESH::GetNameOfSelectedElements(mySelector, myMeshActor->getIO(), aString);
+    if (aNbUnits == 1)
+      StartPointLineEdit->setText(aString.stripWhiteSpace());
+
+  } else if (myEditCurrentArgument == XSpin) {
     // we are now selecting base point
     // reset is not performed here!
 
     // return if is not enabled
-    if ( !BasePointGrp->isEnabled() ) 
+    if (!BasePointGrp->isEnabled())
       return;
 
-    // only one object is acceptable
-    if( nbSel != 1 )
-      return;
-    
     // try to get shape from selection
-    Handle( SALOME_InteractiveObject ) IO = mySelection->firstIObject();
-    
+    Handle(SALOME_InteractiveObject) IO = aList.First();
+
     // check if geom vertex is selected
-    GEOM::GEOM_Object_var aGeomObj = SMESH::IObjectToInterface<GEOM::GEOM_Object>( IO );
+    GEOM::GEOM_Object_var aGeomObj = SMESH::IObjectToInterface<GEOM::GEOM_Object>(IO);
     TopoDS_Vertex aVertex;
-    if( !aGeomObj->_is_nil() ) {
-      if(  aGeomObj->IsShape() && GEOMBase::GetShape( aGeomObj, aVertex ) && !aVertex.IsNull() ) {
-       gp_Pnt aPnt = BRep_Tool::Pnt( aVertex );
-       XSpin->SetValue( aPnt.X() );
-       YSpin->SetValue( aPnt.Y() );
-       ZSpin->SetValue( aPnt.Z() );
+    if (!aGeomObj->_is_nil()) {
+      if (aGeomObj->IsShape() && GEOMBase::GetShape(aGeomObj, aVertex) && !aVertex.IsNull()) {
+       gp_Pnt aPnt = BRep_Tool::Pnt(aVertex);
+       XSpin->SetValue(aPnt.X());
+       YSpin->SetValue(aPnt.Y());
+       ZSpin->SetValue(aPnt.Z());
       }
       return;
     }
 
     // check if smesh node is selected
-    SMESH::SMESH_Mesh_var aMesh = SMESH::GetMeshByIO( IO );
-    if( aMesh->_is_nil() )
+    SMESH::SMESH_Mesh_var aMesh = SMESH::GetMeshByIO(IO);
+    if (aMesh->_is_nil())
       return;
 
     QString aString;
-    int aNbUnits = SMESH::GetNameOfSelectedNodes( mySelection, aString );
+    int aNbUnits = SMESH::GetNameOfSelectedNodes(mySelector, myMeshActor->getIO(), aString);
     // return if more than one node is selected
-    if( aNbUnits != 1 )
+    if (aNbUnits != 1)
       return;
-      
-    SMESH_Actor* aMeshActor = SMESH::FindActorByObject( aMesh );
-    if ( !aMeshActor )
+
+    SMESH_Actor* aMeshActor = SMESH::FindActorByObject(aMesh);
+    if (!aMeshActor)
       return;
 
     SMDS_Mesh* mesh = aMeshActor->GetObject()->GetMesh();
     if (!mesh)
       return;
 
-    const SMDS_MeshNode* n = mesh->FindNode( aString.toLong() );
-    if ( !n )
+    const SMDS_MeshNode* n = mesh->FindNode(aString.toLong());
+    if (!n)
       return;
 
-    XSpin->SetValue( n->X() );
-    YSpin->SetValue( n->Y() );
-    ZSpin->SetValue( n->Z() );
+    XSpin->SetValue(n->X());
+    YSpin->SetValue(n->Y());
+    ZSpin->SetValue(n->Z());
   }
 }
 
 //=================================================================================
-// function : SMESHGUI_ExtrusionAlongPathDlg::SetEditCurrentArgument()
+// function : SetEditCurrentArgument()
 // purpose  :
 //=================================================================================
 void SMESHGUI_ExtrusionAlongPathDlg::SetEditCurrentArgument()
 {
-  MESSAGE("SMESHGUI_ExtrusionAlongPathDlg::SetEditCurrentArgument");
   QToolButton* send = (QToolButton*)sender();
-  if ( send != SelectElementsButton   && 
-       send != SelectPathMeshButton   && 
-       send != SelectPathShapeButton  && 
-       send != SelectStartPointButton && 
-       send != SelectBasePointButton )
+  if (send != SelectElementsButton   &&
+      send != SelectPathMeshButton   &&
+      send != SelectPathShapeButton  &&
+      send != SelectStartPointButton &&
+      send != SelectBasePointButton)
     return;
-  SetEditCurrentArgument( send );
+  SetEditCurrentArgument(send);
 }
 
 //=================================================================================
-// function : SMESHGUI_ExtrusionAlongPathDlg::SetEditCurrentArgument()
+// function : SetEditCurrentArgument()
 // purpose  :
 //=================================================================================
-void SMESHGUI_ExtrusionAlongPathDlg::SetEditCurrentArgument( QToolButton* button )
+void SMESHGUI_ExtrusionAlongPathDlg::SetEditCurrentArgument (QToolButton* button)
 {
-  MESSAGE("SMESHGUI_ExtrusionAlongPathDlg::SetEditCurrentArgument(button)");
-  disconnect( mySelection, 0, this, 0 );
-  mySelection->ClearIObjects();
-  mySelection->ClearFilters();
+  disconnect(mySelectionMgr, 0, this, 0);
+  mySelectionMgr->clearSelected();
+  mySelectionMgr->clearFilters();
   SMESH::SetPickable();
-  
-  if( button == SelectElementsButton ) {
+
+  if (button == SelectElementsButton) {
     myEditCurrentArgument = ElementsLineEdit;
-    SMESH::SetPointRepresentation( false );
-    if ( MeshCheck->isChecked() ) {
-      QAD_Application::getDesktop()->SetSelectionMode( ActorSelection );
-      mySelection->AddFilter( myElementsFilter );
-    }
-    else  {
-      if ( Elements1dRB->isChecked() )
-       QAD_Application::getDesktop()->SetSelectionMode( EdgeSelection, true );
-      else if ( Elements2dRB->isChecked() )
-       QAD_Application::getDesktop()->SetSelectionMode( FaceSelection, true );
+    SMESH::SetPointRepresentation(false);
+    if (MeshCheck->isChecked()) {
+      myViewWindow->SetSelectionMode(ActorSelection);
+      mySelectionMgr->installFilter(myElementsFilter);
+    } else {
+      if (Elements1dRB->isChecked())
+       myViewWindow->SetSelectionMode(EdgeSelection);
+      else if (Elements2dRB->isChecked())
+       myViewWindow->SetSelectionMode(FaceSelection);
     }
-  }
-  else if ( button == SelectPathMeshButton ) {
+  } else if (button == SelectPathMeshButton) {
     myEditCurrentArgument = PathMeshLineEdit;
-    SMESH::SetPointRepresentation( false );
-    QAD_Application::getDesktop()->SetSelectionMode( ActorSelection );
-    mySelection->AddFilter( myPathMeshFilter );
+    SMESH::SetPointRepresentation(false);
+    myViewWindow->SetSelectionMode(ActorSelection);
+    mySelectionMgr->installFilter(myPathMeshFilter);
   }
-  else if ( button == SelectPathShapeButton ) {
+  else if (button == SelectPathShapeButton) {
     myEditCurrentArgument = PathShapeLineEdit;
-    SMESH::SetPointRepresentation( false );
-    QAD_Application::getDesktop()->SetSelectionMode( ActorSelection );
+    SMESH::SetPointRepresentation(false);
+    myViewWindow->SetSelectionMode(ActorSelection);
 
-    if ( !myPathMesh->_is_nil() ) {
+    if (!myPathMesh->_is_nil()) {
       GEOM::GEOM_Object_var aMainShape = myPathMesh->GetShapeToMesh();
-      SMESH_Actor* aPathActor = SMESH::FindActorByObject( myPathMesh );
+      SMESH_Actor* aPathActor = SMESH::FindActorByObject(myPathMesh);
 
-      if ( !aMainShape->_is_nil() && aPathActor )
-       mySelection->AddFilter( new SMESH_NumberFilter( "GEOM", TopAbs_SHAPE, -1, TopAbs_EDGE, aMainShape ) );
-       //SMESH::SetPickable( aPathActor );
+      if (!aMainShape->_is_nil() && aPathActor)
+       mySelectionMgr->installFilter(new SMESH_NumberFilter ("GEOM", TopAbs_SHAPE, -1,
+                                                              TopAbs_EDGE, aMainShape));
+       //SMESH::SetPickable(aPathActor);
     }
   }
-  else if ( button == SelectStartPointButton ) {
+  else if (button == SelectStartPointButton) {
     myEditCurrentArgument = StartPointLineEdit;
-    if ( !myPathMesh->_is_nil() ) {
-      SMESH_Actor* aPathActor = SMESH::FindActorByObject( myPathMesh );
-      if ( aPathActor ) {
-       SMESH::SetPointRepresentation( true );
-       QAD_Application::getDesktop()->SetSelectionMode( NodeSelection, true );
-       SMESH::SetPickable( aPathActor );
+    if (!myPathMesh->_is_nil()) {
+      SMESH_Actor* aPathActor = SMESH::FindActorByObject(myPathMesh);
+      if (aPathActor) {
+       SMESH::SetPointRepresentation(true);
+       myViewWindow->SetSelectionMode(NodeSelection);
+       SMESH::SetPickable(aPathActor);
       }
     }
   }
-  else if ( button == SelectBasePointButton ) {
+  else if (button == SelectBasePointButton) {
     myEditCurrentArgument = XSpin;
-    SMESH::SetPointRepresentation( true );
-    QAD_Application::getDesktop()->SetSelectionMode( NodeSelection, true );
-
-    SMESH_ListOfFilter aListOfFilters;
-    Handle(SMESH_TypeFilter) aMeshOrSubMeshFilter = new SMESH_TypeFilter( MESHorSUBMESH );
-    if ( !aMeshOrSubMeshFilter.IsNull() )
-      aListOfFilters.Append( aMeshOrSubMeshFilter );
-    Handle(SMESH_TypeFilter) aSmeshGroupFilter = new SMESH_TypeFilter( GROUP );
-    if ( !aSmeshGroupFilter.IsNull() )
-      aListOfFilters.Append( aSmeshGroupFilter );
-    //Handle(GEOM_ShapeTypeFilter) aVertexFilter = new GEOM_ShapeTypeFilter( TopAbs_VERTEX );
-    Handle(SMESH_NumberFilter) aVertexFilter = new SMESH_NumberFilter( "GEOM", TopAbs_SHAPE, -1, TopAbs_VERTEX, GEOM::GEOM_Object::_nil() );
-    if ( !aVertexFilter.IsNull() )
-      aListOfFilters.Append( aVertexFilter );
-  
-    mySelection->AddFilter( new SMESH_LogicalFilter( aListOfFilters, SMESH_LogicalFilter::LO_OR ) );
+    SMESH::SetPointRepresentation(true);
+    myViewWindow->SetSelectionMode(NodeSelection);
+
+    SMESH_TypeFilter* aMeshOrSubMeshFilter = new SMESH_TypeFilter(MESHorSUBMESH);
+    SMESH_TypeFilter* aSmeshGroupFilter    = new SMESH_TypeFilter(GROUP);
+    SMESH_NumberFilter* aVertexFilter      = new SMESH_NumberFilter ("GEOM", TopAbs_SHAPE,
+                                                                     -1, TopAbs_VERTEX);
+    QPtrList<SUIT_SelectionFilter> aListOfFilters;
+    if (aMeshOrSubMeshFilter) aListOfFilters.append(aMeshOrSubMeshFilter);
+    if (aSmeshGroupFilter)    aListOfFilters.append(aSmeshGroupFilter);
+    if (aVertexFilter)        aListOfFilters.append(aVertexFilter);
+
+    mySelectionMgr->installFilter(new SMESH_LogicalFilter
+                                  (aListOfFilters, SMESH_LogicalFilter::LO_OR));
   }
 
-  if ( myEditCurrentArgument && !myEditCurrentArgument->hasFocus() )
+  if (myEditCurrentArgument && !myEditCurrentArgument->hasFocus())
     myEditCurrentArgument->setFocus();
 
-  connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
+  connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
   SelectionIntoArgument();
 }
 
 //=================================================================================
-// function : SMESHGUI_ExtrusionAlongPathDlg::DeactivateActiveDialog()
+// function : DeactivateActiveDialog()
 // purpose  : Deactivates this dialog
 //=================================================================================
 void SMESHGUI_ExtrusionAlongPathDlg::DeactivateActiveDialog()
 {
-  MESSAGE("SMESHGUI_ExtrusionAlongPathDlg::DeactivateActiveDialog");
-  if ( ElementsTypeGrp->isEnabled() ) {
-    ElementsTypeGrp->setEnabled( false );
-    ArgumentsGrp->setEnabled( false );
-    ButtonsGrp->setEnabled( false );
-    mySMESHGUI->ResetState();    
-    mySMESHGUI->SetActiveDialogBox( 0 );
+  if (GroupConstructors->isEnabled()) {
+    GroupConstructors->setEnabled(false);
+    GroupArguments->setEnabled(false);
+    GroupButtons->setEnabled(false);
+    mySMESHGUI->ResetState();
+    mySMESHGUI->SetActiveDialogBox(0);
   }
 }
 
 //=================================================================================
-// function : SMESHGUI_ExtrusionAlongPathDlg::ActivateThisDialog()
+// function : ActivateThisDialog()
 // purpose  : Activates this dialog
 //=================================================================================
 void SMESHGUI_ExtrusionAlongPathDlg::ActivateThisDialog()
 {
-  MESSAGE("SMESHGUI_ExtrusionAlongPathDlg::ActivateThisDialog");
   // Emit a signal to deactivate the active dialog
-  mySMESHGUI->EmitSignalDeactivateDialog();   
-  ElementsTypeGrp->setEnabled( true );
-  ArgumentsGrp->setEnabled( true );
-  ButtonsGrp->setEnabled( true );
-  
-  mySMESHGUI->SetActiveDialogBox( this );
-
-  TypeChanged( GetConstructorId() );
+  mySMESHGUI->EmitSignalDeactivateDialog();
+  GroupConstructors->setEnabled(true);
+  GroupArguments->setEnabled(true);
+  GroupButtons->setEnabled(true);
+
+  mySMESHGUI->SetActiveDialogBox(this);
+
+  ConstructorsClicked(GetConstructorId());
   SelectionIntoArgument();
 }
 
 //=================================================================================
-// function : SMESHGUI_ExtrusionAlongPathDlg::enterEvent()
+// function : enterEvent()
 // purpose  : Mouse enter event
 //=================================================================================
-void SMESHGUI_ExtrusionAlongPathDlg::enterEvent(QEvent* e)
-{
-  MESSAGE("SMESHGUI_ExtrusionAlongPathDlg::enterEvent");
-  if ( ElementsTypeGrp->isEnabled() )
-    return;  
-  ActivateThisDialog();
-}
-
-//=================================================================================
-// function : SMESHGUI_ExtrusionAlongPathDlg::reject()
-// purpose  : Called when dialog box is closed
-//=================================================================================
-void SMESHGUI_ExtrusionAlongPathDlg::reject()
+void SMESHGUI_ExtrusionAlongPathDlg::enterEvent (QEvent*)
 {
-  MESSAGE("SMESHGUI_ExtrusionAlongPathDlg::reject");
-  disconnect( mySelection, 0, this, 0 );
-  mySelection->ClearFilters();
-  mySelection->ClearIObjects();
-  SMESH::SetPickable();
-  SMESH::SetPointRepresentation( false );
-  QAD_Application::getDesktop()->SetSelectionMode( ActorSelection );
-  mySMESHGUI->ResetState() ;
-  QDialog::reject();
-}
-
-//=================================================================================
-// function : SMESHGUI_ExtrusionAlongPathDlg::GetConstructorId()
-// purpose  : 
-//=================================================================================
-int SMESHGUI_ExtrusionAlongPathDlg::GetConstructorId()
-{ 
-  MESSAGE("SMESHGUI_ExtrusionAlongPathDlg::GetConstructorId");
-  if ( ElementsTypeGrp != NULL && ElementsTypeGrp->selected() != NULL )
-    return ElementsTypeGrp->id( ElementsTypeGrp->selected() );
-  return -1;
+  if (!GroupConstructors->isEnabled())
+    ActivateThisDialog();
 }
 
 //=======================================================================
-// function : SMESHGUI_ExtrusionAlongPathDlg::onSelectMesh
+// function : onSelectMesh()
 // purpose  :
 //=======================================================================
 void SMESHGUI_ExtrusionAlongPathDlg::onSelectMesh()
 {
-  MESSAGE("SMESHGUI_ExtrusionAlongPathDlg::onSelectMesh");
   bool toSelectMesh = MeshCheck->isChecked();
-  
-  ElementsLineEdit->setReadOnly( toSelectMesh );
-  ElementsLab->setText( toSelectMesh ? tr( "SMESH_NAME" ) : tr( "SMESH_ID_ELEMENTS" ) );
+
+  ElementsLineEdit->setReadOnly(toSelectMesh);
+  ElementsLab->setText(toSelectMesh ? tr("SMESH_NAME") : tr("SMESH_ID_ELEMENTS"));
   ElementsLineEdit->clear();
-  
-  SetEditCurrentArgument( SelectElementsButton );
+
+  SetEditCurrentArgument(SelectElementsButton);
+}
+
+//=================================================================================
+// function : GetConstructorId()
+// purpose  :
+//=================================================================================
+int SMESHGUI_ExtrusionAlongPathDlg::GetConstructorId()
+{
+  if (GroupConstructors != NULL && GroupConstructors->selected() != NULL)
+    return GroupConstructors->id(GroupConstructors->selected());
+  return -1;
 }
 
 //=======================================================================
-// function : SMESHGUI_ExtrusionAlongPathDlg::onAnglesCheck
+// function : onAnglesCheck()
 // purpose  : called when "Use Angles" check box is switched
 //=======================================================================
 void SMESHGUI_ExtrusionAlongPathDlg::onAnglesCheck()
 {
-  MESSAGE("SMESHGUI_ExtrusionAlongPathDlg::onAnglesCheck");
-  AnglesGrp->setEnabled( AnglesCheck->isChecked() );
+  AnglesGrp->setEnabled(AnglesCheck->isChecked());
 }
 
 //=======================================================================
-// function : SMESHGUI_ExtrusionAlongPathDlg::onBasePointCheck
+// function : onBasePointCheck()
 // purpose  : called when "Use Base Point" check box is switched
 //=======================================================================
 void SMESHGUI_ExtrusionAlongPathDlg::onBasePointCheck()
 {
-  MESSAGE("SMESHGUI_ExtrusionAlongPathDlg::onBasePointCheck");
-  BasePointGrp->setEnabled( BasePointCheck->isChecked() );
+  BasePointGrp->setEnabled(BasePointCheck->isChecked());
 }
 
 //=======================================================================
-// function : SMESHGUI_ExtrusionAlongPathDlg::OnAngleAdded
+// function : OnAngleAdded()
 // purpose  : Called when user adds angle to the list
 //=======================================================================
 void SMESHGUI_ExtrusionAlongPathDlg::OnAngleAdded()
 {
-  MESSAGE("SMESHGUI_ExtrusionAlongPathDlg::OnAngleAdded");
-  AnglesList->insertItem( QString::number( AngleSpin->GetValue() ) );
+  AnglesList->insertItem(QString::number(AngleSpin->GetValue()));
 }
 
 //=======================================================================
-// function : SMESHGUI_ExtrusionAlongPathDlg::OnAngleRemoved
+// function : OnAngleRemoved()
 // purpose  : Called when user removes angle(s) from the list
 //=======================================================================
 void SMESHGUI_ExtrusionAlongPathDlg::OnAngleRemoved()
 {
-  MESSAGE("SMESHGUI_ExtrusionAlongPathDlg::OnAngleRemoved");
   QList<QListBoxItem> aList;
-  aList.setAutoDelete( false );
-  for ( int i = 0; i < AnglesList->count(); i++ )
-    if ( AnglesList->isSelected( i ) )
-      aList.append( AnglesList->item( i ) );
+  aList.setAutoDelete(false);
+  for (int i = 0; i < AnglesList->count(); i++)
+    if (AnglesList->isSelected(i))
+      aList.append(AnglesList->item(i));
 
-  for ( int i = 0; i < aList.count(); i++ )
-    delete aList.at( i );
+  for (int i = 0; i < aList.count(); i++)
+    delete aList.at(i);
 }
 
+//=================================================================================
+// function : eventFilter()
+// purpose  : event filter ???
+//=================================================================================
+bool SMESHGUI_ExtrusionAlongPathDlg::eventFilter (QObject* object, QEvent* event)
+{
+  if (event->type() == QEvent::KeyPress) {
+    QKeyEvent* ke = (QKeyEvent*)event;
+    if (object == AnglesList) {
+      if (ke->key() == Key_Delete)
+       OnAngleRemoved();
+    }
+  }
+  else if (event->type() == QEvent::FocusIn) {
+    if (object == ElementsLineEdit) {
+      if (myEditCurrentArgument != ElementsLineEdit)
+       SetEditCurrentArgument(SelectElementsButton);
+    }
+    else if (object == StartPointLineEdit) {
+      if (myEditCurrentArgument != StartPointLineEdit)
+       SetEditCurrentArgument(SelectStartPointButton);
+    }
+    else if (object == XSpin->editor() || object == YSpin->editor() || object == ZSpin->editor()) {
+      if (myEditCurrentArgument != XSpin)
+       SetEditCurrentArgument(SelectBasePointButton);
+    }
+  }
+  return QDialog::eventFilter(object, event);
+}
index 951dbb3ef30e23abb7eb3a2ac5f8c2b3853a06a7..4b70c5ed8f365485a4ecd9cf3a41f7b87076aefd 100644 (file)
@@ -29,9 +29,9 @@
 #ifndef DIALOGBOX_EXTRUSION_PATH_H
 #define DIALOGBOX_EXTRUSION_PATH_H
 
-#include "SALOME_Selection.h"
-#include "SMESH_LogicalFilter.hxx"
-#include "SMESH_TypeFilter.hxx"
+#include "SalomeApp_SelectionMgr.h"
+#include "SUIT_SelectionFilter.h"
+
 // QT Includes
 #include <qdialog.h>
 
@@ -44,9 +44,13 @@ class QLineEdit;
 class QCheckBox;
 class QListBox;
 class QPushButton;
-class SMESHGUI_SpinBox;
+
 class SMESHGUI;
 class SMESH_Actor;
+class SMESHGUI_SpinBox;
+class SVTK_ViewWindow;
+class SVTK_Selector;
+
 
 // IDL Headers
 #include <SALOMEconfig.h>
@@ -57,12 +61,12 @@ class SMESH_Actor;
 // purpose  :
 //=================================================================================
 class SMESHGUI_ExtrusionAlongPathDlg : public QDialog
-{ 
+{
   Q_OBJECT
 
   class SetBusy {
     public:
-      SetBusy( SMESHGUI_ExtrusionAlongPathDlg* _dlg ) { myDlg = _dlg; myDlg->myBusy = true; }
+      SetBusy (SMESHGUI_ExtrusionAlongPathDlg* _dlg) { myDlg = _dlg; myDlg->myBusy = true; }
       ~SetBusy() { myDlg->myBusy = false; }
     private:
       SMESHGUI_ExtrusionAlongPathDlg* myDlg;
@@ -70,39 +74,41 @@ class SMESHGUI_ExtrusionAlongPathDlg : public QDialog
   friend class SetBusy;
 
 public:
-  SMESHGUI_ExtrusionAlongPathDlg( QWidget* parent = 0, SALOME_Selection* Sel = 0, bool modal = FALSE );
+  SMESHGUI_ExtrusionAlongPathDlg (SMESHGUI*,
+                                 bool modal = FALSE);
   ~SMESHGUI_ExtrusionAlongPathDlg();
 
-  bool eventFilter( QObject* object, QEvent* event );
-
-protected slots:
-  void reject();
+  bool eventFilter (QObject* object, QEvent* event);
 
 private:
-  void Init( bool ResetControls = true ) ;
-  void enterEvent ( QEvent * ) ;                          /* mouse enter the QWidget */
+  void Init (bool ResetControls = true);
+  void enterEvent (QEvent*);                           /* mouse enter the QWidget */
   int  GetConstructorId();
-  void SetEditCurrentArgument( QToolButton* button );
+  void SetEditCurrentArgument (QToolButton* button);
+
+  SMESHGUI*                     mySMESHGUI;            /* Current SMESHGUI object */
+  SalomeApp_SelectionMgr*       mySelectionMgr;        /* User shape selection */
+  SVTK_ViewWindow*              myViewWindow;
+  SVTK_Selector*                mySelector;
+
+  QWidget*                      myEditCurrentArgument; /* Current  argument */
 
-  SMESHGUI*                     mySMESHGUI ;              /* Current SMESHGUI object */
-  SALOME_Selection*             mySelection ;             /* User shape selection */
-  QWidget*                      myEditCurrentArgument;    /* Current  argument */
-  
   bool                          myBusy;
-  SMESH::SMESH_IDSource_var     myIDSource;
   SMESH::SMESH_Mesh_var         myMesh;
   SMESH_Actor*                  myMeshActor;
+  SMESH::SMESH_IDSource_var     myIDSource;
   SMESH::SMESH_Mesh_var         myPathMesh;
   GEOM::GEOM_Object_var         myPathShape;
-  Handle(SMESH_LogicalFilter)   myElementsFilter;
-  Handle(SMESH_TypeFilter)      myPathMeshFilter;
+  SUIT_SelectionFilter*         myElementsFilter;
+  SUIT_SelectionFilter*         myPathMeshFilter;
   int                           myType;
 
   // widgets
-  QButtonGroup*     ElementsTypeGrp;
+  QButtonGroup*     GroupConstructors;
   QRadioButton*     Elements1dRB;
   QRadioButton*     Elements2dRB;
-  QGroupBox*        ArgumentsGrp;
+
+  QGroupBox*        GroupArguments;
   QLabel*           ElementsLab;
   QToolButton*      SelectElementsButton;
   QLineEdit*        ElementsLineEdit;
@@ -132,20 +138,24 @@ private:
   SMESHGUI_SpinBox* YSpin;
   QLabel*           ZLab;
   SMESHGUI_SpinBox* ZSpin;
-  QGroupBox*        ButtonsGrp;
+
+  QGroupBox*        GroupButtons;
   QPushButton*      OkButton;
   QPushButton*      ApplyButton;
   QPushButton*      CloseButton;
-  
+
+protected slots:
+  void reject();
+
 private slots:
-  void TypeChanged( int type );
+  void ConstructorsClicked (int);
   void ClickOnOk();
   bool ClickOnApply();
   void SetEditCurrentArgument();
   void SelectionIntoArgument();
   void DeactivateActiveDialog();
   void ActivateThisDialog();
-  void onTextChange(const QString&);
+  void onTextChange (const QString&);
   void onSelectMesh();
   void onAnglesCheck();
   void onBasePointCheck();
index 7e3ad503fe94003054f2d98e2d3bcf74141f6356..1a42cceba5de9754bbab06374356fe6d0a4bad30 100644 (file)
@@ -1,47 +1,64 @@
 //  SMESH SMESHGUI : GUI for SMESH component
 //
 //  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
-// 
-//  This library is free software; you can redistribute it and/or 
-//  modify it under the terms of the GNU Lesser General Public 
-//  License as published by the Free Software Foundation; either 
-//  version 2.1 of the License. 
-// 
-//  This library is distributed in the hope that it will be useful, 
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of 
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
-//  Lesser General Public License for more details. 
-// 
-//  You should have received a copy of the GNU Lesser General Public 
-//  License along with this library; if not, write to the Free Software 
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
-// 
-//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
 //
 //
 //
 //  File   : SMESHGUI_ExtrusionDlg.cxx
 //  Author : Michael ZORIN
 //  Module : SMESH
-//  $Header: 
+//  $Header:
 
 #include "SMESHGUI_ExtrusionDlg.h"
+
 #include "SMESHGUI.h"
-#include "SMESHGUI_SpinBox.h"
 #include "SMESHGUI_Utils.h"
 #include "SMESHGUI_VTKUtils.h"
 #include "SMESHGUI_MeshUtils.h"
+#include "SMESHGUI_SpinBox.h"
 #include "SMESHGUI_IdValidator.h"
+
 #include "SMESH_Actor.h"
 #include "SMESH_TypeFilter.hxx"
+#include "SMESH_NumberFilter.hxx"
+#include "SMESH_LogicalFilter.hxx"
+
 #include "SMDS_Mesh.hxx"
 
-#include "QAD_Application.h"
-#include "QAD_Desktop.h"
-#include "QAD_MessageBox.h"
+#include "SUIT_ResourceMgr.h"
+#include "SUIT_OverrideCursor.h"
+#include "SUIT_Desktop.h"
+#include "SUIT_MessageBox.h"
+
+#include "SVTK_ViewModel.h"
+#include "SVTK_ViewWindow.h"
+#include "SVTK_Selector.h"
+#include "SVTK_Selection.h"
+#include "SALOME_ListIO.hxx"
+
 #include "utilities.h"
 
+// OCCT Includes
+#include <TColStd_MapOfInteger.hxx>
+#include <TColStd_IndexedMapOfInteger.hxx>
+
 // QT Includes
 #include <qapplication.h>
 #include <qbuttongroup.h>
@@ -51,8 +68,8 @@
 #include <qpushbutton.h>
 #include <qradiobutton.h>
 #include <qcheckbox.h>
+#include <qspinbox.h>
 #include <qlayout.h>
-#include <qspinbox.h> 
 #include <qvalidator.h>
 #include <qpixmap.h>
 
 using namespace std;
 
 //=================================================================================
-// class    : SMESHGUI_ExtrusionDlg()
-// purpose  : 
+// function : SMESHGUI_ExtrusionDlg()
+// purpose  : constructor
 //=================================================================================
-SMESHGUI_ExtrusionDlg::SMESHGUI_ExtrusionDlg( QWidget* parent, const char* name, SALOME_Selection* Sel,
-                                             bool modal, WFlags fl )
-  : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu |
-            Qt::WDestructiveClose)
+SMESHGUI_ExtrusionDlg::SMESHGUI_ExtrusionDlg (SMESHGUI* theModule,
+                                             bool modal)
+     : QDialog( SMESH::GetDesktop( theModule ), "SMESHGUI_ExtrusionDlg", modal, WStyle_Customize |
+                WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | Qt::WDestructiveClose),
+     mySMESHGUI( theModule ),
+     mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ),
+     myViewWindow( SMESH::GetViewWindow( theModule ) ),
+     mySelector( myViewWindow->GetSelector() )
 {
-  QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "SMESH",tr("ICON_DLG_EDGE")));
-  QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "SMESH",tr("ICON_DLG_TRIANGLE")));
-  QPixmap image2(QAD_Desktop::getResourceManager()->loadPixmap( "SMESH",tr("ICON_SELECT")));
-
-  if ( !name )
-    setName( "SMESHGUI_ExtrusionDlg" );
-  resize( 303, 185 ); 
-  setCaption( tr( "EXTRUSION_ALONG_LINE" ) );
-  setSizeGripEnabled( TRUE );
-  SMESHGUI_ExtrusionDlgLayout = new QGridLayout( this ); 
-  SMESHGUI_ExtrusionDlgLayout->setSpacing( 6 );
-  SMESHGUI_ExtrusionDlgLayout->setMargin( 11 );
+  QPixmap image0 (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_DLG_EDGE")));
+  QPixmap image1 (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_DLG_TRIANGLE")));
+  QPixmap image2 (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_SELECT")));
+
+  resize(303, 185);
+  setCaption(tr("EXTRUSION_ALONG_LINE"));
+  setSizeGripEnabled(TRUE);
+
+  QGridLayout* SMESHGUI_ExtrusionDlgLayout = new QGridLayout(this);
+  SMESHGUI_ExtrusionDlgLayout->setSpacing(6);
+  SMESHGUI_ExtrusionDlgLayout->setMargin(11);
 
   /***************************************************************/
-  GroupConstructors = new QButtonGroup( this, "GroupConstructors" );
-  GroupConstructors->setTitle( tr( "SMESH_EXTRUSION"  ) );
-  GroupConstructors->setExclusive( TRUE );
-  GroupConstructors->setColumnLayout(0, Qt::Vertical );
-  GroupConstructors->layout()->setSpacing( 0 );
-  GroupConstructors->layout()->setMargin( 0 );
-  GroupConstructorsLayout = new QGridLayout( GroupConstructors->layout() );
-  GroupConstructorsLayout->setAlignment( Qt::AlignTop );
-  GroupConstructorsLayout->setSpacing( 6 );
-  GroupConstructorsLayout->setMargin( 11 );
-  RadioButton1= new QRadioButton( GroupConstructors, "RadioButton1" );
-  RadioButton1->setText( tr( ""  ) );
-  RadioButton1->setPixmap( image0 );
-  GroupConstructorsLayout->addWidget( RadioButton1, 0, 0 );
-  RadioButton2= new QRadioButton( GroupConstructors, "RadioButton2" );
-  RadioButton2->setText( tr( ""  ) );
-  RadioButton2->setPixmap( image1 );
-  GroupConstructorsLayout->addWidget( RadioButton2, 0, 2 );
-  SMESHGUI_ExtrusionDlgLayout->addWidget( GroupConstructors, 0, 0 );
-  
+  GroupConstructors = new QButtonGroup("GroupConstructors", this);
+  GroupConstructors->setTitle(tr("SMESH_EXTRUSION"));
+  GroupConstructors->setExclusive(TRUE);
+  GroupConstructors->setColumnLayout(0, Qt::Vertical);
+  GroupConstructors->layout()->setSpacing(0);
+  GroupConstructors->layout()->setMargin(0);
+  QGridLayout* GroupConstructorsLayout = new QGridLayout(GroupConstructors->layout());
+  GroupConstructorsLayout->setAlignment(Qt::AlignTop);
+  GroupConstructorsLayout->setSpacing(6);
+  GroupConstructorsLayout->setMargin(11);
+  RadioButton1= new QRadioButton(GroupConstructors, "RadioButton1");
+  RadioButton1->setText(tr(""));
+  RadioButton1->setPixmap(image0);
+  GroupConstructorsLayout->addWidget(RadioButton1, 0, 0);
+  RadioButton2= new QRadioButton(GroupConstructors, "RadioButton2");
+  RadioButton2->setText(tr(""));
+  RadioButton2->setPixmap(image1);
+  GroupConstructorsLayout->addWidget(RadioButton2, 0, 2);
+  SMESHGUI_ExtrusionDlgLayout->addWidget(GroupConstructors, 0, 0);
+
   /***************************************************************/
-  GroupButtons = new QGroupBox( this, "GroupButtons" );
-  GroupButtons->setGeometry( QRect( 10, 10, 281, 48 ) ); 
-  GroupButtons->setTitle( tr( ""  ) );
-  GroupButtons->setColumnLayout(0, Qt::Vertical );
-  GroupButtons->layout()->setSpacing( 0 );
-  GroupButtons->layout()->setMargin( 0 );
-  GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
-  GroupButtonsLayout->setAlignment( Qt::AlignTop );
-  GroupButtonsLayout->setSpacing( 6 );
-  GroupButtonsLayout->setMargin( 11 );
-  buttonCancel = new QPushButton( GroupButtons, "buttonCancel" );
-  buttonCancel->setText( tr( "SMESH_BUT_CLOSE"  ) );
-  buttonCancel->setAutoDefault( TRUE );
-  GroupButtonsLayout->addWidget( buttonCancel, 0, 3 );
-  buttonApply = new QPushButton( GroupButtons, "buttonApply" );
-  buttonApply->setText( tr( "SMESH_BUT_APPLY"  ) );
-  buttonApply->setAutoDefault( TRUE );
-  GroupButtonsLayout->addWidget( buttonApply, 0, 1 );
-  QSpacerItem* spacer_9 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
-  GroupButtonsLayout->addItem( spacer_9, 0, 2 );
-  buttonOk = new QPushButton( GroupButtons, "buttonOk" );
-  buttonOk->setText( tr( "SMESH_BUT_OK"  ) );
-  buttonOk->setAutoDefault( TRUE );
-  buttonOk->setDefault( TRUE );
-  GroupButtonsLayout->addWidget( buttonOk, 0, 0 );
-  SMESHGUI_ExtrusionDlgLayout->addWidget( GroupButtons, 2, 0 );
+  GroupButtons = new QGroupBox(this, "GroupButtons");
+  GroupButtons->setGeometry(QRect(10, 10, 281, 48));
+  GroupButtons->setTitle(tr(""));
+  GroupButtons->setColumnLayout(0, Qt::Vertical);
+  GroupButtons->layout()->setSpacing(0);
+  GroupButtons->layout()->setMargin(0);
+  QGridLayout* GroupButtonsLayout = new QGridLayout(GroupButtons->layout());
+  GroupButtonsLayout->setAlignment(Qt::AlignTop);
+  GroupButtonsLayout->setSpacing(6);
+  GroupButtonsLayout->setMargin(11);
+  buttonCancel = new QPushButton(GroupButtons, "buttonCancel");
+  buttonCancel->setText(tr("SMESH_BUT_CLOSE" ));
+  buttonCancel->setAutoDefault(TRUE);
+  GroupButtonsLayout->addWidget(buttonCancel, 0, 3);
+  buttonApply = new QPushButton(GroupButtons, "buttonApply");
+  buttonApply->setText(tr("SMESH_BUT_APPLY" ));
+  buttonApply->setAutoDefault(TRUE);
+  GroupButtonsLayout->addWidget(buttonApply, 0, 1);
+  QSpacerItem* spacer_9 = new QSpacerItem(20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
+  GroupButtonsLayout->addItem(spacer_9, 0, 2);
+  buttonOk = new QPushButton(GroupButtons, "buttonOk");
+  buttonOk->setText(tr("SMESH_BUT_OK" ));
+  buttonOk->setAutoDefault(TRUE);
+  buttonOk->setDefault(TRUE);
+  GroupButtonsLayout->addWidget(buttonOk, 0, 0);
+  SMESHGUI_ExtrusionDlgLayout->addWidget(GroupButtons, 2, 0);
 
   /***************************************************************/
-  GroupArguments = new QGroupBox( this, "GroupArguments" );
-  GroupArguments->setTitle( tr( "EXTRUSION_1D"  ) );
-  GroupArguments->setColumnLayout(0, Qt::Vertical );
-  GroupArguments->layout()->setSpacing( 0 );
-  GroupArguments->layout()->setMargin( 0 );
-  GroupArgumentsLayout = new QGridLayout( GroupArguments->layout());
-  GroupArgumentsLayout->setAlignment( Qt::AlignTop );
-  GroupArgumentsLayout->setSpacing( 6 );
-  GroupArgumentsLayout->setMargin( 11 );
+  GroupArguments = new QGroupBox(this, "GroupArguments");
+  GroupArguments->setTitle(tr("EXTRUSION_1D"));
+  GroupArguments->setColumnLayout(0, Qt::Vertical);
+  GroupArguments->layout()->setSpacing(0);
+  GroupArguments->layout()->setMargin(0);
+  QGridLayout* GroupArgumentsLayout = new QGridLayout(GroupArguments->layout());
+  GroupArgumentsLayout->setAlignment(Qt::AlignTop);
+  GroupArgumentsLayout->setSpacing(6);
+  GroupArgumentsLayout->setMargin(11);
 
   // Controls for elements selection
-  TextLabelElements  = new QLabel( GroupArguments, "TextLabelElements" );
-  TextLabelElements->setText( tr( "SMESH_ID_ELEMENTS"  ) );
+  TextLabelElements  = new QLabel(GroupArguments, "TextLabelElements");
+  TextLabelElements->setText(tr("SMESH_ID_ELEMENTS" ));
   TextLabelElements->setFixedWidth(74);
-  GroupArgumentsLayout->addWidget( TextLabelElements, 0, 0 );
-
-  SelectElementsButton  = new QPushButton( GroupArguments, "SelectElementsButton" );
-  SelectElementsButton->setText( tr( ""  ) );
-  SelectElementsButton->setPixmap( image2 );
-  SelectElementsButton->setToggleButton( FALSE );
-  GroupArgumentsLayout->addWidget( SelectElementsButton, 0, 1 );
-  
-  LineEditElements  = new QLineEdit( GroupArguments, "LineEditElements" );
-  LineEditElements->setValidator( new SMESHGUI_IdValidator( this, "validator" ));
-  GroupArgumentsLayout->addMultiCellWidget( LineEditElements, 0, 0, 2, 7 );
+  GroupArgumentsLayout->addWidget(TextLabelElements, 0, 0);
+
+  SelectElementsButton  = new QPushButton(GroupArguments, "SelectElementsButton");
+  SelectElementsButton->setText(tr("" ));
+  SelectElementsButton->setPixmap(image2);
+  SelectElementsButton->setToggleButton(FALSE);
+  GroupArgumentsLayout->addWidget(SelectElementsButton, 0, 1);
+
+  LineEditElements  = new QLineEdit(GroupArguments, "LineEditElements");
+  LineEditElements->setValidator(new SMESHGUI_IdValidator(this, "validator"));
+  GroupArgumentsLayout->addMultiCellWidget(LineEditElements, 0, 0, 2, 7);
 
   // Control for the whole mesh selection
-  CheckBoxMesh = new QCheckBox( GroupArguments, "CheckBoxMesh" );
-  CheckBoxMesh->setText( tr( "SMESH_SELECT_WHOLE_MESH"  ) );
-  GroupArgumentsLayout->addMultiCellWidget( CheckBoxMesh, 1, 1, 0, 7 );
+  CheckBoxMesh = new QCheckBox(GroupArguments, "CheckBoxMesh");
+  CheckBoxMesh->setText(tr("SMESH_SELECT_WHOLE_MESH" ));
+  GroupArgumentsLayout->addMultiCellWidget(CheckBoxMesh, 1, 1, 0, 7);
 
   // Controls for vector selection
-  TextLabelVector = new QLabel( GroupArguments, "TextLabelVector" );
-  TextLabelVector->setText( tr( "SMESH_VECTOR" ) );
-  GroupArgumentsLayout->addWidget( TextLabelVector, 2, 0 );
-  
-  TextLabelDx = new QLabel( GroupArguments, "TextLabelDx" );
-  TextLabelDx->setText( tr( "SMESH_DX" ) );
-  GroupArgumentsLayout->addWidget( TextLabelDx, 2, 2 );
+  TextLabelVector = new QLabel(GroupArguments, "TextLabelVector");
+  TextLabelVector->setText(tr("SMESH_VECTOR"));
+  GroupArgumentsLayout->addWidget(TextLabelVector, 2, 0);
+
+  TextLabelDx = new QLabel(GroupArguments, "TextLabelDx");
+  TextLabelDx->setText(tr("SMESH_DX"));
+  GroupArgumentsLayout->addWidget(TextLabelDx, 2, 2);
 
   SpinBox_Dx = new SMESHGUI_SpinBox(GroupArguments, "SpinBox_Dx");
-  GroupArgumentsLayout->addWidget( SpinBox_Dx, 2, 3 );
+  GroupArgumentsLayout->addWidget(SpinBox_Dx, 2, 3);
 
-  TextLabelDy = new QLabel( GroupArguments, "TextLabelDy" );
-  TextLabelDy->setText( tr( "SMESH_DY" ) );
-  GroupArgumentsLayout->addWidget( TextLabelDy, 2, 4 );
+  TextLabelDy = new QLabel(GroupArguments, "TextLabelDy");
+  TextLabelDy->setText(tr("SMESH_DY"));
+  GroupArgumentsLayout->addWidget(TextLabelDy, 2, 4);
 
   SpinBox_Dy = new SMESHGUI_SpinBox(GroupArguments, "SpinBox_Dy");
-  GroupArgumentsLayout->addWidget( SpinBox_Dy, 2, 5 );
+  GroupArgumentsLayout->addWidget(SpinBox_Dy, 2, 5);
+
+  TextLabelDz = new QLabel(GroupArguments, "TextLabelDz");
+  TextLabelDz->setText(tr("SMESH_DZ"));
+  GroupArgumentsLayout->addWidget(TextLabelDz, 2, 6);
 
-  TextLabelDz = new QLabel( GroupArguments, "TextLabelDz" );
-  TextLabelDz->setText( tr( "SMESH_DZ" ) );
-  GroupArgumentsLayout->addWidget( TextLabelDz, 2, 6 );
-  
   SpinBox_Dz = new SMESHGUI_SpinBox(GroupArguments, "SpinBox_Dz");
-  GroupArgumentsLayout->addWidget( SpinBox_Dz, 2, 7 );
-  
+  GroupArgumentsLayout->addWidget(SpinBox_Dz, 2, 7);
+
   // Controls for nb. steps defining
-  TextLabelNbSteps = new QLabel( GroupArguments, "TextLabelNbSteps" );
-  TextLabelNbSteps->setText( tr( "SMESH_NUMBEROFSTEPS"  ) );
-  GroupArgumentsLayout->addMultiCellWidget( TextLabelNbSteps, 3, 3, 0, 1 );
+  TextLabelNbSteps = new QLabel(GroupArguments, "TextLabelNbSteps");
+  TextLabelNbSteps->setText(tr("SMESH_NUMBEROFSTEPS" ));
+  GroupArgumentsLayout->addMultiCellWidget(TextLabelNbSteps, 3, 3, 0, 1);
 
   SpinBox_NbSteps = new QSpinBox(GroupArguments, "SpinBox_NbSteps");
-  GroupArgumentsLayout->addMultiCellWidget( SpinBox_NbSteps, 3, 3,  2, 7 );
-  
-  SMESHGUI_ExtrusionDlgLayout->addWidget( GroupArguments, 1, 0 );
-  
+  GroupArgumentsLayout->addMultiCellWidget(SpinBox_NbSteps, 3, 3,  2, 7);
+
+  SMESHGUI_ExtrusionDlgLayout->addWidget(GroupArguments, 1, 0);
+
   /* Initialisations */
-  SpinBox_Dx->RangeStepAndValidator( -999999.999, +999999.999, 10.0, 3 );
-  SpinBox_Dy->RangeStepAndValidator( -999999.999, +999999.999, 10.0, 3 );
-  SpinBox_Dz->RangeStepAndValidator( -999999.999, +999999.999, 10.0, 3 );
+  SpinBox_Dx->RangeStepAndValidator(-999999.999, +999999.999, 10.0, 3);
+  SpinBox_Dy->RangeStepAndValidator(-999999.999, +999999.999, 10.0, 3);
+  SpinBox_Dz->RangeStepAndValidator(-999999.999, +999999.999, 10.0, 3);
 
   QIntValidator* anIntValidator = new QIntValidator(SpinBox_NbSteps);
   SpinBox_NbSteps->setValidator(anIntValidator);
-  SpinBox_NbSteps->setRange( 1, 999999 );
+  SpinBox_NbSteps->setRange(1, 999999);
+
   GroupArguments->show();
-  RadioButton1->setChecked( TRUE );
-  mySelection = Sel;  
-
-  mySMESHGUI  = SMESHGUI::GetSMESHGUI() ;
-  mySMESHGUI->SetActiveDialogBox( (QDialog*)this ) ;
-    
-  // Costruction of the logical filter
-  SMESH_ListOfFilter aListOfFilters;
-  Handle(SMESH_TypeFilter) aMeshOrSubMeshFilter = new SMESH_TypeFilter( MESHorSUBMESH );
-  if ( !aMeshOrSubMeshFilter.IsNull() )
-    aListOfFilters.Append( aMeshOrSubMeshFilter );
-  Handle(SMESH_TypeFilter) aSmeshGroupFilter = new SMESH_TypeFilter( GROUP );
-  if ( !aSmeshGroupFilter.IsNull() )
-    aListOfFilters.Append( aSmeshGroupFilter );
-  
-  myMeshOrSubMeshOrGroupFilter = new SMESH_LogicalFilter( aListOfFilters, SMESH_LogicalFilter::LO_OR );
-  
+  RadioButton1->setChecked(TRUE);
+
+  mySMESHGUI->SetActiveDialogBox(this);
+
+  // Costruction of the logical filter for the elements: mesh/sub-mesh/group
+  SMESH_TypeFilter* aMeshOrSubMeshFilter = new SMESH_TypeFilter (MESHorSUBMESH);
+  SMESH_TypeFilter* aSmeshGroupFilter    = new SMESH_TypeFilter (GROUP);
+
+  QPtrList<SUIT_SelectionFilter> aListOfFilters;
+  if (aMeshOrSubMeshFilter) aListOfFilters.append(aMeshOrSubMeshFilter);
+  if (aSmeshGroupFilter)    aListOfFilters.append(aSmeshGroupFilter);
+
+  myMeshOrSubMeshOrGroupFilter =
+    new SMESH_LogicalFilter (aListOfFilters, SMESH_LogicalFilter::LO_OR);
+
   Init();
-  /* signals and slots connections */
-  connect( buttonOk, SIGNAL( clicked() ),     this, SLOT( ClickOnOk() ) );
-  connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ) ;
-  connect( buttonApply, SIGNAL( clicked() ), this, SLOT(ClickOnApply() ) );
-  connect( GroupConstructors, SIGNAL(clicked(int) ), SLOT( ConstructorsClicked(int) ) );
-  
-  connect( SelectElementsButton, SIGNAL (clicked() ),   this, SLOT( SetEditCurrentArgument() ) ) ;
-  connect( mySMESHGUI, SIGNAL ( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ;
-  connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
+
+  /***************************************************************/
+  // signals and slots connections
+  connect(buttonOk, SIGNAL(clicked()),     this, SLOT(ClickOnOk()));
+  connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel()));
+  connect(buttonApply, SIGNAL(clicked()),  this, SLOT(ClickOnApply()));
+  connect(GroupConstructors, SIGNAL(clicked(int)), SLOT(ConstructorsClicked(int)));
+
+  connect(SelectElementsButton, SIGNAL (clicked()),            this, SLOT(SetEditCurrentArgument()));
+  connect(mySMESHGUI, SIGNAL (SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog()));
+  connect(mySelectionMgr, SIGNAL(currentSelectionChanged()),   this, SLOT(SelectionIntoArgument()));
   /* to close dialog if study change */
-  connect( mySMESHGUI, SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ) ;
-  connect( LineEditElements, SIGNAL( textChanged( const QString& )),
-           SLOT( onTextChange( const QString& )));
-  connect( CheckBoxMesh, SIGNAL( toggled( bool )),
-           SLOT( onSelectMesh( bool )));
+  connect(mySMESHGUI,       SIGNAL (SignalCloseAllDialogs()), this, SLOT(ClickOnCancel()));
+  connect(LineEditElements, SIGNAL(textChanged(const QString&)),    SLOT(onTextChange(const QString&)));
+  connect(CheckBoxMesh,     SIGNAL(toggled(bool)),                  SLOT(onSelectMesh(bool)));
 
+  /***************************************************************/
   /* Move widget on the botton right corner of main widget */
-  int x, y ;
-  mySMESHGUI->DefineDlgPosition( this, x, y ) ;
-  this->move( x, y ) ;
-  this->show() ; /* displays Dialog */
+  int x, y;
+  mySMESHGUI->DefineDlgPosition(this, x, y);
+  this->move(x, y);
+  this->show(); // displays Dialog
 
   ConstructorsClicked(0);
 }
 
 //=================================================================================
 // function : ~SMESHGUI_ExtrusionDlg()
-// purpose  : Destroys the object and frees any allocated resources
+// purpose  : destructor
 //=================================================================================
 SMESHGUI_ExtrusionDlg::~SMESHGUI_ExtrusionDlg()
 {
   // no need to delete child widgets, Qt does it all for us
 }
 
-
 //=================================================================================
 // function : Init()
-// purpose  :
+// purpose  : initialization
 //=================================================================================
-void SMESHGUI_ExtrusionDlg::Init(  bool ResetControls )
+void SMESHGUI_ExtrusionDlg::Init (bool ResetControls)
 {
-  myBusy = false;    
-  
+  myBusy = false;
+
   LineEditElements->clear();
   myElementsId = "";
-  myNbOkElements = 0 ;
+  myNbOkElements = 0;
 
-  buttonOk->setEnabled( false );
-  buttonApply->setEnabled( false );
-  
-  myActor     = 0;
+  buttonOk->setEnabled(false);
+  buttonApply->setEnabled(false);
+
+  myActor = 0;
   myMesh = SMESH::SMESH_Mesh::_nil();
-  
-  if( ResetControls )
-    {
-      SpinBox_NbSteps->setValue(1);
-      SpinBox_Dx->SetValue(0);
-      SpinBox_Dy->SetValue(0);
-      SpinBox_Dz->SetValue(0);
-      
-      CheckBoxMesh->setChecked(false);
-      onSelectMesh( false );
-    }
-}
 
+  if (ResetControls) {
+    SpinBox_NbSteps->setValue(1);
+    SpinBox_Dx->SetValue(0);
+    SpinBox_Dy->SetValue(0);
+    SpinBox_Dz->SetValue(0);
+
+    CheckBoxMesh->setChecked(false);
+    onSelectMesh(false);
+  }
+}
 
 //=================================================================================
 // function : ConstructorsClicked()
 // purpose  : Radio button management
 //=================================================================================
-void SMESHGUI_ExtrusionDlg::ConstructorsClicked(int constructorId)
+void SMESHGUI_ExtrusionDlg::ConstructorsClicked (int constructorId)
 {
-  disconnect(mySelection, 0, this, 0);
-  
-  switch(constructorId)
-    { 
-    case 0 :
-      {
-       GroupArguments->setTitle( tr( "EXTRUSION_1D" ) );
-       if ( !CheckBoxMesh->isChecked() )
-         QAD_Application::getDesktop()->SetSelectionMode( EdgeSelection, true );
-       break;
-      }
-    case 1 :
-      { 
-       GroupArguments->setTitle( tr( "EXTRUSION_2D" ) );
-       if ( !CheckBoxMesh->isChecked() )
-         QAD_Application::getDesktop()->SetSelectionMode( FaceSelection, true );
-       break;
-      }
+  disconnect(mySelectionMgr, 0, this, 0);
+
+  switch (constructorId) {
+  case 0:
+    {
+      GroupArguments->setTitle(tr("EXTRUSION_1D"));
+      if (!CheckBoxMesh->isChecked())
+        myViewWindow->SetSelectionMode(EdgeSelection);
+      break;
     }
+  case 1:
+    {
+      GroupArguments->setTitle(tr("EXTRUSION_2D"));
+      if (!CheckBoxMesh->isChecked())
+        myViewWindow->SetSelectionMode(FaceSelection);
+      break;
+    }
+  }
 
   myEditCurrentArgument = LineEditElements;
   LineEditElements->setFocus();
-  
+
   if (CheckBoxMesh->isChecked())
     onSelectMesh(true);
-  
-  connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
-}
 
+  connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
+}
 
 //=================================================================================
 // function : ClickOnApply()
-// purpose  :
+// purpose  : Called when user presses <Apply> button
 //=================================================================================
-void SMESHGUI_ExtrusionDlg::ClickOnApply()
+bool SMESHGUI_ExtrusionDlg::ClickOnApply()
 {
-  if (mySMESHGUI->ActiveStudyLocked())
-    return;
-  
-  if ( myNbOkElements)
-    {
-      QStringList aListElementsId = QStringList::split( " ", myElementsId, false);
-      
-      SMESH::long_array_var anElementsId = new SMESH::long_array;
-      
-      anElementsId->length( aListElementsId.count() );
-      for ( int i = 0; i < aListElementsId.count(); i++ )
-       anElementsId[i] = aListElementsId[i].toInt();
-      
-      SMESH::DirStruct aVector;
-      aVector.PS.x = SpinBox_Dx->GetValue();
-      aVector.PS.y = SpinBox_Dy->GetValue();
-      aVector.PS.z = SpinBox_Dz->GetValue();
-
-      long aNbSteps = (long)SpinBox_NbSteps->value();
-
-      try
-       {
-         SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
-         QApplication::setOverrideCursor(Qt::waitCursor);
-         aMeshEditor->ExtrusionSweep(anElementsId.inout(), aVector, aNbSteps);
-         QApplication::restoreOverrideCursor();
-       }
-      catch( ... )
-       {
-       }
-      
-      mySelection->ClearIObjects();
-      SMESH::UpdateView();
-      Init( false);
-      ConstructorsClicked( GetConstructorId() );
+  if (mySMESHGUI->isActiveStudyLocked())
+    return false;
+
+  if (myNbOkElements) {
+    QStringList aListElementsId = QStringList::split(" ", myElementsId, false);
+
+    SMESH::long_array_var anElementsId = new SMESH::long_array;
+
+    anElementsId->length(aListElementsId.count());
+    for (int i = 0; i < aListElementsId.count(); i++)
+      anElementsId[i] = aListElementsId[i].toInt();
+
+    SMESH::DirStruct aVector;
+    aVector.PS.x = SpinBox_Dx->GetValue();
+    aVector.PS.y = SpinBox_Dy->GetValue();
+    aVector.PS.z = SpinBox_Dz->GetValue();
+
+    long aNbSteps = (long)SpinBox_NbSteps->value();
+
+    try {
+      SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
+      QApplication::setOverrideCursor(Qt::waitCursor);
+      aMeshEditor->ExtrusionSweep(anElementsId.inout(), aVector, aNbSteps);
+      QApplication::restoreOverrideCursor();
+    } catch (...) {
     }
+
+    mySelectionMgr->clearSelected();
+    SMESH::UpdateView();
+    Init(false);
+    ConstructorsClicked(GetConstructorId());
+  }
+  return true;
 }
 
 //=================================================================================
 // function : ClickOnOk()
-// purpose  :
+// purpose  : Called when user presses <OK> button
 //=================================================================================
 void SMESHGUI_ExtrusionDlg::ClickOnOk()
 {
-  ClickOnApply();
-  ClickOnCancel();
+  if (ClickOnApply())
+    ClickOnCancel();
 }
 
-       
 //=================================================================================
 // function : ClickOnCancel()
-// purpose  :
+// purpose  : Called when dialog box is closed
 //=================================================================================
 void SMESHGUI_ExtrusionDlg::ClickOnCancel()
 {
-  mySelection->ClearFilters();
-  mySelection->ClearIObjects();
+  disconnect(mySelectionMgr, 0, this, 0);
+  mySelectionMgr->clearFilters();
+  mySelectionMgr->clearSelected();
+  SMESH::SetPickable(); // ???
   SMESH::SetPointRepresentation(false);
-  QAD_Application::getDesktop()->SetSelectionMode( ActorSelection );
-  disconnect( mySelection, 0, this, 0 );
-  mySMESHGUI->ResetState() ;
-  reject() ;
+  myViewWindow->SetSelectionMode(ActorSelection);
+  mySMESHGUI->ResetState();
+  reject();
 }
 
-//=======================================================================
-//function : onTextChange
-//purpose  : 
-//=======================================================================
-void SMESHGUI_ExtrusionDlg::onTextChange(const QString& theNewText)
+//=================================================================================
+// function : onTextChange()
+// purpose  :
+//=================================================================================
+void SMESHGUI_ExtrusionDlg::onTextChange (const QString& theNewText)
 {
   QLineEdit* send = (QLineEdit*)sender();
-  
-  if ( myBusy ) return;
+
+  // return if busy
+  if (myBusy) return;
+
+  // set busy flag
   myBusy = true;
-  
+
   if (send == LineEditElements)
     myNbOkElements = 0;
-  
-  buttonOk->setEnabled( false );
-  buttonApply->setEnabled( false );
-  
+
+  buttonOk->setEnabled(false);
+  buttonApply->setEnabled(false);
+
   // hilight entered elements/nodes
   SMDS_Mesh* aMesh = 0;
-  if ( myActor )
+  if (myActor)
     aMesh = myActor->GetObject()->GetMesh();
-  
-  if ( aMesh ) {
-    mySelection->ClearIObjects();
-    mySelection->AddIObject( myActor->getIO() );
-    
-    QStringList aListId = QStringList::split( " ", theNewText, false);
-    
+
+  if (aMesh) {
+    //mySelectionMgr->clearSelected();
+    //mySelectionMgr->AddIObject(myActor->getIO());
+    SALOME_ListIO aList;
+    aList.Append(myActor->getIO());
+    mySelectionMgr->setSelectedObjects(aList, false);
+
+    QStringList aListId = QStringList::split(" ", theNewText, false);
+
     if (send == LineEditElements) {
-      for ( int i = 0; i < aListId.count(); i++ ) {
-       const SMDS_MeshElement * e = aMesh->FindElement( aListId[ i ].toInt() );
-       if ( e ) {
-         if ( !mySelection->IsIndexSelected( myActor->getIO(), e->GetID() ))
-           mySelection->AddOrRemoveIndex (myActor->getIO(), e->GetID(), true);
+      const Handle(SALOME_InteractiveObject)& anIO = myActor->getIO();
+      TColStd_IndexedMapOfInteger selectedIndices;
+      TColStd_MapOfInteger newIndices;
+      mySelector->GetIndex(anIO, selectedIndices);
+      for (int i = 0; i < aListId.count(); i++) {
+       const SMDS_MeshElement * e = aMesh->FindElement(aListId[ i ].toInt());
+       if (e) {
+         //if (!mySelectionMgr->IsIndexSelected(myActor->getIO(), e->GetID())) {
+          if (selectedIndices.Add(e->GetID())) {
+           //mySelectionMgr->AddOrRemoveIndex(myActor->getIO(), e->GetID(), true);
+            newIndices.Add(e->GetID());
+          }
          myNbOkElements++;
        }
       }
+      if (newIndices.Extent() > 0) {
+        mySelector->AddOrRemoveIndex(anIO, newIndices, true);
+       myViewWindow->highlight( anIO, true, true );
+      }
       myElementsId = theNewText;
     }
   }
-  
-  if ( myNbOkElements ) {
-    buttonOk->setEnabled( true );
-    buttonApply->setEnabled( true );
+
+  if (myNbOkElements) {
+    buttonOk->setEnabled(true);
+    buttonApply->setEnabled(true);
   }
-  
+
   myBusy = false;
 }
 
@@ -456,145 +484,130 @@ void SMESHGUI_ExtrusionDlg::onTextChange(const QString& theNewText)
 //=================================================================================
 void SMESHGUI_ExtrusionDlg::SelectionIntoArgument()
 {
-  if ( myBusy ) return;
-  
+  if (myBusy) return;
+
+  // return if dialog box is inactive
+  if (!GroupButtons->isEnabled())
+    return;
+
   // clear
   myActor = 0;
   QString aString = "";
 
+  // set busy flag
   myBusy = true;
-  myEditCurrentArgument->setText( aString );
+
+  myEditCurrentArgument->setText(aString);
   myNbOkElements = 0;
-  buttonOk->setEnabled( false );
-  buttonApply->setEnabled( false );
+  buttonOk->setEnabled(false);
+  buttonApply->setEnabled(false);
   myBusy = false;
-  
-  if ( !GroupButtons->isEnabled() ) // inactive
-    return;
-  
-  buttonOk->setEnabled( false );
-  buttonApply->setEnabled( false );
-  
+
   // get selected mesh
-  
-  int nbSel = SMESH::GetNameOfSelectedIObjects(mySelection, aString);
-  if(nbSel != 1)
+  SALOME_ListIO aList;
+  mySelectionMgr->selectedObjects(aList, SVTK_Viewer::Type());
+  int nbSel = SMESH::GetNameOfSelectedIObjects(mySelectionMgr, aString);
+  if (nbSel != 1)
     return;
-  
-  Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject();
+
+  Handle(SALOME_InteractiveObject) IO = aList.First();
   myMesh = SMESH::GetMeshByIO(IO);
-  if(myMesh->_is_nil())
+  if (myMesh->_is_nil())
     return;
+
   myActor = SMESH::FindActorByObject(myMesh);
   if (!myActor)
     return;
-  
-  if (myEditCurrentArgument == LineEditElements)
-    {
-      int aNbElements = 0;
-      myElementsId = "";
-      
-      if (CheckBoxMesh->isChecked())
-       {
-         SMESH::GetNameOfSelectedIObjects(mySelection, aString);
-       
-         int aConstructorId = GetConstructorId();
-
-         if(!SMESH::IObjectToInterface<SMESH::SMESH_Mesh>(IO)->_is_nil()) //MESH
-           {
-             // get IDs from mesh
-             SMDS_Mesh* aSMDSMesh = myActor->GetObject()->GetMesh();
-             if (!aSMDSMesh)
-               return;
-             
-             if (aConstructorId == 0)
-               {
-                 SMDS_EdgeIteratorPtr anIter = aSMDSMesh->edgesIterator();
-                 
-                 while ( anIter->more() )
-                   {
-                     const SMDS_MeshEdge * edge = anIter->next();
-                     if ( edge ) {
-                       myElementsId += QString(" %1").arg(edge->GetID());
-                       aNbElements++;
-                     }
-                   }
-               }
-             else if (aConstructorId == 1)
-               {
-                 SMDS_FaceIteratorPtr anIter = aSMDSMesh->facesIterator();               
-                 while ( anIter->more() )
-                   {
-                     const SMDS_MeshFace * face = anIter->next();
-                     if ( face ) {
-                       myElementsId += QString(" %1").arg(face->GetID());
-                       aNbElements++;
-                     }
-                   }
-               }
-           }
-         else if (!SMESH::IObjectToInterface<SMESH::SMESH_subMesh>(IO)->_is_nil()) //SUBMESH
-           {
-             // get submesh
-             SMESH::SMESH_subMesh_var aSubMesh = SMESH::IObjectToInterface<SMESH::SMESH_subMesh>(IO) ;
-             
-             // get IDs from submesh
-             SMESH::long_array_var anElementsIds = new SMESH::long_array;
-             if (aConstructorId == 0)
-               anElementsIds = aSubMesh->GetElementsByType(SMESH::EDGE);
-             else if (aConstructorId == 1)
-               anElementsIds = aSubMesh->GetElementsByType(SMESH::FACE);
-             
-             for ( int i = 0; i < anElementsIds->length(); i++ )
-               myElementsId += QString(" %1").arg(anElementsIds[i]);
-             aNbElements = anElementsIds->length();
-           }
-         else // GROUP
-           {
-             // get smesh group
-             SMESH::SMESH_GroupBase_var aGroup =
-                SMESH::IObjectToInterface<SMESH::SMESH_GroupBase>(IO);
-             if (aGroup->_is_nil())
-               return;
-             
-             if ( (aConstructorId == 0 && aGroup->GetType()!= SMESH::EDGE) ||
-                  (aConstructorId == 1 && aGroup->GetType()!= SMESH::FACE) )
-               return;
-             
-             // get IDs from smesh group
-             SMESH::long_array_var anElementsIds = new SMESH::long_array;
-             anElementsIds = aGroup->GetListOfID();
-             for ( int i = 0; i < anElementsIds->length(); i++ )
-               myElementsId += QString(" %1").arg(anElementsIds[i]);
-             aNbElements = anElementsIds->length();
-           }
-       }
-      else
-       {
-         aNbElements = SMESH::GetNameOfSelectedElements(mySelection, aString) ;
-         myElementsId = aString;
-       }
-      
-      if(aNbElements < 1)
-       return ;
-      
-      myNbOkElements = true;
+
+  if (myEditCurrentArgument == LineEditElements) {
+    int aNbElements = 0;
+    myElementsId = "";
+
+    if (CheckBoxMesh->isChecked()) {
+      int aConstructorId = GetConstructorId();
+
+      SMESH::GetNameOfSelectedIObjects(mySelectionMgr, aString);
+
+      if (!SMESH::IObjectToInterface<SMESH::SMESH_Mesh>(IO)->_is_nil()) { //MESH
+        // get IDs from mesh
+        SMDS_Mesh* aSMDSMesh = myActor->GetObject()->GetMesh();
+        if (!aSMDSMesh)
+          return;
+
+        if (aConstructorId == 0) {
+          SMDS_EdgeIteratorPtr anIter = aSMDSMesh->edgesIterator();
+
+          while (anIter->more()) {
+            const SMDS_MeshEdge * edge = anIter->next();
+            if (edge) {
+              myElementsId += QString(" %1").arg(edge->GetID());
+              aNbElements++;
+            }
+          }
+        } else if (aConstructorId == 1) {
+          SMDS_FaceIteratorPtr anIter = aSMDSMesh->facesIterator();
+          while (anIter->more()) {
+            const SMDS_MeshFace * face = anIter->next();
+            if (face) {
+              myElementsId += QString(" %1").arg(face->GetID());
+              aNbElements++;
+            }
+          }
+        }
+      } else if (!SMESH::IObjectToInterface<SMESH::SMESH_subMesh>(IO)->_is_nil()) { //SUBMESH
+        // get submesh
+        SMESH::SMESH_subMesh_var aSubMesh = SMESH::IObjectToInterface<SMESH::SMESH_subMesh>(IO);
+
+        // get IDs from submesh
+        SMESH::long_array_var anElementsIds = new SMESH::long_array;
+        if (aConstructorId == 0)
+          anElementsIds = aSubMesh->GetElementsByType(SMESH::EDGE);
+        else if (aConstructorId == 1)
+          anElementsIds = aSubMesh->GetElementsByType(SMESH::FACE);
+
+        for (int i = 0; i < anElementsIds->length(); i++)
+          myElementsId += QString(" %1").arg(anElementsIds[i]);
+        aNbElements = anElementsIds->length();
+      } else { // GROUP
+        // get smesh group
+        SMESH::SMESH_GroupBase_var aGroup =
+          SMESH::IObjectToInterface<SMESH::SMESH_GroupBase>(IO);
+        if (aGroup->_is_nil())
+          return;
+
+        if ((aConstructorId == 0 && aGroup->GetType() != SMESH::EDGE) ||
+            (aConstructorId == 1 && aGroup->GetType()!= SMESH::FACE))
+          return;
+
+        // get IDs from smesh group
+        SMESH::long_array_var anElementsIds = new SMESH::long_array;
+        anElementsIds = aGroup->GetListOfID();
+        for (int i = 0; i < anElementsIds->length(); i++)
+          myElementsId += QString(" %1").arg(anElementsIds[i]);
+        aNbElements = anElementsIds->length();
+      }
+    } else {
+      aNbElements = SMESH::GetNameOfSelectedElements(mySelector, myActor->getIO(), aString);
+      myElementsId = aString;
     }
-  
+
+    if (aNbElements < 1)
+      return;
+
+    myNbOkElements = true;
+  }
+
   myBusy = true;
-  myEditCurrentArgument->setText( aString );
+  myEditCurrentArgument->setText(aString);
   myBusy = false;
-  
+
   // OK
-  
-  if(myNbOkElements)
-    {
-      buttonOk->setEnabled( true );
-      buttonApply->setEnabled( true );
-    }
+  if (myNbOkElements) {
+    buttonOk->setEnabled(true);
+    buttonApply->setEnabled(true);
+  }
 }
 
-
 //=================================================================================
 // function : SetEditCurrentArgument()
 // purpose  :
@@ -602,151 +615,136 @@ void SMESHGUI_ExtrusionDlg::SelectionIntoArgument()
 void SMESHGUI_ExtrusionDlg::SetEditCurrentArgument()
 {
   QPushButton* send = (QPushButton*)sender();
-  
-  disconnect( mySelection, 0, this, 0 );
-  mySelection->ClearIObjects();
-  mySelection->ClearFilters();
-  
-  if(send == SelectElementsButton) {
+
+  disconnect(mySelectionMgr, 0, this, 0);
+  mySelectionMgr->clearSelected();
+  mySelectionMgr->clearFilters();
+
+  if (send == SelectElementsButton) {
     myEditCurrentArgument = LineEditElements;
-    if (CheckBoxMesh->isChecked())
-      {
-       QAD_Application::getDesktop()->SetSelectionMode( ActorSelection );
-       mySelection->AddFilter(myMeshOrSubMeshOrGroupFilter);
-      }
-    else
-      {
-       int aConstructorId = GetConstructorId();
-       if (aConstructorId == 0)
-         QAD_Application::getDesktop()->SetSelectionMode( EdgeSelection, true );
-       else if (aConstructorId == 1)
-         QAD_Application::getDesktop()->SetSelectionMode( FaceSelection, true );
-      }
+    if (CheckBoxMesh->isChecked()) {
+      myViewWindow->SetSelectionMode(ActorSelection);
+      mySelectionMgr->installFilter(myMeshOrSubMeshOrGroupFilter);
+    } else {
+      int aConstructorId = GetConstructorId();
+      if (aConstructorId == 0)
+        myViewWindow->SetSelectionMode(EdgeSelection);
+      else if (aConstructorId == 1)
+        myViewWindow->SetSelectionMode(FaceSelection);
+    }
   }
-  
+
   myEditCurrentArgument->setFocus();
-  connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
-  SelectionIntoArgument() ;
+  connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
+  SelectionIntoArgument();
 }
 
 //=================================================================================
 // function : DeactivateActiveDialog()
-// purpose  :
+// purpose  : Deactivates this dialog
 //=================================================================================
 void SMESHGUI_ExtrusionDlg::DeactivateActiveDialog()
 {
-  if ( GroupConstructors->isEnabled() ) {
-    GroupConstructors->setEnabled(false) ;
-    GroupArguments->setEnabled(false) ;
-    GroupButtons->setEnabled(false) ;
-    mySMESHGUI->ResetState() ;    
-    mySMESHGUI->SetActiveDialogBox(0) ;
+  if (GroupConstructors->isEnabled()) {
+    GroupConstructors->setEnabled(false);
+    GroupArguments->setEnabled(false);
+    GroupButtons->setEnabled(false);
+    mySMESHGUI->ResetState();
+    mySMESHGUI->SetActiveDialogBox(0);
   }
 }
 
-
 //=================================================================================
 // function : ActivateThisDialog()
-// purpose  :
+// purpose  : Activates this dialog
 //=================================================================================
 void SMESHGUI_ExtrusionDlg::ActivateThisDialog()
 {
-  /* Emit a signal to deactivate the active dialog */
-  mySMESHGUI->EmitSignalDeactivateDialog() ;   
-  GroupConstructors->setEnabled(true) ;
-  GroupArguments->setEnabled(true) ;
-  GroupButtons->setEnabled(true) ;
-  
-  mySMESHGUI->SetActiveDialogBox( (QDialog*)this ) ;
+  // Emit a signal to deactivate the active dialog
+  mySMESHGUI->EmitSignalDeactivateDialog();
+  GroupConstructors->setEnabled(true);
+  GroupArguments->setEnabled(true);
+  GroupButtons->setEnabled(true);
+
+  mySMESHGUI->SetActiveDialogBox(this);
 
   ConstructorsClicked(GetConstructorId());
   SelectionIntoArgument();
 }
 
-
 //=================================================================================
 // function : enterEvent()
-// purpose  :
+// purpose  : Mouse enter event
 //=================================================================================
-void SMESHGUI_ExtrusionDlg::enterEvent(QEvent* e)
+void SMESHGUI_ExtrusionDlg::enterEvent (QEvent*)
 {
-  if ( GroupConstructors->isEnabled() )
-    return ;  
-  ActivateThisDialog() ;
+  if (!GroupConstructors->isEnabled())
+    ActivateThisDialog();
 }
 
-
 //=================================================================================
 // function : closeEvent()
 // purpose  :
 //=================================================================================
-void SMESHGUI_ExtrusionDlg::closeEvent( QCloseEvent* e )
-{
-  /* same than click on cancel button */
-  this->ClickOnCancel() ;
-}
-
-
-//=======================================================================
-//function : hideEvent
-//purpose  : caused by ESC key
-//=======================================================================
-
-void SMESHGUI_ExtrusionDlg::hideEvent ( QHideEvent * e )
-{
-  if ( !isMinimized() )
-    ClickOnCancel();
-}
-
+//void SMESHGUI_ExtrusionDlg::closeEvent (QCloseEvent*)
+//{
+//  /* same than click on cancel button */
+//  this->ClickOnCancel();
+//}
+//
+//=================================================================================
+// function : hideEvent()
+// purpose  : caused by ESC key
+//=================================================================================
+//void SMESHGUI_ExtrusionDlg::hideEvent (QHideEvent*)
+//{
+//  if (!isMinimized())
+//    ClickOnCancel();
+//}
 
-//=======================================================================
-//function : onSelectMesh
-//purpose  :
-//=======================================================================
-void SMESHGUI_ExtrusionDlg::onSelectMesh ( bool toSelectMesh )
+//=================================================================================
+// function : onSelectMesh()
+// purpose  :
+//=================================================================================
+void SMESHGUI_ExtrusionDlg::onSelectMesh (bool toSelectMesh)
 {
   if (toSelectMesh)
-    TextLabelElements->setText( tr( "SMESH_NAME" ) );
+    TextLabelElements->setText(tr("SMESH_NAME"));
   else
-    TextLabelElements->setText( tr( "SMESH_ID_ELEMENTS" ) );
-  
-  if (myEditCurrentArgument != LineEditElements)
-    {
-      LineEditElements->clear();
-      return;
-    }
-  
-  mySelection->ClearFilters() ;
-  
-  if (toSelectMesh)
-    {
-      QAD_Application::getDesktop()->SetSelectionMode( ActorSelection );
-      mySelection->AddFilter(myMeshOrSubMeshOrGroupFilter);
-      LineEditElements->setReadOnly(true);
-    }
-  else
-    {
-      int aConstructorId = GetConstructorId();
-      if (aConstructorId == 0)
-       QAD_Application::getDesktop()->SetSelectionMode( EdgeSelection, true );
-      else if (aConstructorId == 0)
-       QAD_Application::getDesktop()->SetSelectionMode( FaceSelection, true );
-      
-      LineEditElements->setReadOnly(false);
-      onTextChange(LineEditElements->text());
-    }
-  
+    TextLabelElements->setText(tr("SMESH_ID_ELEMENTS"));
+
+  if (myEditCurrentArgument != LineEditElements) {
+    LineEditElements->clear();
+    return;
+  }
+
+  mySelectionMgr->clearFilters();
+
+  if (toSelectMesh) {
+    myViewWindow->SetSelectionMode(ActorSelection);
+    mySelectionMgr->installFilter(myMeshOrSubMeshOrGroupFilter);
+    LineEditElements->setReadOnly(true);
+  } else {
+    int aConstructorId = GetConstructorId();
+    if (aConstructorId == 0)
+      myViewWindow->SetSelectionMode(EdgeSelection);
+    else if (aConstructorId == 0)
+      myViewWindow->SetSelectionMode(FaceSelection);
+
+    LineEditElements->setReadOnly(false);
+    onTextChange(LineEditElements->text());
+  }
+
   SelectionIntoArgument();
 }
 
-
 //=================================================================================
 // function : GetConstructorId()
-// purpose  : 
+// purpose  :
 //=================================================================================
 int SMESHGUI_ExtrusionDlg::GetConstructorId()
-{ 
-  if ( GroupConstructors != NULL && GroupConstructors->selected() != NULL )
-    return GroupConstructors->id( GroupConstructors->selected() );
+{
+  if (GroupConstructors != NULL && GroupConstructors->selected() != NULL)
+    return GroupConstructors->id(GroupConstructors->selected());
   return -1;
 }
index c6f80f0e25914923d15909e309a42513dfa60f50..ab086e5b1e64355afe3c4ee094b4a86d6cd76fc4 100644 (file)
 #ifndef DIALOGBOX_EXTRUSION_H
 #define DIALOGBOX_EXTRUSION_H
 
-#include "SALOME_Selection.h"
-#include "SMESH_LogicalFilter.hxx"
+#include "SalomeApp_SelectionMgr.h"
+#include "SUIT_SelectionFilter.h"
 
 // QT Includes
 #include <qdialog.h>
 
 class QGridLayout; 
 class QButtonGroup;
+class QRadioButton;
 class QGroupBox;
 class QLabel;
 class QLineEdit;
-class QPushButton;
-class QRadioButton;
 class QCheckBox;
 class QSpinBox;
-class SMESHGUI_SpinBox;
+class QPushButton;
+
 class SMESHGUI;
 class SMESH_Actor;
+class SMESHGUI_SpinBox;
+class SVTK_ViewWindow;
+class SVTK_Selector;
 
 // IDL Headers
 #include <SALOMEconfig.h>
 #include CORBA_SERVER_HEADER(SMESH_Mesh)
 
-
 //=================================================================================
 // class    : SMESHGUI_ExtrusionDlg
 // purpose  :
 //=================================================================================
 class SMESHGUI_ExtrusionDlg : public QDialog
-{ 
-    Q_OBJECT
+{
+  Q_OBJECT
 
 public:
-    SMESHGUI_ExtrusionDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 );
-    ~SMESHGUI_ExtrusionDlg();
+  SMESHGUI_ExtrusionDlg (SMESHGUI*,
+                        bool modal = FALSE);
+  ~SMESHGUI_ExtrusionDlg();
 
 private:
+  void Init (bool ResetControls = true);
+  void enterEvent (QEvent*);                           /* mouse enter the QWidget */
+  int  GetConstructorId();
+  //void closeEvent (QCloseEvent*);
+  //void hideEvent (QHideEvent*);                        /* ESC key */
+
+  SMESHGUI*                     mySMESHGUI;            /* Current SMESHGUI object */
+  SalomeApp_SelectionMgr*       mySelectionMgr;        /* User shape selection */
+  QLineEdit*                    myEditCurrentArgument; /* Current  LineEdit */
+  QString                       myElementsId;
+  int                           myNbOkElements;        /* to check when elements are defined */
+  SVTK_ViewWindow*              myViewWindow;
+  SVTK_Selector*                mySelector;
+
+  bool                          myBusy;
+  SMESH::SMESH_Mesh_var         myMesh;
+  SMESH_Actor*                  myActor;
+  SUIT_SelectionFilter*         myMeshOrSubMeshOrGroupFilter;
+
+  // widgets
+  QButtonGroup*     GroupConstructors;
+  QRadioButton*     RadioButton1;
+  QRadioButton*     RadioButton2;
+
+  QGroupBox*        GroupArguments;
+  QLabel*           TextLabelElements;
+  QPushButton*      SelectElementsButton;
+  QLineEdit*        LineEditElements;
+  QCheckBox*        CheckBoxMesh;
+  QLabel*           TextLabelVector;
+  QLabel*           TextLabelDx;
+  SMESHGUI_SpinBox* SpinBox_Dx;
+  QLabel*           TextLabelDy;
+  SMESHGUI_SpinBox* SpinBox_Dy;
+  QLabel*           TextLabelDz;
+  SMESHGUI_SpinBox* SpinBox_Dz;
+  QLabel*           TextLabelNbSteps;
+  QSpinBox*         SpinBox_NbSteps;
+
+  QGroupBox*        GroupButtons;
+  QPushButton*      buttonOk;
+  QPushButton*      buttonCancel;
+  QPushButton*      buttonApply;
 
-    void Init( bool ResetControls = true ) ;
-    void closeEvent( QCloseEvent* e ) ;
-    void enterEvent ( QEvent * ) ;                          /* mouse enter the QWidget */
-    void hideEvent ( QHideEvent * );                        /* ESC key */
-    int GetConstructorId();
-
-    SMESHGUI*                     mySMESHGUI ;              /* Current SMESHGUI object */
-    SALOME_Selection*             mySelection ;             /* User shape selection */
-    QString                       myElementsId;
-    int                           myNbOkElements ;          /* to check when elements are defined */
-    
-    QLineEdit*                    myEditCurrentArgument;    /* Current  LineEdit */
-
-    bool                          myBusy;
-    SMESH::SMESH_Mesh_var         myMesh;
-    SMESH_Actor*                  myActor;
-    Handle(SMESH_LogicalFilter)   myMeshOrSubMeshOrGroupFilter;
-
-    QButtonGroup* GroupConstructors;
-    QRadioButton* RadioButton1;
-    QRadioButton* RadioButton2;
-    QGroupBox* GroupButtons;
-    QPushButton* buttonOk;
-    QPushButton* buttonCancel;
-    QPushButton* buttonApply;
-    QGroupBox* GroupArguments;
-    QLabel* TextLabelElements;
-    QPushButton* SelectElementsButton;
-    QLineEdit* LineEditElements;
-    QCheckBox* CheckBoxMesh;
-    QLabel* TextLabelVector;
-    QLabel* TextLabelDx;
-    SMESHGUI_SpinBox* SpinBox_Dx;
-    QLabel* TextLabelDy;
-    SMESHGUI_SpinBox* SpinBox_Dy;
-    QLabel* TextLabelDz;
-    SMESHGUI_SpinBox* SpinBox_Dz;
-    QLabel* TextLabelNbSteps;
-    QSpinBox* SpinBox_NbSteps;
-    
-    private slots:
-
-    void ConstructorsClicked(int constructorId);
-    void ClickOnOk();
-    void ClickOnCancel();
-    void ClickOnApply();
-    void SetEditCurrentArgument() ;
-    void SelectionIntoArgument() ;
-    void DeactivateActiveDialog() ;
-    void ActivateThisDialog() ;
-    void onTextChange(const QString&);
-    void onSelectMesh(bool toSelectMesh);
-    
-protected:
-    QGridLayout* SMESHGUI_ExtrusionDlgLayout;
-    QGridLayout* GroupConstructorsLayout;
-    QGridLayout* GroupButtonsLayout;
-    QGridLayout* GroupArgumentsLayout;
+private slots:
+  void ConstructorsClicked (int);
+  void ClickOnOk();
+  bool ClickOnApply();
+  void ClickOnCancel();
+  void SetEditCurrentArgument();
+  void SelectionIntoArgument();
+  void DeactivateActiveDialog();
+  void ActivateThisDialog();
+  void onTextChange (const QString&);
+  void onSelectMesh (bool toSelectMesh);
 };
 
 #endif // DIALOGBOX_EXTRUSION_H
index 52f36378b4bc3837f9e8f4f118fe6412de315238..19b3fcb1ab62d0a354d550b888be0701a19603a0 100755 (executable)
 //  Module : SMESH
 
 #include "SMESHGUI_Filter.h"
+
+#include "SMESHGUI.h"
 #include "SMESHGUI_Utils.h"
+
+#include "SMESH_Actor.h"
 #include "SMDS_Mesh.hxx"
 #include "SMDS_MeshElement.hxx"
 #include "SMDSAbs_ElementType.hxx"
 
-#include <vtkCell.h>
-
+// OCCT Includes
 #include <gp_Vec.hxx>
 #include <Precision.hxx>
-#include "SMESH_Actor.h"
-#include "SMESHGUI.h"
+
+// VTK Includes
+#include <vtkCell.h>
 
 IMPLEMENT_STANDARD_HANDLE(SMESHGUI_Filter, VTKViewer_Filter)
 IMPLEMENT_STANDARD_RTTIEXT(SMESHGUI_Filter, VTKViewer_Filter)
@@ -86,7 +90,7 @@ bool SMESHGUI_PredicateFilter::IsValid( const int theCellId ) const
   SMESH_Actor* anActor = dynamic_cast<SMESH_Actor*>( myActor );
   if ( !anActor || anActor->GetObject() == 0 )
     return false;
-  
+
   SMDS_Mesh* aMesh = anActor->GetObject()->GetMesh();
   SMESH::ElementType anElemType = myPred->GetElementType();
   int aMeshId = anElemType == SMESH::NODE ? anActor->GetNodeObjId( theCellId )
@@ -98,7 +102,7 @@ bool SMESHGUI_PredicateFilter::IsValid( const int theCellId ) const
                                                              : aMesh->FindElement( aMeshId );
   if ( anElem != 0 && anElem->GetType() != (SMDSAbs_ElementType)myPred->GetElementType() )
     return true;
-  
+
   return myPred->IsSatisfy( aMeshId );
 }
 
@@ -114,10 +118,10 @@ bool SMESHGUI_PredicateFilter::IsObjValid( const int theObjId ) const
   SMESH_Actor* anActor = ( SMESH_Actor* )myActor;
   if ( anActor->GetObject() == 0 )
     return false;
-  
+
   SMDS_Mesh* aMesh = anActor->GetObject()->GetMesh();
   SMESH::ElementType anElemType = myPred->GetElementType();
-  
+
   // if type of element != type of predicate return true because
   // this predicate is not intended for filtering sush elements
   const SMDS_MeshElement* anElem = anElemType == SMESH::NODE ? aMesh->FindNode( theObjId )
@@ -158,7 +162,10 @@ void SMESHGUI_PredicateFilter::SetActor( SALOME_Actor* theActor )
 
   if ( myActor != 0 && !myPred->_is_nil() )
   {
-    Handle(SALOME_InteractiveObject) anIO = myActor->getIO();
+    SALOME_Actor* sActor = dynamic_cast<SALOME_Actor*>( myActor );
+    Handle(SALOME_InteractiveObject) anIO;
+    if( sActor )
+      anIO = sActor->getIO();
     if ( !anIO.IsNull() )
     {
       SMESH::SMESH_Mesh_var aMesh = SMESH::IObjectToInterface<SMESH::SMESH_Mesh>(anIO);
@@ -214,10 +221,10 @@ bool SMESHGUI_QuadrangleFilter::IsValid( const int theCellId ) const
   SMESH_Actor* anActor = ( SMESH_Actor* )myActor;
   if ( anActor->GetObject() == 0 )
     return false;
-  
+
   SMDS_Mesh* aMesh = anActor->GetObject()->GetMesh();
   const SMDS_MeshElement* anElem = aMesh->FindElement( anActor->GetElemObjId( theCellId ) );
-  
+
   return anElem && anElem->GetType() == SMDSAbs_Face && anElem->NbNodes() == 4;
 }
 
@@ -233,7 +240,7 @@ bool SMESHGUI_QuadrangleFilter::IsObjValid( const int theObjId ) const
   SMESH_Actor* anActor = ( SMESH_Actor* )myActor;
   if ( anActor->GetObject() == 0 )
     return false;
-  
+
   SMDS_Mesh* aMesh = anActor->GetObject()->GetMesh();
   const SMDS_MeshElement* anElem = aMesh->FindElement( theObjId );
 
@@ -291,7 +298,7 @@ bool SMESHGUI_TriangleFilter::IsValid( const int theCellId ) const
   SMESH_Actor* anActor = ( SMESH_Actor* )myActor;
   if ( anActor->GetObject() == 0 )
     return false;
-  
+
   SMDS_Mesh* aMesh = anActor->GetObject()->GetMesh();
   const SMDS_MeshElement* anElem = aMesh->FindElement( anActor->GetElemObjId( theCellId ) );
 
@@ -310,7 +317,7 @@ bool SMESHGUI_TriangleFilter::IsObjValid( const int theObjId ) const
   SMESH_Actor* anActor = ( SMESH_Actor* )myActor;
   if ( anActor->GetObject() == 0 )
     return false;
-  
+
   SMDS_Mesh* aMesh = anActor->GetObject()->GetMesh();
   const SMDS_MeshElement* anElem = aMesh->FindElement( theObjId );
 
@@ -367,7 +374,7 @@ bool SMESHGUI_FacesFilter::IsValid( const int theCellId ) const
   SMESH_Actor* anActor = ( SMESH_Actor* )myActor;
   if ( anActor->GetObject() == 0 )
     return false;
-  
+
   SMDS_Mesh* aMesh = anActor->GetObject()->GetMesh();
   const SMDS_MeshElement* anElem = aMesh->FindElement( anActor->GetElemObjId( theCellId ) );
 
@@ -386,7 +393,7 @@ bool SMESHGUI_FacesFilter::IsObjValid( const int theObjId ) const
   SMESH_Actor* anActor = ( SMESH_Actor* )myActor;
   if ( anActor->GetObject() == 0 )
     return false;
-  
+
   SMDS_Mesh* aMesh = anActor->GetObject()->GetMesh();
   const SMDS_MeshElement* anElem = aMesh->FindElement( theObjId );
 
@@ -444,7 +451,7 @@ bool SMESHGUI_VolumesFilter::IsValid( const int theCellId ) const
   SMESH_Actor* anActor = ( SMESH_Actor* )myActor;
   if ( anActor->GetObject() == 0 )
     return false;
-  
+
   SMDS_Mesh* aMesh = anActor->GetObject()->GetMesh();
   const SMDS_MeshElement* anElem = aMesh->FindElement( anActor->GetElemObjId( theCellId ) );
 
@@ -463,7 +470,7 @@ bool SMESHGUI_VolumesFilter::IsObjValid( const int theObjId ) const
   SMESH_Actor* anActor = ( SMESH_Actor* )myActor;
   if ( anActor->GetObject() == 0 )
     return false;
-  
+
   SMDS_Mesh* aMesh = anActor->GetObject()->GetMesh();
   const SMDS_MeshElement* anElem = aMesh->FindElement( theObjId );
 
@@ -488,14 +495,3 @@ bool SMESHGUI_VolumesFilter::IsNodeFilter() const
 {
   return false;
 }
-
-
-
-
-
-
-
-
-
-
-
index a7fc9e1b3dffa7cb3d6f27b82eae8e603d4484f3..0114f38b88c4fb58a57522a4469a42b6fd6ca2c9 100755 (executable)
 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
 //  Lesser General Public License for more details. 
 // 
-//  You should have received a copy of the GNU Lesser General Public 
-//  License along with this library; if not, write to the Free Software 
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
-// 
-//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
 //
 //
 //
@@ -50,7 +50,7 @@ enum SMESHGUI_FilterType
 
 /*
   Class       : SMESHGUI_Filter
-  Description : Base class for SMESH selection filters for VTK viewer. 
+  Description : Base class for SMESH selection filters for VTK viewer.
 */
 
 DEFINE_STANDARD_HANDLE(SMESHGUI_Filter, VTKViewer_Filter)
index 62a04bb7424aad3b706bf6de6f0d12296dea87fd..873c5f68816618332dd27a6699b8e9c064c6c2f9 100755 (executable)
@@ -1,22 +1,22 @@
 //  SMESH SMESHGUI : GUI for SMESH 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 
-// 
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
 //  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
 //
 //
 #include "SMESHGUI.h"
 #include "SMESHGUI_Utils.h"
 #include "SMESHGUI_VTKUtils.h"
+#include "SMESHGUI_Filter.h"
 #include "SMESHGUI_FilterUtils.h"
+#include "SMESHGUI_FilterLibraryDlg.h"
 
-#include "SMESHGUI_Filter.h"
 #include "SMESH_Actor.h"
-#include "VTKViewer_ViewFrame.h"
-#include "QAD_Desktop.h"
-#include "QAD_MessageBox.h"
-#include "QAD_RightFrame.h"
-#include "QAD_Config.h"
+#include "SMESH_NumberFilter.hxx"
+#include "SMESH_TypeFilter.hxx"
+
+#include "GEOMBase.h"
+#include "GEOM_FaceFilter.h"
+#include "GEOM_TypeFilter.h"
+
+#include "SUIT_Desktop.h"
+#include "SUIT_ResourceMgr.h"
+
+#include "SalomeApp_Application.h"
+#include "SalomeApp_Tools.h"
+#include "SalomeApp_Study.h"
+
+#include "SALOME_ListIO.hxx"
 #include "SALOME_ListIteratorOfListIO.hxx"
 #include "SALOME_DataMapIteratorOfDataMapOfIOMapOfInteger.hxx"
-#include "SALOMEGUI_QtCatchCorbaException.hxx"
-#include "SMESHGUI_FilterLibraryDlg.h"
-#include "SALOME_TypeFilter.hxx"
+#include "SALOMEDSClient_Study.hxx"
 
-#include "GEOMBase.h"
-#include "GEOM_FaceFilter.hxx"
+#include "SVTK_ViewWindow.h"
+#include "SVTK_Selector.h"
 
-#include <TColStd_MapOfInteger.hxx>
-#include <TColStd_IndexedMapOfInteger.hxx>
-#include <TColStd_MapIteratorOfMapOfInteger.hxx>
-#include <Precision.hxx>
+// OCCT Includes
+#include <StdSelect_TypeOfFace.hxx>
 #include <BRep_Tool.hxx>
-#include <TopoDS_Shape.hxx>
 #include <TopoDS.hxx>
 #include <TopoDS_Face.hxx>
+#include <TopoDS_Shape.hxx>
 #include <Geom_Plane.hxx>
 #include <Geom_CylindricalSurface.hxx>
+#include <Precision.hxx>
+#include <TColStd_MapOfInteger.hxx>
+#include <TColStd_IndexedMapOfInteger.hxx>
+#include <TColStd_MapIteratorOfMapOfInteger.hxx>
 
+// QT Includes
 #include <qframe.h>
 #include <qlayout.h>
 #include <qlineedit.h>
 #include "SALOMEconfig.h"
 #include CORBA_SERVER_HEADER(SMESH_Group)
 
-#define SPACING 5                  
+#define SPACING 5
 #define MARGIN  10
 
 using namespace SMESH;
 
-static int maxLength( const QMap<int, QString> theMap, const QFontMetrics& theMetrics )
+static int maxLength (const QMap<int, QString> theMap, const QFontMetrics& theMetrics)
 {
   int aRes = 0;
   QMap<int, QString>::const_iterator anIter;
-  for ( anIter = theMap.begin(); anIter != theMap.end(); ++anIter )
-    aRes = Max( aRes, theMetrics.width( anIter.data() ) );
-  return aRes; 
+  for (anIter = theMap.begin(); anIter != theMap.end(); ++anIter)
+    aRes = Max(aRes, theMetrics.width(anIter.data()));
+  return aRes;
 }
 
-static int getFilterId( SMESH::ElementType theType )
+static int getFilterId (SMESH::ElementType theType)
 {
-  switch ( theType )
+  switch (theType)
   {
     case SMESH::NODE   : return SMESHGUI_NodeFilter;
     case SMESH::EDGE   : return SMESHGUI_EdgeFilter;
@@ -121,127 +133,126 @@ class SMESHGUI_FilterTable::AdditionalWidget : public QFrame
 {
 public:
   enum { Tolerance };
-  
+
 public:
 
-                          AdditionalWidget( QWidget* theParent );
+                          AdditionalWidget(QWidget* theParent);
   virtual                 ~AdditionalWidget();
 
-  virtual void            GetParameters( QValueList<int>& ) const;
-  virtual bool            IsValid( const bool theMsg = true ) const;
-  virtual double          GetDouble( const int theId ) const;
-  virtual int             GetInteger( const int theId ) const;
-  virtual QString         GetString( const int theId ) const;
-  virtual void            SetDouble( const int theId, const double theVal );
-  virtual void            SetInteger( const int theId, const int theVal );
-  virtual void            SetString( const int theId, const QString& theVal );
-  void                    SetEditable( const int theId, const bool isEditable );
-  void                    SetEditable( const bool isEditable );
+  virtual void            GetParameters(QValueList<int>&) const;
+  virtual bool            IsValid(const bool theMsg = true) const;
+  virtual double          GetDouble(const int theId) const;
+  virtual int             GetInteger(const int theId) const;
+  virtual QString         GetString(const int theId) const;
+  virtual void            SetDouble(const int theId, const double theVal);
+  virtual void            SetInteger(const int theId, const int theVal);
+  virtual void            SetString(const int theId, const QString& theVal);
+  void                    SetEditable(const int theId, const bool isEditable);
+  void                    SetEditable(const bool isEditable);
 
 private:
   QMap< int, QLineEdit* > myLineEdits;
 };
 
-SMESHGUI_FilterTable::AdditionalWidget::AdditionalWidget( QWidget* theParent )
-: QFrame( theParent )
+SMESHGUI_FilterTable::AdditionalWidget::AdditionalWidget (QWidget* theParent)
+     : QFrame(theParent)
 {
-  QLabel* aLabel = new QLabel( tr( "SMESH_TOLERANCE" ), this );
-  myLineEdits[ Tolerance ] = new QLineEdit( this );
-  QDoubleValidator* aValidator = new QDoubleValidator( myLineEdits[ Tolerance ] );
-  aValidator->setBottom( 0 );
-  myLineEdits[ Tolerance ]->setValidator( aValidator );
+  QLabel* aLabel = new QLabel(tr("SMESH_TOLERANCE"), this);
+  myLineEdits[ Tolerance ] = new QLineEdit(this);
+  QDoubleValidator* aValidator = new QDoubleValidator(myLineEdits[ Tolerance ]);
+  aValidator->setBottom(0);
+  myLineEdits[ Tolerance ]->setValidator(aValidator);
 
-  QHBoxLayout* aLay = new QHBoxLayout( this, 0, SPACING );
-  aLay->addWidget( aLabel );
-  aLay->addWidget( myLineEdits[ Tolerance ] );
-  
-  QSpacerItem* aSpacer = new QSpacerItem( 0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum );
-  aLay->addItem( aSpacer );
+  QHBoxLayout* aLay = new QHBoxLayout(this, 0, SPACING);
+  aLay->addWidget(aLabel);
+  aLay->addWidget(myLineEdits[ Tolerance ]);
 
-  QString aText = QString( "%1" ).arg( Precision::Confusion() );
-  myLineEdits[ Tolerance ]->setText( aText );
+  QSpacerItem* aSpacer = new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum);
+  aLay->addItem(aSpacer);
+
+  QString aText = QString("%1").arg(Precision::Confusion());
+  myLineEdits[ Tolerance ]->setText(aText);
 }
-SMESHGUI_FilterTable::AdditionalWidget::~AdditionalWidget()
+
+ SMESHGUI_FilterTable::AdditionalWidget::~AdditionalWidget()
 {
 }
 
-void SMESHGUI_FilterTable::AdditionalWidget::GetParameters( QValueList<int>& theList ) const
+void SMESHGUI_FilterTable::AdditionalWidget::GetParameters (QValueList<int>& theList) const
 {
   theList.clear();
-  theList.append( Tolerance );
+  theList.append(Tolerance);
 }
 
-bool SMESHGUI_FilterTable::AdditionalWidget::IsValid( const bool theMsg ) const
+bool SMESHGUI_FilterTable::AdditionalWidget::IsValid (const bool theMsg) const
 {
-  if ( !isEnabled() )
+  if (!isEnabled())
     return true;
 
   QValueList<int> aParams;
-  GetParameters( aParams );
+  GetParameters(aParams);
   QValueList<int>::const_iterator anIter;
-  for ( anIter = aParams.begin(); anIter != aParams.end(); ++anIter )
-  {
+  for (anIter = aParams.begin(); anIter != aParams.end(); ++anIter) {
     const QLineEdit* aWg = myLineEdits[ *anIter ];
     int p = 0;
     QString aText = aWg->text();
-    if ( aWg->isEnabled() && aWg->validator()->validate( aText, p ) != QValidator::Acceptable )
-    {
-      if ( theMsg )
-          QMessageBox::information( SMESHGUI::GetSMESHGUI()->GetDesktop(),
-            tr( "SMESH_INSUFFICIENT_DATA" ), tr( "SMESHGUI_INVALID_PARAMETERS" ), QMessageBox::Ok );
-        return false;
+    if (aWg->isEnabled() && aWg->validator()->validate(aText, p) != QValidator::Acceptable) {
+      if (theMsg)
+        QMessageBox::information(SMESHGUI::desktop(), tr("SMESH_INSUFFICIENT_DATA"),
+                                 tr("SMESHGUI_INVALID_PARAMETERS"), QMessageBox::Ok);
+      return false;
     }
   }
 
   return true;
 }
 
-double SMESHGUI_FilterTable::AdditionalWidget::GetDouble( const int theId ) const
+double SMESHGUI_FilterTable::AdditionalWidget::GetDouble (const int theId) const
 {
-  return myLineEdits.contains( theId ) ? myLineEdits[ theId ]->text().toDouble() : 0;
+  return myLineEdits.contains(theId) ? myLineEdits[ theId ]->text().toDouble() : 0;
 }
 
-int SMESHGUI_FilterTable::AdditionalWidget::GetInteger( const int theId ) const
+int SMESHGUI_FilterTable::AdditionalWidget::GetInteger (const int theId) const
 {
-  return myLineEdits.contains( theId ) ? myLineEdits[ theId ]->text().toInt() : 0;
+  return myLineEdits.contains(theId) ? myLineEdits[ theId ]->text().toInt() : 0;
 }
 
-QString SMESHGUI_FilterTable::AdditionalWidget::GetString( const int theId ) const
+QString SMESHGUI_FilterTable::AdditionalWidget::GetString (const int theId) const
 {
-  return myLineEdits.contains( theId ) ? myLineEdits[ theId ]->text() : QString("");
+  return myLineEdits.contains(theId) ? myLineEdits[ theId ]->text() : QString("");
 }
 
-void SMESHGUI_FilterTable::AdditionalWidget::SetDouble( const int theId, const double theVal )
+void SMESHGUI_FilterTable::AdditionalWidget::SetDouble (const int theId, const double theVal)
 {
-  if ( myLineEdits.contains( theId ) )
-    myLineEdits[ theId ]->setText( QString( "%1" ).arg( theVal ) );
+  if (myLineEdits.contains(theId))
+    myLineEdits[ theId ]->setText(QString("%1").arg(theVal));
 }
 
-void SMESHGUI_FilterTable::AdditionalWidget::SetInteger( const int theId, const int theVal )
+void SMESHGUI_FilterTable::AdditionalWidget::SetInteger (const int theId, const int theVal)
 {
-  if ( myLineEdits.contains( theId ) )
-    myLineEdits[ theId ]->setText( QString( "%1" ).arg( theVal ) );
+  if (myLineEdits.contains(theId))
+    myLineEdits[ theId ]->setText(QString("%1").arg(theVal));
 }
 
-void SMESHGUI_FilterTable::AdditionalWidget::SetString( const int theId, const QString& theVal )
+void SMESHGUI_FilterTable::AdditionalWidget::SetString (const int theId, const QString& theVal)
 {
-  if ( myLineEdits.contains( theId ) )
-    myLineEdits[ theId ]->setText( theVal );
+  if (myLineEdits.contains(theId))
+    myLineEdits[ theId ]->setText(theVal);
 }
 
-void SMESHGUI_FilterTable::AdditionalWidget::SetEditable( const int theId, const bool isEditable )
+void SMESHGUI_FilterTable::AdditionalWidget::SetEditable (const int theId, const bool isEditable)
 {
-  if ( myLineEdits.contains( theId ) )
-    myLineEdits[ theId ]->setEdited( isEditable );
+  if (myLineEdits.contains(theId))
+    myLineEdits[ theId ]->setEdited(isEditable);
 }
 
-void SMESHGUI_FilterTable::AdditionalWidget::SetEditable( const bool isEditable )
+void SMESHGUI_FilterTable::AdditionalWidget::SetEditable (const bool isEditable)
 {
   QValueList<int> aParams;
-  GetParameters( aParams );
+  GetParameters(aParams);
   QValueList<int>::const_iterator anIter;
-  for ( anIter = aParams.begin(); anIter != aParams.end(); ++anIter )
-    myLineEdits[ *anIter ]->setEdited( isEditable );
+  for (anIter = aParams.begin(); anIter != aParams.end(); ++anIter)
+    myLineEdits[ *anIter ]->setEdited(isEditable);
 }
 
 /*
@@ -250,97 +261,95 @@ void SMESHGUI_FilterTable::AdditionalWidget::SetEditable( const bool isEditable
 */
 
 class SMESHGUI_FilterTable::ComboItem : public QComboTableItem
-
 {
 public:
-                          ComboItem( QTable*, const QMap<int, QString>& );
+                          ComboItem(QTable*, const QMap<int, QString>&);
   virtual                 ~ComboItem();
 
-  virtual void            setStringList ( const QStringList & l );
-  void                    setStringList( const QMap<int, QString>& theIds );
+  virtual void            setStringList (const QStringList & l);
+  void                    setStringList(const QMap<int, QString>& theIds);
 
   int                     GetValue() const;
-  void                    SetValue( const int );
-  
+  void                    SetValue(const int);
+
 private:
-  
+
   QMap<int, int>          myNumToId;
   QMap<int, int>          myIdToNum;
 };
 
-SMESHGUI_FilterTable::ComboItem::ComboItem( QTable*                   theParent, 
-                                            const QMap<int, QString>& theIds )
-: QComboTableItem( theParent, QStringList() )
+SMESHGUI_FilterTable::ComboItem::ComboItem (QTable*                   theParent,
+                                            const QMap<int, QString>& theIds)
+: QComboTableItem(theParent, QStringList())
 {
-  setStringList( theIds );
+  setStringList(theIds);
 }
 
-void SMESHGUI_FilterTable::ComboItem::setStringList( const QStringList & l )
+void SMESHGUI_FilterTable::ComboItem::setStringList (const QStringList & l)
 {
-  QComboTableItem::setStringList( l );
+  QComboTableItem::setStringList(l);
 }
 
-void SMESHGUI_FilterTable::ComboItem::setStringList( const QMap<int, QString>& theIds )
+void SMESHGUI_FilterTable::ComboItem::setStringList (const QMap<int, QString>& theIds)
 {
   int i = 0;
   QStringList aList;
   QMap<int, QString>::const_iterator anIter;
-  for ( anIter = theIds.begin(); anIter != theIds.end(); ++anIter )
-  {
+  for (anIter = theIds.begin(); anIter != theIds.end(); ++anIter) {
     myNumToId[ i ] = anIter.key();
     myIdToNum[ anIter.key() ] = i;
-    aList.append( anIter.data() );
+    aList.append(anIter.data());
     i++;
   }
 
-  setStringList( aList );
+  setStringList(aList);
 }
 
 SMESHGUI_FilterTable::ComboItem::~ComboItem()
 {
 }
-  
+
 int SMESHGUI_FilterTable::ComboItem::GetValue() const
 {
   return myNumToId[ currentItem() ];
 }
 
-void SMESHGUI_FilterTable::ComboItem::SetValue( const int theVal )
+void SMESHGUI_FilterTable::ComboItem::SetValue (const int theVal)
 {
-  setCurrentItem( myIdToNum[ theVal ] );
+  setCurrentItem(myIdToNum[ theVal ]);
 }
 
 
 /*
-  Class       : SMESHGUI_FilterTable::Table            
+  Class       : SMESHGUI_FilterTable::Table
   Description : Table used by this widget
 */
 
 class SMESHGUI_FilterTable::Table : public QTable
 {
 public:
-                          Table( QWidget* parent );
-                          Table( int numRows, int numCols, QWidget* parent = 0 );
+                          Table(QWidget* parent);
+                          Table(int numRows, int numCols, QWidget* parent = 0);
   virtual                 ~Table();
 
-  void                    SetEditable( const bool state, const int row, const int col );
-  bool                    IsEditable( const int row, const int col ) const;  
+  void                    SetEditable(const bool state, const int row, const int col);
+  bool                    IsEditable(const int row, const int col) const;
 
-  virtual void            insertRows( int row, int count = 1 );
-  virtual QString         text( int row, int col ) const;
+  virtual void            insertRows(int row, int count = 1);
+  virtual QString         text(int row, int col) const;
 };
 
 //=======================================================================
 // name    : SMESHGUI_FilterTable::Table::Table
 // Purpose : Constructor
 //=======================================================================
-SMESHGUI_FilterTable::Table::Table( QWidget* parent )
-: QTable( parent, "SMESHGUI_FilterTable::Table" )
+SMESHGUI_FilterTable::Table::Table (QWidget* parent)
+: QTable(parent, "SMESHGUI_FilterTable::Table")
 {
 }
 
-SMESHGUI_FilterTable::Table::Table( int numRows, int numCols, QWidget* parent )
-: QTable( numRows, numCols, parent, "SMESHGUI_FilterTable::Table" )
+SMESHGUI_FilterTable::Table::Table (int numRows, int numCols, QWidget* parent)
+: QTable(numRows, numCols, parent, "SMESHGUI_FilterTable::Table")
 {
 }
 
@@ -352,63 +361,63 @@ SMESHGUI_FilterTable::Table::~Table()
 // name    : SMESHGUI_FilterTable::Table::SetEditable
 // Purpose : Set editable of specified cell
 //=======================================================================
-void SMESHGUI_FilterTable::Table::SetEditable( const bool isEditable, const int row, const int col )
+void SMESHGUI_FilterTable::Table::SetEditable (const bool isEditable,
+                                               const int row, const int col)
 {
-  QTableItem* anItem = item( row, col );
-  if( anItem )
-    takeItem( anItem );
+  QTableItem* anItem = item(row, col);
+  if(anItem)
+    takeItem(anItem);
 
-  if ( !isEditable )
-    setItem( row, col, new QTableItem( this, QTableItem::Never, "" ) );
+  if (!isEditable)
+    setItem(row, col, new QTableItem(this, QTableItem::Never, ""));
   else
-    setItem( row, col, new QTableItem( this, QTableItem::OnTyping, "" ) );
+    setItem(row, col, new QTableItem(this, QTableItem::OnTyping, ""));
 }
 
 //=======================================================================
 // name    : SMESHGUI_FilterTable::Table::IsEditable
 // Purpose : Verify wheter cell is editable
 //=======================================================================
-bool SMESHGUI_FilterTable::Table::IsEditable( const int row, const int col ) const
+bool SMESHGUI_FilterTable::Table::IsEditable (const int row, const int col) const
 {
-  QTableItem* anItem = item( row, col );
+  QTableItem* anItem = item(row, col);
   return anItem == 0 || anItem->editType() != QTableItem::Never;
 }
 
 //=======================================================================
 // name    : SMESHGUI_FilterTable::Table::insertRows
-// Purpose : Insert rows ( virtual redefined )
+// Purpose : Insert rows (virtual redefined)
 //=======================================================================
-void SMESHGUI_FilterTable::Table::insertRows( int row, int count )
+void SMESHGUI_FilterTable::Table::insertRows (int row, int count)
 {
   int anEditRow = currEditRow();
   int anEditCol = currEditCol();
 
-  if ( anEditRow >= 0 && anEditCol >= 0 )
-    endEdit( anEditRow, anEditCol, true, false );
+  if (anEditRow >= 0 && anEditCol >= 0)
+    endEdit(anEditRow, anEditCol, true, false);
 
-  QTable::insertRows( row, count );
+  QTable::insertRows(row, count);
 }
 
 //=======================================================================
 // name    : SMESHGUI_FilterTable::Table::text
-// Purpose : Get text from cell ( virtual redefined ) 
+// Purpose : Get text from cell (virtual redefined)
 //=======================================================================
-QString SMESHGUI_FilterTable::Table::text( int row, int col ) const
+QString SMESHGUI_FilterTable::Table::text (int row, int col) const
 {
   int anEditRow = currEditRow();
   int anEditCol = currEditCol();
 
-  if ( anEditRow >= 0 && anEditCol >= 0 && anEditRow == row && anEditCol == col )
-    ((Table*)this)->endEdit( row, col, true, false );
+  if (anEditRow >= 0 && anEditCol >= 0 && anEditRow == row && anEditCol == col)
+    ((Table*)this)->endEdit(row, col, true, false);
 
-  return QTable::text( row, col );
+  return QTable::text(row, col);
 }
 
 
-
 /*
   Class       : SMESHGUI_FilterTable
-  Description : Frame containig 
+  Description : Frame containig
                   - Button group for switching entity type
                   - Table for displaying filter criterions
                   - Buttons for editing table and filter libraries
@@ -418,25 +427,25 @@ QString SMESHGUI_FilterTable::Table::text( int row, int col ) const
 // name    : SMESHGUI_FilterTable::SMESHGUI_FilterTable
 // Purpose : Constructor
 //=======================================================================
-SMESHGUI_FilterTable::SMESHGUI_FilterTable( QWidget* parent, 
-                                            const int type )
-: QFrame( parent )                                            
+SMESHGUI_FilterTable::SMESHGUI_FilterTable (QWidget* parent,
+                                            const int type)
+: QFrame(parent)
 {
   myEntityType = -1;
-  Init( type );
-}                 
+  Init(type);
+}
 
 //=======================================================================
 // name    : SMESHGUI_FilterTable::SMESHGUI_FilterTable
 // Purpose : Constructor
 //=======================================================================
-SMESHGUI_FilterTable::SMESHGUI_FilterTable( QWidget* parent, 
-                                            const QValueList<int>& types )
-: QFrame( parent )                                            
+SMESHGUI_FilterTable::SMESHGUI_FilterTable (QWidget* parent,
+                                            const QValueList<int>& types)
+: QFrame(parent)
 {
   myEntityType = -1;
-  Init( types );
-}                                            
+  Init(types);
+}
 
 SMESHGUI_FilterTable::~SMESHGUI_FilterTable()
 {
@@ -446,153 +455,153 @@ SMESHGUI_FilterTable::~SMESHGUI_FilterTable()
 // name    : SMESHGUI_FilterTable::Init
 // Purpose : Create table corresponding to the specified type
 //=======================================================================
-void SMESHGUI_FilterTable::Init( const int type )
+void SMESHGUI_FilterTable::Init (const int type)
 {
   QValueList<int> aTypes;
-  aTypes.append( type );
-  Init( aTypes );
+  aTypes.append(type);
+  Init(aTypes);
 }
 
 //=======================================================================
 // name    : SMESHGUI_FilterTable::Init
 // Purpose : Create table corresponding to the specified type
 //=======================================================================
-void SMESHGUI_FilterTable::Init( const QValueList<int>& theTypes )
+void SMESHGUI_FilterTable::Init (const QValueList<int>& theTypes)
 {
-  if ( theTypes.isEmpty() )
+  if (theTypes.isEmpty())
     return;
-  
+
   // Create buttons if necessary
-  
-  if ( myTables.isEmpty() ) 
+
+  if (myTables.isEmpty())
   {
     int aType = theTypes.first();
 
     // create main layout
-    QVBoxLayout* aMainLay = new QVBoxLayout( this );
-    QGroupBox* aMainGrp = new QGroupBox( 1, Qt::Horizontal, this );
-    aMainGrp->setFrameStyle( QFrame::NoFrame );
-    aMainGrp->setInsideMargin( 0 );
-    aMainLay->addWidget( aMainGrp );
-    
+    QVBoxLayout* aMainLay = new QVBoxLayout(this);
+    QGroupBox* aMainGrp = new QGroupBox(1, Qt::Horizontal, this);
+    aMainGrp->setFrameStyle(QFrame::NoFrame);
+    aMainGrp->setInsideMargin(0);
+    aMainLay->addWidget(aMainGrp);
+
     // create switch of entity types
-    myEntityTypeGrp = new QButtonGroup( 1, Qt::Vertical, tr( "ENTITY_TYPE" ), aMainGrp );
+    myEntityTypeGrp = new QButtonGroup(1, Qt::Vertical, tr("ENTITY_TYPE"), aMainGrp);
     const QMap<int, QString>& aSupportedTypes = getSupportedTypes();
     QMap<int, QString>::const_iterator anIter;
-    for ( anIter = aSupportedTypes.begin(); anIter != aSupportedTypes.end(); ++anIter )
+    for (anIter = aSupportedTypes.begin(); anIter != aSupportedTypes.end(); ++anIter)
     {
-      QRadioButton* aBtn = new QRadioButton( anIter.data(), myEntityTypeGrp );
-      myEntityTypeGrp->insert( aBtn, anIter.key() );
+      QRadioButton* aBtn = new QRadioButton(anIter.data(), myEntityTypeGrp);
+      myEntityTypeGrp->insert(aBtn, anIter.key());
     }
 
-    myTableGrp = new QGroupBox( 1, Qt::Horizontal, tr( "FILTER" ), aMainGrp  );
-    QFrame* aTableFrame = new QFrame( myTableGrp );
-  
+    myTableGrp = new QGroupBox(1, Qt::Horizontal, tr("FILTER"), aMainGrp );
+    QFrame* aTableFrame = new QFrame(myTableGrp);
+
     // create table
-    mySwitchTableGrp = new QGroupBox( 1, Qt::Horizontal, aTableFrame );
-    mySwitchTableGrp->setFrameStyle( QFrame::NoFrame );
-    mySwitchTableGrp->setInsideMargin( 0 );
-    
-    myTables[ aType ] = createTable( mySwitchTableGrp, aType );
-  
+    mySwitchTableGrp = new QGroupBox(1, Qt::Horizontal, aTableFrame);
+    mySwitchTableGrp->setFrameStyle(QFrame::NoFrame);
+    mySwitchTableGrp->setInsideMargin(0);
+
+    myTables[ aType ] = createTable(mySwitchTableGrp, aType);
+
     // create buttons
-    myAddBtn      = new QPushButton( tr( "ADD" ), aTableFrame );
-    myRemoveBtn   = new QPushButton( tr( "REMOVE" ), aTableFrame );
-    myClearBtn    = new QPushButton( tr( "CLEAR" ), aTableFrame );
-    myInsertBtn   = new QPushButton( tr( "INSERT" ), aTableFrame );
-    myCopyFromBtn = new QPushButton( tr( "COPY_FROM" ), aTableFrame );
-    myAddToBtn    = new QPushButton( tr( "ADD_TO" ), aTableFrame );
-
-    myAddBtn->setAutoDefault( false );
-    myRemoveBtn->setAutoDefault( false );
-    myClearBtn->setAutoDefault( false );
-    myInsertBtn->setAutoDefault( false );
-    myCopyFromBtn->setAutoDefault( false );
-    myAddToBtn->setAutoDefault( false );
+    myAddBtn      = new QPushButton(tr("ADD"), aTableFrame);
+    myRemoveBtn   = new QPushButton(tr("REMOVE"), aTableFrame);
+    myClearBtn    = new QPushButton(tr("CLEAR"), aTableFrame);
+    myInsertBtn   = new QPushButton(tr("INSERT"), aTableFrame);
+    myCopyFromBtn = new QPushButton(tr("COPY_FROM"), aTableFrame);
+    myAddToBtn    = new QPushButton(tr("ADD_TO"), aTableFrame);
+
+    myAddBtn->setAutoDefault(false);
+    myRemoveBtn->setAutoDefault(false);
+    myClearBtn->setAutoDefault(false);
+    myInsertBtn->setAutoDefault(false);
+    myCopyFromBtn->setAutoDefault(false);
+    myAddToBtn->setAutoDefault(false);
 
     myCopyFromBtn->hide();
     myAddToBtn->hide();
-    
+
     // layout widgets
-    QGridLayout* aLay = new QGridLayout( aTableFrame, 8, 2, 0, SPACING );
-
-    aLay->addMultiCellWidget( mySwitchTableGrp, 0, 6, 0, 0 );
-    aLay->addWidget( myAddBtn, 0, 1 );
-    aLay->addWidget( myInsertBtn, 1, 1 );
-    aLay->addWidget( myRemoveBtn, 2, 1 );
-    aLay->addWidget( myClearBtn, 3, 1 );
-    aLay->addWidget( myCopyFromBtn, 5, 1 );
-    aLay->addWidget( myAddToBtn, 6, 1 );
-    aLay->addMultiCellWidget( createAdditionalFrame( aTableFrame ), 7, 7, 0, 1  );
-    
-    aLay->setColStretch( 0, 1 );
-    aLay->setColStretch( 1, 0 );
-    
-    QSpacerItem* aVSpacer = new QSpacerItem( 0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding );
-    aLay->addItem( aVSpacer, 4, 1 );
-    
+    QGridLayout* aLay = new QGridLayout(aTableFrame, 8, 2, 0, SPACING);
+
+    aLay->addMultiCellWidget(mySwitchTableGrp, 0, 6, 0, 0);
+    aLay->addWidget(myAddBtn, 0, 1);
+    aLay->addWidget(myInsertBtn, 1, 1);
+    aLay->addWidget(myRemoveBtn, 2, 1);
+    aLay->addWidget(myClearBtn, 3, 1);
+    aLay->addWidget(myCopyFromBtn, 5, 1);
+    aLay->addWidget(myAddToBtn, 6, 1);
+    aLay->addMultiCellWidget(createAdditionalFrame(aTableFrame), 7, 7, 0, 1 );
+
+    aLay->setColStretch(0, 1);
+    aLay->setColStretch(1, 0);
+
+    QSpacerItem* aVSpacer = new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding);
+    aLay->addItem(aVSpacer, 4, 1);
+
     // signals and slots
-    connect( myAddBtn,    SIGNAL( clicked() ), this, SLOT( onAddBtn() ) );
-    connect( myInsertBtn, SIGNAL( clicked() ), this, SLOT( onInsertBtn() ) );
-    connect( myRemoveBtn, SIGNAL( clicked() ), this, SLOT( onRemoveBtn() ) );
-    connect( myClearBtn,  SIGNAL( clicked() ), this, SLOT( onClearBtn() ) );
-  
-    connect( myCopyFromBtn, SIGNAL( clicked() ), this, SLOT( onCopyFromBtn() ) );
-    connect( myAddToBtn,    SIGNAL( clicked() ), this, SLOT( onAddToBtn() ) );
-    
-    connect( myEntityTypeGrp, SIGNAL( clicked( int ) ), this, SLOT( onEntityType( int ) ) );
-    
+    connect(myAddBtn,    SIGNAL(clicked()), this, SLOT(onAddBtn()));
+    connect(myInsertBtn, SIGNAL(clicked()), this, SLOT(onInsertBtn()));
+    connect(myRemoveBtn, SIGNAL(clicked()), this, SLOT(onRemoveBtn()));
+    connect(myClearBtn,  SIGNAL(clicked()), this, SLOT(onClearBtn()));
+
+    connect(myCopyFromBtn, SIGNAL(clicked()), this, SLOT(onCopyFromBtn()));
+    connect(myAddToBtn,    SIGNAL(clicked()), this, SLOT(onAddToBtn()));
+
+    connect(myEntityTypeGrp, SIGNAL(clicked(int)), this, SLOT(onEntityType(int)));
+
     myLibDlg = 0;
   }
-  
+
   // Hide buttons of entity types if necessary
   const QMap<int, QString>& aSupportedTypes = getSupportedTypes();
   QMap<int, QString>::const_iterator anIt;
-  for ( anIt = aSupportedTypes.begin(); anIt != aSupportedTypes.end(); ++anIt )
+  for (anIt = aSupportedTypes.begin(); anIt != aSupportedTypes.end(); ++anIt)
   {
-    QButton* aBtn = myEntityTypeGrp->find( anIt.key() );
-    theTypes.contains( anIt.key() ) ? aBtn->show() : aBtn->hide();
+    QButton* aBtn = myEntityTypeGrp->find(anIt.key());
+    theTypes.contains(anIt.key()) ? aBtn->show() : aBtn->hide();
   }
 
   // select first button if there is no selected buttons or it is hidden
   QButton* aBtn = myEntityTypeGrp->selected();
-  if (  aBtn == 0 || theTypes.find( myEntityTypeGrp->id( aBtn ) ) == theTypes.end() )
-    myEntityTypeGrp->setButton( theTypes.first() );
+  if ( aBtn == 0 || theTypes.find(myEntityTypeGrp->id(aBtn)) == theTypes.end())
+    myEntityTypeGrp->setButton(theTypes.first());
 
-  if ( theTypes.count() == 1 )
+  if (theTypes.count() == 1)
     myEntityTypeGrp->hide();
   else
     myEntityTypeGrp->show();
 
   myTableGrp->updateGeometry();
-  int aType = myEntityTypeGrp->id( myEntityTypeGrp->selected() );
-  onEntityType( aType );
+  int aType = myEntityTypeGrp->id(myEntityTypeGrp->selected());
+  onEntityType(aType);
 }
 
 //=======================================================================
 // name    : SMESHGUI_FilterTable::GetTableGrp
 // Purpose : Get group box containing table. May be used for adding new widgets in it
-////=======================================================================
-QWidget* SMESHGUI_FilterTable::createAdditionalFrame( QWidget* theParent )
-{
-  QFrame* aFrame = new QFrame( theParent );
-  
-  QFrame* aLine1 = new QFrame( aFrame );
-  QFrame* aLine2 = new QFrame( aFrame );
-  aLine1->setFrameStyle( QFrame::HLine | QFrame::Sunken );
-  aLine2->setFrameStyle( QFrame::HLine | QFrame::Sunken );
-  aLine1->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed) );
-  aLine2->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed) );
-  
-  QLabel* aLabel = new QLabel( tr( "ADDITIONAL_PARAMETERS" ), aFrame );
-
-  myWgStack = new QWidgetStack( aFrame );
-
-  QGridLayout* aLay = new QGridLayout( aFrame, 2, 3, 0, SPACING );
-  aLay->addWidget( aLine1, 0, 0 );
-  aLay->addWidget( aLabel, 0, 1 );
-  aLay->addWidget( aLine2, 0, 2 );
-  aLay->addMultiCellWidget( myWgStack, 1, 1, 0, 2 );
+//=======================================================================
+QWidget* SMESHGUI_FilterTable::createAdditionalFrame (QWidget* theParent)
+{
+  QFrame* aFrame = new QFrame(theParent);
+
+  QFrame* aLine1 = new QFrame(aFrame);
+  QFrame* aLine2 = new QFrame(aFrame);
+  aLine1->setFrameStyle(QFrame::HLine | QFrame::Sunken);
+  aLine2->setFrameStyle(QFrame::HLine | QFrame::Sunken);
+  aLine1->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed));
+  aLine2->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed));
+
+  QLabel* aLabel = new QLabel(tr("ADDITIONAL_PARAMETERS"), aFrame);
+
+  myWgStack = new QWidgetStack(aFrame);
+
+  QGridLayout* aLay = new QGridLayout(aFrame, 2, 3, 0, SPACING);
+  aLay->addWidget(aLine1, 0, 0);
+  aLay->addWidget(aLabel, 0, 1);
+  aLay->addWidget(aLine2, 0, 2);
+  aLay->addMultiCellWidget(myWgStack, 1, 1, 0, 2);
 
   return aFrame;
 }
@@ -600,7 +609,7 @@ QWidget* SMESHGUI_FilterTable::createAdditionalFrame( QWidget* theParent )
 //=======================================================================
 // name    : SMESHGUI_FilterTable::GetTableGrp
 // Purpose : Get group box containing table. May be used for adding new widgets in it
-////=======================================================================
+//=======================================================================
 QGroupBox* SMESHGUI_FilterTable::GetTableGrp()
 {
   return myTableGrp;
@@ -609,28 +618,28 @@ QGroupBox* SMESHGUI_FilterTable::GetTableGrp()
 //=======================================================================
 // name    : SMESHGUI_FilterTable::onEntityType
 // Purpose : SLOT. Called when entity type changed.
-//           Display corresponding table 
+//           Display corresponding table
 //=======================================================================
-void SMESHGUI_FilterTable::onEntityType( int theType )
+void SMESHGUI_FilterTable::onEntityType (int theType)
 {
-  if ( myEntityType == theType )
+  if (myEntityType == theType)
     return;
 
   myIsValid = true;
   emit NeedValidation();
-  if ( !myIsValid )
+  if (!myIsValid)
   {
-    myEntityTypeGrp->setButton( myEntityType );
+    myEntityTypeGrp->setButton(myEntityType);
     return;
   }
 
   myEntityType = theType;
-  
-  if ( !myTables.contains( theType ) )
-    myTables[ theType ] = createTable( mySwitchTableGrp, theType );    
-  
+
+  if (!myTables.contains(theType))
+    myTables[ theType ] = createTable(mySwitchTableGrp, theType);
+
   TableMap::iterator anIter;
-  for ( anIter = myTables.begin(); anIter != myTables.end(); ++anIter )
+  for (anIter = myTables.begin(); anIter != myTables.end(); ++anIter)
     myEntityType == anIter.key() ? anIter.data()->show() : anIter.data()->hide();
 
   updateBtnState();
@@ -638,7 +647,7 @@ void SMESHGUI_FilterTable::onEntityType( int theType )
   myTables[ myEntityType ]->updateGeometry();
   adjustSize();
 
-  emit EntityTypeChanged( theType );
+  emit EntityTypeChanged(theType);
 
 }
 
@@ -646,56 +655,51 @@ void SMESHGUI_FilterTable::onEntityType( int theType )
 // name    : SMESHGUI_FilterTable::IsValid
 // Purpose : Verify validity of entered data
 //=======================================================================
-bool SMESHGUI_FilterTable::IsValid( const bool theMess, const int theEntityType ) const
+bool SMESHGUI_FilterTable::IsValid (const bool theMess, const int theEntityType) const
 {
   int aType = theEntityType == -1 ? GetType() : theEntityType;
 
   Table* aTable = myTables[ aType ];
-  for ( int i = 0, n = aTable->numRows(); i < n; i++ )
+  for (int i = 0, n = aTable->numRows(); i < n; i++)
   {
-    int aCriterion = GetCriterionType( i, aType );
+    int aCriterion = GetCriterionType(i, aType);
 
-    if ( aCriterion == FT_RangeOfIds ||
+    if (aCriterion == FT_RangeOfIds ||
          aCriterion == FT_BelongToGeom ||
          aCriterion == FT_BelongToPlane ||
          aCriterion == FT_BelongToCylinder ||
-        aCriterion == FT_LyingOnGeom)
-    {
-      if ( aTable->text( i, 2 ).isEmpty() )
-      {
-        if ( theMess )
-          QMessageBox::information( SMESHGUI::GetSMESHGUI()->GetDesktop(),
-            tr( "SMESH_INSUFFICIENT_DATA" ), tr( "ERROR" ), QMessageBox::Ok );
+        aCriterion == FT_LyingOnGeom) {
+      if (aTable->text(i, 2).isEmpty()) {
+        if (theMess)
+          QMessageBox::information(SMESHGUI::desktop(), tr("SMESH_INSUFFICIENT_DATA"),
+                                   tr("ERROR"), QMessageBox::Ok);
         return false;
       }
-    }
-    else
-    {
+    } else {
       bool aRes = false;
-      aTable->blockSignals( true );
-      double  aThreshold = ( int )aTable->text( i, 2 ).toDouble( &aRes );
-      aTable->blockSignals( false );
-
-      if ( !aRes && aTable->IsEditable( i, 2 ) )
-      {
-        if ( theMess )
-          QMessageBox::information( SMESHGUI::GetSMESHGUI()->GetDesktop(),
-            tr( "SMESH_INSUFFICIENT_DATA" ), tr( "ERROR" ), QMessageBox::Ok );
+      aTable->blockSignals(true);
+      double  aThreshold = (int)aTable->text(i, 2).toDouble(&aRes);
+      aTable->blockSignals(false);
+
+      if (!aRes && aTable->IsEditable(i, 2)) {
+        if (theMess)
+          QMessageBox::information(SMESHGUI::desktop(), tr("SMESH_INSUFFICIENT_DATA"),
+                                   tr("ERROR"), QMessageBox::Ok);
         return false;
       }
-      else if ( aType == SMESH::EDGE &&
-                GetCriterionType( i, aType ) == SMESH::FT_MultiConnection &&
-                aThreshold == 1 )
+      else if (aType == SMESH::EDGE &&
+                GetCriterionType(i, aType) == SMESH::FT_MultiConnection &&
+                aThreshold == 1)
       {
-        if ( theMess )
-          QMessageBox::information( SMESHGUI::GetSMESHGUI()->GetDesktop(),
-            tr( "SMESH_INSUFFICIENT_DATA" ), tr( "MULTIEDGES_ERROR" ), QMessageBox::Ok );
+        if (theMess)
+          QMessageBox::information(SMESHGUI::desktop(), tr("SMESH_INSUFFICIENT_DATA"),
+                                   tr("MULTIEDGES_ERROR"), QMessageBox::Ok);
         return false;
       }
     }
 
-    QTableItem* anItem = aTable->item( i, 0 );
-    if ( myAddWidgets.contains( anItem ) && !myAddWidgets[ anItem ]->IsValid() )
+    QTableItem* anItem = aTable->item(i, 0);
+    if (myAddWidgets.contains(anItem) && !myAddWidgets[ anItem ]->IsValid())
       return false;
   }
 
@@ -706,7 +710,7 @@ bool SMESHGUI_FilterTable::IsValid( const bool theMess, const int theEntityType
 // name    : SMESHGUI_FilterTable::SetValidity
 // Purpose : Set validity of the table
 //=======================================================================
-void SMESHGUI_FilterTable::SetValidity( const bool isValid )
+void SMESHGUI_FilterTable::SetValidity (const bool isValid)
 {
   myIsValid = isValid;
 }
@@ -724,10 +728,10 @@ int SMESHGUI_FilterTable::GetType() const
 // name    : SMESHGUI_FilterTable::SetType
 // Purpose : Set current entity type
 //=======================================================================
-void SMESHGUI_FilterTable::SetType( const int type )
+void SMESHGUI_FilterTable::SetType (const int type)
 {
-  myEntityTypeGrp->setButton( type );
-  onEntityType( type );
+  myEntityTypeGrp->setButton(type);
+  onEntityType(type);
 }
 
 //=======================================================================
@@ -736,18 +740,18 @@ void SMESHGUI_FilterTable::SetType( const int type )
 //=======================================================================
 void SMESHGUI_FilterTable::RestorePreviousEntityType()
 {
-  SetType( myEntityType );
+  SetType(myEntityType);
 }
 
 //=======================================================================
 // name    : SMESHGUI_FilterTable::GetCriterionType
-// Purpose : Get type of criterion from specified row ( corresponding enums in h-file )
+// Purpose : Get type of criterion from specified row (corresponding enums in h-file)
 //=======================================================================
-int SMESHGUI_FilterTable::GetCriterionType( const int theRow, const int theType ) const
+int SMESHGUI_FilterTable::GetCriterionType (const int theRow, const int theType) const
 {
   int aType = theType == -1 ? GetType() : theType;
   Table* aTable = myTables[ aType ];
-  ComboItem* anItem = (ComboItem*)aTable->item( theRow, 0 );
+  ComboItem* anItem = (ComboItem*)aTable->item(theRow, 0);
   return anItem != 0 ? anItem->GetValue() : FT_Undefined;
 }
 
@@ -755,90 +759,90 @@ int SMESHGUI_FilterTable::GetCriterionType( const int theRow, const int theType
 // name    : SMESHGUI_FilterTable::GetCriterion
 // Purpose : Get parameters of criterion from specified row
 //=======================================================================
-void SMESHGUI_FilterTable::GetCriterionconst int                 theRow,
+void SMESHGUI_FilterTable::GetCriterion (const int                 theRow,
                                          SMESH::Filter::Criterion& theCriterion,
-                                         const int                 theEntityType ) const
+                                         const int                 theEntityType) const
 {
   int aType = theEntityType == -1 ? GetType() : theEntityType;
   Table* aTable = myTables[ aType ];
-  
-  theCriterion.Type = ( (ComboItem*)aTable->item( theRow, 0 ) )->GetValue();
-  theCriterion.UnaryOp = ( (QCheckTableItem*)aTable->item( theRow, 3 ) )->isChecked() ? FT_LogicalNOT : FT_Undefined;
+
+  theCriterion.Type = ((ComboItem*)aTable->item(theRow, 0))->GetValue();
+  theCriterion.UnaryOp = ((QCheckTableItem*)aTable->item(theRow, 3))->isChecked() ? FT_LogicalNOT : FT_Undefined;
   theCriterion.BinaryOp = theRow != aTable->numRows() - 1 ?
-    ( (ComboItem*)aTable->item( theRow, 4 ) )->GetValue() : FT_Undefined;
+    ((ComboItem*)aTable->item(theRow, 4))->GetValue() : FT_Undefined;
   theCriterion.TypeOfElement = (ElementType)aType;
 
-  int aCriterionType = GetCriterionType( theRow, aType );
+  int aCriterionType = GetCriterionType(theRow, aType);
 
-  if ( aCriterionType != FT_RangeOfIds &&
+  if (aCriterionType != FT_RangeOfIds &&
        aCriterionType != FT_BelongToGeom &&
        aCriterionType != FT_BelongToPlane &&
        aCriterionType != FT_BelongToCylinder &&
        aCriterionType != FT_LyingOnGeom)
   {
-    theCriterion.Compare = ( (ComboItem*)aTable->item( theRow, 1 ) )->GetValue();
-    theCriterion.Threshold = aTable->item( theRow, 2 )->text().toDouble();
+    theCriterion.Compare = ((ComboItem*)aTable->item(theRow, 1))->GetValue();
+    theCriterion.Threshold = aTable->item(theRow, 2)->text().toDouble();
   }
   else
-    theCriterion.ThresholdStr = aTable->text( theRow, 2 ).latin1();
+    theCriterion.ThresholdStr = aTable->text(theRow, 2).latin1();
 
-  QTableItem* anItem = aTable->item( theRow, 0 );
-  if ( myAddWidgets.contains( anItem ) )
-    theCriterion.Tolerance = myAddWidgets[ anItem ]->GetDouble( AdditionalWidget::Tolerance );
+  QTableItem* anItem = aTable->item(theRow, 0);
+  if (myAddWidgets.contains(anItem))
+    theCriterion.Tolerance = myAddWidgets[ anItem ]->GetDouble(AdditionalWidget::Tolerance);
 }
 
 //=======================================================================
 // name    : SMESHGUI_FilterTable::SetCriterion
 // Purpose : Set parameters of criterion of specified row
 //=======================================================================
-void SMESHGUI_FilterTable::SetCriterionconst int                       theRow,
+void SMESHGUI_FilterTable::SetCriterion (const int                       theRow,
                                          const SMESH::Filter::Criterion& theCriterion,
-                                         const int                       theEntityType )
+                                         const int                       theEntityType)
 {
   int aType = theEntityType == -1 ? GetType() : theEntityType;
 
   Table* aTable = myTables[ aType ];
 
-  if ( theRow > aTable->numRows() - 1 )
+  if (theRow > aTable->numRows() - 1)
     return;
 
-  ( (ComboItem*)aTable->item( theRow, 0 ) )->SetValue( theCriterion.Type );
-  onCriterionChanged( theRow, 0, aType );
-  ( (ComboItem*)aTable->item( theRow, 1 ) )->SetValue( theCriterion.Compare );
-  ( (QCheckTableItem*)aTable->item( theRow, 3 ) )->setChecked( theCriterion.UnaryOp == FT_LogicalNOT );
+  ((ComboItem*)aTable->item(theRow, 0))->SetValue(theCriterion.Type);
+  onCriterionChanged(theRow, 0, aType);
+  ((ComboItem*)aTable->item(theRow, 1))->SetValue(theCriterion.Compare);
+  ((QCheckTableItem*)aTable->item(theRow, 3))->setChecked(theCriterion.UnaryOp == FT_LogicalNOT);
 
-  if ( theCriterion.BinaryOp != FT_Undefined )
+  if (theCriterion.BinaryOp != FT_Undefined)
   {
-    if ( !aTable->IsEditable( theRow, 4 ) )
-      aTable->setItem( theRow, 4, getBinaryItem( aTable ) );
-    ( (ComboItem*)aTable->item( theRow, 4 ) )->SetValue( theCriterion.BinaryOp );
+    if (!aTable->IsEditable(theRow, 4))
+      aTable->setItem(theRow, 4, getBinaryItem(aTable));
+    ((ComboItem*)aTable->item(theRow, 4))->SetValue(theCriterion.BinaryOp);
   }
   else
-    aTable->SetEditable( false, theRow, 4 );
+    aTable->SetEditable(false, theRow, 4);
 
-  if ( theCriterion.Type != FT_RangeOfIds &&
+  if (theCriterion.Type != FT_RangeOfIds &&
        theCriterion.Type != FT_BelongToGeom &&
        theCriterion.Type != FT_BelongToPlane &&
        theCriterion.Type != FT_BelongToCylinder &&
        theCriterion.Type != FT_LyingOnGeom)
-    aTable->setText( theRow, 2, QString( "%1" ).arg( theCriterion.Threshold, 0, 'g', 15 ) );
+    aTable->setText(theRow, 2, QString("%1").arg(theCriterion.Threshold, 0, 'g', 15));
   else
-    aTable->setText( theRow, 2, QString( theCriterion.ThresholdStr ) );
+    aTable->setText(theRow, 2, QString(theCriterion.ThresholdStr));
 
-  if ( theCriterion.Compare == FT_EqualTo ||
+  if (theCriterion.Compare == FT_EqualTo ||
        theCriterion.Type    == FT_BelongToPlane ||
-       theCriterion.Type    == FT_BelongToCylinder )
+       theCriterion.Type    == FT_BelongToCylinder)
   {
-    QTableItem* anItem = aTable->item( theRow, 0 );
-    if ( !myAddWidgets.contains( anItem ) )
+    QTableItem* anItem = aTable->item(theRow, 0);
+    if (!myAddWidgets.contains(anItem))
     {
-      myAddWidgets[ anItem ] = new AdditionalWidget( myWgStack );
-      myWgStack->addWidget( myAddWidgets[ anItem ] );
+      myAddWidgets[ anItem ] = new AdditionalWidget(myWgStack);
+      myWgStack->addWidget(myAddWidgets[ anItem ]);
     }
-    myAddWidgets[ anItem ]->SetDouble( AdditionalWidget::Tolerance, theCriterion.Tolerance );
+    myAddWidgets[ anItem ]->SetDouble(AdditionalWidget::Tolerance, theCriterion.Tolerance);
   }
 
-  emit CretarionChanged( theRow, aType );
+  emit CretarionChanged(theRow, aType);
 
 }
 
@@ -851,8 +855,8 @@ void SMESHGUI_FilterTable::Update()
   Table* aTable = myTables[ GetType() ];
   int aCurrRow = aTable->currentRow();
   int numRows = aTable->numRows();
-  if ( ( aCurrRow < 0 || aCurrRow >= numRows ) && numRows > 0 )
-    aTable->setCurrentCell( 0, 0 );
+  if ((aCurrRow < 0 || aCurrRow >= numRows) && numRows > 0)
+    aTable->setCurrentCell(0, 0);
   updateAdditionalWidget();
 }
 
@@ -860,20 +864,20 @@ void SMESHGUI_FilterTable::Update()
 // name    : SMESHGUI_FilterTable::AddCriterion
 // Purpose : Add criterion with parameters
 //=======================================================================
-void SMESHGUI_FilterTable::AddCriterionconst SMESH::Filter::Criterion& theCriterion,
-                                         const int                       theEntityType )
+void SMESHGUI_FilterTable::AddCriterion (const SMESH::Filter::Criterion& theCriterion,
+                                         const int                       theEntityType)
 {
   int aType = theEntityType == -1 ? GetType() : theEntityType;
   Table* aTable = myTables[ aType ];
-  addRow( aTable, aType );
-  SetCriterion( aTable->numRows() - 1, theCriterion );
+  addRow(aTable, aType);
+  SetCriterion(aTable->numRows() - 1, theCriterion);
 }
 
 //=======================================================================
 // name    : SMESHGUI_FilterTable::NumRows
 // Purpose : Get number of criterions of current type
 //=======================================================================
-int SMESHGUI_FilterTable::NumRows( const int theEntityType ) const
+int SMESHGUI_FilterTable::NumRows (const int theEntityType) const
 {
   return myTables[ theEntityType == -1 ? GetType() : theEntityType ]->numRows();
 }
@@ -882,18 +886,18 @@ int SMESHGUI_FilterTable::NumRows( const int theEntityType ) const
 // name    : SMESHGUI_FilterTable::Clear
 // Purpose : Clear current table
 //=======================================================================
-void SMESHGUI_FilterTable::Clear( const int theType )
+void SMESHGUI_FilterTable::Clear (const int theType)
 {
   int aType = theType == -1 ? GetType() : theType;
   QTable* aTable = myTables[ aType ];
 
-  if ( aTable->numRows() == 0 )
+  if (aTable->numRows() == 0)
     return;
 
-  while ( aTable->numRows() > 0 )
+  while (aTable->numRows() > 0)
   {
-    removeAdditionalWidget( aTable, 0 );
-    aTable->removeRow( 0 );
+    removeAdditionalWidget(aTable, 0);
+    aTable->removeRow(0);
   }
 
   updateBtnState();
@@ -907,7 +911,7 @@ void SMESHGUI_FilterTable::Clear( const int theType )
 void SMESHGUI_FilterTable::onAddBtn()
 {
   int aType = GetType();
-  addRow( myTables[ aType ], aType );
+  addRow(myTables[ aType ], aType);
 
   Update();
 }
@@ -919,7 +923,7 @@ void SMESHGUI_FilterTable::onAddBtn()
 //=======================================================================
 void SMESHGUI_FilterTable::onInsertBtn()
 {
-  addRow( myTables[ GetType() ], GetType(), false );
+  addRow(myTables[ GetType() ], GetType(), false);
 }
 
 //=======================================================================
@@ -931,25 +935,25 @@ void SMESHGUI_FilterTable::onRemoveBtn()
 {
   Table* aTable = myTables[ GetType() ];
 
-  if ( aTable->numRows() == 0 )
+  if (aTable->numRows() == 0)
     return;
 
   QMemArray<int> aRows;
-  for ( int i = 0, n = aTable->numRows(); i < n; i++ )
+  for (int i = 0, n = aTable->numRows(); i < n; i++)
   {
-    if ( aTable->isRowSelected( i ) )
+    if (aTable->isRowSelected(i))
     {
-      aRows.resize( aRows.size() + 1 );
+      aRows.resize(aRows.size() + 1);
       aRows[ aRows.size() - 1 ] = i;
-      removeAdditionalWidget( aTable, i );
+      removeAdditionalWidget(aTable, i);
     }
   }
 
-  aTable->removeRows( aRows );
+  aTable->removeRows(aRows);
 
   // remove control of binary logical operation from last row
-  if ( aTable->numRows() > 0 )
-    aTable->SetEditable( false, aTable->numRows() - 1, 4 );
+  if (aTable->numRows() > 0)
+    aTable->SetEditable(false, aTable->numRows() - 1, 4);
 
   updateBtnState();
 }
@@ -962,27 +966,27 @@ void SMESHGUI_FilterTable::updateAdditionalWidget()
 {
   Table* aTable = myTables[ GetType() ];
   int aRow = aTable->currentRow();
-  if ( aRow < 0 || aRow >= aTable->numRows() )
+  if (aRow < 0 || aRow >= aTable->numRows())
   {
-    myWgStack->setEnabled( false );
+    myWgStack->setEnabled(false);
     return;
   }
 
-  ComboItem* anItem = ( (ComboItem*)aTable->item( aRow, 0 ) );
-  bool toEnable = ( (ComboItem*)aTable->item( aRow, 1 ) )->GetValue() == FT_EqualTo &&
-                  GetCriterionType( aRow ) != FT_BelongToGeom &&
-                  GetCriterionType( aRow ) != FT_LyingOnGeom &&
-                  GetCriterionType( aRow ) != FT_RangeOfIds &&
-                  GetCriterionType( aRow ) != FT_FreeEdges && 
-                 GetCriterionType( aRow ) != FT_BadOrientedVolume;
-  if ( !myAddWidgets.contains( anItem ) )
+  ComboItem* anItem = ((ComboItem*)aTable->item(aRow, 0));
+  bool toEnable = ((ComboItem*)aTable->item(aRow, 1))->GetValue() == FT_EqualTo &&
+                  GetCriterionType(aRow) != FT_BelongToGeom &&
+                  GetCriterionType(aRow) != FT_LyingOnGeom &&
+                  GetCriterionType(aRow) != FT_RangeOfIds &&
+                  GetCriterionType(aRow) != FT_FreeEdges &&
+                 GetCriterionType(aRow) != FT_BadOrientedVolume;
+  if (!myAddWidgets.contains(anItem))
   {
-    myAddWidgets[ anItem ] = new AdditionalWidget( myWgStack );
-    myWgStack->addWidget( myAddWidgets[ anItem ] );
+    myAddWidgets[ anItem ] = new AdditionalWidget(myWgStack);
+    myWgStack->addWidget(myAddWidgets[ anItem ]);
   }
 
-  myWgStack->raiseWidget( myWgStack->id( myAddWidgets[ anItem ] ) );
-  myWgStack->setEnabled( toEnable );
+  myWgStack->raiseWidget(myWgStack->id(myAddWidgets[ anItem ]));
+  myWgStack->setEnabled(toEnable);
 }
 
 //=======================================================================
@@ -990,15 +994,15 @@ void SMESHGUI_FilterTable::updateAdditionalWidget()
 // Purpose : Remove widgets containing additional parameters from widget
 //           stack and internal map
 //=======================================================================
-void SMESHGUI_FilterTable::removeAdditionalWidget( QTable* theTable, const int theRow )
+void SMESHGUI_FilterTable::removeAdditionalWidget (QTable* theTable, const int theRow)
 {
-  QTableItem* anItem = theTable->item( theRow, 0 );
-  if ( myAddWidgets.contains( anItem ) )
+  QTableItem* anItem = theTable->item(theRow, 0);
+  if (myAddWidgets.contains(anItem))
   {
-    myWgStack->removeWidget( myAddWidgets[ anItem ] );
-    myAddWidgets[ anItem ]->reparent( 0, QPoint() );
+    myWgStack->removeWidget(myAddWidgets[ anItem ]);
+    myAddWidgets[ anItem ]->reparent(0, QPoint());
     delete myAddWidgets[ anItem ];
-    myAddWidgets.remove( anItem );
+    myAddWidgets.remove(anItem);
   }
 }
 
@@ -1011,13 +1015,13 @@ void SMESHGUI_FilterTable::onClearBtn()
 {
   QTable* aTable = myTables[ GetType() ];
 
-  if ( aTable->numRows() == 0 )
+  if (aTable->numRows() == 0)
     return;
 
-  while ( aTable->numRows() > 0 )
+  while (aTable->numRows() > 0)
   {
-    removeAdditionalWidget( aTable, 0 );
-    aTable->removeRow( 0 );
+    removeAdditionalWidget(aTable, 0);
+    aTable->removeRow(0);
   }
 
   updateBtnState();
@@ -1027,63 +1031,63 @@ void SMESHGUI_FilterTable::onClearBtn()
 // name    : SMESHGUI_FilterTable::onCurrentChanged()
 // Purpose : SLOT. Called when current cell changed
 //=======================================================================
-void SMESHGUI_FilterTable::onCurrentChanged( int theRow, int theCol )
+void SMESHGUI_FilterTable::onCurrentChanged (int theRow, int theCol)
 {
   updateAdditionalWidget();
-  emit CurrentChanged( theRow, theCol );
+  emit CurrentChanged(theRow, theCol);
 }
 
 //=======================================================================
 // name    : SMESHGUI_FilterTable::onCriterionChanged()
 // Purpose : Provides reaction on change of criterion
 //=======================================================================
-void SMESHGUI_FilterTable::onCriterionChanged( const int row, const int col, const int entityType )
+void SMESHGUI_FilterTable::onCriterionChanged (const int row, const int col, const int entityType)
 {
   int aType = entityType == -1 ? GetType() : entityType;
   Table* aTable = myTables[ aType ];
-  ComboItem* aCompareItem = (ComboItem*)aTable->item( row, 1 );
+  ComboItem* aCompareItem = (ComboItem*)aTable->item(row, 1);
 
-  int aCriterionType = GetCriterionType( row );
+  int aCriterionType = GetCriterionType(row);
 
-  if ( aType == SMESH::EDGE && aCriterionType == SMESH::FT_FreeBorders ||
-       aType == SMESH::FACE && aCriterionType == SMESH::FT_FreeEdges || 
-       aType == SMESH::VOLUME && aCriterionType == SMESH::FT_BadOrientedVolume )
+  if (aType == SMESH::EDGE && aCriterionType == SMESH::FT_FreeBorders ||
+       aType == SMESH::FACE && aCriterionType == SMESH::FT_FreeEdges ||
+       aType == SMESH::VOLUME && aCriterionType == SMESH::FT_BadOrientedVolume)
   {
-    if ( aCompareItem->count() > 0 )
-      aCompareItem->setStringList( QStringList() );
-    aTable->SetEditable( false, row, 2 );
+    if (aCompareItem->count() > 0)
+      aCompareItem->setStringList(QStringList());
+    aTable->SetEditable(false, row, 2);
   }
-  else if ( aCriterionType == SMESH::FT_RangeOfIds ||
+  else if (aCriterionType == SMESH::FT_RangeOfIds ||
             aCriterionType == SMESH::FT_BelongToGeom ||
             aCriterionType == SMESH::FT_BelongToPlane ||
             aCriterionType == SMESH::FT_BelongToCylinder ||
            aCriterionType == SMESH::FT_LyingOnGeom)
   {
     QMap<int, QString> aMap;
-    aMap[ FT_EqualTo ] = tr( "EQUAL_TO" );
-    aCompareItem->setStringList( aMap );
-    if ( !aTable->IsEditable( row, 2 ) )
-      aTable->SetEditable( true, row, 2 );
+    aMap[ FT_EqualTo ] = tr("EQUAL_TO");
+    aCompareItem->setStringList(aMap);
+    if (!aTable->IsEditable(row, 2))
+      aTable->SetEditable(true, row, 2);
   }
   else
   {
-    if ( aCompareItem->count() != 3 )
+    if (aCompareItem->count() != 3)
     {
-      aCompareItem->setStringList( QStringList() );
-      aCompareItem->setStringList( getCompare() );
+      aCompareItem->setStringList(QStringList());
+      aCompareItem->setStringList(getCompare());
     }
 
-    QString aText = aTable->text( row, 2 );
+    QString aText = aTable->text(row, 2);
     bool isOk = false;
-    aText.toDouble( &isOk );
-    aTable->setText( row, 2, isOk ? aText : QString("") );
-    if ( !aTable->IsEditable( row, 2 ) )
-      aTable->SetEditable( true, row, 2 );
+    aText.toDouble(&isOk);
+    aTable->setText(row, 2, isOk ? aText : QString(""));
+    if (!aTable->IsEditable(row, 2))
+      aTable->SetEditable(true, row, 2);
   }
 
   updateAdditionalWidget();
-  
-  emit CretarionChanged( row, entityType );
+
+  emit CretarionChanged(row, entityType);
 }
 
 //=======================================================================
@@ -1091,9 +1095,9 @@ void SMESHGUI_FilterTable::onCriterionChanged( const int row, const int col, con
 // Purpose : SLOT. Called then contents of table changed
 //           Provides reaction on change of criterion
 //=======================================================================
-void SMESHGUI_FilterTable::onCriterionChanged( int row, int col )
+void SMESHGUI_FilterTable::onCriterionChanged (int row, int col)
 {
-  onCriterionChanged( row, col, -1 );
+  onCriterionChanged(row, col, -1);
 }
 
 //=======================================================================
@@ -1103,8 +1107,8 @@ void SMESHGUI_FilterTable::onCriterionChanged( int row, int col )
 int SMESHGUI_FilterTable::getFirstSelectedRow() const
 {
   QTable* aTable = myTables[ GetType() ];
-  for ( int i = 0, n = aTable->numRows(); i < n; i++ )
-    if ( aTable->isRowSelected( i ) )
+  for (int i = 0, n = aTable->numRows(); i < n; i++)
+    if (aTable->isRowSelected(i))
       return i;
 
   int aRow = aTable->currentRow();
@@ -1115,60 +1119,60 @@ int SMESHGUI_FilterTable::getFirstSelectedRow() const
 // name    : SMESHGUI_FilterTable::addRow
 // Purpose : Add row at the end of table
 //=======================================================================
-void SMESHGUI_FilterTable::addRow( Table* theTable, const int theType, const bool toTheEnd )
+void SMESHGUI_FilterTable::addRow (Table* theTable, const int theType, const bool toTheEnd)
 {
   int aCurrRow = 0;
   int aSelectedRow = getFirstSelectedRow();
   int aCurrCol = theTable->currentColumn();
 
-  if ( toTheEnd || aSelectedRow == -1 )
+  if (toTheEnd || aSelectedRow == -1)
   {
-    theTable->insertRows( theTable->numRows() );
+    theTable->insertRows(theTable->numRows());
     aCurrRow = theTable->numRows() - 1;
   }
   else
   {
-    theTable->insertRows( aSelectedRow );
+    theTable->insertRows(aSelectedRow);
     aCurrRow = aSelectedRow;
   }
 
   // Criteria
-  theTable->setItem( aCurrRow, 0, getCriterionItem( theTable, theType ) );
+  theTable->setItem(aCurrRow, 0, getCriterionItem(theTable, theType));
 
   // Compare
-  theTable->setItem( aCurrRow, 1, getCompareItem( theTable ) );
+  theTable->setItem(aCurrRow, 1, getCompareItem(theTable));
 
   // Threshold
-  //theTable->setItem( aCurrRow, 2, new QTableItem( theTable ) );  
+  //theTable->setItem(aCurrRow, 2, new QTableItem(theTable));
 
   //Logical operation NOT
-  theTable->setItem( aCurrRow, 3, getUnaryItem( theTable ) );
-  
+  theTable->setItem(aCurrRow, 3, getUnaryItem(theTable));
+
   // Logical binary operation for previous value
   int anAddBinOpStr = -1;
-  if ( aCurrRow == theTable->numRows() - 1 )
+  if (aCurrRow == theTable->numRows() - 1)
     anAddBinOpStr = aCurrRow - 1;
-  else if ( aCurrRow >= 0  )
+  else if (aCurrRow >= 0 )
     anAddBinOpStr = aCurrRow;
-  
-  if ( theTable->item( aCurrRow, 4 ) == 0 ||
-       theTable->item( aCurrRow, 4 )->rtti() != 1 )
+
+  if (theTable->item(aCurrRow, 4) == 0 ||
+       theTable->item(aCurrRow, 4)->rtti() != 1)
   {
-    
 
-    if ( anAddBinOpStr >= 0 &&
-         ( theTable->item( anAddBinOpStr, 4 ) == 0 ||
-           theTable->item( anAddBinOpStr, 4 )->rtti() != 1 ) )
-      theTable->setItem( anAddBinOpStr, 4, getBinaryItem( theTable ) );
+
+    if (anAddBinOpStr >= 0 &&
+         (theTable->item(anAddBinOpStr, 4) == 0 ||
+           theTable->item(anAddBinOpStr, 4)->rtti() != 1))
+      theTable->setItem(anAddBinOpStr, 4, getBinaryItem(theTable));
   }
-  
-  theTable->SetEditable( false, theTable->numRows() - 1, 4 );
 
-  if ( aCurrRow >=0 && aCurrRow < theTable->numRows() &&
-       aCurrCol >=0 && aCurrCol < theTable->numRows() )
-  theTable->setCurrentCell( aCurrRow, aCurrCol );
+  theTable->SetEditable(false, theTable->numRows() - 1, 4);
+
+  if (aCurrRow >=0 && aCurrRow < theTable->numRows() &&
+       aCurrCol >=0 && aCurrCol < theTable->numRows())
+  theTable->setCurrentCell(aCurrRow, aCurrCol);
 
-  onCriterionChanged( aCurrRow, 0 );
+  onCriterionChanged(aCurrRow, 0);
 
   updateBtnState();
 }
@@ -1177,43 +1181,43 @@ void SMESHGUI_FilterTable::addRow( Table* theTable, const int theType, const boo
 // name    : SMESHGUI_FilterTable::getCriterionItem
 // Purpose : Get combo table item for criteria of specified type
 //=======================================================================
-QTableItem* SMESHGUI_FilterTable::getCriterionItem( QTable* theParent , const int theType )
+QTableItem* SMESHGUI_FilterTable::getCriterionItem (QTable* theParent , const int theType)
 {
-  return new ComboItem( theParent, getCriteria( theType ) );
+  return new ComboItem(theParent, getCriteria(theType));
 }
 
 //=======================================================================
 // name    : SMESHGUI_FilterTable::getCompareItem
 // Purpose : Get combo table item for operation of comparision
 //=======================================================================
-QTableItem* SMESHGUI_FilterTable::getCompareItem( QTable* theParent )
+QTableItem* SMESHGUI_FilterTable::getCompareItem (QTable* theParent)
 {
-  return new ComboItem( theParent, getCompare() );
+  return new ComboItem(theParent, getCompare());
 }
 
 //=======================================================================
 // name    : SMESHGUI_FilterTable::getBinaryItem
 // Purpose :
 //=======================================================================
-QTableItem* SMESHGUI_FilterTable::getBinaryItem( QTable* theParent )
+QTableItem* SMESHGUI_FilterTable::getBinaryItem (QTable* theParent)
 {
   static QMap<int, QString> aMap;
-  if ( aMap.isEmpty() )
+  if (aMap.isEmpty())
   {
-    aMap[ SMESH::FT_LogicalAND ] = tr( "AND" );
-    aMap[ SMESH::FT_LogicalOR  ] = tr( "OR" );
+    aMap[ SMESH::FT_LogicalAND ] = tr("AND");
+    aMap[ SMESH::FT_LogicalOR  ] = tr("OR");
   }
 
-  return new ComboItem( theParent, aMap );
+  return new ComboItem(theParent, aMap);
 }
 
 //=======================================================================
 // name    : SMESHGUI_FilterTable::getUnaryItem
 // Purpose : Get check table item
 //=======================================================================
-QTableItem* SMESHGUI_FilterTable::getUnaryItem( QTable* theParent )
+QTableItem* SMESHGUI_FilterTable::getUnaryItem (QTable* theParent)
 {
-  return new QCheckTableItem( theParent, tr( "NOT" ) );
+  return new QCheckTableItem(theParent, tr("NOT"));
 }
 
 //=======================================================================
@@ -1223,12 +1227,12 @@ QTableItem* SMESHGUI_FilterTable::getUnaryItem( QTable* theParent )
 const QMap<int, QString>& SMESHGUI_FilterTable::getSupportedTypes() const
 {
   static QMap<int, QString> aTypes;
-  if ( aTypes.isEmpty() )
+  if (aTypes.isEmpty())
   {
-    aTypes[ SMESH::NODE   ] = tr( "NODES" );
-    aTypes[ SMESH::EDGE   ] = tr( "EDGES" );
-    aTypes[ SMESH::FACE   ] = tr( "FACES" );
-    aTypes[ SMESH::VOLUME ] = tr( "VOLUMES" );
+    aTypes[ SMESH::NODE   ] = tr("NODES");
+    aTypes[ SMESH::EDGE   ] = tr("EDGES");
+    aTypes[ SMESH::FACE   ] = tr("FACES");
+    aTypes[ SMESH::VOLUME ] = tr("VOLUMES");
   }
 
   return aTypes;
@@ -1238,69 +1242,69 @@ const QMap<int, QString>& SMESHGUI_FilterTable::getSupportedTypes() const
 // name    : SMESHGUI_FilterTable::getCriteria
 // Purpose : Get criteria for specified type
 //=======================================================================
-const QMap<int, QString>& SMESHGUI_FilterTable::getCriteria( const int theType ) const
+const QMap<int, QString>& SMESHGUI_FilterTable::getCriteria (const int theType) const
 {
-  if ( theType == SMESH::NODE )
+  if (theType == SMESH::NODE)
   {
     static QMap<int, QString> aCriteria;
-    if ( aCriteria.isEmpty() )
+    if (aCriteria.isEmpty())
     {
-      aCriteria[ SMESH::FT_RangeOfIds       ] = tr( "RANGE_OF_IDS" );
-      aCriteria[ SMESH::FT_BelongToGeom     ] = tr( "BELONG_TO_GEOM" );
-      aCriteria[ SMESH::FT_BelongToPlane    ] = tr( "BELONG_TO_PLANE" );
-      aCriteria[ SMESH::FT_BelongToCylinder ] = tr( "BELONG_TO_CYLINDER" );
-      aCriteria[ SMESH::FT_LyingOnGeom      ] = tr( "LYING_ON_GEOM" );
+      aCriteria[ SMESH::FT_RangeOfIds       ] = tr("RANGE_OF_IDS");
+      aCriteria[ SMESH::FT_BelongToGeom     ] = tr("BELONG_TO_GEOM");
+      aCriteria[ SMESH::FT_BelongToPlane    ] = tr("BELONG_TO_PLANE");
+      aCriteria[ SMESH::FT_BelongToCylinder ] = tr("BELONG_TO_CYLINDER");
+      aCriteria[ SMESH::FT_LyingOnGeom      ] = tr("LYING_ON_GEOM");
     }
     return aCriteria;
   }
-  else if ( theType == SMESH::EDGE )
+  else if (theType == SMESH::EDGE)
   {
     static QMap<int, QString> aCriteria;
-    if ( aCriteria.isEmpty() )
+    if (aCriteria.isEmpty())
     {
-      aCriteria[ SMESH::FT_FreeBorders      ] = tr( "FREE_BORDERS" );
-      aCriteria[ SMESH::FT_MultiConnection  ] = tr( "MULTI_BORDERS" );
-      aCriteria[ SMESH::FT_Length           ] = tr( "LENGTH" );
-      aCriteria[ SMESH::FT_RangeOfIds       ] = tr( "RANGE_OF_IDS" );
-      aCriteria[ SMESH::FT_BelongToGeom     ] = tr( "BELONG_TO_GEOM" );
-      aCriteria[ SMESH::FT_BelongToPlane    ] = tr( "BELONG_TO_PLANE" );
-      aCriteria[ SMESH::FT_BelongToCylinder ] = tr( "BELONG_TO_CYLINDER" );
-      aCriteria[ SMESH::FT_LyingOnGeom      ] = tr( "LYING_ON_GEOM" );
+      aCriteria[ SMESH::FT_FreeBorders      ] = tr("FREE_BORDERS");
+      aCriteria[ SMESH::FT_MultiConnection  ] = tr("MULTI_BORDERS");
+      aCriteria[ SMESH::FT_Length           ] = tr("LENGTH");
+      aCriteria[ SMESH::FT_RangeOfIds       ] = tr("RANGE_OF_IDS");
+      aCriteria[ SMESH::FT_BelongToGeom     ] = tr("BELONG_TO_GEOM");
+      aCriteria[ SMESH::FT_BelongToPlane    ] = tr("BELONG_TO_PLANE");
+      aCriteria[ SMESH::FT_BelongToCylinder ] = tr("BELONG_TO_CYLINDER");
+      aCriteria[ SMESH::FT_LyingOnGeom      ] = tr("LYING_ON_GEOM");
     }
     return aCriteria;
   }
-  else if ( theType == SMESH::FACE )
+  else if (theType == SMESH::FACE)
   {
     static QMap<int, QString> aCriteria;
-    if ( aCriteria.isEmpty() )
+    if (aCriteria.isEmpty())
     {
-      aCriteria[ SMESH::FT_AspectRatio      ] = tr( "ASPECT_RATIO" );
-      aCriteria[ SMESH::FT_Warping          ] = tr( "WARPING" );
-      aCriteria[ SMESH::FT_MinimumAngle     ] = tr( "MINIMUM_ANGLE" );
-      aCriteria[ SMESH::FT_Taper            ] = tr( "TAPER" );
-      aCriteria[ SMESH::FT_Skew             ] = tr( "SKEW" );
-      aCriteria[ SMESH::FT_Area             ] = tr( "AREA" );
-      aCriteria[ SMESH::FT_FreeEdges        ] = tr( "FREE_EDGES" );
-      aCriteria[ SMESH::FT_RangeOfIds       ] = tr( "RANGE_OF_IDS" );
-      aCriteria[ SMESH::FT_BelongToGeom     ] = tr( "BELONG_TO_GEOM" );
-      aCriteria[ SMESH::FT_BelongToPlane    ] = tr( "BELONG_TO_PLANE" );
-      aCriteria[ SMESH::FT_BelongToCylinder ] = tr( "BELONG_TO_CYLINDER" );
-      aCriteria[ SMESH::FT_LyingOnGeom      ] = tr( "LYING_ON_GEOM" );
-      aCriteria[ SMESH::FT_Length2D         ] = tr( "LENGTH2D" );
-      aCriteria[ SMESH::FT_MultiConnection2D] = tr( "MULTI2D_BORDERS" );
+      aCriteria[ SMESH::FT_AspectRatio      ] = tr("ASPECT_RATIO");
+      aCriteria[ SMESH::FT_Warping          ] = tr("WARPING");
+      aCriteria[ SMESH::FT_MinimumAngle     ] = tr("MINIMUM_ANGLE");
+      aCriteria[ SMESH::FT_Taper            ] = tr("TAPER");
+      aCriteria[ SMESH::FT_Skew             ] = tr("SKEW");
+      aCriteria[ SMESH::FT_Area             ] = tr("AREA");
+      aCriteria[ SMESH::FT_FreeEdges        ] = tr("FREE_EDGES");
+      aCriteria[ SMESH::FT_RangeOfIds       ] = tr("RANGE_OF_IDS");
+      aCriteria[ SMESH::FT_BelongToGeom     ] = tr("BELONG_TO_GEOM");
+      aCriteria[ SMESH::FT_BelongToPlane    ] = tr("BELONG_TO_PLANE");
+      aCriteria[ SMESH::FT_BelongToCylinder ] = tr("BELONG_TO_CYLINDER");
+      aCriteria[ SMESH::FT_LyingOnGeom      ] = tr("LYING_ON_GEOM");
+      aCriteria[ SMESH::FT_Length2D         ] = tr("LENGTH2D");
+      aCriteria[ SMESH::FT_MultiConnection2D] = tr("MULTI2D_BORDERS");
     }
     return aCriteria;
   }
-  else if ( theType == SMESH::VOLUME )
+  else if (theType == SMESH::VOLUME)
   {
     static QMap<int, QString> aCriteria;
-    if ( aCriteria.isEmpty() )
+    if (aCriteria.isEmpty())
     {
-      aCriteria[ SMESH::FT_AspectRatio3D] = tr( "ASPECT_RATIO_3D" );
-      aCriteria[ SMESH::FT_RangeOfIds   ] = tr( "RANGE_OF_IDS" );
-      aCriteria[ SMESH::FT_BelongToGeom ] = tr( "BELONG_TO_GEOM" );
-      aCriteria[ SMESH::FT_LyingOnGeom ] = tr( "LYING_ON_GEOM" );
-      aCriteria[ SMESH::FT_BadOrientedVolume ] = tr( "BAD_ORIENTED_VOLUME" );
+      aCriteria[ SMESH::FT_AspectRatio3D] = tr("ASPECT_RATIO_3D");
+      aCriteria[ SMESH::FT_RangeOfIds   ] = tr("RANGE_OF_IDS");
+      aCriteria[ SMESH::FT_BelongToGeom ] = tr("BELONG_TO_GEOM");
+      aCriteria[ SMESH::FT_LyingOnGeom ] = tr("LYING_ON_GEOM");
+      aCriteria[ SMESH::FT_BadOrientedVolume ] = tr("BAD_ORIENTED_VOLUME");
     }
     return aCriteria;
   }
@@ -1320,11 +1324,11 @@ const QMap<int, QString>& SMESHGUI_FilterTable::getCompare() const
 {
   static QMap<int, QString> aMap;
 
-  if ( aMap.isEmpty() )
+  if (aMap.isEmpty())
   {
-    aMap[ SMESH::FT_LessThan ] = tr( "LESS_THAN" );
-    aMap[ SMESH::FT_MoreThan ] = tr( "MORE_THAN" );
-    aMap[ SMESH::FT_EqualTo  ] = tr( "EQUAL_TO"  );
+    aMap[ SMESH::FT_LessThan ] = tr("LESS_THAN");
+    aMap[ SMESH::FT_MoreThan ] = tr("MORE_THAN");
+    aMap[ SMESH::FT_EqualTo  ] = tr("EQUAL_TO" );
   }
 
   return aMap;
@@ -1334,57 +1338,57 @@ const QMap<int, QString>& SMESHGUI_FilterTable::getCompare() const
 // name    : SMESHGUI_FilterTable::createTable
 // Purpose : Create table
 //=======================================================================
-SMESHGUI_FilterTable::Table* SMESHGUI_FilterTable::createTableQWidget*  theParent,
-                                                                const int theType )
+SMESHGUI_FilterTable::Table* SMESHGUI_FilterTable::createTable (QWidget*  theParent,
+                                                                const int theType)
 {
   // create table
-  Table* aTable= new Table( 0, 5, theParent );
+  Table* aTable= new Table(0, 5, theParent);
 
   QHeader* aHeaders = aTable->horizontalHeader();
 
-  QFontMetrics aMetrics( aHeaders->font() );
+  QFontMetrics aMetrics(aHeaders->font());
 
   // append spaces to the header of criteria in order to
   // provide visibility of criterion inside comboboxes
   static int aMaxLenCr = 0;
 
-  if ( aMaxLenCr == 0 )
+  if (aMaxLenCr == 0)
   {
     const QMap<int, QString>& aSupportedTypes = getSupportedTypes();
     QMap<int, QString>::const_iterator anIter;
-    for ( anIter = aSupportedTypes.begin(); anIter != aSupportedTypes.end(); ++anIter )
-      aMaxLenCr = Max( maxLength( getCriteria( anIter.key() ), aMetrics ), aMaxLenCr );
+    for (anIter = aSupportedTypes.begin(); anIter != aSupportedTypes.end(); ++anIter)
+      aMaxLenCr = Max(maxLength(getCriteria(anIter.key()), aMetrics), aMaxLenCr);
   }
 
-  static int aLenCr = abs(  aMaxLenCr -
-                            aMetrics.width( tr( "CRITERION" ) ) ) / aMetrics.width( ' ' ) + 5;
+  static int aLenCr = abs( aMaxLenCr -
+                            aMetrics.width(tr("CRITERION"))) / aMetrics.width(' ') + 5;
 
   QString aCrStr;
-  aCrStr.fill( ' ', aLenCr );
+  aCrStr.fill(' ', aLenCr);
   QString aCoStr;
-  aCoStr.fill( ' ', 10 );
+  aCoStr.fill(' ', 10);
 
-  aHeaders->setLabel( 0, tr( "CRITERION" ) + aCrStr );
-  aHeaders->setLabel( 1, tr( "COMPARE" ) + aCoStr );
-  aHeaders->setLabel( 2, tr( "THRESHOLD_VALUE" ) );
-  aHeaders->setLabel( 3, tr( "UNARY" ) );
-  aHeaders->setLabel( 4, tr( "BINARY" ) + "  " );
+  aHeaders->setLabel(0, tr("CRITERION") + aCrStr);
+  aHeaders->setLabel(1, tr("COMPARE") + aCoStr);
+  aHeaders->setLabel(2, tr("THRESHOLD_VALUE"));
+  aHeaders->setLabel(3, tr("UNARY"));
+  aHeaders->setLabel(4, tr("BINARY") + "  ");
 
   // set geometry of the table
-  for ( int i = 0; i <= 4; i++ )
-    aTable->adjustColumn( i );
+  for (int i = 0; i <= 4; i++)
+    aTable->adjustColumn(i);
 
   aTable->updateGeometry();
   QSize aSize = aTable->sizeHint();
   int aWidth = aSize.width();
-  aTable->setMinimumSize( QSize( aWidth, aWidth / 2 ) );
-  aTable->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding) );
+  aTable->setMinimumSize(QSize(aWidth, aWidth / 2));
+  aTable->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding));
 
-  connect( aTable, SIGNAL( valueChanged( int, int ) ),
-           this,   SLOT( onCriterionChanged( int, int ) ) );
+  connect(aTable, SIGNAL(valueChanged(int, int)),
+           this,   SLOT(onCriterionChanged(int, int)));
 
-  connect( aTable, SIGNAL( currentChanged( int, int ) ),
-           this,   SLOT( onCurrentChanged( int, int ) ) );
+  connect(aTable, SIGNAL(currentChanged(int, int)),
+           this,   SLOT(onCurrentChanged(int, int)));
 
   return aTable;
 }
@@ -1395,22 +1399,22 @@ SMESHGUI_FilterTable::Table* SMESHGUI_FilterTable::createTable( QWidget*  thePar
 //=======================================================================
 void SMESHGUI_FilterTable::updateBtnState()
 {
-  myRemoveBtn->setEnabled( myTables[ GetType() ]->numRows() > 0 );
-  myClearBtn->setEnabled( myTables[ GetType() ]->numRows() > 0 );
+  myRemoveBtn->setEnabled(myTables[ GetType() ]->numRows() > 0);
+  myClearBtn->setEnabled(myTables[ GetType() ]->numRows() > 0);
 }
 
 //=======================================================================
 // name    : SMESHGUI_FilterTable::SetEditable
 // Purpose : Set read only flag for tables. Show/hide buttons for work with rows
 //=======================================================================
-void SMESHGUI_FilterTable::SetEditable( const bool isEditable )
+void SMESHGUI_FilterTable::SetEditable (const bool isEditable)
 {
   TableMap::iterator anIter;
-  for ( anIter = myTables.begin(); anIter != myTables.end(); ++anIter )
+  for (anIter = myTables.begin(); anIter != myTables.end(); ++anIter)
   {
-    anIter.data()->setReadOnly( !isEditable );
+    anIter.data()->setReadOnly(!isEditable);
 
-    if ( isEditable )
+    if (isEditable)
     {
       myAddBtn->show();
       myInsertBtn->show();
@@ -1427,27 +1431,27 @@ void SMESHGUI_FilterTable::SetEditable( const bool isEditable )
   }
 
   QMap<QTableItem*, AdditionalWidget*>::iterator anIter2;
-  for ( anIter2 = myAddWidgets.begin(); anIter2 != myAddWidgets.end(); ++anIter2 )
-    anIter2.data()->SetEditable( isEditable );
+  for (anIter2 = myAddWidgets.begin(); anIter2 != myAddWidgets.end(); ++anIter2)
+    anIter2.data()->SetEditable(isEditable);
 }
 
 //=======================================================================
 // name    : SMESHGUI_FilterTable::SetEnabled
 // Purpose : Enable/Disable table. Switching type of elements already enabled
 //=======================================================================
-void SMESHGUI_FilterTable::SetEnabled( const bool isEnabled )
+void SMESHGUI_FilterTable::SetEnabled (const bool isEnabled)
 {
-  myAddBtn->setEnabled( isEnabled );
-  myInsertBtn->setEnabled( isEnabled );
-  myRemoveBtn->setEnabled( isEnabled );
-  myClearBtn->setEnabled( isEnabled );
+  myAddBtn->setEnabled(isEnabled);
+  myInsertBtn->setEnabled(isEnabled);
+  myRemoveBtn->setEnabled(isEnabled);
+  myClearBtn->setEnabled(isEnabled);
 
-  if ( isEnabled )
+  if (isEnabled)
     updateBtnState();
-  
+
   QMap<QTableItem*, AdditionalWidget*>::iterator anIter2;
-  for ( anIter2 = myAddWidgets.begin(); anIter2 != myAddWidgets.end(); ++anIter2 )
-    anIter2.data()->setEnabled( isEnabled );
+  for (anIter2 = myAddWidgets.begin(); anIter2 != myAddWidgets.end(); ++anIter2)
+    anIter2.data()->setEnabled(isEnabled);
 }
 
 //=======================================================================
@@ -1463,9 +1467,9 @@ bool SMESHGUI_FilterTable::IsEditable() const
 // name    : SMESHGUI_FilterTable::SetLibsEnabled
 // Purpose : Show/hide buttons for work with libraries
 //=======================================================================
-void SMESHGUI_FilterTable::SetLibsEnabled( const bool isEnabled )
+void SMESHGUI_FilterTable::SetLibsEnabled (const bool isEnabled)
 {
-  if ( isEnabled )
+  if (isEnabled)
   {
     myCopyFromBtn->show();
     myAddToBtn->show();
@@ -1484,15 +1488,15 @@ void SMESHGUI_FilterTable::SetLibsEnabled( const bool isEnabled )
 //=======================================================================
 void SMESHGUI_FilterTable::onCopyFromBtn()
 {
-  if ( myLibDlg == 0 )
+  if (myLibDlg == 0)
     myLibDlg = new SMESHGUI_FilterLibraryDlg(
-      this, GetType(), SMESHGUI_FilterLibraryDlg::COPY_FROM );
+      this, GetType(), SMESHGUI_FilterLibraryDlg::COPY_FROM);
   else
-    myLibDlg->Init( GetType(), SMESHGUI_FilterLibraryDlg::COPY_FROM );
+    myLibDlg->Init(GetType(), SMESHGUI_FilterLibraryDlg::COPY_FROM);
 
-  if ( myLibDlg->exec() == QDialog::Accepted )
+  if (myLibDlg->exec() == QDialog::Accepted)
   {
-    Copy( myLibDlg->GetTable() );
+    Copy(myLibDlg->GetTable());
     Update();
   }
 }
@@ -1504,32 +1508,32 @@ void SMESHGUI_FilterTable::onCopyFromBtn()
 //=======================================================================
 void SMESHGUI_FilterTable::onAddToBtn()
 {
-  if ( !IsValid( true ) )
+  if (!IsValid(true))
     return;
-  if ( myLibDlg == 0 )
+  if (myLibDlg == 0)
     myLibDlg = new SMESHGUI_FilterLibraryDlg(
-      this, GetType(), SMESHGUI_FilterLibraryDlg::ADD_TO );
+      this, GetType(), SMESHGUI_FilterLibraryDlg::ADD_TO);
   else
-    myLibDlg->Init( GetType(), SMESHGUI_FilterLibraryDlg::ADD_TO );
+    myLibDlg->Init(GetType(), SMESHGUI_FilterLibraryDlg::ADD_TO);
+
+  myLibDlg->SetTable(this);
 
-  myLibDlg->SetTable( this );
-    
   myLibDlg->exec();
-}                                          
+}
 
 //=======================================================================
 // name    : SMESHGUI_FilterTable::Copy
 // Purpose : Initialise table with values of other table
 //=======================================================================
-void SMESHGUI_FilterTable::Copy( const SMESHGUI_FilterTable* theTable )
+void SMESHGUI_FilterTable::Copy (const SMESHGUI_FilterTable* theTable)
 {
   Clear();
 
-  for ( int i = 0, n = theTable->NumRows(); i < n; i++ )
+  for (int i = 0, n = theTable->NumRows(); i < n; i++)
   {
     SMESH::Filter::Criterion aCriterion = SMESHGUI_FilterDlg::createCriterion();
-    theTable->GetCriterion( i, aCriterion );
-    AddCriterion( aCriterion );
+    theTable->GetCriterion(i, aCriterion);
+    AddCriterion(aCriterion);
   }
 }
 
@@ -1537,7 +1541,7 @@ void SMESHGUI_FilterTable::Copy( const SMESHGUI_FilterTable* theTable )
 // name    : SMESHGUI_FilterTable::CurrentCell
 // Purpose : Returns current cell
 //=======================================================================
-bool SMESHGUI_FilterTable::CurrentCell( int& theRow, int& theCol ) const
+bool SMESHGUI_FilterTable::CurrentCell (int& theRow, int& theCol) const
 {
   theRow = myTables[ GetType() ]->currentRow();
   theCol = myTables[ GetType() ]->currentColumn();
@@ -1546,36 +1550,36 @@ bool SMESHGUI_FilterTable::CurrentCell( int& theRow, int& theCol ) const
 
 //=======================================================================
 // name    : SMESHGUI_FilterTable::SetText
-// Purpose : Set text and internal value in cell of threshold value 
+// Purpose : Set text and internal value in cell of threshold value
 //=======================================================================
-void SMESHGUI_FilterTable::SetThresholdconst int      theRow,
+void SMESHGUI_FilterTable::SetThreshold (const int      theRow,
                                          const QString& theText,
-                                         const int      theEntityType )
+                                         const int      theEntityType)
 {
   Table* aTable = myTables[ theEntityType == -1 ? GetType() : theEntityType ];
-  aTable->setText( theRow, 2, theText );
+  aTable->setText(theRow, 2, theText);
 }
 
 //=======================================================================
 // name    : SMESHGUI_FilterTable::SetText
 // Purpose : Get text and internal value from cell of threshold value
 //=======================================================================
-bool SMESHGUI_FilterTable::GetThresholdconst int      theRow,
+bool SMESHGUI_FilterTable::GetThreshold (const int      theRow,
                                          QString&       theText,
-                                         const int      theEntityType )
+                                         const int      theEntityType)
 {
   Table* aTable = myTables[ theEntityType == -1 ? GetType() : theEntityType ];
-  QTableItem* anItem = aTable->item( theRow, 2 );
-  if ( anItem != 0 )
+  QTableItem* anItem = aTable->item(theRow, 2);
+  if (anItem != 0)
   {
     theText = anItem->text();
-    return true;    
+    return true;
   }
   else
    return false;
 }
 
-/*                                                                                                                                                 
+/*
   Class       : SMESHGUI_FilterDlg
   Description : Dialog to specify filters for VTK viewer
 */
@@ -1585,82 +1589,90 @@ bool SMESHGUI_FilterTable::GetThreshold( const int      theRow,
 // name    : SMESHGUI_FilterDlg::SMESHGUI_FilterDlg
 // Purpose : Constructor
 //=======================================================================
-SMESHGUI_FilterDlg::SMESHGUI_FilterDlg( QWidget*               theParent,
+SMESHGUI_FilterDlg::SMESHGUI_FilterDlg( SMESHGUI*              theModule,
                                         const QValueList<int>& theTypes,
-                                        const char*            theName )
-: QDialog( theParent, theName, false,
-           WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
+                                        const char*            theName)
+: QDialog( SMESH::GetDesktop( theModule ), theName, false,
+           WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu),
+     mySMESHGUI( theModule ),
+     mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ),
+     myViewWindow( SMESH::GetViewWindow( theModule ) ),
+     mySelector( myViewWindow->GetSelector() )
 {
-  construct( theTypes );
+  construct(theTypes);
 }
 
 //=======================================================================
 // name    : SMESHGUI_FilterDlg::SMESHGUI_FilterDlg
 // Purpose : Constructor
 //=======================================================================
-SMESHGUI_FilterDlg::SMESHGUI_FilterDlg( QWidget*    theParent,
+SMESHGUI_FilterDlg::SMESHGUI_FilterDlg( SMESHGUI*   theModule,
                                         const int   theType,
-                                        const char* theName )
-: QDialog( theParent, theName, false,
-           WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
+                                        const char* theName)
+: QDialog( SMESH::GetDesktop( theModule ), theName, false,
+           WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu),
+     mySMESHGUI( theModule ),
+     mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ),
+     myViewWindow( SMESH::GetViewWindow( theModule ) ),
+     mySelector( myViewWindow->GetSelector() )
 {
   QValueList<int> aTypes;
-  aTypes.append( theType );
-  construct( aTypes );
+  aTypes.append(theType);
+  construct(aTypes);
 }
 
 //=======================================================================
 // name    : SMESHGUI_FilterDlg::construct
-// Purpose : Construct dialog ( called by constructor )
+// Purpose : Construct dialog (called by constructor)
 //=======================================================================
-void SMESHGUI_FilterDlg::construct( const QValueList<int>& theTypes )
+void SMESHGUI_FilterDlg::construct (const QValueList<int>& theTypes)
 {
   myTypes = theTypes;
 
-  setCaption( tr( "CAPTION" ) );
+  setCaption(tr("CAPTION"));
 
-  QVBoxLayout* aDlgLay = new QVBoxLayout( this, MARGIN, SPACING );
+  QVBoxLayout* aDlgLay = new QVBoxLayout (this, MARGIN, SPACING);
 
-  myMainFrame        = createMainFrame  ( this );
-  QFrame* aBtnFrame  = createButtonFrame( this );
+  myMainFrame        = createMainFrame  (this);
+  QFrame* aBtnFrame  = createButtonFrame(this);
 
-  aDlgLay->addWidget( myMainFrame );
-  aDlgLay->addWidget( aBtnFrame );
+  aDlgLay->addWidget(myMainFrame);
+  aDlgLay->addWidget(aBtnFrame);
 
-  aDlgLay->setStretchFactor( myMainFrame, 1 );
+  aDlgLay->setStretchFactor(myMainFrame, 1);
 
-  Init( myTypes );
+  Init(myTypes);
 }
 
 //=======================================================================
 // name    : SMESHGUI_FilterDlg::createMainFrame
 // Purpose : Create frame containing dialog's input fields
 //=======================================================================
-QFrame* SMESHGUI_FilterDlg::createMainFrame( QWidget* theParent )
+QFrame* SMESHGUI_FilterDlg::createMainFrame (QWidget* theParent)
 {
-  QGroupBox* aMainFrame = new QGroupBox( 1, Qt::Horizontal, theParent );
-  aMainFrame->setFrameStyle( QFrame::NoFrame );
-  aMainFrame->setInsideMargin( 0 );
+  QGroupBox* aMainFrame = new QGroupBox(1, Qt::Horizontal, theParent);
+  aMainFrame->setFrameStyle(QFrame::NoFrame);
+  aMainFrame->setInsideMargin(0);
 
   // filter frame
 
-  myTable = new SMESHGUI_FilterTable( aMainFrame, myTypes );
-  myTable->SetLibsEnabled( true );
+  myTable = new SMESHGUI_FilterTable(aMainFrame, myTypes);
+  myTable->SetLibsEnabled(true);
 
-  QFrame* aLine = new QFrame( myTable->GetTableGrp() );
-  aLine->setFrameStyle( QFrame::HLine | QFrame::Sunken );
+  QFrame* aLine = new QFrame(myTable->GetTableGrp());
+  aLine->setFrameStyle(QFrame::HLine | QFrame::Sunken);
 
-  mySetInViewer = new QCheckBox( tr( "SET_IN_VIEWER" ), myTable->GetTableGrp() );
-  mySetInViewer->setChecked( true );
+  mySetInViewer = new QCheckBox(tr("SET_IN_VIEWER"), myTable->GetTableGrp());
+  mySetInViewer->setChecked(true);
 
   // other controls
-  mySourceGrp = createSourceGroup( aMainFrame );
+  mySourceGrp = createSourceGroup(aMainFrame);
 
-  connect( myTable, SIGNAL( CretarionChanged( const int, const int ) ),
-                    SLOT( onCriterionChanged( const int, const int ) ) );
+  connect(myTable, SIGNAL(CretarionChanged(const int, const int)),
+                    SLOT(onCriterionChanged(const int, const int)));
 
-  connect( myTable, SIGNAL( CurrentChanged( int, int ) ),
-                    SLOT( onCurrentChanged( int, int ) ) );                    
+  connect(myTable, SIGNAL(CurrentChanged(int, int)),
+                    SLOT(onCurrentChanged(int, int)));
 
   return aMainFrame;
 }
@@ -1669,30 +1681,30 @@ QFrame* SMESHGUI_FilterDlg::createMainFrame( QWidget* theParent )
 // name    : SMESHGUI_FilterDlg::createSourceFrame
 // Purpose : Create frame containing source radio button
 //=======================================================================
-QButtonGroup* SMESHGUI_FilterDlg::createSourceGroup( QWidget* theParent )
+QButtonGroup* SMESHGUI_FilterDlg::createSourceGroup (QWidget* theParent)
 {
-  QButtonGroup* aGrp = new QButtonGroup( 1, Qt::Vertical, tr( "SOURCE" ), theParent );
+  QButtonGroup* aGrp = new QButtonGroup(1, Qt::Vertical, tr("SOURCE"), theParent);
 
-  QRadioButton* aMeshBtn = new QRadioButton( tr( "MESH" ), aGrp );
-  QRadioButton* aSelBtn  = new QRadioButton( tr( "SELECTION" ), aGrp );
-  QRadioButton* aGrpBtn  = new QRadioButton( tr( "CURRENT_GROUP" ), aGrp );
+  QRadioButton* aMeshBtn = new QRadioButton(tr("MESH"), aGrp);
+  QRadioButton* aSelBtn  = new QRadioButton(tr("SELECTION"), aGrp);
+  QRadioButton* aGrpBtn  = new QRadioButton(tr("CURRENT_GROUP"), aGrp);
 
-  aGrp->insert( aMeshBtn, Mesh );
-  aGrp->insert( aSelBtn, Selection );
-  aGrp->insert( aGrpBtn, Dialog );
+  aGrp->insert(aMeshBtn, Mesh);
+  aGrp->insert(aSelBtn, Selection);
+  aGrp->insert(aGrpBtn, Dialog);
 
-  aGrp->setButton( Selection );
+  aGrp->setButton(Selection);
 
   return aGrp;
 }
 
 //=======================================================================
 // name    : SMESHGUI_FilterDlg::updateMainButtons
-// Purpose : Update visibility of main buttons ( OK, Cancel, Close ... )
+// Purpose : Update visibility of main buttons (OK, Cancel, Close ...)
 //=======================================================================
 void SMESHGUI_FilterDlg::updateMainButtons()
 {
-  if ( myTypes.count() == 1 )
+  if (myTypes.count() == 1)
   {
     myButtons[ BTN_Cancel ]->show();
     myButtons[ BTN_Apply  ]->hide();
@@ -1712,23 +1724,23 @@ void SMESHGUI_FilterDlg::updateMainButtons()
 // name    : SMESHGUI_FilterDlg::createButtonFrame
 // Purpose : Create frame containing buttons
 //=======================================================================
-QFrame* SMESHGUI_FilterDlg::createButtonFrame( QWidget* theParent )
+QFrame* SMESHGUI_FilterDlg::createButtonFrame (QWidget* theParent)
 {
-  QGroupBox* aGrp = new QGroupBox( 1, Qt::Vertical, theParent );
+  QGroupBox* aGrp = new QGroupBox(1, Qt::Vertical, theParent);
 
-  myButtons[ BTN_OK    ] = new QPushButton( tr( "SMESH_BUT_OK"    ), aGrp );
-  myButtons[ BTN_Apply ] = new QPushButton( tr( "SMESH_BUT_APPLY" ), aGrp );
+  myButtons[ BTN_OK    ] = new QPushButton(tr("SMESH_BUT_OK"   ), aGrp);
+  myButtons[ BTN_Apply ] = new QPushButton(tr("SMESH_BUT_APPLY"), aGrp);
 
-  QLabel* aLbl = new QLabel( aGrp );
-  aLbl->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
+  QLabel* aLbl = new QLabel(aGrp);
+  aLbl->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed));
 
-  myButtons[ BTN_Cancel ] = new QPushButton( tr( "SMESH_BUT_CANCEL" ), aGrp );
-  myButtons[ BTN_Close  ] = new QPushButton( tr( "SMESH_BUT_CLOSE" ), aGrp );
+  myButtons[ BTN_Cancel ] = new QPushButton(tr("SMESH_BUT_CANCEL"), aGrp);
+  myButtons[ BTN_Close  ] = new QPushButton(tr("SMESH_BUT_CLOSE"), aGrp);
 
-  connect( myButtons[ BTN_OK     ], SIGNAL( clicked() ), SLOT( onOk() ) );
-  connect( myButtons[ BTN_Cancel ], SIGNAL( clicked() ), SLOT( onClose() ) ) ;
-  connect( myButtons[ BTN_Close  ], SIGNAL( clicked() ), SLOT( onClose() ) ) ;
-  connect( myButtons[ BTN_Apply  ], SIGNAL( clicked() ), SLOT( onApply() ) );
+  connect(myButtons[ BTN_OK     ], SIGNAL(clicked()), SLOT(onOk()));
+  connect(myButtons[ BTN_Cancel ], SIGNAL(clicked()), SLOT(onClose()));
+  connect(myButtons[ BTN_Close  ], SIGNAL(clicked()), SLOT(onClose()));
+  connect(myButtons[ BTN_Apply  ], SIGNAL(clicked()), SLOT(onApply()));
 
   updateMainButtons();
 
@@ -1747,82 +1759,80 @@ SMESHGUI_FilterDlg::~SMESHGUI_FilterDlg()
 // name    : SMESHGUI_FilterDlg::Init
 // Purpose : Init dialog fields, connect signals and slots, show dialog
 //=======================================================================
-void SMESHGUI_FilterDlg::Init( const int type )
+void SMESHGUI_FilterDlg::Init (const int type)
 {
   QValueList<int> aTypes;
-  aTypes.append( type );
-  Init( aTypes );
+  aTypes.append(type);
+  Init(aTypes);
 }
 
 //=======================================================================
 // name    : SMESHGUI_FilterDlg::Init
 // Purpose : Init dialog fields, connect signals and slots, show dialog
 //=======================================================================
-void SMESHGUI_FilterDlg::Init( const QValueList<int>& theTypes )
+void SMESHGUI_FilterDlg::Init (const QValueList<int>& theTypes)
 {
   mySourceWg  = 0;
-  mySelection = 0;
   myTypes     = theTypes;
   myMesh      = SMESH::SMESH_Mesh::_nil();
   myIObjects.Clear();
   myIsSelectionChanged = false;
 
-  myTable->Init( theTypes );
+  myTable->Init(theTypes);
 
   // set caption
-  if ( theTypes.count() == 1 )
+  if (theTypes.count() == 1)
   {
     int aType = theTypes.first();
-    if      ( aType == SMESH::NODE   ) setCaption( tr( "NODES_TLT" ) );
-    else if ( aType == SMESH::EDGE   ) setCaption( tr( "EDGES_TLT" ) );
-    else if ( aType == SMESH::FACE   ) setCaption( tr( "FACES_TLT" ) );
-    else if ( aType == SMESH::VOLUME ) setCaption( tr( "VOLUMES_TLT" ) );
+    if      (aType == SMESH::NODE  ) setCaption(tr("NODES_TLT"));
+    else if (aType == SMESH::EDGE  ) setCaption(tr("EDGES_TLT"));
+    else if (aType == SMESH::FACE  ) setCaption(tr("FACES_TLT"));
+    else if (aType == SMESH::VOLUME) setCaption(tr("VOLUMES_TLT"));
   }
   else
-    setCaption( tr( "TLT" ) );
+    setCaption(tr("TLT"));
 
   qApp->processEvents();
   updateGeometry();
   adjustSize();
-  setEnabled( true );
+  setEnabled(true);
 
-  mySMESHGUI = SMESHGUI::GetSMESHGUI() ;
-  mySMESHGUI->SetActiveDialogBox( ( QDialog* )this ) ;
+  mySMESHGUI->SetActiveDialogBox((QDialog*)this);
 
-  connect( mySMESHGUI, SIGNAL( SignalDeactivateActiveDialog() ), SLOT( onDeactivate() ) );
-  connect( mySMESHGUI, SIGNAL( SignalCloseAllDialogs() ), SLOT( onClose() ) );
+  connect(mySMESHGUI, SIGNAL(SignalDeactivateActiveDialog()), SLOT(onDeactivate()));
+  connect(mySMESHGUI, SIGNAL(SignalCloseAllDialogs()), SLOT(onClose()));
 
-  int x, y ;
-  mySMESHGUI->DefineDlgPosition( this, x, y );
-  this->move( x, y );
+  int x, y;
+  mySMESHGUI->DefineDlgPosition(this, x, y);
+  this->move(x, y);
 
   updateMainButtons();
   updateSelection();
 
   // Initialise filter table with values of previous filter
   QValueList<int>::const_iterator anIter;
-  for ( anIter = theTypes.begin(); anIter != theTypes.end(); ++anIter )
+  for (anIter = theTypes.begin(); anIter != theTypes.end(); ++anIter)
   {
-    myTable->Clear( *anIter );
-    if ( !myFilter[ *anIter ]->_is_nil() )
+    myTable->Clear(*anIter);
+    if (!myFilter[ *anIter ]->_is_nil())
     {
       SMESH::Filter::Criteria_var aCriteria = new SMESH::Filter::Criteria;
-      if ( myFilter[ *anIter ]->GetCriteria( aCriteria ) )
+      if (myFilter[ *anIter ]->GetCriteria(aCriteria))
       {
-        for ( int i = 0, n = aCriteria->length(); i < n; i++ )
-          myTable->AddCriterion( aCriteria[ i ], *anIter );
+        for (int i = 0, n = aCriteria->length(); i < n; i++)
+          myTable->AddCriterion(aCriteria[ i ], *anIter);
       }
     }
   }
 
-  if ( myInsertState.contains( theTypes.first() ) )
-    mySetInViewer->setChecked( myInsertState[ theTypes.first() ] );
+  if (myInsertState.contains(theTypes.first()))
+    mySetInViewer->setChecked(myInsertState[ theTypes.first() ]);
   else
-    mySetInViewer->setChecked( true );
-  if ( myApplyToState.contains( theTypes.first() ) )
-    mySourceGrp->setButton( myApplyToState[ theTypes.first() ] );
+    mySetInViewer->setChecked(true);
+  if (myApplyToState.contains(theTypes.first()))
+    mySourceGrp->setButton(myApplyToState[ theTypes.first() ]);
   else
-    mySourceGrp->setButton( Selection ); 
+    mySourceGrp->setButton(Selection);
 }
 
 //=======================================================================
@@ -1832,12 +1842,12 @@ void SMESHGUI_FilterDlg::Init( const QValueList<int>& theTypes )
 //=======================================================================
 void SMESHGUI_FilterDlg::onOk()
 {
-  if ( onApply() )
+  if (onApply())
   {
-    mySelection->ClearFilters();
-    disconnect( mySMESHGUI, 0, this, 0 );
-    disconnect( mySelection, 0, this, 0 );
-    mySMESHGUI->ResetState() ;
+    mySelectionMgr->clearFilters();
+    disconnect(mySMESHGUI, 0, this, 0);
+    disconnect(mySelectionMgr, 0, this, 0);
+    mySMESHGUI->ResetState();
     accept();
     emit Accepted();
   }
@@ -1850,29 +1860,32 @@ void SMESHGUI_FilterDlg::onOk()
 void SMESHGUI_FilterDlg::onClose()
 {
   // Restore previously selected object
-  if ( mySelection )
+  if (mySelectionMgr)
   {
-    mySelection->ClearFilters();
-    mySelection->Clear();
-    SALOME_DataMapIteratorOfDataMapOfIOMapOfInteger anIter( myIObjects );
-    for ( ; anIter.More(); anIter.Next() )
+    SALOME_ListIO aList;
+    mySelectionMgr->clearFilters();
+    mySelectionMgr->clearSelected();
+    SALOME_DataMapIteratorOfDataMapOfIOMapOfInteger anIter (myIObjects);
+    for (; anIter.More(); anIter.Next())
     {
-      mySelection->AddIObject( anIter.Key() );
+      aList.Append(anIter.Key());
 
       TColStd_MapOfInteger aResMap;
       const TColStd_IndexedMapOfInteger& anIndMap = anIter.Value();
-      for ( int i = 1, n = anIndMap.Extent(); i <= n; i++ )
-        aResMap.Add( anIndMap( i ) );
-      
-      mySelection->AddOrRemoveIndex( anIter.Key(), aResMap, false );
+      for (int i = 1, n = anIndMap.Extent(); i <= n; i++)
+        aResMap.Add(anIndMap(i));
+
+      mySelector->AddOrRemoveIndex( anIter.Key(), aResMap, false);
+      myViewWindow->highlight( anIter.Key(), true, true );
     }
+    mySelectionMgr->setSelectedObjects(aList, false);
   }
 
-  disconnect( mySMESHGUI, 0, this, 0 );
-  disconnect( mySelection, 0, this, 0 );
-  mySMESHGUI->ResetState() ;
-  reject() ;
-  return ;
+  disconnect(mySMESHGUI, 0, this, 0);
+  disconnect(mySelectionMgr, 0, this, 0);
+  mySMESHGUI->ResetState();
+  reject();
+  return;
 }
 
 //=======================================================================
@@ -1881,67 +1894,66 @@ void SMESHGUI_FilterDlg::onClose()
 //=======================================================================
 void SMESHGUI_FilterDlg::onDeactivate()
 {
-  setEnabled( false );
+  setEnabled(false);
 }
 
 //=======================================================================
 // name    : SMESHGUI_FilterDlg::enterEvent
 // Purpose : Event filter
 //=======================================================================
-void SMESHGUI_FilterDlg::enterEvent( QEvent* )
+void SMESHGUI_FilterDlg::enterEvent (QEvent*)
 {
 //  mySMESHGUI->EmitSignalDeactivateDialog();
-  mySMESHGUI->SetActiveDialogBox( (QDialog*)this );
+  mySMESHGUI->SetActiveDialogBox((QDialog*)this);
   mySMESHGUI->ResetState();
-  setEnabled( true );
+  setEnabled(true);
 }
 
-
-//=================================================================================
-// function : closeEvent()
-// purpose  :
-//=================================================================================
-void SMESHGUI_FilterDlg::closeEvent( QCloseEvent* e )
+//=======================================================================
+// name    : closeEvent()
+// Purpose :
+//=======================================================================
+void SMESHGUI_FilterDlg::closeEvent (QCloseEvent*)
 {
-  onClose() ;
+  onClose();
 }
 
 //=======================================================================
 // name    : SMESHGUI_FilterDlg::getIdsFromWg
 // Purpose : Retrieve list of ids from given widget
 //=======================================================================
-void SMESHGUI_FilterDlg::getIdsFromWg( const QWidget* theWg, QValueList<int>& theRes ) const
+void SMESHGUI_FilterDlg::getIdsFromWg (const QWidget* theWg, QValueList<int>& theRes) const
 {
   theRes.clear();
-  if ( theWg == 0 )
+  if (theWg == 0)
     return;
 
-  if ( theWg->inherits( "QListBox" ) )
+  if (theWg->inherits("QListBox"))
   {
-    QListBox* aListBox = ( QListBox* )theWg;
+    QListBox* aListBox = (QListBox*)theWg;
     bool b;
-    for ( int i = 0, n = aListBox->count(); i < n; i++ )
+    for (int i = 0, n = aListBox->count(); i < n; i++)
     {
-      int anId = aListBox->text( i ).toInt( &b );
-      if ( b )
-        theRes.append( anId );
+      int anId = aListBox->text(i).toInt(&b);
+      if (b)
+        theRes.append(anId);
     }
   }
-  else if ( theWg->inherits( "QLineEdit" ) )
+  else if (theWg->inherits("QLineEdit"))
   {
-    QLineEdit* aLineEdit = ( QLineEdit* )theWg;
+    QLineEdit* aLineEdit = (QLineEdit*)theWg;
     QString aStr = aLineEdit->text();
-    QRegExp aRegExp( "(\\d+)" );
+    QRegExp aRegExp("(\\d+)");
     bool b;
     int aPos = 0;
-    while ( aPos >= 0 )
+    while (aPos >= 0)
     {
-      aPos = aRegExp.search( aStr, aPos );
-      if ( aPos > -1 )
+      aPos = aRegExp.search(aStr, aPos);
+      if (aPos > -1)
       {
-        int anId = aRegExp.cap( 1 ).toInt( &b );
-        if ( b )
-          theRes.append( anId );
+        int anId = aRegExp.cap(1).toInt(&b);
+        if (b)
+          theRes.append(anId);
         aPos += aRegExp.matchedLength();
       }
     }
@@ -1952,9 +1964,9 @@ void SMESHGUI_FilterDlg::getIdsFromWg( const QWidget* theWg, QValueList<int>& th
 // name    : SMESHGUI_FilterDlg::getSelMode
 // Purpose : Get selection mode of specified type
 //=======================================================================
-Selection_Mode SMESHGUI_FilterDlg::getSelMode( const int theType ) const
+Selection_Mode SMESHGUI_FilterDlg::getSelMode (const int theType) const
 {
-  switch ( theType )
+  switch (theType)
   {
     case SMESH::NODE   : return NodeSelection;
     case SMESH::EDGE   : return EdgeSelection;
@@ -1969,36 +1981,36 @@ Selection_Mode SMESHGUI_FilterDlg::getSelMode( const int theType ) const
 // name    : SMESHGUI_FilterDlg::setIdsToWg
 // Purpose : Insert identifiers in specified widgets
 //=======================================================================
-void SMESHGUI_FilterDlg::setIdsToWg( QWidget* theWg, const QValueList<int>& theIds )
+void SMESHGUI_FilterDlg::setIdsToWg (QWidget* theWg, const QValueList<int>& theIds)
 {
-  if ( theWg == 0 )
+  if (theWg == 0)
     return;
 
-  if ( theWg->inherits( "QListBox" ) )
+  if (theWg->inherits("QListBox"))
   {
-    QListBox* aListBox = ( QListBox* )theWg;
+    QListBox* aListBox = (QListBox*)theWg;
     aListBox->clear();
 
     QStringList aStrList;
     QValueList<int>::const_iterator anIter;
-    for ( anIter = theIds.begin(); anIter != theIds.end(); ++anIter )
-      aStrList.append( QString( "%1" ).arg( *anIter ) );
+    for (anIter = theIds.begin(); anIter != theIds.end(); ++anIter)
+      aStrList.append(QString("%1").arg(*anIter));
 
-    aListBox->insertStringList( aStrList );
+    aListBox->insertStringList(aStrList);
   }
-  else if ( theWg->inherits( "QLineEdit" ) )
+  else if (theWg->inherits("QLineEdit"))
   {
-    QLineEdit* aLineEdit = ( QLineEdit* )theWg;
+    QLineEdit* aLineEdit = (QLineEdit*)theWg;
     QString aStr;
     QValueList<int>::const_iterator anIter;
 
-    for ( anIter = theIds.begin(); anIter != theIds.end(); ++ anIter )
-      aStr += QString( "%1 " ).arg( *anIter );
+    for (anIter = theIds.begin(); anIter != theIds.end(); ++ anIter)
+      aStr += QString("%1 ").arg(*anIter);
 
-    if ( !aStr.isEmpty() )
-      aStr.remove( aStr.length() - 1, 1 );
+    if (!aStr.isEmpty())
+      aStr.remove(aStr.length() - 1, 1);
 
-    aLineEdit->setText( aStr );
+    aLineEdit->setText(aStr);
   }
 }
 
@@ -2008,64 +2020,57 @@ void SMESHGUI_FilterDlg::setIdsToWg( QWidget* theWg, const QValueList<int>& theI
 //=======================================================================
 bool SMESHGUI_FilterDlg::isValid() const
 {
-  if ( !myTable->IsValid() )
+  if (!myTable->IsValid())
     return false;
-    
-  for ( int i = 0, n = myTable->NumRows(); i < n; i++ )
+
+  for (int i = 0, n = myTable->NumRows(); i < n; i++)
   {
-    int aType = myTable->GetCriterionType( i );
-    if ( aType == FT_BelongToGeom ||
+    int aType = myTable->GetCriterionType(i);
+    if (aType == FT_BelongToGeom ||
          aType == FT_BelongToPlane ||
          aType == FT_BelongToCylinder ||
-        aType == FT_LyingOnGeom)
-    {
+        aType == FT_LyingOnGeom) {
       QString aName;
-      myTable->GetThreshold( i, aName );
-      
-      SALOMEDS::Study::ListOfSObject_var aList = SMESHGUI::GetSMESHGUI()->GetActiveStudy()->
-        getStudyDocument()->FindObjectByName( aName.latin1(), "GEOM" );
-      if ( aList->length() == 0 )
-      {
-        QMessageBox::information( SMESHGUI::GetSMESHGUI()->GetDesktop(),
-          tr( "SMESH_INSUFFICIENT_DATA" ), tr( "BAD_SHAPE_NAME" ).arg( aName ), QMessageBox::Ok );
+      myTable->GetThreshold(i, aName);
+
+      std::vector<_PTR(SObject)> aList =
+        SMESH::GetActiveStudyDocument()->FindObjectByName(aName.latin1(), "GEOM");
+      if (aList.size() == 0) {
+        QMessageBox::information(SMESHGUI::desktop(), tr("SMESH_INSUFFICIENT_DATA"),
+                                 tr("BAD_SHAPE_NAME").arg(aName), QMessageBox::Ok);
         return false;
       }
 
-      if ( aType == FT_BelongToCylinder || aType == FT_BelongToPlane )
-      {
-        GEOM::GEOM_Object_var aGeomObj =
-          GEOM::GEOM_Object::_narrow( aList[ 0 ]->GetObject() );
-        if ( !aGeomObj->_is_nil() )
-        {
+      if (aType == FT_BelongToCylinder || aType == FT_BelongToPlane) {
+        CORBA::Object_var anObject = SMESH::SObjectToObject(aList[ 0 ]);
+        //GEOM::GEOM_Object_var aGeomObj = GEOM::GEOM_Object::_narrow(aList[ 0 ]->GetObject());
+        GEOM::GEOM_Object_var aGeomObj = GEOM::GEOM_Object::_narrow(anObject);
+        if (!aGeomObj->_is_nil()) {
           TopoDS_Shape aFace;
-          if ( !GEOMBase::GetShape( aGeomObj, aFace ) ||
+          if (!GEOMBase::GetShape(aGeomObj, aFace) ||
                aFace.IsNull() ||
-               aFace.ShapeType() != TopAbs_FACE )
-          {
-            QMessageBox::information( SMESHGUI::GetSMESHGUI()->GetDesktop(),
-              tr( "SMESH_INSUFFICIENT_DATA" ), tr( "SHAPE_IS_NOT_A_FACE" ).arg( aName ), QMessageBox::Ok );
+               aFace.ShapeType() != TopAbs_FACE) {
+            QMessageBox::information(SMESHGUI::desktop(), tr("SMESH_INSUFFICIENT_DATA"),
+                                     tr("SHAPE_IS_NOT_A_FACE").arg(aName), QMessageBox::Ok);
             return false;
           }
 
-          Handle(Geom_Surface) aSurf = BRep_Tool::Surface( TopoDS::Face( aFace ) );
-          if ( aSurf.IsNull() )
-          {
-            QMessageBox::information( SMESHGUI::GetSMESHGUI()->GetDesktop(),
-              tr( "SMESH_INSUFFICIENT_DATA" ), tr( "SHAPE_IS_NOT_A_FACE" ).arg( aName ), QMessageBox::Ok );
+          Handle(Geom_Surface) aSurf = BRep_Tool::Surface(TopoDS::Face(aFace));
+          if (aSurf.IsNull()) {
+            QMessageBox::information(SMESHGUI::desktop(), tr("SMESH_INSUFFICIENT_DATA"),
+                                     tr("SHAPE_IS_NOT_A_FACE").arg(aName), QMessageBox::Ok);
             return false;
           }
 
-          if ( aType == FT_BelongToPlane && !aSurf->IsKind( STANDARD_TYPE( Geom_Plane ) ) )
-          {
-            QMessageBox::information( SMESHGUI::GetSMESHGUI()->GetDesktop(),
-              tr( "SMESH_INSUFFICIENT_DATA" ), tr( "SHAPE_IS_NOT_A_PLANE" ).arg( aName ), QMessageBox::Ok );
+          if (aType == FT_BelongToPlane && !aSurf->IsKind(STANDARD_TYPE(Geom_Plane))) {
+            QMessageBox::information(SMESHGUI::desktop(), tr("SMESH_INSUFFICIENT_DATA"),
+                                     tr("SHAPE_IS_NOT_A_PLANE").arg(aName), QMessageBox::Ok);
             return false;
           }
 
-          if ( aType == FT_BelongToCylinder && !aSurf->IsKind( STANDARD_TYPE( Geom_CylindricalSurface ) ) )
-          {
-            QMessageBox::information( SMESHGUI::GetSMESHGUI()->GetDesktop(),
-              tr( "SMESH_INSUFFICIENT_DATA" ), tr( "SHAPE_IS_NOT_A_CYLINDER" ).arg( aName ), QMessageBox::Ok );
+          if (aType == FT_BelongToCylinder && !aSurf->IsKind(STANDARD_TYPE(Geom_CylindricalSurface))) {
+            QMessageBox::information(SMESHGUI::desktop(), tr("SMESH_INSUFFICIENT_DATA"),
+                                     tr("SHAPE_IS_NOT_A_CYLINDER").arg(aName), QMessageBox::Ok);
             return false;
           }
         }
@@ -2081,7 +2086,7 @@ bool SMESHGUI_FilterDlg::isValid() const
 // Purpose : Set widget of parent dialog containing idsto be filtered if
 //           user select corresponding source radio button
 //=======================================================================
-void SMESHGUI_FilterDlg::SetSourceWg( QWidget* theWg )
+void SMESHGUI_FilterDlg::SetSourceWg (QWidget* theWg)
 {
   mySourceWg = theWg;
 }
@@ -2090,7 +2095,7 @@ void SMESHGUI_FilterDlg::SetSourceWg( QWidget* theWg )
 // name    : SMESHGUI_FilterDlg::SetGroupIds
 // Purpose : Set mesh
 //=======================================================================
-void SMESHGUI_FilterDlg::SetMesh( SMESH::SMESH_Mesh_ptr theMesh )
+void SMESHGUI_FilterDlg::SetMesh (SMESH::SMESH_Mesh_ptr theMesh)
 {
   myMesh = theMesh;
 }
@@ -2099,26 +2104,22 @@ void SMESHGUI_FilterDlg::SetMesh( SMESH::SMESH_Mesh_ptr theMesh )
 // name    : SMESHGUI_FilterDlg::SetSelection
 // Purpose : Get filtered ids
 //=======================================================================
-void SMESHGUI_FilterDlg::SetSelection( SALOME_Selection* theSel )
+void SMESHGUI_FilterDlg::SetSelection()
 {
-  if ( mySelection )
-    disconnect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( onSelectionDone() ) );
-    
-  mySelection = theSel;
+  if (mySelectionMgr)
+    disconnect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(onSelectionDone()));
 
-  if ( mySelection )
-  {
+  if (mySelectionMgr) {
     myIObjects.Clear();
-    const SALOME_ListIO& anObjs = mySelection->StoredIObjects();
-    SALOME_ListIteratorOfListIO anIter( anObjs );
-    for ( ;anIter.More(); anIter.Next() )
-    {
+    const SALOME_ListIO& anObjs = mySelector->StoredIObjects();
+    SALOME_ListIteratorOfListIO anIter (anObjs);
+    for (; anIter.More(); anIter.Next()) {
       TColStd_IndexedMapOfInteger aMap;
-      mySelection->GetIndex( anIter.Value(), aMap );
-      myIObjects.Bind( anIter.Value(), aMap );
+      mySelector->GetIndex(anIter.Value(), aMap);
+      myIObjects.Bind(anIter.Value(), aMap);
     }
-    
-    connect( mySelection, SIGNAL( currentSelectionChanged() ), SLOT( onSelectionDone() ) );
+
+    connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), SLOT(onSelectionDone()));
 
     updateSelection();
   }
@@ -2133,34 +2134,31 @@ void SMESHGUI_FilterDlg::SetSelection( SALOME_Selection* theSel )
 //=======================================================================
 bool SMESHGUI_FilterDlg::onApply()
 {
-  if ( !isValid() )
+  if (!isValid())
     return false;
 
-  try
-  {
+  try {
     int aCurrType = myTable->GetType();
 
-    if ( !createFilter( aCurrType ) )
+    if (!createFilter(aCurrType))
       return false;
 
     insertFilterInViewer();
 
-    if ( !myFilter[ aCurrType ]->GetPredicate()->_is_nil() )
-    {
+    if (!myFilter[ aCurrType ]->GetPredicate()->_is_nil()) {
       QValueList<int> aResultIds;
-      filterSource( aCurrType, aResultIds );
-      selectInViewer( aCurrType, aResultIds );
+      filterSource(aCurrType, aResultIds);
+      selectInViewer(aCurrType, aResultIds);
     }
 
     myInsertState[ aCurrType ] = mySetInViewer->isChecked();
-    myApplyToState[ aCurrType ] = mySourceGrp->id( mySourceGrp->selected() );
-    
+    myApplyToState[ aCurrType ] = mySourceGrp->id(mySourceGrp->selected());
   }
-  catch( const SALOME::SALOME_Exception& S_ex )
+  catch(const SALOME::SALOME_Exception& S_ex)
   {
-    QtCatchCorbaException( S_ex );
+    SalomeApp_Tools::QtCatchCorbaException(S_ex);
   }
-  catch( ... )
+  catch(...)
   {
   }
 
@@ -2171,37 +2169,37 @@ bool SMESHGUI_FilterDlg::onApply()
 // name    : SMESHGUI_FilterDlg::createFilter
 // Purpose : Create predicate for given type
 //=======================================================================
-bool SMESHGUI_FilterDlg::createFilter( const int theType )
+bool SMESHGUI_FilterDlg::createFilter (const int theType)
 {
   SMESH::FilterManager_var aFilterMgr = SMESH::GetFilterManager();
-  if ( aFilterMgr->_is_nil() )
+  if (aFilterMgr->_is_nil())
     return false;
 
   int n = myTable->NumRows();
 
   SMESH::Filter::Criteria_var aCriteria = new SMESH::Filter::Criteria;
-  aCriteria->length( n );
+  aCriteria->length(n);
 
   long aPrecision = -1;
-  if ( QAD_CONFIG->hasSetting( "SMESH:ControlsPrecision" ) )
-  {
-    QString aStr = QAD_CONFIG->getSetting( "SMESH:ControlsPrecision" );
+  SUIT_ResourceMgr* mgr = SMESHGUI::resourceMgr();
+
+  if (mgr && mgr->hasValue("SMESH", "ControlsPrecision")) {
+    QString aStr = mgr->stringValue("SMESH", "ControlsPrecision");
     bool isOk = false;
-    int aVal = aStr.toInt( &isOk );
-    if ( isOk )
+    int aVal = aStr.toInt(&isOk);
+    if (isOk)
       aPrecision = aVal;
   }
-  
-  for ( CORBA::ULong i = 0; i < n; i++ )
-  {
+
+  for (CORBA::ULong i = 0; i < n; i++) {
     SMESH::Filter::Criterion aCriterion = createCriterion();
-    myTable->GetCriterion( i, aCriterion );
+    myTable->GetCriterion(i, aCriterion);
     aCriterion.Precision = aPrecision;
     aCriteria[ i ] = aCriterion;
   }
 
   myFilter[ theType ] = aFilterMgr->CreateFilter();
-  myFilter[ theType ]->SetCriteria( aCriteria.inout() );
+  myFilter[ theType ]->SetCriteria(aCriteria.inout());
 
   return true;
 }
@@ -2212,19 +2210,17 @@ bool SMESHGUI_FilterDlg::createFilter( const int theType )
 //=======================================================================
 void SMESHGUI_FilterDlg::insertFilterInViewer()
 {
-  if ( VTKViewer_InteractorStyleSALOME* aStyle = SMESH::GetInteractorStyle() )
-  {
+  if (SVTK_InteractorStyle* aStyle = SMESH::GetInteractorStyle()) {
     SMESH::ElementType anEntType = (SMESH::ElementType)myTable->GetType();
 
-    if ( myFilter[ myTable->GetType() ]->_is_nil() ||
+    if (myFilter[ myTable->GetType() ]->_is_nil() ||
          myFilter[ myTable->GetType() ]->GetPredicate()->_is_nil() ||
-         !mySetInViewer->isChecked() )
-      SMESH::RemoveFilter( getFilterId( anEntType ), aStyle );
-    else
-    {
+         !mySetInViewer->isChecked()) {
+      SMESH::RemoveFilter(getFilterId(anEntType), aStyle);
+    } else {
       Handle(SMESHGUI_PredicateFilter) aFilter = new SMESHGUI_PredicateFilter();
-      aFilter->SetPredicate( myFilter[ myTable->GetType() ]->GetPredicate() );
-      SMESH::SetFilter( aFilter, aStyle );
+      aFilter->SetPredicate(myFilter[ myTable->GetType() ]->GetPredicate());
+      SMESH::SetFilter(aFilter, aStyle);
     }
   }
 }
@@ -2233,34 +2229,34 @@ void SMESHGUI_FilterDlg::insertFilterInViewer()
 // name    : SMESHGUI_FilterDlg::filterSource
 // Purpose : Filter source ids
 //=======================================================================
-void SMESHGUI_FilterDlg::filterSourceconst int theType,
-                                       QValueList<int>& theResIds )
+void SMESHGUI_FilterDlg::filterSource (const int theType,
+                                       QValueList<int>& theResIds)
 {
   theResIds.clear();
-  if ( myFilter[ theType ]->_is_nil() )
+  if (myFilter[ theType ]->_is_nil())
     return;
 
-  int aSourceId = mySourceGrp->id( mySourceGrp->selected() );
+  int aSourceId = mySourceGrp->id(mySourceGrp->selected());
 
-  if ( aSourceId == Mesh )
+  if (aSourceId == Mesh)
   {
-    if ( myMesh->_is_nil() )
+    if (myMesh->_is_nil())
       return;
-    SMESH::long_array_var anIds = myFilter[ theType ]->GetElementsId( myMesh );
-    for ( int i = 0, n = anIds->length(); i < n; i++ )
-      theResIds.append( anIds[ i ] );
+    SMESH::long_array_var anIds = myFilter[ theType ]->GetElementsId(myMesh);
+    for (int i = 0, n = anIds->length(); i < n; i++)
+      theResIds.append(anIds[ i ]);
   }
-  else if ( aSourceId == Selection )
+  else if (aSourceId == Selection)
   {
-    filterSelectionSource( theType, theResIds );
+    filterSelectionSource(theType, theResIds);
   }
-  else if ( aSourceId == Dialog )
+  else if (aSourceId == Dialog)
   {
     // retrieve ids from dialog
     QValueList<int> aDialogIds;
-    getIdsFromWg( mySourceWg, aDialogIds );
+    getIdsFromWg(mySourceWg, aDialogIds);
 
-    if ( myMesh->_is_nil() )
+    if (myMesh->_is_nil())
     {
       theResIds = aDialogIds;
       return;
@@ -2268,14 +2264,14 @@ void SMESHGUI_FilterDlg::filterSource( const int theType,
 
     // filter ids
     SMESH::Predicate_ptr aPred = myFilter[ theType ]->GetPredicate();
-    aPred->SetMesh( myMesh );
+    aPred->SetMesh(myMesh);
     QValueList<int>::const_iterator anIter;
-    for ( anIter = aDialogIds.begin(); anIter != aDialogIds.end(); ++ anIter )
-      if ( aPred->IsSatisfy( *anIter ) )
-        theResIds.append( *anIter );
+    for (anIter = aDialogIds.begin(); anIter != aDialogIds.end(); ++ anIter)
+      if (aPred->IsSatisfy(*anIter))
+        theResIds.append(*anIter);
 
     // set ids to the dialog
-    setIdsToWg( mySourceWg, theResIds );
+    setIdsToWg(mySourceWg, theResIds);
   }
 }
 
@@ -2283,57 +2279,57 @@ void SMESHGUI_FilterDlg::filterSource( const int theType,
 // name    : SMESHGUI_FilterDlg::filterSelectionSource
 // Purpose : Filter source selection
 //=======================================================================
-void SMESHGUI_FilterDlg::filterSelectionSourceconst int theType,
-                                                QValueList<int>& theResIds )
+void SMESHGUI_FilterDlg::filterSelectionSource (const int theType,
+                                                QValueList<int>& theResIds)
 {
   theResIds.clear();
-  if ( myMesh->_is_nil() || mySelection == 0 )
+  if (myMesh->_is_nil() || mySelectionMgr == 0)
     return;
 
   // Create map of entities to be filtered
   TColStd_MapOfInteger aToBeFiltered;
-  SALOME_DataMapIteratorOfDataMapOfIOMapOfInteger anIter( myIObjects );
+  SALOME_DataMapIteratorOfDataMapOfIOMapOfInteger anIter(myIObjects);
 
-  for ( ; anIter.More(); anIter.Next() )
+  for (; anIter.More(); anIter.Next())
   {
     // process sub mesh
-    SMESH::SMESH_subMesh_var aSubMesh = SMESH::IObjectToInterface<SMESH::SMESH_subMesh>( anIter.Key() );
-    if ( !aSubMesh->_is_nil() )
+    SMESH::SMESH_subMesh_var aSubMesh = SMESH::IObjectToInterface<SMESH::SMESH_subMesh>(anIter.Key());
+    if (!aSubMesh->_is_nil())
     {
-      if ( aSubMesh->GetFather()->GetId() == myMesh->GetId() )
+      if (aSubMesh->GetFather()->GetId() == myMesh->GetId())
       {
         SMESH::long_array_var anIds =
           theType == SMESH::NODE ? aSubMesh->GetNodesId() : aSubMesh->GetElementsId();
-        for ( int i = 0, n = anIds->length(); i < n; i++ )
-          aToBeFiltered.Add( anIds[ i ] );
+        for (int i = 0, n = anIds->length(); i < n; i++)
+          aToBeFiltered.Add(anIds[ i ]);
       }
     }
 
     // process group
     SMESH::SMESH_GroupBase_var aGroup =
-      SMESH::IObjectToInterface<SMESH::SMESH_GroupBase>( anIter.Key() );
-    if ( !aGroup->_is_nil() )
+      SMESH::IObjectToInterface<SMESH::SMESH_GroupBase>(anIter.Key());
+    if (!aGroup->_is_nil())
     {
-      if ( aGroup->GetType() == theType && aGroup->GetMesh()->GetId() == myMesh->GetId() )
+      if (aGroup->GetType() == theType && aGroup->GetMesh()->GetId() == myMesh->GetId())
       {
         SMESH::long_array_var anIds = aGroup->GetListOfID();
-        for ( int i = 0, n = anIds->length(); i < n; i++ )
-          aToBeFiltered.Add( anIds[ i ] );
+        for (int i = 0, n = anIds->length(); i < n; i++)
+          aToBeFiltered.Add(anIds[ i ]);
       }
     }
 
     // process mesh
-    SMESH::SMESH_Mesh_var aMeshPtr = SMESH::IObjectToInterface<SMESH::SMESH_Mesh>( anIter.Key() );
-    if ( !aMeshPtr->_is_nil() && aMeshPtr->GetId() == myMesh->GetId() )
+    SMESH::SMESH_Mesh_var aMeshPtr = SMESH::IObjectToInterface<SMESH::SMESH_Mesh>(anIter.Key());
+    if (!aMeshPtr->_is_nil() && aMeshPtr->GetId() == myMesh->GetId())
     {
       const TColStd_IndexedMapOfInteger& aSelMap = anIter.Value();
 
-      if ( aSelMap.Extent() > 0 )
+      if (aSelMap.Extent() > 0)
       {
-        if( SMESH::FindActorByEntry( anIter.Key()->getEntry() ) )
+        if(SMESH::FindActorByEntry(anIter.Key()->getEntry()))
         {
-          for ( int i = 1; i <= aSelMap.Extent(); i++ )
-            aToBeFiltered.Add( aSelMap(i) );
+          for (int i = 1; i <= aSelMap.Extent(); i++)
+            aToBeFiltered.Add(aSelMap(i));
         }
       }
     }
@@ -2341,67 +2337,69 @@ void SMESHGUI_FilterDlg::filterSelectionSource( const int theType,
 
   // Filter entities
   SMESH::Predicate_ptr aPred = myFilter[ theType ]->GetPredicate();
-  aPred->SetMesh( myMesh );
-  TColStd_MapIteratorOfMapOfInteger aResIter( aToBeFiltered );
-  for ( ; aResIter.More(); aResIter.Next() )
-    if ( aPred->IsSatisfy( aResIter.Key() ) )
-      theResIds.append( aResIter.Key() );
+  aPred->SetMesh(myMesh);
+  TColStd_MapIteratorOfMapOfInteger aResIter(aToBeFiltered);
+  for (; aResIter.More(); aResIter.Next())
+    if (aPred->IsSatisfy(aResIter.Key()))
+      theResIds.append(aResIter.Key());
 }
 
 //=======================================================================
 // name    : SMESHGUI_FilterDlg::selectInViewer
 // Purpose : Select given entities in viewer
 //=======================================================================
-void SMESHGUI_FilterDlg::selectInViewer( const int theType, const QValueList<int>& theIds )
+void SMESHGUI_FilterDlg::selectInViewer (const int theType, const QValueList<int>& theIds)
 {
-  if ( mySelection == 0 || myMesh->_is_nil() )
+  if (mySelectionMgr == 0 || myMesh->_is_nil())
     return;
 
-  mySelection->ClearFilters();
+  mySelectionMgr->clearFilters();
 
   // Set new selection mode if necessary
-  Selection_Mode aSelMode = getSelMode( theType );
-  if ( aSelMode != mySelection->SelectionMode() )
-  {
-    mySelection->ClearIObjects();
-    mySelection->ClearFilters();
-    if ( aSelMode == NodeSelection )
+  Selection_Mode aSelMode = getSelMode(theType);
+  if (myViewWindow->SelectionMode()!=aSelMode) {
+    mySelectionMgr->clearSelected();
+    mySelectionMgr->clearFilters();
+    if (aSelMode == NodeSelection)
       SMESH::SetPointRepresentation(true);
-    QAD_Application::getDesktop()->SetSelectionMode( aSelMode );
+    myViewWindow->SetSelectionMode(aSelMode);
   }
 
   // Clear selection
   SMESH_Actor* anActor = SMESH::FindActorByObject(myMesh);
-  if ( !anActor || !anActor->hasIO() )
+  if (!anActor || !anActor->hasIO())
     return;
 
   Handle(SALOME_InteractiveObject) anIO = anActor->getIO();
-  mySelection->ClearIObjects();
-  mySelection->AddIObject( anIO, false );
+  //mySelectionMgr->clearSelected();
+  //mySelectionMgr->AddIObject(anIO, false);
+  SALOME_ListIO aList;
+  aList.Append(anIO);
+  mySelectionMgr->setSelectedObjects(aList, false);
 
   // Remove filter corresponding to the current type from viewer
   int aType = myTable->GetType();
   int aFilterId = SMESHGUI_UnknownFilter;
-  if      ( aType == SMESH::EDGE   ) aFilterId = SMESHGUI_EdgeFilter;
-  else if ( aType == SMESH::FACE   ) aFilterId = SMESHGUI_FaceFilter;
-  else if ( aType == SMESH::VOLUME ) aFilterId = SMESHGUI_VolumeFilter;
-  Handle(VTKViewer_Filter) aFilter = SMESH::GetFilter( aFilterId );
-  SMESH::RemoveFilter( aFilterId );
+  if      (aType == SMESH::EDGE  ) aFilterId = SMESHGUI_EdgeFilter;
+  else if (aType == SMESH::FACE  ) aFilterId = SMESHGUI_FaceFilter;
+  else if (aType == SMESH::VOLUME) aFilterId = SMESHGUI_VolumeFilter;
+  Handle(VTKViewer_Filter) aFilter = SMESH::GetFilter(aFilterId);
+  SMESH::RemoveFilter(aFilterId);
 
   // get vtk ids
   TColStd_MapOfInteger aMap;
   QValueList<int>::const_iterator anIter;
-  for ( anIter = theIds.begin(); anIter != theIds.end(); ++anIter )
-  {
-    aMap.Add( *anIter );
+  for (anIter = theIds.begin(); anIter != theIds.end(); ++anIter) {
+    aMap.Add(*anIter);
   }
 
   // Set new selection
-  mySelection->AddOrRemoveIndex( anIO, aMap, false, true );
+  mySelector->AddOrRemoveIndex(anIO, aMap, false);
+  myViewWindow->highlight( anIO, true, true );
 
   // insert previously stored filter in viewer if necessary
-  if ( !aFilter.IsNull() )
-    SMESH::SetFilter( aFilter );
+  if (!aFilter.IsNull())
+    SMESH::SetFilter(aFilter);
 }
 
 //=======================================================================
@@ -2432,25 +2430,27 @@ SMESH::Filter::Criterion SMESHGUI_FilterDlg::createCriterion()
 void SMESHGUI_FilterDlg::onSelectionDone()
 {
   int aRow, aCol;
-  if (  mySelection->IObjectCount() != 1 ||
-        !myTable->CurrentCell( aRow, aCol ) ||
-        myTable->GetCriterionType( aRow ) != FT_BelongToGeom &&
-        myTable->GetCriterionType( aRow ) != FT_BelongToPlane &&
-        myTable->GetCriterionType( aRow ) != FT_BelongToCylinder &&
-       myTable->GetCriterionType( aRow ) != FT_LyingOnGeom )
+  const SALOME_ListIO& aList = mySelector->StoredIObjects();
+
+  if (aList.Extent() != 1 ||
+      !myTable->CurrentCell(aRow, aCol) ||
+      myTable->GetCriterionType(aRow) != FT_BelongToGeom &&
+      myTable->GetCriterionType(aRow) != FT_BelongToPlane &&
+      myTable->GetCriterionType(aRow) != FT_BelongToCylinder &&
+      myTable->GetCriterionType(aRow) != FT_LyingOnGeom)
     return;
 
-  Handle(SALOME_InteractiveObject) anIO = mySelection->firstIObject() ;
-  GEOM::GEOM_Object_var anObj = SMESH::IObjectToInterface<GEOM::GEOM_Object>( anIO ) ;
-  if ( !anObj->_is_nil() )
-    myTable->SetThreshold( aRow, GEOMBase::GetName(anObj) );
+  Handle(SALOME_InteractiveObject) anIO = aList.First();
+  GEOM::GEOM_Object_var anObj = SMESH::IObjectToInterface<GEOM::GEOM_Object>(anIO);
+  if (!anObj->_is_nil())
+    myTable->SetThreshold(aRow, GEOMBase::GetName(anObj));
 }
 
 //=======================================================================
 // name    : SMESHGUI_FilterDlg::onCriterionChanged
 // Purpose : SLOT called when cretarion of current row changed. Update selection
 //=======================================================================
-void SMESHGUI_FilterDlg::onCriterionChanged( const int , const int )
+void SMESHGUI_FilterDlg::onCriterionChanged (const int , const int)
 {
   updateSelection();
 }
@@ -2459,7 +2459,7 @@ void SMESHGUI_FilterDlg::onCriterionChanged( const int , const int )
 // name    : SMESHGUI_FilterDlg::onCurrentChanged
 // Purpose : SLOT called when current row changed. Update selection
 //=======================================================================
-void SMESHGUI_FilterDlg::onCurrentChanged( int, int )
+void SMESHGUI_FilterDlg::onCurrentChanged (int, int)
 {
   updateSelection();
 }
@@ -2470,55 +2470,43 @@ void SMESHGUI_FilterDlg::onCurrentChanged( int, int )
 //=======================================================================
 void SMESHGUI_FilterDlg::updateSelection()
 {
-  if ( mySelection == 0 )
+  if (mySelectionMgr == 0)
     return;
-  
-  mySelection->ClearFilters();
-
-  int aRow, aCol;
-  
-  if ( myTable->CurrentCell( aRow, aCol ) &&
-       ( myTable->GetCriterionType( aRow ) == FT_BelongToGeom ||
-         myTable->GetCriterionType( aRow ) == FT_BelongToPlane ||
-         myTable->GetCriterionType( aRow ) == FT_BelongToCylinder ||
-        myTable->GetCriterionType( aRow ) == FT_LyingOnGeom) )
-  {
-    if ( myTable->GetCriterionType( aRow ) == FT_BelongToGeom ||  myTable->GetCriterionType( aRow ) == FT_LyingOnGeom )
-      mySelection->AddFilter( new SALOME_TypeFilter( "GEOM" ) );
-    else if ( myTable->GetCriterionType( aRow ) == FT_BelongToPlane )
-      mySelection->AddFilter( new GEOM_FaceFilter( StdSelect_Plane ) );
-    else if ( myTable->GetCriterionType( aRow ) == FT_BelongToCylinder )
-      mySelection->AddFilter( new GEOM_FaceFilter( StdSelect_Cylinder ) );
-
-    myIsSelectionChanged = true;
-  }
-  else
-  {
-    if ( myIsSelectionChanged )
-      mySelection->AddFilter( new SALOME_TypeFilter( "This filter deactivate selection" ) );
-  }
-}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
 
+  TColStd_MapOfInteger allTypes;
+  for( int i=0; i<10; i++ )
+    allTypes.Add( i );
+  SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>( mySMESHGUI->application()->activeStudy() );
+  if( !aStudy )
+    return;
 
 
+  mySelectionMgr->clearFilters();
 
+  int aRow, aCol;
 
+  if (myTable->CurrentCell(aRow, aCol) &&
+       (myTable->GetCriterionType(aRow) == FT_BelongToGeom ||
+         myTable->GetCriterionType(aRow) == FT_BelongToPlane ||
+         myTable->GetCriterionType(aRow) == FT_BelongToCylinder ||
+        myTable->GetCriterionType(aRow) == FT_LyingOnGeom)) {
 
+    if (myTable->GetCriterionType(aRow) == FT_BelongToGeom ||
+        myTable->GetCriterionType(aRow) == FT_LyingOnGeom) {
 
+      mySelectionMgr->installFilter(new SMESH_NumberFilter("GEOM",TopAbs_SHAPE,0,allTypes));
 
+    } else if (myTable->GetCriterionType(aRow) == FT_BelongToPlane) {
+      mySelectionMgr->installFilter(new GEOM_FaceFilter( aStudy, StdSelect_Plane ) );
 
+    } else if (myTable->GetCriterionType(aRow) == FT_BelongToCylinder) {
+      mySelectionMgr->installFilter(new GEOM_FaceFilter( aStudy, StdSelect_Cylinder ) );
+    }
+    myIsSelectionChanged = true;
 
+  } else {
+    if (myIsSelectionChanged) {
+      mySelectionMgr->installFilter(new SMESH_NumberFilter ("This filter deactivates selection",TopAbs_SHAPE,0,allTypes));
+    }
+  }
+}
index f63d2b2e0a134802a10023875517e0ad9c550238..cbef2c66feb0c72b981450c71843668a82ecbc21 100755 (executable)
 #include <qmap.h>
 #include <qvaluelist.h>
 
-#include "SALOME_Selection.h"
+#include "SalomeApp_SelectionMgr.h"
 #include "SALOME_InteractiveObject.hxx"
 #include "SALOME_DataMapOfIOMapOfInteger.hxx"
+#include "SVTK_Selection.h"
 
 #include <TColStd_IndexedMapOfInteger.hxx>
 
@@ -55,17 +56,19 @@ class QStringList;
 class QTable;
 class QTableItem;
 class QWidgetStack;
-class SALOME_Selection;
+class SalomeApp_SelectionMgr;
 class SMESHGUI;
 class SMESHGUI_FilterLibraryDlg;
+class SVTK_Selector;
+class SVTK_ViewWindow;
 
-/*
-  Class       : SMESHGUI_FilterTable
-  Description : Frame containig 
-                  - Button group for switching entity type
-                  - Table for displaying filter criterions
-                  - Buttons for editing table
-*/
+/*!
 Class       : SMESHGUI_FilterTable
 Description : Frame containig 
                 - Button group for switching entity type
                 - Table for displaying filter criterions
                 - Buttons for editing table
+ */
 
 class SMESHGUI_FilterTable : public QFrame
 {
@@ -78,66 +81,64 @@ class SMESHGUI_FilterTable : public QFrame
   typedef QMap<int, Table*> TableMap;
 
 public:  
-  
-                            SMESHGUI_FilterTable( QWidget* parent, 
-                                                  const int type );
-                            SMESHGUI_FilterTable( QWidget* parent, 
-                                                  const QValueList<int>& type );
+                            SMESHGUI_FilterTable (QWidget* parent, 
+                                                  const int type);
+                            SMESHGUI_FilterTable (QWidget* parent, 
+                                                  const QValueList<int>& type);
   virtual                   ~SMESHGUI_FilterTable();
-  
-  void                      Init( const int type );
-  void                      Init( const QValueList<int>& types );
+
+  void                      Init (const int type);
+  void                      Init (const QValueList<int>& types);
 
   QGroupBox*                GetTableGrp();
 
-  bool                      IsValid( const bool = true, const int theEntityType = -1 ) const;
+  bool                      IsValid (const bool = true, const int theEntityType = -1) const;
   int                       GetType() const;
-  void                      SetType( const int );
+  void                      SetType (const int);
   void                      RestorePreviousEntityType();
-  int                       NumRows( const int theEntityType = -1 ) const;
-  void                      Clear( const int theEntityType = -1 );
-  void                      SetEditable( const bool );
-  void                      SetEnabled( const bool );
-  void                      SetLibsEnabled( const bool );
+  int                       NumRows (const int theEntityType = -1) const;
+  void                      Clear (const int theEntityType = -1);
+  void                      SetEditable (const bool);
+  void                      SetEnabled (const bool);
+  void                      SetLibsEnabled (const bool);
   bool                      IsEditable() const;
 
-  int                       GetCriterionType( const int theRow, const int theType = -1 ) const;
-  
-  void                      GetCriterionconst int                 theRow,
+  int                       GetCriterionType (const int theRow, const int theType = -1) const;
+
+  void                      GetCriterion (const int                 theRow,
                                           SMESH::Filter::Criterion& theCriterion,
-                                          const int                 theEntityType = -1 ) const;
+                                          const int                 theEntityType = -1) const;
 
-  void                      SetCriterionconst int                       theRow,
+  void                      SetCriterion (const int                       theRow,
                                           const SMESH::Filter::Criterion& theCriterion,
-                                          const int                       theEntityType = -1 );
+                                          const int                       theEntityType = -1);
 
-  void                      AddCriterion( const SMESH::Filter::Criterion& theCriterion,
-                                          const int    theEntityType = -1 );
-  
-  void                      Copy( const SMESHGUI_FilterTable* );
-  void                      SetValidity( const bool );
+  void                      AddCriterion (const SMESH::Filter::Criterion& theCriterion,
+                                          const int    theEntityType = -1);
 
-  bool                      CurrentCell( int& theRow, int& theCol ) const;
-  void                      SetThreshold( const int      theRow,
+  void                      Copy (const SMESHGUI_FilterTable*);
+  void                      SetValidity (const bool);
+
+  bool                      CurrentCell (int& theRow, int& theCol) const;
+  void                      SetThreshold (const int      theRow,
                                           const QString& theText,
-                                          const int      theEntityType = -1 );
+                                          const int      theEntityType = -1);
 
-  bool                      GetThresholdconst int      theRow,
+  bool                      GetThreshold (const int      theRow,
                                           QString&       theText,
-                                          const int      theEntityType = -1 );
+                                          const int      theEntityType = -1);
 
   void                      Update();
 
 signals:
 
   void                      CopyFromClicked();
   void                      AddToClicked();
-  void                      EntityTypeChanged( const int );
+  void                      EntityTypeChanged (const int);
   void                      NeedValidation();
-  void                      CretarionChanged( const int theRow, const int theEntityType );
-  void                      CurrentChanged( int, int );
-  
+  void                      CretarionChanged (const int theRow, const int theEntityType);
+  void                      CurrentChanged (int, int);
+
 private slots:
 
   void                      onAddBtn();
@@ -146,30 +147,30 @@ private slots:
   void                      onClearBtn();
   void                      onCopyFromBtn();
   void                      onAddToBtn();
-  void                      onCriterionChanged( int, int );
-  void                      onEntityType( int );
-  void                      onCurrentChanged( int, int );
+  void                      onCriterionChanged (int, int);
+  void                      onEntityType (int);
+  void                      onCurrentChanged (int, int);
 
 private:
 
-  void                      addRow( Table*, const int, const bool toTheEnd = true );
-  QTableItem*               getCriterionItem( QTable*, const int );
-  QTableItem*               getCompareItem( QTable* );
-  QTableItem*               getUnaryItem( QTable* );
-  QTableItem*               getBinaryItem( QTable* );
-  const QMap<int, QString>& getCriteria( const int theType ) const;
+  void                      addRow (Table*, const int, const bool toTheEnd = true);
+  QTableItem*               getCriterionItem (QTable*, const int);
+  QTableItem*               getCompareItem (QTable*);
+  QTableItem*               getUnaryItem (QTable*);
+  QTableItem*               getBinaryItem (QTable*);
+  const QMap<int, QString>& getCriteria (const int theType) const;
   const QMap<int, QString>& getCompare() const;
-  Table*                    createTable( QWidget*, const int );
-  QWidget*                  createAdditionalFrame( QWidget* theParent );
+  Table*                    createTable (QWidget*, const int);
+  QWidget*                  createAdditionalFrame (QWidget* theParent);
   int                       getFirstSelectedRow() const;
-  void                      onCriterionChanged( const int, const int, const int  );
-  
+  void                      onCriterionChanged (const int, const int, const int);
+
   void                      updateBtnState();
-  void                      removeAdditionalWidget( QTable* theTable, const int theRow );
+  void                      removeAdditionalWidget (QTable* theTable, const int theRow);
   void                      updateAdditionalWidget();
 
   const QMap<int, QString>& getSupportedTypes() const;
-  
+
 private:
 
   QGroupBox*                myTableGrp;
@@ -186,45 +187,46 @@ private:
   QButtonGroup*             myEntityTypeGrp;
   int                       myEntityType;
   int                       myIsValid;
-  
+
   SMESHGUI_FilterLibraryDlg* myLibDlg;
 
-  QWidgetStack*             myWgStack;
+  QWidgetStack*              myWgStack;
+
   QMap<QTableItem*, AdditionalWidget*> myAddWidgets;
 };
 
 
-/*
-  Class       : SMESHGUI_FilterDlg
-  Description : Dialog to specify filters for VTK viewer
-*/
+/*!
 Class       : SMESHGUI_FilterDlg
 Description : Dialog to specify filters for VTK viewer
+ */
 
 class SMESHGUI_FilterDlg : public QDialog
-{ 
+{
   Q_OBJECT
 
   // Source elements to be selected
   enum { Mesh, Selection, Dialog, None };
-  
+
   // Buttons
   enum { BTN_OK, BTN_Cancel, BTN_Apply, BTN_Close };
 
 public:
-                            SMESHGUI_FilterDlg( QWidget*               parent,
+                            SMESHGUI_FilterDlg( SMESHGUI*,
                                                 const QValueList<int>& types,
-                                                const char*            name = 0 );
-                                                
-                            SMESHGUI_FilterDlg( QWidget*               parent,
+                                                const char*            name = 0);
+
+                            SMESHGUI_FilterDlg( SMESHGUI*,
                                                 const int              type,
-                                                const char*            name = 0 );                                                    
+                                                const char*            name = 0);
   virtual                   ~SMESHGUI_FilterDlg();
 
-  void                      Init( const QValueList<int>& types );
-  void                      Init( const int type );
+  void                      Init (const QValueList<int>& types);
+  void                      Init (const int type);
 
-  void                      SetSelection( SALOME_Selection* );
-  void                      SetMesh( SMESH::SMESH_Mesh_ptr );
-  void                      SetSourceWg( QWidget* );
+  void                      SetSelection();
+  void                      SetMesh (SMESH::SMESH_Mesh_ptr);
+  void                      SetSourceWg (QWidget*);
 
   static SMESH::Filter::Criterion createCriterion();
 
@@ -239,35 +241,35 @@ private slots:
   void                      onClose();
   void                      onDeactivate();
   void                      onSelectionDone();
-  void                      onCriterionChanged( const int, const int );
-  void                      onCurrentChanged( int, int );
-  
+  void                      onCriterionChanged (const int, const int);
+  void                      onCurrentChanged (int, int);
+
 private:
 
-  void                      construct( const QValueList<int>& types ); 
+  void                      construct (const QValueList<int>& types); 
 
-  void                      closeEvent( QCloseEvent* e );
-  void                      enterEvent ( QEvent * );
+  void                      closeEvent (QCloseEvent*);
+  void                      enterEvent (QEvent*);
 
   // dialog creation
-  QFrame*                   createButtonFrame( QWidget* );
-  QFrame*                   createMainFrame( QWidget* );
-  QButtonGroup*             createSourceGroup( QWidget* );
+  QFrame*                   createButtonFrame (QWidget*);
+  QFrame*                   createMainFrame (QWidget*);
+  QButtonGroup*             createSourceGroup (QWidget*);
   void                      updateMainButtons();
-  
+
   // execution
   bool                      isValid() const;
-  bool                      createFilter( const int theType );
+  bool                      createFilter (const int theType);
   void                      insertFilterInViewer();
-  void                      selectInViewer( const int theType,
-                                            const QValueList<int>& theIds );
-  void                      filterSource( const int            theType,
-                                          QValueList<int>&     theResIds );
-  void                      filterSelectionSource( const int            theType,
-                                                   QValueList<int>&     theResIds );
-  void                      getIdsFromWg( const QWidget*, QValueList<int>& ) const;
-  void                      setIdsToWg( QWidget*, const QValueList<int>& );
-  Selection_Mode            getSelMode( const int ) const;
+  void                      selectInViewer (const int              theType,
+                                            const QValueList<int>& theIds);
+  void                      filterSource (const int        theType,
+                                          QValueList<int>& theResIds);
+  void                      filterSelectionSource (const int        theType,
+                                                   QValueList<int>& theResIds);
+  void                      getIdsFromWg (const QWidget*, QValueList<int>&) const;
+  void                      setIdsToWg (QWidget*, const QValueList<int>&);
+  Selection_Mode            getSelMode (const int) const;
   void                      updateSelection();
 
 private:
@@ -285,7 +287,9 @@ private:
   // initial fields
   QValueList<int>           myTypes;
   SMESHGUI*                 mySMESHGUI;
-  SALOME_Selection*         mySelection;
+  SalomeApp_SelectionMgr*   mySelectionMgr;
+  SVTK_Selector*            mySelector;
+  SVTK_ViewWindow*          myViewWindow;
   SMESH::SMESH_Mesh_ptr     myMesh;
   QWidget*                  mySourceWg;
 
@@ -297,23 +301,3 @@ private:
 };
 
 #endif
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
index c5db4023101a6fb79dc95fc13baad8f273e49a37..e8fffa426b58d3ca126db28b26519f90bd0196c9 100644 (file)
@@ -1,23 +1,23 @@
 //  SMESH SMESHGUI : GUI for SMESH component
 //
 //  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
-// 
-//  This library is free software; you can redistribute it and/or 
-//  modify it under the terms of the GNU Lesser General Public 
-//  License as published by the Free Software Foundation; either 
-//  version 2.1 of the License. 
-// 
-//  This library is distributed in the hope that it will be useful, 
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of 
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
-//  Lesser General Public License for more details. 
-// 
-//  You should have received a copy of the GNU Lesser General Public 
-//  License along with this library; if not, write to the Free Software 
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
-// 
-//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
 //
 //
 //
 //  Module : SMESH
 
 #include "SMESHGUI_FilterLibraryDlg.h"
+
 #include "SMESHGUI.h"
 #include "SMESHGUI_Utils.h"
 #include "SMESHGUI_FilterUtils.h"
 
-#include <QAD_Desktop.h>
-#include <QAD_FileDlg.h>
+#include "SUIT_Session.h"
+#include "SUIT_Desktop.h"
+#include "SUIT_FileDlg.h"
 
+// QT Includes
 #include <qapplication.h>
 #include <qmessagebox.h>
 #include <qframe.h>
 #define SPACING 5
 #define MARGIN  10
 
-/*
-  Class       : SMESHGUI_FilterLibraryDlg::Dialog
-  Description : Dialog for opening filter library
-*/
+/*!
 Class       : SMESHGUI_FilterLibraryDlg::Dialog
 Description : Dialog for opening filter library
+ */
 
-class SMESHGUI_FilterLibraryDlg::Dialog : public QAD_FileDlg
+class SMESHGUI_FilterLibraryDlg::Dialog : public SUIT_FileDlg
 {
-public:
-  Dialog( QWidget* theParent, const bool theToOpen );
+ public:
+  Dialog(QWidget* theParent, const bool theToOpen);
   virtual ~Dialog();
-  
-protected:
+
+ protected:
   virtual bool acceptData();
 };
 
-SMESHGUI_FilterLibraryDlg::Dialog::Dialog( QWidget*                 theParent,
-                                           const bool               theToOpen )
-: QAD_FileDlg( theParent, theToOpen )
+SMESHGUI_FilterLibraryDlg::Dialog::Dialog (QWidget*   theParent,
+                                           const bool theToOpen)
+     : SUIT_FileDlg(theParent, theToOpen)
 {
 }
 
@@ -76,148 +79,150 @@ SMESHGUI_FilterLibraryDlg::Dialog::~Dialog()
 
 bool SMESHGUI_FilterLibraryDlg::Dialog::acceptData()
 {
-  if ( mode() != QFileDialogP::AnyFile )
-    return QAD_FileDlg::acceptData();
-  else
-    return true;
-}
+#ifdef NEW_GUI
+  if (mode() != QFileDialogP::AnyFile)
+    return SUIT_FileDlg::acceptData();
+#endif
 
+  return true;
+}
 
-/*
-  Class       : SMESHGUI_FilterLibraryDlg
-  Description : Dialog to specify filters for VTK viewer
-*/
+/*!
 Class       : SMESHGUI_FilterLibraryDlg
 Description : Dialog to specify filters for VTK viewer
+ */
 
 //=======================================================================
 // name    : SMESHGUI_FilterLibraryDlg::SMESHGUI_FilterLibraryDlg
 // Purpose : Constructor
 //=======================================================================
-SMESHGUI_FilterLibraryDlg::SMESHGUI_FilterLibraryDlgQWidget*               theParent,
+SMESHGUI_FilterLibraryDlg::SMESHGUI_FilterLibraryDlg (QWidget*               theParent,
                                                       const QValueList<int>& theTypes,
                                                       const int              theMode,
-                                                      const char*            theName )
-: QDialog( theParent, theName, true,
-           WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
+                                                      const char*            theName)
+     : QDialog(theParent, theName, true, WStyle_Customize |
+               WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu)
 {
-  construct( theTypes, theMode );
+  construct(theTypes, theMode);
 }
 
 //=======================================================================
 // name    : SMESHGUI_FilterLibraryDlg::SMESHGUI_FilterLibraryDlg
 // Purpose : Constructor
 //=======================================================================
-SMESHGUI_FilterLibraryDlg::SMESHGUI_FilterLibraryDlgQWidget*    theParent,
+SMESHGUI_FilterLibraryDlg::SMESHGUI_FilterLibraryDlg (QWidget*    theParent,
                                                       const int   theType,
                                                       const int   theMode,
-                                                      const char* theName )
-: QDialog( theParent, theName, true,
-           WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
+                                                      const char* theName)
+     : QDialog(theParent, theName, true, WStyle_Customize |
+               WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu)
 {
   QValueList<int> aTypes;
-  aTypes.append( theType );
-  construct( aTypes, theMode );
+  aTypes.append(theType);
+  construct(aTypes, theMode);
 }
 
 //=======================================================================
 // name    : SMESHGUI_FilterLibraryDlg::construct
-// Purpose : Construct dialog ( called by constructor )
+// Purpose : Construct dialog (called by constructor)
 //=======================================================================
-void SMESHGUI_FilterLibraryDlg::construct( const QValueList<int>& theTypes, const int theMode )
+void SMESHGUI_FilterLibraryDlg::construct (const QValueList<int>& theTypes,
+                                           const int theMode)
 {
   myTypes = theTypes;
   myMode  = theMode;
 
-  QVBoxLayout* aDlgLay = new QVBoxLayout( this, MARGIN, SPACING );
+  QVBoxLayout* aDlgLay = new QVBoxLayout(this, MARGIN, SPACING);
 
-  myMainFrame        = createMainFrame  ( this );
-  QFrame* aBtnFrame  = createButtonFrame( this );
+  myMainFrame        = createMainFrame  (this);
+  QFrame* aBtnFrame  = createButtonFrame(this);
 
-  aDlgLay->addWidget( myMainFrame );
-  aDlgLay->addWidget( aBtnFrame );
+  aDlgLay->addWidget(myMainFrame);
+  aDlgLay->addWidget(aBtnFrame);
 
-  aDlgLay->setStretchFactor( myMainFrame, 1 );
+  aDlgLay->setStretchFactor(myMainFrame, 1);
 
-  Init( myTypes, myMode );
+  Init(myTypes, myMode);
 }
 
 //=======================================================================
 // name    : SMESHGUI_FilterLibraryDlg::createMainFrame
 // Purpose : Create frame containing dialog's input fields
 //=======================================================================
-QFrame* SMESHGUI_FilterLibraryDlg::createMainFrame( QWidget* theParent )
+QFrame* SMESHGUI_FilterLibraryDlg::createMainFrame (QWidget* theParent)
 {
-  QGroupBox* aMainFrame = new QGroupBox( 1, Qt::Horizontal, theParent );
-  aMainFrame->setFrameStyle( QFrame::NoFrame );
-  aMainFrame->setInsideMargin( 0 );
+  QGroupBox* aMainFrame = new QGroupBox(1, Qt::Horizontal, theParent);
+  aMainFrame->setFrameStyle(QFrame::NoFrame);
+  aMainFrame->setInsideMargin(0);
 
   // library name
-  
-  QGroupBox* aGrp = new QGroupBox( 1, Qt::Vertical, aMainFrame );
-  aGrp->setFrameStyle( QFrame::NoFrame );
-  aGrp->setInsideMargin( 0 );
-  
-  new QLabel( tr( "LIBRARY_FILE" ), aGrp );
-  myFileName = new QLineEdit( aGrp );
-  myOpenBtn = new QPushButton( aGrp );
-  myOpenBtn->setPixmap( QAD_Desktop::getResourceManager()->loadPixmap( 
-    "QAD", tr("ICON_FILE_OPEN") ) );
-  
+
+  QGroupBox* aGrp = new QGroupBox(1, Qt::Vertical, aMainFrame);
+  aGrp->setFrameStyle(QFrame::NoFrame);
+  aGrp->setInsideMargin(0);
+
+  new QLabel(tr("LIBRARY_FILE"), aGrp);
+  myFileName = new QLineEdit(aGrp);
+  myOpenBtn = new QPushButton(aGrp);
+  myOpenBtn->setPixmap(SUIT_Session::session()->resourceMgr()->loadPixmap(
+    "SUIT", tr("ICON_FILE_OPEN")));
+
   // filters list box
-  
-  aGrp = new QGroupBox( 1, Qt::Vertical, tr( "FILTER_NAMES" ), aMainFrame );
-  QFrame* aFrame = new QFrame( aGrp );
-  myListBox = new QListBox( aFrame );
-  myAddBtn = new QPushButton( tr( "ADD" ), aFrame );
-  myDeleteBtn = new QPushButton( tr( "DELETE" ), aFrame );
-
-  QGridLayout* aLay = new QGridLayout( aFrame, 3, 2, 0, 5 );
-  aLay->addMultiCellWidget( myListBox, 0, 2, 0, 0 );
-  aLay->addWidget( myAddBtn, 0, 1 );
-  aLay->addWidget( myDeleteBtn, 1, 1 );
-  QSpacerItem* aVSpacer = new QSpacerItem( 0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding );
-  aLay->addItem( aVSpacer, 2, 1 );
+
+  aGrp = new QGroupBox(1, Qt::Vertical, tr("FILTER_NAMES"), aMainFrame);
+  QFrame* aFrame = new QFrame(aGrp);
+  myListBox = new QListBox(aFrame);
+  myAddBtn = new QPushButton(tr("ADD"), aFrame);
+  myDeleteBtn = new QPushButton(tr("DELETE"), aFrame);
+
+  QGridLayout* aLay = new QGridLayout(aFrame, 3, 2, 0, 5);
+  aLay->addMultiCellWidget(myListBox, 0, 2, 0, 0);
+  aLay->addWidget(myAddBtn, 0, 1);
+  aLay->addWidget(myDeleteBtn, 1, 1);
+  QSpacerItem* aVSpacer = new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding);
+  aLay->addItem(aVSpacer, 2, 1);
 
   // filter name
-  
-  myNameGrp = new QGroupBox( 1, Qt::Vertical, aMainFrame );
-  myNameGrp->setFrameStyle( QFrame::NoFrame );
-  myNameGrp->setInsideMargin( 0 );
-  new QLabel( tr( "FILTER_NAME" ), myNameGrp );
-  myName = new QLineEdit( myNameGrp );
+
+  myNameGrp = new QGroupBox(1, Qt::Vertical, aMainFrame);
+  myNameGrp->setFrameStyle(QFrame::NoFrame);
+  myNameGrp->setInsideMargin(0);
+  new QLabel(tr("FILTER_NAME"), myNameGrp);
+  myName = new QLineEdit(myNameGrp);
 
   // table
-  
-  myTable = new SMESHGUI_FilterTable( aMainFrame, myTypes );
-  myTable->SetEditable( myMode == EDIT );
-  myTable->SetLibsEnabled( false );
 
-  myListBox->setMinimumHeight( ( int )( myTable->sizeHint().height() * 0.5 ) );
-  myListBox->setRowMode( QListBox::FitToWidth );
-  myListBox->setSelectionMode( QListBox::Single );
+  myTable = new SMESHGUI_FilterTable(aMainFrame, myTypes);
+  myTable->SetEditable(myMode == EDIT);
+  myTable->SetLibsEnabled(false);
 
-  myOpenBtn->setAutoDefault( false );
-  myAddBtn->setAutoDefault( false );
-  myDeleteBtn->setAutoDefault( false );
+  myListBox->setMinimumHeight((int)(myTable->sizeHint().height() * 0.5));
+  myListBox->setRowMode(QListBox::FitToWidth);
+  myListBox->setSelectionMode(QListBox::Single);
+
+  myOpenBtn->setAutoDefault(false);
+  myAddBtn->setAutoDefault(false);
+  myDeleteBtn->setAutoDefault(false);
 
   // connect signals and slots
-  
-  connect( myFileName, SIGNAL( returnPressed() ), this, SLOT( onReturnPressed() ) );
-  connect( myOpenBtn , SIGNAL( clicked() ), this, SLOT( onBrowse() ) );
 
-  connect( myListBox, SIGNAL( highlighted( const QString& ) ),
-           this, SLOT( onFilterChanged( const QString& ) ) );
+  connect(myFileName, SIGNAL(returnPressed()), this, SLOT(onReturnPressed()));
+  connect(myOpenBtn , SIGNAL(clicked()), this, SLOT(onBrowse()));
+
+  connect(myListBox, SIGNAL(highlighted(const QString&)),
+           this, SLOT(onFilterChanged(const QString&)));
 
-  connect( myAddBtn, SIGNAL( clicked() ), this, SLOT( onAddBtnPressed() ) );
-  connect( myDeleteBtn, SIGNAL( clicked() ), this, SLOT( onDeleteBtnPressed() ) );
+  connect(myAddBtn, SIGNAL(clicked()), this, SLOT(onAddBtnPressed()));
+  connect(myDeleteBtn, SIGNAL(clicked()), this, SLOT(onDeleteBtnPressed()));
 
-  connect( myName, SIGNAL( textChanged( const QString& ) ),
-           this, SLOT( onFilterNameChanged( const QString& ) ) );
+  connect(myName, SIGNAL(textChanged(const QString&)),
+           this, SLOT(onFilterNameChanged(const QString&)));
 
-  connect( myTable, SIGNAL( EntityTypeChanged( const int ) ),
-           this, SLOT( onEntityTypeChanged( const int ) ) );
+  connect(myTable, SIGNAL(EntityTypeChanged(const int)),
+           this, SLOT(onEntityTypeChanged(const int)));
+
+  connect(myTable, SIGNAL(NeedValidation()), this, SLOT(onNeedValidation()));
 
-  connect( myTable, SIGNAL( NeedValidation() ), this, SLOT( onNeedValidation() ) );
-           
   return aMainFrame;
 }
 
@@ -225,27 +230,27 @@ QFrame* SMESHGUI_FilterLibraryDlg::createMainFrame( QWidget* theParent )
 // name    : SMESHGUI_FilterLibraryDlg::createButtonFrame
 // Purpose : Create frame containing buttons
 //=======================================================================
-QFrame* SMESHGUI_FilterLibraryDlg::createButtonFrame( QWidget* theParent )
+QFrame* SMESHGUI_FilterLibraryDlg::createButtonFrame (QWidget* theParent)
 {
-  QGroupBox* aGrp = new QGroupBox( 1, Qt::Vertical, theParent );
+  QGroupBox* aGrp = new QGroupBox(1, Qt::Vertical, theParent);
 
-  myButtons[ BTN_OK    ] = new QPushButton( tr( "SMESH_BUT_OK"    ), aGrp );
-  myButtons[ BTN_Apply ] = new QPushButton( tr( "SMESH_BUT_APPLY" ), aGrp );
+  myButtons[ BTN_OK    ] = new QPushButton(tr("SMESH_BUT_OK"   ), aGrp);
+  myButtons[ BTN_Apply ] = new QPushButton(tr("SMESH_BUT_APPLY"), aGrp);
 
-  QLabel* aLbl = new QLabel( aGrp );
-  aLbl->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
+  QLabel* aLbl = new QLabel(aGrp);
+  aLbl->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed));
 
-  myButtons[ BTN_Cancel ] = new QPushButton( tr( "SMESH_BUT_CANCEL" ), aGrp );
-  myButtons[ BTN_Close  ] = new QPushButton( tr( "SMESH_BUT_CLOSE" ), aGrp );
+  myButtons[ BTN_Cancel ] = new QPushButton(tr("SMESH_BUT_CANCEL"), aGrp);
+  myButtons[ BTN_Close  ] = new QPushButton(tr("SMESH_BUT_CLOSE"), aGrp);
 
-  connect( myButtons[ BTN_OK     ], SIGNAL( clicked() ), SLOT( onOk() ) );
-  connect( myButtons[ BTN_Cancel ], SIGNAL( clicked() ), SLOT( onClose() ) ) ;
-  connect( myButtons[ BTN_Close  ], SIGNAL( clicked() ), SLOT( onClose() ) ) ;
-  connect( myButtons[ BTN_Apply  ], SIGNAL( clicked() ), SLOT( onApply() ) );
+  connect(myButtons[ BTN_OK     ], SIGNAL(clicked()), SLOT(onOk()));
+  connect(myButtons[ BTN_Cancel ], SIGNAL(clicked()), SLOT(onClose()));
+  connect(myButtons[ BTN_Close  ], SIGNAL(clicked()), SLOT(onClose()));
+  connect(myButtons[ BTN_Apply  ], SIGNAL(clicked()), SLOT(onApply()));
 
   QMap<int, QPushButton*>::iterator anIter;
-  for ( anIter = myButtons.begin(); anIter != myButtons.end(); ++anIter )
-    anIter.data()->setAutoDefault( false );
+  for (anIter = myButtons.begin(); anIter != myButtons.end(); ++anIter)
+    anIter.data()->setAutoDefault(false);
 
   updateMainButtons();
 
@@ -254,18 +259,15 @@ QFrame* SMESHGUI_FilterLibraryDlg::createButtonFrame( QWidget* theParent )
 
 //=======================================================================
 // name    : SMESHGUI_FilterLibraryDlg::updateMainButtons
-// Purpose : Update visibility of main buttons ( OK, Cancel, Close ... )
+// Purpose : Update visibility of main buttons (OK, Cancel, Close ...)
 //=======================================================================
 void SMESHGUI_FilterLibraryDlg::updateMainButtons()
 {
-  if ( myTypes.count() == 1 )
-  {
+  if (myTypes.count() == 1) {
     myButtons[ BTN_Cancel ]->show();
     myButtons[ BTN_Apply  ]->hide();
     myButtons[ BTN_Close  ]->hide();
-  }
-  else
-  {
+  } else {
     myButtons[ BTN_Cancel ]->hide();
     myButtons[ BTN_Apply  ]->show();
     myButtons[ BTN_Close  ]->show();
@@ -284,70 +286,71 @@ SMESHGUI_FilterLibraryDlg::~SMESHGUI_FilterLibraryDlg()
 // name    : SMESHGUI_FilterLibraryDlg::Init
 // Purpose : Init dialog fields, connect signals and slots, show dialog
 //=======================================================================
-void SMESHGUI_FilterLibraryDlg::Init( const int type, const int theMode )
+void SMESHGUI_FilterLibraryDlg::Init (const int type, const int theMode)
 {
   QValueList<int> aTypes;
-  aTypes.append( type );
-  Init( aTypes, theMode );
+  aTypes.append(type);
+  Init(aTypes, theMode);
 }
 
 //=======================================================================
 // name    : SMESHGUI_FilterLibraryDlg::Init
 // Purpose : Init dialog fields, connect signals and slots, show dialog
 //=======================================================================
-void SMESHGUI_FilterLibraryDlg::Init( const QValueList<int>& theTypes, const int theMode )
+void SMESHGUI_FilterLibraryDlg::Init (const QValueList<int>& theTypes,
+                                      const int theMode)
 {
   myMode = theMode;
   myTypes = theTypes;
-  myTable->Init( theTypes );
+  myTable->Init(theTypes);
   myCurrFilterName = "";
   myCurrFilter = -1;
   myListBox->clear();
   myName->clear();
   myTable->Clear();
-  
+
   updateControlsVisibility();
-  setEnabled( true );
+  setEnabled(true);
 
   SMESHGUI* aModeler = SMESHGUI::GetSMESHGUI();
 
-  connect( aModeler, SIGNAL( SignalDeactivateActiveDialog() ), SLOT( onDeactivate() ) );
-  connect( aModeler, SIGNAL( SignalCloseAllDialogs() ), SLOT( onClose() ) );
+  connect(aModeler, SIGNAL(SignalDeactivateActiveDialog()), SLOT(onDeactivate()));
+  connect(aModeler, SIGNAL(SignalCloseAllDialogs()), SLOT(onClose()));
 
-  if ( myMode == ADD_TO )
+  if (myMode == ADD_TO)
   {
-    setCaption( tr( "ADD_TO_TLT" ) );
-    if ( myFileName->text().isEmpty() )
-      myFileName->setText( getDefaultLibraryName() );
+    setCaption(tr("ADD_TO_TLT"));
+    if (myFileName->text().isEmpty())
+      myFileName->setText(getDefaultLibraryName());
     processNewLibrary();
   }
-  else if ( myMode == COPY_FROM )
+  else if (myMode == COPY_FROM)
   {
-    setCaption( tr( "COPY_FROM_TLT" ) );
-    if ( myFileName->text().isEmpty() )
-      myFileName->setText( getDefaultLibraryName() );
+    setCaption(tr("COPY_FROM_TLT"));
+    if (myFileName->text().isEmpty())
+      myFileName->setText(getDefaultLibraryName());
     processNewLibrary();
-    if ( myListBox->count() > 0 )
-      myListBox->setCurrentItem( 0 );
+    if (myListBox->count() > 0)
+      myListBox->setCurrentItem(0);
   }
   else
   {
-    setCaption( tr( "EDIT_LIB_TLT" ) );
-    if ( myFileName->text().isEmpty() )
-      myFileName->setText( getDefaultLibraryName() );
+    setCaption(tr("EDIT_LIB_TLT"));
+    if (myFileName->text().isEmpty())
+      myFileName->setText(getDefaultLibraryName());
     processNewLibrary();
-    if ( myListBox->count() > 0 )
-      myListBox->setCurrentItem( 0 );
+    if (myListBox->count() > 0)
+      myListBox->setCurrentItem(0);
   }
 
-  int x, y ;
-  aModeler->DefineDlgPosition( this, x, y );
-  this->move( x, y );
+  int x, y;
+  aModeler->DefineDlgPosition(this, x, y);
+  this->move(x, y);
 
   this->show();
 
   updateMainButtons();
-  isPermissionValid( false );
+  isPermissionValid(false);
 }
 
 //=======================================================================
@@ -356,29 +359,29 @@ void SMESHGUI_FilterLibraryDlg::Init( const QValueList<int>& theTypes, const int
 //=======================================================================
 void SMESHGUI_FilterLibraryDlg::updateControlsVisibility()
 {
-  if ( myMode == ADD_TO )
+  if (myMode == ADD_TO)
   {
     myNameGrp->show();
-    myNameGrp->setEnabled( true );
+    myNameGrp->setEnabled(true);
     myAddBtn->hide();
     myDeleteBtn->hide();
-    myTable->SetEditable( false );
+    myTable->SetEditable(false);
   }
-  else if ( myMode == COPY_FROM )
+  else if (myMode == COPY_FROM)
   {
     myNameGrp->hide();
-    myNameGrp->setEnabled( false );
+    myNameGrp->setEnabled(false);
     myAddBtn->hide();
     myDeleteBtn->hide();
-    myTable->SetEditable( false );
+    myTable->SetEditable(false);
   }
-  else if ( myMode == EDIT )
+  else if (myMode == EDIT)
   {
     myNameGrp->show();
-    myNameGrp->setEnabled( true );
+    myNameGrp->setEnabled(true);
     myAddBtn->show();
     myDeleteBtn->show();
-    myTable->SetEditable( true );
+    myTable->SetEditable(true);
   }
 
   qApp->processEvents();
@@ -392,52 +395,46 @@ void SMESHGUI_FilterLibraryDlg::updateControlsVisibility()
 //=======================================================================
 bool SMESHGUI_FilterLibraryDlg::onApply()
 {
-  if ( !isValid( true ) || !isPermissionValid( false ) )
+  if (!isValid(true) || !isPermissionValid(false))
     return false;
 
-  if ( myLibrary->_is_nil() )
-  {
-    QMessageBox::information( SMESHGUI::GetSMESHGUI()->GetDesktop(),
-      tr( "SMESH_WRN_WARNING" ), tr( "LIBRARY_IS_NOT_LOADED" ), QMessageBox::Ok );
+  if (myLibrary->_is_nil()) {
+    QMessageBox::information(SMESHGUI::desktop(), tr("SMESH_WRN_WARNING"),
+                             tr("LIBRARY_IS_NOT_LOADED"), QMessageBox::Ok);
     return false;
   }
 
   const char* aName = myFileName->text().latin1();
-  if ( strcmp( myLibrary->GetFileName(), aName ) != 0 )
-    myLibrary->SetFileName( aName );
+  if (strcmp(myLibrary->GetFileName(), aName) != 0)
+    myLibrary->SetFileName(aName);
 
   bool aResult = false;
 
-  if ( myMode == COPY_FROM || myListBox->count() == 0 )
-  {
+  if (myMode == COPY_FROM || myListBox->count() == 0) {
     aResult = true;
-  }
-  else if ( myMode == EDIT || myMode == ADD_TO )
-  {
+  } else if (myMode == EDIT || myMode == ADD_TO) {
     SMESH::Filter_var aFilter = createFilter();
-    if ( !myLibrary->Replace( myCurrFilterName, myName->text(), aFilter.in() ) )
-    {
-      QMessageBox::information( SMESHGUI::GetSMESHGUI()->GetDesktop(),
-        tr( "SMESH_ERROR" ), tr( "ERROR_OF_EDITING" ), QMessageBox::Ok );
+    if (!myLibrary->Replace(myCurrFilterName, myName->text(), aFilter.in())) {
+      QMessageBox::information(SMESHGUI::desktop(), tr("SMESH_ERROR"),
+                               tr("ERROR_OF_EDITING"), QMessageBox::Ok);
       aResult = false;
     }
     else
       aResult = true;
   }
 
-  if ( aResult && myMode != COPY_FROM )
+  if (aResult && myMode != COPY_FROM)
     aResult = myLibrary->Save();
 
-  if ( aResult )
-  {
+  if (aResult) {
     char* aFileName = myLibrary->GetFileName();
-    getDefaultLibraryName() = QString( aFileName );
+    getDefaultLibraryName() = QString(aFileName);
     delete aFileName;
+  } else if (myMode != COPY_FROM) {
+    QMessageBox::information(SMESHGUI::desktop(), tr("SMESH_ERROR"),
+                             tr("ERROR_OF_SAVING"), QMessageBox::Ok);
+  } else {
   }
-  else if ( myMode != COPY_FROM )
-    QMessageBox::information( SMESHGUI::GetSMESHGUI()->GetDesktop(),
-      tr( "SMESH_ERROR" ), tr( "ERROR_OF_SAVING" ), QMessageBox::Ok );
-  
 
   return aResult;
 }
@@ -449,10 +446,10 @@ bool SMESHGUI_FilterLibraryDlg::onApply()
 //=======================================================================
 void SMESHGUI_FilterLibraryDlg::onOk()
 {
-  if ( onApply() )
+  if (onApply())
   {
-    disconnect( SMESHGUI::GetSMESHGUI(), 0, this, 0 );
-    SMESHGUI::GetSMESHGUI()->ResetState() ;
+    disconnect(SMESHGUI::GetSMESHGUI(), 0, this, 0);
+    SMESHGUI::GetSMESHGUI()->ResetState();
     accept();
   }
 }
@@ -463,9 +460,9 @@ void SMESHGUI_FilterLibraryDlg::onOk()
 //=======================================================================
 void SMESHGUI_FilterLibraryDlg::onClose()
 {
-  disconnect( SMESHGUI::GetSMESHGUI(), 0, this, 0 );
-  SMESHGUI::GetSMESHGUI()->ResetState() ;
-  reject() ;
+  disconnect(SMESHGUI::GetSMESHGUI(), 0, this, 0);
+  SMESHGUI::GetSMESHGUI()->ResetState();
+  reject();
 }
 
 //=======================================================================
@@ -474,25 +471,25 @@ void SMESHGUI_FilterLibraryDlg::onClose()
 //=======================================================================
 void SMESHGUI_FilterLibraryDlg::onDeactivate()
 {
-  setEnabled( false );
+  setEnabled(false);
 }
 
 //=======================================================================
 // name    : SMESHGUI_FilterLibraryDlg::enterEvent
 // Purpose : Event filter
 //=======================================================================
-void SMESHGUI_FilterLibraryDlg::enterEvent( QEvent* )
+void SMESHGUI_FilterLibraryDlg::enterEvent(QEvent*)
 {
-  setEnabled( true );
+  setEnabled(true);
 }
 
 //=================================================================================
 // function : closeEvent()
 // purpose  : Close dialog
 //=================================================================================
-void SMESHGUI_FilterLibraryDlg::closeEvent( QCloseEvent* e )
+void SMESHGUI_FilterLibraryDlg::closeEvent(QCloseEvent* e)
 {
-  onClose() ;
+  onClose();
 }
 
 //=======================================================================
@@ -508,20 +505,20 @@ QString SMESHGUI_FilterLibraryDlg::getFileName() const
 // Function : setFileName
 // Purpose  : Set file name to line edit
 //================================================================
-void SMESHGUI_FilterLibraryDlg::setFileName( const QString& txt, const bool autoExt )
+void SMESHGUI_FilterLibraryDlg::setFileName(const QString& txt, const bool autoExt)
 {
-  if ( myFileName == 0 )
+  if (myFileName == 0)
     return;
-  myFileName->setText( autoExt ? autoExtension( txt ) : txt );
+  myFileName->setText(autoExt ? autoExtension(txt) : txt);
 }
 
 //================================================================
 // Function : autoExtension
 // Purpose  : Append extension to the file name
 //================================================================
-QString SMESHGUI_FilterLibraryDlg::autoExtension( const QString& theFileName ) const
+QString SMESHGUI_FilterLibraryDlg::autoExtension(const QString& theFileName) const
 {
-  QString anExt = theFileName.section( '.', -1 );
+  QString anExt = theFileName.section('.', -1);
   return anExt != "xml" && anExt != "XML" ? theFileName + ".xml" : theFileName;
 }
 
@@ -529,19 +526,19 @@ QString SMESHGUI_FilterLibraryDlg::autoExtension( const QString& theFileName ) c
 // Function : filterWildCards
 // Purpose  :
 //================================================================
-QStringList SMESHGUI_FilterLibraryDlg::filterWildCards( const QString& theFilter ) const
+QStringList SMESHGUI_FilterLibraryDlg::filterWildCards(const QString& theFilter) const
 {
   QStringList res;
 
-  int b = theFilter.findRev( "(" );
-  int e = theFilter.findRev( ")" );
-  if ( b != -1 && e != -1 )
+  int b = theFilter.findRev("(");
+  int e = theFilter.findRev(")");
+  if (b != -1 && e != -1)
   {
-    QString content = theFilter.mid( b + 1, e - b - 1 ).stripWhiteSpace();
-    QStringList lst = QStringList::split( " ", content );
-    for ( QStringList::const_iterator it = lst.begin(); it != lst.end(); ++it )
-      if ( (*it).find( "." ) != -1 )
-        res.append( (*it).stripWhiteSpace() );
+    QString content = theFilter.mid(b + 1, e - b - 1).stripWhiteSpace();
+    QStringList lst = QStringList::split(" ", content);
+    for (QStringList::const_iterator it = lst.begin(); it != lst.end(); ++it)
+      if ((*it).find(".") != -1)
+        res.append((*it).stripWhiteSpace());
   }
   return res;
 }
@@ -553,10 +550,10 @@ QStringList SMESHGUI_FilterLibraryDlg::filterWildCards( const QString& theFilter
 QStringList SMESHGUI_FilterLibraryDlg::prepareFilters() const
 {
   static QStringList aList;
-  if ( aList.isEmpty() )
+  if (aList.isEmpty())
   {
-    aList.append( tr( "XML_FILT" ) );
-    //aList.append( tr( "ALL_FILES_FILTER" ) );
+    aList.append(tr("XML_FILT"));
+    //aList.append(tr("ALL_FILES_FILTER"));
   }
 
   return aList;
@@ -568,48 +565,49 @@ QStringList SMESHGUI_FilterLibraryDlg::prepareFilters() const
 //================================================================
 void SMESHGUI_FilterLibraryDlg::onBrowse()
 {
-  Dialog* aDlg = new Dialog( this, true );
-  aDlg->setCaption( tr( "OPEN_LIBRARY" ) );
+  Dialog* aDlg = new Dialog(this, true);
+  aDlg->setCaption(tr("OPEN_LIBRARY"));
 
-  aDlg->setMode( myMode == COPY_FROM ? QFileDialogP::ExistingFile : QFileDialogP::AnyFile );
-  aDlg->setFilters( prepareFilters() );
-  aDlg->setSelection( getFileName() );
+  //aDlg->setMode(myMode == COPY_FROM ? QFileDialogP::ExistingFile : QFileDialogP::AnyFile);
+  aDlg->setMode(myMode == COPY_FROM ? QFileDialog::ExistingFile : QFileDialog::AnyFile);
+  aDlg->setFilters(prepareFilters());
+  aDlg->setSelection(getFileName());
 
-  QPushButton* anOkBtn = ( QPushButton* )aDlg->child( "OK", "QPushButton" );
-  if ( anOkBtn != 0 )
-    anOkBtn->setText( tr( "SMESH_BUT_OK" ) );
+  QPushButton* anOkBtn = (QPushButton*)aDlg->child("OK", "QPushButton");
+  if (anOkBtn != 0)
+    anOkBtn->setText(tr("SMESH_BUT_OK"));
 
-  if ( aDlg->exec() != Accepted )
+  if (aDlg->exec() != Accepted)
     return;
 
   QString fName = aDlg->selectedFile();
 
-  if ( fName.isEmpty() )
+  if (fName.isEmpty())
     return;
 
-  if ( QFileInfo( fName ).extension().isEmpty() )
-    fName = autoExtension( fName );
+  if (QFileInfo(fName).extension().isEmpty())
+    fName = autoExtension(fName);
 
-  fName = QDir::convertSeparators( fName );
-  QString prev = QDir::convertSeparators( getFileName() );
+  fName = QDir::convertSeparators(fName);
+  QString prev = QDir::convertSeparators(getFileName());
 
-  if ( prev == fName )
+  if (prev == fName)
     return;
 
-  setFileName( fName );
+  setFileName(fName);
 
-  QString aName = myListBox->text( myListBox->count() - 1 );
+  QString aName = myListBox->text(myListBox->count() - 1);
   processNewLibrary();
 
-  if ( myMode == ADD_TO )
+  if (myMode == ADD_TO)
   {
-    myTable->Copy( (SMESHGUI_FilterTable*)parentWidget() );
+    myTable->Copy((SMESHGUI_FilterTable*)parentWidget());
     myCurrFilterName = "";
     myCurrFilter = -1;
-    addFilterToLib( aName );
+    addFilterToLib(aName);
   }
 
-  isPermissionValid( false );
+  isPermissionValid(false);
 }
 
 //=======================================================================
@@ -619,22 +617,18 @@ void SMESHGUI_FilterLibraryDlg::onBrowse()
 void SMESHGUI_FilterLibraryDlg::processNewLibrary()
 {
   SMESH::FilterManager_var aFilterMgr = SMESH::GetFilterManager();
-  if ( aFilterMgr->_is_nil() )
+  if (aFilterMgr->_is_nil())
     return;
 
-  myLibrary = aFilterMgr->LoadLibrary( autoExtension( getFileName() ) );
-  if ( myLibrary->_is_nil() )
-  {
-    if ( myMode == COPY_FROM )
-    {
-      QMessageBox::information( SMESHGUI::GetSMESHGUI()->GetDesktop(),
-        tr( "SMESH_ERROR" ), tr( "ERROR_LOAD" ), QMessageBox::Ok );
+  myLibrary = aFilterMgr->LoadLibrary(autoExtension(getFileName()));
+  if (myLibrary->_is_nil()) {
+    if (myMode == COPY_FROM) {
+      QMessageBox::information(SMESHGUI::desktop(), tr("SMESH_ERROR"),
+                               tr("ERROR_LOAD"), QMessageBox::Ok);
       return;
-    }
-    else
-    {
+    } else {
       myLibrary = aFilterMgr->CreateLibrary();
-      myLibrary->SetFileName( getFileName().latin1() );
+      myLibrary->SetFileName(getFileName().latin1());
     }
   }
 
@@ -648,26 +642,26 @@ void SMESHGUI_FilterLibraryDlg::processNewLibrary()
 void SMESHGUI_FilterLibraryDlg::updateList()
 {
   QStringList aList;
-  SMESH::string_array_var aNames = myLibrary->GetNames( (SMESH::ElementType)myTable->GetType() );
-  for ( int i = 0, n = aNames->length(); i < n; i++ )
-    aList.append( QString( aNames[ i ] ) );
+  SMESH::string_array_var aNames = myLibrary->GetNames((SMESH::ElementType)myTable->GetType());
+  for (int i = 0, n = aNames->length(); i < n; i++)
+    aList.append(QString(aNames[ i ]));
   myListBox->clear();
-  myListBox->insertStringList( aList );
-  if ( myListBox->count() == 0 )
+  myListBox->insertStringList(aList);
+  if (myListBox->count() == 0)
   {
-    myTable->Clear( myTable->GetType() );
+    myTable->Clear(myTable->GetType());
     myName->clear();
-    myName->setEnabled( false );
-    myTable->SetEnabled( false );
+    myName->setEnabled(false);
+    myTable->SetEnabled(false);
   }
   else
   {
-    myName->setEnabled( true );
-    myTable->SetEnabled( true );
-    if ( myListBox->count() )
+    myName->setEnabled(true);
+    myTable->SetEnabled(true);
+    if (myListBox->count())
     {
       myCurrFilterName = "";
-      myListBox->setCurrentItem( 0 );
+      myListBox->setCurrentItem(0);
     }
   }
 }
@@ -676,28 +670,24 @@ void SMESHGUI_FilterLibraryDlg::updateList()
 // name    : SMESHGUI_FilterLibraryDlg::isNameValid
 // Purpose : Verify validity if entered data
 //=======================================================================
-bool SMESHGUI_FilterLibraryDlg::isNameValid( const bool theMess ) const
+bool SMESHGUI_FilterLibraryDlg::isNameValid(const bool theMess) const
 {
   // verify validity of filter name
-  if ( myName->isEnabled() && !myCurrFilterName.isEmpty() )
-  {
+  if (myName->isEnabled() && !myCurrFilterName.isEmpty()) {
     QString aCurrName = myName->text();
-    if ( aCurrName.isEmpty() )
-    {
-      if ( theMess )
-        QMessageBox::information( SMESHGUI::GetSMESHGUI()->GetDesktop(),
-          tr( "SMESH_INSUFFICIENT_DATA" ), tr( "EMPTY_FILTER_NAME" ), QMessageBox::Ok );
+    if (aCurrName.isEmpty()) {
+      if (theMess)
+        QMessageBox::information(SMESHGUI::desktop(), tr("SMESH_INSUFFICIENT_DATA"),
+                                 tr("EMPTY_FILTER_NAME"), QMessageBox::Ok);
       return false;
     }
 
     SMESH::string_array_var aNames = myLibrary->GetAllNames();
-    for ( int f = 0, n = aNames->length(); f < n; f++ )
-    {
-      if ( aNames[ f ] == aCurrName && aNames[ f ] != myCurrFilterName )
-      {
-        if ( theMess )
-          QMessageBox::information( SMESHGUI::GetSMESHGUI()->GetDesktop(),
-            tr( "SMESH_INSUFFICIENT_DATA" ), tr( "ERROR_FILTER_NAME" ), QMessageBox::Ok );
+    for (int f = 0, n = aNames->length(); f < n; f++) {
+      if (aNames[ f ] == aCurrName && aNames[ f ] != myCurrFilterName) {
+        if (theMess)
+          QMessageBox::information(SMESHGUI::desktop(), tr("SMESH_INSUFFICIENT_DATA"),
+                                   tr("ERROR_FILTER_NAME"), QMessageBox::Ok);
         return false;
       }
     }
@@ -710,44 +700,42 @@ bool SMESHGUI_FilterLibraryDlg::isNameValid( const bool theMess ) const
 // name    : SMESHGUI_FilterLibraryDlg::isPermissionValid
 // Purpose : Verify write permission on file
 //=======================================================================
-bool SMESHGUI_FilterLibraryDlg::isPermissionValid( const bool theIsExistingOnly )
+bool SMESHGUI_FilterLibraryDlg::isPermissionValid(const bool theIsExistingOnly)
 {
-  if ( myMode == COPY_FROM )
+  if (myMode == COPY_FROM)
     return true;
-  
+
   // Verify write permission
   bool isWritable = false;
 
-  QString fName( myFileName->text() );
-  if ( QFileInfo( fName ).extension().isEmpty() )
-    fName = autoExtension( fName );
+  QString fName(myFileName->text());
+  if (QFileInfo(fName).extension().isEmpty())
+    fName = autoExtension(fName);
 
-  fName = QDir::convertSeparators( fName );
+  fName = QDir::convertSeparators(fName);
 
-  if ( QFileInfo( fName ).exists() )
-    isWritable = QFileInfo( fName ).isWritable();
-  else if ( !theIsExistingOnly )
-  {
-    QFileInfo aDirInfo( QFileInfo( fName ).dirPath( true ) );
+  if (QFileInfo(fName).exists()) {
+    isWritable = QFileInfo(fName).isWritable();
+  } else if (!theIsExistingOnly) {
+    QFileInfo aDirInfo(QFileInfo(fName).dirPath(true));
     isWritable = aDirInfo.isWritable();
-    /*if ( QDir( QFileInfo( fName ).dirPath( true ) ).exists() ||
-         QDir().mkdir( QFileInfo( fName ).dirPath( true ) ) )
+    /*if (QDir(QFileInfo(fName).dirPath(true)).exists() ||
+         QDir().mkdir(QFileInfo(fName).dirPath(true)))
     {
-      QFile aFile( fName );
-      if ( aFile.open( IO_WriteOnly ) )
+      QFile aFile(fName);
+      if (aFile.open(IO_WriteOnly))
         isWritable = true;
       else
         aFile.close();
     }
     */
-  }
-  else
+  } else {
     isWritable = true;
+  }
 
-  if ( !isWritable )
-  {
-    QMessageBox::information( SMESHGUI::GetSMESHGUI()->GetDesktop(),
-      tr( "SMESH_WRN_WARNING" ), tr( "NO_PERMISSION" ), QMessageBox::Ok );
+  if (!isWritable) {
+    QMessageBox::information(SMESHGUI::desktop(), tr("SMESH_WRN_WARNING"),
+                             tr("NO_PERMISSION"), QMessageBox::Ok);
     return false;
   }
 
@@ -758,10 +746,10 @@ bool SMESHGUI_FilterLibraryDlg::isPermissionValid( const bool theIsExistingOnly
 // name    : SMESHGUI_FilterLibraryDlg::isValid
 // Purpose : Verify validity if entered data
 //=======================================================================
-bool SMESHGUI_FilterLibraryDlg::isValid( const bool theMess ) const
+bool SMESHGUI_FilterLibraryDlg::isValid(const bool theMess) const
 {
   // verify validity of table
-  if ( !myTable->IsValid( theMess ) || !isNameValid( theMess ) )
+  if (!myTable->IsValid(theMess) || !isNameValid(theMess))
     return false;
   else
     return true;
@@ -771,44 +759,44 @@ bool SMESHGUI_FilterLibraryDlg::isValid( const bool theMess ) const
 // name    : SMESHGUI_FilterLibraryDlg::onFilterChanged
 // Purpose : SLOT. Called when selected filter of library  changed
 //=======================================================================
-void SMESHGUI_FilterLibraryDlg::onFilterChanged( const QString& theName )
+void SMESHGUI_FilterLibraryDlg::onFilterChanged(const QString& theName)
 {
-  if ( myLibrary->_is_nil() )
+  if (myLibrary->_is_nil())
     return;
 
   // Save parameters of filter if it was changed
 
-  if ( !myCurrFilterName.isEmpty() && myTable->IsEditable() )
+  if (!myCurrFilterName.isEmpty() && myTable->IsEditable())
   {
-    if ( !isValid( true ) )
+    if (!isValid(true))
     {
-      myListBox->blockSignals( true );
-      myListBox->setCurrentItem( myCurrFilter );
-      myListBox->blockSignals( false );
+      myListBox->blockSignals(true);
+      myListBox->setCurrentItem(myCurrFilter);
+      myListBox->blockSignals(false);
       return;
     }
 
     SMESH::Filter_var aFilter = createFilter();
-    myLibrary->Replace( myCurrFilterName.latin1(), myName->text().latin1(), aFilter );
+    myLibrary->Replace(myCurrFilterName.latin1(), myName->text().latin1(), aFilter);
   }
 
   // Fill table with filter parameters
 
-  SMESH::Filter_var aFilter = myLibrary->Copy( theName );
+  SMESH::Filter_var aFilter = myLibrary->Copy(theName);
   myCurrFilterName = theName;
   myCurrFilter = myListBox->currentItem();
-  myName->setText( theName );
+  myName->setText(theName);
+
 
-  
   SMESH::Filter::Criteria_var aCriteria;
 
-  myTable->Clear( myTable->GetType() );
+  myTable->Clear(myTable->GetType());
 
-  if ( !aFilter->GetCriteria( aCriteria ) )
+  if (!aFilter->GetCriteria(aCriteria))
     return;
 
-  for ( int i = 0, n = aCriteria->length(); i < n; i++ )
-    myTable->AddCriterion( aCriteria[ i ], myTable->GetType() );
+  for (int i = 0, n = aCriteria->length(); i < n; i++)
+    myTable->AddCriterion(aCriteria[ i ], myTable->GetType());
 
   myTable->Update();
 }
@@ -820,19 +808,19 @@ void SMESHGUI_FilterLibraryDlg::onFilterChanged( const QString& theName )
 //=======================================================================
 void SMESHGUI_FilterLibraryDlg::onReturnPressed()
 {
-  QString aName = myListBox->text( myListBox->count() - 1 );
-  
+  QString aName = myListBox->text(myListBox->count() - 1);
+
   processNewLibrary();
 
-  if ( myMode == ADD_TO )
+  if (myMode == ADD_TO)
   {
-    myTable->Copy( (SMESHGUI_FilterTable*)parentWidget() );
+    myTable->Copy((SMESHGUI_FilterTable*)parentWidget());
     myCurrFilterName = "";
     myCurrFilter = -1;
-    addFilterToLib( aName );
+    addFilterToLib(aName);
   }
 
-  isPermissionValid( false );
+  isPermissionValid(false);
 }
 
 //=======================================================================
@@ -841,15 +829,15 @@ void SMESHGUI_FilterLibraryDlg::onReturnPressed()
 //=======================================================================
 void SMESHGUI_FilterLibraryDlg::enableMainButtons()
 {
-  /*bool isEnabled = isValid( false );
-  if ( myButtons.contains( BTN_OK ) )
-    myButtons[ BTN_OK ]->setEnabled( isEnabled );
-  else if ( myButtons.contains( BTN_Apply ) )
-    myButtons[ BTN_OK ]->setEnabled( isEnabled );
-  if ( myButtons.contains( BTN_Cancel ) )
-    myButtons[ BTN_Cancel ]->setEnabled( isEnabled );
-  else if ( myButtons.contains( BTN_Close ) )
-    myButtons[ BTN_Cancel ]->setEnabled( isEnabled );
+  /*bool isEnabled = isValid(false);
+  if (myButtons.contains(BTN_OK))
+    myButtons[ BTN_OK ]->setEnabled(isEnabled);
+  else if (myButtons.contains(BTN_Apply))
+    myButtons[ BTN_OK ]->setEnabled(isEnabled);
+  if (myButtons.contains(BTN_Cancel))
+    myButtons[ BTN_Cancel ]->setEnabled(isEnabled);
+  else if (myButtons.contains(BTN_Close))
+    myButtons[ BTN_Cancel ]->setEnabled(isEnabled);
     */
 }
 
@@ -857,23 +845,23 @@ void SMESHGUI_FilterLibraryDlg::enableMainButtons()
 // name    : SMESHGUI_FilterLibraryDlg::createFilter
 // Purpose : Cerate filter in accordance with library
 //=======================================================================
-SMESH::Filter_ptr SMESHGUI_FilterLibraryDlg::createFilter( const int theType )
+SMESH::Filter_ptr SMESHGUI_FilterLibraryDlg::createFilter(const int theType)
 {
-  int n = myTable->NumRows( theType );
+  int n = myTable->NumRows(theType);
 
   SMESH::Filter::Criteria_var aCriteria = new SMESH::Filter::Criteria;
-  aCriteria->length( n );
+  aCriteria->length(n);
 
-  for ( int i = 0; i < n; i++ )
+  for (int i = 0; i < n; i++)
   {
     SMESH::Filter::Criterion aCriterion = SMESHGUI_FilterDlg::createCriterion();
-    myTable->GetCriterion( i, aCriterion );
+    myTable->GetCriterion(i, aCriterion);
     aCriteria[ i ] = aCriterion;
   }
 
   SMESH::FilterManager_var aFilterMgr = SMESH::GetFilterManager();
   SMESH::Filter_var aFilter = aFilterMgr->CreateFilter();
-  aFilter->SetCriteria( aCriteria.inout() );
+  aFilter->SetCriteria(aCriteria.inout());
 
   return aFilter._retn();
 }
@@ -886,29 +874,28 @@ SMESH::Filter_ptr SMESHGUI_FilterLibraryDlg::createFilter( const int theType )
 void SMESHGUI_FilterLibraryDlg::onAddBtnPressed()
 {
   // Save parameters of filter if it was changed
-  if ( !myCurrFilterName.isEmpty() && myTable->IsEditable() )
+  if (!myCurrFilterName.isEmpty() && myTable->IsEditable())
   {
-    if ( !isValid( true ) )
+    if (!isValid(true))
       return;
 
     SMESH::Filter_var aFilter = createFilter();
-    myLibrary->Replace( myCurrFilterName.latin1(), myName->text().latin1(), aFilter );
+    myLibrary->Replace(myCurrFilterName.latin1(), myName->text().latin1(), aFilter);
   }
 
-  addFilterToLib( getDefaultFilterName() );
+  addFilterToLib(getDefaultFilterName());
 }
 
 //=======================================================================
-// name    : SMESHGUI_FilterLibraryDlg::onAddBtnPressed
+// name    : onAddBtnPressed()
 // Purpose : SLOT. Called when "Add" button pressed
 //           Add new filter to the end of library
 //=======================================================================
-void SMESHGUI_FilterLibraryDlg::addFilterToLib( const QString& theName )
+void SMESHGUI_FilterLibraryDlg::addFilterToLib (const QString& theName)
 {
-  if ( myLibrary->_is_nil() )
-  {
-    QMessageBox::information( SMESHGUI::GetSMESHGUI()->GetDesktop(),
-      tr( "SMESH_WRN_WARNING" ), tr( "LIBRARY_IS_NOT_LOADED" ), QMessageBox::Ok );
+  if (myLibrary->_is_nil()) {
+    QMessageBox::information(SMESHGUI::desktop(), tr("SMESH_WRN_WARNING"),
+                             tr("LIBRARY_IS_NOT_LOADED"), QMessageBox::Ok);
     return;
   }
 
@@ -916,10 +903,10 @@ void SMESHGUI_FilterLibraryDlg::addFilterToLib( const QString& theName )
   SMESH::Filter_var aFilter = createFilter();
 
   // if name of filter already exist in the library assign default name for the filter
-  QString aName( theName );
+  QString aName(theName);
   SMESH::string_array_var aNames = myLibrary->GetAllNames();
-  for ( int i = 0, n = aNames->length(); i < n; i++ )
-    if ( aName == QString( aNames[ i ] ) )
+  for (int i = 0, n = aNames->length(); i < n; i++)
+    if (aName == QString(aNames[ i ]))
     {
       aName = getDefaultFilterName();
       break;
@@ -927,23 +914,22 @@ void SMESHGUI_FilterLibraryDlg::addFilterToLib( const QString& theName )
 
   // add new filter in library
   bool aResult = !aFilter->GetPredicate()->_is_nil()
-    ? myLibrary->Add( aName.latin1(), aFilter )
-    : myLibrary->AddEmpty( aName.latin1(), (SMESH::ElementType)myTable->GetType() );
-    
-  if ( !aResult ) 
-  {
-    QMessageBox::information( SMESHGUI::GetSMESHGUI()->GetDesktop(),
-      tr( "SMESH_ERROR" ), tr( "ERROR_OF_ADDING" ), QMessageBox::Ok );
+    ? myLibrary->Add(aName.latin1(), aFilter)
+    : myLibrary->AddEmpty(aName.latin1(), (SMESH::ElementType)myTable->GetType());
+
+  if (!aResult) {
+    QMessageBox::information(SMESHGUI::desktop(), tr("SMESH_ERROR"),
+                             tr("ERROR_OF_ADDING"), QMessageBox::Ok);
   }
 
   updateList();
   myCurrFilterName = "";
   myCurrFilter = -1;
-  setSelected( aName );
+  setSelected(aName);
 
-  if ( theName != aName )
-    QMessageBox::information( SMESHGUI::GetSMESHGUI()->GetDesktop(), tr( "SMESH_WARNING" ),
-      tr( "ASSIGN_NEW_NAME" ).arg( theName ).arg( aName ) , QMessageBox::Ok );
+  if (theName != aName)
+    QMessageBox::information(SMESHGUI::desktop(), tr("SMESH_WARNING"),
+                             tr("ASSIGN_NEW_NAME").arg(theName).arg(aName), QMessageBox::Ok);
 }
 
 //=======================================================================
@@ -953,10 +939,10 @@ void SMESHGUI_FilterLibraryDlg::addFilterToLib( const QString& theName )
 QString& SMESHGUI_FilterLibraryDlg::getDefaultLibraryName() const
 {
   static QString aName;
-  if ( aName.isEmpty() )
+  if (aName.isEmpty())
   {
-    QString aHomeDir = QDir( QDir::home() ).absPath();
-    aName = aHomeDir + "/" + tr ( "LIB_NAME" );
+    QString aHomeDir = QDir(QDir::home()).absPath();
+    aName = aHomeDir + "/" + tr ("LIB_NAME");
   }
   return aName;
 }
@@ -969,35 +955,35 @@ QString SMESHGUI_FilterLibraryDlg::getDefaultFilterName() const
 {
   QString aName;
 
-  if ( myTable->GetType() == SMESH::NODE )
-    aName = tr( "NODE" );
-  else if ( myTable->GetType() == SMESH::EDGE )
-    aName = tr( "EDGE" );
-  else if ( myTable->GetType() == SMESH::FACE )
-    aName = tr( "FACE" );
-  else if ( myTable->GetType() == SMESH::VOLUME )
-    aName = tr( "VOLUME" );
-  else if ( myTable->GetType() == SMESH::ALL )
-    aName = tr( "ELEMENT" );
-  else 
-    aName = tr( "SELECTION" );
+  if (myTable->GetType() == SMESH::NODE)
+    aName = tr("NODE");
+  else if (myTable->GetType() == SMESH::EDGE)
+    aName = tr("EDGE");
+  else if (myTable->GetType() == SMESH::FACE)
+    aName = tr("FACE");
+  else if (myTable->GetType() == SMESH::VOLUME)
+    aName = tr("VOLUME");
+  else if (myTable->GetType() == SMESH::ALL)
+    aName = tr("ELEMENT");
+  else
+    aName = tr("SELECTION");
 
-  aName += tr( "FILTER" );
+  aName += tr("FILTER");
 
 
   QMap< QString, int > anAllNames;
   SMESH::string_array_var aNames = myLibrary->GetAllNames();
-  for( int i = 0, n = aNames->length(); i < n; i++ )
-    anAllNames[ QString( aNames[ i ] ) ] = -1;
+  for(int i = 0, n = aNames->length(); i < n; i++)
+    anAllNames[ QString(aNames[ i ]) ] = -1;
 
   bool isNotValid = true;
   int k = 1;
   QString aNewName;
-  while ( isNotValid )
+  while (isNotValid)
   {
     isNotValid = false;
-    aNewName = aName + "_" + QString( "%1" ).arg( k );
-    if ( anAllNames.contains( aNewName ) )
+    aNewName = aName + "_" + QString("%1").arg(k);
+    if (anAllNames.contains(aNewName))
     {
       isNotValid = true;
       k++;
@@ -1011,12 +997,12 @@ QString SMESHGUI_FilterLibraryDlg::getDefaultFilterName() const
 // name    : SMESHGUI_FilterLibraryDlg::setSelected
 // Purpose : set selected item in list box containing filters
 //=======================================================================
-bool SMESHGUI_FilterLibraryDlg::setSelected( const QString& theName )
+bool SMESHGUI_FilterLibraryDlg::setSelected(const QString& theName)
 {
-  int anIndex = getIndex( theName );
-  if ( anIndex != -1 )
+  int anIndex = getIndex(theName);
+  if (anIndex != -1)
   {
-    myListBox->setCurrentItem( anIndex );
+    myListBox->setCurrentItem(anIndex);
     myCurrFilterName = theName;
     myCurrFilter = anIndex;
   }
@@ -1027,10 +1013,10 @@ bool SMESHGUI_FilterLibraryDlg::setSelected( const QString& theName )
 // name    : SMESHGUI_FilterLibraryDlg::getIndex
 // Purpose : Get index of the filter in list box
 //=======================================================================
-int SMESHGUI_FilterLibraryDlg::getIndex( const QString& theName ) const
+int SMESHGUI_FilterLibraryDlg::getIndex(const QString& theName) const
 {
-  for ( int i = 0, n = myListBox->count(); i < n; i++ )
-    if ( myListBox->text( i ) == theName)
+  for (int i = 0, n = myListBox->count(); i < n; i++)
+    if (myListBox->text(i) == theName)
       return i;
   return -1;
 }
@@ -1041,67 +1027,62 @@ int SMESHGUI_FilterLibraryDlg::getIndex( const QString& theName ) const
 //=======================================================================
 void SMESHGUI_FilterLibraryDlg::onDeleteBtnPressed()
 {
-  if ( myLibrary->_is_nil() )
-  {
-    QMessageBox::information( SMESHGUI::GetSMESHGUI()->GetDesktop(),
-      tr( "SMESH_WRN_WARNING" ), tr( "LIBRARY_IS_NOT_LOADED" ), QMessageBox::Ok );
+  if (myLibrary->_is_nil()) {
+    QMessageBox::information(SMESHGUI::desktop(), tr("SMESH_WRN_WARNING"),
+                             tr("LIBRARY_IS_NOT_LOADED"), QMessageBox::Ok);
     return;
   }
 
-  int anIndex = getIndex( myCurrFilterName );
+  int anIndex = getIndex(myCurrFilterName);
 
-  if ( anIndex == -1 || !myLibrary->Delete( myCurrFilterName.latin1() ) )
-  {
-    QMessageBox::information( SMESHGUI::GetSMESHGUI()->GetDesktop(),
-      tr( "SMESH_ERROR" ), tr( "ERROR_OF_DELETING" ), QMessageBox::Ok );
-  }
-  else
-  {
+  if (anIndex == -1 || !myLibrary->Delete(myCurrFilterName.latin1())) {
+    QMessageBox::information(SMESHGUI::desktop(), tr("SMESH_ERROR"),
+                             tr("ERROR_OF_DELETING"), QMessageBox::Ok);
+  } else {
     myCurrFilterName = "";
     myCurrFilterName = -1;
-    myListBox->removeItem( anIndex );
-    
-    if ( anIndex >= 1 )
-      myListBox->setSelected( anIndex - 1, true );
-    else if ( anIndex == 0 && myListBox->count() > 0 )
-      myListBox->setSelected( 0, true );
+    myListBox->removeItem(anIndex);
+
+    if (anIndex >= 1)
+      myListBox->setSelected(anIndex - 1, true);
+    else if (anIndex == 0 && myListBox->count() > 0)
+      myListBox->setSelected(0, true);
     else
       myTable->Clear();
   }
 
-  myTable->SetEnabled( myListBox->count() > 0 );
-  if ( myListBox->count() == 0 )
-  {
-    myName->setText( "" );
-    myName->setEnabled( false );
+  myTable->SetEnabled(myListBox->count() > 0);
+  if (myListBox->count() == 0) {
+    myName->setText("");
+    myName->setEnabled(false);
   }
 }
 
 //=======================================================================
-// name    : SMESHGUI_FilterLibraryDlg::onFilterNameChanged
+// name    : onFilterNameChanged()
 // Purpose : SLOT. Called when name of filter changed
 //           Change filter name in list box
 //=======================================================================
-void SMESHGUI_FilterLibraryDlg::onFilterNameChanged( const QString& theName )
+void SMESHGUI_FilterLibraryDlg::onFilterNameChanged (const QString& theName)
 {
   int aCurrItem = myListBox->currentItem();
-  if ( aCurrItem == -1 )
+  if (aCurrItem == -1)
     return;
 
-  myListBox->blockSignals( true );
-  myListBox->changeItem( theName, aCurrItem );
-  myListBox->blockSignals( false );
+  myListBox->blockSignals(true);
+  myListBox->changeItem(theName, aCurrItem);
+  myListBox->blockSignals(false);
 }
 
 //=======================================================================
 // name    : SMESHGUI_FilterLibraryDlg::SetTable
 // Purpose : Set table
 //=======================================================================
-void SMESHGUI_FilterLibraryDlg::SetTable( const SMESHGUI_FilterTable* theTable )
+void SMESHGUI_FilterLibraryDlg::SetTable(const SMESHGUI_FilterTable* theTable)
 {
-  myTable->Copy( theTable );
-  myName->setText( getDefaultFilterName() );
-  addFilterToLib( myName->text() );
+  myTable->Copy(theTable);
+  myName->setText(getDefaultFilterName());
+  addFilterToLib(myName->text());
   myTable->Update();
 }
 
@@ -1119,41 +1100,34 @@ const SMESHGUI_FilterTable* SMESHGUI_FilterLibraryDlg::GetTable() const
 // name    : SMESHGUI_FilterLibraryDlg::onEntityTypeChanged
 // Purpose : SLOT. Called when entiyt type changed
 //=======================================================================
-void SMESHGUI_FilterLibraryDlg::onEntityTypeChanged( const int theType )
+void SMESHGUI_FilterLibraryDlg::onEntityTypeChanged(const int theType)
 {
-  if ( myLibrary->_is_nil() )
+  if (myLibrary->_is_nil())
     return;
 
   myName->clear();
   myCurrFilterName = "";
   myCurrFilter = -1;
   updateList();
-  if ( myListBox->count() )
-    myListBox->setCurrentItem( 0 );
+  if (myListBox->count())
+    myListBox->setCurrentItem(0);
 }
 
 //=======================================================================
 // name    : SMESHGUI_FilterLibraryDlg::onNeedValidation
-// Purpose : 
+// Purpose :
 //=======================================================================
 void SMESHGUI_FilterLibraryDlg::onNeedValidation()
 {
-  if ( !myCurrFilterName.isEmpty() )
+  if (!myCurrFilterName.isEmpty())
   {
-    bool valid = isValid( true );
-    myTable->SetValidity( valid );
+    bool valid = isValid(true);
+    myTable->SetValidity(valid);
 
-    if ( valid )
+    if (valid)
     {
-      SMESH::Filter_var aFilter = createFilter( myTable->GetType() );
-      myLibrary->Replace( myCurrFilterName.latin1(), myName->text().latin1(), aFilter );
+      SMESH::Filter_var aFilter = createFilter(myTable->GetType());
+      myLibrary->Replace(myCurrFilterName.latin1(), myName->text().latin1(), aFilter);
     }
   }
 }
-
-
-
-
-
-
-
index 4b0ae92de7ec286f43d8232827a64ee331a304bb..f02434220c8ccc8726cb4728fbc2bfccecd4342c 100644 (file)
@@ -1,37 +1,31 @@
 //  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 
-// 
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
 //  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
 
 
 #include "SMESHGUI_FilterUtils.h"
-#include "SMESHGUI_SMESHGenUtils.h"
 
+#include "SMESHGUI.h"
 
 namespace SMESH
 {
-
   SMESH::FilterManager_var GetFilterManager()
   {
-    static SMESH::FilterManager_var aFilterManager;
-    if(CORBA::is_nil(aFilterManager)){
-      aFilterManager = GetSMESHGen()->CreateFilterManager();
-    }
-    return aFilterManager;
+    return SMESHGUI::GetSMESHGen()->CreateFilterManager(); // DumpPython
   }
-
 }
index a7dc4011ba122233aa8fc31853e0370d561fad86..c9ffc82e620bc008314a4addd506c7d7b7b76fd1 100644 (file)
@@ -1,48 +1,52 @@
 //  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 
-// 
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
 //  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
 
-
-#include "QAD_Desktop.h"
+#include <boost/shared_ptr.hpp>
 
 #include "SMESHGUI_GEOMGenUtils.h"
 #include "SMESHGUI_Utils.h"
+
+#include <GeometryGUI.h>
+
+#include <SALOMEDSClient_SObject.hxx>
+#include <SALOMEDSClient_ChildIterator.hxx>
+#include <SALOMEDS_SObject.hxx>
+
 #include CORBA_CLIENT_HEADER(SMESH_Mesh)
 
-namespace SMESH{
+
+namespace SMESH {
 
   GEOM::GEOM_Gen_var GetGEOMGen()
   {
     static GEOM::GEOM_Gen_var aGEOMGen;
-    if(CORBA::is_nil(aGEOMGen)){
-      if(QAD_Desktop* aDesktop = QAD_Application::getDesktop()){
-       Engines::Component_var aComponent = aDesktop->getEngine("FactoryServer","GEOM");
-       aGEOMGen = GEOM::GEOM_Gen::_narrow(aComponent);
-      }
-    }
+
+    if(CORBA::is_nil(aGEOMGen))
+        aGEOMGen = GeometryGUI::GetGeomGen();
     return aGEOMGen;
   }
 
-
-  GEOM::GEOM_Object_var GetShapeOnMeshOrSubMesh(SALOMEDS::SObject_ptr theMeshOrSubmesh)
+  GEOM::GEOM_Object_var GetShapeOnMeshOrSubMesh(_PTR(SObject) theMeshOrSubmesh)
   {
-    if(!theMeshOrSubmesh->_is_nil()) {
-      CORBA::Object_var Obj = theMeshOrSubmesh->GetObject();
+    SALOMEDS_SObject* aMeshOrSubmesh = _CAST(SObject,theMeshOrSubmesh);
+    if(aMeshOrSubmesh) {
+      CORBA::Object_var Obj = aMeshOrSubmesh->GetObject();
       if ( !CORBA::is_nil( Obj ) ) {
         SMESH::SMESH_Mesh_var aMesh =
           SObjectToInterface<SMESH::SMESH_Mesh>( theMeshOrSubmesh );
@@ -57,4 +61,32 @@ namespace SMESH{
     return GEOM::GEOM_Object::_nil();
   }
 
+  GEOM::GEOM_Object_ptr GetGeom (_PTR(SObject) theSO)
+  {
+    if (!theSO)
+      return GEOM::GEOM_Object::_nil();
+
+    _PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
+    if (!aStudy)
+      return GEOM::GEOM_Object::_nil();
+
+    _PTR(ChildIterator) anIter (aStudy->NewChildIterator(theSO));
+    for (; anIter->More(); anIter->Next()) {
+      _PTR(SObject) aSObject = anIter->Value();
+      _PTR(SObject) aRefSOClient;
+      GEOM::GEOM_Object_var aMeshShape;
+
+      if (aSObject->ReferencedObject(aRefSOClient)) {
+        SALOMEDS_SObject* aRefSO = _CAST(SObject,aRefSOClient);
+        aMeshShape = GEOM::GEOM_Object::_narrow(aRefSO->GetObject());
+      } else {
+       SALOMEDS_SObject* aSO = _CAST(SObject,aSObject);
+        aMeshShape = GEOM::GEOM_Object::_narrow(aSO->GetObject());
+      }
+
+      if (!aMeshShape->_is_nil())
+        return aMeshShape._retn();
+    }
+    return GEOM::GEOM_Object::_nil();
+  }
 }
index ebc0a43e96bd9c8b59c8aad5459c2c6be7f91370..6f2ccb9b32e406cf7a0c6461b1ffd8874ca44c7e 100644 (file)
@@ -10,7 +10,7 @@
 //  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 
 
 #include "SALOMEconfig.h"
 #include CORBA_SERVER_HEADER(GEOM_Gen)
-#include CORBA_CLIENT_HEADER(SALOMEDS)
 
+#include "SALOMEDSClient_definitions.hxx"
+
+class SALOMEDSClient_SObject;
 
 namespace SMESH
 {
-
   GEOM::GEOM_Gen_var GetGEOMGen();
 
-  GEOM::GEOM_Object_var GetShapeOnMeshOrSubMesh(SALOMEDS::SObject_ptr theSObject);
+  GEOM::GEOM_Object_var GetShapeOnMeshOrSubMesh (_PTR(SObject) theSObject);
 
+  GEOM::GEOM_Object_ptr GetGeom (_PTR(SObject) theSO);
 }
 
-
 #endif
index 457cfecd347e9fa7c41c12f3694a9525aa6fb1d3..5f7b9da9d6ab6ff4fd177efdab650a8b2a62625f 100644 (file)
@@ -1,23 +1,23 @@
 //  SMESH SMESHGUI : GUI for SMESH 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.org 
+//  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.org
 //
 //
 //
@@ -28,7 +28,6 @@
 
 #include "SMESHGUI_GroupDlg.h"
 #include "SMESHGUI_FilterDlg.h"
-#include "SMESHGUI_Filter.h"
 
 #include "SMESHGUI.h"
 #include "SMESHGUI_Utils.h"
 #include "SMESHGUI_FilterUtils.h"
 #include "SMESHGUI_GEOMGenUtils.h"
 
-#include "SALOMEGUI_QtCatchCorbaException.hxx"
+#include "SMESH_TypeFilter.hxx"
+#include "SMESH_Actor.h"
+#include "GEOMBase.h"
+
+#include "SUIT_Desktop.h"
+#include "SUIT_ResourceMgr.h"
+
+#include "SalomeApp_Tools.h"
+#include "SALOMEDSClient_Study.hxx"
+#include "SALOME_ListIO.hxx"
 #include "SALOME_ListIteratorOfListIO.hxx"
-#include "VTKViewer_ViewFrame.h"
-#include "QAD_Application.h"
-#include "QAD_Desktop.h"
-#include "QAD_MessageBox.h"
-#include "QAD_RightFrame.h"
-#include "utilities.h"
 
-#include "SMESH_Actor.h"
+#include "SVTK_ViewWindow.h"
+#include "SVTK_Selector.h"
 
-#include "GEOMBase.h"
+#include "utilities.h"
+
+// OCCT Includes
+#include <TColStd_MapOfInteger.hxx>
 
 // QT Includes
 #include <qbuttongroup.h>
 using namespace std;
 
 //=================================================================================
-// class    : SMESHGUI_GroupDlg()
-// purpose  : 
+// function : SMESHGUI_GroupDlg()
+// purpose  :
 //=================================================================================
-SMESHGUI_GroupDlg::SMESHGUI_GroupDlg( QWidget* parent, const char* name, SALOME_Selection* theSel,
-                                     SMESH::SMESH_Mesh_ptr theMesh, bool modal, WFlags fl )
-  : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | WDestructiveClose )
+SMESHGUI_GroupDlg::SMESHGUI_GroupDlg( SMESHGUI* theModule, const char* name,
+                                     SMESH::SMESH_Mesh_ptr theMesh, bool modal, WFlags fl)
+     : QDialog( SMESH::GetDesktop( theModule ), name, modal, WStyle_Customize | WStyle_NormalBorder |
+                WStyle_Title | WStyle_SysMenu | WDestructiveClose),
+     mySMESHGUI( theModule ),
+     mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ),
+     myViewWindow( SMESH::GetViewWindow( theModule ) ),
+     mySelector( myViewWindow->GetSelector() )
 {
-  if ( !name ) setName( "SMESHGUI_GroupDlg" );
-  initDialog(theSel, true);
+  if (!name) setName("SMESHGUI_GroupDlg");
+  initDialog(true);
   if (!theMesh->_is_nil())
     init(theMesh);
   else {
@@ -91,49 +102,62 @@ SMESHGUI_GroupDlg::SMESHGUI_GroupDlg( QWidget* parent, const char* name, SALOME_
     myGeomGroupBtn->setEnabled(false);
     myGeomGroupLine->setEnabled(false);
   }
-  
+
   /* Move widget on the botton right corner of main widget */
   int x, y ;
   mySMESHGUI->DefineDlgPosition(this, x, y);
   this->move(x, y);
 }
 
-SMESHGUI_GroupDlg::SMESHGUI_GroupDlg( QWidget* parent, const char* name, SALOME_Selection* theSel,
-                                     SMESH::SMESH_Group_ptr theGroup, bool modal, WFlags fl )
-  : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | WDestructiveClose )
+//=================================================================================
+// function : SMESHGUI_GroupDlg()
+// purpose  :
+//=================================================================================
+SMESHGUI_GroupDlg::SMESHGUI_GroupDlg( SMESHGUI* theModule, const char* name,
+                                     SMESH::SMESH_Group_ptr theGroup, bool modal, WFlags fl)
+     : QDialog( SMESH::GetDesktop( theModule ), name, modal, WStyle_Customize | WStyle_NormalBorder |
+                WStyle_Title | WStyle_SysMenu | WDestructiveClose),
+     mySMESHGUI( theModule ),
+     mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ),
+     myViewWindow( SMESH::GetViewWindow( theModule ) ),
+     mySelector( myViewWindow->GetSelector() )
 {
-  if ( !name ) setName( "SMESHGUI_GroupDlg" );
-  initDialog(theSel, false);
+  if (!name) setName("SMESHGUI_GroupDlg");
+  initDialog(false);
   if (!theGroup->_is_nil())
     init(theGroup);
   else {
     mySelectSubMesh->setEnabled(false);
     mySelectGroup->setEnabled(false);
   }
-  
+
   /* Move widget on the botton right corner of main widget */
   int x, y ;
   mySMESHGUI->DefineDlgPosition(this, x, y);
   this->move(x, y);
 }
 
-void SMESHGUI_GroupDlg::initDialog(SALOME_Selection* theSel, bool create)
+//=================================================================================
+// function : SMESHGUI_GroupDlg()
+// purpose  :
+//=================================================================================
+void SMESHGUI_GroupDlg::initDialog(bool create)
 {
   myFilterDlg = 0;
   myCreate = create;
   myCurrentLineEdit = 0;
-  
-  QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "SMESH",tr("ICON_SELECT")));
+
+  QPixmap image0 (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_SELECT")));
 
   if (create)
-    setCaption( tr( "SMESH_CREATE_GROUP_TITLE"  ) );
+    setCaption(tr("SMESH_CREATE_GROUP_TITLE"));
   else
-    setCaption( tr( "SMESH_EDIT_GROUP_TITLE"  ) );
-        
-  setSizeGripEnabled( TRUE );
+    setCaption(tr("SMESH_EDIT_GROUP_TITLE"));
+
+  setSizeGripEnabled(TRUE);
 
   QGridLayout* aMainLayout = new QGridLayout(this, 7, 3, 11, 6);
-  
+
   /***************************************************************/
   QLabel* meshGroupLab = new QLabel(this, "mesh/group label");
   if (create)
@@ -144,7 +168,7 @@ void SMESHGUI_GroupDlg::initDialog(SALOME_Selection* theSel, bool create)
   myMeshGroupBtn->setPixmap(image0);
   myMeshGroupLine = new QLineEdit(this, "mesh/group line");
   myMeshGroupLine->setReadOnly(true);
+
   /***************************************************************/
   myTypeGroup = new QButtonGroup(1, Qt::Vertical, this, "Group types");
   myTypeGroup->setTitle(tr("SMESH_ELEMENTS_TYPE"));
@@ -161,7 +185,7 @@ void SMESHGUI_GroupDlg::initDialog(SALOME_Selection* theSel, bool create)
   }
   myTypeGroup->setEnabled(create);
   myTypeId = -1;
-    
+
   /***************************************************************/
   QLabel* aName = new QLabel(this, "name label");
   aName->setText(tr("SMESH_NAME"));
@@ -181,7 +205,7 @@ void SMESHGUI_GroupDlg::initDialog(SALOME_Selection* theSel, bool create)
   myWGStack = new QWidgetStack( this, "widget stack");
   QWidget* wg1 = new QFrame( myWGStack, "first widget" );
   QWidget* wg2 = new QFrame( myWGStack, "second widget" );
-  
+
   /***************************************************************/
   QGroupBox* aContentBox = new QGroupBox(1, Qt::Horizontal, wg1, "content box");
   aContentBox->setTitle(tr("SMESH_CONTENT"));
@@ -220,7 +244,7 @@ void SMESHGUI_GroupDlg::initDialog(SALOME_Selection* theSel, bool create)
   /***************************************************************/
   QGroupBox* aSelectBox = new QGroupBox(3, Qt::Horizontal, wg1, "select box");
   aSelectBox->setTitle(tr("SMESH_SELECT_FROM"));
-  
+
   mySelectSubMesh = new QCheckBox(aSelectBox, "submesh checkbox");
   mySelectSubMesh->setText(tr("SMESH_SUBMESH"));
   mySelectSubMesh->setMinimumSize(50, 0);
@@ -230,7 +254,7 @@ void SMESHGUI_GroupDlg::initDialog(SALOME_Selection* theSel, bool create)
   mySubMeshLine = new QLineEdit(aSelectBox, "submesh line");
   mySubMeshLine->setReadOnly(true);
   onSelectSubMesh(false);
-  
+
   mySelectGroup = new QCheckBox(aSelectBox, "group checkbox");
   mySelectGroup->setText(tr("SMESH_GROUP"));
   mySelectGroup->setMinimumSize(50, 0);
@@ -240,7 +264,7 @@ void SMESHGUI_GroupDlg::initDialog(SALOME_Selection* theSel, bool create)
   myGroupLine = new QLineEdit(aSelectBox, "group line");
   myGroupLine->setReadOnly(true);
   onSelectGroup(false);
-  
+
   /***************************************************************/
   QGridLayout* wg1Layout = new QGridLayout( wg1, 3, 1, 0, 6 );
   wg1Layout->addWidget(aContentBox, 0, 0);
@@ -256,7 +280,7 @@ void SMESHGUI_GroupDlg::initDialog(SALOME_Selection* theSel, bool create)
   myGeomGroupLine = new QLineEdit(wg2, "geometry group line");
   myGeomGroupLine->setReadOnly(true); //VSR ???
   onSelectGeomGroup(false);
-  
+
   /***************************************************************/
   QGridLayout* wg2Layout = new QGridLayout( wg2, 2, 3, 0, 6 );
   wg2Layout->addWidget(geomObject,     0, 0);
@@ -331,8 +355,6 @@ void SMESHGUI_GroupDlg::initDialog(SALOME_Selection* theSel, bool create)
   connect(aCloseBtn, SIGNAL(clicked()), this, SLOT(onClose()));
 
   /* Init selection */
-  mySelection = theSel;  
-  mySMESHGUI = SMESHGUI::GetSMESHGUI();
   mySMESHGUI->SetActiveDialogBox(this);
   mySMESHGUI->SetState(800);
 
@@ -343,14 +365,14 @@ void SMESHGUI_GroupDlg::initDialog(SALOME_Selection* theSel, bool create)
 
   connect(mySMESHGUI, SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(onDeactivate()));
   connect(mySMESHGUI, SIGNAL(SignalCloseAllDialogs()), this, SLOT(onClose()));
-  connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(onObjectSelectionChanged()));
+  connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(onObjectSelectionChanged()));
 
   myGrpTypeGroup->setButton(myGrpTypeGroup->id(rb1)); // VSR !!!
   onGrpTypeChanged(myGrpTypeGroup->id(rb1)); // VSR!!!
 
   if (myMesh->_is_nil() )
     myTypeGroup->setButton(0);
-  
+
   updateButtons();
 }
 
@@ -368,21 +390,22 @@ SMESHGUI_GroupDlg::~SMESHGUI_GroupDlg()
   }
 }
 
-
 //=================================================================================
 // function : Init()
 // purpose  :
 //=================================================================================
-void SMESHGUI_GroupDlg::init(SMESH::SMESH_Mesh_ptr theMesh)
+void SMESHGUI_GroupDlg::init (SMESH::SMESH_Mesh_ptr theMesh)
 {
   /* init data from current selection */
   myMesh = SMESH::SMESH_Mesh::_duplicate(theMesh);
   myGroup = SMESH::SMESH_Group::_nil();
-  
+
   myActor = SMESH::FindActorByObject(myMesh);
   SMESH::SetPickable(myActor);
-   
-  QString aName = mySelection->firstIObject()->getName();
+
+  const SALOME_ListIO& aList = mySelector->StoredIObjects();
+
+  QString aName = aList.First()->getName();
   myMeshGroupLine->setText(aName) ;
   myMeshGroupLine->home( false );
 
@@ -396,24 +419,24 @@ void SMESHGUI_GroupDlg::init(SMESH::SMESH_Mesh_ptr theMesh)
 // function : Init()
 // purpose  :
 //=================================================================================
-void SMESHGUI_GroupDlg::init(SMESH::SMESH_Group_ptr theGroup)
+void SMESHGUI_GroupDlg::init (SMESH::SMESH_Group_ptr theGroup)
 {
   myMesh = theGroup->GetMesh();
   myGroup = SMESH::SMESH_Group::_duplicate(theGroup);
-  
+
   myActor = SMESH::FindActorByObject(myMesh);
   if ( !myActor )
     myActor = SMESH::FindActorByObject(myGroup);
   SMESH::SetPickable(myActor);
-  
+
   int aType = 0;
   switch(theGroup->GetType()) {
   case SMESH::NODE: aType= 0; break;
   case SMESH::EDGE: aType = 1; break;
   case SMESH::FACE: aType = 2; break;
   case SMESH::VOLUME: aType = 3; break;
-  } 
-  
+  }
+
   myName->setText(myGroup->GetName());
   myName->home(false);
   myMeshGroupLine->setText(myGroup->GetName());
@@ -423,7 +446,7 @@ void SMESHGUI_GroupDlg::init(SMESH::SMESH_Group_ptr theGroup)
   myElements->clear();
   setSelectionMode(aType);
   myTypeId = aType;
-  
+
   myIdList.clear();
   if (!theGroup->IsEmpty()) {
     SMESH::long_array_var anElements = myGroup->GetListOfID();
@@ -436,15 +459,14 @@ void SMESHGUI_GroupDlg::init(SMESH::SMESH_Group_ptr theGroup)
   }
 }
 
-
 //=================================================================================
 // function : updateButtons()
-// purpose  : 
+// purpose  :
 //=================================================================================
 void SMESHGUI_GroupDlg::updateButtons()
 {
-  bool enable; 
-  
+  bool enable;
+
   if (myGrpTypeId == 0)
     enable = !myName->text().stripWhiteSpace().isEmpty() && myElements->count() > 0;
   else if (myGrpTypeId == 1)
@@ -458,9 +480,9 @@ void SMESHGUI_GroupDlg::updateButtons()
 
 //=================================================================================
 // function : onNameChanged()
-// purpose  : 
+// purpose  :
 //=================================================================================
-void SMESHGUI_GroupDlg::onNameChanged(const QString& text)
+void SMESHGUI_GroupDlg::onNameChanged (const QString& text)
 {
   updateButtons();
 }
@@ -469,7 +491,7 @@ void SMESHGUI_GroupDlg::onNameChanged(const QString& text)
 // function : onTypeChanged()
 // purpose  : Group elements type radio button management
 //=================================================================================
-void SMESHGUI_GroupDlg::onTypeChanged(int id)
+void SMESHGUI_GroupDlg::onTypeChanged (int id)
 {
   if (myTypeId != id) {
     myElements->clear();
@@ -483,7 +505,7 @@ void SMESHGUI_GroupDlg::onTypeChanged(int id)
 // function : onGrpTypeChanged()
 // purpose  : Group type radio button management
 //=================================================================================
-void SMESHGUI_GroupDlg::onGrpTypeChanged(int id)
+void SMESHGUI_GroupDlg::onGrpTypeChanged (int id)
 {
   if (myGrpTypeId != id) {
     myWGStack->raiseWidget( id );
@@ -496,47 +518,46 @@ void SMESHGUI_GroupDlg::onGrpTypeChanged(int id)
 // function : setSelectionMode()
 // purpose  : Radio button management
 //=================================================================================
-void SMESHGUI_GroupDlg::setSelectionMode(int theMode)
+void SMESHGUI_GroupDlg::setSelectionMode (int theMode)
 {
   // PAL7314
   if (myMesh->_is_nil())
     return;
-  
+
   if (mySelectionMode != theMode) {
-    mySelection->ClearIObjects();
-    mySelection->ClearFilters();
+    mySelectionMgr->clearSelected();
+    mySelectionMgr->clearFilters();
     SMESH::SetPointRepresentation(false);
     if (theMode < 4) {
-      switch(theMode){
+      switch (theMode) {
       case 0:
-        if ( myActor )
+        if (myActor)
           myActor->SetPointRepresentation(true);
         else
           SMESH::SetPointRepresentation(true);
-       QAD_Application::getDesktop()->SetSelectionMode(NodeSelection, true);
+       myViewWindow->SetSelectionMode(NodeSelection);
        break;
       case 1:
-       QAD_Application::getDesktop()->SetSelectionMode(EdgeSelection, true);
+       myViewWindow->SetSelectionMode(EdgeSelection);
        break;
       case 2:
-       QAD_Application::getDesktop()->SetSelectionMode(FaceSelection, true);
+       myViewWindow->SetSelectionMode(FaceSelection);
        break;
       default:
-       QAD_Application::getDesktop()->SetSelectionMode(VolumeSelection, true);
+        myViewWindow->SetSelectionMode(VolumeSelection);
       }
-    }
-    else {
-      QAD_Application::getDesktop()->SetSelectionMode(ActorSelection, true);
+    } else {
+      myViewWindow->SetSelectionMode(ActorSelection);
       if (theMode == 4)
-       mySelection->AddFilter(mySubMeshFilter);
+       mySelectionMgr->installFilter(mySubMeshFilter);
       else if (theMode == 5)
-       mySelection->AddFilter(myGroupFilter);
+       mySelectionMgr->installFilter(myGroupFilter);
       else if (theMode == 6)
-       mySelection->AddFilter(myMeshFilter);
+       mySelectionMgr->installFilter(myMeshFilter);
     }
     mySelectionMode = theMode;
   }
-} 
+}
 
 //=================================================================================
 // function : onApply()
@@ -544,11 +565,13 @@ void SMESHGUI_GroupDlg::setSelectionMode(int theMode)
 //=================================================================================
 bool SMESHGUI_GroupDlg::onApply()
 {
-  if (mySMESHGUI->ActiveStudyLocked())
+  if (mySMESHGUI->isActiveStudyLocked())
     return false;
-  
-  if ( myGrpTypeId == 0 && !myName->text().stripWhiteSpace().isEmpty() && myElements->count() > 0) {
-    mySelection->ClearIObjects();
+
+  if (myGrpTypeId == 0 &&
+      !myName->text().stripWhiteSpace().isEmpty() &&
+      myElements->count() > 0) {
+    mySelectionMgr->clearSelected();
     if (myGroup->_is_nil()) {
       SMESH::ElementType aType = SMESH::ALL;
       switch(myTypeId) {
@@ -567,19 +590,19 @@ bool SMESHGUI_GroupDlg::onApply()
 
       myGroup = SMESH::AddGroup(myMesh, aType, myName->text());
       myGroup->Add(anIdList.inout());
-      
+
       /* init for next operation */
       myName->setText("");
       myElements->clear();
       myGroup = SMESH::SMESH_Group::_nil();
-    }
-    else {
+
+    else {
       myGroup->SetName(myName->text());
 
       QValueList<int> aAddList;
       QValueList<int>::iterator anIt;
       QListBoxItem* anItem;
-      
+
       for (anItem = myElements->firstItem(); anItem != 0; anItem = anItem->next()) {
        int anId = anItem->text().toInt();
        if ((anIt = myIdList.find(anId)) == myIdList.end())
@@ -609,33 +632,36 @@ bool SMESHGUI_GroupDlg::onApply()
        myIdList.append(anItem->text().toInt());
     }
 
-    mySMESHGUI->GetActiveStudy()->updateObjBrowser(true);
+    mySMESHGUI->updateObjBrowser(true);
     SMESH::UpdateView(); // asv: fix of BUG PAL5515
-    mySelection->ClearIObjects();
+    mySelectionMgr->clearSelected();
     return true;
-  }
-  else if (myGrpTypeId == 1 && !myName->text().stripWhiteSpace().isEmpty() && !CORBA::is_nil( myGeomGroup ))
-    {
-      SMESH::ElementType aType = SMESH::ALL;
-      switch(myTypeId) {
-      case 0: aType = SMESH::NODE; break;
-      case 1: aType = SMESH::EDGE; break;
-      case 2: aType = SMESH::FACE; break;
-      case 3: aType = SMESH::VOLUME; break;
-      }
-      
-      SALOMEDS::Study_var aStudy = SMESH::GetActiveStudyDocument();
-      GEOM::GEOM_IGroupOperations_var aGroupOp = SMESH::GetGEOMGen()->GetIGroupOperations(aStudy->StudyId());
-      
-      SMESH::SMESH_GroupOnGeom_var aGroupOnGeom = myMesh->CreateGroupFromGEOM(aType, myName->text(),myGeomGroup);
-      
-      mySMESHGUI->GetActiveStudy()->updateObjBrowser(true);
-      mySelection->ClearIObjects();
-      /* init for next operation */
-      myName->setText("");
-      return true;
+  } else if (myGrpTypeId == 1 &&
+             !myName->text().stripWhiteSpace().isEmpty() &&
+             !CORBA::is_nil(myGeomGroup))
+  {
+    SMESH::ElementType aType = SMESH::ALL;
+    switch (myTypeId) {
+    case 0: aType = SMESH::NODE; break;
+    case 1: aType = SMESH::EDGE; break;
+    case 2: aType = SMESH::FACE; break;
+    case 3: aType = SMESH::VOLUME; break;
     }
-  
+
+    _PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
+    GEOM::GEOM_IGroupOperations_var aGroupOp =
+      SMESH::GetGEOMGen()->GetIGroupOperations(aStudy->StudyId());
+
+    SMESH::SMESH_GroupOnGeom_var aGroupOnGeom =
+      myMesh->CreateGroupFromGEOM(aType, myName->text(),myGeomGroup);
+
+    mySMESHGUI->updateObjBrowser(true);
+    mySelectionMgr->clearSelected();
+    /* init for next operation */
+    myName->setText("");
+    return true;
+  }
+
   return false;
 }
 
@@ -661,7 +687,7 @@ void SMESHGUI_GroupDlg::onListSelectionChanged()
   busy = true;
 
   if (myCurrentLineEdit == 0) {
-    mySelection->ClearIObjects();
+    mySelectionMgr->clearSelected();
     TColStd_MapOfInteger aIndexes;
     QListBoxItem* anItem;
     for (anItem = myElements->firstItem(); anItem != 0; anItem = anItem->next()) {
@@ -670,8 +696,11 @@ void SMESHGUI_GroupDlg::onListSelectionChanged()
        aIndexes.Add(anId);
       }
     }
-    mySelection->AddOrRemoveIndex(myActor->getIO(), aIndexes, false, false);
-    mySelection->AddIObject(myActor->getIO());
+    mySelector->AddOrRemoveIndex(myActor->getIO(), aIndexes, false);
+    SALOME_ListIO aList;
+    aList.Append(myActor->getIO());
+    mySelectionMgr->setSelectedObjects(aList,false);
+    myViewWindow->highlight( myActor->getIO(), true, true );
   }
   busy = false;
 }
@@ -685,175 +714,180 @@ void SMESHGUI_GroupDlg::onObjectSelectionChanged()
   if (busy || !isEnabled()) return;
   busy = true;
 
-  int aNbSel = mySelection->IObjectCount();
+  const SALOME_ListIO& aList = mySelector->StoredIObjects();
+
+  int aNbSel = aList.Extent();
   myElements->clearSelection();
+
   if (myCurrentLineEdit) {
-    myCurrentLineEdit->setText("") ;
+    myCurrentLineEdit->setText("");
     QString aString = "";
-    
-    if (myCurrentLineEdit == myMeshGroupLine)
-      {
-       mySelectSubMesh->setEnabled(false);
-       mySelectGroup->setEnabled(false);
-       myGroupLine->setText("");
-       mySubMeshLine->setText("");
-       
-       myGeomGroupBtn->setEnabled(false);
-       myGeomGroupLine->setEnabled(false);
-       myGeomGroupLine->setText("");
-       if (!myCreate)
-         myName->setText("");
-       
-       myElements->clear();
-
-       if(aNbSel != 1)
-         {
-           myGroup = SMESH::SMESH_Group::_nil();
-           myMesh = SMESH::SMESH_Mesh::_nil();
-           busy = false;
-           return;
-         }
-       Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject();
-       
-       if (myCreate)
-         {
-           myMesh = SMESH::IObjectToInterface<SMESH::SMESH_Mesh>(IO);
-           if(myMesh->_is_nil())
-             return;
-           myGroup = SMESH::SMESH_Group::_nil();
-           
-           myActor = SMESH::FindActorByObject(myMesh);
-           SMESH::SetPickable(myActor);
-           
-           aString = mySelection->firstIObject()->getName();
-           myMeshGroupLine->setText(aString) ;
-           myMeshGroupLine->home( false );
-           
-           mySelectSubMesh->setEnabled(true);
-           mySelectGroup->setEnabled(true);
-           myGeomGroupBtn->setEnabled(true);
-           myGeomGroupLine->setEnabled(true);
-           updateButtons();
-         }
-       else
-         {
-           SMESH::SMESH_Group_var aGroup = SMESH::IObjectToInterface<SMESH::SMESH_Group>(IO);
-           if(aGroup->_is_nil())
-             return;
-           busy = false;
-           myCurrentLineEdit = 0;
-           init(aGroup);
-           busy = true;
-           mySelectSubMesh->setEnabled(true);
-           mySelectGroup->setEnabled(true);
-           myGeomGroupBtn->setEnabled(true);
-           myGeomGroupLine->setEnabled(true);
-         }
-       myCurrentLineEdit = 0;
-       busy = false;
-       if (!myCreate)
-         return;
 
-       if (myTypeId == -1)
-         onTypeChanged(0);
-       else
-         {
-           myElements->clear();
-           setSelectionMode(myTypeId);
-         }
-       
-       return;
+    if (myCurrentLineEdit == myMeshGroupLine) {
+      mySelectSubMesh->setEnabled(false);
+      mySelectGroup->setEnabled(false);
+      myGroupLine->setText("");
+      mySubMeshLine->setText("");
+
+      myGeomGroupBtn->setEnabled(false);
+      myGeomGroupLine->setEnabled(false);
+      myGeomGroupLine->setText("");
+      if (!myCreate)
+        myName->setText("");
+
+      myElements->clear();
+
+      if (aNbSel != 1) {
+        myGroup = SMESH::SMESH_Group::_nil();
+        myMesh = SMESH::SMESH_Mesh::_nil();
+        busy = false;
+        return;
       }
-    else if (myCurrentLineEdit == myGeomGroupLine)
-      {
-       
-       if(aNbSel != 1)
-         {
-           myGeomGroup = GEOM::GEOM_Object::_nil();
-           busy = false;
-           return;
-         }
-       
-       Standard_Boolean testResult = Standard_False;
-       myGeomGroup = GEOMBase::ConvertIOinGEOMObject(mySelection->firstIObject(), testResult );
-       
-       // Check if the object is a geometry group
-       if(!testResult || CORBA::is_nil( myGeomGroup ))
-         {
-           myGeomGroup = GEOM::GEOM_Object::_nil();
-           busy = false;
-           return;
-         }
-       // Check if group constructed on the same shape as a mesh or on its child
-       SALOMEDS::Study_var aStudy = SMESH::GetActiveStudyDocument();
-       GEOM::GEOM_IGroupOperations_var anOp = SMESH::GetGEOMGen()->GetIGroupOperations(aStudy->StudyId());
-       // The main shape of the group 
-       GEOM::GEOM_Object_var aGroupMainShape;
-       if( myGeomGroup->GetType() == 37 ) 
-         aGroupMainShape = anOp->GetMainShape( myGeomGroup );
-       else
-         aGroupMainShape = GEOM::GEOM_Object::_duplicate(myGeomGroup);
-       SALOMEDS::SObject_var aGroupMainShapeSO = aStudy->FindObjectIOR( aStudy->ConvertObjectToIOR(aGroupMainShape) );
-       // The mesh SObject
-       SALOMEDS::SObject_var aMeshSO = aStudy->FindObjectIOR( aStudy->ConvertObjectToIOR(myMesh) );
-        if ( aMeshSO->_is_nil() ) {
-          myGeomGroup = GEOM::GEOM_Object::_nil();
-          busy = false;
+      Handle(SALOME_InteractiveObject) IO = aList.First();
+
+      if (myCreate) {
+        myMesh = SMESH::IObjectToInterface<SMESH::SMESH_Mesh>(IO);
+        if (myMesh->_is_nil())
+       {
+         busy = false;
           return;
-        }
-       SALOMEDS::SObject_var anObj, aRef;
-       bool isRefOrSubShape = false;
-       if ( aMeshSO->FindSubObject( 1, anObj ) &&  anObj->ReferencedObject( aRef )) {
-         if ( strcmp( aRef->GetID(), aGroupMainShapeSO->GetID() ) == 0 )
-           isRefOrSubShape = true;
-         else
-           {
-             SALOMEDS::SObject_var aFather = aGroupMainShapeSO->GetFather();
-             SALOMEDS::SComponent_var aComponent = aGroupMainShapeSO->GetFatherComponent();
-             while ( !isRefOrSubShape && strcmp( aFather->GetID(), aComponent->GetID() ) != 0 )
-               {
-                 if (strcmp( aRef->GetID(), aFather->GetID() ) == 0)
-                   isRefOrSubShape = true;
-                 else
-                   aFather = aFather->GetFather();
-               }
-           }
        }
-       if ( !isRefOrSubShape ) 
-         {
-           myGeomGroup = GEOM::GEOM_Object::_nil();
-           busy = false;
-           return;
-         }
+        myGroup = SMESH::SMESH_Group::_nil();
+
+        myActor = SMESH::FindActorByObject(myMesh);
+        SMESH::SetPickable(myActor);
+
+        aString = aList.First()->getName();
+        myMeshGroupLine->setText(aString) ;
+        myMeshGroupLine->home( false );
+
+        mySelectSubMesh->setEnabled(true);
+        mySelectGroup->setEnabled(true);
+        myGeomGroupBtn->setEnabled(true);
+        myGeomGroupLine->setEnabled(true);
+        updateButtons();
+      } else {
+        SMESH::SMESH_Group_var aGroup = SMESH::IObjectToInterface<SMESH::SMESH_Group>(IO);
+        if (aGroup->_is_nil())
+       {
+         busy = false;
+          return;
+       }
+        busy = false;
+        myCurrentLineEdit = 0;
+        init(aGroup);
+        busy = true;
+        mySelectSubMesh->setEnabled(true);
+        mySelectGroup->setEnabled(true);
+        myGeomGroupBtn->setEnabled(true);
+        myGeomGroupLine->setEnabled(true);
+      }
+      myCurrentLineEdit = 0;
+      busy = false;
+      if (!myCreate)
+      {
+        busy = false;
+        return;
+      }
+
+      if (myTypeId == -1)
+        onTypeChanged(0);
+      else {
+        myElements->clear();
+        setSelectionMode(myTypeId);
+      }
+
+      busy = false;
+      return;
+
+    } else if (myCurrentLineEdit == myGeomGroupLine) {
+      if (aNbSel != 1) {
+        myGeomGroup = GEOM::GEOM_Object::_nil();
+        busy = false;
+        return;
       }
-    
+
+      Standard_Boolean testResult = Standard_False;
+      myGeomGroup = GEOMBase::ConvertIOinGEOMObject(aList.First(), testResult);
+
+      // Check if the object is a geometry group
+      if (!testResult || CORBA::is_nil(myGeomGroup)) {
+        myGeomGroup = GEOM::GEOM_Object::_nil();
+        busy = false;
+        return;
+      }
+      // Check if group constructed on the same shape as a mesh or on its child
+      _PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
+      GEOM::GEOM_IGroupOperations_var anOp =
+        SMESH::GetGEOMGen()->GetIGroupOperations(aStudy->StudyId());
+
+      // The main shape of the group
+      GEOM::GEOM_Object_var aGroupMainShape;
+      if (myGeomGroup->GetType() == 37)
+        aGroupMainShape = anOp->GetMainShape(myGeomGroup);
+      else
+        aGroupMainShape = GEOM::GEOM_Object::_duplicate(myGeomGroup);
+      _PTR(SObject) aGroupMainShapeSO =
+        //aStudy->FindObjectIOR(aStudy->ConvertObjectToIOR(aGroupMainShape));
+        aStudy->FindObjectIOR(aGroupMainShape->GetStudyEntry());
+
+      // The mesh SObject
+      _PTR(SObject) aMeshSO = SMESH::FindSObject(myMesh);
+      if (!aMeshSO) {
+        myGeomGroup = GEOM::GEOM_Object::_nil();
+        busy = false;
+        return;
+      }
+      _PTR(SObject) anObj, aRef;
+      bool isRefOrSubShape = false;
+      if (aMeshSO->FindSubObject(1, anObj) &&  anObj->ReferencedObject(aRef)) {
+        //if (strcmp(aRef->GetID(), aGroupMainShapeSO->GetID()) == 0) {
+        if (aRef->GetID() == aGroupMainShapeSO->GetID()) {
+          isRefOrSubShape = true;
+        } else {
+          _PTR(SObject) aFather = aGroupMainShapeSO->GetFather();
+          _PTR(SComponent) aComponent = aGroupMainShapeSO->GetFatherComponent();
+         //while (!isRefOrSubShape && strcmp(aFather->GetID(), aComponent->GetID()) != 0) {
+         while (!isRefOrSubShape && aFather->GetID() != aComponent->GetID()) {
+            //if (strcmp(aRef->GetID(), aFather->GetID()) == 0)
+            if (aRef->GetID() == aFather->GetID())
+              isRefOrSubShape = true;
+            else
+              aFather = aFather->GetFather();
+          }
+       }
+      }
+      if (!isRefOrSubShape) {
+        myGeomGroup = GEOM::GEOM_Object::_nil();
+        busy = false;
+        return;
+      }
+    }
+
     if (aNbSel >= 1) {
       if (aNbSel > 1) {
        if (myCurrentLineEdit == mySubMeshLine)
          aString = tr("SMESH_SUBMESH_SELECTED").arg(aNbSel);
        else if (myCurrentLineEdit == myGroupLine || myCurrentLineEdit == myGeomGroupLine)
          aString = tr("SMESH_GROUP_SELECTED").arg(aNbSel);
-      }
-      else {
-       aString = mySelection->firstIObject()->getName();
+      } else {
+       aString = aList.First()->getName();
       }
     }
-    
-    myCurrentLineEdit->setText(aString) ;
-    myCurrentLineEdit->home( false );
-    
+
+    myCurrentLineEdit->setText(aString);
+    myCurrentLineEdit->home(false);
+
     updateButtons();
-  }
-  else {
+
+  else {
     if (aNbSel == 1) {
       QString aListStr = "";
       int aNbItems = 0;
       if (myTypeId == 0) {
-       aNbItems = SMESH::GetNameOfSelectedNodes(mySelection, aListStr);
-      }
-      else {
-       aNbItems = SMESH::GetNameOfSelectedElements(mySelection, aListStr);
+       aNbItems = SMESH::GetNameOfSelectedNodes(mySelector, myActor->getIO(), aListStr);
+      } else {
+       aNbItems = SMESH::GetNameOfSelectedElements(mySelector, myActor->getIO(), aListStr);
       }
       if (aNbItems > 0) {
        QStringList anElements = QStringList::split(" ", aListStr);
@@ -865,18 +899,17 @@ void SMESHGUI_GroupDlg::onObjectSelectionChanged()
       }
     }
   }
-  
-  if ( !myActor ) {
-    if ( !myGroup->_is_nil() )
+
+  if (!myActor) {
+    if (!myGroup->_is_nil())
       myActor = SMESH::FindActorByObject(myGroup);
     else
       myActor = SMESH::FindActorByObject(myMesh);
   }
-  
+
   busy = false;
 }
 
-
 //=================================================================================
 // function : onSelectSubMesh()
 // purpose  : Called when selection in 3D view or ObjectBrowser is changed
@@ -886,7 +919,7 @@ void SMESHGUI_GroupDlg::onSelectSubMesh(bool on)
   if (on) {
     if (mySelectGroup->isChecked()) {
       mySelectGroup->setChecked(false);
-    } 
+    }
     //VSR: else if (mySelectGeomGroup->isChecked()) {
     //VSR:   mySelectGeomGroup->setChecked(false);
     //VSR: }
@@ -987,7 +1020,7 @@ void SMESHGUI_GroupDlg::setCurrentSelection()
 
 //=================================================================================
 // function : setFilters()
-// purpose  : SLOT. Called when "Filter" button pressed. 
+// purpose  : SLOT. Called when "Filter" button pressed.
 //=================================================================================
 void SMESHGUI_GroupDlg::setFilters()
 {
@@ -1003,13 +1036,13 @@ void SMESHGUI_GroupDlg::setFilters()
 
   if ( myFilterDlg == 0 )
   {
-    myFilterDlg = new SMESHGUI_FilterDlg( (QWidget*)parent(), aType );
+    myFilterDlg = new SMESHGUI_FilterDlg( mySMESHGUI, aType );
     connect( myFilterDlg, SIGNAL( Accepted() ), SLOT( onFilterAccepted() ) );
   }
   else
     myFilterDlg->Init( aType );
 
-  myFilterDlg->SetSelection( mySelection );
+  myFilterDlg->SetSelection();
   myFilterDlg->SetMesh( myMesh );
   myFilterDlg->SetSourceWg( myElements );
 
@@ -1037,7 +1070,9 @@ void SMESHGUI_GroupDlg::onFilterAccepted()
 //=================================================================================
 void SMESHGUI_GroupDlg::onAdd()
 {
-  int aNbSel = mySelection->IObjectCount();
+  const SALOME_ListIO& aList = mySelector->StoredIObjects();
+  int aNbSel = aList.Extent();
+
   if (aNbSel == 0 || !myActor || myMesh->_is_nil()) return;
 
   busy = true;
@@ -1055,10 +1090,10 @@ void SMESHGUI_GroupDlg::onAdd()
     QString aListStr = "";
     int aNbItems = 0;
     if (myTypeId == 0) {
-      aNbItems = SMESH::GetNameOfSelectedNodes(mySelection, myActor->getIO(), aListStr);
+      aNbItems = SMESH::GetNameOfSelectedNodes(mySelector, myActor->getIO(), aListStr);
     }
     else {
-      aNbItems = SMESH::GetNameOfSelectedElements(mySelection, myActor->getIO(), aListStr);
+      aNbItems = SMESH::GetNameOfSelectedElements(mySelector, myActor->getIO(), aListStr);
     }
     if (aNbItems > 0) {
       QStringList anElements = QStringList::split(" ", aListStr);
@@ -1072,16 +1107,18 @@ void SMESHGUI_GroupDlg::onAdd()
        myElements->setSelected(anItem, true);
       }
     }
-  }
-  else if (myCurrentLineEdit == mySubMeshLine) {
-    SALOME_ListIteratorOfListIO anIt(mySelection->StoredIObjects());
+  } else if (myCurrentLineEdit == mySubMeshLine) {
+    //SALOME_ListIteratorOfListIO anIt (mySelectionMgr->StoredIObjects());
+    const SALOME_ListIO& aList = mySelector->StoredIObjects();
+    SALOME_ListIteratorOfListIO anIt (aList);
     for (; anIt.More(); anIt.Next()) {
-      SMESH::SMESH_subMesh_var aSubMesh = SMESH::IObjectToInterface<SMESH::SMESH_subMesh>(anIt.Value());
+      SMESH::SMESH_subMesh_var aSubMesh =
+        SMESH::IObjectToInterface<SMESH::SMESH_subMesh>(anIt.Value());
       if (!aSubMesh->_is_nil()) {
        // check if mesh is the same
        if (aSubMesh->GetFather()->GetId() == myMesh->GetId()) {
           try {
-            SMESH::long_array_var anElements = aSubMesh->GetElementsByType ( aType );
+            SMESH::long_array_var anElements = aSubMesh->GetElementsByType(aType);
             int k = anElements->length();
             QListBoxItem* anItem = 0;
             for (int i = 0; i < k; i++) {
@@ -1095,7 +1132,7 @@ void SMESHGUI_GroupDlg::onAdd()
             }
           }
           catch (const SALOME::SALOME_Exception& ex) {
-            QtCatchCorbaException(ex);
+            SalomeApp_Tools::QtCatchCorbaException(ex);
           }
         }
       }
@@ -1103,11 +1140,14 @@ void SMESHGUI_GroupDlg::onAdd()
     mySelectSubMesh->setChecked(false);
     busy = false;
     onListSelectionChanged();
-  }
-  else if (myCurrentLineEdit == myGroupLine) {
-    SALOME_ListIteratorOfListIO anIt(mySelection->StoredIObjects());
+
+  } else if (myCurrentLineEdit == myGroupLine) {
+    //SALOME_ListIteratorOfListIO anIt (mySelectionMgr->StoredIObjects());
+    const SALOME_ListIO& aList = mySelector->StoredIObjects();
+    SALOME_ListIteratorOfListIO anIt (aList);
     for (; anIt.More(); anIt.Next()) {
-      SMESH::SMESH_Group_var aGroup = SMESH::IObjectToInterface<SMESH::SMESH_Group>(anIt.Value());
+      SMESH::SMESH_Group_var aGroup =
+        SMESH::IObjectToInterface<SMESH::SMESH_Group>(anIt.Value());
       if (!aGroup->_is_nil()) {
        // check if mesh is the same
        if (aGroup->GetType() == aType && aGroup->GetMesh()->GetId() == myMesh->GetId()) {
@@ -1129,34 +1169,36 @@ void SMESHGUI_GroupDlg::onAdd()
     mySelectGroup->setChecked(false);
     busy = false;
     onListSelectionChanged();
-  }
-  else if (myCurrentLineEdit == myGeomGroupLine && !CORBA::is_nil(myGeomGroup)) {
-    
-    SALOMEDS::Study_var aStudy = SMESH::GetActiveStudyDocument();
-    GEOM::GEOM_IGroupOperations_var aGroupOp = SMESH::GetGEOMGen()->GetIGroupOperations(aStudy->StudyId());
-    
+
+  else if (myCurrentLineEdit == myGeomGroupLine && !CORBA::is_nil(myGeomGroup)) {
+    _PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
+    GEOM::GEOM_IGroupOperations_var aGroupOp =
+      SMESH::GetGEOMGen()->GetIGroupOperations(aStudy->StudyId());
+
     SMESH::ElementType aGroupType = SMESH::ALL;
     switch(aGroupOp->GetType(myGeomGroup)) {
     case 7: aGroupType = SMESH::NODE; break;
     case 6: aGroupType = SMESH::EDGE; break;
     case 4: aGroupType = SMESH::FACE; break;
     case 2: aGroupType = SMESH::VOLUME; break;
-    default: return;
+    default: busy = false; return;
     }
-    
+
     if (aGroupType == aType) {
-      SALOMEDS::SObject_var aGroupSO = aStudy->FindObjectIOR( aStudy->ConvertObjectToIOR(myGeomGroup) );
+      _PTR(SObject) aGroupSO =
+        //aStudy->FindObjectIOR(aStudy->ConvertObjectToIOR(myGeomGroup));
+        aStudy->FindObjectIOR(myGeomGroup->GetStudyEntry());
       // Construct filter
       SMESH::FilterManager_var aFilterMgr = SMESH::GetFilterManager();
       SMESH::Filter_var aFilter = aFilterMgr->CreateFilter();
       SMESH::BelongToGeom_var aBelongToGeom = aFilterMgr->CreateBelongToGeom();;
       aBelongToGeom->SetGeom(myGeomGroup);
-      aBelongToGeom->SetShapeName(aGroupSO->GetName());
+      aBelongToGeom->SetShapeName(aGroupSO->GetName().c_str());
       aBelongToGeom->SetElementType(aType);
-      aFilter->SetPredicate( aBelongToGeom );
-      
-      SMESH::long_array_var anElements = aFilter->GetElementsId( myMesh );
-      
+      aFilter->SetPredicate(aBelongToGeom);
+
+      SMESH::long_array_var anElements = aFilter->GetElementsId(myMesh);
+
       int k = anElements->length();
       QListBoxItem* anItem = 0;
       for (int i = 0; i < k; i++) {
@@ -1169,13 +1211,13 @@ void SMESHGUI_GroupDlg::onAdd()
        myElements->setSelected(anItem, true);
       }
     }
-    
+
     //VSR: mySelectGeomGroup->setChecked(false);
     busy = false;
     onListSelectionChanged();
   }
   busy = false;
-  //  mySelection->ClearIObjects();
+  //  mySelectionMgr->clearSelected();
   updateButtons();
 }
 
@@ -1192,11 +1234,12 @@ void SMESHGUI_GroupDlg::onRemove()
        myElements->removeItem(i-1);
       }
     }
-  }
-  else {
-    int aNbSel = mySelection->IObjectCount();
+  } else {
+    const SALOME_ListIO& aList = mySelector->StoredIObjects();
+    int aNbSel = aList.Extent();
+
     if (aNbSel == 0) { busy = false; return; }
-    
+
     SMESH::ElementType aType = SMESH::ALL;
     switch(myTypeId) {
     case 0: aType = SMESH::NODE; break;
@@ -1206,7 +1249,9 @@ void SMESHGUI_GroupDlg::onRemove()
     }
 
     if (myCurrentLineEdit == mySubMeshLine) {
-      SALOME_ListIteratorOfListIO anIt(mySelection->StoredIObjects());
+      //SALOME_ListIteratorOfListIO anIt (mySelectionMgr->StoredIObjects());
+      const SALOME_ListIO& aList = mySelector->StoredIObjects();
+      SALOME_ListIteratorOfListIO anIt (aList);
       for (; anIt.More(); anIt.Next()) {
        SMESH::SMESH_subMesh_var aSubMesh = SMESH::IObjectToInterface<SMESH::SMESH_subMesh>(anIt.Value());
        if (!aSubMesh->_is_nil()) {
@@ -1223,7 +1268,7 @@ void SMESHGUI_GroupDlg::onRemove()
                }
              }
              catch (const SALOME::SALOME_Exception& ex) {
-               QtCatchCorbaException(ex);
+               SalomeApp_Tools::QtCatchCorbaException(ex);
              }
            }
            else {
@@ -1237,7 +1282,7 @@ void SMESHGUI_GroupDlg::onRemove()
                }
              }
              catch (const SALOME::SALOME_Exception& ex) {
-               QtCatchCorbaException(ex);
+               SalomeApp_Tools::QtCatchCorbaException(ex);
              }
            }
          }
@@ -1246,7 +1291,9 @@ void SMESHGUI_GroupDlg::onRemove()
     }
     else if (myCurrentLineEdit == myGroupLine) {
       Standard_Boolean aRes;
-      SALOME_ListIteratorOfListIO anIt(mySelection->StoredIObjects());
+      //SALOME_ListIteratorOfListIO anIt (mySelectionMgr->StoredIObjects());
+      const SALOME_ListIO& aList = mySelector->StoredIObjects();
+      SALOME_ListIteratorOfListIO anIt (aList);
       for (; anIt.More(); anIt.Next()) {
        SMESH::SMESH_Group_var aGroup = SMESH::IObjectToInterface<SMESH::SMESH_Group>(anIt.Value());
        if (aRes && !aGroup->_is_nil()) {
@@ -1287,7 +1334,7 @@ void SMESHGUI_GroupDlg::onSort()
     // fill the array
     for (anItem = myElements->firstItem(), i = 0; anItem != 0; anItem = anItem->next(), i++) {
       anArray[i] = anItem->text().toInt();
-      if (anItem->isSelected()) 
+      if (anItem->isSelected())
        aSelected.append(anItem->text());
     }
     // sort & update list
@@ -1309,65 +1356,64 @@ void SMESHGUI_GroupDlg::onSort()
 // function : closeEvent()
 // purpose  :
 //=================================================================================
-void SMESHGUI_GroupDlg::closeEvent( QCloseEvent* e )
+void SMESHGUI_GroupDlg::closeEvent (QCloseEvent*)
 {
   onClose();
 }
 
-//=======================================================================
-// name    : SMESHGUI_GroupDlg::onClose
-// Purpose : SLOT called when "Close" button pressed. Close dialog
-//=======================================================================
+//=================================================================================
+// function : SMESHGUI_GroupDlg::onClose
+// purpose  : SLOT called when "Close" button pressed. Close dialog
+//=================================================================================
 void SMESHGUI_GroupDlg::onClose()
 {
-  QAD_StudyFrame* aStudyFrame = mySMESHGUI->GetActiveStudy()->getActiveStudyFrame();
-  if (aStudyFrame->getTypeView() == VIEW_VTK) {
+  if (SMESH::GetCurrentVtkView()) {
     SMESH::RemoveFilters(); // PAL6938 -- clean all mesh entity filters
     SMESH::SetPointRepresentation(false);
     SMESH::SetPickable();
   }
-  
-  mySelection->ClearIObjects();
-  QAD_Application::getDesktop()->SetSelectionMode(ActorSelection);
-  mySelection->ClearFilters();
+
+  mySelectionMgr->clearSelected();
+  myViewWindow->SetSelectionMode(ActorSelection);
+  mySelectionMgr->clearFilters();
   mySMESHGUI->ResetState();
 
   reject();
 }
 
-//=======================================================================
-// name    : SMESHGUI_GroupDlg::onDeactivate
-// Purpose : SLOT called when dialog must be deativated
-//=======================================================================
+//=================================================================================
+// function : SMESHGUI_GroupDlg::onDeactivate
+// purpose  : SLOT called when dialog must be deativated
+//=================================================================================
 void SMESHGUI_GroupDlg::onDeactivate()
 {
   mySMESHGUI->ResetState();
-  setEnabled( false );
+  setEnabled(false);
 }
 
-//=======================================================================
-// name    : SMESHGUI_GroupDlg::enterEvent
-// Purpose : Event filter
-//=======================================================================
-void SMESHGUI_GroupDlg::enterEvent( QEvent* )
+//=================================================================================
+// function : SMESHGUI_GroupDlg::enterEvent
+// purpose  : Event filter
+//=================================================================================
+void SMESHGUI_GroupDlg::enterEvent (QEvent*)
 {
-  if ( !isEnabled() ) {
-    SMESHGUI::GetSMESHGUI()->EmitSignalDeactivateDialog();
-    setEnabled( true );
+  if (!isEnabled()) {
+    mySMESHGUI->EmitSignalDeactivateDialog();
+    setEnabled(true);
     mySelectionMode = -1;
-    setSelectionMode( myTypeId );
-    mySMESHGUI->SetActiveDialogBox( (QDialog*)this ) ;
+    setSelectionMode(myTypeId);
+    //mySMESHGUI->SetActiveDialogBox((QDialog*)this);
+    mySMESHGUI->SetActiveDialogBox(this);
     mySMESHGUI->SetState(800);
   }
 }
 
-//=======================================================================
-//function : hideEvent
-//purpose  : caused by ESC key
-//=======================================================================
-
-void SMESHGUI_GroupDlg::hideEvent ( QHideEvent * e )
+//=================================================================================
+// function : hideEvent
+// purpose  : caused by ESC key
+//=================================================================================
+void SMESHGUI_GroupDlg::hideEvent (QHideEvent*)
 {
-  if ( !isMinimized() )
+  if (!isMinimized())
     onClose();
 }
index 9c19f9563396b340047379c0bf26fd8649daae31..797c084cad800e5fa3c32abe6851574c7630d521 100644 (file)
@@ -28,8 +28,9 @@
 #ifndef DIALOGBOX_GROUP_H
 #define DIALOGBOX_GROUP_H
 
-#include "SALOME_Selection.h"
-#include "SMESH_TypeFilter.hxx"
+#include "SalomeApp_SelectionMgr.h"
+//#include "SMESH_TypeFilter.hxx"
+#include "SUIT_SelectionFilter.h"
 
 // QT Includes
 #include <qdialog.h>
@@ -50,6 +51,8 @@ class QWidgetStack;
 class SMESHGUI;
 class SMESH_Actor;
 class SMESHGUI_FilterDlg;
+class SVTK_Selector;
+class SVTK_ViewWindow;
 
 //=================================================================================
 // class    : SMESHGUI_GroupDlg
@@ -60,11 +63,14 @@ class SMESHGUI_GroupDlg : public QDialog
     Q_OBJECT
 
 public:
-    SMESHGUI_GroupDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* theSel = 0, 
+    SMESHGUI_GroupDlg( SMESHGUI*,
+                      const char* name = 0, 
                       SMESH::SMESH_Mesh_ptr theMesh = SMESH::SMESH_Mesh::_nil(), 
                       bool modal = FALSE, WFlags fl = 0 );
-    SMESHGUI_GroupDlg( QWidget* parent, const char* name, SALOME_Selection* theSel, 
-                      SMESH::SMESH_Group_ptr theGroup, bool modal = FALSE, WFlags fl = 0 );
+    SMESHGUI_GroupDlg( SMESHGUI*,
+                      const char* name, 
+                      SMESH::SMESH_Group_ptr theGroup,
+                      bool modal = FALSE, WFlags fl = 0 );
     ~SMESHGUI_GroupDlg();
 
 public slots:
@@ -98,21 +104,23 @@ private slots:
     void onFilterAccepted();
 
 private:
-    void initDialog(SALOME_Selection* theSel, bool create);
+    void initDialog(bool create);
     void init(SMESH::SMESH_Mesh_ptr theMesh);
     void init(SMESH::SMESH_Group_ptr theGroup);
     void closeEvent(QCloseEvent* e);
-    void enterEvent ( QEvent * ) ;            
-    void hideEvent ( QHideEvent * );                        /* ESC key */
+    void enterEvent (QEvent*);
+    void hideEvent (QHideEvent*);                          /* ESC key */
     void setSelectionMode(int theMode);
     void updateButtons();
 
-    SMESHGUI*                     mySMESHGUI ;              /* Current SMESHGUI object */
-    SALOME_Selection*             mySelection ;             /* User shape selection */
-    SMESH_Actor*                  myActor;                  /* Current mesh actor */
-    int                           myGrpTypeId ;             /* Current group type id : standalone or group on geometry */
-    int                           myTypeId ;                /* Current type id = radio button id */
-    QLineEdit*                    myCurrentLineEdit;        /* Current  LineEdit */
+    SMESHGUI*                     mySMESHGUI;              /* Current SMESHGUI object */
+    SalomeApp_SelectionMgr*       mySelectionMgr;          /* User shape selection */
+    SMESH_Actor*                  myActor;                 /* Current mesh actor */
+    int                           myGrpTypeId; /* Current group type id : standalone or group on geometry */
+    int                           myTypeId;                /* Current type id = radio button id */
+    QLineEdit*                    myCurrentLineEdit;       /* Current  LineEdit */
+    SVTK_ViewWindow*              myViewWindow;
+    SVTK_Selector*                mySelector;
 
     QPushButton*                  myMeshGroupBtn;
     QLineEdit*                    myMeshGroupLine;
@@ -144,9 +152,12 @@ private:
     GEOM::GEOM_Object_var         myGeomGroup;
 
     int                           mySelectionMode;
-    Handle(SMESH_TypeFilter)      myMeshFilter;
-    Handle(SMESH_TypeFilter)      mySubMeshFilter;
-    Handle(SMESH_TypeFilter)      myGroupFilter;
+    //Handle(SMESH_TypeFilter)      myMeshFilter;
+    //Handle(SMESH_TypeFilter)      mySubMeshFilter;
+    //Handle(SMESH_TypeFilter)      myGroupFilter;
+    SUIT_SelectionFilter*         myMeshFilter;
+    SUIT_SelectionFilter*         mySubMeshFilter;
+    SUIT_SelectionFilter*         myGroupFilter;
 
     SMESHGUI_FilterDlg*           myFilterDlg;
 
index c5b07386e3c3d06d885ed1ecbfe35e91355c6dfe..04a03263ad03f5c6b449f021ea6043c79390e320 100644 (file)
@@ -1,23 +1,23 @@
 //  SMESH SMESHGUI : GUI for SMESH component
 //
 //  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
-// 
-//  This library is free software; you can redistribute it and/or 
-//  modify it under the terms of the GNU Lesser General Public 
-//  License as published by the Free Software Foundation; either 
-//  version 2.1 of the License. 
-// 
-//  This library is distributed in the hope that it will be useful, 
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of 
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
-//  Lesser General Public License for more details. 
-// 
-//  You should have received a copy of the GNU Lesser General Public 
-//  License along with this library; if not, write to the Free Software 
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
-// 
-//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
 //
 //
 //
 
 #include "SMESHGUI_GroupOpDlg.h"
 
-#include "QAD_Desktop.h"
-
 #include "SMESHGUI.h"
 #include "SMESHGUI_Utils.h"
-#include "SALOME_Selection.h"
+
 #include "SMESH_TypeFilter.hxx"
 
+#include "SUIT_ResourceMgr.h"
+#include "SUIT_Desktop.h"
+
+#include "SalomeApp_SelectionMgr.h"
+#include "SVTK_Selection.h"
+#include "SALOME_ListIO.hxx"
+
+// QT Includes
 #include <qframe.h>
 #include <qlayout.h>
 #include <qpushbutton.h>
 #define SPACING 5
 #define MARGIN  10
 
-/*
-  Class       : SMESHGUI_GroupOpDlg
-  Description : Perform boolean operations on groups
-*/
+/*!
 Class       : SMESHGUI_GroupOpDlg
 Description : Perform boolean operations on groups
+ */
 
 //=======================================================================
 // name    : SMESHGUI_GroupOpDlg::SMESHGUI_GroupOpDlg
 // Purpose : Constructor
 //=======================================================================
-SMESHGUI_GroupOpDlg::SMESHGUI_GroupOpDlg( QWidget*          theParent, 
-                                          SALOME_Selection* theSelection, 
-                                          const int         theMode )
-: QDialog( theParent, "SMESHGUI_GroupOpDlg", false, 
-           WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
+SMESHGUI_GroupOpDlg::SMESHGUI_GroupOpDlg (QWidget*                theParent,
+                                          SalomeApp_SelectionMgr* theSelection,
+                                          const int               theMode)
+     : QDialog(theParent, "SMESHGUI_GroupOpDlg", false,
+               WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu)
 {
   myMode = theMode;
 
-  if ( myMode == UNION ) setCaption( tr( "UNION_OF_TWO_GROUPS" ) );
-  else if ( myMode == INTERSECT ) setCaption( tr( "INTERSECTION_OF_TWO_GROUPS" ) );
-  else setCaption( tr( "CUT_OF_TWO_GROUPS" ) );
+  if (myMode == UNION) setCaption(tr("UNION_OF_TWO_GROUPS"));
+  else if (myMode == INTERSECT) setCaption(tr("INTERSECTION_OF_TWO_GROUPS"));
+  else setCaption(tr("CUT_OF_TWO_GROUPS"));
 
-  QVBoxLayout* aDlgLay = new QVBoxLayout( this, MARGIN, SPACING );
+  QVBoxLayout* aDlgLay = new QVBoxLayout (this, MARGIN, SPACING);
 
-  QFrame* aMainFrame = createMainFrame  ( this );
-  QFrame* aBtnFrame  = createButtonFrame( this );
+  QFrame* aMainFrame = createMainFrame  (this);
+  QFrame* aBtnFrame  = createButtonFrame(this);
 
-  aDlgLay->addWidget( aMainFrame );
-  aDlgLay->addWidget( aBtnFrame );
+  aDlgLay->addWidget(aMainFrame);
+  aDlgLay->addWidget(aBtnFrame);
 
-  aDlgLay->setStretchFactor( aMainFrame, 1 );
+  aDlgLay->setStretchFactor(aMainFrame, 1);
 
-  Init( theSelection ); 
+  Init(theSelection);
 }
 
 //=======================================================================
 // name    : SMESHGUI_GroupOpDlg::createMainFrame
 // Purpose : Create frame containing dialog's input fields
 //=======================================================================
-QFrame* SMESHGUI_GroupOpDlg::createMainFrame( QWidget* theParent )
+QFrame* SMESHGUI_GroupOpDlg::createMainFrame (QWidget* theParent)
 {
-  QGroupBox* aMainGrp = new QGroupBox( 1, Qt::Horizontal, theParent );
-  aMainGrp->setFrameStyle( QFrame::NoFrame );
-  aMainGrp->setInsideMargin( 0 );
-  
-  QGroupBox* aNameGrp = new QGroupBox( 1, Qt::Vertical, tr( "NAME" ), aMainGrp );
-  new QLabel( tr( "RESULT_NAME" ), aNameGrp );
-  myNameEdit = new QLineEdit( aNameGrp );
-  
-  QGroupBox* anArgGrp = new QGroupBox( 3, Qt::Horizontal, tr( "ARGUMENTS" ), aMainGrp );
-  
-  new QLabel( myMode == CUT ? tr( "MAIN_OBJECT" ) :tr( "OBJECT_1" ), anArgGrp );
-  myBtn1 = new QPushButton( anArgGrp );
-  myEdit1 = new QLineEdit( anArgGrp );
-  
-  new QLabel( myMode == CUT ? tr( "TOOL_OBJECT" ) :tr( "OBJECT_2" ), anArgGrp );
-  myBtn2 = new QPushButton( anArgGrp );
-  myEdit2 = new QLineEdit( anArgGrp );
-  
-  myEdit1->setReadOnly( true );
-  myEdit2->setReadOnly( true );
-
-  QPixmap aPix( QAD_Desktop::getResourceManager()->loadPixmap( "SMESH",tr( "ICON_SELECT" ) ) );
-  myBtn1->setPixmap( aPix );
-  myBtn2->setPixmap( aPix );
-  
+  QGroupBox* aMainGrp = new QGroupBox(1, Qt::Horizontal, theParent);
+  aMainGrp->setFrameStyle(QFrame::NoFrame);
+  aMainGrp->setInsideMargin(0);
+
+  QGroupBox* aNameGrp = new QGroupBox(1, Qt::Vertical, tr("NAME"), aMainGrp);
+  new QLabel(tr("RESULT_NAME"), aNameGrp);
+  myNameEdit = new QLineEdit(aNameGrp);
+
+  QGroupBox* anArgGrp = new QGroupBox(3, Qt::Horizontal, tr("ARGUMENTS"), aMainGrp);
+
+  new QLabel(myMode == CUT ? tr("MAIN_OBJECT") :tr("OBJECT_1"), anArgGrp);
+  myBtn1 = new QPushButton(anArgGrp);
+  myEdit1 = new QLineEdit(anArgGrp);
+  myEdit1->setAlignment( Qt::AlignLeft );
+
+  new QLabel(myMode == CUT ? tr("TOOL_OBJECT") :tr("OBJECT_2"), anArgGrp);
+  myBtn2 = new QPushButton(anArgGrp);
+  myEdit2 = new QLineEdit(anArgGrp);
+  myEdit2->setAlignment( Qt::AlignLeft );
+
+  myEdit1->setReadOnly(true);
+  myEdit2->setReadOnly(true);
+
+  QPixmap aPix (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_SELECT")));
+  myBtn1->setPixmap(aPix);
+  myBtn2->setPixmap(aPix);
+
   return aMainGrp;
 }
 
@@ -118,28 +126,28 @@ QFrame* SMESHGUI_GroupOpDlg::createMainFrame( QWidget* theParent )
 // name    : SMESHGUI_GroupOpDlg::createButtonFrame
 // Purpose : Create frame containing buttons
 //=======================================================================
-QFrame* SMESHGUI_GroupOpDlg::createButtonFrame( QWidget* theParent )
+QFrame* SMESHGUI_GroupOpDlg::createButtonFrame (QWidget* theParent)
 {
-  QFrame* aFrame = new QFrame( theParent );
-  aFrame->setFrameStyle( QFrame::Box | QFrame::Sunken );
+  QFrame* aFrame = new QFrame(theParent);
+  aFrame->setFrameStyle(QFrame::Box | QFrame::Sunken);
 
-  myOkBtn     = new QPushButton( tr( "SMESH_BUT_OK"    ), aFrame );
-  myApplyBtn  = new QPushButton( tr( "SMESH_BUT_APPLY" ), aFrame );
-  myCloseBtn  = new QPushButton( tr( "SMESH_BUT_CLOSE" ), aFrame );
+  myOkBtn     = new QPushButton(tr("SMESH_BUT_OK"   ), aFrame);
+  myApplyBtn  = new QPushButton(tr("SMESH_BUT_APPLY"), aFrame);
+  myCloseBtn  = new QPushButton(tr("SMESH_BUT_CLOSE"), aFrame);
 
-  QSpacerItem* aSpacer = new QSpacerItem( 0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum );
+  QSpacerItem* aSpacer = new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum);
 
-  QHBoxLayout* aLay = new QHBoxLayout( aFrame, MARGIN, SPACING );
+  QHBoxLayout* aLay = new QHBoxLayout(aFrame, MARGIN, SPACING);
+
+  aLay->addWidget(myOkBtn);
+  aLay->addWidget(myApplyBtn);
+  aLay->addItem(aSpacer);
+  aLay->addWidget(myCloseBtn);
 
-  aLay->addWidget( myOkBtn );
-  aLay->addWidget( myApplyBtn );
-  aLay->addItem( aSpacer);
-  aLay->addWidget( myCloseBtn );
-  
   // connect signals and slots
-  connect( myOkBtn,    SIGNAL( clicked() ), SLOT( onOk() ) );
-  connect( myCloseBtn, SIGNAL( clicked() ), SLOT( onClose() ) ) ;
-  connect( myApplyBtn, SIGNAL( clicked() ), SLOT( onApply() ) );
+  connect(myOkBtn,    SIGNAL(clicked()), SLOT(onOk()));
+  connect(myCloseBtn, SIGNAL(clicked()), SLOT(onClose()));
+  connect(myApplyBtn, SIGNAL(clicked()), SLOT(onApply()));
 
   return aFrame;
 }
@@ -156,32 +164,36 @@ SMESHGUI_GroupOpDlg::~SMESHGUI_GroupOpDlg()
 // name    : SMESHGUI_GroupOpDlg::Init
 // Purpose : Init dialog fields, connect signals and slots, show dialog
 //=======================================================================
-void SMESHGUI_GroupOpDlg::Init( SALOME_Selection* theSelection )
+void SMESHGUI_GroupOpDlg::Init (SalomeApp_SelectionMgr* theSelection)
 {
-  mySelection = theSelection;  
+  mySelectionMgr = theSelection;
   SMESHGUI* aSMESHGUI = SMESHGUI::GetSMESHGUI();
-  aSMESHGUI->SetActiveDialogBox( ( QDialog* )this ) ;
+  aSMESHGUI->SetActiveDialogBox((QDialog*)this);
   myFocusWg = myEdit1;
-  
+
   myGroup1 = SMESH::SMESH_GroupBase::_nil();
   myGroup2 = SMESH::SMESH_GroupBase::_nil();
-  
+
   // selection and SMESHGUI
-  connect( mySelection, SIGNAL( currentSelectionChanged() ), SLOT( onSelectionDone() ) );
-  connect( aSMESHGUI, SIGNAL( SignalDeactivateActiveDialog() ), SLOT( onDeactivate() ) );
-  connect( aSMESHGUI, SIGNAL( SignalCloseAllDialogs() ), SLOT( ClickOnClose() ) );
-  
-  connect( myBtn1, SIGNAL( clicked() ), this, SLOT( onFocusChanged() ) );
-  connect( myBtn2, SIGNAL( clicked() ), this, SLOT( onFocusChanged() ) );
-  
-  int x, y ;
-  aSMESHGUI->DefineDlgPosition( this, x, y );
-  this->move( x, y );
-  this->show(); 
+  connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), SLOT(onSelectionDone()));
+  connect(aSMESHGUI, SIGNAL(SignalDeactivateActiveDialog()), SLOT(onDeactivate()));
+  connect(aSMESHGUI, SIGNAL(SignalCloseAllDialogs()), SLOT(ClickOnClose()));
+
+  connect(myBtn1, SIGNAL(clicked()), this, SLOT(onFocusChanged()));
+  connect(myBtn2, SIGNAL(clicked()), this, SLOT(onFocusChanged()));
+
+  int x, y;
+  aSMESHGUI->DefineDlgPosition(this, x, y);
+  this->move(x, y);
+  this->show();
 
   // set selection mode
-  QAD_Application::getDesktop()->SetSelectionMode( ActorSelection, true ); 
-  mySelection->AddFilter( new SMESH_TypeFilter( GROUP ) );
+#ifdef NEW_GUI
+  mySelectionMgr->setSelectionModes(ActorSelection, true);
+#else
+  mySelectionMgr->setSelectionModes(ActorSelection);
+#endif
+  mySelectionMgr->installFilter(new SMESH_TypeFilter (GROUP));
 
   return;
 }
@@ -193,85 +205,77 @@ void SMESHGUI_GroupOpDlg::Init( SALOME_Selection* theSelection )
 bool SMESHGUI_GroupOpDlg::isValid()
 {
   // Verify validity of group name
-  if ( myNameEdit->text() == "" )
-  {
-    QMessageBox::information( SMESHGUI::GetSMESHGUI()->GetDesktop(),
-      tr( "SMESH_INSUFFICIENT_DATA" ), tr( "EMPTY_NAME" ), QMessageBox::Ok ); 
+  if (myNameEdit->text() == "") {
+    QMessageBox::information(SMESHGUI::desktop(), tr("SMESH_INSUFFICIENT_DATA"),
+                             tr("EMPTY_NAME"), QMessageBox::Ok);
     return false;
   }
 
   // Verufy wheter arguments speciffiyed
-  if ( myGroup1->_is_nil() || myGroup2->_is_nil() )
-  {
-    QMessageBox::information( SMESHGUI::GetSMESHGUI()->GetDesktop(),
-      tr( "SMESH_INSUFFICIENT_DATA" ), tr( "INCORRECT_ARGUMENTS" ), QMessageBox::Ok ); 
+  if (myGroup1->_is_nil() || myGroup2->_is_nil()) {
+    QMessageBox::information(SMESHGUI::desktop(), tr("SMESH_INSUFFICIENT_DATA"),
+                             tr("INCORRECT_ARGUMENTS"), QMessageBox::Ok);
     return false;
   }
 
   // Verify whether arguments belongs to same mesh
   SMESH::SMESH_Mesh_ptr aMesh1 = myGroup1->GetMesh();
   SMESH::SMESH_Mesh_ptr aMesh2 = myGroup2->GetMesh();
-  
+
   int aMeshId1 = !aMesh1->_is_nil() ? aMesh1->GetId() : -1;
   int aMeshId2 = !aMesh2->_is_nil() ? aMesh2->GetId() : -1;
-  
-  if ( aMeshId1 != aMeshId2 || aMeshId1 == -1 )
-  {
-    QMessageBox::information( SMESHGUI::GetSMESHGUI()->GetDesktop(),
-      tr( "SMESH_INSUFFICIENT_DATA" ), tr( "DIFF_MESHES" ), QMessageBox::Ok ); 
+
+  if (aMeshId1 != aMeshId2 || aMeshId1 == -1) {
+    QMessageBox::information(SMESHGUI::desktop(), tr("SMESH_INSUFFICIENT_DATA"),
+                             tr("DIFF_MESHES"), QMessageBox::Ok);
     return false;
   }
 
   // Verify whether groups have same types of entities
-  if ( myGroup1->GetType() != myGroup2->GetType() )
-  {
-    QMessageBox::information( SMESHGUI::GetSMESHGUI()->GetDesktop(),
-      tr( "SMESH_INSUFFICIENT_DATA" ), tr( "DIFF_TYPES" ), QMessageBox::Ok );
+  if (myGroup1->GetType() != myGroup2->GetType()) {
+    QMessageBox::information(SMESHGUI::desktop(), tr("SMESH_INSUFFICIENT_DATA"),
+                             tr("DIFF_TYPES"), QMessageBox::Ok);
     return false;
   }
-  
-  
+
   return true;
 }
 
 //=======================================================================
 // name    : SMESHGUI_GroupOpDlg::onApply
-// Purpose : SLOT called when "Apply" button pressed. 
+// Purpose : SLOT called when "Apply" button pressed.
 //=======================================================================
 bool SMESHGUI_GroupOpDlg::onApply()
 {
-  if ( !isValid() || SMESHGUI::GetSMESHGUI()->ActiveStudyLocked() )
+  if (!isValid() || SMESHGUI::GetSMESHGUI()->isActiveStudyLocked())
     return false;
-  
+
   SMESH::SMESH_Mesh_ptr aMesh = myGroup1->GetMesh();
   QString aName = myNameEdit->text();
   SMESH::SMESH_Group_ptr aNewGrp = SMESH::SMESH_Group::_nil();
-  
-  if  ( myMode == UNION ) aNewGrp = aMesh->UnionGroups( myGroup1, myGroup2, aName.latin1() );
-  else if ( myMode == INTERSECT ) aNewGrp = aMesh->IntersectGroups( myGroup1, myGroup2, aName.latin1() );
-  else aNewGrp = aMesh->CutGroups( myGroup1, myGroup2, aName.latin1() );
-
-  if ( !aNewGrp->_is_nil() )
-  {
-    SMESHGUI::GetSMESHGUI()->GetActiveStudy()->updateObjBrowser( true );
+
+  if (myMode == UNION) aNewGrp = aMesh->UnionGroups(myGroup1, myGroup2, aName.latin1());
+  else if (myMode == INTERSECT) aNewGrp = aMesh->IntersectGroups(myGroup1, myGroup2, aName.latin1());
+  else aNewGrp = aMesh->CutGroups(myGroup1, myGroup2, aName.latin1());
+
+  if (!aNewGrp->_is_nil()) {
+    SMESHGUI::GetSMESHGUI()->updateObjBrowser(true);
     reset();
     return true;
-  }
-  else
-  {
-    QMessageBox::critical( SMESHGUI::GetSMESHGUI()->GetDesktop(),
-      tr( "SMESH_ERROR" ), tr( "SMESH_OPERATION_FAILED" ), "OK" ); 
+  } else {
+    QMessageBox::critical(SMESHGUI::desktop(), tr("SMESH_ERROR"),
+                          tr("SMESH_OPERATION_FAILED"), "OK");
     return false;
   }
 }
 
 //=======================================================================
 // name    : SMESHGUI_GroupOpDlg::onOk
-// Purpose : SLOT called when "Ok" button pressed. 
+// Purpose : SLOT called when "Ok" button pressed.
 //=======================================================================
 void SMESHGUI_GroupOpDlg::onOk()
 {
-  if ( onApply() )
+  if (onApply())
     onClose();
 }
 
@@ -281,11 +285,11 @@ void SMESHGUI_GroupOpDlg::onOk()
 //=======================================================================
 void SMESHGUI_GroupOpDlg::onClose()
 {
-  QAD_Application::getDesktop()->SetSelectionMode( ActorSelection );
-  disconnect( mySelection, 0, this, 0 );
-  disconnect( SMESHGUI::GetSMESHGUI(), 0, this, 0 );
+  mySelectionMgr->setSelectionModes(ActorSelection);
+  disconnect(mySelectionMgr, 0, this, 0);
+  disconnect(SMESHGUI::GetSMESHGUI(), 0, this, 0);
   SMESHGUI::GetSMESHGUI()->ResetState();
-  mySelection->ClearFilters();
+  mySelectionMgr->clearFilters();
   reject();
 }
 
@@ -295,23 +299,26 @@ void SMESHGUI_GroupOpDlg::onClose()
 //=======================================================================
 void SMESHGUI_GroupOpDlg::onSelectionDone()
 {
-  if ( myFocusWg == myEdit1 )
+  if (myFocusWg == myEdit1)
     myGroup1 = SMESH::SMESH_GroupBase::_nil();
   else
     myGroup2 = SMESH::SMESH_GroupBase::_nil();
-  
-  myFocusWg->setText( "" );
-  
-  if ( mySelection->IObjectCount() == 1 )
-  {
-    SMESH::SMESH_GroupBase_var aGroup = 
-      SMESH::IObjectToInterface<SMESH::SMESH_GroupBase>( mySelection->firstIObject() );
-    
-    if ( !aGroup->_is_nil() )
+
+  myFocusWg->setText("");
+
+  SALOME_ListIO aList;
+  mySelectionMgr->selectedObjects(aList);
+
+  if (aList.Extent() == 1) {
+    SMESH::SMESH_GroupBase_var aGroup =
+      SMESH::IObjectToInterface<SMESH::SMESH_GroupBase>(aList.First());
+
+    if (!aGroup->_is_nil())
     {
-      myFocusWg->setText( aGroup->GetName() );
+      myFocusWg->setText(aGroup->GetName());
+      myFocusWg->setCursorPosition( 0 );
 
-      if ( myFocusWg == myEdit1 )
+      if (myFocusWg == myEdit1)
         myGroup1 = aGroup;
       else
         myGroup2 = aGroup;
@@ -325,30 +332,33 @@ void SMESHGUI_GroupOpDlg::onSelectionDone()
 //=======================================================================
 void SMESHGUI_GroupOpDlg::onDeactivate()
 {
-  setEnabled( false );
-  mySelection->ClearFilters();
+  setEnabled(false);
+  mySelectionMgr->clearFilters();
 }
 
 //=======================================================================
 // name    : SMESHGUI_GroupOpDlg::enterEvent
 // Purpose : Event filter
 //=======================================================================
-void SMESHGUI_GroupOpDlg::enterEvent( QEvent* )
+void SMESHGUI_GroupOpDlg::enterEvent (QEvent*)
 {
-  SMESHGUI::GetSMESHGUI()->EmitSignalDeactivateDialog() ;   
-  setEnabled( true );
-  QAD_Application::getDesktop()->SetSelectionMode( ActorSelection, true ); 
-  mySelection->AddFilter( new SMESH_TypeFilter( GROUP ) );
+  SMESHGUI::GetSMESHGUI()->EmitSignalDeactivateDialog();
+  setEnabled(true);
+#ifdef NEW_GUI
+  mySelectionMgr->setSelectionModes(ActorSelection, true);
+#else
+  mySelectionMgr->setSelectionModes(ActorSelection);
+#endif
+  mySelectionMgr->installFilter(new SMESH_TypeFilter (GROUP));
 }
 
-
-//=================================================================================
-// function : closeEvent()
-// purpose  :
-//=================================================================================
-void SMESHGUI_GroupOpDlg::closeEvent( QCloseEvent* )
+//=======================================================================
+// name    : SMESHGUI_GroupOpDlg::closeEvent
+// purpose :
+//=======================================================================
+void SMESHGUI_GroupOpDlg::closeEvent (QCloseEvent*)
 {
-  onClose() ;
+  onClose();
 }
 
 //=======================================================================
@@ -368,34 +378,9 @@ void SMESHGUI_GroupOpDlg::onFocusChanged()
 //=======================================================================
 void SMESHGUI_GroupOpDlg::reset()
 {
-  myNameEdit->setText( "" );
-  myEdit1->setText( "" );
-  myEdit2->setText( "" );
+  myNameEdit->setText("");
+  myEdit1->setText("");
+  myEdit2->setText("");
   myFocusWg = myEdit1;
   myNameEdit->setFocus();
 }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
index a82136f148a08cb413b46adb645bbea9ece0adc2..d05201390a54448ad371550166af24d1d2207c70 100644 (file)
@@ -36,7 +36,7 @@ class QCloseEvent;
 class QLabel;
 class QFrame;
 class QPushButton;
-class SALOME_Selection;
+class SalomeApp_SelectionMgr;
 class QLineEdit;
 
 /*
@@ -52,10 +52,10 @@ public:
   enum { UNION, INTERSECT, CUT };
     
 public:
-                            SMESHGUI_GroupOpDlg( QWidget*, SALOME_Selection*, const int );
+                            SMESHGUI_GroupOpDlg( QWidget*, SalomeApp_SelectionMgr*, const int );
   virtual                   ~SMESHGUI_GroupOpDlg();
 
-  void                      Init( SALOME_Selection* ) ;
+  void                      Init( SalomeApp_SelectionMgr* ) ;
   
 private:
 
@@ -91,7 +91,7 @@ private:
   QPushButton*              myBtn1;
   QPushButton*              myBtn2;
   
-  SALOME_Selection*         mySelection;
+  SalomeApp_SelectionMgr*   mySelectionMgr;
   int                       myMode;
   
   QLineEdit*                myFocusWg;
@@ -102,8 +102,3 @@ private:
 };
 
 #endif
-
-
-
-
-
index 14462a9be810d059214a816c8822fca5ad271c2a..d2aa17f3a2138e5e5b8777715020a214025f9002 100644 (file)
@@ -1,29 +1,34 @@
 //  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 
-// 
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
 //  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
 
 
-#include "QAD_Study.h"
-#include "SALOMEGUI_QtCatchCorbaException.hxx"
-
 #include "SMESHGUI_GroupUtils.h"
+
+#include "SMESHGUI.h"
 #include "SMESHGUI_Utils.h"
 
+#include "SUIT_Session.h"
+#include "SalomeApp_Application.h"
+#include "SalomeApp_Tools.h"
+
+#include "OB_Browser.h"
+
 namespace SMESH
 {
 
@@ -37,10 +42,12 @@ namespace SMESH
        aGroup = theMesh->CreateGroup( theType, theGroupName );
     }
     catch( const SALOME::SALOME_Exception& S_ex ) {
-      QtCatchCorbaException( S_ex );
+      SalomeApp_Tools::QtCatchCorbaException( S_ex );
     }
-    GetActiveStudy()->updateObjBrowser( true );
+    //SalomeApp_Application* app =
+    //  dynamic_cast<SalomeApp_Application*>(SUIT_Session::session()->activeApplication());
+    //if (app) app->objectBrowser()->updateTree();
+    SMESHGUI::GetSMESHGUI()->updateObjBrowser();
     return aGroup._retn();
   }
-
 }
index 5d47d4c1909a8611f20996ffaacb06e9c9a0f65e..619ec75dc4b0c21cdb29596d78387a2a94e15e1f 100644 (file)
@@ -1,49 +1,54 @@
 //  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 
-// 
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
 //  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
 
-#include <map>
-#include <string>
-
-#include <dlfcn.h>
-
-#include "QAD.h"
-#include "QAD_Tools.h"
-#include "QAD_Config.h"
-#include "QAD_Desktop.h"
-#include "QAD_MessageBox.h"
-#include "QAD_WaitCursor.h"
-#include "QAD_ResourceMgr.h"
-
-#include "SALOMEGUI_QtCatchCorbaException.hxx"
-
 #include "SMESHGUI_HypothesesUtils.h"
+
+#include "SMESHGUI.h"
 #include "SMESHGUI_Hypotheses.h"
 #include "SMESHGUI_XmlHandler.h"
-#include "SMESHGUI.h"
-
 #include "SMESHGUI_Utils.h"
 #include "SMESHGUI_GEOMGenUtils.h"
-#include "SMESHGUI_SMESHGenUtils.h"
+
+#include "SUIT_Tools.h"
+#include "SUIT_Desktop.h"
+#include "SUIT_MessageBox.h"
+#include "SUIT_OverrideCursor.h"
+#include "SUIT_ResourceMgr.h"
+#include "SUIT_Session.h"
+
+#include "OB_Browser.h"
+
+#include "SalomeApp_Study.h"
+#include "SalomeApp_Tools.h"
+#include "SalomeApp_Application.h"
+
+#include <SALOMEDSClient_Study.hxx>
+#include <SALOMEDSClient_SObject.hxx>
 
 #include "SALOMEconfig.h"
 #include CORBA_CLIENT_HEADER(SALOMEDS_Attributes)
 
+#include <map>
+#include <string>
+
+#include <dlfcn.h>
+
 #ifdef _DEBUG_
 static int MYDEBUG = 0;
 #else
@@ -51,7 +56,7 @@ static int MYDEBUG = 0;
 #endif
 
 namespace SMESH{
-  
+
   using namespace std;
 
   typedef map<string,HypothesisData*> THypothesisDataMap;
@@ -61,12 +66,12 @@ namespace SMESH{
   typedef map<string,SMESHGUI_GenericHypothesisCreator*> THypCreatorMap;
   THypCreatorMap myHypCreatorMap;
 
-  void addMap( const THypothesisDataMap& theMap,
+  void addMap(const THypothesisDataMap& theMap,
               THypothesisDataMap& toMap)
   {
     THypothesisDataMap::const_iterator it;
-    for ( it = theMap.begin(); it != theMap.end(); it++ )
-      toMap.insert( *it );
+    for (it = theMap.begin(); it != theMap.end(); it++)
+      toMap.insert(*it);
   }
 
 
@@ -74,79 +79,79 @@ namespace SMESH{
                               SMESH::SMESH_Hypothesis_ptr theHyp,
                               const bool theIsAddition)
   {
-    if ( theHypStatus > SMESH::HYP_OK ) {
-      
+    if (theHypStatus > SMESH::HYP_OK) {
+
       // get Hyp name
       QString aHypName ("NULL Hypothesis");
-      if ( !CORBA::is_nil( theHyp )) {
-       SALOMEDS::SObject_var Shyp = SMESH::FindSObject( theHyp );
-       if ( !CORBA::is_nil( Shyp ))
+      if (!CORBA::is_nil(theHyp)) {
+       _PTR(SObject) Shyp = SMESH::FindSObject(theHyp);
+       if (Shyp)
          // name in study
-         aHypName = Shyp->GetName();
+         aHypName = Shyp->GetName().c_str();
        else
          // label in xml file
-         aHypName = GetHypothesisData( theHyp->GetName() )->Label;
+         aHypName = GetHypothesisData(theHyp->GetName())->Label;
       }
 
       // message
-      bool isFatal = ( theHypStatus >= SMESH::HYP_UNKNOWN_FATAL );
+      bool isFatal = (theHypStatus >= SMESH::HYP_UNKNOWN_FATAL);
       QString aMsg;
-      if ( theIsAddition )
-       aMsg = ( isFatal ? "SMESH_CANT_ADD_HYP" : "SMESH_ADD_HYP_WRN");
+      if (theIsAddition)
+       aMsg = (isFatal ? "SMESH_CANT_ADD_HYP" : "SMESH_ADD_HYP_WRN");
       else
-       aMsg = ( isFatal ? "SMESH_CANT_RM_HYP"  : "SMESH_RM_HYP_WRN");
-      
-      aMsg = QObject::tr( aMsg ).arg( aHypName ) +
-       QObject::tr( QString( "SMESH_HYP_%1" ).arg( theHypStatus ));
-      
-      QAD_MessageBox::warn1(QAD_Application::getDesktop(),
-                           QObject::tr( "SMESH_WRN_WARNING" ),
+       aMsg = (isFatal ? "SMESH_CANT_RM_HYP"  : "SMESH_RM_HYP_WRN");
+
+      aMsg = QObject::tr(aMsg).arg(aHypName) +
+       QObject::tr(QString("SMESH_HYP_%1").arg(theHypStatus));
+
+      SUIT_MessageBox::warn1(SMESHGUI::desktop(),
+                           QObject::tr("SMESH_WRN_WARNING"),
                            aMsg,
-                           QObject::tr( "SMESH_BUT_OK" ));
+                           QObject::tr("SMESH_BUT_OK"));
     }
   }
 
 
   void InitAvailableHypotheses()
   {
-    QAD_WaitCursor wc;
+    SUIT_OverrideCursor wc;
     if (myHypothesesMap.empty() && myAlgorithmsMap.empty()) {
       // Resource manager
-      QAD_ResourceMgr* resMgr = QAD_Desktop::createResourceManager();
+      SUIT_ResourceMgr* resMgr = SMESHGUI::resourceMgr();
       if (!resMgr) return;
-      
+
       // Find name of a resource XML file ("SMESH_Meshers.xml");
       QString HypsXml;
       char* cenv = getenv("SMESH_MeshersList");
       if (cenv)
        HypsXml.sprintf("%s", cenv);
-      
-      QStringList HypsXmlList = QStringList::split( ":", HypsXml, false );
+
+      QStringList HypsXmlList = QStringList::split(":", HypsXml, false);
       if (HypsXmlList.count() == 0)
        {
-         QAD_MessageBox::error1(QAD_Application::getDesktop(),
+         SUIT_MessageBox::error1(SMESHGUI::desktop(),
                                 QObject::tr("SMESH_WRN_WARNING"),
                                 QObject::tr("MESHERS_FILE_NO_VARIABLE"),
                                 QObject::tr("SMESH_BUT_OK"));
          return;
        }
-      
+
       // loop on files in HypsXml
       QString aNoAccessFiles;
-      for ( int i = 0; i < HypsXmlList.count(); i++ ) {
+      for (int i = 0; i < HypsXmlList.count(); i++) {
        QString HypsXml = HypsXmlList[ i ];
-       
+
        // Find full path to the resource XML file
        QString xmlFile = HypsXml + ".xml";
-       xmlFile = QAD_Tools::addSlash(resMgr->findFile(xmlFile, HypsXml)) + xmlFile;
-       
-       QFile file (QAD_Tools::unix2win(xmlFile));
+       xmlFile = resMgr->path("resources", "SMESH", xmlFile);
+
+       QFile file (xmlFile);
        if (file.exists() && file.open(IO_ReadOnly)) {
          file.close();
-         
+
          SMESHGUI_XmlHandler* aXmlHandler = new SMESHGUI_XmlHandler();
          ASSERT(aXmlHandler);
-         
+
          QXmlInputSource source (file);
          QXmlSimpleReader reader;
          reader.setContentHandler(aXmlHandler);
@@ -154,11 +159,11 @@ namespace SMESH{
          bool ok = reader.parse(source);
          file.close();
          if (ok) {
-           addMap( aXmlHandler->myHypothesesMap, myHypothesesMap );
-           addMap( aXmlHandler->myAlgorithmsMap, myAlgorithmsMap );
+           addMap(aXmlHandler->myHypothesesMap, myHypothesesMap);
+           addMap(aXmlHandler->myAlgorithmsMap, myAlgorithmsMap);
          }
          else {
-           QAD_MessageBox::error1(QAD_Application::getDesktop(), 
+           SUIT_MessageBox::error1(SMESHGUI::desktop(),
                                   QObject::tr("INF_PARSE_ERROR"),
                                   QObject::tr(aXmlHandler->errorProtocol()),
                                   QObject::tr("SMESH_BUT_OK"));
@@ -171,17 +176,17 @@ namespace SMESH{
            aNoAccessFiles += ", " + xmlFile;
        }
       } // end loop
-      
-      
+
+
       if (!aNoAccessFiles.isEmpty()) {
        QString aMess = QObject::tr("MESHERS_FILE_CANT_OPEN") + " " + aNoAccessFiles + "\n";
        aMess += QObject::tr("MESHERS_FILE_CHECK_VARIABLE");
-       wc.stop();
-       QAD_MessageBox::warn1(QAD_Application::getDesktop(),
+       wc.suspend();
+       SUIT_MessageBox::warn1(SMESHGUI::desktop(),
                              QObject::tr("SMESH_WRN_WARNING"),
                              aMess,
                              QObject::tr("SMESH_BUT_OK"));
-       wc.start();
+       wc.resume();
       }
     }
   }
@@ -190,10 +195,10 @@ namespace SMESH{
   QStringList GetAvailableHypotheses(const bool isAlgo)
   {
     QStringList aHypList;
-    
+
     // Init list of available hypotheses, if needed
     InitAvailableHypotheses();
-    
+
     // fill list of hypotheses/algorithms
     THypothesisDataMap::iterator anIter;
     if (isAlgo) {
@@ -208,10 +213,10 @@ namespace SMESH{
        aHypList.append(((*anIter).first).c_str());
       }
     }
-    
+
     return aHypList;
   }
-  
+
 
   HypothesisData* GetHypothesisData (const char* aHypType)
   {
@@ -237,7 +242,7 @@ namespace SMESH{
     if(MYDEBUG) MESSAGE("Get HypothesisCreator for " << aHypType);
 
     SMESHGUI_GenericHypothesisCreator* aCreator = 0;
-    
+
     // check, if creator for this hypothesis type already exists
     if (myHypCreatorMap.find(aHypType) != myHypCreatorMap.end()) {
       aCreator = myHypCreatorMap[aHypType];
@@ -270,7 +275,7 @@ namespace SMESH{
          typedef SMESHGUI_GenericHypothesisCreator* (*GetHypothesisCreator) \
            (QString aHypType, QString aServerLibName, SMESHGUI* aSMESHGUI);
          GetHypothesisCreator procHandle =
-           (GetHypothesisCreator)dlsym( libHandle, "GetHypothesisCreator" );
+           (GetHypothesisCreator)dlsym(libHandle, "GetHypothesisCreator");
          if (!procHandle) {
            if(MYDEBUG) MESSAGE("bad hypothesis client plugin library");
            dlclose(libHandle);
@@ -290,7 +295,7 @@ namespace SMESH{
        }
       }
       catch (const SALOME::SALOME_Exception& S_ex) {
-       QtCatchCorbaException(S_ex);
+       SalomeApp_Tools::QtCatchCorbaException(S_ex);
       }
     }
 
@@ -305,24 +310,29 @@ namespace SMESH{
     if(MYDEBUG) MESSAGE("Create " << aHypType << " with name " << aHypName);
 
     SMESH::SMESH_Hypothesis_var Hyp;
-    
+
     HypothesisData* aHypData = GetHypothesisData(aHypType);
     QString aServLib = aHypData->ServerLibName;
-    
+
     try {
-      Hyp = SMESH::GetSMESHGen()->CreateHypothesis(aHypType, aServLib);
+      Hyp = SMESHGUI::GetSMESHGen()->CreateHypothesis(aHypType, aServLib);
       if (!Hyp->_is_nil()) {
-       SALOMEDS::SObject_var SHyp = SMESH::FindSObject(Hyp.in());
-       if (!SHyp->_is_nil()) {
-         if ( strcmp(aHypName,"") != 0 )
-           SMESH::SetName( SHyp, aHypName );
-         GetActiveStudy()->updateObjBrowser(true);
+       _PTR(SObject) SHyp = SMESH::FindSObject(Hyp.in());
+       if (SHyp) {
+         //if (strcmp(aHypName,"") != 0)
+         if (strlen(aHypName) > 0)
+           SMESH::SetName(SHyp, aHypName);
+         //SalomeApp_Application* app =
+         //  dynamic_cast<SalomeApp_Application*>(SUIT_Session::session()->activeApplication());
+         //if (app)
+         //  app->objectBrowser()->updateTree();
+          SMESHGUI::GetSMESHGUI()->updateObjBrowser();
          return Hyp._retn();
        }
       }
     }
     catch (const SALOME::SALOME_Exception & S_ex) {
-      QtCatchCorbaException(S_ex);
+      SalomeApp_Tools::QtCatchCorbaException(S_ex);
     }
 
     return SMESH::SMESH_Hypothesis::_nil();
@@ -332,29 +342,29 @@ namespace SMESH{
   bool AddHypothesisOnMesh (SMESH::SMESH_Mesh_ptr aMesh, SMESH::SMESH_Hypothesis_ptr aHyp)
   {
     if(MYDEBUG) MESSAGE ("SMESHGUI::AddHypothesisOnMesh");
-    int res = SMESH::HYP_UNKNOWN_FATAL; 
-    QAD_WaitCursor wc;
-    
-    if ( !aMesh->_is_nil() ) {
-      SALOMEDS::SObject_var SM = SMESH::FindSObject( aMesh );
+    int res = SMESH::HYP_UNKNOWN_FATAL;
+    SUIT_OverrideCursor wc;
+
+    if (!aMesh->_is_nil()) {
+      _PTR(SObject) SM = SMESH::FindSObject(aMesh);
       GEOM::GEOM_Object_var aShapeObject = SMESH::GetShapeOnMeshOrSubMesh(SM);
       try {
-       res = aMesh->AddHypothesis( aShapeObject, aHyp );
-       if ( res < SMESH::HYP_UNKNOWN_FATAL ) {
-         SALOMEDS::SObject_var SH = SMESH::FindSObject(aHyp);
-         if ( !SM->_is_nil() && !SH->_is_nil() ) {
+       res = aMesh->AddHypothesis(aShapeObject, aHyp);
+       if (res < SMESH::HYP_UNKNOWN_FATAL) {
+         _PTR(SObject) SH = SMESH::FindSObject(aHyp);
+         if (SM && SH) {
            SMESH::ModifiedMesh(SM, false);
          }
        }
-       if ( res > SMESH::HYP_OK ) {
-         wc.stop();
-         processHypothesisStatus( res, aHyp, true );
-         wc.start();
+       if (res > SMESH::HYP_OK) {
+         wc.suspend();
+         processHypothesisStatus(res, aHyp, true);
+         wc.resume();
        }
       }
-      catch( const SALOME::SALOME_Exception& S_ex ) {
-       wc.stop();
-       QtCatchCorbaException( S_ex );
+      catch(const SALOME::SALOME_Exception& S_ex) {
+       wc.suspend();
+       SalomeApp_Tools::QtCatchCorbaException(S_ex);
        res = SMESH::HYP_UNKNOWN_FATAL;
       }
     }
@@ -364,164 +374,164 @@ namespace SMESH{
 
   bool AddHypothesisOnSubMesh (SMESH::SMESH_subMesh_ptr aSubMesh, SMESH::SMESH_Hypothesis_ptr aHyp)
   {
-    if(MYDEBUG) MESSAGE( "SMESHGUI::AddHypothesisOnSubMesh() ");
+    if(MYDEBUG) MESSAGE("SMESHGUI::AddHypothesisOnSubMesh() ");
     int res = SMESH::HYP_UNKNOWN_FATAL;
-    QAD_WaitCursor wc;
-    
-    if ( !aSubMesh->_is_nil() && ! aHyp->_is_nil() ) {
+    SUIT_OverrideCursor wc;
+
+    if (!aSubMesh->_is_nil() && ! aHyp->_is_nil()) {
       try {
        SMESH::SMESH_Mesh_var aMesh = aSubMesh->GetFather();
-       SALOMEDS::SObject_var SsubM = SMESH::FindSObject( aSubMesh );
-       GEOM::GEOM_Object_var aShapeObject = SMESH::GetShapeOnMeshOrSubMesh( SsubM );
-       if ( !aMesh->_is_nil() && !SsubM->_is_nil() && !aShapeObject->_is_nil() ) {
-         res = aMesh->AddHypothesis( aShapeObject, aHyp );
-         if ( res < SMESH::HYP_UNKNOWN_FATAL )  {
-            SALOMEDS::SObject_var meshSO = SMESH::FindSObject( aMesh );
-            if ( !meshSO->_is_nil() )
-              SMESH::ModifiedMesh( meshSO, false );
+       _PTR(SObject) SsubM = SMESH::FindSObject(aSubMesh);
+       GEOM::GEOM_Object_var aShapeObject = SMESH::GetShapeOnMeshOrSubMesh(SsubM);
+       if (!aMesh->_is_nil() && SsubM && !aShapeObject->_is_nil()) {
+         res = aMesh->AddHypothesis(aShapeObject, aHyp);
+         if (res < SMESH::HYP_UNKNOWN_FATAL)  {
+            _PTR(SObject) meshSO = SMESH::FindSObject(aMesh);
+            if (meshSO)
+              SMESH::ModifiedMesh(meshSO, false);
          }
-         if ( res > SMESH::HYP_OK ) {
-           wc.stop();
-           processHypothesisStatus( res, aHyp, true );
-           wc.start();
+         if (res > SMESH::HYP_OK) {
+           wc.suspend();
+           processHypothesisStatus(res, aHyp, true);
+           wc.resume();
          }
        }
        else {
-         SCRUTE( aHyp->_is_nil() );
-         SCRUTE( aMesh->_is_nil() );
-         SCRUTE( SsubM->_is_nil() );
-         SCRUTE( aShapeObject->_is_nil() );
+         SCRUTE(aHyp->_is_nil());
+         SCRUTE(aMesh->_is_nil());
+         SCRUTE(!SsubM);
+         SCRUTE(aShapeObject->_is_nil());
        }
       }
-      catch( const SALOME::SALOME_Exception& S_ex ) {
-       wc.stop();
-       QtCatchCorbaException( S_ex );
+      catch(const SALOME::SALOME_Exception& S_ex) {
+       wc.suspend();
+       SalomeApp_Tools::QtCatchCorbaException(S_ex);
        res = SMESH::HYP_UNKNOWN_FATAL;
       }
     }
     else {
-      SCRUTE( aSubMesh->_is_nil() );
-      SCRUTE( aHyp->_is_nil() );
+      SCRUTE(aSubMesh->_is_nil());
+      SCRUTE(aHyp->_is_nil());
     }
     return res < SMESH::HYP_UNKNOWN_FATAL;
   }
-  
+
   bool RemoveHypothesisOrAlgorithmOnMesh (const Handle(SALOME_InteractiveObject)& IObject)
   {
     int res = SMESH::HYP_UNKNOWN_FATAL;
-    QAD_WaitCursor wc;
-    
+    SUIT_OverrideCursor wc;
+
     if (IObject->hasReference()) {
       try {
-       SALOMEDS::Study_var aStudy = GetActiveStudyDocument();
+       _PTR(Study) aStudy = GetActiveStudyDocument();
        SMESH_Hypothesis_var anHyp = IObjectToInterface<SMESH_Hypothesis>(IObject);
-       SALOMEDS::SObject_var aHypSObj = aStudy->FindObjectID(IObject->getReference());
-       if (!aHypSObj->_is_nil()) {
-         SALOMEDS::SObject_var MorSM = SMESH::GetMeshOrSubmesh(aHypSObj);
-         if (!MorSM->_is_nil()) {
+       _PTR(SObject) aHypSObj = aStudy->FindObjectID(IObject->getReference());
+       if (aHypSObj) {
+         _PTR(SObject) MorSM = SMESH::GetMeshOrSubmesh(aHypSObj);
+         if (MorSM) {
            GEOM::GEOM_Object_var aShape = SMESH::GetShapeOnMeshOrSubMesh(MorSM);
            if (!aShape->_is_nil()){
-             SMESH::SMESH_Mesh_var aMesh = 
+             SMESH::SMESH_Mesh_var aMesh =
                SMESH::SObjectToInterface<SMESH::SMESH_Mesh>(MorSM);
              SMESH::SMESH_subMesh_var aSubMesh =
                SMESH::SObjectToInterface<SMESH::SMESH_subMesh>(MorSM);
-             
+
              if (!aSubMesh->_is_nil())
                aMesh = aSubMesh->GetFather();
-             
+
              if (!aMesh->_is_nil()) {
                res = aMesh->RemoveHypothesis(aShape, anHyp);
-               if ( res < SMESH::HYP_UNKNOWN_FATAL ) {
-                  SALOMEDS::SObject_var meshSO = SMESH::FindSObject( aMesh );
-                  if ( !meshSO->_is_nil() )
+               if (res < SMESH::HYP_UNKNOWN_FATAL) {
+                  _PTR(SObject) meshSO = SMESH::FindSObject(aMesh);
+                  if (meshSO)
                     SMESH::ModifiedMesh(meshSO, false);
                 }
-               if ( res > SMESH::HYP_OK ) {
-                 wc.stop();
-                 processHypothesisStatus( res, anHyp, false );
-                 wc.start();
+               if (res > SMESH::HYP_OK) {
+                 wc.suspend();
+                 processHypothesisStatus(res, anHyp, false);
+                 wc.resume();
                }
              }
            }
          }
        }
       }
-      catch( const SALOME::SALOME_Exception& S_ex ) {
-       wc.stop();
-       QtCatchCorbaException( S_ex );
+      catch(const SALOME::SALOME_Exception& S_ex) {
+       wc.suspend();
+       SalomeApp_Tools::QtCatchCorbaException(S_ex);
        res = SMESH::HYP_UNKNOWN_FATAL;
       }
-    } 
+    }
     else if (IObject->hasEntry()) {
       if(MYDEBUG) MESSAGE("IObject entry " << IObject->getEntry());
     }
     return res < SMESH::HYP_UNKNOWN_FATAL;
   }
-  
-  bool RemoveHypothesisOrAlgorithmOnMesh (SALOMEDS::SObject_ptr MorSM,
+
+  bool RemoveHypothesisOrAlgorithmOnMesh (_PTR(SObject) MorSM,
                                          SMESH::SMESH_Hypothesis_ptr anHyp)
   {
-    SALOMEDS::SObject_var AHR, aRef;
     SALOMEDS::GenericAttribute_var anAttr;
     SALOMEDS::AttributeIOR_var anIOR;
     int res = SMESH::HYP_UNKNOWN_FATAL;
-    QAD_WaitCursor wc;
-    
-    if (!MorSM->_is_nil()) {
+    SUIT_OverrideCursor wc;
+
+    if (MorSM) {
       try {
        GEOM::GEOM_Object_var aShapeObject = SMESH::GetShapeOnMeshOrSubMesh(MorSM);
        if (!aShapeObject->_is_nil()) {
          SMESH::SMESH_Mesh_var aMesh = SMESH::SObjectToInterface<SMESH::SMESH_Mesh>(MorSM);
          SMESH::SMESH_subMesh_var aSubMesh = SMESH::SObjectToInterface<SMESH::SMESH_subMesh>(MorSM);
-         
-         if ( !aSubMesh->_is_nil() )
+
+         if (!aSubMesh->_is_nil())
            aMesh = aSubMesh->GetFather();
-         
+
          if (!aMesh->_is_nil()) {
            res = aMesh->RemoveHypothesis(aShapeObject, anHyp);
-           if ( res < SMESH::HYP_UNKNOWN_FATAL ) {
-              SALOMEDS::SObject_var meshSO = SMESH::FindSObject( aMesh );
-              if ( !meshSO->_is_nil() )
+           if (res < SMESH::HYP_UNKNOWN_FATAL) {
+              _PTR(SObject) meshSO = SMESH::FindSObject(aMesh);
+              if (meshSO)
                 SMESH::ModifiedMesh(meshSO, false);
             }
-           if ( res > SMESH::HYP_OK ) {
-             wc.stop();
-             processHypothesisStatus( res, anHyp, false );
-             wc.start();
+           if (res > SMESH::HYP_OK) {
+             wc.suspend();
+             processHypothesisStatus(res, anHyp, false);
+             wc.resume();
            }
          }
        }
-      } catch( const SALOME::SALOME_Exception& S_ex ) {
-       wc.stop();
-       QtCatchCorbaException( S_ex );
+      } catch(const SALOME::SALOME_Exception& S_ex) {
+       wc.suspend();
+       SalomeApp_Tools::QtCatchCorbaException(S_ex);
        res = SMESH::HYP_UNKNOWN_FATAL;
       }
     }
     return res < SMESH::HYP_UNKNOWN_FATAL;
   }
 
-  SALOMEDS::Study::ListOfSObject* GetMeshesUsingAlgoOrHypothesis( SMESH::SMESH_Hypothesis_ptr AlgoOrHyp )
+  SObjectList GetMeshesUsingAlgoOrHypothesis(SMESH::SMESH_Hypothesis_ptr AlgoOrHyp)
   {
-    SALOMEDS::Study::ListOfSObject_var listSOmesh =
-      new SALOMEDS::Study::ListOfSObject;
-    listSOmesh->length(0);
+    SObjectList listSOmesh;
+    listSOmesh.resize(0);
+
     unsigned int index = 0;
     if (!AlgoOrHyp->_is_nil()) {
-      SALOMEDS::SObject_var SO_Hypothesis = SMESH::FindSObject(AlgoOrHyp);
-      if (!SO_Hypothesis->_is_nil()) {
-       SALOMEDS::Study::ListOfSObject_var listSO =
-         GetActiveStudyDocument()->FindDependances(SO_Hypothesis);
-       if(MYDEBUG) MESSAGE("SMESHGUI::GetMeshesUsingAlgoOrHypothesis(): dependency number ="<<listSO->length());
-       for (unsigned int i = 0; i < listSO->length(); i++) {
-         SALOMEDS::SObject_ptr SO = listSO[i];
-         if (!SO->_is_nil()) { 
-           SALOMEDS::SObject_var aFather = SO->GetFather();
-           if (!aFather->_is_nil()) {
-             SALOMEDS::SObject_var SOfatherFather = aFather->GetFather();
-             if (!SOfatherFather->_is_nil()) {
+      _PTR(SObject) SO_Hypothesis = SMESH::FindSObject(AlgoOrHyp);
+      if (SO_Hypothesis) {
+       SObjectList listSO =
+         SMESHGUI::activeStudy()->studyDS()->FindDependances(SO_Hypothesis);
+
+       if(MYDEBUG) MESSAGE("SMESHGUI::GetMeshesUsingAlgoOrHypothesis(): dependency number ="<<listSO.size());
+       for (unsigned int i = 0; i < listSO.size(); i++) {
+         _PTR(SObject) SO = listSO[i];
+         if (!SO) {
+           _PTR(SObject) aFather = SO->GetFather();
+           if (aFather) {
+             _PTR(SObject) SOfatherFather = aFather->GetFather();
+             if (SOfatherFather) {
                if(MYDEBUG) MESSAGE("SMESHGUI::GetMeshesUsingAlgoOrHypothesis(): dependency added to list");
                index++;
-               listSOmesh->length(index);
+               listSOmesh.resize(index);
                listSOmesh[index - 1] = SOfatherFather;
              }
            }
@@ -529,8 +539,7 @@ namespace SMESH{
        }
       }
     }
-    if(MYDEBUG) MESSAGE("SMESHGUI::GetMeshesUsingAlgoOrHypothesis(): completed");
-    return listSOmesh._retn();
+    if (MYDEBUG) MESSAGE("SMESHGUI::GetMeshesUsingAlgoOrHypothesis(): completed");
+    return listSOmesh;
   }
-
 }
index d87f45cb8a972efe356788574117d8a717b7ad1a..16d935b1e3f70e6fb842d70d32d2b22bb08111e0 100644 (file)
 #include <qstringlist.h>
 
 #include "SALOME_InteractiveObject.hxx"
+#include "SALOMEDSClient_definitions.hxx"
 
 #include "SALOMEconfig.h"
 #include CORBA_CLIENT_HEADER(SALOMEDS)
 #include CORBA_SERVER_HEADER(SMESH_Mesh)
 #include CORBA_SERVER_HEADER(SMESH_Hypothesis)
 
+#include <vector>
+
 class HypothesisData;
 class SMESHGUI_GenericHypothesisCreator;
+class SALOMEDSClient_SObject;
 
 namespace SMESH{
 
@@ -61,10 +65,11 @@ namespace SMESH{
 
   bool RemoveHypothesisOrAlgorithmOnMesh(const Handle(SALOME_InteractiveObject)& IObject);
 
-  bool RemoveHypothesisOrAlgorithmOnMesh(SALOMEDS::SObject_ptr MorSM,
+  bool RemoveHypothesisOrAlgorithmOnMesh(_PTR(SObject) MorSM,
                                         SMESH::SMESH_Hypothesis_ptr anHyp);
 
-  SALOMEDS::Study::ListOfSObject* GetMeshesUsingAlgoOrHypothesis(SMESH::SMESH_Hypothesis_ptr AlgoOrHyp ) ;
+  typedef std::vector<_PTR(SObject)> SObjectList;
+  SObjectList GetMeshesUsingAlgoOrHypothesis(SMESH::SMESH_Hypothesis_ptr AlgoOrHyp ) ;
 
 }
 
index 68a7375033b8b6bbe0aa7daad00a085aeb47c184..ce686c62ad9a615fc61fdc959cfd3042edb19037 100644 (file)
@@ -1,23 +1,23 @@
 //  SMESH SMESHGUI : GUI for SMESH component
 //
 //  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
-// 
-//  This library is free software; you can redistribute it and/or 
-//  modify it under the terms of the GNU Lesser General Public 
-//  License as published by the Free Software Foundation; either 
-//  version 2.1 of the License. 
-// 
-//  This library is distributed in the hope that it will be useful, 
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of 
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
-//  Lesser General Public License for more details. 
-// 
-//  You should have received a copy of the GNU Lesser General Public 
-//  License along with this library; if not, write to the Free Software 
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
-// 
-//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
 //
 //
 //
 
 #include "SMESHGUI.h"
 #include "SMESHGUI_Utils.h"
-#include "SMESHGUI_SMESHGenUtils.h"
 #include "SMESHGUI_HypothesesUtils.h"
 
+#include "SMESH_TypeFilter.hxx"
+#include "SMESH_NumberFilter.hxx"
+
 #include "GEOMBase.h"
 
-#include "QAD_Application.h"
-#include "QAD_Desktop.h"
-#include "QAD_MessageBox.h"
-#include "QAD_WaitCursor.h"
-#include "QAD_Operation.h"
+#include "SUIT_Session.h"
+#include "SUIT_MessageBox.h"
+#include "SUIT_OverrideCursor.h"
+#include "SUIT_Operation.h"
+#include "SUIT_Desktop.h"
 
+#include "SALOMEDSClient_Study.hxx"
+#include "SALOMEDS_SObject.hxx"
+#include "SALOME_ListIO.hxx"
 #include "SALOME_ListIteratorOfListIO.hxx"
-#include "SALOMEGUI_QtCatchCorbaException.hxx"
+#include "SalomeApp_Tools.h"
+
+#include "SVTK_ViewModel.h"
 
 #include "utilities.h"
 
 
 using namespace std;
 
-namespace SMESH{
-  SMESH::SMESH_Mesh_var InitMesh(GEOM::GEOM_Object_ptr theShapeObject, 
-                                const char* theMeshName)
+namespace SMESH {
+  SMESH::SMESH_Mesh_var InitMesh (GEOM::GEOM_Object_ptr theShapeObject,
+                                  const char* theMeshName)
   {
     SMESH::SMESH_Mesh_var aMesh;
     try {
-      SMESH::SMESH_Gen_var aSMESHGen = SMESH::GetSMESHGen();
-      if ( !aSMESHGen->_is_nil() && !theShapeObject->_is_nil() ) {
-       aMesh = aSMESHGen->CreateMesh( theShapeObject );
-       if ( !aMesh->_is_nil() ) {
-         SALOMEDS::SObject_var aMeshSObject = SMESH::FindSObject( aMesh.in() );
-         SMESH::SetName( aMeshSObject, theMeshName );
+      SMESH::SMESH_Gen_var aSMESHGen = SMESHGUI::GetSMESHGen();
+      if (!aSMESHGen->_is_nil() && !theShapeObject->_is_nil()) {
+       aMesh = aSMESHGen->CreateMesh(theShapeObject);
+       if (!aMesh->_is_nil()) {
+         _PTR(SObject) aMeshSObject = SMESH::FindSObject(aMesh.in());
+         SMESH::SetName(aMeshSObject, theMeshName);
        }
       }
     }
-    catch( const SALOME::SALOME_Exception& S_ex ) {
-      QtCatchCorbaException( S_ex );
+    catch (const SALOME::SALOME_Exception& S_ex) {
+      SalomeApp_Tools::QtCatchCorbaException(S_ex);
     }
     return aMesh._retn();
   }
@@ -80,162 +87,166 @@ namespace SMESH{
 
 //=================================================================================
 // class    : SMESHGUI_InitMeshDlg()
-// purpose  : Constructs a SMESHGUI_InitMeshDlg which is a child of 'parent', with the 
+// purpose  : Constructs a SMESHGUI_InitMeshDlg which is a child of 'parent', with the
 //            name 'name' and widget flags set to 'f'.
 //            The dialog will by default be modeless, unless you set 'modal' to
 //            TRUE to construct a modal dialog.
 //=================================================================================
-SMESHGUI_InitMeshDlg::SMESHGUI_InitMeshDlg( QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl )
-    : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | WDestructiveClose )
+SMESHGUI_InitMeshDlg::SMESHGUI_InitMeshDlg (SMESHGUI* theModule, const char* name,
+                                            bool modal, WFlags fl)
+     : QDialog( SMESH::GetDesktop( theModule ), name, modal, WStyle_Customize | WStyle_NormalBorder |
+               WStyle_Title | WStyle_SysMenu | WDestructiveClose),
+    mySMESHGUI( theModule ),
+    mySelectionMgr( SMESH::GetSelectionMgr( theModule ) )
 {
-    QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "SMESH",tr("ICON_SELECT")));
-    if ( !name )
-       setName( "SMESHGUI_InitMeshDlg" );
-    setCaption( tr( "SMESH_INIT_MESH"  ) );
-    setSizeGripEnabled( TRUE );
-    QGridLayout* SMESHGUI_InitMeshDlgLayout = new QGridLayout( this ); 
-    SMESHGUI_InitMeshDlgLayout->setSpacing( 6 );
-    SMESHGUI_InitMeshDlgLayout->setMargin( 11 );
-    
+    QPixmap image0 (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_SELECT")));
+    if (!name)
+      setName("SMESHGUI_InitMeshDlg");
+
+    setCaption(tr("SMESH_INIT_MESH"));
+    setSizeGripEnabled(TRUE);
+    QGridLayout* SMESHGUI_InitMeshDlgLayout = new QGridLayout (this);
+    SMESHGUI_InitMeshDlgLayout->setSpacing(6);
+    SMESHGUI_InitMeshDlgLayout->setMargin(11);
+
     /***************************************************************/
-    GroupC1 = new QGroupBox( tr( "SMESH_ARGUMENTS" ), this, "GroupC1" );
-    GroupC1->setColumnLayout(0, Qt::Vertical );
-    GroupC1->layout()->setSpacing( 0 );
-    GroupC1->layout()->setMargin( 0 );
-    QGridLayout* GroupC1Layout = new QGridLayout( GroupC1->layout() );
-    GroupC1Layout->setAlignment( Qt::AlignTop );
-    GroupC1Layout->setSpacing( 6 );
-    GroupC1Layout->setMargin( 11 );
-
-    TextLabel_NameMesh = new QLabel( tr( "SMESH_NAME" ), GroupC1, "TextLabel_NameMesh" );
-    GroupC1Layout->addWidget( TextLabel_NameMesh, 0, 0 );
-    LineEdit_NameMesh = new QLineEdit( GroupC1, "LineEdit_NameMesh" );
-    GroupC1Layout->addWidget( LineEdit_NameMesh, 0, 2 );
-
-    TextLabelC1A1 = new QLabel( tr( "SMESH_OBJECT_GEOM" ), GroupC1, "TextLabelC1A1" );
-    GroupC1Layout->addWidget( TextLabelC1A1, 1, 0 );
-    SelectButtonC1A1 = new QPushButton( GroupC1, "SelectButtonC1A1" );
-    SelectButtonC1A1->setPixmap( image0 );
-    SelectButtonC1A1->setToggleButton( FALSE );
-    GroupC1Layout->addWidget( SelectButtonC1A1, 1, 1 );
-    LineEditC1A1 = new QLineEdit( GroupC1, "LineEditC1A1" );
-    LineEditC1A1->setReadOnly( true );
-    GroupC1Layout->addWidget( LineEditC1A1, 1, 2 );
-
-    TextLabelC1A1Hyp = new QLabel( tr( "SMESH_OBJECT_HYPOTHESIS" ), GroupC1, "TextLabelC1A1Hyp" );
-    GroupC1Layout->addWidget( TextLabelC1A1Hyp, 2, 0 );
-    SelectButtonC1A1Hyp = new QPushButton( GroupC1, "SelectButtonC1A1Hyp" );
-    SelectButtonC1A1Hyp->setPixmap( image0 );
-    GroupC1Layout->addWidget( SelectButtonC1A1Hyp, 2, 1 );
-    LineEditC1A1Hyp = new QLineEdit( GroupC1, "LineEditC1A1Hyp" );
-    LineEditC1A1Hyp->setReadOnly( true );
-    GroupC1Layout->addWidget( LineEditC1A1Hyp, 2, 2 );
-
-    TextLabelC1A1Algo = new QLabel( tr( "SMESH_OBJECT_ALGORITHM" ), GroupC1, "TextLabelC1A1Algo" );
-    GroupC1Layout->addWidget( TextLabelC1A1Algo, 3, 0 );
-    SelectButtonC1A1Algo = new QPushButton( GroupC1, "SelectButtonC1A1Algo" );
-    SelectButtonC1A1Algo->setPixmap( image0 );
-    GroupC1Layout->addWidget( SelectButtonC1A1Algo, 3, 1 );
-    LineEditC1A1Algo = new QLineEdit( GroupC1, "LineEditC1A1Algo" );
-    LineEditC1A1Algo->setReadOnly( true );
-    GroupC1Layout->addWidget( LineEditC1A1Algo, 3, 2 );
-
-    SMESHGUI_InitMeshDlgLayout->addWidget( GroupC1, 1, 0 );
+    GroupC1 = new QGroupBox(tr("SMESH_ARGUMENTS"), this, "GroupC1");
+    GroupC1->setColumnLayout(0, Qt::Vertical);
+    GroupC1->layout()->setSpacing(0);
+    GroupC1->layout()->setMargin(0);
+    QGridLayout* GroupC1Layout = new QGridLayout(GroupC1->layout());
+    GroupC1Layout->setAlignment(Qt::AlignTop);
+    GroupC1Layout->setSpacing(6);
+    GroupC1Layout->setMargin(11);
+
+    TextLabel_NameMesh = new QLabel(tr("SMESH_NAME"), GroupC1, "TextLabel_NameMesh");
+    GroupC1Layout->addWidget(TextLabel_NameMesh, 0, 0);
+    LineEdit_NameMesh = new QLineEdit(GroupC1, "LineEdit_NameMesh");
+    GroupC1Layout->addWidget(LineEdit_NameMesh, 0, 2);
+
+    TextLabelC1A1 = new QLabel(tr("SMESH_OBJECT_GEOM"), GroupC1, "TextLabelC1A1");
+    GroupC1Layout->addWidget(TextLabelC1A1, 1, 0);
+    SelectButtonC1A1 = new QPushButton(GroupC1, "SelectButtonC1A1");
+    SelectButtonC1A1->setPixmap(image0);
+    SelectButtonC1A1->setToggleButton(FALSE);
+    GroupC1Layout->addWidget(SelectButtonC1A1, 1, 1);
+    LineEditC1A1 = new QLineEdit(GroupC1, "LineEditC1A1");
+    LineEditC1A1->setReadOnly(true);
+    GroupC1Layout->addWidget(LineEditC1A1, 1, 2);
+
+    TextLabelC1A1Hyp = new QLabel(tr("SMESH_OBJECT_HYPOTHESIS"), GroupC1, "TextLabelC1A1Hyp");
+    GroupC1Layout->addWidget(TextLabelC1A1Hyp, 2, 0);
+    SelectButtonC1A1Hyp = new QPushButton(GroupC1, "SelectButtonC1A1Hyp");
+    SelectButtonC1A1Hyp->setPixmap(image0);
+    GroupC1Layout->addWidget(SelectButtonC1A1Hyp, 2, 1);
+    LineEditC1A1Hyp = new QLineEdit(GroupC1, "LineEditC1A1Hyp");
+    LineEditC1A1Hyp->setReadOnly(true);
+    GroupC1Layout->addWidget(LineEditC1A1Hyp, 2, 2);
+
+    TextLabelC1A1Algo = new QLabel(tr("SMESH_OBJECT_ALGORITHM"), GroupC1, "TextLabelC1A1Algo");
+    GroupC1Layout->addWidget(TextLabelC1A1Algo, 3, 0);
+    SelectButtonC1A1Algo = new QPushButton(GroupC1, "SelectButtonC1A1Algo");
+    SelectButtonC1A1Algo->setPixmap(image0);
+    GroupC1Layout->addWidget(SelectButtonC1A1Algo, 3, 1);
+    LineEditC1A1Algo = new QLineEdit(GroupC1, "LineEditC1A1Algo");
+    LineEditC1A1Algo->setReadOnly(true);
+    GroupC1Layout->addWidget(LineEditC1A1Algo, 3, 2);
+
+    SMESHGUI_InitMeshDlgLayout->addWidget(GroupC1, 1, 0);
 
     /***************************************************************/
-    GroupButtons = new QGroupBox( this, "GroupButtons" );
-    GroupButtons->setColumnLayout(0, Qt::Vertical );
-    GroupButtons->layout()->setSpacing( 0 );
-    GroupButtons->layout()->setMargin( 0 );
-    QGridLayout* GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
-    GroupButtonsLayout->setAlignment( Qt::AlignTop );
-    GroupButtonsLayout->setSpacing( 6 );
-    GroupButtonsLayout->setMargin( 11 );
+    GroupButtons = new QGroupBox(this, "GroupButtons");
+    GroupButtons->setColumnLayout(0, Qt::Vertical);
+    GroupButtons->layout()->setSpacing(0);
+    GroupButtons->layout()->setMargin(0);
+    QGridLayout* GroupButtonsLayout = new QGridLayout(GroupButtons->layout());
+    GroupButtonsLayout->setAlignment(Qt::AlignTop);
+    GroupButtonsLayout->setSpacing(6);
+    GroupButtonsLayout->setMargin(11);
 
-    buttonOk = new QPushButton( tr( "SMESH_BUT_OK" ), GroupButtons, "buttonOk" );
-    buttonOk->setAutoDefault( TRUE );
-    buttonOk->setDefault( TRUE );
-    GroupButtonsLayout->addWidget( buttonOk, 0, 0 );
+    buttonOk = new QPushButton(tr("SMESH_BUT_OK"), GroupButtons, "buttonOk");
+    buttonOk->setAutoDefault(TRUE);
+    buttonOk->setDefault(TRUE);
+    GroupButtonsLayout->addWidget(buttonOk, 0, 0);
 
-    buttonApply = new QPushButton( tr( "SMESH_BUT_APPLY" ), GroupButtons, "buttonApply" );
-    buttonApply->setAutoDefault( TRUE );
-    GroupButtonsLayout->addWidget( buttonApply, 0, 1 );
+    buttonApply = new QPushButton(tr("SMESH_BUT_APPLY"), GroupButtons, "buttonApply");
+    buttonApply->setAutoDefault(TRUE);
+    GroupButtonsLayout->addWidget(buttonApply, 0, 1);
 
-    GroupButtonsLayout->addItem( new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ), 0, 2 );
+    GroupButtonsLayout->addItem(new QSpacerItem(20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum), 0, 2);
 
-    buttonCancel = new QPushButton( tr( "SMESH_BUT_CLOSE" ), GroupButtons, "buttonCancel" );
-    buttonCancel->setAutoDefault( TRUE );
-    GroupButtonsLayout->addWidget( buttonCancel, 0, 3 );
+    buttonCancel = new QPushButton(tr("SMESH_BUT_CLOSE"), GroupButtons, "buttonCancel");
+    buttonCancel->setAutoDefault(TRUE);
+    GroupButtonsLayout->addWidget(buttonCancel, 0, 3);
 
-    SMESHGUI_InitMeshDlgLayout->addWidget( GroupButtons, 2, 0 );
+    SMESHGUI_InitMeshDlgLayout->addWidget(GroupButtons, 2, 0);
 
     /***************************************************************/
-    Init( Sel ) ;
+    Init();
 }
 
-
 //=================================================================================
 // function : ~SMESHGUI_InitMeshDlg()
 // purpose  : Destroys the object and frees any allocated resources
 //=================================================================================
 SMESHGUI_InitMeshDlg::~SMESHGUI_InitMeshDlg()
 {
-    // no need to delete child widgets, Qt does it all for us
+  // no need to delete child widgets, Qt does it all for us
 }
 
-
 //=================================================================================
 // function : Init()
 // purpose  :
 //=================================================================================
-void SMESHGUI_InitMeshDlg::Init( SALOME_Selection* Sel )
+void SMESHGUI_InitMeshDlg::Init ()
 {
-  mySelection = Sel;
-  mySMESHGUI = SMESHGUI::GetSMESHGUI() ;
-  mySMESHGUI->SetActiveDialogBox( (QDialog*)this ) ;
+  mySMESHGUI->SetActiveDialogBox((QDialog*)this);
 
-  myGeomFilter       = new SALOME_TypeFilter( "GEOM" );
-  myAlgorithmFilter  = new SMESH_TypeFilter( ALGORITHM );
-  myHypothesisFilter = new SMESH_TypeFilter( HYPOTHESIS );
+  //myGeomFilter       = new SALOME_TypeFilter("GEOM");
+  TColStd_MapOfInteger allTypesMap;
+  for (int i = 0; i < 10; i++)
+    allTypesMap.Add(i);
+  myGeomFilter       = new SMESH_NumberFilter ("GEOM", TopAbs_SHAPE, 0, allTypesMap);
+  myAlgorithmFilter  = new SMESH_TypeFilter (ALGORITHM);
+  myHypothesisFilter = new SMESH_TypeFilter (HYPOTHESIS);
 
   /* signals and slots connections */
-  connect( buttonOk,     SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
-  connect( buttonApply,  SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) );
-  connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ) ;
-
-  connect( SelectButtonC1A1,     SIGNAL (clicked() ),  this, SLOT( SetEditCurrentArgument() ) ) ;
-  connect( SelectButtonC1A1Hyp,  SIGNAL (clicked() ),  this, SLOT( SetEditCurrentArgument() ) ) ;
-  connect( SelectButtonC1A1Algo, SIGNAL (clicked() ),  this, SLOT( SetEditCurrentArgument() ) ) ;
-
-  connect( mySelection, SIGNAL( currentSelectionChanged() ),      this, SLOT( SelectionIntoArgument() ) );
-  connect( mySMESHGUI,  SIGNAL( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ;
-  connect( mySMESHGUI,  SIGNAL( SignalCloseAllDialogs() ),        this, SLOT( ClickOnCancel() ) ) ;
-  
-  int x, y ;
-  mySMESHGUI->DefineDlgPosition( this, x, y ) ;
-  this->move( x, y ) ;
-  this->show() ; 
-
-  LineEdit_NameMesh->setText( GetDefaultMeshName() );
-  LineEdit_NameMesh->setFocus() ;
-  myEditCurrentArgument = LineEditC1A1 ;       
-  mySelection->ClearFilters() ;   
-  mySelection->AddFilter( myGeomFilter ) ;
+  connect(buttonOk,     SIGNAL(clicked()), this, SLOT(ClickOnOk()));
+  connect(buttonApply,  SIGNAL(clicked()), this, SLOT(ClickOnApply()));
+  connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel()));
+
+  connect(SelectButtonC1A1,     SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
+  connect(SelectButtonC1A1Hyp,  SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
+  connect(SelectButtonC1A1Algo, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
+
+  connect(mySelectionMgr, SIGNAL(currentSelectionChanged()),      this, SLOT(SelectionIntoArgument()));
+  connect(mySMESHGUI,     SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog()));
+  connect(mySMESHGUI,     SIGNAL(SignalCloseAllDialogs()),        this, SLOT(ClickOnCancel()));
+
+  int x, y;
+  mySMESHGUI->DefineDlgPosition(this, x, y);
+  this->move(x, y);
+  this->show();
+
+  LineEdit_NameMesh->setText(GetDefaultMeshName());
+  LineEdit_NameMesh->setFocus();
+  myEditCurrentArgument = LineEditC1A1;
+  mySelectionMgr->clearFilters();
+  mySelectionMgr->installFilter(myGeomFilter);
 
   SelectionIntoArgument();
 
   UpdateControlState();
 }
 
-
 //=================================================================================
 // function : ClickOnOk()
 // purpose  :
 //=================================================================================
 void SMESHGUI_InitMeshDlg::ClickOnOk()
 {
-  if ( this->ClickOnApply() )
-    this->ClickOnCancel() ;
+  if (this->ClickOnApply())
+    this->ClickOnCancel();
 }
 
 //=================================================================================
@@ -244,38 +255,41 @@ void SMESHGUI_InitMeshDlg::ClickOnOk()
 //=================================================================================
 bool SMESHGUI_InitMeshDlg::ClickOnApply()
 {
-  if (mySMESHGUI->ActiveStudyLocked())
+  if (mySMESHGUI->isActiveStudyLocked())
     return false;
 
   QString myNameMesh = LineEdit_NameMesh->text().stripWhiteSpace();
-  if ( myNameMesh.isEmpty() ) {
-    QAD_MessageBox::warn1( this, tr( "SMESH_WRN_WARNING" ), tr( "SMESH_WRN_EMPTY_NAME" ), tr( "SMESH_BUT_OK" ) );
+  if (myNameMesh.isEmpty()) {
+    SUIT_MessageBox::warn1(this, tr("SMESH_WRN_WARNING"),
+                           tr("SMESH_WRN_EMPTY_NAME"), tr("SMESH_BUT_OK"));
     return false;
   }
-  
-  if ( myGeomShape->_is_nil() || !HypoList.count() || !AlgoList.count() )
+
+  if (myGeomShape->_is_nil() || !HypoList.count() || !AlgoList.count())
     return false;
 
-  QAD_WaitCursor wc;
+  SUIT_OverrideCursor wc;
 
-  QAD_Operation* op = new QAD_Operation( mySMESHGUI->GetActiveStudy() );
+  SUIT_Operation* op =
+    new SUIT_Operation (SUIT_Session::session()->activeApplication());
 
   // start transaction
   op->start();
-  
+
   // create mesh
-  SMESH::SMESH_Mesh_var aMesh = SMESH::InitMesh( myGeomShape, myNameMesh ) ;
-  
-  if ( !aMesh->_is_nil() ) {
+  SMESH::SMESH_Mesh_var aMesh = SMESH::InitMesh(myGeomShape, myNameMesh);
+
+  if (!aMesh->_is_nil()) {
     // assign hypotheses
-    for( int i = 0; i < HypoList.count(); i++ ) {
-      SALOMEDS::SObject_var aHypSO = SMESH::GetActiveStudyDocument()->FindObjectID( HypoList[i] );
-      if ( !aHypSO->_is_nil() ) {
-       CORBA::Object_var anObject = aHypSO->GetObject();
-       if ( !CORBA::is_nil( anObject ) ) {
-         SMESH::SMESH_Hypothesis_var aHyp = SMESH::SMESH_Hypothesis::_narrow( anObject );
-         if ( !aHyp->_is_nil() ) {
-           if ( !SMESH::AddHypothesisOnMesh( aMesh, aHyp ) ) {
+    for (int i = 0; i < HypoList.count(); i++) {
+      _PTR(SObject) aHypSOClient =
+        SMESH::GetActiveStudyDocument()->FindObjectID(HypoList[i].latin1());
+      if (aHypSOClient) {
+       CORBA::Object_var anObject = _CAST(SObject,aHypSOClient)->GetObject();
+       if (!CORBA::is_nil(anObject)) {
+         SMESH::SMESH_Hypothesis_var aHyp = SMESH::SMESH_Hypothesis::_narrow(anObject);
+         if (!aHyp->_is_nil()) {
+           if (!SMESH::AddHypothesisOnMesh(aMesh, aHyp)) {
              // abort transaction
              op->abort();
              return false;
@@ -285,14 +299,15 @@ bool SMESHGUI_InitMeshDlg::ClickOnApply()
       }
     }
     // assign algorithms
-    for( int i = 0; i < AlgoList.count(); i++ ) {
-      SALOMEDS::SObject_var aHypSO = SMESH::GetActiveStudyDocument()->FindObjectID( AlgoList[i] );
-      if ( !aHypSO->_is_nil() ) {
-       CORBA::Object_var anObject = aHypSO->GetObject();
-       if ( !CORBA::is_nil( anObject ) ) {
-         SMESH::SMESH_Hypothesis_var aHyp = SMESH::SMESH_Hypothesis::_narrow( anObject );
-         if ( !aHyp->_is_nil() ) {
-           if ( !SMESH::AddHypothesisOnMesh( aMesh, aHyp ) ) {
+    for (int i = 0; i < AlgoList.count(); i++) {
+      _PTR(SObject) aHypSOClient =
+        SMESH::GetActiveStudyDocument()->FindObjectID(AlgoList[i].latin1());
+      if (aHypSOClient) {
+       CORBA::Object_var anObject = _CAST(SObject,aHypSOClient)->GetObject();
+       if (!CORBA::is_nil(anObject)) {
+         SMESH::SMESH_Hypothesis_var aHyp = SMESH::SMESH_Hypothesis::_narrow(anObject);
+         if (!aHyp->_is_nil()) {
+           if (!SMESH::AddHypothesisOnMesh(aMesh, aHyp)) {
              // abort transaction
              op->abort();
              return false;
@@ -303,12 +318,12 @@ bool SMESHGUI_InitMeshDlg::ClickOnApply()
     }
   }
   // commit transaction
-  op->finish();
-  LineEdit_NameMesh->setText( GetDefaultMeshName() );
+  op->commit();
+  mySMESHGUI->updateObjBrowser();
+  LineEdit_NameMesh->setText(GetDefaultMeshName());
   return true;
 }
 
-
 //=================================================================================
 // function : ClickOnCancel()
 // purpose  :
@@ -318,73 +333,66 @@ void SMESHGUI_InitMeshDlg::ClickOnCancel()
   close();
 }
 
-
 //=================================================================================
 // function : SelectionIntoArgument()
 // purpose  : Called when selection as changed or other case
 //=================================================================================
 void SMESHGUI_InitMeshDlg::SelectionIntoArgument()
 {
-  QString aString = ""; 
+  QString aString = "";
 
-  int nbSel = SMESH::GetNameOfSelectedIObjects( mySelection, aString );
+  SALOME_ListIO aList;
+  mySelectionMgr->selectedObjects(aList,SVTK_Viewer::Type());
 
-  if ( myEditCurrentArgument == LineEditC1A1 )
-  {
+  int nbSel = SMESH::GetNameOfSelectedIObjects(mySelectionMgr, aString);
+
+  if (myEditCurrentArgument == LineEditC1A1) {
     // geom shape
-    if ( nbSel != 1 )
-    {
+    if (nbSel != 1) {
       myGeomShape = GEOM::GEOM_Object::_nil();
       aString = "";
-    } 
-    else
-    {
-      Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject() ;
-      myGeomShape = SMESH::IObjectToInterface<GEOM::GEOM_Object>( IO ) ;
-      if ( myGeomShape->_is_nil() || !GEOMBase::IsShape( myGeomShape ) )
-      {
+    } else {
+      Handle(SALOME_InteractiveObject) IO = aList.First();
+      myGeomShape = SMESH::IObjectToInterface<GEOM::GEOM_Object>(IO);
+      if (myGeomShape->_is_nil() || !GEOMBase::IsShape(myGeomShape)) {
         myGeomShape = GEOM::GEOM_Object::_nil();
         aString = "";
       }
     }
-  }
-  else if ( myEditCurrentArgument == LineEditC1A1Hyp ) {
+  } else if (myEditCurrentArgument == LineEditC1A1Hyp) {
     // hypotheses
     HypoList.clear();
-    if ( nbSel >= 1 ) {
-      SALOME_ListIteratorOfListIO Itinit( mySelection->StoredIObjects() );
-      for ( ; Itinit.More(); Itinit.Next() ) {
-       HypoList.append( Itinit.Value()->getEntry() );
+    if (nbSel >= 1) {
+      SALOME_ListIteratorOfListIO Itinit (aList);
+      for (; Itinit.More(); Itinit.Next()) {
+       HypoList.append(Itinit.Value()->getEntry());
       }
-      if ( nbSel > 1 )
-       aString = tr( "%1 Hypothesis" ).arg( nbSel ) ;
-    }
-    else {
+      if (nbSel > 1)
+       aString = tr("%1 Hypothesis").arg(nbSel);
+    } else {
       aString = "";
     }
-  }
-  else if ( myEditCurrentArgument == LineEditC1A1Algo ) {
+  } else if (myEditCurrentArgument == LineEditC1A1Algo) {
     // algorithms
-    AlgoList.clear(); 
-    if ( nbSel >= 1 ) {
-      SALOME_ListIteratorOfListIO Itinit( mySelection->StoredIObjects() );
-      for ( ; Itinit.More(); Itinit.Next() ) {
-       AlgoList.append( Itinit.Value()->getEntry() );
+    AlgoList.clear();
+    if (nbSel >= 1) {
+      SALOME_ListIteratorOfListIO Itinit (aList);
+      for (; Itinit.More(); Itinit.Next()) {
+       AlgoList.append(Itinit.Value()->getEntry());
       }
-      if ( nbSel > 1 )
-       aString = tr( "%1 Algorithms" ).arg( nbSel ) ;
-    }
-    else {
+      if (nbSel > 1)
+       aString = tr("%1 Algorithms").arg(nbSel);
+    } else {
       aString = "";
     }
+  } else {
   }
 
-  myEditCurrentArgument->setText(aString) ;
+  myEditCurrentArgument->setText(aString);
 
   UpdateControlState();
 }
 
-
 //=================================================================================
 // function : SetEditCurrentArgument()
 // purpose  :
@@ -392,23 +400,23 @@ void SMESHGUI_InitMeshDlg::SelectionIntoArgument()
 void SMESHGUI_InitMeshDlg::SetEditCurrentArgument()
 {
   QPushButton* send = (QPushButton*)sender();
-  if(send == SelectButtonC1A1) {
-    LineEditC1A1->setFocus() ;
+  if (send == SelectButtonC1A1) {
+    LineEditC1A1->setFocus();
     myEditCurrentArgument = LineEditC1A1;
-    mySelection->ClearFilters() ;        
-    mySelection->AddFilter(myGeomFilter) ;
-  } else if( send == SelectButtonC1A1Hyp ) {
-    LineEditC1A1Hyp->setFocus() ;
-    myEditCurrentArgument = LineEditC1A1Hyp ;
-    mySelection->ClearFilters() ;        
-    mySelection->AddFilter(myHypothesisFilter) ;
-  } else if( send == SelectButtonC1A1Algo ) {
-    LineEditC1A1Algo->setFocus() ;
-    myEditCurrentArgument = LineEditC1A1Algo ;
-    mySelection->ClearFilters() ;        
-    mySelection->AddFilter(myAlgorithmFilter) ;
+    mySelectionMgr->clearFilters();
+    mySelectionMgr->installFilter(myGeomFilter);
+  } else if (send == SelectButtonC1A1Hyp) {
+    LineEditC1A1Hyp->setFocus();
+    myEditCurrentArgument = LineEditC1A1Hyp;
+    mySelectionMgr->clearFilters();
+    mySelectionMgr->installFilter(myHypothesisFilter);
+  } else if (send == SelectButtonC1A1Algo) {
+    LineEditC1A1Algo->setFocus();
+    myEditCurrentArgument = LineEditC1A1Algo;
+    mySelectionMgr->clearFilters();
+    mySelectionMgr->installFilter(myAlgorithmFilter);
   }
-  SelectionIntoArgument() ;
+  SelectionIntoArgument();
 }
 
 //=================================================================================
@@ -417,48 +425,45 @@ void SMESHGUI_InitMeshDlg::SetEditCurrentArgument()
 //=================================================================================
 void SMESHGUI_InitMeshDlg::DeactivateActiveDialog()
 {
-  if ( GroupC1->isEnabled() ) {
-    disconnect( mySelection, 0, this, 0 );
-    GroupC1->setEnabled(false) ;
-    GroupButtons->setEnabled(false) ;
+  if (GroupC1->isEnabled()) {
+    disconnect(mySelectionMgr, 0, this, 0);
+    GroupC1->setEnabled(false);
+    GroupButtons->setEnabled(false);
   }
 }
 
-
 //=================================================================================
 // function : ActivateThisDialog()
 // purpose  :
 //=================================================================================
 void SMESHGUI_InitMeshDlg::ActivateThisDialog()
 {
-  mySMESHGUI->EmitSignalDeactivateDialog() ;   
-  GroupC1->setEnabled(true) ;
-  GroupButtons->setEnabled(true) ;
-  connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
+  mySMESHGUI->EmitSignalDeactivateDialog();
+  GroupC1->setEnabled(true);
+  GroupButtons->setEnabled(true);
+  connect (mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
 }
 
-
 //=================================================================================
 // function : enterEvent()
 // purpose  :
 //=================================================================================
-void SMESHGUI_InitMeshDlg::enterEvent(QEvent* e)
+void SMESHGUI_InitMeshDlg::enterEvent (QEvent* e)
 {
-  if ( !GroupC1->isEnabled() )
-    ActivateThisDialog() ;
+  if (!GroupC1->isEnabled())
+    ActivateThisDialog();
 }
 
-
 //=================================================================================
 // function : closeEvent()
 // purpose  :
 //=================================================================================
-void SMESHGUI_InitMeshDlg::closeEvent( QCloseEvent* e )
+void SMESHGUI_InitMeshDlg::closeEvent (QCloseEvent* e)
 {
-  disconnect( mySelection, 0, this, 0 );
-  mySMESHGUI->ResetState() ;
-  mySelection->ClearFilters() ;
-  QDialog::closeEvent( e );
+  disconnect(mySelectionMgr, 0, this, 0);
+  mySMESHGUI->ResetState();
+  mySelectionMgr->clearFilters();
+  QDialog::closeEvent(e);
 }
 
 //=================================================================================
@@ -467,10 +472,10 @@ void SMESHGUI_InitMeshDlg::closeEvent( QCloseEvent* e )
 //=================================================================================
 void SMESHGUI_InitMeshDlg::UpdateControlState()
 {
-  bool isEnabled = ( !myGeomShape->_is_nil() && HypoList.count() && AlgoList.count() );
+  bool isEnabled = (!myGeomShape->_is_nil() && HypoList.count() && AlgoList.count());
 
-  buttonOk   ->setEnabled( isEnabled );
-  buttonApply->setEnabled( isEnabled );
+  buttonOk   ->setEnabled(isEnabled);
+  buttonApply->setEnabled(isEnabled);
 }
 
 //=================================================================================
@@ -479,20 +484,15 @@ void SMESHGUI_InitMeshDlg::UpdateControlState()
 //=================================================================================
 QString SMESHGUI_InitMeshDlg::GetDefaultMeshName()
 {
-  SALOMEDS::Study_var aStudy = QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument();
+  _PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
   int aNumber = 0;
   QString aMeshName;
-  SALOMEDS::SObject_var obj;
-  
-  do 
-    {
-      aMeshName = QString(tr("SMESH_OBJECT_MESH")) +"_"+QString::number(++aNumber);
-      obj = aStudy->FindObject(aMeshName);
-    } 
-  while (!obj->_is_nil());
+  _PTR(SObject) obj;
+
+  do {
+    aMeshName = QString(tr("SMESH_OBJECT_MESH")) + "_" + QString::number(++aNumber);
+    obj = aStudy->FindObject(aMeshName.latin1());
+  } while (obj);
 
   return aMeshName;
 }
-
-
-
index afdcc8584b7a7e051e7bb6a32a0f9864b622c569..1a6f4ed5780017b8830421bb011e64e46b0a2063 100644 (file)
 #ifndef DIALOGBOX_INIT_MESH_H
 #define DIALOGBOX_INIT_MESH_H
 
-#include "SALOME_Selection.h"
-#include "SALOME_TypeFilter.hxx"
-#include "SMESH_TypeFilter.hxx"
+//#include "SMESH_TypeFilter.hxx"
+
+#include "SUIT_SelectionFilter.h"
+#include "SalomeApp_SelectionMgr.h"
 
 // QT Includes
 #include <qdialog.h>
@@ -57,7 +58,10 @@ class SMESHGUI_InitMeshDlg : public QDialog
     Q_OBJECT
 
 public:
-    SMESHGUI_InitMeshDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 );
+    SMESHGUI_InitMeshDlg ( SMESHGUI*,
+                         const char* = 0,
+                         bool modal = FALSE,
+                         WFlags fl = 0 );
     ~SMESHGUI_InitMeshDlg();
 
 protected:
@@ -65,24 +69,27 @@ protected:
     void enterEvent( QEvent * ) ;
 
 private:
-    void Init( SALOME_Selection* Sel ) ;
+    void Init();
 
     void UpdateControlState();
     QString SMESHGUI_InitMeshDlg::GetDefaultMeshName();
 
 private:
-    SMESHGUI*                     mySMESHGUI ;
-    SALOME_Selection*             mySelection ;
-             
-    GEOM::GEOM_Object_var         myGeomShape ;
-    QLineEdit*                    myEditCurrentArgument; 
+    SMESHGUI*                  mySMESHGUI;
+    SalomeApp_SelectionMgr*    mySelectionMgr;
+
+    GEOM::GEOM_Object_var      myGeomShape;
+    QLineEdit*                 myEditCurrentArgument; 
 
-    Handle(SALOME_TypeFilter)     myGeomFilter;
-    Handle(SMESH_TypeFilter)      myHypothesisFilter;
-    Handle(SMESH_TypeFilter)      myAlgorithmFilter;
+    //Handle(SALOME_TypeFilter)  myGeomFilter;
+    SUIT_SelectionFilter*      myGeomFilter;
+    //SMESH_TypeFilter*          myHypothesisFilter;
+    //SMESH_TypeFilter*          myAlgorithmFilter;
+    SUIT_SelectionFilter*      myHypothesisFilter;
+    SUIT_SelectionFilter*      myAlgorithmFilter;
 
-    QStringList                   HypoList;
-    QStringList                   AlgoList;
+    QStringList                HypoList;
+    QStringList                AlgoList;
 
     QGroupBox*    GroupButtons;
     QPushButton*  buttonOk;
@@ -90,8 +97,8 @@ private:
     QPushButton*  buttonApply;
 
     QGroupBox*    GroupC1;
-    QLabel*       TextLabel_NameMesh ;
-    QLineEdit*    LineEdit_NameMesh ;
+    QLabel*       TextLabel_NameMesh;
+    QLineEdit*    LineEdit_NameMesh;
     QLabel*       TextLabelC1A1;
     QPushButton*  SelectButtonC1A1;
     QLineEdit*    LineEditC1A1;
@@ -108,10 +115,10 @@ private slots:
     void ClickOnOk();
     bool ClickOnApply();
     void ClickOnCancel();
-    void SetEditCurrentArgument() ;
-    void SelectionIntoArgument() ;
-    void DeactivateActiveDialog() ;
-    void ActivateThisDialog() ;
+    void SetEditCurrentArgument();
+    void SelectionIntoArgument();
+    void DeactivateActiveDialog();
+    void ActivateThisDialog();
 };
 
 #endif // DIALOGBOX_INIT_MESH_H
index d4816fea76d7121799efa9bd7bf17a7b502641ae..2a36a93afc960ff2c31a9a8c3ca136788843776c 100644 (file)
@@ -1,30 +1,30 @@
 //  SMESH SMESHGUI : GUI for SMESH component
 //
 //  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
-// 
-//  This library is free software; you can redistribute it and/or 
-//  modify it under the terms of the GNU Lesser General Public 
-//  License as published by the Free Software Foundation; either 
-//  version 2.1 of the License. 
-// 
-//  This library is distributed in the hope that it will be useful, 
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of 
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
-//  Lesser General Public License for more details. 
-// 
-//  You should have received a copy of the GNU Lesser General Public 
-//  License along with this library; if not, write to the Free Software 
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
-// 
-//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
 //
 //
 //
 //  File   : SMESHGUI_MergeNodesDlg.cxx
 //  Author : Michael ZORIN
 //  Module : SMESH
-//  $Header: 
+//  $Header:
 
 #include "SMESHGUI_MergeNodesDlg.h"
 
 #include "SMESHGUI_VTKUtils.h"
 #include "SMESHGUI_IdValidator.h"
 #include "SMESHGUI_SpinBox.h"
+
 #include "SMESH_Actor.h"
+#include "SMESH_TypeFilter.hxx"
 #include "SMDS_Mesh.hxx"
 
 #include "GEOMBase.h"
 
-#include "QAD_Application.h"
-#include "QAD_Desktop.h"
-#include "QAD_MessageBox.h"
+#include "SUIT_ResourceMgr.h"
+
+#include "SVTK_ViewModel.h"
+#include "SVTK_ViewWindow.h"
+#include "SVTK_Selector.h"
+#include "SVTK_Selection.h"
+#include "SALOME_ListIO.hxx"
+
 #include "utilities.h"
 
+// OCCT Includes
+#include <TColStd_MapOfInteger.hxx>
+
 // QT Includes
 #include <qapplication.h>
 #include <qbuttongroup.h>
@@ -62,206 +72,212 @@ using namespace std;
 
 //=================================================================================
 // class    : SMESHGUI_MergeNodesDlg()
-// purpose  : 
+// purpose  :
 //=================================================================================
-SMESHGUI_MergeNodesDlg::SMESHGUI_MergeNodesDlg( QWidget* parent, const char* name, SALOME_Selection* Sel,
-                                             bool modal, WFlags fl )
-  : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu |
-            Qt::WDestructiveClose)
+SMESHGUI_MergeNodesDlg::SMESHGUI_MergeNodesDlg( SMESHGUI* theModule, const char* name,
+                                                bool modal, WFlags fl)
+     : QDialog( SMESH::GetDesktop( theModule ), name, modal, WStyle_Customize | WStyle_NormalBorder |
+                WStyle_Title | WStyle_SysMenu | Qt::WDestructiveClose),
+     mySMESHGUI( theModule ),
+     mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ),
+     myViewWindow( SMESH::GetViewWindow( theModule ) ),
+     mySelector( myViewWindow->GetSelector() )
 {
-  QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "SMESH",tr("ICON_SMESH_MERGE_NODES")));
-  QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "SMESH",tr("ICON_SELECT")));
-  
-  if ( !name )
-    setName( "SMESHGUI_MergeNodesDlg" );
-  resize( 303, 185 ); 
-  setCaption( tr( "SMESH_MERGE_NODES" ) );
-  setSizeGripEnabled( TRUE );
-  SMESHGUI_MergeNodesDlgLayout = new QGridLayout( this ); 
-  SMESHGUI_MergeNodesDlgLayout->setSpacing( 6 );
-  SMESHGUI_MergeNodesDlgLayout->setMargin( 11 );
-  
+  QPixmap image0 (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_SMESH_MERGE_NODES")));
+  QPixmap image1 (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_SELECT")));
+
+  if (!name)
+    setName("SMESHGUI_MergeNodesDlg");
+  resize(303, 185);
+  setCaption(tr("SMESH_MERGE_NODES"));
+  setSizeGripEnabled(TRUE);
+  SMESHGUI_MergeNodesDlgLayout = new QGridLayout(this);
+  SMESHGUI_MergeNodesDlgLayout->setSpacing(6);
+  SMESHGUI_MergeNodesDlgLayout->setMargin(11);
+
   /***************************************************************/
-  GroupConstructors = new QButtonGroup( this, "GroupConstructors" );
-  GroupConstructors->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)0, 0, 0, GroupConstructors->sizePolicy().hasHeightForWidth() ) );
-  GroupConstructors->setTitle( tr( "SMESH_MERGE_NODES"  ) );
-  GroupConstructors->setExclusive( TRUE );
-  GroupConstructors->setColumnLayout(0, Qt::Vertical );
-  GroupConstructors->layout()->setSpacing( 0 );
-  GroupConstructors->layout()->setMargin( 0 );
-  GroupConstructorsLayout = new QGridLayout( GroupConstructors->layout() );
-  GroupConstructorsLayout->setAlignment( Qt::AlignTop );
-  GroupConstructorsLayout->setSpacing( 6 );
-  GroupConstructorsLayout->setMargin( 11 );
-  QHBoxLayout* RBLayout = new QHBoxLayout( 0, 0, 6, "Layout2");
-  RadioButton1= new QRadioButton( GroupConstructors, "RadioButton1" );
-  RadioButton1->setText( tr( ""  ) );
-  RadioButton1->setPixmap( image0 );
-  RBLayout->addWidget( RadioButton1);
-  GroupConstructorsLayout->addLayout( RBLayout, 0, 0 );
-  SMESHGUI_MergeNodesDlgLayout->addWidget( GroupConstructors, 0, 0 );
-  
+  GroupConstructors = new QButtonGroup(this, "GroupConstructors");
+  GroupConstructors->setSizePolicy(QSizePolicy((QSizePolicy::SizeType)5,
+                                               (QSizePolicy::SizeType)0, 0, 0,
+                                               GroupConstructors->sizePolicy().hasHeightForWidth()));
+  GroupConstructors->setTitle(tr("SMESH_MERGE_NODES" ));
+  GroupConstructors->setExclusive(TRUE);
+  GroupConstructors->setColumnLayout(0, Qt::Vertical);
+  GroupConstructors->layout()->setSpacing(0);
+  GroupConstructors->layout()->setMargin(0);
+  GroupConstructorsLayout = new QGridLayout(GroupConstructors->layout());
+  GroupConstructorsLayout->setAlignment(Qt::AlignTop);
+  GroupConstructorsLayout->setSpacing(6);
+  GroupConstructorsLayout->setMargin(11);
+  QHBoxLayout* RBLayout = new QHBoxLayout(0, 0, 6, "Layout2");
+  RadioButton1= new QRadioButton(GroupConstructors, "RadioButton1");
+  RadioButton1->setText(tr("" ));
+  RadioButton1->setPixmap(image0);
+  RBLayout->addWidget(RadioButton1);
+  GroupConstructorsLayout->addLayout(RBLayout, 0, 0);
+  SMESHGUI_MergeNodesDlgLayout->addWidget(GroupConstructors, 0, 0);
+
   /***************************************************************/
-  GroupButtons = new QGroupBox( this, "GroupButtons" );
-  GroupButtons->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, GroupButtons->sizePolicy().hasHeightForWidth() ) );
-  GroupButtons->setGeometry( QRect( 10, 10, 281, 48 ) ); 
-  GroupButtons->setTitle( tr( ""  ) );
-  GroupButtons->setColumnLayout(0, Qt::Vertical );
-  GroupButtons->layout()->setSpacing( 0 );
-  GroupButtons->layout()->setMargin( 0 );
-  GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
-  GroupButtonsLayout->setAlignment( Qt::AlignTop );
-  GroupButtonsLayout->setSpacing( 6 );
-  GroupButtonsLayout->setMargin( 11 );
-  buttonCancel = new QPushButton( GroupButtons, "buttonCancel" );
-  buttonCancel->setText( tr( "SMESH_BUT_CLOSE"  ) );
-  buttonCancel->setAutoDefault( TRUE );
-  GroupButtonsLayout->addWidget( buttonCancel, 0, 3 );
-  buttonApply = new QPushButton( GroupButtons, "buttonApply" );
-  buttonApply->setText( tr( "SMESH_BUT_APPLY"  ) );
-  buttonApply->setAutoDefault( TRUE );
-  GroupButtonsLayout->addWidget( buttonApply, 0, 1 );
-  QSpacerItem* spacer_9 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
-  GroupButtonsLayout->addItem( spacer_9, 0, 2 );
-  buttonOk = new QPushButton( GroupButtons, "buttonOk" );
-  buttonOk->setText( tr( "SMESH_BUT_OK"  ) );
-  buttonOk->setAutoDefault( TRUE );
-  buttonOk->setDefault( TRUE );
-  GroupButtonsLayout->addWidget( buttonOk, 0, 0 );
-  SMESHGUI_MergeNodesDlgLayout->addWidget( GroupButtons, 4, 0 );
+  GroupButtons = new QGroupBox(this, "GroupButtons");
+  GroupButtons->setSizePolicy(QSizePolicy((QSizePolicy::SizeType)7,
+                                          (QSizePolicy::SizeType)0, 0, 0,
+                                          GroupButtons->sizePolicy().hasHeightForWidth()));
+  GroupButtons->setGeometry(QRect(10, 10, 281, 48));
+  GroupButtons->setTitle(tr("" ));
+  GroupButtons->setColumnLayout(0, Qt::Vertical);
+  GroupButtons->layout()->setSpacing(0);
+  GroupButtons->layout()->setMargin(0);
+  GroupButtonsLayout = new QGridLayout(GroupButtons->layout());
+  GroupButtonsLayout->setAlignment(Qt::AlignTop);
+  GroupButtonsLayout->setSpacing(6);
+  GroupButtonsLayout->setMargin(11);
+  buttonCancel = new QPushButton(GroupButtons, "buttonCancel");
+  buttonCancel->setText(tr("SMESH_BUT_CLOSE" ));
+  buttonCancel->setAutoDefault(TRUE);
+  GroupButtonsLayout->addWidget(buttonCancel, 0, 3);
+  buttonApply = new QPushButton(GroupButtons, "buttonApply");
+  buttonApply->setText(tr("SMESH_BUT_APPLY" ));
+  buttonApply->setAutoDefault(TRUE);
+  GroupButtonsLayout->addWidget(buttonApply, 0, 1);
+  QSpacerItem* spacer_9 = new QSpacerItem(20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
+  GroupButtonsLayout->addItem(spacer_9, 0, 2);
+  buttonOk = new QPushButton(GroupButtons, "buttonOk");
+  buttonOk->setText(tr("SMESH_BUT_OK" ));
+  buttonOk->setAutoDefault(TRUE);
+  buttonOk->setDefault(TRUE);
+  GroupButtonsLayout->addWidget(buttonOk, 0, 0);
+  SMESHGUI_MergeNodesDlgLayout->addWidget(GroupButtons, 4, 0);
 
   /***************************************************************/
-  
+
   // Controls for mesh defining
-  GroupMesh = new QGroupBox( this, "GroupMesh" );
-  GroupMesh->setTitle( tr( "SMESH_MESH" ) );
-  GroupMesh->setColumnLayout(0, Qt::Vertical );
-  GroupMesh->layout()->setSpacing( 0 );
-  GroupMesh->layout()->setMargin( 0 );
-  GroupMeshLayout = new QGridLayout( GroupMesh->layout() );
-  GroupMeshLayout->setAlignment( Qt::AlignTop );
-  GroupMeshLayout->setSpacing( 6 );
-  GroupMeshLayout->setMargin( 11 );
-  
-  TextLabelName = new QLabel( GroupMesh, "TextLabelName" );
-  TextLabelName->setText( tr( "SMESH_NAME" ) );
-  GroupMeshLayout->addWidget( TextLabelName, 0, 0 );
-
-  SelectMeshButton = new QPushButton( GroupMesh, "SelectMeshButton" );
-  SelectMeshButton->setPixmap( image1 );
-  GroupMeshLayout->addWidget( SelectMeshButton, 0, 1 );
+  GroupMesh = new QGroupBox(this, "GroupMesh");
+  GroupMesh->setTitle(tr("SMESH_MESH"));
+  GroupMesh->setColumnLayout(0, Qt::Vertical);
+  GroupMesh->layout()->setSpacing(0);
+  GroupMesh->layout()->setMargin(0);
+  GroupMeshLayout = new QGridLayout(GroupMesh->layout());
+  GroupMeshLayout->setAlignment(Qt::AlignTop);
+  GroupMeshLayout->setSpacing(6);
+  GroupMeshLayout->setMargin(11);
+
+  TextLabelName = new QLabel(GroupMesh, "TextLabelName");
+  TextLabelName->setText(tr("SMESH_NAME"));
+  GroupMeshLayout->addWidget(TextLabelName, 0, 0);
+
+  SelectMeshButton = new QPushButton(GroupMesh, "SelectMeshButton");
+  SelectMeshButton->setPixmap(image1);
+  GroupMeshLayout->addWidget(SelectMeshButton, 0, 1);
 
   LineEditMesh = new QLineEdit(GroupMesh, "LineEditMesh");
   LineEditMesh->setReadOnly(true);
-  GroupMeshLayout->addWidget( LineEditMesh, 0, 2 );
-  
-  SMESHGUI_MergeNodesDlgLayout->addWidget( GroupMesh, 1, 0 );
-  
+  GroupMeshLayout->addWidget(LineEditMesh, 0, 2);
+
+  SMESHGUI_MergeNodesDlgLayout->addWidget(GroupMesh, 1, 0);
+
   // Controls for coincident nodes detecting
-  GroupCoincident = new QGroupBox( this, "GroupCoincident" );
-  GroupCoincident->setTitle( tr( "COINCIDENT_NODES" ) );
-  GroupCoincident->setColumnLayout(0, Qt::Vertical );
-  GroupCoincident->layout()->setSpacing( 0 );
-  GroupCoincident->layout()->setMargin( 0 );
-  QGridLayout* GroupCoincidentLayout = new QGridLayout( GroupCoincident->layout() );
-  GroupCoincidentLayout->setAlignment( Qt::AlignTop );
-  GroupCoincidentLayout->setSpacing( 6 );
-  GroupCoincidentLayout->setMargin( 11 );
-
-  TextLabelTolerance = new QLabel( GroupCoincident, "TextLabelTolerance" );
-  TextLabelTolerance->setText( tr( "SMESH_TOLERANCE" ) );
-  GroupCoincidentLayout->addWidget( TextLabelTolerance, 0, 0 );
-  
-  SpinBoxTolerance = new SMESHGUI_SpinBox( GroupCoincident, "SpinBoxTolerance" );
-  GroupCoincidentLayout->addWidget( SpinBoxTolerance, 0, 1 );
-  
-  QPushButton* DetectButton = new QPushButton( GroupCoincident, "DetectButton" );
-  DetectButton->setText( tr("DETECT") );
-  GroupCoincidentLayout->addWidget( DetectButton, 0, 2 );
-  
-  ListCoincident = new QListView( GroupCoincident );
-  ListCoincident->setSorting( -1 );
-  ListCoincident->addColumn( "Nodes" );
+  GroupCoincident = new QGroupBox(this, "GroupCoincident");
+  GroupCoincident->setTitle(tr("COINCIDENT_NODES"));
+  GroupCoincident->setColumnLayout(0, Qt::Vertical);
+  GroupCoincident->layout()->setSpacing(0);
+  GroupCoincident->layout()->setMargin(0);
+  QGridLayout* GroupCoincidentLayout = new QGridLayout(GroupCoincident->layout());
+  GroupCoincidentLayout->setAlignment(Qt::AlignTop);
+  GroupCoincidentLayout->setSpacing(6);
+  GroupCoincidentLayout->setMargin(11);
+
+  TextLabelTolerance = new QLabel(GroupCoincident, "TextLabelTolerance");
+  TextLabelTolerance->setText(tr("SMESH_TOLERANCE"));
+  GroupCoincidentLayout->addWidget(TextLabelTolerance, 0, 0);
+
+  SpinBoxTolerance = new SMESHGUI_SpinBox(GroupCoincident, "SpinBoxTolerance");
+  GroupCoincidentLayout->addWidget(SpinBoxTolerance, 0, 1);
+
+  QPushButton* DetectButton = new QPushButton(GroupCoincident, "DetectButton");
+  DetectButton->setText(tr("DETECT"));
+  GroupCoincidentLayout->addWidget(DetectButton, 0, 2);
+
+  ListCoincident = new QListView(GroupCoincident);
+  ListCoincident->setSorting(-1);
+  ListCoincident->addColumn("Nodes");
   ListCoincident->header()->hide();
-  
-  GroupCoincidentLayout->addMultiCellWidget( ListCoincident, 1, 1, 0, 1 );
+
+  GroupCoincidentLayout->addMultiCellWidget(ListCoincident, 1, 1, 0, 1);
 
   SelectAllCB = new QCheckBox(GroupCoincident, "SelectAllCB");
   SelectAllCB->setText(tr("SELECT_ALL"));
-  GroupCoincidentLayout->addWidget( SelectAllCB, 2, 0 );
-  
-  SMESHGUI_MergeNodesDlgLayout->addWidget( GroupCoincident, 2, 0 );
+  GroupCoincidentLayout->addWidget(SelectAllCB, 2, 0);
+
+  SMESHGUI_MergeNodesDlgLayout->addWidget(GroupCoincident, 2, 0);
 
   // Controls for editing group of nodes
-  GroupEdit = new QGroupBox( this, "GroupEdit" );
-  GroupEdit->setTitle( tr( "EDIT_GROUP_OF_NODES" ) );
-  GroupEdit->setColumnLayout(0, Qt::Vertical );
-  GroupEdit->layout()->setSpacing( 0 );
-  GroupEdit->layout()->setMargin( 0 );
-  QGridLayout* GroupEditLayout = new QGridLayout( GroupEdit->layout() );
-  GroupEditLayout->setAlignment( Qt::AlignTop );
-  GroupEditLayout->setSpacing( 6 );
-  GroupEditLayout->setMargin( 11 );
-  
-  ListEdit = new QListBox( GroupEdit, "ListEdit" );
+  GroupEdit = new QGroupBox(this, "GroupEdit");
+  GroupEdit->setTitle(tr("EDIT_GROUP_OF_NODES"));
+  GroupEdit->setColumnLayout(0, Qt::Vertical);
+  GroupEdit->layout()->setSpacing(0);
+  GroupEdit->layout()->setMargin(0);
+  QGridLayout* GroupEditLayout = new QGridLayout(GroupEdit->layout());
+  GroupEditLayout->setAlignment(Qt::AlignTop);
+  GroupEditLayout->setSpacing(6);
+  GroupEditLayout->setMargin(11);
+
+  ListEdit = new QListBox(GroupEdit, "ListEdit");
   ListEdit->setColumnMode(QListBox::FitToHeight);
-  ListEdit->setSelectionMode( QListBox::Extended );
-  GroupEditLayout->addMultiCellWidget( ListEdit, 0, 2, 0, 0 );
-  
-  QPushButton* AddButton = new QPushButton( GroupEdit, "AddButton" );
-  AddButton->setText( tr("SMESH_BUT_ADD") );
-  GroupEditLayout->addWidget( AddButton, 0, 1 );
-  
-  QPushButton* RemoveButton = new QPushButton( GroupEdit, "RemoveButton" );
-  RemoveButton->setText( tr("SMESH_BUT_REMOVE") );
-  GroupEditLayout->addWidget( RemoveButton, 1, 1 );
-  
-  QSpacerItem* spacer = new QSpacerItem( 20, 200, QSizePolicy::Minimum, QSizePolicy::Expanding );
-  GroupEditLayout->addItem( spacer, 2, 1 );
-  
-  SMESHGUI_MergeNodesDlgLayout->addWidget( GroupEdit, 3, 0 );
-  
+  ListEdit->setSelectionMode(QListBox::Extended);
+  GroupEditLayout->addMultiCellWidget(ListEdit, 0, 2, 0, 0);
+
+  QPushButton* AddButton = new QPushButton(GroupEdit, "AddButton");
+  AddButton->setText(tr("SMESH_BUT_ADD"));
+  GroupEditLayout->addWidget(AddButton, 0, 1);
+
+  QPushButton* RemoveButton = new QPushButton(GroupEdit, "RemoveButton");
+  RemoveButton->setText(tr("SMESH_BUT_REMOVE"));
+  GroupEditLayout->addWidget(RemoveButton, 1, 1);
+
+  QSpacerItem* spacer = new QSpacerItem(20, 200, QSizePolicy::Minimum, QSizePolicy::Expanding);
+  GroupEditLayout->addItem(spacer, 2, 1);
+
+  SMESHGUI_MergeNodesDlgLayout->addWidget(GroupEdit, 3, 0);
+
   /* Initialisations */
-  SpinBoxTolerance->RangeStepAndValidator( 0.0, 999999.999, 0.1, 3 );
+  SpinBoxTolerance->RangeStepAndValidator(0.0, 999999.999, 0.1, 3);
   SpinBoxTolerance->SetValue(1e-05);
-  
-  RadioButton1->setChecked( TRUE );
-  
+
+  RadioButton1->setChecked(TRUE);
+
   myActor = 0;
 
-  mySelection = Sel;  
-  
-  mySMESHGUI  = SMESHGUI::GetSMESHGUI() ;
-  mySMESHGUI->SetActiveDialogBox( (QDialog*)this ) ;
-  
-  myMeshOrSubMeshFilter = new SMESH_TypeFilter( MESHorSUBMESH );
+  mySMESHGUI = SMESHGUI::GetSMESHGUI();
+  mySMESHGUI->SetActiveDialogBox((QDialog*)this);
+
+  myMeshOrSubMeshFilter = new SMESH_TypeFilter (MESHorSUBMESH);
 
   /* signals and slots connections */
-  connect( buttonOk, SIGNAL( clicked() ),     this, SLOT( ClickOnOk() ) );
-  connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) );
-  connect( buttonApply, SIGNAL( clicked() ), this, SLOT(ClickOnApply() ) );
-  
-  connect( SelectMeshButton, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) );
-  connect( DetectButton, SIGNAL ( clicked() ), this, SLOT( onDetect() ) );
-  connect( ListCoincident, SIGNAL ( selectionChanged() ), this, SLOT( onSelectNodesGroup() ) );
-  connect( ListCoincident, SIGNAL ( pressed( QListViewItem* ) ), this, SLOT( updateControls() ) );
-  connect( ListCoincident, SIGNAL ( currentChanged( QListViewItem* ) ), this, SLOT( updateControls() ) );
-  connect( SelectAllCB, SIGNAL( toggled(bool) ), this, SLOT(onSelectAll(bool) ) );
-  connect( ListEdit, SIGNAL ( selectionChanged() ), this, SLOT( onSelectNodesFromGroup() ) );
-  connect( AddButton, SIGNAL ( clicked() ), this, SLOT( onAdd() ) );
-  connect( RemoveButton, SIGNAL ( clicked() ), this, SLOT( onRemove() ) );
-
-  connect( mySMESHGUI, SIGNAL ( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) );
-  connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
+  connect(buttonOk, SIGNAL(clicked()),     this, SLOT(ClickOnOk()));
+  connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel()));
+  connect(buttonApply, SIGNAL(clicked()),  this, SLOT(ClickOnApply()));
+
+  connect(SelectMeshButton, SIGNAL (clicked()), this, SLOT(SetEditCurrentArgument()));
+  connect(DetectButton, SIGNAL (clicked()), this, SLOT(onDetect()));
+  connect(ListCoincident, SIGNAL (selectionChanged()), this, SLOT(onSelectNodesGroup()));
+  connect(ListCoincident, SIGNAL (pressed(QListViewItem*)), this, SLOT(updateControls()));
+  connect(ListCoincident, SIGNAL (currentChanged(QListViewItem*)), this, SLOT(updateControls()));
+  connect(SelectAllCB, SIGNAL(toggled(bool)), this, SLOT(onSelectAll(bool)));
+  connect(ListEdit, SIGNAL (selectionChanged()), this, SLOT(onSelectNodesFromGroup()));
+  connect(AddButton, SIGNAL (clicked()), this, SLOT(onAdd()));
+  connect(RemoveButton, SIGNAL (clicked()), this, SLOT(onRemove()));
+
+  connect(mySMESHGUI, SIGNAL (SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog()));
+  connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
   /* to close dialog if study change */
-  connect( mySMESHGUI, SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) );
-  
+  connect(mySMESHGUI, SIGNAL (SignalCloseAllDialogs()), this, SLOT(ClickOnCancel()));
+
   /* Move widget on the botton right corner of main widget */
-  int x, y ;
-  mySMESHGUI->DefineDlgPosition( this, x, y ) ;
-  this->move( x, y ) ;
-  this->show() ; /* displays Dialog */
-  
+  int x, y;
+  mySMESHGUI->DefineDlgPosition(this, x, y);
+  this->move(x, y);
+  this->show(); /* displays Dialog */
+
   resize(0,0);
   buttonOk->setEnabled(false);
   buttonApply->setEnabled(false);
@@ -276,51 +292,46 @@ SMESHGUI_MergeNodesDlg::~SMESHGUI_MergeNodesDlg()
   // no need to delete child widgets, Qt does it all for us
 }
 
-
 //=================================================================================
 // function : ClickOnApply()
 // purpose  :
 //=================================================================================
 bool SMESHGUI_MergeNodesDlg::ClickOnApply()
 {
-  if (mySMESHGUI->ActiveStudyLocked() || myMesh->_is_nil())
+  if (mySMESHGUI->isActiveStudyLocked() || myMesh->_is_nil())
     return false;
 
-  try
-    {
-      SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
-
-      QApplication::setOverrideCursor(Qt::waitCursor);
-      SMESH::array_of_long_array_var aGroupsOfNodes = new SMESH::array_of_long_array;
-      aGroupsOfNodes->length(ListCoincident->childCount());
-      QListViewItem* item = ListCoincident->firstChild();
-
-      int anArrayNum = 0;
-      while (item)
-       {
-         QStringList aListIds = QStringList("");
-         if (((QCheckListItem*) item)->isOn())
-           aListIds = QStringList::split( " ", item->text(0), false);
-         
-         SMESH::long_array_var anIds = new SMESH::long_array;
-         anIds->length(aListIds.count());
-         
-         for ( int i = 0; i < aListIds.count(); i++ )
-           anIds[i] = aListIds[i].toInt();
-         
-         aGroupsOfNodes[anArrayNum++] = anIds.inout();
-         
-         item = item->itemBelow();
-       }
-
-      aMeshEditor->MergeNodes (aGroupsOfNodes.inout());
-      QApplication::restoreOverrideCursor();
-    }
-  catch( ... )
-    {
+  try {
+    SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
+
+    QApplication::setOverrideCursor(Qt::waitCursor);
+    SMESH::array_of_long_array_var aGroupsOfNodes = new SMESH::array_of_long_array;
+    aGroupsOfNodes->length(ListCoincident->childCount());
+    QListViewItem* item = ListCoincident->firstChild();
+
+    int anArrayNum = 0;
+    while (item) {
+      QStringList aListIds = QStringList("");
+      if (((QCheckListItem*) item)->isOn())
+        aListIds = QStringList::split(" ", item->text(0), false);
+
+      SMESH::long_array_var anIds = new SMESH::long_array;
+      anIds->length(aListIds.count());
+
+      for (int i = 0; i < aListIds.count(); i++)
+        anIds[i] = aListIds[i].toInt();
+
+      aGroupsOfNodes[anArrayNum++] = anIds.inout();
+
+      item = item->itemBelow();
     }
 
-  mySelection->ClearIObjects();
+    aMeshEditor->MergeNodes (aGroupsOfNodes.inout());
+    QApplication::restoreOverrideCursor();
+  } catch(...) {
+  }
+
+  mySelectionMgr->clearSelected();
   SMESH::UpdateView();
 
   onDetect();
@@ -333,191 +344,176 @@ bool SMESHGUI_MergeNodesDlg::ClickOnApply()
 //=================================================================================
 void SMESHGUI_MergeNodesDlg::ClickOnOk()
 {
-  ifClickOnApply())
-    ClickOnCancel() ;
+  if (ClickOnApply())
+    ClickOnCancel();
 }
 
-       
 //=================================================================================
 // function : ClickOnCancel()
 // purpose  :
 //=================================================================================
 void SMESHGUI_MergeNodesDlg::ClickOnCancel()
 {
-  mySelection->ClearFilters();
-  mySelection->ClearIObjects();
+  mySelectionMgr->clearFilters();
+  mySelectionMgr->clearSelected();
   SMESH::SetPointRepresentation(false);
-  QAD_Application::getDesktop()->SetSelectionMode( ActorSelection );
-  disconnect( mySelection, 0, this, 0 );
-  mySMESHGUI->ResetState() ;
-  reject() ;
+  myViewWindow->SetSelectionMode(ActorSelection);
+  disconnect(mySelectionMgr, 0, this, 0);
+  mySMESHGUI->ResetState();
+  reject();
 }
 
-
 //=================================================================================
 // function : onEditNodesGroup()
 // purpose  :
 //=================================================================================
 void SMESHGUI_MergeNodesDlg::onEditNodesGroup()
 {
-  if ( ListCoincident->childCount() < 1 )
+  if (ListCoincident->childCount() < 1)
     return;
 
   QString aNewIds = "";
-  
+
   QListBoxItem* anItem;
   for (anItem = ListEdit->firstItem(); anItem != 0; anItem = anItem->next())
     aNewIds+=QString(" %1").arg(anItem->text());
-  
+
   ListCoincident->currentItem()->setText(0, aNewIds);
 }
 
-
 //=================================================================================
 // function : updateControls()
-// purpose  : 
+// purpose  :
 //=================================================================================
 void SMESHGUI_MergeNodesDlg::updateControls()
 {
-  if ( ListCoincident->childCount() < 1 )
-    {
-      SMESH::SetPointRepresentation(false);
-      QAD_Application::getDesktop()->SetSelectionMode( ActorSelection );
-      return;
-    }
-  
+  if (ListCoincident->childCount() < 1) {
+    SMESH::SetPointRepresentation(false);
+    myViewWindow->SetSelectionMode(ActorSelection);
+    return;
+  }
+
   bool hasChecked = false, hasUnchecked = false;
-  
+
   QListViewItem* item = ListCoincident->firstChild();
-  
-  while (item && (!hasChecked || !hasUnchecked))
-    {
-      if (((QCheckListItem*) item)->isOn())
-       hasChecked = true;
-      else
-       hasUnchecked = true;
-      
-      item = item->itemBelow();
-    }
-  
+
+  while (item && (!hasChecked || !hasUnchecked)) {
+    if (((QCheckListItem*) item)->isOn())
+      hasChecked = true;
+    else
+      hasUnchecked = true;
+
+    item = item->itemBelow();
+  }
+
   if (hasUnchecked)
     SelectAllCB->setChecked(false);
-  
+
   bool enable = !(myMesh->_is_nil()) && hasChecked;
-  
+
   buttonOk->setEnabled(enable);
   buttonApply->setEnabled(enable);
 }
 
-
 //=================================================================================
 // function : onDetect()
-// purpose  : 
+// purpose  :
 //=================================================================================
 void SMESHGUI_MergeNodesDlg::onDetect()
 {
-  if(myMesh->_is_nil())
+  if (myMesh->_is_nil())
     return;
 
-  try
-    {
-      SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
-      
-      QApplication::setOverrideCursor(Qt::waitCursor);
-      ListCoincident->clear();
-      ListEdit->clear();
-      
-      SMESH::array_of_long_array_var aNodeGroups;
-      aMeshEditor->FindCoincidentNodes(SpinBoxTolerance->GetValue(), aNodeGroups);
-      
-      for ( int i = 0; i < aNodeGroups->length(); i++ )
-       {
-         SMESH::long_array& aGroup = aNodeGroups[i];
-         
-         QString aNodeIds;
-         for ( int j = 0; j < aGroup.length(); j++ )
-           aNodeIds+=QString(" %1").arg(aGroup[j]);
-         
-         new QCheckListItem ( ListCoincident, aNodeIds, QCheckListItem::CheckBox );
-       }
-      QApplication::restoreOverrideCursor();
-    }
-  catch( ... )
-    {
+  try {
+    SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
+
+    QApplication::setOverrideCursor(Qt::waitCursor);
+    ListCoincident->clear();
+    ListEdit->clear();
+
+    SMESH::array_of_long_array_var aNodeGroups;
+    aMeshEditor->FindCoincidentNodes(SpinBoxTolerance->GetValue(), aNodeGroups);
+
+    for (int i = 0; i < aNodeGroups->length(); i++) {
+      SMESH::long_array& aGroup = aNodeGroups[i];
+
+      QString aNodeIds;
+      for (int j = 0; j < aGroup.length(); j++)
+        aNodeIds+=QString(" %1").arg(aGroup[j]);
+
+      new QCheckListItem (ListCoincident, aNodeIds, QCheckListItem::CheckBox);
     }
-  
+    QApplication::restoreOverrideCursor();
+  } catch(...) {
+  }
+
   updateControls();
 }
 
-
 //=================================================================================
 // function : onSelectNodesGroup()
-// purpose  : 
+// purpose  :
 //=================================================================================
 void SMESHGUI_MergeNodesDlg::onSelectNodesGroup()
 {
-  if(!myActor)
+  if (!myActor)
     return;
-  
+
   myEditCurrentArgument = (QWidget*)ListCoincident;
-  
+
   QListViewItem* aSelectedItem = ListCoincident->selectedItem();
   if (!aSelectedItem)
     return;
-  
-  QStringList aListId = QStringList::split( " ", aSelectedItem->text(0), false);
-  
+
+  QStringList aListId = QStringList::split(" ", aSelectedItem->text(0), false);
+
   ListEdit->clear();
   ListEdit->insertStringList(aListId);
-  
-  mySelection->ClearIObjects();
-  mySelection->AddIObject( myActor->getIO() );
-  
+
+  //mySelectionMgr->clearSelected();
+  //mySelectionMgr->AddIObject(myActor->getIO());
+  SALOME_ListIO aList;
+  aList.Append(myActor->getIO());
+  mySelectionMgr->setSelectedObjects(aList, false);
+
   SMESH::SetPointRepresentation(true);
-  QAD_Application::getDesktop()->SetSelectionMode( NodeSelection, true );
-    
+  myViewWindow->SetSelectionMode(NodeSelection);
+
   ListEdit->selectAll(true);
 }
 
-
 //=================================================================================
 // function : onSelectAll()
-// purpose  : 
+// purpose  :
 //=================================================================================
-void SMESHGUI_MergeNodesDlg::onSelectAll(bool isToggled)
+void SMESHGUI_MergeNodesDlg::onSelectAll (bool isToggled)
 {
-  if (isToggled)
-    {
-      int aNbItems = 0;
-      QListViewItem* item = ListCoincident->firstChild();
-      while (item)
-       {
-         aNbItems++;
-         if (!((QCheckListItem*) item)->isOn())
-           ((QCheckListItem*) item)->setOn(true);
-         item = item->itemBelow();
-       }
-      
-      if (aNbItems)
-       {
-         buttonOk->setEnabled(true);
-         buttonApply->setEnabled(true);
-       }
+  if (isToggled) {
+    int aNbItems = 0;
+    QListViewItem* item = ListCoincident->firstChild();
+    while (item) {
+      aNbItems++;
+      if (!((QCheckListItem*) item)->isOn())
+        ((QCheckListItem*) item)->setOn(true);
+      item = item->itemBelow();
     }
-}
 
+    if (aNbItems) {
+      buttonOk->setEnabled(true);
+      buttonApply->setEnabled(true);
+    }
+  }
+}
 
 //=================================================================================
 // function : onSelectNodesFromGroup()
-// purpose  : 
+// purpose  :
 //=================================================================================
 void SMESHGUI_MergeNodesDlg::onSelectNodesFromGroup()
 {
-  if (!myActor) 
+  if (!myActor)
     return;
-  
-  mySelection->ClearIObjects();
-  
+
   TColStd_MapOfInteger aIndexes;
   QListBoxItem* anItem;
   for (anItem = ListEdit->firstItem(); anItem != 0; anItem = anItem->next()) {
@@ -526,14 +522,16 @@ void SMESHGUI_MergeNodesDlg::onSelectNodesFromGroup()
       aIndexes.Add(anId);
     }
   }
-  mySelection->AddOrRemoveIndex(myActor->getIO(), aIndexes, false, false);
-  mySelection->AddIObject(myActor->getIO());
-}
 
+  mySelector->AddOrRemoveIndex(myActor->getIO(), aIndexes, false);
+  SALOME_ListIO aList;
+  aList.Append(myActor->getIO());
+  mySelectionMgr->setSelectedObjects(aList);
+}
 
 //=================================================================================
 // function : onAdd()
-// purpose  : 
+// purpose  :
 //=================================================================================
 void SMESHGUI_MergeNodesDlg::onAdd()
 {
@@ -542,14 +540,14 @@ void SMESHGUI_MergeNodesDlg::onAdd()
 
   QString aListStr = "";
   int aNbNnodes = 0;
-  
-  aNbNnodes = SMESH::GetNameOfSelectedNodes(mySelection, myActor->getIO(), aListStr);
+
+  aNbNnodes = SMESH::GetNameOfSelectedNodes(mySelector, myActor->getIO(), aListStr);
   if (aNbNnodes < 1)
     return;
-  
+
   QStringList aNodes = QStringList::split(" ", aListStr);
   QListBoxItem* anItem = 0;
-  
+
   for (QStringList::iterator it = aNodes.begin(); it != aNodes.end(); ++it) {
     anItem = ListEdit->findItem(*it, Qt::ExactMatch);
     if (!anItem) {
@@ -558,83 +556,79 @@ void SMESHGUI_MergeNodesDlg::onAdd()
     }
     ListEdit->setSelected(anItem, true);
   }
-  
+
   onEditNodesGroup();
 }
 
-
 //=================================================================================
 // function : onRemove()
-// purpose  : 
+// purpose  :
 //=================================================================================
 void SMESHGUI_MergeNodesDlg::onRemove()
 {
   if (myEditCurrentArgument != (QWidget*)ListCoincident)
     return;
-  
-  for (int i = ListEdit->count(); i > 0; i--) 
-    {
-      if (ListEdit->isSelected(i-1))
-       ListEdit->removeItem(i-1);
-    }
+
+  for (int i = ListEdit->count(); i > 0; i--) {
+    if (ListEdit->isSelected(i-1))
+      ListEdit->removeItem(i-1);
+  }
   onEditNodesGroup();
 }
 
-
 //=================================================================================
 // function : SetEditCurrentArgument()
-// purpose  : 
+// purpose  :
 //=================================================================================
 void SMESHGUI_MergeNodesDlg::SetEditCurrentArgument()
 {
   QPushButton* send = (QPushButton*)sender();
-  
-  disconnect( mySelection, 0, this, 0 );
-  mySelection->ClearIObjects();
-  mySelection->ClearFilters();
-  
-  if(send == SelectMeshButton) 
-    {
-      myEditCurrentArgument = (QWidget*)LineEditMesh;
-      SMESH::SetPointRepresentation(false);
-      QAD_Application::getDesktop()->SetSelectionMode( ActorSelection );
-      mySelection->AddFilter(myMeshOrSubMeshFilter) ;
-    }
-  
+
+  disconnect(mySelectionMgr, 0, this, 0);
+  mySelectionMgr->clearSelected();
+  mySelectionMgr->clearFilters();
+
+  if (send == SelectMeshButton) {
+    myEditCurrentArgument = (QWidget*)LineEditMesh;
+    SMESH::SetPointRepresentation(false);
+    myViewWindow->SetSelectionMode(ActorSelection);
+    mySelectionMgr->installFilter(myMeshOrSubMeshFilter);
+  }
+
   myEditCurrentArgument->setFocus();
-  connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
-  SelectionIntoArgument() ;
+  connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
+  SelectionIntoArgument();
 }
 
-
 //=================================================================================
 // function : SelectionIntoArgument()
 // purpose  : Called when selection as changed or other case
 //=================================================================================
 void SMESHGUI_MergeNodesDlg::SelectionIntoArgument()
 {
-  if (myEditCurrentArgument == (QWidget*)LineEditMesh)
-    {
-      QString aString = "";
-      LineEditMesh->setText( aString );
-      
-      ListCoincident->clear();
-      ListEdit->clear();
-
-      int nbSel = SMESH::GetNameOfSelectedIObjects(mySelection, aString);
-      if(nbSel != 1)
-       return;
-      
-      Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject();
-      myMesh = SMESH::IObjectToInterface<SMESH::SMESH_Mesh>(IO) ;
-      myActor = SMESH::FindActorByEntry( mySelection->firstIObject()->getEntry() );
-      if(myMesh->_is_nil() || !myActor)
-       return;
-      
-      LineEditMesh->setText( aString );
-    }
-}
+  if (myEditCurrentArgument == (QWidget*)LineEditMesh) {
+    QString aString = "";
+    LineEditMesh->setText(aString);
 
+    ListCoincident->clear();
+    ListEdit->clear();
+
+    int nbSel = SMESH::GetNameOfSelectedIObjects(mySelectionMgr, aString);
+    if (nbSel != 1)
+      return;
+
+    SALOME_ListIO aList;
+    mySelectionMgr->selectedObjects(aList,SVTK_Viewer::Type());
+
+    Handle(SALOME_InteractiveObject) IO = aList.First();
+    myMesh = SMESH::IObjectToInterface<SMESH::SMESH_Mesh>(IO);
+    myActor = SMESH::FindActorByEntry(aList.First()->getEntry());
+    if (myMesh->_is_nil() || !myActor)
+      return;
+
+    LineEditMesh->setText(aString);
+  }
+}
 
 //=================================================================================
 // function : DeactivateActiveDialog()
@@ -642,18 +636,17 @@ void SMESHGUI_MergeNodesDlg::SelectionIntoArgument()
 //=================================================================================
 void SMESHGUI_MergeNodesDlg::DeactivateActiveDialog()
 {
-  if ( GroupConstructors->isEnabled() ) {
-    GroupConstructors->setEnabled(false) ;
+  if (GroupConstructors->isEnabled()) {
+    GroupConstructors->setEnabled(false);
     GroupMesh->setEnabled(false);
     GroupCoincident->setEnabled(false);
     GroupEdit->setEnabled(false);
-    GroupButtons->setEnabled(false) ;
-    mySMESHGUI->ResetState() ;    
-    mySMESHGUI->SetActiveDialogBox(0) ;
+    GroupButtons->setEnabled(false);
+    mySMESHGUI->ResetState();
+    mySMESHGUI->SetActiveDialogBox(0);
   }
 }
 
-
 //=================================================================================
 // function : ActivateThisDialog()
 // purpose  :
@@ -661,49 +654,44 @@ void SMESHGUI_MergeNodesDlg::DeactivateActiveDialog()
 void SMESHGUI_MergeNodesDlg::ActivateThisDialog()
 {
   /* Emit a signal to deactivate the active dialog */
-  mySMESHGUI->EmitSignalDeactivateDialog() ;   
-  GroupConstructors->setEnabled(true) ;
+  mySMESHGUI->EmitSignalDeactivateDialog();
+  GroupConstructors->setEnabled(true);
   GroupMesh->setEnabled(true);
   GroupCoincident->setEnabled(true);
   GroupEdit->setEnabled(true);
-  GroupButtons->setEnabled(true) ;
-  
-  mySMESHGUI->SetActiveDialogBox( (QDialog*)this ) ;
-  
+  GroupButtons->setEnabled(true);
+
+  mySMESHGUI->SetActiveDialogBox((QDialog*)this);
+
   SelectionIntoArgument();
 }
 
-
 //=================================================================================
 // function : enterEvent()
 // purpose  :
 //=================================================================================
-void SMESHGUI_MergeNodesDlg::enterEvent(QEvent* e)
+void SMESHGUI_MergeNodesDlg::enterEvent (QEvent*)
 {
-  if ( GroupConstructors->isEnabled() )
-    return ;  
-  ActivateThisDialog() ;
+  if (!GroupConstructors->isEnabled())
+    ActivateThisDialog();
 }
 
-
 //=================================================================================
 // function : closeEvent()
 // purpose  :
 //=================================================================================
-void SMESHGUI_MergeNodesDlg::closeEvent( QCloseEvent* e )
+void SMESHGUI_MergeNodesDlg::closeEvent (QCloseEvent*)
 {
   /* same than click on cancel button */
-  ClickOnCancel() ;
+  ClickOnCancel();
 }
 
-
 //=======================================================================
-//function : hideEvent
+//function : hideEvent()
 //purpose  : caused by ESC key
 //=======================================================================
-
-void SMESHGUI_MergeNodesDlg::hideEvent ( QHideEvent * e )
+void SMESHGUI_MergeNodesDlg::hideEvent (QHideEvent*)
 {
-  if ( !isMinimized() )
+  if (!isMinimized())
     ClickOnCancel();
 }
index ad390853bc590a6f3f6b27e3538bdae75eb5df3f..b679a94f060633bd44a94133d967ce9addaaef5c 100644 (file)
@@ -29,8 +29,9 @@
 #ifndef DIALOGBOX_MERGENODES_H
 #define DIALOGBOX_MERGENODES_H
 
-#include "SALOME_Selection.h"
-#include "SMESH_TypeFilter.hxx"
+#include "SalomeApp_SelectionMgr.h"
+//#include "SMESH_TypeFilter.hxx"
+#include "SUIT_SelectionFilter.h"
 
 // QT Includes
 #include <qdialog.h>
@@ -49,6 +50,9 @@ class QListBox;
 class SMESHGUI;
 class SMESHGUI_SpinBox;
 class SMESH_Actor;
+class SVTK_ViewWindow;
+class SVTK_Selector;
+
 
 // IDL Headers
 #include <SALOMEconfig.h>
@@ -64,26 +68,31 @@ class SMESHGUI_MergeNodesDlg : public QDialog
     Q_OBJECT
 
 public:
-    SMESHGUI_MergeNodesDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 );
+    SMESHGUI_MergeNodesDlg( SMESHGUI*,
+                           const char* name = 0,
+                           bool modal = FALSE,
+                           WFlags fl = 0);
     ~SMESHGUI_MergeNodesDlg();
 
 private:
-
-    void Init() ;
-    void closeEvent( QCloseEvent* e ) ;
-    void enterEvent ( QEvent * ) ;                          /* mouse enter the QWidget */
+    void Init();
+    void closeEvent( QCloseEvent* e );
+    void enterEvent ( QEvent * );                           /* mouse enter the QWidget */
     void hideEvent ( QHideEvent * );                        /* ESC key */
     void onEditNodesGroup();
-    
-    SMESHGUI*                     mySMESHGUI ;              /* Current SMESHGUI object */
-    SALOME_Selection*             mySelection ;             /* User shape selection */
-        
+
+    SMESHGUI*                     mySMESHGUI;               /* Current SMESHGUI object */
+    SalomeApp_SelectionMgr*       mySelectionMgr;           /* User shape selection */
+    SVTK_ViewWindow*              myViewWindow;
+    SVTK_Selector*                mySelector;
+
     QWidget*                      myEditCurrentArgument;
 
     SMESH::SMESH_Mesh_var         myMesh;
     SMESH_Actor*                  myActor;
-    Handle(SMESH_TypeFilter)      myMeshOrSubMeshFilter;
+    //Handle(SMESH_TypeFilter)      myMeshOrSubMeshFilter;
+    SUIT_SelectionFilter*         myMeshOrSubMeshFilter;
+
     QButtonGroup*     GroupConstructors;
     QRadioButton*     RadioButton1;
     QGroupBox*        GroupButtons;
index dd130b2fe63aa688ee7a2d4ccda4cc192ec6a131..cd16d80bd0e1129994f51c68388fcc3eb17dbd67 100644 (file)
@@ -1,23 +1,23 @@
 //  SMESH SMESHGUI : GUI for SMESH component
 //
 //  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
-// 
-//  This library is free software; you can redistribute it and/or 
-//  modify it under the terms of the GNU Lesser General Public 
-//  License as published by the Free Software Foundation; either 
-//  version 2.1 of the License. 
-// 
-//  This library is distributed in the hope that it will be useful, 
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of 
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
-//  Lesser General Public License for more details. 
-// 
-//  You should have received a copy of the GNU Lesser General Public 
-//  License along with this library; if not, write to the Free Software 
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
-// 
-//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
 //
 //
 //
 //  Module : SMESH
 //  $Header$
 
+#include "SMESHGUI_MeshInfosDlg.h"
+
+#include "SMESHGUI.h"
+#include "SMESHGUI_Utils.h"
+
+#include "SUIT_Desktop.h"
+#include "SUIT_ResourceMgr.h"
+#include "SUIT_OverrideCursor.h"
+
+#include "SalomeApp_SelectionMgr.h"
+#include "SALOMEDSClient_Study.hxx"
+#include "SALOME_ListIO.hxx"
+
+#include "utilities.h"
+
 // QT Includes
 #include <qgroupbox.h>
 #include <qlabel.h>
 #include <qmap.h>
 #include <qpushbutton.h>
 
-#include "QAD_Application.h"
-#include "QAD_Desktop.h"
-#include "QAD_WaitCursor.h"
-
-#include "SMESHGUI_MeshInfosDlg.h"
-#include "SMESHGUI_Utils.h"
-#include "SMESHGUI.h"
-
 // IDL Headers
 #include "SALOMEconfig.h"
 #include CORBA_SERVER_HEADER(SMESH_Mesh)
 #include CORBA_SERVER_HEADER(SMESH_Group)
 
-#include "utilities.h"
-
 using namespace std;
 
-#define COLONIZE( str )   ( QString( str ).contains( ":" ) > 0 ? QString( str ) : QString( str ) + " :"  )
+#define COLONIZE(str)   (QString(str).contains(":") > 0 ? QString(str) : QString(str) + " :" )
 
 //=================================================================================
-/*!
- *  SMESHGUI_MeshInfosDlg::SMESHGUI_MeshInfosDlg
- * 
- *  Constructor
- */
+// function : SMESHGUI_MeshInfosDlg()
+// purpose  : Constructor
 //=================================================================================
-SMESHGUI_MeshInfosDlg::SMESHGUI_MeshInfosDlg( QWidget* parent,  const char* name, bool modal, WFlags fl )
-     : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | WDestructiveClose )
+SMESHGUI_MeshInfosDlg::SMESHGUI_MeshInfosDlg (SMESHGUI* theModule, 
+                                             const char* name, 
+                                             bool modal, 
+                                             WFlags fl): 
+  QDialog(SMESH::GetDesktop(theModule), 
+         name, 
+         modal, 
+         WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | WDestructiveClose),
+  mySelectionMgr(SMESH::GetSelectionMgr(theModule)),
+  mySMESHGUI(theModule)
 {
-  if ( !name )
-      setName( "SMESHGUI_MeshInfosDlg" );
-  setCaption( tr( "SMESH_MESHINFO_TITLE"  ) );
-  setSizeGripEnabled( TRUE );
+  if (!name)
+      setName("SMESHGUI_MeshInfosDlg");
+  setCaption(tr("SMESH_MESHINFO_TITLE"));
+  setSizeGripEnabled(TRUE);
 
   myStartSelection = true;
   myIsActiveWindow = true;
 
-  QVBoxLayout* aTopLayout = new QVBoxLayout( this ); 
-  aTopLayout->setSpacing( 6 );  aTopLayout->setMargin( 11 );
+  QVBoxLayout* aTopLayout = new QVBoxLayout(this);
+  aTopLayout->setSpacing(6);  aTopLayout->setMargin(11);
 
   // select button & label
-  QPixmap image0( QAD_Desktop::getResourceManager()->loadPixmap( "SMESH",tr( "ICON_SELECT" ) ) );
-  mySelectBtn = new QPushButton( this, "mySelectBtn" );
-  mySelectBtn->setPixmap( image0 );
-  mySelectBtn->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ) );
+  QPixmap image0(SMESHGUI::resourceMgr()->loadPixmap("SMESH",tr("ICON_SELECT")));
+  mySelectBtn = new QPushButton(this, "mySelectBtn");
+  mySelectBtn->setPixmap(image0);
+  mySelectBtn->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed));
 
-  mySelectLab = new QLabel( this, "mySelectLab" );
-  mySelectLab->setAlignment( AlignCenter );
-  QFont fnt = mySelectLab->font(); fnt.setBold( true );
-  mySelectLab->setFont( fnt );
+  mySelectLab = new QLabel(this, "mySelectLab");
+  mySelectLab->setAlignment(AlignCenter);
+  QFont fnt = mySelectLab->font(); fnt.setBold(true);
+  mySelectLab->setFont(fnt);
 
-  QHBoxLayout* aSelectLayout = new QHBoxLayout; 
-  aSelectLayout->setMargin( 0 ); aSelectLayout->setSpacing( 0 );
-  aSelectLayout->addWidget( mySelectBtn ); 
-  aSelectLayout->addWidget( mySelectLab );
+  QHBoxLayout* aSelectLayout = new QHBoxLayout;
+  aSelectLayout->setMargin(0); aSelectLayout->setSpacing(0);
+  aSelectLayout->addWidget(mySelectBtn);
+  aSelectLayout->addWidget(mySelectLab);
 
   // top widget stack
-  myWGStack = new QWidgetStack( this );
+  myWGStack = new QWidgetStack(this);
 
   // no valid selection
-  QWidget* myBadWidget = new QWidget( myWGStack );
-  QVBoxLayout* aBadLayout = new QVBoxLayout( myBadWidget ); 
-  QLabel* myBadLab = new QLabel( tr( "SMESH_BAD_SELECTION" ), myBadWidget, "myBadLab" );
-  myBadLab->setAlignment( Qt::AlignCenter ); 
-  myBadLab->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ) );
-  aBadLayout->addWidget( myBadLab );
-  myWGStack->addWidget( myBadWidget, 0 );
-  
+  QWidget* myBadWidget = new QWidget(myWGStack);
+  QVBoxLayout* aBadLayout = new QVBoxLayout(myBadWidget);
+  QLabel* myBadLab = new QLabel(tr("SMESH_BAD_SELECTION"), myBadWidget, "myBadLab");
+  myBadLab->setAlignment(Qt::AlignCenter);
+  myBadLab->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding));
+  aBadLayout->addWidget(myBadLab);
+  myWGStack->addWidget(myBadWidget, 0);
+
   // mesh
-  myMeshWidget = new QWidget( myWGStack );
-  QGridLayout* aMeshLayout = new QGridLayout( myMeshWidget ); 
-  aMeshLayout->setSpacing( 6 );  aMeshLayout->setMargin( 0 );
-  myWGStack->addWidget( myMeshWidget );
-  
+  myMeshWidget = new QWidget(myWGStack);
+  QGridLayout* aMeshLayout = new QGridLayout(myMeshWidget);
+  aMeshLayout->setSpacing(6);  aMeshLayout->setMargin(0);
+  myWGStack->addWidget(myMeshWidget);
+
   // --> name
-  QLabel* myMeshNameLab = new QLabel( COLONIZE( tr( "SMESH_MESHINFO_NAME" ) ), myMeshWidget, "myMeshNameLab" );
-  myMeshName    = new QLabel( myMeshWidget, "myMeshName" );
-  myMeshName->setMinimumWidth( 100 );
-  QFrame* line1 = new QFrame( myMeshWidget );
-  line1->setFrameStyle( QFrame::HLine | QFrame::Sunken );
-  
+  QLabel* myMeshNameLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_NAME")), myMeshWidget, "myMeshNameLab");
+  myMeshName    = new QLabel(myMeshWidget, "myMeshName");
+  myMeshName->setMinimumWidth(100);
+  QFrame* line1 = new QFrame(myMeshWidget);
+  line1->setFrameStyle(QFrame::HLine | QFrame::Sunken);
+
   // --> nodes
-  QLabel* myMeshNbNodesLab = new QLabel( COLONIZE( tr( "SMESH_MESHINFO_NODES" ) ), myMeshWidget, "myMeshNbNodesLab" );
-  myMeshNbNodes    = new QLabel( myMeshWidget, "myMeshNbNodes" );
-  myMeshNbNodes->setMinimumWidth( 100 );
-  
+  QLabel* myMeshNbNodesLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_NODES")), myMeshWidget, "myMeshNbNodesLab");
+  myMeshNbNodes    = new QLabel(myMeshWidget, "myMeshNbNodes");
+  myMeshNbNodes->setMinimumWidth(100);
+
   // --> edges
-  QLabel* myMeshNbEdgesLab = new QLabel( COLONIZE( tr( "SMESH_MESHINFO_EDGES" ) ), myMeshWidget, "myMeshNbEdgesLab" );
-  myMeshNbEdges    = new QLabel( myMeshWidget, "myMeshNbEdges" );
-  myMeshNbEdges->setMinimumWidth( 100 );
-  
+  QLabel* myMeshNbEdgesLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_EDGES")), myMeshWidget, "myMeshNbEdgesLab");
+  myMeshNbEdges    = new QLabel(myMeshWidget, "myMeshNbEdges");
+  myMeshNbEdges->setMinimumWidth(100);
+
   // --> faces
-  myMeshFacesGroup = new QGroupBox( tr( "SMESH_MESHINFO_FACES" ), myMeshWidget, "myMeshFacesGroup" );
-  myMeshFacesGroup->setColumnLayout(0, Qt::Vertical );
-  myMeshFacesGroup->layout()->setSpacing( 0 );  myMeshFacesGroup->layout()->setMargin( 0 );
-  QGridLayout* myMeshFacesGroupLayout = new QGridLayout( myMeshFacesGroup->layout() );
-  myMeshFacesGroupLayout->setAlignment( Qt::AlignTop );
-  myMeshFacesGroupLayout->setSpacing( 6 );  myMeshFacesGroupLayout->setMargin( 11 );
+  myMeshFacesGroup = new QGroupBox(tr("SMESH_MESHINFO_FACES"), myMeshWidget, "myMeshFacesGroup");
+  myMeshFacesGroup->setColumnLayout(0, Qt::Vertical);
+  myMeshFacesGroup->layout()->setSpacing(0);  myMeshFacesGroup->layout()->setMargin(0);
+  QGridLayout* myMeshFacesGroupLayout = new QGridLayout(myMeshFacesGroup->layout());
+  myMeshFacesGroupLayout->setAlignment(Qt::AlignTop);
+  myMeshFacesGroupLayout->setSpacing(6);  myMeshFacesGroupLayout->setMargin(11);
 
   // --> faces --> total
-  QLabel* myMeshNbFacesLab = new QLabel( COLONIZE( tr( "SMESH_MESHINFO_TOTAL" ) ), myMeshFacesGroup, "myMeshNbFacesLab" );
-  myMeshNbFacesLab->setFont( fnt );
-  myMeshNbFaces    = new QLabel( myMeshFacesGroup, "myMeshNbFaces" );
-  myMeshNbFaces->setMinimumWidth( 100 );
-  myMeshNbFaces->setFont( fnt );
-  
+  QLabel* myMeshNbFacesLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_TOTAL")), myMeshFacesGroup, "myMeshNbFacesLab");
+  myMeshNbFacesLab->setFont(fnt);
+  myMeshNbFaces    = new QLabel(myMeshFacesGroup, "myMeshNbFaces");
+  myMeshNbFaces->setMinimumWidth(100);
+  myMeshNbFaces->setFont(fnt);
+
   // --> faces --> triangles
-  QLabel* myMeshNbTrianglesLab = new QLabel( COLONIZE( tr( "SMESH_MESHINFO_TRIANGLES" ) ), myMeshFacesGroup, "myMeshNbTrianglesLab" );
-  myMeshNbTriangles    = new QLabel( myMeshFacesGroup, "myMeshNbTriangles" );
-  myMeshNbTriangles->setMinimumWidth( 100 );
-  
+  QLabel* myMeshNbTrianglesLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_TRIANGLES")), myMeshFacesGroup, "myMeshNbTrianglesLab");
+  myMeshNbTriangles    = new QLabel(myMeshFacesGroup, "myMeshNbTriangles");
+  myMeshNbTriangles->setMinimumWidth(100);
+
   // --> faces --> quadrangles
-  QLabel* myMeshNbQuadranglesLab = new QLabel( COLONIZE( tr( "SMESH_MESHINFO_QUADRANGLES" ) ), myMeshFacesGroup, "myMeshNbQuadranglesLab" );
-  myMeshNbQuadrangles    = new QLabel( myMeshFacesGroup, "myMeshNbQuadrangles" );
-  myMeshNbQuadrangles->setMinimumWidth( 100 );
-  
-  myMeshFacesGroupLayout->addWidget( myMeshNbFacesLab,       0, 0 );
-  myMeshFacesGroupLayout->addWidget( myMeshNbFaces,          0, 1 );
-  myMeshFacesGroupLayout->addWidget( myMeshNbTrianglesLab,   1, 0 );
-  myMeshFacesGroupLayout->addWidget( myMeshNbTriangles,      1, 1 );
-  myMeshFacesGroupLayout->addWidget( myMeshNbQuadranglesLab, 2, 0 );
-  myMeshFacesGroupLayout->addWidget( myMeshNbQuadrangles,    2, 1 );
+  QLabel* myMeshNbQuadranglesLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_QUADRANGLES")), myMeshFacesGroup, "myMeshNbQuadranglesLab");
+  myMeshNbQuadrangles    = new QLabel(myMeshFacesGroup, "myMeshNbQuadrangles");
+  myMeshNbQuadrangles->setMinimumWidth(100);
+
+  // --> faces --> polygons
+  QLabel* myMeshNbPolygonesLab = new QLabel( COLONIZE( tr( "SMESH_MESHINFO_POLYGONES" ) ), myMeshFacesGroup, "myMeshNbPolygonesLab" );
+  myMeshNbPolygones      = new QLabel( myMeshFacesGroup, "myMeshNbPolygones" );
+  myMeshNbPolygones->setMinimumWidth( 100 );
+
+  myMeshFacesGroupLayout->addWidget(myMeshNbFacesLab,       0, 0);
+  myMeshFacesGroupLayout->addWidget(myMeshNbFaces,          0, 1);
+  myMeshFacesGroupLayout->addWidget(myMeshNbTrianglesLab,   1, 0);
+  myMeshFacesGroupLayout->addWidget(myMeshNbTriangles,      1, 1);
+  myMeshFacesGroupLayout->addWidget(myMeshNbQuadranglesLab, 2, 0);
+  myMeshFacesGroupLayout->addWidget(myMeshNbQuadrangles,    2, 1);
+  myMeshFacesGroupLayout->addWidget( myMeshNbPolygonesLab,   3, 0 );
+  myMeshFacesGroupLayout->addWidget( myMeshNbPolygones,      3, 1 );
   
   // --> volumes
-  myMeshVolumesGroup = new QGroupBox( tr( "SMESH_MESHINFO_VOLUMES" ), myMeshWidget, "myMeshVolumesGroup" );
-  myMeshVolumesGroup->setColumnLayout(0, Qt::Vertical );
-  myMeshVolumesGroup->layout()->setSpacing( 0 );  myMeshVolumesGroup->layout()->setMargin( 0 );
-  QGridLayout* myMeshVolumesGroupLayout = new QGridLayout( myMeshVolumesGroup->layout() );
-  myMeshVolumesGroupLayout->setAlignment( Qt::AlignTop );
-  myMeshVolumesGroupLayout->setSpacing( 6 );  myMeshVolumesGroupLayout->setMargin( 11 );
-  
+  myMeshVolumesGroup = new QGroupBox(tr("SMESH_MESHINFO_VOLUMES"), myMeshWidget, "myMeshVolumesGroup");
+  myMeshVolumesGroup->setColumnLayout(0, Qt::Vertical);
+  myMeshVolumesGroup->layout()->setSpacing(0);  myMeshVolumesGroup->layout()->setMargin(0);
+  QGridLayout* myMeshVolumesGroupLayout = new QGridLayout(myMeshVolumesGroup->layout());
+  myMeshVolumesGroupLayout->setAlignment(Qt::AlignTop);
+  myMeshVolumesGroupLayout->setSpacing(6);  myMeshVolumesGroupLayout->setMargin(11);
+
   // --> volumes --> total
-  QLabel* myMeshNbVolumesLab = new QLabel( COLONIZE( tr( "SMESH_MESHINFO_TOTAL" ) ), myMeshVolumesGroup, "myMeshNbVolumesLab" );
-  myMeshNbVolumesLab->setFont( fnt );
-  myMeshNbVolumes    = new QLabel( myMeshVolumesGroup, "myMeshNbVolumes" );
-  myMeshNbVolumes->setMinimumWidth( 100 );
-  myMeshNbVolumes->setFont( fnt );
-  
+  QLabel* myMeshNbVolumesLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_TOTAL")), myMeshVolumesGroup, "myMeshNbVolumesLab");
+  myMeshNbVolumesLab->setFont(fnt);
+  myMeshNbVolumes    = new QLabel(myMeshVolumesGroup, "myMeshNbVolumes");
+  myMeshNbVolumes->setMinimumWidth(100);
+  myMeshNbVolumes->setFont(fnt);
+
   // --> volumes --> tetrahedrons
-  QLabel* myMeshNbTetraLab = new QLabel( COLONIZE( tr( "SMESH_MESHINFO_TETRAS" ) ), myMeshVolumesGroup, "myMeshNbTetraLab" );
-  myMeshNbTetra    = new QLabel( myMeshVolumesGroup, "myMeshNbTetra" );
-  myMeshNbTetra->setMinimumWidth( 100 );
-  
+  QLabel* myMeshNbTetraLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_TETRAS")), myMeshVolumesGroup, "myMeshNbTetraLab");
+  myMeshNbTetra    = new QLabel(myMeshVolumesGroup, "myMeshNbTetra");
+  myMeshNbTetra->setMinimumWidth(100);
+
   // --> volumes --> hexahedrons
-  QLabel* myMeshNbHexaLab = new QLabel( COLONIZE( tr( "SMESH_MESHINFO_HEXAS" ) ), myMeshVolumesGroup, "myMeshNbHexaLab" );
-  myMeshNbHexa    = new QLabel( myMeshVolumesGroup, "myMeshNbHexa" );
-  myMeshNbHexaLab->setMinimumWidth( 100 );
-  
+  QLabel* myMeshNbHexaLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_HEXAS")), myMeshVolumesGroup, "myMeshNbHexaLab");
+  myMeshNbHexa    = new QLabel(myMeshVolumesGroup, "myMeshNbHexa");
+  myMeshNbHexaLab->setMinimumWidth(100);
+
   // --> volumes --> prisms
-  QLabel* myMeshNbPrismLab = new QLabel( COLONIZE( tr( "SMESH_MESHINFO_PRISMS" ) ), myMeshVolumesGroup, "myMeshNbPrismLab" );
-  myMeshNbPrism    = new QLabel( myMeshVolumesGroup, "myMeshNbPrism" );
-  myMeshNbPrism->setMinimumWidth( 100 );
-  
+  QLabel* myMeshNbPrismLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_PRISMS")), myMeshVolumesGroup, "myMeshNbPrismLab");
+  myMeshNbPrism    = new QLabel(myMeshVolumesGroup, "myMeshNbPrism");
+  myMeshNbPrism->setMinimumWidth(100);
+
   // --> volumes --> pyramids
-  QLabel* myMeshNbPyraLab = new QLabel( COLONIZE( tr( "SMESH_MESHINFO_PYRAS" ) ), myMeshVolumesGroup, "myMeshNbPyraLab" );
-  myMeshNbPyra    = new QLabel( myMeshVolumesGroup, "myMeshNbPyra" );
-  myMeshNbPyra->setMinimumWidth( 100 );
-  
-  myMeshVolumesGroupLayout->addWidget( myMeshNbVolumesLab, 0, 0 );
-  myMeshVolumesGroupLayout->addWidget( myMeshNbVolumes,    0, 1 );
-  myMeshVolumesGroupLayout->addWidget( myMeshNbTetraLab,   1, 0 );
-  myMeshVolumesGroupLayout->addWidget( myMeshNbTetra,      1, 1 );
-  myMeshVolumesGroupLayout->addWidget( myMeshNbHexaLab,    2, 0 );
-  myMeshVolumesGroupLayout->addWidget( myMeshNbHexa,       2, 1 );
-  myMeshVolumesGroupLayout->addWidget( myMeshNbPrismLab,   3, 0 );
-  myMeshVolumesGroupLayout->addWidget( myMeshNbPrism,      3, 1 );
-  myMeshVolumesGroupLayout->addWidget( myMeshNbPyraLab,    4, 0 );
-  myMeshVolumesGroupLayout->addWidget( myMeshNbPyra,       4, 1 );
-  
-  aMeshLayout->addWidget( myMeshNameLab,          0, 0 );
-  aMeshLayout->addWidget( myMeshName,             0, 1 );
-  aMeshLayout->addMultiCellWidget( line1,   1, 1, 0, 1 );
-  aMeshLayout->addWidget( myMeshNbNodesLab,       2, 0 );
-  aMeshLayout->addWidget( myMeshNbNodes,          2, 1 );
-  aMeshLayout->addWidget( myMeshNbEdgesLab,       3, 0 );
-  aMeshLayout->addWidget( myMeshNbEdges,          3, 1 );
-  aMeshLayout->addMultiCellWidget( myMeshFacesGroup,   4, 4, 0, 1 );
-  aMeshLayout->addMultiCellWidget( myMeshVolumesGroup, 5, 5, 0, 1 );
-  aMeshLayout->addItem( new QSpacerItem( 5, 5, QSizePolicy::Minimum, QSizePolicy::Expanding ), 6, 0 );
+  QLabel* myMeshNbPyraLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_PYRAS")), myMeshVolumesGroup, "myMeshNbPyraLab");
+  myMeshNbPyra    = new QLabel(myMeshVolumesGroup, "myMeshNbPyra");
+  myMeshNbPyra->setMinimumWidth(100);
+
+  // --> volumes --> polyherones
+  QLabel* myMeshNbPolyhedronesLab = new QLabel( COLONIZE( tr( "SMESH_MESHINFO_POLYEDRES" ) ), myMeshVolumesGroup, "myMeshNbPolyhedronLab" );
+  myMeshNbPolyhedrones = new QLabel( myMeshVolumesGroup, "myMeshNbPolyhedrones" );
+  myMeshNbPolyhedrones->setMinimumWidth( 100 );
+
+  myMeshVolumesGroupLayout->addWidget(myMeshNbVolumesLab, 0, 0);
+  myMeshVolumesGroupLayout->addWidget(myMeshNbVolumes,    0, 1);
+  myMeshVolumesGroupLayout->addWidget(myMeshNbTetraLab,   1, 0);
+  myMeshVolumesGroupLayout->addWidget(myMeshNbTetra,      1, 1);
+  myMeshVolumesGroupLayout->addWidget(myMeshNbHexaLab,    2, 0);
+  myMeshVolumesGroupLayout->addWidget(myMeshNbHexa,       2, 1);
+  myMeshVolumesGroupLayout->addWidget(myMeshNbPrismLab,   3, 0);
+  myMeshVolumesGroupLayout->addWidget(myMeshNbPrism,      3, 1);
+  myMeshVolumesGroupLayout->addWidget(myMeshNbPyraLab,    4, 0);
+  myMeshVolumesGroupLayout->addWidget(myMeshNbPyra,       4, 1);
+  myMeshVolumesGroupLayout->addWidget( myMeshNbPolyhedronesLab,    5, 0 );
+  myMeshVolumesGroupLayout->addWidget( myMeshNbPolyhedrones,       5, 1 );
+
+  aMeshLayout->addWidget(myMeshNameLab,          0, 0);
+  aMeshLayout->addWidget(myMeshName,             0, 1);
+  aMeshLayout->addMultiCellWidget(line1,   1, 1, 0, 1);
+  aMeshLayout->addWidget(myMeshNbNodesLab,       2, 0);
+  aMeshLayout->addWidget(myMeshNbNodes,          2, 1);
+  aMeshLayout->addWidget(myMeshNbEdgesLab,       3, 0);
+  aMeshLayout->addWidget(myMeshNbEdges,          3, 1);
+  aMeshLayout->addMultiCellWidget(myMeshFacesGroup,   4, 4, 0, 1);
+  aMeshLayout->addMultiCellWidget(myMeshVolumesGroup, 5, 5, 0, 1);
+  aMeshLayout->addItem(new QSpacerItem(5, 5, QSizePolicy::Minimum, QSizePolicy::Expanding), 6, 0);
 
   // submesh
-  mySubMeshWidget = new QWidget( myWGStack );
-  QGridLayout* aSubMeshLayout = new QGridLayout( mySubMeshWidget ); 
-  aSubMeshLayout->setSpacing( 6 );  aSubMeshLayout->setMargin( 0 );
-  myWGStack->addWidget( mySubMeshWidget );
-  
+  mySubMeshWidget = new QWidget(myWGStack);
+  QGridLayout* aSubMeshLayout = new QGridLayout(mySubMeshWidget);
+  aSubMeshLayout->setSpacing(6);  aSubMeshLayout->setMargin(0);
+  myWGStack->addWidget(mySubMeshWidget);
+
   // --> name
-  QLabel* mySubMeshNameLab = new QLabel( COLONIZE( tr( "SMESH_MESHINFO_NAME" ) ), mySubMeshWidget, "mySubMeshNameLab" );
-  mySubMeshName    = new QLabel( mySubMeshWidget, "mySubMeshName" );
-  mySubMeshName->setMinimumWidth( 100 );
-  QFrame* line2 = new QFrame( mySubMeshWidget );
-  line2->setFrameStyle( QFrame::HLine | QFrame::Sunken );
-  
+  QLabel* mySubMeshNameLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_NAME")), mySubMeshWidget, "mySubMeshNameLab");
+  mySubMeshName    = new QLabel(mySubMeshWidget, "mySubMeshName");
+  mySubMeshName->setMinimumWidth(100);
+  QFrame* line2 = new QFrame(mySubMeshWidget);
+  line2->setFrameStyle(QFrame::HLine | QFrame::Sunken);
+
   // --> nodes
-  QLabel* mySubMeshNbNodesLab = new QLabel( COLONIZE( tr( "SMESH_MESHINFO_NODES" ) ), mySubMeshWidget, "mySubMeshNbNodesLab" );
-  mySubMeshNbNodes    = new QLabel( mySubMeshWidget, "mySubMeshNbNodes" );
-  mySubMeshNbNodes->setMinimumWidth( 100 );
-  
+  QLabel* mySubMeshNbNodesLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_NODES")), mySubMeshWidget, "mySubMeshNbNodesLab");
+  mySubMeshNbNodes    = new QLabel(mySubMeshWidget, "mySubMeshNbNodes");
+  mySubMeshNbNodes->setMinimumWidth(100);
+
   // --> elements
-  mySubMeshElementsGroup = new QGroupBox( tr( "SMESH_MESHINFO_ELEMENTS" ), mySubMeshWidget, "mySubMeshElementsGroup" );
-  mySubMeshElementsGroup->setColumnLayout(0, Qt::Vertical );
-  mySubMeshElementsGroup->layout()->setSpacing( 0 );  mySubMeshElementsGroup->layout()->setMargin( 0 );
-  QGridLayout* mySubMeshElementsGroupLayout = new QGridLayout( mySubMeshElementsGroup->layout() );
-  mySubMeshElementsGroupLayout->setAlignment( Qt::AlignTop );
-  mySubMeshElementsGroupLayout->setSpacing( 6 );  mySubMeshElementsGroupLayout->setMargin( 11 );
+  mySubMeshElementsGroup = new QGroupBox(tr("SMESH_MESHINFO_ELEMENTS"), mySubMeshWidget, "mySubMeshElementsGroup");
+  mySubMeshElementsGroup->setColumnLayout(0, Qt::Vertical);
+  mySubMeshElementsGroup->layout()->setSpacing(0);  mySubMeshElementsGroup->layout()->setMargin(0);
+  QGridLayout* mySubMeshElementsGroupLayout = new QGridLayout(mySubMeshElementsGroup->layout());
+  mySubMeshElementsGroupLayout->setAlignment(Qt::AlignTop);
+  mySubMeshElementsGroupLayout->setSpacing(6);  mySubMeshElementsGroupLayout->setMargin(11);
 
   // --> elements --> total
-  QLabel* mySubMeshNbElementsLab = new QLabel( COLONIZE( tr( "SMESH_MESHINFO_TOTAL" ) ), mySubMeshElementsGroup, "mySubMeshNbElementsLab" );
-  mySubMeshNbElementsLab->setFont( fnt );
-  mySubMeshNbElements    = new QLabel( mySubMeshElementsGroup, "mySubMeshNbElements" );
-  mySubMeshNbElements->setMinimumWidth( 100 );
-  mySubMeshNbElements->setFont( fnt );
-  
+  QLabel* mySubMeshNbElementsLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_TOTAL")), mySubMeshElementsGroup, "mySubMeshNbElementsLab");
+  mySubMeshNbElementsLab->setFont(fnt);
+  mySubMeshNbElements    = new QLabel(mySubMeshElementsGroup, "mySubMeshNbElements");
+  mySubMeshNbElements->setMinimumWidth(100);
+  mySubMeshNbElements->setFont(fnt);
+
   // --> elements --> edges
-  QLabel* mySubMeshNbEdgesLab = new QLabel( COLONIZE( tr( "SMESH_MESHINFO_EDGES" ) ), mySubMeshElementsGroup, "mySubMeshNbEdgesLab" );
-  mySubMeshNbEdges    = new QLabel( mySubMeshElementsGroup, "mySubMeshNbEdges" );
-  mySubMeshNbEdges->setMinimumWidth( 100 );
-  
+  QLabel* mySubMeshNbEdgesLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_EDGES")), mySubMeshElementsGroup, "mySubMeshNbEdgesLab");
+  mySubMeshNbEdges    = new QLabel(mySubMeshElementsGroup, "mySubMeshNbEdges");
+  mySubMeshNbEdges->setMinimumWidth(100);
+
   // --> elements --> faces
-  QLabel* mySubMeshNbFacesLab = new QLabel( COLONIZE( tr( "SMESH_MESHINFO_FACES" ) ), mySubMeshElementsGroup, "mySubMeshNbFacesLab" );
-  mySubMeshNbFaces    = new QLabel( mySubMeshElementsGroup, "mySubMeshNbFaces" );
-  mySubMeshNbFaces->setMinimumWidth( 100 );
-  
+  QLabel* mySubMeshNbFacesLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_FACES")), mySubMeshElementsGroup, "mySubMeshNbFacesLab");
+  mySubMeshNbFaces    = new QLabel(mySubMeshElementsGroup, "mySubMeshNbFaces");
+  mySubMeshNbFaces->setMinimumWidth(100);
+
   // --> elements --> volumes
-  QLabel* mySubMeshNbVolumesLab = new QLabel( COLONIZE( tr( "SMESH_MESHINFO_VOLUMES" ) ), mySubMeshElementsGroup, "mySubMeshNbVolumesLab" );
-  mySubMeshNbVolumes    = new QLabel( mySubMeshElementsGroup, "mySubMeshNbVolumes" );
-  mySubMeshNbVolumes->setMinimumWidth( 100 );
-  
-  mySubMeshElementsGroupLayout->addWidget( mySubMeshNbElementsLab, 0, 0 );
-  mySubMeshElementsGroupLayout->addWidget( mySubMeshNbElements,    0, 1 );
-  mySubMeshElementsGroupLayout->addWidget( mySubMeshNbEdgesLab,    1, 0 );
-  mySubMeshElementsGroupLayout->addWidget( mySubMeshNbEdges,       1, 1 );
-  mySubMeshElementsGroupLayout->addWidget( mySubMeshNbFacesLab,    2, 0 );
-  mySubMeshElementsGroupLayout->addWidget( mySubMeshNbFaces,       2, 1 );
-  mySubMeshElementsGroupLayout->addWidget( mySubMeshNbVolumesLab,  3, 0 );
-  mySubMeshElementsGroupLayout->addWidget( mySubMeshNbVolumes,     3, 1 );
-
-  aSubMeshLayout->addWidget( mySubMeshNameLab,          0, 0 );
-  aSubMeshLayout->addWidget( mySubMeshName,             0, 1 );
-  aSubMeshLayout->addMultiCellWidget( line2,      1, 1, 0, 1 );
-  aSubMeshLayout->addWidget( mySubMeshNbNodesLab,       2, 0 );
-  aSubMeshLayout->addWidget( mySubMeshNbNodes,          2, 1 );
-  aSubMeshLayout->addMultiCellWidget( mySubMeshElementsGroup, 3, 3, 0, 1 );
-  aSubMeshLayout->addItem( new QSpacerItem( 5, 5, QSizePolicy::Minimum, QSizePolicy::Expanding ), 4, 0 );
+  QLabel* mySubMeshNbVolumesLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_VOLUMES")), mySubMeshElementsGroup, "mySubMeshNbVolumesLab");
+  mySubMeshNbVolumes    = new QLabel(mySubMeshElementsGroup, "mySubMeshNbVolumes");
+  mySubMeshNbVolumes->setMinimumWidth(100);
+
+  mySubMeshElementsGroupLayout->addWidget(mySubMeshNbElementsLab, 0, 0);
+  mySubMeshElementsGroupLayout->addWidget(mySubMeshNbElements,    0, 1);
+  mySubMeshElementsGroupLayout->addWidget(mySubMeshNbEdgesLab,    1, 0);
+  mySubMeshElementsGroupLayout->addWidget(mySubMeshNbEdges,       1, 1);
+  mySubMeshElementsGroupLayout->addWidget(mySubMeshNbFacesLab,    2, 0);
+  mySubMeshElementsGroupLayout->addWidget(mySubMeshNbFaces,       2, 1);
+  mySubMeshElementsGroupLayout->addWidget(mySubMeshNbVolumesLab,  3, 0);
+  mySubMeshElementsGroupLayout->addWidget(mySubMeshNbVolumes,     3, 1);
+
+  aSubMeshLayout->addWidget(mySubMeshNameLab,          0, 0);
+  aSubMeshLayout->addWidget(mySubMeshName,             0, 1);
+  aSubMeshLayout->addMultiCellWidget(line2,      1, 1, 0, 1);
+  aSubMeshLayout->addWidget(mySubMeshNbNodesLab,       2, 0);
+  aSubMeshLayout->addWidget(mySubMeshNbNodes,          2, 1);
+  aSubMeshLayout->addMultiCellWidget(mySubMeshElementsGroup, 3, 3, 0, 1);
+  aSubMeshLayout->addItem(new QSpacerItem(5, 5, QSizePolicy::Minimum, QSizePolicy::Expanding), 4, 0);
 
   // group
-  myGroupWidget = new QWidget( myWGStack );
-  QGridLayout* myGroupWidgetLayout = new QGridLayout( myGroupWidget ); 
-  myGroupWidgetLayout->setSpacing( 6 );  myGroupWidgetLayout->setMargin( 0 );
-  myWGStack->addWidget( myGroupWidget );
-  
+  myGroupWidget = new QWidget(myWGStack);
+  QGridLayout* myGroupWidgetLayout = new QGridLayout(myGroupWidget);
+  myGroupWidgetLayout->setSpacing(6);  myGroupWidgetLayout->setMargin(0);
+  myWGStack->addWidget(myGroupWidget);
+
   // --> name
-  QLabel* myGroupNameLab = new QLabel( COLONIZE( tr( "SMESH_MESHINFO_NAME" ) ), myGroupWidget, "myGroupNameLab" );
-  myGroupName = new QLabel( myGroupWidget, "myGroupName" );
-  myGroupName->setMinimumWidth( 100 );
-  QFrame* line3 = new QFrame( myGroupWidget );
-  line3->setFrameStyle( QFrame::HLine | QFrame::Sunken );
-  
+  QLabel* myGroupNameLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_NAME")), myGroupWidget, "myGroupNameLab");
+  myGroupName = new QLabel(myGroupWidget, "myGroupName");
+  myGroupName->setMinimumWidth(100);
+  QFrame* line3 = new QFrame(myGroupWidget);
+  line3->setFrameStyle(QFrame::HLine | QFrame::Sunken);
+
   // --> type
-  QLabel* myGroupTypeLab = new QLabel( COLONIZE( tr( "SMESH_MESHINFO_TYPE" ) ), myGroupWidget, "myGroupTypeLab" );
-  myGroupType = new QLabel( myGroupWidget, "myGroupType" );
-  myGroupType->setMinimumWidth( 100 );
+  QLabel* myGroupTypeLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_TYPE")), myGroupWidget, "myGroupTypeLab");
+  myGroupType = new QLabel(myGroupWidget, "myGroupType");
+  myGroupType->setMinimumWidth(100);
 
   // --> number of entities
-  QLabel* myGroupNbLab = new QLabel( COLONIZE( tr( "SMESH_MESHINFO_ENTITIES" ) ), myGroupWidget, "myGroupNbLab" );
-  myGroupNb = new QLabel( myGroupWidget, "myGroupNb" );
-  myGroupNb->setMinimumWidth( 100 );
-  
-  myGroupWidgetLayout->addWidget( myGroupNameLab,       0, 0 );
-  myGroupWidgetLayout->addWidget( myGroupName,          0, 1 );
-  myGroupWidgetLayout->addMultiCellWidget( line3, 1, 1, 0, 1 );
-  myGroupWidgetLayout->addWidget( myGroupTypeLab,       2, 0 );
-  myGroupWidgetLayout->addWidget( myGroupType,          2, 1 );
-  myGroupWidgetLayout->addWidget( myGroupNbLab,         3, 0 );
-  myGroupWidgetLayout->addWidget( myGroupNb,            3, 1 );
-  myGroupWidgetLayout->addItem( new QSpacerItem( 5, 5, QSizePolicy::Minimum, QSizePolicy::Expanding ), 4, 0 );
+  QLabel* myGroupNbLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_ENTITIES")), myGroupWidget, "myGroupNbLab");
+  myGroupNb = new QLabel(myGroupWidget, "myGroupNb");
+  myGroupNb->setMinimumWidth(100);
+
+  myGroupWidgetLayout->addWidget(myGroupNameLab,       0, 0);
+  myGroupWidgetLayout->addWidget(myGroupName,          0, 1);
+  myGroupWidgetLayout->addMultiCellWidget(line3, 1, 1, 0, 1);
+  myGroupWidgetLayout->addWidget(myGroupTypeLab,       2, 0);
+  myGroupWidgetLayout->addWidget(myGroupType,          2, 1);
+  myGroupWidgetLayout->addWidget(myGroupNbLab,         3, 0);
+  myGroupWidgetLayout->addWidget(myGroupNb,            3, 1);
+  myGroupWidgetLayout->addItem(new QSpacerItem(5, 5, QSizePolicy::Minimum, QSizePolicy::Expanding), 4, 0);
 
   // buttons
-  myButtonsGroup = new QGroupBox( this, "myButtonsGroup" );
-  myButtonsGroup->setColumnLayout(0, Qt::Vertical );
-  myButtonsGroup->layout()->setSpacing( 0 );  myButtonsGroup->layout()->setMargin( 0 );
-  QHBoxLayout* myButtonsGroupLayout = new QHBoxLayout( myButtonsGroup->layout() );
-  myButtonsGroupLayout->setAlignment( Qt::AlignTop );
-  myButtonsGroupLayout->setSpacing( 6 ); myButtonsGroupLayout->setMargin( 11 );
-  
+  myButtonsGroup = new QGroupBox(this, "myButtonsGroup");
+  myButtonsGroup->setColumnLayout(0, Qt::Vertical);
+  myButtonsGroup->layout()->setSpacing(0);  myButtonsGroup->layout()->setMargin(0);
+  QHBoxLayout* myButtonsGroupLayout = new QHBoxLayout(myButtonsGroup->layout());
+  myButtonsGroupLayout->setAlignment(Qt::AlignTop);
+  myButtonsGroupLayout->setSpacing(6); myButtonsGroupLayout->setMargin(11);
+
   // buttons --> OK button
-  myOkBtn = new QPushButton( tr( "SMESH_BUT_OK"  ), myButtonsGroup, "myOkBtn" );
-  myOkBtn->setAutoDefault( TRUE ); myOkBtn->setDefault( TRUE );
+  myOkBtn = new QPushButton(tr("SMESH_BUT_OK" ), myButtonsGroup, "myOkBtn");
+  myOkBtn->setAutoDefault(TRUE); myOkBtn->setDefault(TRUE);
   myButtonsGroupLayout->addStretch();
-  myButtonsGroupLayout->addWidget( myOkBtn );
+  myButtonsGroupLayout->addWidget(myOkBtn);
   myButtonsGroupLayout->addStretch();
 
-  aTopLayout->addLayout( aSelectLayout );
-  aTopLayout->addWidget( myWGStack );
-  aTopLayout->addWidget( myButtonsGroup );
-  
-  mySelection = SALOME_Selection::Selection( SMESHGUI::GetSMESHGUI()->GetActiveStudy()->getSelection() );
-  SMESHGUI::GetSMESHGUI()->SetActiveDialogBox( this ) ;
+  aTopLayout->addLayout(aSelectLayout);
+  aTopLayout->addWidget(myWGStack);
+  aTopLayout->addWidget(myButtonsGroup);
+
+  mySMESHGUI->SetActiveDialogBox(this);
 
   // connect signals
-  connect( myOkBtn,                  SIGNAL( clicked() ),                      this, SLOT( close() ) );
-  connect( mySelectBtn,              SIGNAL( clicked() ),                      this, SLOT( onStartSelection() ) );
-  connect( SMESHGUI::GetSMESHGUI(),  SIGNAL( SignalCloseAllDialogs() ),        this, SLOT( close() ) ) ;
-  connect( SMESHGUI::GetSMESHGUI(),  SIGNAL( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ;
-  connect( mySelection,              SIGNAL( currentSelectionChanged() ),      this, SLOT( onSelectionChanged() ) );
+  connect(myOkBtn,                 SIGNAL(clicked()),                      this, SLOT(close()));
+  connect(mySelectBtn,             SIGNAL(clicked()),                      this, SLOT(onStartSelection()));
+  connect(mySMESHGUI, SIGNAL(SignalCloseAllDialogs()),        this, SLOT(close()));
+  connect(mySMESHGUI, SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog()));
+  connect(mySelectionMgr,          SIGNAL(currentSelectionChanged()),      this, SLOT(onSelectionChanged()));
 
   // resize and move dialog, then show
   int x, y;
-  SMESHGUI::GetSMESHGUI()->DefineDlgPosition( this, x, y );
-  this->move( x, y );
+  mySMESHGUI->DefineDlgPosition(this, x, y);
+  this->move(x, y);
   this->show();
 
-  cout<<"----"<<this->height()<<endl;
-  cout<<"----"<<this->width()<<endl;
   // init dialog with current selection
   onSelectionChanged();
 }
 
 //=================================================================================
-/*!
- *  SMESHGUI_MeshInfosDlg::~SMESHGUI_MeshInfosDlg
- * 
- *  Destructor
- */
+// function : ~SMESHGUI_MeshInfosDlg()
+// purpose  : Destructor
 //=================================================================================
 SMESHGUI_MeshInfosDlg::~SMESHGUI_MeshInfosDlg()
 {
 }
 
 //=================================================================================
-/*!
- *  SMESHGUI_MeshInfosDlg::DumpMeshInfos
- */
+// function : DumpMeshInfos()
+// purpose  : 
 //=================================================================================
 void SMESHGUI_MeshInfosDlg::DumpMeshInfos()
 {
-  QAD_WaitCursor wc;
-  int nbSel = mySelection->IObjectCount();
-  if ( nbSel == 1 ) {
+  SUIT_OverrideCursor wc;
+
+  SALOME_ListIO aList;
+  mySelectionMgr->selectedObjects(aList);
+
+  int nbSel = aList.Extent();
+  if (nbSel == 1) {
     myStartSelection = false;
-    mySelectLab->setText( "" );
-    Handle(SALOME_InteractiveObject) IObject = mySelection->firstIObject();
-    SALOMEDS::SObject_var aSO = SMESH::GetActiveStudyDocument()->FindObjectID( IObject->getEntry() );
-    if ( !aSO->_is_nil() ) {
-      CORBA::Object_var anObject = aSO->GetObject();
-      if ( !CORBA::is_nil( anObject ) ) {
-       SMESH::SMESH_Mesh_var aMesh = SMESH::SMESH_Mesh::_narrow( anObject );
-       if ( !aMesh->_is_nil() ) {
-         myWGStack->raiseWidget( myMeshWidget );
-         setCaption( tr( "SMESH_MESHINFO_TITLE" ) + " [" + tr("SMESH_OBJECT_MESH") +"]" );
-         myMeshName->setText( aSO->GetName() );
-         myMeshNbNodes->setNum( (int)aMesh->NbNodes() );
-         myMeshNbEdges->setNum( (int)aMesh->NbEdges() );
-         myMeshNbFaces->setNum( (int)aMesh->NbFaces() );
-         myMeshNbTriangles->setNum( (int)aMesh->NbTriangles() );
-         myMeshNbQuadrangles->setNum( (int)aMesh->NbQuadrangles() );
-         myMeshNbVolumes->setNum( (int)aMesh->NbVolumes() );
-         myMeshNbTetra->setNum( (int)aMesh->NbTetras() );
-         myMeshNbHexa->setNum( (int)aMesh->NbHexas() );
-         myMeshNbPrism->setNum( (int)aMesh->NbPrisms() );
-         myMeshNbPyra->setNum( (int)aMesh->NbPyramids() );
+    mySelectLab->setText("");
+    Handle(SALOME_InteractiveObject) IObject = aList.First();
+    _PTR(SObject) aSO = SMESH::GetActiveStudyDocument()->FindObjectID(IObject->getEntry());
+    if (aSO) {
+      //CORBA::Object_var anObject = aSO->GetObject();
+      CORBA::Object_var anObject = SMESH::SObjectToObject(aSO);
+      if (!CORBA::is_nil(anObject)) {
+       SMESH::SMESH_Mesh_var aMesh = SMESH::SMESH_Mesh::_narrow(anObject);
+       if (!aMesh->_is_nil()) {
+         myWGStack->raiseWidget(myMeshWidget);
+         setCaption(tr("SMESH_MESHINFO_TITLE") + " [" + tr("SMESH_OBJECT_MESH") + "]");
+         myMeshName->setText(aSO->GetName().c_str());
+         myMeshNbNodes->setNum((int)aMesh->NbNodes());
+         myMeshNbEdges->setNum((int)aMesh->NbEdges());
+         myMeshNbFaces->setNum((int)aMesh->NbFaces());
+         myMeshNbTriangles->setNum((int)aMesh->NbTriangles());
+         myMeshNbQuadrangles->setNum((int)aMesh->NbQuadrangles());
+         myMeshNbPolygones->setNum( (int)aMesh->NbPolygons() );
+         myMeshNbVolumes->setNum((int)aMesh->NbVolumes());
+         myMeshNbTetra->setNum((int)aMesh->NbTetras());
+         myMeshNbHexa->setNum((int)aMesh->NbHexas());
+         myMeshNbPrism->setNum((int)aMesh->NbPrisms());
+         myMeshNbPyra->setNum((int)aMesh->NbPyramids());
+         myMeshNbPolyhedrones->setNum( (int)aMesh->NbPolyhedrons() );
          return;
        }
-       SMESH::SMESH_subMesh_var aSubMesh = SMESH::SMESH_subMesh::_narrow( anObject );
-       if ( !aSubMesh->_is_nil() ) {
-         myWGStack->raiseWidget( mySubMeshWidget );
-         setCaption( tr( "SMESH_MESHINFO_TITLE" ) + " [" + tr("SMESH_SUBMESH") +"]" );
-         mySubMeshName->setText( aSO->GetName() );
-         mySubMeshNbNodes->setNum( (int)aSubMesh->GetNumberOfNodes( true ) );
-         mySubMeshNbElements->setNum( (int)aSubMesh->GetNumberOfElements() );
-         mySubMeshNbEdges->setNum( (int)( aSubMesh->GetElementsByType( SMESH::EDGE )->length() ) );
-         mySubMeshNbFaces->setNum( (int)( aSubMesh->GetElementsByType( SMESH::FACE )->length() ) );
-         mySubMeshNbVolumes->setNum( (int)( aSubMesh->GetElementsByType( SMESH::VOLUME )->length() ) );
+       SMESH::SMESH_subMesh_var aSubMesh = SMESH::SMESH_subMesh::_narrow(anObject);
+       if (!aSubMesh->_is_nil()) {
+         myWGStack->raiseWidget(mySubMeshWidget);
+         setCaption(tr("SMESH_MESHINFO_TITLE") + " [" + tr("SMESH_SUBMESH") + "]");
+         mySubMeshName->setText(aSO->GetName().c_str());
+         mySubMeshNbNodes->setNum((int)aSubMesh->GetNumberOfNodes(true));
+         mySubMeshNbElements->setNum((int)aSubMesh->GetNumberOfElements());
+         mySubMeshNbEdges->setNum((int)(aSubMesh->GetElementsByType(SMESH::EDGE)->length()));
+         mySubMeshNbFaces->setNum((int)(aSubMesh->GetElementsByType(SMESH::FACE)->length()));
+         mySubMeshNbVolumes->setNum((int)(aSubMesh->GetElementsByType(SMESH::VOLUME)->length()));
          return;
        }
-       SMESH::SMESH_GroupBase_var aGroup = SMESH::SMESH_GroupBase::_narrow( anObject );
-       if ( !aGroup->_is_nil() ) {
-         myWGStack->raiseWidget( myGroupWidget );
-         setCaption( tr( "SMESH_MESHINFO_TITLE" ) + " [" + tr("SMESH_GROUP") +"]" );
-         myGroupName->setText( aSO->GetName() );
+       SMESH::SMESH_GroupBase_var aGroup = SMESH::SMESH_GroupBase::_narrow(anObject);
+       if (!aGroup->_is_nil()) {
+         myWGStack->raiseWidget(myGroupWidget);
+         setCaption(tr("SMESH_MESHINFO_TITLE") + " [" + tr("SMESH_GROUP") + "]");
+         myGroupName->setText(aSO->GetName().c_str());
          int aType = aGroup->GetType();
          QString strType;
-         switch ( aType ) {
+         switch (aType) {
          case SMESH::NODE:
            strType = "SMESH_MESHINFO_NODES"; break;
          case SMESH::EDGE:
@@ -429,16 +453,16 @@ void SMESHGUI_MeshInfosDlg::DumpMeshInfos()
          default:
            strType = "SMESH_MESHINFO_ALL_TYPES"; break;
          }
-         
-         myGroupType->setText( tr( strType ) );
-         myGroupNb->setNum( (int)aGroup->Size() );
+
+         myGroupType->setText(tr(strType));
+         myGroupNb->setNum((int)aGroup->Size());
          return;
        }
       }
     }
   }
-  myWGStack->raiseWidget( 0 );
-  setCaption( tr( "SMESH_MESHINFO_TITLE" ) );
+  myWGStack->raiseWidget(0);
+  setCaption(tr("SMESH_MESHINFO_TITLE"));
 }
 
 //=================================================================================
@@ -447,45 +471,41 @@ void SMESHGUI_MeshInfosDlg::DumpMeshInfos()
 //=================================================================================
 void SMESHGUI_MeshInfosDlg::onSelectionChanged()
 {
-  if ( myStartSelection )
+  if (myStartSelection)
     DumpMeshInfos();
 }
 
-
 //=================================================================================
 // function : closeEvent()
 // purpose  :
 //=================================================================================
-void SMESHGUI_MeshInfosDlg::closeEvent( QCloseEvent* e )
+void SMESHGUI_MeshInfosDlg::closeEvent (QCloseEvent* e)
 {
-  SMESHGUI::GetSMESHGUI()->ResetState();
-  QDialog::closeEvent( e );
+  mySMESHGUI->ResetState();
+  QDialog::closeEvent(e);
 }
 
-
 //=================================================================================
 // function : windowActivationChange()
 // purpose  : called when window is activated/deactivated
 //=================================================================================
-void SMESHGUI_MeshInfosDlg::windowActivationChange( bool oldActive )
+void SMESHGUI_MeshInfosDlg::windowActivationChange (bool oldActive)
 {
-  QDialog::windowActivationChange( oldActive );
-  if ( isActiveWindow() && myIsActiveWindow != isActiveWindow() )
-    ActivateThisDialog() ;
+  QDialog::windowActivationChange(oldActive);
+  if (isActiveWindow() && myIsActiveWindow != isActiveWindow())
+    ActivateThisDialog();
   myIsActiveWindow = isActiveWindow();
 }
 
-
 //=================================================================================
 // function : DeactivateActiveDialog()
 // purpose  :
 //=================================================================================
 void SMESHGUI_MeshInfosDlg::DeactivateActiveDialog()
 {
-  disconnect( mySelection, 0, this, 0 );
+  disconnect(mySelectionMgr, 0, this, 0);
 }
 
-
 //=================================================================================
 // function : ActivateThisDialog()
 // purpose  :
@@ -493,8 +513,8 @@ void SMESHGUI_MeshInfosDlg::DeactivateActiveDialog()
 void SMESHGUI_MeshInfosDlg::ActivateThisDialog()
 {
   /* Emit a signal to deactivate any active dialog */
-  SMESHGUI::GetSMESHGUI()->EmitSignalDeactivateDialog() ;
-  connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( onSelectionChanged() ) );
+  mySMESHGUI->EmitSignalDeactivateDialog();
+  connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(onSelectionChanged()));
 }
 
 //=================================================================================
@@ -506,5 +526,5 @@ void SMESHGUI_MeshInfosDlg::onStartSelection()
   myStartSelection = true;
   onSelectionChanged();
   myStartSelection = true;
-  mySelectLab->setText( tr( "INF_SELECT_OBJECT" ) );
+  mySelectLab->setText(tr("INF_SELECT_OBJECT"));
 }
index c8123d8c0ff8c6c4b7a2937a5d8b024181215e44..49db8c13a5224a250d1869e63307a3367a47b7b4 100644 (file)
 class QGroupBox;
 class QLabel;
 class QPushButton;
-class SALOME_Selection;
 class QWidgetStack;
 
+class SalomeApp_SelectionMgr;
+class SMESHGUI;
+
 class SMESHGUI_MeshInfosDlg : public QDialog
 { 
     Q_OBJECT
 
 public:
-    SMESHGUI_MeshInfosDlg( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 );
+    SMESHGUI_MeshInfosDlg( SMESHGUI* theModule, 
+                          const char* name = 0, 
+                          bool modal = FALSE, 
+                          WFlags fl = 0 );
     ~SMESHGUI_MeshInfosDlg();
 
 protected:
@@ -58,10 +63,11 @@ private slots:
     void onStartSelection();
 
 private:
-    SALOME_Selection*     mySelection; 
-    bool                  myStartSelection;
-    bool                  myIsActiveWindow;
-    
+    SMESHGUI*               mySMESHGUI;
+    SalomeApp_SelectionMgr* mySelectionMgr; 
+    bool                    myStartSelection;
+    bool                    myIsActiveWindow;
+
     QPushButton*  mySelectBtn;
     QLabel*       mySelectLab;
 
@@ -75,13 +81,15 @@ private:
     QLabel*       myMeshNbFaces;
     QLabel*       myMeshNbTriangles;
     QLabel*       myMeshNbQuadrangles;
+    QLabel*       myMeshNbPolygones;
     QGroupBox*    myMeshVolumesGroup;
     QLabel*       myMeshNbVolumes;
     QLabel*       myMeshNbTetra;
     QLabel*       myMeshNbHexa;
     QLabel*       myMeshNbPyra;
     QLabel*       myMeshNbPrism;
-    
+    QLabel*       myMeshNbPolyhedrones;
+
     QWidget*      mySubMeshWidget;
     QLabel*       mySubMeshName;
     QLabel*       mySubMeshNbNodes;
index efc4eec75b498820220a6801e343c5db478b77da..2093f8ae1c5db39e0d5eb11670a7cdc4e7cdea67 100755 (executable)
@@ -1,23 +1,23 @@
 //  SMESH SMESHGUI : GUI for SMESH component
 //
 //  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
-// 
-//  This library is free software; you can redistribute it and/or 
-//  modify it under the terms of the GNU Lesser General Public 
-//  License as published by the Free Software Foundation; either 
-//  version 2.1 of the License. 
-// 
-//  This library is distributed in the hope that it will be useful, 
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of 
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
-//  Lesser General Public License for more details. 
-// 
-//  You should have received a copy of the GNU Lesser General Public 
-//  License along with this library; if not, write to the Free Software 
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
-// 
-//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
 //
 //
 //
 
 #include "SMESHGUI_MeshPatternDlg.h"
 
-#include "QAD_Desktop.h"
-#include "QAD_FileDlg.h"
-
-#include "SMESHGUI_SpinBox.h"
 #include "SMESHGUI.h"
-#include "SALOME_Selection.h"
-#include "SMESH_NumberFilter.hxx"
-#include "SMESHGUI_Utils.h"
-#include "SMESHGUI_VTKUtils.h"
+#include "SMESHGUI_SpinBox.h"
 #include "SMESHGUI_CreatePatternDlg.h"
 #include "SMESHGUI_PatternWidget.h"
-#include "SMESH_Actor.h"
-#include "SALOMEGUI_QtCatchCorbaException.hxx"
-#include "VTKViewer_ViewFrame.h"
+#include "SMESHGUI_Utils.h"
+#include "SMESHGUI_VTKUtils.h"
 #include "SMESHGUI_PatternUtils.h"
+#include "SMESHGUI_GEOMGenUtils.h"
+
+#include "SMESH_Actor.h"
 #include "SMESH_ActorUtils.h"
-#include "SMDS_MeshElement.hxx"
+#include "SMESH_NumberFilter.hxx"
+
 #include "SMDS_Mesh.hxx"
+#include "SMDS_MeshElement.hxx"
 
-#include "QAD_Config.h"
+#include "SUIT_ResourceMgr.h"
+#include "SUIT_Desktop.h"
+#include "SUIT_FileDlg.h"
 
+#include "SalomeApp_SelectionMgr.h"
+#include "SalomeApp_Tools.h"
+#include "SalomeApp_Study.h"
+
+#include "SALOMEDS_SObject.hxx"
+
+#include "SALOME_ListIO.hxx"
+#include "SVTK_Selection.h"
+
+#include "SVTK_ViewModel.h"
+#include "SVTK_Selector.h"
+#include "SVTK_ViewWindow.h"
+
+// OCCT Includes
 #include <TColStd_MapOfInteger.hxx>
+#include <TColStd_IndexedMapOfInteger.hxx>
 
+// QT Includes
 #include <qframe.h>
 #include <qlayout.h>
 #include <qlineedit.h>
 #include <qcstring.h>
 #include <qspinbox.h>
 #include <qvaluelist.h>
+#include <qdir.h>
+#include <qfile.h>
+#include <qfileinfo.h>
+#include <qfiledialog.h>
 
+// VTK Includes
 #include <vtkCell.h>
 #include <vtkIdList.h>
 #include <vtkIntArray.h>
 #define SPACING 5
 #define MARGIN  10
 
-/*
-  Class       : SMESHGUI_MeshPatternDlg
-  Description : Dialog to specify filters for VTK viewer
-*/
+/*!
 Class       : SMESHGUI_MeshPatternDlg
 Description : Dialog to specify filters for VTK viewer
+ */
 
 //=======================================================================
 // name    : SMESHGUI_MeshPatternDlg::SMESHGUI_MeshPatternDlg
 // Purpose : Constructor
 //=======================================================================
-SMESHGUI_MeshPatternDlg::SMESHGUI_MeshPatternDlg( QWidget*          theParent,
-                                            SALOME_Selection* theSelection,
-                                            const char*       theName )
-: QDialog( theParent, theName, false,
-         WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ),
-  myBusy( false )
+SMESHGUI_MeshPatternDlg::SMESHGUI_MeshPatternDlg( SMESHGUI*   theModule,
+                                                  const char* theName )
+     : QDialog( SMESH::GetDesktop( theModule ), theName, false, WStyle_Customize |
+                WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu),
+       myBusy(false),
+       mySMESHGUI( theModule ),
+       mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ),
+       myViewWindow( SMESH::GetViewWindow( theModule ) ),
+       mySelector( myViewWindow->GetSelector() )
 {
-  setCaption( tr( "CAPTION" ) );
-
-  QVBoxLayout* aDlgLay = new QVBoxLayout( this, MARGIN, SPACING );
+  setCaption(tr("CAPTION"));
 
-  QFrame* aMainFrame = createMainFrame  ( this );
-  QFrame* aBtnFrame  = createButtonFrame( this );
+  QVBoxLayout* aDlgLay = new QVBoxLayout(this, MARGIN, SPACING);
 
+  QFrame* aMainFrame = createMainFrame  (this);
+  QFrame* aBtnFrame  = createButtonFrame(this);
 
+  aDlgLay->addWidget(aMainFrame);
+  aDlgLay->addWidget(aBtnFrame);
 
-
-  aDlgLay->addWidget( aMainFrame );
-  aDlgLay->addWidget( aBtnFrame );
-
-  aDlgLay->setStretchFactor( aMainFrame, 1 );
+  aDlgLay->setStretchFactor(aMainFrame, 1);
 
   myCreationDlg = 0;
-  Init( theSelection );
+  Init();
 }
 
 //=======================================================================
 // name    : SMESHGUI_MeshPatternDlg::createMainFrame
 // Purpose : Create frame containing dialog's input fields
 //=======================================================================
-QFrame* SMESHGUI_MeshPatternDlg::createMainFrame( QWidget* theParent )
+QFrame* SMESHGUI_MeshPatternDlg::createMainFrame (QWidget* theParent)
 {
-  QPixmap iconSlct( QAD_Desktop::getResourceManager()->loadPixmap( "SMESH", tr( "ICON_SELECT" ) ) );
-  QPixmap icon2d  ( QAD_Desktop::getResourceManager()->loadPixmap( "SMESH", tr( "ICON_PATTERN_2d" ) ) );
-  QPixmap icon3d  ( QAD_Desktop::getResourceManager()->loadPixmap( "SMESH", tr( "ICON_PATTERN_3d" ) ) );
-  QPixmap iconOpen( QAD_Desktop::getResourceManager()->loadPixmap( "SMESH", tr( "ICON_FILE_OPEN" ) ) );
+  QPixmap iconSlct (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_SELECT")));
+  QPixmap icon2d   (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_PATTERN_2d")));
+  QPixmap icon3d   (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_PATTERN_3d")));
+  QPixmap iconOpen (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_FILE_OPEN")));
 
-  QPixmap iconSample2d( QAD_Desktop::getResourceManager()->loadPixmap( "SMESH", tr( "ICON_PATTERN_SAMPLE_2D" ) ) );
-  QPixmap iconSample3d( QAD_Desktop::getResourceManager()->loadPixmap( "SMESH", tr( "ICON_PATTERN_SAMPLE_3D" ) ) );
+  QPixmap iconSample2d (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_PATTERN_SAMPLE_2D")));
+  QPixmap iconSample3d (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_PATTERN_SAMPLE_3D")));
 
-  QGroupBox* aMainGrp = new QGroupBox( 1, Qt::Horizontal, theParent );
-  aMainGrp->setFrameStyle( QFrame::NoFrame );
-  aMainGrp->setInsideMargin( 0 );
+  QGroupBox* aMainGrp = new QGroupBox (1, Qt::Horizontal, theParent);
+  aMainGrp->setFrameStyle(QFrame::NoFrame);
+  aMainGrp->setInsideMargin(0);
 
   // Pattern type group
-  
-  myTypeGrp = new QButtonGroup( 1, Qt::Vertical, tr( "PATTERN_TYPE" ), aMainGrp );
-  mySwitch2d = new QRadioButton( myTypeGrp );
-  mySwitch3d = new QRadioButton( myTypeGrp );
-  mySwitch2d->setPixmap( icon2d );
-  mySwitch3d->setPixmap( icon3d );
-  myTypeGrp->insert( mySwitch2d, Type_2d );
-  myTypeGrp->insert( mySwitch3d, Type_3d );
 
+  myTypeGrp = new QButtonGroup (1, Qt::Vertical, tr("PATTERN_TYPE"), aMainGrp);
+  mySwitch2d = new QRadioButton (myTypeGrp);
+  mySwitch3d = new QRadioButton (myTypeGrp);
+  mySwitch2d->setPixmap(icon2d);
+  mySwitch3d->setPixmap(icon3d);
+  myTypeGrp->insert(mySwitch2d, Type_2d);
+  myTypeGrp->insert(mySwitch3d, Type_3d);
 
   // Mesh group
-  
-  QGroupBox* aMeshGrp = new QGroupBox( 1, Qt::Vertical, tr( "SMESH_MESH" ), aMainGrp );
-  new QLabel( tr( "SMESH_MESH" ), aMeshGrp );
-  mySelBtn[ Mesh ] = new QPushButton( aMeshGrp );
-  mySelBtn[ Mesh ]->setPixmap( iconSlct );
-  mySelEdit[ Mesh ] = new QLineEdit( aMeshGrp );
-  mySelEdit[ Mesh ]->setReadOnly( true );
+
+  QGroupBox* aMeshGrp = new QGroupBox(1, Qt::Vertical, tr("SMESH_MESH"), aMainGrp);
+  new QLabel(tr("SMESH_MESH"), aMeshGrp);
+  mySelBtn[ Mesh ] = new QPushButton(aMeshGrp);
+  mySelBtn[ Mesh ]->setPixmap(iconSlct);
+  mySelEdit[ Mesh ] = new QLineEdit(aMeshGrp);
+  mySelEdit[ Mesh ]->setReadOnly(true);
 
   // Pattern group
-  
-  QGroupBox* aPatGrp = new QGroupBox( 1, Qt::Horizontal, tr( "PATTERN" ), aMainGrp );
+
+  QGroupBox* aPatGrp = new QGroupBox(1, Qt::Horizontal, tr("PATTERN"), aMainGrp);
 
   // pattern name
-  QGroupBox* aNameGrp = new QGroupBox( 1, Qt::Vertical, aPatGrp );
-  aNameGrp->setFrameStyle( QFrame::NoFrame );
-  aNameGrp->setInsideMargin( 0 );
-  new QLabel( tr( "PATTERN" ), aNameGrp );
-  myName = new QLineEdit( aNameGrp );
-  myName->setReadOnly( true );
-  myOpenBtn = new QPushButton( aNameGrp );
-  myOpenBtn->setPixmap( iconOpen );
-  myNewBtn = new QPushButton( tr( "NEW" ), aNameGrp );
+  QGroupBox* aNameGrp = new QGroupBox(1, Qt::Vertical, aPatGrp);
+  aNameGrp->setFrameStyle(QFrame::NoFrame);
+  aNameGrp->setInsideMargin(0);
+  new QLabel(tr("PATTERN"), aNameGrp);
+  myName = new QLineEdit(aNameGrp);
+  myName->setReadOnly(true);
+  myOpenBtn = new QPushButton(aNameGrp);
+  myOpenBtn->setPixmap(iconOpen);
+  myNewBtn = new QPushButton(tr("NEW"), aNameGrp);
 
   // Mode selection check box
-  myRefine = new QCheckBox( tr( "REFINE" ), aPatGrp );
+  myRefine = new QCheckBox(tr("REFINE"), aPatGrp);
 
   // selection widgets for Apply to geom mode
-  myGeomGrp = new QGroupBox( 3, Qt::Horizontal, aPatGrp );
-  myGeomGrp->setFrameStyle( QFrame::NoFrame );
-  myGeomGrp->setInsideMargin( 0 );
+  myGeomGrp = new QGroupBox(3, Qt::Horizontal, aPatGrp);
+  myGeomGrp->setFrameStyle(QFrame::NoFrame);
+  myGeomGrp->setInsideMargin(0);
 
-  for ( int i = Object; i <= Vertex2; i++ )
+  for (int i = Object; i <= Vertex2; i++)
   {
-    mySelLbl[ i ] = new QLabel( myGeomGrp );
-    mySelBtn[ i ] = new QPushButton( myGeomGrp );
-    mySelBtn[ i ]->setPixmap( iconSlct );
-    mySelEdit[ i ] = new QLineEdit( myGeomGrp );
-    mySelEdit[ i ]->setReadOnly( true );
+    mySelLbl[ i ] = new QLabel(myGeomGrp);
+    mySelBtn[ i ] = new QPushButton(myGeomGrp);
+    mySelBtn[ i ]->setPixmap(iconSlct);
+    mySelEdit[ i ] = new QLineEdit(myGeomGrp);
+    mySelEdit[ i ]->setReadOnly(true);
   }
 
   // Widgets for refinement of existing mesh elements
-  myRefineGrp = new QFrame( aPatGrp );
-  myRefineGrp->setFrameStyle( QFrame::NoFrame );
-  QGridLayout* aRefGrid = new QGridLayout( myRefineGrp, 3, 3, 0, 5 );
-
-  mySelLbl[ Ids ] = new QLabel( myRefineGrp );
-  mySelBtn[ Ids ] = new QPushButton( myRefineGrp );
-  mySelBtn[ Ids ]->setPixmap( iconSlct );
-  mySelEdit[ Ids ] = new QLineEdit( myRefineGrp );
-
-  QLabel* aNodeLbl = new QLabel( tr( "NODE_1" ), myRefineGrp );
-  myNode1          = new QSpinBox( myRefineGrp );
-  myNode2Lbl       = new QLabel( tr( "NODE_2" ), myRefineGrp );
-  myNode2          = new QSpinBox( myRefineGrp );
-
-  aRefGrid->addWidget( mySelLbl [ Ids ], 0, 0 );
-  aRefGrid->addWidget( mySelBtn [ Ids ], 0, 1 );
-  aRefGrid->addWidget( mySelEdit[ Ids ], 0, 2 );
-  aRefGrid->addWidget( aNodeLbl, 1, 0 );
-  aRefGrid->addMultiCellWidget( myNode1, 1, 1, 1, 2 );
-  aRefGrid->addWidget( myNode2Lbl, 2, 0 );
-  aRefGrid->addMultiCellWidget( myNode2, 2, 2, 1, 2 );
+  myRefineGrp = new QFrame(aPatGrp);
+  myRefineGrp->setFrameStyle(QFrame::NoFrame);
+  QGridLayout* aRefGrid = new QGridLayout(myRefineGrp, 3, 3, 0, 5);
+
+  mySelLbl[ Ids ] = new QLabel(myRefineGrp);
+  mySelBtn[ Ids ] = new QPushButton(myRefineGrp);
+  mySelBtn[ Ids ]->setPixmap(iconSlct);
+  mySelEdit[ Ids ] = new QLineEdit(myRefineGrp);
+
+  QLabel* aNodeLbl = new QLabel(tr("NODE_1"), myRefineGrp);
+  myNode1          = new QSpinBox(myRefineGrp);
+  myNode2Lbl       = new QLabel(tr("NODE_2"), myRefineGrp);
+  myNode2          = new QSpinBox(myRefineGrp);
+
+  aRefGrid->addWidget(mySelLbl [ Ids ], 0, 0);
+  aRefGrid->addWidget(mySelBtn [ Ids ], 0, 1);
+  aRefGrid->addWidget(mySelEdit[ Ids ], 0, 2);
+  aRefGrid->addWidget(aNodeLbl, 1, 0);
+  aRefGrid->addMultiCellWidget(myNode1, 1, 1, 1, 2);
+  aRefGrid->addWidget(myNode2Lbl, 2, 0);
+  aRefGrid->addMultiCellWidget(myNode2, 2, 2, 1, 2);
 
   // reverse check box
-  myReverseChk = new QCheckBox( tr( "REVERSE" ), aPatGrp );
+  myReverseChk = new QCheckBox(tr("REVERSE"), aPatGrp);
+
+  // CreatePoly check box
+  myCreatePolygonsChk = new QCheckBox( tr( "CREATE_POLYGONS_NEAR_BOUNDARY" ), aPatGrp );
+  myCreatePolyedrsChk = new QCheckBox( tr( "CREATE_POLYEDRS_NEAR_BOUNDARY" ), aPatGrp );
 
   // Pictures 2d and 3d
-  for ( int i = 0; i < 2; i++ )
-  {
-    if ( i == 0 )
-    {
-      myPicture2d = new SMESHGUI_PatternWidget( aPatGrp ),
-      myPicture2d->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ) );
-    }
-    else
-    {
-      myPicture3d = new QFrame( aPatGrp ),
-      myPreview3d = new QLabel( myPicture3d );
-      myPreview3d->setPixmap( iconSample3d );
-      QGridLayout* aLay = new QGridLayout( myPicture3d, 3, 3, 0, 0 );
-      QSpacerItem* aSpacerH1 = new QSpacerItem( 0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum );
-      QSpacerItem* aSpacerH2 = new QSpacerItem( 0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum );
-      QSpacerItem* aSpacerV1 = new QSpacerItem( 0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding );
-      QSpacerItem* aSpacerV2 = new QSpacerItem( 0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding );
-      aLay->addItem( aSpacerH1, 1, 0 );
-      aLay->addItem( aSpacerH2, 1, 2 );
-      aLay->addItem( aSpacerV1, 0, 1 );
-      aLay->addItem( aSpacerV2, 2, 1 );
-      aLay->addWidget( myPreview3d, 1, 1 );
+  for (int i = 0; i < 2; i++) {
+    if (i == 0) {
+      myPicture2d = new SMESHGUI_PatternWidget(aPatGrp),
+      myPicture2d->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding));
+    } else {
+      myPicture3d = new QFrame(aPatGrp),
+      myPreview3d = new QLabel(myPicture3d);
+      myPreview3d->setPixmap(iconSample3d);
+      QGridLayout* aLay = new QGridLayout(myPicture3d, 3, 3, 0, 0);
+      QSpacerItem* aSpacerH1 = new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum);
+      QSpacerItem* aSpacerH2 = new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum);
+      QSpacerItem* aSpacerV1 = new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding);
+      QSpacerItem* aSpacerV2 = new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding);
+      aLay->addItem(aSpacerH1, 1, 0);
+      aLay->addItem(aSpacerH2, 1, 2);
+      aLay->addItem(aSpacerV1, 0, 1);
+      aLay->addItem(aSpacerV2, 2, 1);
+      aLay->addWidget(myPreview3d, 1, 1);
     }
   }
 
-  myPreviewChk = new QCheckBox( tr( "PREVIEW" ), aPatGrp );
+  myPreviewChk = new QCheckBox(tr("PREVIEW"), aPatGrp);
 
   // Connect signals and slots
 
-  connect( myTypeGrp,      SIGNAL( clicked( int )  ),               SLOT( onTypeChanged( int ) ) );
-  connect( myOpenBtn,      SIGNAL( clicked()       ),               SLOT( onOpen()             ) );
-  connect( myNewBtn,       SIGNAL( clicked()       ),               SLOT( onNew()              ) );
-  connect( myReverseChk,   SIGNAL( toggled( bool ) ),               SLOT( onReverse( bool )    ) );
-  connect( myPreviewChk,   SIGNAL( toggled( bool ) ),               SLOT( onPreview( bool )    ) );
-  connect( myRefine,       SIGNAL( toggled( bool ) ),               SLOT( onModeToggled( bool ) ) );
-  connect( myNode1,        SIGNAL( valueChanged( int ) ),           SLOT( onNodeChanged( int ) ) );
-  connect( myNode2,        SIGNAL( valueChanged( int ) ),           SLOT( onNodeChanged( int ) ) );
-  connect( mySelEdit[Ids], SIGNAL( textChanged( const QString& ) ), SLOT( onTextChanged( const QString& ) ) );
+  connect(myTypeGrp, SIGNAL(clicked(int)), SLOT(onTypeChanged(int)));
+  connect(myOpenBtn, SIGNAL(clicked()),    SLOT(onOpen()));
+  connect(myNewBtn,  SIGNAL(clicked()),    SLOT(onNew()));
+
+  connect(myReverseChk, SIGNAL(toggled(bool)), SLOT(onReverse(bool)));
+  connect(myPreviewChk, SIGNAL(toggled(bool)), SLOT(onPreview(bool)));
+  connect(myRefine,     SIGNAL(toggled(bool)), SLOT(onModeToggled(bool)));
+
+  connect(myNode1, SIGNAL(valueChanged(int)), SLOT(onNodeChanged(int)));
+  connect(myNode2, SIGNAL(valueChanged(int)), SLOT(onNodeChanged(int)));
+
+  connect(mySelEdit[Ids], SIGNAL(textChanged(const QString&)), SLOT(onTextChanged(const QString&)));
 
   QMap< int, QPushButton* >::iterator anIter;
-  for ( anIter = mySelBtn.begin(); anIter != mySelBtn.end(); ++anIter )
-    connect( *anIter, SIGNAL( clicked() ), SLOT( onSelInputChanged() ) );
+  for (anIter = mySelBtn.begin(); anIter != mySelBtn.end(); ++anIter)
+    connect(*anIter, SIGNAL(clicked()), SLOT(onSelInputChanged()));
 
   return aMainGrp;
 }
 
 //=======================================================================
-
 // name    : SMESHGUI_MeshPatternDlg::createButtonFrame
 // Purpose : Create frame containing buttons
 //=======================================================================
-QFrame* SMESHGUI_MeshPatternDlg::createButtonFrame( QWidget* theParent )
+QFrame* SMESHGUI_MeshPatternDlg::createButtonFrame (QWidget* theParent)
 {
-  QFrame* aFrame = new QFrame( theParent );
-  aFrame->setFrameStyle( QFrame::Box | QFrame::Sunken );
+  QFrame* aFrame = new QFrame(theParent);
+  aFrame->setFrameStyle(QFrame::Box | QFrame::Sunken);
 
-  myOkBtn     = new QPushButton( tr( "SMESH_BUT_OK"    ), aFrame );
-  myApplyBtn  = new QPushButton( tr( "SMESH_BUT_APPLY" ), aFrame );
-  myCloseBtn  = new QPushButton( tr( "SMESH_BUT_CLOSE" ), aFrame );
+  myOkBtn     = new QPushButton(tr("SMESH_BUT_OK"   ), aFrame);
+  myApplyBtn  = new QPushButton(tr("SMESH_BUT_APPLY"), aFrame);
+  myCloseBtn  = new QPushButton(tr("SMESH_BUT_CLOSE"), aFrame);
 
-  QSpacerItem* aSpacer = new QSpacerItem( 0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum );
+  QSpacerItem* aSpacer = new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum);
 
-  QHBoxLayout* aLay = new QHBoxLayout( aFrame, MARGIN, SPACING );
+  QHBoxLayout* aLay = new QHBoxLayout(aFrame, MARGIN, SPACING);
 
-  aLay->addWidget( myOkBtn );
-  aLay->addWidget( myApplyBtn );
-  aLay->addItem( aSpacer);
-  aLay->addWidget( myCloseBtn );
+  aLay->addWidget(myOkBtn);
+  aLay->addWidget(myApplyBtn);
+  aLay->addItem(aSpacer);
+  aLay->addWidget(myCloseBtn);
 
-  connect( myOkBtn,    SIGNAL( clicked() ), SLOT( onOk() ) );
-  connect( myCloseBtn, SIGNAL( clicked() ), SLOT( onClose() ) ) ;
-  connect( myApplyBtn, SIGNAL( clicked() ), SLOT( onApply() ) );
+  connect(myOkBtn,    SIGNAL(clicked()), SLOT(onOk()));
+  connect(myCloseBtn, SIGNAL(clicked()), SLOT(onClose()));
+  connect(myApplyBtn, SIGNAL(clicked()), SLOT(onApply()));
 
   return aFrame;
 }
@@ -295,7 +316,7 @@ SMESHGUI_MeshPatternDlg::~SMESHGUI_MeshPatternDlg()
 // name    : SMESHGUI_MeshPatternDlg::Init
 // Purpose : Init dialog fields, connect signals and slots, show dialog
 //=======================================================================
-void SMESHGUI_MeshPatternDlg::Init( SALOME_Selection* theSelection )
+void SMESHGUI_MeshPatternDlg::Init()
 {
   myPattern = SMESH::GetPattern();
   myPreviewActor = 0;
@@ -303,9 +324,7 @@ void SMESHGUI_MeshPatternDlg::Init( SALOME_Selection* theSelection )
   mySelInput = Mesh;
   myType = -1;
   myNbPoints = -1;
-  mySelection = theSelection;
-  SMESHGUI* aSMESHGUI = SMESHGUI::GetSMESHGUI();
-  aSMESHGUI->SetActiveDialogBox( ( QDialog* )this );
+  mySMESHGUI->SetActiveDialogBox((QDialog*)this);
   myMesh = SMESH::SMESH_Mesh::_nil();
 
   myMeshShape = GEOM::GEOM_Object::_nil();
@@ -314,24 +333,24 @@ void SMESHGUI_MeshPatternDlg::Init( SALOME_Selection* theSelection )
   myGeomObj[ Vertex2 ] = GEOM::GEOM_Object::_nil();
 
   // selection and SMESHGUI
-  connect( mySelection, SIGNAL( currentSelectionChanged() ), SLOT( onSelectionDone() ) );
-  connect( aSMESHGUI, SIGNAL( SignalDeactivateActiveDialog() ), SLOT( onDeactivate() ) );
-  connect( aSMESHGUI, SIGNAL( SignalCloseAllDialogs() ), SLOT( onClose() ) );
+  connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), SLOT(onSelectionDone()));
+  connect(mySMESHGUI, SIGNAL(SignalDeactivateActiveDialog()), SLOT(onDeactivate()));
+  connect(mySMESHGUI, SIGNAL(SignalCloseAllDialogs()), SLOT(onClose()));
 
-  myTypeGrp->setButton( Type_2d );
-  onTypeChanged( Type_2d );
-  onModeToggled( isRefine() );
+  myTypeGrp->setButton(Type_2d);
+  onTypeChanged(Type_2d);
+  onModeToggled(isRefine());
 
   updateGeometry();
 
-  resize( minimumSize() );
+  resize(minimumSize());
 
   activateSelection();
   onSelectionDone();
 
-  int x, y ;
-  aSMESHGUI->DefineDlgPosition( this, x, y );
-  this->move( x, y );
+  int x, y;
+  mySMESHGUI->DefineDlgPosition(this, x, y);
+  this->move(x, y);
   this->show();
 }
 
@@ -339,20 +358,24 @@ void SMESHGUI_MeshPatternDlg::Init( SALOME_Selection* theSelection )
 // name    : SMESHGUI_MeshPatternDlg::isValid
 // Purpose : Verify validity of entry data
 //=======================================================================
-bool SMESHGUI_MeshPatternDlg::isValid( const bool theMess )
+bool SMESHGUI_MeshPatternDlg::isValid (const bool theMess)
 {
   QValueList<int> ids;
-  if ( ( isRefine() && ( myMesh->_is_nil() || !getIds( ids ) || getNode( false ) < 0 || myType == Type_3d && ( getNode( true ) < 0 || getNode( false ) == getNode( true ) ) ) ) 
-       || ( !isRefine() && ( myMesh->_is_nil() || myMeshShape->_is_nil() || myGeomObj[ Object ]->_is_nil() ||
-       myGeomObj[ Vertex1 ]->_is_nil() || myType == Type_3d && myGeomObj[ Vertex2 ]->_is_nil() ) ) )
+  if ((isRefine() &&
+       (myMesh->_is_nil() || !getIds(ids) || getNode(false) < 0 ||
+        myType == Type_3d && (getNode(true) < 0 || getNode(false) == getNode(true))))
+      ||
+      (!isRefine() &&
+       (myMesh->_is_nil() || myMeshShape->_is_nil() || myGeomObj[ Object ]->_is_nil() ||
+        myGeomObj[ Vertex1 ]->_is_nil() || myType == Type_3d && myGeomObj[ Vertex2 ]->_is_nil())))
   {
-    if ( theMess )
-      QMessageBox::information( SMESHGUI::GetSMESHGUI()->GetDesktop(),
-        tr( "SMESH_INSUFFICIENT_DATA" ), tr( "SMESHGUI_INVALID_PARAMETERS" ), QMessageBox::Ok );
+    if (theMess)
+      QMessageBox::information(SMESHGUI::desktop(), tr("SMESH_INSUFFICIENT_DATA"),
+                               tr("SMESHGUI_INVALID_PARAMETERS"), QMessageBox::Ok);
     return false;
   }
-  else
-    return true;
+
+  return true;
 }
 
 //=======================================================================
@@ -361,67 +384,62 @@ bool SMESHGUI_MeshPatternDlg::isValid( const bool theMess )
 //=======================================================================
 bool SMESHGUI_MeshPatternDlg::onApply()
 {
-  try
-  {
-    if ( !isValid() )
+  try {
+    if (!isValid())
       return false;
 
     erasePreview();
 
-    if ( isRefine() ) { // Refining existing mesh elements
+    if (isRefine()) { // Refining existing mesh elements
       QValueList<int> ids;
-      getIds( ids );
+      getIds(ids);
       SMESH::long_array_var varIds = new SMESH::long_array();
-      varIds->length( ids.count() );
+      varIds->length(ids.count());
       int i = 0;
-      for ( QValueList<int>::iterator it = ids.begin(); it != ids.end(); ++it )
+      for (QValueList<int>::iterator it = ids.begin(); it != ids.end(); ++it)
        varIds[i++] = *it;
       myType == Type_2d
-       ? myPattern->ApplyToMeshFaces  ( myMesh, varIds, getNode( false ), myReverseChk->isChecked() )
-       : myPattern->ApplyToHexahedrons( myMesh, varIds, getNode( false ), getNode( true ) );
-    }
-    else { // Applying a pattern to geometrical object
-    if ( myType == Type_2d )
-      myPattern->ApplyToFace(
-        myGeomObj[ Object ], myGeomObj[ Vertex1 ], myReverseChk->isChecked() );
-    else
-      myPattern->ApplyTo3DBlock(
-        myGeomObj[ Object ], myGeomObj[ Vertex1 ], myGeomObj[ Vertex2 ] );
+       ? myPattern->ApplyToMeshFaces  (myMesh, varIds, getNode(false), myReverseChk->isChecked())
+       : myPattern->ApplyToHexahedrons(myMesh, varIds, getNode(false), getNode(true));
+
+    } else { // Applying a pattern to geometrical object
+      if (myType == Type_2d)
+        myPattern->ApplyToFace(myGeomObj[Object], myGeomObj[Vertex1], myReverseChk->isChecked());
+      else
+        myPattern->ApplyTo3DBlock(myGeomObj[Object], myGeomObj[Vertex1], myGeomObj[Vertex2]);
     }
 
-    if ( myPattern->MakeMesh( myMesh ) )
-    {
-      mySelection->ClearIObjects();
-      SMESHGUI* aCompGUI = SMESHGUI::GetSMESHGUI();
-      if ( !isRefine() && !QAD_CONFIG->getSetting( "SMESH:AutomaticUpdate" ).compare( "true" ) ) {
-       SALOMEDS::SObject_var aSO = SMESH::FindSObject( myMesh.in() );
-       SMESH_Actor* anActor = SMESH::FindActorByEntry( aSO->GetID() );
-       if(!anActor){
-         anActor = SMESH::CreateActor( aSO->GetStudy(), aSO->GetID() );
-         if(anActor){
-           SMESH::DisplayActor( aCompGUI->GetActiveStudy()->getActiveStudyFrame(), anActor );
+    bool toCreatePolygons = myCreatePolygonsChk->isChecked();
+    bool toCreatePolyedrs = myCreatePolyedrsChk->isChecked();
+    if ( myPattern->MakeMesh( myMesh, toCreatePolygons, toCreatePolyedrs ) ) {
+      mySelectionMgr->clearSelected();
+      SUIT_ResourceMgr* mgr = SMESHGUI::resourceMgr();
+      bool autoUpdate = false;
+      if (mgr && mgr->stringValue("SMESH", "AutomaticUpdate").compare("true") == 0)
+        autoUpdate = true;
+      if (!isRefine() && autoUpdate) {
+       _PTR(SObject) aSO = SMESH::FindSObject(myMesh.in());
+       SMESH_Actor* anActor = SMESH::FindActorByEntry(aSO->GetID().c_str());
+       if (!anActor) {
+         anActor = SMESH::CreateActor(aSO->GetStudy(), aSO->GetID().c_str());
+         if (anActor) {
+           SMESH::DisplayActor(SMESH::GetActiveWindow(), anActor);
            SMESH::FitAll();
          }
        }
       }
       SMESH::UpdateView();
-
-      aCompGUI->GetActiveStudy()->updateObjBrowser( true );
+      
+      mySMESHGUI->updateObjBrowser(true);
       return true;
-    }
-    else
-    {
-      QMessageBox::information( SMESHGUI::GetSMESHGUI()->GetDesktop(),
-        tr( "SMESH_ERROR" ), tr( "SMESH_OPERATION_FAILED" ), QMessageBox::Ok );
+    } else {
+      QMessageBox::information(SMESHGUI::desktop(), tr("SMESH_ERROR"),
+                               tr("SMESH_OPERATION_FAILED"), QMessageBox::Ok);
       return false;
     }
-  }
-  catch( const SALOME::SALOME_Exception& S_ex )
-  {
-    QtCatchCorbaException( S_ex );    
-  }
-  catch( ... )
-  {
+  } catch (const SALOME::SALOME_Exception& S_ex) {
+    SalomeApp_Tools::QtCatchCorbaException(S_ex);
+  } catch (...) {
   }
 
   return false;
@@ -433,7 +451,7 @@ bool SMESHGUI_MeshPatternDlg::onApply()
 //=======================================================================
 void SMESHGUI_MeshPatternDlg::onOk()
 {
-  if ( onApply() )
+  if (onApply())
     onClose();
 }
 
@@ -443,77 +461,47 @@ void SMESHGUI_MeshPatternDlg::onOk()
 //=======================================================================
 void SMESHGUI_MeshPatternDlg::onClose()
 {
-  mySelection->ClearFilters();
+  mySelectionMgr->clearFilters();
   SMESH::SetPickable();
-  QAD_Application::getDesktop()->SetSelectionMode( ActorSelection );
-  disconnect( mySelection, 0, this, 0 );
-  disconnect( SMESHGUI::GetSMESHGUI(), 0, this, 0 );
-  SMESHGUI::GetSMESHGUI()->ResetState();
+  myViewWindow->SetSelectionMode(ActorSelection);
+  disconnect(mySelectionMgr, 0, this, 0);
+  disconnect(mySMESHGUI, 0, this, 0);
+  mySMESHGUI->ResetState();
   erasePreview();
   reject();
 }
 
-
-
 //=======================================================================
 // name    : SMESHGUI_MeshPatternDlg::onSelectionDone
 // Purpose : SLOT called when selection changed
 //=======================================================================
 void SMESHGUI_MeshPatternDlg::onSelectionDone()
 {
-  if ( myBusy )
+  if (myBusy)
     return;
-  
-  try
-  {
-    if ( mySelInput == Mesh )
-    {
-      if ( mySelection->IObjectCount() != 1 )
+
+  try {
+    if (mySelInput == Mesh) {
+      SALOME_ListIO aList;
+      mySelectionMgr->selectedObjects(aList,SVTK_Viewer::Type());
+      if (aList.Extent() != 1)
        return;
 
       // Retrieve mesh from selection
-      Handle(SALOME_InteractiveObject) anIO = mySelection->firstIObject();
-      SMESH::SMESH_Mesh_var aMesh = SMESH::IObjectToInterface<SMESH::SMESH_Mesh>( anIO );
-      if ( aMesh->_is_nil() )
+      Handle(SALOME_InteractiveObject) anIO = aList.First();
+      SMESH::SMESH_Mesh_var aMesh = SMESH::IObjectToInterface<SMESH::SMESH_Mesh>(anIO);
+      if (aMesh->_is_nil())
         return;
 
       // Get geom object corresponding to the mesh
-      SALOMEDS::Study_var aStudy =
-        SMESHGUI::GetSMESHGUI()->GetActiveStudy()->getStudyDocument();
-
-      SALOMEDS::SObject_var aSO = SMESH::FindSObject( aMesh.in() );
-      if ( aSO->_is_nil() )
-        return;
-
-      bool isFound = false;
-      SALOMEDS::ChildIterator_var anIter = aStudy->NewChildIterator( aSO );
-      for( ; anIter->More(); anIter->Next() )
-      {
-        SALOMEDS::SObject_var aSO = anIter->Value();
-        SALOMEDS::SObject_var aRefSO;
-
-        GEOM::GEOM_Object_var aMeshShape = GEOM::GEOM_Object::_narrow(
-          aSO->ReferencedObject( aRefSO )? aRefSO->GetObject() : aSO->GetObject() );
-
-        if ( !aMeshShape->_is_nil() )
-        {
-          isFound = true;
-          myMeshShape = aMeshShape;
-          break;
-
-        }
-      }
-
-      if ( !isFound )
-        myMeshShape = GEOM::GEOM_Object::_nil();
+      _PTR(SObject) aSO = SMESH::FindSObject(aMesh.in());
+      myMeshShape = SMESH::GetGeom(aSO);
 
       // Clear fields of geom objects if mesh was changed
-      if ( myMesh != aMesh )
-      {
-        for ( int i = Object; i <= Ids; i++ )
-        {
+      if (myMesh != aMesh) {
+        for (int i = Object; i <= Ids; i++) {
           myGeomObj[ i ] = GEOM::GEOM_Object::_nil();
-          mySelEdit[ i ]->setText( "" );
+          mySelEdit[ i ]->setText("");
         }
       }
 
@@ -521,36 +509,38 @@ void SMESHGUI_MeshPatternDlg::onSelectionDone()
 
       // Set name of mesh in line edit
       QString aName;
-      SMESH::GetNameOfSelectedIObjects( mySelection, aName );
-      mySelEdit[ Mesh ]->setText( aName );
-    }
-    else if ( mySelInput == Ids ) {
+      SMESH::GetNameOfSelectedIObjects(mySelectionMgr, aName);
+      mySelEdit[ Mesh ]->setText(aName);
+
+    } else if (mySelInput == Ids) {
+      SALOME_ListIO aList;
+      mySelectionMgr->selectedObjects(aList,SVTK_Viewer::Type());
+
       QString anIds;
-      if ( !SMESH::GetNameOfSelectedElements( mySelection, anIds ) )
+      if (!SMESH::GetNameOfSelectedElements(mySelector, aList.First(), anIds))
        anIds = "";
+
       myBusy = true;
-      mySelEdit[ Ids ]->setText( anIds );
+      mySelEdit[ Ids ]->setText(anIds);
       myBusy = false;
-    }
-    else
-    {
-      if ( mySelection->IObjectCount() != 1 )
+
+    } else {
+      SALOME_ListIO aList;
+      mySelectionMgr->selectedObjects(aList, SVTK_Viewer::Type());
+      if (aList.Extent() != 1)
        return;
 
       // Get geom object from selection
-      Handle(SALOME_InteractiveObject) anIO = mySelection->firstIObject();
-      GEOM::GEOM_Object_var anObj = SMESH::IObjectToInterface<GEOM::GEOM_Object>( anIO );
-      if ( anObj->_is_nil() )
+      Handle(SALOME_InteractiveObject) anIO = aList.First();
+      GEOM::GEOM_Object_var anObj = SMESH::IObjectToInterface<GEOM::GEOM_Object>(anIO);
+      if (anObj->_is_nil())
         return;
 
       // Clear fields of vertexes if face or 3d block was changed
-      if ( anObj != myGeomObj[ mySelInput ] && mySelInput == Object )
-      {
-        for ( int i = Vertex1; i <= Vertex2; i++ )
-        {
+      if (anObj != myGeomObj[ mySelInput ] && mySelInput == Object) {
+        for (int i = Vertex1; i <= Vertex2; i++) {
           myGeomObj[ i ] = GEOM::GEOM_Object::_nil();
-          mySelEdit[ i ]->setText( "" );
+          mySelEdit[ i ]->setText("");
         }
       }
 
@@ -558,17 +548,13 @@ void SMESHGUI_MeshPatternDlg::onSelectionDone()
 
       // Set name of geom object in line edit
       QString aName;
-      SMESH::GetNameOfSelectedIObjects( mySelection, aName );
-      mySelEdit[ mySelInput ]->setText( aName );
+      SMESH::GetNameOfSelectedIObjects(mySelectionMgr, aName);
+      mySelEdit[ mySelInput ]->setText(aName);
     }
-  }
-  catch( const SALOME::SALOME_Exception& S_ex )
-  {
-    QtCatchCorbaException( S_ex );
+  } catch (const SALOME::SALOME_Exception& S_ex) {
+    SalomeApp_Tools::QtCatchCorbaException(S_ex);
     resetSelInput();
-  }
-  catch( ... )
-  {
+  } catch (...) {
     resetSelInput();
   }
 
@@ -582,7 +568,7 @@ void SMESHGUI_MeshPatternDlg::onSelectionDone()
 //=======================================================================
 void SMESHGUI_MeshPatternDlg::resetSelInput()
 {
-  if ( mySelInput == Mesh )
+  if (mySelInput == Mesh)
   {
     myMesh = SMESH::SMESH_Mesh::_nil();
     myMeshShape = GEOM::GEOM_Object::_nil();
@@ -591,7 +577,7 @@ void SMESHGUI_MeshPatternDlg::resetSelInput()
   else
     myGeomObj[ mySelInput ] = GEOM::GEOM_Object::_nil();
 
-  mySelEdit[ mySelInput ]->setText( "" );
+  mySelEdit[ mySelInput ]->setText("");
 }
 
 //=======================================================================
@@ -600,39 +586,38 @@ void SMESHGUI_MeshPatternDlg::resetSelInput()
 //=======================================================================
 void SMESHGUI_MeshPatternDlg::onDeactivate()
 {
-  mySelection->ClearFilters();
-  //if ( myReverseChk->isChecked() )
+  mySelectionMgr->clearFilters();
+  //if (myReverseChk->isChecked())
   //  erasePreview();
-  disconnect( mySelection, 0, this, 0 );
-  setEnabled( false );
+  disconnect(mySelectionMgr, 0, this, 0);
+  setEnabled(false);
 }
 
 //=======================================================================
 // name    : SMESHGUI_MeshPatternDlg::enterEvent
 // Purpose : Event filter
 //=======================================================================
-void SMESHGUI_MeshPatternDlg::enterEvent( QEvent* )
+void SMESHGUI_MeshPatternDlg::enterEvent (QEvent*)
 {
-  if ( myIsCreateDlgOpen )
+  if (myIsCreateDlgOpen)
     return;
-    
-  if ( myReverseChk->isChecked() )
+
+  if (myReverseChk->isChecked())
     displayPreview();
-  SMESHGUI::GetSMESHGUI()->EmitSignalDeactivateDialog() ;
-  setEnabled( true );
+  mySMESHGUI->EmitSignalDeactivateDialog();
+  setEnabled(true);
   activateSelection();
-  connect( mySelection, SIGNAL( currentSelectionChanged() ), SLOT( onSelectionDone() ) );
-  onTextChanged( mySelEdit[Ids]->text() );
+  connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), SLOT(onSelectionDone()));
+  onTextChanged(mySelEdit[Ids]->text());
 }
 
-
-//=================================================================================
-// function : closeEvent()
-// purpose  :
-//=================================================================================
-void SMESHGUI_MeshPatternDlg::closeEvent( QCloseEvent* e )
+//=======================================================================
+// name    : SMESHGUI_MeshPatternDlg::closeEvent
+// Purpose :
+//=======================================================================
+void SMESHGUI_MeshPatternDlg::closeEvent (QCloseEvent*)
 {
-  onClose() ;
+  onClose();
 }
 
 //=======================================================================
@@ -643,8 +628,8 @@ void SMESHGUI_MeshPatternDlg::closeEvent( QCloseEvent* e )
 void SMESHGUI_MeshPatternDlg::onSelInputChanged()
 {
   const QObject* aSender = sender();
-  for ( int i = Mesh; i <= Ids; i++ )
-    if ( aSender == mySelBtn[ i ] )
+  for (int i = Mesh; i <= Ids; i++)
+    if (aSender == mySelBtn[ i ])
       mySelInput = i;
 
   activateSelection();
@@ -655,27 +640,25 @@ void SMESHGUI_MeshPatternDlg::onSelInputChanged()
 // name    : SMESHGUI_MeshPatternDlg::prepareFilters
 // Purpose : Prepare filters for dialog
 //=======================================================================
-
 QStringList SMESHGUI_MeshPatternDlg::prepareFilters() const
 {
   static QStringList aList;
-  if ( aList.isEmpty() )
+  if (aList.isEmpty())
   {
-    aList.append( tr( "PATTERN_FILT" ) );
-    //aList.append( tr( "ALL_FILES_FILTER" ) );
+    aList.append(tr("PATTERN_FILT"));
+    //aList.append(tr("ALL_FILES_FILTER"));
   }
 
   return aList;
 }
 
-//================================================================
-
-// Function : SMESHGUI_MeshPatternDlg::autoExtension
-// Purpose  : Append extension to the file name
-//================================================================
-QString SMESHGUI_MeshPatternDlg::autoExtension( const QString& theFileName ) const
+//=======================================================================
+// name    : SMESHGUI_MeshPatternDlg::autoExtension
+// Purpose : Append extension to the file name
+//=======================================================================
+QString SMESHGUI_MeshPatternDlg::autoExtension (const QString& theFileName) const
 {
-  QString anExt = theFileName.section( '.', -1 );
+  QString anExt = theFileName.section('.', -1);
   return anExt != "smp" && anExt != "SMP" ? theFileName + ".smp" : theFileName;
 }
 
@@ -686,53 +669,51 @@ QString SMESHGUI_MeshPatternDlg::autoExtension( const QString& theFileName ) con
 //=======================================================================
 void SMESHGUI_MeshPatternDlg::onOpen()
 {
-  QAD_FileDlg* aDlg = new QAD_FileDlg( this, true );
-  aDlg->setCaption( tr( "LOAD_PATTERN" ) );
-  aDlg->setMode( QFileDialogP::ExistingFile );
-  aDlg->setFilters( prepareFilters() );
-  if ( myName->text() != "" )
-    aDlg->setSelection( myName->text() + ".smp" );
-  QPushButton* anOkBtn = ( QPushButton* )aDlg->child( "OK", "QPushButton" );
-  if ( anOkBtn != 0 )
-    anOkBtn->setText( tr( "SMESH_BUT_OK" ) );
-
-  if ( aDlg->exec() != Accepted )
+  SUIT_FileDlg* aDlg = new SUIT_FileDlg (this, true);
+  aDlg->setCaption(tr("LOAD_PATTERN"));
+  aDlg->setMode(QFileDialog::ExistingFile);
+  aDlg->setFilters(prepareFilters());
+  if (myName->text() != "")
+    aDlg->setSelection(myName->text() + ".smp");
+  QPushButton* anOkBtn = (QPushButton*)aDlg->child("OK", "QPushButton");
+  if (anOkBtn != 0)
+    anOkBtn->setText(tr("SMESH_BUT_OK"));
+
+  if (aDlg->exec() != Accepted)
     return;
 
   QString fName = aDlg->selectedFile();
-  if ( fName.isEmpty() )
+  if (fName.isEmpty())
     return;
 
-  if ( QFileInfo( fName ).extension().isEmpty() )
-    fName = autoExtension( fName );
+  if (QFileInfo(fName).extension().isEmpty())
+    fName = autoExtension(fName);
 
-  fName = QDir::convertSeparators( fName );
-  
-  QString prev = QDir::convertSeparators( myName->text() );
-  if ( prev == fName )
+  fName = QDir::convertSeparators(fName);
+
+  QString prev = QDir::convertSeparators(myName->text());
+  if (prev == fName)
     return;
 
   // Read string from file
-  QFile aFile( fName );
-  if ( !aFile.open( IO_ReadOnly ) )
-  {
-    QMessageBox::information( SMESHGUI::GetSMESHGUI()->GetDesktop(),
-      tr( "SMESH_ERROR" ), tr( "ERROR_OF_OPENING" ), QMessageBox::Ok );
+  QFile aFile(fName);
+  if (!aFile.open(IO_ReadOnly)) {
+    QMessageBox::information(SMESHGUI::desktop(), tr("SMESH_ERROR"),
+                             tr("ERROR_OF_OPENING"), QMessageBox::Ok);
     return;
   }
-  
+
   QByteArray aDataArray = aFile.readAll();
   const char* aData = aDataArray.data();
-  if ( aData == 0 )
-  {
-    QMessageBox::information( SMESHGUI::GetSMESHGUI()->GetDesktop(),
-      tr( "SMESH_ERROR" ), tr( "ERROR_OF_READING" ), QMessageBox::Ok );
+  if (aData == 0) {
+    QMessageBox::information(SMESHGUI::desktop(), tr("SMESH_ERROR"),
+                             tr("ERROR_OF_READING"), QMessageBox::Ok);
     return;
   }
-  
-  if ( loadFromFile( aData ) )
-    myName->setText( QFileInfo( fName ).baseName() );
-    
+
+  if (loadFromFile(aData))
+    myName->setText(QFileInfo(fName).baseName());
+
   updateWgState();
   displayPreview();
 }
@@ -743,11 +724,10 @@ void SMESHGUI_MeshPatternDlg::onOpen()
 //=======================================================================
 void SMESHGUI_MeshPatternDlg::onCloseCreationDlg()
 {
-  setEnabled( true );
+  setEnabled(true);
   myIsCreateDlgOpen = false;
 }
 
-
 //=======================================================================
 // name    : SMESHGUI_MeshPatternDlg::onOkCreationDlg
 // Purpose : SLOT. Called when "Pattern creation" dialog closed with OK
@@ -755,32 +735,31 @@ void SMESHGUI_MeshPatternDlg::onCloseCreationDlg()
 //=======================================================================
 void SMESHGUI_MeshPatternDlg::onOkCreationDlg()
 {
-  myPattern = SMESH::SMESH_Pattern::_duplicate( myCreationDlg->GetPattern() );
-  myName->setText( myCreationDlg->GetPatternName() );
+  myPattern = SMESH::SMESH_Pattern::_duplicate(myCreationDlg->GetPattern());
+  myName->setText(myCreationDlg->GetPatternName());
   displayPreview();
-  setEnabled( true );
+  setEnabled(true);
   myIsCreateDlgOpen = false;
 }
 
-
 //=======================================================================
 // name    : SMESHGUI_MeshPatternDlg::onNew
 // Purpose : SLOT. Called when "New..." button clicked. Create new pattern
 //=======================================================================
 void SMESHGUI_MeshPatternDlg::onNew()
 {
-  setEnabled( false );
+  setEnabled(false);
   myIsCreateDlgOpen = true;
-  if ( myCreationDlg == 0 )
+  if (myCreationDlg == 0)
   {
-    myCreationDlg = new SMESHGUI_CreatePatternDlg( this, mySelection, myType );
-    connect( myCreationDlg, SIGNAL( NewPattern() ), SLOT( onOkCreationDlg() ) );
-    connect( myCreationDlg, SIGNAL( Close() ), SLOT( onCloseCreationDlg() ) );
+    myCreationDlg = new SMESHGUI_CreatePatternDlg( mySMESHGUI, myType);
+    connect(myCreationDlg, SIGNAL(NewPattern()), SLOT(onOkCreationDlg()));
+    connect(myCreationDlg, SIGNAL(Close()), SLOT(onCloseCreationDlg()));
   }
   else
-    myCreationDlg->Init( mySelection, myType );
+    myCreationDlg->Init(myType);
 
-  myCreationDlg->SetMesh( myMesh );
+  myCreationDlg->SetMesh(myMesh);
   myCreationDlg->show();
 }
 
@@ -789,7 +768,7 @@ void SMESHGUI_MeshPatternDlg::onNew()
 // Purpose : SLOT. Called when state of "Reverse order..." checkbox chaged
 //           Calculate new points of the mesh to be created. Redisplay preview
 //=======================================================================
-void SMESHGUI_MeshPatternDlg::onReverse( bool )
+void SMESHGUI_MeshPatternDlg::onReverse (bool)
 {
   displayPreview();
 }
@@ -800,7 +779,7 @@ void SMESHGUI_MeshPatternDlg::onReverse( bool )
 // Purpose : SLOT. Called when state of "Preview" checkbox changed
 //           Display/Erase preview
 //=======================================================================
-void SMESHGUI_MeshPatternDlg::onPreview( bool )
+void SMESHGUI_MeshPatternDlg::onPreview (bool)
 {
   displayPreview();
 }
@@ -811,53 +790,42 @@ void SMESHGUI_MeshPatternDlg::onPreview( bool )
 //=======================================================================
 void SMESHGUI_MeshPatternDlg::displayPreview()
 {
-  try
-  {
+  try {
     // Redisplay preview in dialog
-
     SMESH::point_array_var pnts = myPattern->GetPoints();
     SMESH::long_array_var keyPoints = myPattern->GetKeyPoints();
     SMESH::array_of_long_array_var elemPoints = myPattern->GetElementPoints(false);
 
-    if ( pnts->length()       == 0 ||
-         keyPoints->length()  == 0 ||
-         elemPoints->length() == 0 )
-    {
+    if (pnts->length()       == 0 ||
+        keyPoints->length()  == 0 ||
+        elemPoints->length() == 0) {
       erasePreview();
       return;
-    }
-
-    else
-    {
-      PointVector aPoints( pnts->length() );
-      QValueVector<int> aKeyPoints( keyPoints->length() );
-      ConnectivityVector anElemPoints( elemPoints->length() );
+    } else {
+      PointVector aPoints(pnts->length());
+      QValueVector<int> aKeyPoints(keyPoints->length());
+      ConnectivityVector anElemPoints(elemPoints->length());
 
-      for ( int i = 0, n = pnts->length(); i < n; i++ )
+      for (int i = 0, n = pnts->length(); i < n; i++)
         aPoints[ i ] = pnts[ i ];
 
-      for ( int i2 = 0, n2 = keyPoints->length(); i2 < n2; i2++ )
+      for (int i2 = 0, n2 = keyPoints->length(); i2 < n2; i2++)
         aKeyPoints[ i2 ] = keyPoints[ i2 ];
 
-      for ( int i3 = 0, n3 = elemPoints->length(); i3 < n3; i3++ )
-      {
-        QValueVector<int> aVec( elemPoints[ i3 ].length() );
-        for ( int i4 = 0, n4 = elemPoints[ i3 ].length(); i4 < n4; i4++ )
+      for (int i3 = 0, n3 = elemPoints->length(); i3 < n3; i3++) {
+        QValueVector<int> aVec(elemPoints[ i3 ].length());
+        for (int i4 = 0, n4 = elemPoints[ i3 ].length(); i4 < n4; i4++)
           aVec[ i4 ] = elemPoints[ i3 ][ i4 ];
 
         anElemPoints[ i3 ] = aVec;
       }
 
-      myPicture2d->SetPoints( aPoints, aKeyPoints, anElemPoints );
+      myPicture2d->SetPoints(aPoints, aKeyPoints, anElemPoints);
     }
 
-
     // Redisplay preview in 3D viewer
-
-    if ( myPreviewActor != 0 )
-    {
-      if ( VTKViewer_ViewFrame* vf = SMESH::GetCurrentVtkView() )
-      {
+    if (myPreviewActor != 0) {
+      if (SVTK_ViewWindow* vf = SMESH::GetCurrentVtkView()) {
         vf->RemoveActor(myPreviewActor);
         vf->Repaint();
       }
@@ -865,45 +833,41 @@ void SMESHGUI_MeshPatternDlg::displayPreview()
       myPreviewActor = 0;
     }
 
-    if ( !myPreviewChk->isChecked() || !isValid( false ) )
+    if (!myPreviewChk->isChecked() || !isValid(false))
       return;
 
     vtkUnstructuredGrid* aGrid = getGrid();
-    if ( aGrid == 0 )
+    if (aGrid == 0)
       return;
 
     // Create and display actor
     vtkDataSetMapper* aMapper = vtkDataSetMapper::New();
-    aMapper->SetInput( aGrid );
+    aMapper->SetInput(aGrid);
 
     myPreviewActor = SALOME_Actor::New();
     myPreviewActor->PickableOff();
-    myPreviewActor->SetMapper( aMapper );
+    myPreviewActor->SetMapper(aMapper);
 
     vtkProperty* aProp = vtkProperty::New();
     aProp->SetRepresentationToWireframe();
-    aProp->SetColor( 250, 0, 250 );
-    if ( SMESH::FindActorByObject( myMesh ) )
-      aProp->SetLineWidth( SMESH::GetFloat( "SMESH:SettingsWidth", 1 ) +1 );
+    aProp->SetColor(250, 0, 250);
+    if (SMESH::FindActorByObject(myMesh))
+      aProp->SetLineWidth(SMESH::GetFloat("SMESH:SettingsWidth", 1) +1);
     else
-      aProp->SetLineWidth( 1 );
-    myPreviewActor->SetProperty( aProp );
+      aProp->SetLineWidth(1);
+    myPreviewActor->SetProperty(aProp);
 
-    myPreviewActor->SetRepresentation( 3 );
+    myPreviewActor->SetRepresentation(3);
 
-    SMESH::GetCurrentVtkView()->AddActor( myPreviewActor );
+    SMESH::GetCurrentVtkView()->AddActor(myPreviewActor);
     SMESH::GetCurrentVtkView()->Repaint();
 
     aProp->Delete();
     aGrid->Delete();
-  }
-  catch( const SALOME::SALOME_Exception& S_ex )
-  {
-    QtCatchCorbaException( S_ex );
+  } catch (const SALOME::SALOME_Exception& S_ex) {
+    SalomeApp_Tools::QtCatchCorbaException(S_ex);
     erasePreview();
-  }
-  catch( ... )
-  {
+  } catch (...) {
     erasePreview();
   }
 }
@@ -915,14 +879,14 @@ void SMESHGUI_MeshPatternDlg::displayPreview()
 void SMESHGUI_MeshPatternDlg::erasePreview()
 {
   // Erase preview in 2D viewer
-  myPicture2d->SetPoints( PointVector(), QValueVector<int>(), ConnectivityVector() );
+  myPicture2d->SetPoints(PointVector(), QValueVector<int>(), ConnectivityVector());
 
   // Erase preview in 3D viewer
-  if ( myPreviewActor == 0 )
+  if (myPreviewActor == 0)
     return;
 
 
-  if ( VTKViewer_ViewFrame* vf = SMESH::GetCurrentVtkView() )
+  if (SVTK_ViewWindow* vf = SMESH::GetCurrentVtkView())
   {
     vf->RemoveActor(myPreviewActor);
     vf->Repaint();
@@ -937,60 +901,51 @@ void SMESHGUI_MeshPatternDlg::erasePreview()
 //=======================================================================
 void SMESHGUI_MeshPatternDlg::updateWgState()
 {
-  if ( myMesh->_is_nil() )
-  {
-    for ( int i = Object; i <= Ids; i++ )
-    {
-      mySelBtn [ i ]->setEnabled( false );
-      mySelEdit[ i ]->setEnabled( false );
-      mySelEdit[ i ]->setText( "" );
+  if (myMesh->_is_nil()) {
+    for (int i = Object; i <= Ids; i++) {
+      mySelBtn [ i ]->setEnabled(false);
+      mySelEdit[ i ]->setEnabled(false);
+      mySelEdit[ i ]->setText("");
     }
-    myNode1->setEnabled( false );
-    myNode2->setEnabled( false );
-    myNode1->setRange( 0, 0 );
-    myNode2->setRange( 0, 0 );
-  }
-  else
-  {
-    mySelBtn [ Object ]->setEnabled( true );
-    mySelEdit[ Object ]->setEnabled( true );
-    mySelBtn [ Ids ]   ->setEnabled( true );
-    mySelEdit[ Ids ]   ->setEnabled( true );
-    
-    if ( myGeomObj[ Object ]->_is_nil() )
-    {
-      for ( int i = Vertex1; i <= Vertex2; i++ )
-      {
-        mySelBtn [ i ]->setEnabled( false );
-        mySelEdit[ i ]->setEnabled( false );
-        mySelEdit[ i ]->setText( "" );
+    myNode1->setEnabled(false);
+    myNode2->setEnabled(false);
+    myNode1->setRange(0, 0);
+    myNode2->setRange(0, 0);
+  } else {
+    mySelBtn [ Object ]->setEnabled(true);
+    mySelEdit[ Object ]->setEnabled(true);
+    mySelBtn [ Ids ]   ->setEnabled(true);
+    mySelEdit[ Ids ]   ->setEnabled(true);
+
+    if (myGeomObj[ Object ]->_is_nil()) {
+      for (int i = Vertex1; i <= Vertex2; i++) {
+        mySelBtn [ i ]->setEnabled(false);
+        mySelEdit[ i ]->setEnabled(false);
+        mySelEdit[ i ]->setText("");
       }
-    }
-    else
-    {
-      for ( int i = Object; i <= Vertex2; i++ )
-      {
-        mySelBtn [ i ]->setEnabled( true );
-        mySelEdit[ i ]->setEnabled( true );
+    } else {
+      for (int i = Object; i <= Vertex2; i++) {
+        mySelBtn [ i ]->setEnabled(true);
+        mySelEdit[ i ]->setEnabled(true);
       }
     }
 
     QValueList<int> ids;
-    if ( !CORBA::is_nil( myPattern ) && getIds( ids ) ) {
+    if (!CORBA::is_nil(myPattern) && getIds(ids)) {
       SMESH::long_array_var keyPoints = myPattern->GetKeyPoints();
-      if ( keyPoints->length() ) {
-       myNode1->setEnabled( true );
-       myNode2->setEnabled( true );
-       myNode1->setRange( 1, keyPoints->length() );
-       myNode2->setRange( 1, keyPoints->length() );
+      if (keyPoints->length()) {
+       myNode1->setEnabled(true);
+       myNode2->setEnabled(true);
+       myNode1->setRange(1, keyPoints->length());
+       myNode2->setRange(1, keyPoints->length());
        return;
       }
     }
 
-    myNode1->setEnabled( false );
-    myNode2->setEnabled( false );
-    myNode1->setRange( 0, 0 );
-    myNode2->setRange( 0, 0 );
+    myNode1->setEnabled(false);
+    myNode2->setEnabled(false);
+    myNode1->setRange(0, 0);
+    myNode2->setRange(0, 0);
   }
 }
 
@@ -1000,47 +955,42 @@ void SMESHGUI_MeshPatternDlg::updateWgState()
 //=======================================================================
 void SMESHGUI_MeshPatternDlg::activateSelection()
 {
-  mySelection->ClearFilters();
-  if ( mySelInput == Ids ) {
-    SMESH_Actor* anActor = SMESH::FindActorByObject( myMesh );
-    if ( anActor )
+  mySelectionMgr->clearFilters();
+  if (mySelInput == Ids) {
+    SMESH_Actor* anActor = SMESH::FindActorByObject(myMesh);
+    if (anActor)
       SMESH::SetPickable(anActor);
 
-    if ( myType == Type_2d )
-      QAD_Application::getDesktop()->SetSelectionMode( FaceSelection, true );
+    if (myType == Type_2d)
+      myViewWindow->SetSelectionMode(FaceSelection);
     else
-      QAD_Application::getDesktop()->SetSelectionMode( CellSelection, true );
+      myViewWindow->SetSelectionMode(CellSelection);
   }
   else {
     SMESH::SetPickable();
-  QAD_Application::getDesktop()->SetSelectionMode( ActorSelection );
+    //mySelectionMgr->setSelectionModes(ActorSelection);
+    myViewWindow->SetSelectionMode(ActorSelection);
   }
-  
-  if ( mySelInput == Object && !myMeshShape->_is_nil() )
-  {
-    if ( myType == Type_2d )
-    {
-      if ( myNbPoints > 0 )
-        mySelection->AddFilter( new SMESH_NumberFilter( 
 
-          "GEOM", TopAbs_VERTEX, myNbPoints, TopAbs_FACE, myMeshShape ) );
+  if (mySelInput == Object && !myMeshShape->_is_nil()) {
+    if (myType == Type_2d) {
+      if (myNbPoints > 0)
+        mySelectionMgr->installFilter
+          (new SMESH_NumberFilter ("GEOM", TopAbs_VERTEX, myNbPoints, TopAbs_FACE, myMeshShape));
       else
-        mySelection->AddFilter( new SMESH_NumberFilter(
-          "GEOM", TopAbs_SHAPE, myNbPoints, TopAbs_FACE, myMeshShape ) );
-    }
-    else
-    {
+        mySelectionMgr->installFilter
+          (new SMESH_NumberFilter ("GEOM", TopAbs_SHAPE, myNbPoints, TopAbs_FACE, myMeshShape));
+    } else {
       TColStd_MapOfInteger aTypes;
-      aTypes.Add( TopAbs_SHELL );
-      aTypes.Add( TopAbs_SOLID );
-      mySelection->AddFilter( new SMESH_NumberFilter(
-        "GEOM", TopAbs_FACE, 6, aTypes, myMeshShape, true ) );
+      aTypes.Add(TopAbs_SHELL);
+      aTypes.Add(TopAbs_SOLID);
+      mySelectionMgr->installFilter
+        (new SMESH_NumberFilter ("GEOM", TopAbs_FACE, 6, aTypes, myMeshShape, true));
     }
-  }
-  else if ( ( mySelInput == Vertex1 || mySelInput == Vertex2 ) && !myGeomObj[ Object ]->_is_nil()  )
-  {
-    mySelection->AddFilter( new SMESH_NumberFilter(
-      "GEOM", TopAbs_SHAPE, 1, TopAbs_VERTEX, myGeomObj[ Object ] ) );
+  } else if ((mySelInput == Vertex1 || mySelInput == Vertex2) && !myGeomObj[ Object ]->_is_nil()) {
+    mySelectionMgr->installFilter
+      (new SMESH_NumberFilter ("GEOM", TopAbs_SHAPE, 1, TopAbs_VERTEX, myGeomObj[ Object ]));
+  } else {
   }
 }
 
@@ -1048,56 +998,48 @@ void SMESHGUI_MeshPatternDlg::activateSelection()
 // name    : SMESHGUI_MeshPatternDlg::loadFromFile
 // Purpose : Load pattern from file
 //=======================================================================
-bool SMESHGUI_MeshPatternDlg::loadFromFile( const QString& theName )
+bool SMESHGUI_MeshPatternDlg::loadFromFile (const QString& theName)
 {
-  try
-  {
+  try {
     SMESH::SMESH_Pattern_var aPattern = SMESH::GetPattern();
 
-    if ( !aPattern->LoadFromFile( theName.latin1() ) ||
-         myType == Type_2d && !aPattern->Is2D())
-    {
+    if (!aPattern->LoadFromFile(theName.latin1()) ||
+        myType == Type_2d && !aPattern->Is2D()) {
       SMESH::SMESH_Pattern::ErrorCode aCode = aPattern->GetErrorCode();
       QString aMess;
-      if      ( aCode == SMESH::SMESH_Pattern::ERR_READ_NB_POINTS      ) aMess = tr( "ERR_READ_NB_POINTS" );
-      else if ( aCode == SMESH::SMESH_Pattern::ERR_READ_POINT_COORDS   ) aMess = tr( "ERR_READ_POINT_COORDS" );
-      else if ( aCode == SMESH::SMESH_Pattern::ERR_READ_TOO_FEW_POINTS ) aMess = tr( "ERR_READ_TOO_FEW_POINTS" );
-      else if ( aCode == SMESH::SMESH_Pattern::ERR_READ_3D_COORD       ) aMess = tr( "ERR_READ_3D_COORD" );
-      else if ( aCode == SMESH::SMESH_Pattern::ERR_READ_NO_KEYPOINT    ) aMess = tr( "ERR_READ_NO_KEYPOINT" );
-      else if ( aCode == SMESH::SMESH_Pattern::ERR_READ_BAD_INDEX      ) aMess = tr( "ERR_READ_BAD_INDEX" );
-      else if ( aCode == SMESH::SMESH_Pattern::ERR_READ_ELEM_POINTS    ) aMess = tr( "ERR_READ_ELEM_POINTS" );
-      else if ( aCode == SMESH::SMESH_Pattern::ERR_READ_NO_ELEMS       ) aMess = tr( "ERR_READ_NO_ELEMS" );
-      else if ( aCode == SMESH::SMESH_Pattern::ERR_READ_BAD_KEY_POINT  ) aMess = tr( "ERR_READ_BAD_KEY_POINT" );
-      else                                                               aMess = tr( "ERROR_OF_LOADING" );
-
-      QMessageBox::information( SMESHGUI::GetSMESHGUI()->GetDesktop(),
-        tr( "SMESH_ERROR" ), aMess, QMessageBox::Ok );
+      if      (aCode == SMESH::SMESH_Pattern::ERR_READ_NB_POINTS     ) aMess = tr("ERR_READ_NB_POINTS");
+      else if (aCode == SMESH::SMESH_Pattern::ERR_READ_POINT_COORDS  ) aMess = tr("ERR_READ_POINT_COORDS");
+      else if (aCode == SMESH::SMESH_Pattern::ERR_READ_TOO_FEW_POINTS) aMess = tr("ERR_READ_TOO_FEW_POINTS");
+      else if (aCode == SMESH::SMESH_Pattern::ERR_READ_3D_COORD      ) aMess = tr("ERR_READ_3D_COORD");
+      else if (aCode == SMESH::SMESH_Pattern::ERR_READ_NO_KEYPOINT   ) aMess = tr("ERR_READ_NO_KEYPOINT");
+      else if (aCode == SMESH::SMESH_Pattern::ERR_READ_BAD_INDEX     ) aMess = tr("ERR_READ_BAD_INDEX");
+      else if (aCode == SMESH::SMESH_Pattern::ERR_READ_ELEM_POINTS   ) aMess = tr("ERR_READ_ELEM_POINTS");
+      else if (aCode == SMESH::SMESH_Pattern::ERR_READ_NO_ELEMS      ) aMess = tr("ERR_READ_NO_ELEMS");
+      else if (aCode == SMESH::SMESH_Pattern::ERR_READ_BAD_KEY_POINT ) aMess = tr("ERR_READ_BAD_KEY_POINT");
+      else                                                             aMess = tr("ERROR_OF_LOADING");
+
+      QMessageBox::information(SMESHGUI::desktop(), tr("SMESH_ERROR"), aMess, QMessageBox::Ok);
       return false;
-    }
-    else
-    {
+    } else {
       myPattern = aPattern;
       return true;
     }
-  }
-  catch( const SALOME::SALOME_Exception& S_ex )
-  {
-    QtCatchCorbaException( S_ex );
-    QMessageBox::information( SMESHGUI::GetSMESHGUI()->GetDesktop(),
-        tr( "SMESH_ERROR" ), tr( "ERROR_OF_LOADING" ), QMessageBox::Ok );
+  } catch (const SALOME::SALOME_Exception& S_ex) {
+    SalomeApp_Tools::QtCatchCorbaException(S_ex);
+    QMessageBox::information(SMESHGUI::desktop(), tr("SMESH_ERROR"),
+                             tr("ERROR_OF_LOADING"), QMessageBox::Ok);
       return false;
   }
 }
 
 //=======================================================================
 // name    : SMESHGUI_MeshPatternDlg::onTypeChanged
-
 // Purpose : SLOT. Called when pattern type changed.
 //           Change dialog's look and feel
 //=======================================================================
-void SMESHGUI_MeshPatternDlg::onTypeChanged( int theType )
+void SMESHGUI_MeshPatternDlg::onTypeChanged (int theType)
 {
-  if ( myType == theType )
+  if (myType == theType)
     return;
 
   myType = theType;
@@ -1108,14 +1050,15 @@ void SMESHGUI_MeshPatternDlg::onTypeChanged( int theType )
   myGeomObj[ Vertex2 ] = GEOM::GEOM_Object::_nil();
   myPattern = SMESH::GetPattern();
 
-  myName->setText( "" );
-  mySelEdit[ Object  ]->setText( "" );
-  mySelEdit[ Vertex1 ]->setText( "" );
-  mySelEdit[ Vertex2 ]->setText( "" );
-  mySelEdit[ Ids ]    ->setText( "" );
+  myName->setText("");
+  mySelEdit[ Object  ]->setText("");
+  mySelEdit[ Vertex1 ]->setText("");
+  mySelEdit[ Vertex2 ]->setText("");
+  mySelEdit[ Ids ]    ->setText("");
+  myCreatePolygonsChk->show();
+  myCreatePolyedrsChk->show();
 
-  if ( theType == Type_2d )
-  {
+  if (theType == Type_2d) {
     // Geom widgets
     mySelLbl [ Vertex2 ]->hide();
     mySelBtn [ Vertex2 ]->hide();
@@ -1123,15 +1066,13 @@ void SMESHGUI_MeshPatternDlg::onTypeChanged( int theType )
     myReverseChk->show();
     myPicture2d->show();
     myPicture3d->hide();
-    mySelLbl[ Object  ]->setText( tr( "FACE" ) );
-    mySelLbl[ Vertex1 ]->setText( tr( "VERTEX" ) );
+    mySelLbl[ Object  ]->setText(tr("FACE"));
+    mySelLbl[ Vertex1 ]->setText(tr("VERTEX"));
     // Refine widgets
-    mySelLbl[ Ids ]->setText( tr( "MESH_FACES" ) );
+    mySelLbl[ Ids ]->setText(tr("MESH_FACES"));
     myNode2Lbl->hide();
     myNode2   ->hide();
-  }
-  else
-  {
+  } else {
     // Geom widgets
     mySelLbl [ Vertex2 ]->show();
     mySelBtn [ Vertex2 ]->show();
@@ -1139,11 +1080,11 @@ void SMESHGUI_MeshPatternDlg::onTypeChanged( int theType )
     myReverseChk->hide();
     myPicture2d->hide();
     myPicture3d->show();
-    mySelLbl[ Object  ]->setText( tr( "3D_BLOCK" ) );
-    mySelLbl[ Vertex1 ]->setText( tr( "VERTEX1" ) );
-    mySelLbl[ Vertex2 ]->setText( tr( "VERTEX2" ) );
+    mySelLbl[ Object  ]->setText(tr("3D_BLOCK"));
+    mySelLbl[ Vertex1 ]->setText(tr("VERTEX1"));
+    mySelLbl[ Vertex2 ]->setText(tr("VERTEX2"));
     // Refine widgets
-    mySelLbl[ Ids ]->setText( tr( "MESH_VOLUMES" ) );
+    mySelLbl[ Ids ]->setText(tr("MESH_VOLUMES"));
     myNode2Lbl->show();
     myNode2   ->show();
   }
@@ -1160,49 +1101,45 @@ void SMESHGUI_MeshPatternDlg::onTypeChanged( int theType )
 //=======================================================================
 vtkUnstructuredGrid* SMESHGUI_MeshPatternDlg::getGrid()
 {
-  try
-  {
+  try {
     // Get points from pattern
     SMESH::point_array_var pnts;
     QValueList<int> ids;
-    if ( isRefine() && getIds( ids ) ) {
+    if (isRefine() && getIds(ids)) {
       SMESH::long_array_var varIds = new SMESH::long_array();
-      varIds->length( ids.count() );
+      varIds->length(ids.count());
       int i = 0;
-      for ( QValueList<int>::iterator it = ids.begin(); it != ids.end(); ++it )
+      for (QValueList<int>::iterator it = ids.begin(); it != ids.end(); ++it)
        varIds[i++] = *it;
       pnts = myType == Type_2d
-       ? myPattern->ApplyToMeshFaces  ( myMesh, varIds, getNode( false ), myReverseChk->isChecked() )
-       : myPattern->ApplyToHexahedrons( myMesh, varIds, getNode( false ), getNode( true ) );
-    }
-    else {
+       ? myPattern->ApplyToMeshFaces  (myMesh, varIds, getNode(false), myReverseChk->isChecked())
+       : myPattern->ApplyToHexahedrons(myMesh, varIds, getNode(false), getNode(true));
+    } else {
       pnts = myType == Type_2d
-       ? myPattern->ApplyToFace   ( myGeomObj[ Object ], myGeomObj[ Vertex1 ], myReverseChk->isChecked() )
-      : myPattern->ApplyTo3DBlock( myGeomObj[ Object ], myGeomObj[ Vertex1 ], myGeomObj[ Vertex2 ] );
+       ? myPattern->ApplyToFace   (myGeomObj[ Object ], myGeomObj[ Vertex1 ], myReverseChk->isChecked())
+      : myPattern->ApplyTo3DBlock(myGeomObj[ Object ], myGeomObj[ Vertex1 ], myGeomObj[ Vertex2 ]);
     }
 
     SMESH::array_of_long_array_var elemPoints = myPattern->GetElementPoints(true);
 
-    if ( pnts->length() == 0 || elemPoints->length() == 0 )
+    if (pnts->length() == 0 || elemPoints->length() == 0)
       return 0;
 
-    
-
     // to do : to be removed /////////////////////////////////////////////
 
 #ifdef DEB_SLN
-    for ( int i1 = 0, n1 = pnts->length(); i1 < n1; i1++ )
-      printf( "%d: %g %g %g\n", i1, pnts[ i1 ].x, pnts[ i1 ].y, pnts[ i1 ].z );
+    for (int i1 = 0, n1 = pnts->length(); i1 < n1; i1++)
+      printf("%d: %g %g %g\n", i1, pnts[ i1 ].x, pnts[ i1 ].y, pnts[ i1 ].z);
 
-    printf( "\nELEMENTS : \n" );
-    for ( int i2 = 0, n2 = elemPoints->length(); i2 < n2; i2++ )
+    printf("\nELEMENTS : \n");
+    for (int i2 = 0, n2 = elemPoints->length(); i2 < n2; i2++)
     {
 
-      printf( "%d: ", i2 );
-      for ( int i3 = 0, n3 = elemPoints[ i2 ].length(); i3 < n3; i3++ )
-        printf( "%d ", elemPoints[ i2 ][ i3 ] );
+      printf("%d: ", i2);
+      for (int i3 = 0, n3 = elemPoints[ i2 ].length(); i3 < n3; i3++)
+        printf("%d ", elemPoints[ i2 ][ i3 ]);
 
-      printf( "\n" );
+      printf("\n");
 
     }
 #endif
@@ -1211,56 +1148,55 @@ vtkUnstructuredGrid* SMESHGUI_MeshPatternDlg::getGrid()
     // Calculate number of points used for cell
     vtkIdType aNbCells = elemPoints->length();
     vtkIdType aCellsSize = 0;
-    for ( int i = 0, n = elemPoints->length(); i < n; i++ )
+    for (int i = 0, n = elemPoints->length(); i < n; i++)
       aCellsSize += elemPoints[ i ].length();
 
     // Create unstructured grid and other  usefull arrays
     vtkUnstructuredGrid* aGrid = vtkUnstructuredGrid::New();
 
     vtkCellArray* aConnectivity = vtkCellArray::New();
-    aConnectivity->Allocate( aCellsSize, 0 );
+    aConnectivity->Allocate(aCellsSize, 0);
 
     vtkPoints* aPoints = vtkPoints::New();
-    aPoints->SetNumberOfPoints( pnts->length() );
+    aPoints->SetNumberOfPoints(pnts->length());
 
     vtkUnsignedCharArray* aCellTypesArray = vtkUnsignedCharArray::New();
-    aCellTypesArray->SetNumberOfComponents( 1 );
-    aCellTypesArray->Allocate( aNbCells * aCellTypesArray->GetNumberOfComponents() );
+    aCellTypesArray->SetNumberOfComponents(1);
+    aCellTypesArray->Allocate(aNbCells * aCellTypesArray->GetNumberOfComponents());
 
     vtkIdList *anIdList = vtkIdList::New();
 
     // Fill array of points
-    for ( int p = 0, nbPnt = pnts->length(); p < nbPnt; p++ )
-      aPoints->SetPoint( p, pnts[ p ].x, pnts[ p ].y, pnts[ p ].z );
+    for (int p = 0, nbPnt = pnts->length(); p < nbPnt; p++)
+      aPoints->SetPoint(p, pnts[ p ].x, pnts[ p ].y, pnts[ p ].z);
 
-    for ( int e = 0, nbElem = elemPoints->length(); e < nbElem; e++ )
-    {
+    for (int e = 0, nbElem = elemPoints->length(); e < nbElem; e++) {
       int nbPoints = elemPoints[ e ].length();
-      anIdList->SetNumberOfIds( nbPoints );
-      for ( int i = 0; i < nbPoints; i++ )
-        anIdList->SetId( i, elemPoints[ e ][ i ] );
-
-      aConnectivity->InsertNextCell( anIdList );
-
-      if      ( nbPoints == 3 ) aCellTypesArray->InsertNextValue( VTK_TRIANGLE );
-      else if ( nbPoints == 5 ) aCellTypesArray->InsertNextValue( VTK_PYRAMID );
-      else if ( nbPoints == 6 ) aCellTypesArray->InsertNextValue( VTK_WEDGE );
-      else if ( nbPoints == 8 ) aCellTypesArray->InsertNextValue( VTK_HEXAHEDRON );
-      else if ( nbPoints == 4 && myType == Type_2d ) aCellTypesArray->InsertNextValue( VTK_QUAD );
-      else if ( nbPoints == 4 && myType == Type_3d ) aCellTypesArray->InsertNextValue( VTK_TETRA );
-      else aCellTypesArray->InsertNextValue( VTK_EMPTY_CELL );
+      anIdList->SetNumberOfIds(nbPoints);
+      for (int i = 0; i < nbPoints; i++)
+        anIdList->SetId(i, elemPoints[ e ][ i ]);
+
+      aConnectivity->InsertNextCell(anIdList);
+
+      if      (nbPoints == 3) aCellTypesArray->InsertNextValue(VTK_TRIANGLE);
+      else if (nbPoints == 5) aCellTypesArray->InsertNextValue(VTK_PYRAMID);
+      else if (nbPoints == 6) aCellTypesArray->InsertNextValue(VTK_WEDGE);
+      else if (nbPoints == 8) aCellTypesArray->InsertNextValue(VTK_HEXAHEDRON);
+      else if (nbPoints == 4 && myType == Type_2d) aCellTypesArray->InsertNextValue(VTK_QUAD);
+      else if (nbPoints == 4 && myType == Type_3d) aCellTypesArray->InsertNextValue(VTK_TETRA);
+      else aCellTypesArray->InsertNextValue(VTK_EMPTY_CELL);
     }
 
     vtkIntArray* aCellLocationsArray = vtkIntArray::New();
-    aCellLocationsArray->SetNumberOfComponents( 1 );
-    aCellLocationsArray->SetNumberOfTuples( aNbCells );
+    aCellLocationsArray->SetNumberOfComponents(1);
+    aCellLocationsArray->SetNumberOfTuples(aNbCells);
 
     aConnectivity->InitTraversal();
-    for( vtkIdType idType = 0, *pts, npts; aConnectivity->GetNextCell( npts, pts ); idType++ )
-      aCellLocationsArray->SetValue( idType, aConnectivity->GetTraversalLocation( npts ) );
+    for (vtkIdType idType = 0, *pts, npts; aConnectivity->GetNextCell(npts, pts); idType++)
+      aCellLocationsArray->SetValue(idType, aConnectivity->GetTraversalLocation(npts));
 
-    aGrid->SetPoints( aPoints );
-    aGrid->SetCells( aCellTypesArray, aCellLocationsArray,aConnectivity );
+    aGrid->SetPoints(aPoints);
+    aGrid->SetCells(aCellTypesArray, aCellLocationsArray,aConnectivity);
 
     aConnectivity->Delete();
     aPoints->Delete();
@@ -1269,18 +1205,16 @@ vtkUnstructuredGrid* SMESHGUI_MeshPatternDlg::getGrid()
     aCellLocationsArray->Delete();
 
     return aGrid;
-  }
-  catch( ... )
-  {
+  } catch (...) {
     return 0;
   }
 }
 
 //=======================================================================
 // name    : onModeToggled
-// Purpose : 
+// Purpose :
 //=======================================================================
-void SMESHGUI_MeshPatternDlg::onModeToggled( bool on )
+void SMESHGUI_MeshPatternDlg::onModeToggled (bool on)
 {
   on ? myRefineGrp->show() : myRefineGrp->hide();
   on ? myGeomGrp->hide()   : myGeomGrp->show();
@@ -1290,7 +1224,7 @@ void SMESHGUI_MeshPatternDlg::onModeToggled( bool on )
 
 //=======================================================================
 // name    : isRefine
-// Purpose : 
+// Purpose :
 //=======================================================================
 bool SMESHGUI_MeshPatternDlg::isRefine() const
 {
@@ -1298,61 +1232,72 @@ bool SMESHGUI_MeshPatternDlg::isRefine() const
 }
 
 //=======================================================================
-//function : onTextChanged
-//purpose  : 
+// name    : onTextChanged
+// Purpose :
 //=======================================================================
-void SMESHGUI_MeshPatternDlg::onTextChanged(const QString& theNewText)
+void SMESHGUI_MeshPatternDlg::onTextChanged (const QString& theNewText)
 {
-  if ( myBusy || !isRefine() )
+  if (myBusy || !isRefine())
     return;
 
   myBusy = true;
 
-  if ( mySelInput != Ids ) {
+  if (mySelInput != Ids) {
     mySelInput = Ids;
     activateSelection();
   }
 
   // hilight entered elements/nodes
   SMDS_Mesh* aMesh = 0;
-  SMESH_Actor* anActor = SMESH::FindActorByObject( myMesh );
-  if ( anActor )
+  SMESH_Actor* anActor = SMESH::FindActorByObject(myMesh);
+  if (anActor)
     aMesh = anActor->GetObject()->GetMesh();
 
-  if ( aMesh ) {
-    mySelection->ClearIObjects();
-    mySelection->AddIObject( anActor->getIO() );
+  if (aMesh) {
+    QStringList aListId = QStringList::split(" ", theNewText, false);
+
+    SALOME_ListIO aList;
+    aList.Append(anActor->getIO());
+    mySelectionMgr->setSelectedObjects(aList, false);
 
-    QStringList aListId = QStringList::split( " ", theNewText, false);
+    TColStd_IndexedMapOfInteger selectedIndices;
+    TColStd_MapOfInteger newIndices;
+    mySelector->GetIndex(anActor->getIO(), selectedIndices);
 
-    for ( int i = 0; i < aListId.count(); i++ ) {
-      const SMDS_MeshElement * e = aMesh->FindElement( aListId[ i ].toInt() );
-      if ( e && e->GetType() == ( myType == Type_2d ? SMDSAbs_Face : SMDSAbs_Volume ) ) {
-       if ( !mySelection->IsIndexSelected( anActor->getIO(), e->GetID() ) )
-         mySelection->AddOrRemoveIndex( anActor->getIO(), e->GetID(), true );
+    for (int i = 0; i < aListId.count(); i++) {
+      const SMDS_MeshElement * e = aMesh->FindElement(aListId[ i ].toInt());
+      if (e && e->GetType() == (myType == Type_2d ? SMDSAbs_Face : SMDSAbs_Volume)) {
+        if (selectedIndices.Add(e->GetID())) {
+          newIndices.Add(e->GetID());
+        }
       }
     }
+    if (newIndices.Extent() > 0)
+    {
+      mySelector->AddOrRemoveIndex( anActor->getIO(), newIndices, true);
+      myViewWindow->highlight( anActor->getIO(), true, true );
+    }
   }
 
   myBusy = false;
 }
 
 //=======================================================================
-//function : onNodeChanged
-//purpose  : 
+// name    : onNodeChanged
+// Purpose :
 //=======================================================================
-void SMESHGUI_MeshPatternDlg::onNodeChanged( int value )
+void SMESHGUI_MeshPatternDlg::onNodeChanged (int value)
 {
-  if ( myType == Type_3d ) {
+  if (myType == Type_3d) {
     QSpinBox* first = (QSpinBox*)sender();
     QSpinBox* second = first == myNode1 ? myNode2 : myNode1;
     int secondVal = second->value();
-    if ( secondVal == value ) {
+    if (secondVal == value) {
       secondVal = value == second->maxValue() ? second->minValue() : value + 1;
       bool blocked = second->signalsBlocked();
-      second->blockSignals( true );
-      second->setValue( secondVal );
-      second->blockSignals( blocked );
+      second->blockSignals(true);
+      second->setValue(secondVal);
+      second->blockSignals(blocked);
     }
   }
 
@@ -1360,30 +1305,29 @@ void SMESHGUI_MeshPatternDlg::onNodeChanged( int value )
 }
 
 //=======================================================================
-//function : getIds
-//purpose  : 
+// name    : getIds
+// Purpose :
 //=======================================================================
-bool SMESHGUI_MeshPatternDlg::getIds( QValueList<int>& ids ) const
+bool SMESHGUI_MeshPatternDlg::getIds (QValueList<int>& ids) const
 {
   ids.clear();
-  QStringList strIds = QStringList::split( " ", mySelEdit[Ids]->text() );
+  QStringList strIds = QStringList::split(" ", mySelEdit[Ids]->text());
   bool isOk;
   int val;
-  for ( QStringList::iterator it = strIds.begin(); it != strIds.end(); ++it ) {
-    val = (*it).toInt( &isOk );
-    if ( isOk )
-      ids.append( val );
+  for (QStringList::iterator it = strIds.begin(); it != strIds.end(); ++it) {
+    val = (*it).toInt(&isOk);
+    if (isOk)
+      ids.append(val);
   }
 
   return ids.count();
 }
 
 //=======================================================================
-//function : getNode1
-//purpose  : 
+// name    : getNode1
+// Purpose :
 //=======================================================================
-int SMESHGUI_MeshPatternDlg::getNode( bool second ) const
+int SMESHGUI_MeshPatternDlg::getNode (bool second) const
 {
   return second ? myNode2->value() - 1 : myNode1->value() - 1;
 }
-
index 26a7332365a116fdc5570cd1975e04a196275412..b1cf5b9d7c6938dbd5df16db257d2ce7633f7606 100755 (executable)
@@ -40,7 +40,7 @@ class QFrame;
 class QLineEdit;
 class SMESHGUI_SpinBox;
 class QPushButton;
-class SALOME_Selection;
+class SalomeApp_SelectionMgr;
 class QRadioButton;
 class QCheckBox;
 class QButtonGroup;
@@ -51,6 +51,9 @@ class SMESHGUI_CreatePatternDlg;
 class SMESHGUI_PatternWidget;
 class vtkUnstructuredGrid;
 class SALOME_Actor;
+class SVTK_ViewWindow;
+class SVTK_Selector;
+class SMESHGUI;
 
 /*
   Class       : SMESHGUI_MeshPatternDlg
@@ -68,12 +71,11 @@ class SMESHGUI_MeshPatternDlg : public QDialog
   enum { Mesh, Object, Vertex1, Vertex2, Ids };
 
 public:
-                                      SMESHGUI_MeshPatternDlg( QWidget*,
-                                                               SALOME_Selection*,
+                                      SMESHGUI_MeshPatternDlg( SMESHGUI*,
                                                                const char* = 0 );
   virtual                             ~SMESHGUI_MeshPatternDlg();
 
-  void                                Init( SALOME_Selection* );
+  void                                Init();
   
 private slots:
 
@@ -145,13 +147,18 @@ private:
   QPushButton*                        myNewBtn;
 
   QCheckBox*                          myReverseChk;
+  QCheckBox*                          myCreatePolygonsChk;
+  QCheckBox*                          myCreatePolyedrsChk;
   SMESHGUI_PatternWidget*             myPicture2d;
   QFrame*                             myPicture3d;
   QLabel*                             myPreview3d;
 
   QCheckBox*                          myPreviewChk;
-    
-  SALOME_Selection*                   mySelection;
+
+  SMESHGUI*                           mySMESHGUI;
+  SVTK_ViewWindow*                    myViewWindow;
+  SVTK_Selector*                      mySelector;
+  SalomeApp_SelectionMgr*             mySelectionMgr;
   int                                 mySelInput;
   int                                 myNbPoints;
   int                                 myType;
@@ -168,20 +175,3 @@ private:
 };
 
 #endif
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
index e163f8095ae925e5aae6975f4cd121daa5f1fd0e..fba4f187f6718e2bb6dc3948a18232e7b27192d8 100644 (file)
@@ -1,23 +1,23 @@
 //  SMESH SMESHGUI : GUI for SMESH component
 //
 //  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
-// 
-//  This library is free software; you can redistribute it and/or 
-//  modify it under the terms of the GNU Lesser General Public 
-//  License as published by the Free Software Foundation; either 
-//  version 2.1 of the License. 
-// 
-//  This library is distributed in the hope that it will be useful, 
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of 
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
-//  Lesser General Public License for more details. 
-// 
-//  You should have received a copy of the GNU Lesser General Public 
-//  License along with this library; if not, write to the Free Software 
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
-// 
-//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
 //
 //
 //
@@ -31,7 +31,6 @@
 #include "SMESHGUI.h"
 #include "SMESHGUI_SpinBox.h"
 #include "SMESHGUI_IdValidator.h"
-
 #include "SMESHGUI_Utils.h"
 #include "SMESHGUI_VTKUtils.h"
 #include "SMESHGUI_MeshUtils.h"
 #include "SMDS_Mesh.hxx"
 #include "SMDS_MeshNode.hxx"
 
-#include "SALOME_Selection.h"
-#include "VTKViewer_ViewFrame.h"
-#include "QAD_Desktop.h"
-#include "QAD_RightFrame.h"
-#include "QAD_MessageBox.h"
+#include "SalomeApp_SelectionMgr.h"
+#include "SUIT_ResourceMgr.h"
+#include "SUIT_Desktop.h"
+
+#include "SVTK_Selector.h"
+#include "SVTK_ViewModel.h"
+#include "SVTK_ViewWindow.h"
+#include "SALOME_ListIO.hxx"
+
+#include "SVTK_ViewWindow.h"
 
 #include "utilities.h"
 
+// OCCT includes
+#include <TColStd_MapOfInteger.hxx>
+
+// VTK includes
 #include <vtkCell.h>
 #include <vtkIdList.h>
 #include <vtkIntArray.h>
@@ -56,6 +64,7 @@
 #include <vtkUnstructuredGrid.h>
 #include <vtkDataSetMapper.h>
 
+// QT includes
 #include <qgroupbox.h>
 #include <qlabel.h>
 #include <qlineedit.h>
 
 
 //=================================================================================
-// class    : SMESHGUI_MoveNodesDlg()
-// purpose  : 
+// name    : SMESHGUI_MoveNodesDlg::SMESHGUI_MoveNodesDlg
+// Purpose :
 //=================================================================================
-SMESHGUI_MoveNodesDlg::SMESHGUI_MoveNodesDlg( QWidget*          theParent,
-                                              SALOME_Selection* theSelection,
-                                              const char*       theName )
-
-: QDialog( theParent, theName, false,
-           WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
+SMESHGUI_MoveNodesDlg::SMESHGUI_MoveNodesDlg (SMESHGUI* theModule, 
+                                             const char* theName):
+  QDialog(SMESH::GetDesktop(theModule), 
+         theName, 
+         false,
+         WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu),
+  mySelector(SMESH::GetViewWindow(theModule)->GetSelector()),
+  mySelectionMgr(SMESH::GetSelectionMgr(theModule)),
+  myViewWindow(SMESH::GetViewWindow(theModule)),
+  mySMESHGUI(theModule)
 {
   myPreviewActor = 0;
   myBusy = false;
-  mySelection = 0;
-  
-  setCaption( tr( "CAPTION" ) );
 
-  QVBoxLayout* aDlgLay = new QVBoxLayout( this, MARGIN, SPACING );
+  setCaption(tr("CAPTION"));
 
-  QFrame* aMainFrame = createMainFrame  ( this );
-  QFrame* aBtnFrame  = createButtonFrame( this );
+  QVBoxLayout* aDlgLay = new QVBoxLayout (this, MARGIN, SPACING);
 
-  aDlgLay->addWidget( aMainFrame );
-  aDlgLay->addWidget( aBtnFrame );
+  QFrame* aMainFrame = createMainFrame  (this);
+  QFrame* aBtnFrame  = createButtonFrame(this);
 
-  aDlgLay->setStretchFactor( aMainFrame, 1 );
+  aDlgLay->addWidget(aMainFrame);
+  aDlgLay->addWidget(aBtnFrame);
 
-  Init( theSelection ) ;
+  aDlgLay->setStretchFactor(aMainFrame, 1);
+
+  Init();
 }
 
 //=======================================================================
 // name    : SMESHGUI_MoveNodesDlg::createButtonFrame
 // Purpose : Create frame containing buttons
 //=======================================================================
-QFrame* SMESHGUI_MoveNodesDlg::createButtonFrame( QWidget* theParent )
+QFrame* SMESHGUI_MoveNodesDlg::createButtonFrame (QWidget* theParent)
 {
-  QFrame* aFrame = new QFrame( theParent );
-  aFrame->setFrameStyle( QFrame::Box | QFrame::Sunken );
+  QFrame* aFrame = new QFrame(theParent);
+  aFrame->setFrameStyle(QFrame::Box | QFrame::Sunken);
 
-  myOkBtn     = new QPushButton( tr( "SMESH_BUT_OK"    ), aFrame );
-  myApplyBtn  = new QPushButton( tr( "SMESH_BUT_APPLY" ), aFrame );
-  myCloseBtn  = new QPushButton( tr( "SMESH_BUT_CLOSE" ), aFrame );
+  myOkBtn     = new QPushButton(tr("SMESH_BUT_OK"   ), aFrame);
+  myApplyBtn  = new QPushButton(tr("SMESH_BUT_APPLY"), aFrame);
+  myCloseBtn  = new QPushButton(tr("SMESH_BUT_CLOSE"), aFrame);
 
-  QSpacerItem* aSpacer = new QSpacerItem( 0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum );
+  QSpacerItem* aSpacer = new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum);
 
-  QHBoxLayout* aLay = new QHBoxLayout( aFrame, MARGIN, SPACING );
+  QHBoxLayout* aLay = new QHBoxLayout(aFrame, MARGIN, SPACING);
 
-  aLay->addWidget( myOkBtn );
-  aLay->addWidget( myApplyBtn );
-  aLay->addItem( aSpacer);
-  aLay->addWidget( myCloseBtn );
+  aLay->addWidget(myOkBtn);
+  aLay->addWidget(myApplyBtn);
+  aLay->addItem(aSpacer);
+  aLay->addWidget(myCloseBtn);
 
-  connect( myOkBtn,    SIGNAL( clicked() ), SLOT( onOk() ) );
-  connect( myCloseBtn, SIGNAL( clicked() ), SLOT( onClose() ) ) ;
-  connect( myApplyBtn, SIGNAL( clicked() ), SLOT( onApply() ) );
+  connect(myOkBtn,    SIGNAL(clicked()), SLOT(onOk()));
+  connect(myCloseBtn, SIGNAL(clicked()), SLOT(onClose()));
+  connect(myApplyBtn, SIGNAL(clicked()), SLOT(onApply()));
 
   return aFrame;
 }
@@ -137,49 +149,47 @@ QFrame* SMESHGUI_MoveNodesDlg::createButtonFrame( QWidget* theParent )
 // name    : SMESHGUI_MoveNodesDlg::createMainFrame
 // Purpose : Create frame containing dialog's input fields
 //=======================================================================
-QFrame* SMESHGUI_MoveNodesDlg::createMainFrame( QWidget* theParent )
+QFrame* SMESHGUI_MoveNodesDlg::createMainFrame (QWidget* theParent)
 {
-  QFrame* aFrame = new QFrame( theParent );
-
-  QPixmap iconMoveNode(
-    QAD_Desktop::getResourceManager()->loadPixmap( "SMESH",tr( "ICON_DLG_MOVE_NODE" ) ) );
-  QPixmap iconSelect(
-    QAD_Desktop::getResourceManager()->loadPixmap( "SMESH",tr( "ICON_SELECT" ) ) );
-
-  QButtonGroup* aPixGrp = new QButtonGroup( 1, Qt::Vertical, tr( "MESH_NODE" ), aFrame );
-  aPixGrp->setExclusive( TRUE );
-  QRadioButton* aRBut = new QRadioButton( aPixGrp );
-  aRBut->setPixmap( iconMoveNode );
-  aRBut->setChecked( TRUE );
-
-  QGroupBox* anIdGrp = new QGroupBox( 1, Qt::Vertical, tr( "SMESH_MOVE" ), aFrame );
-  new QLabel( tr( "NODE_ID" ), anIdGrp );
-  ( new QPushButton( anIdGrp ) )->setPixmap( iconSelect );
-  myId = new QLineEdit( anIdGrp );
-  myId->setValidator( new SMESHGUI_IdValidator( this, "validator", 1 ));
-
-  QGroupBox* aCoordGrp = new QGroupBox( 1, Qt::Vertical, tr( "SMESH_COORDINATES" ), aFrame );
-  new QLabel( tr( "SMESH_X" ), aCoordGrp );
-  myX = new SMESHGUI_SpinBox( aCoordGrp );
-  new QLabel( tr( "SMESH_Y" ), aCoordGrp );
-  myY = new SMESHGUI_SpinBox( aCoordGrp );
-  new QLabel( tr( "SMESH_Z" ), aCoordGrp );
-  myZ = new SMESHGUI_SpinBox( aCoordGrp );
-
-  myX->RangeStepAndValidator( -999999.999, +999999.999, 25.0, 3 );
-  myY->RangeStepAndValidator( -999999.999, +999999.999, 25.0, 3 );
-  myZ->RangeStepAndValidator( -999999.999, +999999.999, 25.0, 3 );  
-
-  QVBoxLayout* aLay = new QVBoxLayout( aFrame );
-  aLay->addWidget( aPixGrp );
-  aLay->addWidget( anIdGrp );
-  aLay->addWidget( aCoordGrp );
+  QFrame* aFrame = new QFrame(theParent);
+
+  QPixmap iconMoveNode (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_DLG_MOVE_NODE")));
+  QPixmap iconSelect   (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_SELECT")));
+
+  QButtonGroup* aPixGrp = new QButtonGroup(1, Qt::Vertical, tr("MESH_NODE"), aFrame);
+  aPixGrp->setExclusive(TRUE);
+  QRadioButton* aRBut = new QRadioButton(aPixGrp);
+  aRBut->setPixmap(iconMoveNode);
+  aRBut->setChecked(TRUE);
+
+  QGroupBox* anIdGrp = new QGroupBox(1, Qt::Vertical, tr("SMESH_MOVE"), aFrame);
+  new QLabel(tr("NODE_ID"), anIdGrp);
+  (new QPushButton(anIdGrp))->setPixmap(iconSelect);
+  myId = new QLineEdit(anIdGrp);
+  myId->setValidator(new SMESHGUI_IdValidator(this, "validator", 1));
+
+  QGroupBox* aCoordGrp = new QGroupBox(1, Qt::Vertical, tr("SMESH_COORDINATES"), aFrame);
+  new QLabel(tr("SMESH_X"), aCoordGrp);
+  myX = new SMESHGUI_SpinBox(aCoordGrp);
+  new QLabel(tr("SMESH_Y"), aCoordGrp);
+  myY = new SMESHGUI_SpinBox(aCoordGrp);
+  new QLabel(tr("SMESH_Z"), aCoordGrp);
+  myZ = new SMESHGUI_SpinBox(aCoordGrp);
+
+  myX->RangeStepAndValidator(-999999.999, +999999.999, 25.0, 3);
+  myY->RangeStepAndValidator(-999999.999, +999999.999, 25.0, 3);
+  myZ->RangeStepAndValidator(-999999.999, +999999.999, 25.0, 3);
+
+  QVBoxLayout* aLay = new QVBoxLayout(aFrame);
+  aLay->addWidget(aPixGrp);
+  aLay->addWidget(anIdGrp);
+  aLay->addWidget(aCoordGrp);
 
   // connect signale and slots
-  connect( myX, SIGNAL ( valueChanged( double) ), this, SLOT( redisplayPreview() ) );
-  connect( myY, SIGNAL ( valueChanged( double) ), this, SLOT( redisplayPreview() ) );
-  connect( myZ, SIGNAL ( valueChanged( double) ), this, SLOT( redisplayPreview() ) );
-  connect( myId, SIGNAL( textChanged(const QString&) ), SLOT( onTextChange(const QString&) ));
+  connect(myX, SIGNAL (valueChanged(double)), this, SLOT(redisplayPreview()));
+  connect(myY, SIGNAL (valueChanged(double)), this, SLOT(redisplayPreview()));
+  connect(myZ, SIGNAL (valueChanged(double)), this, SLOT(redisplayPreview()));
+  connect(myId, SIGNAL(textChanged(const QString&)), SLOT(onTextChange(const QString&)));
 
   return aFrame;
 }
@@ -197,32 +207,31 @@ SMESHGUI_MoveNodesDlg::~SMESHGUI_MoveNodesDlg()
 // name    : SMESHGUI_MoveNodesDlg::Init
 // Purpose : Init dialog fields
 //=======================================================================
-void SMESHGUI_MoveNodesDlg::Init( SALOME_Selection* theSelection )
+void SMESHGUI_MoveNodesDlg::Init()
 {
   myPreviewActor = 0;
   myMeshActor = 0;
   myBusy = false;
-  mySelection = theSelection;
 
-  SMESHGUI* aSMESHGUI = SMESHGUI::GetSMESHGUI();
-  aSMESHGUI->SetActiveDialogBox( ( QDialog* )this ) ;
+  mySMESHGUI->SetActiveDialogBox((QDialog*)this);
 
   // selection and SMESHGUI
-  connect( mySelection, SIGNAL( currentSelectionChanged() ), SLOT( onSelectionDone() ) );
-  connect( aSMESHGUI, SIGNAL( SignalDeactivateActiveDialog() ), SLOT( onDeactivate() ) );
-  connect( aSMESHGUI, SIGNAL( SignalCloseAllDialogs() ), SLOT( onClose() ) );
+  connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), SLOT(onSelectionDone()));
+  connect(mySMESHGUI, SIGNAL(SignalDeactivateActiveDialog()), SLOT(onDeactivate()));
+  connect(mySMESHGUI, SIGNAL(SignalCloseAllDialogs()), SLOT(onClose()));
 
   reset();
-  setEnabled( true );
+  setEnabled(true);
 
-  int x, y ;
-  aSMESHGUI->DefineDlgPosition( this, x, y );
-  this->move( x, y );
+  int x, y;
+  mySMESHGUI->DefineDlgPosition(this, x, y);
+  this->move(x, y);
   this->show();
 
   // set selection mode
   SMESH::SetPointRepresentation(true);
-  QAD_Application::getDesktop()->SetSelectionMode( NodeSelection, true );
+  myViewWindow->SetSelectionMode(NodeSelection);
+
   onSelectionDone();
 }
 
@@ -230,13 +239,12 @@ void SMESHGUI_MoveNodesDlg::Init( SALOME_Selection* theSelection )
 // name    : SMESHGUI_MoveNodesDlg::isValid
 // Purpose : Verify validity of entry information
 //=======================================================================
-bool SMESHGUI_MoveNodesDlg::isValid( const bool theMess ) const
+bool SMESHGUI_MoveNodesDlg::isValid (const bool theMess) const
 {
-  if ( myId->text().isEmpty() )
-  {
-    if ( theMess )
-      QMessageBox::information( SMESHGUI::GetSMESHGUI()->GetDesktop(),
-        tr( "SMESH_WARNING" ), tr( "NODE_ID_IS_NOT_DEFINED" ), QMessageBox::Ok );
+  if (myId->text().isEmpty()) {
+    if (theMess)
+      QMessageBox::information(SMESHGUI::desktop(), tr("SMESH_WARNING"),
+                               tr("NODE_ID_IS_NOT_DEFINED"), QMessageBox::Ok);
     return false;
   }
   return true;
@@ -249,115 +257,108 @@ bool SMESHGUI_MoveNodesDlg::isValid( const bool theMess ) const
 void SMESHGUI_MoveNodesDlg::reset()
 {
   myId->clear();
-  myX->SetValue( 0 );
-  myY->SetValue( 0 );
-  myZ->SetValue( 0 );
+  myX->SetValue(0);
+  myY->SetValue(0);
+  myZ->SetValue(0);
   redisplayPreview();
   updateButtons();
 }
 
 //=======================================================================
-// name    : SMESHGUI_MoveNodesDlg::nApply
+// name    : SMESHGUI_MoveNodesDlg::onApply
 // Purpose : SLOT called when "Apply" button pressed.
 //=======================================================================
 bool SMESHGUI_MoveNodesDlg::onApply()
 {
-  if (SMESHGUI::GetSMESHGUI()->ActiveStudyLocked())
+  if (SMESHGUI::GetSMESHGUI()->isActiveStudyLocked())
     return false;
 
-  if ( !isValid( true ) )
+  if (!isValid(true))
     return false;
 
-  SMESH::SMESH_Mesh_var aMesh = SMESH::GetMeshByIO( myMeshActor->getIO() );
-  if(aMesh->_is_nil() )
-  {
-    QMessageBox::information( SMESHGUI::GetSMESHGUI()->GetDesktop(),
-    tr( "SMESH_ERROR" ), tr( "SMESHG_NO_MESH" ), QMessageBox::Ok );
+  SMESH::SMESH_Mesh_var aMesh = SMESH::GetMeshByIO(myMeshActor->getIO());
+  if (aMesh->_is_nil()) {
+    QMessageBox::information(SMESHGUI::desktop(), tr("SMESH_ERROR"),
+                             tr("SMESHG_NO_MESH"), QMessageBox::Ok);
     return false;
   }
 
   SMESH::SMESH_MeshEditor_var aMeshEditor = aMesh->GetMeshEditor();
-  if ( aMeshEditor->_is_nil() )
+  if (aMeshEditor->_is_nil())
     return false;
 
   int anId = myId->text().toInt();
   bool aResult = false;
-  try
-  {
-    aResult = aMeshEditor->MoveNode( anId, myX->GetValue(), myY->GetValue(), myZ->GetValue() );
-  }
-  catch( ... )
-  {
+  try {
+    aResult = aMeshEditor->MoveNode(anId, myX->GetValue(), myY->GetValue(), myZ->GetValue());
+  } catch (...) {
   }
 
-  if ( aResult )
-  {
-    Handle(SALOME_InteractiveObject) anIO = myMeshActor->getIO();
-    mySelection->ClearIObjects();
+  if (aResult) {
+    SALOME_ListIO aList;
+    aList.Append(myMeshActor->getIO());
+    mySelectionMgr->setSelectedObjects(aList,false);
     SMESH::UpdateView();
-    mySelection->AddIObject( anIO, false );
     reset();
   }
 
   return aResult;
 }
 
-
 //=======================================================================
 // name    : SMESHGUI_MoveNodesDlg::onOk
 // Purpose : SLOT called when "Ok" button pressed.
 //=======================================================================
 void SMESHGUI_MoveNodesDlg::onOk()
 {
-  if ( onApply() )
+  if (onApply())
     onClose();
 }
 
-
 //=======================================================================
 // name    : SMESHGUI_MoveNodesDlg::onClose
 // Purpose : SLOT called when "Close" button pressed. Close dialog
 //=======================================================================
 void SMESHGUI_MoveNodesDlg::onClose()
 {
-  mySelection->ClearIObjects();
+  mySelectionMgr->clearSelected();
   SMESH::SetPointRepresentation(false);
-  QAD_Application::getDesktop()->SetSelectionMode( ActorSelection );
-  disconnect( mySelection, 0, this, 0 );
-  disconnect( SMESHGUI::GetSMESHGUI(), 0, this, 0 );
-  SMESHGUI::GetSMESHGUI()->ResetState();
+  mySelector->SetSelectionMode(ActorSelection);
+  disconnect(mySelectionMgr, 0, this, 0);
+  disconnect(mySMESHGUI, 0, this, 0);
+  mySMESHGUI->ResetState();
   reject();
 }
 
-
-
 //=======================================================================
-//function : onTextChange
-//purpose  : 
+// name    : SMESHGUI_MoveNodesDlg::onTextChange
+// Purpose :
 //=======================================================================
-
-void SMESHGUI_MoveNodesDlg::onTextChange(const QString& theNewText)
+void SMESHGUI_MoveNodesDlg::onTextChange (const QString& theNewText)
 {
-  if ( myBusy ) return;
+  if (myBusy) return;
 
-  myOkBtn->setEnabled( false );
-  myApplyBtn->setEnabled( false );
+  myOkBtn->setEnabled(false);
+  myApplyBtn->setEnabled(false);
   erasePreview();
 
   // select entered node
-  SMDS_Mesh* aMesh = 0;
-  if ( myMeshActor )
-    aMesh = myMeshActor->GetObject()->GetMesh();
-  if ( aMesh ) {
-
-    myBusy = true;
-    mySelection->ClearIObjects();
-    mySelection->AddIObject( myMeshActor->getIO() );
-    myBusy = false;
-
-    const SMDS_MeshElement * e = aMesh->FindElement( theNewText.toInt() );
-    if ( e )
-      mySelection->AddOrRemoveIndex (myMeshActor->getIO(), e->GetID(), true);
+  if(myMeshActor){
+    if(SMDS_Mesh* aMesh = myMeshActor->GetObject()->GetMesh()){
+      myBusy = true;
+      Handle(SALOME_InteractiveObject) anIO = myMeshActor->getIO();
+      SALOME_ListIO aList;
+      aList.Append(anIO);
+      mySelectionMgr->setSelectedObjects(aList,false);
+      myBusy = false;
+
+      if(const SMDS_MeshElement *anElem = aMesh->FindElement(theNewText.toInt())) {
+       TColStd_MapOfInteger aListInd;
+       aListInd.Add(anElem->GetID());
+       mySelector->AddOrRemoveIndex(anIO,aListInd, true);
+       myViewWindow->highlight(anIO,true,true);
+      }
+    }
   }
 }
 
@@ -367,22 +368,25 @@ void SMESHGUI_MoveNodesDlg::onTextChange(const QString& theNewText)
 //=======================================================================
 void SMESHGUI_MoveNodesDlg::onSelectionDone()
 {
-  if ( myBusy ) return;
+  if (myBusy) return;
   myMeshActor = 0;
 
-  if ( mySelection->IObjectCount() == 1 ) {
-    myMeshActor = SMESH::FindActorByEntry(mySelection->firstIObject()->getEntry());
-    if ( myMeshActor )
-    {
+  SALOME_ListIO aList;
+  mySelectionMgr->selectedObjects(aList,SVTK_Viewer::Type());
+
+  if (aList.Extent() == 1) {
+    Handle(SALOME_InteractiveObject) anIO = aList.First();
+    myMeshActor = SMESH::FindActorByEntry(anIO->getEntry());
+    if(myMeshActor){
       QString aText;
-      if ( SMESH::GetNameOfSelectedNodes( mySelection, aText ) == 1 ) {
+      if (SMESH::GetNameOfSelectedNodes(mySelector,anIO,aText) == 1) {
         if(SMDS_Mesh* aMesh = myMeshActor->GetObject()->GetMesh()) {
           if(const SMDS_MeshNode* aNode = aMesh->FindNode(aText.toInt())) {
             myBusy = true;
-            myId->setText( aText );
-            myX->SetValue( aNode->X() );
-            myY->SetValue( aNode->Y() );
-            myZ->SetValue( aNode->Z() );
+            myId->setText(aText);
+            myX->SetValue(aNode->X());
+            myY->SetValue(aNode->Y());
+            myZ->SetValue(aNode->Z());
             myBusy = false;
             erasePreview(); // avoid overlapping of a selection and a preview
             updateButtons();
@@ -396,57 +400,52 @@ void SMESHGUI_MoveNodesDlg::onSelectionDone()
   reset();
 }
 
-
 //=======================================================================
 // name    : SMESHGUI_MoveNodesDlg::onDeactivate
 // Purpose : SLOT called when dialog must be deativated
 //=======================================================================
 void SMESHGUI_MoveNodesDlg::onDeactivate()
 {
-  setEnabled( false );
+  setEnabled(false);
   erasePreview();
 }
 
-
 //=======================================================================
 // name    : SMESHGUI_MoveNodesDlg::enterEvent
 // Purpose : Event filter
 //=======================================================================
-void SMESHGUI_MoveNodesDlg::enterEvent( QEvent* )
+void SMESHGUI_MoveNodesDlg::enterEvent (QEvent*)
 {
-  if ( !isEnabled() )
-  {
+  if (!isEnabled()) {
     SMESHGUI::GetSMESHGUI()->EmitSignalDeactivateDialog();
 
     // set selection mode
     SMESH::SetPointRepresentation(true);
-    QAD_Application::getDesktop()->SetSelectionMode( NodeSelection, true );
+    myViewWindow->SetSelectionMode(NodeSelection);
 
     redisplayPreview();
-  
-    setEnabled( true );
+
+    setEnabled(true);
   }
 }
 
-
-//=================================================================================
-// function : closeEvent()
-// purpose  :
-//=================================================================================
-void SMESHGUI_MoveNodesDlg::closeEvent( QCloseEvent* e )
+//=======================================================================
+// name    : SMESHGUI_MoveNodesDlg::closeEvent
+// Purpose :
+//=======================================================================
+void SMESHGUI_MoveNodesDlg::closeEvent (QCloseEvent*)
 {
-  onClose() ;                  
-  SMESH::GetCurrentVtkView()->Repaint();
+  onClose();
+  myViewWindow->Repaint();
 }
 
 //=======================================================================
-//function : hideEvent
-//purpose  : may be caused by ESC key
+// name    : SMESHGUI_MoveNodesDlg::hideEvent
+// Purpose : may be caused by ESC key
 //=======================================================================
-
-void SMESHGUI_MoveNodesDlg::hideEvent ( QHideEvent * e )
+void SMESHGUI_MoveNodesDlg::hideEvent (QHideEvent*)
 {
-  if ( !isMinimized() )
+  if (!isMinimized())
     onClose();
 }
 
@@ -456,9 +455,9 @@ void SMESHGUI_MoveNodesDlg::hideEvent ( QHideEvent * e )
 //=======================================================================
 void SMESHGUI_MoveNodesDlg::updateButtons()
 {
-  bool isEnabled = isValid( false );
-  myOkBtn->setEnabled( isEnabled );
-  myApplyBtn->setEnabled( isEnabled );
+  bool isEnabled = isValid(false);
+  myOkBtn->setEnabled(isEnabled);
+  myApplyBtn->setEnabled(isEnabled);
 }
 
 //=======================================================================
@@ -467,14 +466,13 @@ void SMESHGUI_MoveNodesDlg::updateButtons()
 //=======================================================================
 void  SMESHGUI_MoveNodesDlg::erasePreview()
 {
-  if ( myPreviewActor == 0 )
+  if (myPreviewActor == 0)
     return;
 
-  if ( VTKViewer_ViewFrame* vf = SMESH::GetCurrentVtkView() )
-    vf->RemoveActor(myPreviewActor);
+  myViewWindow->RemoveActor(myPreviewActor);
   myPreviewActor->Delete();
   myPreviewActor = 0;
-  SMESH::GetCurrentVtkView()->Repaint();
+  myViewWindow->Repaint();
 }
 
 //=======================================================================
@@ -483,73 +481,71 @@ void  SMESHGUI_MoveNodesDlg::erasePreview()
 //=======================================================================
 void SMESHGUI_MoveNodesDlg::redisplayPreview()
 {
-  if ( myBusy )
+  if (myBusy)
     return;
-  
-  if ( myPreviewActor != 0 )
+
+  if (myPreviewActor != 0)
     erasePreview();
-  
-  if ( !isValid( false ) )
+
+  if (!isValid(false))
     return;
 
   vtkUnstructuredGrid* aGrid = vtkUnstructuredGrid::New();
-  
+
   vtkPoints* aPoints = vtkPoints::New();
-  aPoints->SetNumberOfPoints( 1 );
-  aPoints->SetPoint( 0, myX->GetValue(), myY->GetValue(), myZ->GetValue() );
+  aPoints->SetNumberOfPoints(1);
+  aPoints->SetPoint(0, myX->GetValue(), myY->GetValue(), myZ->GetValue());
 
   // Create cells
-  
+
   vtkIdList *anIdList = vtkIdList::New();
-  anIdList->SetNumberOfIds( 1 );
+  anIdList->SetNumberOfIds(1);
 
   vtkCellArray *aCells = vtkCellArray::New();
-  aCells->Allocate( 2, 0 );
+  aCells->Allocate(2, 0);
 
   vtkUnsignedCharArray* aCellTypesArray = vtkUnsignedCharArray::New();
-  aCellTypesArray->SetNumberOfComponents( 1 );
-  aCellTypesArray->Allocate( 1 );
+  aCellTypesArray->SetNumberOfComponents(1);
+  aCellTypesArray->Allocate(1);
 
-  anIdList->SetId( 0, 0 );
-  aCells->InsertNextCell( anIdList );
-  aCellTypesArray->InsertNextValue( VTK_VERTEX );
+  anIdList->SetId(0, 0);
+  aCells->InsertNextCell(anIdList);
+  aCellTypesArray->InsertNextValue(VTK_VERTEX);
+  anIdList->Delete();
 
   vtkIntArray* aCellLocationsArray = vtkIntArray::New();
-  aCellLocationsArray->SetNumberOfComponents( 1 );
-  aCellLocationsArray->SetNumberOfTuples( 1 );
+  aCellLocationsArray->SetNumberOfComponents(1);
+  aCellLocationsArray->SetNumberOfTuples(1);
 
   aCells->InitTraversal();
   vtkIdType npts;
-  aCellLocationsArray->SetValue( 0, aCells->GetTraversalLocation( npts ) );
+  aCellLocationsArray->SetValue(0, aCells->GetTraversalLocation(npts));
 
-  aGrid->SetCells( aCellTypesArray, aCellLocationsArray, aCells );
+  aGrid->SetPoints(aPoints);
+  aPoints->Delete();
 
-  aGrid->SetPoints( aPoints );
-  aGrid->SetCells( aCellTypesArray, aCellLocationsArray,aCells );
+  aGrid->SetCells(aCellTypesArray,aCellLocationsArray,aCells);
+  aCellLocationsArray->Delete();
+  aCellTypesArray->Delete();
+  aCells->Delete();
 
   // Create and display actor
   vtkDataSetMapper* aMapper = vtkDataSetMapper::New();
-  aMapper->SetInput( aGrid );
+  aMapper->SetInput(aGrid);
+  aGrid->Delete();
 
   myPreviewActor = SALOME_Actor::New();
   myPreviewActor->PickableOff();
-  myPreviewActor->SetMapper( aMapper );
+  myPreviewActor->SetMapper(aMapper);
+  aMapper->Delete();
 
   vtkProperty* aProp = vtkProperty::New();
   aProp->SetRepresentationToWireframe();
-  aProp->SetColor( 250, 0, 250 );
-  aProp->SetPointSize( 5 );
-  myPreviewActor->SetProperty( aProp );
-
-  SMESH::GetCurrentVtkView()->AddActor( myPreviewActor );
-  SMESH::GetCurrentVtkView()->Repaint();
-
+  aProp->SetColor(250, 0, 250);
+  aProp->SetPointSize(5);
+  myPreviewActor->SetProperty(aProp);
   aProp->Delete();
-  aCellLocationsArray->Delete();
-  aCellTypesArray->Delete();
-  aCells->Delete();
-  anIdList->Delete(); 
-  aPoints->Delete();
-  aGrid->Delete();
+
+  myViewWindow->AddActor(myPreviewActor);
+  myViewWindow->Repaint();
 }
-  
index c1b18de9cc6cdf53e6dd55115ceb10fe475972b3..4163c542126b0a1eaf5f700a03182b5292fc9793 100644 (file)
 #ifndef DIALOGBOX_MOVE_NODES_H
 #define DIALOGBOX_MOVE_NODES_H
 
+#include "SalomeApp_SelectionMgr.h"
+
 #include <qdialog.h>
-#include "SALOME_Selection.h"
 
 class QLineEdit;
 class QPushButton;
 class SMESHGUI_SpinBox;
 class SALOME_Actor;
 class QFrame;
+
+class SMESHGUI;
 class SMESH_Actor;
+class SUIT_Desktop;
+class SVTK_Selector;
+class SVTK_ViewWindow;
 
 //=================================================================================
 // class    : SMESHGUI_MoveNodesDlg
@@ -49,12 +55,11 @@ class SMESHGUI_MoveNodesDlg : public QDialog
 
 public:
 
-                                SMESHGUI_MoveNodesDlg( QWidget*,
-                                                       SALOME_Selection*,
-                                                       const char* = 0 );
+                                SMESHGUI_MoveNodesDlg(SMESHGUI* theModule,
+                                                     const char* name = 0);
  virtual                        ~SMESHGUI_MoveNodesDlg();
     
- void                           Init( SALOME_Selection* ) ;
+ void                           Init();
 
 private slots:
 
@@ -91,7 +96,10 @@ private:
   SMESHGUI_SpinBox*             myY;
   SMESHGUI_SpinBox*             myZ;
 
-  SALOME_Selection*             mySelection;
+  SalomeApp_SelectionMgr*       mySelectionMgr;
+  SVTK_ViewWindow*              myViewWindow;
+  SVTK_Selector*                mySelector;
+  SMESHGUI*                     mySMESHGUI;
   
   SALOME_Actor*                 myPreviewActor;
   SMESH_Actor*                  myMeshActor;
index d311b490e3900dfd661fbdb8dbd5d9c9d65c6145..f1d9400615dfe7b59ddc690addfe87e30b4f009d 100755 (executable)
@@ -1,23 +1,23 @@
 //  SMESH SMESHGUI : GUI for SMESH component
 //
 //  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
-// 
-//  This library is free software; you can redistribute it and/or 
-//  modify it under the terms of the GNU Lesser General Public 
-//  License as published by the Free Software Foundation; either 
-//  version 2.1 of the License. 
-// 
-//  This library is distributed in the hope that it will be useful, 
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of 
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
-//  Lesser General Public License for more details. 
-// 
-//  You should have received a copy of the GNU Lesser General Public 
-//  License along with this library; if not, write to the Free Software 
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
-// 
-//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
 //
 //
 //
 #include "SMESHGUI_VTKUtils.h"
 #include "SMESHGUI_MeshUtils.h"
 
-#include "QAD_Desktop.h"
-#include "QAD_RightFrame.h"
-
-#include "VTKViewer_ViewFrame.h"
-
 #include "SMESH_Actor.h"
+#include "SMESH_TypeFilter.hxx"
 #include "SMDS_Mesh.hxx"
 #include "SMDS_MeshElement.hxx"
 
-#include "SALOME_Selection.h"
+#include "SUIT_ResourceMgr.h"
+#include "SUIT_Desktop.h"
+
+#include "SalomeApp_SelectionMgr.h"
+#include "SALOME_ListIO.hxx"
 #include "SALOME_ListIteratorOfListIO.hxx"
-#include "VTKViewer_InteractorStyleSALOME.h"
 
+#include "SVTK_Selector.h"
+#include "SVTK_ViewModel.h"
+#include "SVTK_ViewWindow.h"
+#include "SVTK_InteractorStyle.h"
+
+// OCCT Includes
+#include <Precision.hxx>
+#include <TColStd_IndexedMapOfInteger.hxx>
+#include <TColStd_DataMapOfIntegerInteger.hxx>
+#include <TColStd_MapIteratorOfMapOfInteger.hxx>
+
+// VTK Includes
 #include <vtkCell3D.h>
 #include <vtkQuad.h>
 #include <vtkTriangle.h>
+#include <vtkPolygon.h>
+#include <vtkConvexPointSet.h>
 #include <vtkIdList.h>
 #include <vtkIntArray.h>
 #include <vtkCellArray.h>
 #include <vtkUnstructuredGrid.h>
 #include <vtkDataSetMapper.h>
 
-#include <TColStd_IndexedMapOfInteger.hxx>
-#include <TColStd_MapIteratorOfMapOfInteger.hxx>
-#include <Precision.hxx>
-#include <TColStd_DataMapOfIntegerInteger.hxx>
-
+// QT Includes
 #include <qcheckbox.h>
 #include <qframe.h>
 #include <qgroupbox.h>
 #define SPACING 5
 #define MARGIN  10
 
-/*
-  Class       : SMESHGUI_MultiEditDlg
-  Description : Description : Inversion of the diagonal of a pseudo-quadrangle formed by 
-                2 neighboring triangles with 1 common edge
-*/
+/*!
 Class       : SMESHGUI_MultiEditDlg
+ *  Description : Description : Inversion of the diagonal of a pseudo-quadrangle formed by
               2 neighboring triangles with 1 common edge
+ */
 
 //=======================================================================
 // name    : SMESHGUI_MultiEditDlg::SMESHGUI_MultiEditDlg
 // Purpose : Constructor
 //=======================================================================
-SMESHGUI_MultiEditDlg::SMESHGUI_MultiEditDlg( QWidget*              theParent, 
-                                              SALOME_Selection*     theSelection,
-                                              const int             theMode,
-                                             const bool            the3d2d,
-                                              const char*           theName )
-: QDialog( theParent, theName, false, 
-           WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | WDestructiveClose )
+SMESHGUI_MultiEditDlg
+::SMESHGUI_MultiEditDlg(SMESHGUI* theModule,
+                       const int theMode,
+                       const bool the3d2d,
+                       const char* theName):
+  QDialog(SMESH::GetDesktop(theModule), 
+         theName, 
+         false, 
+         WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | WDestructiveClose),
+    mySelector(SMESH::GetViewWindow(theModule)->GetSelector()),
+    mySelectionMgr(SMESH::GetSelectionMgr(theModule)),
+    myViewWindow(SMESH::GetViewWindow(theModule)),
+    mySMESHGUI(theModule)
 {
   myFilterDlg = 0;
-  mySubmeshFilter = new SMESH_TypeFilter( SUBMESH );
-  myGroupFilter = new SMESH_TypeFilter( GROUP );
-
   myEntityType = 0;
 
   myFilterType = theMode;
-  QVBoxLayout* aDlgLay = new QVBoxLayout( this, MARGIN, SPACING );
+  QVBoxLayout* aDlgLay = new QVBoxLayout(this, MARGIN, SPACING);
 
-  QFrame* aMainFrame = createMainFrame  ( this, the3d2d );
-  QFrame* aBtnFrame  = createButtonFrame( this );
+  QFrame* aMainFrame = createMainFrame  (this, the3d2d);
+  QFrame* aBtnFrame  = createButtonFrame(this);
 
-  aDlgLay->addWidget( aMainFrame );
-  aDlgLay->addWidget( aBtnFrame );
+  aDlgLay->addWidget(aMainFrame);
+  aDlgLay->addWidget(aBtnFrame);
 
-  aDlgLay->setStretchFactor( aMainFrame, 1 );
-  aDlgLay->setStretchFactor( aBtnFrame, 0 );
-  Init( theSelection ) ;
+  aDlgLay->setStretchFactor(aMainFrame, 1);
+  aDlgLay->setStretchFactor(aBtnFrame, 0);
+  Init();
 }
 
 //=======================================================================
 // name    : SMESHGUI_MultiEditDlg::createMainFrame
 // Purpose : Create frame containing dialog's input fields
 //=======================================================================
-QFrame* SMESHGUI_MultiEditDlg::createMainFrame( QWidget* theParent, const bool the3d2d )
+QFrame* SMESHGUI_MultiEditDlg::createMainFrame (QWidget* theParent, const bool the3d2d)
 {
-  QGroupBox* aMainGrp = new QGroupBox( 1, Qt::Horizontal, theParent );
-  aMainGrp->setFrameStyle( QFrame::NoFrame );
-  aMainGrp->setInsideMargin( 0 );
+  QGroupBox* aMainGrp = new QGroupBox(1, Qt::Horizontal, theParent);
+  aMainGrp->setFrameStyle(QFrame::NoFrame);
+  aMainGrp->setInsideMargin(0);
+
+  QPixmap aPix (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_SELECT")));
 
-  QPixmap aPix( QAD_Desktop::getResourceManager()->loadPixmap( "SMESH",tr( "ICON_SELECT" ) ) );
-  
   // "Selected cells" group
-  mySelGrp = new QGroupBox( 1, Qt::Horizontal,  aMainGrp );
+  mySelGrp = new QGroupBox(1, Qt::Horizontal,  aMainGrp);
 
   myEntityTypeGrp = 0;
-  if ( the3d2d ) {
-    myEntityTypeGrp = new QHButtonGroup( tr("SMESH_ELEMENTS_TYPE"), mySelGrp );
-    (new QRadioButton( tr("SMESH_FACE"),   myEntityTypeGrp ))->setChecked( true );
-    (new QRadioButton( tr("SMESH_VOLUME"), myEntityTypeGrp ));
-    myEntityType = myEntityTypeGrp->id( myEntityTypeGrp->selected() );
+  if (the3d2d) {
+    myEntityTypeGrp = new QHButtonGroup(tr("SMESH_ELEMENTS_TYPE"), mySelGrp);
+    (new QRadioButton(tr("SMESH_FACE"),   myEntityTypeGrp))->setChecked(true);
+    (new QRadioButton(tr("SMESH_VOLUME"), myEntityTypeGrp));
+    myEntityType = myEntityTypeGrp->id(myEntityTypeGrp->selected());
   }
 
-  QFrame* aFrame = new QFrame( mySelGrp );
-  
-  myListBox = new QListBox( aFrame );
-  myListBox->setSelectionMode( QListBox::Extended );
-  myListBox->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding) );
-//  myListBox->setColumnMode( QListBox::FitToHeight );
-  myListBox->installEventFilter( this );
-  
-  myFilterBtn = new QPushButton( tr( "FILTER" )   , aFrame );
-  myAddBtn    = new QPushButton( tr( "ADD" )      , aFrame );
-  myRemoveBtn = new QPushButton( tr( "REMOVE" )   , aFrame );
-  mySortBtn   = new QPushButton( tr( "SORT_LIST" ), aFrame );
-
-  QGridLayout* aLay = new QGridLayout( aFrame, 5, 2, 0, 5 );
-  aLay->addMultiCellWidget( myListBox, 0, 4, 0, 0 );
-  aLay->addWidget( myFilterBtn, 0, 1 );
-  aLay->addWidget( myAddBtn, 1, 1 );
-  aLay->addWidget( myRemoveBtn, 2, 1 );
-  aLay->addWidget( mySortBtn, 3, 1 );
-  
-  QSpacerItem* aSpacer = new QSpacerItem( 0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding );
-  aLay->addItem( aSpacer, 4, 1 );
-  
-  myToAllChk = new QCheckBox( tr( "TO_ALL" ), mySelGrp );
+  QFrame* aFrame = new QFrame(mySelGrp);
+
+  myListBox = new QListBox(aFrame);
+  myListBox->setSelectionMode(QListBox::Extended);
+  myListBox->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding));
+//  myListBox->setColumnMode(QListBox::FitToHeight);
+  myListBox->installEventFilter(this);
+
+  myFilterBtn = new QPushButton(tr("FILTER")   , aFrame);
+  myAddBtn    = new QPushButton(tr("ADD")      , aFrame);
+  myRemoveBtn = new QPushButton(tr("REMOVE")   , aFrame);
+  mySortBtn   = new QPushButton(tr("SORT_LIST"), aFrame);
+
+  QGridLayout* aLay = new QGridLayout(aFrame, 5, 2, 0, 5);
+  aLay->addMultiCellWidget(myListBox, 0, 4, 0, 0);
+  aLay->addWidget(myFilterBtn, 0, 1);
+  aLay->addWidget(myAddBtn, 1, 1);
+  aLay->addWidget(myRemoveBtn, 2, 1);
+  aLay->addWidget(mySortBtn, 3, 1);
+
+  QSpacerItem* aSpacer = new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding);
+  aLay->addItem(aSpacer, 4, 1);
+
+  myToAllChk = new QCheckBox(tr("TO_ALL"), mySelGrp);
 
   // "Select from" group
-  QGroupBox* aGrp = new QGroupBox( 3, Qt::Horizontal, tr( "SELECT_FROM" ), aMainGrp );
-  
-  mySubmeshChk = new QCheckBox( tr( "SMESH_SUBMESH" ), aGrp );
-  mySubmeshBtn = new QPushButton( aGrp );
-  mySubmesh = new QLineEdit( aGrp );
-  mySubmesh->setReadOnly( true );
-  mySubmeshBtn->setPixmap( aPix );
-  
-  myGroupChk = new QCheckBox( tr( "GROUP" ), aGrp );
-  myGroupBtn = new QPushButton( aGrp );
-  myGroup = new QLineEdit( aGrp );
-  myGroup->setReadOnly( true );
-  myGroupBtn->setPixmap( aPix );
+  QGroupBox* aGrp = new QGroupBox(3, Qt::Horizontal, tr("SELECT_FROM"), aMainGrp);
+
+  mySubmeshChk = new QCheckBox(tr("SMESH_SUBMESH"), aGrp);
+  mySubmeshBtn = new QPushButton(aGrp);
+  mySubmesh = new QLineEdit(aGrp);
+  mySubmesh->setReadOnly(true);
+  mySubmeshBtn->setPixmap(aPix);
+
+  myGroupChk = new QCheckBox(tr("GROUP"), aGrp);
+  myGroupBtn = new QPushButton(aGrp);
+  myGroup = new QLineEdit(aGrp);
+  myGroup->setReadOnly(true);
+  myGroupBtn->setPixmap(aPix);
 
   return aMainGrp;
 }
@@ -189,23 +201,23 @@ QFrame* SMESHGUI_MultiEditDlg::createMainFrame( QWidget* theParent, const bool t
 // name    : SMESHGUI_MultiEditDlg::createButtonFrame
 // Purpose : Create frame containing buttons
 //=======================================================================
-QFrame* SMESHGUI_MultiEditDlg::createButtonFrame( QWidget* theParent )
+QFrame* SMESHGUI_MultiEditDlg::createButtonFrame (QWidget* theParent)
 {
-  QFrame* aFrame = new QFrame( theParent );
-  aFrame->setFrameStyle( QFrame::Box | QFrame::Sunken );
+  QFrame* aFrame = new QFrame (theParent);
+  aFrame->setFrameStyle(QFrame::Box | QFrame::Sunken);
 
-  myOkBtn     = new QPushButton( tr( "SMESH_BUT_OK"    ), aFrame );
-  myApplyBtn  = new QPushButton( tr( "SMESH_BUT_APPLY" ), aFrame );
-  myCloseBtn  = new QPushButton( tr( "SMESH_BUT_CLOSE" ), aFrame );
+  myOkBtn     = new QPushButton (tr("SMESH_BUT_OK"   ), aFrame);
+  myApplyBtn  = new QPushButton (tr("SMESH_BUT_APPLY"), aFrame);
+  myCloseBtn  = new QPushButton (tr("SMESH_BUT_CLOSE"), aFrame);
 
-  QSpacerItem* aSpacer = new QSpacerItem( 0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum );
+  QSpacerItem* aSpacer = new QSpacerItem (0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum);
 
-  QHBoxLayout* aLay = new QHBoxLayout( aFrame, MARGIN, SPACING );
+  QHBoxLayout* aLay = new QHBoxLayout (aFrame, MARGIN, SPACING);
 
-  aLay->addWidget( myOkBtn );
-  aLay->addWidget( myApplyBtn );
-  aLay->addItem( aSpacer);
-  aLay->addWidget( myCloseBtn );
+  aLay->addWidget(myOkBtn);
+  aLay->addWidget(myApplyBtn);
+  aLay->addItem(aSpacer);
+  aLay->addWidget(myCloseBtn);
 
   return aFrame;
 }
@@ -214,7 +226,7 @@ QFrame* SMESHGUI_MultiEditDlg::createButtonFrame( QWidget* theParent )
 // name    : SMESHGUI_MultiEditDlg::isValid
 // Purpose : Verify validity of input data
 //=======================================================================
-bool SMESHGUI_MultiEditDlg::isValid( const bool /*theMess*/ ) const
+bool SMESHGUI_MultiEditDlg::isValid (const bool /*theMess*/) const
 {
   return (!myMesh->_is_nil() &&
           (myListBox->count() > 0 || (myToAllChk->isChecked() && myActor)));
@@ -226,9 +238,9 @@ bool SMESHGUI_MultiEditDlg::isValid( const bool /*theMess*/ ) const
 //=======================================================================
 SMESHGUI_MultiEditDlg::~SMESHGUI_MultiEditDlg()
 {
-  if ( myFilterDlg != 0 )
+  if (myFilterDlg != 0)
   {
-    myFilterDlg->reparent( 0, QPoint() );
+    myFilterDlg->reparent(0, QPoint());
     delete myFilterDlg;
   }
 }
@@ -237,25 +249,23 @@ SMESHGUI_MultiEditDlg::~SMESHGUI_MultiEditDlg()
 // name    : SMESHGUI_MultiEditDlg::eventFilter
 // Purpose : event filter
 //=======================================================================
-bool SMESHGUI_MultiEditDlg::eventFilter( QObject* object, QEvent* event )
+bool SMESHGUI_MultiEditDlg::eventFilter (QObject* object, QEvent* event)
 {
-  if ( object == myListBox && event->type() == QEvent::KeyPress ) {
+  if (object == myListBox && event->type() == QEvent::KeyPress) {
     QKeyEvent* ke = (QKeyEvent*)event;
-    if ( ke->key() == Key_Delete )
+    if (ke->key() == Key_Delete)
       onRemoveBtn();
   }
-  return QDialog::eventFilter( object, event );
+  return QDialog::eventFilter(object, event);
 }
 
 //=======================================================================
 // name    : SMESHGUI_MultiEditDlg::Init
 // Purpose : Init dialog fields, connect signals and slots, show dialog
 //=======================================================================
-void SMESHGUI_MultiEditDlg::Init( SALOME_Selection* theSelection )
+void SMESHGUI_MultiEditDlg::Init()
 {
-  SMESHGUI* aSMESHGUI = SMESHGUI::GetSMESHGUI();
-  mySelection = theSelection;
-  aSMESHGUI->SetActiveDialogBox( ( QDialog* )this ) ;
+  mySMESHGUI->SetActiveDialogBox((QDialog*)this);
   myListBox->clear();
   myIds.Clear();
   myBusy = false;
@@ -263,29 +273,29 @@ void SMESHGUI_MultiEditDlg::Init( SALOME_Selection* theSelection )
   emit ListContensChanged();
 
   // main buttons
-  connect( myOkBtn,    SIGNAL( clicked() ), SLOT( onOk() ) );
-  connect( myCloseBtn, SIGNAL( clicked() ), SLOT( onClose() ) ) ;
-  connect( myApplyBtn, SIGNAL( clicked() ), SLOT( onApply() ) );
+  connect(myOkBtn,    SIGNAL(clicked()), SLOT(onOk()));
+  connect(myCloseBtn, SIGNAL(clicked()), SLOT(onClose()));
+  connect(myApplyBtn, SIGNAL(clicked()), SLOT(onApply()));
 
   // selection and SMESHGUI
-  connect( mySelection, SIGNAL( currentSelectionChanged() ), SLOT( onSelectionDone() ) );
-  connect( aSMESHGUI, SIGNAL( SignalDeactivateActiveDialog() ), SLOT( onDeactivate() ) );
-  connect( aSMESHGUI, SIGNAL( SignalCloseAllDialogs() ), SLOT( onClose() ) );
+  connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), SLOT(onSelectionDone()));
+  connect(mySMESHGUI, SIGNAL(SignalDeactivateActiveDialog()), SLOT(onDeactivate()));
+  connect(mySMESHGUI, SIGNAL(SignalCloseAllDialogs()), SLOT(onClose()));
 
   // dialog controls
-  connect( myFilterBtn, SIGNAL( clicked() ), SLOT( onFilterBtn()   ) );
-  connect( myAddBtn   , SIGNAL( clicked() ), SLOT( onAddBtn()      ) );
-  connect( myRemoveBtn, SIGNAL( clicked() ), SLOT( onRemoveBtn()   ) );
-  connect( mySortBtn  , SIGNAL( clicked() ), SLOT( onSortListBtn() ) );
-  
-  connect( mySubmeshChk, SIGNAL( stateChanged( int ) ), SLOT( onSubmeshChk() ) );
-  connect( myGroupChk  , SIGNAL( stateChanged( int ) ), SLOT( onGroupChk()   ) );
-  connect( myToAllChk  , SIGNAL( stateChanged( int ) ), SLOT( onToAllChk()   ) );
+  connect(myFilterBtn, SIGNAL(clicked()), SLOT(onFilterBtn()  ));
+  connect(myAddBtn   , SIGNAL(clicked()), SLOT(onAddBtn()     ));
+  connect(myRemoveBtn, SIGNAL(clicked()), SLOT(onRemoveBtn()  ));
+  connect(mySortBtn  , SIGNAL(clicked()), SLOT(onSortListBtn()));
 
-  if ( myEntityTypeGrp )
-    connect( myEntityTypeGrp, SIGNAL( clicked(int) ), SLOT( on3d2dChanged(int) ) );
+  connect(mySubmeshChk, SIGNAL(stateChanged(int)), SLOT(onSubmeshChk()));
+  connect(myGroupChk  , SIGNAL(stateChanged(int)), SLOT(onGroupChk()  ));
+  connect(myToAllChk  , SIGNAL(stateChanged(int)), SLOT(onToAllChk()  ));
 
-  connect( myListBox, SIGNAL( selectionChanged() ), SLOT( onListSelectionChanged() ) );
+  if (myEntityTypeGrp)
+    connect(myEntityTypeGrp, SIGNAL(clicked(int)), SLOT(on3d2dChanged(int)));
+
+  connect(myListBox, SIGNAL(selectionChanged()), SLOT(onListSelectionChanged()));
 
   onSelectionDone();
 
@@ -296,12 +306,12 @@ void SMESHGUI_MultiEditDlg::Init( SALOME_Selection* theSelection )
 
 //=======================================================================
 // name    : SMESHGUI_MultiEditDlg::onOk
-// Purpose : SLOT called when "Ok" button pressed. 
+// Purpose : SLOT called when "Ok" button pressed.
 //           Assign filters VTK viewer and close dialog
 //=======================================================================
 void SMESHGUI_MultiEditDlg::onOk()
 {
-  if ( onApply() )
+  if (onApply())
     onClose();
 }
 
@@ -312,35 +322,34 @@ void SMESHGUI_MultiEditDlg::onOk()
 SMESH::long_array_var SMESHGUI_MultiEditDlg::getIds()
 {
   SMESH::long_array_var anIds = new SMESH::long_array;
-  
-  if ( myToAllChk->isChecked() )
+
+  if (myToAllChk->isChecked())
   {
     myIds.Clear();
-    SMESH_Actor * anActor = SMESH::FindActorByObject( myMesh );
-    if ( !anActor )
+    SMESH_Actor * anActor = SMESH::FindActorByObject(myMesh);
+    if (!anActor)
       anActor = myActor;
-    if ( anActor != 0 )
+    if (anActor != 0)
     {
       TVisualObjPtr aVisualObj = anActor->GetObject();
       vtkUnstructuredGrid* aGrid = aVisualObj->GetUnstructuredGrid();
-      if ( aGrid != 0 )
-      {
-        for ( int i = 0, n = aGrid->GetNumberOfCells(); i < n; i++ )
-        {
-          vtkCell* aCell = aGrid->GetCell( i );
-          if ( aCell != 0 )
-          {
+      if (aGrid != 0) {
+        for (int i = 0, n = aGrid->GetNumberOfCells(); i < n; i++) {
+          vtkCell* aCell = aGrid->GetCell(i);
+          if (aCell != 0) {
            vtkTriangle* aTri = vtkTriangle::SafeDownCast(aCell);
            vtkQuad*     aQua = vtkQuad::SafeDownCast(aCell);
-           vtkCell3D*   a3d  = vtkCell3D::SafeDownCast(aCell);
+           vtkPolygon*  aPG  = vtkPolygon::SafeDownCast(aCell);
 
-           if ( aTri && myFilterType == SMESHGUI_TriaFilter || 
-                aQua && myFilterType == SMESHGUI_QuadFilter ||
-                ( aTri || aQua ) && myFilterType == SMESHGUI_FaceFilter ||
-                a3d && myFilterType == SMESHGUI_VolumeFilter )
-            {
-              int anObjId = aVisualObj->GetElemObjId( i );
-              myIds.Add( anObjId );
+           vtkCell3D*   a3d  = vtkCell3D::SafeDownCast(aCell);
+           vtkConvexPointSet* aPH = vtkConvexPointSet::SafeDownCast(aCell);
+
+           if (aTri && myFilterType == SMESHGUI_TriaFilter ||
+                aQua && myFilterType == SMESHGUI_QuadFilter ||
+                (aTri || aQua || aPG) && myFilterType == SMESHGUI_FaceFilter ||
+                (a3d || aPH) && myFilterType == SMESHGUI_VolumeFilter) {
+              int anObjId = aVisualObj->GetElemObjId(i);
+              myIds.Add(anObjId);
             }
           }
         }
@@ -348,9 +357,9 @@ SMESH::long_array_var SMESHGUI_MultiEditDlg::getIds()
     }
   }
 
-  anIds->length( myIds.Extent() );
-  TColStd_MapIteratorOfMapOfInteger anIter( myIds );
-  for ( int i = 0; anIter.More(); anIter.Next()  )
+  anIds->length(myIds.Extent());
+  TColStd_MapIteratorOfMapOfInteger anIter(myIds);
+  for (int i = 0; anIter.More(); anIter.Next() )
   {
     anIds[ i++ ] = anIter.Key();
   }
@@ -363,17 +372,17 @@ SMESH::long_array_var SMESHGUI_MultiEditDlg::getIds()
 //=======================================================================
 void SMESHGUI_MultiEditDlg::onClose()
 {
-  QAD_Application::getDesktop()->SetSelectionMode( ActorSelection );
-  disconnect( mySelection, 0, this, 0 );
-  disconnect( SMESHGUI::GetSMESHGUI(), 0, this, 0 );
-  SMESHGUI::GetSMESHGUI()->ResetState();
-  
+  myViewWindow->SetSelectionMode(ActorSelection);
+  disconnect(mySelectionMgr, 0, this, 0);
+  disconnect(mySMESHGUI, 0, this, 0);
+  mySMESHGUI->ResetState();
+
   SMESH::RemoveFilters();
   SMESH::SetPickable();
 
-  mySelection->ClearIObjects();
-  mySelection->ClearFilters();
-  
+  mySelectionMgr->clearSelected();
+  mySelectionMgr->clearFilters();
+
   reject();
 }
 
@@ -383,73 +392,62 @@ void SMESHGUI_MultiEditDlg::onClose()
 //=======================================================================
 void SMESHGUI_MultiEditDlg::onSelectionDone()
 {
-  if ( myBusy || !isEnabled() ) return;
+  if (myBusy || !isEnabled()) return;
   myBusy = true;
 
-  int nbSel = mySelection->IObjectCount();
+  const SALOME_ListIO& aList = mySelector->StoredIObjects();
+
+  int nbSel = aList.Extent();
   myListBox->clearSelection();
 
-  if ( mySubmeshChk->isChecked() || myGroupChk->isChecked() )
-  {
+  if (mySubmeshChk->isChecked() || myGroupChk->isChecked()) {
     QLineEdit* aNameEdit = mySubmeshChk->isChecked() ? mySubmesh : myGroup;
-    int nbSel = mySelection->IObjectCount();
-    if ( nbSel == 1 )
-    {
-      Handle(SALOME_InteractiveObject) anIO = mySelection->firstIObject();
-      anIO.IsNull() ? aNameEdit->clear() : aNameEdit->setText( anIO->getName() );
+    if (nbSel == 1) {
+      Handle(SALOME_InteractiveObject) anIO = aList.First();
+      anIO.IsNull() ? aNameEdit->clear() : aNameEdit->setText(anIO->getName());
 
-      if ( mySubmeshChk->isChecked() )
-      {
+      if (mySubmeshChk->isChecked()) {
         SMESH::SMESH_subMesh_var aSubMesh =
-          SMESH::IObjectToInterface<SMESH::SMESH_subMesh>( anIO );
-        if ( !aSubMesh->_is_nil() )
+          SMESH::IObjectToInterface<SMESH::SMESH_subMesh>(anIO);
+        if (!aSubMesh->_is_nil())
           myMesh = aSubMesh->GetFather();
-      }
-      else
-      {
+      } else {
         SMESH::SMESH_GroupBase_var aGroup =
-          SMESH::IObjectToInterface<SMESH::SMESH_GroupBase>( anIO );
-        if ( !aGroup->_is_nil() )
+          SMESH::IObjectToInterface<SMESH::SMESH_GroupBase>(anIO);
+        if (!aGroup->_is_nil())
           myMesh = aGroup->GetMesh();
       }
-    }
-    else if ( nbSel > 1 )
-    {
-      QString aStr = mySubmeshChk->isChecked() ? 
-        tr( "SMESH_SUBMESH_SELECTED" ) : tr( "SMESH_GROUP_SELECTED" );
-      aNameEdit->setText( aStr.arg( nbSel ) );
-    }
-    else
+    } else if (nbSel > 1) {
+      QString aStr = mySubmeshChk->isChecked() ?
+        tr("SMESH_SUBMESH_SELECTED") : tr("SMESH_GROUP_SELECTED");
+      aNameEdit->setText(aStr.arg(nbSel));
+    } else {
       aNameEdit->clear();
-  }
-  else if ( nbSel == 1 )
-  {
+    }
+  } else if (nbSel == 1) {
     QString aListStr = "";
-    int aNbItems = SMESH::GetNameOfSelectedElements(mySelection, aListStr);
-    if ( aNbItems > 0 )
-    {
+    Handle(SALOME_InteractiveObject) anIO = aList.First();
+    int aNbItems = SMESH::GetNameOfSelectedElements(mySelector,anIO,aListStr);
+    if (aNbItems > 0) {
       QStringList anElements = QStringList::split(" ", aListStr);
       QListBoxItem* anItem = 0;
-      for ( QStringList::iterator it = anElements.begin(); it != anElements.end(); ++it)
-      {
-        anItem = myListBox->findItem( *it, Qt::ExactMatch );
-        if (anItem) myListBox->setSelected( anItem, true );
+      for (QStringList::iterator it = anElements.begin(); it != anElements.end(); ++it) {
+        anItem = myListBox->findItem(*it, Qt::ExactMatch);
+        if (anItem) myListBox->setSelected(anItem, true);
       }
     }
 
-    myMesh = SMESH::GetMeshByIO( mySelection->firstIObject() );
+    myMesh = SMESH::GetMeshByIO(anIO);
   }
 
-  if ( nbSel == 1 ) {
-    myActor = SMESH::FindActorByEntry(mySelection->firstIObject()->getEntry());
+  if (nbSel == 1) {
+    myActor = SMESH::FindActorByEntry(aList.First()->getEntry());
     if (!myActor)
-      myActor = SMESH::FindActorByObject( myMesh );
-    VTKViewer_InteractorStyleSALOME* aStyle = SMESH::GetInteractorStyle();
-    Handle(VTKViewer_Filter) aFilter = aStyle->GetFilter( myFilterType );
-    if ( !aFilter.IsNull() )
-      aFilter->SetActor( myActor );
-//if ( myActor )
-//    SMESH::SetPickable(myActor);
+      myActor = SMESH::FindActorByObject(myMesh);
+    SVTK_InteractorStyle* aStyle = SMESH::GetInteractorStyle();
+    Handle(VTKViewer_Filter) aFilter = aStyle->GetFilter(myFilterType);
+    if (!aFilter.IsNull())
+      aFilter->SetActor(myActor);
   }
   myBusy = false;
 
@@ -462,39 +460,37 @@ void SMESHGUI_MultiEditDlg::onSelectionDone()
 //=======================================================================
 void SMESHGUI_MultiEditDlg::onDeactivate()
 {
-  setEnabled( false );
+  setEnabled(false);
 }
 
 //=======================================================================
 // name    : SMESHGUI_MultiEditDlg::enterEvent
 // Purpose : Event filter
 //=======================================================================
-void SMESHGUI_MultiEditDlg::enterEvent( QEvent* )
+void SMESHGUI_MultiEditDlg::enterEvent (QEvent*)
 {
-  if ( !isEnabled() ) {
-    SMESHGUI::GetSMESHGUI()->EmitSignalDeactivateDialog();
-    setEnabled( true );
+  if (!isEnabled()) {
+    mySMESHGUI->EmitSignalDeactivateDialog();
+    setEnabled(true);
     setSelectionMode();
   }
 }
 
-
-//=================================================================================
-// function : closeEvent()
-// purpose  :
-//=================================================================================
-void SMESHGUI_MultiEditDlg::closeEvent( QCloseEvent* e )
+//=======================================================================
+// name    : SMESHGUI_MultiEditDlg::closeEvent
+// Purpose :
+//=======================================================================
+void SMESHGUI_MultiEditDlg::closeEvent (QCloseEvent*)
 {
-  onClose() ;
+  onClose();
 }
 //=======================================================================
-//function : hideEvent
-//purpose  : caused by ESC key
+// name    : SMESHGUI_MultiEditDlg::hideEvent
+// Purpose : caused by ESC key
 //=======================================================================
-
-void SMESHGUI_MultiEditDlg::hideEvent ( QHideEvent * e )
+void SMESHGUI_MultiEditDlg::hideEvent (QHideEvent*)
 {
-  if ( !isMinimized() )
+  if (!isMinimized())
     onClose();
 }
 
@@ -505,42 +501,40 @@ void SMESHGUI_MultiEditDlg::hideEvent ( QHideEvent * e )
 //=======================================================================
 void SMESHGUI_MultiEditDlg::onFilterBtn()
 {
-  if ( myFilterDlg == 0 )
-  {
-    myFilterDlg = new SMESHGUI_FilterDlg( (QWidget*)parent(), entityType() ? SMESH::VOLUME : SMESH::FACE );
-    connect( myFilterDlg, SIGNAL( Accepted() ), SLOT( onFilterAccepted() ) );
+  if (myFilterDlg == 0) {
+    myFilterDlg = new SMESHGUI_FilterDlg( mySMESHGUI, entityType() ? SMESH::VOLUME : SMESH::FACE);
+    connect(myFilterDlg, SIGNAL(Accepted()), SLOT(onFilterAccepted()));
+  } else {
+    myFilterDlg->Init(entityType() ? SMESH::VOLUME : SMESH::FACE);
   }
-  else
-    myFilterDlg->Init( entityType() ? SMESH::VOLUME : SMESH::FACE );
 
-  myFilterDlg->SetSelection( mySelection );
-  myFilterDlg->SetMesh( myMesh );
-  myFilterDlg->SetSourceWg( myListBox );
+  myFilterDlg->SetSelection();
+  myFilterDlg->SetMesh(myMesh);
+  myFilterDlg->SetSourceWg(myListBox);
 
   myFilterDlg->show();
 }
 
-//=================================================================================
-// function : onFilterAccepted()
-// purpose  : SLOT. Called when Filter dlg closed with OK button.
+//=======================================================================
+// name    : onFilterAccepted()
+// Purpose : SLOT. Called when Filter dlg closed with OK button.
 //            Uncheck "Select submesh" and "Select group" checkboxes
-//=================================================================================
+//=======================================================================
 void SMESHGUI_MultiEditDlg::onFilterAccepted()
 {
   myIds.Clear();
-  for ( int i = 0, n = myListBox->count(); i < n; i++ )
-    myIds.Add( myListBox->text( i ).toInt() );
+  for (int i = 0, n = myListBox->count(); i < n; i++)
+    myIds.Add(myListBox->text(i).toInt());
 
   emit ListContensChanged();
 
-  if ( mySubmeshChk->isChecked() || myGroupChk->isChecked() )
-  {
-    mySubmeshChk->blockSignals( true );
-    myGroupChk->blockSignals( true );
-    mySubmeshChk->setChecked( false );
-    myGroupChk->setChecked( false );
-    mySubmeshChk->blockSignals( false );
-    myGroupChk->blockSignals( false );
+  if (mySubmeshChk->isChecked() || myGroupChk->isChecked()) {
+    mySubmeshChk->blockSignals(true);
+    myGroupChk->blockSignals(true);
+    mySubmeshChk->setChecked(false);
+    myGroupChk->setChecked(false);
+    mySubmeshChk->blockSignals(false);
+    myGroupChk->blockSignals(false);
   }
   updateButtons();
 }
@@ -549,13 +543,13 @@ void SMESHGUI_MultiEditDlg::onFilterAccepted()
 // name    : SMESHGUI_MultiEditDlg::isIdValid
 // Purpose : Verify whether Id of element satisfies to filters from viewer
 //=======================================================================
-bool SMESHGUI_MultiEditDlg::isIdValid( const int theId ) const
+bool SMESHGUI_MultiEditDlg::isIdValid (const int theId) const
 {
-  VTKViewer_InteractorStyleSALOME* aStyle = SMESH::GetInteractorStyle();
+  SVTK_InteractorStyle* aStyle = SMESH::GetInteractorStyle();
   Handle(SMESHGUI_Filter) aFilter =
-    Handle(SMESHGUI_Filter)::DownCast( aStyle->GetFilter( myFilterType ) );
+    Handle(SMESHGUI_Filter)::DownCast(aStyle->GetFilter(myFilterType));
 
-  return ( !aFilter.IsNull() && aFilter->IsObjValid( theId ) );
+  return (!aFilter.IsNull() && aFilter->IsObjValid(theId));
 }
 
 //=======================================================================
@@ -565,74 +559,67 @@ bool SMESHGUI_MultiEditDlg::isIdValid( const int theId ) const
 //=======================================================================
 void SMESHGUI_MultiEditDlg::onAddBtn()
 {
-  int nbSelected = mySelection->IObjectCount();
-  if ( nbSelected == 0 ) 
+  const SALOME_ListIO& aList = mySelector->StoredIObjects();
+
+  int nbSelected = aList.Extent();
+  if (nbSelected == 0)
     return;
 
   TColStd_IndexedMapOfInteger toBeAdded;
-  
-  if ( !mySubmeshChk->isChecked() && !myGroupChk->isChecked() ) 
-  {
-    if ( nbSelected == 1 ) 
-      SMESH::GetSelected( mySelection, toBeAdded );
-  }
-  else if ( mySubmeshChk->isChecked() ) 
-  {
-    SALOME_ListIteratorOfListIO anIter( mySelection->StoredIObjects() );
-    for ( ; anIter.More(); anIter.Next() )
-    {
-      SMESH::SMESH_subMesh_var aSubMesh = SMESH::IObjectToInterface<SMESH::SMESH_subMesh>( anIter.Value() );
-      if ( !aSubMesh->_is_nil() )
-      {
-        if ( aSubMesh->GetFather()->GetId() == myMesh->GetId() )
-        {
+
+  if (!mySubmeshChk->isChecked() && !myGroupChk->isChecked()) {
+    if (nbSelected == 1)
+      mySelector->GetIndex(aList.First(),toBeAdded);
+  } else if (mySubmeshChk->isChecked()) {
+    SALOME_ListIteratorOfListIO anIter(aList);
+    for (; anIter.More(); anIter.Next()) {
+      SMESH::SMESH_subMesh_var aSubMesh =
+        SMESH::IObjectToInterface<SMESH::SMESH_subMesh>(anIter.Value());
+      if (!aSubMesh->_is_nil()) {
+        if (aSubMesh->GetFather()->GetId() == myMesh->GetId()) {
           SMESH::long_array_var anIds = aSubMesh->GetElementsId();
-          for ( int i = 0, n = anIds->length(); i < n; i++ )
-          {
-            if ( isIdValid( anIds[ i ] ) )
-              toBeAdded.Add( anIds[ i ] );
+          for (int i = 0, n = anIds->length(); i < n; i++) {
+            if (isIdValid(anIds[ i ]))
+              toBeAdded.Add(anIds[ i ]);
           }
         }
       }
     }
-  }
-  else if ( myGroupChk->isChecked() ) 
-  {
-    SALOME_ListIteratorOfListIO anIter( mySelection->StoredIObjects() );
-    for ( ; anIter.More(); anIter.Next() )
-    {
+  } else if (myGroupChk->isChecked()) {
+    SALOME_ListIteratorOfListIO anIter(aList);
+    for (; anIter.More(); anIter.Next()) {
       SMESH::SMESH_GroupBase_var aGroup =
-        SMESH::IObjectToInterface<SMESH::SMESH_GroupBase>( anIter.Value() );
-      if ( !aGroup->_is_nil() && ( aGroup->GetType() == SMESH::FACE && entityType() == 0 || aGroup->GetType() == SMESH::VOLUME && entityType() == 1 ) )
-      {
-        if ( aGroup->GetMesh()->GetId() == myMesh->GetId() )
-        {
+        SMESH::IObjectToInterface<SMESH::SMESH_GroupBase>(anIter.Value());
+      if (!aGroup->_is_nil() && (aGroup->GetType() == SMESH::FACE &&
+                                 entityType() == 0 || aGroup->GetType() == SMESH::VOLUME &&
+                                 entityType() == 1)) {
+        if (aGroup->GetMesh()->GetId() == myMesh->GetId()) {
           SMESH::long_array_var anIds = aGroup->GetListOfID();
-          for ( int i = 0, n = anIds->length(); i < n; i++ )
-          {
-            if ( isIdValid( anIds[ i ] ) )
-              toBeAdded.Add( anIds[ i ] );
+          for (int i = 0, n = anIds->length(); i < n; i++) {
+            if (isIdValid(anIds[ i ]))
+              toBeAdded.Add(anIds[ i ]);
           }
         }
       }
     }
+  } else {
   }
 
   myBusy = true;
-  bool isGroupOrSubmesh = ( mySubmeshChk->isChecked() || myGroupChk->isChecked() );
-  mySubmeshChk->setChecked( false );
-  myGroupChk->setChecked( false );
-  for( int i = 1; i <= toBeAdded.Extent(); i++ )
-    if ( myIds.Add( toBeAdded(i) ) ) {
-      QListBoxItem * item = new QListBoxText( QString( "%1" ).arg( toBeAdded(i) ));
-      myListBox->insertItem( item );
-      myListBox->setSelected( item, true );
+  bool isGroupOrSubmesh = (mySubmeshChk->isChecked() || myGroupChk->isChecked());
+  mySubmeshChk->setChecked(false);
+  myGroupChk->setChecked(false);
+  for(int i = 1; i <= toBeAdded.Extent(); i++)
+    if (myIds.Add(toBeAdded(i))) {
+      QListBoxItem * item = new QListBoxText(QString("%1").arg(toBeAdded(i)));
+      myListBox->insertItem(item);
+      myListBox->setSelected(item, true);
     }
   myBusy = false;
 
-  emit ListContensChanged(); 
+  emit ListContensChanged();
 
-  if ( isGroupOrSubmesh )
+  if (isGroupOrSubmesh)
     onListSelectionChanged();
 
   updateButtons();
@@ -645,38 +632,40 @@ void SMESHGUI_MultiEditDlg::onAddBtn()
 void SMESHGUI_MultiEditDlg::updateButtons()
 {
   bool isOk = isValid(false);
-  myOkBtn->setEnabled( isOk );
-  myApplyBtn->setEnabled( isOk );
+  myOkBtn->setEnabled(isOk);
+  myApplyBtn->setEnabled(isOk);
 
   bool isListBoxNonEmpty = myListBox->count() > 0;
   bool isToAll = myToAllChk->isChecked();
-  myFilterBtn->setEnabled( !isToAll );
-  myRemoveBtn->setEnabled( isListBoxNonEmpty && !isToAll );
-  mySortBtn->setEnabled( isListBoxNonEmpty &&!isToAll );
-  
-  if ( isToAll ||
-       myMesh->_is_nil() ||
-       mySelection->IObjectCount() != 1 ||
-       (SMESH::IObjectToInterface<SMESH::SMESH_subMesh>( mySelection->firstIObject() )->_is_nil() &&
-       SMESH::IObjectToInterface<SMESH::SMESH_GroupBase>( mySelection->firstIObject() )->_is_nil() &&
-       SMESH::IObjectToInterface<SMESH::SMESH_Mesh>( mySelection->firstIObject() )->_is_nil()) )
-    myAddBtn->setEnabled( false );
+  myFilterBtn->setEnabled(!isToAll);
+  myRemoveBtn->setEnabled(isListBoxNonEmpty && !isToAll);
+  mySortBtn->setEnabled(isListBoxNonEmpty &&!isToAll);
+
+  const SALOME_ListIO& aList = mySelector->StoredIObjects();
+
+  if (isToAll ||
+      myMesh->_is_nil() ||
+      aList.Extent() != 1 ||
+      (SMESH::IObjectToInterface<SMESH::SMESH_subMesh>(aList.First())->_is_nil() &&
+       SMESH::IObjectToInterface<SMESH::SMESH_GroupBase>(aList.First())->_is_nil() &&
+       SMESH::IObjectToInterface<SMESH::SMESH_Mesh>(aList.First())->_is_nil()))
+    myAddBtn->setEnabled(false);
   else
-    myAddBtn->setEnabled( true );
-  
-  mySubmeshChk->setEnabled( !isToAll );
-  mySubmeshBtn->setEnabled( mySubmeshChk->isChecked() );
-  mySubmesh->setEnabled( mySubmeshChk->isChecked() );
-  
-  myGroupChk->setEnabled( !isToAll );
-  myGroupBtn->setEnabled( myGroupChk->isChecked() );
-  myGroup->setEnabled( myGroupChk->isChecked() );
-  
-  if ( !mySubmeshChk->isChecked() )
+    myAddBtn->setEnabled(true);
+
+  mySubmeshChk->setEnabled(!isToAll);
+  mySubmeshBtn->setEnabled(mySubmeshChk->isChecked());
+  mySubmesh->setEnabled(mySubmeshChk->isChecked());
+
+  myGroupChk->setEnabled(!isToAll);
+  myGroupBtn->setEnabled(myGroupChk->isChecked());
+  myGroup->setEnabled(myGroupChk->isChecked());
+
+  if (!mySubmeshChk->isChecked())
     mySubmesh->clear();
-  if ( !myGroupChk->isChecked() )
+  if (!myGroupChk->isChecked())
     myGroup->clear();
-    
+
 }
 
 //=======================================================================
@@ -687,22 +676,22 @@ void SMESHGUI_MultiEditDlg::updateButtons()
 void SMESHGUI_MultiEditDlg::onRemoveBtn()
 {
   myBusy = true;
-  
-  for ( int i = 0, n = myListBox->count(); i < n; i++ )
+
+  for (int i = 0, n = myListBox->count(); i < n; i++)
   {
-    for ( int i = myListBox->count(); i > 0; i--) {
-      if ( myListBox->isSelected( i - 1 ) ) 
+    for (int i = myListBox->count(); i > 0; i--) {
+      if (myListBox->isSelected(i - 1))
       {
-        int anId = myListBox->text( i - 1 ).toInt();
-        myIds.Remove( anId );
-        myIds.Remove( anId );
-             myListBox->removeItem( i-1 );
+        int anId = myListBox->text(i - 1).toInt();
+        myIds.Remove(anId);
+        myIds.Remove(anId);
+             myListBox->removeItem(i-1);
       }
-    }        
+    }
   }
   myBusy = false;
 
-  emit ListContensChanged();  
+  emit ListContensChanged();
   updateButtons();
 }
 
@@ -716,28 +705,28 @@ void SMESHGUI_MultiEditDlg::onSortListBtn()
   myBusy = true;
 
   int i, k = myListBox->count();
-  if ( k > 0 ) 
+  if (k > 0)
   {
     QStringList aSelected;
-    std::vector<int> anArray( k );
+    std::vector<int> anArray(k);
     QListBoxItem* anItem;
-    for ( anItem = myListBox->firstItem(), i = 0; anItem != 0; anItem = anItem->next(), i++) 
+    for (anItem = myListBox->firstItem(), i = 0; anItem != 0; anItem = anItem->next(), i++)
     {
       anArray[ i ] = anItem->text().toInt();
-      if ( anItem->isSelected() ) 
-        aSelected.append( anItem->text() );
+      if (anItem->isSelected())
+        aSelected.append(anItem->text());
     }
-    
-    std::sort( anArray.begin(), anArray.end() );
+
+    std::sort(anArray.begin(), anArray.end());
     myListBox->clear();
-    for ( i = 0; i < k; i++ ) 
-      myListBox->insertItem( QString::number( anArray[ i ] ) );
+    for (i = 0; i < k; i++)
+      myListBox->insertItem(QString::number(anArray[ i ]));
 
-    for ( QStringList::iterator it = aSelected.begin(); it != aSelected.end(); ++it ) 
+    for (QStringList::iterator it = aSelected.begin(); it != aSelected.end(); ++it)
     {
-      anItem = myListBox->findItem( *it, Qt::ExactMatch );
-      if ( anItem ) 
-        myListBox->setSelected( anItem, true );
+      anItem = myListBox->findItem(*it, Qt::ExactMatch);
+      if (anItem)
+        myListBox->setSelected(anItem, true);
     }
   }
   myBusy = false;
@@ -750,31 +739,30 @@ void SMESHGUI_MultiEditDlg::onSortListBtn()
 //=======================================================================
 void SMESHGUI_MultiEditDlg::onListSelectionChanged()
 {
-  if ( myActor == 0 || myBusy )
+  if (myActor == 0 || myBusy)
     return;
-  
-  if ( mySubmeshChk->isChecked() || myGroupChk->isChecked() ) 
+
+  if (mySubmeshChk->isChecked() || myGroupChk->isChecked())
     return;
 
-  SMESH_Actor * anActor = SMESH::FindActorByObject( myMesh );
-  if ( !anActor )
+  SMESH_Actor * anActor = SMESH::FindActorByObject(myMesh);
+  if (!anActor)
     anActor = myActor;
   TVisualObjPtr anObj = anActor->GetObject();
 
   TColStd_MapOfInteger anIndexes;
-  for ( QListBoxItem* anItem = myListBox->firstItem(); anItem != 0; anItem = anItem->next() ) 
+  for (QListBoxItem* anItem = myListBox->firstItem(); anItem != 0; anItem = anItem->next())
   {
-    if ( anItem->isSelected() ) 
+    if (anItem->isSelected())
     {
       int anId = anItem->text().toInt();
-      if ( anObj->GetElemVTKId( anId ) >= 0 ) // avoid exception in hilight
+      if (anObj->GetElemVTKId(anId) >= 0) // avoid exception in hilight
         anIndexes.Add(anId);
     }
   }
-  
-  mySelection->ClearIObjects();
-  mySelection->AddOrRemoveIndex( anActor->getIO(), anIndexes, false, false );
-  mySelection->AddIObject( anActor->getIO() );
+
+  mySelector->AddOrRemoveIndex(anActor->getIO(),anIndexes,false);
+  myViewWindow->highlight(anActor->getIO(),true,true);
 }
 
 //=======================================================================
@@ -785,14 +773,14 @@ void SMESHGUI_MultiEditDlg::onListSelectionChanged()
 void SMESHGUI_MultiEditDlg::onSubmeshChk()
 {
   bool isChecked = mySubmeshChk->isChecked();
-  mySubmeshBtn->setEnabled( isChecked );
-  mySubmesh->setEnabled( isChecked );
-  if ( !isChecked )
+  mySubmeshBtn->setEnabled(isChecked);
+  mySubmesh->setEnabled(isChecked);
+  if (!isChecked)
     mySubmesh->clear();
-  if ( isChecked && myGroupChk->isChecked() )
-      myGroupChk->setChecked( false );
-      
-  setSelectionMode();      
+  if (isChecked && myGroupChk->isChecked())
+      myGroupChk->setChecked(false);
+
+  setSelectionMode();
 }
 
 //=======================================================================
@@ -803,12 +791,12 @@ void SMESHGUI_MultiEditDlg::onSubmeshChk()
 void SMESHGUI_MultiEditDlg::onGroupChk()
 {
   bool isChecked = myGroupChk->isChecked();
-  myGroupBtn->setEnabled( isChecked );
-  myGroup->setEnabled( isChecked );
-  if ( !isChecked )
+  myGroupBtn->setEnabled(isChecked);
+  myGroup->setEnabled(isChecked);
+  if (!isChecked)
     myGroup->clear();
-  if ( isChecked && mySubmeshChk->isChecked() )
-      mySubmeshChk->setChecked( false );
+  if (isChecked && mySubmeshChk->isChecked())
+      mySubmeshChk->setChecked(false);
 
   setSelectionMode();
 }
@@ -816,27 +804,23 @@ void SMESHGUI_MultiEditDlg::onGroupChk()
 //=======================================================================
 // name    : SMESHGUI_MultiEditDlg::onToAllChk
 // Purpose : SLOT. Called when state of "Apply to all" check box changed.
-//           Activate/deactivate selection 
+//           Activate/deactivate selection
 //=======================================================================
 void SMESHGUI_MultiEditDlg::onToAllChk()
 {
   bool isChecked = myToAllChk->isChecked();
 
-  if ( isChecked )
+  if (isChecked)
     myListBox->clear();
 
   myIds.Clear();
 
   emit ListContensChanged();
-    
+
   updateButtons();
   setSelectionMode();
-
-  if ( myActor )
-    mySelection->AddIObject( myActor->getIO(), true );
 }
 
-
 //=======================================================================
 // name    : SMESHGUI_MultiEditDlg::setSelectionMode
 // Purpose : Set selection mode
@@ -844,60 +828,56 @@ void SMESHGUI_MultiEditDlg::onToAllChk()
 void SMESHGUI_MultiEditDlg::setSelectionMode()
 {
   SMESH::RemoveFilters();
-    
-  mySelection->ClearIObjects();
-  mySelection->ClearFilters();
-  
-  if ( mySubmeshChk->isChecked() ) {
-    QAD_Application::getDesktop()->SetSelectionMode( ActorSelection, true );
-    mySelection->AddFilter( mySubmeshFilter );
-  }
-  else if ( myGroupChk->isChecked() ) {
-    QAD_Application::getDesktop()->SetSelectionMode( ActorSelection, true );
-    mySelection->AddFilter( myGroupFilter );
+
+  mySelectionMgr->clearSelected();
+  mySelectionMgr->clearFilters();
+
+  if (mySubmeshChk->isChecked()) {
+    myViewWindow->SetSelectionMode(ActorSelection);
+    mySelectionMgr->installFilter(new SMESH_TypeFilter(SUBMESH));
   }
-  if ( entityType() ) {
-    QAD_Application::getDesktop()->SetSelectionMode( VolumeSelection, true );
-    SMESH::SetFilter( new SMESHGUI_VolumesFilter() );
+  else if (myGroupChk->isChecked()) {
+    myViewWindow->SetSelectionMode(ActorSelection);
+    mySelectionMgr->installFilter(new SMESH_TypeFilter(GROUP));
   }
-  else {
-    QAD_Application::getDesktop()->SetSelectionMode( FaceSelection, true );
-    if ( myFilterType == SMESHGUI_TriaFilter )
-      SMESH::SetFilter( new SMESHGUI_TriangleFilter() );
-    else if ( myFilterType == SMESHGUI_QuadFilter )
-      SMESH::SetFilter( new SMESHGUI_QuadrangleFilter() );
+
+  if (entityType()) {
+    myViewWindow->SetSelectionMode(VolumeSelection);
+    SMESH::SetFilter(new SMESHGUI_VolumesFilter());
+  } else {
+    myViewWindow->SetSelectionMode(FaceSelection);
+    if (myFilterType == SMESHGUI_TriaFilter)
+      SMESH::SetFilter(new SMESHGUI_TriangleFilter());
+    else if (myFilterType == SMESHGUI_QuadFilter)
+      SMESH::SetFilter(new SMESHGUI_QuadrangleFilter());
     else
-      SMESH::SetFilter( new SMESHGUI_FacesFilter() );
+      SMESH::SetFilter(new SMESHGUI_FacesFilter());
   }
 }
 
 //=======================================================================
 // name    : SMESHGUI_MultiEditDlg::onApply
-// Purpose : SLOT. Called when "Apply" button clicked. 
+// Purpose : SLOT. Called when "Apply" button clicked.
 //=======================================================================
 bool SMESHGUI_MultiEditDlg::onApply()
 {
-  if ( SMESHGUI::GetSMESHGUI()->ActiveStudyLocked() )
+  if (mySMESHGUI->isActiveStudyLocked())
     return false;
-  if ( !isValid( true ) )
+  if (!isValid(true))
     return false;
 
   SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
-  if ( aMeshEditor->_is_nil()  )
+  if (aMeshEditor->_is_nil())
     return false;
 
   myBusy = true;
 
   SMESH::long_array_var anIds = getIds();
 
-  bool aResult = process( aMeshEditor, anIds.inout() );
-  if ( aResult )
-  {
-    if ( myActor )
-    {
-      mySelection->ClearIObjects();
+  bool aResult = process(aMeshEditor, anIds.inout());
+  if (aResult) {
+    if (myActor) {
       SMESH::UpdateView();
-      mySelection->AddIObject( myActor->getIO(), false );
     }
 
     myListBox->clear();
@@ -913,21 +893,21 @@ bool SMESHGUI_MultiEditDlg::onApply()
 
 //=======================================================================
 // name    : SMESHGUI_MultiEditDlg::on3d2dChanged
-// Purpose : 
+// Purpose :
 //=======================================================================
-void SMESHGUI_MultiEditDlg::on3d2dChanged(int type)
+void SMESHGUI_MultiEditDlg::on3d2dChanged (int type)
 {
-  if ( myEntityType != type ) {
+  if (myEntityType != type) {
     myEntityType = type;
-    
+
     myListBox->clear();
     myIds.Clear();
 
     emit ListContensChanged();
-    
-    if ( type )
+
+    if (type)
       myFilterType = SMESHGUI_VolumeFilter;
-    else 
+    else
       myFilterType = SMESHGUI_FaceFilter;
 
     updateButtons();
@@ -937,80 +917,78 @@ void SMESHGUI_MultiEditDlg::on3d2dChanged(int type)
 
 //=======================================================================
 // name    : SMESHGUI_MultiEditDlg::entityType
-// Purpose : 
+// Purpose :
 //=======================================================================
-
-int SMESHGUI_MultiEditDlg::entityType() 
+int SMESHGUI_MultiEditDlg::entityType()
 {
   return myEntityType;
 }
 
 /*
-  Class       : SMESHGUI_ChangeOrientationDlg
-  Description : Modification of orientation of faces
-*/
-
-SMESHGUI_ChangeOrientationDlg::SMESHGUI_ChangeOrientationDlg( QWidget*          theParent, 
-                                                              SALOME_Selection* theSelection,
-                                                              const char*       theName )
-: SMESHGUI_MultiEditDlg( theParent, theSelection, SMESHGUI_FaceFilter, true, theName )
 Class       : SMESHGUI_ChangeOrientationDlg
 Description : Modification of orientation of faces
+ */
+
+SMESHGUI_ChangeOrientationDlg
+::SMESHGUI_ChangeOrientationDlg(SMESHGUI* theModule,
+                               const char* theName): 
+  SMESHGUI_MultiEditDlg(theModule, SMESHGUI_FaceFilter, true, theName)
 {
-  setCaption( tr( "CAPTION" ) );
+  setCaption(tr("CAPTION"));
 }
 
 SMESHGUI_ChangeOrientationDlg::~SMESHGUI_ChangeOrientationDlg()
 {
 }
 
-bool SMESHGUI_ChangeOrientationDlg::processSMESH::SMESH_MeshEditor_ptr theEditor,
-                                             const SMESH::long_array&    theIds )
+bool SMESHGUI_ChangeOrientationDlg::process (SMESH::SMESH_MeshEditor_ptr theEditor,
+                                             const SMESH::long_array&    theIds)
 {
-  return theEditor->Reorient( theIds );
+  return theEditor->Reorient(theIds);
 }
 
-/*
-  Class       : SMESHGUI_UnionOfTrianglesDlg
-  Description : Construction of quadrangles by automatic association of triangles
-*/
-
-SMESHGUI_UnionOfTrianglesDlg::SMESHGUI_UnionOfTrianglesDlg( QWidget*          theParent,
-                                                            SALOME_Selection* theSelection,
-                                                            const char*       theName )
-: SMESHGUI_MultiEditDlg( theParent, theSelection, SMESHGUI_TriaFilter, false, theName )
+/*!
 Class       : SMESHGUI_UnionOfTrianglesDlg
 Description : Construction of quadrangles by automatic association of triangles
+ */
+
+SMESHGUI_UnionOfTrianglesDlg
+::SMESHGUI_UnionOfTrianglesDlg(SMESHGUI* theModule,
+                              const char* theName):
+  SMESHGUI_MultiEditDlg(theModule, SMESHGUI_TriaFilter, false, theName)
 {
-  setCaption( tr( "CAPTION" ) );
+  setCaption(tr("CAPTION"));
 }
 
 SMESHGUI_UnionOfTrianglesDlg::~SMESHGUI_UnionOfTrianglesDlg()
 {
 }
 
-bool SMESHGUI_UnionOfTrianglesDlg::processSMESH::SMESH_MeshEditor_ptr theEditor,
-                                            const SMESH::long_array&    theIds )
+bool SMESHGUI_UnionOfTrianglesDlg::process (SMESH::SMESH_MeshEditor_ptr theEditor,
+                                            const SMESH::long_array&    theIds)
 {
-  return theEditor->TriToQuad(theIds, SMESH::NumericalFunctor::_nil(), 1. );
+  return theEditor->TriToQuad(theIds, SMESH::NumericalFunctor::_nil(), 1.);
 }
 
-/*
-  Class       : SMESHGUI_CuttingOfQuadsDlg
-  Description : Construction of quadrangles by automatic association of triangles
-*/
-
-SMESHGUI_CuttingOfQuadsDlg::SMESHGUI_CuttingOfQuadsDlg( QWidget*          theParent,
-                                                        SALOME_Selection* theSelection,
-                                                        const char*       theName )
-: SMESHGUI_MultiEditDlg( theParent, theSelection, SMESHGUI_QuadFilter, false, theName )
-{
+/*!
+ *  Class       : SMESHGUI_CuttingOfQuadsDlg
+ *  Description : Construction of quadrangles by automatic association of triangles
+ */
 
-  setCaption( tr( "CAPTION" ) );
+SMESHGUI_CuttingOfQuadsDlg
+::SMESHGUI_CuttingOfQuadsDlg(SMESHGUI* theModule,
+                            const char* theName):
+  SMESHGUI_MultiEditDlg(theModule, SMESHGUI_QuadFilter, false, theName)
+{
+  setCaption(tr("CAPTION"));
   myPreviewActor = 0;
 
-  myUseDiagChk = new QCheckBox( tr( "USE_DIAGONAL_2_4" ), mySelGrp );
-  myPreviewChk = new QCheckBox( tr( "PREVIEW" ), mySelGrp );
+  myUseDiagChk = new QCheckBox (tr("USE_DIAGONAL_2_4"), mySelGrp);
+  myPreviewChk = new QCheckBox (tr("PREVIEW"), mySelGrp);
 
-  connect( myPreviewChk, SIGNAL( stateChanged( int ) ), this, SLOT( onPreviewChk() ) );
-  connect( myUseDiagChk, SIGNAL( stateChanged( int ) ), this, SLOT( onPreviewChk() ) );
-  connect( this, SIGNAL( ListContensChanged() ), this, SLOT( onPreviewChk() ) );
+  connect(myPreviewChk, SIGNAL(stateChanged(int)),    this, SLOT(onPreviewChk()));
+  connect(myUseDiagChk, SIGNAL(stateChanged(int)),    this, SLOT(onPreviewChk()));
+  connect(this,         SIGNAL(ListContensChanged()), this, SLOT(onPreviewChk()));
 }
 
 SMESHGUI_CuttingOfQuadsDlg::~SMESHGUI_CuttingOfQuadsDlg()
@@ -1023,10 +1001,10 @@ void SMESHGUI_CuttingOfQuadsDlg::onClose()
   SMESHGUI_MultiEditDlg::onClose();
 }
 
-bool SMESHGUI_CuttingOfQuadsDlg::processSMESH::SMESH_MeshEditor_ptr theEditor,
-                                          const SMESH::long_array&    theIds )
+bool SMESHGUI_CuttingOfQuadsDlg::process (SMESH::SMESH_MeshEditor_ptr theEditor,
+                                          const SMESH::long_array&    theIds)
 {
-  return theEditor->SplitQuad( theIds, !myUseDiagChk->isChecked() );
+  return theEditor->SplitQuad(theIds, !myUseDiagChk->isChecked());
 }
 
 void SMESHGUI_CuttingOfQuadsDlg::onPreviewChk()
@@ -1036,11 +1014,10 @@ void SMESHGUI_CuttingOfQuadsDlg::onPreviewChk()
 
 void SMESHGUI_CuttingOfQuadsDlg::erasePreview()
 {
-  if ( myPreviewActor == 0 )
+  if (myPreviewActor == 0)
     return;
-    
-  if ( VTKViewer_ViewFrame* vf = SMESH::GetCurrentVtkView() )
-  {
+
+  if (SVTK_ViewWindow* vf = SMESH::GetCurrentVtkView()) {
     vf->RemoveActor(myPreviewActor);
     vf->Repaint();
   }
@@ -1050,124 +1027,124 @@ void SMESHGUI_CuttingOfQuadsDlg::erasePreview()
 
 void SMESHGUI_CuttingOfQuadsDlg::displayPreview()
 {
-  if ( myActor == 0 )
+  if (myActor == 0)
     return;
 
-  if ( myPreviewActor != 0 )
+  if (myPreviewActor != 0)
     erasePreview();
 
   // get Ids of elements
   SMESH::long_array_var anElemIds = getIds();
-  if ( getIds()->length() == 0 )
+  if (getIds()->length() == 0)
     return;
 
   SMDS_Mesh* aMesh = myActor->GetObject()->GetMesh();
-  if ( aMesh == 0 )
+  if (aMesh == 0)
     return;
 
   bool isDiag24 = myUseDiagChk->isChecked();
 
   //Create grid
   vtkUnstructuredGrid* aGrid = vtkUnstructuredGrid::New();
-    
+
   vtkIdType aNbCells = anElemIds->length() * 2;
   vtkIdType aCellsSize = 4 * aNbCells;
   vtkCellArray* aConnectivity = vtkCellArray::New();
-  aConnectivity->Allocate( aCellsSize, 0 );
+  aConnectivity->Allocate(aCellsSize, 0);
 
   vtkPoints* aPoints = vtkPoints::New();
-  aPoints->SetNumberOfPoints( anElemIds->length() * 4 );
-  
+  aPoints->SetNumberOfPoints(anElemIds->length() * 4);
+
   vtkUnsignedCharArray* aCellTypesArray = vtkUnsignedCharArray::New();
-  aCellTypesArray->SetNumberOfComponents( 1 );
-  aCellTypesArray->Allocate( aNbCells * aCellTypesArray->GetNumberOfComponents() );
+  aCellTypesArray->SetNumberOfComponents(1);
+  aCellTypesArray->Allocate(aNbCells * aCellTypesArray->GetNumberOfComponents());
 
   vtkIdList *anIdList = vtkIdList::New();
-  anIdList->SetNumberOfIds( 3 );
+  anIdList->SetNumberOfIds(3);
 
   TColStd_DataMapOfIntegerInteger anIdToVtk;
 
   int aNodes[ 4 ];
   int nbPoints = -1;
-  for ( int i = 0, n = anElemIds->length(); i < n; i++ )
+  for (int i = 0, n = anElemIds->length(); i < n; i++)
   {
-    const SMDS_MeshElement* anElem = aMesh->FindElement( anElemIds[ i ] );
-    if ( anElem == 0 || anElem->NbNodes() != 4 )
+    const SMDS_MeshElement* anElem = aMesh->FindElement(anElemIds[ i ]);
+    if (anElem == 0 || anElem->NbNodes() != 4)
       continue;
-      
+
     SMDS_ElemIteratorPtr anIter = anElem->nodesIterator();
     int k = 0;
-    while( anIter->more() )
-      if ( const SMDS_MeshNode* aNode = (SMDS_MeshNode*)anIter->next() )
+    while(anIter->more())
+      if (const SMDS_MeshNode* aNode = (SMDS_MeshNode*)anIter->next())
       {
-        if ( !anIdToVtk.IsBound( aNode->GetID() ) )
+        if (!anIdToVtk.IsBound(aNode->GetID()))
         {
-          aPoints->SetPoint( ++nbPoints, aNode->X(), aNode->Y(), aNode->Z() );
-          anIdToVtk.Bind( aNode->GetID(), nbPoints );
+          aPoints->SetPoint(++nbPoints, aNode->X(), aNode->Y(), aNode->Z());
+          anIdToVtk.Bind(aNode->GetID(), nbPoints);
         }
-        
+
         aNodes[ k++ ] = aNode->GetID();
       }
 
-    if ( k != 4 )
+    if (k != 4)
       continue;
 
-    if ( !isDiag24 )
+    if (!isDiag24)
     {
-      anIdList->SetId( 0, anIdToVtk( aNodes[ 0 ] ) );
-      anIdList->SetId( 1, anIdToVtk( aNodes[ 1 ] ) );
-      anIdList->SetId( 2, anIdToVtk( aNodes[ 2 ] ) );
-      aConnectivity->InsertNextCell( anIdList );
-      aCellTypesArray->InsertNextValue( VTK_TRIANGLE );
-
-      anIdList->SetId( 0, anIdToVtk( aNodes[ 2 ] ) );
-      anIdList->SetId( 1, anIdToVtk( aNodes[ 3 ] ) );
-      anIdList->SetId( 2, anIdToVtk( aNodes[ 0 ] ) );
-      aConnectivity->InsertNextCell( anIdList );
-      aCellTypesArray->InsertNextValue( VTK_TRIANGLE );
+      anIdList->SetId(0, anIdToVtk(aNodes[ 0 ]));
+      anIdList->SetId(1, anIdToVtk(aNodes[ 1 ]));
+      anIdList->SetId(2, anIdToVtk(aNodes[ 2 ]));
+      aConnectivity->InsertNextCell(anIdList);
+      aCellTypesArray->InsertNextValue(VTK_TRIANGLE);
+
+      anIdList->SetId(0, anIdToVtk(aNodes[ 2 ]));
+      anIdList->SetId(1, anIdToVtk(aNodes[ 3 ]));
+      anIdList->SetId(2, anIdToVtk(aNodes[ 0 ]));
+      aConnectivity->InsertNextCell(anIdList);
+      aCellTypesArray->InsertNextValue(VTK_TRIANGLE);
     }
     else
     {
-      anIdList->SetId( 0, anIdToVtk( aNodes[ 1 ] ) );
-      anIdList->SetId( 1, anIdToVtk( aNodes[ 2 ] ) );
-      anIdList->SetId( 2, anIdToVtk( aNodes[ 3 ] ) );
-      aConnectivity->InsertNextCell( anIdList );
-      aCellTypesArray->InsertNextValue( VTK_TRIANGLE );
-
-      anIdList->SetId( 0, anIdToVtk( aNodes[ 3 ] ) );
-      anIdList->SetId( 1, anIdToVtk( aNodes[ 0 ] ) );
-      anIdList->SetId( 2, anIdToVtk( aNodes[ 1 ] ) );
-      aConnectivity->InsertNextCell( anIdList );
-      aCellTypesArray->InsertNextValue( VTK_TRIANGLE );
+      anIdList->SetId(0, anIdToVtk(aNodes[ 1 ]));
+      anIdList->SetId(1, anIdToVtk(aNodes[ 2 ]));
+      anIdList->SetId(2, anIdToVtk(aNodes[ 3 ]));
+      aConnectivity->InsertNextCell(anIdList);
+      aCellTypesArray->InsertNextValue(VTK_TRIANGLE);
+
+      anIdList->SetId(0, anIdToVtk(aNodes[ 3 ]));
+      anIdList->SetId(1, anIdToVtk(aNodes[ 0 ]));
+      anIdList->SetId(2, anIdToVtk(aNodes[ 1 ]));
+      aConnectivity->InsertNextCell(anIdList);
+      aCellTypesArray->InsertNextValue(VTK_TRIANGLE);
     }
   }
 
   vtkIntArray* aCellLocationsArray = vtkIntArray::New();
-  aCellLocationsArray->SetNumberOfComponents( 1 );
-  aCellLocationsArray->SetNumberOfTuples( aNbCells );
+  aCellLocationsArray->SetNumberOfComponents(1);
+  aCellLocationsArray->SetNumberOfTuples(aNbCells);
 
   aConnectivity->InitTraversal();
-  for( vtkIdType idType = 0, *pts, npts; aConnectivity->GetNextCell( npts, pts ); idType++ )
-    aCellLocationsArray->SetValue( idType, aConnectivity->GetTraversalLocation( npts ) );
+  for(vtkIdType idType = 0, *pts, npts; aConnectivity->GetNextCell(npts, pts); idType++)
+    aCellLocationsArray->SetValue(idType, aConnectivity->GetTraversalLocation(npts));
 
-  aGrid->SetPoints( aPoints );
-  aGrid->SetCells( aCellTypesArray, aCellLocationsArray,aConnectivity );
+  aGrid->SetPoints(aPoints);
+  aGrid->SetCells(aCellTypesArray, aCellLocationsArray,aConnectivity);
 
   // Create and display actor
   vtkDataSetMapper* aMapper = vtkDataSetMapper::New();
-  aMapper->SetInput( aGrid );
-  
+  aMapper->SetInput(aGrid);
+
   myPreviewActor = SALOME_Actor::New();
   myPreviewActor->PickableOff();
-  myPreviewActor->SetMapper( aMapper );
+  myPreviewActor->SetMapper(aMapper);
 
   vtkProperty* aProp = vtkProperty::New();
   aProp->SetRepresentationToWireframe();
-  aProp->SetColor( 250, 0, 250 );
-  aProp->SetLineWidth( myActor->GetLineWidth() + 1 );
-  myPreviewActor->SetProperty( aProp );
+  aProp->SetColor(250, 0, 250);
+  aProp->SetLineWidth(myActor->GetLineWidth() + 1);
+  myPreviewActor->SetProperty(aProp);
 
-  SMESH::GetCurrentVtkView()->AddActor( myPreviewActor );
+  SMESH::GetCurrentVtkView()->AddActor(myPreviewActor);
   SMESH::GetCurrentVtkView()->Repaint();
 
   aProp->Delete();
@@ -1179,26 +1156,3 @@ void SMESHGUI_CuttingOfQuadsDlg::displayPreview()
   aCellTypesArray->Delete();
   aCellLocationsArray->Delete();
 }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
index 48a59a962e9248bff1786557c50d467f69f6a319..3a5558fe14e5ffbb8ac93a018894cd1efc6fc24a 100755 (executable)
@@ -28,7 +28,9 @@
 #define SMESHGUI_MultiEditDlg_H
 
 #include <qdialog.h>
-#include "SMESH_TypeFilter.hxx"
+
+#include "SUIT_SelectionFilter.h"
+
 #include <TColStd_MapOfInteger.hxx>
 
 #include <SALOMEconfig.h>
@@ -42,12 +44,18 @@ class QFrame;
 class QLineEdit;
 class SMESHGUI_SpinBox;
 class QPushButton;
-class SALOME_Selection;
-class SMESH_Actor;
-class SALOME_Actor;
 class QButtonGroup;
 class QObject;
 
+class SMESH_Actor;
+class SALOME_Actor;
+class SalomeApp_SelectionMgr;
+
+class SMESHGUI;
+class SMESH_Actor;
+class SVTK_Selector;
+class SVTK_ViewWindow;
+
 /*
   Class       : SMESHGUI_MultiEditDlg
   Description : Base class for dialogs of diagonal inversion and 
@@ -59,14 +67,13 @@ class SMESHGUI_MultiEditDlg : public QDialog
   Q_OBJECT
 
 public:
-                            SMESHGUI_MultiEditDlg( QWidget*,
-                                                   SALOME_Selection*,
-                                                   const int,
-                                                  const bool = false,
-                                                   const char* = 0 );
+                            SMESHGUI_MultiEditDlg(SMESHGUI* theModule,
+                                                 const int,
+                                                 const bool = false,
+                                                 const char* = 0 );
   virtual                   ~SMESHGUI_MultiEditDlg();
 
-  void                      Init( SALOME_Selection* ) ;
+  void                      Init() ;
 
   bool                      eventFilter( QObject* object, QEvent* event );
 
@@ -113,10 +120,14 @@ protected:
   QPushButton*              myOkBtn;
   QPushButton*              myApplyBtn;
   QPushButton*              myCloseBtn;
-  SALOME_Selection*         mySelection;
-  SMESH::SMESH_Mesh_var     myMesh;
   SMESH_Actor*              myActor;
+  SMESH::SMESH_Mesh_var     myMesh;
   
+  SalomeApp_SelectionMgr*   mySelectionMgr;
+  SVTK_ViewWindow*          myViewWindow;
+  SVTK_Selector*            mySelector;
+  SMESHGUI*                 mySMESHGUI;
+
   QGroupBox*                mySelGrp;
   
   QListBox*                 myListBox;
@@ -139,8 +150,6 @@ protected:
   SMESHGUI_FilterDlg*       myFilterDlg;
   TColStd_MapOfInteger      myIds;
   int                       myFilterType;
-  Handle(SMESH_TypeFilter)  mySubmeshFilter;
-  Handle(SMESH_TypeFilter)  myGroupFilter;
   bool                      myBusy;
   int                       myEntityType;
 };
@@ -154,9 +163,8 @@ class  SMESHGUI_ChangeOrientationDlg : public SMESHGUI_MultiEditDlg
   Q_OBJECT
 
 public:
-                            SMESHGUI_ChangeOrientationDlg( QWidget*,
-                                                           SALOME_Selection*,
-                                                           const char* = 0 );
+                            SMESHGUI_ChangeOrientationDlg(SMESHGUI* theModule,
+                                                         const char* = 0);
   virtual                   ~SMESHGUI_ChangeOrientationDlg();
 
 protected:
@@ -173,9 +181,8 @@ class  SMESHGUI_UnionOfTrianglesDlg : public SMESHGUI_MultiEditDlg
   Q_OBJECT
 
 public:
-                            SMESHGUI_UnionOfTrianglesDlg( QWidget*,
-                                                          SALOME_Selection*,
-                                                          const char* = 0 );
+                            SMESHGUI_UnionOfTrianglesDlg(SMESHGUI* theModule,
+                                                        const char* = 0);
   virtual                   ~SMESHGUI_UnionOfTrianglesDlg();
 
 protected:
@@ -192,9 +199,8 @@ class  SMESHGUI_CuttingOfQuadsDlg : public SMESHGUI_MultiEditDlg
   Q_OBJECT
 
 public:
-                            SMESHGUI_CuttingOfQuadsDlg( QWidget*,
-                                                        SALOME_Selection*,
-                                                        const char* = 0 );
+                            SMESHGUI_CuttingOfQuadsDlg(SMESHGUI* theModule,
+                                                      const char* = 0);
   virtual                   ~SMESHGUI_CuttingOfQuadsDlg();
 
 protected:
index 67b0daa2310cfec249b9c58e245e6abc9ae84356..a3f0966ff07c7d98f65a89fec57077464f036332 100644 (file)
@@ -1,23 +1,23 @@
 //  SMESH SMESHGUI : GUI for SMESH component
 //
 //  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
-// 
-//  This library is free software; you can redistribute it and/or 
-//  modify it under the terms of the GNU Lesser General Public 
-//  License as published by the Free Software Foundation; either 
-//  version 2.1 of the License. 
-// 
-//  This library is distributed in the hope that it will be useful, 
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of 
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
-//  Lesser General Public License for more details. 
-// 
-//  You should have received a copy of the GNU Lesser General Public 
-//  License along with this library; if not, write to the Free Software 
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
-// 
-//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
 //
 //
 //
 #include "SMESHGUI_NodesDlg.h"
 
 #include "SMESHGUI.h"
+#include "SMESHGUI_SpinBox.h"
 #include "SMESHGUI_Utils.h"
+#include "SMESHGUI_VTKUtils.h"
 #include "SMESHGUI_MeshUtils.h"
 
-#include "SMESHGUI_VTKUtils.h"
+#include "SMESH_Actor.h"
 #include "SMESH_ActorUtils.h"
+#include "SMESH_ObjectDef.h"
 
-#include "VTKViewer_ViewFrame.h"
-#include "SALOME_Actor.h"
+#include "SMDS_Mesh.hxx"
+#include "SMDS_MeshNode.hxx"
 
-#include "SMESHGUI_SpinBox.h"
+#include "SUIT_Session.h"
+#include "SUIT_OverrideCursor.h"
+#include "SUIT_ViewWindow.h"
+#include "SUIT_ViewManager.h"
+#include "SUIT_MessageBox.h"
 
-#include "QAD_Application.h"
-#include "QAD_Desktop.h"
-#include "QAD_WaitCursor.h"
-#include "QAD_MessageBox.h"
+#include "SalomeApp_Study.h"
+#include "SalomeApp_Application.h"
 
-#include "SMESH_Actor.h"
-#include "SMESH_ObjectDef.h"
+#include "SVTK_ViewWindow.h"
 
-#include "SMDS_Mesh.hxx"
-#include "SMDS_MeshNode.hxx"
+#include "SALOME_Actor.h"
+#include "SALOME_ListIO.hxx"
+#include "SVTK_Selection.h"
+
+#include "utilities.h"
 
 // VTK Includes
 #include <vtkCell.h>
 #include <qvalidator.h>
 #include <qevent.h>
 
-#include "utilities.h"
-
 using namespace std;
 
 
-namespace SMESH{
+namespace SMESH {
 
-  void AddNode(SMESH::SMESH_Mesh_ptr theMesh, float x, float y, float z){
-    QAD_WaitCursor wc;
-    try{
-      SALOMEDS::SObject_var aSobj = SMESH::FindSObject(theMesh);
-      CORBA::String_var anEntry = aSobj->GetID();
+  void AddNode (SMESH::SMESH_Mesh_ptr theMesh, float x, float y, float z)
+  {
+    SUIT_OverrideCursor wc;
+    try {
+      _PTR(SObject) aSobj = SMESH::FindSObject(theMesh);
       SMESH::SMESH_MeshEditor_var aMeshEditor = theMesh->GetMeshEditor();
       aMeshEditor->AddNode(x,y,z);
-      SALOMEDS::Study_var aStudy = GetActiveStudyDocument();
+      _PTR(Study) aStudy = GetActiveStudyDocument();
       CORBA::Long anId = aStudy->StudyId();
-      if(TVisualObjPtr aVisualObj = SMESH::GetVisualObj(anId,anEntry.in())){
+      if (TVisualObjPtr aVisualObj = SMESH::GetVisualObj(anId, aSobj->GetID().c_str())) {
        aVisualObj->Update(true);
       }
-    }catch(SALOME::SALOME_Exception& exc) {
-      INFOS("Follow exception was cought:\n\t"<<exc.details.text);
-    }catch(const std::exception& exc){
-      INFOS("Follow exception was cought:\n\t"<<exc.what());
-    }catch(...){
+    } catch (SALOME::SALOME_Exception& exc) {
+      INFOS("Follow exception was cought:\n\t" << exc.details.text);
+    } catch (const std::exception& exc) {
+      INFOS("Follow exception was cought:\n\t" << exc.what());
+    } catch (...) {
       INFOS("Unknown exception was cought !!!");
     }
   }
 
-
-  class TNodeSimulation{
-    QAD_Study* myStudy;
-    QAD_StudyFrame* myStudyFrame;
-    VTKViewer_ViewFrame* myViewFrame;
+  class TNodeSimulation {
+    SalomeApp_Application* myApplication;
+    SUIT_ViewWindow* myViewWindow;
+    SVTK_ViewWindow* myVTKViewWindow;
 
     SALOME_Actor *myPreviewActor;
     vtkDataSetMapper* myMapper;
     vtkPoints* myPoints;
 
   public:
-
-    TNodeSimulation(QAD_Study* theStudy):
-      myStudy(theStudy),
-      myStudyFrame(theStudy->getActiveStudyFrame()),
-      myViewFrame(GetVtkViewFrame(theStudy->getActiveStudyFrame()))
+    TNodeSimulation (SalomeApp_Application* theApplication)
     {
+      myApplication = theApplication;
+      SUIT_ViewManager* mgr = theApplication->activeViewManager();
+      if (!mgr) return;
+      myViewWindow = mgr->getActiveView();
+      myVTKViewWindow = GetVtkViewWindow(myViewWindow);
+
       vtkUnstructuredGrid* aGrid = vtkUnstructuredGrid::New();
-  
+
       // Create points
       myPoints = vtkPoints::New();
-      myPoints->SetNumberOfPoints( 1 );
+      myPoints->SetNumberOfPoints(1);
       myPoints->SetPoint(0,0.0,0.0,0.0);
-      
+
       // Create cells
       vtkIdList *anIdList = vtkIdList::New();
-      anIdList->SetNumberOfIds( 1 );
+      anIdList->SetNumberOfIds(1);
 
       vtkCellArray *aCells = vtkCellArray::New();
-      aCells->Allocate( 2, 0 );
+      aCells->Allocate(2, 0);
 
       vtkUnsignedCharArray* aCellTypesArray = vtkUnsignedCharArray::New();
-      aCellTypesArray->SetNumberOfComponents( 1 );
-      aCellTypesArray->Allocate( 1 );
-      
-      anIdList->SetId( 0, 0 );
-      aCells->InsertNextCell( anIdList );
-      aCellTypesArray->InsertNextValue( VTK_VERTEX );
-      
+      aCellTypesArray->SetNumberOfComponents(1);
+      aCellTypesArray->Allocate(1);
+
+      anIdList->SetId(0, 0);
+      aCells->InsertNextCell(anIdList);
+      aCellTypesArray->InsertNextValue(VTK_VERTEX);
+
       vtkIntArray* aCellLocationsArray = vtkIntArray::New();
-      aCellLocationsArray->SetNumberOfComponents( 1 );
-      aCellLocationsArray->SetNumberOfTuples( 1 );
-      
+      aCellLocationsArray->SetNumberOfComponents(1);
+      aCellLocationsArray->SetNumberOfTuples(1);
+
       aCells->InitTraversal();
       vtkIdType npts;
-      aCellLocationsArray->SetValue( 0, aCells->GetTraversalLocation( npts ) );
-  
-      aGrid->SetCells( aCellTypesArray, aCellLocationsArray, aCells );
+      aCellLocationsArray->SetValue(0, aCells->GetTraversalLocation(npts));
 
-      aGrid->SetPoints( myPoints );
-      aGrid->SetCells( aCellTypesArray, aCellLocationsArray,aCells );
+      aGrid->SetCells(aCellTypesArray, aCellLocationsArray, aCells);
+
+      aGrid->SetPoints(myPoints);
+      aGrid->SetCells(aCellTypesArray, aCellLocationsArray,aCells);
       aCellLocationsArray->Delete();
       aCellTypesArray->Delete();
       aCells->Delete();
-      anIdList->Delete(); 
+      anIdList->Delete();
 
       // Create and display actor
       myMapper = vtkDataSetMapper::New();
-      myMapper->SetInput( aGrid );
+      myMapper->SetInput(aGrid);
       aGrid->Delete();
 
       myPreviewActor = SALOME_Actor::New();
       myPreviewActor->SetInfinitive(true);
       myPreviewActor->VisibilityOff();
       myPreviewActor->PickableOff();
-      myPreviewActor->SetMapper( myMapper );
+      myPreviewActor->SetMapper(myMapper);
 
       vtkProperty* aProp = vtkProperty::New();
       aProp->SetRepresentationToPoints();
@@ -186,30 +192,29 @@ namespace SMESH{
       float aPointSize = GetFloat("SMESH:SettingsNodesSize",3);
       aProp->SetPointSize(aPointSize);
 
-      myPreviewActor->SetProperty( aProp );
+      myPreviewActor->SetProperty(aProp);
       aProp->Delete();
 
-      myViewFrame->AddActor( myPreviewActor );
-
+      myVTKViewWindow->AddActor(myPreviewActor);
     }
 
-
-    void SetPosition(float x, float y, float z){
+    void SetPosition (float x, float y, float z)
+    {
       myPoints->SetPoint(0,x,y,z);
       myPoints->Modified();
       SetVisibility(true);
     }
 
-
-    void SetVisibility(bool theVisibility){
+    void SetVisibility (bool theVisibility)
+    {
       myPreviewActor->SetVisibility(theVisibility);
       RepaintCurrentView();
     }
 
-
-    ~TNodeSimulation(){
-      if(FindVtkViewFrame(myStudy,myStudyFrame)){
-       myViewFrame->RemoveActor(myPreviewActor);
+    ~TNodeSimulation()
+    {
+      if (FindVtkViewWindow(myApplication->activeViewManager(), myViewWindow)) {
+       myVTKViewWindow->RemoveActor(myPreviewActor);
       }
       myPreviewActor->Delete();
 
@@ -218,121 +223,119 @@ namespace SMESH{
 
       myPoints->Delete();
     }
-
   };
-
 }
 
-
 //=================================================================================
 // class    : SMESHGUI_NodesDlg()
-// purpose  : 
+// purpose  :
 //=================================================================================
-SMESHGUI_NodesDlg::SMESHGUI_NodesDlgQWidget* parent,
+SMESHGUI_NodesDlg::SMESHGUI_NodesDlg (QWidget* parent,
                                      const char* name,
-                                     SALOME_Selection* Sel,
+                                     SalomeApp_SelectionMgr* Sel,
                                      bool modal,
-                                     WFlags fl )
-  : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu |
-            Qt::WDestructiveClose)
+                                     WFlags fl)
+  : QDialog(parent, name, modal, WStyle_Customize | WStyle_NormalBorder |
+            WStyle_Title | WStyle_SysMenu | Qt::WDestructiveClose)
 {
-  mySimulation = new SMESH::TNodeSimulation(SMESH::GetActiveStudy());
-
-  QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "SMESH",tr("ICON_DLG_NODE")));
-  if ( !name )
-    setName( "SMESHGUI_NodesDlg" );
-  resize( 303, 185 ); 
-  setCaption( tr( "MESH_NODE_TITLE"  ) );
-  setSizeGripEnabled( TRUE );
-  SMESHGUI_NodesDlgLayout = new QGridLayout( this ); 
-  SMESHGUI_NodesDlgLayout->setSpacing( 6 );
-  SMESHGUI_NodesDlgLayout->setMargin( 11 );
+  SalomeApp_Application* anApp = dynamic_cast<SalomeApp_Application*>
+    (SUIT_Session::session()->activeApplication());
+  mySimulation = new SMESH::TNodeSimulation (anApp);
+
+  QPixmap image0 (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_DLG_NODE")));
+  if (!name)
+    setName("SMESHGUI_NodesDlg");
+  resize(303, 185);
+  setCaption(tr("MESH_NODE_TITLE"));
+  setSizeGripEnabled(TRUE);
+  SMESHGUI_NodesDlgLayout = new QGridLayout(this);
+  SMESHGUI_NodesDlgLayout->setSpacing(6);
+  SMESHGUI_NodesDlgLayout->setMargin(11);
 
   /***************************************************************/
-  GroupButtons = new QGroupBox( this, "GroupButtons" );
-  GroupButtons->setGeometry( QRect( 10, 10, 281, 48 ) ); 
-  GroupButtons->setTitle( tr( ""  ) );
-  GroupButtons->setColumnLayout(0, Qt::Vertical );
-  GroupButtons->layout()->setSpacing( 0 );
-  GroupButtons->layout()->setMargin( 0 );
-  GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
-  GroupButtonsLayout->setAlignment( Qt::AlignTop );
-  GroupButtonsLayout->setSpacing( 6 );
-  GroupButtonsLayout->setMargin( 11 );
-  buttonCancel = new QPushButton( GroupButtons, "buttonCancel" );
-  buttonCancel->setText( tr( "SMESH_BUT_CLOSE"  ) );
-  buttonCancel->setAutoDefault( TRUE );
-  GroupButtonsLayout->addWidget( buttonCancel, 0, 3 );
-  buttonApply = new QPushButton( GroupButtons, "buttonApply" );
-  buttonApply->setText( tr( "SMESH_BUT_APPLY"  ) );
-  buttonApply->setAutoDefault( TRUE );
-  GroupButtonsLayout->addWidget( buttonApply, 0, 1 );
-  QSpacerItem* spacer_9 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
-  GroupButtonsLayout->addItem( spacer_9, 0, 2 );
-  buttonOk = new QPushButton( GroupButtons, "buttonOk" );
-  buttonOk->setText( tr( "SMESH_BUT_OK"  ) );
-  buttonOk->setAutoDefault( TRUE );
-  buttonOk->setDefault( TRUE );
-  GroupButtonsLayout->addWidget( buttonOk, 0, 0 );
-  SMESHGUI_NodesDlgLayout->addWidget( GroupButtons, 2, 0 );
+  GroupButtons = new QGroupBox(this, "GroupButtons");
+  GroupButtons->setGeometry(QRect(10, 10, 281, 48));
+  GroupButtons->setTitle(tr("" ));
+  GroupButtons->setColumnLayout(0, Qt::Vertical);
+  GroupButtons->layout()->setSpacing(0);
+  GroupButtons->layout()->setMargin(0);
+  GroupButtonsLayout = new QGridLayout(GroupButtons->layout());
+  GroupButtonsLayout->setAlignment(Qt::AlignTop);
+  GroupButtonsLayout->setSpacing(6);
+  GroupButtonsLayout->setMargin(11);
+  buttonCancel = new QPushButton(GroupButtons, "buttonCancel");
+  buttonCancel->setText(tr("SMESH_BUT_CLOSE" ));
+  buttonCancel->setAutoDefault(TRUE);
+  GroupButtonsLayout->addWidget(buttonCancel, 0, 3);
+  buttonApply = new QPushButton(GroupButtons, "buttonApply");
+  buttonApply->setText(tr("SMESH_BUT_APPLY" ));
+  buttonApply->setAutoDefault(TRUE);
+  GroupButtonsLayout->addWidget(buttonApply, 0, 1);
+  QSpacerItem* spacer_9 = new QSpacerItem(20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
+  GroupButtonsLayout->addItem(spacer_9, 0, 2);
+  buttonOk = new QPushButton(GroupButtons, "buttonOk");
+  buttonOk->setText(tr("SMESH_BUT_OK" ));
+  buttonOk->setAutoDefault(TRUE);
+  buttonOk->setDefault(TRUE);
+  GroupButtonsLayout->addWidget(buttonOk, 0, 0);
+  SMESHGUI_NodesDlgLayout->addWidget(GroupButtons, 2, 0);
 
   /***************************************************************/
-  GroupConstructors = new QButtonGroup( this, "GroupConstructors" );
-  GroupConstructors->setTitle( tr( "MESH_NODE"  ) );
-  GroupConstructors->setExclusive( TRUE );
-  GroupConstructors->setColumnLayout(0, Qt::Vertical );
-  GroupConstructors->layout()->setSpacing( 0 );
-  GroupConstructors->layout()->setMargin( 0 );
-  GroupConstructorsLayout = new QGridLayout( GroupConstructors->layout() );
-  GroupConstructorsLayout->setAlignment( Qt::AlignTop );
-  GroupConstructorsLayout->setSpacing( 6 );
-  GroupConstructorsLayout->setMargin( 11 );
-  Constructor1 = new QRadioButton( GroupConstructors, "Constructor1" );
-  Constructor1->setText( tr( ""  ) );
-  Constructor1->setPixmap( image0 );
-  Constructor1->setChecked( TRUE );
-  GroupConstructorsLayout->addWidget( Constructor1, 0, 0 );
-  QSpacerItem* spacer_2 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
-  GroupConstructorsLayout->addItem( spacer_2, 0, 1 );
-  SMESHGUI_NodesDlgLayout->addWidget( GroupConstructors, 0, 0 );
+  GroupConstructors = new QButtonGroup(this, "GroupConstructors");
+  GroupConstructors->setTitle(tr("MESH_NODE" ));
+  GroupConstructors->setExclusive(TRUE);
+  GroupConstructors->setColumnLayout(0, Qt::Vertical);
+  GroupConstructors->layout()->setSpacing(0);
+  GroupConstructors->layout()->setMargin(0);
+  GroupConstructorsLayout = new QGridLayout(GroupConstructors->layout());
+  GroupConstructorsLayout->setAlignment(Qt::AlignTop);
+  GroupConstructorsLayout->setSpacing(6);
+  GroupConstructorsLayout->setMargin(11);
+  Constructor1 = new QRadioButton(GroupConstructors, "Constructor1");
+  Constructor1->setText(tr("" ));
+  Constructor1->setPixmap(image0);
+  Constructor1->setChecked(TRUE);
+  GroupConstructorsLayout->addWidget(Constructor1, 0, 0);
+  QSpacerItem* spacer_2 = new QSpacerItem(20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
+  GroupConstructorsLayout->addItem(spacer_2, 0, 1);
+  SMESHGUI_NodesDlgLayout->addWidget(GroupConstructors, 0, 0);
 
   /***************************************************************/
-  GroupCoordinates = new QGroupBox( this, "GroupCoordinates" );
-  GroupCoordinates->setTitle( tr( "SMESH_COORDINATES"  ) );
-  GroupCoordinates->setColumnLayout(0, Qt::Vertical );
-  GroupCoordinates->layout()->setSpacing( 0 );
-  GroupCoordinates->layout()->setMargin( 0 );
-  GroupCoordinatesLayout = new QGridLayout( GroupCoordinates->layout() );
-  GroupCoordinatesLayout->setAlignment( Qt::AlignTop );
-  GroupCoordinatesLayout->setSpacing( 6 );
-  GroupCoordinatesLayout->setMargin( 11 );
-  TextLabel_X = new QLabel( GroupCoordinates, "TextLabel_X" );
-  TextLabel_X->setText( tr( "SMESH_X"  ) );
-  GroupCoordinatesLayout->addWidget( TextLabel_X, 0, 0 );
-  TextLabel_Y = new QLabel( GroupCoordinates, "TextLabel_Y" );
-  TextLabel_Y->setText( tr( "SMESH_Y"  ) );
-  GroupCoordinatesLayout->addWidget( TextLabel_Y, 0, 2 );
-  
-  TextLabel_Z = new QLabel( GroupCoordinates, "TextLabel_Z" );
-  TextLabel_Z->setText( tr( "SMESH_Z"  ) );
-  GroupCoordinatesLayout->addWidget( TextLabel_Z, 0, 4 );
-  
-  SpinBox_X = new SMESHGUI_SpinBox( GroupCoordinates, "SpinBox_X" ) ;
-  GroupCoordinatesLayout->addWidget( SpinBox_X, 0, 1 );
-
-  SpinBox_Y = new SMESHGUI_SpinBox( GroupCoordinates, "SpinBox_Y" ) ;
-  GroupCoordinatesLayout->addWidget( SpinBox_Y, 0, 3 );
-  SpinBox_Z = new SMESHGUI_SpinBox( GroupCoordinates, "SpinBox_Z" ) ;
-  GroupCoordinatesLayout->addWidget( SpinBox_Z, 0, 5 );
-
-  SMESHGUI_NodesDlgLayout->addWidget( GroupCoordinates, 1, 0 );
+  GroupCoordinates = new QGroupBox(this, "GroupCoordinates");
+  GroupCoordinates->setTitle(tr("SMESH_COORDINATES" ));
+  GroupCoordinates->setColumnLayout(0, Qt::Vertical);
+  GroupCoordinates->layout()->setSpacing(0);
+  GroupCoordinates->layout()->setMargin(0);
+  GroupCoordinatesLayout = new QGridLayout(GroupCoordinates->layout());
+  GroupCoordinatesLayout->setAlignment(Qt::AlignTop);
+  GroupCoordinatesLayout->setSpacing(6);
+  GroupCoordinatesLayout->setMargin(11);
+  TextLabel_X = new QLabel(GroupCoordinates, "TextLabel_X");
+  TextLabel_X->setText(tr("SMESH_X" ));
+  GroupCoordinatesLayout->addWidget(TextLabel_X, 0, 0);
+  TextLabel_Y = new QLabel(GroupCoordinates, "TextLabel_Y");
+  TextLabel_Y->setText(tr("SMESH_Y" ));
+  GroupCoordinatesLayout->addWidget(TextLabel_Y, 0, 2);
+
+  TextLabel_Z = new QLabel(GroupCoordinates, "TextLabel_Z");
+  TextLabel_Z->setText(tr("SMESH_Z" ));
+  GroupCoordinatesLayout->addWidget(TextLabel_Z, 0, 4);
+
+  SpinBox_X = new SMESHGUI_SpinBox(GroupCoordinates, "SpinBox_X");
+  GroupCoordinatesLayout->addWidget(SpinBox_X, 0, 1);
+
+  SpinBox_Y = new SMESHGUI_SpinBox(GroupCoordinates, "SpinBox_Y");
+  GroupCoordinatesLayout->addWidget(SpinBox_Y, 0, 3);
+
+  SpinBox_Z = new SMESHGUI_SpinBox(GroupCoordinates, "SpinBox_Z");
+  GroupCoordinatesLayout->addWidget(SpinBox_Z, 0, 5);
+
+  SMESHGUI_NodesDlgLayout->addWidget(GroupCoordinates, 1, 0);
+
   /* Initialisation and display */
-  Init(Sel) ;
+  Init(Sel);
 }
 
-
 //=======================================================================
 // function : ~SMESHGUI_NodesDlg()
 // purpose  : Destructor
@@ -342,54 +345,57 @@ SMESHGUI_NodesDlg::~SMESHGUI_NodesDlg()
   delete mySimulation;
 }
 
-
 //=================================================================================
 // function : Init()
 // purpose  :
 //=================================================================================
-void SMESHGUI_NodesDlg::Init(SALOME_Selection* Sel)
+void SMESHGUI_NodesDlg::Init (SalomeApp_SelectionMgr* Sel)
 {
   /* Get setting of step value from file configuration */
-  double step ;
-  // QString St = QAD_CONFIG->getSetting( "xxxxxxxxxxxxx" ) ;  TODO
-  // step = St.toDouble() ;                                    TODO
-  step = 25.0 ;
-  
+  double step;
+  // QString St = SUIT_CONFIG->getSetting("xxxxxxxxxxxxx");  TODO
+  // step = St.toDouble();                                    TODO
+  step = 25.0;
+
   /* min, max, step and decimals for spin boxes */
-  SpinBox_X->RangeStepAndValidator( -999.999, +999.999, step, 3 ) ;
-  SpinBox_Y->RangeStepAndValidator( -999.999, +999.999, step, 3 ) ;
-  SpinBox_Z->RangeStepAndValidator( -999.999, +999.999, step, 3 ) ;  
-  SpinBox_X->SetValue( 0.0 ) ;
-  SpinBox_Y->SetValue( 0.0 ) ;
-  SpinBox_Z->SetValue( 0.0 ) ;
-  
-  mySelection = Sel ;
-  myMeshGUI = SMESHGUI::GetSMESHGUI() ;   
-  myMeshGUI->SetActiveDialogBox( (QDialog*)this ) ;
-  
+  SpinBox_X->RangeStepAndValidator(-999.999, +999.999, step, 3);
+  SpinBox_Y->RangeStepAndValidator(-999.999, +999.999, step, 3);
+  SpinBox_Z->RangeStepAndValidator(-999.999, +999.999, step, 3);
+  SpinBox_X->SetValue(0.0);
+  SpinBox_Y->SetValue(0.0);
+  SpinBox_Z->SetValue(0.0);
+
+  mySelectionMgr = Sel;
+  myMeshGUI = SMESHGUI::GetSMESHGUI();
+  myMeshGUI->SetActiveDialogBox((QDialog*)this);
+
   /* signals and slots connections */
-  connect( buttonOk, SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
-  connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) );
-  connect( buttonApply, SIGNAL( clicked() ), this, SLOT(ClickOnApply() ) );
-  
-  connect( SpinBox_X, SIGNAL ( valueChanged(double) ), SLOT( ValueChangedInSpinBox(double) )) ;
-  connect( SpinBox_Y, SIGNAL ( valueChanged(double) ), SLOT( ValueChangedInSpinBox(double) )) ;
-  connect( SpinBox_Z, SIGNAL ( valueChanged(double) ), SLOT( ValueChangedInSpinBox(double) )) ;
-
-  connect( mySelection, SIGNAL( currentSelectionChanged() ), SLOT( SelectionIntoArgument() ));
-  connect( myMeshGUI, SIGNAL ( SignalDeactivateActiveDialog() ), SLOT( DeactivateActiveDialog() )) ;
+  connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk()));
+  connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel()));
+  connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply()));
+
+  connect(SpinBox_X, SIGNAL (valueChanged(double)), SLOT(ValueChangedInSpinBox(double)));
+  connect(SpinBox_Y, SIGNAL (valueChanged(double)), SLOT(ValueChangedInSpinBox(double)));
+  connect(SpinBox_Z, SIGNAL (valueChanged(double)), SLOT(ValueChangedInSpinBox(double)));
+
+  connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), SLOT(SelectionIntoArgument()));
+  connect(myMeshGUI, SIGNAL (SignalDeactivateActiveDialog()), SLOT(DeactivateActiveDialog()));
   /* to close dialog if study frame change */
-  connect( myMeshGUI, SIGNAL ( SignalStudyFrameChanged() ), SLOT( ClickOnCancel() ) ) ;
+  connect(myMeshGUI, SIGNAL (SignalStudyFrameChanged()), SLOT(ClickOnCancel()));
+
   /* Move widget on the botton right corner of main widget */
-  int x, y ;
-  myMeshGUI->DefineDlgPosition( this, x, y ) ;
-  this->move( x, y ) ;
-  this->show() ;
+  int x, y;
+  myMeshGUI->DefineDlgPosition(this, x, y);
+  this->move(x, y);
+  this->show();
 
   // set selection mode
   SMESH::SetPointRepresentation(true);
-  QAD_Application::getDesktop()->SetSelectionMode( NodeSelection, true );
+#ifdef NEW_GUI
+  mySelectionMgr->setSelectionModes(NodeSelection, true);
+#else
+  mySelectionMgr->setSelectionModes(NodeSelection);
+#endif
 
   SelectionIntoArgument();
 }
@@ -398,16 +404,15 @@ void SMESHGUI_NodesDlg::Init(SALOME_Selection* Sel)
 // function : ValueChangedInSpinBox()
 // purpose  :
 //=================================================================================
-void SMESHGUI_NodesDlg::ValueChangedInSpinBox( double newValue )
+void SMESHGUI_NodesDlg::ValueChangedInSpinBox (double newValue)
 {
-  if(!myMesh->_is_nil()){
-    double vx = SpinBox_X->GetValue() ;
-    double vy = SpinBox_Y->GetValue() ;
-    double vz = SpinBox_Z->GetValue() ;
+  if (!myMesh->_is_nil()) {
+    double vx = SpinBox_X->GetValue();
+    double vy = SpinBox_Y->GetValue();
+    double vz = SpinBox_Z->GetValue();
 
     mySimulation->SetPosition(vx,vy,vz);
   }
-  return ;
 }
 
 //=================================================================================
@@ -416,73 +421,83 @@ void SMESHGUI_NodesDlg::ValueChangedInSpinBox( double newValue )
 //=================================================================================
 void SMESHGUI_NodesDlg::ClickOnOk()
 {
-  if ( ClickOnApply() )
-    ClickOnCancel() ;
+  if (ClickOnApply())
+    ClickOnCancel();
 }
 
-//=======================================================================
+//=================================================================================
 // function : ClickOnApply()
 // purpose  :
-//=======================================================================
+//=================================================================================
 bool SMESHGUI_NodesDlg::ClickOnApply()
 {
-  if (myMeshGUI->ActiveStudyLocked())
+  if (myMeshGUI->isActiveStudyLocked())
     return false;
 
-  if ( myMesh->_is_nil() ) {
-    QAD_MessageBox::warn1(QAD_Application::getDesktop(),
-                          tr("SMESH_WRN_WARNING"),
-                          tr("MESH_IS_NOT_SELECTED"),
-                          tr("SMESH_BUT_OK"));
+  if (myMesh->_is_nil()) {
+    SUIT_MessageBox::warn1(SMESHGUI::desktop(), tr("SMESH_WRN_WARNING"),
+                           tr("MESH_IS_NOT_SELECTED"), tr("SMESH_BUT_OK"));
     return false;
   }
-                              
+
   /* Recup args and call method */
-  double x = SpinBox_X->GetValue() ;
-  double y = SpinBox_Y->GetValue() ;
-  double z = SpinBox_Z->GetValue() ;
+  double x = SpinBox_X->GetValue();
+  double y = SpinBox_Y->GetValue();
+  double z = SpinBox_Z->GetValue();
   mySimulation->SetVisibility(false);
-  SMESH::AddNode(myMesh,x,y,z) ; 
+  SMESH::AddNode(myMesh,x,y,z);
   SMESH::SetPointRepresentation(true);
 
   // select myMesh
-  if ( mySelection->IObjectCount() != 1 ) {
-    if(VTKViewer_ViewFrame* aViewFrame = SMESH::GetCurrentVtkView()) {
-      vtkActorCollection *aCollection = aViewFrame->getRenderer()->GetActors();
+  SALOME_ListIO aList;
+  mySelectionMgr->selectedObjects(aList);
+  if (aList.Extent() != 1) {
+    if (SVTK_ViewWindow* aViewWindow = SMESH::GetCurrentVtkView()) {
+      vtkActorCollection *aCollection = aViewWindow->getRenderer()->GetActors();
       aCollection->InitTraversal();
-      while(vtkActor *anAct = aCollection->GetNextActor()){
-        if(SMESH_Actor *anActor = dynamic_cast<SMESH_Actor*>(anAct))
-          if(anActor->hasIO())
-            if(SMESH_MeshObj *aMeshObj = dynamic_cast<SMESH_MeshObj*>(anActor->GetObject().get()))
-              if(myMesh->_is_equivalent( aMeshObj->GetMeshServer() ))
-              {
-                mySelection->ClearIObjects();
-                mySelection->AddIObject( anActor->getIO(), false );
+      while (vtkActor *anAct = aCollection->GetNextActor()) {
+        if (SMESH_Actor *anActor = dynamic_cast<SMESH_Actor*>(anAct)) {
+          if (anActor->hasIO()) {
+            if (SMESH_MeshObj *aMeshObj = dynamic_cast<SMESH_MeshObj*>(anActor->GetObject().get())) {
+              if (myMesh->_is_equivalent(aMeshObj->GetMeshServer())) {
+#ifdef NEW_GUI
+                mySelectionMgr->clearSelected();
+                mySelectionMgr->AddIObject(anActor->getIO(), false);
+#else
+                aList.Clear();
+                aList.Append(anActor->getIO());
+                mySelectionMgr->setSelectedObjects(aList, false);
+#endif
                 break;
               }
+            }
+          }
+        }
       }
     }
   }
   return true;
 }
 
-
-//=======================================================================
+//=================================================================================
 // function : ClickOnCancel()
 // purpose  :
-//=======================================================================
+//=================================================================================
 void SMESHGUI_NodesDlg::ClickOnCancel()
 {
-  mySelection->ClearIObjects();
+  MESSAGE("SMESHGUI_NodesDlg::ClickOnCancel() 1");
+  disconnect(mySelectionMgr, 0, this, 0);
+  mySelectionMgr->clearSelected();
+  mySelectionMgr->setSelectionModes(ActorSelection);
+
+  MESSAGE("SMESHGUI_NodesDlg::ClickOnCancel() 2");
   mySimulation->SetVisibility(false);
   SMESH::SetPointRepresentation(false);
-  QAD_Application::getDesktop()->SetSelectionMode( ActorSelection );
-  disconnect( mySelection, 0, this, 0 );
   myMeshGUI->ResetState();
-  reject() ;
-  return ;
-}
 
+  reject();
+  MESSAGE("SMESHGUI_NodesDlg::ClickOnCancel() 3");
+}
 
 //=================================================================================
 // function : SelectionIntoArgument()
@@ -490,26 +505,28 @@ void SMESHGUI_NodesDlg::ClickOnCancel()
 //=================================================================================
 void SMESHGUI_NodesDlg::SelectionIntoArgument()
 {
-  if ( !GroupConstructors->isEnabled() )
+  if (!GroupConstructors->isEnabled())
     return;
 
   mySimulation->SetVisibility(false);
   SMESH::SetPointRepresentation(true);
 
-  if(mySelection->IObjectCount() == 1){
-    Handle(SALOME_InteractiveObject) anIO = mySelection->firstIObject();
-    if(anIO->hasEntry()){
+  SALOME_ListIO aList;
+  mySelectionMgr->selectedObjects(aList);
+  if (aList.Extent() == 1) {
+    Handle(SALOME_InteractiveObject) anIO = aList.First();
+    if (anIO->hasEntry()) {
       myMesh = SMESH::GetMeshByIO(anIO);
-      if(myMesh->_is_nil()) return;
+      if (myMesh->_is_nil()) return;
       QString aText;
-      if(SMESH::GetNameOfSelectedNodes( mySelection, aText ) == 1){
-       if(SMESH_Actor* anActor = SMESH::FindActorByObject(myMesh.in())){
-         if(SMDS_Mesh* aMesh = anActor->GetObject()->GetMesh()){
-           if(const SMDS_MeshNode* aNode = aMesh->FindNode(aText.toInt())){
-             SpinBox_X->SetValue( aNode->X() );
-             SpinBox_Y->SetValue( aNode->Y() ) ;
-             SpinBox_Z->SetValue( aNode->Z() ) ;
-             }
+      if (SMESH::GetNameOfSelectedNodes(mySelectionMgr, aText) == 1) {
+       if (SMESH_Actor* anActor = SMESH::FindActorByObject(myMesh.in())) {
+         if (SMDS_Mesh* aMesh = anActor->GetObject()->GetMesh()) {
+           if (const SMDS_MeshNode* aNode = aMesh->FindNode(aText.toInt())) {
+             SpinBox_X->SetValue(aNode->X());
+             SpinBox_Y->SetValue(aNode->Y());
+             SpinBox_Z->SetValue(aNode->Z());
+            }
          }
        }
       }
@@ -520,24 +537,22 @@ void SMESHGUI_NodesDlg::SelectionIntoArgument()
   }
 }
 
-
-//=======================================================================
+//=================================================================================
 // function : closeEvent()
 // purpose  :
-//=======================================================================
-void SMESHGUI_NodesDlg::closeEvent(QCloseEvent* e)
+//=================================================================================
+void SMESHGUI_NodesDlg::closeEvent (QCloseEvent*)
 {
-  this->ClickOnCancel() ; /* same than click on cancel button */
+  this->ClickOnCancel(); /* same than click on cancel button */
 }
 
-//=======================================================================
-//function : hideEvent
-//purpose  : caused by ESC key
-//=======================================================================
-
-void SMESHGUI_NodesDlg::hideEvent ( QHideEvent * e )
+//=================================================================================
+// function : hideEvent()
+// purpose  : caused by ESC key
+//=================================================================================
+void SMESHGUI_NodesDlg::hideEvent (QHideEvent*)
 {
-  if ( !isMinimized() )
+  if (!isMinimized())
     ClickOnCancel();
 }
 
@@ -545,43 +560,45 @@ void SMESHGUI_NodesDlg::hideEvent ( QHideEvent * e )
 // function : enterEvent()
 // purpose  : to reactivate this dialog box when mouse enter onto the window
 //=================================================================================
-void SMESHGUI_NodesDlg::enterEvent( QEvent* e)
+void SMESHGUI_NodesDlg::enterEvent(QEvent*)
 {
-  if ( !GroupConstructors->isEnabled() )
-    ActivateThisDialog() ;
+  if (!GroupConstructors->isEnabled())
+    ActivateThisDialog();
 }
 
-
 //=================================================================================
 // function : DeactivateActiveDialog()
 // purpose  : public slot to deactivate if active
 //=================================================================================
 void SMESHGUI_NodesDlg::DeactivateActiveDialog()
 {
-  if ( GroupConstructors->isEnabled() ) {
-    GroupConstructors->setEnabled(false) ;
-    GroupCoordinates->setEnabled(false) ;
-    GroupButtons->setEnabled(false) ;
-    mySimulation->SetVisibility(false) ;
-    myMeshGUI->ResetState() ;    
-    myMeshGUI->SetActiveDialogBox(0) ;
+  if (GroupConstructors->isEnabled()) {
+    GroupConstructors->setEnabled(false);
+    GroupCoordinates->setEnabled(false);
+    GroupButtons->setEnabled(false);
+    mySimulation->SetVisibility(false);
+    myMeshGUI->ResetState();
+    myMeshGUI->SetActiveDialogBox(0);
   }
 }
 
-
 //=================================================================================
 // function : ActivateThisDialog()
 // purpose  :
 //=================================================================================
-void SMESHGUI_NodesDlg::ActivateThisDialog( )
+void SMESHGUI_NodesDlg::ActivateThisDialog()
 {
-  myMeshGUI->EmitSignalDeactivateDialog() ;
-  GroupConstructors->setEnabled(true) ;
-  GroupCoordinates->setEnabled(true) ;
-  GroupButtons->setEnabled(true) ;
+  myMeshGUI->EmitSignalDeactivateDialog();
+  GroupConstructors->setEnabled(true);
+  GroupCoordinates->setEnabled(true);
+  GroupButtons->setEnabled(true);
 
   SMESH::SetPointRepresentation(true);
-  QAD_Application::getDesktop()->SetSelectionMode( NodeSelection, true );
+#ifdef NEW_GUI
+  mySelectionMgr->setSelectionModes(NodeSelection, true);
+#else
+  mySelectionMgr->setSelectionModes(NodeSelection);
+#endif
 
   SelectionIntoArgument();
 }
index 8cf17d17d15ec07dcc7cb8ddaca6ffebb9e6b30d..50e84b15526ab3741244739fcce97d9dcbf5e38d 100644 (file)
@@ -29,7 +29,7 @@
 #ifndef DIALOGBOX_NODES_H
 #define DIALOGBOX_NODES_H
 
-#include "SALOME_Selection.h"
+#include "SalomeApp_SelectionMgr.h"
 
 #include <qvariant.h>
 #include <qdialog.h>
@@ -64,25 +64,25 @@ class SMESHGUI_NodesDlg : public QDialog
     Q_OBJECT
 
 public:
-    SMESHGUI_NodesDlgQWidget* parent = 0, const char* name = 0,
-                      SALOME_Selection* Sel = 0,
+    SMESHGUI_NodesDlg (QWidget* parent = 0, const char* name = 0,
+                      SalomeApp_SelectionMgr* Sel = 0,
                       bool modal = FALSE,
-                      WFlags fl = 0 );
+                      WFlags fl = 0);
 
     ~SMESHGUI_NodesDlg();
-    
-private :
 
-    SALOME_Selection* mySelection ;
-    SMESHGUI*         myMeshGUI ;
+private:
 
-    SMESH::SMESH_Mesh_var myMesh;
+    SalomeApp_SelectionMgr* mySelectionMgr;
+    SMESHGUI*               myMeshGUI;
+
+    SMESH::SMESH_Mesh_var   myMesh;
     SMESH::TNodeSimulation* mySimulation;
 
-    void Init(SALOME_Selection* Sel) ;
+    void Init (SalomeApp_SelectionMgr*);
     void enterEvent(QEvent* e);
-    void closeEvent(QCloseEvent* e) ;
-    void hideEvent ( QHideEvent * );                 /* ESC key */
+    void closeEvent(QCloseEvent*);
+    void hideEvent (QHideEvent *);                 /* ESC key */
 
     QButtonGroup* GroupConstructors;
     QRadioButton* Constructor1;
@@ -118,4 +118,3 @@ protected:
 };
 
 #endif // DIALOGBOX_NODES_H
-
index e552b9d7d0bccd654abf50dce21747cebcdb726a..718162f2b55452b340d3382270f895b18e402583 100644 (file)
 
 
 #include "SMESHGUI_PatternUtils.h"
-#include "SMESHGUI_SMESHGenUtils.h"
 
+#include "SMESHGUI.h"
 
-namespace SMESH{
+namespace SMESH {
 
   SMESH::SMESH_Pattern_var GetPattern()
   {
-    return GetSMESHGen()->GetPattern();
+    return SMESHGUI::GetSMESHGen()->GetPattern();
   }
-
 }
index 80614980c442c934e3e7d53b14751914cde60d12..178800a6273be63f8b945988b7a8e88edeac8325 100644 (file)
@@ -1,30 +1,30 @@
 //  SMESH SMESHGUI : GUI for SMESH component
 //
 //  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
-// 
-//  This library is free software; you can redistribute it and/or 
-//  modify it under the terms of the GNU Lesser General Public 
-//  License as published by the Free Software Foundation; either 
-//  version 2.1 of the License. 
-// 
-//  This library is distributed in the hope that it will be useful, 
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of 
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
-//  Lesser General Public License for more details. 
-// 
-//  You should have received a copy of the GNU Lesser General Public 
-//  License along with this library; if not, write to the Free Software 
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
-// 
-//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
 //
 //
 //
 //  File   : SMESHGUI_PatternWidget.cxx
 //  Author : Michael ZORIN
 //  Module : SMESH
-//  $Header: 
+//  $Header:
 
 #include "SMESHGUI_PatternWidget.h"
 
 
 //=================================================================================
 // class    : SMESHGUI_PatternWidget()
-// purpose  : 
+// purpose  :
 //=================================================================================
-SMESHGUI_PatternWidget::SMESHGUI_PatternWidget( QWidget* parent, const char* name, WFlags fl )
-                                  : QFrame( parent, name, WStyle_Customize)
+SMESHGUI_PatternWidget::SMESHGUI_PatternWidget (QWidget* parent, const char* name, WFlags fl)
+     : QFrame(parent, name, WStyle_Customize)
 {
   myMinU =  myMinV =  myMaxU =  myMaxV = 0;
   setMinimumHeight(150);
   repaint();
 }
 
-
-
 //=================================================================================
 // function : ~SMESHGUI_PatternWidget()
-// purpose  : 
+// purpose  :
 //=================================================================================
 SMESHGUI_PatternWidget::~SMESHGUI_PatternWidget()
 {
 }
 
-
 //=================================================================================
-// function : SMESHGUI_PatternWidget::SetPoints
-// purpose  : 
+// function : SetPoints()
+// purpose  :
 //=================================================================================
-void SMESHGUI_PatternWidget::SetPoints( PointVector thePoints,  QValueVector<int> theKeys, ConnectivityVector theConnections )
+void SMESHGUI_PatternWidget::SetPoints (PointVector thePoints,
+                                        QValueVector<int> theKeys,
+                                        ConnectivityVector theConnections)
 {
   myPoints = thePoints;
   myKeys = theKeys;
   myConnections  = theConnections;
-  
+
   if (!thePoints.size())
     return;
-  
+
   myMinU = myMaxU = (thePoints[0]).x;
   myMinV = myMaxV = (thePoints[0]).y;
   double x, y;
-  
-  for (int i = 1; i < thePoints.size(); i++)
-    {
-      x = (thePoints[i]).x;
-      y = (thePoints[i]).y;
-      
-      if ( myMinU > x )
-       myMinU = x;
-      if ( myMaxU < x)
-       myMaxU = x;
-      if ( myMinV > y )
-       myMinV = y;
-      if ( myMaxV < y)
-       myMaxV = y;
-    }
-  
+
+  for (int i = 1; i < thePoints.size(); i++) {
+    x = (thePoints[i]).x;
+    y = (thePoints[i]).y;
+
+    if (myMinU > x)
+      myMinU = x;
+    if (myMaxU < x)
+      myMaxU = x;
+    if (myMinV > y)
+      myMinV = y;
+    if (myMaxV < y)
+      myMaxV = y;
+  }
+
   repaint();
 }
 
@@ -95,77 +93,73 @@ static const int Shift  = 4; // shift of the point number from point
 static const int Border = 20;
 
 //=================================================================================
-// function : SMESHGUI_PatternWidget::paintEvent
-// purpose  : 
+// function : paintEvent()
+// purpose  :
 //=================================================================================
-void SMESHGUI_PatternWidget::paintEvent( QPaintEvent * )
+void SMESHGUI_PatternWidget::paintEvent (QPaintEvent*)
 {
-  QPainter paint( this );
-  paint.setBrush (Qt::SolidPattern ); 
+  QPainter paint (this);
+  paint.setBrush(Qt::SolidPattern);
 
   //Draw points
   const int aRadius = 3; // radius of a point
-  
-  for (int i = 0; i < myKeys.size() && i < myPoints.size(); i++)
-    {
-      SMESH::PointStruct aPoint = myPoints[ myKeys[i] ];
-      QPoint aQPnt = MapCoords( aPoint.x, aPoint.y);
-      
-      paint.drawPie( aQPnt.x() - aRadius, aQPnt.y() - aRadius, aRadius*2, aRadius*2, 5760, 5760 );
-      paint.drawText( aQPnt.x() +  Shift, aQPnt.y() -   Shift, QString::number( i+1 ) );
-    }
-  
+
+  for (int i = 0; i < myKeys.size() && i < myPoints.size(); i++) {
+    SMESH::PointStruct aPoint = myPoints[ myKeys[i] ];
+    QPoint aQPnt = MapCoords(aPoint.x, aPoint.y);
+
+    paint.drawPie(aQPnt.x() - aRadius, aQPnt.y() - aRadius, aRadius*2, aRadius*2, 5760, 5760);
+    paint.drawText(aQPnt.x() +  Shift, aQPnt.y() -   Shift, QString::number(i+1));
+  }
+
   //Draw lines
-  for (int i = 0; i < myConnections.size(); i++)
-    {
-      QValueVector<int> aCVector = myConnections[i];
-
-      if ( aCVector.size() == 0 )
-        continue;
-      
-      SMESH::PointStruct aPoint = myPoints[ aCVector[0] ];
-      const QPoint aBeginPnt = MapCoords( aPoint.x, aPoint.y);
-      QPoint aFirstPnt = aBeginPnt, aSecondPnt;  
-      
-      for (int j = 1; j < aCVector.size(); j++)
-       {
-         aPoint = myPoints[ aCVector[j] ];
-         aSecondPnt = MapCoords( aPoint.x, aPoint.y);
-         paint.drawLine(aFirstPnt, aSecondPnt);
-         aFirstPnt = aSecondPnt;
-       }
-      
-      paint.drawLine(aBeginPnt, aSecondPnt);
+  for (int i = 0; i < myConnections.size(); i++) {
+    QValueVector<int> aCVector = myConnections[i];
+
+    if (aCVector.size() == 0)
+      continue;
+
+    SMESH::PointStruct aPoint = myPoints[ aCVector[0] ];
+    const QPoint aBeginPnt = MapCoords(aPoint.x, aPoint.y);
+    QPoint aFirstPnt = aBeginPnt, aSecondPnt;
+
+    for (int j = 1; j < aCVector.size(); j++) {
+      aPoint = myPoints[ aCVector[j] ];
+      aSecondPnt = MapCoords(aPoint.x, aPoint.y);
+      paint.drawLine(aFirstPnt, aSecondPnt);
+      aFirstPnt = aSecondPnt;
     }
-}
 
+    paint.drawLine(aBeginPnt, aSecondPnt);
+  }
+}
 
 //=================================================================================
-// function : SMESHGUI_PatternWidget::MapCoords
-// purpose  : 
+// function : MapCoords()
+// purpose  :
 //=================================================================================
-QPoint SMESHGUI_PatternWidget::MapCoords( const double u, const double v )
+QPoint SMESHGUI_PatternWidget::MapCoords (const double u, const double v)
 {
   int aWidth  = width()  - 2*Border;
   int aHeight = height() - 2*Border;
 
   double aUBound = myMaxU - myMinU;
   double aVBound = myMaxV - myMinV;
-  
+
   double aUScale = aWidth/aUBound;
   double aVScale = aHeight/aVBound;
-  
+
   double aScale;
   aUScale <= aVScale ? aScale = aUScale : aScale = aVScale;
 
-  double aUMiddle = ( myMaxU + myMinU )/2;
-  double aVMiddle = ( myMaxV + myMinV )/2;
-  
-  int x = int(  aWidth/2  + (u - aUMiddle)*aScale + Border - Shift);
-  
-  int y = int(  aHeight/2 + (aVMiddle - v)*aScale + Border + Shift);
-  
+  double aUMiddle = (myMaxU + myMinU)/2;
+  double aVMiddle = (myMaxV + myMinV)/2;
+
+  int x = int(aWidth/2  + (u - aUMiddle)*aScale + Border - Shift);
+
+  int y = int(aHeight/2 + (aVMiddle - v)*aScale + Border + Shift);
+
   QPoint aPoint = QPoint(x, y);
-  
+
   return aPoint;
 }
index 2255978a660b355694606fda90094741992e69a8..5024a235edc4b8fc712a5a1947610112e5623582 100755 (executable)
@@ -1,22 +1,22 @@
 //  SMESH SMESHGUI : GUI for SMESH 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 
-// 
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
 //  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
 //
 //
 //  Module : SMESH
 
 #include "SMESHGUI_PrecisionDlg.h"
-#include "QAD_Config.h"
+
 #include "SMESHGUI.h"
 #include "SMESHGUI_VTKUtils.h"
 
+#include "SUIT_ResourceMgr.h"
+
 #include <qgroupbox.h>
 #include <qpushbutton.h>
 #include <qcheckbox.h>
 #include <qlayout.h>
 #include <qlabel.h>
 
-#define SPACING 5                  
+#define SPACING 5
 #define MARGIN  10
 #define DEFAULT_VAL 10
 #define RANGE 128
 
-/*
-  Class       : SMESHGUI_PrecisionDlg
-  Description : Dialog to specify precision of mesh quality controls
-*/
+/*!
 Class       : SMESHGUI_PrecisionDlg
 Description : Dialog to specify precision of mesh quality controls
+ */
 
 //=======================================================================
 // name    : SMESHGUI_PrecisionDlg::SMESHGUI_PrecisionDlg
 // Purpose : Constructor
 //=======================================================================
-SMESHGUI_PrecisionDlg::SMESHGUI_PrecisionDlg( QWidget* theParent )
-: QDialog( theParent, "SMESHGUI_PrecisionDlg", true,
-           WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
+SMESHGUI_PrecisionDlg::SMESHGUI_PrecisionDlg (QWidget* theParent)
+     : QDialog(theParent, "SMESHGUI_PrecisionDlg", true,
+               WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu)
 {
-  setCaption( tr( "CAPTION" ) );
+  setCaption(tr("CAPTION"));
 
-  QVBoxLayout* aDlgLay = new QVBoxLayout( this, MARGIN, SPACING );
+  QVBoxLayout* aDlgLay = new QVBoxLayout (this, MARGIN, SPACING);
 
-  QFrame* aMainFrame = createMainFrame  ( this );
-  QFrame* aBtnFrame  = createButtonFrame( this );
+  QFrame* aMainFrame = createMainFrame  (this);
+  QFrame* aBtnFrame  = createButtonFrame(this);
 
-  aDlgLay->addWidget( aMainFrame );
-  aDlgLay->addWidget( aBtnFrame );
+  aDlgLay->addWidget(aMainFrame);
+  aDlgLay->addWidget(aBtnFrame);
 
-  aDlgLay->setStretchFactor( aMainFrame, 1 );
+  aDlgLay->setStretchFactor(aMainFrame, 1);
 
-  setMinimumWidth( (int)( QFontMetrics( font() ).width( tr( "CAPTION" ) ) * 1.5 ) );
+  setMinimumWidth((int)(QFontMetrics(font()).width(tr("CAPTION")) * 1.5));
 
   Init();
-
 }
 
 //=======================================================================
@@ -85,21 +86,21 @@ SMESHGUI_PrecisionDlg::~SMESHGUI_PrecisionDlg()
 // name    : SMESHGUI_PrecisionDlg::createButtonFrame
 // Purpose : Create frame containing buttons
 //=======================================================================
-QFrame* SMESHGUI_PrecisionDlg::createButtonFrame( QWidget* theParent )
+QFrame* SMESHGUI_PrecisionDlg::createButtonFrame (QWidget* theParent)
 {
-  QGroupBox* aGrp = new QGroupBox( 1, Qt::Vertical, theParent );
-  aGrp->setFrameStyle( QFrame::NoFrame );
-  aGrp->setInsideMargin( 0 );
+  QGroupBox* aGrp = new QGroupBox (1, Qt::Vertical, theParent);
+  aGrp->setFrameStyle(QFrame::NoFrame);
+  aGrp->setInsideMargin(0);
 
-  myOKBtn = new QPushButton( tr( "SMESH_BUT_OK"    ), aGrp );
+  myOKBtn = new QPushButton (tr("SMESH_BUT_OK"), aGrp);
 
-  QLabel* aLbl = new QLabel( aGrp );
-  aLbl->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
+  QLabel* aLbl = new QLabel (aGrp);
+  aLbl->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed));
 
-  myCancelBtn = new QPushButton( tr( "SMESH_BUT_CANCEL" ), aGrp );
+  myCancelBtn = new QPushButton (tr("SMESH_BUT_CANCEL"), aGrp);
 
-  connect( myOKBtn, SIGNAL( clicked() ), SLOT( onOk() ) );
-  connect( myCancelBtn, SIGNAL( clicked() ), SLOT( onClose() ) );
+  connect(myOKBtn, SIGNAL(clicked()), SLOT(onOk()));
+  connect(myCancelBtn, SIGNAL(clicked()), SLOT(onClose()));
 
   return aGrp;
 }
@@ -108,14 +109,14 @@ QFrame* SMESHGUI_PrecisionDlg::createButtonFrame( QWidget* theParent )
 // name    : SMESHGUI_PrecisionDlg:: createMainFrame
 // Purpose : Create frame containing dialog's input fields
 //=======================================================================
-QFrame* SMESHGUI_PrecisionDlg::createMainFrame( QWidget* theParent )
+QFrame* SMESHGUI_PrecisionDlg::createMainFrame (QWidget* theParent)
 {
-  QGroupBox* aGrp = new QGroupBox( 2, Qt::Horizontal, theParent );
-  new QLabel( tr( "PRECISION" ), aGrp );
-  mySpinBox = new QSpinBox( 0, RANGE, 1, aGrp );
-  myNotUseChk = new QCheckBox( tr( "NOT_USE" ), aGrp );
+  QGroupBox* aGrp = new QGroupBox(2, Qt::Horizontal, theParent);
+  new QLabel (tr("PRECISION"), aGrp);
+  mySpinBox = new QSpinBox (0, RANGE, 1, aGrp);
+  myNotUseChk = new QCheckBox (tr("NOT_USE"), aGrp);
 
-  connect( myNotUseChk, SIGNAL( toggled( bool ) ), SLOT( onNotUse() ) );
+  connect(myNotUseChk, SIGNAL(toggled(bool)), SLOT(onNotUse()));
 
   return aGrp;
 }
@@ -126,25 +127,22 @@ QFrame* SMESHGUI_PrecisionDlg::createMainFrame( QWidget* theParent )
 //=======================================================================
 void SMESHGUI_PrecisionDlg::Init()
 {
-  if ( QAD_CONFIG->hasSetting( "SMESH:ControlsPrecision" ) )
-  {
-    QString aStr = QAD_CONFIG->getSetting( "SMESH:ControlsPrecision" );
-    bool isOk = false;
-    int aVal = aStr.toInt( &isOk );
-    mySpinBox->setValue( isOk ? aVal : DEFAULT_VAL );
-    myNotUseChk->setChecked( !isOk );
-  }
-  else
-  {
-    mySpinBox->setValue( DEFAULT_VAL );
-    myNotUseChk->setChecked( true );
+  bool isOk = false;
+  int aVal = DEFAULT_VAL;
+  SUIT_ResourceMgr* mgr = SMESHGUI::resourceMgr();
+  if (mgr && mgr->hasValue("SMESH", "ControlsPrecision")) {
+    QString aStr = mgr->stringValue("SMESH", "ControlsPrecision");
+    aVal = aStr.toInt(&isOk);
   }
 
+  mySpinBox->setValue(isOk ? aVal : DEFAULT_VAL);
+  myNotUseChk->setChecked(!isOk);
+
   onNotUse();
 
   SMESHGUI* aSMESHGUI = SMESHGUI::GetSMESHGUI();
-  aSMESHGUI->SetActiveDialogBox( ( QDialog* )this ) ;
-  connect( aSMESHGUI, SIGNAL( SignalCloseAllDialogs() ), SLOT( onClose() ) );
+  aSMESHGUI->SetActiveDialogBox((QDialog*)this);
+  connect(aSMESHGUI, SIGNAL(SignalCloseAllDialogs()), SLOT(onClose()));
 }
 
 //=======================================================================
@@ -153,20 +151,22 @@ void SMESHGUI_PrecisionDlg::Init()
 //=======================================================================
 void SMESHGUI_PrecisionDlg::onOk()
 {
-  if ( myNotUseChk->isChecked() )
-  {
-    QAD_CONFIG->removeSettings( "SMESH:ControlsPrecision" );
-    SMESH::SetControlsPrecision( -1 );
-  }
-  else
-  {
+  SUIT_ResourceMgr* mgr = SMESHGUI::resourceMgr();
+  if (myNotUseChk->isChecked()) {
+    if (mgr) {
+      mgr->remove("SMESH", "ControlsPrecision");
+    }
+    SMESH::SetControlsPrecision(-1);
+  } else {
     mySpinBox->clearFocus();
     int aVal = mySpinBox->value();
-    QAD_CONFIG->addSetting( "SMESH:ControlsPrecision", QString( "%1" ).arg( aVal ) );
-    SMESH::SetControlsPrecision( aVal );
+    if (mgr) {
+      mgr->setValue("SMESH", "ControlsPrecision", QString("%1").arg(aVal));
+    }
+    SMESH::SetControlsPrecision(aVal);
   }
-  
-  disconnect( SMESHGUI::GetSMESHGUI(), 0, this, 0 );
+
+  disconnect(SMESHGUI::GetSMESHGUI(), 0, this, 0);
   SMESHGUI::GetSMESHGUI()->ResetState() ;
   accept();
 }
@@ -177,45 +177,24 @@ void SMESHGUI_PrecisionDlg::onOk()
 //=======================================================================
 void SMESHGUI_PrecisionDlg::onClose()
 {
-  disconnect( SMESHGUI::GetSMESHGUI(), 0, this, 0 );
+  disconnect(SMESHGUI::GetSMESHGUI(), 0, this, 0);
   reject();
 }
 
-//=================================================================================
-// function : SMESHGUI_PrecisionDlg::closeEvent()
-// purpose  :
-//=================================================================================
-void SMESHGUI_PrecisionDlg::closeEvent( QCloseEvent* )
+//=======================================================================
+// name    : SMESHGUI_PrecisionDlg::closeEvent
+// Purpose :
+//=======================================================================
+void SMESHGUI_PrecisionDlg::closeEvent (QCloseEvent*)
 {
   onClose();
 }
 
 //=======================================================================
-// name    : SMESHGUI_PrecisionDlg::onClose
+// name    : SMESHGUI_PrecisionDlg::onNotUse
 // Purpose : SLOT. Called when state of "Do not use" check box changed
 //=======================================================================
 void SMESHGUI_PrecisionDlg::onNotUse()
 {
-  mySpinBox->setEnabled( !myNotUseChk->isChecked() );
+  mySpinBox->setEnabled(!myNotUseChk->isChecked());
 }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
index 6e9bff6e32f55afc0b556dcda9e45d6b7c51eaed..abe998f850bbe163ed578df544f8ebe263ba44e0 100644 (file)
@@ -1,23 +1,23 @@
 //  SMESH SMESHGUI : GUI for SMESH component
 //
 //  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
-// 
-//  This library is free software; you can redistribute it and/or 
-//  modify it under the terms of the GNU Lesser General Public 
-//  License as published by the Free Software Foundation; either 
-//  version 2.1 of the License. 
-// 
-//  This library is distributed in the hope that it will be useful, 
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of 
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
-//  Lesser General Public License for more details. 
-// 
-//  You should have received a copy of the GNU Lesser General Public 
-//  License along with this library; if not, write to the Free Software 
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
-// 
-//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
 //
 //
 //
 //  Module : SMESH
 //  $Header$
 
-using namespace std;
 #include "SMESHGUI_Preferences_ColorDlg.h"
 #include "SMESHGUI.h"
 
 #include "utilities.h"
 
+// QT Includes
 #include <qbuttongroup.h>
 #include <qcheckbox.h>
 #include <qcombobox.h>
@@ -41,134 +41,139 @@ using namespace std;
 #include <qpushbutton.h>
 #include <qlayout.h>
 #include <qcolordialog.h>
-#include <qspinbox.h> 
+#include <qspinbox.h>
 #include <qcolor.h>
 
-/* 
- *  Constructs a SMESHGUI_Preferences_ColorDlg which is a child of 'parent', with the 
- *  name 'name' and widget flags set to 'f' 
- *
- *  The dialog will by default be modeless, unless you set 'modal' to
- *  TRUE to construct a modal dialog.
- */
-SMESHGUI_Preferences_ColorDlg::SMESHGUI_Preferences_ColorDlg( QWidget* parent,  const char* name  )
-    : QDialog( parent, name, true, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
+using namespace std;
+
+//=================================================================================
+// function : SMESHGUI_Preferences_ColorDlg()
+// purpose  : Constructs a SMESHGUI_Preferences_ColorDlg which is a child
+//            of 'parent', with the name 'name' and widget flags set to 'f'
+//            The dialog will by default be modeless, unless you
+//            set'modal' to TRUE to construct a modal dialog.
+//=================================================================================
+SMESHGUI_Preferences_ColorDlg::SMESHGUI_Preferences_ColorDlg (QWidget* parent,
+                                                              const char* name)
+     : QDialog(parent, name, true, WStyle_Customize |
+               WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu)
 {
-    if ( !name )
-       setName( "SMESHGUI_Preferences_ColorDlg" );
-    setCaption( tr( "Preferences - Set Color" ) );
-    setSizeGripEnabled( TRUE );
-    QGridLayout* SMESHGUI_Preferences_ColorDlgLayout = new QGridLayout( this ); 
-    SMESHGUI_Preferences_ColorDlgLayout->setSpacing( 6 );
-    SMESHGUI_Preferences_ColorDlgLayout->setMargin( 11 );
-
-    ButtonGroup1 = new QButtonGroup( tr( "Elements" ), this, "ButtonGroup1" );
-    ButtonGroup1->setColumnLayout(0, Qt::Vertical );
-    ButtonGroup1->layout()->setSpacing( 0 );
-    ButtonGroup1->layout()->setMargin( 0 );
-    QGridLayout* ButtonGroup1Layout = new QGridLayout( ButtonGroup1->layout() );
-    ButtonGroup1Layout->setAlignment( Qt::AlignTop );
-    ButtonGroup1Layout->setSpacing( 6 );
-    ButtonGroup1Layout->setMargin( 11 );
-
-    TextLabel_Fill = new QLabel( tr( "Fill" ), ButtonGroup1, "TextLabel_2D_Fill" );
-    ButtonGroup1Layout->addWidget( TextLabel_Fill, 0, 0 );
-
-    btnFillColor = new QPushButton( ButtonGroup1, "btnFillColor" );
-    btnFillColor->setFixedSize( QSize( 25, 25 ) );
-    ButtonGroup1Layout->addWidget( btnFillColor, 0, 1 );
-
-    TextLabel_Outine = new QLabel( tr( "Outline" ), ButtonGroup1, "TextLabel_2D_Outine" );
-    ButtonGroup1Layout->addWidget( TextLabel_Outine, 0, 2 );
-
-    btnOutlineColor = new QPushButton( ButtonGroup1, "btnOutlineColor" );
-    btnOutlineColor->setFixedSize( QSize( 25, 25 ) );
-    ButtonGroup1Layout->addWidget( btnOutlineColor, 0, 3 );
-
-    TextLabel_Width = new QLabel( tr( "Width" ), ButtonGroup1, "TextLabel_2D_Width" );
-    ButtonGroup1Layout->addWidget( TextLabel_Width, 0, 4 );
-
-    SpinBox_Width = new QSpinBox( 0, 5, 1, ButtonGroup1, "SpinBox_Width" );
-    SpinBox_Width->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
-    SpinBox_Width->setWrapping( FALSE );
-    SpinBox_Width->setButtonSymbols( QSpinBox::PlusMinus );
-    ButtonGroup1Layout->addWidget( SpinBox_Width, 0, 5 );
-
-    TextLabel_BackFace = new QLabel( tr( "Back Face" ), ButtonGroup1, "TextLabel_BackFace" );
-    ButtonGroup1Layout->addWidget( TextLabel_BackFace, 1, 0 );
-
-    btnBackFaceColor = new QPushButton( ButtonGroup1, "btnBackFaceColor" );
-    btnBackFaceColor->setFixedSize( QSize( 25, 25 ) );
-    ButtonGroup1Layout->addWidget( btnBackFaceColor, 1, 1 );
-
-    TextLabel_ShrinkCoeff = new QLabel( tr( "Shrink coef." ), ButtonGroup1, "TextLabel_ShrinkCoeff" );
-    ButtonGroup1Layout->addWidget( TextLabel_ShrinkCoeff, 2, 0 );
-
-    SpinBox_Shrink = new QSpinBox( 20, 100, 1, ButtonGroup1, "SpinBox_Shrink" );
-    SpinBox_Shrink->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
-    SpinBox_Shrink->setButtonSymbols( QSpinBox::PlusMinus );
-    ButtonGroup1Layout->addMultiCellWidget( SpinBox_Shrink, 2, 2, 1, 5);
-
-    SMESHGUI_Preferences_ColorDlgLayout->addWidget( ButtonGroup1, 0, 0 );
-
-    ButtonGroup2 = new QButtonGroup( tr( "Nodes" ), this, "ButtonGroup2" );
-    ButtonGroup2->setColumnLayout(0, Qt::Vertical );
-    ButtonGroup2->layout()->setSpacing( 0 );
-    ButtonGroup2->layout()->setMargin( 0 );
-    QGridLayout* ButtonGroup2Layout = new QGridLayout( ButtonGroup2->layout() );
-    ButtonGroup2Layout->setAlignment( Qt::AlignTop );
-    ButtonGroup2Layout->setSpacing( 6 );
-    ButtonGroup2Layout->setMargin( 11 );
-
-    TextLabel_Nodes_Color = new QLabel( tr( "Color" ), ButtonGroup2, "TextLabel_Nodes_Color" );
-    ButtonGroup2Layout->addWidget( TextLabel_Nodes_Color, 0, 0 );
-
-    btnNodeColor = new QPushButton( ButtonGroup2, "btnNodeColor" );
-    btnNodeColor->setFixedSize( QSize( 25, 25 ) );
-    ButtonGroup2Layout->addWidget( btnNodeColor, 0, 1 );
-
-    TextLabel_Nodes_Size = new QLabel( tr( "Size" ), ButtonGroup2, "TextLabel_Nodes_Size" );
-    ButtonGroup2Layout->addWidget( TextLabel_Nodes_Size, 0, 2 );
-
-    SpinBox_Nodes_Size = new QSpinBox( 0, 5, 1, ButtonGroup2, "SpinBox_Nodes_Size" );
-    SpinBox_Nodes_Size->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
-    SpinBox_Nodes_Size->setWrapping( FALSE );
-    SpinBox_Nodes_Size->setButtonSymbols( QSpinBox::PlusMinus );
-    ButtonGroup2Layout->addWidget( SpinBox_Nodes_Size, 0, 3 );
-
-    SMESHGUI_Preferences_ColorDlgLayout->addWidget( ButtonGroup2, 1, 0 );
-
-    GroupButtons = new QButtonGroup( this, "GroupButtons" );
-    GroupButtons->setColumnLayout(0, Qt::Vertical );
-    GroupButtons->layout()->setSpacing( 0 );
-    GroupButtons->layout()->setMargin( 0 );
-    QGridLayout* GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
-    GroupButtonsLayout->setAlignment( Qt::AlignTop );
-    GroupButtonsLayout->setSpacing( 6 );
-    GroupButtonsLayout->setMargin( 11 );
-
-    buttonOk = new QPushButton( tr( "&OK" ), GroupButtons, "buttonOk" );
-    buttonOk->setAutoDefault( TRUE );
-    buttonOk->setDefault( TRUE );
-    GroupButtonsLayout->addWidget( buttonOk, 0, 0 );
-
-    GroupButtonsLayout->addItem( new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ), 0, 1 );
-
-    buttonCancel = new QPushButton( tr( "&Cancel" ), GroupButtons, "buttonCancel" );
-    buttonCancel->setAutoDefault( TRUE );
-    GroupButtonsLayout->addWidget( buttonCancel, 0, 2 );
-
-    SMESHGUI_Preferences_ColorDlgLayout->addWidget( GroupButtons, 2, 0 );
+    if (!name)
+       setName("SMESHGUI_Preferences_ColorDlg");
+    setCaption(tr("Preferences - Set Color"));
+    setSizeGripEnabled(TRUE);
+    QGridLayout* SMESHGUI_Preferences_ColorDlgLayout = new QGridLayout(this);
+    SMESHGUI_Preferences_ColorDlgLayout->setSpacing(6);
+    SMESHGUI_Preferences_ColorDlgLayout->setMargin(11);
+
+    ButtonGroup1 = new QButtonGroup(tr("Elements"), this, "ButtonGroup1");
+    ButtonGroup1->setColumnLayout(0, Qt::Vertical);
+    ButtonGroup1->layout()->setSpacing(0);
+    ButtonGroup1->layout()->setMargin(0);
+    QGridLayout* ButtonGroup1Layout = new QGridLayout(ButtonGroup1->layout());
+    ButtonGroup1Layout->setAlignment(Qt::AlignTop);
+    ButtonGroup1Layout->setSpacing(6);
+    ButtonGroup1Layout->setMargin(11);
+
+    TextLabel_Fill = new QLabel(tr("Fill"), ButtonGroup1, "TextLabel_2D_Fill");
+    ButtonGroup1Layout->addWidget(TextLabel_Fill, 0, 0);
+
+    btnFillColor = new QPushButton(ButtonGroup1, "btnFillColor");
+    btnFillColor->setFixedSize(QSize(25, 25));
+    ButtonGroup1Layout->addWidget(btnFillColor, 0, 1);
+
+    TextLabel_Outine = new QLabel(tr("Outline"), ButtonGroup1, "TextLabel_2D_Outine");
+    ButtonGroup1Layout->addWidget(TextLabel_Outine, 0, 2);
+
+    btnOutlineColor = new QPushButton(ButtonGroup1, "btnOutlineColor");
+    btnOutlineColor->setFixedSize(QSize(25, 25));
+    ButtonGroup1Layout->addWidget(btnOutlineColor, 0, 3);
+
+    TextLabel_Width = new QLabel(tr("Width"), ButtonGroup1, "TextLabel_2D_Width");
+    ButtonGroup1Layout->addWidget(TextLabel_Width, 0, 4);
+
+    SpinBox_Width = new QSpinBox(0, 5, 1, ButtonGroup1, "SpinBox_Width");
+    SpinBox_Width->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed));
+    SpinBox_Width->setWrapping(FALSE);
+    SpinBox_Width->setButtonSymbols(QSpinBox::PlusMinus);
+    ButtonGroup1Layout->addWidget(SpinBox_Width, 0, 5);
+
+    TextLabel_BackFace = new QLabel(tr("Back Face"), ButtonGroup1, "TextLabel_BackFace");
+    ButtonGroup1Layout->addWidget(TextLabel_BackFace, 1, 0);
+
+    btnBackFaceColor = new QPushButton(ButtonGroup1, "btnBackFaceColor");
+    btnBackFaceColor->setFixedSize(QSize(25, 25));
+    ButtonGroup1Layout->addWidget(btnBackFaceColor, 1, 1);
+
+    TextLabel_ShrinkCoeff = new QLabel(tr("Shrink coef."), ButtonGroup1, "TextLabel_ShrinkCoeff");
+    ButtonGroup1Layout->addWidget(TextLabel_ShrinkCoeff, 2, 0);
+
+    SpinBox_Shrink = new QSpinBox(20, 100, 1, ButtonGroup1, "SpinBox_Shrink");
+    SpinBox_Shrink->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed));
+    SpinBox_Shrink->setButtonSymbols(QSpinBox::PlusMinus);
+    ButtonGroup1Layout->addMultiCellWidget(SpinBox_Shrink, 2, 2, 1, 5);
+
+    SMESHGUI_Preferences_ColorDlgLayout->addWidget(ButtonGroup1, 0, 0);
+
+    ButtonGroup2 = new QButtonGroup(tr("Nodes"), this, "ButtonGroup2");
+    ButtonGroup2->setColumnLayout(0, Qt::Vertical);
+    ButtonGroup2->layout()->setSpacing(0);
+    ButtonGroup2->layout()->setMargin(0);
+    QGridLayout* ButtonGroup2Layout = new QGridLayout(ButtonGroup2->layout());
+    ButtonGroup2Layout->setAlignment(Qt::AlignTop);
+    ButtonGroup2Layout->setSpacing(6);
+    ButtonGroup2Layout->setMargin(11);
+
+    TextLabel_Nodes_Color = new QLabel(tr("Color"), ButtonGroup2, "TextLabel_Nodes_Color");
+    ButtonGroup2Layout->addWidget(TextLabel_Nodes_Color, 0, 0);
+
+    btnNodeColor = new QPushButton(ButtonGroup2, "btnNodeColor");
+    btnNodeColor->setFixedSize(QSize(25, 25));
+    ButtonGroup2Layout->addWidget(btnNodeColor, 0, 1);
+
+    TextLabel_Nodes_Size = new QLabel(tr("Size"), ButtonGroup2, "TextLabel_Nodes_Size");
+    ButtonGroup2Layout->addWidget(TextLabel_Nodes_Size, 0, 2);
+
+    SpinBox_Nodes_Size = new QSpinBox(0, 5, 1, ButtonGroup2, "SpinBox_Nodes_Size");
+    SpinBox_Nodes_Size->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed));
+    SpinBox_Nodes_Size->setWrapping(FALSE);
+    SpinBox_Nodes_Size->setButtonSymbols(QSpinBox::PlusMinus);
+    ButtonGroup2Layout->addWidget(SpinBox_Nodes_Size, 0, 3);
+
+    SMESHGUI_Preferences_ColorDlgLayout->addWidget(ButtonGroup2, 1, 0);
+
+    GroupButtons = new QButtonGroup(this, "GroupButtons");
+    GroupButtons->setColumnLayout(0, Qt::Vertical);
+    GroupButtons->layout()->setSpacing(0);
+    GroupButtons->layout()->setMargin(0);
+    QGridLayout* GroupButtonsLayout = new QGridLayout(GroupButtons->layout());
+    GroupButtonsLayout->setAlignment(Qt::AlignTop);
+    GroupButtonsLayout->setSpacing(6);
+    GroupButtonsLayout->setMargin(11);
+
+    buttonOk = new QPushButton(tr("&OK"), GroupButtons, "buttonOk");
+    buttonOk->setAutoDefault(TRUE);
+    buttonOk->setDefault(TRUE);
+    GroupButtonsLayout->addWidget(buttonOk, 0, 0);
+
+    GroupButtonsLayout->addItem(new QSpacerItem(20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum), 0, 1);
+
+    buttonCancel = new QPushButton(tr("&Cancel"), GroupButtons, "buttonCancel");
+    buttonCancel->setAutoDefault(TRUE);
+    GroupButtonsLayout->addWidget(buttonCancel, 0, 2);
+
+    SMESHGUI_Preferences_ColorDlgLayout->addWidget(GroupButtons, 2, 0);
 
     Init();
 }
 
-/*  
- *  Destroys the object and frees any allocated resources
- */
+//=================================================================================
+// function : ~SMESHGUI_Preferences_ColorDlg()
+// purpose  : Destructor
+//=================================================================================
 SMESHGUI_Preferences_ColorDlg::~SMESHGUI_Preferences_ColorDlg()
 {
-    // no need to delete child widgets, Qt does it all for us
+  // no need to delete child widgets, Qt does it all for us
 }
 
 //=================================================================================
@@ -176,27 +181,27 @@ SMESHGUI_Preferences_ColorDlg::~SMESHGUI_Preferences_ColorDlg()
 // purpose  :
 //=================================================================================
 void SMESHGUI_Preferences_ColorDlg::Init()
-{  
-  mySMESHGUI = SMESHGUI::GetSMESHGUI() ;
-  mySMESHGUI->SetActiveDialogBox( (QDialog*)this ) ;
-  
+{
+  mySMESHGUI = SMESHGUI::GetSMESHGUI();
+  mySMESHGUI->SetActiveDialogBox((QDialog*)this);
+
   /* signals and slots connections */
-  connect( buttonOk, SIGNAL( clicked() ),     this, SLOT( ClickOnOk() ) );
-  connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ) ;
+  connect(buttonOk, SIGNAL(clicked()),     this, SLOT(ClickOnOk()));
+  connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel()));
 
-  connect( btnFillColor, SIGNAL( clicked() ), this, SLOT( SelectFillColor() ) ) ;
-  connect( btnOutlineColor, SIGNAL( clicked() ), this, SLOT( SelectOutlineColor() ) ) ;
-  connect( btnNodeColor, SIGNAL( clicked() ), this, SLOT( SelectNodeColor() ) ) ;
-  connect( btnBackFaceColor, SIGNAL( clicked() ), this, SLOT( SelectBackFaceColor() ) ) ;
+  connect(btnFillColor, SIGNAL(clicked()), this, SLOT(SelectFillColor()));
+  connect(btnOutlineColor, SIGNAL(clicked()), this, SLOT(SelectOutlineColor()));
+  connect(btnNodeColor, SIGNAL(clicked()), this, SLOT(SelectNodeColor()));
+  connect(btnBackFaceColor, SIGNAL(clicked()), this, SLOT(SelectBackFaceColor()));
 
-  connect( mySMESHGUI, SIGNAL ( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ;
+  connect(mySMESHGUI, SIGNAL (SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog()));
   /* to close dialog if study change */
-  connect( mySMESHGUI, SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ) ;
+  connect(mySMESHGUI, SIGNAL (SignalCloseAllDialogs()), this, SLOT(ClickOnCancel()));
+
   /* Move widget on the botton right corner of main widget */
-  int x, y ;
-  mySMESHGUI->DefineDlgPosition( this, x, y ) ;
-  this->move( x, y ) ;
+  int x, y;
+  mySMESHGUI->DefineDlgPosition(this, x, y);
+  this->move(x, y);
 }
 
 //=================================================================================
@@ -206,8 +211,8 @@ void SMESHGUI_Preferences_ColorDlg::Init()
 void SMESHGUI_Preferences_ColorDlg::SelectFillColor()
 {
   QColor color = btnFillColor->palette().active().button();
-  color = QColorDialog::getColor( color );
-  if ( color.isValid() ) {
+  color = QColorDialog::getColor(color);
+  if (color.isValid()) {
     QPalette pal = btnFillColor->palette();
     pal.setColor(QColorGroup::Button, color);
     btnFillColor->setPalette(pal);
@@ -221,8 +226,8 @@ void SMESHGUI_Preferences_ColorDlg::SelectFillColor()
 void SMESHGUI_Preferences_ColorDlg::SelectBackFaceColor()
 {
   QColor color = btnBackFaceColor->palette().active().button();
-  color = QColorDialog::getColor( color );
-  if ( color.isValid() ) {
+  color = QColorDialog::getColor(color);
+  if (color.isValid()) {
     QPalette pal = btnBackFaceColor->palette();
     pal.setColor(QColorGroup::Button, color);
     btnBackFaceColor->setPalette(pal);
@@ -236,8 +241,8 @@ void SMESHGUI_Preferences_ColorDlg::SelectBackFaceColor()
 void SMESHGUI_Preferences_ColorDlg::SelectOutlineColor()
 {
   QColor color = btnOutlineColor->palette().active().button();
-  color = QColorDialog::getColor( color );
-  if ( color.isValid() ) {
+  color = QColorDialog::getColor(color);
+  if (color.isValid()) {
     QPalette pal = btnOutlineColor->palette();
     pal.setColor(QColorGroup::Button, color);
     btnOutlineColor->setPalette(pal);
@@ -251,8 +256,8 @@ void SMESHGUI_Preferences_ColorDlg::SelectOutlineColor()
 void SMESHGUI_Preferences_ColorDlg::SelectNodeColor()
 {
   QColor color = btnNodeColor->palette().active().button();
-  color = QColorDialog::getColor( color );
-  if ( color.isValid() ) {
+  color = QColorDialog::getColor(color);
+  if (color.isValid()) {
     QPalette pal = btnNodeColor->palette();
     pal.setColor(QColorGroup::Button, color);
     btnNodeColor->setPalette(pal);
@@ -276,7 +281,7 @@ void SMESHGUI_Preferences_ColorDlg::ClickOnOk()
 void SMESHGUI_Preferences_ColorDlg::ClickOnCancel()
 {
   mySMESHGUI->ResetState();
-  reject() ;
+  reject();
 }
 
 //=================================================================================
@@ -285,18 +290,15 @@ void SMESHGUI_Preferences_ColorDlg::ClickOnCancel()
 //=================================================================================
 void SMESHGUI_Preferences_ColorDlg::DeactivateActiveDialog()
 {
-  return ;
 }
 
-
-
 //=================================================================================
 // function : closeEvent()
 // purpose  :
 //=================================================================================
-void SMESHGUI_Preferences_ColorDlg::closeEvent( QCloseEvent* e )
+void SMESHGUI_Preferences_ColorDlg::closeEvent (QCloseEvent*)
 {
-  this->ClickOnCancel() ; /* same than click on cancel button */
+  this->ClickOnCancel(); /* same than click on cancel button */
 }
 
 //=================================================================================
@@ -306,19 +308,17 @@ void SMESHGUI_Preferences_ColorDlg::closeEvent( QCloseEvent* e )
 void SMESHGUI_Preferences_ColorDlg::ActivateThisDialog()
 {
   /* Emit a signal to deactivate any active dialog */
-  mySMESHGUI->EmitSignalDeactivateDialog() ;
-
-  return ;
+  mySMESHGUI->EmitSignalDeactivateDialog();
 }
 
 //=================================================================================
 // function : SetColor()
 // purpose  :
 //=================================================================================
-void SMESHGUI_Preferences_ColorDlg::SetColor(int type, QColor color)
+void SMESHGUI_Preferences_ColorDlg::SetColor (int type, QColor color)
 {
   switch (type) {
-  case 1 : // fill 
+  case 1 : // fill
     {
       QPalette pal = btnFillColor->palette();
       pal.setColor(QColorGroup::Button, color);
@@ -353,7 +353,7 @@ void SMESHGUI_Preferences_ColorDlg::SetColor(int type, QColor color)
 // function : GetColor()
 // purpose  :
 //=================================================================================
-QColor SMESHGUI_Preferences_ColorDlg::GetColor(int type)
+QColor SMESHGUI_Preferences_ColorDlg::GetColor (int type)
 {
   QColor color;
   switch (type) {
@@ -367,9 +367,9 @@ QColor SMESHGUI_Preferences_ColorDlg::GetColor(int type)
 
 //=================================================================================
 // function : SetIntValue()
-// purpose  : 
+// purpose  :
 //=================================================================================
-void SMESHGUI_Preferences_ColorDlg::SetIntValue(int type, int value)
+void SMESHGUI_Preferences_ColorDlg::SetIntValue (int type, int value)
 {
   switch (type) {
   case 1 : SpinBox_Width->setValue(value);      break; // width
@@ -380,9 +380,9 @@ void SMESHGUI_Preferences_ColorDlg::SetIntValue(int type, int value)
 
 //=================================================================================
 // function : GetIntValue()
-// purpose  : 
+// purpose  :
 //=================================================================================
-int SMESHGUI_Preferences_ColorDlg::GetIntValue(int type)
+int SMESHGUI_Preferences_ColorDlg::GetIntValue (int type)
 {
   int res = 0;
   switch (type) {
index 296312ab038ca354385d6165cdc2934a7ce8c1c1..5ad2c5403273fffd590ce191da4934519269424b 100644 (file)
@@ -30,8 +30,8 @@
 #define SMESHGUI_PREFERENCES_COLORDLG_H
 
 // SALOME Includes
-#include "QAD_Config.h"
-#include "QAD_Settings.h"
+//#include "SUIT_Config.h"
+//#include "SUIT_Settings.h"
 
 // IDL Headers
 #include <SALOMEconfig.h>
index c2474d067ffbbceb207f0f7b8f351774280b3cfe..850194b22d767275bd1bfa57f47becd5ce5cc4a1 100644 (file)
@@ -1,23 +1,23 @@
 //  SMESH SMESHGUI : GUI for SMESH component
 //
 //  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
-// 
-//  This library is free software; you can redistribute it and/or 
-//  modify it under the terms of the GNU Lesser General Public 
-//  License as published by the Free Software Foundation; either 
-//  version 2.1 of the License. 
-// 
-//  This library is distributed in the hope that it will be useful, 
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of 
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
-//  Lesser General Public License for more details. 
-// 
-//  You should have received a copy of the GNU Lesser General Public 
-//  License along with this library; if not, write to the Free Software 
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
-// 
-//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
 //
 //
 //
 #include "SMESHGUI.h"
 #include "SMESHGUI_VTKUtils.h"
 
+#include "SMESH_Actor.h"
+
+#include "SUIT_ResourceMgr.h"
+
+#include "SalomeApp_SelectionMgr.h"
+#include "SALOME_ListIO.hxx"
+
+#include <QtxDblSpinBox.h>
+
 #include <qbuttongroup.h>
 #include <qcheckbox.h>
 #include <qcombobox.h>
 #include <vtkScalarBarActor.h>
 #include <vtkScalarsToColors.h>
 
-#include "QAD_SpinBoxDbl.h"
-#include "QAD_Config.h"
-#include "SALOME_Selection.h"
-#include "SMESHGUI.h"
-#include "SMESH_Actor.h"
-
 #define MINIMUM_WIDTH 70
 #define MARGIN_SIZE   11
 #define SPACING_SIZE   6
@@ -80,14 +83,13 @@ SMESHGUI_Preferences_ScalarBarDlg* SMESHGUI_Preferences_ScalarBarDlg::myDlg = 0;
  *  Gets the only instance of "Scalar Bar Properties" dialog box
  */
 //=================================================================================================
-void SMESHGUI_Preferences_ScalarBarDlg::ScalarBarProperties(QWidget* parent, 
-                                                           SALOME_Selection* Sel)
+void SMESHGUI_Preferences_ScalarBarDlg::ScalarBarProperties (QWidget* parent,
+                                                             SalomeApp_SelectionMgr* Sel)
 {
-  if ( !myDlg ) {
-    myDlg = new SMESHGUI_Preferences_ScalarBarDlg( parent, Sel, false );
+  if (!myDlg) {
+    myDlg = new SMESHGUI_Preferences_ScalarBarDlg (parent, Sel, false);
     myDlg->show();
-  }
-  else {
+  } else {
     myDlg->show();
     myDlg->setActiveWindow();
     myDlg->raise();
@@ -102,9 +104,10 @@ void SMESHGUI_Preferences_ScalarBarDlg::ScalarBarProperties(QWidget* parent,
  *  Opens "Scalar Bar Preferences" dialog box
  */
 //=================================================================================================
-void SMESHGUI_Preferences_ScalarBarDlg::ScalarBarPreferences( QWidget* parent )
+void SMESHGUI_Preferences_ScalarBarDlg::ScalarBarPreferences (QWidget* parent)
 {
-  SMESHGUI_Preferences_ScalarBarDlg* aDlg = new SMESHGUI_Preferences_ScalarBarDlg( parent, 0, true );
+  SMESHGUI_Preferences_ScalarBarDlg* aDlg =
+    new SMESHGUI_Preferences_ScalarBarDlg (parent, 0, true);
   aDlg->exec();
 }
 
@@ -115,16 +118,17 @@ void SMESHGUI_Preferences_ScalarBarDlg::ScalarBarPreferences( QWidget* parent )
  *  Constructor
  */
 //=================================================================================================
-SMESHGUI_Preferences_ScalarBarDlg::SMESHGUI_Preferences_ScalarBarDlg(QWidget* parent, 
-                                                                    SALOME_Selection* Sel, 
-                                                                    bool modal)
-     : QDialog( parent, 0, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | WDestructiveClose )
+SMESHGUI_Preferences_ScalarBarDlg::SMESHGUI_Preferences_ScalarBarDlg (QWidget* parent,
+                                                                      SalomeApp_SelectionMgr* Sel,
+                                                                      bool modal)
+     : QDialog(parent, 0, modal, WStyle_Customize | WStyle_NormalBorder |
+               WStyle_Title | WStyle_SysMenu | WDestructiveClose)
 {
-  setName( "SMESHGUI_Preferences_ScalarBarDlg" );
-  setCaption( Sel ? tr( "SMESH_PROPERTIES_SCALARBAR" ) : tr( "SMESH_PREFERENCES_SCALARBAR" ) );
-  setSizeGripEnabled( TRUE );
+  setName("SMESHGUI_Preferences_ScalarBarDlg");
+  setCaption(Sel ? tr("SMESH_PROPERTIES_SCALARBAR") : tr("SMESH_PREFERENCES_SCALARBAR"));
+  setSizeGripEnabled(TRUE);
 
-  mySelection = Sel;
+  mySelectionMgr = Sel;
   myActor = 0;
 
   /******************************************************************************/
@@ -135,14 +139,14 @@ SMESHGUI_Preferences_ScalarBarDlg::SMESHGUI_Preferences_ScalarBarDlg(QWidget* pa
 
   /******************************************************************************/
   // Scalar range
-  if ( mySelection ) {
+  if ( mySelectionMgr ) {
     myRangeGrp = new QGroupBox ( tr( "SMESH_RANGE_SCALARBAR" ), this, "myRangeGrp" );
     myRangeGrp->setColumnLayout( 0, Qt::Vertical );
     myRangeGrp->layout()->setSpacing( 0 ); myRangeGrp->layout()->setMargin( 0 );
     QGridLayout* myRangeGrpLayout = new QGridLayout( myRangeGrp->layout() );
     myRangeGrpLayout->setAlignment( Qt::AlignTop );
     myRangeGrpLayout->setSpacing( SPACING_SIZE ); myRangeGrpLayout->setMargin( MARGIN_SIZE );
-    
+
     myMinEdit = new QLineEdit( myRangeGrp, "myMinEdit" );
     myMinEdit->setMinimumWidth( MINIMUM_WIDTH );
     myMinEdit->setValidator( new QDoubleValidator( this ) );
@@ -168,29 +172,29 @@ SMESHGUI_Preferences_ScalarBarDlg::SMESHGUI_Preferences_ScalarBarDlg(QWidget* pa
   QGridLayout* myFontGrpLayout = new QGridLayout( myFontGrp->layout() );
   myFontGrpLayout->setAlignment( Qt::AlignTop );
   myFontGrpLayout->setSpacing( SPACING_SIZE ); myFontGrpLayout->setMargin( MARGIN_SIZE );
-    
+
   myTitleColorBtn = new QToolButton( myFontGrp, "myTitleColorBtn" );
-  
+
   myTitleFontCombo = new QComboBox( false, myFontGrp, "myTitleFontCombo" );
   myTitleFontCombo->setMinimumWidth( MINIMUM_WIDTH );
   myTitleFontCombo->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
   myTitleFontCombo->insertItem( tr( "SMESH_FONT_ARIAL" ) );
   myTitleFontCombo->insertItem( tr( "SMESH_FONT_COURIER" ) );
   myTitleFontCombo->insertItem( tr( "SMESH_FONT_TIMES" ) );
-  
+
   myTitleBoldCheck   = new QCheckBox( tr( "SMESH_FONT_BOLD" ),   myFontGrp, "myTitleBoldCheck" );
   myTitleItalicCheck = new QCheckBox( tr( "SMESH_FONT_ITALIC" ), myFontGrp, "myTitleItalicCheck" );
   myTitleShadowCheck = new QCheckBox( tr( "SMESH_FONT_SHADOW" ), myFontGrp, "myTitleShadowCheck" );
 
   myLabelsColorBtn = new QToolButton( myFontGrp, "myLabelsColorBtn" );
-  
+
   myLabelsFontCombo = new QComboBox( false, myFontGrp, "myLabelsFontCombo" );
   myLabelsFontCombo->setMinimumWidth( MINIMUM_WIDTH );
   myLabelsFontCombo->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
   myLabelsFontCombo->insertItem( tr( "SMESH_FONT_ARIAL" ) );
   myLabelsFontCombo->insertItem( tr( "SMESH_FONT_COURIER" ) );
   myLabelsFontCombo->insertItem( tr( "SMESH_FONT_TIMES" ) );
-  
+
   myLabelsBoldCheck   = new QCheckBox( tr( "SMESH_FONT_BOLD" ),   myFontGrp, "myLabelsBoldCheck" );
   myLabelsItalicCheck = new QCheckBox( tr( "SMESH_FONT_ITALIC" ), myFontGrp, "myLabelsItalicCheck" );
   myLabelsShadowCheck = new QCheckBox( tr( "SMESH_FONT_SHADOW" ), myFontGrp, "myLabelsShadowCheck" );
@@ -201,7 +205,7 @@ SMESHGUI_Preferences_ScalarBarDlg::SMESHGUI_Preferences_ScalarBarDlg(QWidget* pa
   myFontGrpLayout->addWidget( myTitleBoldCheck,   0, 3 );
   myFontGrpLayout->addWidget( myTitleItalicCheck, 0, 4 );
   myFontGrpLayout->addWidget( myTitleShadowCheck, 0, 5 );
-  
+
   myFontGrpLayout->addWidget( new QLabel( tr( "SMESH_LABELS" ), myFontGrp, "myFontLabelsLab" ), 1, 0 );
   myFontGrpLayout->addWidget( myLabelsColorBtn,    1, 1 );
   myFontGrpLayout->addWidget( myLabelsFontCombo,   1, 2 );
@@ -220,7 +224,7 @@ SMESHGUI_Preferences_ScalarBarDlg::SMESHGUI_Preferences_ScalarBarDlg(QWidget* pa
   QGridLayout* myLabColorGrpLayout = new QGridLayout( myLabColorGrp->layout() );
   myLabColorGrpLayout->setAlignment( Qt::AlignTop );
   myLabColorGrpLayout->setSpacing( SPACING_SIZE ); myLabColorGrpLayout->setMargin( MARGIN_SIZE );
-    
+
   myColorsSpin = new QSpinBox( 2, 256, 1, myLabColorGrp, "myColorsSpin" );
   myColorsSpin->setMinimumWidth( MINIMUM_WIDTH );
   myColorsSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
@@ -245,7 +249,7 @@ SMESHGUI_Preferences_ScalarBarDlg::SMESHGUI_Preferences_ScalarBarDlg(QWidget* pa
   QGridLayout* myOrientationGrpLayout = new QGridLayout( myOrientationGrp->layout() );
   myOrientationGrpLayout->setAlignment( Qt::AlignTop );
   myOrientationGrpLayout->setSpacing( SPACING_SIZE ); myOrientationGrpLayout->setMargin( MARGIN_SIZE );
-    
+
   myVertRadioBtn  = new QRadioButton( tr( "SMESH_VERTICAL" ),   myOrientationGrp, "myVertRadioBtn" );
   myHorizRadioBtn = new QRadioButton( tr( "SMESH_HORIZONTAL" ), myOrientationGrp, "myHorizRadioBtn" );
   myVertRadioBtn->setChecked( true );
@@ -258,26 +262,26 @@ SMESHGUI_Preferences_ScalarBarDlg::SMESHGUI_Preferences_ScalarBarDlg(QWidget* pa
 
   /******************************************************************************/
   // Position & Size
-  myOriginDimGrp = new QGroupBox ( tr( "SMESH_POSITION_SIZE_SCALARBAR" ), this, "myOriginDimGrp" );
-  myOriginDimGrp->setColumnLayout( 0, Qt::Vertical );
+  myOriginDimGrp = new QGroupBox (tr("SMESH_POSITION_SIZE_SCALARBAR"), this, "myOriginDimGrp");
+  myOriginDimGrp->setColumnLayout(0, Qt::Vertical);
   myOriginDimGrp->layout()->setSpacing( 0 ); myOriginDimGrp->layout()->setMargin( 0 );
   QGridLayout* myOriginDimGrpLayout = new QGridLayout( myOriginDimGrp->layout() );
   myOriginDimGrpLayout->setAlignment( Qt::AlignTop );
   myOriginDimGrpLayout->setSpacing( SPACING_SIZE ); myOriginDimGrpLayout->setMargin( MARGIN_SIZE );
-    
-  myXSpin = new QAD_SpinBoxDbl( myOriginDimGrp, 0.0, 1.0, 0.1 );
+
+  myXSpin = new QtxDblSpinBox (0.0, 1.0, 0.1, myOriginDimGrp);
   myXSpin->setMinimumWidth( MINIMUM_WIDTH );
   myXSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
 
-  myYSpin = new QAD_SpinBoxDbl( myOriginDimGrp, 0.0, 1.0, 0.1 );
+  myYSpin = new QtxDblSpinBox(0.0, 1.0, 0.1, myOriginDimGrp);
   myYSpin->setMinimumWidth( MINIMUM_WIDTH );
   myYSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
 
-  myWidthSpin = new QAD_SpinBoxDbl( myOriginDimGrp, 0.0, 1.0, 0.1 );
+  myWidthSpin = new QtxDblSpinBox(0.0, 1.0, 0.1, myOriginDimGrp);
   myWidthSpin->setMinimumWidth( MINIMUM_WIDTH );
   myWidthSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
 
-  myHeightSpin = new QAD_SpinBoxDbl( myOriginDimGrp, 0.0, 1.0, 0.1 );
+  myHeightSpin = new QtxDblSpinBox(0.0, 1.0, 0.1, myOriginDimGrp);
   myHeightSpin->setMinimumWidth( MINIMUM_WIDTH );
   myHeightSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
 
@@ -305,14 +309,14 @@ SMESHGUI_Preferences_ScalarBarDlg::SMESHGUI_Preferences_ScalarBarDlg(QWidget* pa
   myOkBtn = new QPushButton( tr( "SMESH_BUT_OK" ), myButtonGrp, "myOkBtn" );
   myOkBtn->setAutoDefault( TRUE ); myOkBtn->setDefault( TRUE );
   myButtonGrpLayout->addWidget( myOkBtn );
-  if ( mySelection ) {
+  if ( mySelectionMgr ) {
     myApplyBtn = new QPushButton( tr( "SMESH_BUT_APPLY" ), myButtonGrp, "myApplyBtn" );
     myApplyBtn->setAutoDefault( TRUE );
     myButtonGrpLayout->addWidget( myApplyBtn );
   }
   myButtonGrpLayout->addStretch();
   myCancelBtn = new QPushButton( tr( "SMESH_BUT_CANCEL" ), myButtonGrp, "myCancelBtn" );
-  if ( mySelection )
+  if ( mySelectionMgr )
     myCancelBtn->setText( tr( "SMESH_BUT_CLOSE" ) );
   myCancelBtn->setAutoDefault( TRUE );
   myButtonGrpLayout->addWidget( myCancelBtn );
@@ -322,87 +326,96 @@ SMESHGUI_Preferences_ScalarBarDlg::SMESHGUI_Preferences_ScalarBarDlg(QWidget* pa
   /***************************************************************/
   // Init
   // --> first init from preferences
-  QColor titleColor( 255, 255, 255 );
-  if ( QAD_CONFIG->hasSetting( "SMESH:ScalarBarTitleColor" ) ) {
-    QStringList aTColor = QStringList::split(  ":", QAD_CONFIG->getSetting( "SMESH:ScalarBarTitleColor" ), false );
-    titleColor = QColor( ( aTColor.count() > 0 ? aTColor[0].toInt() : 255 ), 
-                        ( aTColor.count() > 1 ? aTColor[1].toInt() : 255 ), 
-                        ( aTColor.count() > 2 ? aTColor[2].toInt() : 255 ) );
+  SUIT_ResourceMgr* mgr = SMESHGUI::resourceMgr();
+
+  QColor titleColor (255, 255, 255);
+  if (mgr && mgr->hasValue("SMESH", "ScalarBarTitleColor")) {
+    QStringList aTColor =
+      QStringList::split(":", mgr->stringValue("SMESH", "ScalarBarTitleColor"), false);
+    titleColor = QColor((aTColor.count() > 0 ? aTColor[0].toInt() : 255),
+                        (aTColor.count() > 1 ? aTColor[1].toInt() : 255),
+                        (aTColor.count() > 2 ? aTColor[2].toInt() : 255));
   }
-  myTitleColorBtn->setPaletteBackgroundColor( titleColor );
-  myTitleFontCombo->setCurrentItem( 0 );
-  if ( QAD_CONFIG->hasSetting( "SMESH:ScalarBarTitleFont" ) ) {
-    if ( QAD_CONFIG->getSetting( "SMESH:ScalarBarTitleFont" ) == "Arial" )
-      myTitleFontCombo->setCurrentItem( 0 );
-    if ( QAD_CONFIG->getSetting( "SMESH:ScalarBarTitleFont" ) == "Courier" )
-      myTitleFontCombo->setCurrentItem( 1 );
-    if ( QAD_CONFIG->getSetting( "SMESH:ScalarBarTitleFont" ) == "Times" )
-      myTitleFontCombo->setCurrentItem( 2 );
+  myTitleColorBtn->setPaletteBackgroundColor(titleColor);
+  myTitleFontCombo->setCurrentItem(0);
+  if (mgr && mgr->hasValue("SMESH", "ScalarBarTitleFont")) {
+    if (mgr->stringValue("SMESH", "ScalarBarTitleFont") == "Arial")
+      myTitleFontCombo->setCurrentItem(0);
+    if (mgr->stringValue("SMESH", "ScalarBarTitleFont") == "Courier")
+      myTitleFontCombo->setCurrentItem(1);
+    if (mgr->stringValue("SMESH", "ScalarBarTitleFont") == "Times")
+      myTitleFontCombo->setCurrentItem(2);
   }
-  myTitleBoldCheck->setChecked( QAD_CONFIG->getSetting( "SMESH:ScalarBarTitleBold" ) == "true" );
-  myTitleItalicCheck->setChecked( QAD_CONFIG->getSetting( "SMESH:ScalarBarTitleItalic" ) == "true" );
-  myTitleShadowCheck->setChecked( QAD_CONFIG->getSetting( "SMESH:ScalarBarTitleShadow" ) == "true" );
-
-  QColor labelColor( 255, 255, 255 );
-  if ( QAD_CONFIG->hasSetting( "SMESH:ScalarBarLabelColor" ) ) {
-    QStringList aLColor = QStringList::split( ":", QAD_CONFIG->getSetting( "SMESH:ScalarBarLabelColor" ), false );
-    labelColor = QColor( ( aLColor.count() > 0 ? aLColor[0].toInt() : 255 ), 
-                        ( aLColor.count() > 1 ? aLColor[1].toInt() : 255 ), 
-                        ( aLColor.count() > 2 ? aLColor[2].toInt() : 255 ) );
+  myTitleBoldCheck->setChecked  (mgr && mgr->stringValue("SMESH", "ScalarBarTitleBold")   == "true");
+  myTitleItalicCheck->setChecked(mgr && mgr->stringValue("SMESH", "ScalarBarTitleItalic") == "true");
+  myTitleShadowCheck->setChecked(mgr && mgr->stringValue("SMESH", "ScalarBarTitleShadow") == "true");
+
+  QColor labelColor (255, 255, 255);
+  if (mgr && mgr->hasValue("SMESH", "ScalarBarLabelColor")) {
+    QStringList aLColor =
+      QStringList::split(":", mgr->stringValue("SMESH", "ScalarBarLabelColor"), false);
+    labelColor = QColor((aLColor.count() > 0 ? aLColor[0].toInt() : 255),
+                        (aLColor.count() > 1 ? aLColor[1].toInt() : 255),
+                        (aLColor.count() > 2 ? aLColor[2].toInt() : 255));
   }
-  myLabelsColorBtn->setPaletteBackgroundColor( labelColor );
-  myLabelsFontCombo->setCurrentItem( 0 );
-  if ( QAD_CONFIG->hasSetting( "SMESH:ScalarBarLabelFont" ) ) {
-    if ( QAD_CONFIG->getSetting( "SMESH:ScalarBarLabelFont" ) == "Arial" )
-      myLabelsFontCombo->setCurrentItem( 0 );
-    if ( QAD_CONFIG->getSetting( "SMESH:ScalarBarLabelFont" ) == "Courier" )
-      myLabelsFontCombo->setCurrentItem( 1 );
-    if ( QAD_CONFIG->getSetting( "SMESH:ScalarBarLabelFont" ) == "Times" )
-      myLabelsFontCombo->setCurrentItem( 2 );
+  myLabelsColorBtn->setPaletteBackgroundColor(labelColor);
+  myLabelsFontCombo->setCurrentItem(0);
+  if (mgr && mgr->hasValue("SMESH", "ScalarBarLabelFont")) {
+    if (mgr->stringValue("SMESH", "ScalarBarLabelFont") == "Arial")
+      myLabelsFontCombo->setCurrentItem(0);
+    if (mgr->stringValue("SMESH", "ScalarBarLabelFont") == "Courier")
+      myLabelsFontCombo->setCurrentItem(1);
+    if (mgr->stringValue("SMESH", "ScalarBarLabelFont") == "Times")
+      myLabelsFontCombo->setCurrentItem(2);
   }
-  myLabelsBoldCheck->setChecked( QAD_CONFIG->getSetting( "SMESH:ScalarBarLabelBold" ) == "true" );
-  myLabelsItalicCheck->setChecked( QAD_CONFIG->getSetting( "SMESH:ScalarBarLabelItalic" ) == "true" );
-  myLabelsShadowCheck->setChecked( QAD_CONFIG->getSetting( "SMESH:ScalarBarLabelShadow" ) == "true" );
+  myLabelsBoldCheck  ->setChecked(mgr && mgr->stringValue("SMESH", "ScalarBarLabelBold")   == "true");
+  myLabelsItalicCheck->setChecked(mgr && mgr->stringValue("SMESH", "ScalarBarLabelItalic") == "true");
+  myLabelsShadowCheck->setChecked(mgr && mgr->stringValue("SMESH", "ScalarBarLabelShadow") == "true");
 
   int aNbColors = 64;
-  if ( QAD_CONFIG->hasSetting( "SMESH:ScalarBarNbOfColors" ) )
-    aNbColors = QAD_CONFIG->getSetting( "SMESH:ScalarBarNbOfColors" ).toInt();
-  myColorsSpin->setValue( aNbColors );
+  if (mgr && mgr->hasValue("SMESH", "ScalarBarNbOfColors"))
+    aNbColors = mgr->integerValue("SMESH", "ScalarBarNbOfColors");
+  myColorsSpin->setValue(aNbColors);
+
   int aNbLabels = 5;
-  if ( QAD_CONFIG->hasSetting( "SMESH:ScalarBarNbOfLabels" ) )
-    aNbLabels = QAD_CONFIG->getSetting( "SMESH:ScalarBarNbOfLabels" ).toInt();
-  myLabelsSpin->setValue( aNbLabels );
+  if (mgr && mgr->hasValue("SMESH", "ScalarBarNbOfLabels"))
+    aNbLabels = mgr->integerValue("SMESH", "ScalarBarNbOfLabels");
+  myLabelsSpin->setValue(aNbLabels);
 
-  QString aOrientation = QAD_CONFIG->getSetting( "SMESH:ScalarBarOrientation" );
-  if ( aOrientation == "Horizontal" )
-    myHorizRadioBtn->setChecked( true );
+  QString aOrientation = (mgr ? mgr->stringValue("SMESH", "ScalarBarOrientation") : "");
+  if (aOrientation == "Horizontal")
+    myHorizRadioBtn->setChecked(true);
   else
-    myVertRadioBtn->setChecked( true );
+    myVertRadioBtn->setChecked(true);
   myIniOrientation = myVertRadioBtn->isChecked();
 
-  if ( QAD_CONFIG->hasSetting( "SMESH:ScalarBarXPosition" ) )
-    myIniX = QAD_CONFIG->getSetting( "SMESH:ScalarBarXPosition" ).toDouble();
+  if (mgr && mgr->hasValue("SMESH", "ScalarBarXPosition"))
+    myIniX = mgr->doubleValue("SMESH", "ScalarBarXPosition");
   else
     myIniX = myHorizRadioBtn->isChecked() ? DEF_HOR_X : DEF_VER_X;
-  if ( QAD_CONFIG->hasSetting( "SMESH:ScalarBarYPosition" ) )
-    myIniY = QAD_CONFIG->getSetting( "SMESH:ScalarBarYPosition" ).toDouble();
+
+  if (mgr && mgr->hasValue("SMESH", "ScalarBarYPosition"))
+    myIniY = mgr->doubleValue("SMESH", "ScalarBarYPosition");
   else
     myIniY = myHorizRadioBtn->isChecked() ? DEF_HOR_Y : DEF_VER_Y;
-  if ( QAD_CONFIG->hasSetting( "SMESH:ScalarBarWidth" ) )
-    myIniW = QAD_CONFIG->getSetting( "SMESH:ScalarBarWidth" ).toDouble();
+
+  if (mgr && mgr->hasValue("SMESH", "ScalarBarWidth"))
+    myIniW = mgr->doubleValue("SMESH", "ScalarBarWidth");
   else
     myIniW = myHorizRadioBtn->isChecked() ? DEF_HOR_W : DEF_VER_W;
-  if ( QAD_CONFIG->hasSetting( "SMESH:ScalarBarHeight" ) )
-    myIniH = QAD_CONFIG->getSetting( "SMESH:ScalarBarHeight" ).toDouble();
+
+  if (mgr && mgr->hasValue("SMESH", "ScalarBarHeight"))
+    myIniH = mgr->doubleValue("SMESH", "ScalarBarHeight");
   else
     myIniH = myHorizRadioBtn->isChecked() ? DEF_HOR_H : DEF_VER_H;
-  setOriginAndSize( myIniX, myIniY, myIniW, myIniH );
 
-  if ( mySelection ) {
+  setOriginAndSize(myIniX, myIniY, myIniW, myIniH);
+
+  if (mySelectionMgr) {
     // --> then init from selection if necessary
     onSelectionChanged();
   }
-  
+
   /***************************************************************/
   // Connect section
   connect( myTitleColorBtn,     SIGNAL( clicked() ), this, SLOT( onTitleColor() ) );
@@ -412,9 +425,9 @@ SMESHGUI_Preferences_ScalarBarDlg::SMESHGUI_Preferences_ScalarBarDlg(QWidget* pa
   connect( myXSpin,             SIGNAL( valueChanged( double ) ), this, SLOT( onXYChanged() ) );
   connect( myYSpin,             SIGNAL( valueChanged( double ) ), this, SLOT( onXYChanged() ) );
   connect( myOrientationGrp,    SIGNAL( clicked( int ) ), this, SLOT( onOrientationChanged() ) );
-  if ( mySelection ) {
+  if ( mySelectionMgr ) {
     connect( myApplyBtn,        SIGNAL( clicked() ), this, SLOT( onApply() ) );
-    connect( mySelection,       SIGNAL( currentSelectionChanged() ), this, SLOT( onSelectionChanged() ) );
+    connect( mySelectionMgr,    SIGNAL( currentSelectionChanged() ), this, SLOT( onSelectionChanged() ) );
   }
   connect( SMESHGUI::GetSMESHGUI(),  SIGNAL( SignalCloseAllDialogs() ), this, SLOT( onCancel() ) ) ;
 }
@@ -452,9 +465,9 @@ void SMESHGUI_Preferences_ScalarBarDlg::onOk()
 //=================================================================================================
 bool SMESHGUI_Preferences_ScalarBarDlg::onApply()
 {
-  if ( mySelection ) {
+  if (mySelectionMgr) {
     // Scalar Bar properties
-    if ( !myActor )
+    if (!myActor)
       return false;
     vtkScalarBarActor* myScalarBarActor = myActor->GetScalarBarActor();
 
@@ -502,42 +515,49 @@ bool SMESHGUI_Preferences_ScalarBarDlg::onApply()
     double aMax = myMaxEdit->text().toDouble();
     myScalarBarActor->GetLookupTable()->SetRange( aMin, aMax );
     SMESH::RepaintCurrentView();
-  }
-  else {
+  } else {
     // Scalar Bar preferences
+    SUIT_ResourceMgr* mgr = SMESHGUI::resourceMgr();
+    if (!mgr) return false;
+
     QColor titleColor = myTitleColorBtn->paletteBackgroundColor();
-    QAD_CONFIG->addSetting( "SMESH:ScalarBarTitleColor",  QString().sprintf( "%d:%d:%d", titleColor.red(), titleColor.green(), titleColor.blue() ) );
-    if ( myTitleFontCombo->currentItem() == 0 )
-      QAD_CONFIG->addSetting( "SMESH:ScalarBarTitleFont", "Arial" );
-    else if ( myTitleFontCombo->currentItem() == 1 )
-      QAD_CONFIG->addSetting( "SMESH:ScalarBarTitleFont", "Courier" );
+    mgr->setValue("SMESH", "ScalarBarTitleColor",
+                  QString().sprintf("%d:%d:%d", titleColor.red(), titleColor.green(), titleColor.blue()));
+    if (myTitleFontCombo->currentItem() == 0)
+      mgr->setValue("SMESH", "ScalarBarTitleFont", "Arial");
+    else if (myTitleFontCombo->currentItem() == 1)
+      mgr->setValue("SMESH", "ScalarBarTitleFont", "Courier");
     else
-      QAD_CONFIG->addSetting( "SMESH:ScalarBarTitleFont", "Times" );
-    QAD_CONFIG->addSetting( "SMESH:ScalarBarTitleBold",   myTitleBoldCheck->isChecked() ?   "true" : "false" );
-    QAD_CONFIG->addSetting( "SMESH:ScalarBarTitleItalic", myTitleItalicCheck->isChecked() ? "true" : "false" );
-    QAD_CONFIG->addSetting( "SMESH:ScalarBarTitleShadow", myTitleShadowCheck->isChecked() ? "true" : "false" );
+      mgr->setValue("SMESH", "ScalarBarTitleFont", "Times");
+
+    mgr->setValue("SMESH", "ScalarBarTitleBold"  , myTitleBoldCheck  ->isChecked() ? "true" : "false");
+    mgr->setValue("SMESH", "ScalarBarTitleItalic", myTitleItalicCheck->isChecked() ? "true" : "false");
+    mgr->setValue("SMESH", "ScalarBarTitleShadow", myTitleShadowCheck->isChecked() ? "true" : "false");
 
     QColor labelColor = myLabelsColorBtn->paletteBackgroundColor();
-    QAD_CONFIG->addSetting( "SMESH:ScalarBarLabelColor",  QString().sprintf( "%d:%d:%d", labelColor.red(), labelColor.green(),labelColor. blue() ) );
-    if ( myLabelsFontCombo->currentItem() == 0 )
-      QAD_CONFIG->addSetting( "SMESH:ScalarBarLabelFont", "Arial" );
+    mgr->setValue("SMESH", "ScalarBarLabelColor",
+                  QString().sprintf("%d:%d:%d", labelColor.red(), labelColor.green(),labelColor. blue()));
+
+    if (myLabelsFontCombo->currentItem() == 0)
+      mgr->setValue("SMESH", "ScalarBarLabelFont", "Arial");
     else if ( myLabelsFontCombo->currentItem() == 1 )
-      QAD_CONFIG->addSetting( "SMESH:ScalarBarLabelFont", "Courier" );
+      mgr->setValue("SMESH", "ScalarBarLabelFont", "Courier");
     else
-      QAD_CONFIG->addSetting( "SMESH:ScalarBarLabelFont", "Times" );
-    QAD_CONFIG->addSetting( "SMESH:ScalarBarLabelBold",   myLabelsBoldCheck->isChecked() ?   "true" : "false" );
-    QAD_CONFIG->addSetting( "SMESH:ScalarBarLabelItalic", myLabelsItalicCheck->isChecked() ? "true" : "false" );
-    QAD_CONFIG->addSetting( "SMESH:ScalarBarLabelShadow", myLabelsShadowCheck->isChecked() ? "true" : "false" );
-
-    QAD_CONFIG->addSetting( "SMESH:ScalarBarNbOfColors", myColorsSpin->value() );
-    QAD_CONFIG->addSetting( "SMESH:ScalarBarNbOfLabels", myLabelsSpin->value() );
-
-    QAD_CONFIG->addSetting( "SMESH:ScalarBarOrientation", myHorizRadioBtn->isChecked() ? "Horizontal" : "Vertical" );
-    
-    QAD_CONFIG->addSetting( "SMESH:ScalarBarXPosition", myXSpin->value() );
-    QAD_CONFIG->addSetting( "SMESH:ScalarBarYPosition", myYSpin->value() );
-    QAD_CONFIG->addSetting( "SMESH:ScalarBarWidth",     myWidthSpin->value() );
-    QAD_CONFIG->addSetting( "SMESH:ScalarBarHeight",    myHeightSpin->value() );
+      mgr->setValue("SMESH", "ScalarBarLabelFont", "Times");
+
+    mgr->setValue("SMESH", "ScalarBarLabelBold",   myLabelsBoldCheck->isChecked()   ? "true" : "false");
+    mgr->setValue("SMESH", "ScalarBarLabelItalic", myLabelsItalicCheck->isChecked() ? "true" : "false");
+    mgr->setValue("SMESH", "ScalarBarLabelShadow", myLabelsShadowCheck->isChecked() ? "true" : "false");
+
+    mgr->setValue("SMESH", "ScalarBarNbOfColors", myColorsSpin->value());
+    mgr->setValue("SMESH", "ScalarBarNbOfLabels", myLabelsSpin->value());
+
+    mgr->setValue("SMESH", "ScalarBarOrientation", myHorizRadioBtn->isChecked() ? "Horizontal" : "Vertical");
+
+    mgr->setValue("SMESH", "ScalarBarXPosition", myXSpin->value());
+    mgr->setValue("SMESH", "ScalarBarYPosition", myYSpin->value());
+    mgr->setValue("SMESH", "ScalarBarWidth",     myWidthSpin->value());
+    mgr->setValue("SMESH", "ScalarBarHeight",    myHeightSpin->value());
   }
   return true;
 }
@@ -565,7 +585,7 @@ void SMESHGUI_Preferences_ScalarBarDlg::onTitleColor()
 {
   QColor aColor = myTitleColorBtn->paletteBackgroundColor();
   aColor = QColorDialog::getColor( aColor, this );
-  if ( aColor.isValid() ) 
+  if ( aColor.isValid() )
     myTitleColorBtn->setPaletteBackgroundColor( aColor );
 }
 
@@ -580,7 +600,7 @@ void SMESHGUI_Preferences_ScalarBarDlg::onLabelsColor()
 {
   QColor aColor = myLabelsColorBtn->paletteBackgroundColor();
   aColor = QColorDialog::getColor( aColor, this );
-  if ( aColor.isValid() ) 
+  if ( aColor.isValid() )
     myLabelsColorBtn->setPaletteBackgroundColor( aColor );
 }
 
@@ -593,15 +613,18 @@ void SMESHGUI_Preferences_ScalarBarDlg::onLabelsColor()
 //=================================================================================================
 void SMESHGUI_Preferences_ScalarBarDlg::onSelectionChanged()
 {
-  if( mySelection ) {
-    if ( mySelection->IObjectCount() == 1 ) {
-      Handle(SALOME_InteractiveObject) anIO = mySelection->firstIObject();
+  if (mySelectionMgr) {
+    SALOME_ListIO aList;
+    mySelectionMgr->selectedObjects(aList);
+
+    if (aList.Extent() == 1) {
+      Handle(SALOME_InteractiveObject) anIO = aList.First();
       if( anIO->hasEntry() ) {
        SMESH_Actor* anActor = SMESH::FindActorByEntry(anIO->getEntry());
        if ( anActor && anActor->GetScalarBarActor() && anActor->GetControlMode() != SMESH_Actor::eNone ) {
          myActor = anActor;
          vtkScalarBarActor* myScalarBarActor = myActor->GetScalarBarActor();
-         
+
          if ( myScalarBarActor->GetLookupTable() ) {
            float *range = myScalarBarActor->GetLookupTable()->GetRange();
            myMinEdit->setText( QString::number( range[0] ) );
@@ -634,7 +657,7 @@ void SMESHGUI_Preferences_ScalarBarDlg::onSelectionChanged()
          else
            myHorizRadioBtn->setChecked( true );
          myIniOrientation = myVertRadioBtn->isChecked();
-         
+
          myIniX = myScalarBarActor->GetPosition()[0];
          myIniY = myScalarBarActor->GetPosition()[1];
          myIniW = myScalarBarActor->GetWidth();
@@ -672,7 +695,7 @@ void SMESHGUI_Preferences_ScalarBarDlg::onSelectionChanged()
 //=================================================================================================
 void SMESHGUI_Preferences_ScalarBarDlg::closeEvent( QCloseEvent* e )
 {
-  if ( mySelection ) // "Properties" dialog box
+  if ( mySelectionMgr ) // "Properties" dialog box
     myDlg = 0;
   QDialog::closeEvent( e );
 }
@@ -720,14 +743,14 @@ void SMESHGUI_Preferences_ScalarBarDlg::setOriginAndSize( const double x,
  *  Called when orientation is changed
  */
 //=================================================================================================
-void SMESHGUI_Preferences_ScalarBarDlg::onOrientationChanged() 
+void SMESHGUI_Preferences_ScalarBarDlg::onOrientationChanged()
 {
   int aOrientation = myVertRadioBtn->isChecked();
   if ( aOrientation == myIniOrientation )
     setOriginAndSize( myIniX, myIniY, myIniW, myIniH );
   else
-    setOriginAndSize( aOrientation ? DEF_VER_X : DEF_HOR_X, 
-                     aOrientation ? DEF_VER_Y : DEF_HOR_Y, 
-                     aOrientation ? DEF_VER_W : DEF_HOR_W, 
+    setOriginAndSize( aOrientation ? DEF_VER_X : DEF_HOR_X,
+                     aOrientation ? DEF_VER_Y : DEF_HOR_Y,
+                     aOrientation ? DEF_VER_W : DEF_HOR_W,
                      aOrientation ? DEF_VER_H : DEF_HOR_H );
 }
index bde914a36757a143eca20a8c1d41e559c2fb66d3..f436c649cafb9010fafcfd2beaadde817eda7623 100644 (file)
@@ -41,8 +41,11 @@ class QPushButton;
 class QToolButton;
 class QRadioButton;
 class QSpinBox;
-class QAD_SpinBoxDbl;
-class SALOME_Selection;
+
+class QtxDblSpinBox;
+
+class SalomeApp_SelectionMgr;
+
 class SMESH_Actor;
 
 class SMESHGUI_Preferences_ScalarBarDlg : public QDialog
@@ -52,10 +55,10 @@ class SMESHGUI_Preferences_ScalarBarDlg : public QDialog
 public:
   ~SMESHGUI_Preferences_ScalarBarDlg();
   static void ScalarBarPreferences( QWidget* parent );
-  static void ScalarBarProperties ( QWidget* parent, SALOME_Selection* Sel );
+  static void ScalarBarProperties ( QWidget* parent, SalomeApp_SelectionMgr* Sel );
 
 protected:
-  SMESHGUI_Preferences_ScalarBarDlg( QWidget* parent = 0, SALOME_Selection* Sel = 0, bool modal = FALSE );
+  SMESHGUI_Preferences_ScalarBarDlg( QWidget* parent = 0, SalomeApp_SelectionMgr* Sel = 0, bool modal = FALSE );
   static SMESHGUI_Preferences_ScalarBarDlg* myDlg;
   void closeEvent( QCloseEvent* e );
   void setOriginAndSize( const double x, const double y, const double w, const double h );
@@ -71,10 +74,10 @@ protected slots:
   void onOrientationChanged();
 
 private:
-  SALOME_Selection*  mySelection;
-  SMESH_Actor*       myActor;
-  double             myIniX, myIniY, myIniW, myIniH;
-  int                myIniOrientation;
+  SalomeApp_SelectionMgr*  mySelectionMgr;
+  SMESH_Actor*             myActor;
+  double                   myIniX, myIniY, myIniW, myIniH;
+  int                      myIniOrientation;
 
   QGroupBox*         myRangeGrp;
   QLineEdit*         myMinEdit;
@@ -101,10 +104,10 @@ private:
   QRadioButton*      myHorizRadioBtn;
 
   QGroupBox*         myOriginDimGrp;
-  QAD_SpinBoxDbl*    myXSpin;
-  QAD_SpinBoxDbl*    myYSpin;
-  QAD_SpinBoxDbl*    myWidthSpin;
-  QAD_SpinBoxDbl*    myHeightSpin;
+  QtxDblSpinBox*     myXSpin;
+  QtxDblSpinBox*     myYSpin;
+  QtxDblSpinBox*     myWidthSpin;
+  QtxDblSpinBox*     myHeightSpin;
 
   QGroupBox*         myButtonGrp;
   QPushButton*       myOkBtn;
index 18a63d2be0cc82b96630e099f24780cab4e8d6eb..011402ab7c0680656a689acdbe920f72d73f6f29 100644 (file)
@@ -1,23 +1,23 @@
 //  SMESH SMESHGUI : GUI for SMESH component
 //
 //  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
-// 
-//  This library is free software; you can redistribute it and/or 
-//  modify it under the terms of the GNU Lesser General Public 
-//  License as published by the Free Software Foundation; either 
-//  version 2.1 of the License. 
-// 
-//  This library is distributed in the hope that it will be useful, 
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of 
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
-//  Lesser General Public License for more details. 
-// 
-//  You should have received a copy of the GNU Lesser General Public 
-//  License along with this library; if not, write to the Free Software 
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
-// 
-//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
 //
 //
 //
 #include "SMESHGUI_VTKUtils.h"
 #include "SMESHGUI_MeshUtils.h"
 #include "SMESHGUI_IdValidator.h"
+
 #include "SMESH_Actor.h"
 #include "SMDS_Mesh.hxx"
 
-#include "QAD_Application.h"
-#include "QAD_Desktop.h"
-#include "QAD_MessageBox.h"
+#include "SUIT_ResourceMgr.h"
+#include "SUIT_Desktop.h"
+
+#include "SVTK_Selector.h"
+#include "SVTK_ViewModel.h"
+#include "SVTK_ViewWindow.h"
+#include "SALOME_ListIO.hxx"
+
 #include "utilities.h"
 
+// OCCT Includes
+#include <TColStd_MapOfInteger.hxx>
+#include <TColStd_IndexedMapOfInteger.hxx>
+
 // QT Includes
 #include <qbuttongroup.h>
 #include <qgroupbox.h>
@@ -59,104 +69,115 @@ using namespace std;
 
 //=================================================================================
 // class    : SMESHGUI_RemoveElementsDlg()
-// purpose  : 
+// purpose  :
 //=================================================================================
-SMESHGUI_RemoveElementsDlg::SMESHGUI_RemoveElementsDlg( QWidget* parent, const char* name, SALOME_Selection* Sel,
-                                                       bool modal, WFlags fl )
-    : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
+SMESHGUI_RemoveElementsDlg
+::SMESHGUI_RemoveElementsDlg (SMESHGUI* theModule, 
+                             const char* name,
+                             bool modal, 
+                             WFlags fl)
+  : QDialog(SMESH::GetDesktop(theModule), 
+           name, 
+           modal, 
+           WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | Qt::WDestructiveClose),
+    mySelector(SMESH::GetViewWindow(theModule)->GetSelector()),
+    mySelectionMgr(SMESH::GetSelectionMgr(theModule)),
+    myViewWindow(SMESH::GetViewWindow(theModule)),
+    mySMESHGUI(theModule),
+    myBusy(false)
 {
-    QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "SMESH",tr("ICON_DLG_REM_ELEMENT")));
-    QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "SMESH",tr("ICON_SELECT")));
-
-    if ( !name )
-       setName( "SMESHGUI_RemoveElementsDlg" );
-    resize( 303, 185 ); 
-    setCaption( tr( "SMESH_REMOVE_ELEMENTS_TITLE"  ) );
-    setSizeGripEnabled( TRUE );
-    SMESHGUI_RemoveElementsDlgLayout = new QGridLayout( this ); 
-    SMESHGUI_RemoveElementsDlgLayout->setSpacing( 6 );
-    SMESHGUI_RemoveElementsDlgLayout->setMargin( 11 );
+    QPixmap image0 (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_DLG_REM_ELEMENT")));
+    QPixmap image1 (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_SELECT")));
+
+    if (!name)
+      setName("SMESHGUI_RemoveElementsDlg");
+    resize(303, 185);
+    setCaption(tr("SMESH_REMOVE_ELEMENTS_TITLE"));
+    setSizeGripEnabled(TRUE);
+    SMESHGUI_RemoveElementsDlgLayout = new QGridLayout(this);
+    SMESHGUI_RemoveElementsDlgLayout->setSpacing(6);
+    SMESHGUI_RemoveElementsDlgLayout->setMargin(11);
 
     /***************************************************************/
-    GroupConstructors = new QButtonGroup( this, "GroupConstructors" );
-    GroupConstructors->setTitle( tr( "SMESH_ELEMENTS"  ) );
-    GroupConstructors->setExclusive( TRUE );
-    GroupConstructors->setColumnLayout(0, Qt::Vertical );
-    GroupConstructors->layout()->setSpacing( 0 );
-    GroupConstructors->layout()->setMargin( 0 );
-    GroupConstructorsLayout = new QGridLayout( GroupConstructors->layout() );
-    GroupConstructorsLayout->setAlignment( Qt::AlignTop );
-    GroupConstructorsLayout->setSpacing( 6 );
-    GroupConstructorsLayout->setMargin( 11 );
-    Constructor1 = new QRadioButton( GroupConstructors, "Constructor1" );
-    Constructor1->setText( tr( ""  ) );
-    Constructor1->setPixmap( image0 );
-    Constructor1->setChecked( TRUE );
-    Constructor1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, Constructor1->sizePolicy().hasHeightForWidth() ) );
-    Constructor1->setMinimumSize( QSize( 50, 0 ) );
-    GroupConstructorsLayout->addWidget( Constructor1, 0, 0 );
-    QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
-    GroupConstructorsLayout->addItem( spacer, 0, 1 );
-    SMESHGUI_RemoveElementsDlgLayout->addWidget( GroupConstructors, 0, 0 );
-    
+    GroupConstructors = new QButtonGroup(this, "GroupConstructors");
+    GroupConstructors->setTitle(tr("SMESH_ELEMENTS" ));
+    GroupConstructors->setExclusive(TRUE);
+    GroupConstructors->setColumnLayout(0, Qt::Vertical);
+    GroupConstructors->layout()->setSpacing(0);
+    GroupConstructors->layout()->setMargin(0);
+    GroupConstructorsLayout = new QGridLayout(GroupConstructors->layout());
+    GroupConstructorsLayout->setAlignment(Qt::AlignTop);
+    GroupConstructorsLayout->setSpacing(6);
+    GroupConstructorsLayout->setMargin(11);
+    Constructor1 = new QRadioButton(GroupConstructors, "Constructor1");
+    Constructor1->setText(tr("" ));
+    Constructor1->setPixmap(image0);
+    Constructor1->setChecked(TRUE);
+    Constructor1->setSizePolicy(QSizePolicy((QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, Constructor1->sizePolicy().hasHeightForWidth()));
+    Constructor1->setMinimumSize(QSize(50, 0));
+    GroupConstructorsLayout->addWidget(Constructor1, 0, 0);
+    QSpacerItem* spacer = new QSpacerItem(20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
+    GroupConstructorsLayout->addItem(spacer, 0, 1);
+    SMESHGUI_RemoveElementsDlgLayout->addWidget(GroupConstructors, 0, 0);
+
     /***************************************************************/
-    GroupButtons = new QGroupBox( this, "GroupButtons" );
-    GroupButtons->setGeometry( QRect( 10, 10, 281, 48 ) ); 
-    GroupButtons->setTitle( tr( ""  ) );
-    GroupButtons->setColumnLayout(0, Qt::Vertical );
-    GroupButtons->layout()->setSpacing( 0 );
-    GroupButtons->layout()->setMargin( 0 );
-    GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
-    GroupButtonsLayout->setAlignment( Qt::AlignTop );
-    GroupButtonsLayout->setSpacing( 6 );
-    GroupButtonsLayout->setMargin( 11 );
-    buttonCancel = new QPushButton( GroupButtons, "buttonCancel" );
-    buttonCancel->setText( tr( "SMESH_BUT_CLOSE"  ) );
-    buttonCancel->setAutoDefault( TRUE );
-    GroupButtonsLayout->addWidget( buttonCancel, 0, 3 );
-    buttonApply = new QPushButton( GroupButtons, "buttonApply" );
-    buttonApply->setText( tr( "SMESH_BUT_APPLY"  ) );
-    buttonApply->setAutoDefault( TRUE );
-    GroupButtonsLayout->addWidget( buttonApply, 0, 1 );
-    QSpacerItem* spacer_9 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
-    GroupButtonsLayout->addItem( spacer_9, 0, 2 );
-    buttonOk = new QPushButton( GroupButtons, "buttonOk" );
-    buttonOk->setText( tr( "SMESH_BUT_OK"  ) );
-    buttonOk->setAutoDefault( TRUE );
-    buttonOk->setDefault( TRUE );
-    GroupButtonsLayout->addWidget( buttonOk, 0, 0 );
-    SMESHGUI_RemoveElementsDlgLayout->addWidget( GroupButtons, 2, 0 );
+    GroupButtons = new QGroupBox(this, "GroupButtons");
+    GroupButtons->setGeometry(QRect(10, 10, 281, 48));
+    GroupButtons->setTitle(tr("" ));
+    GroupButtons->setColumnLayout(0, Qt::Vertical);
+    GroupButtons->layout()->setSpacing(0);
+    GroupButtons->layout()->setMargin(0);
+    GroupButtonsLayout = new QGridLayout(GroupButtons->layout());
+    GroupButtonsLayout->setAlignment(Qt::AlignTop);
+    GroupButtonsLayout->setSpacing(6);
+    GroupButtonsLayout->setMargin(11);
+    buttonCancel = new QPushButton(GroupButtons, "buttonCancel");
+    buttonCancel->setText(tr("SMESH_BUT_CLOSE" ));
+    buttonCancel->setAutoDefault(TRUE);
+    GroupButtonsLayout->addWidget(buttonCancel, 0, 3);
+    buttonApply = new QPushButton(GroupButtons, "buttonApply");
+    buttonApply->setText(tr("SMESH_BUT_APPLY" ));
+    buttonApply->setAutoDefault(TRUE);
+    GroupButtonsLayout->addWidget(buttonApply, 0, 1);
+    QSpacerItem* spacer_9 = new QSpacerItem(20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
+    GroupButtonsLayout->addItem(spacer_9, 0, 2);
+    buttonOk = new QPushButton(GroupButtons, "buttonOk");
+    buttonOk->setText(tr("SMESH_BUT_OK" ));
+    buttonOk->setAutoDefault(TRUE);
+    buttonOk->setDefault(TRUE);
+    GroupButtonsLayout->addWidget(buttonOk, 0, 0);
+    SMESHGUI_RemoveElementsDlgLayout->addWidget(GroupButtons, 2, 0);
 
     /***************************************************************/
-    GroupC1 = new QGroupBox( this, "GroupC1" );
-    GroupC1->setTitle( tr( "SMESH_REMOVE"  ) );
-    GroupC1->setMinimumSize( QSize( 0, 0 ) );
-    GroupC1->setFrameShape( QGroupBox::Box );
-    GroupC1->setFrameShadow( QGroupBox::Sunken );
-    GroupC1->setColumnLayout(0, Qt::Vertical );
-    GroupC1->layout()->setSpacing( 0 );
-    GroupC1->layout()->setMargin( 0 );
-    GroupC1Layout = new QGridLayout( GroupC1->layout() );
-    GroupC1Layout->setAlignment( Qt::AlignTop );
-    GroupC1Layout->setSpacing( 6 );
-    GroupC1Layout->setMargin( 11 );
-    TextLabelC1A1 = new QLabel( GroupC1, "TextLabelC1A1" );
-    TextLabelC1A1->setText( tr( "SMESH_ID_ELEMENTS"  ) );
-    TextLabelC1A1->setMinimumSize( QSize( 50, 0 ) );
-    TextLabelC1A1->setFrameShape( QLabel::NoFrame );
-    TextLabelC1A1->setFrameShadow( QLabel::Plain );
-    GroupC1Layout->addWidget( TextLabelC1A1, 0, 0 );
-    SelectButtonC1A1 = new QPushButton( GroupC1, "SelectButtonC1A1" );
-    SelectButtonC1A1->setText( tr( ""  ) );
-    SelectButtonC1A1->setPixmap( image1 );
-    SelectButtonC1A1->setToggleButton( FALSE );
-    GroupC1Layout->addWidget( SelectButtonC1A1, 0, 1 );
-    LineEditC1A1 = new QLineEdit( GroupC1, "LineEditC1A1" );
-    LineEditC1A1->setValidator( new SMESHGUI_IdValidator( this, "validator" ));
-    GroupC1Layout->addWidget( LineEditC1A1, 0, 2 );
-    SMESHGUI_RemoveElementsDlgLayout->addWidget( GroupC1, 1, 0 );
-
-    Init(Sel) ; /* Initialisations */
+    GroupC1 = new QGroupBox(this, "GroupC1");
+    GroupC1->setTitle(tr("SMESH_REMOVE" ));
+    GroupC1->setMinimumSize(QSize(0, 0));
+    GroupC1->setFrameShape(QGroupBox::Box);
+    GroupC1->setFrameShadow(QGroupBox::Sunken);
+    GroupC1->setColumnLayout(0, Qt::Vertical);
+    GroupC1->layout()->setSpacing(0);
+    GroupC1->layout()->setMargin(0);
+    GroupC1Layout = new QGridLayout(GroupC1->layout());
+    GroupC1Layout->setAlignment(Qt::AlignTop);
+    GroupC1Layout->setSpacing(6);
+    GroupC1Layout->setMargin(11);
+    TextLabelC1A1 = new QLabel(GroupC1, "TextLabelC1A1");
+    TextLabelC1A1->setText(tr("SMESH_ID_ELEMENTS" ));
+    TextLabelC1A1->setMinimumSize(QSize(50, 0));
+    TextLabelC1A1->setFrameShape(QLabel::NoFrame);
+    TextLabelC1A1->setFrameShadow(QLabel::Plain);
+    GroupC1Layout->addWidget(TextLabelC1A1, 0, 0);
+    SelectButtonC1A1 = new QPushButton(GroupC1, "SelectButtonC1A1");
+    SelectButtonC1A1->setText(tr("" ));
+    SelectButtonC1A1->setPixmap(image1);
+    SelectButtonC1A1->setToggleButton(FALSE);
+    GroupC1Layout->addWidget(SelectButtonC1A1, 0, 1);
+    LineEditC1A1 = new QLineEdit(GroupC1, "LineEditC1A1");
+    LineEditC1A1->setValidator(new SMESHGUI_IdValidator(this, "validator"));
+    GroupC1Layout->addWidget(LineEditC1A1, 0, 2);
+    SMESHGUI_RemoveElementsDlgLayout->addWidget(GroupC1, 1, 0);
+
+    Init(); /* Initialisations */
 }
 
 //=================================================================================
@@ -165,96 +186,85 @@ SMESHGUI_RemoveElementsDlg::SMESHGUI_RemoveElementsDlg( QWidget* parent, const c
 //=================================================================================
 SMESHGUI_RemoveElementsDlg::~SMESHGUI_RemoveElementsDlg()
 {
-    // no need to delete child widgets, Qt does it all for us
+  // no need to delete child widgets, Qt does it all for us
 }
 
-
 //=================================================================================
 // function : Init()
 // purpose  :
 //=================================================================================
-void SMESHGUI_RemoveElementsDlg::Init( SALOME_Selection* Sel )
+void SMESHGUI_RemoveElementsDlg::Init()
 {
-
   GroupC1->show();
-  myConstructorId = 0 ;
-  Constructor1->setChecked( TRUE );
-  myEditCurrentArgument = LineEditC1A1 ;       
-
-  mySelection = Sel;  
-  myNbOkElements = false ;
-  mySMESHGUI = SMESHGUI::GetSMESHGUI() ;
-  mySMESHGUI->SetActiveDialogBox( (QDialog*)this ) ;
+  myConstructorId = 0;
+  Constructor1->setChecked(TRUE);
+  myEditCurrentArgument = LineEditC1A1;
+
+  myNbOkElements = false;
+  mySMESHGUI->SetActiveDialogBox((QDialog*)this);
   myActor = 0;
   myBusy = false;
 
   /* signals and slots connections */
-  connect( buttonOk, SIGNAL( clicked() ),     this, SLOT( ClickOnOk() ) );
-  connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ) ;
-  connect( buttonApply, SIGNAL( clicked() ), this, SLOT(ClickOnApply() ) );
-  connect( GroupConstructors, SIGNAL(clicked(int) ), SLOT( ConstructorsClicked(int) ) );
-
-  connect( SelectButtonC1A1, SIGNAL (clicked() ),   this, SLOT( SetEditCurrentArgument() ) ) ;
-  connect( mySMESHGUI, SIGNAL ( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ;
-  connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
+  connect(buttonOk, SIGNAL(clicked()),     this, SLOT(ClickOnOk()));
+  connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel()));
+  connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply()));
+  connect(GroupConstructors, SIGNAL(clicked(int)), SLOT(ConstructorsClicked(int)));
+
+  connect(SelectButtonC1A1, SIGNAL (clicked()),   this, SLOT(SetEditCurrentArgument()));
+  connect(mySMESHGUI, SIGNAL (SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog()));
+  connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
   /* to close dialog if study change */
-  connect( mySMESHGUI, SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ) ;
-  connect( myEditCurrentArgument, SIGNAL( textChanged( const QString& )),
-           SLOT( onTextChange( const QString& )));
+  connect(mySMESHGUI, SIGNAL (SignalCloseAllDialogs()), this, SLOT(ClickOnCancel()));
+  connect(myEditCurrentArgument, SIGNAL(textChanged(const QString&)),
+           SLOT(onTextChange(const QString&)));
 
   /* Move widget on the botton right corner of main widget */
-  int x, y ;
-  mySMESHGUI->DefineDlgPosition( this, x, y ) ;
-  this->move( x, y ) ;
-  this->show() ; /* displays Dialog */
+  int x, y;
+  mySMESHGUI->DefineDlgPosition(this, x, y);
+  this->move(x, y);
+  this->show(); /* displays Dialog */
 
-  QAD_Application::getDesktop()->SetSelectionMode( CellSelection, true );
+  myViewWindow->SetSelectionMode(CellSelection);
 
   SelectionIntoArgument();
 }
 
-
 //=================================================================================
 // function : ConstructorsClicked()
 // purpose  : Radio button management
 //=================================================================================
-void SMESHGUI_RemoveElementsDlg::ConstructorsClicked(int constructorId)
+void SMESHGUI_RemoveElementsDlg::ConstructorsClicked (int)
 {
-  return ;
 }
 
-
 //=================================================================================
 // function : ClickOnApply()
 // purpose  :
 //=================================================================================
 void SMESHGUI_RemoveElementsDlg::ClickOnApply()
 {
-  if (mySMESHGUI->ActiveStudyLocked())
+  if (mySMESHGUI->isActiveStudyLocked())
     return;
-  if ( myNbOkElements ) {
-    QStringList aListId = QStringList::split( " ", myEditCurrentArgument->text(), false);
+  if (myNbOkElements) {
+    QStringList aListId = QStringList::split(" ", myEditCurrentArgument->text(), false);
     SMESH::long_array_var anArrayOfIdeces = new SMESH::long_array;
-    anArrayOfIdeces->length( aListId.count() );
-    for ( int i = 0; i < aListId.count(); i++ )
+    anArrayOfIdeces->length(aListId.count());
+    for (int i = 0; i < aListId.count(); i++)
       anArrayOfIdeces[i] = aListId[ i ].toInt();
 
     bool aResult = false;
-    try
-    {
+    try {
       SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
-      aResult = aMeshEditor->RemoveElements(anArrayOfIdeces.inout()) ;
-    }
-    catch( ... )
-    {
+      aResult = aMeshEditor->RemoveElements(anArrayOfIdeces.inout());
+    } catch (...) {
     }
 
-    if ( aResult )
-    {
-      Handle(SALOME_InteractiveObject) anIO = myActor->getIO();
-      mySelection->ClearIObjects();
+    if (aResult) {
+      SALOME_ListIO aList;
+      aList.Append(myActor->getIO());
+      mySelectionMgr->setSelectedObjects(aList, false);
       SMESH::UpdateView();
-      mySelection->AddIObject( anIO, false );
     }
   }
 }
@@ -265,10 +275,10 @@ void SMESHGUI_RemoveElementsDlg::ClickOnApply()
 //=================================================================================
 void SMESHGUI_RemoveElementsDlg::ClickOnOk()
 {
-  this->ClickOnApply() ;
-  this->ClickOnCancel() ;
+  this->ClickOnApply();
+  this->ClickOnCancel();
 
-  return ;
+  return;
 }
 
 //=================================================================================
@@ -277,53 +287,61 @@ void SMESHGUI_RemoveElementsDlg::ClickOnOk()
 //=================================================================================
 void SMESHGUI_RemoveElementsDlg::ClickOnCancel()
 {
-  mySelection->ClearIObjects();
-  QAD_Application::getDesktop()->SetSelectionMode( ActorSelection );
-  disconnect( mySelection, 0, this, 0 );
-  mySMESHGUI->ResetState() ;
-  reject() ;
-  return ;
+  mySelectionMgr->clearSelected();
+  myViewWindow->SetSelectionMode(ActorSelection);
+  disconnect(mySelectionMgr, 0, this, 0);
+  mySMESHGUI->ResetState();
+  reject();
+  return;
 }
 
-
 //=======================================================================
 //function : onTextChange
-//purpose  : 
+//purpose  :
 //=======================================================================
-
-void SMESHGUI_RemoveElementsDlg::onTextChange(const QString& theNewText)
+void SMESHGUI_RemoveElementsDlg::onTextChange (const QString& theNewText)
 {
-  if ( myBusy ) return;
+  if (myBusy) 
+    return;
   myBusy = true;
 
   myNbOkElements = 0;
 
-  buttonOk->setEnabled( false );
-  buttonApply->setEnabled( false );
+  buttonOk->setEnabled(false);
+  buttonApply->setEnabled(false);
 
   // hilight entered elements
-  SMDS_Mesh* aMesh = 0;
-  if ( myActor )
-    aMesh = myActor->GetObject()->GetMesh();
-  if ( aMesh ) {
-
-    mySelection->ClearIObjects();
-    mySelection->AddIObject( myActor->getIO() );
-
-    QStringList aListId = QStringList::split( " ", theNewText, false);
-    for ( int i = 0; i < aListId.count(); i++ ) {
-      const SMDS_MeshElement * e = aMesh->FindElement( aListId[ i ].toInt() );
-      if ( e ) {
-        if ( !mySelection->IsIndexSelected( myActor->getIO(), e->GetID() ))
-          mySelection->AddOrRemoveIndex (myActor->getIO(), e->GetID(), true);
-        myNbOkElements++;
+  if(myActor){
+    if(SMDS_Mesh* aMesh = myActor->GetObject()->GetMesh()){
+      Handle(SALOME_InteractiveObject) anIO = myActor->getIO();
+      SALOME_ListIO aList;
+      aList.Append(anIO);
+      mySelectionMgr->setSelectedObjects(aList, false);
+      
+      TColStd_IndexedMapOfInteger selectedIndices;
+      TColStd_MapOfInteger newIndices;
+      mySelector->GetIndex(anIO,selectedIndices);
+      
+      QStringList aListId = QStringList::split(" ", theNewText, false);
+      for (int i = 0; i < aListId.count(); i++) {
+       if(const SMDS_MeshElement *anElem = aMesh->FindElement(aListId[i].toInt())) {
+         if (selectedIndices.Add(anElem->GetID())) {
+           newIndices.Add(anElem->GetID());
+         }
+         myNbOkElements++;
+       }
+      }
+    
+      if (newIndices.Extent() > 0){
+       mySelector->AddOrRemoveIndex(anIO,newIndices,true);
+       myViewWindow->highlight(anIO,true,true);
       }
     }
+  }
 
-    if ( myNbOkElements ) {
-      buttonOk->setEnabled( true );
-      buttonApply->setEnabled( true );
-    }
+  if (myNbOkElements) {
+    buttonOk->setEnabled(true);
+    buttonApply->setEnabled(true);
   }
 
   myBusy = false;
@@ -335,7 +353,7 @@ void SMESHGUI_RemoveElementsDlg::onTextChange(const QString& theNewText)
 //=================================================================================
 void SMESHGUI_RemoveElementsDlg::SelectionIntoArgument()
 {
-  if ( myBusy ) return;
+  if (myBusy) return;
 
   // clear
 
@@ -343,48 +361,50 @@ void SMESHGUI_RemoveElementsDlg::SelectionIntoArgument()
   myActor = 0;
 
   myBusy = true;
-  myEditCurrentArgument->setText( "" );
+  myEditCurrentArgument->setText("");
   myBusy = false;
 
-  if ( !GroupButtons->isEnabled() ) // inactive
+  if (!GroupButtons->isEnabled()) // inactive
     return;
 
-  buttonOk->setEnabled( false );
-  buttonApply->setEnabled( false );
+  buttonOk->setEnabled(false);
+  buttonApply->setEnabled(false);
 
   // get selected mesh
 
-  int nbSel = mySelection->IObjectCount();
-  if(nbSel != 1)
+  SALOME_ListIO aList;
+  mySelectionMgr->selectedObjects(aList,SVTK_Viewer::Type());
+
+  int nbSel = aList.Extent();
+  if (nbSel != 1)
     return;
 
-  myMesh = SMESH::GetMeshByIO( mySelection->firstIObject() );
-  if ( myMesh->_is_nil() )
+  Handle(SALOME_InteractiveObject) anIO = aList.First();
+  myMesh = SMESH::GetMeshByIO(anIO);
+  if (myMesh->_is_nil())
     return;
 
-  myActor = SMESH::FindActorByEntry( mySelection->firstIObject()->getEntry() );
-  if ( !myActor )
+  myActor = SMESH::FindActorByEntry(anIO->getEntry());
+  if (!myActor)
     return;
 
   // get selected nodes
-
   QString aString = "";
-  int nbElems = SMESH::GetNameOfSelectedElements(mySelection, aString) ;
+  int nbElems = SMESH::GetNameOfSelectedElements(mySelector,anIO,aString);
   if(nbElems < 1)
-    return ;
+    return;
   myBusy = true;
-  myEditCurrentArgument->setText( aString );
+  myEditCurrentArgument->setText(aString);
   myBusy = false;
 
   // OK
 
   myNbOkElements = nbElems;
 
-  buttonOk->setEnabled( true );
-  buttonApply->setEnabled( true );
+  buttonOk->setEnabled(true);
+  buttonApply->setEnabled(true);
 }
 
-
 //=================================================================================
 // function : SetEditCurrentArgument()
 // purpose  :
@@ -395,16 +415,16 @@ void SMESHGUI_RemoveElementsDlg::SetEditCurrentArgument()
   switch (myConstructorId)
     {
     case 0: /* default constructor */
-      {        
+      {
        if(send == SelectButtonC1A1) {
-         LineEditC1A1->setFocus() ;
+         LineEditC1A1->setFocus();
          myEditCurrentArgument = LineEditC1A1;
        }
-       SelectionIntoArgument() ;
+       SelectionIntoArgument();
        break;
       }
     }
-  return ;
+  return;
 }
 
 //=================================================================================
@@ -413,15 +433,15 @@ void SMESHGUI_RemoveElementsDlg::SetEditCurrentArgument()
 //=================================================================================
 void SMESHGUI_RemoveElementsDlg::DeactivateActiveDialog()
 {
-  if ( GroupConstructors->isEnabled() ) {
-    GroupConstructors->setEnabled(false) ;
-    GroupC1->setEnabled(false) ;
-    GroupButtons->setEnabled(false) ;
+  if (GroupConstructors->isEnabled()) {
+    GroupConstructors->setEnabled(false);
+    GroupC1->setEnabled(false);
+    GroupButtons->setEnabled(false);
+    mySMESHGUI->ResetState(); // ??
+    mySMESHGUI->SetActiveDialogBox(0); // ??
   }
-  return ;
 }
 
-
 //=================================================================================
 // function : ActivateThisDialog()
 // purpose  :
@@ -429,45 +449,46 @@ void SMESHGUI_RemoveElementsDlg::DeactivateActiveDialog()
 void SMESHGUI_RemoveElementsDlg::ActivateThisDialog()
 {
   /* Emit a signal to deactivate the active dialog */
-  mySMESHGUI->EmitSignalDeactivateDialog() ;   
+  mySMESHGUI->EmitSignalDeactivateDialog();
 
-  GroupConstructors->setEnabled(true) ;
-  GroupC1->setEnabled(true) ;
-  GroupButtons->setEnabled(true) ;
+  GroupConstructors->setEnabled(true);
+  GroupC1->setEnabled(true);
+  GroupButtons->setEnabled(true);
 
-  QAD_Application::getDesktop()->SetSelectionMode( CellSelection, true );
-}
+  mySMESHGUI->SetActiveDialogBox((QDialog*)this); // ??
+
+  myViewWindow->SetSelectionMode(NodeSelection);
 
+  SelectionIntoArgument(); // ??
+}
 
 //=================================================================================
 // function : enterEvent()
 // purpose  :
 //=================================================================================
-void SMESHGUI_RemoveElementsDlg::enterEvent(QEvent* e)
+void SMESHGUI_RemoveElementsDlg::enterEvent (QEvent*)
 {
-  if ( !GroupConstructors->isEnabled() )
-    ActivateThisDialog() ;
+  if (!GroupConstructors->isEnabled())
+    ActivateThisDialog();
 }
 
-
 //=================================================================================
 // function : closeEvent()
 // purpose  :
 //=================================================================================
-void SMESHGUI_RemoveElementsDlg::closeEvent( QCloseEvent* e )
+void SMESHGUI_RemoveElementsDlg::closeEvent (QCloseEvent*)
 {
   /* same than click on cancel button */
-  this->ClickOnCancel() ;
-  return ;
+  this->ClickOnCancel();
+  return;
 }
 
 //=======================================================================
 //function : hideEvent
 //purpose  : caused by ESC key
 //=======================================================================
-
-void SMESHGUI_RemoveElementsDlg::hideEvent ( QHideEvent * e )
+void SMESHGUI_RemoveElementsDlg::hideEvent (QHideEvent * e)
 {
-  if ( !isMinimized() )
+  if (!isMinimized())
     ClickOnCancel();
 }
index e18ad584b69f0b8de2543a34fe99708e7a0f6bfd..e112f65f115dbdf6a919a656605a9f3dd9beaf62 100644 (file)
@@ -29,7 +29,7 @@
 #ifndef DIALOGBOX_REMOVE_ELEMENTS_H
 #define DIALOGBOX_REMOVE_ELEMENTS_H
 
-#include "SALOME_Selection.h"
+#include "SalomeApp_SelectionMgr.h"
 
 // QT Includes
 #include <qvariant.h>
@@ -44,8 +44,11 @@ class QLabel;
 class QLineEdit;
 class QPushButton;
 class QRadioButton;
+
 class SMESHGUI;
 class SMESH_Actor;
+class SVTK_Selector;
+class SVTK_ViewWindow;
 
 // IDL Headers
 #include <SALOMEconfig.h>
@@ -60,20 +63,26 @@ class SMESHGUI_RemoveElementsDlg : public QDialog
     Q_OBJECT
 
 public:
-    SMESHGUI_RemoveElementsDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 );
+    SMESHGUI_RemoveElementsDlg(SMESHGUI* theModule,
+                              const char* name = 0,
+                              bool modal = FALSE,
+                              WFlags fl = 0);
     ~SMESHGUI_RemoveElementsDlg();
 
 private:
 
-    void Init( SALOME_Selection* Sel ) ;
+    void Init() ;
     void closeEvent( QCloseEvent* e ) ;
     void enterEvent ( QEvent * ) ;                          /* mouse enter the QWidget */
     void hideEvent ( QHideEvent * );                        /* ESC key */
 
-    SMESHGUI*                     mySMESHGUI ;              /* Current SMESHGUI object */
-    SALOME_Selection*             mySelection ;             /* User shape selection */
-    int                           myNbOkElements ;          /* to check when arguments is defined */
-    int                           myConstructorId ;         /* Current constructor id = radio button id */
+    SalomeApp_SelectionMgr*       mySelectionMgr;
+    SVTK_ViewWindow*              myViewWindow;
+    SVTK_Selector*                mySelector;
+    SMESHGUI*                     mySMESHGUI;
+
+    int                           myNbOkElements;           /* to check when arguments is defined */
+    int                           myConstructorId;          /* Current constructor id = radio button id */
     QLineEdit*                    myEditCurrentArgument;    /* Current  LineEdit */
 
     bool                          myBusy;
index 3990a51b0206f9736780b55d188fa6592feb428e..9df083576e8381ccbd6a0aa1e02c4ac784dd321b 100644 (file)
@@ -1,23 +1,23 @@
 //  SMESH SMESHGUI : GUI for SMESH component
 //
 //  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
-// 
-//  This library is free software; you can redistribute it and/or 
-//  modify it under the terms of the GNU Lesser General Public 
-//  License as published by the Free Software Foundation; either 
-//  version 2.1 of the License. 
-// 
-//  This library is distributed in the hope that it will be useful, 
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of 
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
-//  Lesser General Public License for more details. 
-// 
-//  You should have received a copy of the GNU Lesser General Public 
-//  License along with this library; if not, write to the Free Software 
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
-// 
-//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
 //
 //
 //
 #include "SMESHGUI_VTKUtils.h"
 #include "SMESHGUI_MeshUtils.h"
 #include "SMESHGUI_IdValidator.h"
+
 #include "SMESH_Actor.h"
 #include "SMDS_Mesh.hxx"
 
-#include "QAD_Application.h"
-#include "QAD_Desktop.h"
-#include "QAD_MessageBox.h"
+#include "SUIT_ResourceMgr.h"
+#include "SUIT_Desktop.h"
+
+#include "SVTK_Selector.h"
+#include "SVTK_ViewModel.h"
+#include "SVTK_ViewWindow.h"
+#include "SALOME_ListIO.hxx"
+
 #include "utilities.h"
 
+// OCCT Includes
+#include <TColStd_MapOfInteger.hxx>
+#include <TColStd_IndexedMapOfInteger.hxx>
+
 // QT Includes
 #include <qbuttongroup.h>
 #include <qgroupbox.h>
@@ -59,106 +69,115 @@ using namespace std;
 
 //=================================================================================
 // class    : SMESHGUI_RemoveNodesDlg()
-// purpose  : 
+// purpose  :
 //=================================================================================
-SMESHGUI_RemoveNodesDlg::SMESHGUI_RemoveNodesDlg( QWidget* parent, const char* name, SALOME_Selection* Sel,
-                                                 bool modal, WFlags fl )
-     : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu |
-              Qt::WDestructiveClose),
-       myBusy( false )
+SMESHGUI_RemoveNodesDlg
+::SMESHGUI_RemoveNodesDlg(SMESHGUI* theModule, 
+                         const char* name,
+                         bool modal, 
+                         WFlags fl)
+  : QDialog(SMESH::GetDesktop(theModule), 
+           name, 
+           modal, 
+           WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | Qt::WDestructiveClose),
+    mySelector(SMESH::GetViewWindow(theModule)->GetSelector()),
+    mySelectionMgr(SMESH::GetSelectionMgr(theModule)),
+    myViewWindow(SMESH::GetViewWindow(theModule)),
+    mySMESHGUI(theModule),
+    myBusy(false)
 {
-    QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "SMESH",tr("ICON_DLG_REM_NODE")));
-    QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "SMESH",tr("ICON_SELECT")));
-
-    if ( !name )
-       setName( "SMESHGUI_RemoveNodesDlg" );
-    resize( 303, 185 ); 
-    setCaption( tr( "SMESH_REMOVE_NODES_TITLE"  ) );
-    setSizeGripEnabled( TRUE );
-    SMESHGUI_RemoveNodesDlgLayout = new QGridLayout( this ); 
-    SMESHGUI_RemoveNodesDlgLayout->setSpacing( 6 );
-    SMESHGUI_RemoveNodesDlgLayout->setMargin( 11 );
+    QPixmap image0 (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_DLG_REM_NODE")));
+    QPixmap image1 (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_SELECT")));
+
+    if (!name)
+       setName("SMESHGUI_RemoveNodesDlg");
+    resize(303, 185);
+    setCaption(tr("SMESH_REMOVE_NODES_TITLE" ));
+    setSizeGripEnabled(TRUE);
+    SMESHGUI_RemoveNodesDlgLayout = new QGridLayout(this);
+    SMESHGUI_RemoveNodesDlgLayout->setSpacing(6);
+    SMESHGUI_RemoveNodesDlgLayout->setMargin(11);
 
     /***************************************************************/
-    GroupConstructors = new QButtonGroup( this, "GroupConstructors" );
-    GroupConstructors->setTitle( tr( "SMESH_NODES"  ) );
-    GroupConstructors->setExclusive( TRUE );
-    GroupConstructors->setColumnLayout(0, Qt::Vertical );
-    GroupConstructors->layout()->setSpacing( 0 );
-    GroupConstructors->layout()->setMargin( 0 );
-    GroupConstructorsLayout = new QGridLayout( GroupConstructors->layout() );
-    GroupConstructorsLayout->setAlignment( Qt::AlignTop );
-    GroupConstructorsLayout->setSpacing( 6 );
-    GroupConstructorsLayout->setMargin( 11 );
-    Constructor1 = new QRadioButton( GroupConstructors, "Constructor1" );
-    Constructor1->setText( tr( ""  ) );
-    Constructor1->setPixmap( image0 );
-    Constructor1->setChecked( TRUE );
-    Constructor1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, Constructor1->sizePolicy().hasHeightForWidth() ) );
-    Constructor1->setMinimumSize( QSize( 50, 0 ) );
-    GroupConstructorsLayout->addWidget( Constructor1, 0, 0 );
-    QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
-    GroupConstructorsLayout->addItem( spacer, 0, 1 );
-    SMESHGUI_RemoveNodesDlgLayout->addWidget( GroupConstructors, 0, 0 );
-    
+    GroupConstructors = new QButtonGroup(this, "GroupConstructors");
+    GroupConstructors->setTitle(tr("SMESH_NODES" ));
+    GroupConstructors->setExclusive(TRUE);
+    GroupConstructors->setColumnLayout(0, Qt::Vertical);
+    GroupConstructors->layout()->setSpacing(0);
+    GroupConstructors->layout()->setMargin(0);
+    GroupConstructorsLayout = new QGridLayout(GroupConstructors->layout());
+    GroupConstructorsLayout->setAlignment(Qt::AlignTop);
+    GroupConstructorsLayout->setSpacing(6);
+    GroupConstructorsLayout->setMargin(11);
+    Constructor1 = new QRadioButton(GroupConstructors, "Constructor1");
+    Constructor1->setText(tr("" ));
+    Constructor1->setPixmap(image0);
+    Constructor1->setChecked(TRUE);
+    Constructor1->setSizePolicy(QSizePolicy((QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, Constructor1->sizePolicy().hasHeightForWidth()));
+    Constructor1->setMinimumSize(QSize(50, 0));
+    GroupConstructorsLayout->addWidget(Constructor1, 0, 0);
+    QSpacerItem* spacer = new QSpacerItem(20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
+    GroupConstructorsLayout->addItem(spacer, 0, 1);
+    SMESHGUI_RemoveNodesDlgLayout->addWidget(GroupConstructors, 0, 0);
+
     /***************************************************************/
-    GroupButtons = new QGroupBox( this, "GroupButtons" );
-    GroupButtons->setGeometry( QRect( 10, 10, 281, 48 ) ); 
-    GroupButtons->setTitle( tr( ""  ) );
-    GroupButtons->setColumnLayout(0, Qt::Vertical );
-    GroupButtons->layout()->setSpacing( 0 );
-    GroupButtons->layout()->setMargin( 0 );
-    GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
-    GroupButtonsLayout->setAlignment( Qt::AlignTop );
-    GroupButtonsLayout->setSpacing( 6 );
-    GroupButtonsLayout->setMargin( 11 );
-    buttonCancel = new QPushButton( GroupButtons, "buttonCancel" );
-    buttonCancel->setText( tr( "SMESH_BUT_CLOSE"  ) );
-    buttonCancel->setAutoDefault( TRUE );
-    GroupButtonsLayout->addWidget( buttonCancel, 0, 3 );
-    buttonApply = new QPushButton( GroupButtons, "buttonApply" );
-    buttonApply->setText( tr( "SMESH_BUT_APPLY"  ) );
-    buttonApply->setAutoDefault( TRUE );
-    GroupButtonsLayout->addWidget( buttonApply, 0, 1 );
-    QSpacerItem* spacer_9 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
-    GroupButtonsLayout->addItem( spacer_9, 0, 2 );
-    buttonOk = new QPushButton( GroupButtons, "buttonOk" );
-    buttonOk->setText( tr( "SMESH_BUT_OK"  ) );
-    buttonOk->setAutoDefault( TRUE );
-    buttonOk->setDefault( TRUE );
-    GroupButtonsLayout->addWidget( buttonOk, 0, 0 );
-    SMESHGUI_RemoveNodesDlgLayout->addWidget( GroupButtons, 2, 0 );
+    GroupButtons = new QGroupBox(this, "GroupButtons");
+    GroupButtons->setGeometry(QRect(10, 10, 281, 48));
+    GroupButtons->setTitle(tr("" ));
+    GroupButtons->setColumnLayout(0, Qt::Vertical);
+    GroupButtons->layout()->setSpacing(0);
+    GroupButtons->layout()->setMargin(0);
+    GroupButtonsLayout = new QGridLayout(GroupButtons->layout());
+    GroupButtonsLayout->setAlignment(Qt::AlignTop);
+    GroupButtonsLayout->setSpacing(6);
+    GroupButtonsLayout->setMargin(11);
+    buttonCancel = new QPushButton(GroupButtons, "buttonCancel");
+    buttonCancel->setText(tr("SMESH_BUT_CLOSE" ));
+    buttonCancel->setAutoDefault(TRUE);
+    GroupButtonsLayout->addWidget(buttonCancel, 0, 3);
+    buttonApply = new QPushButton(GroupButtons, "buttonApply");
+    buttonApply->setText(tr("SMESH_BUT_APPLY" ));
+    buttonApply->setAutoDefault(TRUE);
+    GroupButtonsLayout->addWidget(buttonApply, 0, 1);
+    QSpacerItem* spacer_9 = new QSpacerItem(20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
+    GroupButtonsLayout->addItem(spacer_9, 0, 2);
+    buttonOk = new QPushButton(GroupButtons, "buttonOk");
+    buttonOk->setText(tr("SMESH_BUT_OK" ));
+    buttonOk->setAutoDefault(TRUE);
+    buttonOk->setDefault(TRUE);
+    GroupButtonsLayout->addWidget(buttonOk, 0, 0);
+    SMESHGUI_RemoveNodesDlgLayout->addWidget(GroupButtons, 2, 0);
 
     /***************************************************************/
-    GroupC1 = new QGroupBox( this, "GroupC1" );
-    GroupC1->setTitle( tr( "SMESH_REMOVE"  ) );
-    GroupC1->setMinimumSize( QSize( 0, 0 ) );
-    GroupC1->setFrameShape( QGroupBox::Box );
-    GroupC1->setFrameShadow( QGroupBox::Sunken );
-    GroupC1->setColumnLayout(0, Qt::Vertical );
-    GroupC1->layout()->setSpacing( 0 );
-    GroupC1->layout()->setMargin( 0 );
-    GroupC1Layout = new QGridLayout( GroupC1->layout() );
-    GroupC1Layout->setAlignment( Qt::AlignTop );
-    GroupC1Layout->setSpacing( 6 );
-    GroupC1Layout->setMargin( 11 );
-    TextLabelC1A1 = new QLabel( GroupC1, "TextLabelC1A1" );
-    TextLabelC1A1->setText( tr( "SMESH_ID_NODES"  ) );
-    TextLabelC1A1->setMinimumSize( QSize( 50, 0 ) );
-    TextLabelC1A1->setFrameShape( QLabel::NoFrame );
-    TextLabelC1A1->setFrameShadow( QLabel::Plain );
-    GroupC1Layout->addWidget( TextLabelC1A1, 0, 0 );
-    SelectButtonC1A1 = new QPushButton( GroupC1, "SelectButtonC1A1" );
-    SelectButtonC1A1->setText( tr( ""  ) );
-    SelectButtonC1A1->setPixmap( image1 );
-    SelectButtonC1A1->setToggleButton( FALSE );
-    GroupC1Layout->addWidget( SelectButtonC1A1, 0, 1 );
-    LineEditC1A1 = new QLineEdit( GroupC1, "LineEditC1A1" );
-    LineEditC1A1->setValidator( new SMESHGUI_IdValidator( this, "validator" ));
-    GroupC1Layout->addWidget( LineEditC1A1, 0, 2 );
-    SMESHGUI_RemoveNodesDlgLayout->addWidget( GroupC1, 1, 0 );
-
-    Init(Sel) ; /* Initialisations */
+    GroupC1 = new QGroupBox(this, "GroupC1");
+    GroupC1->setTitle(tr("SMESH_REMOVE" ));
+    GroupC1->setMinimumSize(QSize(0, 0));
+    GroupC1->setFrameShape(QGroupBox::Box);
+    GroupC1->setFrameShadow(QGroupBox::Sunken);
+    GroupC1->setColumnLayout(0, Qt::Vertical);
+    GroupC1->layout()->setSpacing(0);
+    GroupC1->layout()->setMargin(0);
+    GroupC1Layout = new QGridLayout(GroupC1->layout());
+    GroupC1Layout->setAlignment(Qt::AlignTop);
+    GroupC1Layout->setSpacing(6);
+    GroupC1Layout->setMargin(11);
+    TextLabelC1A1 = new QLabel(GroupC1, "TextLabelC1A1");
+    TextLabelC1A1->setText(tr("SMESH_ID_NODES" ));
+    TextLabelC1A1->setMinimumSize(QSize(50, 0));
+    TextLabelC1A1->setFrameShape(QLabel::NoFrame);
+    TextLabelC1A1->setFrameShadow(QLabel::Plain);
+    GroupC1Layout->addWidget(TextLabelC1A1, 0, 0);
+    SelectButtonC1A1 = new QPushButton(GroupC1, "SelectButtonC1A1");
+    SelectButtonC1A1->setText(tr("" ));
+    SelectButtonC1A1->setPixmap(image1);
+    SelectButtonC1A1->setToggleButton(FALSE);
+    GroupC1Layout->addWidget(SelectButtonC1A1, 0, 1);
+    LineEditC1A1 = new QLineEdit(GroupC1, "LineEditC1A1");
+    LineEditC1A1->setValidator(new SMESHGUI_IdValidator(this, "validator"));
+    GroupC1Layout->addWidget(LineEditC1A1, 0, 2);
+    SMESHGUI_RemoveNodesDlgLayout->addWidget(GroupC1, 1, 0);
+
+    Init(); /* Initialisations */
 }
 
 //=================================================================================
@@ -167,99 +186,83 @@ SMESHGUI_RemoveNodesDlg::SMESHGUI_RemoveNodesDlg( QWidget* parent, const char* n
 //=================================================================================
 SMESHGUI_RemoveNodesDlg::~SMESHGUI_RemoveNodesDlg()
 {
-    // no need to delete child widgets, Qt does it all for us
+  // no need to delete child widgets, Qt does it all for us
 }
 
-
 //=================================================================================
 // function : Init()
 // purpose  :
 //=================================================================================
-void SMESHGUI_RemoveNodesDlg::Init( SALOME_Selection* Sel )
+void SMESHGUI_RemoveNodesDlg::Init()
 {
-  myBusy = false;    
-
   GroupC1->show();
-  myConstructorId = 0 ;
-  Constructor1->setChecked( TRUE );
-  myEditCurrentArgument = LineEditC1A1 ;       
-  mySelection = Sel;  
-  myNbOkNodes = 0 ;
-  myActor     = 0;
-  mySMESHGUI  = SMESHGUI::GetSMESHGUI() ;
-  mySMESHGUI->SetActiveDialogBox( (QDialog*)this ) ;
+  myConstructorId = 0;
+  Constructor1->setChecked(TRUE);
+  myEditCurrentArgument = LineEditC1A1;
+
+  myNbOkNodes = 0;
+  mySMESHGUI->SetActiveDialogBox((QDialog*)this);
+  myActor = 0;
+  myBusy = false;
 
   /* signals and slots connections */
-  connect( buttonOk, SIGNAL( clicked() ),     this, SLOT( ClickOnOk() ) );
-  connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ) ;
-  connect( buttonApply, SIGNAL( clicked() ), this, SLOT(ClickOnApply() ) );
-  connect( GroupConstructors, SIGNAL(clicked(int) ), SLOT( ConstructorsClicked(int) ) );
-
-  connect( SelectButtonC1A1, SIGNAL (clicked() ),   this, SLOT( SetEditCurrentArgument() ) ) ;
-  connect( mySMESHGUI, SIGNAL ( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ;
-  connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
-  /* to close dialog if study change */
-  connect( mySMESHGUI, SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ) ;
-  connect( myEditCurrentArgument, SIGNAL( textChanged( const QString& )),
-           SLOT( onTextChange( const QString& )));
+  connect(buttonOk, SIGNAL(clicked()),     this, SLOT(ClickOnOk()));
+  connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel()));
+  connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply()));
+  connect(GroupConstructors, SIGNAL(clicked(int)), SLOT(ConstructorsClicked(int)));
+
+  connect(SelectButtonC1A1, SIGNAL (clicked()),   this, SLOT(SetEditCurrentArgument()));
+  connect(mySMESHGUI, SIGNAL (SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog()));
+  connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
 
   /* Move widget on the botton right corner of main widget */
-  int x, y ;
-  mySMESHGUI->DefineDlgPosition( this, x, y ) ;
-  this->move( x, y ) ;
-  this->show() ; /* displays Dialog */
+  int x, y;
+  mySMESHGUI->DefineDlgPosition(this, x, y);
+  this->move(x, y);
+  this->show(); /* displays Dialog */
 
   SMESH::SetPointRepresentation(true);
-  QAD_Application::getDesktop()->SetSelectionMode( NodeSelection, true );
+  myViewWindow->SetSelectionMode(NodeSelection);
 
   SelectionIntoArgument();
-  return ;
 }
 
-
 //=================================================================================
 // function : ConstructorsClicked()
 // purpose  : Radio button management
 //=================================================================================
-void SMESHGUI_RemoveNodesDlg::ConstructorsClicked(int constructorId)
+void SMESHGUI_RemoveNodesDlg::ConstructorsClicked (int)
 {
-  return ;
 }
 
-
 //=================================================================================
 // function : ClickOnApply()
 // purpose  :
 //=================================================================================
 void SMESHGUI_RemoveNodesDlg::ClickOnApply()
 {
-  if (mySMESHGUI->ActiveStudyLocked())
+  if (mySMESHGUI->isActiveStudyLocked())
     return;
-  
-  if ( myNbOkNodes )
-  {
-    QStringList aListId = QStringList::split( " ", myEditCurrentArgument->text(), false);
+
+  if (myNbOkNodes) {
+    QStringList aListId = QStringList::split(" ", myEditCurrentArgument->text(), false);
     SMESH::long_array_var anArrayOfIdeces = new SMESH::long_array;
-    anArrayOfIdeces->length( aListId.count() );
-    for ( int i = 0; i < aListId.count(); i++ )
+    anArrayOfIdeces->length(aListId.count());
+    for (int i = 0; i < aListId.count(); i++)
       anArrayOfIdeces[i] = aListId[ i ].toInt();
 
     bool aResult = false;
-    try
-    {
+    try {
       SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
-      aResult = aMeshEditor->RemoveNodes(anArrayOfIdeces.inout()) ;
-    }
-    catch( ... )
-    {
+      aResult = aMeshEditor->RemoveNodes(anArrayOfIdeces.inout());
+    } catch(...) {
     }
 
-    if ( aResult )
-    {
-      Handle(SALOME_InteractiveObject) anIO = myActor->getIO();
-      mySelection->ClearIObjects();
+    if (aResult) {
+      SALOME_ListIO aList;
+      aList.Append(myActor->getIO());
+      mySelectionMgr->setSelectedObjects(aList, false);
       SMESH::UpdateView();
-      mySelection->AddIObject( anIO, false );
     }
 
     SMESH::SetPointRepresentation(true);
@@ -272,68 +275,72 @@ void SMESHGUI_RemoveNodesDlg::ClickOnApply()
 //=================================================================================
 void SMESHGUI_RemoveNodesDlg::ClickOnOk()
 {
-  this->ClickOnApply() ;
-  this->ClickOnCancel() ;
-
-  return ;
+  ClickOnApply();
+  ClickOnCancel();
 }
 
-       
 //=================================================================================
 // function : ClickOnCancel()
 // purpose  :
 //=================================================================================
 void SMESHGUI_RemoveNodesDlg::ClickOnCancel()
 {
-  mySelection->ClearIObjects();
+  mySelectionMgr->clearSelected();
   SMESH::SetPointRepresentation(false);
-  QAD_Application::getDesktop()->SetSelectionMode( ActorSelection );
-  disconnect( mySelection, 0, this, 0 );
-  mySMESHGUI->ResetState() ;
-  reject() ;
-  return ;
+  myViewWindow->SetSelectionMode(ActorSelection);
+  disconnect(mySelectionMgr, 0, this, 0);
+  mySMESHGUI->ResetState();
+  reject();
 }
 
 //=======================================================================
 //function : onTextChange
-//purpose  : 
+//purpose  :
 //=======================================================================
-
-void SMESHGUI_RemoveNodesDlg::onTextChange(const QString& theNewText)
+void SMESHGUI_RemoveNodesDlg::onTextChange (const QString& theNewText)
 {
-  if ( myBusy ) return;
+  if (myBusy) return;
   myBusy = true;
 
   myNbOkNodes = 0;
 
-  buttonOk->setEnabled( false );
-  buttonApply->setEnabled( false );
+  buttonOk->setEnabled(false);
+  buttonApply->setEnabled(false);
 
   // hilight entered nodes
-  SMDS_Mesh* aMesh = 0;
-  if ( myActor )
-    aMesh = myActor->GetObject()->GetMesh();
-  if ( aMesh ) {
-
-    mySelection->ClearIObjects();
-    mySelection->AddIObject( myActor->getIO() );
-
-    QStringList aListId = QStringList::split( " ", theNewText, false);
-    for ( int i = 0; i < aListId.count(); i++ ) {
-      const SMDS_MeshNode * n = aMesh->FindNode( aListId[ i ].toInt() );
-      if ( n ) {
-        if ( !mySelection->IsIndexSelected( myActor->getIO(), n->GetID() ))
-          mySelection->AddOrRemoveIndex (myActor->getIO(), n->GetID(), true);
-        myNbOkNodes++;
+  if(myActor){
+    if(SMDS_Mesh* aMesh = myActor->GetObject()->GetMesh()){
+      Handle(SALOME_InteractiveObject) anIO = myActor->getIO();
+      SALOME_ListIO aList;
+      aList.Append(anIO);
+      mySelectionMgr->setSelectedObjects(aList, false);
+      
+      TColStd_IndexedMapOfInteger selectedIndices;
+      TColStd_MapOfInteger newIndices;
+      mySelector->GetIndex(anIO,selectedIndices);
+    
+      QStringList aListId = QStringList::split(" ", theNewText, false);
+      for (int i = 0; i < aListId.count(); i++) {
+       if (const SMDS_MeshNode *aNode = aMesh->FindNode(aListId[ i ].toInt())) {
+         if (selectedIndices.Add(aNode->GetID())) {
+           newIndices.Add(aNode->GetID());
+         }
+         myNbOkNodes++;
+       }
       }
-    }
 
-    if ( myNbOkNodes ) {
-      buttonOk->setEnabled( true );
-      buttonApply->setEnabled( true );
+      if(newIndices.Extent() > 0){
+       mySelector->AddOrRemoveIndex(anIO,newIndices,true);
+       myViewWindow->highlight(anIO,true,true);
+      }
     }
   }
 
+  if (myNbOkNodes) {
+    buttonOk->setEnabled(true);
+    buttonApply->setEnabled(true);
+  }
+
   myBusy = false;
 }
 
@@ -343,7 +350,7 @@ void SMESHGUI_RemoveNodesDlg::onTextChange(const QString& theNewText)
 //=================================================================================
 void SMESHGUI_RemoveNodesDlg::SelectionIntoArgument()
 {
-  if ( myBusy ) return;
+  if (myBusy) return;
 
   // clear
 
@@ -351,48 +358,50 @@ void SMESHGUI_RemoveNodesDlg::SelectionIntoArgument()
   myActor = 0;
 
   myBusy = true;
-  myEditCurrentArgument->setText( "" );
+  myEditCurrentArgument->setText("");
   myBusy = false;
 
-  if ( !GroupButtons->isEnabled() ) // inactive
+  if (!GroupButtons->isEnabled()) // inactive
     return;
 
-  buttonOk->setEnabled( false );
-  buttonApply->setEnabled( false );
+  buttonOk->setEnabled(false);
+  buttonApply->setEnabled(false);
 
   // get selected mesh
+  SALOME_ListIO aList;
+  mySelectionMgr->selectedObjects(aList,SVTK_Viewer::Type());
 
-  int nbSel = mySelection->IObjectCount();
-  if(nbSel != 1)
+  int nbSel = aList.Extent();
+  if (nbSel != 1)
     return;
 
-  myMesh = SMESH::GetMeshByIO( mySelection->firstIObject() );
-  if ( myMesh->_is_nil() )
+  Handle(SALOME_InteractiveObject) anIO = aList.First();
+  myMesh = SMESH::GetMeshByIO(anIO);
+  if (myMesh->_is_nil())
     return;
 
-  myActor = SMESH::FindActorByEntry( mySelection->firstIObject()->getEntry() );
-  if ( !myActor )
+  myActor = SMESH::FindActorByEntry(anIO->getEntry());
+  if (!myActor)
     return;
 
   // get selected nodes
 
   QString aString = "";
-  int nbNodes = SMESH::GetNameOfSelectedNodes(mySelection, aString) ;
+  int nbNodes = SMESH::GetNameOfSelectedNodes(mySelector,anIO,aString);
   if(nbNodes < 1)
-    return ;
+    return;
   myBusy = true;
-  myEditCurrentArgument->setText( aString );
+  myEditCurrentArgument->setText(aString);
   myBusy = false;
 
   // OK
 
   myNbOkNodes = true;
 
-  buttonOk->setEnabled( true );
-  buttonApply->setEnabled( true );
+  buttonOk->setEnabled(true);
+  buttonApply->setEnabled(true);
 }
 
-
 //=================================================================================
 // function : SetEditCurrentArgument()
 // purpose  :
@@ -403,16 +412,16 @@ void SMESHGUI_RemoveNodesDlg::SetEditCurrentArgument()
   switch (myConstructorId)
     {
     case 0: /* default constructor */
-      {        
+      {
        if(send == SelectButtonC1A1) {
-         LineEditC1A1->setFocus() ;
+         LineEditC1A1->setFocus();
          myEditCurrentArgument = LineEditC1A1;
        }
-       SelectionIntoArgument() ;
+       SelectionIntoArgument();
        break;
       }
     }
-  return ;
+  return;
 }
 
 //=================================================================================
@@ -421,17 +430,15 @@ void SMESHGUI_RemoveNodesDlg::SetEditCurrentArgument()
 //=================================================================================
 void SMESHGUI_RemoveNodesDlg::DeactivateActiveDialog()
 {
-  if ( GroupConstructors->isEnabled() ) {
-    GroupConstructors->setEnabled(false) ;
-    GroupC1->setEnabled(false) ;
-    GroupButtons->setEnabled(false) ;
-    mySMESHGUI->ResetState() ;    
-    mySMESHGUI->SetActiveDialogBox(0) ;
+  if (GroupConstructors->isEnabled()) {
+    GroupConstructors->setEnabled(false);
+    GroupC1->setEnabled(false);
+    GroupButtons->setEnabled(false);
+    mySMESHGUI->ResetState(); // ??
+    mySMESHGUI->SetActiveDialogBox(0); // ??
   }
-  return ;
 }
 
-
 //=================================================================================
 // function : ActivateThisDialog()
 // purpose  :
@@ -439,52 +446,47 @@ void SMESHGUI_RemoveNodesDlg::DeactivateActiveDialog()
 void SMESHGUI_RemoveNodesDlg::ActivateThisDialog()
 {
   /* Emit a signal to deactivate the active dialog */
-  mySMESHGUI->EmitSignalDeactivateDialog() ;   
-  GroupConstructors->setEnabled(true) ;
-  GroupC1->setEnabled(true) ;
-  GroupButtons->setEnabled(true) ;
-  
-  mySMESHGUI->SetActiveDialogBox( (QDialog*)this ) ;
+  mySMESHGUI->EmitSignalDeactivateDialog();
+
+  GroupConstructors->setEnabled(true);
+  GroupC1->setEnabled(true);
+  GroupButtons->setEnabled(true);
+
+  mySMESHGUI->SetActiveDialogBox((QDialog*)this); // ??
 
   SMESH::SetPointRepresentation(true);
-  QAD_Application::getDesktop()->SetSelectionMode( NodeSelection, true );
+  myViewWindow->SetSelectionMode(NodeSelection);
 
-  SelectionIntoArgument();
+  SelectionIntoArgument(); // ??
 }
 
-
 //=================================================================================
 // function : enterEvent()
 // purpose  :
 //=================================================================================
-void SMESHGUI_RemoveNodesDlg::enterEvent(QEvent* e)
+void SMESHGUI_RemoveNodesDlg::enterEvent (QEvent*)
 {
-  if ( GroupConstructors->isEnabled() )
-    return ;  
-  ActivateThisDialog() ;
-  return ;
+  if (!GroupConstructors->isEnabled())
+    ActivateThisDialog();
 }
 
-
 //=================================================================================
 // function : closeEvent()
 // purpose  :
 //=================================================================================
-void SMESHGUI_RemoveNodesDlg::closeEvent( QCloseEvent* e )
+void SMESHGUI_RemoveNodesDlg::closeEvent (QCloseEvent*)
 {
   /* same than click on cancel button */
-  this->ClickOnCancel() ;
-  return ;
+  this->ClickOnCancel();
+  return;
 }
 
-
 //=======================================================================
 //function : hideEvent
 //purpose  : caused by ESC key
 //=======================================================================
-
-void SMESHGUI_RemoveNodesDlg::hideEvent ( QHideEvent * e )
+void SMESHGUI_RemoveNodesDlg::hideEvent (QHideEvent * e)
 {
-  if ( !isMinimized() )
+  if (!isMinimized())
     ClickOnCancel();
 }
index d40edccf812119ca2d020baa01f9bfabf56be28d..6a847e2cf544b617ffeb13fe105eab0c1cddfa2a 100644 (file)
@@ -29,7 +29,7 @@
 #ifndef DIALOGBOX_REMOVE_NODES_H
 #define DIALOGBOX_REMOVE_NODES_H
 
-#include "SALOME_Selection.h"
+#include "SalomeApp_SelectionMgr.h"
 
 // QT Includes
 #include <qvariant.h>
@@ -47,8 +47,11 @@ class QLabel;
 class QLineEdit;
 class QPushButton;
 class QRadioButton;
+
 class SMESHGUI;
 class SMESH_Actor;
+class SVTK_Selector;
+class SVTK_ViewWindow;
 
 // IDL Headers
 #include <SALOMEconfig.h>
@@ -59,25 +62,31 @@ class SMESH_Actor;
 // purpose  :
 //=================================================================================
 class SMESHGUI_RemoveNodesDlg : public QDialog
-{ 
+{
     Q_OBJECT
 
 public:
-    SMESHGUI_RemoveNodesDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 );
+    SMESHGUI_RemoveNodesDlg(SMESHGUI* theModule,
+                           const char* name = 0,
+                           bool modal = FALSE,
+                           WFlags fl = 0);
     ~SMESHGUI_RemoveNodesDlg();
 
 private:
 
-    void Init( SALOME_Selection* Sel ) ;
+    void Init() ;
     void closeEvent( QCloseEvent* e ) ;
-    void enterEvent ( QEvent * ) ;                          /* mouse enter the QWidget */
-    void hideEvent ( QHideEvent * );                        /* ESC key */
-
-    SMESHGUI*                     mySMESHGUI ;              /* Current SMESHGUI object */
-    SALOME_Selection*             mySelection ;             /* User shape selection */
-    int                           myNbOkNodes ;             /* to check when arguments is defined */
-    int                           myConstructorId ;         /* Current constructor id = radio button id */
-    QLineEdit*                    myEditCurrentArgument;    /* Current  LineEdit */
+    void enterEvent ( QEvent * ) ;                         /* mouse enter the QWidget */
+    void hideEvent ( QHideEvent * );                       /* ESC key */
+
+    SalomeApp_SelectionMgr*       mySelectionMgr;
+    SVTK_ViewWindow*              myViewWindow;
+    SVTK_Selector*                mySelector;
+    SMESHGUI*                     mySMESHGUI;
+
+    int                           myNbOkNodes;             /* to check when arguments is defined */
+    int                           myConstructorId;         /* Current constructor id = radio button id */
+    QLineEdit*                    myEditCurrentArgument;   /* Current  LineEdit */
 
     bool                          myBusy;
     SMESH::SMESH_Mesh_var         myMesh;
index 00ede0b48b97be7f86dda60ad901e52749e0ca0a..f886e45d5f02995cb6b8f4dbaac3db767177264b 100644 (file)
@@ -1,23 +1,23 @@
 //  SMESH SMESHGUI : GUI for SMESH component
 //
 //  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
-// 
-//  This library is free software; you can redistribute it and/or 
-//  modify it under the terms of the GNU Lesser General Public 
-//  License as published by the Free Software Foundation; either 
-//  version 2.1 of the License. 
-// 
-//  This library is distributed in the hope that it will be useful, 
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of 
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
-//  Lesser General Public License for more details. 
-// 
-//  You should have received a copy of the GNU Lesser General Public 
-//  License along with this library; if not, write to the Free Software 
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
-// 
-//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
 //
 //
 //
 #include "SMESHGUI.h"
 #include "SMESHGUI_Utils.h"
 #include "SMESHGUI_VTKUtils.h"
+
 #include "SMESH_Actor.h"
+#include "SMESH_TypeFilter.hxx"
 #include "SMDS_Mesh.hxx"
 
-#include "QAD_Application.h"
-#include "QAD_Desktop.h"
-#include "QAD_MessageBox.h"
+#include "SUIT_Session.h"
+
+#include "SALOME_ListIO.hxx"
+
 #include "utilities.h"
 
 // QT Includes
@@ -54,120 +57,120 @@ using namespace std;
 
 //=================================================================================
 // class    : SMESHGUI_RenumberingDlg()
-// purpose  : 
+// purpose  :
 //=================================================================================
-SMESHGUI_RenumberingDlg::SMESHGUI_RenumberingDlg( QWidget* parent, const char* name, SALOME_Selection* Sel,
-                                                 const int unit, bool modal, WFlags fl )
-    : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu |
-              Qt::WDestructiveClose)
+SMESHGUI_RenumberingDlg::SMESHGUI_RenumberingDlg (QWidget* parent, const char* name,
+                                                  SalomeApp_SelectionMgr* Sel,
+                                                 const int unit, bool modal, WFlags fl)
+     : QDialog(parent, name, modal, WStyle_Customize | WStyle_NormalBorder |
+               WStyle_Title | WStyle_SysMenu | Qt::WDestructiveClose)
 {
   myUnit = unit;
 
-  if ( !name )
-    setName( "SMESHGUI_RenumberingDlg" );
-  resize( 303, 185 );
-  
+  if (!name)
+    setName("SMESHGUI_RenumberingDlg");
+  resize(303, 185);
 
   QPixmap image0;
-  QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "SMESH",tr("ICON_SELECT")));
+  QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap("SMESH",tr("ICON_SELECT")));
 
   if (unit == 0) {
-    image0 = QPixmap(QAD_Desktop::getResourceManager()->loadPixmap( "SMESH",tr("ICON_DLG_RENUMBERING_NODES")));
-    setCaption( tr( "SMESH_RENUMBERING_NODES_TITLE"  ) );
+    image0 = QPixmap(SUIT_Session::session()->resourceMgr()->loadPixmap("SMESH",tr("ICON_DLG_RENUMBERING_NODES")));
+    setCaption(tr("SMESH_RENUMBERING_NODES_TITLE" ));
   }
   else if (unit == 1) {
-    image0 = QPixmap(QAD_Desktop::getResourceManager()->loadPixmap( "SMESH",tr("ICON_DLG_RENUMBERING_ELEMENTS")));
-    setCaption( tr( "SMESH_RENUMBERING_ELEMENTS_TITLE"  ) );
+    image0 = QPixmap(SUIT_Session::session()->resourceMgr()->loadPixmap("SMESH",tr("ICON_DLG_RENUMBERING_ELEMENTS")));
+    setCaption(tr("SMESH_RENUMBERING_ELEMENTS_TITLE" ));
   }
-  
-  setSizeGripEnabled( TRUE );
-  SMESHGUI_RenumberingDlgLayout = new QGridLayout( this ); 
-  SMESHGUI_RenumberingDlgLayout->setSpacing( 6 );
-  SMESHGUI_RenumberingDlgLayout->setMargin( 11 );
-  
+
+  setSizeGripEnabled(TRUE);
+  SMESHGUI_RenumberingDlgLayout = new QGridLayout(this);
+  SMESHGUI_RenumberingDlgLayout->setSpacing(6);
+  SMESHGUI_RenumberingDlgLayout->setMargin(11);
+
   /***************************************************************/
-  GroupConstructors = new QButtonGroup( this, "GroupConstructors" );
+  GroupConstructors = new QButtonGroup(this, "GroupConstructors");
   if (unit == 0)
-    GroupConstructors->setTitle( tr( "SMESH_NODES"  ) );
+    GroupConstructors->setTitle(tr("SMESH_NODES" ));
   else if (unit == 1)
-    GroupConstructors->setTitle( tr( "SMESH_ELEMENTS"  ) );
-  GroupConstructors->setExclusive( TRUE );
-  GroupConstructors->setColumnLayout(0, Qt::Vertical );
-  GroupConstructors->layout()->setSpacing( 0 );
-  GroupConstructors->layout()->setMargin( 0 );
-  GroupConstructorsLayout = new QGridLayout( GroupConstructors->layout() );
-  GroupConstructorsLayout->setAlignment( Qt::AlignTop );
-  GroupConstructorsLayout->setSpacing( 6 );
-  GroupConstructorsLayout->setMargin( 11 );
-  Constructor1 = new QRadioButton( GroupConstructors, "Constructor1" );
-  Constructor1->setText( tr( ""  ) );
-  Constructor1->setPixmap( image0 );
-  Constructor1->setChecked( TRUE );
-  Constructor1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, Constructor1->sizePolicy().hasHeightForWidth() ) );
-  Constructor1->setMinimumSize( QSize( 50, 0 ) );
-  GroupConstructorsLayout->addWidget( Constructor1, 0, 0 );
-  QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
-  GroupConstructorsLayout->addItem( spacer, 0, 1 );
-  SMESHGUI_RenumberingDlgLayout->addWidget( GroupConstructors, 0, 0 );
-  
+    GroupConstructors->setTitle(tr("SMESH_ELEMENTS" ));
+  GroupConstructors->setExclusive(TRUE);
+  GroupConstructors->setColumnLayout(0, Qt::Vertical);
+  GroupConstructors->layout()->setSpacing(0);
+  GroupConstructors->layout()->setMargin(0);
+  GroupConstructorsLayout = new QGridLayout(GroupConstructors->layout());
+  GroupConstructorsLayout->setAlignment(Qt::AlignTop);
+  GroupConstructorsLayout->setSpacing(6);
+  GroupConstructorsLayout->setMargin(11);
+  Constructor1 = new QRadioButton(GroupConstructors, "Constructor1");
+  Constructor1->setText(tr("" ));
+  Constructor1->setPixmap(image0);
+  Constructor1->setChecked(TRUE);
+  Constructor1->setSizePolicy(QSizePolicy((QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, Constructor1->sizePolicy().hasHeightForWidth()));
+  Constructor1->setMinimumSize(QSize(50, 0));
+  GroupConstructorsLayout->addWidget(Constructor1, 0, 0);
+  QSpacerItem* spacer = new QSpacerItem(20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
+  GroupConstructorsLayout->addItem(spacer, 0, 1);
+  SMESHGUI_RenumberingDlgLayout->addWidget(GroupConstructors, 0, 0);
+
   /***************************************************************/
-  GroupButtons = new QGroupBox( this, "GroupButtons" );
-  GroupButtons->setGeometry( QRect( 10, 10, 281, 48 ) ); 
-  GroupButtons->setTitle( tr( ""  ) );
-  GroupButtons->setColumnLayout(0, Qt::Vertical );
-  GroupButtons->layout()->setSpacing( 0 );
-  GroupButtons->layout()->setMargin( 0 );
-  GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
-  GroupButtonsLayout->setAlignment( Qt::AlignTop );
-  GroupButtonsLayout->setSpacing( 6 );
-  GroupButtonsLayout->setMargin( 11 );
-  buttonCancel = new QPushButton( GroupButtons, "buttonCancel" );
-  buttonCancel->setText( tr( "SMESH_BUT_CLOSE"  ) );
-  buttonCancel->setAutoDefault( TRUE );
-  GroupButtonsLayout->addWidget( buttonCancel, 0, 3 );
-  buttonApply = new QPushButton( GroupButtons, "buttonApply" );
-  buttonApply->setText( tr( "SMESH_BUT_APPLY"  ) );
-  buttonApply->setAutoDefault( TRUE );
-  GroupButtonsLayout->addWidget( buttonApply, 0, 1 );
-  QSpacerItem* spacer_9 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
-  GroupButtonsLayout->addItem( spacer_9, 0, 2 );
-  buttonOk = new QPushButton( GroupButtons, "buttonOk" );
-  buttonOk->setText( tr( "SMESH_BUT_OK"  ) );
-  buttonOk->setAutoDefault( TRUE );
-  buttonOk->setDefault( TRUE );
-  GroupButtonsLayout->addWidget( buttonOk, 0, 0 );
-  SMESHGUI_RenumberingDlgLayout->addWidget( GroupButtons, 2, 0 );
-  
+  GroupButtons = new QGroupBox(this, "GroupButtons");
+  GroupButtons->setGeometry(QRect(10, 10, 281, 48));
+  GroupButtons->setTitle(tr("" ));
+  GroupButtons->setColumnLayout(0, Qt::Vertical);
+  GroupButtons->layout()->setSpacing(0);
+  GroupButtons->layout()->setMargin(0);
+  GroupButtonsLayout = new QGridLayout(GroupButtons->layout());
+  GroupButtonsLayout->setAlignment(Qt::AlignTop);
+  GroupButtonsLayout->setSpacing(6);
+  GroupButtonsLayout->setMargin(11);
+  buttonCancel = new QPushButton(GroupButtons, "buttonCancel");
+  buttonCancel->setText(tr("SMESH_BUT_CLOSE" ));
+  buttonCancel->setAutoDefault(TRUE);
+  GroupButtonsLayout->addWidget(buttonCancel, 0, 3);
+  buttonApply = new QPushButton(GroupButtons, "buttonApply");
+  buttonApply->setText(tr("SMESH_BUT_APPLY" ));
+  buttonApply->setAutoDefault(TRUE);
+  GroupButtonsLayout->addWidget(buttonApply, 0, 1);
+  QSpacerItem* spacer_9 = new QSpacerItem(20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
+  GroupButtonsLayout->addItem(spacer_9, 0, 2);
+  buttonOk = new QPushButton(GroupButtons, "buttonOk");
+  buttonOk->setText(tr("SMESH_BUT_OK" ));
+  buttonOk->setAutoDefault(TRUE);
+  buttonOk->setDefault(TRUE);
+  GroupButtonsLayout->addWidget(buttonOk, 0, 0);
+  SMESHGUI_RenumberingDlgLayout->addWidget(GroupButtons, 2, 0);
+
   /***************************************************************/
-  GroupMesh = new QGroupBox( this, "GroupMesh" );
-  GroupMesh->setTitle( tr( "SMESH_RENUMBERING"  ) );
-  GroupMesh->setMinimumSize( QSize( 0, 0 ) );
-  GroupMesh->setFrameShape( QGroupBox::Box );
-  GroupMesh->setFrameShadow( QGroupBox::Sunken );
-  GroupMesh->setColumnLayout(0, Qt::Vertical );
-  GroupMesh->layout()->setSpacing( 0 );
-  GroupMesh->layout()->setMargin( 0 );
-  GroupMeshLayout = new QGridLayout( GroupMesh->layout() );
-  GroupMeshLayout->setAlignment( Qt::AlignTop );
-  GroupMeshLayout->setSpacing( 6 );
-  GroupMeshLayout->setMargin( 11 );
-  TextLabelMesh = new QLabel( GroupMesh, "TextLabelMesh" );
-  TextLabelMesh->setText( tr( "SMESH_MESH" ) );
-  TextLabelMesh->setMinimumSize( QSize( 50, 0 ) );
-  TextLabelMesh->setFrameShape( QLabel::NoFrame );
-  TextLabelMesh->setFrameShadow( QLabel::Plain );
-  GroupMeshLayout->addWidget( TextLabelMesh, 0, 0 );
-  SelectButton = new QPushButton( GroupMesh, "SelectButton" );
-  SelectButton->setText( tr( ""  ) );
-  SelectButton->setPixmap( image1 );
-  SelectButton->setToggleButton( FALSE );
-  GroupMeshLayout->addWidget( SelectButton, 0, 1 );
-  LineEditMesh = new QLineEdit( GroupMesh, "LineEditMesh" );
-  LineEditMesh->setReadOnly( true );
-  GroupMeshLayout->addWidget( LineEditMesh, 0, 2 );
-  SMESHGUI_RenumberingDlgLayout->addWidget( GroupMesh, 1, 0 );
-  
-  Init(Sel) ; /* Initialisations */
+  GroupMesh = new QGroupBox(this, "GroupMesh");
+  GroupMesh->setTitle(tr("SMESH_RENUMBERING" ));
+  GroupMesh->setMinimumSize(QSize(0, 0));
+  GroupMesh->setFrameShape(QGroupBox::Box);
+  GroupMesh->setFrameShadow(QGroupBox::Sunken);
+  GroupMesh->setColumnLayout(0, Qt::Vertical);
+  GroupMesh->layout()->setSpacing(0);
+  GroupMesh->layout()->setMargin(0);
+  GroupMeshLayout = new QGridLayout(GroupMesh->layout());
+  GroupMeshLayout->setAlignment(Qt::AlignTop);
+  GroupMeshLayout->setSpacing(6);
+  GroupMeshLayout->setMargin(11);
+  TextLabelMesh = new QLabel(GroupMesh, "TextLabelMesh");
+  TextLabelMesh->setText(tr("SMESH_MESH"));
+  TextLabelMesh->setMinimumSize(QSize(50, 0));
+  TextLabelMesh->setFrameShape(QLabel::NoFrame);
+  TextLabelMesh->setFrameShadow(QLabel::Plain);
+  GroupMeshLayout->addWidget(TextLabelMesh, 0, 0);
+  SelectButton = new QPushButton(GroupMesh, "SelectButton");
+  SelectButton->setText(tr("" ));
+  SelectButton->setPixmap(image1);
+  SelectButton->setToggleButton(FALSE);
+  GroupMeshLayout->addWidget(SelectButton, 0, 1);
+  LineEditMesh = new QLineEdit(GroupMesh, "LineEditMesh");
+  LineEditMesh->setReadOnly(true);
+  GroupMeshLayout->addWidget(LineEditMesh, 0, 2);
+  SMESHGUI_RenumberingDlgLayout->addWidget(GroupMesh, 1, 0);
+
+  Init(Sel); /* Initialisations */
 }
 
 //=================================================================================
@@ -179,79 +182,74 @@ SMESHGUI_RenumberingDlg::~SMESHGUI_RenumberingDlg()
   // no need to delete child widgets, Qt does it all for us
 }
 
-
 //=================================================================================
 // function : Init()
 // purpose  :
 //=================================================================================
-void SMESHGUI_RenumberingDlg::Init( SALOME_Selection* Sel )
+void SMESHGUI_RenumberingDlg::Init (SalomeApp_SelectionMgr* Sel)
 {
-
   GroupMesh->show();
-  myConstructorId = 0 ;
-  Constructor1->setChecked( TRUE );
-  mySelection = Sel;  
-  mySMESHGUI  = SMESHGUI::GetSMESHGUI() ;
-  mySMESHGUI->SetActiveDialogBox( (QDialog*)this );
+  myConstructorId = 0;
+  Constructor1->setChecked(TRUE);
+  mySelectionMgr = Sel;
+  mySMESHGUI = SMESHGUI::GetSMESHGUI();
+  mySMESHGUI->SetActiveDialogBox((QDialog*)this);
 
   myMesh = SMESH::SMESH_Mesh::_nil();
-    
-  myMeshFilter = new SMESH_TypeFilter( MESH );
+
+  myMeshFilter = new SMESH_TypeFilter (MESH);
 
   /* signals and slots connections */
-  connect( buttonOk, SIGNAL( clicked() ),     this, SLOT( ClickOnOk() ) );
-  connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ) ;
-  connect( buttonApply, SIGNAL( clicked() ), this, SLOT(ClickOnApply() ) );
-  connect( GroupConstructors, SIGNAL(clicked(int) ), SLOT( ConstructorsClicked(int) ) );
-  
-  connect( SelectButton, SIGNAL (clicked() ),   this, SLOT( SetEditCurrentArgument() ) ) ;
-  connect( mySMESHGUI, SIGNAL ( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ;
-  connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
+  connect(buttonOk, SIGNAL(clicked()),     this, SLOT(ClickOnOk()));
+  connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel()));
+  connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply()));
+  connect(GroupConstructors, SIGNAL(clicked(int)), SLOT(ConstructorsClicked(int)));
+
+  connect(SelectButton, SIGNAL (clicked()),   this, SLOT(SetEditCurrentArgument()));
+  connect(mySMESHGUI, SIGNAL (SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog()));
+  connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
   /* to close dialog if study change */
-  connect( mySMESHGUI, SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ) ;
-  
+  connect(mySMESHGUI, SIGNAL (SignalCloseAllDialogs()), this, SLOT(ClickOnCancel()));
+
   /* Move widget on the botton right corner of main widget */
-  int x, y ;
-  mySMESHGUI->DefineDlgPosition( this, x, y ) ;
-  this->move( x, y ) ;
-  this->show() ; /* displays Dialog */
-  
-  myEditCurrentArgument = LineEditMesh ;
+  int x, y;
+  mySMESHGUI->DefineDlgPosition(this, x, y);
+  this->move(x, y);
+  this->show(); /* displays Dialog */
+
+  myEditCurrentArgument = LineEditMesh;
   LineEditMesh->setFocus();
-  mySelection->ClearFilters() ;   
-  mySelection->AddFilter( myMeshFilter ) ;
-  
+  mySelectionMgr->clearFilters();
+  mySelectionMgr->installFilter(myMeshFilter);
+
   SelectionIntoArgument();
 }
 
-
 //=================================================================================
 // function : ConstructorsClicked()
 // purpose  : Radio button management
 //=================================================================================
-void SMESHGUI_RenumberingDlg::ConstructorsClicked(int constructorId)
+void SMESHGUI_RenumberingDlg::ConstructorsClicked (int)
 {
-  return ;
 }
 
-
 //=================================================================================
 // function : ClickOnApply()
 // purpose  :
 //=================================================================================
 void SMESHGUI_RenumberingDlg::ClickOnApply()
 {
-  if (mySMESHGUI->ActiveStudyLocked())
+  if (mySMESHGUI->isActiveStudyLocked())
     return;
-  
-  if ( !myMesh->_is_nil())
+
+  if (!myMesh->_is_nil())
     {
       try
        {
          SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
          SMESH_Actor* anActor = SMESH::FindActorByObject(myMesh);
          bool isUnitsLabeled = false;
-         
+
          if (myUnit == 0 && anActor) {
            isUnitsLabeled = anActor->GetPointsLabeled();
            if (isUnitsLabeled)  anActor->SetPointsLabeled(false);
@@ -260,7 +258,7 @@ void SMESHGUI_RenumberingDlg::ClickOnApply()
            isUnitsLabeled = anActor->GetCellsLabeled();
            if (isUnitsLabeled)  anActor->SetCellsLabeled(false);
          }
-         
+
          QApplication::setOverrideCursor(Qt::waitCursor);
          if (myUnit == 0) {
            aMeshEditor->RenumberNodes();
@@ -272,11 +270,11 @@ void SMESHGUI_RenumberingDlg::ClickOnApply()
          }
          QApplication::restoreOverrideCursor();
        }
-      catch( ... )
+      catch(...)
        {
        }
-      
-      mySelection->ClearIObjects();
+
+      mySelectionMgr->clearSelected();
       SMESH::UpdateView();
     }
 }
@@ -287,60 +285,58 @@ void SMESHGUI_RenumberingDlg::ClickOnApply()
 //=================================================================================
 void SMESHGUI_RenumberingDlg::ClickOnOk()
 {
-  ClickOnApply() ;
-  ClickOnCancel() ;
+  ClickOnApply();
+  ClickOnCancel();
 }
 
-       
 //=================================================================================
 // function : ClickOnCancel()
 // purpose  :
 //=================================================================================
 void SMESHGUI_RenumberingDlg::ClickOnCancel()
 {
-  mySelection->ClearIObjects();
-  mySelection->ClearFilters();
-  disconnect( mySelection, 0, this, 0 );
-  mySMESHGUI->ResetState() ;
-  reject() ;
+  mySelectionMgr->clearSelected();
+  mySelectionMgr->clearFilters();
+  disconnect(mySelectionMgr, 0, this, 0);
+  mySMESHGUI->ResetState();
+  reject();
 }
 
-
 //=================================================================================
 // function : SelectionIntoArgument()
 // purpose  : Called when selection as changed or other case
 //=================================================================================
 void SMESHGUI_RenumberingDlg::SelectionIntoArgument()
 {
-  if ( !GroupButtons->isEnabled() ) // inactive
+  if (!GroupButtons->isEnabled()) // inactive
     return;
-  
-  QString aString = ""; 
-  
-  int nbSel = SMESH::GetNameOfSelectedIObjects(mySelection, aString) ;
 
-  if ( myEditCurrentArgument == LineEditMesh ) {
+  QString aString = "";
+
+  SALOME_ListIO aList;
+  mySelectionMgr->selectedObjects(aList);
+  int nbSel = SMESH::GetNameOfSelectedIObjects(mySelectionMgr, aString);
+
+  if (myEditCurrentArgument == LineEditMesh) {
     // mesh
-    if ( nbSel != 1 ) {
+    if (nbSel != 1) {
       myMesh = SMESH::SMESH_Mesh::_nil();
       aString = "";
-    }
-    else {
-      Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject() ;
-      myMesh = SMESH::IObjectToInterface<SMESH::SMESH_Mesh>(IO) ;
-      if( myMesh->_is_nil() )
+    } else {
+      Handle(SALOME_InteractiveObject) IO = aList.First();
+      myMesh = SMESH::IObjectToInterface<SMESH::SMESH_Mesh>(IO);
+      if (myMesh->_is_nil())
        aString = "";
     }
   }
-  
-  myEditCurrentArgument->setText(aString) ;
-  
+
+  myEditCurrentArgument->setText(aString);
+
   bool isEnabled = (!myMesh->_is_nil());
-  buttonOk->setEnabled( isEnabled );
-  buttonApply->setEnabled( isEnabled );
+  buttonOk->setEnabled(isEnabled);
+  buttonApply->setEnabled(isEnabled);
 }
 
-
 //=================================================================================
 // function : SetEditCurrentArgument()
 // purpose  :
@@ -351,12 +347,12 @@ void SMESHGUI_RenumberingDlg::SetEditCurrentArgument()
   switch (myConstructorId)
     {
     case 0: /* default constructor */
-      {        
+      {
        if(send == SelectButton) {
-         LineEditMesh->setFocus() ;
+         LineEditMesh->setFocus();
          myEditCurrentArgument = LineEditMesh;
        }
-       SelectionIntoArgument() ;
+       SelectionIntoArgument();
        break;
       }
     }
@@ -368,16 +364,15 @@ void SMESHGUI_RenumberingDlg::SetEditCurrentArgument()
 //=================================================================================
 void SMESHGUI_RenumberingDlg::DeactivateActiveDialog()
 {
-  if ( GroupConstructors->isEnabled() ) {
-    GroupConstructors->setEnabled(false) ;
-    GroupMesh->setEnabled(false) ;
-    GroupButtons->setEnabled(false) ;
-    mySMESHGUI->ResetState() ;    
-    mySMESHGUI->SetActiveDialogBox(0) ;
+  if (GroupConstructors->isEnabled()) {
+    GroupConstructors->setEnabled(false);
+    GroupMesh->setEnabled(false);
+    GroupButtons->setEnabled(false);
+    mySMESHGUI->ResetState();
+    mySMESHGUI->SetActiveDialogBox(0);
   }
 }
 
-
 //=================================================================================
 // function : ActivateThisDialog()
 // purpose  :
@@ -385,46 +380,42 @@ void SMESHGUI_RenumberingDlg::DeactivateActiveDialog()
 void SMESHGUI_RenumberingDlg::ActivateThisDialog()
 {
   /* Emit a signal to deactivate the active dialog */
-  mySMESHGUI->EmitSignalDeactivateDialog() ;   
-  GroupConstructors->setEnabled(true) ;
-  GroupMesh->setEnabled(true) ;
-  GroupButtons->setEnabled(true) ;
-  
-  mySMESHGUI->SetActiveDialogBox( (QDialog*)this ) ;
+  mySMESHGUI->EmitSignalDeactivateDialog();
+  GroupConstructors->setEnabled(true);
+  GroupMesh->setEnabled(true);
+  GroupButtons->setEnabled(true);
+
+  mySMESHGUI->SetActiveDialogBox((QDialog*)this);
   SelectionIntoArgument();
 }
 
-
 //=================================================================================
 // function : enterEvent()
 // purpose  :
 //=================================================================================
 void SMESHGUI_RenumberingDlg::enterEvent(QEvent* e)
 {
-  if ( GroupConstructors->isEnabled() )
-    return ;  
-  ActivateThisDialog() ;
+  if (GroupConstructors->isEnabled())
+    return;
+  ActivateThisDialog();
 }
 
-
 //=================================================================================
 // function : closeEvent()
 // purpose  :
 //=================================================================================
-void SMESHGUI_RenumberingDlg::closeEvent( QCloseEvent* e )
+void SMESHGUI_RenumberingDlg::closeEvent(QCloseEvent* e)
 {
   /* same than click on cancel button */
-  this->ClickOnCancel() ;
+  this->ClickOnCancel();
 }
 
-
 //=======================================================================
 //function : hideEvent
 //purpose  : caused by ESC key
 //=======================================================================
-
-void SMESHGUI_RenumberingDlg::hideEvent ( QHideEvent * e )
+void SMESHGUI_RenumberingDlg::hideEvent (QHideEvent * e)
 {
-  if ( !isMinimized() )
+  if (!isMinimized())
     ClickOnCancel();
 }
index be6bb435c27789077e9ae6178271f52386dc5623..74f89af67e8d3f3ae59f17643f7c4edb0a09084e 100644 (file)
@@ -29,8 +29,9 @@
 #ifndef DIALOGBOX_RENUMBERING_H
 #define DIALOGBOX_RENUMBERING_H
 
-#include "SALOME_Selection.h"
-#include "SMESH_TypeFilter.hxx"
+#include "SalomeApp_SelectionMgr.h"
+//#include "SMESH_TypeFilter.hxx"
+#include "SUIT_SelectionFilter.h"
 
 // QT Includes
 #include <qdialog.h>
@@ -59,24 +60,30 @@ class SMESHGUI_RenumberingDlg : public QDialog
     Q_OBJECT
 
 public:
-    SMESHGUI_RenumberingDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, const int unit = 0, bool modal = FALSE, WFlags fl = 0 );
+    SMESHGUI_RenumberingDlg (QWidget* parent = 0,
+                            const char* name = 0,
+                            SalomeApp_SelectionMgr* Sel = 0,
+                            const int unit = 0,
+                            bool modal = FALSE,
+                            WFlags fl = 0);
     ~SMESHGUI_RenumberingDlg();
 
 private:
 
-    void Init( SALOME_Selection* Sel ) ;
+    void Init( SalomeApp_SelectionMgr* Sel ) ;
     void closeEvent( QCloseEvent* e ) ;
-    void enterEvent ( QEvent * ) ;                          /* mouse enter the QWidget */
-    void hideEvent ( QHideEvent * );                        /* ESC key */
+    void enterEvent ( QEvent * ) ;                         /* mouse enter the QWidget */
+    void hideEvent ( QHideEvent * );                       /* ESC key */
     
-    SMESHGUI*                     mySMESHGUI ;              /* Current SMESHGUI object */
-    SALOME_Selection*             mySelection ;             /* User shape selection */
-    int                           myConstructorId ;         /* Current constructor id = radio button id */
-    QLineEdit*                    myEditCurrentArgument;    /* Current  LineEdit */
+    SMESHGUI*                     mySMESHGUI;              /* Current SMESHGUI object */
+    SalomeApp_SelectionMgr*       mySelectionMgr;          /* User shape selection */
+    int                           myConstructorId;         /* Current constructor id = radio button id */
+    QLineEdit*                    myEditCurrentArgument;   /* Current  LineEdit */
 
     int myUnit;    
     SMESH::SMESH_Mesh_var         myMesh;
-    Handle(SMESH_TypeFilter)      myMeshFilter;
+    //Handle(SMESH_TypeFilter)      myMeshFilter;
+    SUIT_SelectionFilter*         myMeshFilter;
         
     QButtonGroup* GroupConstructors;
     QRadioButton* Constructor1;
index f7782b57dc44dc2977995108bb618b36ab04783b..731f9460d90045f80764fe69b3e411bc04349471 100644 (file)
@@ -1,47 +1,59 @@
 //  SMESH SMESHGUI : GUI for SMESH component
 //
 //  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
-// 
-//  This library is free software; you can redistribute it and/or 
-//  modify it under the terms of the GNU Lesser General Public 
-//  License as published by the Free Software Foundation; either 
-//  version 2.1 of the License. 
-// 
-//  This library is distributed in the hope that it will be useful, 
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of 
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
-//  Lesser General Public License for more details. 
-// 
-//  You should have received a copy of the GNU Lesser General Public 
-//  License along with this library; if not, write to the Free Software 
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
-// 
-//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
 //
 //
 //
 //  File   : SMESHGUI_RevolutionDlg.cxx
 //  Author : Michael ZORIN
 //  Module : SMESH
-//  $Header: 
+//  $Header:
 
 #include "SMESHGUI_RevolutionDlg.h"
+
 #include "SMESHGUI.h"
 #include "SMESHGUI_SpinBox.h"
 #include "SMESHGUI_Utils.h"
 #include "SMESHGUI_VTKUtils.h"
 #include "SMESHGUI_MeshUtils.h"
 #include "SMESHGUI_IdValidator.h"
+
 #include "SMESH_Actor.h"
 #include "SMESH_TypeFilter.hxx"
+#include "SMESH_LogicalFilter.hxx"
 #include "SMDS_Mesh.hxx"
 
-#include "QAD_Application.h"
-#include "QAD_Desktop.h"
-#include "QAD_MessageBox.h"
+#include "SUIT_ResourceMgr.h"
+
+#include "SVTK_ViewModel.h"
+#include "SVTK_ViewWindow.h"
+#include "SVTK_Selector.h"
+#include "SVTK_Selection.h"
+#include "SALOME_ListIO.hxx"
+
 #include "utilities.h"
 
+// OCCT Includes
+#include <TColStd_MapOfInteger.hxx>
+#include <TColStd_IndexedMapOfInteger.hxx>
+
 // QT Includes
 #include <qapplication.h>
 #include <qbuttongroup.h>
@@ -52,7 +64,7 @@
 #include <qradiobutton.h>
 #include <qcheckbox.h>
 #include <qlayout.h>
-#include <qspinbox.h> 
+#include <qspinbox.h>
 #include <qvalidator.h>
 #include <qpixmap.h>
 
@@ -64,269 +76,271 @@ using namespace std;
 
 //=================================================================================
 // class    : SMESHGUI_RevolutionDlg()
-// purpose  : 
+// purpose  :
 //=================================================================================
-SMESHGUI_RevolutionDlg::SMESHGUI_RevolutionDlg( QWidget* parent, const char* name, SALOME_Selection* Sel,
-                                             bool modal, WFlags fl )
-  : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu |
-            Qt::WDestructiveClose)
+SMESHGUI_RevolutionDlg::SMESHGUI_RevolutionDlg( SMESHGUI* theModule, const char* name,
+                                                bool modal, WFlags fl)
+     : QDialog( SMESH::GetDesktop( theModule ), name, modal, WStyle_Customize | WStyle_NormalBorder |
+                WStyle_Title | WStyle_SysMenu | Qt::WDestructiveClose),
+     mySMESHGUI( theModule ),
+     mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ),
+     myViewWindow( SMESH::GetViewWindow( theModule ) ),
+     mySelector( myViewWindow->GetSelector() )
 {
-  QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "SMESH",tr("ICON_DLG_EDGE")));
-  QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "SMESH",tr("ICON_DLG_TRIANGLE")));
-  QPixmap image2(QAD_Desktop::getResourceManager()->loadPixmap( "SMESH",tr("ICON_SELECT")));
-
-  if ( !name )
-    setName( "SMESHGUI_RevolutionDlg" );
-  resize( 303, 185 ); 
-  setCaption( tr( "REVOLUTION_AROUND_AXIS" ) );
-  setSizeGripEnabled( TRUE );
-  SMESHGUI_RevolutionDlgLayout = new QGridLayout( this ); 
-  SMESHGUI_RevolutionDlgLayout->setSpacing( 6 );
-  SMESHGUI_RevolutionDlgLayout->setMargin( 11 );
+  QPixmap image0 (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_DLG_EDGE")));
+  QPixmap image1 (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_DLG_TRIANGLE")));
+  QPixmap image2 (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_SELECT")));
+
+  if (!name)
+    setName("SMESHGUI_RevolutionDlg");
+  resize(303, 185);
+  setCaption(tr("REVOLUTION_AROUND_AXIS"));
+  setSizeGripEnabled(TRUE);
+  SMESHGUI_RevolutionDlgLayout = new QGridLayout(this);
+  SMESHGUI_RevolutionDlgLayout->setSpacing(6);
+  SMESHGUI_RevolutionDlgLayout->setMargin(11);
 
   /***************************************************************/
-  GroupConstructors = new QButtonGroup( this, "GroupConstructors" );
-  GroupConstructors->setTitle( tr( "SMESH_REVOLUTION"  ) );
-  GroupConstructors->setExclusive( TRUE );
-  GroupConstructors->setColumnLayout(0, Qt::Vertical );
-  GroupConstructors->layout()->setSpacing( 0 );
-  GroupConstructors->layout()->setMargin( 0 );
-  GroupConstructorsLayout = new QGridLayout( GroupConstructors->layout() );
-  GroupConstructorsLayout->setAlignment( Qt::AlignTop );
-  GroupConstructorsLayout->setSpacing( 6 );
-  GroupConstructorsLayout->setMargin( 11 );
-  RadioButton1= new QRadioButton( GroupConstructors, "RadioButton1" );
-  RadioButton1->setText( tr( ""  ) );
-  RadioButton1->setPixmap( image0 );
-  GroupConstructorsLayout->addWidget( RadioButton1, 0, 0 );
-  RadioButton2= new QRadioButton( GroupConstructors, "RadioButton2" );
-  RadioButton2->setText( tr( ""  ) );
-  RadioButton2->setPixmap( image1 );
-  GroupConstructorsLayout->addWidget( RadioButton2, 0, 2 );
-  SMESHGUI_RevolutionDlgLayout->addWidget( GroupConstructors, 0, 0 );
-  
+  GroupConstructors = new QButtonGroup(this, "GroupConstructors");
+  GroupConstructors->setTitle(tr("SMESH_REVOLUTION" ));
+  GroupConstructors->setExclusive(TRUE);
+  GroupConstructors->setColumnLayout(0, Qt::Vertical);
+  GroupConstructors->layout()->setSpacing(0);
+  GroupConstructors->layout()->setMargin(0);
+  GroupConstructorsLayout = new QGridLayout(GroupConstructors->layout());
+  GroupConstructorsLayout->setAlignment(Qt::AlignTop);
+  GroupConstructorsLayout->setSpacing(6);
+  GroupConstructorsLayout->setMargin(11);
+  RadioButton1= new QRadioButton(GroupConstructors, "RadioButton1");
+  RadioButton1->setText(tr("" ));
+  RadioButton1->setPixmap(image0);
+  GroupConstructorsLayout->addWidget(RadioButton1, 0, 0);
+  RadioButton2= new QRadioButton(GroupConstructors, "RadioButton2");
+  RadioButton2->setText(tr("" ));
+  RadioButton2->setPixmap(image1);
+  GroupConstructorsLayout->addWidget(RadioButton2, 0, 2);
+  SMESHGUI_RevolutionDlgLayout->addWidget(GroupConstructors, 0, 0);
+
   /***************************************************************/
-  GroupButtons = new QGroupBox( this, "GroupButtons" );
-  GroupButtons->setGeometry( QRect( 10, 10, 281, 48 ) ); 
-  GroupButtons->setTitle( tr( ""  ) );
-  GroupButtons->setColumnLayout(0, Qt::Vertical );
-  GroupButtons->layout()->setSpacing( 0 );
-  GroupButtons->layout()->setMargin( 0 );
-  GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
-  GroupButtonsLayout->setAlignment( Qt::AlignTop );
-  GroupButtonsLayout->setSpacing( 6 );
-  GroupButtonsLayout->setMargin( 11 );
-  buttonCancel = new QPushButton( GroupButtons, "buttonCancel" );
-  buttonCancel->setText( tr( "SMESH_BUT_CLOSE"  ) );
-  buttonCancel->setAutoDefault( TRUE );
-  GroupButtonsLayout->addWidget( buttonCancel, 0, 3 );
-  buttonApply = new QPushButton( GroupButtons, "buttonApply" );
-  buttonApply->setText( tr( "SMESH_BUT_APPLY"  ) );
-  buttonApply->setAutoDefault( TRUE );
-  GroupButtonsLayout->addWidget( buttonApply, 0, 1 );
-  QSpacerItem* spacer_9 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
-  GroupButtonsLayout->addItem( spacer_9, 0, 2 );
-  buttonOk = new QPushButton( GroupButtons, "buttonOk" );
-  buttonOk->setText( tr( "SMESH_BUT_OK"  ) );
-  buttonOk->setAutoDefault( TRUE );
-  buttonOk->setDefault( TRUE );
-  GroupButtonsLayout->addWidget( buttonOk, 0, 0 );
-  SMESHGUI_RevolutionDlgLayout->addWidget( GroupButtons, 2, 0 );
+  GroupButtons = new QGroupBox(this, "GroupButtons");
+  GroupButtons->setGeometry(QRect(10, 10, 281, 48));
+  GroupButtons->setTitle(tr("" ));
+  GroupButtons->setColumnLayout(0, Qt::Vertical);
+  GroupButtons->layout()->setSpacing(0);
+  GroupButtons->layout()->setMargin(0);
+  GroupButtonsLayout = new QGridLayout(GroupButtons->layout());
+  GroupButtonsLayout->setAlignment(Qt::AlignTop);
+  GroupButtonsLayout->setSpacing(6);
+  GroupButtonsLayout->setMargin(11);
+  buttonCancel = new QPushButton(GroupButtons, "buttonCancel");
+  buttonCancel->setText(tr("SMESH_BUT_CLOSE" ));
+  buttonCancel->setAutoDefault(TRUE);
+  GroupButtonsLayout->addWidget(buttonCancel, 0, 3);
+  buttonApply = new QPushButton(GroupButtons, "buttonApply");
+  buttonApply->setText(tr("SMESH_BUT_APPLY" ));
+  buttonApply->setAutoDefault(TRUE);
+  GroupButtonsLayout->addWidget(buttonApply, 0, 1);
+  QSpacerItem* spacer_9 = new QSpacerItem(20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
+  GroupButtonsLayout->addItem(spacer_9, 0, 2);
+  buttonOk = new QPushButton(GroupButtons, "buttonOk");
+  buttonOk->setText(tr("SMESH_BUT_OK" ));
+  buttonOk->setAutoDefault(TRUE);
+  buttonOk->setDefault(TRUE);
+  GroupButtonsLayout->addWidget(buttonOk, 0, 0);
+  SMESHGUI_RevolutionDlgLayout->addWidget(GroupButtons, 2, 0);
 
   /***************************************************************/
-  GroupArguments = new QGroupBox( this, "GroupArguments" );
-  GroupArguments->setTitle( tr( "REVOLUTION_1D"  ) );
-  GroupArguments->setColumnLayout(0, Qt::Vertical );
-  GroupArguments->layout()->setSpacing( 0 );
-  GroupArguments->layout()->setMargin( 0 );
-  GroupArgumentsLayout = new QGridLayout( GroupArguments->layout() );
-  GroupArgumentsLayout->setAlignment( Qt::AlignTop );
-  GroupArgumentsLayout->setSpacing( 6 );
-  GroupArgumentsLayout->setMargin( 11 );
+  GroupArguments = new QGroupBox(this, "GroupArguments");
+  GroupArguments->setTitle(tr("REVOLUTION_1D"));
+  GroupArguments->setColumnLayout(0, Qt::Vertical);
+  GroupArguments->layout()->setSpacing(0);
+  GroupArguments->layout()->setMargin(0);
+  GroupArgumentsLayout = new QGridLayout(GroupArguments->layout());
+  GroupArgumentsLayout->setAlignment(Qt::AlignTop);
+  GroupArgumentsLayout->setSpacing(6);
+  GroupArgumentsLayout->setMargin(11);
 
   // Controls for elements selection
-  TextLabelElements  = new QLabel( GroupArguments, "TextLabelElements" );
-  TextLabelElements->setText( tr( "SMESH_ID_ELEMENTS"  ) );
+  TextLabelElements  = new QLabel(GroupArguments, "TextLabelElements");
+  TextLabelElements->setText(tr("SMESH_ID_ELEMENTS" ));
   TextLabelElements->setFixedWidth(74);
-  GroupArgumentsLayout->addWidget( TextLabelElements, 0, 0 );
+  GroupArgumentsLayout->addWidget(TextLabelElements, 0, 0);
 
-  SelectElementsButton  = new QPushButton( GroupArguments, "SelectElementsButton" );
-  SelectElementsButton->setText( tr( ""  ) );
-  SelectElementsButton->setPixmap( image2 );
-  SelectElementsButton->setToggleButton( FALSE );
-  GroupArgumentsLayout->addWidget( SelectElementsButton, 0, 1 );
+  SelectElementsButton  = new QPushButton(GroupArguments, "SelectElementsButton");
+  SelectElementsButton->setText(tr("" ));
+  SelectElementsButton->setPixmap(image2);
+  SelectElementsButton->setToggleButton(FALSE);
+  GroupArgumentsLayout->addWidget(SelectElementsButton, 0, 1);
 
-  LineEditElements  = new QLineEdit( GroupArguments, "LineEditElements" );
-  LineEditElements->setValidator( new SMESHGUI_IdValidator( this, "validator" ));
-  GroupArgumentsLayout->addWidget( LineEditElements, 0, 2 );
+  LineEditElements  = new QLineEdit(GroupArguments, "LineEditElements");
+  LineEditElements->setValidator(new SMESHGUI_IdValidator(this, "validator"));
+  GroupArgumentsLayout->addWidget(LineEditElements, 0, 2);
 
   // Control for the whole mesh selection
-  CheckBoxMesh = new QCheckBox( GroupArguments, "CheckBoxMesh" );
-  CheckBoxMesh->setText( tr( "SMESH_SELECT_WHOLE_MESH"  ) );
-  GroupArgumentsLayout->addMultiCellWidget( CheckBoxMesh, 1, 1, 0, 3 );
+  CheckBoxMesh = new QCheckBox(GroupArguments, "CheckBoxMesh");
+  CheckBoxMesh->setText(tr("SMESH_SELECT_WHOLE_MESH" ));
+  GroupArgumentsLayout->addMultiCellWidget(CheckBoxMesh, 1, 1, 0, 3);
 
   // Controls for axis defining
-  GroupAxis = new QGroupBox( GroupArguments, "GroupAxis" );
-  GroupAxis->setTitle( tr( "SMESH_AXIS" ) );
-  GroupAxis->setColumnLayout(0, Qt::Vertical );
-  GroupAxis->layout()->setSpacing( 0 );
-  GroupAxis->layout()->setMargin( 0 );
-  QGridLayout* GroupAxisLayout = new QGridLayout( GroupAxis->layout() );
-  GroupAxisLayout->setAlignment( Qt::AlignTop );
-  GroupAxisLayout->setSpacing( 6 );
-  GroupAxisLayout->setMargin( 11 );
-  
-  TextLabelPoint = new QLabel( GroupAxis, "TextLabelPoint" );
-  TextLabelPoint->setText( tr( "SMESH_POINT" ) );
-  GroupAxisLayout->addWidget( TextLabelPoint, 0, 0 );
-
-  SelectPointButton  = new QPushButton( GroupAxis, "SelectPointButton" );
-  SelectPointButton->setPixmap( image2 );
-  GroupAxisLayout->addWidget( SelectPointButton, 0, 1 );
-  
-  TextLabelX = new QLabel( GroupAxis, "TextLabelX" );
-  TextLabelX->setText( tr( "SMESH_X" ) );
-  GroupAxisLayout->addWidget( TextLabelX, 0, 2 );
-
-  SpinBox_X = new SMESHGUI_SpinBox( GroupAxis, "SpinBox_X");
-  GroupAxisLayout->addWidget( SpinBox_X, 0, 3 );
-  
-  TextLabelY = new QLabel( GroupAxis, "TextLabelY" );
-  TextLabelY->setText( tr( "SMESH_Y" ) );
-  GroupAxisLayout->addWidget( TextLabelY, 0, 4 );
-
-  SpinBox_Y = new SMESHGUI_SpinBox( GroupAxis, "SpinBox_Y");
-  GroupAxisLayout->addWidget( SpinBox_Y, 0, 5 );
-
-  TextLabelZ = new QLabel( GroupAxis, "TextLabelZ" );
-  TextLabelZ->setText( tr( "SMESH_Z" ) );
-  GroupAxisLayout->addWidget( TextLabelZ, 0, 6 );
-  
-  SpinBox_Z = new SMESHGUI_SpinBox( GroupAxis, "SpinBox_Z");
-  GroupAxisLayout->addWidget( SpinBox_Z, 0, 7 );
-
-  TextLabelVector = new QLabel( GroupAxis, "TextLabelVector" );
-  TextLabelVector->setText( tr( "SMESH_VECTOR" ) );
-  GroupAxisLayout->addWidget( TextLabelVector, 1, 0 );
-  
-  SelectVectorButton = new QPushButton( GroupAxis, "SelectVectorButton" );
-  SelectVectorButton->setPixmap( image2 );
-  GroupAxisLayout->addWidget( SelectVectorButton, 1, 1 );
-  
-  TextLabelDX = new QLabel( GroupAxis, "TextLabelDX" );
-  TextLabelDX->setText( tr( "SMESH_DX" ) );
-  GroupAxisLayout->addWidget( TextLabelDX, 1, 2 );
-
-  SpinBox_DX = new SMESHGUI_SpinBox( GroupAxis, "SpinBox_DX");
-  GroupAxisLayout->addWidget( SpinBox_DX, 1, 3 );
-  
-  TextLabelDY = new QLabel( GroupAxis, "TextLabelDY" );
-  TextLabelDY->setText( tr( "SMESH_DY" ) );
-  GroupAxisLayout->addWidget( TextLabelDY, 1, 4 );
-
-  SpinBox_DY = new SMESHGUI_SpinBox( GroupAxis, "SpinBox_DY");
-  GroupAxisLayout->addWidget( SpinBox_DY, 1, 5 );
-
-  TextLabelDZ = new QLabel( GroupAxis, "TextLabelDZ" );
-  TextLabelDZ->setText( tr( "SMESH_DZ" ) );
-  GroupAxisLayout->addWidget( TextLabelDZ, 1, 6 );
-  
-  SpinBox_DZ = new SMESHGUI_SpinBox( GroupAxis, "SpinBox_DZ");
-  GroupAxisLayout->addWidget( SpinBox_DZ, 1, 7 );
-
-  GroupArgumentsLayout->addMultiCellWidget( GroupAxis, 2, 2, 0, 3 );
-    
+  GroupAxis = new QGroupBox(GroupArguments, "GroupAxis");
+  GroupAxis->setTitle(tr("SMESH_AXIS"));
+  GroupAxis->setColumnLayout(0, Qt::Vertical);
+  GroupAxis->layout()->setSpacing(0);
+  GroupAxis->layout()->setMargin(0);
+  QGridLayout* GroupAxisLayout = new QGridLayout(GroupAxis->layout());
+  GroupAxisLayout->setAlignment(Qt::AlignTop);
+  GroupAxisLayout->setSpacing(6);
+  GroupAxisLayout->setMargin(11);
+
+  TextLabelPoint = new QLabel(GroupAxis, "TextLabelPoint");
+  TextLabelPoint->setText(tr("SMESH_POINT"));
+  GroupAxisLayout->addWidget(TextLabelPoint, 0, 0);
+
+  SelectPointButton  = new QPushButton(GroupAxis, "SelectPointButton");
+  SelectPointButton->setPixmap(image2);
+  GroupAxisLayout->addWidget(SelectPointButton, 0, 1);
+
+  TextLabelX = new QLabel(GroupAxis, "TextLabelX");
+  TextLabelX->setText(tr("SMESH_X"));
+  GroupAxisLayout->addWidget(TextLabelX, 0, 2);
+
+  SpinBox_X = new SMESHGUI_SpinBox(GroupAxis, "SpinBox_X");
+  GroupAxisLayout->addWidget(SpinBox_X, 0, 3);
+
+  TextLabelY = new QLabel(GroupAxis, "TextLabelY");
+  TextLabelY->setText(tr("SMESH_Y"));
+  GroupAxisLayout->addWidget(TextLabelY, 0, 4);
+
+  SpinBox_Y = new SMESHGUI_SpinBox(GroupAxis, "SpinBox_Y");
+  GroupAxisLayout->addWidget(SpinBox_Y, 0, 5);
+
+  TextLabelZ = new QLabel(GroupAxis, "TextLabelZ");
+  TextLabelZ->setText(tr("SMESH_Z"));
+  GroupAxisLayout->addWidget(TextLabelZ, 0, 6);
+
+  SpinBox_Z = new SMESHGUI_SpinBox(GroupAxis, "SpinBox_Z");
+  GroupAxisLayout->addWidget(SpinBox_Z, 0, 7);
+
+  TextLabelVector = new QLabel(GroupAxis, "TextLabelVector");
+  TextLabelVector->setText(tr("SMESH_VECTOR"));
+  GroupAxisLayout->addWidget(TextLabelVector, 1, 0);
+
+  SelectVectorButton = new QPushButton(GroupAxis, "SelectVectorButton");
+  SelectVectorButton->setPixmap(image2);
+  GroupAxisLayout->addWidget(SelectVectorButton, 1, 1);
+
+  TextLabelDX = new QLabel(GroupAxis, "TextLabelDX");
+  TextLabelDX->setText(tr("SMESH_DX"));
+  GroupAxisLayout->addWidget(TextLabelDX, 1, 2);
+
+  SpinBox_DX = new SMESHGUI_SpinBox(GroupAxis, "SpinBox_DX");
+  GroupAxisLayout->addWidget(SpinBox_DX, 1, 3);
+
+  TextLabelDY = new QLabel(GroupAxis, "TextLabelDY");
+  TextLabelDY->setText(tr("SMESH_DY"));
+  GroupAxisLayout->addWidget(TextLabelDY, 1, 4);
+
+  SpinBox_DY = new SMESHGUI_SpinBox(GroupAxis, "SpinBox_DY");
+  GroupAxisLayout->addWidget(SpinBox_DY, 1, 5);
+
+  TextLabelDZ = new QLabel(GroupAxis, "TextLabelDZ");
+  TextLabelDZ->setText(tr("SMESH_DZ"));
+  GroupAxisLayout->addWidget(TextLabelDZ, 1, 6);
+
+  SpinBox_DZ = new SMESHGUI_SpinBox(GroupAxis, "SpinBox_DZ");
+  GroupAxisLayout->addWidget(SpinBox_DZ, 1, 7);
+
+  GroupArgumentsLayout->addMultiCellWidget(GroupAxis, 2, 2, 0, 3);
+
   // Controls for angle defining
-  TextLabelAngle = new QLabel( GroupArguments, "TextLabelAngle" );
-  TextLabelAngle->setText( tr( "SMESH_ANGLE"  ) );
-  GroupArgumentsLayout->addMultiCellWidget( TextLabelAngle, 3, 3, 0, 1 );
+  TextLabelAngle = new QLabel(GroupArguments, "TextLabelAngle");
+  TextLabelAngle->setText(tr("SMESH_ANGLE" ));
+  GroupArgumentsLayout->addMultiCellWidget(TextLabelAngle, 3, 3, 0, 1);
 
   SpinBox_Angle = new SMESHGUI_SpinBox(GroupArguments, "SpinBox_Angle");
-  GroupArgumentsLayout->addWidget( SpinBox_Angle, 3, 2 );
-  
+  GroupArgumentsLayout->addWidget(SpinBox_Angle, 3, 2);
+
   // Controls for nb. steps defining
-  TextLabelNbSteps = new QLabel( GroupArguments, "TextLabelNbSteps" );
-  TextLabelNbSteps->setText( tr( "SMESH_NUMBEROFSTEPS"  ) );
-  GroupArgumentsLayout->addMultiCellWidget( TextLabelNbSteps, 4, 4, 0, 1 );
+  TextLabelNbSteps = new QLabel(GroupArguments, "TextLabelNbSteps");
+  TextLabelNbSteps->setText(tr("SMESH_NUMBEROFSTEPS" ));
+  GroupArgumentsLayout->addMultiCellWidget(TextLabelNbSteps, 4, 4, 0, 1);
 
   SpinBox_NbSteps = new QSpinBox(GroupArguments, "SpinBox_NbSteps");
-  GroupArgumentsLayout->addWidget( SpinBox_NbSteps, 4, 2 );
-  
+  GroupArgumentsLayout->addWidget(SpinBox_NbSteps, 4, 2);
+
   // Controls for tolerance defining
-  TextLabelTolerance = new QLabel( GroupArguments, "TextLabelTolerance" );
-  TextLabelTolerance->setText( tr( "SMESH_TOLERANCE" ) );
-  GroupArgumentsLayout->addMultiCellWidget( TextLabelTolerance, 5, 5, 0, 1 );
+  TextLabelTolerance = new QLabel(GroupArguments, "TextLabelTolerance");
+  TextLabelTolerance->setText(tr("SMESH_TOLERANCE"));
+  GroupArgumentsLayout->addMultiCellWidget(TextLabelTolerance, 5, 5, 0, 1);
 
   SpinBox_Tolerance = new SMESHGUI_SpinBox(GroupArguments, "SpinBox_Tolerance");
-  GroupArgumentsLayout->addWidget( SpinBox_Tolerance, 5, 2 );
+  GroupArgumentsLayout->addWidget(SpinBox_Tolerance, 5, 2);
+
+  SMESHGUI_RevolutionDlgLayout->addWidget(GroupArguments, 1, 0);
 
-  SMESHGUI_RevolutionDlgLayout->addWidget( GroupArguments, 1, 0 );
-  
   /* Initialisations */
-  SpinBox_X->RangeStepAndValidator( -999999.999, +999999.999, 10.0, 3 );
-  SpinBox_Y->RangeStepAndValidator( -999999.999, +999999.999, 10.0, 3 );
-  SpinBox_Z->RangeStepAndValidator( -999999.999, +999999.999, 10.0, 3 );
-  SpinBox_DX->RangeStepAndValidator( -999999.999, +999999.999, 10.0, 3 );
-  SpinBox_DY->RangeStepAndValidator( -999999.999, +999999.999, 10.0, 3 );
-  SpinBox_DZ->RangeStepAndValidator( -999999.999, +999999.999, 10.0, 3 );
-
-  SpinBox_Angle->RangeStepAndValidator( -999999.999, +999999.999, 5.0, 3 );
-  
+  SpinBox_X->RangeStepAndValidator(-999999.999, +999999.999, 10.0, 3);
+  SpinBox_Y->RangeStepAndValidator(-999999.999, +999999.999, 10.0, 3);
+  SpinBox_Z->RangeStepAndValidator(-999999.999, +999999.999, 10.0, 3);
+  SpinBox_DX->RangeStepAndValidator(-999999.999, +999999.999, 10.0, 3);
+  SpinBox_DY->RangeStepAndValidator(-999999.999, +999999.999, 10.0, 3);
+  SpinBox_DZ->RangeStepAndValidator(-999999.999, +999999.999, 10.0, 3);
+
+  SpinBox_Angle->RangeStepAndValidator(-999999.999, +999999.999, 5.0, 3);
+
   QIntValidator* anIntValidator = new QIntValidator(SpinBox_NbSteps);
   SpinBox_NbSteps->setValidator(anIntValidator);
-  SpinBox_NbSteps->setRange( 1, 999999 );
-  
-  SpinBox_Tolerance->RangeStepAndValidator( 0.0, +999999.999, 0.1, 6 );
+  SpinBox_NbSteps->setRange(1, 999999);
+
+  SpinBox_Tolerance->RangeStepAndValidator(0.0, +999999.999, 0.1, 6);
+
   GroupArguments->show();
-  RadioButton1->setChecked( TRUE );
-  mySelection = Sel;  
+  RadioButton1->setChecked(TRUE);
+
+  mySMESHGUI->SetActiveDialogBox((QDialog*)this);
 
-  mySMESHGUI  = SMESHGUI::GetSMESHGUI() ;
-  mySMESHGUI->SetActiveDialogBox( (QDialog*)this ) ;
-  
   // Costruction of the logical filter
-  SMESH_ListOfFilter aListOfFilters;
-  Handle(SMESH_TypeFilter) aMeshOrSubMeshFilter = new SMESH_TypeFilter( MESHorSUBMESH );
-  if ( !aMeshOrSubMeshFilter.IsNull() )
-    aListOfFilters.Append( aMeshOrSubMeshFilter );
-  Handle(SMESH_TypeFilter) aSmeshGroupFilter = new SMESH_TypeFilter( GROUP );
-  if ( !aSmeshGroupFilter.IsNull() )
-    aListOfFilters.Append( aSmeshGroupFilter );
-  
-  myMeshOrSubMeshOrGroupFilter = new SMESH_LogicalFilter( aListOfFilters, SMESH_LogicalFilter::LO_OR );
-  
+  SMESH_TypeFilter* aMeshOrSubMeshFilter = new SMESH_TypeFilter (MESHorSUBMESH);
+  SMESH_TypeFilter* aSmeshGroupFilter    = new SMESH_TypeFilter (GROUP);
+
+  QPtrList<SUIT_SelectionFilter> aListOfFilters;
+  if (aMeshOrSubMeshFilter) aListOfFilters.append(aMeshOrSubMeshFilter);
+  if (aSmeshGroupFilter)    aListOfFilters.append(aSmeshGroupFilter);
+
+  myMeshOrSubMeshOrGroupFilter =
+    new SMESH_LogicalFilter (aListOfFilters, SMESH_LogicalFilter::LO_OR);
+
   Init();
+
   /* signals and slots connections */
-  connect( buttonOk, SIGNAL( clicked() ),     this, SLOT( ClickOnOk() ) );
-  connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ) ;
-  connect( buttonApply, SIGNAL( clicked() ), this, SLOT(ClickOnApply() ) );
-  connect( GroupConstructors, SIGNAL(clicked(int) ), SLOT( ConstructorsClicked(int) ) );
-  
-  connect( SelectElementsButton, SIGNAL (clicked() ),   this, SLOT( SetEditCurrentArgument() ) ) ;
-  connect( SelectPointButton, SIGNAL (clicked() ),   this, SLOT( SetEditCurrentArgument() ) ) ;
-  connect( SelectVectorButton, SIGNAL (clicked() ),   this, SLOT( SetEditCurrentArgument() ) ) ;
-
-  connect( SpinBox_DX, SIGNAL( valueChanged( double )), this, SLOT(onVectorChanged() ) );
-  connect( SpinBox_DY, SIGNAL( valueChanged( double )), this, SLOT(onVectorChanged() ) );
-  connect( SpinBox_DZ, SIGNAL( valueChanged( double )), this, SLOT(onVectorChanged() ) );
-
-  connect( mySMESHGUI, SIGNAL ( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ;
-  connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
+  connect(buttonOk, SIGNAL(clicked()),     this, SLOT(ClickOnOk()));
+  connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel()));
+  connect(buttonApply, SIGNAL(clicked()),  this, SLOT(ClickOnApply()));
+  connect(GroupConstructors, SIGNAL(clicked(int)), SLOT(ConstructorsClicked(int)));
+
+  connect(SelectElementsButton, SIGNAL (clicked()), this, SLOT(SetEditCurrentArgument()));
+  connect(SelectPointButton, SIGNAL (clicked()),    this, SLOT(SetEditCurrentArgument()));
+  connect(SelectVectorButton, SIGNAL (clicked()),   this, SLOT(SetEditCurrentArgument()));
+
+  connect(SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(onVectorChanged()));
+  connect(SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(onVectorChanged()));
+  connect(SpinBox_DZ, SIGNAL(valueChanged(double)), this, SLOT(onVectorChanged()));
+
+  connect(mySMESHGUI,     SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog()));
+  connect(mySelectionMgr, SIGNAL(currentSelectionChanged()),      this, SLOT(SelectionIntoArgument()));
   /* to close dialog if study change */
-  connect( mySMESHGUI, SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ) ;
-  connect( LineEditElements, SIGNAL( textChanged( const QString& )),
-           SLOT( onTextChange( const QString& )));
-  connect( CheckBoxMesh, SIGNAL( toggled( bool )),
-           SLOT( onSelectMesh( bool )));
-  
+  connect(mySMESHGUI,       SIGNAL(SignalCloseAllDialogs()), this, SLOT(ClickOnCancel()));
+  connect(LineEditElements, SIGNAL(textChanged(const QString&)),   SLOT(onTextChange(const QString&)));
+  connect(CheckBoxMesh,     SIGNAL(toggled(bool)),                 SLOT(onSelectMesh(bool)));
+
   /* Move widget on the botton right corner of main widget */
-  int x, y ;
-  mySMESHGUI->DefineDlgPosition( this, x, y ) ;
-  this->move( x, y ) ;
-  this->show() ; /* displays Dialog */
+  int x, y;
+  mySMESHGUI->DefineDlgPosition(this, x, y);
+  this->move(x, y);
+  this->show(); /* displays Dialog */
 
   ConstructorsClicked(0);
+  resize(0,0); // ??
 }
 
 //=================================================================================
@@ -338,83 +352,79 @@ SMESHGUI_RevolutionDlg::~SMESHGUI_RevolutionDlg()
   // no need to delete child widgets, Qt does it all for us
 }
 
-
 //=================================================================================
 // function : Init()
 // purpose  :
 //=================================================================================
-void SMESHGUI_RevolutionDlg::Init( bool ResetControls )
+void SMESHGUI_RevolutionDlg::Init (bool ResetControls)
 {
   myBusy = false;
-  
+
   myEditCurrentArgument = 0;
   LineEditElements->clear();
   myElementsId = "";
-  myNbOkElements = 0 ;
-  
-  myActor     = 0;
+  myNbOkElements = 0;
+
+  myActor = 0;
   myMesh = SMESH::SMESH_Mesh::_nil();
-  
-  if( ResetControls )
-    {
-      SpinBox_X->SetValue(0.0);
-      SpinBox_Y->SetValue(0.0);
-      SpinBox_Z->SetValue(0.0);
-      SpinBox_DX->SetValue(0.0);
-      SpinBox_DY->SetValue(0.0);
-      SpinBox_DZ->SetValue(0.0);
-      
-      SpinBox_Angle->SetValue(45);
-      SpinBox_NbSteps->setValue(1);
-      SpinBox_Tolerance->SetValue(1e-05);
-      
-      CheckBoxMesh->setChecked(false);
-      onSelectMesh( false );
-    }
-}
 
+  if (ResetControls) {
+    SpinBox_X->SetValue(0.0);
+    SpinBox_Y->SetValue(0.0);
+    SpinBox_Z->SetValue(0.0);
+    SpinBox_DX->SetValue(0.0);
+    SpinBox_DY->SetValue(0.0);
+    SpinBox_DZ->SetValue(0.0);
+
+    SpinBox_Angle->SetValue(45);
+    SpinBox_NbSteps->setValue(1);
+    SpinBox_Tolerance->SetValue(1e-05);
+
+    CheckBoxMesh->setChecked(false);
+    onSelectMesh(false);
+  }
+}
 
 //=================================================================================
 // function : ConstructorsClicked()
 // purpose  : Radio button management
 //=================================================================================
-void SMESHGUI_RevolutionDlg::ConstructorsClicked(int constructorId)
+void SMESHGUI_RevolutionDlg::ConstructorsClicked (int constructorId)
 {
-  disconnect(mySelection, 0, this, 0);
-  
+  disconnect(mySelectionMgr, 0, this, 0);
+
   Selection_Mode aSelMode = ActorSelection;
 
-  switch(constructorId)
-    { 
-    case 0 :
-      {
-       GroupArguments->setTitle( tr( "REVOLUTION_1D" ) );
-       aSelMode = EdgeSelection;
-       break;
-      }
-    case 1 :
-      { 
-       GroupArguments->setTitle( tr( "REVOLUTION_2D" ) );
-       aSelMode = FaceSelection;
-       break;
-      }
+  switch (constructorId) {
+  case 0:
+    {
+      GroupArguments->setTitle(tr("REVOLUTION_1D"));
+      aSelMode = EdgeSelection;
+      break;
+    }
+  case 1:
+    {
+      GroupArguments->setTitle(tr("REVOLUTION_2D"));
+      aSelMode = FaceSelection;
+      break;
     }
-  
-  if (myEditCurrentArgument != (QWidget*)LineEditElements)
+  }
+
+  if (myEditCurrentArgument != (QWidget*)LineEditElements) {
     SMESH::SetPointRepresentation(false);
-    
+  }
+
   if (!CheckBoxMesh->isChecked())
-    QAD_Application::getDesktop()->SetSelectionMode( aSelMode, true );
-  
+    myViewWindow->SetSelectionMode(aSelMode);
+
   myEditCurrentArgument = (QWidget*)LineEditElements;
   LineEditElements->setFocus();
-  
+
   if (CheckBoxMesh->isChecked())
     onSelectMesh(true);
-  
-  connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
-}
 
+  connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
+}
 
 //=================================================================================
 // function : ClickOnApply()
@@ -422,48 +432,44 @@ void SMESHGUI_RevolutionDlg::ConstructorsClicked(int constructorId)
 //=================================================================================
 void SMESHGUI_RevolutionDlg::ClickOnApply()
 {
-  if (mySMESHGUI->ActiveStudyLocked())
+  if (mySMESHGUI->isActiveStudyLocked())
     return;
-  
-  if ( myNbOkElements  && IsAxisOk())
-    {
-      QStringList aListElementsId = QStringList::split( " ", myElementsId, false);
-      
-      SMESH::long_array_var anElementsId = new SMESH::long_array;
-      
-      anElementsId->length( aListElementsId.count() );
-      for ( int i = 0; i < aListElementsId.count(); i++ )
-       anElementsId[i] = aListElementsId[i].toInt();
-      
-      SMESH::AxisStruct anAxis;
-      
-      anAxis.x =  SpinBox_X->GetValue();
-      anAxis.y =  SpinBox_Y->GetValue();
-      anAxis.z =  SpinBox_Z->GetValue();;
-      anAxis.vx = SpinBox_DX->GetValue();
-      anAxis.vy = SpinBox_DY->GetValue();
-      anAxis.vz = SpinBox_DZ->GetValue();
-
-      double anAngle = (SpinBox_Angle->GetValue())*PI/180; 
-      long aNbSteps = (long)SpinBox_NbSteps->value();
-      double aTolerance = SpinBox_Tolerance->GetValue();
-
-      try
-       {
-         SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
-         QApplication::setOverrideCursor(Qt::waitCursor);
-         aMeshEditor->RotationSweep(anElementsId.inout(), anAxis, anAngle, aNbSteps, aTolerance);
-         QApplication::restoreOverrideCursor();
-       }
-      catch( ... )
-       {
-       }
-      
-      mySelection->ClearIObjects();
-      SMESH::UpdateView();
-      Init( false);
-      ConstructorsClicked( GetConstructorId() );
+
+  if (myNbOkElements && IsAxisOk()) {
+    QStringList aListElementsId = QStringList::split(" ", myElementsId, false);
+
+    SMESH::long_array_var anElementsId = new SMESH::long_array;
+
+    anElementsId->length(aListElementsId.count());
+    for (int i = 0; i < aListElementsId.count(); i++)
+      anElementsId[i] = aListElementsId[i].toInt();
+
+    SMESH::AxisStruct anAxis;
+
+    anAxis.x =  SpinBox_X->GetValue();
+    anAxis.y =  SpinBox_Y->GetValue();
+    anAxis.z =  SpinBox_Z->GetValue();;
+    anAxis.vx = SpinBox_DX->GetValue();
+    anAxis.vy = SpinBox_DY->GetValue();
+    anAxis.vz = SpinBox_DZ->GetValue();
+
+    double anAngle = (SpinBox_Angle->GetValue())*PI/180;
+    long aNbSteps = (long)SpinBox_NbSteps->value();
+    double aTolerance = SpinBox_Tolerance->GetValue();
+
+    try {
+      SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
+      QApplication::setOverrideCursor(Qt::waitCursor);
+      aMeshEditor->RotationSweep(anElementsId.inout(), anAxis, anAngle, aNbSteps, aTolerance);
+      QApplication::restoreOverrideCursor();
+    } catch (...) {
     }
+
+    mySelectionMgr->clearSelected();
+    SMESH::UpdateView();
+    Init(false);
+    ConstructorsClicked(GetConstructorId());
+  }
 }
 
 //=================================================================================
@@ -472,73 +478,87 @@ void SMESHGUI_RevolutionDlg::ClickOnApply()
 //=================================================================================
 void SMESHGUI_RevolutionDlg::ClickOnOk()
 {
-  ClickOnApply() ;
-  ClickOnCancel() ;
+  ClickOnApply();
+  ClickOnCancel();
 }
 
-       
 //=================================================================================
 // function : ClickOnCancel()
 // purpose  :
 //=================================================================================
 void SMESHGUI_RevolutionDlg::ClickOnCancel()
 {
-  mySelection->ClearFilters();
-  mySelection->ClearIObjects();
+  disconnect(mySelectionMgr, 0, this, 0);
+  mySelectionMgr->clearFilters();
+  mySelectionMgr->clearSelected();
   SMESH::SetPointRepresentation(false);
-  QAD_Application::getDesktop()->SetSelectionMode( ActorSelection );
-  disconnect( mySelection, 0, this, 0 );
-  mySMESHGUI->ResetState() ;
-  reject() ;
+  myViewWindow->SetSelectionMode(ActorSelection);
+  mySMESHGUI->ResetState();
+  reject();
 }
 
 //=======================================================================
-//function : onTextChange
-//purpose  : 
+// function : onTextChange()
+// purpose  :
 //=======================================================================
-
-void SMESHGUI_RevolutionDlg::onTextChange(const QString& theNewText)
+void SMESHGUI_RevolutionDlg::onTextChange (const QString& theNewText)
 {
   QLineEdit* send = (QLineEdit*)sender();
 
-  if ( myBusy ) return;
+  if (myBusy) return;
   myBusy = true;
-  
+
   if (send == LineEditElements)
     myNbOkElements = 0;
-  
-  buttonOk->setEnabled( false );
-  buttonApply->setEnabled( false );
-  
+
+  buttonOk->setEnabled(false);
+  buttonApply->setEnabled(false);
+
   // hilight entered elements
   SMDS_Mesh* aMesh = 0;
-  if ( myActor )
+  if (myActor)
     aMesh = myActor->GetObject()->GetMesh();
-  
-  if ( aMesh ) {
-    mySelection->ClearIObjects();
-    mySelection->AddIObject( myActor->getIO() );
-    
-    QStringList aListId = QStringList::split( " ", theNewText, false);
-    
+
+  if (aMesh) {
     if (send == LineEditElements) {
-      for ( int i = 0; i < aListId.count(); i++ ) {
-       const SMDS_MeshElement * e = aMesh->FindElement( aListId[ i ].toInt() );
-       if ( e ) {
-         if ( !mySelection->IsIndexSelected( myActor->getIO(), e->GetID() ))
-           mySelection->AddOrRemoveIndex (myActor->getIO(), e->GetID(), true);
+      //mySelectionMgr->clearSelected();
+      //mySelectionMgr->AddIObject(myActor->getIO());
+      SALOME_ListIO aList;
+      aList.Append(myActor->getIO());
+      mySelectionMgr->setSelectedObjects(aList, false);
+
+      TColStd_IndexedMapOfInteger selectedIndices;
+      TColStd_MapOfInteger newIndices;
+      mySelector->GetIndex(myActor->getIO(), selectedIndices);
+
+      QStringList aListId = QStringList::split(" ", theNewText, false);
+      for (int i = 0; i < aListId.count(); i++) {
+       const SMDS_MeshElement * e = aMesh->FindElement(aListId[ i ].toInt());
+       if (e) {
+         //if (!mySelectionMgr->IsIndexSelected(myActor->getIO(), e->GetID())) {
+          if (selectedIndices.Add(e->GetID())) {
+           //mySelectionMgr->AddOrRemoveIndex (myActor->getIO(), e->GetID(), true);
+            newIndices.Add(e->GetID());
+          }
          myNbOkElements++;
        }
       }
+
+      if (newIndices.Extent() > 0)
+      {
+        mySelector->AddOrRemoveIndex(myActor->getIO(), newIndices, true);
+       myViewWindow->highlight( myActor->getIO(), true, true );
+      }
+
       myElementsId = theNewText;
     }
   }
-  
-  if ( myNbOkElements &&  IsAxisOk() ) {
-    buttonOk->setEnabled( true );
-    buttonApply->setEnabled( true );
+
+  if (myNbOkElements && IsAxisOk()) {
+    buttonOk->setEnabled(true);
+    buttonApply->setEnabled(true);
   }
-  
+
   myBusy = false;
 }
 
@@ -548,176 +568,160 @@ void SMESHGUI_RevolutionDlg::onTextChange(const QString& theNewText)
 //=================================================================================
 void SMESHGUI_RevolutionDlg::SelectionIntoArgument()
 {
-  if ( myBusy ) return;
-  
+  if (myBusy) return;
+
   // clear
   myActor = 0;
   QString aString = "";
 
   myBusy = true;
-  if (myEditCurrentArgument == (QWidget*)LineEditElements)
-    {
-      LineEditElements->setText( aString );
-      myNbOkElements = 0;
-      buttonOk->setEnabled( false );
-      buttonApply->setEnabled( false );
-    }
+  if (myEditCurrentArgument == (QWidget*)LineEditElements) {
+    LineEditElements->setText(aString);
+    myNbOkElements = 0;
+    buttonOk->setEnabled(false);
+    buttonApply->setEnabled(false);
+  }
   myBusy = false;
-  
-  if ( !GroupButtons->isEnabled() ) // inactive
+
+  if (!GroupButtons->isEnabled()) // inactive
     return;
-  
+
   // get selected mesh
-  int nbSel = mySelection->IObjectCount();
-  if(nbSel != 1)
+  const SALOME_ListIO& aList = mySelector->StoredIObjects();
+
+  int nbSel = aList.Extent();
+  if (nbSel != 1)
     return;
-  
-  Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject();
+
+  Handle(SALOME_InteractiveObject) IO = aList.First();
   myMesh = SMESH::GetMeshByIO(IO);
-  if(myMesh->_is_nil())
+  if (myMesh->_is_nil())
     return;
+
   myActor = SMESH::FindActorByObject(myMesh);
+  if (!myActor)
+    myActor = SMESH::FindActorByEntry(IO->getEntry());
   if (!myActor)
     return;
-  
+
   int aNbUnits = 0;
 
-  if (myEditCurrentArgument == (QWidget*)LineEditElements)
-    {
-      myElementsId = "";
-      
-      if (CheckBoxMesh->isChecked())
-       {
-         SMESH::GetNameOfSelectedIObjects(mySelection, aString);
-       
-         int aConstructorId = GetConstructorId();
-
-         if(!SMESH::IObjectToInterface<SMESH::SMESH_Mesh>(IO)->_is_nil()) //MESH
-           {
-             // get IDs from mesh
-             SMDS_Mesh* aSMDSMesh = myActor->GetObject()->GetMesh();
-             if (!aSMDSMesh)
-               return;
-             
-             if (aConstructorId == 0)
-               {
-                 SMDS_EdgeIteratorPtr anIter = aSMDSMesh->edgesIterator();
-                 
-                 while ( anIter->more() )
-                   {
-                     const SMDS_MeshEdge * edge = anIter->next();
-                     if ( edge ) {
-                       myElementsId += QString(" %1").arg(edge->GetID());
-                       aNbUnits++;
-                     }
-                   }
-               }
-             else if (aConstructorId == 1)
-               {
-                 SMDS_FaceIteratorPtr anIter = aSMDSMesh->facesIterator();               
-                 while ( anIter->more() )
-                   {
-                     const SMDS_MeshFace * face = anIter->next();
-                     if ( face ) {
-                       myElementsId += QString(" %1").arg(face->GetID());
-                       aNbUnits++;
-                     }
-                   }
-               }
-           }
-         else if (!SMESH::IObjectToInterface<SMESH::SMESH_subMesh>(IO)->_is_nil()) //SUBMESH
-           {
-             // get submesh
-             SMESH::SMESH_subMesh_var aSubMesh = SMESH::IObjectToInterface<SMESH::SMESH_subMesh>(IO) ;
-             
-             // get IDs from submesh
-             SMESH::long_array_var anElementsIds = new SMESH::long_array;
-             if (aConstructorId == 0)
-               anElementsIds = aSubMesh->GetElementsByType(SMESH::EDGE);
-             else if (aConstructorId == 1)
-               anElementsIds = aSubMesh->GetElementsByType(SMESH::FACE);
-             
-             for ( int i = 0; i < anElementsIds->length(); i++ )
-               myElementsId += QString(" %1").arg(anElementsIds[i]);
-             aNbUnits = anElementsIds->length();
-           }
-         else // GROUP
-           {
-             // get smesh group
-             SMESH::SMESH_GroupBase_var aGroup =
-                SMESH::IObjectToInterface<SMESH::SMESH_GroupBase>(IO);
-             if (aGroup->_is_nil())
-               return;
-             
-             if ( (aConstructorId == 0 && aGroup->GetType()!= SMESH::EDGE) ||
-                  (aConstructorId == 1 && aGroup->GetType()!= SMESH::FACE) )
-               return;
-             
-             // get IDs from smesh group
-             SMESH::long_array_var anElementsIds = new SMESH::long_array;
-             anElementsIds = aGroup->GetListOfID();
-             for ( int i = 0; i < anElementsIds->length(); i++ )
-               myElementsId += QString(" %1").arg(anElementsIds[i]);
-             aNbUnits = anElementsIds->length();
-           }
-       }
-      else
-       {
-         aNbUnits = SMESH::GetNameOfSelectedElements(mySelection, aString) ;
-         myElementsId = aString;
-       }
-      
-      if(aNbUnits < 1)
-       return ;
-      
-      myNbOkElements = true;
+  if (myEditCurrentArgument == (QWidget*)LineEditElements) {
+    myElementsId = "";
+
+    if (CheckBoxMesh->isChecked()) {
+      int aConstructorId = GetConstructorId();
+
+      SMESH::GetNameOfSelectedIObjects(mySelectionMgr, aString);
+
+      if (!SMESH::IObjectToInterface<SMESH::SMESH_Mesh>(IO)->_is_nil()) { //MESH
+        // get IDs from mesh
+        SMDS_Mesh* aSMDSMesh = myActor->GetObject()->GetMesh();
+        if (!aSMDSMesh)
+          return;
+
+        if (aConstructorId == 0) {
+          SMDS_EdgeIteratorPtr anIter = aSMDSMesh->edgesIterator();
+
+          while (anIter->more()) {
+            const SMDS_MeshEdge * edge = anIter->next();
+            if (edge) {
+              myElementsId += QString(" %1").arg(edge->GetID());
+              aNbUnits++;
+            }
+          }
+        } else if (aConstructorId == 1) {
+          SMDS_FaceIteratorPtr anIter = aSMDSMesh->facesIterator();
+          while (anIter->more()) {
+            const SMDS_MeshFace * face = anIter->next();
+            if (face) {
+              myElementsId += QString(" %1").arg(face->GetID());
+              aNbUnits++;
+            }
+          }
+        }
+      } else if (!SMESH::IObjectToInterface<SMESH::SMESH_subMesh>(IO)->_is_nil()) { //SUBMESH
+        // get submesh
+        SMESH::SMESH_subMesh_var aSubMesh = SMESH::IObjectToInterface<SMESH::SMESH_subMesh>(IO);
+
+        // get IDs from submesh
+        SMESH::long_array_var anElementsIds = new SMESH::long_array;
+        if (aConstructorId == 0)
+          anElementsIds = aSubMesh->GetElementsByType(SMESH::EDGE);
+        else if (aConstructorId == 1)
+          anElementsIds = aSubMesh->GetElementsByType(SMESH::FACE);
+
+        for (int i = 0; i < anElementsIds->length(); i++)
+          myElementsId += QString(" %1").arg(anElementsIds[i]);
+        aNbUnits = anElementsIds->length();
+      } else { // GROUP
+        // get smesh group
+        SMESH::SMESH_GroupBase_var aGroup =
+          SMESH::IObjectToInterface<SMESH::SMESH_GroupBase>(IO);
+        if (aGroup->_is_nil())
+          return;
+
+        if ((aConstructorId == 0 && aGroup->GetType()!= SMESH::EDGE) ||
+            (aConstructorId == 1 && aGroup->GetType()!= SMESH::FACE))
+          return;
+
+        // get IDs from smesh group
+        SMESH::long_array_var anElementsIds = new SMESH::long_array;
+        anElementsIds = aGroup->GetListOfID();
+        for (int i = 0; i < anElementsIds->length(); i++) {
+          myElementsId += QString(" %1").arg(anElementsIds[i]);
+        }
+        aNbUnits = anElementsIds->length();
+      }
+    } else {
+      aNbUnits = SMESH::GetNameOfSelectedElements(mySelector, myActor->getIO(), aString);
+      myElementsId = aString;
     }
-  else 
-    {
-      aNbUnits = SMESH::GetNameOfSelectedNodes(mySelection, aString);
-      if(aNbUnits != 1)
-       return;
-      
-      SMDS_Mesh* aMesh =  myActor->GetObject()->GetMesh();
-      if (!aMesh)
-       return;
-
-      const SMDS_MeshNode * n = aMesh->FindNode( aString.toInt() );
-      if ( !n )
-       return;
-      
-      double x = n->X();
-      double y = n->Y();
-      double z = n->Z();
-
-      if (myEditCurrentArgument == (QWidget*)SpinBox_X)
-       {
-         SpinBox_X->SetValue(x);
-         SpinBox_Y->SetValue(y);
-         SpinBox_Z->SetValue(z);
-       }
-      else if (myEditCurrentArgument == (QWidget*)SpinBox_DX)
-       {
-         SpinBox_DX->SetValue(x - SpinBox_X->GetValue());
-         SpinBox_DY->SetValue(y - SpinBox_Y->GetValue());
-         SpinBox_DZ->SetValue(z - SpinBox_Z->GetValue());
-       }
+
+    if (aNbUnits < 1)
+      return;
+
+    myNbOkElements = true;
+  } else {
+    aNbUnits = SMESH::GetNameOfSelectedNodes(mySelector, myActor->getIO(), aString);
+    if (aNbUnits != 1)
+      return;
+
+    SMDS_Mesh* aMesh =  myActor->GetObject()->GetMesh();
+    if (!aMesh)
+      return;
+
+    const SMDS_MeshNode * n = aMesh->FindNode(aString.toInt());
+    if (!n)
+      return;
+
+    double x = n->X();
+    double y = n->Y();
+    double z = n->Z();
+
+    if (myEditCurrentArgument == (QWidget*)SpinBox_X) {
+      SpinBox_X->SetValue(x);
+      SpinBox_Y->SetValue(y);
+      SpinBox_Z->SetValue(z);
+    } else if (myEditCurrentArgument == (QWidget*)SpinBox_DX) {
+      SpinBox_DX->SetValue(x - SpinBox_X->GetValue());
+      SpinBox_DY->SetValue(y - SpinBox_Y->GetValue());
+      SpinBox_DZ->SetValue(z - SpinBox_Z->GetValue());
     }
-  
+  }
+
   myBusy = true;
   if (myEditCurrentArgument == (QWidget*)LineEditElements)
-    LineEditElements->setText( aString );
+    LineEditElements->setText(aString);
   myBusy = false;
-  
+
   // OK
-  if(myNbOkElements && IsAxisOk())
-    {
-      buttonOk->setEnabled( true );
-      buttonApply->setEnabled( true );
-    }
+  if (myNbOkElements && IsAxisOk()) {
+    buttonOk->setEnabled(true);
+    buttonApply->setEnabled(true);
+  }
 }
 
-
 //=================================================================================
 // function : SetEditCurrentArgument()
 // purpose  :
@@ -725,44 +729,38 @@ void SMESHGUI_RevolutionDlg::SelectionIntoArgument()
 void SMESHGUI_RevolutionDlg::SetEditCurrentArgument()
 {
   QPushButton* send = (QPushButton*)sender();
-  
-  disconnect( mySelection, 0, this, 0 );
-  mySelection->ClearIObjects();
-  mySelection->ClearFilters();
-  
-  if(send == SelectElementsButton) {
+
+  disconnect(mySelectionMgr, 0, this, 0);
+  mySelectionMgr->clearSelected();
+  mySelectionMgr->clearFilters();
+
+  if (send == SelectElementsButton) {
     myEditCurrentArgument = (QWidget*)LineEditElements;
     SMESH::SetPointRepresentation(false);
-    if (CheckBoxMesh->isChecked())
-      {
-       QAD_Application::getDesktop()->SetSelectionMode( ActorSelection );
-       mySelection->AddFilter(myMeshOrSubMeshOrGroupFilter);
-      }
-    else
-      {
-       int aConstructorId = GetConstructorId();
-       if (aConstructorId == 0)
-         QAD_Application::getDesktop()->SetSelectionMode( EdgeSelection, true );
-       else if (aConstructorId == 1)
-         QAD_Application::getDesktop()->SetSelectionMode( FaceSelection, true );
-      }
-  }
-  else if (send == SelectPointButton)
-    {
-      myEditCurrentArgument = (QWidget*)SpinBox_X;
-      SMESH::SetPointRepresentation(true);
-      QAD_Application::getDesktop()->SetSelectionMode( NodeSelection, true );
-    }
-  else if (send == SelectVectorButton)
-    {
-      myEditCurrentArgument = (QWidget*)SpinBox_DX;
-      SMESH::SetPointRepresentation(true);
-      QAD_Application::getDesktop()->SetSelectionMode( NodeSelection, true );
+    if (CheckBoxMesh->isChecked()) {
+      myViewWindow->SetSelectionMode(ActorSelection);
+      mySelectionMgr->installFilter(myMeshOrSubMeshOrGroupFilter);
+    } else {
+      int aConstructorId = GetConstructorId();
+      if (aConstructorId == 0)
+        myViewWindow->SetSelectionMode(EdgeSelection);
+      else if (aConstructorId == 1)
+        myViewWindow->SetSelectionMode(FaceSelection);
     }
-  
+  } else if (send == SelectPointButton) {
+    myEditCurrentArgument = (QWidget*)SpinBox_X;
+    SMESH::SetPointRepresentation(true);
+    myViewWindow->SetSelectionMode(NodeSelection);
+  } else if (send == SelectVectorButton) {
+    myEditCurrentArgument = (QWidget*)SpinBox_DX;
+    SMESH::SetPointRepresentation(true);
+    myViewWindow->SetSelectionMode(NodeSelection);
+  } else {
+  }
+
   myEditCurrentArgument->setFocus();
-  connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
-  SelectionIntoArgument() ;
+  connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
+  SelectionIntoArgument();
 }
 
 //=================================================================================
@@ -771,16 +769,15 @@ void SMESHGUI_RevolutionDlg::SetEditCurrentArgument()
 //=================================================================================
 void SMESHGUI_RevolutionDlg::DeactivateActiveDialog()
 {
-  if ( GroupConstructors->isEnabled() ) {
-    GroupConstructors->setEnabled(false) ;
-    GroupArguments->setEnabled(false) ;
-    GroupButtons->setEnabled(false) ;
-    mySMESHGUI->ResetState() ;    
-    mySMESHGUI->SetActiveDialogBox(0) ;
+  if (GroupConstructors->isEnabled()) {
+    GroupConstructors->setEnabled(false);
+    GroupArguments->setEnabled(false);
+    GroupButtons->setEnabled(false);
+    mySMESHGUI->ResetState();
+    mySMESHGUI->SetActiveDialogBox(0);
   }
 }
 
-
 //=================================================================================
 // function : ActivateThisDialog()
 // purpose  :
@@ -788,134 +785,117 @@ void SMESHGUI_RevolutionDlg::DeactivateActiveDialog()
 void SMESHGUI_RevolutionDlg::ActivateThisDialog()
 {
   /* Emit a signal to deactivate the active dialog */
-  mySMESHGUI->EmitSignalDeactivateDialog() ;   
-  GroupConstructors->setEnabled(true) ;
-  GroupArguments->setEnabled(true) ;
-  GroupButtons->setEnabled(true) ;
-  
-  mySMESHGUI->SetActiveDialogBox( (QDialog*)this ) ;
+  mySMESHGUI->EmitSignalDeactivateDialog();
+  GroupConstructors->setEnabled(true);
+  GroupArguments->setEnabled(true);
+  GroupButtons->setEnabled(true);
+
+  mySMESHGUI->SetActiveDialogBox((QDialog*)this);
 
   ConstructorsClicked(GetConstructorId());
   SelectionIntoArgument();
 }
 
-
 //=================================================================================
 // function : enterEvent()
 // purpose  :
 //=================================================================================
-void SMESHGUI_RevolutionDlg::enterEvent(QEvent* e)
+void SMESHGUI_RevolutionDlg::enterEvent (QEvent*)
 {
-  if ( GroupConstructors->isEnabled() )
-    return ;  
-  ActivateThisDialog() ;
+  if (!GroupConstructors->isEnabled())
+    ActivateThisDialog();
 }
 
-
 //=================================================================================
 // function : closeEvent()
 // purpose  :
 //=================================================================================
-void SMESHGUI_RevolutionDlg::closeEvent( QCloseEvent* e )
+void SMESHGUI_RevolutionDlg::closeEvent (QCloseEvent*)
 {
   /* same than click on cancel button */
-  this->ClickOnCancel() ;
-  return ;
+  this->ClickOnCancel();
 }
 
-
 //=======================================================================
-//function : hideEvent
-//purpose  : caused by ESC key
+// function : hideEvent()
+// purpose  : caused by ESC key
 //=======================================================================
-
-void SMESHGUI_RevolutionDlg::hideEvent ( QHideEvent * e )
+void SMESHGUI_RevolutionDlg::hideEvent (QHideEvent*)
 {
-  if ( !isMinimized() )
+  if (!isMinimized())
     ClickOnCancel();
 }
 
+//=======================================================================
+//function : onSelectMesh
+//purpose  :
+//=======================================================================
+void SMESHGUI_RevolutionDlg::onSelectMesh (bool toSelectMesh)
+{
+  if (toSelectMesh)
+    TextLabelElements->setText(tr("SMESH_NAME"));
+  else
+    TextLabelElements->setText(tr("SMESH_ID_ELEMENTS"));
+
+  if (myEditCurrentArgument != LineEditElements) {
+    LineEditElements->clear();
+    return;
+  }
+
+  mySelectionMgr->clearFilters();
+  SMESH::SetPointRepresentation(false);
+
+  if (toSelectMesh) {
+    myViewWindow->SetSelectionMode(ActorSelection);
+    mySelectionMgr->installFilter(myMeshOrSubMeshOrGroupFilter);
+    LineEditElements->setReadOnly(true);
+  } else {
+    int aConstructorId = GetConstructorId();
+    if (aConstructorId == 0)
+      myViewWindow->SetSelectionMode(EdgeSelection);
+    else if (aConstructorId == 0)
+      myViewWindow->SetSelectionMode(FaceSelection);
+
+    LineEditElements->setReadOnly(false);
+    onTextChange(LineEditElements->text());
+  }
+
+  SelectionIntoArgument();
+}
 
 //=================================================================================
 // function : GetConstructorId()
-// purpose  : 
+// purpose  :
 //=================================================================================
 int SMESHGUI_RevolutionDlg::GetConstructorId()
-{ 
-  if ( GroupConstructors != NULL && GroupConstructors->selected() != NULL )
-    return GroupConstructors->id( GroupConstructors->selected() );
+{
+  if (GroupConstructors != NULL && GroupConstructors->selected() != NULL)
+    return GroupConstructors->id(GroupConstructors->selected());
   return -1;
 }
 
-
 //=================================================================================
 // function : IsAxisOk()
-// purpose  : 
+// purpose  :
 //=================================================================================
 bool SMESHGUI_RevolutionDlg::IsAxisOk()
 {
-  return (SpinBox_DX->GetValue() != 0 || 
+  return (SpinBox_DX->GetValue() != 0 ||
          SpinBox_DY->GetValue() != 0 ||
-         SpinBox_DZ->GetValue() != 0); 
+         SpinBox_DZ->GetValue() != 0);
 }
 
-
 //=================================================================================
 // function : onVectorChanged()
-// purpose  : 
+// purpose  :
 //=================================================================================
 void SMESHGUI_RevolutionDlg::onVectorChanged()
 {
-  if (IsAxisOk())
-    {
-      buttonOk->setEnabled( true );
-      buttonApply->setEnabled( true );
-    }
-  else
-    {
-      buttonOk->setEnabled( false );
-      buttonApply->setEnabled( false );
-    }
-}
-
-
-//=======================================================================
-//function : onSelectMesh
-//purpose  :
-//=======================================================================
-void SMESHGUI_RevolutionDlg::onSelectMesh ( bool toSelectMesh )
-{
-  if (toSelectMesh)
-    TextLabelElements->setText( tr( "SMESH_NAME" ) );
-  else
-    TextLabelElements->setText( tr( "SMESH_ID_ELEMENTS" ) );
-  
-  if (myEditCurrentArgument != LineEditElements)
-    {
-      LineEditElements->clear();
-      return;
-    }
-  
-  mySelection->ClearFilters() ;
-  SMESH::SetPointRepresentation(false);
-  
-  if (toSelectMesh)
-    {
-      QAD_Application::getDesktop()->SetSelectionMode( ActorSelection );
-      mySelection->AddFilter(myMeshOrSubMeshOrGroupFilter);
-      LineEditElements->setReadOnly(true);
-    }
-  else
-    {
-      int aConstructorId = GetConstructorId();
-      if (aConstructorId == 0)
-       QAD_Application::getDesktop()->SetSelectionMode( EdgeSelection, true );
-      else if (aConstructorId == 0)
-       QAD_Application::getDesktop()->SetSelectionMode( FaceSelection, true );
-      
-      LineEditElements->setReadOnly(false);
-      onTextChange(LineEditElements->text());
-    }
-  
-  SelectionIntoArgument();
+  if (IsAxisOk()) {
+    buttonOk->setEnabled(true);
+    buttonApply->setEnabled(true);
+  } else {
+    buttonOk->setEnabled(false);
+    buttonApply->setEnabled(false);
+  }
 }
index 6b55513e33ced31f2ed52f8d5e98292953cd058c..5e35ea9dac8c9e1c0a979e29d3e368b6f5ce732c 100644 (file)
 #ifndef DIALOGBOX_REVOLUTION_H
 #define DIALOGBOX_REVOLUTION_H
 
-#include "SALOME_Selection.h"
+#include "SalomeApp_SelectionMgr.h"
+
 #include "SMESH_LogicalFilter.hxx"
+
 // QT Includes
 #include <qdialog.h>
 
@@ -47,6 +49,9 @@ class SMESHGUI_SpinBox;
 class SMESHGUI;
 class SMESH_Actor;
 class SMESHGUI_SpinBox;
+class SVTK_ViewWindow;
+class SVTK_Selector;
+
 
 // IDL Headers
 #include <SALOMEconfig.h>
@@ -62,28 +67,32 @@ class SMESHGUI_RevolutionDlg : public QDialog
     Q_OBJECT
 
 public:
-    SMESHGUI_RevolutionDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 );
+    SMESHGUI_RevolutionDlg (SMESHGUI*,
+                           const char* name = 0,
+                           bool modal = FALSE,
+                           WFlags fl = 0);
     ~SMESHGUI_RevolutionDlg();
 
 private:
-
-    void Init( bool ResetControls = true ) ;
-    void closeEvent( QCloseEvent* e ) ;
-    void enterEvent ( QEvent * ) ;                          /* mouse enter the QWidget */
-    void hideEvent ( QHideEvent * );                        /* ESC key */
+    void Init (bool ResetControls = true);
+    void closeEvent (QCloseEvent*);
+    void enterEvent (QEvent*);                          /* mouse enter the QWidget */
+    void hideEvent (QHideEvent*);                       /* ESC key */
     int  GetConstructorId();
     bool IsAxisOk();
 
-    SMESHGUI*                     mySMESHGUI ;              /* Current SMESHGUI object */
-    SALOME_Selection*             mySelection ;             /* User shape selection */
-    int                           myNbOkElements ;          /* to check when elements are defined */
+    SMESHGUI*                     mySMESHGUI;              /* Current SMESHGUI object */
+    SalomeApp_SelectionMgr*       mySelectionMgr;          /* User shape selection */
+    int                           myNbOkElements;          /* to check when elements are defined */
     QString                       myElementsId;
-    QWidget*                      myEditCurrentArgument;    /* Current  argument */
+    QWidget*                      myEditCurrentArgument;   /* Current  argument */
+    SVTK_ViewWindow*              myViewWindow;
+    SVTK_Selector*                mySelector;
 
     bool                          myBusy;
     SMESH::SMESH_Mesh_var         myMesh;
     SMESH_Actor*                  myActor;
-    Handle(SMESH_LogicalFilter)   myMeshOrSubMeshOrGroupFilter;
+    SMESH_LogicalFilter*          myMeshOrSubMeshOrGroupFilter;
 
     QButtonGroup* GroupConstructors;
     QRadioButton* RadioButton1;
@@ -98,7 +107,7 @@ private:
     QPushButton* SelectElementsButton;
     QLineEdit* LineEditElements;
     QCheckBox* CheckBoxMesh;
-    
+
     QLabel* TextLabelPoint;
     QPushButton* SelectPointButton;
     QLabel* TextLabelX;
@@ -115,7 +124,7 @@ private:
     SMESHGUI_SpinBox* SpinBox_DY;
     QLabel* TextLabelDZ;
     SMESHGUI_SpinBox* SpinBox_DZ;
-    
+
     QLabel* TextLabelAngle;
     SMESHGUI_SpinBox* SpinBox_Angle;
     QLabel* TextLabelNbSteps;
@@ -123,19 +132,19 @@ private:
     QLabel* TextLabelTolerance;
     SMESHGUI_SpinBox* SpinBox_Tolerance;
 
-    private slots:
+private slots:
 
-    void ConstructorsClicked(int constructorId);
+    void ConstructorsClicked (int constructorId);
     void ClickOnOk();
     void ClickOnCancel();
     void ClickOnApply();
-    void SetEditCurrentArgument() ;
-    void SelectionIntoArgument() ;
-    void DeactivateActiveDialog() ;
-    void ActivateThisDialog() ;
-    void onTextChange(const QString&);
+    void SetEditCurrentArgument();
+    void SelectionIntoArgument();
+    void DeactivateActiveDialog();
+    void ActivateThisDialog();
+    void onTextChange (const QString&);
+    void onSelectMesh (bool toSelectMesh);
     void onVectorChanged();
-    void onSelectMesh(bool toSelectMesh);
 
 protected:
     QGridLayout* SMESHGUI_RevolutionDlgLayout;
index fd7253b76e22edd6a31cfee198fc5e1f58b58ea1..6d603a53aae2637f8a04e53ddc8e8e625f32e896 100644 (file)
@@ -1,30 +1,30 @@
 //  SMESH SMESHGUI : GUI for SMESH component
 //
 //  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
-// 
-//  This library is free software; you can redistribute it and/or 
-//  modify it under the terms of the GNU Lesser General Public 
-//  License as published by the Free Software Foundation; either 
-//  version 2.1 of the License. 
-// 
-//  This library is distributed in the hope that it will be useful, 
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of 
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
-//  Lesser General Public License for more details. 
-// 
-//  You should have received a copy of the GNU Lesser General Public 
-//  License along with this library; if not, write to the Free Software 
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
-// 
-//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
 //
 //
 //
 //  File   : SMESHGUI_RotationDlg.cxx
 //  Author : Michael ZORIN
 //  Module : SMESH
-//  $Header: 
+//  $Header:
 
 #include "SMESHGUI_RotationDlg.h"
 
 #include "SMESHGUI_VTKUtils.h"
 #include "SMESHGUI_MeshUtils.h"
 #include "SMESHGUI_IdValidator.h"
+
 #include "SMESH_Actor.h"
 #include "SMESH_TypeFilter.hxx"
+#include "SMESH_LogicalFilter.hxx"
 #include "SMDS_Mesh.hxx"
 
-#include "QAD_Application.h"
-#include "QAD_Desktop.h"
-#include "QAD_MessageBox.h"
+#include "SUIT_Desktop.h"
+#include "SUIT_Session.h"
+
+#include "SVTK_ViewModel.h"
+#include "SVTK_ViewWindow.h"
+#include "SVTK_Selector.h"
+#include "SVTK_Selection.h"
+#include "SALOME_ListIO.hxx"
+
 #include "utilities.h"
 
+// OCCT Includes
+#include <TColStd_MapOfInteger.hxx>
+#include <TColStd_IndexedMapOfInteger.hxx>
+
 // QT Includes
 #include <qapplication.h>
 #include <qbuttongroup.h>
@@ -63,256 +75,262 @@ using namespace std;
 
 //=================================================================================
 // class    : SMESHGUI_RotationDlg()
-// purpose  : 
+// purpose  :
 //=================================================================================
-SMESHGUI_RotationDlg::SMESHGUI_RotationDlg( QWidget* parent, const char* name, SALOME_Selection* Sel,
-                                             bool modal, WFlags fl )
-  : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu |
-            Qt::WDestructiveClose)
+SMESHGUI_RotationDlg::SMESHGUI_RotationDlg( SMESHGUI* theModule, const char* name,
+                                            bool modal, WFlags fl)
+     : QDialog( SMESH::GetDesktop( theModule ), name, modal, WStyle_Customize | WStyle_NormalBorder |
+               WStyle_Title | WStyle_SysMenu | Qt::WDestructiveClose),
+     mySMESHGUI( theModule ),
+     mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ),
+     myViewWindow( SMESH::GetViewWindow( theModule ) ),
+     mySelector( myViewWindow->GetSelector() )
 {
-  QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "SMESH",tr("ICON_DLG_ROTATION")));
-  QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "SMESH",tr("ICON_SELECT")));
-
-  if ( !name )
-    setName( "SMESHGUI_RotationDlg" );
-  resize( 303, 185 ); 
-  setCaption( tr( "SMESH_ROTATION_TITLE" ) );
-  setSizeGripEnabled( TRUE );
-  SMESHGUI_RotationDlgLayout = new QGridLayout( this ); 
-  SMESHGUI_RotationDlgLayout->setSpacing( 6 );
-  SMESHGUI_RotationDlgLayout->setMargin( 11 );
+  QPixmap image0 (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_DLG_ROTATION")));
+  QPixmap image1 (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_SELECT")));
+
+  if (!name)
+    setName("SMESHGUI_RotationDlg");
+  resize(303, 185);
+  setCaption(tr("SMESH_ROTATION_TITLE"));
+  setSizeGripEnabled(TRUE);
+  SMESHGUI_RotationDlgLayout = new QGridLayout(this);
+  SMESHGUI_RotationDlgLayout->setSpacing(6);
+  SMESHGUI_RotationDlgLayout->setMargin(11);
 
   /***************************************************************/
-  GroupConstructors = new QButtonGroup( this, "GroupConstructors" );
-  GroupConstructors->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)0, 0, 0, GroupConstructors->sizePolicy().hasHeightForWidth() ) );
-  GroupConstructors->setTitle( tr( "SMESH_ROTATION"  ) );
-  GroupConstructors->setExclusive( TRUE );
-  GroupConstructors->setColumnLayout(0, Qt::Vertical );
-  GroupConstructors->layout()->setSpacing( 0 );
-  GroupConstructors->layout()->setMargin( 0 );
-  GroupConstructorsLayout = new QGridLayout( GroupConstructors->layout() );
-  GroupConstructorsLayout->setAlignment( Qt::AlignTop );
-  GroupConstructorsLayout->setSpacing( 6 );
-  GroupConstructorsLayout->setMargin( 11 );
-  RadioButton1= new QRadioButton( GroupConstructors, "RadioButton1" );
-  RadioButton1->setText( tr( ""  ) );
-  RadioButton1->setPixmap( image0 );
-  RadioButton1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, RadioButton1->sizePolicy().hasHeightForWidth() ) );
-  RadioButton1->setMinimumSize( QSize( 50, 0 ) );
-  GroupConstructorsLayout->addWidget( RadioButton1, 0, 0 );
-  QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
-  GroupConstructorsLayout->addItem( spacer, 0, 1 );
-  SMESHGUI_RotationDlgLayout->addWidget( GroupConstructors, 0, 0 );
-  
+  GroupConstructors = new QButtonGroup(this, "GroupConstructors");
+  GroupConstructors->setSizePolicy(QSizePolicy((QSizePolicy::SizeType)5,
+                                               (QSizePolicy::SizeType)0, 0, 0,
+                                               GroupConstructors->sizePolicy().hasHeightForWidth()));
+  GroupConstructors->setTitle(tr("SMESH_ROTATION"));
+  GroupConstructors->setExclusive(TRUE);
+  GroupConstructors->setColumnLayout(0, Qt::Vertical);
+  GroupConstructors->layout()->setSpacing(0);
+  GroupConstructors->layout()->setMargin(0);
+  GroupConstructorsLayout = new QGridLayout(GroupConstructors->layout());
+  GroupConstructorsLayout->setAlignment(Qt::AlignTop);
+  GroupConstructorsLayout->setSpacing(6);
+  GroupConstructorsLayout->setMargin(11);
+  RadioButton1= new QRadioButton(GroupConstructors, "RadioButton1");
+  RadioButton1->setText(tr("" ));
+  RadioButton1->setPixmap(image0);
+  RadioButton1->setSizePolicy(QSizePolicy((QSizePolicy::SizeType)1,
+                                          (QSizePolicy::SizeType)0,
+                                          RadioButton1->sizePolicy().hasHeightForWidth()));
+  RadioButton1->setMinimumSize(QSize(50, 0));
+  GroupConstructorsLayout->addWidget(RadioButton1, 0, 0);
+  QSpacerItem* spacer = new QSpacerItem(20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
+  GroupConstructorsLayout->addItem(spacer, 0, 1);
+  SMESHGUI_RotationDlgLayout->addWidget(GroupConstructors, 0, 0);
+
   /***************************************************************/
-  GroupButtons = new QGroupBox( this, "GroupButtons" );
-  GroupButtons->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, GroupButtons->sizePolicy().hasHeightForWidth() ) );
-  GroupButtons->setGeometry( QRect( 10, 10, 281, 48 ) ); 
-  GroupButtons->setTitle( tr( ""  ) );
-  GroupButtons->setColumnLayout(0, Qt::Vertical );
-  GroupButtons->layout()->setSpacing( 0 );
-  GroupButtons->layout()->setMargin( 0 );
-  GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
-  GroupButtonsLayout->setAlignment( Qt::AlignTop );
-  GroupButtonsLayout->setSpacing( 6 );
-  GroupButtonsLayout->setMargin( 11 );
-  buttonCancel = new QPushButton( GroupButtons, "buttonCancel" );
-  buttonCancel->setText( tr( "SMESH_BUT_CLOSE"  ) );
-  buttonCancel->setAutoDefault( TRUE );
-  GroupButtonsLayout->addWidget( buttonCancel, 0, 3 );
-  buttonApply = new QPushButton( GroupButtons, "buttonApply" );
-  buttonApply->setText( tr( "SMESH_BUT_APPLY"  ) );
-  buttonApply->setAutoDefault( TRUE );
-  GroupButtonsLayout->addWidget( buttonApply, 0, 1 );
-  QSpacerItem* spacer_9 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
-  GroupButtonsLayout->addItem( spacer_9, 0, 2 );
-  buttonOk = new QPushButton( GroupButtons, "buttonOk" );
-  buttonOk->setText( tr( "SMESH_BUT_OK"  ) );
-  buttonOk->setAutoDefault( TRUE );
-  buttonOk->setDefault( TRUE );
-  GroupButtonsLayout->addWidget( buttonOk, 0, 0 );
-  SMESHGUI_RotationDlgLayout->addWidget( GroupButtons, 2, 0 );
+  GroupButtons = new QGroupBox(this, "GroupButtons");
+  GroupButtons->setSizePolicy(QSizePolicy((QSizePolicy::SizeType)7,
+                                          (QSizePolicy::SizeType)0, 0, 0,
+                                          GroupButtons->sizePolicy().hasHeightForWidth()));
+  GroupButtons->setGeometry(QRect(10, 10, 281, 48));
+  GroupButtons->setTitle(tr("" ));
+  GroupButtons->setColumnLayout(0, Qt::Vertical);
+  GroupButtons->layout()->setSpacing(0);
+  GroupButtons->layout()->setMargin(0);
+  GroupButtonsLayout = new QGridLayout(GroupButtons->layout());
+  GroupButtonsLayout->setAlignment(Qt::AlignTop);
+  GroupButtonsLayout->setSpacing(6);
+  GroupButtonsLayout->setMargin(11);
+  buttonCancel = new QPushButton(GroupButtons, "buttonCancel");
+  buttonCancel->setText(tr("SMESH_BUT_CLOSE"));
+  buttonCancel->setAutoDefault(TRUE);
+  GroupButtonsLayout->addWidget(buttonCancel, 0, 3);
+  buttonApply = new QPushButton(GroupButtons, "buttonApply");
+  buttonApply->setText(tr("SMESH_BUT_APPLY"));
+  buttonApply->setAutoDefault(TRUE);
+  GroupButtonsLayout->addWidget(buttonApply, 0, 1);
+  QSpacerItem* spacer_9 = new QSpacerItem(20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
+  GroupButtonsLayout->addItem(spacer_9, 0, 2);
+  buttonOk = new QPushButton(GroupButtons, "buttonOk");
+  buttonOk->setText(tr("SMESH_BUT_OK"));
+  buttonOk->setAutoDefault(TRUE);
+  buttonOk->setDefault(TRUE);
+  GroupButtonsLayout->addWidget(buttonOk, 0, 0);
+  SMESHGUI_RotationDlgLayout->addWidget(GroupButtons, 2, 0);
 
   /***************************************************************/
-  GroupArguments = new QGroupBox( this, "GroupArguments" );
-  GroupArguments->setTitle( tr( "SMESH_ARGUMENTS" ) );
-  GroupArguments->setColumnLayout(0, Qt::Vertical );
-  GroupArguments->layout()->setSpacing( 0 );
-  GroupArguments->layout()->setMargin( 0 );
-  GroupArgumentsLayout = new QGridLayout( GroupArguments->layout() );
-  GroupArgumentsLayout->setAlignment( Qt::AlignTop );
-  GroupArgumentsLayout->setSpacing( 6 );
-  GroupArgumentsLayout->setMargin( 11 );
+  GroupArguments = new QGroupBox(this, "GroupArguments");
+  GroupArguments->setTitle(tr("SMESH_ARGUMENTS"));
+  GroupArguments->setColumnLayout(0, Qt::Vertical);
+  GroupArguments->layout()->setSpacing(0);
+  GroupArguments->layout()->setMargin(0);
+  GroupArgumentsLayout = new QGridLayout(GroupArguments->layout());
+  GroupArgumentsLayout->setAlignment(Qt::AlignTop);
+  GroupArgumentsLayout->setSpacing(6);
+  GroupArgumentsLayout->setMargin(11);
 
   // Controls for elements selection
-  TextLabelElements  = new QLabel( GroupArguments, "TextLabelElements" );
-  TextLabelElements->setText( tr( "SMESH_ID_ELEMENTS"  ) );
+  TextLabelElements  = new QLabel(GroupArguments, "TextLabelElements");
+  TextLabelElements->setText(tr("SMESH_ID_ELEMENTS" ));
   TextLabelElements->setFixedWidth(74);
-  GroupArgumentsLayout->addWidget( TextLabelElements, 0, 0 );
+  GroupArgumentsLayout->addWidget(TextLabelElements, 0, 0);
 
-  SelectElementsButton  = new QPushButton( GroupArguments, "SelectElementsButton" );
-  SelectElementsButton->setText( tr( ""  ) );
-  SelectElementsButton->setPixmap( image1 );
-  SelectElementsButton->setToggleButton( FALSE );
-  GroupArgumentsLayout->addWidget( SelectElementsButton, 0, 1 );
+  SelectElementsButton  = new QPushButton(GroupArguments, "SelectElementsButton");
+  SelectElementsButton->setText(tr("" ));
+  SelectElementsButton->setPixmap(image1);
+  SelectElementsButton->setToggleButton(FALSE);
+  GroupArgumentsLayout->addWidget(SelectElementsButton, 0, 1);
 
-  LineEditElements  = new QLineEdit( GroupArguments, "LineEditElements" );
-  LineEditElements->setValidator( new SMESHGUI_IdValidator( this, "validator" ));
-  GroupArgumentsLayout->addWidget( LineEditElements, 0, 2 );
+  LineEditElements  = new QLineEdit(GroupArguments, "LineEditElements");
+  LineEditElements->setValidator(new SMESHGUI_IdValidator(this, "validator"));
+  GroupArgumentsLayout->addWidget(LineEditElements, 0, 2);
 
   // Control for the whole mesh selection
-  CheckBoxMesh = new QCheckBox( GroupArguments, "CheckBoxMesh" );
-  CheckBoxMesh->setText( tr( "SMESH_SELECT_WHOLE_MESH"  ) );
-  GroupArgumentsLayout->addMultiCellWidget( CheckBoxMesh, 1, 1, 0, 2 );
-  
+  CheckBoxMesh = new QCheckBox(GroupArguments, "CheckBoxMesh");
+  CheckBoxMesh->setText(tr("SMESH_SELECT_WHOLE_MESH" ));
+  GroupArgumentsLayout->addMultiCellWidget(CheckBoxMesh, 1, 1, 0, 2);
+
   // Controls for axis defining
-  GroupAxis = new QGroupBox( GroupArguments, "GroupAxis" );
-  GroupAxis->setTitle( tr( "SMESH_AXIS" ) );
-  GroupAxis->setColumnLayout(0, Qt::Vertical );
-  GroupAxis->layout()->setSpacing( 0 );
-  GroupAxis->layout()->setMargin( 0 );
-  QGridLayout* GroupAxisLayout = new QGridLayout( GroupAxis->layout() );
-  GroupAxisLayout->setAlignment( Qt::AlignTop );
-  GroupAxisLayout->setSpacing( 6 );
-  GroupAxisLayout->setMargin( 11 );
-  
-  TextLabelPoint = new QLabel( GroupAxis, "TextLabelPoint" );
-  TextLabelPoint->setText( tr( "SMESH_POINT" ) );
-  GroupAxisLayout->addWidget( TextLabelPoint, 0, 0 );
-
-  SelectPointButton  = new QPushButton( GroupAxis, "SelectPointButton" );
-  SelectPointButton->setPixmap( image1 );
-  GroupAxisLayout->addWidget( SelectPointButton, 0, 1 );
-  
-  TextLabelX = new QLabel( GroupAxis, "TextLabelX" );
-  TextLabelX->setText( tr( "SMESH_X" ) );
-  GroupAxisLayout->addWidget( TextLabelX, 0, 2 );
-
-  SpinBox_X = new SMESHGUI_SpinBox( GroupAxis, "SpinBox_X");
-  GroupAxisLayout->addWidget( SpinBox_X, 0, 3 );
-  
-  TextLabelY = new QLabel( GroupAxis, "TextLabelY" );
-  TextLabelY->setText( tr( "SMESH_Y" ) );
-  GroupAxisLayout->addWidget( TextLabelY, 0, 4 );
-
-  SpinBox_Y = new SMESHGUI_SpinBox( GroupAxis, "SpinBox_Y");
-  GroupAxisLayout->addWidget( SpinBox_Y, 0, 5 );
-
-  TextLabelZ = new QLabel( GroupAxis, "TextLabelZ" );
-  TextLabelZ->setText( tr( "SMESH_Z" ) );
-  GroupAxisLayout->addWidget( TextLabelZ, 0, 6 );
-  
-  SpinBox_Z = new SMESHGUI_SpinBox( GroupAxis, "SpinBox_Z");
-  GroupAxisLayout->addWidget( SpinBox_Z, 0, 7 );
-
-  TextLabelVector = new QLabel( GroupAxis, "TextLabelVector" );
-  TextLabelVector->setText( tr( "SMESH_VECTOR" ) );
-  GroupAxisLayout->addWidget( TextLabelVector, 1, 0 );
-  
-  SelectVectorButton = new QPushButton( GroupAxis, "SelectVectorButton" );
-  SelectVectorButton->setPixmap( image1 );
-  GroupAxisLayout->addWidget( SelectVectorButton, 1, 1 );
-  
-  TextLabelDX = new QLabel( GroupAxis, "TextLabelDX" );
-  TextLabelDX->setText( tr( "SMESH_DX" ) );
-  GroupAxisLayout->addWidget( TextLabelDX, 1, 2 );
-
-  SpinBox_DX = new SMESHGUI_SpinBox( GroupAxis, "SpinBox_DX");
-  GroupAxisLayout->addWidget( SpinBox_DX, 1, 3 );
-  
-  TextLabelDY = new QLabel( GroupAxis, "TextLabelDY" );
-  TextLabelDY->setText( tr( "SMESH_DY" ) );
-  GroupAxisLayout->addWidget( TextLabelDY, 1, 4 );
-
-  SpinBox_DY = new SMESHGUI_SpinBox( GroupAxis, "SpinBox_DY");
-  GroupAxisLayout->addWidget( SpinBox_DY, 1, 5 );
-
-  TextLabelDZ = new QLabel( GroupAxis, "TextLabelDZ" );
-  TextLabelDZ->setText( tr( "SMESH_DZ" ) );
-  GroupAxisLayout->addWidget( TextLabelDZ, 1, 6 );
-  
-  SpinBox_DZ = new SMESHGUI_SpinBox( GroupAxis, "SpinBox_DZ");
-  GroupAxisLayout->addWidget( SpinBox_DZ, 1, 7 );
-
-  GroupArgumentsLayout->addMultiCellWidget( GroupAxis, 2, 2, 0, 2 );
-    
+  GroupAxis = new QGroupBox(GroupArguments, "GroupAxis");
+  GroupAxis->setTitle(tr("SMESH_AXIS"));
+  GroupAxis->setColumnLayout(0, Qt::Vertical);
+  GroupAxis->layout()->setSpacing(0);
+  GroupAxis->layout()->setMargin(0);
+  QGridLayout* GroupAxisLayout = new QGridLayout(GroupAxis->layout());
+  GroupAxisLayout->setAlignment(Qt::AlignTop);
+  GroupAxisLayout->setSpacing(6);
+  GroupAxisLayout->setMargin(11);
+
+  TextLabelPoint = new QLabel(GroupAxis, "TextLabelPoint");
+  TextLabelPoint->setText(tr("SMESH_POINT"));
+  GroupAxisLayout->addWidget(TextLabelPoint, 0, 0);
+
+  SelectPointButton  = new QPushButton(GroupAxis, "SelectPointButton");
+  SelectPointButton->setPixmap(image1);
+  GroupAxisLayout->addWidget(SelectPointButton, 0, 1);
+
+  TextLabelX = new QLabel(GroupAxis, "TextLabelX");
+  TextLabelX->setText(tr("SMESH_X"));
+  GroupAxisLayout->addWidget(TextLabelX, 0, 2);
+
+  SpinBox_X = new SMESHGUI_SpinBox(GroupAxis, "SpinBox_X");
+  GroupAxisLayout->addWidget(SpinBox_X, 0, 3);
+
+  TextLabelY = new QLabel(GroupAxis, "TextLabelY");
+  TextLabelY->setText(tr("SMESH_Y"));
+  GroupAxisLayout->addWidget(TextLabelY, 0, 4);
+
+  SpinBox_Y = new SMESHGUI_SpinBox(GroupAxis, "SpinBox_Y");
+  GroupAxisLayout->addWidget(SpinBox_Y, 0, 5);
+
+  TextLabelZ = new QLabel(GroupAxis, "TextLabelZ");
+  TextLabelZ->setText(tr("SMESH_Z"));
+  GroupAxisLayout->addWidget(TextLabelZ, 0, 6);
+
+  SpinBox_Z = new SMESHGUI_SpinBox(GroupAxis, "SpinBox_Z");
+  GroupAxisLayout->addWidget(SpinBox_Z, 0, 7);
+
+  TextLabelVector = new QLabel(GroupAxis, "TextLabelVector");
+  TextLabelVector->setText(tr("SMESH_VECTOR"));
+  GroupAxisLayout->addWidget(TextLabelVector, 1, 0);
+
+  SelectVectorButton = new QPushButton(GroupAxis, "SelectVectorButton");
+  SelectVectorButton->setPixmap(image1);
+  GroupAxisLayout->addWidget(SelectVectorButton, 1, 1);
+
+  TextLabelDX = new QLabel(GroupAxis, "TextLabelDX");
+  TextLabelDX->setText(tr("SMESH_DX"));
+  GroupAxisLayout->addWidget(TextLabelDX, 1, 2);
+
+  SpinBox_DX = new SMESHGUI_SpinBox(GroupAxis, "SpinBox_DX");
+  GroupAxisLayout->addWidget(SpinBox_DX, 1, 3);
+
+  TextLabelDY = new QLabel(GroupAxis, "TextLabelDY");
+  TextLabelDY->setText(tr("SMESH_DY"));
+  GroupAxisLayout->addWidget(TextLabelDY, 1, 4);
+
+  SpinBox_DY = new SMESHGUI_SpinBox(GroupAxis, "SpinBox_DY");
+  GroupAxisLayout->addWidget(SpinBox_DY, 1, 5);
+
+  TextLabelDZ = new QLabel(GroupAxis, "TextLabelDZ");
+  TextLabelDZ->setText(tr("SMESH_DZ"));
+  GroupAxisLayout->addWidget(TextLabelDZ, 1, 6);
+
+  SpinBox_DZ = new SMESHGUI_SpinBox(GroupAxis, "SpinBox_DZ");
+  GroupAxisLayout->addWidget(SpinBox_DZ, 1, 7);
+
+  GroupArgumentsLayout->addMultiCellWidget(GroupAxis, 2, 2, 0, 2);
+
   // Controls for angle defining
-  TextLabelAngle = new QLabel( GroupArguments, "TextLabelAngle" );
-  TextLabelAngle->setText( tr( "SMESH_ANGLE"  ) );
-  GroupArgumentsLayout->addMultiCellWidget( TextLabelAngle, 3, 3, 0, 1 );
+  TextLabelAngle = new QLabel(GroupArguments, "TextLabelAngle");
+  TextLabelAngle->setText(tr("SMESH_ANGLE"));
+  GroupArgumentsLayout->addMultiCellWidget(TextLabelAngle, 3, 3, 0, 1);
 
   SpinBox_Angle = new SMESHGUI_SpinBox(GroupArguments, "SpinBox_Angle");
-  GroupArgumentsLayout->addWidget( SpinBox_Angle, 3, 2 );
+  GroupArgumentsLayout->addWidget(SpinBox_Angle, 3, 2);
 
   // Controls for "Create a copy" option
-  CheckBoxCopy = new QCheckBox( GroupArguments, "CheckBoxCopy" );
-  CheckBoxCopy->setText( tr( "SMESH_CREATE_COPY" ) );
-  GroupArgumentsLayout->addMultiCellWidget( CheckBoxCopy, 4, 4, 0, 2 );
-  
+  CheckBoxCopy = new QCheckBox(GroupArguments, "CheckBoxCopy");
+  CheckBoxCopy->setText(tr("SMESH_CREATE_COPY"));
+  GroupArgumentsLayout->addMultiCellWidget(CheckBoxCopy, 4, 4, 0, 2);
+
+  SMESHGUI_RotationDlgLayout->addWidget(GroupArguments, 1, 0);
 
-  SMESHGUI_RotationDlgLayout->addWidget( GroupArguments, 1, 0 );
-  
   /* Initialisations */
-  SpinBox_X->RangeStepAndValidator( -999999.999, +999999.999, 10.0, 3 );
-  SpinBox_Y->RangeStepAndValidator( -999999.999, +999999.999, 10.0, 3 );
-  SpinBox_Z->RangeStepAndValidator( -999999.999, +999999.999, 10.0, 3 );
-  SpinBox_DX->RangeStepAndValidator( -999999.999, +999999.999, 10.0, 3 );
-  SpinBox_DY->RangeStepAndValidator( -999999.999, +999999.999, 10.0, 3 );
-  SpinBox_DZ->RangeStepAndValidator( -999999.999, +999999.999, 10.0, 3 );
-
-  SpinBox_Angle->RangeStepAndValidator( -999999.999, +999999.999, 5.0, 3 );
-  
+  SpinBox_X->RangeStepAndValidator(-999999.999, +999999.999, 10.0, 3);
+  SpinBox_Y->RangeStepAndValidator(-999999.999, +999999.999, 10.0, 3);
+  SpinBox_Z->RangeStepAndValidator(-999999.999, +999999.999, 10.0, 3);
+  SpinBox_DX->RangeStepAndValidator(-999999.999, +999999.999, 10.0, 3);
+  SpinBox_DY->RangeStepAndValidator(-999999.999, +999999.999, 10.0, 3);
+  SpinBox_DZ->RangeStepAndValidator(-999999.999, +999999.999, 10.0, 3);
+
+  SpinBox_Angle->RangeStepAndValidator(-999999.999, +999999.999, 5.0, 3);
+
   GroupArguments->show();
-  myConstructorId = 0 ;
-  RadioButton1->setChecked( TRUE );
-  mySelection = Sel;  
-  
-  mySMESHGUI  = SMESHGUI::GetSMESHGUI() ;
-  mySMESHGUI->SetActiveDialogBox( (QDialog*)this ) ;
+  myConstructorId = 0;
+  RadioButton1->setChecked(TRUE);
+
+  mySMESHGUI->SetActiveDialogBox((QDialog*)this);
 
   // Costruction of the logical filter
-  SMESH_ListOfFilter aListOfFilters;
-  Handle(SMESH_TypeFilter) aMeshOrSubMeshFilter = new SMESH_TypeFilter( MESHorSUBMESH );
-  if ( !aMeshOrSubMeshFilter.IsNull() )
-    aListOfFilters.Append( aMeshOrSubMeshFilter );
-  Handle(SMESH_TypeFilter) aSmeshGroupFilter = new SMESH_TypeFilter( GROUP );
-  if ( !aSmeshGroupFilter.IsNull() )
-    aListOfFilters.Append( aSmeshGroupFilter );
-  
-  myMeshOrSubMeshOrGroupFilter = new SMESH_LogicalFilter( aListOfFilters, SMESH_LogicalFilter::LO_OR );
-  
+  SMESH_TypeFilter* aMeshOrSubMeshFilter = new SMESH_TypeFilter (MESHorSUBMESH);
+  SMESH_TypeFilter* aSmeshGroupFilter    = new SMESH_TypeFilter (GROUP);
+
+  QPtrList<SUIT_SelectionFilter> aListOfFilters;
+  if (aMeshOrSubMeshFilter) aListOfFilters.append(aMeshOrSubMeshFilter);
+  if (aSmeshGroupFilter)    aListOfFilters.append(aSmeshGroupFilter);
+
+  myMeshOrSubMeshOrGroupFilter =
+    new SMESH_LogicalFilter (aListOfFilters, SMESH_LogicalFilter::LO_OR);
+
   Init();
+
   /* signals and slots connections */
-  connect( buttonOk, SIGNAL( clicked() ),     this, SLOT( ClickOnOk() ) );
-  connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ) ;
-  connect( buttonApply, SIGNAL( clicked() ),  this, SLOT(ClickOnApply() ) );
-  connect( GroupConstructors, SIGNAL(clicked(int) ), SLOT( ConstructorsClicked(int) ) );
-  
-  connect( SelectElementsButton, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ;
-  connect( SelectPointButton, SIGNAL (clicked() ),    this, SLOT( SetEditCurrentArgument() ) ) ;
-  connect( SelectVectorButton, SIGNAL (clicked() ),   this, SLOT( SetEditCurrentArgument() ) ) ;
-  
-  connect( SpinBox_DX, SIGNAL( valueChanged( double )), this, SLOT(onVectorChanged() ) );
-  connect( SpinBox_DY, SIGNAL( valueChanged( double )), this, SLOT(onVectorChanged() ) );
-  connect( SpinBox_DZ, SIGNAL( valueChanged( double )), this, SLOT(onVectorChanged() ) );
-  
-  connect( mySMESHGUI, SIGNAL ( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ;
-  connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
+  connect(buttonOk, SIGNAL(clicked()),     this, SLOT(ClickOnOk()));
+  connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel()));
+  connect(buttonApply, SIGNAL(clicked()),  this, SLOT(ClickOnApply()));
+  connect(GroupConstructors, SIGNAL(clicked(int)), SLOT(ConstructorsClicked(int)));
+
+  connect(SelectElementsButton, SIGNAL (clicked()), this, SLOT(SetEditCurrentArgument()));
+  connect(SelectPointButton, SIGNAL (clicked()),    this, SLOT(SetEditCurrentArgument()));
+  connect(SelectVectorButton, SIGNAL (clicked()),   this, SLOT(SetEditCurrentArgument()));
+
+  connect(SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(onVectorChanged()));
+  connect(SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(onVectorChanged()));
+  connect(SpinBox_DZ, SIGNAL(valueChanged(double)), this, SLOT(onVectorChanged()));
+
+  connect(mySMESHGUI, SIGNAL (SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog()));
+  connect(mySelectionMgr, SIGNAL(currentSelectionChanged()),   this, SLOT(SelectionIntoArgument()));
   /* to close dialog if study change */
-  connect( mySMESHGUI, SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ) ;
-  connect( LineEditElements, SIGNAL( textChanged( const QString& )),
-           SLOT( onTextChange( const QString& )));
-  connect( CheckBoxMesh, SIGNAL( toggled( bool )),
-           SLOT( onSelectMesh( bool )));
-  
+  connect(mySMESHGUI,       SIGNAL (SignalCloseAllDialogs()), this, SLOT(ClickOnCancel()));
+  connect(LineEditElements, SIGNAL(textChanged(const QString&)),    SLOT(onTextChange(const QString&)));
+  connect(CheckBoxMesh,     SIGNAL(toggled(bool)),                  SLOT(onSelectMesh(bool)));
+
   /* Move widget on the botton right corner of main widget */
-  int x, y ;
-  mySMESHGUI->DefineDlgPosition( this, x, y ) ;
-  this->move( x, y ) ;
-  this->show() ; /* displays Dialog */
+  int x, y;
+  mySMESHGUI->DefineDlgPosition(this, x, y);
+  this->move(x, y);
+  this->show(); /* displays Dialog */
 
   ConstructorsClicked(0);
-  resize(0,0);
+  resize(0,0); // ??
 }
 
 //=================================================================================
@@ -324,101 +342,92 @@ SMESHGUI_RotationDlg::~SMESHGUI_RotationDlg()
   // no need to delete child widgets, Qt does it all for us
 }
 
-
 //=================================================================================
 // function : Init()
 // purpose  :
 //=================================================================================
-void SMESHGUI_RotationDlg::Init( bool ResetControls )
+void SMESHGUI_RotationDlg::Init (bool ResetControls)
 {
   myBusy = false;
-  
+
   myEditCurrentArgument = (QWidget*)LineEditElements;
   LineEditElements->setFocus();
   myElementsId = "";
-  myNbOkElements = 0 ;
-  
-  buttonOk->setEnabled( false );
-  buttonApply->setEnabled( false );
-  
-  myActor     = 0;
+  myNbOkElements = 0;
+
+  buttonOk->setEnabled(false);
+  buttonApply->setEnabled(false);
+
+  myActor = 0;
   myMesh = SMESH::SMESH_Mesh::_nil();
-  
-  if( ResetControls )
-    {
-      SpinBox_X->SetValue(0.0);
-      SpinBox_Y->SetValue(0.0);
-      SpinBox_Z->SetValue(0.0);
-      SpinBox_DX->SetValue(0.0);
-      SpinBox_DY->SetValue(0.0);
-      SpinBox_DZ->SetValue(0.0);
-      
-      SpinBox_Angle->SetValue(45);
-      
-      CheckBoxCopy->setChecked(false);
-      CheckBoxMesh->setChecked(false);
-    }
-  
+
+  if (ResetControls) {
+    SpinBox_X->SetValue(0.0);
+    SpinBox_Y->SetValue(0.0);
+    SpinBox_Z->SetValue(0.0);
+    SpinBox_DX->SetValue(0.0);
+    SpinBox_DY->SetValue(0.0);
+    SpinBox_DZ->SetValue(0.0);
+
+    SpinBox_Angle->SetValue(45);
+
+    CheckBoxCopy->setChecked(false);
+    CheckBoxMesh->setChecked(false);
+  }
+
   onSelectMesh(CheckBoxMesh->isChecked());
 }
 
-
 //=================================================================================
 // function : ConstructorsClicked()
 // purpose  : Radio button management
 //=================================================================================
-void SMESHGUI_RotationDlg::ConstructorsClicked(int constructorId)
+void SMESHGUI_RotationDlg::ConstructorsClicked (int constructorId)
 {
-  return ;
 }
 
-
 //=================================================================================
 // function : ClickOnApply()
 // purpose  :
 //=================================================================================
 void SMESHGUI_RotationDlg::ClickOnApply()
 {
-  if (mySMESHGUI->ActiveStudyLocked())
+  if (mySMESHGUI->isActiveStudyLocked())
     return;
-  
-  if ( myNbOkElements  && IsAxisOk())
-    {
-      QStringList aListElementsId = QStringList::split( " ", myElementsId, false);
-      
-      SMESH::long_array_var anElementsId = new SMESH::long_array;
-      
-      anElementsId->length( aListElementsId.count() );
-      for ( int i = 0; i < aListElementsId.count(); i++ )
-       anElementsId[i] = aListElementsId[i].toInt();
-      
-      SMESH::AxisStruct anAxis;
-      
-      anAxis.x =  SpinBox_X->GetValue();
-      anAxis.y =  SpinBox_Y->GetValue();
-      anAxis.z =  SpinBox_Z->GetValue();;
-      anAxis.vx = SpinBox_DX->GetValue();
-      anAxis.vy = SpinBox_DY->GetValue();
-      anAxis.vz = SpinBox_DZ->GetValue();
-
-      double anAngle = (SpinBox_Angle->GetValue())*PI/180; 
-      bool toCreateCopy = CheckBoxCopy->isChecked();
-      
-      try
-       {
-         SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
-         QApplication::setOverrideCursor(Qt::waitCursor);
-         aMeshEditor->Rotate(anElementsId.inout(), anAxis, anAngle, toCreateCopy);
-         QApplication::restoreOverrideCursor();
-       }
-      catch( ... )
-       {
-       }
-      
-      mySelection->ClearIObjects();
-      SMESH::UpdateView();
-      Init( false );
+
+  if (myNbOkElements && IsAxisOk()) {
+    QStringList aListElementsId = QStringList::split(" ", myElementsId, false);
+
+    SMESH::long_array_var anElementsId = new SMESH::long_array;
+
+    anElementsId->length(aListElementsId.count());
+    for (int i = 0; i < aListElementsId.count(); i++)
+      anElementsId[i] = aListElementsId[i].toInt();
+
+    SMESH::AxisStruct anAxis;
+
+    anAxis.x =  SpinBox_X->GetValue();
+    anAxis.y =  SpinBox_Y->GetValue();
+    anAxis.z =  SpinBox_Z->GetValue();;
+    anAxis.vx = SpinBox_DX->GetValue();
+    anAxis.vy = SpinBox_DY->GetValue();
+    anAxis.vz = SpinBox_DZ->GetValue();
+
+    double anAngle = (SpinBox_Angle->GetValue())*PI/180;
+    bool toCreateCopy = CheckBoxCopy->isChecked();
+
+    try {
+      SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
+      QApplication::setOverrideCursor(Qt::waitCursor);
+      aMeshEditor->Rotate(anElementsId.inout(), anAxis, anAngle, toCreateCopy);
+      QApplication::restoreOverrideCursor();
+    } catch (...) {
     }
+
+    mySelectionMgr->clearSelected();
+    SMESH::UpdateView();
+    Init(false);
+  }
 }
 
 //=================================================================================
@@ -431,70 +440,82 @@ void SMESHGUI_RotationDlg::ClickOnOk()
   ClickOnCancel();
 }
 
-       
 //=================================================================================
 // function : ClickOnCancel()
 // purpose  :
 //=================================================================================
 void SMESHGUI_RotationDlg::ClickOnCancel()
 {
-  mySelection->ClearFilters();
-  mySelection->ClearIObjects();
+  disconnect(mySelectionMgr, 0, this, 0);
+  mySelectionMgr->clearFilters();
+  mySelectionMgr->clearSelected();
   SMESH::SetPointRepresentation(false);
-  QAD_Application::getDesktop()->SetSelectionMode( ActorSelection );
-  disconnect( mySelection, 0, this, 0 );
-  mySMESHGUI->ResetState() ;
-  reject() ;
+  myViewWindow->SetSelectionMode(ActorSelection);
+  mySMESHGUI->ResetState();
+  reject();
 }
 
 //=======================================================================
-//function : onTextChange
-//purpose  : 
+// function : onTextChange()
+// purpose  :
 //=======================================================================
-
-void SMESHGUI_RotationDlg::onTextChange(const QString& theNewText)
+void SMESHGUI_RotationDlg::onTextChange (const QString& theNewText)
 {
   QLineEdit* send = (QLineEdit*)sender();
 
-  if ( myBusy ) return;
+  if (myBusy) return;
   myBusy = true;
-  
+
   if (send == LineEditElements)
     myNbOkElements = 0;
-  
-  buttonOk->setEnabled( false );
-  buttonApply->setEnabled( false );
-  
+
+  buttonOk->setEnabled(false);
+  buttonApply->setEnabled(false);
+
   // hilight entered elements
   SMDS_Mesh* aMesh = 0;
-  if ( myActor )
+  if (myActor)
     aMesh = myActor->GetObject()->GetMesh();
-  
-  if ( aMesh ) {
-    
-    mySelection->ClearIObjects();
-    mySelection->AddIObject( myActor->getIO() );
-    
-    QStringList aListId = QStringList::split( " ", theNewText, false);
-    
+
+  if (aMesh) {
     if (send == LineEditElements) {
-      for ( int i = 0; i < aListId.count(); i++ ) {
-       const SMDS_MeshElement * e = aMesh->FindElement( aListId[ i ].toInt() );
-       if ( e ) {
-         if ( !mySelection->IsIndexSelected( myActor->getIO(), e->GetID() ))
-           mySelection->AddOrRemoveIndex (myActor->getIO(), e->GetID(), true);
+      //mySelectionMgr->clearSelected();
+      //mySelectionMgr->AddIObject(myActor->getIO());
+      SALOME_ListIO aList;
+      aList.Append(myActor->getIO());
+      mySelectionMgr->setSelectedObjects(aList, false);
+
+      TColStd_IndexedMapOfInteger selectedIndices;
+      TColStd_MapOfInteger newIndices;
+      mySelector->GetIndex( myActor->getIO(), selectedIndices);
+
+      QStringList aListId = QStringList::split(" ", theNewText, false);
+      for (int i = 0; i < aListId.count(); i++) {
+       const SMDS_MeshElement * e = aMesh->FindElement(aListId[ i ].toInt());
+       if (e) {
+         //if (!mySelectionMgr->IsIndexSelected(myActor->getIO(), e->GetID())) {
+          if (selectedIndices.Add(e->GetID())) {
+           //mySelectionMgr->AddOrRemoveIndex (myActor->getIO(), e->GetID(), true);
+            newIndices.Add(e->GetID());
+          }
          myNbOkElements++;
        }
       }
+
+      if (newIndices.Extent() > 0){
+       mySelector->AddOrRemoveIndex( myActor->getIO(), newIndices, true );
+       myViewWindow->highlight( myActor->getIO(), true, true );
+      }
+
       myElementsId = theNewText;
     }
   }
-  
-  if ( myNbOkElements && IsAxisOk()) {
-    buttonOk->setEnabled( true );
-    buttonApply->setEnabled( true );
+
+  if (myNbOkElements && IsAxisOk()) {
+    buttonOk->setEnabled(true);
+    buttonApply->setEnabled(true);
   }
-  
+
   myBusy = false;
 }
 
@@ -504,34 +525,35 @@ void SMESHGUI_RotationDlg::onTextChange(const QString& theNewText)
 //=================================================================================
 void SMESHGUI_RotationDlg::SelectionIntoArgument()
 {
-  if ( myBusy ) return;
-  
+  if (myBusy) return;
+
   // clear
-  
   myActor = 0;
   QString aString = "";
 
   myBusy = true;
-  if (myEditCurrentArgument == (QWidget*)LineEditElements)
-    {
-      LineEditElements->setText( aString );
-      myNbOkElements = 0;
-      buttonOk->setEnabled( false );
-      buttonApply->setEnabled( false );
-    }
+  if (myEditCurrentArgument == (QWidget*)LineEditElements) {
+    LineEditElements->setText(aString);
+    myNbOkElements = 0;
+    buttonOk->setEnabled(false);
+    buttonApply->setEnabled(false);
+  }
   myBusy = false;
-  
-  if ( !GroupButtons->isEnabled() ) // inactive
+
+  if (!GroupButtons->isEnabled()) // inactive
     return;
-  
+
   // get selected mesh
-  int nbSel = mySelection->IObjectCount();
-  if(nbSel != 1)
+  SALOME_ListIO aList;
+  mySelectionMgr->selectedObjects(aList,SVTK_Viewer::Type());
+
+  int nbSel = aList.Extent();
+  if (nbSel != 1)
     return;
-  
-  Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject();
-  myMesh = SMESH::GetMeshByIO( mySelection->firstIObject() );
-  if(myMesh->_is_nil())
+
+  Handle(SALOME_InteractiveObject) IO = aList.First();
+  myMesh = SMESH::GetMeshByIO(IO);
+  if (myMesh->_is_nil())
     return;
 
   myActor = SMESH::FindActorByObject(myMesh);
@@ -539,119 +561,103 @@ void SMESHGUI_RotationDlg::SelectionIntoArgument()
     myActor = SMESH::FindActorByEntry(IO->getEntry());
   if (!myActor)
     return;
-  
+
   int aNbUnits = 0;
-  
-  if (myEditCurrentArgument == (QWidget*)LineEditElements)
-    {
-      myElementsId = "";
-      
-      if (CheckBoxMesh->isChecked())
-       {
-         SMESH::GetNameOfSelectedIObjects(mySelection, aString);
-         
-         if(!SMESH::IObjectToInterface<SMESH::SMESH_Mesh>(IO)->_is_nil()) //MESH
-           {
-             // get IDs from mesh
-             SMDS_Mesh* aSMDSMesh = myActor->GetObject()->GetMesh();
-             if (!aSMDSMesh)
-               return;
-             
-             for (int i = aSMDSMesh->MinElementID(); i <= aSMDSMesh->MaxElementID(); i++  )
-               {
-                 const SMDS_MeshElement * e = aSMDSMesh->FindElement( i );
-                 if ( e ) {
-                   myElementsId += QString(" %1").arg(i);
-                   aNbUnits++;
-                 }
-               }
-           }
-         else if (!SMESH::IObjectToInterface<SMESH::SMESH_subMesh>(IO)->_is_nil()) //SUBMESH
-           {
-             // get submesh
-             SMESH::SMESH_subMesh_var aSubMesh = SMESH::IObjectToInterface<SMESH::SMESH_subMesh>(IO) ;
-             
-             // get IDs from submesh
-             SMESH::long_array_var anElementsIds = new SMESH::long_array;
-             anElementsIds = aSubMesh->GetElementsId();
-             for ( int i = 0; i < anElementsIds->length(); i++ )
-               myElementsId += QString(" %1").arg(anElementsIds[i]);
-             aNbUnits = anElementsIds->length();
-           }
-         else // GROUP
-           {
-             // get smesh group
-             SMESH::SMESH_GroupBase_var aGroup =
-                SMESH::IObjectToInterface<SMESH::SMESH_GroupBase>(IO);
-             if (aGroup->_is_nil())
-               return;
-             
-             // get IDs from smesh group
-             SMESH::long_array_var anElementsIds = new SMESH::long_array;
-             anElementsIds = aGroup->GetListOfID();
-             for ( int i = 0; i < anElementsIds->length(); i++ )
-               myElementsId += QString(" %1").arg(anElementsIds[i]);
-             aNbUnits = anElementsIds->length();
-           }
-       }
-      else
-       {
-         aNbUnits = SMESH::GetNameOfSelectedElements(mySelection, aString) ;
-         myElementsId = aString;
-       }
-      
-      if(aNbUnits < 1)
-       return ;
-      
-      myNbOkElements = true;
+
+  if (myEditCurrentArgument == (QWidget*)LineEditElements) {
+    myElementsId = "";
+
+    if (CheckBoxMesh->isChecked()) {
+      SMESH::GetNameOfSelectedIObjects(mySelectionMgr, aString);
+
+      if (!SMESH::IObjectToInterface<SMESH::SMESH_Mesh>(IO)->_is_nil()) { //MESH
+        // get IDs from mesh
+        SMDS_Mesh* aSMDSMesh = myActor->GetObject()->GetMesh();
+        if (!aSMDSMesh)
+          return;
+
+        for (int i = aSMDSMesh->MinElementID(); i <= aSMDSMesh->MaxElementID(); i++) {
+          const SMDS_MeshElement * e = aSMDSMesh->FindElement(i);
+          if (e) {
+            myElementsId += QString(" %1").arg(i);
+            aNbUnits++;
+          }
+        }
+      } else if (!SMESH::IObjectToInterface<SMESH::SMESH_subMesh>(IO)->_is_nil()) { //SUBMESH
+        // get submesh
+        SMESH::SMESH_subMesh_var aSubMesh = SMESH::IObjectToInterface<SMESH::SMESH_subMesh>(IO);
+
+        // get IDs from submesh
+        SMESH::long_array_var anElementsIds = new SMESH::long_array;
+        anElementsIds = aSubMesh->GetElementsId();
+        for (int i = 0; i < anElementsIds->length(); i++) {
+          myElementsId += QString(" %1").arg(anElementsIds[i]);
+        }
+        aNbUnits = anElementsIds->length();
+      } else { // GROUP
+        // get smesh group
+        SMESH::SMESH_GroupBase_var aGroup =
+          SMESH::IObjectToInterface<SMESH::SMESH_GroupBase>(IO);
+        if (aGroup->_is_nil())
+          return;
+
+        // get IDs from smesh group
+        SMESH::long_array_var anElementsIds = new SMESH::long_array;
+        anElementsIds = aGroup->GetListOfID();
+        for (int i = 0; i < anElementsIds->length(); i++) {
+          myElementsId += QString(" %1").arg(anElementsIds[i]);
+        }
+        aNbUnits = anElementsIds->length();
+      }
+    } else {
+      aNbUnits = SMESH::GetNameOfSelectedElements(mySelector, myActor->getIO(), aString);
+      myElementsId = aString;
     }
-  else
-    {
-      aNbUnits = SMESH::GetNameOfSelectedNodes(mySelection, aString);
-      if(aNbUnits != 1)
-       return;
-      
-      SMDS_Mesh* aMesh =  myActor->GetObject()->GetMesh();
-      if (!aMesh)
-       return;
-      
-      const SMDS_MeshNode * n = aMesh->FindNode( aString.toInt() );
-      if ( !n )
-       return;
-      
-      double x = n->X();
-      double y = n->Y();
-      double z = n->Z();
-      
-      if (myEditCurrentArgument == (QWidget*)SpinBox_X)
-       {
-         SpinBox_X->SetValue(x);
-         SpinBox_Y->SetValue(y);
-         SpinBox_Z->SetValue(z);
-       }
-      else if (myEditCurrentArgument == (QWidget*)SpinBox_DX)
-       {
-         SpinBox_DX->SetValue(x - SpinBox_X->GetValue());
-         SpinBox_DY->SetValue(y - SpinBox_Y->GetValue());
-         SpinBox_DZ->SetValue(z - SpinBox_Z->GetValue());
-       }
+
+    if (aNbUnits < 1)
+      return;
+
+    myNbOkElements = true;
+  } else {
+    aNbUnits = SMESH::GetNameOfSelectedNodes(mySelector, myActor->getIO(), aString);
+    if (aNbUnits != 1)
+      return;
+
+    SMDS_Mesh* aMesh =  myActor->GetObject()->GetMesh();
+    if (!aMesh)
+      return;
+
+    const SMDS_MeshNode * n = aMesh->FindNode(aString.toInt());
+    if (!n)
+      return;
+
+    double x = n->X();
+    double y = n->Y();
+    double z = n->Z();
+
+    if (myEditCurrentArgument == (QWidget*)SpinBox_X) {
+      SpinBox_X->SetValue(x);
+      SpinBox_Y->SetValue(y);
+      SpinBox_Z->SetValue(z);
+    } else if (myEditCurrentArgument == (QWidget*)SpinBox_DX) {
+      SpinBox_DX->SetValue(x - SpinBox_X->GetValue());
+      SpinBox_DY->SetValue(y - SpinBox_Y->GetValue());
+      SpinBox_DZ->SetValue(z - SpinBox_Z->GetValue());
     }
-  
+  }
+
   myBusy = true;
   if (myEditCurrentArgument == (QWidget*)LineEditElements)
-    LineEditElements->setText( aString );
+    LineEditElements->setText(aString);
   myBusy = false;
-  
+
   // OK
-  
-  if(myNbOkElements && IsAxisOk())
-    {
-      buttonOk->setEnabled( true );
-      buttonApply->setEnabled( true );
-    }
+  if (myNbOkElements && IsAxisOk()) {
+    buttonOk->setEnabled(true);
+    buttonApply->setEnabled(true);
+  }
 }
 
-
 //=================================================================================
 // function : SetEditCurrentArgument()
 // purpose  :
@@ -659,45 +665,42 @@ void SMESHGUI_RotationDlg::SelectionIntoArgument()
 void SMESHGUI_RotationDlg::SetEditCurrentArgument()
 {
   QPushButton* send = (QPushButton*)sender();
-  
-  disconnect( mySelection, 0, this, 0 );
-  mySelection->ClearIObjects();
-  mySelection->ClearFilters();
 
-  switch (myConstructorId)
+  disconnect(mySelectionMgr, 0, this, 0);
+  mySelectionMgr->clearSelected();
+  mySelectionMgr->clearFilters();
+
+  switch (myConstructorId) {
+  case 0: /* default constructor */
     {
-    case 0: /* default constructor */
-      {        
-       if(send == SelectElementsButton) {
-         myEditCurrentArgument = (QWidget*)LineEditElements;
-         SMESH::SetPointRepresentation(false);
-         if (CheckBoxMesh->isChecked())
-           {
-             QAD_Application::getDesktop()->SetSelectionMode( ActorSelection );
-             mySelection->AddFilter(myMeshOrSubMeshOrGroupFilter);
-           }
-         else
-           QAD_Application::getDesktop()->SetSelectionMode( CellSelection, true );
-       }
-       else if (send == SelectPointButton)
-         {
-           myEditCurrentArgument = (QWidget*)SpinBox_X;
-           SMESH::SetPointRepresentation(true);
-           QAD_Application::getDesktop()->SetSelectionMode( NodeSelection, true );
-         }
-       else if (send == SelectVectorButton)
-         {
-           myEditCurrentArgument = (QWidget*)SpinBox_DX;
-           SMESH::SetPointRepresentation(true);
-           QAD_Application::getDesktop()->SetSelectionMode( NodeSelection, true );
-         }
-       break;
+      if (send == SelectElementsButton) {
+        myEditCurrentArgument = (QWidget*)LineEditElements;
+        SMESH::SetPointRepresentation(false);
+        if (CheckBoxMesh->isChecked()) {
+          myViewWindow->SetSelectionMode(ActorSelection);
+          mySelectionMgr->installFilter(myMeshOrSubMeshOrGroupFilter);
+        } else {
+
+          myViewWindow->SetSelectionMode( CellSelection );
+        }
+      } else if (send == SelectPointButton) {
+        myEditCurrentArgument = (QWidget*)SpinBox_X;
+        SMESH::SetPointRepresentation(true);
+
+        myViewWindow->SetSelectionMode( NodeSelection );
+      } else if (send == SelectVectorButton) {
+        myEditCurrentArgument = (QWidget*)SpinBox_DX;
+        SMESH::SetPointRepresentation(true);
+
+        myViewWindow->SetSelectionMode( NodeSelection );
       }
+      break;
     }
-  
+  }
+
   myEditCurrentArgument->setFocus();
-  connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
-  SelectionIntoArgument() ;
+  connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
+  SelectionIntoArgument();
 }
 
 //=================================================================================
@@ -706,16 +709,15 @@ void SMESHGUI_RotationDlg::SetEditCurrentArgument()
 //=================================================================================
 void SMESHGUI_RotationDlg::DeactivateActiveDialog()
 {
-  if ( GroupConstructors->isEnabled() ) {
-    GroupConstructors->setEnabled(false) ;
-    GroupArguments->setEnabled(false) ;
-    GroupButtons->setEnabled(false) ;
-    mySMESHGUI->ResetState() ;    
-    mySMESHGUI->SetActiveDialogBox(0) ;
+  if (GroupConstructors->isEnabled()) {
+    GroupConstructors->setEnabled(false);
+    GroupArguments->setEnabled(false);
+    GroupButtons->setEnabled(false);
+    mySMESHGUI->ResetState();
+    mySMESHGUI->SetActiveDialogBox(0);
   }
 }
 
-
 //=================================================================================
 // function : ActivateThisDialog()
 // purpose  :
@@ -723,116 +725,101 @@ void SMESHGUI_RotationDlg::DeactivateActiveDialog()
 void SMESHGUI_RotationDlg::ActivateThisDialog()
 {
   /* Emit a signal to deactivate the active dialog */
-  mySMESHGUI->EmitSignalDeactivateDialog() ;   
-  GroupConstructors->setEnabled(true) ;
-  GroupArguments->setEnabled(true) ;
-  GroupButtons->setEnabled(true) ;
-  
-  mySMESHGUI->SetActiveDialogBox( (QDialog*)this ) ;
-
-  QAD_Application::getDesktop()->SetSelectionMode( CellSelection, true );
+  mySMESHGUI->EmitSignalDeactivateDialog();
+  GroupConstructors->setEnabled(true);
+  GroupArguments->setEnabled(true);
+  GroupButtons->setEnabled(true);
+
+  mySMESHGUI->SetActiveDialogBox((QDialog*)this);
+
+  myViewWindow->SetSelectionMode( CellSelection );
   SelectionIntoArgument();
 }
 
-
 //=================================================================================
 // function : enterEvent()
 // purpose  :
 //=================================================================================
-void SMESHGUI_RotationDlg::enterEvent(QEvent* e)
+void SMESHGUI_RotationDlg::enterEvent (QEvent*)
 {
-  if ( GroupConstructors->isEnabled() )
-    return ;  
-  ActivateThisDialog() ;
+  if (!GroupConstructors->isEnabled())
+    ActivateThisDialog();
 }
 
-
 //=================================================================================
 // function : closeEvent()
 // purpose  :
 //=================================================================================
-void SMESHGUI_RotationDlg::closeEvent( QCloseEvent* e )
+void SMESHGUI_RotationDlg::closeEvent (QCloseEvent*)
 {
   /* same than click on cancel button */
-  this->ClickOnCancel() ;
+  this->ClickOnCancel();
 }
 
-
-//=======================================================================
-//function : hideEvent
-//purpose  : caused by ESC key
-//=======================================================================
-
-void SMESHGUI_RotationDlg::hideEvent ( QHideEvent * e )
+//=================================================================================
+// function : hideEvent()
+// purpose  : caused by ESC key
+//=================================================================================
+void SMESHGUI_RotationDlg::hideEvent (QHideEvent*)
 {
-  if ( !isMinimized() )
+  if (!isMinimized())
     ClickOnCancel();
 }
 
-
-//=======================================================================
-//function : onSelectMesh
-//purpose  :
-//=======================================================================
-void SMESHGUI_RotationDlg::onSelectMesh ( bool toSelectMesh )
+//=================================================================================
+// function : onSelectMesh()
+// purpose  :
+//=================================================================================
+void SMESHGUI_RotationDlg::onSelectMesh (bool toSelectMesh)
 {
   if (toSelectMesh)
-    TextLabelElements->setText( tr( "SMESH_NAME" ) );
+    TextLabelElements->setText(tr("SMESH_NAME"));
   else
-    TextLabelElements->setText( tr( "SMESH_ID_ELEMENTS" ) );
-  
-  if (myEditCurrentArgument != LineEditElements)
-    {
-      LineEditElements->clear();
-      return;
-    }
-  
-  mySelection->ClearFilters() ;
+    TextLabelElements->setText(tr("SMESH_ID_ELEMENTS"));
+
+  if (myEditCurrentArgument != LineEditElements) {
+    LineEditElements->clear();
+    return;
+  }
+
+  mySelectionMgr->clearFilters();
   SMESH::SetPointRepresentation(false);
-  
-  if (toSelectMesh)
-    {
-      QAD_Application::getDesktop()->SetSelectionMode( ActorSelection );
-      mySelection->AddFilter(myMeshOrSubMeshOrGroupFilter);
-      LineEditElements->setReadOnly(true);
-    }
-  else
-    {
-      QAD_Application::getDesktop()->SetSelectionMode( CellSelection, true );
-      LineEditElements->setReadOnly(false);
-      onTextChange(LineEditElements->text());
-    }
-  
+
+  if (toSelectMesh) {
+    myViewWindow->SetSelectionMode(ActorSelection);
+    mySelectionMgr->installFilter(myMeshOrSubMeshOrGroupFilter);
+    LineEditElements->setReadOnly(true);
+  } else {
+    myViewWindow->SetSelectionMode( CellSelection );
+    LineEditElements->setReadOnly(false);
+    onTextChange(LineEditElements->text());
+  }
+
   SelectionIntoArgument();
 }
 
-
 //=================================================================================
 // function : IsAxisOk()
-// purpose  : 
+// purpose  :
 //=================================================================================
 bool SMESHGUI_RotationDlg::IsAxisOk()
 {
-  return (SpinBox_DX->GetValue() != 0 || 
+  return (SpinBox_DX->GetValue() != 0 ||
          SpinBox_DY->GetValue() != 0 ||
-         SpinBox_DZ->GetValue() != 0); 
+         SpinBox_DZ->GetValue() != 0);
 }
 
-
 //=================================================================================
 // function : onVectorChanged()
-// purpose  : 
+// purpose  :
 //=================================================================================
 void SMESHGUI_RotationDlg::onVectorChanged()
 {
-  if (IsAxisOk())
-    {
-      buttonOk->setEnabled( true );
-      buttonApply->setEnabled( true );
-    }
-  else
-    {
-      buttonOk->setEnabled( false );
-      buttonApply->setEnabled( false );
-    }
+  if (IsAxisOk()) {
+    buttonOk->setEnabled(true);
+    buttonApply->setEnabled(true);
+  } else {
+    buttonOk->setEnabled(false);
+    buttonApply->setEnabled(false);
+  }
 }
index 7901d1ed9bcf0f74e74835d00122cabcb3bdd1f9..1fb8ed500d98d5dab2aba086ff7f6f07ee4464dc 100644 (file)
@@ -29,7 +29,8 @@
 #ifndef DIALOGBOX_ROTATION_H
 #define DIALOGBOX_ROTATION_H
 
-#include "SALOME_Selection.h"
+#include "SalomeApp_SelectionMgr.h"
+
 #include "SMESH_LogicalFilter.hxx"
 
 // QT Includes
@@ -47,6 +48,9 @@ class SMESHGUI_SpinBox;
 class SMESHGUI;
 class SMESH_Actor;
 class SMESHGUI_SpinBox;
+class SVTK_ViewWindow;
+class SVTK_Selector;
+
 
 // IDL Headers
 #include <SALOMEconfig.h>
@@ -62,29 +66,33 @@ class SMESHGUI_RotationDlg : public QDialog
     Q_OBJECT
 
 public:
-    SMESHGUI_RotationDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 );
+    SMESHGUI_RotationDlg( SMESHGUI*,
+                         const char* name = 0,
+                         bool modal = FALSE,
+                         WFlags fl = 0);
     ~SMESHGUI_RotationDlg();
 
 private:
-
-    void Init( bool ResetControls = true ) ;
-    void closeEvent( QCloseEvent* e ) ;
-    void enterEvent ( QEvent * ) ;                          /* mouse enter the QWidget */
-    void hideEvent ( QHideEvent * );                        /* ESC key */
+    void Init (bool ResetControls = true);
+    void closeEvent (QCloseEvent*);
+    void enterEvent (QEvent*);                          /* mouse enter the QWidget */
+    void hideEvent (QHideEvent*);                       /* ESC key */
     bool IsAxisOk();
-    
-    SMESHGUI*                     mySMESHGUI ;              /* Current SMESHGUI object */
-    SALOME_Selection*             mySelection ;             /* User shape selection */
-    int                           myNbOkElements ;          /* to check when elements are defined */
+
+    SMESHGUI*                     mySMESHGUI;              /* Current SMESHGUI object */
+    SalomeApp_SelectionMgr*       mySelectionMgr;          /* User shape selection */
+    int                           myNbOkElements;          /* to check when elements are defined */
     QString                       myElementsId;
-    
-    QWidget*                      myEditCurrentArgument;    /* Current  LineEdit */
+    SVTK_ViewWindow*              myViewWindow;
+    SVTK_Selector*                mySelector;
+
+    QWidget*                      myEditCurrentArgument;   /* Current  LineEdit */
     int myConstructorId;
     bool                          myBusy;
     SMESH::SMESH_Mesh_var         myMesh;
     SMESH_Actor*                  myActor;
-    Handle(SMESH_LogicalFilter)   myMeshOrSubMeshOrGroupFilter;
-    
+    SMESH_LogicalFilter*          myMeshOrSubMeshOrGroupFilter;
+
     QButtonGroup* GroupConstructors;
     QRadioButton* RadioButton1;
     QGroupBox* GroupButtons;
@@ -118,19 +126,19 @@ private:
     QLabel* TextLabelAngle;
     SMESHGUI_SpinBox* SpinBox_Angle;
     QCheckBox* CheckBoxCopy;
-   
-    private slots:
 
-    void ConstructorsClicked(int constructorId);
+private slots:
+
+    void ConstructorsClicked (int constructorId);
     void ClickOnOk();
     void ClickOnCancel();
     void ClickOnApply();
-    void SetEditCurrentArgument() ;
-    void SelectionIntoArgument() ;
-    void DeactivateActiveDialog() ;
-    void ActivateThisDialog() ;
-    void onTextChange(const QString&);
-    void onSelectMesh(bool toSelectMesh);
+    void SetEditCurrentArgument();
+    void SelectionIntoArgument();
+    void DeactivateActiveDialog();
+    void ActivateThisDialog();
+    void onTextChange (const QString&);
+    void onSelectMesh (bool toSelectMesh);
     void onVectorChanged();
 
 protected:
diff --git a/src/SMESHGUI/SMESHGUI_Selection.cxx b/src/SMESHGUI/SMESHGUI_Selection.cxx
new file mode 100644 (file)
index 0000000..73f961b
--- /dev/null
@@ -0,0 +1,421 @@
+
+#include "SMESHGUI_Selection.h"
+#include "SMESHGUI_Utils.h"
+#include "SMESHGUI_VTKUtils.h"
+#include "SMESHGUI_MeshUtils.h"
+#include "SMESHGUI_GEOMGenUtils.h"
+
+#include "SMESH_Type.h"
+#include "SMESH_Actor.h"
+
+#include "SalomeApp_SelectionMgr.h"
+#include "SalomeApp_Study.h"
+#include "SalomeApp_VTKSelector.h"
+
+#include "SUIT_Session.h"
+
+#include "SVTK_RenderWindowInteractor.h"
+#include "SVTK_ViewWindow.h"
+
+#include CORBA_SERVER_HEADER(SMESH_Mesh)
+#include CORBA_SERVER_HEADER(SMESH_Group)
+
+//=======================================================================
+//function : SMESHGUI_Selection
+//purpose  : 
+//=======================================================================
+
+SMESHGUI_Selection::SMESHGUI_Selection( const QString&          client,
+                                        SalomeApp_SelectionMgr* mgr )
+{
+  myPopupClient = client;
+  
+  SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>
+    (SUIT_Session::session()->activeApplication()->activeStudy());
+
+  if( mgr && appStudy )
+  {
+    _PTR(Study) study = appStudy->studyDS();
+
+    SUIT_DataOwnerPtrList sel;
+    mgr->selected( sel, client );
+    myDataOwners = sel;
+    SUIT_DataOwnerPtrList::const_iterator anIt = sel.begin(),
+                                          aLast = sel.end();
+    for( ; anIt!=aLast; anIt++ )
+    {
+      SUIT_DataOwner* owner = ( SUIT_DataOwner* )( (*anIt ).get() );
+      SalomeApp_DataOwner* sowner = dynamic_cast<SalomeApp_DataOwner*>( owner );
+      if( sowner )
+        myTypes.append( typeName( type( sowner, study ) ) );
+      else
+        myTypes.append( "Unknown" );
+    }
+  }
+}
+
+SMESHGUI_Selection::~SMESHGUI_Selection()
+{
+}
+
+//=======================================================================
+//function : count
+//purpose  : 
+//=======================================================================
+
+int SMESHGUI_Selection::count() const
+{
+  return myTypes.count();
+}
+
+//=======================================================================
+//function : param
+//purpose  : 
+//=======================================================================
+
+QtxValue SMESHGUI_Selection::param( const int ind, const QString& p ) const
+{
+  QtxValue val;
+  if      ( p=="client" )        val = QtxValue( myPopupClient );
+  else if ( p=="type" )          val = QtxValue( myTypes[ind] );
+  else if ( p=="elemTypes" )     val = QtxValue( elemTypes( ind ) );
+  else if ( p=="numberOfNodes" ) val = QtxValue( numberOfNodes( ind ) );
+  else if ( p=="labeledTypes" )  val = QtxValue( labeledTypes( ind ) );
+  else if ( p=="shrinkMode" )    val = QtxValue( shrinkMode( ind ) );
+  else if ( p=="entityMode" )    val = QtxValue( entityMode( ind ) );
+  else if ( p=="controlMode" )   val = QtxValue( controlMode( ind ) );
+  else if ( p=="displayMode" )   val = QtxValue( displayMode( ind ) );
+  else if ( p=="isComputable" )  val = QtxValue( isComputable( ind ) );
+  else if ( p=="hasReference" )  val = QtxValue( hasReference( ind ) );
+  else if ( p=="isVisible" )     val = QtxValue( isVisible( ind ) );
+
+  printf( "--> param() : [%s] = %s (%s)\n", p.latin1(), val.toString().latin1(), val.typeName() );
+  if ( val.type() == QVariant::List )
+    cout << "size: " << val.toList().count() << endl;
+  return val;
+}
+
+//=======================================================================
+//function : getVtkOwner
+//purpose  : 
+//=======================================================================
+
+SMESH_Actor* SMESHGUI_Selection::getActor( int ind ) const
+{
+  if ( ind >= 0 && ind < myDataOwners.count() ) {
+    const SalomeApp_SVTKDataOwner* owner = 
+      dynamic_cast<const SalomeApp_SVTKDataOwner*> ( myDataOwners[ ind ].get() );
+    if ( owner )
+      return dynamic_cast<SMESH_Actor*>( owner->GetActor() );
+  }
+  return 0;
+}
+
+//=======================================================================
+//function : elemTypes
+//purpose  : may return {'Edge' 'Face' 'Volume'} at most
+//=======================================================================
+
+QValueList<QVariant> SMESHGUI_Selection::elemTypes( int ind ) const
+{
+  QValueList<QVariant> types;
+  SMESH_Actor* actor = getActor( ind );
+  if ( actor ) {
+    TVisualObjPtr object = actor->GetObject();
+    if ( object ) {
+      if ( object->GetNbEntities( SMDSAbs_Edge )) types.append( "Edge" );
+      if ( object->GetNbEntities( SMDSAbs_Face )) types.append( "Face" );
+      if ( object->GetNbEntities( SMDSAbs_Volume )) types.append( "Volume" );
+    }
+  }
+  return types;
+}
+
+//=======================================================================
+//function : labeledTypes
+//purpose  : may return {'Point' 'Cell'} at most
+//=======================================================================
+
+QValueList<QVariant> SMESHGUI_Selection::labeledTypes( int ind ) const
+{
+  QValueList<QVariant> types;
+  SMESH_Actor* actor = getActor( ind );
+  if ( actor ) {
+    if ( actor->GetPointsLabeled()) types.append( "Point" );
+    if ( actor->GetCellsLabeled()) types.append( "Cell" );
+  }
+  return types;
+}
+
+//=======================================================================
+//function : displayMode
+//purpose  : return SMESH_Actor::EReperesent
+//=======================================================================
+
+QString SMESHGUI_Selection::displayMode( int ind ) const
+{
+  SMESH_Actor* actor = getActor( ind );
+  if ( actor ) {
+    switch( actor->GetRepresentation() ) {
+    case SMESH_Actor::eEdge:    return "eEdge";
+    case SMESH_Actor::eSurface: return "eSurface";
+    case SMESH_Actor::ePoint:   return "ePoint";
+    default:;
+    }
+  }
+  return "Unknown";
+}
+
+//=======================================================================
+//function : shrinkMode
+//purpose  : return either 'IsSrunk', 'IsNotShrunk' or 'IsNotShrinkable'
+//=======================================================================
+
+QString SMESHGUI_Selection::shrinkMode( int ind ) const
+{
+  SMESH_Actor* actor = getActor( ind );
+  if ( actor && actor->IsShrunkable() ) {
+    if ( actor->IsShrunk() )
+      return "IsShrunk";
+    return "IsNotShrunk";
+  }
+  return "IsNotShrinkable";
+}
+
+//=======================================================================
+//function : entityMode
+//purpose  : may return {'Edge' 'Face' 'Volume'} at most
+//=======================================================================
+
+QValueList<QVariant> SMESHGUI_Selection::entityMode( int ind ) const
+{
+  QValueList<QVariant> types;
+  SMESH_Actor* actor = getActor( ind );
+  if ( actor ) {
+    unsigned int aMode = actor->GetEntityMode();
+    if ( aMode & SMESH_Actor::eVolumes) types.append( "Volume");
+    if ( aMode & SMESH_Actor::eFaces  ) types.append( "Face"  );
+    if ( aMode & SMESH_Actor::eEdges  ) types.append( "Edge"  );
+  }
+  return types;
+}
+
+//=======================================================================
+//function : controlMode
+//purpose  : return SMESH_Actor::eControl
+//=======================================================================
+
+QString SMESHGUI_Selection::controlMode( int ind ) const
+{
+  SMESH_Actor* actor = getActor( ind );
+  if ( actor ) {
+    switch( actor->GetControlMode() ) {
+    case SMESH_Actor::eLength:            return "eLength";
+    case SMESH_Actor::eLength2D:          return "eLength2D";
+    case SMESH_Actor::eFreeEdges:         return "eFreeEdges";
+    case SMESH_Actor::eFreeBorders:       return "eFreeBorders";
+    case SMESH_Actor::eMultiConnection:   return "eMultiConnection";
+    case SMESH_Actor::eMultiConnection2D: return "eMultiConnection2D";
+    case SMESH_Actor::eArea:              return "eArea";
+    case SMESH_Actor::eTaper:             return "eTaper";
+    case SMESH_Actor::eAspectRatio:       return "eAspectRatio";
+    case SMESH_Actor::eAspectRatio3D:     return "eAspectRatio3D";
+    case SMESH_Actor::eMinimumAngle:      return "eMinimumAngle";
+    case SMESH_Actor::eWarping:           return "eWarping";
+    case SMESH_Actor::eSkew:              return "eSkew";
+    default:;
+    }
+  }
+  return "eNone";
+}
+
+//=======================================================================
+//function : numberOfNodes
+//purpose  : 
+//=======================================================================
+
+int SMESHGUI_Selection::numberOfNodes( int ind ) const
+{
+  if ( ind >= 0 && ind < myTypes.count() && myTypes[ind] != "Unknown" )
+  {
+    CORBA::Object_var obj =
+      SMESH::DataOwnerToObject( static_cast<SalomeApp_DataOwner*>( myDataOwners[ ind ].get() ));
+    if ( ! CORBA::is_nil( obj )) {
+      SMESH::SMESH_Mesh_var mesh = SMESH::SMESH_Mesh::_narrow( obj );
+      if ( ! mesh->_is_nil() )
+        return mesh->NbNodes();
+      SMESH::SMESH_subMesh_var aSubMeshObj = SMESH::SMESH_subMesh::_narrow( obj );
+      if ( !aSubMeshObj->_is_nil() )
+        return aSubMeshObj->GetNumberOfNodes(true);
+      SMESH::SMESH_GroupBase_var aGroupObj = SMESH::SMESH_GroupBase::_narrow( obj );
+      if ( !aGroupObj->_is_nil() )
+        return aGroupObj->Size();
+    }
+  }
+  return 0;
+}
+
+//=======================================================================
+//function : isComputable
+//purpose  : 
+//=======================================================================
+
+QVariant SMESHGUI_Selection::isComputable( int ind ) const
+{
+  if ( ind >= 0 && ind < myTypes.count() && myTypes[ind] != "Unknown" )
+  {
+    Handle(SALOME_InteractiveObject) io =
+      static_cast<SalomeApp_DataOwner*>( myDataOwners[ ind ].get() )->IO();
+    if ( !io.IsNull() ) {
+      SMESH::SMESH_Mesh_var mesh = SMESH::GetMeshByIO(io) ; // m,sm,gr->m
+      if ( !mesh->_is_nil() ) {
+        _PTR(SObject) so = SMESH::FindSObject( mesh );
+        if ( so ) {
+          GEOM::GEOM_Object_var shape = SMESH::GetShapeOnMeshOrSubMesh( so );
+          return QVariant( !shape->_is_nil(), 0 );
+        }
+      }
+    }
+  }
+  return QVariant( false, 0 );
+}
+
+//=======================================================================
+//function : hasReference
+//purpose  : 
+//=======================================================================
+
+QVariant SMESHGUI_Selection::hasReference( int ind ) const
+{
+  if ( ind >= 0 && ind < myTypes.count() && myTypes[ind] != "Unknown" )
+  {
+    Handle(SALOME_InteractiveObject) io =
+      static_cast<SalomeApp_DataOwner*>( myDataOwners[ ind ].get() )->IO();
+    if ( !io.IsNull() )
+      return QVariant( io->hasReference(), 0 );
+  }
+  return QVariant( false, 0 );
+}
+
+//=======================================================================
+//function : isVisible
+//purpose  : 
+//=======================================================================
+
+QVariant SMESHGUI_Selection::isVisible( int ind ) const
+{
+  if ( ind >= 0 && ind < myTypes.count() && myTypes[ind] != "Unknown" )
+  {
+    QString entry = static_cast<SalomeApp_DataOwner*>( myDataOwners[ ind ].get() )->entry();
+    SMESH_Actor* actor = SMESH::FindActorByEntry( entry.latin1() );
+    if ( actor && actor->hasIO() ) {
+      SVTK_RenderWindowInteractor* renderInter = SMESH::GetCurrentVtkView()->getRWInteractor();
+      return QVariant( renderInter->isVisible( actor->getIO() ), 0 );
+    }
+  }
+  return QVariant( false, 0 );
+}
+
+
+//=======================================================================
+//function : type
+//purpose  : 
+//=======================================================================
+
+int SMESHGUI_Selection::type( SalomeApp_DataOwner* owner,
+                              _PTR(Study) study )
+{
+  QString entry = owner->entry();
+
+  _PTR(SObject) obj (study->FindObjectID(entry.latin1()));
+  if( !obj )
+    return -1;
+
+  _PTR(SObject) objFather = obj->GetFather();
+  _PTR(SComponent) objComponent = obj->GetFatherComponent();
+
+  int aLevel = obj->Depth() - objComponent->Depth(),
+      aFTag = objFather->Tag(),
+      anOTag = obj->Tag(),
+      res = -1;
+
+  switch( aLevel )
+  {
+  case 1:
+    if( anOTag>=3 )
+      res = MESH;
+    break;
+  case 2:
+    switch( aFTag )
+    {
+    case 1:
+      res = HYPOTHESIS;
+      break;
+    case 2:
+      res = ALGORITHM;
+      break;
+    }
+    break;
+  case 3:
+    switch( aFTag )
+    {
+    case 4:
+      res = SUBMESH_VERTEX;
+      break;
+    case 5:
+      res = SUBMESH_EDGE;
+      break;
+    case 7:
+      res = SUBMESH_FACE;
+      break;
+    case 9:
+      res = SUBMESH_SOLID;
+      break;
+    case 10:
+      res = SUBMESH_COMPOUND;
+      break;
+    }
+    if( aFTag>10 )
+      res = GROUP;
+
+    break;
+  }
+
+  return res;
+}
+
+//=======================================================================
+//function : typeName
+//purpose  : 
+//=======================================================================
+
+QString SMESHGUI_Selection::typeName( const int t )
+{
+  switch( t )
+  {
+  case HYPOTHESIS:
+    return "Hypothesis";
+  case ALGORITHM:
+    return "Algorithm";
+  case MESH:
+    return "Mesh";
+  case SUBMESH:
+    return "SubMesh";
+  case MESHorSUBMESH:
+    return "Mesh or submesh";
+  case SUBMESH_VERTEX:
+    return "Mesh vertex";
+  case SUBMESH_EDGE:
+    return "Mesh edge";
+  case SUBMESH_FACE:
+    return "Mesh face";
+  case SUBMESH_SOLID:
+    return "Mesh solid";
+  case SUBMESH_COMPOUND:
+    return "Mesh compound";
+  case GROUP:
+    return "Group";
+  default:
+    return "Unknown";
+  }
+}
diff --git a/src/SMESHGUI/SMESHGUI_Selection.h b/src/SMESHGUI/SMESHGUI_Selection.h
new file mode 100644 (file)
index 0000000..20e13f9
--- /dev/null
@@ -0,0 +1,77 @@
+//  SMESH SMESHGUI_Selection
+//
+//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//
+//  File   : SMESHGUI_Selection.h
+//  Author : Alexander SOLOVYOV
+//  Module : SMESH
+//  $Header$
+
+#ifndef SMESHGUI_SELECTION_HeaderFile
+#define SMESHGUI_SELECTION_HeaderFile
+
+#include <QtxPopupMgr.h>
+
+#include "SALOMEDSClient_definitions.hxx"
+#include "SUIT_DataOwner.h"
+
+class SalomeApp_SelectionMgr;
+class SALOMEDSClient_Study;
+class SalomeApp_DataOwner;
+class SMESH_Actor;
+
+class SMESHGUI_Selection : public QtxPopupMgr::Selection
+{
+public:
+  SMESHGUI_Selection( const QString&, SalomeApp_SelectionMgr* );
+  virtual ~SMESHGUI_Selection();
+
+  virtual QtxValue param( const int , const QString& paramName ) const;
+
+  virtual int count() const;
+
+  // got from object, not from actor
+  virtual int numberOfNodes( int ind ) const;
+  virtual QVariant isComputable( int ind ) const;
+  virtual QVariant hasReference( int ind ) const;
+  virtual QVariant isVisible( int ind ) const;
+
+  // parameters got from actor return nothing if an actor is not visible
+  virtual QValueList<QVariant> elemTypes( int ind ) const;
+  virtual QValueList<QVariant> labeledTypes( int ind ) const;
+  virtual QString displayMode( int ind ) const;
+  virtual QString shrinkMode( int ind ) const;
+  virtual QValueList<QVariant> entityMode( int ind ) const;
+  virtual QString controlMode( int ind ) const;
+  
+  SMESH_Actor* getActor( int ind ) const;
+
+  static int       type( SalomeApp_DataOwner* owner, _PTR(Study) study);
+  static QString   typeName( const int type);
+
+private:
+  QString               myPopupClient;
+  QStringList           myTypes;
+  SUIT_DataOwnerPtrList myDataOwners;
+};
+
+#endif
index 0cfe1f64399924850ba5c01a2ae18731409c2881..a84e3834d40326526fa171fdc64a2fc730051f42 100644 (file)
@@ -1,30 +1,30 @@
 //  SMESH SMESHGUI : GUI for SMESH component
 //
 //  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
-// 
-//  This library is free software; you can redistribute it and/or 
-//  modify it under the terms of the GNU Lesser General Public 
-//  License as published by the Free Software Foundation; either 
-//  version 2.1 of the License. 
-// 
-//  This library is distributed in the hope that it will be useful, 
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of 
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
-//  Lesser General Public License for more details. 
-// 
-//  You should have received a copy of the GNU Lesser General Public 
-//  License along with this library; if not, write to the Free Software 
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
-// 
-//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
 //
 //
 //
 //  File   : SMESHGUI_SewingDlg.cxx
 //  Author : Michael ZORIN
 //  Module : SMESH
-//  $Header: 
+//  $Header:
 
 #include "SMESHGUI_SewingDlg.h"
 
 #include "SMESHGUI_Utils.h"
 #include "SMESHGUI_VTKUtils.h"
 #include "SMESHGUI_IdValidator.h"
+
 #include "SMESH_Actor.h"
 #include "SMDS_Mesh.hxx"
 
-#include "GEOMBase.h"
+#include "SUIT_ResourceMgr.h"
+#include "SUIT_Desktop.h"
+#include "SUIT_MessageBox.h"
+
+#include "SVTK_ViewModel.h"
+#include "SVTK_ViewWindow.h"
+#include "SVTK_Selector.h"
+#include "SVTK_Selection.h"
+#include "SALOME_ListIO.hxx"
 
-#include "QAD_Application.h"
-#include "QAD_Desktop.h"
-#include "QAD_MessageBox.h"
 #include "utilities.h"
 
+// OCCT Includes
+#include <TColStd_MapOfInteger.hxx>
+#include <TColStd_IndexedMapOfInteger.hxx>
+
 // QT Includes
 #include <qapplication.h>
 #include <qbuttongroup.h>
@@ -58,241 +68,256 @@ using namespace std;
 
 //=================================================================================
 // class    : SMESHGUI_SewingDlg()
-// purpose  : 
+// purpose  :
 //=================================================================================
-SMESHGUI_SewingDlg::SMESHGUI_SewingDlg( QWidget* parent, const char* name, SALOME_Selection* Sel,
-                                             bool modal, WFlags fl )
-  : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu |
-            Qt::WDestructiveClose)
+SMESHGUI_SewingDlg::SMESHGUI_SewingDlg( SMESHGUI* theModule, const char* name,
+                                        bool modal, WFlags fl)
+     : QDialog( SMESH::GetDesktop( theModule ), name, modal, WStyle_Customize | WStyle_NormalBorder |
+                WStyle_Title | WStyle_SysMenu | Qt::WDestructiveClose),
+      mySMESHGUI( theModule ),
+      mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ),
+      myViewWindow( SMESH::GetViewWindow( theModule ) ),
+      mySelector( myViewWindow->GetSelector() )
 {
-  QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "SMESH",tr("ICON_SMESH_SEWING_FREEBORDERS")));
-  QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "SMESH",tr("ICON_SMESH_SEWING_CONFORM_FREEBORDERS")));
-  QPixmap image2(QAD_Desktop::getResourceManager()->loadPixmap( "SMESH",tr("ICON_SMESH_SEWING_BORDERTOSIDE")));
-  QPixmap image3(QAD_Desktop::getResourceManager()->loadPixmap( "SMESH",tr("ICON_SMESH_SEWING_SIDEELEMENTS")));
-  QPixmap image4(QAD_Desktop::getResourceManager()->loadPixmap( "SMESH",tr("ICON_SELECT")));
-
-  if ( !name )
-    setName( "SMESHGUI_SewingDlg" );
-  resize( 303, 185 ); 
-  setCaption( tr( "SMESH_SEWING" ) );
-  setSizeGripEnabled( TRUE );
-  SMESHGUI_SewingDlgLayout = new QGridLayout( this ); 
-  SMESHGUI_SewingDlgLayout->setSpacing( 6 );
-  SMESHGUI_SewingDlgLayout->setMargin( 11 );
+  QPixmap image0 (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_SMESH_SEWING_FREEBORDERS")));
+  QPixmap image1 (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_SMESH_SEWING_CONFORM_FREEBORDERS")));
+  QPixmap image2 (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_SMESH_SEWING_BORDERTOSIDE")));
+  QPixmap image3 (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_SMESH_SEWING_SIDEELEMENTS")));
+  QPixmap image4 (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_SELECT")));
+
+  if (!name)
+    setName("SMESHGUI_SewingDlg");
+  resize(303, 185);
+  setCaption(tr("SMESH_SEWING"));
+  setSizeGripEnabled(TRUE);
+  SMESHGUI_SewingDlgLayout = new QGridLayout(this);
+  SMESHGUI_SewingDlgLayout->setSpacing(6);
+  SMESHGUI_SewingDlgLayout->setMargin(11);
 
   /***************************************************************/
-  GroupConstructors = new QButtonGroup( this, "GroupConstructors" );
-  GroupConstructors->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)0, 0, 0, GroupConstructors->sizePolicy().hasHeightForWidth() ) );
-  GroupConstructors->setTitle( tr( "SMESH_SEWING"  ) );
-  GroupConstructors->setExclusive( TRUE );
-  GroupConstructors->setColumnLayout(0, Qt::Vertical );
-  GroupConstructors->layout()->setSpacing( 0 );
-  GroupConstructors->layout()->setMargin( 0 );
-  GroupConstructorsLayout = new QGridLayout( GroupConstructors->layout() );
-  GroupConstructorsLayout->setAlignment( Qt::AlignTop );
-  GroupConstructorsLayout->setSpacing( 6 );
-  GroupConstructorsLayout->setMargin( 11 );
-  QHBoxLayout* RBLayout = new QHBoxLayout( 0, 0, 6, "Layout2");
-  RadioButton1= new QRadioButton( GroupConstructors, "RadioButton1" );
-  RadioButton1->setText( tr( ""  ) );
-  RadioButton1->setPixmap( image0 );
-  RBLayout->addWidget( RadioButton1);
-  RadioButton2= new QRadioButton( GroupConstructors, "RadioButton2" );
-  RadioButton2->setText( tr( ""  ) );
-  RadioButton2->setPixmap( image1 );
-  RBLayout->addWidget( RadioButton2);
-  RadioButton3= new QRadioButton( GroupConstructors, "RadioButton3" );
-  RadioButton3->setText( tr( ""  ) );
-  RadioButton3->setPixmap( image2 );
-  RBLayout->addWidget( RadioButton3);
-  RadioButton4= new QRadioButton( GroupConstructors, "RadioButton4" );
-  RadioButton4->setText( tr( ""  ) );
-  RadioButton4->setPixmap( image3 );
-  RBLayout->addWidget( RadioButton4);
-  GroupConstructorsLayout->addLayout( RBLayout, 0, 0 );
-  SMESHGUI_SewingDlgLayout->addWidget( GroupConstructors, 0, 0 );
-  
+  GroupConstructors = new QButtonGroup(this, "GroupConstructors");
+  GroupConstructors->setSizePolicy(QSizePolicy((QSizePolicy::SizeType)5,
+                                               (QSizePolicy::SizeType)0, 0, 0,
+                                               GroupConstructors->sizePolicy().hasHeightForWidth()));
+  GroupConstructors->setTitle(tr("SMESH_SEWING"));
+  GroupConstructors->setExclusive(TRUE);
+  GroupConstructors->setColumnLayout(0, Qt::Vertical);
+  GroupConstructors->layout()->setSpacing(0);
+  GroupConstructors->layout()->setMargin(0);
+  GroupConstructorsLayout = new QGridLayout(GroupConstructors->layout());
+  GroupConstructorsLayout->setAlignment(Qt::AlignTop);
+  GroupConstructorsLayout->setSpacing(6);
+  GroupConstructorsLayout->setMargin(11);
+  QHBoxLayout* RBLayout = new QHBoxLayout(0, 0, 6, "Layout2");
+  RadioButton1= new QRadioButton(GroupConstructors, "RadioButton1");
+  RadioButton1->setText(tr("" ));
+  RadioButton1->setPixmap(image0);
+  RBLayout->addWidget(RadioButton1);
+  RadioButton2= new QRadioButton(GroupConstructors, "RadioButton2");
+  RadioButton2->setText(tr("" ));
+  RadioButton2->setPixmap(image1);
+  RBLayout->addWidget(RadioButton2);
+  RadioButton3= new QRadioButton(GroupConstructors, "RadioButton3");
+  RadioButton3->setText(tr("" ));
+  RadioButton3->setPixmap(image2);
+  RBLayout->addWidget(RadioButton3);
+  RadioButton4= new QRadioButton(GroupConstructors, "RadioButton4");
+  RadioButton4->setText(tr("" ));
+  RadioButton4->setPixmap(image3);
+  RBLayout->addWidget(RadioButton4);
+  GroupConstructorsLayout->addLayout(RBLayout, 0, 0);
+  SMESHGUI_SewingDlgLayout->addWidget(GroupConstructors, 0, 0);
+
   /***************************************************************/
-  GroupButtons = new QGroupBox( this, "GroupButtons" );
-  GroupButtons->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, GroupButtons->sizePolicy().hasHeightForWidth() ) );
-  GroupButtons->setGeometry( QRect( 10, 10, 281, 48 ) ); 
-  GroupButtons->setTitle( tr( ""  ) );
-  GroupButtons->setColumnLayout(0, Qt::Vertical );
-  GroupButtons->layout()->setSpacing( 0 );
-  GroupButtons->layout()->setMargin( 0 );
-  GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
-  GroupButtonsLayout->setAlignment( Qt::AlignTop );
-  GroupButtonsLayout->setSpacing( 6 );
-  GroupButtonsLayout->setMargin( 11 );
-  buttonCancel = new QPushButton( GroupButtons, "buttonCancel" );
-  buttonCancel->setText( tr( "SMESH_BUT_CLOSE"  ) );
-  buttonCancel->setAutoDefault( TRUE );
-  GroupButtonsLayout->addWidget( buttonCancel, 0, 3 );
-  buttonApply = new QPushButton( GroupButtons, "buttonApply" );
-  buttonApply->setText( tr( "SMESH_BUT_APPLY"  ) );
-  buttonApply->setAutoDefault( TRUE );
-  GroupButtonsLayout->addWidget( buttonApply, 0, 1 );
-  QSpacerItem* spacer_9 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
-  GroupButtonsLayout->addItem( spacer_9, 0, 2 );
-  buttonOk = new QPushButton( GroupButtons, "buttonOk" );
-  buttonOk->setText( tr( "SMESH_BUT_OK"  ) );
-  buttonOk->setAutoDefault( TRUE );
-  buttonOk->setDefault( TRUE );
-  GroupButtonsLayout->addWidget( buttonOk, 0, 0 );
-  SMESHGUI_SewingDlgLayout->addWidget( GroupButtons, 2, 0 );
+  GroupButtons = new QGroupBox(this, "GroupButtons");
+  GroupButtons->setSizePolicy(QSizePolicy((QSizePolicy::SizeType)7,
+                                          (QSizePolicy::SizeType)0, 0, 0,
+                                          GroupButtons->sizePolicy().hasHeightForWidth()));
+  GroupButtons->setGeometry(QRect(10, 10, 281, 48));
+  GroupButtons->setTitle(tr("" ));
+  GroupButtons->setColumnLayout(0, Qt::Vertical);
+  GroupButtons->layout()->setSpacing(0);
+  GroupButtons->layout()->setMargin(0);
+  GroupButtonsLayout = new QGridLayout(GroupButtons->layout());
+  GroupButtonsLayout->setAlignment(Qt::AlignTop);
+  GroupButtonsLayout->setSpacing(6);
+  GroupButtonsLayout->setMargin(11);
+  buttonCancel = new QPushButton(GroupButtons, "buttonCancel");
+  buttonCancel->setText(tr("SMESH_BUT_CLOSE"));
+  buttonCancel->setAutoDefault(TRUE);
+  GroupButtonsLayout->addWidget(buttonCancel, 0, 3);
+  buttonApply = new QPushButton(GroupButtons, "buttonApply");
+  buttonApply->setText(tr("SMESH_BUT_APPLY"));
+  buttonApply->setAutoDefault(TRUE);
+  GroupButtonsLayout->addWidget(buttonApply, 0, 1);
+  QSpacerItem* spacer_9 = new QSpacerItem(20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
+  GroupButtonsLayout->addItem(spacer_9, 0, 2);
+  buttonOk = new QPushButton(GroupButtons, "buttonOk");
+  buttonOk->setText(tr("SMESH_BUT_OK"));
+  buttonOk->setAutoDefault(TRUE);
+  buttonOk->setDefault(TRUE);
+  GroupButtonsLayout->addWidget(buttonOk, 0, 0);
+  SMESHGUI_SewingDlgLayout->addWidget(GroupButtons, 2, 0);
 
   /***************************************************************/
-  GroupArguments = new QGroupBox( this, "GroupArguments" );
-  GroupArguments->setColumnLayout(0, Qt::Vertical );
-  GroupArguments->layout()->setSpacing( 0 );
-  GroupArguments->layout()->setMargin( 0 );
-  GroupArgumentsLayout = new QGridLayout( GroupArguments->layout() );
-  GroupArgumentsLayout->setAlignment( Qt::AlignTop );
-  GroupArgumentsLayout->setSpacing( 6 );
-  GroupArgumentsLayout->setMargin( 11 );
+  GroupArguments = new QGroupBox(this, "GroupArguments");
+  GroupArguments->setColumnLayout(0, Qt::Vertical);
+  GroupArguments->layout()->setSpacing(0);
+  GroupArguments->layout()->setMargin(0);
+  GroupArgumentsLayout = new QGridLayout(GroupArguments->layout());
+  GroupArgumentsLayout->setAlignment(Qt::AlignTop);
+  GroupArgumentsLayout->setSpacing(6);
+  GroupArgumentsLayout->setMargin(11);
 
   // First subgroup
-  SubGroup1 = new QGroupBox( GroupArguments, "SubGroup1" );
-  SubGroup1->setColumnLayout(0, Qt::Vertical );
-  SubGroup1->layout()->setSpacing( 0 );
-  SubGroup1->layout()->setMargin( 0 );
-  QGridLayout* SubGroup1Layout = new QGridLayout( SubGroup1->layout() );
-  SubGroup1Layout->setAlignment( Qt::AlignTop );
-  SubGroup1Layout->setSpacing( 6 );
-  SubGroup1Layout->setMargin( 11 );
-  
+  SubGroup1 = new QGroupBox(GroupArguments, "SubGroup1");
+  SubGroup1->setColumnLayout(0, Qt::Vertical);
+  SubGroup1->layout()->setSpacing(0);
+  SubGroup1->layout()->setMargin(0);
+  QGridLayout* SubGroup1Layout = new QGridLayout(SubGroup1->layout());
+  SubGroup1Layout->setAlignment(Qt::AlignTop);
+  SubGroup1Layout->setSpacing(6);
+  SubGroup1Layout->setMargin(11);
+
   // Controls of the first subgroup
-  TextLabel1 = new QLabel( SubGroup1, "TextLabel1" );
+  TextLabel1 = new QLabel(SubGroup1, "TextLabel1");
   TextLabel1->setFixedWidth(104);
-  SubGroup1Layout->addWidget( TextLabel1, 0, 0 );
-  
-  SelectButton1  = new QPushButton( SubGroup1, "SelectButton1" );
-  SelectButton1->setPixmap( image4 );
-  SubGroup1Layout->addWidget( SelectButton1, 0, 1 );
-  
-  LineEdit1 = new QLineEdit( SubGroup1, "LineEdit1" );
-  SubGroup1Layout->addWidget( LineEdit1, 0, 2 );
-  
-  TextLabel2 = new QLabel( SubGroup1, "TextLabel2" );
-  SubGroup1Layout->addWidget( TextLabel2, 1, 0 );
-  
-  SelectButton2  = new QPushButton( SubGroup1, "SelectButton2" );
-  SelectButton2->setPixmap( image4 );
-  SubGroup1Layout->addWidget( SelectButton2, 1, 1 );
-  
-  LineEdit2 = new QLineEdit( SubGroup1, "LineEdit2" );
-  SubGroup1Layout->addWidget( LineEdit2, 1, 2 );
+  SubGroup1Layout->addWidget(TextLabel1, 0, 0);
 
-  TextLabel3 = new QLabel( SubGroup1, "TextLabel3" );
-  SubGroup1Layout->addWidget( TextLabel3, 2, 0 );
-  
-  SelectButton3  = new QPushButton( SubGroup1, "SelectButton3" );
-  SelectButton3->setPixmap( image4 );
-  SubGroup1Layout->addWidget( SelectButton3, 2, 1 );
-  
-  LineEdit3 = new QLineEdit( SubGroup1, "LineEdit3" );
-  SubGroup1Layout->addWidget( LineEdit3, 2, 2 );
+  SelectButton1  = new QPushButton(SubGroup1, "SelectButton1");
+  SelectButton1->setPixmap(image4);
+  SubGroup1Layout->addWidget(SelectButton1, 0, 1);
+
+  LineEdit1 = new QLineEdit(SubGroup1, "LineEdit1");
+  SubGroup1Layout->addWidget(LineEdit1, 0, 2);
+
+  TextLabel2 = new QLabel(SubGroup1, "TextLabel2");
+  SubGroup1Layout->addWidget(TextLabel2, 1, 0);
 
+  SelectButton2  = new QPushButton(SubGroup1, "SelectButton2");
+  SelectButton2->setPixmap(image4);
+  SubGroup1Layout->addWidget(SelectButton2, 1, 1);
+
+  LineEdit2 = new QLineEdit(SubGroup1, "LineEdit2");
+  SubGroup1Layout->addWidget(LineEdit2, 1, 2);
+
+  TextLabel3 = new QLabel(SubGroup1, "TextLabel3");
+  SubGroup1Layout->addWidget(TextLabel3, 2, 0);
+
+  SelectButton3  = new QPushButton(SubGroup1, "SelectButton3");
+  SelectButton3->setPixmap(image4);
+  SubGroup1Layout->addWidget(SelectButton3, 2, 1);
+
+  LineEdit3 = new QLineEdit(SubGroup1, "LineEdit3");
+  SubGroup1Layout->addWidget(LineEdit3, 2, 2);
 
   // Second subgroup
-  SubGroup2 = new QGroupBox( GroupArguments, "SubGroup2" );
-  SubGroup2->setColumnLayout(0, Qt::Vertical );
-  SubGroup2->layout()->setSpacing( 0 );
-  SubGroup2->layout()->setMargin( 0 );
-  QGridLayout* SubGroup2Layout = new QGridLayout( SubGroup2->layout() );
-  SubGroup2Layout->setAlignment( Qt::AlignTop );
-  SubGroup2Layout->setSpacing( 6 );
-  SubGroup2Layout->setMargin( 11 );
-  
+  SubGroup2 = new QGroupBox(GroupArguments, "SubGroup2");
+  SubGroup2->setColumnLayout(0, Qt::Vertical);
+  SubGroup2->layout()->setSpacing(0);
+  SubGroup2->layout()->setMargin(0);
+  QGridLayout* SubGroup2Layout = new QGridLayout(SubGroup2->layout());
+  SubGroup2Layout->setAlignment(Qt::AlignTop);
+  SubGroup2Layout->setSpacing(6);
+  SubGroup2Layout->setMargin(11);
+
   // Controls of the first subgroup
-  TextLabel4 = new QLabel( SubGroup2, "TextLabel4" );
-  SubGroup2Layout->addWidget( TextLabel4, 0, 0 );
-  
-  SelectButton4  = new QPushButton( SubGroup2, "SelectButton4" );
-  SelectButton4->setPixmap( image4 );
-  SubGroup2Layout->addWidget( SelectButton4, 0, 1 );
-  
-  LineEdit4 = new QLineEdit( SubGroup2, "LineEdit4" );
-  SubGroup2Layout->addWidget( LineEdit4, 0, 2 );
-  
-  TextLabel5 = new QLabel( SubGroup2, "TextLabel5" );
-  SubGroup2Layout->addWidget( TextLabel5, 1, 0 );
-  
-  SelectButton5  = new QPushButton( SubGroup2, "SelectButton5" );
-  SelectButton5->setPixmap( image4 );
-  SubGroup2Layout->addWidget( SelectButton5, 1, 1 );
-  
-  LineEdit5 = new QLineEdit( SubGroup2, "LineEdit5" );
-  SubGroup2Layout->addWidget( LineEdit5, 1, 2 );
+  TextLabel4 = new QLabel(SubGroup2, "TextLabel4");
+  SubGroup2Layout->addWidget(TextLabel4, 0, 0);
 
-  TextLabel6 = new QLabel( SubGroup2, "TextLabel6" );
-  SubGroup2Layout->addWidget( TextLabel6, 2, 0 );
-  
-  SelectButton6  = new QPushButton( SubGroup2, "SelectButton6" );
-  SelectButton6->setPixmap( image4 );
-  SubGroup2Layout->addWidget( SelectButton6, 2, 1 );
-  
-  LineEdit6 = new QLineEdit( SubGroup2, "LineEdit6" );
-  SubGroup2Layout->addWidget( LineEdit6, 2, 2 );
+  SelectButton4  = new QPushButton(SubGroup2, "SelectButton4");
+  SelectButton4->setPixmap(image4);
+  SubGroup2Layout->addWidget(SelectButton4, 0, 1);
+
+  LineEdit4 = new QLineEdit(SubGroup2, "LineEdit4");
+  SubGroup2Layout->addWidget(LineEdit4, 0, 2);
+
+  TextLabel5 = new QLabel(SubGroup2, "TextLabel5");
+  SubGroup2Layout->addWidget(TextLabel5, 1, 0);
+
+  SelectButton5  = new QPushButton(SubGroup2, "SelectButton5");
+  SelectButton5->setPixmap(image4);
+  SubGroup2Layout->addWidget(SelectButton5, 1, 1);
+
+  LineEdit5 = new QLineEdit(SubGroup2, "LineEdit5");
+  SubGroup2Layout->addWidget(LineEdit5, 1, 2);
+
+  TextLabel6 = new QLabel(SubGroup2, "TextLabel6");
+  SubGroup2Layout->addWidget(TextLabel6, 2, 0);
+
+  SelectButton6  = new QPushButton(SubGroup2, "SelectButton6");
+  SelectButton6->setPixmap(image4);
+  SubGroup2Layout->addWidget(SelectButton6, 2, 1);
+
+  LineEdit6 = new QLineEdit(SubGroup2, "LineEdit6");
+  SubGroup2Layout->addWidget(LineEdit6, 2, 2);
 
-  
   // Add subgroups to the group of arguments
-  GroupArgumentsLayout->addWidget( SubGroup1, 0, 0 );
-  GroupArgumentsLayout->addWidget( SubGroup2, 1, 0 );
+  GroupArgumentsLayout->addWidget(SubGroup1, 0, 0);
+  GroupArgumentsLayout->addWidget(SubGroup2, 1, 0);
 
   // Control for the merging equal elements
-  CheckBoxMerge = new QCheckBox( GroupArguments, "CheckBoxMerge" );
-  CheckBoxMerge->setText( tr( "MERGE_EQUAL_ELEMENTS"  ) );
-  GroupArgumentsLayout->addWidget( CheckBoxMerge, 2, 0 );
-  
+  CheckBoxMerge = new QCheckBox(GroupArguments, "CheckBoxMerge");
+  CheckBoxMerge->setText(tr("MERGE_EQUAL_ELEMENTS" ));
+  GroupArgumentsLayout->addWidget(CheckBoxMerge, 2, 0);
 
-  SMESHGUI_SewingDlgLayout->addWidget( GroupArguments, 1, 0 );
+// Control for the polygons creation instead of splitting
+  CheckBoxPolygons = new QCheckBox( GroupArguments, "CheckBoxPolygons" );
+  CheckBoxPolygons->setText( tr( "CREATE_POLYGONS_INSTEAD_SPLITTING"  ) );
+  GroupArgumentsLayout->addWidget( CheckBoxPolygons, 3, 0 );
   
+  // Control for the polyedres creation to obtain conform mesh
+  CheckBoxPolyedrs = new QCheckBox( GroupArguments, "CheckBoxPolyedrs" );
+  CheckBoxPolyedrs->setText( tr( "CREATE_POLYEDRS_NEAR_BOUNDARY"  ) );
+  GroupArgumentsLayout->addWidget( CheckBoxPolyedrs, 4, 0 );
+
+
+  SMESHGUI_SewingDlgLayout->addWidget(GroupArguments, 1, 0);
+
   /* Initialisations */
   GroupArguments->show();
-  RadioButton1->setChecked( TRUE );
-  mySelection = Sel;  
-  
-  LineEdit2->setValidator( new SMESHGUI_IdValidator( this, "validator", 1));
-  LineEdit3->setValidator( new SMESHGUI_IdValidator( this, "validator", 1));
-  LineEdit5->setValidator( new SMESHGUI_IdValidator( this, "validator", 1));
-  LineEdit6->setValidator( new SMESHGUI_IdValidator( this, "validator", 1));
-  
-  mySMESHGUI  = SMESHGUI::GetSMESHGUI() ;
-  mySMESHGUI->SetActiveDialogBox( (QDialog*)this ) ;
+  RadioButton1->setChecked(TRUE);
+
+  LineEdit2->setValidator(new SMESHGUI_IdValidator(this, "validator", 1));
+  LineEdit3->setValidator(new SMESHGUI_IdValidator(this, "validator", 1));
+  LineEdit5->setValidator(new SMESHGUI_IdValidator(this, "validator", 1));
+  LineEdit6->setValidator(new SMESHGUI_IdValidator(this, "validator", 1));
+
+  mySMESHGUI->SetActiveDialogBox((QDialog*)this);
 
   Init();
+
   /* signals and slots connections */
-  connect( buttonOk, SIGNAL( clicked() ),     this, SLOT( ClickOnOk() ) );
-  connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ) ;
-  connect( buttonApply, SIGNAL( clicked() ), this, SLOT(ClickOnApply() ) );
-  connect( GroupConstructors, SIGNAL(clicked(int) ), SLOT( ConstructorsClicked(int) ) );
-  
-  connect( SelectButton1, SIGNAL (clicked() ),   this, SLOT( SetEditCurrentArgument() ) ) ;
-  connect( SelectButton2, SIGNAL (clicked() ),   this, SLOT( SetEditCurrentArgument() ) ) ;
-  connect( SelectButton3, SIGNAL (clicked() ),   this, SLOT( SetEditCurrentArgument() ) ) ;
-  connect( SelectButton4, SIGNAL (clicked() ),   this, SLOT( SetEditCurrentArgument() ) ) ;
-  connect( SelectButton5, SIGNAL (clicked() ),   this, SLOT( SetEditCurrentArgument() ) ) ;
-  connect( SelectButton6, SIGNAL (clicked() ),   this, SLOT( SetEditCurrentArgument() ) ) ;
-
-  connect( mySMESHGUI, SIGNAL ( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ;
-  connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
+  connect(buttonOk, SIGNAL(clicked()),     this, SLOT(ClickOnOk()));
+  connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel()));
+  connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply()));
+  connect(GroupConstructors, SIGNAL(clicked(int)), SLOT(ConstructorsClicked(int)));
+
+  connect(SelectButton1, SIGNAL (clicked()),   this, SLOT(SetEditCurrentArgument()));
+  connect(SelectButton2, SIGNAL (clicked()),   this, SLOT(SetEditCurrentArgument()));
+  connect(SelectButton3, SIGNAL (clicked()),   this, SLOT(SetEditCurrentArgument()));
+  connect(SelectButton4, SIGNAL (clicked()),   this, SLOT(SetEditCurrentArgument()));
+  connect(SelectButton5, SIGNAL (clicked()),   this, SLOT(SetEditCurrentArgument()));
+  connect(SelectButton6, SIGNAL (clicked()),   this, SLOT(SetEditCurrentArgument()));
+
+  connect(mySMESHGUI, SIGNAL (SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog()));
+  connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
   /* to close dialog if study change */
-  connect( mySMESHGUI, SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ) ;
-
-  connect( LineEdit1, SIGNAL( textChanged( const QString& )), SLOT( onTextChange( const QString& )));
-  connect( LineEdit2, SIGNAL( textChanged( const QString& )), SLOT( onTextChange( const QString& )));
-  connect( LineEdit3, SIGNAL( textChanged( const QString& )), SLOT( onTextChange( const QString& )));
-  connect( LineEdit4, SIGNAL( textChanged( const QString& )), SLOT( onTextChange( const QString& )));
-  connect( LineEdit5, SIGNAL( textChanged( const QString& )), SLOT( onTextChange( const QString& )));
-  connect( LineEdit6, SIGNAL( textChanged( const QString& )), SLOT( onTextChange( const QString& )));
-  
+  connect(mySMESHGUI, SIGNAL (SignalCloseAllDialogs()), this, SLOT(ClickOnCancel()));
+
+  connect(LineEdit1, SIGNAL(textChanged(const QString&)), SLOT(onTextChange(const QString&)));
+  connect(LineEdit2, SIGNAL(textChanged(const QString&)), SLOT(onTextChange(const QString&)));
+  connect(LineEdit3, SIGNAL(textChanged(const QString&)), SLOT(onTextChange(const QString&)));
+  connect(LineEdit4, SIGNAL(textChanged(const QString&)), SLOT(onTextChange(const QString&)));
+  connect(LineEdit5, SIGNAL(textChanged(const QString&)), SLOT(onTextChange(const QString&)));
+  connect(LineEdit6, SIGNAL(textChanged(const QString&)), SLOT(onTextChange(const QString&)));
+
   /* Move widget on the botton right corner of main widget */
-  int x, y ;
-  mySMESHGUI->DefineDlgPosition( this, x, y ) ;
-  this->move( x, y ) ;
-  this->show() ; /* displays Dialog */
-  
+  int x, y;
+  mySMESHGUI->DefineDlgPosition(this, x, y);
+  this->move(x, y);
+  this->show(); /* displays Dialog */
+
   ConstructorsClicked(0);
   resize(0,0);
 }
@@ -306,7 +331,6 @@ SMESHGUI_SewingDlg::~SMESHGUI_SewingDlg()
   // no need to delete child widgets, Qt does it all for us
 }
 
-
 //=================================================================================
 // function : Init()
 // purpose  :
@@ -317,21 +341,22 @@ void SMESHGUI_SewingDlg::Init()
 
   myEditCurrentArgument = LineEdit1;
   LineEdit1->setFocus();
-  myActor     = 0;
+  myActor = 0;
   myMesh = SMESH::SMESH_Mesh::_nil();
   CheckBoxMerge->setChecked(false);
+  CheckBoxPolygons->setChecked(false);
+  CheckBoxPolyedrs->setChecked(false);
   SelectionIntoArgument();
 }
 
-
 //=================================================================================
 // function : ConstructorsClicked()
 // purpose  : Radio button management
 //=================================================================================
-void SMESHGUI_SewingDlg::ConstructorsClicked(int constructorId)
+void SMESHGUI_SewingDlg::ConstructorsClicked (int constructorId)
 {
-  disconnect(mySelection, 0, this, 0);
-  mySelection->ClearIObjects();
+  disconnect(mySelectionMgr, 0, this, 0);
+  mySelectionMgr->clearSelected();
   LineEdit1->setText("");
   LineEdit2->setText("");
   LineEdit3->setText("");
@@ -341,99 +366,114 @@ void SMESHGUI_SewingDlg::ConstructorsClicked(int constructorId)
   myOk1 = myOk2 = myOk3 = myOk4 = myOk5 = myOk6 = false;
   myEditCurrentArgument = LineEdit1;
   myEditCurrentArgument->setFocus();
-  
-  if (!TextLabel5->isEnabled())
+
+  if (!TextLabel5->isEnabled()) {
+    TextLabel5->setEnabled(true);
+    SelectButton5->setEnabled(true);
+    LineEdit5->setEnabled(true);
+  } else if (!TextLabel6->isEnabled()) {
+    TextLabel6->setEnabled(true);
+    SelectButton6->setEnabled(true);
+    LineEdit6->setEnabled(true);
+  }
+
+  if (constructorId == 1 || constructorId == 3) {
+    if (CheckBoxPolygons->isVisible())
+      CheckBoxPolygons->hide();
+    if (CheckBoxPolyedrs->isVisible())
+      CheckBoxPolyedrs->hide();
+  }
+
+  switch (constructorId) {
+  case 0:
     {
-      TextLabel5->setEnabled(true);
-      SelectButton5->setEnabled(true);
-      LineEdit5->setEnabled(true);
+      GroupArguments->setTitle(tr("SEW_FREE_BORDERS"));
+      SubGroup1->setTitle(tr("BORDER_1"));
+      SubGroup2->setTitle(tr("BORDER_2"));
+
+        if (!CheckBoxPolygons->isVisible())
+          CheckBoxPolygons->show();
+        if (!CheckBoxPolyedrs->isVisible())
+          CheckBoxPolyedrs->show();
+
+
+      break;
     }
-  else if (!TextLabel6->isEnabled())
+  case 1:
     {
-      TextLabel6->setEnabled(true);
-      SelectButton6->setEnabled(true);
-      LineEdit6->setEnabled(true);
+      GroupArguments->setTitle(tr("SEW_CONFORM_FREE_BORDERS"));
+      SubGroup1->setTitle(tr("BORDER_1"));
+      SubGroup2->setTitle(tr("BORDER_2"));
+
+      TextLabel6->setEnabled(false);
+      SelectButton6->setEnabled(false);
+      LineEdit6->setEnabled(false);
+
+      myOk6 = true;
+
+      break;
     }
-  
-  switch(constructorId)
+  case 2:
     {
-    case 0 :
-      { 
-       GroupArguments->setTitle( tr( "SEW_FREE_BORDERS" ) );
-       SubGroup1->setTitle( tr( "BORDER_1" ) );
-       SubGroup2->setTitle( tr( "BORDER_2" ) );
-       
-       break;
-      }
-    case 1 :
-      {
-       GroupArguments->setTitle( tr( "SEW_CONFORM_FREE_BORDERS" ) );
-       SubGroup1->setTitle( tr( "BORDER_1" ) );
-       SubGroup2->setTitle( tr( "BORDER_2" ) );
-       
-       TextLabel6->setEnabled(false);
-       SelectButton6->setEnabled(false);
-       LineEdit6->setEnabled(false);
-       
-       myOk6 = true;
-         
-       break;
-      }
-    case 2 :
-      {
-       GroupArguments->setTitle( tr( "SEW_BORDER_TO_SIDE" ) );
-       SubGroup1->setTitle( tr( "BORDER" ) );
-       SubGroup2->setTitle( tr( "SIDE" ) );
+      GroupArguments->setTitle(tr("SEW_BORDER_TO_SIDE"));
+      SubGroup1->setTitle(tr("BORDER"));
+      SubGroup2->setTitle(tr("SIDE"));
+
+      TextLabel5->setEnabled(false);
+      SelectButton5->setEnabled(false);
+      LineEdit5->setEnabled(false);
+
+      if (!CheckBoxPolygons->isVisible())
+       CheckBoxPolygons->show();
+      if (!CheckBoxPolyedrs->isVisible())
+       CheckBoxPolyedrs->show();
+      
 
-       TextLabel5->setEnabled(false);
-       SelectButton5->setEnabled(false);
-       LineEdit5->setEnabled(false);
-       
-       myOk5 = true;
+      myOk5 = true;
 
-       break;
-      }
-    case 3 :
-      {        
-       GroupArguments->setTitle( tr( "SEW_SIDE_ELEMENTS" ) );
-       SubGroup1->setTitle( tr( "SIDE_1" ) );
-       SubGroup2->setTitle( tr( "SIDE_2" ) );
-       
-       TextLabel1->setText( tr( "SMESH_ID_ELEMENTS" ) );
-       TextLabel2->setText( tr( "NODE1_TO_MERGE" ) );
-       TextLabel3->setText( tr( "NODE2_TO_MERGE" ) );
-       TextLabel4->setText( tr( "SMESH_ID_ELEMENTS" ) );
-       TextLabel5->setText( tr( "NODE1_TO_MERGE" ) );
-       TextLabel6->setText( tr( "NODE2_TO_MERGE" ) );
-
-       LineEdit1->setValidator( new SMESHGUI_IdValidator( this, "validator"));
-       LineEdit4->setValidator( new SMESHGUI_IdValidator( this, "validator"));
-
-       SMESH::SetPointRepresentation(false);
-       QAD_Application::getDesktop()->SetSelectionMode( CellSelection, true );
-       break;
-      }
+      break;
     }
-  
-  if (constructorId != 3)
+  case 3:
     {
-      TextLabel1->setText( tr( "FIRST_NODE_ID" ) );
-      TextLabel2->setText( tr( "SECOND_NODE_ID" ) );
-      TextLabel3->setText( tr( "LAST_NODE_ID" ) );
-      TextLabel4->setText( tr( "FIRST_NODE_ID" ) );
-      TextLabel5->setText( tr( "SECOND_NODE_ID" ) );
-      TextLabel6->setText( tr( "LAST_NODE_ID" ) );
-      
-      LineEdit1->setValidator( new SMESHGUI_IdValidator( this, "validator", 1));
-      LineEdit4->setValidator( new SMESHGUI_IdValidator( this, "validator", 1));
+      GroupArguments->setTitle(tr("SEW_SIDE_ELEMENTS"));
+      SubGroup1->setTitle(tr("SIDE_1"));
+      SubGroup2->setTitle(tr("SIDE_2"));
 
-      SMESH::SetPointRepresentation(true);
-      QAD_Application::getDesktop()->SetSelectionMode( NodeSelection, true );
+      TextLabel1->setText(tr("SMESH_ID_ELEMENTS"));
+      TextLabel2->setText(tr("NODE1_TO_MERGE"));
+      TextLabel3->setText(tr("NODE2_TO_MERGE"));
+      TextLabel4->setText(tr("SMESH_ID_ELEMENTS"));
+      TextLabel5->setText(tr("NODE1_TO_MERGE"));
+      TextLabel6->setText(tr("NODE2_TO_MERGE"));
+
+      LineEdit1->setValidator(new SMESHGUI_IdValidator(this, "validator"));
+      LineEdit4->setValidator(new SMESHGUI_IdValidator(this, "validator"));
+
+      SMESH::SetPointRepresentation(false);
+
+      myViewWindow->SetSelectionMode(CellSelection);
+      break;
     }
-  
-  connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
-}
+  }
 
+  if (constructorId != 3) {
+    TextLabel1->setText(tr("FIRST_NODE_ID"));
+    TextLabel2->setText(tr("SECOND_NODE_ID"));
+    TextLabel3->setText(tr("LAST_NODE_ID"));
+    TextLabel4->setText(tr("FIRST_NODE_ID"));
+    TextLabel5->setText(tr("SECOND_NODE_ID"));
+    TextLabel6->setText(tr("LAST_NODE_ID"));
+
+    LineEdit1->setValidator(new SMESHGUI_IdValidator(this, "validator", 1));
+    LineEdit4->setValidator(new SMESHGUI_IdValidator(this, "validator", 1));
+
+    SMESH::SetPointRepresentation(true);
+
+    myViewWindow->SetSelectionMode(NodeSelection);
+  }
+
+  connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
+}
 
 //=================================================================================
 // function : ClickOnApply()
@@ -441,92 +481,95 @@ void SMESHGUI_SewingDlg::ConstructorsClicked(int constructorId)
 //=================================================================================
 bool SMESHGUI_SewingDlg::ClickOnApply()
 {
-  if (mySMESHGUI->ActiveStudyLocked())
+  if (mySMESHGUI->isActiveStudyLocked())
     return false;
-  
+
   bool aResult = false;
 
-  if ( IsValid() )
-    {
-      bool toMerge = CheckBoxMerge->isChecked();
-    
-      try
-       {
-         SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
-         QApplication::setOverrideCursor(Qt::waitCursor);
-       
-         int aConstructorId = GetConstructorId();
-          SMESH::SMESH_MeshEditor::Sew_Error anError;
-  
-         if (aConstructorId == 0)
-           anError = aMeshEditor->SewFreeBorders(LineEdit1->text().toLong(),
-                                                 LineEdit2->text().toLong(),
-                                                 LineEdit3->text().toLong(),
-                                                 LineEdit4->text().toLong(),
-                                                 LineEdit5->text().toLong(),
-                                                 LineEdit6->text().toLong());
-         else if (aConstructorId == 1)
-           anError = aMeshEditor->SewConformFreeBorders(LineEdit1->text().toLong(),
-                                                        LineEdit2->text().toLong(),
-                                                        LineEdit3->text().toLong(),
-                                                        LineEdit4->text().toLong(),
-                                                        LineEdit5->text().toLong());
-         else if (aConstructorId == 2)
-           anError = aMeshEditor->SewBorderToSide(LineEdit1->text().toLong(),
-                                                  LineEdit2->text().toLong(),
-                                                  LineEdit3->text().toLong(),
-                                                  LineEdit4->text().toLong(),
-                                                  LineEdit6->text().toLong());
-         else if (aConstructorId == 3)
-           {
-             QStringList aListElementsId1 = QStringList::split( " ", LineEdit1->text(), false);
-             QStringList aListElementsId2 = QStringList::split( " ", LineEdit4->text(), false);
-             
-             SMESH::long_array_var anElementsId1 = new SMESH::long_array;
-             SMESH::long_array_var anElementsId2 = new SMESH::long_array;
-      
-             anElementsId1->length( aListElementsId1.count() );
-             anElementsId2->length( aListElementsId2.count() );
-
-             for ( int i = 0; i < aListElementsId1.count(); i++ )
-               anElementsId1[i] = aListElementsId1[i].toInt();
-             for ( int i = 0; i < aListElementsId2.count(); i++ )
-               anElementsId2[i] = aListElementsId2[i].toInt();
-
-             anError = aMeshEditor->SewSideElements(anElementsId1.inout(),
-                                                    anElementsId2.inout(),
-                                                    LineEdit2->text().toLong(),
-                                                    LineEdit5->text().toLong(),
-                                                    LineEdit3->text().toLong(),
-                                                    LineEdit6->text().toLong());
-           }
-         aResult = ( anError == SMESH::SMESH_MeshEditor::SEW_OK );
-
-         if (toMerge && aResult)
-           aMeshEditor->MergeEqualElements();
-         
-         QApplication::restoreOverrideCursor();
-
-          if ( !aResult ) {
-            QString msg = tr(QString("ERROR_%1").arg(anError));
-            QAD_MessageBox::warn1(QAD_Application::getDesktop(),
-                                  tr("SMESH_WRN_WARNING"),msg,tr("SMESH_BUT_OK"));
-          }
-        }
-      catch( ... )
-       {
-       }
-      
-      if ( aResult )
-       {
-         Handle(SALOME_InteractiveObject) anIO = myActor->getIO();
-         mySelection->ClearIObjects();
-         SMESH::UpdateView();
-         mySelection->AddIObject( anIO, false );
-         Init();
-         ConstructorsClicked(GetConstructorId());
-       }
+  if (IsValid()) {
+    bool toMerge = CheckBoxMerge->isChecked();
+    bool toCreatePolygons = CheckBoxPolygons->isChecked();
+    bool toCreatePolyedrs = CheckBoxPolyedrs->isChecked();
+
+    try {
+      SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
+      QApplication::setOverrideCursor(Qt::waitCursor);
+
+      int aConstructorId = GetConstructorId();
+      SMESH::SMESH_MeshEditor::Sew_Error anError;
+
+      if (aConstructorId == 0)
+        anError = aMeshEditor->SewFreeBorders(LineEdit1->text().toLong(),
+                                              LineEdit2->text().toLong(),
+                                              LineEdit3->text().toLong(),
+                                              LineEdit4->text().toLong(),
+                                              LineEdit5->text().toLong(),
+                                              LineEdit6->text().toLong(),
+                                             toCreatePolygons,
+                                             toCreatePolyedrs);
+      else if (aConstructorId == 1)
+        anError = aMeshEditor->SewConformFreeBorders(LineEdit1->text().toLong(),
+                                                     LineEdit2->text().toLong(),
+                                                     LineEdit3->text().toLong(),
+                                                     LineEdit4->text().toLong(),
+                                                     LineEdit5->text().toLong());
+      else if (aConstructorId == 2)
+        anError = aMeshEditor->SewBorderToSide(LineEdit1->text().toLong(),
+                                               LineEdit2->text().toLong(),
+                                               LineEdit3->text().toLong(),
+                                               LineEdit4->text().toLong(),
+                                               LineEdit6->text().toLong(),
+                                              toCreatePolygons,
+                                              toCreatePolyedrs);
+      else if (aConstructorId == 3) {
+        QStringList aListElementsId1 = QStringList::split(" ", LineEdit1->text(), false);
+        QStringList aListElementsId2 = QStringList::split(" ", LineEdit4->text(), false);
+
+        SMESH::long_array_var anElementsId1 = new SMESH::long_array;
+        SMESH::long_array_var anElementsId2 = new SMESH::long_array;
+
+        anElementsId1->length(aListElementsId1.count());
+        anElementsId2->length(aListElementsId2.count());
+
+        for (int i = 0; i < aListElementsId1.count(); i++)
+          anElementsId1[i] = aListElementsId1[i].toInt();
+        for (int i = 0; i < aListElementsId2.count(); i++)
+          anElementsId2[i] = aListElementsId2[i].toInt();
+
+        anError = aMeshEditor->SewSideElements(anElementsId1.inout(),
+                                               anElementsId2.inout(),
+                                               LineEdit2->text().toLong(),
+                                               LineEdit5->text().toLong(),
+                                               LineEdit3->text().toLong(),
+                                               LineEdit6->text().toLong());
+      }
+      aResult = (anError == SMESH::SMESH_MeshEditor::SEW_OK);
+
+      if (toMerge && aResult)
+        aMeshEditor->MergeEqualElements();
+
+      QApplication::restoreOverrideCursor();
+
+      if (!aResult) {
+        QString msg = tr(QString("ERROR_%1").arg(anError));
+        SUIT_MessageBox::warn1(SMESHGUI::desktop(), tr("SMESH_WRN_WARNING"),
+                               msg, tr("SMESH_BUT_OK"));
+      }
+    } catch (...) {
+    }
+
+    if (aResult) {
+      Handle(SALOME_InteractiveObject) anIO = myActor->getIO();
+
+      SALOME_ListIO aList;
+      aList.Append(anIO);
+      mySelectionMgr->setSelectedObjects(aList, false);
+      SMESH::UpdateView();
+
+      Init();
+      ConstructorsClicked(GetConstructorId());
     }
+  }
 
   return aResult;
 }
@@ -537,40 +580,38 @@ bool SMESHGUI_SewingDlg::ClickOnApply()
 //=================================================================================
 void SMESHGUI_SewingDlg::ClickOnOk()
 {
-  ifClickOnApply())
-    ClickOnCancel() ;
+  if (ClickOnApply())
+    ClickOnCancel();
 }
 
-       
 //=================================================================================
 // function : ClickOnCancel()
 // purpose  :
 //=================================================================================
 void SMESHGUI_SewingDlg::ClickOnCancel()
 {
-  mySelection->ClearIObjects();
+  mySelectionMgr->clearSelected();
   SMESH::SetPointRepresentation(false);
-  QAD_Application::getDesktop()->SetSelectionMode( ActorSelection );
-  disconnect( mySelection, 0, this, 0 );
-  mySMESHGUI->ResetState() ;
-  reject() ;
+  myViewWindow->SetSelectionMode(ActorSelection);
+  disconnect(mySelectionMgr, 0, this, 0);
+  mySMESHGUI->ResetState();
+  reject();
 }
 
 //=======================================================================
 //function : onTextChange
-//purpose  : 
+//purpose  :
 //=======================================================================
-
-void SMESHGUI_SewingDlg::onTextChange(const QString& theNewText)
+void SMESHGUI_SewingDlg::onTextChange (const QString& theNewText)
 {
   QLineEdit* send = (QLineEdit*)sender();
 
-  if ( myBusy ) return;
+  if (myBusy) return;
   myBusy = true;
 
   if (send)
     myEditCurrentArgument = send;
+
   if      (send == LineEdit1)
     myOk1 = false;
   else if (send == LineEdit2)
@@ -584,163 +625,179 @@ void SMESHGUI_SewingDlg::onTextChange(const QString& theNewText)
   else if (send == LineEdit6)
     myOk6 = false;
 
-  buttonOk->setEnabled( false );
-  buttonApply->setEnabled( false );
-  
+  buttonOk->setEnabled(false);
+  buttonApply->setEnabled(false);
+
   // hilight entered elements/nodes
   SMDS_Mesh* aMesh = 0;
-  
-  if ( myActor )
+
+  if (myActor)
     aMesh = myActor->GetObject()->GetMesh();
   else
     send->clear();
-  
-  if ( aMesh ) {
-    mySelection->ClearIObjects();
-    mySelection->AddIObject( myActor->getIO() );
-  
-    if (GetConstructorId() != 3 || (send != LineEdit1 && send != LineEdit4))
-      {
-       SMESH::SetPointRepresentation(true);
-       QAD_Application::getDesktop()->SetSelectionMode( NodeSelection, true );
-       
-       const SMDS_MeshNode * n = aMesh->FindNode( theNewText.toInt() );
-       if ( n ) {
-         if ( !mySelection->IsIndexSelected( myActor->getIO(), n->GetID() ))
-           mySelection->AddOrRemoveIndex (myActor->getIO(), n->GetID(), true);
-         
-         if      (send == LineEdit1)
-           myOk1 = true;
-         else if (send == LineEdit2)
-           myOk2 = true;
-         else if (send == LineEdit3)
-           myOk3 = true;
-         else if (send == LineEdit4)
-           myOk4 = true;
-         else if (send == LineEdit5)
-           myOk5 = true;
-         else if (send == LineEdit6)
-           myOk6 = true;
-       }
+
+  if (aMesh) {
+    //mySelectionMgr->clearSelected();
+    //mySelectionMgr->AddIObject(myActor->getIO());
+    SALOME_ListIO aList;
+    aList.Append(myActor->getIO());
+    mySelectionMgr->setSelectedObjects(aList, false);
+
+    TColStd_IndexedMapOfInteger selectedIndices;
+    TColStd_MapOfInteger newIndices;
+    mySelector->GetIndex( myActor->getIO(), selectedIndices);
+
+    if (GetConstructorId() != 3 || (send != LineEdit1 && send != LineEdit4)) {
+      SMESH::SetPointRepresentation(true);
+
+      myViewWindow->SetSelectionMode(NodeSelection);
+
+      const SMDS_MeshNode * n = aMesh->FindNode(theNewText.toInt());
+      if (n) {
+        //if (!mySelectionMgr->IsIndexSelected(myActor->getIO(), n->GetID())) {
+        if (selectedIndices.Add(n->GetID())) {
+          //mySelectionMgr->AddOrRemoveIndex (myActor->getIO(), n->GetID(), true);
+          newIndices.Add(n->GetID());
+          mySelector->AddOrRemoveIndex(myActor->getIO(), newIndices, true);
+         myViewWindow->highlight( myActor->getIO(), true, true );
+        }
+
+        if      (send == LineEdit1)
+          myOk1 = true;
+        else if (send == LineEdit2)
+          myOk2 = true;
+        else if (send == LineEdit3)
+          myOk3 = true;
+        else if (send == LineEdit4)
+          myOk4 = true;
+        else if (send == LineEdit5)
+          myOk5 = true;
+        else if (send == LineEdit6)
+          myOk6 = true;
       }
-    else
+    } else {
+      SMESH::SetPointRepresentation(false);
+
+      myViewWindow->SetSelectionMode(CellSelection);
+
+      QStringList aListId = QStringList::split(" ", theNewText, false);
+
+      bool isEvenOneExists = false;
+
+      for (int i = 0; i < aListId.count(); i++) {
+        const SMDS_MeshElement * e = aMesh->FindElement(aListId[ i ].toInt());
+        if (e) {
+          //if (!mySelectionMgr->IsIndexSelected(myActor->getIO(), e->GetID())) {
+          if (selectedIndices.Add(e->GetID())) {
+            //mySelectionMgr->AddOrRemoveIndex (myActor->getIO(), e->GetID(), true);
+            newIndices.Add(e->GetID());
+          }
+          if (!isEvenOneExists)
+            isEvenOneExists = true;
+        }
+      }
+
+      if (newIndices.Extent() > 0)
       {
-       SMESH::SetPointRepresentation(false);
-       QAD_Application::getDesktop()->SetSelectionMode( CellSelection, true );
-       
-       QStringList aListId = QStringList::split( " ", theNewText, false);
-       
-       bool isEvenOneExists = false;
-       
-       for ( int i = 0; i < aListId.count(); i++ ) {
-         const SMDS_MeshElement * e = aMesh->FindElement( aListId[ i ].toInt() );
-         if ( e ) {
-           if ( !mySelection->IsIndexSelected( myActor->getIO(), e->GetID() ))
-             mySelection->AddOrRemoveIndex (myActor->getIO(), e->GetID(), true);
-           if (!isEvenOneExists) 
-             isEvenOneExists = true;
-         }
-       }
-       
-       if (isEvenOneExists)
-         {
-           if (send == LineEdit1)
-             myOk1 = true;
-           else if(send == LineEdit4)
-             myOk4 = true;
-         }
-       else
-         send->clear();
+        mySelector->AddOrRemoveIndex(myActor->getIO(), newIndices, true);
+       myViewWindow->highlight( myActor->getIO(), true, true );
       }
+
+      if (isEvenOneExists) {
+        if (send == LineEdit1)
+          myOk1 = true;
+        else if(send == LineEdit4)
+          myOk4 = true;
+      } else {
+        send->clear();
+      }
+    }
   }
-  
-  if ( IsValid() ) {
-    buttonOk->setEnabled( true );
-    buttonApply->setEnabled( true );
+
+  if (IsValid()) {
+    buttonOk->setEnabled(true);
+    buttonApply->setEnabled(true);
   }
-  
+
   myBusy = false;
 }
 
-
 //=================================================================================
 // function : SelectionIntoArgument()
 // purpose  : Called when selection as changed or other case
 //=================================================================================
-void SMESHGUI_SewingDlg::SelectionIntoArgument(bool isSelectionChanged)
+void SMESHGUI_SewingDlg::SelectionIntoArgument (bool isSelectionChanged)
 {
-  if ( myBusy ) return;
-  
+  if (myBusy) return;
+
   // clear
   if (isSelectionChanged)
     myActor = 0;
-  
+
   QString aString = "";
-  
+
   myBusy = true;
-  myEditCurrentArgument->setText( aString );
+  myEditCurrentArgument->setText(aString);
   myBusy = false;
-  
-  if ( !GroupButtons->isEnabled() ) // inactive
+
+  if (!GroupButtons->isEnabled()) // inactive
     return;
-  
-  buttonOk->setEnabled( false );
-  buttonApply->setEnabled( false );
-  
+
+  buttonOk->setEnabled(false);
+  buttonApply->setEnabled(false);
+
   // get selected mesh
-  int nbSel = mySelection->IObjectCount();
-  if(nbSel != 1)
+  SALOME_ListIO aList;
+  mySelectionMgr->selectedObjects(aList,SVTK_Viewer::Type());
+
+  int nbSel = aList.Extent();
+  if (nbSel != 1)
     return;
-  
-  Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject();
-  myMesh = SMESH::IObjectToInterface<SMESH::SMESH_Mesh>(IO) ;
-  myActor = SMESH::FindActorByEntry( mySelection->firstIObject()->getEntry() );
-  
+
+  Handle(SALOME_InteractiveObject) IO = aList.First();
+  myMesh = SMESH::IObjectToInterface<SMESH::SMESH_Mesh>(IO);
+  myActor = SMESH::FindActorByEntry(aList.First()->getEntry());
+
   if (myMesh->_is_nil() || !myActor)
     return;
-  
+
   // get selected elements/nodes
-  
   int aNbUnits = 0;
-  
-  if (GetConstructorId() != 3 || (myEditCurrentArgument != LineEdit1 && myEditCurrentArgument != LineEdit4))
-    {
-      aNbUnits = SMESH::GetNameOfSelectedNodes(mySelection, aString);
-      if(aNbUnits != 1)
-       return;
-    }
-  else
-    {
-      aNbUnits = SMESH::GetNameOfSelectedElements(mySelection, aString);
-      if(aNbUnits < 1) 
-       return;
-    }
-  
+
+  if (GetConstructorId() != 3 ||
+      (myEditCurrentArgument != LineEdit1 && myEditCurrentArgument != LineEdit4)) {
+    aNbUnits = SMESH::GetNameOfSelectedNodes(mySelector, myActor->getIO(), aString);
+    if (aNbUnits != 1)
+      return;
+  } else {
+    aNbUnits = SMESH::GetNameOfSelectedElements(mySelector, myActor->getIO(), aString);
+    if (aNbUnits < 1)
+      return;
+  }
+
   myBusy = true;
-  myEditCurrentArgument->setText( aString );
+  myEditCurrentArgument->setText(aString);
   myBusy = false;
-  
+
   // OK
   if (myEditCurrentArgument == LineEdit1)
     myOk1 = true;
-  else if(myEditCurrentArgument == LineEdit2)
+  else if (myEditCurrentArgument == LineEdit2)
     myOk2 = true;
-  else if(myEditCurrentArgument == LineEdit3)
+  else if (myEditCurrentArgument == LineEdit3)
     myOk3 = true;
-  else if(myEditCurrentArgument == LineEdit4)
+  else if (myEditCurrentArgument == LineEdit4)
     myOk4 = true;
-  else if(myEditCurrentArgument == LineEdit5)
+  else if (myEditCurrentArgument == LineEdit5)
     myOk5 = true;
-  else if(myEditCurrentArgument == LineEdit6)
+  else if (myEditCurrentArgument == LineEdit6)
     myOk6 = true;
-  
-  if(IsValid())
-    {
-      buttonOk->setEnabled( true );
-      buttonApply->setEnabled( true );
-    }
-}
 
+  if (IsValid()) {
+    buttonOk->setEnabled(true);
+    buttonApply->setEnabled(true);
+  }
+}
 
 //=================================================================================
 // function : SetEditCurrentArgument()
@@ -749,11 +806,11 @@ void SMESHGUI_SewingDlg::SelectionIntoArgument(bool isSelectionChanged)
 void SMESHGUI_SewingDlg::SetEditCurrentArgument()
 {
   QPushButton* send = (QPushButton*)sender();
-  
-  disconnect( mySelection, 0, this, 0 );
-  mySelection->ClearIObjects();
-  
-  if(send == SelectButton1) {
+
+  disconnect(mySelectionMgr, 0, this, 0);
+  mySelectionMgr->clearSelected();
+
+  if (send == SelectButton1) {
     myEditCurrentArgument = LineEdit1;
     myOk1 = false;
   }
@@ -777,21 +834,20 @@ void SMESHGUI_SewingDlg::SetEditCurrentArgument()
     myEditCurrentArgument = LineEdit6;
     myOk6 = false;
   }
-  
-  if (GetConstructorId() != 3 || (send != SelectButton1 && send != SelectButton4))
-    {
-      SMESH::SetPointRepresentation(true);
-      QAD_Application::getDesktop()->SetSelectionMode( NodeSelection, true );
-    }
-  else
-    {
-      SMESH::SetPointRepresentation(false);
-      QAD_Application::getDesktop()->SetSelectionMode( CellSelection, true );
-    }
-  
+
+  if (GetConstructorId() != 3 || (send != SelectButton1 && send != SelectButton4)) {
+    SMESH::SetPointRepresentation(true);
+
+    myViewWindow->SetSelectionMode(NodeSelection);
+
+  } else {
+    SMESH::SetPointRepresentation(false);
+    myViewWindow->SetSelectionMode(CellSelection);
+  }
+
   myEditCurrentArgument->setFocus();
-  connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
-  SelectionIntoArgument(false) ;
+  connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
+  SelectionIntoArgument(false);
 }
 
 //=================================================================================
@@ -800,16 +856,15 @@ void SMESHGUI_SewingDlg::SetEditCurrentArgument()
 //=================================================================================
 void SMESHGUI_SewingDlg::DeactivateActiveDialog()
 {
-  if ( GroupConstructors->isEnabled() ) {
-    GroupConstructors->setEnabled(false) ;
-    GroupArguments->setEnabled(false) ;
-    GroupButtons->setEnabled(false) ;
-    mySMESHGUI->ResetState() ;    
-    mySMESHGUI->SetActiveDialogBox(0) ;
+  if (GroupConstructors->isEnabled()) {
+    GroupConstructors->setEnabled(false);
+    GroupArguments->setEnabled(false);
+    GroupButtons->setEnabled(false);
+    mySMESHGUI->ResetState();
+    mySMESHGUI->SetActiveDialogBox(0);
   }
 }
 
-
 //=================================================================================
 // function : ActivateThisDialog()
 // purpose  :
@@ -817,68 +872,61 @@ void SMESHGUI_SewingDlg::DeactivateActiveDialog()
 void SMESHGUI_SewingDlg::ActivateThisDialog()
 {
   /* Emit a signal to deactivate the active dialog */
-  mySMESHGUI->EmitSignalDeactivateDialog() ;   
-  GroupConstructors->setEnabled(true) ;
-  GroupArguments->setEnabled(true) ;
-  GroupButtons->setEnabled(true) ;
-  
-  mySMESHGUI->SetActiveDialogBox( (QDialog*)this ) ;
-  
+  mySMESHGUI->EmitSignalDeactivateDialog();
+  GroupConstructors->setEnabled(true);
+  GroupArguments->setEnabled(true);
+  GroupButtons->setEnabled(true);
+
+  mySMESHGUI->SetActiveDialogBox((QDialog*)this);
+
   ConstructorsClicked(GetConstructorId());
   SelectionIntoArgument();
 }
 
-
 //=================================================================================
 // function : enterEvent()
 // purpose  :
 //=================================================================================
-void SMESHGUI_SewingDlg::enterEvent(QEvent* e)
+void SMESHGUI_SewingDlg::enterEvent (QEvent* e)
 {
-  if ( GroupConstructors->isEnabled() )
-    return ;  
-  ActivateThisDialog() ;
+  if (!GroupConstructors->isEnabled())
+    ActivateThisDialog();
 }
 
-
 //=================================================================================
 // function : closeEvent()
 // purpose  :
 //=================================================================================
-void SMESHGUI_SewingDlg::closeEvent( QCloseEvent* e )
+void SMESHGUI_SewingDlg::closeEvent (QCloseEvent*)
 {
   /* same than click on cancel button */
-  this->ClickOnCancel() ;
+  this->ClickOnCancel();
 }
 
-
 //=======================================================================
 //function : hideEvent
 //purpose  : caused by ESC key
 //=======================================================================
-
-void SMESHGUI_SewingDlg::hideEvent ( QHideEvent * e )
+void SMESHGUI_SewingDlg::hideEvent (QHideEvent*)
 {
-  if ( !isMinimized() )
+  if (!isMinimized())
     ClickOnCancel();
 }
 
-
 //=================================================================================
 // function : GetConstructorId()
-// purpose  : 
+// purpose  :
 //=================================================================================
 int SMESHGUI_SewingDlg::GetConstructorId()
-{ 
-  if ( GroupConstructors != NULL && GroupConstructors->selected() != NULL )
-    return GroupConstructors->id( GroupConstructors->selected() );
+{
+  if (GroupConstructors != NULL && GroupConstructors->selected() != NULL)
+    return GroupConstructors->id(GroupConstructors->selected());
   return -1;
 }
 
-
 //=================================================================================
 // function : GetConstructorId()
-// purpose  : 
+// purpose  :
 //=================================================================================
 bool SMESHGUI_SewingDlg::IsValid()
 {
index b5433bb2d33a22f58702a2c91286edbc6e7919ac..695abc9b362e98d645c066d2ca1e6126c5dcf6ff 100644 (file)
@@ -29,7 +29,7 @@
 #ifndef DIALOGBOX_SEWING_H
 #define DIALOGBOX_SEWING_H
 
-#include "SALOME_Selection.h"
+#include "SalomeApp_SelectionMgr.h"
 
 // QT Includes
 #include <qdialog.h>
@@ -44,6 +44,8 @@ class QRadioButton;
 class QCheckBox;
 class SMESHGUI;
 class SMESH_Actor;
+class SVTK_ViewWindow;
+class SVTK_Selector;
 
 // IDL Headers
 #include <SALOMEconfig.h>
@@ -59,22 +61,26 @@ class SMESHGUI_SewingDlg : public QDialog
     Q_OBJECT
 
 public:
-    SMESHGUI_SewingDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 );
+    SMESHGUI_SewingDlg( SMESHGUI*,
+                       const char* name = 0,
+                       bool modal = FALSE,
+                       WFlags fl = 0);
     ~SMESHGUI_SewingDlg();
 
 private:
-
     void Init() ;
     void closeEvent( QCloseEvent* e ) ;
-    void enterEvent ( QEvent * ) ;                          /* mouse enter the QWidget */
-    void hideEvent ( QHideEvent * );                        /* ESC key */
+    void enterEvent ( QEvent * );                          /* mouse enter the QWidget */
+    void hideEvent ( QHideEvent * );                       /* ESC key */
     int  GetConstructorId();
     bool IsValid();
     
-    SMESHGUI*                     mySMESHGUI ;              /* Current SMESHGUI object */
-    SALOME_Selection*             mySelection ;             /* User shape selection */
+    SMESHGUI*                     mySMESHGUI;              /* Current SMESHGUI object */
+    SalomeApp_SelectionMgr*       mySelectionMgr;          /* User shape selection */
     int                           myOk1, myOk2, myOk3, myOk4, myOk5, myOk6;    
-    QLineEdit*                    myEditCurrentArgument;    /* Current  LineEdit */
+    QLineEdit*                    myEditCurrentArgument;   /* Current  LineEdit */
+    SVTK_ViewWindow*              myViewWindow;
+    SVTK_Selector*                mySelector;
     
     bool                          myBusy;
     SMESH::SMESH_Mesh_var         myMesh;
@@ -111,7 +117,9 @@ private:
     QLineEdit* LineEdit5;
     QLineEdit* LineEdit6;
     QCheckBox* CheckBoxMerge;
-   
+    QCheckBox* CheckBoxPolygons;
+    QCheckBox* CheckBoxPolyedrs;
+
 private slots:
 
     void ConstructorsClicked(int constructorId);
index b25953d4cd3e6ff3326c9cea17b7b855c5cda2d0..cf7750be8bf7c5d3688e80597696e6c039036199 100755 (executable)
@@ -1,23 +1,23 @@
 //  SMESH SMESHGUI : GUI for SMESH component
 //
 //  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
-// 
-//  This library is free software; you can redistribute it and/or 
-//  modify it under the terms of the GNU Lesser General Public 
-//  License as published by the Free Software Foundation; either 
-//  version 2.1 of the License. 
-// 
-//  This library is distributed in the hope that it will be useful, 
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of 
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
-//  Lesser General Public License for more details. 
-// 
-//  You should have received a copy of the GNU Lesser General Public 
-//  License along with this library; if not, write to the Free Software 
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
-// 
-//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
 //
 //
 //
 
 #include "SMESHGUI_SingleEditDlg.h"
 
-#include "QAD_Desktop.h"
-
 #include "SMESHGUI.h"
 #include "SMESHGUI_Utils.h"
 #include "SMESHGUI_VTKUtils.h"
 #include "SMESHGUI_MeshUtils.h"
-
 #include "SMESHGUI_SpinBox.h"
 
-#include "utilities.h"
-#include "SALOME_Selection.h"
 #include "SMESH_Actor.h"
 #include "SMDS_Mesh.hxx"
 
+#include "SalomeApp_SelectionMgr.h"
+#include "SUIT_ResourceMgr.h"
+#include "SUIT_MessageBox.h"
+#include "SUIT_Desktop.h"
+
+#include "SVTK_Selector.h"
+#include "SVTK_ViewWindow.h"
+#include "SALOME_ListIO.hxx"
+
+#include "utilities.h"
+
+// OCCT Includes
+#include <TColStd_MapOfInteger.hxx>
+#include <TColStd_IndexedMapOfInteger.hxx>
+
+// QT Includes
 #include <qframe.h>
 #include <qlayout.h>
 #include <qlineedit.h>
 #define MARGIN  10
 
 
-/*
-  Class       : SMESHGUI_DiagValidator
-  Description : validate munual input of edge like "id1-id2"
-*/
+/*!
 Class       : SMESHGUI_DiagValidator
 Description : validate munual input of edge like "id1-id2"
+ */
 class SMESHGUI_DiagValidator: public QValidator
 {
  public:
-
-  SMESHGUI_DiagValidator(QWidget * parent, const char * name = 0):
+  SMESHGUI_DiagValidator (QWidget * parent, const char * name = 0):
     QValidator(parent,name) {}
 
-  State validate ( QString & text, int & pos) const
+  State validate (QString & text, int & pos) const
   {
     text.stripWhiteSpace();
-    text.replace( QRegExp("[^0-9]+"), "-" );
-    if ( text == "-" )
+    text.replace(QRegExp("[^0-9]+"), "-");
+    if (text == "-")
       text = "";
-    int ind = text.find( QRegExp("-[0-9]+-"));
-    if ( ind > 0 ) { // leave only two ids
-      ind = text.find( '-', ind + 1 );
-      if ( ind > 0 )
-        text.truncate( ind );
+    int ind = text.find(QRegExp("-[0-9]+-"));
+    if (ind > 0) { // leave only two ids
+      ind = text.find('-', ind + 1);
+      if (ind > 0)
+        text.truncate(ind);
     }
-    if ( pos > text.length() )
+    if (pos > text.length())
       pos = text.length();
     return Acceptable;
   }
 };
 
-/*
-  Class       : SMESHGUI_SingleEditDlg
-  Description : Inversion of the diagonal of a pseudo-quadrangle formed by 
-                2 neighboring triangles with 1 common edge
-*/
+/*!
 Class       : SMESHGUI_SingleEditDlg
+ *  Description : Inversion of the diagonal of a pseudo-quadrangle formed by
               2 neighboring triangles with 1 common edge
+ */
 
 //=======================================================================
-// name    : SMESHGUI_SingleEditDlg::SMESHGUI_SingleEditDlg
+// name    : SMESHGUI_SingleEditDlg()
 // Purpose : Constructor
 //=======================================================================
-SMESHGUI_SingleEditDlg::SMESHGUI_SingleEditDlg( QWidget*          theParent, 
-                                                      SALOME_Selection* theSelection,
-                                                      const char*       theName )
-: QDialog( theParent, theName, false, 
-           WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
+SMESHGUI_SingleEditDlg
+::SMESHGUI_SingleEditDlg(SMESHGUI* theModule, 
+                        const char* theName):
+  QDialog(SMESH::GetDesktop(theModule), 
+         theName, 
+         false, 
+         WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu),
+    mySelector(SMESH::GetViewWindow(theModule)->GetSelector()),
+    mySelectionMgr(SMESH::GetSelectionMgr(theModule)),
+    myViewWindow(SMESH::GetViewWindow(theModule)),
+    mySMESHGUI(theModule)
 {
-  //setCaption( tr( "CAPTION" ) );
-
-  QVBoxLayout* aDlgLay = new QVBoxLayout( this, MARGIN, SPACING );
+  QVBoxLayout* aDlgLay = new QVBoxLayout(this, MARGIN, SPACING);
 
-  QFrame* aMainFrame = createMainFrame  ( this );
-  QFrame* aBtnFrame  = createButtonFrame( this );
+  QFrame* aMainFrame = createMainFrame  (this);
+  QFrame* aBtnFrame  = createButtonFrame(this);
 
-  aDlgLay->addWidget( aMainFrame );
-  aDlgLay->addWidget( aBtnFrame );
+  aDlgLay->addWidget(aMainFrame);
+  aDlgLay->addWidget(aBtnFrame);
 
-  aDlgLay->setStretchFactor( aMainFrame, 1 );
+  aDlgLay->setStretchFactor(aMainFrame, 1);
 
-  Init( theSelection ) ; 
+  Init();
 }
 
 //=======================================================================
-// name    : SMESHGUI_SingleEditDlg::createMainFrame
+// name    : createMainFrame()
 // Purpose : Create frame containing dialog's input fields
 //=======================================================================
-QFrame* SMESHGUI_SingleEditDlg::createMainFrame( QWidget* theParent )
+QFrame* SMESHGUI_SingleEditDlg::createMainFrame (QWidget* theParent)
 {
-  QGroupBox* aMainGrp = new QGroupBox( 1, Qt::Vertical, tr( "EDGE_BETWEEN" ), theParent );
+  QGroupBox* aMainGrp = new QGroupBox(1, Qt::Vertical, tr("EDGE_BETWEEN"), theParent);
 
-  QPixmap aPix( QAD_Desktop::getResourceManager()->loadPixmap( "SMESH",tr( "ICON_SELECT" ) ) );
-  
-  new QLabel( tr( "SMESH_EDGE" ), aMainGrp );
-  ( new QPushButton( aMainGrp ) )->setPixmap( aPix );
-  myEdge = new QLineEdit( aMainGrp );
-  myEdge->setValidator( new SMESHGUI_DiagValidator( this, "validator" ));
+  QPixmap aPix (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_SELECT")));
+
+  new QLabel(tr("SMESH_EDGE"), aMainGrp);
+  (new QPushButton(aMainGrp))->setPixmap(aPix);
+  myEdge = new QLineEdit(aMainGrp);
+  myEdge->setValidator(new SMESHGUI_DiagValidator(this, "validator"));
 
   return aMainGrp;
 }
 
 //=======================================================================
-// name    : SMESHGUI_SingleEditDlg::createButtonFrame
+// name    : createButtonFrame()
 // Purpose : Create frame containing buttons
 //=======================================================================
-QFrame* SMESHGUI_SingleEditDlg::createButtonFrame( QWidget* theParent )
+QFrame* SMESHGUI_SingleEditDlg::createButtonFrame (QWidget* theParent)
 {
-  QFrame* aFrame = new QFrame( theParent );
-  aFrame->setFrameStyle( QFrame::Box | QFrame::Sunken );
+  QFrame* aFrame = new QFrame(theParent);
+  aFrame->setFrameStyle(QFrame::Box | QFrame::Sunken);
 
-  myOkBtn     = new QPushButton( tr( "SMESH_BUT_OK"    ), aFrame );
-  myApplyBtn  = new QPushButton( tr( "SMESH_BUT_APPLY" ), aFrame );
-  myCloseBtn  = new QPushButton( tr( "SMESH_BUT_CLOSE" ), aFrame );
+  myOkBtn     = new QPushButton(tr("SMESH_BUT_OK"   ), aFrame);
+  myApplyBtn  = new QPushButton(tr("SMESH_BUT_APPLY"), aFrame);
+  myCloseBtn  = new QPushButton(tr("SMESH_BUT_CLOSE"), aFrame);
 
-  QSpacerItem* aSpacer = new QSpacerItem( 0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum );
+  QSpacerItem* aSpacer = new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum);
 
-  QHBoxLayout* aLay = new QHBoxLayout( aFrame, MARGIN, SPACING );
+  QHBoxLayout* aLay = new QHBoxLayout(aFrame, MARGIN, SPACING);
 
-  aLay->addWidget( myOkBtn );
-  aLay->addWidget( myApplyBtn );
-  aLay->addItem( aSpacer);
-  aLay->addWidget( myCloseBtn );
+  aLay->addWidget(myOkBtn);
+  aLay->addWidget(myApplyBtn);
+  aLay->addItem(aSpacer);
+  aLay->addWidget(myCloseBtn);
 
   return aFrame;
 }
 
 //=======================================================================
-// name    : SMESHGUI_SingleEditDlg::isValid
+// name    : isValid()
 // Purpose : Verify validity of input data
 //=======================================================================
-bool SMESHGUI_SingleEditDlg::isValid( const bool theMess ) const
+bool SMESHGUI_SingleEditDlg::isValid (const bool theMess) const
 {
   int id1, id2;
-  return getNodeIds( myEdge->text(), id1, id2 );
+  return getNodeIds(myEdge->text(), id1, id2);
 }
 
 //=======================================================================
-// name    : SMESHGUI_SingleEditDlg::getNodeIds
+// name    : getNodeIds()
 // Purpose : Retrieve node ids from string
 //=======================================================================
-bool SMESHGUI_SingleEditDlg::getNodeIds( const QString& theStr, int& theId1, int&  theId2 ) const
+bool SMESHGUI_SingleEditDlg::getNodeIds (const QString& theStr,
+                                         int& theId1, int&  theId2) const
 {
-  if ( !theStr.contains( '-' ) )
+  if (!theStr.contains('-'))
     return false;
 
   bool ok1, ok2;
-  QString str1 = theStr.section( '-', 0, 0, QString::SectionSkipEmpty );
-  QString str2 = theStr.section( '-', 1, 1, QString::SectionSkipEmpty );
-  theId1 = str1.toInt( &ok1 );
-  theId2 = str2.toInt( &ok2 );
-  
+  QString str1 = theStr.section('-', 0, 0, QString::SectionSkipEmpty);
+  QString str2 = theStr.section('-', 1, 1, QString::SectionSkipEmpty);
+  theId1 = str1.toInt(&ok1);
+  theId2 = str2.toInt(&ok2);
+
   return ok1 & ok2;
 }
 
 //=======================================================================
-// name    : SMESHGUI_SingleEditDlg::~SMESHGUI_SingleEditDlg
+// name    : ~SMESHGUI_SingleEditDlg()
 // Purpose : Destructor
 //=======================================================================
 SMESHGUI_SingleEditDlg::~SMESHGUI_SingleEditDlg()
@@ -195,83 +210,78 @@ SMESHGUI_SingleEditDlg::~SMESHGUI_SingleEditDlg()
 }
 
 //=======================================================================
-// name    : SMESHGUI_SingleEditDlg::Init
+// name    : Init()
 // Purpose : Init dialog fields, connect signals and slots, show dialog
 //=======================================================================
-void SMESHGUI_SingleEditDlg::Init( SALOME_Selection* theSelection )
+void SMESHGUI_SingleEditDlg::Init()
 {
-  mySelection = theSelection;  
-  SMESHGUI* aSMESHGUI = SMESHGUI::GetSMESHGUI();
-  aSMESHGUI->SetActiveDialogBox( ( QDialog* )this ) ;
+  mySMESHGUI->SetActiveDialogBox((QDialog*)this);
   myBusy = false;
   myActor = 0;
+
   // main buttons
-  connect( myOkBtn,    SIGNAL( clicked() ), SLOT( onOk() ) );
-  connect( myCloseBtn, SIGNAL( clicked() ), SLOT( onClose() ) ) ;
-  connect( myApplyBtn, SIGNAL( clicked() ), SLOT( onApply() ) );
+  connect(myOkBtn,    SIGNAL(clicked()), SLOT(onOk()));
+  connect(myCloseBtn, SIGNAL(clicked()), SLOT(onClose()));
+  connect(myApplyBtn, SIGNAL(clicked()), SLOT(onApply()));
 
   // selection and SMESHGUI
-  connect( mySelection, SIGNAL( currentSelectionChanged() ), SLOT( onSelectionDone() ) );
-  connect( aSMESHGUI, SIGNAL( SignalDeactivateActiveDialog() ), SLOT( onDeactivate() ) );
-  connect( aSMESHGUI, SIGNAL( SignalCloseAllDialogs() ), SLOT( onClose() ) );
-  connect( myEdge, SIGNAL( textChanged(const QString&)), SLOT( onTextChange(const QString&)));
+  connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), SLOT(onSelectionDone()));
+  connect(mySMESHGUI, SIGNAL(SignalDeactivateActiveDialog()), SLOT(onDeactivate()));
+  connect(mySMESHGUI, SIGNAL(SignalCloseAllDialogs()), SLOT(onClose()));
+  connect(myEdge, SIGNAL(textChanged(const QString&)), SLOT(onTextChange(const QString&)));
 
-  myOkBtn->setEnabled( false );
-  myApplyBtn->setEnabled( false );
-  setEnabled( true );
+  myOkBtn->setEnabled(false);
+  myApplyBtn->setEnabled(false);
+  setEnabled(true);
 
-  int x, y ;
-  aSMESHGUI->DefineDlgPosition( this, x, y );
-  this->move( x, y );
-  this->show(); 
+  int x, y;
+  mySMESHGUI->DefineDlgPosition(this, x, y);
+  this->move(x, y);
+  this->show();
 
   // set selection mode
-  QAD_Application::getDesktop()->SetSelectionMode( EdgeOfCellSelection, true );
+  myViewWindow->SetSelectionMode(EdgeOfCellSelection);
 
   onSelectionDone();
-
-  return;
 }
 
 //=======================================================================
-// name    : SMESHGUI_SingleEditDlg::onOk
-// Purpose : SLOT called when "Ok" button pressed. 
+// name    : onOk()
+// Purpose : SLOT called when "Ok" button pressed.
 //           Assign filters VTK viewer and close dialog
 //=======================================================================
 void SMESHGUI_SingleEditDlg::onOk()
 {
-  if ( onApply() )
+  if (onApply())
     onClose();
 }
 
 //=======================================================================
-// name    : SMESHGUI_SingleEditDlg::onClose
+// name    : onClose()
 // Purpose : SLOT called when "Close" button pressed. Close dialog
 //=======================================================================
 void SMESHGUI_SingleEditDlg::onClose()
 {
-  QAD_Application::getDesktop()->SetSelectionMode( ActorSelection );
-  mySelection->ClearIObjects();
-  disconnect( mySelection, 0, this, 0 );
-  disconnect( SMESHGUI::GetSMESHGUI(), 0, this, 0 );
-  SMESHGUI::GetSMESHGUI()->ResetState() ;
+  myViewWindow->SetSelectionMode(ActorSelection);
+  mySelectionMgr->clearSelected();
+  disconnect(mySelectionMgr, 0, this, 0);
+  disconnect(mySMESHGUI, 0, this, 0);
+  mySMESHGUI->ResetState();
   reject();
 }
 
 //=======================================================================
-//function : findTriangles
+//function : findTriangles()
 //purpose  : find triangles sharing theNode1-theNode2 link
-//    THIS IS A PIECE OF SMESH_MeshEditor.cxx
-//    TO DO: make it available in SMDS for ex.
+//           THIS IS A PIECE OF SMESH_MeshEditor.cxx
+//           TO DO: make it available in SMDS for ex.
 //=======================================================================
-
-static bool findTriangles(const SMDS_MeshNode *    theNode1,
-                          const SMDS_MeshNode *    theNode2,
-                          const SMDS_MeshElement*& theTria1,
-                          const SMDS_MeshElement*& theTria2)
+static bool findTriangles (const SMDS_MeshNode *    theNode1,
+                           const SMDS_MeshNode *    theNode2,
+                           const SMDS_MeshElement*& theTria1,
+                           const SMDS_MeshElement*& theTria2)
 {
-  if ( !theNode1 || !theNode2 ) return false;
+  if (!theNode1 || !theNode2) return false;
 
   theTria1 = theTria2 = 0;
 
@@ -279,266 +289,270 @@ static bool findTriangles(const SMDS_MeshNode *    theNode1,
   SMDS_ElemIteratorPtr it = theNode1->GetInverseElementIterator();
   while (it->more()) {
     const SMDS_MeshElement* elem = it->next();
-    if ( elem->GetType() == SMDSAbs_Face && elem->NbNodes() == 3 )
-      emap.insert( elem );
+    if (elem->GetType() == SMDSAbs_Face && elem->NbNodes() == 3)
+      emap.insert(elem);
   }
   it = theNode2->GetInverseElementIterator();
   while (it->more()) {
     const SMDS_MeshElement* elem = it->next();
-    if ( elem->GetType() == SMDSAbs_Face &&
-         emap.find( elem ) != emap.end() )
-      if ( theTria1 ) {
+    if (elem->GetType() == SMDSAbs_Face &&
+         emap.find(elem) != emap.end())
+      if (theTria1) {
         theTria2 = elem;
         break;
       } else {
         theTria1 = elem;
       }
   }
-  return ( theTria1 && theTria2 );
+  return (theTria1 && theTria2);
 }
 
 //=======================================================================
-//function : onTextChange
-//purpose  : 
+//function : onTextChange()
+//purpose  :
 //=======================================================================
-
-void SMESHGUI_SingleEditDlg::onTextChange( const QString& theNewText )
+void SMESHGUI_SingleEditDlg::onTextChange (const QString& theNewText)
 {
-  if ( myBusy ) return;
+  if (myBusy) return;
 
-  myOkBtn->setEnabled( false );
-  myApplyBtn->setEnabled( false );
+  myOkBtn->setEnabled(false);
+  myApplyBtn->setEnabled(false);
 
   // hilight entered edge
-  SMDS_Mesh* aMesh = 0;
-  if ( myActor )
-    aMesh = myActor->GetObject()->GetMesh();
-  if ( aMesh ) {
-
-    myBusy = true; // block onSelectionDone()
-    mySelection->ClearIObjects();
-    mySelection->AddIObject( myActor->getIO() );
-    myBusy = false;
-
-    QStringList aListId = QStringList::split( "-", theNewText, false);
-    if ( aListId.count() != 2 )
-      return;
-    const SMDS_MeshNode* a2Nodes[2];
-    bool allOk = true;
-    int i;
-    for ( i = 0; i < aListId.count(); i++ ) {
-      const SMDS_MeshNode * n = aMesh->FindNode( aListId[ i ].toInt() );
-      if ( n )
-        a2Nodes[ i ] = n;
-      else
-        allOk = false;
-    }
-
-    // find a triangle and an edge nb
-    const SMDS_MeshElement* tria[2];
-    if (allOk &&
-        a2Nodes[0] != a2Nodes[1] &&
-        findTriangles( a2Nodes[0],
-                      a2Nodes[1],
-                      tria[0],
-                      tria[1])) {
+  if(myActor){
+    if(SMDS_Mesh* aMesh = myActor->GetObject()->GetMesh()){
       myBusy = true; // block onSelectionDone()
-      mySelection->AddOrRemoveIndex (myActor->getIO(), tria[0]->GetID(), true, false);
-
-      const SMDS_MeshNode* a3Nodes [3];
-      SMDS_ElemIteratorPtr it;
-      int edgeInd = 2;
-      for (i = 0, it = tria[0]->nodesIterator(); it->more(); i++ ) {
-        a3Nodes[ i ] = static_cast<const SMDS_MeshNode*>( it->next() );
-        if ( i > 0 )
-          if (( a3Nodes[ i ] == a2Nodes[ 0 ] && a3Nodes[ i - 1] == a2Nodes[ 1 ] ) ||
-              ( a3Nodes[ i ] == a2Nodes[ 1 ] && a3Nodes[ i - 1] == a2Nodes[ 0 ] ) ) {
-            edgeInd = i - 1;
-            break;
-          }
-      }
-
-      mySelection->AddOrRemoveIndex( myActor->getIO(), -edgeInd-1, true, true );
+      Handle(SALOME_InteractiveObject) anIO = myActor->getIO();
+      SALOME_ListIO aList;
+      aList.Append(anIO);
+      mySelectionMgr->setSelectedObjects(aList,false);
+      
+      TColStd_IndexedMapOfInteger selectedIndices;
+      TColStd_MapOfInteger newIndices;
+      mySelector->GetIndex(anIO,selectedIndices);
       myBusy = false;
 
-      myOkBtn->setEnabled( true );
-      myApplyBtn->setEnabled( true );
+      QStringList aListId = QStringList::split("-", theNewText, false);
+      if (aListId.count() != 2)
+       return;
+
+      int i;
+      bool allOk = true;
+      const SMDS_MeshNode* a2Nodes[2];
+      for (i = 0; i < aListId.count(); i++) {
+       if(const SMDS_MeshNode *aNode = aMesh->FindNode(aListId[ i ].toInt()))
+         a2Nodes[ i ] = aNode;
+       else
+         allOk = false;
+      }
+      
+      // find a triangle and an edge nb
+      const SMDS_MeshElement* tria[2];
+      allOk &= a2Nodes[0] != a2Nodes[1] && findTriangles(a2Nodes[0],a2Nodes[1],tria[0],tria[1]);
+      if(allOk){
+       myBusy = true; // block onSelectionDone()
+       newIndices.Add(tria[0]->GetID());
+       mySelector->AddOrRemoveIndex(anIO,newIndices, true);
+
+       const SMDS_MeshNode* a3Nodes [3];
+       SMDS_ElemIteratorPtr it;
+       int edgeInd = 2;
+       for (i = 0, it = tria[0]->nodesIterator(); it->more(); i++) {
+         a3Nodes[ i ] = static_cast<const SMDS_MeshNode*>(it->next());
+         if (i > 0) {
+           allOk = (a3Nodes[ i ] == a2Nodes[ 0 ] && a3Nodes[ i - 1] == a2Nodes[ 1 ]) ||
+             (a3Nodes[ i ] == a2Nodes[ 1 ] && a3Nodes[ i - 1] == a2Nodes[ 0 ]);
+           if (allOk) {
+             edgeInd = i - 1;
+             break;
+           }
+         }
+       }
+
+       newIndices.Clear();
+       newIndices.Add(-edgeInd-1);
+       mySelector->AddOrRemoveIndex(anIO,newIndices,true);
+       myBusy = false;
+       
+       myOkBtn->setEnabled(true);
+       myApplyBtn->setEnabled(true);
+      }
     }
   }
 }
+
 //=======================================================================
-// name    : SMESHGUI_SingleEditDlg::onSelectionDone
+// name    : onSelectionDone()
 // Purpose : SLOT called when selection changed
 //=======================================================================
 void SMESHGUI_SingleEditDlg::onSelectionDone()
 {
-  if ( myBusy ) return;
+  if (myBusy) return;
 
   int anId1 = 0, anId2 = 0;
 
-  myOkBtn->setEnabled( false );
-  myApplyBtn->setEnabled( false );
+  myOkBtn->setEnabled(false);
+  myApplyBtn->setEnabled(false);
 
-  if ( mySelection->IObjectCount() != 1 )
-  {
+  SALOME_ListIO aList;
+  mySelectionMgr->selectedObjects(aList);
+
+  if (aList.Extent() != 1) {
     myEdge->clear();
     return;
   }
 
-  myActor = SMESH::FindActorByEntry( mySelection->firstIObject()->getEntry() );
-  SMDS_Mesh* aMesh = 0;
-  if ( myActor )
-    aMesh = myActor->GetObject()->GetMesh();
-  if ( !aMesh )
-    return;
-
-  if (SMESH::GetEdgeNodes( mySelection, anId1, anId2 ) >= 1 ) {
-    QString aText = QString( "%1-%2" ).arg( anId1 ).arg( anId2 );
-    myBusy = true;
-    myEdge->setText( aText );    
-    myBusy = false;
-
-    const SMDS_MeshElement* tria[2];
-    if ( findTriangles( aMesh->FindNode( anId1 ), aMesh->FindNode( anId2 ), tria[0],tria[1]))
-    {
-      myOkBtn->setEnabled( true );
-      myApplyBtn->setEnabled( true );
+  Handle(SALOME_InteractiveObject) anIO = aList.First();
+  myActor = SMESH::FindActorByEntry(anIO->getEntry());
+  if(myActor){
+    TVisualObjPtr aVisualObj = myActor->GetObject();
+    if(SMDS_Mesh* aMesh = aVisualObj->GetMesh()){
+      if(SMESH::GetEdgeNodes(mySelector, aVisualObj, anId1, anId2) >= 1){
+       QString aText = QString("%1-%2").arg(anId1).arg(anId2);
+       myBusy = true;
+       myEdge->setText(aText);
+       myBusy = false;
+       
+       const SMDS_MeshElement* tria[2];
+       if (findTriangles(aMesh->FindNode(anId1), aMesh->FindNode(anId2), tria[0],tria[1])) {
+         myOkBtn->setEnabled(true);
+         myApplyBtn->setEnabled(true);
+       }
+      } else {
+       myEdge->clear();
+      }
     }
   }
-  else
-    myEdge->clear();
 }
 
 //=======================================================================
-// name    : SMESHGUI_SingleEditDlg::onDeactivate
+// name    : onDeactivate()
 // Purpose : SLOT called when dialog must be deativated
 //=======================================================================
 void SMESHGUI_SingleEditDlg::onDeactivate()
 {
-  setEnabled( false );
+  setEnabled(false);
 }
 
 //=======================================================================
-// name    : SMESHGUI_SingleEditDlg::enterEvent
+// name    : enterEvent()
 // Purpose : Event filter
 //=======================================================================
-void SMESHGUI_SingleEditDlg::enterEvent( QEvent* )
+void SMESHGUI_SingleEditDlg::enterEvent (QEvent*)
 {
-  if ( !isEnabled() ) {
-    SMESHGUI::GetSMESHGUI()->EmitSignalDeactivateDialog();
-    // set selection mode
-    QAD_Application::getDesktop()->SetSelectionMode( EdgeOfCellSelection, true ); 
-    setEnabled( true );
+  if (!isEnabled()) {
+    mySMESHGUI->EmitSignalDeactivateDialog();
+    myViewWindow->SetSelectionMode(EdgeOfCellSelection);
+    setEnabled(true);
   }
 }
 
-
 //=================================================================================
 // function : closeEvent()
 // purpose  :
 //=================================================================================
-void SMESHGUI_SingleEditDlg::closeEvent( QCloseEvent* e )
+void SMESHGUI_SingleEditDlg::closeEvent (QCloseEvent*)
 {
-  onClose() ;
+  onClose();
 }
+
 //=======================================================================
-//function : hideEvent
+//function : hideEvent()
 //purpose  : caused by ESC key
 //=======================================================================
-
-void SMESHGUI_SingleEditDlg::hideEvent ( QHideEvent * e )
+void SMESHGUI_SingleEditDlg::hideEvent (QHideEvent*)
 {
-  if ( !isMinimized() )
+  if (!isMinimized())
     onClose();
 }
 
 //=================================================================================
-// function : onApply
+// function : onApply()
 // purpose  : SLOT. Called when apply button is pressed
 //=================================================================================
 bool SMESHGUI_SingleEditDlg::onApply()
 {
-  if (SMESHGUI::GetSMESHGUI()->ActiveStudyLocked())
+  if (mySMESHGUI->isActiveStudyLocked())
     return false;
   // verify validity of input data
-  if ( !isValid( true ) )
+  if (!isValid(true))
     return false;
 
-  // get mesh, actor and nodes    
-  SMESH::SMESH_Mesh_var aMesh = SMESH::GetMeshByIO( mySelection->firstIObject() );
+  // get mesh, actor and nodes
+  SALOME_ListIO aList;
+  mySelectionMgr->selectedObjects(aList);
 
-  if ( aMesh->_is_nil() )
-  {
-    QMessageBox::information( SMESHGUI::GetSMESHGUI()->GetDesktop(),
-    tr( "SMESH_ERROR" ), tr( "SMESHG_NO_MESH" ), QMessageBox::Ok );
+  SMESH::SMESH_Mesh_var aMesh = SMESH::GetMeshByIO(aList.First());
+
+  if (aMesh->_is_nil()) {
+    SUIT_MessageBox::info1(SMESH::GetDesktop(mySMESHGUI), 
+                          tr("SMESH_ERROR"),
+                          tr("SMESHG_NO_MESH"), 
+                          tr("SMESH_BUT_OK"));
     return false;
   }
 
   SMESH::SMESH_MeshEditor_var aMeshEditor = aMesh->GetMeshEditor();
   int anId1= 0, anId2 = 0;
-  if ( aMeshEditor->_is_nil() || !getNodeIds( myEdge->text(), anId1, anId2 ) )
+  if (aMeshEditor->_is_nil() || !getNodeIds(myEdge->text(), anId1, anId2))
     return false;
 
   // perform operation
-  bool aResult = process( aMeshEditor.in(), anId1, anId2 );
+  bool aResult = process(aMeshEditor.in(), anId1, anId2);
 
   // update actor
-  if ( aResult )
-  {
-    Handle(SALOME_InteractiveObject) anIO = mySelection->firstIObject();
-    mySelection->ClearIObjects();
+  if (aResult) {
+    mySelectionMgr->setSelectedObjects(aList, false);
     SMESH::UpdateView();
-    mySelection->AddIObject( anIO, false );
   }
 
   return aResult;
 }
 
-/*
-  Class       : SMESHGUI_TrianglesInversionDlg
-  Description : Inversion of the diagonal of a pseudo-quadrangle formed by
-                2 neighboring triangles with 1 common edge
-*/
+/*!
 Class       : SMESHGUI_TrianglesInversionDlg
 Description : Inversion of the diagonal of a pseudo-quadrangle formed by
               2 neighboring triangles with 1 common edge
+ */
 
-SMESHGUI_TrianglesInversionDlg::SMESHGUI_TrianglesInversionDlg( QWidget*          theParent,
-                                                                SALOME_Selection* theSelection,
-                                                                const char*       theName )
-: SMESHGUI_SingleEditDlg( theParent, theSelection, theName )
+SMESHGUI_TrianglesInversionDlg
+::SMESHGUI_TrianglesInversionDlg(SMESHGUI* theModule, 
+                                const char* theName)
+: SMESHGUI_SingleEditDlg(theModule,theName)
 {
-  setCaption( tr( "CAPTION" ) );
+  setCaption(tr("CAPTION"));
 }
 
 SMESHGUI_TrianglesInversionDlg::~SMESHGUI_TrianglesInversionDlg()
 {
 }
 
-bool SMESHGUI_TrianglesInversionDlg::process(
-  SMESH::SMESH_MeshEditor_ptr theMeshEditor, const int theId1, const int theId2 )
+bool SMESHGUI_TrianglesInversionDlg::process (SMESH::SMESH_MeshEditor_ptr theMeshEditor,
+                                              const int theId1, const int theId2)
 {
-  return theMeshEditor->InverseDiag( theId1, theId2 );
+  return theMeshEditor->InverseDiag(theId1, theId2);
 }
 
-/*
-  Class       : SMESHGUI_UnionOfTwoTrianglesDlg
-  Description : Construction of a quadrangle by deletion of the 
-                common border of 2 neighboring triangles
-*/
+/*!
 Class       : SMESHGUI_UnionOfTwoTrianglesDlg
+ *  Description : Construction of a quadrangle by deletion of the
               common border of 2 neighboring triangles
+ */
 
-SMESHGUI_UnionOfTwoTrianglesDlg::SMESHGUI_UnionOfTwoTrianglesDlg( QWidget*          theParent, 
-                                                                  SALOME_Selection* theSelection,
-                                                                  const char*       theName )
-: SMESHGUI_SingleEditDlg( theParent, theSelection, theName )
+SMESHGUI_UnionOfTwoTrianglesDlg
+::SMESHGUI_UnionOfTwoTrianglesDlg(SMESHGUI* theModule, 
+                                 const char* theName)
+: SMESHGUI_SingleEditDlg(theModule,theName)
 {
-  setCaption( tr( "CAPTION" ) );
+  setCaption(tr("CAPTION"));
 }
 
 SMESHGUI_UnionOfTwoTrianglesDlg::~SMESHGUI_UnionOfTwoTrianglesDlg()
 {
 }
 
-bool SMESHGUI_UnionOfTwoTrianglesDlg::process(
-  SMESH::SMESH_MeshEditor_ptr theMeshEditor, const int theId1, const int theId2 )
+bool SMESHGUI_UnionOfTwoTrianglesDlg::process (SMESH::SMESH_MeshEditor_ptr theMeshEditor,
+                                               const int theId1, const int theId2)
 {
-  return theMeshEditor->DeleteDiag( theId1, theId2 );
+  return theMeshEditor->DeleteDiag(theId1, theId2);
 }
-
index 9aed20635ca6db74cd1a56fca46a0ec45d1b8622..3eff1f9d36d1285910c2c14002e597b05d6c864b 100755 (executable)
@@ -37,93 +37,97 @@ class QFrame;
 class QLineEdit;
 class SMESHGUI_SpinBox;
 class QPushButton;
-class SALOME_Selection;
-class SMESH_Actor;
-
-/*
-  Class       : SMESHGUI_SingleEditDlg
-  Description : Base class for dialogs of diagonal inversion and 
-                union of two neighboring triangles
-*/
 
+class SMESHGUI;
+class SMESH_Actor;
+class SVTK_Selector;
+class SVTK_ViewWindow;
+class SalomeApp_SelectionMgr;
+
+/*!
+ *  Class       : SMESHGUI_SingleEditDlg
+ *  Description : Base class for dialogs of diagonal inversion and 
+ *                union of two neighboring triangles
+ */
 class SMESHGUI_SingleEditDlg : public QDialog
 { 
   Q_OBJECT
 
 public:
-                            SMESHGUI_SingleEditDlg( QWidget*, SALOME_Selection*, const char* = 0 );
-  virtual                   ~SMESHGUI_SingleEditDlg();
+  SMESHGUI_SingleEditDlg(SMESHGUI* theModule, 
+                        const char* theName = 0);
+  virtual ~SMESHGUI_SingleEditDlg();
 
-  void                      Init( SALOME_Selection* ) ;
+  void Init();
 
 protected slots:
+  void                    onOk();
+  virtual bool            onApply();
+  void                    onClose();
 
-  void                      onOk();
-  virtual bool              onApply();
-  void                      onClose();
+  void                    onDeactivate();
 
-  void                      onDeactivate();
-
-  void                      onSelectionDone();
-  void                      onTextChange(const QString&);
+  void                    onSelectionDone();
+  void                    onTextChange (const QString&);
 
 protected:
+  void                    closeEvent (QCloseEvent*);
+  void                    enterEvent (QEvent*);
+  void                    hideEvent (QHideEvent*);                        /* ESC key */
+  QFrame*                 createButtonFrame (QWidget*);
+  QFrame*                 createMainFrame (QWidget*);
+  bool                    isValid (const bool) const;
+  bool                    getNodeIds (const QString&, int&, int&) const;
+  virtual bool            process (SMESH::SMESH_MeshEditor_ptr, const int, const int) = 0;
 
-  void                      closeEvent( QCloseEvent* e ) ;
-  void                      enterEvent ( QEvent * ) ;            
-  void                      hideEvent ( QHideEvent * );                        /* ESC key */
-  QFrame*                   createButtonFrame( QWidget* );
-  QFrame*                   createMainFrame  ( QWidget* );
-  bool                      isValid( const bool ) const;
-  bool                      getNodeIds( const QString&, int&, int& ) const;
-  virtual bool              process( SMESH::SMESH_MeshEditor_ptr, const int, const int ) = 0;
-  
 protected:
-
-  bool                      myBusy;
-  QPushButton*              myOkBtn;
-  QPushButton*              myApplyBtn;
-  QPushButton*              myCloseBtn;
-  QLineEdit*                myEdge;
-  SALOME_Selection*         mySelection;
-  SMESH_Actor*              myActor;
-
+  bool                    myBusy;
+  QPushButton*            myOkBtn;
+  QPushButton*            myApplyBtn;
+  QPushButton*            myCloseBtn;
+  QLineEdit*              myEdge;
+  SMESH_Actor*            myActor;
+
+  SalomeApp_SelectionMgr* mySelectionMgr;
+  SVTK_ViewWindow*        myViewWindow;
+  SVTK_Selector*          mySelector;
+  SMESHGUI*               mySMESHGUI;
 };
 
-/*
-  Class       : SMESHGUI_TrianglesInversionDlg
-  Description : Inversion of the diagonal of a pseudo-quadrangle formed by 
-                2 neighboring triangles with 1 common edge
-*/
+/*!
 Class       : SMESHGUI_TrianglesInversionDlg
 Description : Inversion of the diagonal of a pseudo-quadrangle formed by 
               2 neighboring triangles with 1 common edge
+ */
 class SMESHGUI_TrianglesInversionDlg : public SMESHGUI_SingleEditDlg
 {
   Q_OBJECT
-  
+
 public:
-                            SMESHGUI_TrianglesInversionDlg( QWidget*, SALOME_Selection*, const char* = 0 );
-  virtual                   ~SMESHGUI_TrianglesInversionDlg();
+  SMESHGUI_TrianglesInversionDlg(SMESHGUI* theModule, 
+                                const char* theName = 0);
+  virtual ~SMESHGUI_TrianglesInversionDlg();
 
 protected:
-
-  virtual bool              process( SMESH::SMESH_MeshEditor_ptr, const int, const int );
+  virtual bool process (SMESH::SMESH_MeshEditor_ptr, const int, const int);
 };
 
-/*
-  Class       : SMESHGUI_UnionOfTwoTrianglesDlg
-  Description : Construction of a quadrangle by deletion of the 
-                common border of 2 neighboring triangles
-*/
+/*!
 Class       : SMESHGUI_UnionOfTwoTrianglesDlg
 Description : Construction of a quadrangle by deletion of the 
               common border of 2 neighboring triangles
+ */
 class SMESHGUI_UnionOfTwoTrianglesDlg : public SMESHGUI_SingleEditDlg
 {
   Q_OBJECT
 
 public:
-                            SMESHGUI_UnionOfTwoTrianglesDlg( QWidget*, SALOME_Selection*, const char* = 0 );
-  virtual                   ~SMESHGUI_UnionOfTwoTrianglesDlg();
+  SMESHGUI_UnionOfTwoTrianglesDlg(SMESHGUI* theModule, 
+                                 const char* theName = 0);
+  virtual ~SMESHGUI_UnionOfTwoTrianglesDlg();
 
 protected:
-
-  virtual bool              process( SMESH::SMESH_MeshEditor_ptr, const int, const int );
+  virtual bool process (SMESH::SMESH_MeshEditor_ptr, const int, const int);
 };
 
 #endif
index 3099baeb0130867ac3831c27de0a76c55e90ebae..3adcb19c5021a18438aa1a81757dff4a38e544ec 100644 (file)
@@ -1,48 +1,64 @@
 //  SMESH SMESHGUI : GUI for SMESH component
 //
 //  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
-// 
-//  This library is free software; you can redistribute it and/or 
-//  modify it under the terms of the GNU Lesser General Public 
-//  License as published by the Free Software Foundation; either 
-//  version 2.1 of the License. 
-// 
-//  This library is distributed in the hope that it will be useful, 
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of 
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
-//  Lesser General Public License for more details. 
-// 
-//  You should have received a copy of the GNU Lesser General Public 
-//  License along with this library; if not, write to the Free Software 
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
-// 
-//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
 //
 //
 //
 //  File   : SMESHGUI_SmoothingDlg.cxx
 //  Author : Michael ZORIN
 //  Module : SMESH
-//  $Header: 
+//  $Header:
 
 #include "SMESHGUI_SmoothingDlg.h"
 
 #include "SMESHGUI.h"
-#include "SMESHGUI_SpinBox.h"
 #include "SMESHGUI_Utils.h"
 #include "SMESHGUI_VTKUtils.h"
 #include "SMESHGUI_MeshUtils.h"
+#include "SMESHGUI_SpinBox.h"
 #include "SMESHGUI_IdValidator.h"
+
 #include "SMESH_Actor.h"
 #include "SMESH_TypeFilter.hxx"
+#include "SMESH_NumberFilter.hxx"
+#include "SMESH_LogicalFilter.hxx"
+
 #include "SMDS_Mesh.hxx"
 
-#include "QAD_Application.h"
-#include "QAD_Desktop.h"
-#include "QAD_MessageBox.h"
+#include "SUIT_ResourceMgr.h"
+#include "SUIT_OverrideCursor.h"
+#include "SUIT_Desktop.h"
+#include "SUIT_MessageBox.h"
+
+#include "SVTK_ViewModel.h"
+#include "SVTK_Selector.h"
+#include "SVTK_ViewWindow.h"
+#include "SVTK_Selection.h"
+#include "SALOME_ListIO.hxx"
+
 #include "utilities.h"
 
+// OCCT Includes
+#include <TColStd_MapOfInteger.hxx>
+#include <TColStd_IndexedMapOfInteger.hxx>
+
 // QT Includes
 #include <qapplication.h>
 #include <qbuttongroup.h>
@@ -53,8 +69,8 @@
 #include <qradiobutton.h>
 #include <qcombobox.h>
 #include <qcheckbox.h>
+#include <qspinbox.h>
 #include <qlayout.h>
-#include <qspinbox.h> 
 #include <qvalidator.h>
 #include <qpixmap.h>
 
 using namespace std;
 
 //=================================================================================
-// class    : SMESHGUI_SmoothingDlg()
-// purpose  : 
+// function : SMESHGUI_SmoothingDlg()
+// purpose  : constructor
 //=================================================================================
-SMESHGUI_SmoothingDlg::SMESHGUI_SmoothingDlg( QWidget* parent, const char* name, SALOME_Selection* Sel,
-                                             bool modal, WFlags fl )
-  : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu |
-            Qt::WDestructiveClose)
+SMESHGUI_SmoothingDlg::SMESHGUI_SmoothingDlg( SMESHGUI* theModule, const char* name,
+                                             bool modal, WFlags fl)
+     : QDialog( SMESH::GetDesktop( theModule ), name, modal, WStyle_Customize | WStyle_NormalBorder |
+                WStyle_Title | WStyle_SysMenu | Qt::WDestructiveClose),
+     mySMESHGUI( theModule ),
+     mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ),
+     myViewWindow( SMESH::GetViewWindow( theModule ) ),
+     mySelector( myViewWindow->GetSelector() )
 {
-  QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "SMESH",tr("ICON_DLG_SMOOTHING")));
-  QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "SMESH",tr("ICON_SELECT")));
-
-  if ( !name )
-    setName( "SMESHGUI_SmoothingDlg" );
-  resize( 303, 185 ); 
-  setCaption( tr( "SMESH_SMOOTHING" ) );
-  setSizeGripEnabled( TRUE );
-  SMESHGUI_SmoothingDlgLayout = new QGridLayout( this ); 
-  SMESHGUI_SmoothingDlgLayout->setSpacing( 6 );
-  SMESHGUI_SmoothingDlgLayout->setMargin( 11 );
+  QPixmap image0 (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_DLG_SMOOTHING")));
+  QPixmap image1 (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_SELECT")));
+
+  if (!name)
+    setName("SMESHGUI_SmoothingDlg");
+  resize(303, 185);
+  setCaption(tr("SMESH_SMOOTHING"));
+  setSizeGripEnabled(TRUE);
+  SMESHGUI_SmoothingDlgLayout = new QGridLayout(this);
+  SMESHGUI_SmoothingDlgLayout->setSpacing(6);
+  SMESHGUI_SmoothingDlgLayout->setMargin(11);
 
   /***************************************************************/
-  GroupConstructors = new QButtonGroup( this, "GroupConstructors" );
-  GroupConstructors->setTitle( tr( "SMESH_SMOOTHING"  ) );
-  GroupConstructors->setExclusive( TRUE );
-  GroupConstructors->setColumnLayout(0, Qt::Vertical );
-  GroupConstructors->layout()->setSpacing( 0 );
-  GroupConstructors->layout()->setMargin( 0 );
-  GroupConstructorsLayout = new QGridLayout( GroupConstructors->layout() );
-  GroupConstructorsLayout->setAlignment( Qt::AlignTop );
-  GroupConstructorsLayout->setSpacing( 6 );
-  GroupConstructorsLayout->setMargin( 11 );
-  Constructor1 = new QRadioButton( GroupConstructors, "Constructor1" );
-  Constructor1->setText( tr( ""  ) );
-  Constructor1->setPixmap( image0 );
-  Constructor1->setChecked( TRUE );
-  Constructor1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, Constructor1->sizePolicy().hasHeightForWidth() ) );
-  Constructor1->setMinimumSize( QSize( 50, 0 ) );
-  GroupConstructorsLayout->addWidget( Constructor1, 0, 0 );
-  QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
-  GroupConstructorsLayout->addItem( spacer, 0, 1 );
-  SMESHGUI_SmoothingDlgLayout->addWidget( GroupConstructors, 0, 0 );
-  
+  GroupConstructors = new QButtonGroup(this, "GroupConstructors");
+  GroupConstructors->setTitle(tr("SMESH_SMOOTHING" ));
+  GroupConstructors->setExclusive(TRUE);
+  GroupConstructors->setColumnLayout(0, Qt::Vertical);
+  GroupConstructors->layout()->setSpacing(0);
+  GroupConstructors->layout()->setMargin(0);
+  GroupConstructorsLayout = new QGridLayout(GroupConstructors->layout());
+  GroupConstructorsLayout->setAlignment(Qt::AlignTop);
+  GroupConstructorsLayout->setSpacing(6);
+  GroupConstructorsLayout->setMargin(11);
+  Constructor1 = new QRadioButton(GroupConstructors, "Constructor1");
+  Constructor1->setText(tr("" ));
+  Constructor1->setPixmap(image0);
+  Constructor1->setChecked(TRUE);
+  Constructor1->setSizePolicy(QSizePolicy((QSizePolicy::SizeType)1,
+                                          (QSizePolicy::SizeType)0,
+                                          Constructor1->sizePolicy().hasHeightForWidth()));
+  Constructor1->setMinimumSize(QSize(50, 0));
+  GroupConstructorsLayout->addWidget(Constructor1, 0, 0);
+  QSpacerItem* spacer = new QSpacerItem(20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
+  GroupConstructorsLayout->addItem(spacer, 0, 1);
+  SMESHGUI_SmoothingDlgLayout->addWidget(GroupConstructors, 0, 0);
+
   /***************************************************************/
-  GroupButtons = new QGroupBox( this, "GroupButtons" );
-  GroupButtons->setGeometry( QRect( 10, 10, 281, 48 ) ); 
-  GroupButtons->setTitle( tr( ""  ) );
-  GroupButtons->setColumnLayout(0, Qt::Vertical );
-  GroupButtons->layout()->setSpacing( 0 );
-  GroupButtons->layout()->setMargin( 0 );
-  GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
-  GroupButtonsLayout->setAlignment( Qt::AlignTop );
-  GroupButtonsLayout->setSpacing( 6 );
-  GroupButtonsLayout->setMargin( 11 );
-  buttonCancel = new QPushButton( GroupButtons, "buttonCancel" );
-  buttonCancel->setText( tr( "SMESH_BUT_CLOSE"  ) );
-  buttonCancel->setAutoDefault( TRUE );
-  GroupButtonsLayout->addWidget( buttonCancel, 0, 3 );
-  buttonApply = new QPushButton( GroupButtons, "buttonApply" );
-  buttonApply->setText( tr( "SMESH_BUT_APPLY"  ) );
-  buttonApply->setAutoDefault( TRUE );
-  GroupButtonsLayout->addWidget( buttonApply, 0, 1 );
-  QSpacerItem* spacer_9 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
-  GroupButtonsLayout->addItem( spacer_9, 0, 2 );
-  buttonOk = new QPushButton( GroupButtons, "buttonOk" );
-  buttonOk->setText( tr( "SMESH_BUT_OK"  ) );
-  buttonOk->setAutoDefault( TRUE );
-  buttonOk->setDefault( TRUE );
-  GroupButtonsLayout->addWidget( buttonOk, 0, 0 );
-  SMESHGUI_SmoothingDlgLayout->addWidget( GroupButtons, 2, 0 );
+  GroupButtons = new QGroupBox(this, "GroupButtons");
+  GroupButtons->setGeometry(QRect(10, 10, 281, 48));
+  GroupButtons->setTitle(tr(""));
+  GroupButtons->setColumnLayout(0, Qt::Vertical);
+  GroupButtons->layout()->setSpacing(0);
+  GroupButtons->layout()->setMargin(0);
+  GroupButtonsLayout = new QGridLayout(GroupButtons->layout());
+  GroupButtonsLayout->setAlignment(Qt::AlignTop);
+  GroupButtonsLayout->setSpacing(6);
+  GroupButtonsLayout->setMargin(11);
+  buttonCancel = new QPushButton(GroupButtons, "buttonCancel");
+  buttonCancel->setText(tr("SMESH_BUT_CLOSE" ));
+  buttonCancel->setAutoDefault(TRUE);
+  GroupButtonsLayout->addWidget(buttonCancel, 0, 3);
+  buttonApply = new QPushButton(GroupButtons, "buttonApply");
+  buttonApply->setText(tr("SMESH_BUT_APPLY" ));
+  buttonApply->setAutoDefault(TRUE);
+  GroupButtonsLayout->addWidget(buttonApply, 0, 1);
+  QSpacerItem* spacer_9 = new QSpacerItem(20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
+  GroupButtonsLayout->addItem(spacer_9, 0, 2);
+  buttonOk = new QPushButton(GroupButtons, "buttonOk");
+  buttonOk->setText(tr("SMESH_BUT_OK" ));
+  buttonOk->setAutoDefault(TRUE);
+  buttonOk->setDefault(TRUE);
+  GroupButtonsLayout->addWidget(buttonOk, 0, 0);
+  SMESHGUI_SmoothingDlgLayout->addWidget(GroupButtons, 2, 0);
 
   /***************************************************************/
-  GroupArguments = new QGroupBox( this, "GroupArguments" );
-  GroupArguments->setTitle( tr( "SMESH_ARGUMENTS"  ) );
-  GroupArguments->setColumnLayout(0, Qt::Vertical );
-  GroupArguments->layout()->setSpacing( 0 );
-  GroupArguments->layout()->setMargin( 0 );
-  GroupArgumentsLayout = new QGridLayout( GroupArguments->layout() );
-  GroupArgumentsLayout->setAlignment( Qt::AlignTop );
-  GroupArgumentsLayout->setSpacing( 6 );
-  GroupArgumentsLayout->setMargin( 11 );
+  GroupArguments = new QGroupBox(this, "GroupArguments");
+  GroupArguments->setTitle(tr("SMESH_ARGUMENTS"));
+  GroupArguments->setColumnLayout(0, Qt::Vertical);
+  GroupArguments->layout()->setSpacing(0);
+  GroupArguments->layout()->setMargin(0);
+  GroupArgumentsLayout = new QGridLayout(GroupArguments->layout());
+  GroupArgumentsLayout->setAlignment(Qt::AlignTop);
+  GroupArgumentsLayout->setSpacing(6);
+  GroupArgumentsLayout->setMargin(11);
 
   // Controls for elements selection
-  TextLabelElements  = new QLabel( GroupArguments, "TextLabelElements" );
-  TextLabelElements->setText( tr( "SMESH_ID_ELEMENTS"  ) );
-  GroupArgumentsLayout->addWidget( TextLabelElements, 0, 0 );
+  TextLabelElements  = new QLabel(GroupArguments, "TextLabelElements");
+  TextLabelElements->setText(tr("SMESH_ID_ELEMENTS" ));
+  GroupArgumentsLayout->addWidget(TextLabelElements, 0, 0);
 
-  SelectElementsButton  = new QPushButton( GroupArguments, "SelectElementsButton" );
-  SelectElementsButton->setText( tr( ""  ) );
-  SelectElementsButton->setPixmap( image1 );
-  SelectElementsButton->setToggleButton( FALSE );
-  GroupArgumentsLayout->addWidget( SelectElementsButton, 0, 1 );
+  SelectElementsButton  = new QPushButton(GroupArguments, "SelectElementsButton");
+  SelectElementsButton->setText(tr("" ));
+  SelectElementsButton->setPixmap(image1);
+  SelectElementsButton->setToggleButton(FALSE);
+  GroupArgumentsLayout->addWidget(SelectElementsButton, 0, 1);
 
-  LineEditElements  = new QLineEdit( GroupArguments, "LineEditElements" );
-  LineEditElements->setValidator( new SMESHGUI_IdValidator( this, "validator" ));
-  GroupArgumentsLayout->addWidget( LineEditElements, 0, 2 );
+  LineEditElements  = new QLineEdit(GroupArguments, "LineEditElements");
+  LineEditElements->setValidator(new SMESHGUI_IdValidator(this, "validator"));
+  GroupArgumentsLayout->addWidget(LineEditElements, 0, 2);
 
   // Control for the whole mesh selection
-  CheckBoxMesh = new QCheckBox( GroupArguments, "CheckBoxMesh" );
-  CheckBoxMesh->setText( tr( "SMESH_SELECT_WHOLE_MESH" ) );
-  GroupArgumentsLayout->addMultiCellWidget( CheckBoxMesh, 1, 1, 0, 2 );
+  CheckBoxMesh = new QCheckBox(GroupArguments, "CheckBoxMesh");
+  CheckBoxMesh->setText(tr("SMESH_SELECT_WHOLE_MESH"));
+  GroupArgumentsLayout->addMultiCellWidget(CheckBoxMesh, 1, 1, 0, 2);
 
   // Controls for nodes selection
-  TextLabelNodes = new QLabel( GroupArguments, "TextLabelNodes" );
-  TextLabelNodes->setText( tr( "FIXED_NODES_IDS" ) );
-  GroupArgumentsLayout->addWidget( TextLabelNodes, 2, 0 );
+  TextLabelNodes = new QLabel(GroupArguments, "TextLabelNodes");
+  TextLabelNodes->setText(tr("FIXED_NODES_IDS"));
+  GroupArgumentsLayout->addWidget(TextLabelNodes, 2, 0);
 
-  SelectNodesButton  = new QPushButton( GroupArguments, "SelectNodesButton" );
-  SelectNodesButton->setText( tr( ""  ) );
-  SelectNodesButton->setPixmap( image1 );
-  SelectNodesButton->setToggleButton( FALSE );
-  GroupArgumentsLayout->addWidget( SelectNodesButton, 2, 1 );
+  SelectNodesButton  = new QPushButton(GroupArguments, "SelectNodesButton");
+  SelectNodesButton->setText(tr("" ));
+  SelectNodesButton->setPixmap(image1);
+  SelectNodesButton->setToggleButton(FALSE);
+  GroupArgumentsLayout->addWidget(SelectNodesButton, 2, 1);
 
-  LineEditNodes  = new QLineEdit( GroupArguments, "LineEditNodes" );
-  LineEditNodes->setValidator( new SMESHGUI_IdValidator( this, "validator" ));
-  GroupArgumentsLayout->addWidget( LineEditNodes, 2, 2 );
+  LineEditNodes  = new QLineEdit(GroupArguments, "LineEditNodes");
+  LineEditNodes->setValidator(new SMESHGUI_IdValidator(this, "validator"));
+  GroupArgumentsLayout->addWidget(LineEditNodes, 2, 2);
 
   // Controls for method selection
-  TextLabelMethod = new QLabel( GroupArguments, "TextLabelMethod" );
-  TextLabelMethod->setText( tr( "METHOD"  ) );
-  GroupArgumentsLayout->addMultiCellWidget( TextLabelMethod, 3, 3, 0, 1 );
+  TextLabelMethod = new QLabel(GroupArguments, "TextLabelMethod");
+  TextLabelMethod->setText(tr("METHOD" ));
+  GroupArgumentsLayout->addMultiCellWidget(TextLabelMethod, 3, 3, 0, 1);
 
-  ComboBoxMethod = new QComboBox( GroupArguments, "ComboBoxMethod" );
-  GroupArgumentsLayout->addWidget( ComboBoxMethod, 3, 2 );
+  ComboBoxMethod = new QComboBox(GroupArguments, "ComboBoxMethod");
+  GroupArgumentsLayout->addWidget(ComboBoxMethod, 3, 2);
 
   // Controls for iteration limit defining
-  TextLabelLimit = new QLabel( GroupArguments, "TextLabelLimit" );
-  TextLabelLimit->setText( tr( "ITERATION_LIMIT"  ) );
-  GroupArgumentsLayout->addMultiCellWidget( TextLabelLimit, 4, 4, 0, 1 );
+  TextLabelLimit = new QLabel(GroupArguments, "TextLabelLimit");
+  TextLabelLimit->setText(tr("ITERATION_LIMIT" ));
+  GroupArgumentsLayout->addMultiCellWidget(TextLabelLimit, 4, 4, 0, 1);
 
   SpinBox_IterationLimit = new QSpinBox(GroupArguments, "SpinBox_IterationLimit");
-  GroupArgumentsLayout->addWidget( SpinBox_IterationLimit, 4, 2 );
+  GroupArgumentsLayout->addWidget(SpinBox_IterationLimit, 4, 2);
 
   // Controls for max. aspect ratio defining
-  TextLabelAspectRatio = new QLabel( GroupArguments, "TextLabelAspectRatio" );
-  TextLabelAspectRatio->setText( tr( "MAX_ASPECT_RATIO" ) );
-  GroupArgumentsLayout->addMultiCellWidget( TextLabelAspectRatio, 5, 5, 0, 1 );
+  TextLabelAspectRatio = new QLabel(GroupArguments, "TextLabelAspectRatio");
+  TextLabelAspectRatio->setText(tr("MAX_ASPECT_RATIO"));
+  GroupArgumentsLayout->addMultiCellWidget(TextLabelAspectRatio, 5, 5, 0, 1);
 
   SpinBox_AspectRatio = new SMESHGUI_SpinBox(GroupArguments, "SpinBox_AspectRatio");
-  GroupArgumentsLayout->addWidget( SpinBox_AspectRatio, 5, 2 );
+  GroupArgumentsLayout->addWidget(SpinBox_AspectRatio, 5, 2);
 
+  // Check box "Is Parametric"
+  CheckBoxParametric = new QCheckBox( GroupArguments, "CheckBoxParametric" );
+  CheckBoxParametric->setText( tr( "IS_PARAMETRIC" ) );
+  GroupArgumentsLayout->addMultiCellWidget( CheckBoxParametric, 6, 6, 0, 2 );
+
+
+  SMESHGUI_SmoothingDlgLayout->addWidget(GroupArguments, 1, 0);
 
-  SMESHGUI_SmoothingDlgLayout->addWidget( GroupArguments, 1, 0 );
-  
   /* Initialisations */
   ComboBoxMethod->insertItem(tr("LAPLACIAN"));
   ComboBoxMethod->insertItem(tr("CENTROIDAL"));
 
+  ComboBoxMethod->setCurrentItem(0);
+
+  CheckBoxParametric->setChecked( TRUE );
+  
   QIntValidator* anIntValidator = new QIntValidator(SpinBox_IterationLimit);
   SpinBox_IterationLimit->setValidator(anIntValidator);
-  SpinBox_IterationLimit->setRange( 1, 999999 );
-  SpinBox_AspectRatio->RangeStepAndValidator( 0.0, +999999.999, 0.1, 3 );
+  SpinBox_IterationLimit->setRange(1, 999999);
+  SpinBox_IterationLimit->setValue(20);
+  SpinBox_AspectRatio->RangeStepAndValidator(0.0, +999999.999, 0.1, 3);
+  SpinBox_AspectRatio->SetValue(1.1);
 
   GroupArguments->show();
-  myConstructorId = 0 ;
-  Constructor1->setChecked( TRUE );
-  mySelection = Sel;  
+  myConstructorId = 0;
+  Constructor1->setChecked(TRUE);
 
-  mySMESHGUI  = SMESHGUI::GetSMESHGUI() ;
-  mySMESHGUI->SetActiveDialogBox( (QDialog*)this ) ;
-  
-  // Costruction of the logical filter
-  SMESH_ListOfFilter aListOfFilters;
-  Handle(SMESH_TypeFilter) aMeshOrSubMeshFilter = new SMESH_TypeFilter( MESHorSUBMESH );
-  if ( !aMeshOrSubMeshFilter.IsNull() )
-    aListOfFilters.Append( aMeshOrSubMeshFilter );
-  Handle(SMESH_TypeFilter) aSmeshGroupFilter = new SMESH_TypeFilter( GROUP );
-  if ( !aSmeshGroupFilter.IsNull() )
-    aListOfFilters.Append( aSmeshGroupFilter );
-  
-  myMeshOrSubMeshOrGroupFilter = new SMESH_LogicalFilter( aListOfFilters, SMESH_LogicalFilter::LO_OR );
+  mySMESHGUI->SetActiveDialogBox(this);
+
+  // Costruction of the logical filter for the elements: mesh/sub-mesh/group
+  SMESH_TypeFilter* aMeshOrSubMeshFilter = new SMESH_TypeFilter (MESHorSUBMESH);
+  SMESH_TypeFilter* aSmeshGroupFilter    = new SMESH_TypeFilter (GROUP);
+
+  QPtrList<SUIT_SelectionFilter> aListOfFilters;
+  if (aMeshOrSubMeshFilter) aListOfFilters.append(aMeshOrSubMeshFilter);
+  if (aSmeshGroupFilter)    aListOfFilters.append(aSmeshGroupFilter);
+
+  myMeshOrSubMeshOrGroupFilter =
+    new SMESH_LogicalFilter (aListOfFilters, SMESH_LogicalFilter::LO_OR);
 
   Init();
-  /* signals and slots connections */
-  connect( buttonOk, SIGNAL( clicked() ),     this, SLOT( ClickOnOk() ) );
-  connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ) ;
-  connect( buttonApply, SIGNAL( clicked() ), this, SLOT(ClickOnApply() ) );
-  connect( GroupConstructors, SIGNAL(clicked(int) ), SLOT( ConstructorsClicked(int) ) );
-  
-  connect( SelectElementsButton, SIGNAL (clicked() ),   this, SLOT( SetEditCurrentArgument() ) ) ;
-  connect( SelectNodesButton, SIGNAL (clicked() ),   this, SLOT( SetEditCurrentArgument() ) ) ;
-  connect( mySMESHGUI, SIGNAL ( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ;
-  connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
+
+  /***************************************************************/
+  // signals and slots connections
+  connect(buttonOk, SIGNAL(clicked()),     this, SLOT(ClickOnOk()));
+  connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel()));
+  connect(buttonApply, SIGNAL(clicked()),  this, SLOT(ClickOnApply()));
+  connect(GroupConstructors, SIGNAL(clicked(int)), SLOT(ConstructorsClicked(int)));
+
+  connect(SelectElementsButton, SIGNAL (clicked()), this, SLOT(SetEditCurrentArgument()));
+  connect(SelectNodesButton, SIGNAL (clicked()), this, SLOT(SetEditCurrentArgument()));
+  connect(mySMESHGUI, SIGNAL (SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog()));
+  connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
   /* to close dialog if study change */
-  connect( mySMESHGUI, SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ) ;
-  connect( LineEditElements, SIGNAL( textChanged( const QString& )),
-           SLOT( onTextChange( const QString& )));
-  connect( LineEditNodes, SIGNAL( textChanged( const QString& )),
-           SLOT( onTextChange( const QString& )));
-  connect( CheckBoxMesh, SIGNAL( toggled( bool )),
-           SLOT( onSelectMesh( bool )));
-  
+  connect(mySMESHGUI, SIGNAL (SignalCloseAllDialogs()), this, SLOT(ClickOnCancel()));
+  connect(LineEditElements, SIGNAL(textChanged(const QString&)),
+           SLOT(onTextChange(const QString&)));
+  connect(LineEditNodes, SIGNAL(textChanged(const QString&)),
+           SLOT(onTextChange(const QString&)));
+  connect(CheckBoxMesh, SIGNAL(toggled(bool)),
+           SLOT(onSelectMesh(bool)));
+
+  /***************************************************************/
   /* Move widget on the botton right corner of main widget */
-  int x, y ;
-  mySMESHGUI->DefineDlgPosition( this, x, y ) ;
-  this->move( x, y ) ;
-  this->show() ; /* displays Dialog */
+  int x, y;
+  mySMESHGUI->DefineDlgPosition(this, x, y);
+  this->move(x, y);
+  this->show(); // displays Dialog
 }
 
 //=================================================================================
 // function : ~SMESHGUI_SmoothingDlg()
-// purpose  : Destroys the object and frees any allocated resources
+// purpose  : destructor
 //=================================================================================
 SMESHGUI_SmoothingDlg::~SMESHGUI_SmoothingDlg()
 {
   // no need to delete child widgets, Qt does it all for us
 }
 
-
 //=================================================================================
 // function : Init()
-// purpose  :
+// purpose  : initialization
 //=================================================================================
 void SMESHGUI_SmoothingDlg::Init()
 {
-  myBusy = false;  
-          
-  ComboBoxMethod->setCurrentItem(0);
-  
-  SpinBox_IterationLimit->setValue(20);
-  SpinBox_AspectRatio->SetValue(1.1);
-  
+  myBusy = false;
+
+//   ComboBoxMethod->setCurrentItem(0);
+
+//   SpinBox_IterationLimit->setValue(20);
+//   SpinBox_AspectRatio->SetValue(1.1);
+
   myEditCurrentArgument = LineEditElements;
   LineEditElements->setFocus();
+  LineEditNodes->clear();
   myElementsId = "";
-  myNbOkElements = 0 ;
-  myNbOkNodes = 0 ;
+  myNbOkElements = 0;
+  myNbOkNodes = 0;
   myActor     = 0;
   myMesh = SMESH::SMESH_Mesh::_nil();
-  
+
   CheckBoxMesh->setChecked(false);
-  onSelectMesh( false );
+  onSelectMesh(false);
 }
 
-
 //=================================================================================
 // function : ConstructorsClicked()
 // purpose  : Radio button management
 //=================================================================================
-void SMESHGUI_SmoothingDlg::ConstructorsClicked(int constructorId)
+void SMESHGUI_SmoothingDlg::ConstructorsClicked (int constructorId)
 {
-  return ;
 }
 
-
 //=================================================================================
 // function : ClickOnApply()
-// purpose  :
+// purpose  : Called when user presses <Apply> button
 //=================================================================================
 void SMESHGUI_SmoothingDlg::ClickOnApply()
 {
-  if (mySMESHGUI->ActiveStudyLocked())
+  if (mySMESHGUI->isActiveStudyLocked())
     return;
-  
-  if ( myNbOkElements  && (myNbOkNodes || LineEditNodes->text().stripWhiteSpace().isEmpty()))
-    {
-      QStringList aListElementsId = QStringList::split( " ", myElementsId, false);
-      QStringList aListNodesId = QStringList::split( " ", LineEditNodes->text(), false);
-
-      SMESH::long_array_var anElementsId = new SMESH::long_array;
-      SMESH::long_array_var aNodesId = new SMESH::long_array;
-
-      anElementsId->length( aListElementsId.count() );
-      for ( int i = 0; i < aListElementsId.count(); i++ )
-       anElementsId[i] = aListElementsId[i].toInt();
-      
-      if (myNbOkNodes)
-       {
-         aNodesId->length( aListNodesId.count() );
-         for ( int i = 0; i < aListNodesId.count(); i++ )
-           aNodesId[i] = aListNodesId[i].toInt();
-       }
+
+  if (myNbOkElements &&
+      (myNbOkNodes || LineEditNodes->text().stripWhiteSpace().isEmpty())) {
+    QStringList aListElementsId = QStringList::split(" ", myElementsId, false);
+    QStringList aListNodesId    = QStringList::split(" ", LineEditNodes->text(), false);
+
+    SMESH::long_array_var anElementsId = new SMESH::long_array;
+    SMESH::long_array_var aNodesId = new SMESH::long_array;
+
+    anElementsId->length(aListElementsId.count());
+    for (int i = 0; i < aListElementsId.count(); i++)
+      anElementsId[i] = aListElementsId[i].toInt();
+
+    if (myNbOkNodes) {
+      aNodesId->length(aListNodesId.count());
+      for (int i = 0; i < aListNodesId.count(); i++)
+        aNodesId[i] = aListNodesId[i].toInt();
+    } else {
+      aNodesId->length(0);
+    }
+
+    long anIterationLimit = (long)SpinBox_IterationLimit->value();
+    double aMaxAspectRatio = SpinBox_AspectRatio->GetValue();
+
+    SMESH::SMESH_MeshEditor::Smooth_Method aMethod = SMESH::SMESH_MeshEditor::LAPLACIAN_SMOOTH;
+    if (ComboBoxMethod->currentItem() > 0)
+      aMethod =  SMESH::SMESH_MeshEditor::CENTROIDAL_SMOOTH;
+
+    bool aResult = false;
+    try {
+      SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
+      QApplication::setOverrideCursor(Qt::waitCursor);
+      if ( CheckBoxParametric->isChecked() )
+       aResult = aMeshEditor->SmoothParametric(anElementsId.inout(), aNodesId.inout(),
+                                               anIterationLimit, aMaxAspectRatio, aMethod);
       else
-       anElementsId->length(0);
-      
-      long anIterationLimit = (long)SpinBox_IterationLimit->value();
-      double aMaxAspectRatio = SpinBox_AspectRatio->GetValue();
-
-      SMESH::SMESH_MeshEditor::Smooth_Method aMethod = SMESH::SMESH_MeshEditor::LAPLACIAN_SMOOTH;
-      if (ComboBoxMethod->currentItem() > 0)
-       aMethod =  SMESH::SMESH_MeshEditor::CENTROIDAL_SMOOTH;
-      
-      bool aResult = false;
-      try
-       {
-         SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
-         QApplication::setOverrideCursor(Qt::waitCursor);
-         aResult = aMeshEditor->Smooth(anElementsId.inout(), aNodesId.inout(), anIterationLimit, aMaxAspectRatio, aMethod);
-         QApplication::restoreOverrideCursor();
-       }
-      catch( ... )
-       {
-       }
-      
-      if ( aResult )
-       {
-         Handle(SALOME_InteractiveObject) anIO = myActor->getIO();
-         mySelection->ClearIObjects();
-         SMESH::UpdateView();
-         mySelection->AddIObject( anIO, false );
-         Init();
-       }
+       aResult = aMeshEditor->Smooth(anElementsId.inout(), aNodesId.inout(),
+                                     anIterationLimit, aMaxAspectRatio, aMethod);
+      QApplication::restoreOverrideCursor();
+    } catch (...) {
     }
-  
+
+    if (aResult) {
+      Handle(SALOME_InteractiveObject) anIO = myActor->getIO();
+
+      SALOME_ListIO aList;
+      aList.Append(anIO);
+      mySelectionMgr->setSelectedObjects(aList, false);
+      SMESH::UpdateView();
+      Init();
+    }
+  }
 }
 
 //=================================================================================
 // function : ClickOnOk()
-// purpose  :
+// purpose  : Called when user presses <OK> button
 //=================================================================================
 void SMESHGUI_SmoothingDlg::ClickOnOk()
 {
-  ClickOnApply() ;
-  ClickOnCancel() ;
+  ClickOnApply();
+  ClickOnCancel();
 }
 
-       
 //=================================================================================
 // function : ClickOnCancel()
-// purpose  :
+// purpose  : Called when dialog box is closed
 //=================================================================================
 void SMESHGUI_SmoothingDlg::ClickOnCancel()
 {
-  mySelection->ClearFilters();
-  mySelection->ClearIObjects();
+  disconnect(mySelectionMgr, 0, this, 0);
+  mySelectionMgr->clearFilters();
+  mySelectionMgr->clearSelected();
+  SMESH::SetPickable(); // ???
   SMESH::SetPointRepresentation(false);
-  QAD_Application::getDesktop()->SetSelectionMode( ActorSelection );
-  disconnect( mySelection, 0, this, 0 );
-  mySMESHGUI->ResetState() ;
-  reject() ;
+  myViewWindow->SetSelectionMode(ActorSelection);
+  mySMESHGUI->ResetState();
+  reject();
 }
 
 //=======================================================================
-//function : onTextChange
-//purpose  : 
+// function : onTextChange()
+// purpose  :
 //=======================================================================
-
-void SMESHGUI_SmoothingDlg::onTextChange(const QString& theNewText)
+void SMESHGUI_SmoothingDlg::onTextChange (const QString& theNewText)
 {
   QLineEdit* send = (QLineEdit*)sender();
 
-  if ( myBusy ) return;
+  // return if busy
+  if (myBusy) return;
+
+  // set busy flag
   myBusy = true;
-  
+
   if (send == LineEditElements)
     myNbOkElements = 0;
   else if (send == LineEditNodes)
     myNbOkNodes = 0;
-  
-  buttonOk->setEnabled( false );
-  buttonApply->setEnabled( false );
-  
+
+  buttonOk->setEnabled(false);
+  buttonApply->setEnabled(false);
+
   // hilight entered elements/nodes
   SMDS_Mesh* aMesh = 0;
-  if ( myActor )
+  if (myActor)
     aMesh = myActor->GetObject()->GetMesh();
-  
-  if ( aMesh ) {
-    mySelection->ClearIObjects();
-    mySelection->AddIObject( myActor->getIO() );
-    
-    QStringList aListId = QStringList::split( " ", theNewText, false);
-    
+
+  if (aMesh) {
+    //mySelectionMgr->clearSelected();
+    //mySelectionMgr->AddIObject(myActor->getIO());
+    SALOME_ListIO aList;
+    aList.Append(myActor->getIO());
+    mySelectionMgr->setSelectedObjects(aList, false);
+
+    QStringList aListId = QStringList::split(" ", theNewText, false);
+
     if (send == LineEditElements) {
-      for ( int i = 0; i < aListId.count(); i++ ) {
-       const SMDS_MeshElement * e = aMesh->FindElement( aListId[ i ].toInt() );
-       if ( e ) {
-         if ( !mySelection->IsIndexSelected( myActor->getIO(), e->GetID() ))
-           mySelection->AddOrRemoveIndex (myActor->getIO(), e->GetID(), true);
+      const Handle(SALOME_InteractiveObject)& anIO = myActor->getIO();
+      TColStd_IndexedMapOfInteger selectedIndices;
+      TColStd_MapOfInteger newIndices;
+      mySelector->GetIndex( anIO, selectedIndices );
+      for (int i = 0; i < aListId.count(); i++) {
+       const SMDS_MeshElement * e = aMesh->FindElement(aListId[ i ].toInt());
+       if (e) {
+         //if (!mySelectionMgr->IsIndexSelected(myActor->getIO(), e->GetID())) {
+          if (selectedIndices.Add(e->GetID())) {
+           //mySelectionMgr->AddOrRemoveIndex(myActor->getIO(), e->GetID(), true);
+            newIndices.Add(e->GetID());
+          }
          myNbOkElements++;
        }
       }
+      if (newIndices.Extent() > 0) {
+        mySelector->AddOrRemoveIndex(anIO, newIndices, true);
+       myViewWindow->highlight( anIO, true, true );
+      }
       myElementsId = theNewText;
-    }
-    else if (send == LineEditNodes) {   
-      for ( int i = 0; i < aListId.count(); i++ ) {
-       const SMDS_MeshNode * n = aMesh->FindNode( aListId[ i ].toInt() );
-       if ( n ) {
-         if ( !mySelection->IsIndexSelected( myActor->getIO(), n->GetID() ))
-           mySelection->AddOrRemoveIndex (myActor->getIO(), n->GetID(), true);
+
+    } else if (send == LineEditNodes) {
+      TColStd_IndexedMapOfInteger selectedIndices;
+      TColStd_MapOfInteger newIndices;
+      mySelector->GetIndex(myActor->getIO(), selectedIndices);
+
+      for (int i = 0; i < aListId.count(); i++) {
+       const SMDS_MeshNode * n = aMesh->FindNode(aListId[ i ].toInt());
+       if (n) {
+         //if (!mySelectionMgr->IsIndexSelected(myActor->getIO(), n->GetID())) {
+          if (selectedIndices.Add(n->GetID())) {
+           //mySelectionMgr->AddOrRemoveIndex (myActor->getIO(), n->GetID(), true);
+            newIndices.Add(n->GetID());
+          }
          myNbOkNodes++;
        }
       }
+      if (newIndices.Extent() > 0)
+      {
+        mySelector->AddOrRemoveIndex(myActor->getIO(), newIndices, true);
+       myViewWindow->highlight( myActor->getIO(), true, true );
+      }
     }
   }
-  
-  if ( myNbOkElements && (myNbOkNodes || LineEditNodes->text().stripWhiteSpace().isEmpty()) ) {
-    buttonOk->setEnabled( true );
-    buttonApply->setEnabled( true );
+
+  if (myNbOkElements && (myNbOkNodes || LineEditNodes->text().stripWhiteSpace().isEmpty())) {
+    buttonOk->setEnabled(true);
+    buttonApply->setEnabled(true);
   }
-  
+
   myBusy = false;
 }
 
@@ -464,125 +524,115 @@ void SMESHGUI_SmoothingDlg::onTextChange(const QString& theNewText)
 //=================================================================================
 void SMESHGUI_SmoothingDlg::SelectionIntoArgument()
 {
-  if ( myBusy ) return;
+  if (myBusy) return;
 
   // clear
   myActor = 0;
   QString aString = "";
 
   myBusy = true;
-  if (myEditCurrentArgument == (QWidget*)LineEditElements)
-    {
-      LineEditElements->setText( aString );
-      myNbOkElements = 0;
-      buttonOk->setEnabled( false );
-      buttonApply->setEnabled( false );
-    }
+  if (myEditCurrentArgument == (QWidget*)LineEditElements) {
+    LineEditElements->setText(aString);
+    myNbOkElements = 0;
+    buttonOk->setEnabled(false);
+    buttonApply->setEnabled(false);
+  }
   myBusy = false;
 
-  if ( !GroupButtons->isEnabled() ) // inactive
+  if (!GroupButtons->isEnabled()) // inactive
     return;
-  
+
   // get selected mesh
-  
-  int nbSel = mySelection->IObjectCount();
-  if(nbSel != 1)
+  SALOME_ListIO aList;
+  mySelectionMgr->selectedObjects(aList,SVTK_Viewer::Type());
+  int nbSel = aList.Extent();
+  if (nbSel != 1)
     return;
-  
-  Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject();
+
+  Handle(SALOME_InteractiveObject) IO = aList.First();
   myMesh = SMESH::GetMeshByIO(IO);
-  if(myMesh->_is_nil())
+  if (myMesh->_is_nil())
     return;
+
   myActor = SMESH::FindActorByObject(myMesh);
   if (!myActor)
     return;
-  
+
   int aNbUnits = 0;
-  if (myEditCurrentArgument == LineEditElements)
-    {
-      myElementsId = "";
-      
-      if (CheckBoxMesh->isChecked())
-       {
-         SMESH::GetNameOfSelectedIObjects(mySelection, aString);
-         
-         if(!SMESH::IObjectToInterface<SMESH::SMESH_Mesh>(IO)->_is_nil()) //MESH
-           {
-             // get IDs from mesh
-             SMDS_Mesh* aSMDSMesh = myActor->GetObject()->GetMesh();
-             if (!aSMDSMesh)
-               return;
-             
-             for (int i = aSMDSMesh->MinElementID(); i <= aSMDSMesh->MaxElementID(); i++  )
-               {
-                 const SMDS_MeshElement * e = aSMDSMesh->FindElement( i );
-                 if ( e ) {
-                   myElementsId += QString(" %1").arg(i);
-                   aNbUnits++;
-                 }
-               }
-           }
-         else if (!SMESH::IObjectToInterface<SMESH::SMESH_subMesh>(IO)->_is_nil()) //SUBMESH
-           {
-             // get submesh
-             SMESH::SMESH_subMesh_var aSubMesh = SMESH::IObjectToInterface<SMESH::SMESH_subMesh>(IO) ;
-             
-             // get IDs from submesh
-             SMESH::long_array_var anElementsIds = new SMESH::long_array;
-             anElementsIds = aSubMesh->GetElementsId();
-             for ( int i = 0; i < anElementsIds->length(); i++ )
-               myElementsId += QString(" %1").arg(anElementsIds[i]);
-             aNbUnits = anElementsIds->length();
-           }
-         else // GROUP
-           {
-             // get smesh group
-             SMESH::SMESH_GroupBase_var aGroup
-                = SMESH::IObjectToInterface<SMESH::SMESH_GroupBase>(IO);
-             if (aGroup->_is_nil())
-               return;
-             
-             // get IDs from smesh group
-             SMESH::long_array_var anElementsIds = new SMESH::long_array;
-             anElementsIds = aGroup->GetListOfID();
-             for ( int i = 0; i < anElementsIds->length(); i++ )
-               myElementsId += QString(" %1").arg(anElementsIds[i]);
-             aNbUnits = anElementsIds->length();
-           }
-       }
-      else
-       {
-         aNbUnits = SMESH::GetNameOfSelectedElements(mySelection, aString) ;
-         myElementsId = aString;
-       }
-    }
-  else if (myEditCurrentArgument == LineEditNodes && !myMesh->_is_nil() && myActor)
-    {
-      myNbOkNodes = 0;
-      aNbUnits = SMESH::GetNameOfSelectedNodes(mySelection, aString) ;
+
+  if (myEditCurrentArgument == LineEditElements) {
+    myElementsId = "";
+
+    if (CheckBoxMesh->isChecked()) {
+      SMESH::GetNameOfSelectedIObjects(mySelectionMgr, aString);
+
+      if (!SMESH::IObjectToInterface<SMESH::SMESH_Mesh>(IO)->_is_nil()) { //MESH
+        // get IDs from mesh
+        SMDS_Mesh* aSMDSMesh = myActor->GetObject()->GetMesh();
+        if (!aSMDSMesh)
+          return;
+
+        for (int i = aSMDSMesh->MinElementID(); i <= aSMDSMesh->MaxElementID(); i++ ) {
+          const SMDS_MeshElement * e = aSMDSMesh->FindElement(i);
+          if (e) {
+            myElementsId += QString(" %1").arg(i);
+            aNbUnits++;
+          }
+        }
+      } else if (!SMESH::IObjectToInterface<SMESH::SMESH_subMesh>(IO)->_is_nil()) { //SUBMESH
+        // get submesh
+        SMESH::SMESH_subMesh_var aSubMesh = SMESH::IObjectToInterface<SMESH::SMESH_subMesh>(IO);
+
+        // get IDs from submesh
+        SMESH::long_array_var anElementsIds = new SMESH::long_array;
+        anElementsIds = aSubMesh->GetElementsId();
+        for (int i = 0; i < anElementsIds->length(); i++) {
+          myElementsId += QString(" %1").arg(anElementsIds[i]);
+        }
+        aNbUnits = anElementsIds->length();
+      } else { // GROUP
+        // get smesh group
+        SMESH::SMESH_GroupBase_var aGroup =
+          SMESH::IObjectToInterface<SMESH::SMESH_GroupBase>(IO);
+        if (aGroup->_is_nil())
+          return;
+
+        // get IDs from smesh group
+        SMESH::long_array_var anElementsIds = new SMESH::long_array;
+        anElementsIds = aGroup->GetListOfID();
+        for (int i = 0; i < anElementsIds->length(); i++) {
+          myElementsId += QString(" %1").arg(anElementsIds[i]);
+        }
+        aNbUnits = anElementsIds->length();
+      }
+    } else {
+      aNbUnits = SMESH::GetNameOfSelectedElements(mySelector, myActor->getIO(), aString);
+      myElementsId = aString;
     }
-  
-  if(aNbUnits < 1)
-    return ;
+  } else if (myEditCurrentArgument == LineEditNodes && !myMesh->_is_nil() && myActor) {
+    myNbOkNodes = 0;
+    aNbUnits = SMESH::GetNameOfSelectedNodes(mySelector, myActor->getIO(), aString);
+  } else {
+  }
+
+  if (aNbUnits < 1)
+    return;
 
   myBusy = true;
-  myEditCurrentArgument->setText( aString );
+  myEditCurrentArgument->setText(aString);
   myBusy = false;
-  
+
   // OK
   if (myEditCurrentArgument == LineEditElements)
     myNbOkElements = true;
   else if (myEditCurrentArgument == LineEditNodes)
     myNbOkNodes = true;
-  
-  if (myNbOkElements)
-    {
-      buttonOk->setEnabled( true );
-      buttonApply->setEnabled( true );
-    }
-}
 
+  if (myNbOkElements) {
+    buttonOk->setEnabled(true);
+    buttonApply->setEnabled(true);
+  }
+}
 
 //=================================================================================
 // function : SetEditCurrentArgument()
@@ -591,143 +641,127 @@ void SMESHGUI_SmoothingDlg::SelectionIntoArgument()
 void SMESHGUI_SmoothingDlg::SetEditCurrentArgument()
 {
   QPushButton* send = (QPushButton*)sender();
-  
-  switch (myConstructorId)
+
+  switch (myConstructorId) {
+  case 0: /* default constructor */
     {
-    case 0: /* default constructor */
-      {        
-       disconnect( mySelection, 0, this, 0 );
-       mySelection->ClearIObjects();
-       mySelection->ClearFilters();
-       
-       if(send == SelectElementsButton) {
-         myEditCurrentArgument = LineEditElements;
-         SMESH::SetPointRepresentation(false);
-         if (CheckBoxMesh->isChecked())
-           {
-             QAD_Application::getDesktop()->SetSelectionMode( ActorSelection );
-             mySelection->AddFilter(myMeshOrSubMeshOrGroupFilter);
-           }
-         else
-           QAD_Application::getDesktop()->SetSelectionMode( CellSelection, true );
+      disconnect(mySelectionMgr, 0, this, 0);
+      mySelectionMgr->clearSelected();
+      mySelectionMgr->clearFilters();
+
+      if (send == SelectElementsButton) {
+        myEditCurrentArgument = LineEditElements;
+        SMESH::SetPointRepresentation(false);
+        if (CheckBoxMesh->isChecked()) {
+          mySelectionMgr->setSelectionModes(ActorSelection);
+          mySelectionMgr->installFilter(myMeshOrSubMeshOrGroupFilter);
+        } else {
+          myViewWindow->SetSelectionMode(CellSelection);
        }
-       else if (send == SelectNodesButton)
-         {
-           myEditCurrentArgument = LineEditNodes;
-           SMESH::SetPointRepresentation(true);
-           QAD_Application::getDesktop()->SetSelectionMode( NodeSelection, true );
-         }
-       
-       myEditCurrentArgument->setFocus();
-       connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
-       SelectionIntoArgument() ;
-       break;
+      }        else if (send == SelectNodesButton) {
+        myEditCurrentArgument = LineEditNodes;
+        SMESH::SetPointRepresentation(true);
+        myViewWindow->SetSelectionMode(NodeSelection);
       }
+
+      myEditCurrentArgument->setFocus();
+      connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
+      SelectionIntoArgument();
+      break;
     }
+  }
 }
 
 //=================================================================================
 // function : DeactivateActiveDialog()
-// purpose  :
+// purpose  : Deactivates this dialog
 //=================================================================================
 void SMESHGUI_SmoothingDlg::DeactivateActiveDialog()
 {
-  if ( GroupConstructors->isEnabled() ) {
-    GroupConstructors->setEnabled(false) ;
-    GroupArguments->setEnabled(false) ;
-    GroupButtons->setEnabled(false) ;
-    mySMESHGUI->ResetState() ;    
-    mySMESHGUI->SetActiveDialogBox(0) ;
+  if (GroupConstructors->isEnabled()) {
+    GroupConstructors->setEnabled(false);
+    GroupArguments->setEnabled(false);
+    GroupButtons->setEnabled(false);
+    mySMESHGUI->ResetState();
+    mySMESHGUI->SetActiveDialogBox(0);
   }
 }
 
-
 //=================================================================================
 // function : ActivateThisDialog()
-// purpose  :
+// purpose  : Activates this dialog
 //=================================================================================
 void SMESHGUI_SmoothingDlg::ActivateThisDialog()
 {
-  /* Emit a signal to deactivate the active dialog */
-  mySMESHGUI->EmitSignalDeactivateDialog() ;   
-  GroupConstructors->setEnabled(true) ;
-  GroupArguments->setEnabled(true) ;
-  GroupButtons->setEnabled(true) ;
-  
-  mySMESHGUI->SetActiveDialogBox( (QDialog*)this ) ;
-
-  QAD_Application::getDesktop()->SetSelectionMode( CellSelection, true );
+  // Emit a signal to deactivate the active dialog
+  mySMESHGUI->EmitSignalDeactivateDialog();
+  GroupConstructors->setEnabled(true);
+  GroupArguments->setEnabled(true);
+  GroupButtons->setEnabled(true);
+
+  mySMESHGUI->SetActiveDialogBox(this);
+  myViewWindow->SetSelectionMode(CellSelection);
   SelectionIntoArgument();
 }
 
-
 //=================================================================================
 // function : enterEvent()
-// purpose  :
+// purpose  : Mouse enter event
 //=================================================================================
-void SMESHGUI_SmoothingDlg::enterEvent(QEvent* e)
+void SMESHGUI_SmoothingDlg::enterEvent (QEvent*)
 {
-  if ( GroupConstructors->isEnabled() )
-    return ;  
-  ActivateThisDialog() ;
+  if (!GroupConstructors->isEnabled())
+    ActivateThisDialog();
 }
 
-
 //=================================================================================
 // function : closeEvent()
 // purpose  :
 //=================================================================================
-void SMESHGUI_SmoothingDlg::closeEvent( QCloseEvent* e )
+void SMESHGUI_SmoothingDlg::closeEvent (QCloseEvent*)
 {
   /* same than click on cancel button */
-  this->ClickOnCancel() ;
+  this->ClickOnCancel();
 }
 
-
 //=======================================================================
-//function : hideEvent
-//purpose  : caused by ESC key
+// function : hideEvent()
+// purpose  : caused by ESC key
 //=======================================================================
-
-void SMESHGUI_SmoothingDlg::hideEvent ( QHideEvent * e )
+void SMESHGUI_SmoothingDlg::hideEvent (QHideEvent*)
 {
-  if ( !isMinimized() )
+  if (!isMinimized())
     ClickOnCancel();
 }
 
-
 //=======================================================================
-//function : onSelectMesh
-//purpose  :
+// function : onSelectMesh()
+// purpose  :
 //=======================================================================
-void SMESHGUI_SmoothingDlg::onSelectMesh ( bool toSelectMesh )
+void SMESHGUI_SmoothingDlg::onSelectMesh (bool toSelectMesh)
 {
   if (toSelectMesh)
-    TextLabelElements->setText( tr( "SMESH_NAME" ) );
+    TextLabelElements->setText(tr("SMESH_NAME"));
   else
-    TextLabelElements->setText( tr( "SMESH_ID_ELEMENTS" ) );
-  
-  if (myEditCurrentArgument != LineEditElements)
-    {
-      LineEditElements->clear();
-      return;
-    }
-  
-  mySelection->ClearFilters() ;
+    TextLabelElements->setText(tr("SMESH_ID_ELEMENTS"));
+
+  if (myEditCurrentArgument != LineEditElements) {
+    LineEditElements->clear();
+    return;
+  }
+
+  mySelectionMgr->clearFilters();
   SMESH::SetPointRepresentation(false);
-  
-  if (toSelectMesh)
-    {
-      QAD_Application::getDesktop()->SetSelectionMode( ActorSelection );
-      mySelection->AddFilter(myMeshOrSubMeshOrGroupFilter);
-      LineEditElements->setReadOnly(true);
-    }
-  else
-    {
-      QAD_Application::getDesktop()->SetSelectionMode( CellSelection, true );
-      LineEditElements->setReadOnly(false);
-      onTextChange(LineEditElements->text());
-    }
-  
+
+  if (toSelectMesh) {
+    mySelectionMgr->setSelectionModes(ActorSelection);
+    mySelectionMgr->installFilter(myMeshOrSubMeshOrGroupFilter);
+    LineEditElements->setReadOnly(true);
+  } else {
+    myViewWindow->SetSelectionMode(CellSelection);
+    LineEditElements->setReadOnly(false);
+    onTextChange(LineEditElements->text());
+  }
+
   SelectionIntoArgument();
 }
index fafade3f33bb697de5a0213232b154507d5572e4..fc1fdb21599238548db50d1a95b86a9ece9d218b 100644 (file)
 #ifndef DIALOGBOX_SMOOTHING_H
 #define DIALOGBOX_SMOOTHING_H
 
-#include "SALOME_Selection.h"
+#include "SalomeApp_SelectionMgr.h"
+
 #include "SMESH_LogicalFilter.hxx"
+
 // QT Includes
 #include <qdialog.h>
 
@@ -47,6 +49,8 @@ class QSpinBox;
 class SMESHGUI_SpinBox;
 class SMESHGUI;
 class SMESH_Actor;
+class SVTK_ViewWindow;
+class SVTK_Selector;
 
 
 // IDL Headers
@@ -63,28 +67,33 @@ class SMESHGUI_SmoothingDlg : public QDialog
     Q_OBJECT
 
 public:
-    SMESHGUI_SmoothingDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 );
+    SMESHGUI_SmoothingDlg( SMESHGUI*,
+                          const char* name = 0,
+                          bool modal = FALSE,
+                          WFlags fl = 0);
     ~SMESHGUI_SmoothingDlg();
 
 private:
 
-    void Init() ;
-    void closeEvent( QCloseEvent* e ) ;
-    void enterEvent ( QEvent * ) ;                          /* mouse enter the QWidget */
-    void hideEvent ( QHideEvent * );                        /* ESC key */
+    void Init();
+    void closeEvent(QCloseEvent*);
+    void enterEvent (QEvent*);                             /* mouse enter the QWidget */
+    void hideEvent (QHideEvent*);                          /* ESC key */
 
-    SMESHGUI*                     mySMESHGUI ;              /* Current SMESHGUI object */
-    SALOME_Selection*             mySelection ;             /* User shape selection */
+    SMESHGUI*                     mySMESHGUI;              /* Current SMESHGUI object */
+    SalomeApp_SelectionMgr*       mySelectionMgr;          /* User shape selection */
     QString                       myElementsId;
-    int                           myNbOkElements ;          /* to check when elements are defined */
-    int                           myNbOkNodes ;             /* to check when fixed nodes are defined */
-    int                           myConstructorId ;         /* Current constructor id = radio button id */
-    QLineEdit*                    myEditCurrentArgument;    /* Current  LineEdit */
+    int                           myNbOkElements;          /* to check when elements are defined */
+    int                           myNbOkNodes;             /* to check when fixed nodes are defined */
+    int                           myConstructorId;         /* Current constructor id = radio button id */
+    QLineEdit*                    myEditCurrentArgument;   /* Current  LineEdit */
+    SVTK_ViewWindow*              myViewWindow;
+    SVTK_Selector*                mySelector;
 
     bool                          myBusy;
     SMESH::SMESH_Mesh_var         myMesh;
     SMESH_Actor*                  myActor;
-    Handle(SMESH_LogicalFilter)   myMeshOrSubMeshOrGroupFilter;
+    SMESH_LogicalFilter*          myMeshOrSubMeshOrGroupFilter;
 
     QButtonGroup* GroupConstructors;
     QRadioButton* Constructor1;
@@ -106,6 +115,7 @@ private:
     QSpinBox* SpinBox_IterationLimit;
     QLabel* TextLabelAspectRatio;
     SMESHGUI_SpinBox* SpinBox_AspectRatio;
+    QCheckBox       * CheckBoxParametric;
     
 private slots:
 
index 017b37b33b77b3300f393b3bc0386bfaedc1d718..54c247a80620ad7a5ac0223ad4fae1b60dd4db8a 100644 (file)
@@ -30,6 +30,7 @@
 #include "SMESHGUI.h"
 
 #include <qvalidator.h>
+#include <qlineedit.h>
 
 using namespace std;
 
@@ -37,19 +38,18 @@ using namespace std;
 // class    : SMESHGUI_SpinBox()
 // purpose  : constructor of specific widget accepting floats in double precision.
 //=================================================================================
-SMESHGUI_SpinBox::SMESHGUI_SpinBox( QWidget* parent, const char* name )
-: QAD_SpinBoxDbl( parent, name)
+SMESHGUI_SpinBox::SMESHGUI_SpinBox (QWidget* parent, const char* name)
+     : QtxDblSpinBox(parent, name)
 {
 }
 
-
 //=================================================================================
 // function : SetStep()  [SLOT]
 // purpose  :
 //=================================================================================
-void SMESHGUI_SpinBox::SetStep( double newStep )
+void SMESHGUI_SpinBox::SetStep (double newStep)
 {
-  setLineStep( newStep );
+  setLineStep(newStep);
 }
 
 //=================================================================================
@@ -64,16 +64,17 @@ SMESHGUI_SpinBox::~SMESHGUI_SpinBox()
 // function : SetValue()
 // purpose  :
 //=================================================================================
-void SMESHGUI_SpinBox::SetValue( double v )
+void SMESHGUI_SpinBox::SetValue (double v)
 {
-  setValue( v );
+  setValue(v);
+  editor()->setCursorPosition( 0 );
 }
 
 //=================================================================================
 // function : GetValue()
 // purpose  : returns a double
 //=================================================================================
-double SMESHGUI_SpinBox::GetValue( )
+double SMESHGUI_SpinBox::GetValue()
 {
   return value();
 }
@@ -82,7 +83,7 @@ double SMESHGUI_SpinBox::GetValue( )
 // function : GetString()
 // purpose  : returns a QString
 //=================================================================================
-QString SMESHGUI_SpinBox::GetString( )
+QString SMESHGUI_SpinBox::GetString()
 {
   return cleanText();
 }
@@ -91,9 +92,10 @@ QString SMESHGUI_SpinBox::GetString( )
 // function : RangeStepAndValidator()
 // purpose  :
 //=================================================================================
-void SMESHGUI_SpinBox::RangeStepAndValidator( double min, double max, double step, unsigned short decimals )
+void SMESHGUI_SpinBox::RangeStepAndValidator
+  (double min, double max, double step, unsigned short decimals)
 {
-  setRange( min, max );
-  setLineStep( step );
-  ( ( QDoubleValidator* )validator() )->setRange( min, max, decimals ) ;
+  setRange(min, max);
+  setLineStep(step);
+  ((QDoubleValidator*)validator())->setRange(min, max, decimals);
 }
index fab8312d2133e9d1a9709fe8419ecacce2e00969..8655e4dfb2348881215e02f593683bc1273e2fe1 100644 (file)
 //  Module : SMESH
 //  $Header$
 
-#ifndef  SMESHSPINBOX_H
-#define  SMESHSPINBOX_H
+#ifndef  SMESH_SPINBOX_H
+#define  SMESH_SPINBOX_H
 
-#include "QAD_SpinBoxDbl.h" 
+#include <QtxDblSpinBox.h>
 
 //=================================================================================
 // class    : SMESHGUI_SpinBox
-// purpose  : Derivated from QAD_SpinBoxDbl class 
+// purpose  : Derivated from QtxDblSpinBox class 
 //=================================================================================
-class SMESHGUI_SpinBox : public QAD_SpinBoxDbl
+class SMESHGUI_SpinBox : public QtxDblSpinBox
 {
   Q_OBJECT
 
-public :
+public:
+  SMESHGUI_SpinBox (QWidget* parent, const char* name = 0);
+  ~SMESHGUI_SpinBox();
 
-  SMESHGUI_SpinBox( QWidget* parent, const char* name = 0 ) ;
-  ~SMESHGUI_SpinBox() ;
-  
-  void       RangeStepAndValidator( double         min = -1000000.0, 
-                                   double         max = +1000000.0, 
-                                   double         step = 100.0, 
-                                   unsigned short decimals = 3 ) ;
-  void       SetValue( double v ) ;
-  double     GetValue() ;
-  QString    GetString() ;
-  QLineEdit* editor() { return QAD_SpinBoxDbl::editor(); } 
+  void       RangeStepAndValidator (double         min = -1000000.0,
+                                   double         max = +1000000.0,
+                                   double         step = 100.0,
+                                   unsigned short decimals = 3);
+  void       SetValue (double v);
+  double     GetValue();
+  QString    GetString();
+  QLineEdit* editor() { return QtxDblSpinBox::editor(); } 
 
 public slots:
-  void       SetStep( double newStep );
-
+  void       SetStep (double newStep);
 };
-#endif //  SMESHSPINBOX_H
+#endif //  SMESH_SPINBOX_H
index 37dfbdfedbb80c7a3b50a7415f605eef78ba58c7..3b7916938be2c0666c903c9e9282aabd235af895 100644 (file)
@@ -1,23 +1,23 @@
 //  SMESH SMESHGUI : GUI for SMESH component
 //
 //  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
-// 
-//  This library is free software; you can redistribute it and/or 
-//  modify it under the terms of the GNU Lesser General Public 
-//  License as published by the Free Software Foundation; either 
-//  version 2.1 of the License. 
-// 
-//  This library is distributed in the hope that it will be useful, 
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of 
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
-//  Lesser General Public License for more details. 
-// 
-//  You should have received a copy of the GNU Lesser General Public 
-//  License along with this library; if not, write to the Free Software 
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
-// 
-//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
 //
 //
 //
 //  Module : SMESH
 //  $Header$
 
+#include "SMESHGUI_StandardMeshInfosDlg.h"
+
+#include "SMESHGUI.h"
+#include "SMESHGUI_Utils.h"
+#include "SMESHGUI_MeshUtils.h"
+
+#include "SMESH.hxx"
+#include "SMESH_TypeFilter.hxx"
+
+#include "SALOMEDSClient_Study.hxx"
+#include "SALOMEDSClient_SObject.hxx"
+
+#include "SUIT_Session.h"
+#include "SUIT_OverrideCursor.h"
+
+#include "SalomeApp_SelectionMgr.h"
+#include "SALOME_ListIO.hxx"
+
+#include "utilities.h"
+
 // QT Includes
 #include <qgroupbox.h>
 #include <qlabel.h>
 #include <qmap.h>
 #include <qpushbutton.h>
 
-#include "QAD_Application.h"
-#include "QAD_Desktop.h"
-#include "QAD_WaitCursor.h"
-
-#include "SMESHGUI_StandardMeshInfosDlg.h"
-#include "SMESHGUI_Utils.h"
-#include "SMESHGUI_MeshUtils.h"
-#include "SMESHGUI.h"
-
-#include "SMESH.hxx"
-
 // IDL Headers
 #include "SALOMEconfig.h"
 #include CORBA_SERVER_HEADER(SMESH_Mesh)
 #include CORBA_SERVER_HEADER(SMESH_Group)
 #include CORBA_SERVER_HEADER(GEOM_Gen)
 
-#include "utilities.h"
-
 using namespace std;
 
 
 //=================================================================================
 /*!
  *  SMESHGUI_StandardMeshInfosDlg::SMESHGUI_StandardMeshInfosDlg
- * 
+ *
  *  Constructor
  */
 //=================================================================================
-SMESHGUI_StandardMeshInfosDlg::SMESHGUI_StandardMeshInfosDlg( QWidget* parent,  const char* name, bool modal, WFlags fl )
-     : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | WDestructiveClose )
+SMESHGUI_StandardMeshInfosDlg::SMESHGUI_StandardMeshInfosDlg (QWidget* parent, const char* name,
+                                                              bool modal, WFlags fl)
+     : QDialog(parent, name, modal, WStyle_Customize | WStyle_NormalBorder |
+               WStyle_Title | WStyle_SysMenu | WDestructiveClose)
 {
-  if ( !name )
-      setName( "SMESHGUI_StandardMeshInfosDlg" );
-  setCaption( tr( "SMESH_STANDARD_MESHINFO_TITLE"  ) );
-  setSizeGripEnabled( TRUE );
+  if (!name)
+      setName("SMESHGUI_StandardMeshInfosDlg");
+  setCaption(tr("SMESH_STANDARD_MESHINFO_TITLE" ));
+  setSizeGripEnabled(TRUE);
 
   myStartSelection = true;
   myIsActiveWindow = true;
 
   // dialog layout
-  QGridLayout* aDlgLayout = new QGridLayout( this ); 
-  aDlgLayout->setSpacing( 6 );
-  aDlgLayout->setMargin( 11 );
-  
+  QGridLayout* aDlgLayout = new QGridLayout(this);
+  aDlgLayout->setSpacing(6);
+  aDlgLayout->setMargin(11);
+
   // mesh group box
-  myMeshGroup = new QGroupBox( this, "myMeshGroup" );
-  myMeshGroup->setTitle( tr( "SMESH_MESH" ) );
-  myMeshGroup->setColumnLayout(0, Qt::Vertical );
-  myMeshGroup->layout()->setSpacing( 0 );
-  myMeshGroup->layout()->setMargin( 0 );
-  QGridLayout* myMeshGroupLayout = new QGridLayout( myMeshGroup->layout() );
-  myMeshGroupLayout->setAlignment( Qt::AlignTop );
-  myMeshGroupLayout->setSpacing( 6 );
-  myMeshGroupLayout->setMargin( 11 );
-  
+  myMeshGroup = new QGroupBox(this, "myMeshGroup");
+  myMeshGroup->setTitle(tr("SMESH_MESH"));
+  myMeshGroup->setColumnLayout(0, Qt::Vertical);
+  myMeshGroup->layout()->setSpacing(0);
+  myMeshGroup->layout()->setMargin(0);
+  QGridLayout* myMeshGroupLayout = new QGridLayout(myMeshGroup->layout());
+  myMeshGroupLayout->setAlignment(Qt::AlignTop);
+  myMeshGroupLayout->setSpacing(6);
+  myMeshGroupLayout->setMargin(11);
+
   // select button, label and line edit with mesh name
-  myNameLab = new QLabel( myMeshGroup, "myNameLab" );
-  myNameLab->setText( tr( "SMESH_NAME"  ) );
-  myMeshGroupLayout->addWidget( myNameLab, 0, 0 );
-
-  QPixmap image0( QAD_Desktop::getResourceManager()->loadPixmap( "SMESH",tr( "ICON_SELECT" ) ) );
-  mySelectBtn = new QPushButton( myMeshGroup, "mySelectBtn" );
-  mySelectBtn->setPixmap( image0 );
-  mySelectBtn->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ) );
-  myMeshGroupLayout->addWidget( mySelectBtn, 0, 1 );
-  
-  myMeshLine = new QLineEdit( myMeshGroup, "myMeshLine" );
-  myMeshGroupLayout->addWidget( myMeshLine, 0, 2 );
-  
-  aDlgLayout->addWidget( myMeshGroup, 0, 0 );
+  myNameLab = new QLabel(myMeshGroup, "myNameLab");
+  myNameLab->setText(tr("SMESH_NAME" ));
+  myMeshGroupLayout->addWidget(myNameLab, 0, 0);
+
+  QPixmap image0(SUIT_Session::session()->resourceMgr()->loadPixmap("SMESH",tr("ICON_SELECT")));
+  mySelectBtn = new QPushButton(myMeshGroup, "mySelectBtn");
+  mySelectBtn->setPixmap(image0);
+  mySelectBtn->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed));
+  myMeshGroupLayout->addWidget(mySelectBtn, 0, 1);
+
+  myMeshLine = new QLineEdit(myMeshGroup, "myMeshLine");
+  myMeshGroupLayout->addWidget(myMeshLine, 0, 2);
+
+  aDlgLayout->addWidget(myMeshGroup, 0, 0);
 
   // information group box
-  myInfoGroup  = new QGroupBox( this, "myInfoGroup" );
-  myInfoGroup->setTitle( tr( "SMESH_INFORMATION" ) );
-  myInfoGroup->setColumnLayout(0, Qt::Vertical );
-  myInfoGroup->layout()->setSpacing( 0 );
-  myInfoGroup->layout()->setMargin( 0 );
-  QGridLayout* myInfoGroupLayout = new QGridLayout( myInfoGroup->layout() );
-  myInfoGroupLayout->setAlignment( Qt::AlignTop );
-  myInfoGroupLayout->setSpacing( 6 );
-  myInfoGroupLayout->setMargin( 11 );
-  
+  myInfoGroup  = new QGroupBox(this, "myInfoGroup");
+  myInfoGroup->setTitle(tr("SMESH_INFORMATION"));
+  myInfoGroup->setColumnLayout(0, Qt::Vertical);
+  myInfoGroup->layout()->setSpacing(0);
+  myInfoGroup->layout()->setMargin(0);
+  QGridLayout* myInfoGroupLayout = new QGridLayout(myInfoGroup->layout());
+  myInfoGroupLayout->setAlignment(Qt::AlignTop);
+  myInfoGroupLayout->setSpacing(6);
+  myInfoGroupLayout->setMargin(11);
+
   // information text browser
   myInfo = new QTextBrowser(myInfoGroup, "myInfo");
-  myInfoGroupLayout->addWidget( myInfo, 0, 0 );
+  myInfoGroupLayout->addWidget(myInfo, 0, 0);
 
-  aDlgLayout->addWidget( myInfoGroup, 1, 0 );
+  aDlgLayout->addWidget(myInfoGroup, 1, 0);
 
   // buttons group
-  myButtonsGroup = new QGroupBox( this, "myButtonsGroup" );
-  myButtonsGroup->setColumnLayout(0, Qt::Vertical );
-  myButtonsGroup->layout()->setSpacing( 0 );  myButtonsGroup->layout()->setMargin( 0 );
-  QHBoxLayout* myButtonsGroupLayout = new QHBoxLayout( myButtonsGroup->layout() );
-  myButtonsGroupLayout->setAlignment( Qt::AlignTop );
-  myButtonsGroupLayout->setSpacing( 6 ); myButtonsGroupLayout->setMargin( 11 );
-  
+  myButtonsGroup = new QGroupBox(this, "myButtonsGroup");
+  myButtonsGroup->setColumnLayout(0, Qt::Vertical);
+  myButtonsGroup->layout()->setSpacing(0);  myButtonsGroup->layout()->setMargin(0);
+  QHBoxLayout* myButtonsGroupLayout = new QHBoxLayout(myButtonsGroup->layout());
+  myButtonsGroupLayout->setAlignment(Qt::AlignTop);
+  myButtonsGroupLayout->setSpacing(6); myButtonsGroupLayout->setMargin(11);
+
   // buttons --> OK button
-  myOkBtn = new QPushButton( tr( "SMESH_BUT_OK"  ), myButtonsGroup, "myOkBtn" );
-  myOkBtn->setAutoDefault( TRUE ); myOkBtn->setDefault( TRUE );
+  myOkBtn = new QPushButton(tr("SMESH_BUT_OK" ), myButtonsGroup, "myOkBtn");
+  myOkBtn->setAutoDefault(TRUE); myOkBtn->setDefault(TRUE);
   myButtonsGroupLayout->addStretch();
-  myButtonsGroupLayout->addWidget( myOkBtn );
+  myButtonsGroupLayout->addWidget(myOkBtn);
   myButtonsGroupLayout->addStretch();
-  
-  aDlgLayout->addWidget( myButtonsGroup, 2, 0 );
-  
-  mySelection = SALOME_Selection::Selection( SMESHGUI::GetSMESHGUI()->GetActiveStudy()->getSelection() );
-  SMESHGUI::GetSMESHGUI()->SetActiveDialogBox( this ) ;
+
+  aDlgLayout->addWidget(myButtonsGroup, 2, 0);
+
+  mySelectionMgr = SMESHGUI::selectionMgr();
+  SMESHGUI::GetSMESHGUI()->SetActiveDialogBox(this);
 
   // connect signals
-  connect( myOkBtn,                  SIGNAL( clicked() ),                      this, SLOT( close() ) );
-  connect( mySelectBtn,              SIGNAL( clicked() ),                      this, SLOT( onStartSelection() ) );
-  connect( SMESHGUI::GetSMESHGUI(),  SIGNAL( SignalCloseAllDialogs() ),        this, SLOT( close() ) ) ;
-  connect( SMESHGUI::GetSMESHGUI(),  SIGNAL( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ;
-  connect( mySelection,              SIGNAL( currentSelectionChanged() ),      this, SLOT( onSelectionChanged() ) );
+  connect(myOkBtn,                 SIGNAL(clicked()),                      this, SLOT(close()));
+  connect(mySelectBtn,             SIGNAL(clicked()),                      this, SLOT(onStartSelection()));
+  connect(SMESHGUI::GetSMESHGUI(), SIGNAL(SignalCloseAllDialogs()),        this, SLOT(close()));
+  connect(SMESHGUI::GetSMESHGUI(), SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog()));
+  connect(mySelectionMgr,          SIGNAL(currentSelectionChanged()),      this, SLOT(onSelectionChanged()));
 
   // resize and move dialog, then show
   this->setMinimumSize(270, 428);
   int x, y;
-  SMESHGUI::GetSMESHGUI()->DefineDlgPosition( this, x, y );
-  this->move( x, y );
+  SMESHGUI::GetSMESHGUI()->DefineDlgPosition(this, x, y);
+  this->move(x, y);
   this->show();
-  
+
   // init dialog with current selection
-  myMeshFilter = new SMESH_TypeFilter( MESH );
-  mySelection->AddFilter( myMeshFilter );
+  myMeshFilter = new SMESH_TypeFilter (MESH);
+  mySelectionMgr->installFilter(myMeshFilter);
   onSelectionChanged();
 }
 
 //=================================================================================
 /*!
  *  SMESHGUI_StandardMeshInfosDlg::~SMESHGUI_StandardMeshInfosDlg
- * 
+ *
  *  Destructor
  */
 //=================================================================================
@@ -182,199 +191,190 @@ SMESHGUI_StandardMeshInfosDlg::~SMESHGUI_StandardMeshInfosDlg()
 //=================================================================================
 void SMESHGUI_StandardMeshInfosDlg::DumpMeshInfos()
 {
-  QAD_WaitCursor wc;
-  int nbSel = mySelection->IObjectCount();
+  SUIT_OverrideCursor wc;
+
+  SALOME_ListIO aList;
+  mySelectionMgr->selectedObjects(aList);
+
+  int nbSel = aList.Extent();
   myInfo->clear();
-  if ( nbSel == 1 ) {
+  if (nbSel == 1) {
     myStartSelection = false;
-    myMeshLine->setText( "" );
-    SMESH::SMESH_Mesh_var aMesh = SMESH::GetMeshByIO( mySelection->firstIObject() );
-    
-    if ( !aMesh->_is_nil() ) {
+    myMeshLine->setText("");
+    SMESH::SMESH_Mesh_var aMesh = SMESH::GetMeshByIO(aList.First());
+
+    if (!aMesh->_is_nil()) {
       QString aName, anInfo;
-      SMESH::GetNameOfSelectedIObjects(mySelection, aName);
-      myMeshLine->setText( aName );
+      SMESH::GetNameOfSelectedIObjects(mySelectionMgr, aName);
+      myMeshLine->setText(aName);
       int aNbNodes =   (int)aMesh->NbNodes();
       int aNbEdges =   (int)aMesh->NbEdges();
       int aNbFaces =   (int)aMesh->NbFaces();
       int aNbVolumes = (int)aMesh->NbVolumes();
-      
+
       int aDimension = 0;
       double aNbDimElements = 0;
       if (aNbVolumes > 0) {
        aNbDimElements = aNbVolumes;
        aDimension = 3;
       }
-      else if(aNbFaces > 0 ) {
+      else if(aNbFaces > 0) {
        aNbDimElements = aNbFaces;
        aDimension = 2;
       }
-      else if(aNbEdges > 0 ) {
+      else if(aNbEdges > 0) {
        aNbDimElements = aNbEdges;
        aDimension = 1;
       }
-      else if(aNbNodes > 0 ) {
+      else if(aNbNodes > 0) {
        aNbDimElements = aNbNodes;
        aDimension = 0;
       }
-      
+
       // information about the mesh
       anInfo.append(QString("Nb of element of dimension %1:<b> %2</b><br>").arg(aDimension).arg(aNbDimElements));
       anInfo.append(QString("Nb of nodes: <b>%1</b><br><br>").arg(aNbNodes));
 
       // information about the groups of the mesh
-      SALOMEDS::Study_var aStudy = SMESH::GetActiveStudyDocument();
-      SALOMEDS::SObject_var aMeshSO = aStudy->FindObjectIOR( aStudy->ConvertObjectToIOR(aMesh) ); 
-      SALOMEDS::SObject_var anObj;
-      
+      _PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
+      _PTR(SObject) aMeshSO = SMESH::FindSObject(aMesh);
+      _PTR(SObject) anObj;
+
       bool hasGroup = false;
 
       // info about groups on nodes
-      aMeshSO->FindSubObject(Tag_NodeGroups , anObj);
-      if ( !anObj->_is_nil() )
-       {
-         SALOMEDS::ChildIterator_var it = aStudy->NewChildIterator(anObj);
-         if (it->More())
-           {
-             anInfo.append(QString("Groups:<br><br>"));
-             hasGroup = true;
-           }
-         for(; it->More(); it->Next()){
-           SALOMEDS::SObject_var subObj = it->Value();
-           SMESH::SMESH_GroupBase_var aGroup = SMESH::SMESH_GroupBase::_narrow( subObj->GetObject() );
-           if ( !aGroup->_is_nil() )
-             {
-               anInfo.append(QString("-   <b>%1</b><br>").arg(aGroup->GetName()));
-               anInfo.append(QString("%1<br>").arg("on nodes"));
-               anInfo.append(QString("%1<br>").arg(aGroup->Size()));
-               // check if the group based on geometry
-               SMESH::SMESH_GroupOnGeom_var aGroupOnGeom = SMESH::SMESH_GroupOnGeom::_narrow(aGroup);
-               if ( !aGroupOnGeom->_is_nil() )
-                 {
-                   GEOM::GEOM_Object_var aGroupMainShape = aGroupOnGeom->GetShape();
-                   QString aShapeName = "<unknown>";
-                   SALOMEDS::SObject_var aGeomObj, aRef;
-                   if ( subObj->FindSubObject( 1, aGeomObj ) &&  aGeomObj->ReferencedObject( aRef ))
-                     aShapeName = aRef->GetName();
-                   anInfo.append(QString("based on <i>%1</i> geometry object<br><br>").arg(aShapeName));
-                 }
-               else
-                 anInfo.append(QString("<br>"));
-             }
-         }
-       }  
-      
+      aMeshSO->FindSubObject(Tag_NodeGroups, anObj);
+      if (anObj) {
+        _PTR(ChildIterator) it = aStudy->NewChildIterator(anObj);
+       if (it->More()) {
+          anInfo.append(QString("Groups:<br><br>"));
+          hasGroup = true;
+        }
+       for (; it->More(); it->Next()) {
+          _PTR(SObject) subObj = it->Value();
+          CORBA::Object_var anObject = SMESH::SObjectToObject(subObj);
+         SMESH::SMESH_GroupBase_var aGroup = SMESH::SMESH_GroupBase::_narrow(anObject);
+         if (!aGroup->_is_nil()) {
+            anInfo.append(QString("-   <b>%1</b><br>").arg(aGroup->GetName()));
+            anInfo.append(QString("%1<br>").arg("on nodes"));
+            anInfo.append(QString("%1<br>").arg(aGroup->Size()));
+            // check if the group based on geometry
+            SMESH::SMESH_GroupOnGeom_var aGroupOnGeom = SMESH::SMESH_GroupOnGeom::_narrow(aGroup);
+            if (!aGroupOnGeom->_is_nil()) {
+              GEOM::GEOM_Object_var aGroupMainShape = aGroupOnGeom->GetShape();
+              QString aShapeName = "<unknown>";
+              _PTR(SObject) aGeomObj, aRef;
+              if (subObj->FindSubObject(1, aGeomObj) &&  aGeomObj->ReferencedObject(aRef))
+                aShapeName = aRef->GetName().c_str();
+              anInfo.append(QString("based on <i>%1</i> geometry object<br><br>").arg(aShapeName));
+            } else {
+              anInfo.append(QString("<br>"));
+            }
+          }
+       }
+      }
+
       // info about groups on edges
-      anObj = SALOMEDS::SObject::_nil();
-      aMeshSO->FindSubObject(Tag_EdgeGroups , anObj);
-      if ( !anObj->_is_nil() )
-       {
-         SALOMEDS::ChildIterator_var it = aStudy->NewChildIterator(anObj);
-         if (!hasGroup && it->More())
-           {
-             anInfo.append(QString("Groups:<br><br>"));
-             hasGroup = true;
-           }
-         for(; it->More(); it->Next()){
-           SALOMEDS::SObject_var subObj = it->Value();
-           SMESH::SMESH_GroupBase_var aGroup = SMESH::SMESH_GroupBase::_narrow( subObj->GetObject() );
-           if ( !aGroup->_is_nil() )
-             {
-               anInfo.append(QString("-   <b>%1</b><br>").arg(aGroup->GetName()));
-               anInfo.append(QString("%1<br>").arg("on edges"));
-               anInfo.append(QString("%1<br>").arg(aGroup->Size()));
-               // check if the group based on geometry
-               SMESH::SMESH_GroupOnGeom_var aGroupOnGeom = SMESH::SMESH_GroupOnGeom::_narrow(aGroup);
-               if ( !aGroupOnGeom->_is_nil() )
-                 {
-                   GEOM::GEOM_Object_var aGroupMainShape = aGroupOnGeom->GetShape();
-                   QString aShapeName = "<unknown>";
-                   SALOMEDS::SObject_var aGeomObj, aRef;
-                   if ( subObj->FindSubObject( 1, aGeomObj ) &&  aGeomObj->ReferencedObject( aRef ))
-                     aShapeName = aRef->GetName();
-                   anInfo.append(QString("based on <i>%1</i> geometry object<br><br>").arg(aShapeName));
-                 }
-               else
-                 anInfo.append(QString("<br>"));
-             }
-         }
+      anObj.reset();
+      aMeshSO->FindSubObject(Tag_EdgeGroups, anObj);
+      if (anObj) {
+        _PTR(ChildIterator) it = aStudy->NewChildIterator(anObj);
+        if (!hasGroup && it->More()) {
+          anInfo.append(QString("Groups:<br><br>"));
+          hasGroup = true;
+        }
+       for (; it->More(); it->Next()) {
+          _PTR(SObject) subObj = it->Value();
+          CORBA::Object_var anObject = SMESH::SObjectToObject(subObj);
+         SMESH::SMESH_GroupBase_var aGroup = SMESH::SMESH_GroupBase::_narrow(anObject);
+         if (!aGroup->_is_nil()) {
+            anInfo.append(QString("-   <b>%1</b><br>").arg(aGroup->GetName()));
+            anInfo.append(QString("%1<br>").arg("on edges"));
+            anInfo.append(QString("%1<br>").arg(aGroup->Size()));
+            // check if the group based on geometry
+            SMESH::SMESH_GroupOnGeom_var aGroupOnGeom = SMESH::SMESH_GroupOnGeom::_narrow(aGroup);
+            if (!aGroupOnGeom->_is_nil()) {
+              GEOM::GEOM_Object_var aGroupMainShape = aGroupOnGeom->GetShape();
+              QString aShapeName = "<unknown>";
+              _PTR(SObject) aGeomObj, aRef;
+              if (subObj->FindSubObject(1, aGeomObj) && aGeomObj->ReferencedObject(aRef))
+                aShapeName = aRef->GetName().c_str();
+              anInfo.append(QString("based on <i>%1</i> geometry object<br><br>").arg(aShapeName));
+            } else {
+              anInfo.append(QString("<br>"));
+            }
+          }
        }
-      
+      }
+
       // info about groups on faces
-      anObj = SALOMEDS::SObject::_nil();
+      anObj.reset();
       aMeshSO->FindSubObject(Tag_FaceGroups , anObj);
-      if ( !anObj->_is_nil() )
-       {
-         SALOMEDS::ChildIterator_var it = aStudy->NewChildIterator(anObj);
-         if (!hasGroup && it->More())
-           {
-             anInfo.append(QString("Groups:<br><br>"));
-             hasGroup = true;
-           }
-         for(; it->More(); it->Next()){
-           SALOMEDS::SObject_var subObj = it->Value();
-           SMESH::SMESH_GroupBase_var aGroup = SMESH::SMESH_GroupBase::_narrow( subObj->GetObject() );
-           if ( !aGroup->_is_nil() )
-             {
-               anInfo.append(QString("-   <b>%1</b><br>").arg(aGroup->GetName()));
-               anInfo.append(QString("%1<br>").arg("on faces"));
-               anInfo.append(QString("%1<br>").arg(aGroup->Size()));
-               // check if the group based on geometry
-               SMESH::SMESH_GroupOnGeom_var aGroupOnGeom = SMESH::SMESH_GroupOnGeom::_narrow(aGroup);
-               if ( !aGroupOnGeom->_is_nil() )
-                 {
-                   GEOM::GEOM_Object_var aGroupMainShape = aGroupOnGeom->GetShape();
-                   QString aShapeName = "<unknown>";
-                   SALOMEDS::SObject_var aGeomObj, aRef;
-                   if ( subObj->FindSubObject( 1, aGeomObj ) &&  aGeomObj->ReferencedObject( aRef ))
-                     aShapeName = aRef->GetName();
-                   anInfo.append(QString("based on <i>%1</i> geometry object<br><br>").arg(aShapeName));
-                 }
-               else
-                 anInfo.append(QString("<br>"));
-             }
-         }
+      if (anObj) {
+        _PTR(ChildIterator) it = aStudy->NewChildIterator(anObj);
+       if (!hasGroup && it->More()) {
+          anInfo.append(QString("Groups:<br><br>"));
+          hasGroup = true;
+        }
+       for (; it->More(); it->Next()) {
+          _PTR(SObject) subObj = it->Value();
+          CORBA::Object_var anObject = SMESH::SObjectToObject(subObj);
+         SMESH::SMESH_GroupBase_var aGroup = SMESH::SMESH_GroupBase::_narrow(anObject);
+         if (!aGroup->_is_nil()) {
+            anInfo.append(QString("-   <b>%1</b><br>").arg(aGroup->GetName()));
+            anInfo.append(QString("%1<br>").arg("on faces"));
+            anInfo.append(QString("%1<br>").arg(aGroup->Size()));
+            // check if the group based on geometry
+            SMESH::SMESH_GroupOnGeom_var aGroupOnGeom = SMESH::SMESH_GroupOnGeom::_narrow(aGroup);
+            if (!aGroupOnGeom->_is_nil()) {
+              GEOM::GEOM_Object_var aGroupMainShape = aGroupOnGeom->GetShape();
+              QString aShapeName = "<unknown>";
+              _PTR(SObject) aGeomObj, aRef;
+              if (subObj->FindSubObject(1, aGeomObj) && aGeomObj->ReferencedObject(aRef))
+                aShapeName = aRef->GetName().c_str();
+              anInfo.append(QString("based on <i>%1</i> geometry object<br><br>").arg(aShapeName));
+            } else {
+              anInfo.append(QString("<br>"));
+            }
+          }
        }
-      
+      }
+
       // info about groups on volumes
-      anObj = SALOMEDS::SObject::_nil();
-      aMeshSO->FindSubObject(Tag_VolumeGroups , anObj);
-      if ( !anObj->_is_nil() )
-       {
-         SALOMEDS::ChildIterator_var it = aStudy->NewChildIterator(anObj);
-         if (!hasGroup && it->More())
-           anInfo.append(QString("Groups:<br>"));
-         for(; it->More(); it->Next()){
-           SALOMEDS::SObject_var subObj = it->Value();
-           SMESH::SMESH_GroupBase_var aGroup = SMESH::SMESH_GroupBase::_narrow( subObj->GetObject() );
-           if ( !aGroup->_is_nil() )
-             {
-               anInfo.append(QString("-   <b>%1</b><br>").arg(aGroup->GetName()));
-               anInfo.append(QString("%1<br>").arg("on volumes"));
-               anInfo.append(QString("%1<br>").arg(aGroup->Size()));
-               // check if the group based on geometry
-               SMESH::SMESH_GroupOnGeom_var aGroupOnGeom = SMESH::SMESH_GroupOnGeom::_narrow(aGroup);
-               if ( !aGroupOnGeom->_is_nil() )
-                 {
-                   GEOM::GEOM_Object_var aGroupMainShape = aGroupOnGeom->GetShape();
-                   QString aShapeName = "<unknown>";
-                   SALOMEDS::SObject_var aGeomObj, aRef;
-                   if ( subObj->FindSubObject( 1, aGeomObj ) &&  aGeomObj->ReferencedObject( aRef ))
-                     aShapeName = aRef->GetName();
-                   anInfo.append(QString("based on <i>%1</i> geometry object<br><br>").arg(aShapeName));
-                 }
-               else
-                 anInfo.append(QString("<br>"));
-             }
-         }
+      anObj.reset();
+      aMeshSO->FindSubObject(Tag_VolumeGroups, anObj);
+      if (anObj) {
+        _PTR(ChildIterator) it = aStudy->NewChildIterator(anObj);
+       if (!hasGroup && it->More())
+          anInfo.append(QString("Groups:<br>"));
+       for (; it->More(); it->Next()) {
+          _PTR(SObject) subObj = it->Value();
+          CORBA::Object_var anObject = SMESH::SObjectToObject(subObj);
+         SMESH::SMESH_GroupBase_var aGroup = SMESH::SMESH_GroupBase::_narrow(anObject);
+         if (!aGroup->_is_nil()) {
+            anInfo.append(QString("-   <b>%1</b><br>").arg(aGroup->GetName()));
+            anInfo.append(QString("%1<br>").arg("on volumes"));
+            anInfo.append(QString("%1<br>").arg(aGroup->Size()));
+            // check if the group based on geometry
+            SMESH::SMESH_GroupOnGeom_var aGroupOnGeom = SMESH::SMESH_GroupOnGeom::_narrow(aGroup);
+            if (!aGroupOnGeom->_is_nil()) {
+              GEOM::GEOM_Object_var aGroupMainShape = aGroupOnGeom->GetShape();
+              QString aShapeName = "<unknown>";
+              _PTR(SObject) aGeomObj, aRef;
+              if (subObj->FindSubObject(1, aGeomObj) &&  aGeomObj->ReferencedObject(aRef))
+                aShapeName = aRef->GetName().c_str();
+              anInfo.append(QString("based on <i>%1</i> geometry object<br><br>").arg(aShapeName));
+            } else {
+              anInfo.append(QString("<br>"));
+            }
+          }
        }
-      
+      }
+
       myInfo->setText(anInfo);
       return;
     }
   }
-  
-  return;
 }
 
 //=================================================================================
@@ -383,46 +383,42 @@ void SMESHGUI_StandardMeshInfosDlg::DumpMeshInfos()
 //=================================================================================
 void SMESHGUI_StandardMeshInfosDlg::onSelectionChanged()
 {
-  if ( myStartSelection )
+  if (myStartSelection)
     DumpMeshInfos();
 }
 
-
 //=================================================================================
 // function : closeEvent()
 // purpose  :
 //=================================================================================
-void SMESHGUI_StandardMeshInfosDlg::closeEvent( QCloseEvent* e )
+void SMESHGUI_StandardMeshInfosDlg::closeEvent (QCloseEvent* e)
 {
-  mySelection->ClearFilters();
+  mySelectionMgr->clearFilters();
   SMESHGUI::GetSMESHGUI()->ResetState();
-  QDialog::closeEvent( e );
+  QDialog::closeEvent(e);
 }
 
-
 //=================================================================================
 // function : windowActivationChange()
 // purpose  : called when window is activated/deactivated
 //=================================================================================
-void SMESHGUI_StandardMeshInfosDlg::windowActivationChange( bool oldActive )
+void SMESHGUI_StandardMeshInfosDlg::windowActivationChange (bool oldActive)
 {
-  QDialog::windowActivationChange( oldActive );
-  if ( isActiveWindow() && myIsActiveWindow != isActiveWindow() )
-    ActivateThisDialog() ;
+  QDialog::windowActivationChange(oldActive);
+  if (isActiveWindow() && myIsActiveWindow != isActiveWindow())
+    ActivateThisDialog();
   myIsActiveWindow = isActiveWindow();
 }
 
-
 //=================================================================================
 // function : DeactivateActiveDialog()
 // purpose  :
 //=================================================================================
 void SMESHGUI_StandardMeshInfosDlg::DeactivateActiveDialog()
 {
-  disconnect( mySelection, 0, this, 0 );
+  disconnect(mySelectionMgr, 0, this, 0);
 }
 
-
 //=================================================================================
 // function : ActivateThisDialog()
 // purpose  :
@@ -430,8 +426,8 @@ void SMESHGUI_StandardMeshInfosDlg::DeactivateActiveDialog()
 void SMESHGUI_StandardMeshInfosDlg::ActivateThisDialog()
 {
   /* Emit a signal to deactivate any active dialog */
-  SMESHGUI::GetSMESHGUI()->EmitSignalDeactivateDialog() ;
-  connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( onSelectionChanged() ) );
+  SMESHGUI::GetSMESHGUI()->EmitSignalDeactivateDialog();
+  connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(onSelectionChanged()));
 }
 
 //=================================================================================
@@ -441,8 +437,8 @@ void SMESHGUI_StandardMeshInfosDlg::ActivateThisDialog()
 void SMESHGUI_StandardMeshInfosDlg::onStartSelection()
 {
   myStartSelection = true;
-  mySelection->AddFilter( myMeshFilter ) ;
-  myMeshLine->setText( tr( "Select a mesh" ) );
+  mySelectionMgr->installFilter(myMeshFilter);
+  myMeshLine->setText(tr("Select a mesh"));
   onSelectionChanged();
   myStartSelection = true;
 }
index 04abee92a9f051c0d6cd5232fd672ddb01e23ace..857be0d4d7eff497fda3be44461d7564b3e4990a 100644 (file)
@@ -29,7 +29,8 @@
 #ifndef SMESHGUI_STANDARDMESHINFOSDLG_H
 #define SMESHGUI_STANDARDMESHINFOSDLG_H
 
-#include "SMESH_TypeFilter.hxx"
+//#include "SMESH_TypeFilter.hxx"
+#include "SUIT_SelectionFilter.h"
 
 // QT Includes
 #include <qdialog.h>
@@ -39,7 +40,7 @@ class QLabel;
 class QPushButton;
 class QLineEdit;
 class QTextBrowser;
-class SALOME_Selection;
+class SalomeApp_SelectionMgr;
 
 class SMESHGUI_StandardMeshInfosDlg : public QDialog
 { 
@@ -61,11 +62,12 @@ private slots:
     void onStartSelection();
 
 private:
-    SALOME_Selection*     mySelection
-    bool                  myStartSelection;
-    bool                  myIsActiveWindow;
+    SalomeApp_SelectionMgr*  mySelectionMgr
+    bool                     myStartSelection;
+    bool                     myIsActiveWindow;
     
-    Handle(SMESH_TypeFilter)      myMeshFilter;
+    //Handle(SMESH_TypeFilter) myMeshFilter;
+    SUIT_SelectionFilter*    myMeshFilter;
 
     QLabel*       myNameLab;
     QPushButton*  mySelectBtn;
index b82c7b32a0ff30ae803bf6fd4d2faff6d23dfb51..6ed39d3c8ccfc70d3c9f1fd6a0c6d14bc9b0a499 100644 (file)
@@ -32,10 +32,14 @@ using namespace std;
 #include "Utils_ORB_INIT.hxx"
 #include "Utils_SINGLETON.hxx"
 
+#include <SMESHGUI.h>
+#include <SMESHGUI_GEOMGenUtils.h>
+
 // SALOME Includes
-#include "QAD_Application.h"
-#include "QAD_Desktop.h"
-#include "QAD_ResourceMgr.h"
+#include "SUIT_ResourceMgr.h"
+#include "SUIT_Session.h"
+
+#include "SalomeApp_Application.h"
 
 #include "utilities.h"
 
@@ -69,20 +73,22 @@ SMESH_Swig::SMESH_Swig()
 void SMESH_Swig::Init(int studyID)
 {
   MESSAGE("Init");
-  Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "SMESH");
-  SMESH::SMESH_Gen_var CompMesh = SMESH::SMESH_Gen::_narrow(comp);
-
-  Engines::Component_var comp1 = QAD_Application::getDesktop()->getEngine("FactoryServer", "GEOM");
-  GEOM::GEOM_Gen_var CompGeom = GEOM::GEOM_Gen::_narrow(comp1);
+  SMESH::SMESH_Gen_var CompMesh = SMESHGUI::GetSMESHGen();
+  GEOM::GEOM_Gen_var CompGeom = SMESH::GetGEOMGen();
 
-  QAD_ResourceMgr* resMgr = QAD_Desktop::createResourceManager();
+  SUIT_ResourceMgr* resMgr = SMESHGUI::resourceMgr();
   if ( resMgr ) {
-    QString msg;
+    resMgr->loadLanguage( QString::null, "en" );
+    /*QString msg;
     if (!resMgr->loadResources( "SMESH", msg ))
-      MESSAGE ( msg )
+      MESSAGE ( msg )*/
   }
 
-  CORBA::Object_var obj = QAD_Application::getDesktop()->getNameService()->Resolve("/myStudyManager");
+  SalomeApp_Application* app = dynamic_cast<SalomeApp_Application*>( SUIT_Session::session()->activeApplication() );
+  if( !app )
+    return;
+
+  CORBA::Object_var obj = app->namingService()->Resolve("/myStudyManager");
   SALOMEDS::StudyManager_var myStudyMgr = SALOMEDS::StudyManager::_narrow(obj);
   myStudy = myStudyMgr->GetStudyByID(studyID);
 
@@ -95,7 +101,7 @@ void SMESH_Swig::Init(int studyID)
 
   // See return value of SMESH::SMESH_Gen::ComponentDataType()
   SALOMEDS::SComponent_var father = myStudy->FindComponent("SMESH");
-  
+
   if (father->_is_nil()) {
     bool aLocked = myStudy->GetProperties()->IsLocked();
     if (aLocked) myStudy->GetProperties()->SetLocked(false);
@@ -103,7 +109,7 @@ void SMESH_Swig::Init(int studyID)
     anAttr = myStudyBuilder->FindOrCreateAttribute(father, "AttributeName");
     aName = SALOMEDS::AttributeName::_narrow(anAttr);
     //NRI    aName->SetValue(QObject::tr("SMESH_MEN_COMPONENT"));
-    aName->SetValue( QAD_Application::getDesktop()->getComponentUserName( "SMESH" ) );
+    aName->SetValue( SMESHGUI::GetSMESHGUI()->moduleName() );
     anAttr = myStudyBuilder->FindOrCreateAttribute(father, "AttributePixMap");
     aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr);
     aPixmap->SetPixMap( "ICON_OBJBROWSER_SMESH" );
index 1186ce9d4f8fede4585e1600da42fbfe07b02b83..a49f6cef94fd6af5b10ddc542e67333233795004 100644 (file)
@@ -1,48 +1,60 @@
 //  SMESH SMESHGUI : GUI for SMESH component
 //
 //  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
-// 
-//  This library is free software; you can redistribute it and/or 
-//  modify it under the terms of the GNU Lesser General Public 
-//  License as published by the Free Software Foundation; either 
-//  version 2.1 of the License. 
-// 
-//  This library is distributed in the hope that it will be useful, 
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of 
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
-//  Lesser General Public License for more details. 
-// 
-//  You should have received a copy of the GNU Lesser General Public 
-//  License along with this library; if not, write to the Free Software 
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
-// 
-//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
 //
 //
 //
 //  File   : SMESHGUI_SymmetryDlg.cxx
 //  Author : Michael ZORIN
 //  Module : SMESH
-//  $Header: 
+//  $Header:
 
 #include "SMESHGUI_SymmetryDlg.h"
 
 #include "SMESHGUI.h"
+#include "SMESHGUI_SpinBox.h"
 #include "SMESHGUI_Utils.h"
 #include "SMESHGUI_VTKUtils.h"
 #include "SMESHGUI_MeshUtils.h"
 #include "SMESHGUI_IdValidator.h"
-#include "SMESHGUI_SpinBox.h"
+
 #include "SMESH_Actor.h"
 #include "SMESH_TypeFilter.hxx"
+#include "SMESH_LogicalFilter.hxx"
 #include "SMDS_Mesh.hxx"
 
-#include "QAD_Application.h"
-#include "QAD_Desktop.h"
-#include "QAD_MessageBox.h"
+#include "SUIT_Desktop.h"
+#include "SUIT_ResourceMgr.h"
+
+#include "SVTK_ViewModel.h"
+#include "SVTK_ViewWindow.h"
+#include "SVTK_Selector.h"
+#include "SVTK_Selection.h"
+#include "SALOME_ListIO.hxx"
+
 #include "utilities.h"
 
+// OCCT Includes
+#include <TColStd_MapOfInteger.hxx>
+#include <TColStd_IndexedMapOfInteger.hxx>
+
 // QT Includes
 #include <qapplication.h>
 #include <qbuttongroup.h>
@@ -63,251 +75,256 @@ using namespace std;
 
 //=================================================================================
 // class    : SMESHGUI_SymmetryDlg()
-// purpose  : 
+// purpose  :
 //=================================================================================
-SMESHGUI_SymmetryDlg::SMESHGUI_SymmetryDlg( QWidget* parent, const char* name, SALOME_Selection* Sel,
-                                             bool modal, WFlags fl )
-  : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu |
-            Qt::WDestructiveClose)
+SMESHGUI_SymmetryDlg::SMESHGUI_SymmetryDlg( SMESHGUI* theModule, const char* name,
+                                            bool modal, WFlags fl)
+     : QDialog( SMESH::GetDesktop( theModule ), name, modal, WStyle_Customize | WStyle_NormalBorder |
+                WStyle_Title | WStyle_SysMenu | Qt::WDestructiveClose),
+      mySMESHGUI( theModule ),
+      mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ),
+      myViewWindow( SMESH::GetViewWindow( theModule ) ),
+      mySelector( myViewWindow->GetSelector() )
 {
-  QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "SMESH",tr("ICON_SMESH_SYMMETRY_POINT")));
-  QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "SMESH",tr("ICON_SMESH_SYMMETRY_AXIS")));
-  QPixmap image2(QAD_Desktop::getResourceManager()->loadPixmap( "SMESH",tr("ICON_SMESH_SYMMETRY_PLANE")));
-  QPixmap image3(QAD_Desktop::getResourceManager()->loadPixmap( "SMESH",tr("ICON_SELECT")));
-
-  if ( !name )
-    setName( "SMESHGUI_SymmetryDlg" );
-  resize( 303, 185 ); 
-  setCaption( tr( "SMESH_SYMMETRY" ) );
-  setSizeGripEnabled( TRUE );
-  SMESHGUI_SymmetryDlgLayout = new QGridLayout( this ); 
-  SMESHGUI_SymmetryDlgLayout->setSpacing( 6 );
-  SMESHGUI_SymmetryDlgLayout->setMargin( 11 );
+  QPixmap image0 (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_SMESH_SYMMETRY_POINT")));
+  QPixmap image1 (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_SMESH_SYMMETRY_AXIS")));
+  QPixmap image2 (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_SMESH_SYMMETRY_PLANE")));
+  QPixmap image3 (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_SELECT")));
+
+  if (!name)
+    setName("SMESHGUI_SymmetryDlg");
+  resize(303, 185);
+  setCaption(tr("SMESH_SYMMETRY"));
+  setSizeGripEnabled(TRUE);
+  SMESHGUI_SymmetryDlgLayout = new QGridLayout(this);
+  SMESHGUI_SymmetryDlgLayout->setSpacing(6);
+  SMESHGUI_SymmetryDlgLayout->setMargin(11);
 
   /***************************************************************/
-  GroupConstructors = new QButtonGroup( this, "GroupConstructors" );
-  GroupConstructors->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)0, 0, 0, GroupConstructors->sizePolicy().hasHeightForWidth() ) );
-  GroupConstructors->setTitle( tr( "SMESH_SYMMETRY"  ) );
-  GroupConstructors->setExclusive( TRUE );
-  GroupConstructors->setColumnLayout(0, Qt::Vertical );
-  GroupConstructors->layout()->setSpacing( 0 );
-  GroupConstructors->layout()->setMargin( 0 );
-  GroupConstructorsLayout = new QGridLayout( GroupConstructors->layout() );
-  GroupConstructorsLayout->setAlignment( Qt::AlignTop );
-  GroupConstructorsLayout->setSpacing( 6 );
-  GroupConstructorsLayout->setMargin( 11 );
-  QHBoxLayout* RBLayout = new QHBoxLayout( 0, 0, 6, "Layout2");
-  RadioButton1= new QRadioButton( GroupConstructors, "RadioButton1" );
-  RadioButton1->setText( tr( ""  ) );
-  RadioButton1->setPixmap( image0 );
-  RBLayout->addWidget( RadioButton1);
-  RadioButton2= new QRadioButton( GroupConstructors, "RadioButton2" );
-  RadioButton2->setText( tr( ""  ) );
-  RadioButton2->setPixmap( image1 );
-  RBLayout->addWidget( RadioButton2);
-  RadioButton3= new QRadioButton( GroupConstructors, "RadioButton3" );
-  RadioButton3->setText( tr( ""  ) );
-  RadioButton3->setPixmap( image2 );
-  RBLayout->addWidget( RadioButton3);
-  GroupConstructorsLayout->addLayout( RBLayout, 0, 0 );
-  SMESHGUI_SymmetryDlgLayout->addWidget( GroupConstructors, 0, 0 );
-  
+  GroupConstructors = new QButtonGroup(this, "GroupConstructors");
+  GroupConstructors->setSizePolicy(QSizePolicy((QSizePolicy::SizeType)5,
+                                               (QSizePolicy::SizeType)0, 0, 0,
+                                               GroupConstructors->sizePolicy().hasHeightForWidth()));
+  GroupConstructors->setTitle(tr("SMESH_SYMMETRY" ));
+  GroupConstructors->setExclusive(TRUE);
+  GroupConstructors->setColumnLayout(0, Qt::Vertical);
+  GroupConstructors->layout()->setSpacing(0);
+  GroupConstructors->layout()->setMargin(0);
+  GroupConstructorsLayout = new QGridLayout(GroupConstructors->layout());
+  GroupConstructorsLayout->setAlignment(Qt::AlignTop);
+  GroupConstructorsLayout->setSpacing(6);
+  GroupConstructorsLayout->setMargin(11);
+  QHBoxLayout* RBLayout = new QHBoxLayout(0, 0, 6, "Layout2");
+  RadioButton1= new QRadioButton(GroupConstructors, "RadioButton1");
+  RadioButton1->setText(tr("" ));
+  RadioButton1->setPixmap(image0);
+  RBLayout->addWidget(RadioButton1);
+  RadioButton2= new QRadioButton(GroupConstructors, "RadioButton2");
+  RadioButton2->setText(tr("" ));
+  RadioButton2->setPixmap(image1);
+  RBLayout->addWidget(RadioButton2);
+  RadioButton3= new QRadioButton(GroupConstructors, "RadioButton3");
+  RadioButton3->setText(tr("" ));
+  RadioButton3->setPixmap(image2);
+  RBLayout->addWidget(RadioButton3);
+  GroupConstructorsLayout->addLayout(RBLayout, 0, 0);
+  SMESHGUI_SymmetryDlgLayout->addWidget(GroupConstructors, 0, 0);
+
   /***************************************************************/
-  GroupButtons = new QGroupBox( this, "GroupButtons" );
-  GroupButtons->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, GroupButtons->sizePolicy().hasHeightForWidth() ) );
-  GroupButtons->setGeometry( QRect( 10, 10, 281, 48 ) ); 
-  GroupButtons->setTitle( tr( ""  ) );
-  GroupButtons->setColumnLayout(0, Qt::Vertical );
-  GroupButtons->layout()->setSpacing( 0 );
-  GroupButtons->layout()->setMargin( 0 );
-  GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
-  GroupButtonsLayout->setAlignment( Qt::AlignTop );
-  GroupButtonsLayout->setSpacing( 6 );
-  GroupButtonsLayout->setMargin( 11 );
-  buttonCancel = new QPushButton( GroupButtons, "buttonCancel" );
-  buttonCancel->setText( tr( "SMESH_BUT_CLOSE"  ) );
-  buttonCancel->setAutoDefault( TRUE );
-  GroupButtonsLayout->addWidget( buttonCancel, 0, 3 );
-  buttonApply = new QPushButton( GroupButtons, "buttonApply" );
-  buttonApply->setText( tr( "SMESH_BUT_APPLY"  ) );
-  buttonApply->setAutoDefault( TRUE );
-  GroupButtonsLayout->addWidget( buttonApply, 0, 1 );
-  QSpacerItem* spacer_9 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
-  GroupButtonsLayout->addItem( spacer_9, 0, 2 );
-  buttonOk = new QPushButton( GroupButtons, "buttonOk" );
-  buttonOk->setText( tr( "SMESH_BUT_OK"  ) );
-  buttonOk->setAutoDefault( TRUE );
-  buttonOk->setDefault( TRUE );
-  GroupButtonsLayout->addWidget( buttonOk, 0, 0 );
-  SMESHGUI_SymmetryDlgLayout->addWidget( GroupButtons, 2, 0 );
+  GroupButtons = new QGroupBox(this, "GroupButtons");
+  GroupButtons->setSizePolicy(QSizePolicy((QSizePolicy::SizeType)7,
+                                          (QSizePolicy::SizeType)0, 0, 0,
+                                          GroupButtons->sizePolicy().hasHeightForWidth()));
+  GroupButtons->setGeometry(QRect(10, 10, 281, 48));
+  GroupButtons->setTitle(tr("" ));
+  GroupButtons->setColumnLayout(0, Qt::Vertical);
+  GroupButtons->layout()->setSpacing(0);
+  GroupButtons->layout()->setMargin(0);
+  GroupButtonsLayout = new QGridLayout(GroupButtons->layout());
+  GroupButtonsLayout->setAlignment(Qt::AlignTop);
+  GroupButtonsLayout->setSpacing(6);
+  GroupButtonsLayout->setMargin(11);
+  buttonCancel = new QPushButton(GroupButtons, "buttonCancel");
+  buttonCancel->setText(tr("SMESH_BUT_CLOSE" ));
+  buttonCancel->setAutoDefault(TRUE);
+  GroupButtonsLayout->addWidget(buttonCancel, 0, 3);
+  buttonApply = new QPushButton(GroupButtons, "buttonApply");
+  buttonApply->setText(tr("SMESH_BUT_APPLY" ));
+  buttonApply->setAutoDefault(TRUE);
+  GroupButtonsLayout->addWidget(buttonApply, 0, 1);
+  QSpacerItem* spacer_9 = new QSpacerItem(20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
+  GroupButtonsLayout->addItem(spacer_9, 0, 2);
+  buttonOk = new QPushButton(GroupButtons, "buttonOk");
+  buttonOk->setText(tr("SMESH_BUT_OK" ));
+  buttonOk->setAutoDefault(TRUE);
+  buttonOk->setDefault(TRUE);
+  GroupButtonsLayout->addWidget(buttonOk, 0, 0);
+  SMESHGUI_SymmetryDlgLayout->addWidget(GroupButtons, 2, 0);
 
   /***************************************************************/
-  GroupArguments = new QGroupBox( this, "GroupArguments" );
-  GroupArguments->setTitle( tr( "SMESH_ARGUMENTS" ) );
-  GroupArguments->setColumnLayout(0, Qt::Vertical );
-  GroupArguments->layout()->setSpacing( 0 );
-  GroupArguments->layout()->setMargin( 0 );
-  GroupArgumentsLayout = new QGridLayout( GroupArguments->layout() );
-  GroupArgumentsLayout->setAlignment( Qt::AlignTop );
-  GroupArgumentsLayout->setSpacing( 6 );
-  GroupArgumentsLayout->setMargin( 11 );
+  GroupArguments = new QGroupBox(this, "GroupArguments");
+  GroupArguments->setTitle(tr("SMESH_ARGUMENTS"));
+  GroupArguments->setColumnLayout(0, Qt::Vertical);
+  GroupArguments->layout()->setSpacing(0);
+  GroupArguments->layout()->setMargin(0);
+  GroupArgumentsLayout = new QGridLayout(GroupArguments->layout());
+  GroupArgumentsLayout->setAlignment(Qt::AlignTop);
+  GroupArgumentsLayout->setSpacing(6);
+  GroupArgumentsLayout->setMargin(11);
 
   // Controls for elements selection
-  TextLabelElements  = new QLabel( GroupArguments, "TextLabelElements" );
-  TextLabelElements->setText( tr( "SMESH_ID_ELEMENTS"  ) );
+  TextLabelElements  = new QLabel(GroupArguments, "TextLabelElements");
+  TextLabelElements->setText(tr("SMESH_ID_ELEMENTS" ));
   TextLabelElements->setFixedWidth(74);
-  GroupArgumentsLayout->addWidget( TextLabelElements, 0, 0 );
-  
-  SelectElementsButton  = new QPushButton( GroupArguments, "SelectElementsButton" );
-  SelectElementsButton->setText( tr( ""  ) );
-  SelectElementsButton->setPixmap( image3 );
-  SelectElementsButton->setToggleButton( FALSE );
-  GroupArgumentsLayout->addWidget( SelectElementsButton, 0, 1 );
-
-  LineEditElements  = new QLineEdit( GroupArguments, "LineEditElements" );
-  LineEditElements->setValidator( new SMESHGUI_IdValidator( this, "validator" ));
-  GroupArgumentsLayout->addWidget( LineEditElements, 0, 2 );
+  GroupArgumentsLayout->addWidget(TextLabelElements, 0, 0);
+
+  SelectElementsButton  = new QPushButton(GroupArguments, "SelectElementsButton");
+  SelectElementsButton->setText(tr("" ));
+  SelectElementsButton->setPixmap(image3);
+  SelectElementsButton->setToggleButton(FALSE);
+  GroupArgumentsLayout->addWidget(SelectElementsButton, 0, 1);
+
+  LineEditElements  = new QLineEdit(GroupArguments, "LineEditElements");
+  LineEditElements->setValidator(new SMESHGUI_IdValidator(this, "validator"));
+  GroupArgumentsLayout->addWidget(LineEditElements, 0, 2);
 
   // Control for the whole mesh selection
-  CheckBoxMesh = new QCheckBox( GroupArguments, "CheckBoxMesh" );
-  CheckBoxMesh->setText( tr( "SMESH_SELECT_WHOLE_MESH"  ) );
-  GroupArgumentsLayout->addMultiCellWidget( CheckBoxMesh, 1, 1, 0, 2 );
-  
+  CheckBoxMesh = new QCheckBox(GroupArguments, "CheckBoxMesh");
+  CheckBoxMesh->setText(tr("SMESH_SELECT_WHOLE_MESH" ));
+  GroupArgumentsLayout->addMultiCellWidget(CheckBoxMesh, 1, 1, 0, 2);
+
   // Controls for mirror selection
-  GroupMirror = new QGroupBox( GroupArguments, "GroupMirror" );
-  GroupMirror->setColumnLayout(0, Qt::Vertical );
-  GroupMirror->layout()->setSpacing( 0 );
-  GroupMirror->layout()->setMargin( 0 );
-  QGridLayout* GroupMirrorLayout = new QGridLayout( GroupMirror->layout() );
-  GroupMirrorLayout->setAlignment( Qt::AlignTop );
-  GroupMirrorLayout->setSpacing( 6 );
-  GroupMirrorLayout->setMargin( 11 );
-  
-  TextLabelPoint = new QLabel( GroupMirror, "TextLabelPoint" );
-  TextLabelPoint->setText( tr( "SMESH_POINT" ) );
-  GroupMirrorLayout->addWidget( TextLabelPoint, 0, 0 );
-
-  SelectPointButton  = new QPushButton( GroupMirror, "SelectPointButton" );
-  SelectPointButton->setPixmap( image3 );
-  GroupMirrorLayout->addWidget( SelectPointButton, 0, 1 );
-  
-  TextLabelX = new QLabel( GroupMirror, "TextLabelX" );
-  TextLabelX->setText( tr( "SMESH_X" ) );
-  GroupMirrorLayout->addWidget( TextLabelX, 0, 2 );
-
-  SpinBox_X = new SMESHGUI_SpinBox( GroupMirror, "SpinBox_X");
-  GroupMirrorLayout->addWidget( SpinBox_X, 0, 3 );
-  
-  TextLabelY = new QLabel( GroupMirror, "TextLabelY" );
-  TextLabelY->setText( tr( "SMESH_Y" ) );
-  GroupMirrorLayout->addWidget( TextLabelY, 0, 4 );
-
-  SpinBox_Y = new SMESHGUI_SpinBox( GroupMirror, "SpinBox_Y");
-  GroupMirrorLayout->addWidget( SpinBox_Y, 0, 5 );
-
-  TextLabelZ = new QLabel( GroupMirror, "TextLabelZ" );
-  TextLabelZ->setText( tr( "SMESH_Z" ) );
-  GroupMirrorLayout->addWidget( TextLabelZ, 0, 6 );
-  
-  SpinBox_Z = new SMESHGUI_SpinBox( GroupMirror, "SpinBox_Z");
-  GroupMirrorLayout->addWidget( SpinBox_Z, 0, 7 );
-
-  TextLabelVector = new QLabel( GroupMirror, "TextLabelVector" );
-  GroupMirrorLayout->addWidget( TextLabelVector, 1, 0 );
-  
-  SelectVectorButton = new QPushButton( GroupMirror, "SelectVectorButton" );
-  SelectVectorButton->setPixmap( image3 );
-  GroupMirrorLayout->addWidget( SelectVectorButton, 1, 1 );
-  
-  TextLabelDX = new QLabel( GroupMirror, "TextLabelDX" );
-  TextLabelDX->setText( tr( "SMESH_DX" ) );
-  GroupMirrorLayout->addWidget( TextLabelDX, 1, 2 );
-
-  SpinBox_DX = new SMESHGUI_SpinBox( GroupMirror, "SpinBox_DX");
-  GroupMirrorLayout->addWidget( SpinBox_DX, 1, 3 );
-  
-  TextLabelDY = new QLabel( GroupMirror, "TextLabelDY" );
-  TextLabelDY->setText( tr( "SMESH_DY" ) );
-  GroupMirrorLayout->addWidget( TextLabelDY, 1, 4 );
-
-  SpinBox_DY = new SMESHGUI_SpinBox( GroupMirror, "SpinBox_DY");
-  GroupMirrorLayout->addWidget( SpinBox_DY, 1, 5 );
-
-  TextLabelDZ = new QLabel( GroupMirror, "TextLabelDZ" );
-  TextLabelDZ->setText( tr( "SMESH_DZ" ) );
-  GroupMirrorLayout->addWidget( TextLabelDZ, 1, 6 );
-  
-  SpinBox_DZ = new SMESHGUI_SpinBox( GroupMirror, "SpinBox_DZ");
-  GroupMirrorLayout->addWidget( SpinBox_DZ, 1, 7 );
-
-  GroupArgumentsLayout->addMultiCellWidget( GroupMirror, 2, 2, 0, 2 );
+  GroupMirror = new QGroupBox(GroupArguments, "GroupMirror");
+  GroupMirror->setColumnLayout(0, Qt::Vertical);
+  GroupMirror->layout()->setSpacing(0);
+  GroupMirror->layout()->setMargin(0);
+  QGridLayout* GroupMirrorLayout = new QGridLayout(GroupMirror->layout());
+  GroupMirrorLayout->setAlignment(Qt::AlignTop);
+  GroupMirrorLayout->setSpacing(6);
+  GroupMirrorLayout->setMargin(11);
+
+  TextLabelPoint = new QLabel(GroupMirror, "TextLabelPoint");
+  TextLabelPoint->setText(tr("SMESH_POINT"));
+  GroupMirrorLayout->addWidget(TextLabelPoint, 0, 0);
+
+  SelectPointButton  = new QPushButton(GroupMirror, "SelectPointButton");
+  SelectPointButton->setPixmap(image3);
+  GroupMirrorLayout->addWidget(SelectPointButton, 0, 1);
+
+  TextLabelX = new QLabel(GroupMirror, "TextLabelX");
+  TextLabelX->setText(tr("SMESH_X"));
+  GroupMirrorLayout->addWidget(TextLabelX, 0, 2);
+
+  SpinBox_X = new SMESHGUI_SpinBox(GroupMirror, "SpinBox_X");
+  GroupMirrorLayout->addWidget(SpinBox_X, 0, 3);
+
+  TextLabelY = new QLabel(GroupMirror, "TextLabelY");
+  TextLabelY->setText(tr("SMESH_Y"));
+  GroupMirrorLayout->addWidget(TextLabelY, 0, 4);
+
+  SpinBox_Y = new SMESHGUI_SpinBox(GroupMirror, "SpinBox_Y");
+  GroupMirrorLayout->addWidget(SpinBox_Y, 0, 5);
+
+  TextLabelZ = new QLabel(GroupMirror, "TextLabelZ");
+  TextLabelZ->setText(tr("SMESH_Z"));
+  GroupMirrorLayout->addWidget(TextLabelZ, 0, 6);
+
+  SpinBox_Z = new SMESHGUI_SpinBox(GroupMirror, "SpinBox_Z");
+  GroupMirrorLayout->addWidget(SpinBox_Z, 0, 7);
+
+  TextLabelVector = new QLabel(GroupMirror, "TextLabelVector");
+  GroupMirrorLayout->addWidget(TextLabelVector, 1, 0);
+
+  SelectVectorButton = new QPushButton(GroupMirror, "SelectVectorButton");
+  SelectVectorButton->setPixmap(image3);
+  GroupMirrorLayout->addWidget(SelectVectorButton, 1, 1);
+
+  TextLabelDX = new QLabel(GroupMirror, "TextLabelDX");
+  TextLabelDX->setText(tr("SMESH_DX"));
+  GroupMirrorLayout->addWidget(TextLabelDX, 1, 2);
+
+  SpinBox_DX = new SMESHGUI_SpinBox(GroupMirror, "SpinBox_DX");
+  GroupMirrorLayout->addWidget(SpinBox_DX, 1, 3);
+
+  TextLabelDY = new QLabel(GroupMirror, "TextLabelDY");
+  TextLabelDY->setText(tr("SMESH_DY"));
+  GroupMirrorLayout->addWidget(TextLabelDY, 1, 4);
+
+  SpinBox_DY = new SMESHGUI_SpinBox(GroupMirror, "SpinBox_DY");
+  GroupMirrorLayout->addWidget(SpinBox_DY, 1, 5);
+
+  TextLabelDZ = new QLabel(GroupMirror, "TextLabelDZ");
+  TextLabelDZ->setText(tr("SMESH_DZ"));
+  GroupMirrorLayout->addWidget(TextLabelDZ, 1, 6);
+
+  SpinBox_DZ = new SMESHGUI_SpinBox(GroupMirror, "SpinBox_DZ");
+  GroupMirrorLayout->addWidget(SpinBox_DZ, 1, 7);
+
+  GroupArgumentsLayout->addMultiCellWidget(GroupMirror, 2, 2, 0, 2);
+
   // Controls for "Create a copy" option
-  CheckBoxCopy = new QCheckBox( GroupArguments, "CheckBoxCopy" );
-  CheckBoxCopy->setText( tr( "SMESH_CREATE_COPY" ) );
-  GroupArgumentsLayout->addMultiCellWidget( CheckBoxCopy, 3, 3, 0, 2 );
-  
+  CheckBoxCopy = new QCheckBox(GroupArguments, "CheckBoxCopy");
+  CheckBoxCopy->setText(tr("SMESH_CREATE_COPY"));
+  GroupArgumentsLayout->addMultiCellWidget(CheckBoxCopy, 3, 3, 0, 2);
+
+
+  SMESHGUI_SymmetryDlgLayout->addWidget(GroupArguments, 1, 0);
 
-  SMESHGUI_SymmetryDlgLayout->addWidget( GroupArguments, 1, 0 );
-  
   /* Initialisations */
-  SpinBox_X->RangeStepAndValidator( -999999.999, +999999.999, 10.0, 3 );
-  SpinBox_Y->RangeStepAndValidator( -999999.999, +999999.999, 10.0, 3 );
-  SpinBox_Z->RangeStepAndValidator( -999999.999, +999999.999, 10.0, 3 );
-  SpinBox_DX->RangeStepAndValidator( -999999.999, +999999.999, 10.0, 3 );
-  SpinBox_DY->RangeStepAndValidator( -999999.999, +999999.999, 10.0, 3 );
-  SpinBox_DZ->RangeStepAndValidator( -999999.999, +999999.999, 10.0, 3 );
+  SpinBox_X->RangeStepAndValidator(-999999.999, +999999.999, 10.0, 3);
+  SpinBox_Y->RangeStepAndValidator(-999999.999, +999999.999, 10.0, 3);
+  SpinBox_Z->RangeStepAndValidator(-999999.999, +999999.999, 10.0, 3);
+  SpinBox_DX->RangeStepAndValidator(-999999.999, +999999.999, 10.0, 3);
+  SpinBox_DY->RangeStepAndValidator(-999999.999, +999999.999, 10.0, 3);
+  SpinBox_DZ->RangeStepAndValidator(-999999.999, +999999.999, 10.0, 3);
 
   GroupArguments->show();
-  RadioButton1->setChecked( TRUE );
-  mySelection = Sel;  
-  
-  mySMESHGUI  = SMESHGUI::GetSMESHGUI() ;
-  mySMESHGUI->SetActiveDialogBox( (QDialog*)this ) ;
-  
+  RadioButton1->setChecked(TRUE);
+
+  mySMESHGUI->SetActiveDialogBox((QDialog*)this);
+
   // Costruction of the logical filter
-  SMESH_ListOfFilter aListOfFilters;
-  Handle(SMESH_TypeFilter) aMeshOrSubMeshFilter = new SMESH_TypeFilter( MESHorSUBMESH );
-  if ( !aMeshOrSubMeshFilter.IsNull() )
-    aListOfFilters.Append( aMeshOrSubMeshFilter );
-  Handle(SMESH_TypeFilter) aSmeshGroupFilter = new SMESH_TypeFilter( GROUP );
-  if ( !aSmeshGroupFilter.IsNull() )
-    aListOfFilters.Append( aSmeshGroupFilter );
-  
-  myMeshOrSubMeshOrGroupFilter = new SMESH_LogicalFilter( aListOfFilters, SMESH_LogicalFilter::LO_OR );
-    
+  SMESH_TypeFilter* aMeshOrSubMeshFilter = new SMESH_TypeFilter (MESHorSUBMESH);
+  SMESH_TypeFilter* aSmeshGroupFilter    = new SMESH_TypeFilter (GROUP);
+
+  QPtrList<SUIT_SelectionFilter> aListOfFilters;
+  if (aMeshOrSubMeshFilter) aListOfFilters.append(aMeshOrSubMeshFilter);
+  if (aSmeshGroupFilter)    aListOfFilters.append(aSmeshGroupFilter);
+
+  myMeshOrSubMeshOrGroupFilter =
+    new SMESH_LogicalFilter (aListOfFilters, SMESH_LogicalFilter::LO_OR);
+
   Init();
+
   /* signals and slots connections */
-  connect( buttonOk, SIGNAL( clicked() ),     this, SLOT( ClickOnOk() ) );
-  connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ) ;
-  connect( buttonApply, SIGNAL( clicked() ), this, SLOT(ClickOnApply() ) );
-  connect( GroupConstructors, SIGNAL(clicked(int) ), SLOT( ConstructorsClicked(int) ) );
-  
-  connect( SelectElementsButton, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ;
-  connect( SelectPointButton, SIGNAL (clicked() ),    this, SLOT( SetEditCurrentArgument() ) ) ;
-  connect( SelectVectorButton, SIGNAL (clicked() ),   this, SLOT( SetEditCurrentArgument() ) ) ;
-  
-  connect( SpinBox_DX, SIGNAL( valueChanged( double )), this, SLOT(onVectorChanged() ) );
-  connect( SpinBox_DY, SIGNAL( valueChanged( double )), this, SLOT(onVectorChanged() ) );
-  connect( SpinBox_DZ, SIGNAL( valueChanged( double )), this, SLOT(onVectorChanged() ) );
-  connect( mySMESHGUI, SIGNAL ( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ;
-  connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
+  connect(buttonOk, SIGNAL(clicked()),     this, SLOT(ClickOnOk()));
+  connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel()));
+  connect(buttonApply, SIGNAL(clicked()),  this, SLOT(ClickOnApply()));
+  connect(GroupConstructors, SIGNAL(clicked(int)), SLOT(ConstructorsClicked(int)));
+
+  connect(SelectElementsButton, SIGNAL (clicked()), this, SLOT(SetEditCurrentArgument()));
+  connect(SelectPointButton, SIGNAL (clicked()),    this, SLOT(SetEditCurrentArgument()));
+  connect(SelectVectorButton, SIGNAL (clicked()),   this, SLOT(SetEditCurrentArgument()));
+
+  connect(SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(onVectorChanged()));
+  connect(SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(onVectorChanged()));
+  connect(SpinBox_DZ, SIGNAL(valueChanged(double)), this, SLOT(onVectorChanged()));
+
+  connect(mySMESHGUI,     SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog()));
+  connect(mySelectionMgr, SIGNAL(currentSelectionChanged()),      this, SLOT(SelectionIntoArgument()));
   /* to close dialog if study change */
-  connect( mySMESHGUI, SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ) ;
-  connect( LineEditElements, SIGNAL( textChanged( const QString& )),
-           SLOT( onTextChange( const QString& )));
-  connect( CheckBoxMesh, SIGNAL( toggled( bool )),
-           SLOT( onSelectMesh( bool )));
-  
+  connect(mySMESHGUI,       SIGNAL(SignalCloseAllDialogs()), this, SLOT(ClickOnCancel()));
+  connect(LineEditElements, SIGNAL(textChanged(const QString&)),   SLOT(onTextChange(const QString&)));
+  connect(CheckBoxMesh,     SIGNAL(toggled(bool)),                 SLOT(onSelectMesh(bool)));
+
   /* Move widget on the botton right corner of main widget */
-  int x, y ;
-  mySMESHGUI->DefineDlgPosition( this, x, y ) ;
-  this->move( x, y ) ;
-  this->show() ; /* displays Dialog */
+  int x, y;
+  mySMESHGUI->DefineDlgPosition(this, x, y);
+  this->move(x, y);
+  this->show(); /* displays Dialog */
 
   ConstructorsClicked(0);
-  resize(0,0);
+  resize(0,0); // ??
 }
 
 //=================================================================================
@@ -319,108 +336,101 @@ SMESHGUI_SymmetryDlg::~SMESHGUI_SymmetryDlg()
   // no need to delete child widgets, Qt does it all for us
 }
 
-
 //=================================================================================
 // function : Init()
 // purpose  :
 //=================================================================================
-void SMESHGUI_SymmetryDlg::Init( bool ResetControls )
+void SMESHGUI_SymmetryDlg::Init (bool ResetControls)
 {
   myBusy = false;
-  
+
   myEditCurrentArgument = 0;
   LineEditElements->clear();
   myElementsId = "";
-  myNbOkElements = 0 ;
-  
-  buttonOk->setEnabled( false );
-  buttonApply->setEnabled( false );
-  
-  myActor     = 0;
+  myNbOkElements = 0;
+
+  buttonOk->setEnabled(false);
+  buttonApply->setEnabled(false);
+
+  myActor = 0;
   myMesh = SMESH::SMESH_Mesh::_nil();
 
-  if( ResetControls )
-    {
-      SpinBox_X->SetValue(0.0);
-      SpinBox_Y->SetValue(0.0);
-      SpinBox_Z->SetValue(0.0);
-      SpinBox_DX->SetValue(0.0);
-      SpinBox_DY->SetValue(0.0);
-      SpinBox_DZ->SetValue(0.0);
-      
-      CheckBoxCopy->setChecked(false);
-      CheckBoxMesh->setChecked(false);
-      onSelectMesh( false );
-    }
+  if (ResetControls) {
+    SpinBox_X->SetValue(0.0);
+    SpinBox_Y->SetValue(0.0);
+    SpinBox_Z->SetValue(0.0);
+    SpinBox_DX->SetValue(0.0);
+    SpinBox_DY->SetValue(0.0);
+    SpinBox_DZ->SetValue(0.0);
+
+    CheckBoxCopy->setChecked(false);
+    CheckBoxMesh->setChecked(false);
+    onSelectMesh(false);
+  }
 }
 
-
 //=================================================================================
 // function : ConstructorsClicked()
 // purpose  : Radio button management
 //=================================================================================
-void SMESHGUI_SymmetryDlg::ConstructorsClicked(int constructorId)
+void SMESHGUI_SymmetryDlg::ConstructorsClicked (int constructorId)
 {
-  disconnect(mySelection, 0, this, 0);
-  
-  if (constructorId!=0 && !TextLabelVector->isVisible())
+  disconnect(mySelectionMgr, 0, this, 0);
+
+  if (constructorId != 0 && !TextLabelVector->isVisible()) {
+    TextLabelVector->show();
+    SelectVectorButton->show();
+    TextLabelDX->show();
+    SpinBox_DX->show();
+    TextLabelDY->show();
+    SpinBox_DY->show();
+    TextLabelDZ->show();
+    SpinBox_DZ->show();
+  }
+
+  switch (constructorId) {
+  case 0:
     {
-      TextLabelVector->show();
-      SelectVectorButton->show();
-      TextLabelDX->show();
-      SpinBox_DX->show();
-      TextLabelDY->show();
-      SpinBox_DY->show();
-      TextLabelDZ->show();
-      SpinBox_DZ->show();
+      GroupMirror->setTitle(tr("SMESH_POINT"));
+
+      TextLabelVector->hide();
+      SelectVectorButton->hide();
+      TextLabelDX->hide();
+      SpinBox_DX->hide();
+      TextLabelDY->hide();
+      SpinBox_DY->hide();
+      TextLabelDZ->hide();
+      SpinBox_DZ->hide();
+      break;
     }
-
-  switch(constructorId)
+  case 1:
     {
-    case 0 :
-      { 
-       GroupMirror->setTitle( tr( "SMESH_POINT" ) );
-       
-       TextLabelVector->hide();
-       SelectVectorButton->hide();
-       TextLabelDX->hide();
-       SpinBox_DX->hide();
-       TextLabelDY->hide();
-       SpinBox_DY->hide();
-       TextLabelDZ->hide();
-       SpinBox_DZ->hide();
-       break;
-      }
-    case 1 :
-      {
-       GroupMirror->setTitle( tr( "SMESH_AXIS" ) );
-       TextLabelVector->setText( tr( "SMESH_VECTOR" ) );
-       break;
-      }
-    case 2 :
-      {
-       GroupMirror->setTitle( tr( "SMESH_PLANE" ) );
-       TextLabelVector->setText( tr( "SMESH_NORMAL" ) );
-       break;
-      }
+      GroupMirror->setTitle(tr("SMESH_AXIS"));
+      TextLabelVector->setText(tr("SMESH_VECTOR"));
+      break;
     }
-  
-  if (myEditCurrentArgument != (QWidget*)LineEditElements)
+  case 2:
     {
-      SMESH::SetPointRepresentation(false);
-      if (!CheckBoxMesh->isChecked())
-       QAD_Application::getDesktop()->SetSelectionMode( CellSelection, true );
+      GroupMirror->setTitle(tr("SMESH_PLANE"));
+      TextLabelVector->setText(tr("SMESH_NORMAL"));
+      break;
     }
-  
+  }
+
+  if (myEditCurrentArgument != (QWidget*)LineEditElements) {
+    SMESH::SetPointRepresentation(false);
+    if (!CheckBoxMesh->isChecked())
+      myViewWindow->SetSelectionMode(CellSelection);
+  }
+
   myEditCurrentArgument = (QWidget*)LineEditElements;
   LineEditElements->setFocus();
 
   if (CheckBoxMesh->isChecked())
     onSelectMesh(true);
-  
-  connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
-}
 
+  connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
+}
 
 //=================================================================================
 // function : ClickOnApply()
@@ -428,60 +438,55 @@ void SMESHGUI_SymmetryDlg::ConstructorsClicked(int constructorId)
 //=================================================================================
 void SMESHGUI_SymmetryDlg::ClickOnApply()
 {
-  if (mySMESHGUI->ActiveStudyLocked())
+  if (mySMESHGUI->isActiveStudyLocked())
     return;
-  
-  if ( myNbOkElements  && IsMirrorOk() )
-    {
-      QStringList aListElementsId = QStringList::split( " ", myElementsId, false);
-      
-      SMESH::long_array_var anElementsId = new SMESH::long_array;
-      
-      anElementsId->length( aListElementsId.count() );
-      for ( int i = 0; i < aListElementsId.count(); i++ )
-       anElementsId[i] = aListElementsId[i].toInt();
-      
-      SMESH::AxisStruct aMirror;
-      
-      aMirror.x =  SpinBox_X->GetValue();
-      aMirror.y =  SpinBox_Y->GetValue();
-      aMirror.z =  SpinBox_Z->GetValue();
-      if (GetConstructorId() == 0)
-       aMirror.vx = aMirror.vy = aMirror.vz = 0;
-      else
-       {
-         aMirror.vx = SpinBox_DX->GetValue();
-         aMirror.vy = SpinBox_DY->GetValue();
-         aMirror.vz = SpinBox_DZ->GetValue();
-       }
-      
-      bool toCreateCopy = CheckBoxCopy->isChecked();
-
-      SMESH::SMESH_MeshEditor::MirrorType aMirrorType;
-
-      if (GetConstructorId() == 0)
-       aMirrorType = SMESH::SMESH_MeshEditor::POINT;
-      if (GetConstructorId() == 1)
-       aMirrorType = SMESH::SMESH_MeshEditor::AXIS;
-      if (GetConstructorId() == 2)
-       aMirrorType = SMESH::SMESH_MeshEditor::PLANE;
-
-      try
-       {
-         SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
-         QApplication::setOverrideCursor(Qt::waitCursor);
-         aMeshEditor->Mirror(anElementsId, aMirror, aMirrorType, toCreateCopy);
-         QApplication::restoreOverrideCursor();
-       }
-      catch( ... )
-       {
-       }
-      
-      mySelection->ClearIObjects();
-      SMESH::UpdateView();
-      Init( false );
-      ConstructorsClicked( GetConstructorId() );
+
+  if (myNbOkElements && IsMirrorOk()) {
+    QStringList aListElementsId = QStringList::split(" ", myElementsId, false);
+
+    SMESH::long_array_var anElementsId = new SMESH::long_array;
+
+    anElementsId->length(aListElementsId.count());
+    for (int i = 0; i < aListElementsId.count(); i++)
+      anElementsId[i] = aListElementsId[i].toInt();
+
+    SMESH::AxisStruct aMirror;
+
+    aMirror.x =  SpinBox_X->GetValue();
+    aMirror.y =  SpinBox_Y->GetValue();
+    aMirror.z =  SpinBox_Z->GetValue();
+    if (GetConstructorId() == 0) {
+      aMirror.vx = aMirror.vy = aMirror.vz = 0;
+    } else {
+      aMirror.vx = SpinBox_DX->GetValue();
+      aMirror.vy = SpinBox_DY->GetValue();
+      aMirror.vz = SpinBox_DZ->GetValue();
+    }
+
+    bool toCreateCopy = CheckBoxCopy->isChecked();
+
+    SMESH::SMESH_MeshEditor::MirrorType aMirrorType;
+
+    if (GetConstructorId() == 0)
+      aMirrorType = SMESH::SMESH_MeshEditor::POINT;
+    if (GetConstructorId() == 1)
+      aMirrorType = SMESH::SMESH_MeshEditor::AXIS;
+    if (GetConstructorId() == 2)
+      aMirrorType = SMESH::SMESH_MeshEditor::PLANE;
+
+    try {
+      SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
+      QApplication::setOverrideCursor(Qt::waitCursor);
+      aMeshEditor->Mirror(anElementsId, aMirror, aMirrorType, toCreateCopy);
+      QApplication::restoreOverrideCursor();
+    } catch (...) {
     }
+
+    mySelectionMgr->clearSelected();
+    SMESH::UpdateView();
+    Init(false);
+    ConstructorsClicked(GetConstructorId());
+  }
 }
 
 //=================================================================================
@@ -490,74 +495,87 @@ void SMESHGUI_SymmetryDlg::ClickOnApply()
 //=================================================================================
 void SMESHGUI_SymmetryDlg::ClickOnOk()
 {
-  ClickOnApply() ;
-  ClickOnCancel() ;
+  ClickOnApply();
+  ClickOnCancel();
 }
 
-       
 //=================================================================================
 // function : ClickOnCancel()
 // purpose  :
 //=================================================================================
 void SMESHGUI_SymmetryDlg::ClickOnCancel()
 {
-  mySelection->ClearFilters();
-  mySelection->ClearIObjects();
+  disconnect(mySelectionMgr, 0, this, 0);
+  mySelectionMgr->clearFilters();
+  mySelectionMgr->clearSelected();
   SMESH::SetPointRepresentation(false);
-  QAD_Application::getDesktop()->SetSelectionMode( ActorSelection );
-  disconnect( mySelection, 0, this, 0 );
-  mySMESHGUI->ResetState() ;
-  reject() ;
+  myViewWindow->SetSelectionMode(ActorSelection);
+  mySMESHGUI->ResetState();
+  reject();
 }
 
 //=======================================================================
-//function : onTextChange
-//purpose  : 
+// function : onTextChange()
+// purpose  :
 //=======================================================================
-
-void SMESHGUI_SymmetryDlg::onTextChange(const QString& theNewText)
+void SMESHGUI_SymmetryDlg::onTextChange (const QString& theNewText)
 {
   QLineEdit* send = (QLineEdit*)sender();
 
-  if ( myBusy ) return;
+  if (myBusy) return;
   myBusy = true;
-  
+
   if (send == LineEditElements)
     myNbOkElements = 0;
-  
-  buttonOk->setEnabled( false );
-  buttonApply->setEnabled( false );
-  
+
+  buttonOk->setEnabled(false);
+  buttonApply->setEnabled(false);
+
   // hilight entered elements
   SMDS_Mesh* aMesh = 0;
-  if ( myActor )
+  if (myActor)
     aMesh = myActor->GetObject()->GetMesh();
-  
-  if ( aMesh ) {
-    
-    mySelection->ClearIObjects();
-    mySelection->AddIObject( myActor->getIO() );
-    
-    QStringList aListId = QStringList::split( " ", theNewText, false);
-    
+
+  if (aMesh) {
+    //mySelectionMgr->clearSelected();
+    //mySelectionMgr->AddIObject(myActor->getIO());
+    SALOME_ListIO aList;
+    aList.Append(myActor->getIO());
+    mySelectionMgr->setSelectedObjects(aList, false);
+
+    TColStd_IndexedMapOfInteger selectedIndices;
+    TColStd_MapOfInteger newIndices;
+    mySelector->GetIndex(myActor->getIO(), selectedIndices);
+
+    QStringList aListId = QStringList::split(" ", theNewText, false);
+
     if (send == LineEditElements) {
-      for ( int i = 0; i < aListId.count(); i++ ) {
-       const SMDS_MeshElement * e = aMesh->FindElement( aListId[ i ].toInt() );
-       if ( e ) {
-         if ( !mySelection->IsIndexSelected( myActor->getIO(), e->GetID() ))
-           mySelection->AddOrRemoveIndex (myActor->getIO(), e->GetID(), true);
+      for (int i = 0; i < aListId.count(); i++) {
+       const SMDS_MeshElement * e = aMesh->FindElement(aListId[ i ].toInt());
+       if (e) {
+         //if (!mySelectionMgr->IsIndexSelected(myActor->getIO(), e->GetID())) {
+          if (selectedIndices.Add(e->GetID())) {
+           //mySelectionMgr->AddOrRemoveIndex (myActor->getIO(), e->GetID(), true);
+            newIndices.Add(e->GetID());
+          }
          myNbOkElements++;
        }
       }
+
+      if (newIndices.Extent() > 0){
+       mySelector->AddOrRemoveIndex( myActor->getIO(), newIndices, true );
+       myViewWindow->highlight( myActor->getIO(), true, true );
+      }
+
       myElementsId = theNewText;
     }
   }
-  
-  if ( myNbOkElements &&  IsMirrorOk() ) {
-    buttonOk->setEnabled( true );
-    buttonApply->setEnabled( true );
+
+  if (myNbOkElements &&  IsMirrorOk()) {
+    buttonOk->setEnabled(true);
+    buttonApply->setEnabled(true);
   }
-  
+
   myBusy = false;
 }
 
@@ -567,33 +585,34 @@ void SMESHGUI_SymmetryDlg::onTextChange(const QString& theNewText)
 //=================================================================================
 void SMESHGUI_SymmetryDlg::SelectionIntoArgument()
 {
-  if ( myBusy ) return;
-  
+  if (myBusy) return;
+
   // clear
-  
   myActor = 0;
   QString aString = "";
 
   myBusy = true;
-  if (myEditCurrentArgument == (QWidget*)LineEditElements)
-    {
-      LineEditElements->setText( aString );
-      myNbOkElements = 0;
-      buttonOk->setEnabled( false );
-      buttonApply->setEnabled( false );
-    }
+  if (myEditCurrentArgument == (QWidget*)LineEditElements) {
+    LineEditElements->setText(aString);
+    myNbOkElements = 0;
+    buttonOk->setEnabled(false);
+    buttonApply->setEnabled(false);
+  }
   myBusy = false;
-  
-  if ( !GroupButtons->isEnabled() ) // inactive
+
+  if (!GroupButtons->isEnabled()) // inactive
     return;
-  
+
   // get selected mesh
-  int nbSel = mySelection->IObjectCount();
-  if(nbSel != 1)
+  SALOME_ListIO aList;
+  mySelectionMgr->selectedObjects(aList,SVTK_Viewer::Type());
+
+  int nbSel = aList.Extent();
+  if (nbSel != 1)
     return;
-  
-  Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject();
-  myMesh = SMESH::GetMeshByIO( mySelection->firstIObject() );
+
+  Handle(SALOME_InteractiveObject) IO = aList.First();
+  myMesh = SMESH::GetMeshByIO(IO);
   if(myMesh->_is_nil())
     return;
 
@@ -602,118 +621,103 @@ void SMESHGUI_SymmetryDlg::SelectionIntoArgument()
     myActor = SMESH::FindActorByEntry(IO->getEntry());
   if (!myActor)
     return;
-  
+
   int aNbUnits = 0;
 
-  if (myEditCurrentArgument == (QWidget*)LineEditElements)
-    {
-      myElementsId = "";
-      
-      if (CheckBoxMesh->isChecked())
-       {
-         SMESH::GetNameOfSelectedIObjects(mySelection, aString);
-         
-         if(!SMESH::IObjectToInterface<SMESH::SMESH_Mesh>(IO)->_is_nil()) //MESH
-           {
-             // get IDs from mesh
-             SMDS_Mesh* aSMDSMesh = myActor->GetObject()->GetMesh();
-             if (!aSMDSMesh)
-               return;
-             
-             for (int i = aSMDSMesh->MinElementID(); i <= aSMDSMesh->MaxElementID(); i++  )
-               {
-                 const SMDS_MeshElement * e = aSMDSMesh->FindElement( i );
-                 if ( e ) {
-                   myElementsId += QString(" %1").arg(i);
-                   aNbUnits++;
-                 }
-               }
-           }
-         else if (!SMESH::IObjectToInterface<SMESH::SMESH_subMesh>(IO)->_is_nil()) //SUBMESH
-           {
-             // get submesh
-             SMESH::SMESH_subMesh_var aSubMesh = SMESH::IObjectToInterface<SMESH::SMESH_subMesh>(IO) ;
-             
-             // get IDs from submesh
-             SMESH::long_array_var anElementsIds = new SMESH::long_array;
-             anElementsIds = aSubMesh->GetElementsId();
-             for ( int i = 0; i < anElementsIds->length(); i++ )
-               myElementsId += QString(" %1").arg(anElementsIds[i]);
-             aNbUnits = anElementsIds->length();
-           }
-         else // GROUP
-           {
-             // get smesh group
-             SMESH::SMESH_GroupBase_var aGroup
-                = SMESH::IObjectToInterface<SMESH::SMESH_GroupBase>(IO);
-             if (aGroup->_is_nil())
-               return;
-             
-             // get IDs from smesh group
-             SMESH::long_array_var anElementsIds = new SMESH::long_array;
-             anElementsIds = aGroup->GetListOfID();
-             for ( int i = 0; i < anElementsIds->length(); i++ )
-               myElementsId += QString(" %1").arg(anElementsIds[i]);
-             aNbUnits = anElementsIds->length();
-           }
-       }
-      else
-       {
-         aNbUnits = SMESH::GetNameOfSelectedElements(mySelection, aString) ;
-         myElementsId = aString;
-       }
-      
-      if(aNbUnits < 1)
-       return ;
-      
-      myNbOkElements = true;
+  if (myEditCurrentArgument == (QWidget*)LineEditElements) {
+    myElementsId = "";
+
+    if (CheckBoxMesh->isChecked()) {
+      SMESH::GetNameOfSelectedIObjects(mySelectionMgr, aString);
+
+      if (!SMESH::IObjectToInterface<SMESH::SMESH_Mesh>(IO)->_is_nil()) { //MESH
+        // get IDs from mesh
+        SMDS_Mesh* aSMDSMesh = myActor->GetObject()->GetMesh();
+        if (!aSMDSMesh)
+          return;
+
+        for (int i = aSMDSMesh->MinElementID(); i <= aSMDSMesh->MaxElementID(); i++) {
+          const SMDS_MeshElement * e = aSMDSMesh->FindElement(i);
+          if (e) {
+            myElementsId += QString(" %1").arg(i);
+            aNbUnits++;
+          }
+        }
+      } else if (!SMESH::IObjectToInterface<SMESH::SMESH_subMesh>(IO)->_is_nil()) { //SUBMESH
+        // get submesh
+        SMESH::SMESH_subMesh_var aSubMesh = SMESH::IObjectToInterface<SMESH::SMESH_subMesh>(IO);
+
+        // get IDs from submesh
+        SMESH::long_array_var anElementsIds = new SMESH::long_array;
+        anElementsIds = aSubMesh->GetElementsId();
+        for (int i = 0; i < anElementsIds->length(); i++) {
+          myElementsId += QString(" %1").arg(anElementsIds[i]);
+        }
+        aNbUnits = anElementsIds->length();
+      } else { // GROUP
+        // get smesh group
+        SMESH::SMESH_GroupBase_var aGroup =
+          SMESH::IObjectToInterface<SMESH::SMESH_GroupBase>(IO);
+        if (aGroup->_is_nil())
+          return;
+
+        // get IDs from smesh group
+        SMESH::long_array_var anElementsIds = new SMESH::long_array;
+        anElementsIds = aGroup->GetListOfID();
+        for (int i = 0; i < anElementsIds->length(); i++) {
+          myElementsId += QString(" %1").arg(anElementsIds[i]);
+        }
+        aNbUnits = anElementsIds->length();
+      }
+    } else {
+      aNbUnits = SMESH::GetNameOfSelectedElements( mySelector, myActor->getIO(), aString);
+      myElementsId = aString;
     }
-  else
-    {
-      aNbUnits = SMESH::GetNameOfSelectedNodes(mySelection, aString);
-      if(aNbUnits != 1)
-       return;
-      
-      SMDS_Mesh* aMesh =  myActor->GetObject()->GetMesh();
-      if (!aMesh)
-       return;
-      
-      const SMDS_MeshNode * n = aMesh->FindNode( aString.toInt() );
-      if ( !n )
-       return;
-      
-      double x = n->X();
-      double y = n->Y();
-      double z = n->Z();
-      
-      if (myEditCurrentArgument == (QWidget*)SpinBox_X)
-       {
-         SpinBox_X->SetValue(x);
-         SpinBox_Y->SetValue(y);
-         SpinBox_Z->SetValue(z);
-       }
-      else if (myEditCurrentArgument == (QWidget*)SpinBox_DX)
-       {
-         SpinBox_DX->SetValue(x - SpinBox_X->GetValue());
-         SpinBox_DY->SetValue(y - SpinBox_Y->GetValue());
-         SpinBox_DZ->SetValue(z - SpinBox_Z->GetValue());
-       }
+
+    if (aNbUnits < 1)
+      return;
+
+    myNbOkElements = true;
+  } else {
+    aNbUnits = SMESH::GetNameOfSelectedNodes(mySelector, myActor->getIO(), aString);
+    if (aNbUnits != 1)
+      return;
+
+    SMDS_Mesh* aMesh =  myActor->GetObject()->GetMesh();
+    if (!aMesh)
+      return;
+
+    const SMDS_MeshNode * n = aMesh->FindNode(aString.toInt());
+    if (!n)
+      return;
+
+    double x = n->X();
+    double y = n->Y();
+    double z = n->Z();
+
+    if (myEditCurrentArgument == (QWidget*)SpinBox_X) {
+      SpinBox_X->SetValue(x);
+      SpinBox_Y->SetValue(y);
+      SpinBox_Z->SetValue(z);
+    } else if (myEditCurrentArgument == (QWidget*)SpinBox_DX) {
+      SpinBox_DX->SetValue(x - SpinBox_X->GetValue());
+      SpinBox_DY->SetValue(y - SpinBox_Y->GetValue());
+      SpinBox_DZ->SetValue(z - SpinBox_Z->GetValue());
     }
-  
+  }
+
   myBusy = true;
   if (myEditCurrentArgument == (QWidget*)LineEditElements)
-    LineEditElements->setText( aString );
+    LineEditElements->setText(aString);
   myBusy = false;
-  
+
   // OK
-  if(myNbOkElements && IsMirrorOk())
-    {
-      buttonOk->setEnabled( true );
-      buttonApply->setEnabled( true );
-    }
+  if (myNbOkElements && IsMirrorOk()) {
+    buttonOk->setEnabled(true);
+    buttonApply->setEnabled(true);
+  }
 }
 
-
 //=================================================================================
 // function : SetEditCurrentArgument()
 // purpose  :
@@ -721,38 +725,35 @@ void SMESHGUI_SymmetryDlg::SelectionIntoArgument()
 void SMESHGUI_SymmetryDlg::SetEditCurrentArgument()
 {
   QPushButton* send = (QPushButton*)sender();
-  
-  disconnect( mySelection, 0, this, 0 );
-  mySelection->ClearIObjects();
-  mySelection->ClearFilters();
-  
-  if(send == SelectElementsButton) {
+
+  disconnect(mySelectionMgr, 0, this, 0);
+  mySelectionMgr->clearSelected();
+  mySelectionMgr->clearFilters();
+
+  if (send == SelectElementsButton) {
     myEditCurrentArgument = (QWidget*)LineEditElements;
     SMESH::SetPointRepresentation(false);
-    if (CheckBoxMesh->isChecked())
-      {
-       QAD_Application::getDesktop()->SetSelectionMode( ActorSelection );
-       mySelection->AddFilter(myMeshOrSubMeshOrGroupFilter);
-      }
-    else
-      QAD_Application::getDesktop()->SetSelectionMode( CellSelection, true );
-  }
-  else if (send == SelectPointButton)
-    {
-      myEditCurrentArgument = (QWidget*)SpinBox_X;
-      SMESH::SetPointRepresentation(true);
-      QAD_Application::getDesktop()->SetSelectionMode( NodeSelection, true );
+    if (CheckBoxMesh->isChecked()) {
+      myViewWindow->SetSelectionMode(ActorSelection);
+      mySelectionMgr->installFilter(myMeshOrSubMeshOrGroupFilter);
+    } else {
+      myViewWindow->SetSelectionMode(CellSelection);
     }
-  else if (send == SelectVectorButton)
-    {
-      myEditCurrentArgument = (QWidget*)SpinBox_DX;
-      SMESH::SetPointRepresentation(true);
-      QAD_Application::getDesktop()->SetSelectionMode( NodeSelection, true );
-    }
-  
+  } else if (send == SelectPointButton) {
+    myEditCurrentArgument = (QWidget*)SpinBox_X;
+    SMESH::SetPointRepresentation(true);
+    myViewWindow->SetSelectionMode(NodeSelection);
+  } else if (send == SelectVectorButton) {
+    myEditCurrentArgument = (QWidget*)SpinBox_DX;
+    SMESH::SetPointRepresentation(true);
+
+    myViewWindow->SetSelectionMode(NodeSelection);
+  } else {
+  }
+
   myEditCurrentArgument->setFocus();
-  connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
-  SelectionIntoArgument() ;
+  connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
+  SelectionIntoArgument();
 }
 
 //=================================================================================
@@ -761,16 +762,15 @@ void SMESHGUI_SymmetryDlg::SetEditCurrentArgument()
 //=================================================================================
 void SMESHGUI_SymmetryDlg::DeactivateActiveDialog()
 {
-  if ( GroupConstructors->isEnabled() ) {
-    GroupConstructors->setEnabled(false) ;
-    GroupArguments->setEnabled(false) ;
-    GroupButtons->setEnabled(false) ;
-    mySMESHGUI->ResetState() ;    
-    mySMESHGUI->SetActiveDialogBox(0) ;
+  if (GroupConstructors->isEnabled()) {
+    GroupConstructors->setEnabled(false);
+    GroupArguments->setEnabled(false);
+    GroupButtons->setEnabled(false);
+    mySMESHGUI->ResetState();
+    mySMESHGUI->SetActiveDialogBox(0);
   }
 }
 
-
 //=================================================================================
 // function : ActivateThisDialog()
 // purpose  :
@@ -778,131 +778,117 @@ void SMESHGUI_SymmetryDlg::DeactivateActiveDialog()
 void SMESHGUI_SymmetryDlg::ActivateThisDialog()
 {
   /* Emit a signal to deactivate the active dialog */
-  mySMESHGUI->EmitSignalDeactivateDialog() ;   
-  GroupConstructors->setEnabled(true) ;
-  GroupArguments->setEnabled(true) ;
-  GroupButtons->setEnabled(true) ;
-  
-  mySMESHGUI->SetActiveDialogBox( (QDialog*)this ) ;
-
-  QAD_Application::getDesktop()->SetSelectionMode( CellSelection, true );
+  mySMESHGUI->EmitSignalDeactivateDialog();
+  GroupConstructors->setEnabled(true);
+  GroupArguments->setEnabled(true);
+  GroupButtons->setEnabled(true);
+
+  mySMESHGUI->SetActiveDialogBox((QDialog*)this);
+
+  myViewWindow->SetSelectionMode(CellSelection);
   SelectionIntoArgument();
 }
 
-
 //=================================================================================
 // function : enterEvent()
 // purpose  :
 //=================================================================================
-void SMESHGUI_SymmetryDlg::enterEvent(QEvent* e)
+void SMESHGUI_SymmetryDlg::enterEvent (QEvent*)
 {
-  if ( GroupConstructors->isEnabled() )
-    return ;  
-  ActivateThisDialog() ;
+  if (!GroupConstructors->isEnabled())
+    ActivateThisDialog();
 }
 
-
 //=================================================================================
 // function : closeEvent()
 // purpose  :
 //=================================================================================
-void SMESHGUI_SymmetryDlg::closeEvent( QCloseEvent* e )
+void SMESHGUI_SymmetryDlg::closeEvent (QCloseEvent*)
 {
   /* same than click on cancel button */
-  this->ClickOnCancel() ;
+  this->ClickOnCancel();
 }
 
-
 //=======================================================================
-//function : hideEvent
-//purpose  : caused by ESC key
+// function : hideEvent()
+// purpose  : caused by ESC key
 //=======================================================================
-
-void SMESHGUI_SymmetryDlg::hideEvent ( QHideEvent * e )
+void SMESHGUI_SymmetryDlg::hideEvent (QHideEvent*)
 {
-  if ( !isMinimized() )
+  if (!isMinimized())
     ClickOnCancel();
 }
 
-
 //=======================================================================
 //function : onSelectMesh
 //purpose  :
 //=======================================================================
-void SMESHGUI_SymmetryDlg::onSelectMesh ( bool toSelectMesh )
+void SMESHGUI_SymmetryDlg::onSelectMesh (bool toSelectMesh)
 {
   if (toSelectMesh)
-    TextLabelElements->setText( tr( "SMESH_NAME" ) );
+    TextLabelElements->setText(tr("SMESH_NAME"));
   else
-    TextLabelElements->setText( tr( "SMESH_ID_ELEMENTS" ) );
-  
-  if (myEditCurrentArgument != LineEditElements)
-    {
-      LineEditElements->clear();
-      return;
-    }
-  
-  mySelection->ClearFilters() ;
+    TextLabelElements->setText(tr("SMESH_ID_ELEMENTS"));
+
+  if (myEditCurrentArgument != LineEditElements) {
+    LineEditElements->clear();
+    return;
+  }
+
+  mySelectionMgr->clearFilters();
   SMESH::SetPointRepresentation(false);
-  
-  if (toSelectMesh)
-    {
-      QAD_Application::getDesktop()->SetSelectionMode( ActorSelection );
-      mySelection->AddFilter(myMeshOrSubMeshOrGroupFilter);
-      LineEditElements->setReadOnly(true);
-    }
-  else
-    {
-      QAD_Application::getDesktop()->SetSelectionMode( CellSelection, true );
-      LineEditElements->setReadOnly(false);
-      onTextChange(LineEditElements->text());
-    }
-  
+
+  if (toSelectMesh) {
+    myViewWindow->SetSelectionMode(ActorSelection);
+    mySelectionMgr->installFilter(myMeshOrSubMeshOrGroupFilter);
+    LineEditElements->setReadOnly(true);
+  } else {
+    myViewWindow->SetSelectionMode(CellSelection);
+    LineEditElements->setReadOnly(false);
+    onTextChange(LineEditElements->text());
+  }
+
   SelectionIntoArgument();
 }
 
-
 //=================================================================================
 // function : GetConstructorId()
-// purpose  : 
+// purpose  :
 //=================================================================================
 int SMESHGUI_SymmetryDlg::GetConstructorId()
-{ 
-  if ( GroupConstructors != NULL && GroupConstructors->selected() != NULL )
-    return GroupConstructors->id( GroupConstructors->selected() );
+{
+  if (GroupConstructors != NULL && GroupConstructors->selected() != NULL)
+    return GroupConstructors->id(GroupConstructors->selected());
   return -1;
 }
 
-
 //=================================================================================
-// function : IsAxisOk()
-// purpose  : 
+// function : IsMirrorOk()
+// purpose  :
 //=================================================================================
 bool SMESHGUI_SymmetryDlg::IsMirrorOk()
 {
   bool isOk = true;
 
   if (GetConstructorId() != 0)
-    isOk = SpinBox_DX->GetValue() != 0 || SpinBox_DY->GetValue() != 0 || SpinBox_DZ->GetValue() != 0; 
+    isOk = (SpinBox_DX->GetValue() != 0 ||
+            SpinBox_DY->GetValue() != 0 ||
+            SpinBox_DZ->GetValue() != 0);
 
   return isOk;
 }
 
-
 //=================================================================================
 // function : onVectorChanged()
-// purpose  : 
+// purpose  :
 //=================================================================================
 void SMESHGUI_SymmetryDlg::onVectorChanged()
 {
-  if (IsMirrorOk())
-    {
-      buttonOk->setEnabled( true );
-      buttonApply->setEnabled( true );
-    }
-  else
-    {
-      buttonOk->setEnabled( false );
-      buttonApply->setEnabled( false );
-    }
+  if (IsMirrorOk()) {
+    buttonOk->setEnabled(true);
+    buttonApply->setEnabled(true);
+  } else {
+    buttonOk->setEnabled(false);
+    buttonApply->setEnabled(false);
+  }
 }
index c556b34934d01aafc9f273f7070b9021c8b01c79..97cd85605b14296964bbd50693d1b4bb4559ba82 100644 (file)
@@ -29,7 +29,8 @@
 #ifndef DIALOGBOX_SYMMETRY_H
 #define DIALOGBOX_SYMMETRY_H
 
-#include "SALOME_Selection.h"
+#include "SalomeApp_SelectionMgr.h"
+
 #include "SMESH_LogicalFilter.hxx"
 
 // QT Includes
@@ -47,6 +48,8 @@ class QCheckBox;
 class SMESHGUI_SpinBox;
 class SMESHGUI;
 class SMESH_Actor;
+class SVTK_ViewWindow;
+class SVTK_Selector;
 
 // IDL Headers
 #include <SALOMEconfig.h>
@@ -62,29 +65,33 @@ class SMESHGUI_SymmetryDlg : public QDialog
     Q_OBJECT
 
 public:
-    SMESHGUI_SymmetryDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 );
+    SMESHGUI_SymmetryDlg( SMESHGUI*,
+                         const char* name = 0,
+                         bool modal = FALSE,
+                         WFlags fl = 0);
     ~SMESHGUI_SymmetryDlg();
 
 private:
-
-    void Init( bool ResetControls = true ) ;
-    void closeEvent( QCloseEvent* e ) ;
-    void enterEvent ( QEvent * ) ;                          /* mouse enter the QWidget */
-    void hideEvent ( QHideEvent * );                        /* ESC key */
+    void Init (bool ResetControls = true);
+    void closeEvent (QCloseEvent*);
+    void enterEvent (QEvent*);                             /* mouse enter the QWidget */
+    void hideEvent (QHideEvent*);                          /* ESC key */
     int GetConstructorId();
     bool IsMirrorOk();
-    
-    SMESHGUI*                     mySMESHGUI ;              /* Current SMESHGUI object */
-    SALOME_Selection*             mySelection ;             /* User shape selection */
-    int                           myNbOkElements ;          /* to check when elements are defined */
+
+    SMESHGUI*                     mySMESHGUI;              /* Current SMESHGUI object */
+    SalomeApp_SelectionMgr*       mySelectionMgr;          /* User shape selection */
+    int                           myNbOkElements;          /* to check when elements are defined */
     QString                       myElementsId;
+    SVTK_ViewWindow*              myViewWindow;
+    SVTK_Selector*                mySelector;
+
+    QWidget*                      myEditCurrentArgument;   /* Current  LineEdit */
 
-    QWidget*                      myEditCurrentArgument;    /* Current  LineEdit */
-    
     bool                          myBusy;
     SMESH::SMESH_Mesh_var         myMesh;
     SMESH_Actor*                  myActor;
-    Handle(SMESH_LogicalFilter)   myMeshOrSubMeshOrGroupFilter;
+    SMESH_LogicalFilter*          myMeshOrSubMeshOrGroupFilter;
     
     QButtonGroup* GroupConstructors;
     QRadioButton* RadioButton1;
index 0bb568609bb4aaebec9d26846006363008183922..5ab553b229231098dd33258282db439f9c092d2a 100644 (file)
@@ -1,48 +1,60 @@
 //  SMESH SMESHGUI : GUI for SMESH component
 //
 //  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
-// 
-//  This library is free software; you can redistribute it and/or 
-//  modify it under the terms of the GNU Lesser General Public 
-//  License as published by the Free Software Foundation; either 
-//  version 2.1 of the License. 
-// 
-//  This library is distributed in the hope that it will be useful, 
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of 
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
-//  Lesser General Public License for more details. 
-// 
-//  You should have received a copy of the GNU Lesser General Public 
-//  License along with this library; if not, write to the Free Software 
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
-// 
-//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
 //
 //
 //
 //  File   : SMESHGUI_TranslationDlg.cxx
 //  Author : Michael ZORIN
 //  Module : SMESH
-//  $Header: 
+//  $Header:
 
 #include "SMESHGUI_TranslationDlg.h"
 
 #include "SMESHGUI.h"
+#include "SMESHGUI_SpinBox.h"
 #include "SMESHGUI_Utils.h"
 #include "SMESHGUI_VTKUtils.h"
 #include "SMESHGUI_MeshUtils.h"
 #include "SMESHGUI_IdValidator.h"
-#include "SMESHGUI_SpinBox.h"
+
 #include "SMESH_Actor.h"
 #include "SMESH_TypeFilter.hxx"
+#include "SMESH_LogicalFilter.hxx"
 #include "SMDS_Mesh.hxx"
 
-#include "QAD_Application.h"
-#include "QAD_Desktop.h"
-#include "QAD_MessageBox.h"
+#include "SUIT_Desktop.h"
+#include "SUIT_ResourceMgr.h"
+
+#include "SVTK_ViewModel.h"
+#include "SVTK_Selection.h"
+#include "SVTK_ViewWindow.h"
+#include "SVTK_Selector.h"
+#include "SALOME_ListIO.hxx"
+
 #include "utilities.h"
 
+// OCCT Includes
+#include <TColStd_MapOfInteger.hxx>
+#include <TColStd_IndexedMapOfInteger.hxx>
+
 // QT Includes
 #include <qapplication.h>
 #include <qbuttongroup.h>
@@ -53,7 +65,7 @@
 #include <qradiobutton.h>
 #include <qcheckbox.h>
 #include <qlayout.h>
-#include <qspinbox.h> 
+#include <qspinbox.h>
 #include <qpixmap.h>
 
 // IDL Headers
@@ -64,230 +76,231 @@ using namespace std;
 
 //=================================================================================
 // class    : SMESHGUI_TranslationDlg()
-// purpose  : 
+// purpose  :
 //=================================================================================
-SMESHGUI_TranslationDlg::SMESHGUI_TranslationDlg( QWidget* parent, const char* name, SALOME_Selection* Sel,
-                                             bool modal, WFlags fl )
-  : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu |
-            Qt::WDestructiveClose)
+SMESHGUI_TranslationDlg::SMESHGUI_TranslationDlg( SMESHGUI* theModule, const char* name,
+                                                  bool modal, WFlags fl)
+     : QDialog( SMESH::GetDesktop( theModule ), name, modal, WStyle_Customize | WStyle_NormalBorder |
+                WStyle_Title | WStyle_SysMenu | Qt::WDestructiveClose),
+     mySMESHGUI( theModule ),
+     mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ),
+     myViewWindow( SMESH::GetViewWindow( theModule ) ),
+     mySelector( myViewWindow->GetSelector() )
 {
-  QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "SMESH",tr("ICON_SMESH_TRANSLATION_POINTS")));
-  QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "SMESH",tr("ICON_SMESH_TRANSLATION_VECTOR")));
-  QPixmap image2(QAD_Desktop::getResourceManager()->loadPixmap( "SMESH",tr("ICON_SELECT")));
-
-  if ( !name )
-    setName( "SMESHGUI_TranslationDlg" );
-  resize( 303, 185 ); 
-  setCaption( tr( "SMESH_TRANSLATION" ) );
-  setSizeGripEnabled( TRUE );
-  SMESHGUI_TranslationDlgLayout = new QGridLayout( this ); 
-  SMESHGUI_TranslationDlgLayout->setSpacing( 6 );
-  SMESHGUI_TranslationDlgLayout->setMargin( 11 );
+  QPixmap image0 (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_SMESH_TRANSLATION_POINTS")));
+  QPixmap image1 (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_SMESH_TRANSLATION_VECTOR")));
+  QPixmap image2 (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_SELECT")));
+
+  if (!name)
+    setName("SMESHGUI_TranslationDlg");
+  resize(303, 185);
+  setCaption(tr("SMESH_TRANSLATION"));
+  setSizeGripEnabled(TRUE);
+  SMESHGUI_TranslationDlgLayout = new QGridLayout(this);
+  SMESHGUI_TranslationDlgLayout->setSpacing(6);
+  SMESHGUI_TranslationDlgLayout->setMargin(11);
 
   /***************************************************************/
-  GroupConstructors = new QButtonGroup( this, "GroupConstructors" );
-  GroupConstructors->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)0, 0, 0, GroupConstructors->sizePolicy().hasHeightForWidth() ) );
-  GroupConstructors->setTitle( tr( "SMESH_TRANSLATION"  ) );
-  GroupConstructors->setExclusive( TRUE );
-  GroupConstructors->setColumnLayout(0, Qt::Vertical );
-  GroupConstructors->layout()->setSpacing( 0 );
-  GroupConstructors->layout()->setMargin( 0 );
-  GroupConstructorsLayout = new QGridLayout( GroupConstructors->layout() );
-  GroupConstructorsLayout->setAlignment( Qt::AlignTop );
-  GroupConstructorsLayout->setSpacing( 6 );
-  GroupConstructorsLayout->setMargin( 11 );
-  RadioButton1= new QRadioButton( GroupConstructors, "RadioButton1" );
-  RadioButton1->setText( tr( ""  ) );
-  RadioButton1->setPixmap( image0 );
-  GroupConstructorsLayout->addWidget( RadioButton1, 0, 0 );
-  RadioButton2= new QRadioButton( GroupConstructors, "RadioButton2" );
-  RadioButton2->setText( tr( ""  ) );
-  RadioButton2->setPixmap( image1 );
-  GroupConstructorsLayout->addWidget( RadioButton2, 0, 2  );
-  SMESHGUI_TranslationDlgLayout->addWidget( GroupConstructors, 0, 0 );
-  
+  GroupConstructors = new QButtonGroup(this, "GroupConstructors");
+  GroupConstructors->setSizePolicy(QSizePolicy((QSizePolicy::SizeType)5, (QSizePolicy::SizeType)0, 0, 0, GroupConstructors->sizePolicy().hasHeightForWidth()));
+  GroupConstructors->setTitle(tr("SMESH_TRANSLATION" ));
+  GroupConstructors->setExclusive(TRUE);
+  GroupConstructors->setColumnLayout(0, Qt::Vertical);
+  GroupConstructors->layout()->setSpacing(0);
+  GroupConstructors->layout()->setMargin(0);
+  GroupConstructorsLayout = new QGridLayout(GroupConstructors->layout());
+  GroupConstructorsLayout->setAlignment(Qt::AlignTop);
+  GroupConstructorsLayout->setSpacing(6);
+  GroupConstructorsLayout->setMargin(11);
+  RadioButton1= new QRadioButton(GroupConstructors, "RadioButton1");
+  RadioButton1->setText(tr("" ));
+  RadioButton1->setPixmap(image0);
+  GroupConstructorsLayout->addWidget(RadioButton1, 0, 0);
+  RadioButton2= new QRadioButton(GroupConstructors, "RadioButton2");
+  RadioButton2->setText(tr("" ));
+  RadioButton2->setPixmap(image1);
+  GroupConstructorsLayout->addWidget(RadioButton2, 0, 2 );
+  SMESHGUI_TranslationDlgLayout->addWidget(GroupConstructors, 0, 0);
+
   /***************************************************************/
-  GroupButtons = new QGroupBox( this, "GroupButtons" );
-  GroupButtons->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, GroupButtons->sizePolicy().hasHeightForWidth() ) );
-  GroupButtons->setGeometry( QRect( 10, 10, 281, 48 ) ); 
-  GroupButtons->setTitle( tr( ""  ) );
-  GroupButtons->setColumnLayout(0, Qt::Vertical );
-  GroupButtons->layout()->setSpacing( 0 );
-  GroupButtons->layout()->setMargin( 0 );
-  GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
-  GroupButtonsLayout->setAlignment( Qt::AlignTop );
-  GroupButtonsLayout->setSpacing( 6 );
-  GroupButtonsLayout->setMargin( 11 );
-  buttonCancel = new QPushButton( GroupButtons, "buttonCancel" );
-  buttonCancel->setText( tr( "SMESH_BUT_CLOSE"  ) );
-  buttonCancel->setAutoDefault( TRUE );
-  GroupButtonsLayout->addWidget( buttonCancel, 0, 3 );
-  buttonApply = new QPushButton( GroupButtons, "buttonApply" );
-  buttonApply->setText( tr( "SMESH_BUT_APPLY"  ) );
-  buttonApply->setAutoDefault( TRUE );
-  GroupButtonsLayout->addWidget( buttonApply, 0, 1 );
-  QSpacerItem* spacer_9 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
-  GroupButtonsLayout->addItem( spacer_9, 0, 2 );
-  buttonOk = new QPushButton( GroupButtons, "buttonOk" );
-  buttonOk->setText( tr( "SMESH_BUT_OK"  ) );
-  buttonOk->setAutoDefault( TRUE );
-  buttonOk->setDefault( TRUE );
-  GroupButtonsLayout->addWidget( buttonOk, 0, 0 );
-  SMESHGUI_TranslationDlgLayout->addWidget( GroupButtons, 2, 0 );
+  GroupButtons = new QGroupBox(this, "GroupButtons");
+  GroupButtons->setSizePolicy(QSizePolicy((QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, GroupButtons->sizePolicy().hasHeightForWidth()));
+  GroupButtons->setGeometry(QRect(10, 10, 281, 48));
+  GroupButtons->setTitle(tr("" ));
+  GroupButtons->setColumnLayout(0, Qt::Vertical);
+  GroupButtons->layout()->setSpacing(0);
+  GroupButtons->layout()->setMargin(0);
+  GroupButtonsLayout = new QGridLayout(GroupButtons->layout());
+  GroupButtonsLayout->setAlignment(Qt::AlignTop);
+  GroupButtonsLayout->setSpacing(6);
+  GroupButtonsLayout->setMargin(11);
+  buttonCancel = new QPushButton(GroupButtons, "buttonCancel");
+  buttonCancel->setText(tr("SMESH_BUT_CLOSE" ));
+  buttonCancel->setAutoDefault(TRUE);
+  GroupButtonsLayout->addWidget(buttonCancel, 0, 3);
+  buttonApply = new QPushButton(GroupButtons, "buttonApply");
+  buttonApply->setText(tr("SMESH_BUT_APPLY" ));
+  buttonApply->setAutoDefault(TRUE);
+  GroupButtonsLayout->addWidget(buttonApply, 0, 1);
+  QSpacerItem* spacer_9 = new QSpacerItem(20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
+  GroupButtonsLayout->addItem(spacer_9, 0, 2);
+  buttonOk = new QPushButton(GroupButtons, "buttonOk");
+  buttonOk->setText(tr("SMESH_BUT_OK" ));
+  buttonOk->setAutoDefault(TRUE);
+  buttonOk->setDefault(TRUE);
+  GroupButtonsLayout->addWidget(buttonOk, 0, 0);
+  SMESHGUI_TranslationDlgLayout->addWidget(GroupButtons, 2, 0);
 
   /***************************************************************/
-  GroupArguments = new QGroupBox( this, "GroupArguments" );
-  GroupArguments->setTitle( tr( "SMESH_ARGUMENTS" ) );
-  GroupArguments->setColumnLayout(0, Qt::Vertical );
-  GroupArguments->layout()->setSpacing( 0 );
-  GroupArguments->layout()->setMargin( 0 );
-  GroupArgumentsLayout = new QGridLayout( GroupArguments->layout() );
-  GroupArgumentsLayout->setAlignment( Qt::AlignTop );
-  GroupArgumentsLayout->setSpacing( 6 );
-  GroupArgumentsLayout->setMargin( 11 );
+  GroupArguments = new QGroupBox(this, "GroupArguments");
+  GroupArguments->setTitle(tr("SMESH_ARGUMENTS"));
+  GroupArguments->setColumnLayout(0, Qt::Vertical);
+  GroupArguments->layout()->setSpacing(0);
+  GroupArguments->layout()->setMargin(0);
+  GroupArgumentsLayout = new QGridLayout(GroupArguments->layout());
+  GroupArgumentsLayout->setAlignment(Qt::AlignTop);
+  GroupArgumentsLayout->setSpacing(6);
+  GroupArgumentsLayout->setMargin(11);
 
   // Controls for elements selection
-  TextLabelElements  = new QLabel( GroupArguments, "TextLabelElements" );
-  TextLabelElements->setText( tr( "SMESH_ID_ELEMENTS"  ) );
+  TextLabelElements  = new QLabel(GroupArguments, "TextLabelElements");
+  TextLabelElements->setText(tr("SMESH_ID_ELEMENTS" ));
   TextLabelElements->setFixedWidth(74);
-  GroupArgumentsLayout->addWidget( TextLabelElements, 0, 0 );
+  GroupArgumentsLayout->addWidget(TextLabelElements, 0, 0);
 
-  SelectElementsButton  = new QPushButton( GroupArguments, "SelectElementsButton" );
-  SelectElementsButton->setText( tr( ""  ) );
-  SelectElementsButton->setPixmap( image2 );
-  SelectElementsButton->setToggleButton( FALSE );
-  GroupArgumentsLayout->addWidget( SelectElementsButton, 0, 1 );
+  SelectElementsButton  = new QPushButton(GroupArguments, "SelectElementsButton");
+  SelectElementsButton->setText(tr("" ));
+  SelectElementsButton->setPixmap(image2);
+  SelectElementsButton->setToggleButton(FALSE);
+  GroupArgumentsLayout->addWidget(SelectElementsButton, 0, 1);
 
-  LineEditElements  = new QLineEdit( GroupArguments, "LineEditElements" );
-  LineEditElements->setValidator( new SMESHGUI_IdValidator( this, "validator" ));
-  GroupArgumentsLayout->addMultiCellWidget( LineEditElements, 0, 0, 2, 7 );
+  LineEditElements  = new QLineEdit(GroupArguments, "LineEditElements");
+  LineEditElements->setValidator(new SMESHGUI_IdValidator(this, "validator"));
+  GroupArgumentsLayout->addMultiCellWidget(LineEditElements, 0, 0, 2, 7);
 
   // Control for the whole mesh selection
-  CheckBoxMesh = new QCheckBox( GroupArguments, "CheckBoxMesh" );
-  CheckBoxMesh->setText( tr( "SMESH_SELECT_WHOLE_MESH"  ) );
-  GroupArgumentsLayout->addMultiCellWidget( CheckBoxMesh, 1, 1, 0, 7 );
-  
+  CheckBoxMesh = new QCheckBox(GroupArguments, "CheckBoxMesh");
+  CheckBoxMesh->setText(tr("SMESH_SELECT_WHOLE_MESH" ));
+  GroupArgumentsLayout->addMultiCellWidget(CheckBoxMesh, 1, 1, 0, 7);
+
   // Controls for vector and points selection
-  TextLabel1 = new QLabel( GroupArguments, "TextLabel1" );
-  GroupArgumentsLayout->addWidget( TextLabel1, 2, 0 );
+  TextLabel1 = new QLabel(GroupArguments, "TextLabel1");
+  GroupArgumentsLayout->addWidget(TextLabel1, 2, 0);
 
-  SelectButton1  = new QPushButton( GroupArguments, "SelectButton1" );
-  SelectButton1->setText( tr( ""  ) );
-  SelectButton1->setPixmap( image2 );
-  SelectButton1->setToggleButton( FALSE );
-  GroupArgumentsLayout->addWidget( SelectButton1, 2, 1 );
+  SelectButton1  = new QPushButton(GroupArguments, "SelectButton1");
+  SelectButton1->setText(tr("" ));
+  SelectButton1->setPixmap(image2);
+  SelectButton1->setToggleButton(FALSE);
+  GroupArgumentsLayout->addWidget(SelectButton1, 2, 1);
 
-  TextLabel1_1 = new QLabel( GroupArguments, "TextLabel1_1" );
-  GroupArgumentsLayout->addWidget( TextLabel1_1, 2, 2 );
+  TextLabel1_1 = new QLabel(GroupArguments, "TextLabel1_1");
+  GroupArgumentsLayout->addWidget(TextLabel1_1, 2, 2);
 
   SpinBox1_1 = new SMESHGUI_SpinBox(GroupArguments, "SpinBox1_1");
-  GroupArgumentsLayout->addWidget( SpinBox1_1, 2, 3 );
+  GroupArgumentsLayout->addWidget(SpinBox1_1, 2, 3);
 
-  TextLabel1_2 = new QLabel( GroupArguments, "TextLabel1_2" );
-  GroupArgumentsLayout->addWidget( TextLabel1_2, 2, 4 );
+  TextLabel1_2 = new QLabel(GroupArguments, "TextLabel1_2");
+  GroupArgumentsLayout->addWidget(TextLabel1_2, 2, 4);
 
   SpinBox1_2 = new SMESHGUI_SpinBox(GroupArguments, "SpinBox1_2");
-  GroupArgumentsLayout->addWidget( SpinBox1_2, 2, 5 );
+  GroupArgumentsLayout->addWidget(SpinBox1_2, 2, 5);
+
+  TextLabel1_3 = new QLabel(GroupArguments, "TextLabel1_3");
+  GroupArgumentsLayout->addWidget(TextLabel1_3, 2, 6);
 
-  TextLabel1_3 = new QLabel( GroupArguments, "TextLabel1_3" );
-  GroupArgumentsLayout->addWidget( TextLabel1_3, 2, 6 );
-  
   SpinBox1_3 = new SMESHGUI_SpinBox(GroupArguments, "SpinBox1_3");
-  GroupArgumentsLayout->addWidget( SpinBox1_3, 2, 7 );
-  
-  TextLabel2 = new QLabel( GroupArguments, "TextLabel2" );
-  TextLabel2->setText( tr( "SMESH_POINT_2"  ) );
-  GroupArgumentsLayout->addWidget( TextLabel2, 3, 0 );
-
-  SelectButton2  = new QPushButton( GroupArguments, "SelectButton2" );
-  SelectButton2->setText( tr( ""  ) );
-  SelectButton2->setPixmap( image2 );
-  SelectButton2->setToggleButton( FALSE );
-  GroupArgumentsLayout->addWidget( SelectButton2, 3, 1 );
-
-  TextLabel2_1 = new QLabel( GroupArguments, "TextLabel2_1" );
-  TextLabel2_1->setText( tr( "SMESH_X"  ) );
-  GroupArgumentsLayout->addWidget( TextLabel2_1, 3, 2 );
-  
+  GroupArgumentsLayout->addWidget(SpinBox1_3, 2, 7);
+
+  TextLabel2 = new QLabel(GroupArguments, "TextLabel2");
+  TextLabel2->setText(tr("SMESH_POINT_2" ));
+  GroupArgumentsLayout->addWidget(TextLabel2, 3, 0);
+
+  SelectButton2  = new QPushButton(GroupArguments, "SelectButton2");
+  SelectButton2->setText(tr("" ));
+  SelectButton2->setPixmap(image2);
+  SelectButton2->setToggleButton(FALSE);
+  GroupArgumentsLayout->addWidget(SelectButton2, 3, 1);
+
+  TextLabel2_1 = new QLabel(GroupArguments, "TextLabel2_1");
+  TextLabel2_1->setText(tr("SMESH_X" ));
+  GroupArgumentsLayout->addWidget(TextLabel2_1, 3, 2);
+
   SpinBox2_1 = new SMESHGUI_SpinBox(GroupArguments, "SpinBox2_1");
-  GroupArgumentsLayout->addWidget( SpinBox2_1, 3, 3 );
-  
-  TextLabel2_2 = new QLabel( GroupArguments, "TextLabel2_2" );
-  TextLabel2_2->setText( tr( "SMESH_Y"  ) );
-  GroupArgumentsLayout->addWidget( TextLabel2_2, 3, 4 );
+  GroupArgumentsLayout->addWidget(SpinBox2_1, 3, 3);
+
+  TextLabel2_2 = new QLabel(GroupArguments, "TextLabel2_2");
+  TextLabel2_2->setText(tr("SMESH_Y" ));
+  GroupArgumentsLayout->addWidget(TextLabel2_2, 3, 4);
 
   SpinBox2_2 = new SMESHGUI_SpinBox(GroupArguments, "SpinBox2_2");
-  GroupArgumentsLayout->addWidget( SpinBox2_2, 3, 5 );
+  GroupArgumentsLayout->addWidget(SpinBox2_2, 3, 5);
+
+  TextLabel2_3 = new QLabel(GroupArguments, "TextLabel2_3");
+  TextLabel2_3->setText(tr("SMESH_Z"));
+  GroupArgumentsLayout->addWidget(TextLabel2_3, 3, 6);
 
-  TextLabel2_3 = new QLabel( GroupArguments, "TextLabel2_3" );
-  TextLabel2_3->setText( tr( "SMESH_Z" ) );
-  GroupArgumentsLayout->addWidget( TextLabel2_3, 3, 6 );
-  
   SpinBox2_3 = new SMESHGUI_SpinBox(GroupArguments, "SpinBox2_3");
-  GroupArgumentsLayout->addWidget( SpinBox2_3, 3, 7 );
-  
+  GroupArgumentsLayout->addWidget(SpinBox2_3, 3, 7);
+
   // Controls for "Create a copy" option
-  CheckBoxCopy = new QCheckBox( GroupArguments, "CheckBoxCopy" );
-  CheckBoxCopy->setText( tr( "SMESH_CREATE_COPY" ) );
-  GroupArgumentsLayout->addMultiCellWidget( CheckBoxCopy, 4, 4, 0, 2 );
-  
+  CheckBoxCopy = new QCheckBox(GroupArguments, "CheckBoxCopy");
+  CheckBoxCopy->setText(tr("SMESH_CREATE_COPY"));
+  GroupArgumentsLayout->addMultiCellWidget(CheckBoxCopy, 4, 4, 0, 2);
+
+
+  SMESHGUI_TranslationDlgLayout->addWidget(GroupArguments, 1, 0);
 
-  SMESHGUI_TranslationDlgLayout->addWidget( GroupArguments, 1, 0 );
-  
   /* Initialisations */
-  SpinBox1_1->RangeStepAndValidator( -999999.999, +999999.999, 10.0, 3 );
-  SpinBox1_2->RangeStepAndValidator( -999999.999, +999999.999, 10.0, 3 );
-  SpinBox1_3->RangeStepAndValidator( -999999.999, +999999.999, 10.0, 3 );
-  SpinBox2_1->RangeStepAndValidator( -999999.999, +999999.999, 10.0, 3 );
-  SpinBox2_2->RangeStepAndValidator( -999999.999, +999999.999, 10.0, 3 );
-  SpinBox2_3->RangeStepAndValidator( -999999.999, +999999.999, 10.0, 3 );
+  SpinBox1_1->RangeStepAndValidator(-999999.999, +999999.999, 10.0, 3);
+  SpinBox1_2->RangeStepAndValidator(-999999.999, +999999.999, 10.0, 3);
+  SpinBox1_3->RangeStepAndValidator(-999999.999, +999999.999, 10.0, 3);
+  SpinBox2_1->RangeStepAndValidator(-999999.999, +999999.999, 10.0, 3);
+  SpinBox2_2->RangeStepAndValidator(-999999.999, +999999.999, 10.0, 3);
+  SpinBox2_3->RangeStepAndValidator(-999999.999, +999999.999, 10.0, 3);
 
   GroupArguments->show();
-  RadioButton1->setChecked( TRUE );
-  mySelection = Sel;  
-  
-  mySMESHGUI  = SMESHGUI::GetSMESHGUI() ;
-  mySMESHGUI->SetActiveDialogBox( (QDialog*)this ) ;
+  RadioButton1->setChecked(TRUE);
+
+  mySMESHGUI->SetActiveDialogBox((QDialog*)this);
 
   // Costruction of the logical filter
-  SMESH_ListOfFilter aListOfFilters;
-  Handle(SMESH_TypeFilter) aMeshOrSubMeshFilter = new SMESH_TypeFilter( MESHorSUBMESH );
-  if ( !aMeshOrSubMeshFilter.IsNull() )
-    aListOfFilters.Append( aMeshOrSubMeshFilter );
-  Handle(SMESH_TypeFilter) aSmeshGroupFilter = new SMESH_TypeFilter( GROUP );
-  if ( !aSmeshGroupFilter.IsNull() )
-    aListOfFilters.Append( aSmeshGroupFilter );
-  
-  myMeshOrSubMeshOrGroupFilter = new SMESH_LogicalFilter( aListOfFilters, SMESH_LogicalFilter::LO_OR );
-  
+  SMESH_TypeFilter* aMeshOrSubMeshFilter = new SMESH_TypeFilter (MESHorSUBMESH);
+  SMESH_TypeFilter* aSmeshGroupFilter    = new SMESH_TypeFilter (GROUP);
+
+  QPtrList<SUIT_SelectionFilter> aListOfFilters;
+  if (aMeshOrSubMeshFilter) aListOfFilters.append(aMeshOrSubMeshFilter);
+  if (aSmeshGroupFilter)    aListOfFilters.append(aSmeshGroupFilter);
+
+  myMeshOrSubMeshOrGroupFilter =
+    new SMESH_LogicalFilter(aListOfFilters, SMESH_LogicalFilter::LO_OR);
+
   Init();
 
   /* signals and slots connections */
-  connect( buttonOk, SIGNAL( clicked() ),     this, SLOT( ClickOnOk() ) );
-  connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ) ;
-  connect( buttonApply, SIGNAL( clicked() ), this, SLOT(ClickOnApply() ) );
-  connect( GroupConstructors, SIGNAL(clicked(int) ), SLOT( ConstructorsClicked(int) ) );
-  
-  connect( SelectElementsButton, SIGNAL (clicked() ),   this, SLOT( SetEditCurrentArgument() ) ) ;
-  connect( SelectButton1, SIGNAL (clicked() ),   this, SLOT( SetEditCurrentArgument() ) ) ;
-  connect( SelectButton2, SIGNAL (clicked() ),   this, SLOT( SetEditCurrentArgument() ) ) ;
-
-  connect( mySMESHGUI, SIGNAL ( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ;
-  connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
+  connect(buttonOk, SIGNAL(clicked()),     this, SLOT(ClickOnOk()));
+  connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel()));
+  connect(buttonApply, SIGNAL(clicked()),  this, SLOT(ClickOnApply()));
+  connect(GroupConstructors, SIGNAL(clicked(int)), SLOT(ConstructorsClicked(int)));
+
+  connect(SelectElementsButton, SIGNAL (clicked()), this, SLOT(SetEditCurrentArgument()));
+  connect(SelectButton1,        SIGNAL (clicked()), this, SLOT(SetEditCurrentArgument()));
+  connect(SelectButton2,        SIGNAL (clicked()), this, SLOT(SetEditCurrentArgument()));
+
+  connect(mySMESHGUI, SIGNAL (SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog()));
+  connect(mySelectionMgr, SIGNAL(currentSelectionChanged()),   this, SLOT(SelectionIntoArgument()));
   /* to close dialog if study change */
-  connect( mySMESHGUI, SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ) ;
-  connect( LineEditElements, SIGNAL( textChanged( const QString& )),
-           SLOT( onTextChange( const QString& )));
-  connect( CheckBoxMesh, SIGNAL( toggled( bool )),
-           SLOT( onSelectMesh( bool )));
-  
+  connect(mySMESHGUI,       SIGNAL (SignalCloseAllDialogs()), this, SLOT(ClickOnCancel()));
+  connect(LineEditElements, SIGNAL(textChanged(const QString&)),    SLOT(onTextChange(const QString&)));
+  connect(CheckBoxMesh,     SIGNAL(toggled(bool)),                  SLOT(onSelectMesh(bool)));
+
   /* Move widget on the botton right corner of main widget */
-  int x, y ;
-  mySMESHGUI->DefineDlgPosition( this, x, y ) ;
-  this->move( x, y ) ;
-  this->show() ; /* displays Dialog */
+  int x, y;
+  mySMESHGUI->DefineDlgPosition(this, x, y);
+  this->move(x, y);
+  this->show(); /* displays Dialog */
 
   ConstructorsClicked(0);
+  resize(0,0); // ??
 }
 
 //=================================================================================
@@ -299,106 +312,101 @@ SMESHGUI_TranslationDlg::~SMESHGUI_TranslationDlg()
   // no need to delete child widgets, Qt does it all for us
 }
 
-
 //=================================================================================
 // function : Init()
 // purpose  :
 //=================================================================================
-void SMESHGUI_TranslationDlg::Init( bool ResetControls )
+void SMESHGUI_TranslationDlg::Init (bool ResetControls)
 {
   myBusy = false;
-  
+
   myEditCurrentArgument = 0;
   LineEditElements->clear();
   myElementsId = "";
   myNbOkElements = 0;
 
-  buttonOk->setEnabled( false );
-  buttonApply->setEnabled( false );
-  
-  myActor     = 0;
+  buttonOk->setEnabled(false);
+  buttonApply->setEnabled(false);
+
+  myActor = 0;
   myMesh = SMESH::SMESH_Mesh::_nil();
 
-  if( ResetControls )
-    {
-      SpinBox1_1->SetValue(0.0);
-      SpinBox1_2->SetValue(0.0);
-      SpinBox1_3->SetValue(0.0);
-      SpinBox2_1->SetValue(0.0);
-      SpinBox2_2->SetValue(0.0);
-      SpinBox2_3->SetValue(0.0);
-      
-      CheckBoxCopy->setChecked(false);
-      CheckBoxMesh->setChecked(false);
-      onSelectMesh( false );
-    }
+  if (ResetControls) {
+    SpinBox1_1->SetValue(0.0);
+    SpinBox1_2->SetValue(0.0);
+    SpinBox1_3->SetValue(0.0);
+    SpinBox2_1->SetValue(0.0);
+    SpinBox2_2->SetValue(0.0);
+    SpinBox2_3->SetValue(0.0);
+
+    CheckBoxCopy->setChecked(false);
+    CheckBoxMesh->setChecked(false);
+    onSelectMesh(false);
+  }
 }
 
-
 //=================================================================================
 // function : ConstructorsClicked()
 // purpose  : Radio button management
 //=================================================================================
-void SMESHGUI_TranslationDlg::ConstructorsClicked(int constructorId)
+void SMESHGUI_TranslationDlg::ConstructorsClicked (int constructorId)
 {
-  disconnect(mySelection, 0, this, 0);
-  
-  switch(constructorId)
+  disconnect(mySelectionMgr, 0, this, 0);
+
+  switch (constructorId) {
+  case 0:
     {
-    case 0 :
-      { 
-       TextLabel1->setText( tr( "SMESH_POINT_1" ) );
-       TextLabel1_1->setText( tr( "SMESH_X" ) );
-       TextLabel1_2->setText( tr( "SMESH_Y" ) );
-       TextLabel1_3->setText( tr( "SMESH_Z" ) );
-
-       SelectButton1->show();
-       TextLabel2->show();
-       SelectButton2->show();
-       TextLabel2_1->show();
-       SpinBox2_1->show();
-       TextLabel2_2->show();
-       SpinBox2_2->show();
-       TextLabel2_3->show();
-       SpinBox2_3->show();
-       break;
-      }
-    case 1 :
-      {
-       TextLabel1->setText( tr( "SMESH_VECTOR" ) );
-       TextLabel1_1->setText( tr( "SMESH_DX" ) );
-       TextLabel1_2->setText( tr( "SMESH_DY" ) );
-       TextLabel1_3->setText( tr( "SMESH_DZ" ) );
-
-       SelectButton1->hide();
-       TextLabel2->hide();
-       SelectButton2->hide();
-       TextLabel2_1->hide();
-       SpinBox2_1->hide();
-       TextLabel2_2->hide();
-       SpinBox2_2->hide();
-       TextLabel2_3->hide();
-       SpinBox2_3->hide();
-       break;
-      }
+      TextLabel1->setText(tr("SMESH_POINT_1"));
+      TextLabel1_1->setText(tr("SMESH_X"));
+      TextLabel1_2->setText(tr("SMESH_Y"));
+      TextLabel1_3->setText(tr("SMESH_Z"));
+
+      SelectButton1->show();
+      TextLabel2->show();
+      SelectButton2->show();
+      TextLabel2_1->show();
+      SpinBox2_1->show();
+      TextLabel2_2->show();
+      SpinBox2_2->show();
+      TextLabel2_3->show();
+      SpinBox2_3->show();
+      break;
     }
-  
-  if (myEditCurrentArgument != (QWidget*)LineEditElements)
+  case 1:
     {
-      SMESH::SetPointRepresentation(false);
-      if (!CheckBoxMesh->isChecked())
-       QAD_Application::getDesktop()->SetSelectionMode( CellSelection, true );
+      TextLabel1->setText(tr("SMESH_VECTOR"));
+      TextLabel1_1->setText(tr("SMESH_DX"));
+      TextLabel1_2->setText(tr("SMESH_DY"));
+      TextLabel1_3->setText(tr("SMESH_DZ"));
+
+      SelectButton1->hide();
+      TextLabel2->hide();
+      SelectButton2->hide();
+      TextLabel2_1->hide();
+      SpinBox2_1->hide();
+      TextLabel2_2->hide();
+      SpinBox2_2->hide();
+      TextLabel2_3->hide();
+      SpinBox2_3->hide();
+      break;
     }
-  
+  }
+
+  if (myEditCurrentArgument != (QWidget*)LineEditElements) {
+    SMESH::SetPointRepresentation(false);
+    if (!CheckBoxMesh->isChecked())
+
+      myViewWindow->SetSelectionMode( CellSelection );
+  }
+
   myEditCurrentArgument = (QWidget*)LineEditElements;
   LineEditElements->setFocus();
-  
+
   if (CheckBoxMesh->isChecked())
     onSelectMesh(true);
-  
-  connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
-}
 
+  connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
+}
 
 //=================================================================================
 // function : ClickOnApply()
@@ -406,51 +414,44 @@ void SMESHGUI_TranslationDlg::ConstructorsClicked(int constructorId)
 //=================================================================================
 void SMESHGUI_TranslationDlg::ClickOnApply()
 {
-  if (mySMESHGUI->ActiveStudyLocked())
+  if (mySMESHGUI->isActiveStudyLocked())
     return;
-  
-  if ( myNbOkElements)
-    {
-      QStringList aListElementsId = QStringList::split( " ", myElementsId, false);
-      
-      SMESH::long_array_var anElementsId = new SMESH::long_array;
-      
-      anElementsId->length( aListElementsId.count() );
-      for ( int i = 0; i < aListElementsId.count(); i++ )
-       anElementsId[i] = aListElementsId[i].toInt();
-
-      SMESH::DirStruct aVector;
-      if(GetConstructorId() == 0)
-       {
-         aVector.PS.x = SpinBox2_1->GetValue() - SpinBox1_1->GetValue();
-         aVector.PS.y = SpinBox2_2->GetValue() - SpinBox1_2->GetValue();
-         aVector.PS.z = SpinBox2_3->GetValue() - SpinBox1_3->GetValue();
-       }
-      else if(GetConstructorId() == 1)
-       {
-         aVector.PS.x = SpinBox1_1->GetValue();
-         aVector.PS.y = SpinBox1_2->GetValue();
-         aVector.PS.z = SpinBox1_3->GetValue();
-       }
-      
-      bool toCreateCopy = CheckBoxCopy->isChecked();
-      
-      try
-       {
-         SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
-         QApplication::setOverrideCursor(Qt::waitCursor);
-         aMeshEditor->Translate(anElementsId.inout(), aVector, toCreateCopy);
-         QApplication::restoreOverrideCursor();
-       }
-      catch( ... )
-       {
-       }
-      
-      mySelection->ClearIObjects();
-      SMESH::UpdateView();
-      Init( false );
-      ConstructorsClicked( GetConstructorId() );
+
+  if (myNbOkElements) {
+    QStringList aListElementsId = QStringList::split(" ", myElementsId, false);
+
+    SMESH::long_array_var anElementsId = new SMESH::long_array;
+
+    anElementsId->length(aListElementsId.count());
+    for (int i = 0; i < aListElementsId.count(); i++)
+      anElementsId[i] = aListElementsId[i].toInt();
+
+    SMESH::DirStruct aVector;
+    if (GetConstructorId() == 0) {
+      aVector.PS.x = SpinBox2_1->GetValue() - SpinBox1_1->GetValue();
+      aVector.PS.y = SpinBox2_2->GetValue() - SpinBox1_2->GetValue();
+      aVector.PS.z = SpinBox2_3->GetValue() - SpinBox1_3->GetValue();
+    } else if (GetConstructorId() == 1) {
+      aVector.PS.x = SpinBox1_1->GetValue();
+      aVector.PS.y = SpinBox1_2->GetValue();
+      aVector.PS.z = SpinBox1_3->GetValue();
     }
+
+    bool toCreateCopy = CheckBoxCopy->isChecked();
+
+    try {
+      SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
+      QApplication::setOverrideCursor(Qt::waitCursor);
+      aMeshEditor->Translate(anElementsId.inout(), aVector, toCreateCopy);
+      QApplication::restoreOverrideCursor();
+    } catch (...) {
+    }
+
+    mySelectionMgr->clearSelected();
+    SMESH::UpdateView();
+    Init(false);
+    ConstructorsClicked(GetConstructorId());
+  }
 }
 
 //=================================================================================
@@ -459,73 +460,87 @@ void SMESHGUI_TranslationDlg::ClickOnApply()
 //=================================================================================
 void SMESHGUI_TranslationDlg::ClickOnOk()
 {
-  ClickOnApply() ;
-  ClickOnCancel() ;
+  ClickOnApply();
+  ClickOnCancel();
 }
 
-       
 //=================================================================================
 // function : ClickOnCancel()
 // purpose  :
 //=================================================================================
 void SMESHGUI_TranslationDlg::ClickOnCancel()
 {
-  mySelection->ClearFilters();
-  mySelection->ClearIObjects();
+  disconnect(mySelectionMgr, 0, this, 0);
+  mySelectionMgr->clearFilters();
+  mySelectionMgr->clearSelected();
   SMESH::SetPointRepresentation(false);
-  QAD_Application::getDesktop()->SetSelectionMode( ActorSelection );
-  disconnect( mySelection, 0, this, 0 );
-  mySMESHGUI->ResetState() ;
-  reject() ;
+  myViewWindow->SetSelectionMode( ActorSelection );
+  mySMESHGUI->ResetState();
+  reject();
 }
 
 //=======================================================================
-//function : onTextChange
-//purpose  : 
+// function : onTextChange()
+// purpose  :
 //=======================================================================
-
-void SMESHGUI_TranslationDlg::onTextChange(const QString& theNewText)
+void SMESHGUI_TranslationDlg::onTextChange (const QString& theNewText)
 {
   QLineEdit* send = (QLineEdit*)sender();
 
-  if ( myBusy ) return;
+  if (myBusy) return;
   myBusy = true;
-  
+
   if (send == LineEditElements)
     myNbOkElements = 0;
-  
-  buttonOk->setEnabled( false );
-  buttonApply->setEnabled( false );
-  
+
+  buttonOk->setEnabled(false);
+  buttonApply->setEnabled(false);
+
   // hilight entered elements
   SMDS_Mesh* aMesh = 0;
-  if ( myActor )
+  if (myActor)
     aMesh = myActor->GetObject()->GetMesh();
-  
-  if ( aMesh ) {
-    mySelection->ClearIObjects();
-    mySelection->AddIObject( myActor->getIO() );
-    
-    QStringList aListId = QStringList::split( " ", theNewText, false);
-    
+
+  if (aMesh) {
+    //mySelectionMgr->clearSelected();
+    //mySelectionMgr->AddIObject(myActor->getIO());
+    SALOME_ListIO aList;
+    aList.Append(myActor->getIO());
+    mySelectionMgr->setSelectedObjects(aList, false);
+
+    TColStd_IndexedMapOfInteger selectedIndices;
+    TColStd_MapOfInteger newIndices;
+    mySelector->GetIndex( myActor->getIO(), selectedIndices );
+
+    QStringList aListId = QStringList::split(" ", theNewText, false);
+
     if (send == LineEditElements) {
-      for ( int i = 0; i < aListId.count(); i++ ) {
-       const SMDS_MeshElement * e = aMesh->FindElement( aListId[ i ].toInt() );
-       if ( e ) {
-         if ( !mySelection->IsIndexSelected( myActor->getIO(), e->GetID() ))
-           mySelection->AddOrRemoveIndex (myActor->getIO(), e->GetID(), true);
+      for (int i = 0; i < aListId.count(); i++) {
+       const SMDS_MeshElement * e = aMesh->FindElement(aListId[ i ].toInt());
+       if (e) {
+         //if (!mySelectionMgr->IsIndexSelected(myActor->getIO(), e->GetID())) {
+          if (selectedIndices.Add(e->GetID())) {
+           //mySelectionMgr->AddOrRemoveIndex (myActor->getIO(), e->GetID(), true);
+            newIndices.Add(e->GetID());
+          }
          myNbOkElements++;
        }
       }
+
+      if (newIndices.Extent() > 0){
+       mySelector->AddOrRemoveIndex( myActor->getIO(), newIndices, true );
+       myViewWindow->highlight( myActor->getIO(), true, true );
+      }
+
       myElementsId = theNewText;
     }
   }
-  
-  if ( myNbOkElements ) {
-    buttonOk->setEnabled( true );
-    buttonApply->setEnabled( true );
+
+  if (myNbOkElements) {
+    buttonOk->setEnabled(true);
+    buttonApply->setEnabled(true);
   }
-  
+
   myBusy = false;
 }
 
@@ -535,152 +550,139 @@ void SMESHGUI_TranslationDlg::onTextChange(const QString& theNewText)
 //=================================================================================
 void SMESHGUI_TranslationDlg::SelectionIntoArgument()
 {
-  if ( myBusy ) return;
-  
+  if (myBusy) return;
+
   // clear
   myActor = 0;
   QString aString = "";
 
   myBusy = true;
-  if (myEditCurrentArgument == (QWidget*)LineEditElements)
-    {
-      LineEditElements->setText( aString );
-      myNbOkElements = 0;
-      buttonOk->setEnabled( false );
-      buttonApply->setEnabled( false );
-    }
+  if (myEditCurrentArgument == (QWidget*)LineEditElements) {
+    LineEditElements->setText(aString);
+    myNbOkElements = 0;
+    buttonOk->setEnabled(false);
+    buttonApply->setEnabled(false);
+  }
   myBusy = false;
-  
-  if ( !GroupButtons->isEnabled() ) // inactive
+
+  if (!GroupButtons->isEnabled()) // inactive
     return;
-   
+
   // get selected mesh
-  
-  int nbSel = mySelection->IObjectCount();
-  if(nbSel != 1)
+  SALOME_ListIO aList;
+  mySelectionMgr->selectedObjects(aList,SVTK_Viewer::Type());
+
+  int nbSel = aList.Extent();
+  if (nbSel != 1)
     return;
-  
-  Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject();
+
+  Handle(SALOME_InteractiveObject) IO = aList.First();
   myMesh = SMESH::GetMeshByIO(IO);
-  if(myMesh->_is_nil())
+  if (myMesh->_is_nil())
     return;
-  
+
   myActor = SMESH::FindActorByObject(myMesh);
   if (!myActor)
     myActor = SMESH::FindActorByEntry(IO->getEntry());
   if (!myActor)
     return;
-    
+
   int aNbUnits = 0;
-  
-  if (myEditCurrentArgument == (QWidget*)LineEditElements)
-    {
-      myElementsId = "";
-      
-      if (CheckBoxMesh->isChecked())
-       {
-         SMESH::GetNameOfSelectedIObjects(mySelection, aString);
-       
-         if(!SMESH::IObjectToInterface<SMESH::SMESH_Mesh>(IO)->_is_nil()) //MESH
-           {
-             // get IDs from mesh
-             SMDS_Mesh* aSMDSMesh = myActor->GetObject()->GetMesh();
-             if (!aSMDSMesh)
-               return;
-             
-             for (int i = aSMDSMesh->MinElementID(); i <= aSMDSMesh->MaxElementID(); i++  )
-               {
-                 const SMDS_MeshElement * e = aSMDSMesh->FindElement( i );
-                 if ( e ) {
-                   myElementsId += QString(" %1").arg(i);
-                   aNbUnits++;
-                 }
-               }
-           }
-         else if (!SMESH::IObjectToInterface<SMESH::SMESH_subMesh>(IO)->_is_nil()) //SUBMESH
-           {
-             // get submesh
-             SMESH::SMESH_subMesh_var aSubMesh = SMESH::IObjectToInterface<SMESH::SMESH_subMesh>(IO) ;
-             
-             // get IDs from submesh
-             SMESH::long_array_var anElementsIds = new SMESH::long_array;
-             anElementsIds = aSubMesh->GetElementsId();
-             for ( int i = 0; i < anElementsIds->length(); i++ )
-               myElementsId += QString(" %1").arg(anElementsIds[i]);
-             aNbUnits = anElementsIds->length();
-           }
-         else // GROUP
-           {
-             // get smesh group
-             SMESH::SMESH_GroupBase_var aGroup =
-                SMESH::IObjectToInterface<SMESH::SMESH_GroupBase>(IO);
-             if (aGroup->_is_nil())
-               return;
-             
-             // get IDs from smesh group
-             SMESH::long_array_var anElementsIds = new SMESH::long_array;
-             anElementsIds = aGroup->GetListOfID();
-             for ( int i = 0; i < anElementsIds->length(); i++ )
-               myElementsId += QString(" %1").arg(anElementsIds[i]);
-             aNbUnits = anElementsIds->length();
-           }
-       }
-      else
-       {
-         aNbUnits = SMESH::GetNameOfSelectedElements(mySelection, aString) ;
-         myElementsId = aString;
-       }
-      
-      if(aNbUnits < 1)
-       return ;
-      
-      myNbOkElements = true;
+
+  if (myEditCurrentArgument == (QWidget*)LineEditElements) {
+    myElementsId = "";
+
+    if (CheckBoxMesh->isChecked()) {
+      SMESH::GetNameOfSelectedIObjects( mySelectionMgr, aString );
+
+      if (!SMESH::IObjectToInterface<SMESH::SMESH_Mesh>(IO)->_is_nil()) { //MESH
+        // get IDs from mesh
+        SMDS_Mesh* aSMDSMesh = myActor->GetObject()->GetMesh();
+        if (!aSMDSMesh)
+          return;
+
+        for (int i = aSMDSMesh->MinElementID(); i <= aSMDSMesh->MaxElementID(); i++) {
+          const SMDS_MeshElement * e = aSMDSMesh->FindElement(i);
+          if (e) {
+            myElementsId += QString(" %1").arg(i);
+            aNbUnits++;
+          }
+        }
+      } else if (!SMESH::IObjectToInterface<SMESH::SMESH_subMesh>(IO)->_is_nil()) { //SUBMESH
+        // get submesh
+        SMESH::SMESH_subMesh_var aSubMesh = SMESH::IObjectToInterface<SMESH::SMESH_subMesh>(IO);
+
+        // get IDs from submesh
+        SMESH::long_array_var anElementsIds = new SMESH::long_array;
+        anElementsIds = aSubMesh->GetElementsId();
+        for (int i = 0; i < anElementsIds->length(); i++) {
+          myElementsId += QString(" %1").arg(anElementsIds[i]);
+        }
+        aNbUnits = anElementsIds->length();
+      } else { // GROUP
+        // get smesh group
+        SMESH::SMESH_GroupBase_var aGroup =
+          SMESH::IObjectToInterface<SMESH::SMESH_GroupBase>(IO);
+        if (aGroup->_is_nil())
+          return;
+
+        // get IDs from smesh group
+        SMESH::long_array_var anElementsIds = new SMESH::long_array;
+        anElementsIds = aGroup->GetListOfID();
+        for (int i = 0; i < anElementsIds->length(); i++) {
+          myElementsId += QString(" %1").arg(anElementsIds[i]);
+        }
+        aNbUnits = anElementsIds->length();
+      }
+    } else {
+      aNbUnits = SMESH::GetNameOfSelectedElements(mySelector, myActor->getIO(), aString);
+      myElementsId = aString;
     }
-  else {
-    aNbUnits = SMESH::GetNameOfSelectedNodes(mySelection, aString);
-    if(aNbUnits != 1)
+
+    if (aNbUnits < 1)
+      return;
+
+    myNbOkElements = true;
+  } else {
+    aNbUnits = SMESH::GetNameOfSelectedNodes(mySelector, myActor->getIO(), aString);
+    if (aNbUnits != 1)
       return;
-    
+
     SMDS_Mesh* aMesh =  myActor->GetObject()->GetMesh();
     if (!aMesh)
       return;
-    
-    const SMDS_MeshNode * n = aMesh->FindNode( aString.toInt() );
-    if ( !n )
+
+    const SMDS_MeshNode * n = aMesh->FindNode(aString.toInt());
+    if (!n)
       return;
-    
+
     double x = n->X();
     double y = n->Y();
     double z = n->Z();
-    
-    if (myEditCurrentArgument == (QWidget*)SpinBox1_1)
-      {
-       SpinBox1_1->SetValue(x);
-       SpinBox1_2->SetValue(y);
-       SpinBox2_3->SetValue(z);
-      }
-    else if (myEditCurrentArgument == (QWidget*)SpinBox2_1)
-      {
-       SpinBox2_1->SetValue(x);
-       SpinBox2_2->SetValue(y);
-       SpinBox2_3->SetValue(z);
-      }
+
+    if (myEditCurrentArgument == (QWidget*)SpinBox1_1) {
+      SpinBox1_1->SetValue(x);
+      SpinBox1_2->SetValue(y);
+      SpinBox2_3->SetValue(z);
+    } else if (myEditCurrentArgument == (QWidget*)SpinBox2_1) {
+      SpinBox2_1->SetValue(x);
+      SpinBox2_2->SetValue(y);
+      SpinBox2_3->SetValue(z);
+    }
   }
-  
+
   myBusy = true;
   if (myEditCurrentArgument == (QWidget*)LineEditElements)
-    LineEditElements->setText( aString );
+    LineEditElements->setText(aString);
   myBusy = false;
-  
+
   // OK
-  if(myNbOkElements)
-    {
-      buttonOk->setEnabled( true );
-      buttonApply->setEnabled( true );
-    }
+  if (myNbOkElements) {
+    buttonOk->setEnabled(true);
+    buttonApply->setEnabled(true);
+  }
 }
 
-
 //=================================================================================
 // function : SetEditCurrentArgument()
 // purpose  :
@@ -688,38 +690,36 @@ void SMESHGUI_TranslationDlg::SelectionIntoArgument()
 void SMESHGUI_TranslationDlg::SetEditCurrentArgument()
 {
   QPushButton* send = (QPushButton*)sender();
-  
-  disconnect( mySelection, 0, this, 0 );
-  mySelection->ClearIObjects();
-  mySelection->ClearFilters();
-  
-  if(send == SelectElementsButton) {
+
+  disconnect(mySelectionMgr, 0, this, 0);
+  mySelectionMgr->clearSelected();
+  mySelectionMgr->clearFilters();
+
+  if (send == SelectElementsButton) {
     myEditCurrentArgument = (QWidget*)LineEditElements;
     SMESH::SetPointRepresentation(false);
-    if (CheckBoxMesh->isChecked())
-      {
-       QAD_Application::getDesktop()->SetSelectionMode( ActorSelection );
-       mySelection->AddFilter(myMeshOrSubMeshOrGroupFilter);
-      }
-    else
-      QAD_Application::getDesktop()->SetSelectionMode( CellSelection, true );
-  }
-  else if (send == SelectButton1)
-    {
-      myEditCurrentArgument = (QWidget*)SpinBox1_1;
-      SMESH::SetPointRepresentation(true);
-      QAD_Application::getDesktop()->SetSelectionMode( NodeSelection, true );
-    }
-  else if (send == SelectButton2)
-    {
-      myEditCurrentArgument = (QWidget*)SpinBox2_1;
-      SMESH::SetPointRepresentation(true);
-      QAD_Application::getDesktop()->SetSelectionMode( NodeSelection, true );
+    if (CheckBoxMesh->isChecked()) {
+      myViewWindow->SetSelectionMode( ActorSelection );
+      mySelectionMgr->installFilter(myMeshOrSubMeshOrGroupFilter);
+    } else {
+
+      myViewWindow->SetSelectionMode( CellSelection );
     }
-  
+  } else if (send == SelectButton1) {
+    myEditCurrentArgument = (QWidget*)SpinBox1_1;
+    SMESH::SetPointRepresentation(true);
+
+    myViewWindow->SetSelectionMode( NodeSelection );
+  } else if (send == SelectButton2) {
+    myEditCurrentArgument = (QWidget*)SpinBox2_1;
+    SMESH::SetPointRepresentation(true);
+
+    myViewWindow->SetSelectionMode( NodeSelection );
+  }
+
   myEditCurrentArgument->setFocus();
-  connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
-  SelectionIntoArgument() ;
+  connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
+  SelectionIntoArgument();
 }
 
 //=================================================================================
@@ -728,16 +728,15 @@ void SMESHGUI_TranslationDlg::SetEditCurrentArgument()
 //=================================================================================
 void SMESHGUI_TranslationDlg::DeactivateActiveDialog()
 {
-  if ( GroupConstructors->isEnabled() ) {
-    GroupConstructors->setEnabled(false) ;
-    GroupArguments->setEnabled(false) ;
-    GroupButtons->setEnabled(false) ;
-    mySMESHGUI->ResetState() ;    
-    mySMESHGUI->SetActiveDialogBox(0) ;
+  if (GroupConstructors->isEnabled()) {
+    GroupConstructors->setEnabled(false);
+    GroupArguments->setEnabled(false);
+    GroupButtons->setEnabled(false);
+    mySMESHGUI->ResetState();
+    mySMESHGUI->SetActiveDialogBox(0);
   }
 }
 
-
 //=================================================================================
 // function : ActivateThisDialog()
 // purpose  :
@@ -745,97 +744,87 @@ void SMESHGUI_TranslationDlg::DeactivateActiveDialog()
 void SMESHGUI_TranslationDlg::ActivateThisDialog()
 {
   /* Emit a signal to deactivate the active dialog */
-  mySMESHGUI->EmitSignalDeactivateDialog() ;   
-  GroupConstructors->setEnabled(true) ;
-  GroupArguments->setEnabled(true) ;
-  GroupButtons->setEnabled(true) ;
-  
-  mySMESHGUI->SetActiveDialogBox( (QDialog*)this ) ;
-
-  QAD_Application::getDesktop()->SetSelectionMode( CellSelection, true );
+  mySMESHGUI->EmitSignalDeactivateDialog();
+  GroupConstructors->setEnabled(true);
+  GroupArguments->setEnabled(true);
+  GroupButtons->setEnabled(true);
+
+  mySMESHGUI->SetActiveDialogBox((QDialog*)this);
+
+  myViewWindow->SetSelectionMode( CellSelection );
+
   SelectionIntoArgument();
 }
 
-
 //=================================================================================
 // function : enterEvent()
 // purpose  :
 //=================================================================================
-void SMESHGUI_TranslationDlg::enterEvent(QEvent* e)
+void SMESHGUI_TranslationDlg::enterEvent (QEvent*)
 {
-  if ( GroupConstructors->isEnabled() )
-    return ;  
-  ActivateThisDialog() ;
+  if (!GroupConstructors->isEnabled())
+    ActivateThisDialog();
 }
 
-
 //=================================================================================
 // function : closeEvent()
 // purpose  :
 //=================================================================================
-void SMESHGUI_TranslationDlg::closeEvent( QCloseEvent* e )
+void SMESHGUI_TranslationDlg::closeEvent (QCloseEvent*)
 {
   /* same than click on cancel button */
-  this->ClickOnCancel() ;
+  this->ClickOnCancel();
 }
 
-
 //=======================================================================
 //function : hideEvent
 //purpose  : caused by ESC key
 //=======================================================================
-
-void SMESHGUI_TranslationDlg::hideEvent ( QHideEvent * e )
+void SMESHGUI_TranslationDlg::hideEvent (QHideEvent*)
 {
-  if ( !isMinimized() )
+  if (!isMinimized())
     ClickOnCancel();
 }
 
-
 //=======================================================================
 //function : onSelectMesh
 //purpose  :
 //=======================================================================
-void SMESHGUI_TranslationDlg::onSelectMesh ( bool toSelectMesh )
+void SMESHGUI_TranslationDlg::onSelectMesh (bool toSelectMesh)
 {
   if (toSelectMesh)
-    TextLabelElements->setText( tr( "SMESH_NAME" ) );
+    TextLabelElements->setText(tr("SMESH_NAME"));
   else
-    TextLabelElements->setText( tr( "SMESH_ID_ELEMENTS" ) );
-  
-  if (myEditCurrentArgument != LineEditElements)
-    {
-      LineEditElements->clear();
-      return;
-    }
-  
-  mySelection->ClearFilters() ;
+    TextLabelElements->setText(tr("SMESH_ID_ELEMENTS"));
+
+  if (myEditCurrentArgument != LineEditElements) {
+    LineEditElements->clear();
+    return;
+  }
+
+  mySelectionMgr->clearFilters();
   SMESH::SetPointRepresentation(false);
-  
-  if (toSelectMesh)
-    {
-      QAD_Application::getDesktop()->SetSelectionMode( ActorSelection );
-      mySelection->AddFilter(myMeshOrSubMeshOrGroupFilter);
-      LineEditElements->setReadOnly(true);
-    }
-  else
-    {
-      QAD_Application::getDesktop()->SetSelectionMode( CellSelection, true );
-      LineEditElements->setReadOnly(false);
-      onTextChange(LineEditElements->text());
-    }
-  
+
+  if (toSelectMesh) {
+    myViewWindow->SetSelectionMode( ActorSelection );
+    mySelectionMgr->installFilter(myMeshOrSubMeshOrGroupFilter);
+    LineEditElements->setReadOnly(true);
+  } else {
+    myViewWindow->SetSelectionMode( CellSelection );
+    LineEditElements->setReadOnly(false);
+    onTextChange(LineEditElements->text());
+  }
+
   SelectionIntoArgument();
 }
 
-
 //=================================================================================
 // function : GetConstructorId()
-// purpose  : 
+// purpose  :
 //=================================================================================
 int SMESHGUI_TranslationDlg::GetConstructorId()
-{ 
-  if ( GroupConstructors != NULL && GroupConstructors->selected() != NULL )
-    return GroupConstructors->id( GroupConstructors->selected() );
+{
+  if (GroupConstructors != NULL && GroupConstructors->selected() != NULL)
+    return GroupConstructors->id(GroupConstructors->selected());
   return -1;
 }
index b53e8948fd1961b15106c65da3f402071c7aae3f..da9c93e7d309a7f554b46752d6209fd8313418a8 100644 (file)
@@ -29,7 +29,8 @@
 #ifndef DIALOGBOX_TRANSLATION_H
 #define DIALOGBOX_TRANSLATION_H
 
-#include "SALOME_Selection.h"
+#include "SalomeApp_SelectionMgr.h"
+
 #include "SMESH_LogicalFilter.hxx"
 
 // QT Includes
@@ -46,6 +47,8 @@ class QCheckBox;
 class SMESHGUI;
 class SMESHGUI_SpinBox;
 class SMESH_Actor;
+class SVTK_ViewWindow;
+class SVTK_Selector;
 
 // IDL Headers
 #include <SALOMEconfig.h>
@@ -61,28 +64,33 @@ class SMESHGUI_TranslationDlg : public QDialog
     Q_OBJECT
 
 public:
-    SMESHGUI_TranslationDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 );
+    SMESHGUI_TranslationDlg( SMESHGUI*,
+                            const char* name = 0,
+                            bool modal = FALSE,
+                            WFlags fl = 0);
     ~SMESHGUI_TranslationDlg();
 
 private:
-
-    void Init( bool ResetControls = true ) ;
-    void closeEvent( QCloseEvent* e ) ;
-    void enterEvent ( QEvent * ) ;                          /* mouse enter the QWidget */
-    void hideEvent ( QHideEvent * );                        /* ESC key */
+    void Init (bool ResetControls = true);
+    void closeEvent (QCloseEvent*);
+    void enterEvent (QEvent*);                             /* mouse enter the QWidget */
+    void hideEvent (QHideEvent*);                          /* ESC key */
     int GetConstructorId();
 
-    SMESHGUI*                     mySMESHGUI ;              /* Current SMESHGUI object */
-    SALOME_Selection*             mySelection ;             /* User shape selection */
+    SMESHGUI*                     mySMESHGUI;              /* Current SMESHGUI object */
+    SalomeApp_SelectionMgr*       mySelectionMgr;          /* User shape selection */
     QString                       myElementsId;
-    int                           myNbOkElements ;          /* to check when elements are defined */
-    
+    int                           myNbOkElements;          /* to check when elements are defined */
+
+    SVTK_ViewWindow*              myViewWindow;
+    SVTK_Selector*                mySelector;
+
     QWidget*                      myEditCurrentArgument;
-   
+
     bool                          myBusy;
     SMESH::SMESH_Mesh_var         myMesh;
     SMESH_Actor*                  myActor;
-    Handle(SMESH_LogicalFilter)   myMeshOrSubMeshOrGroupFilter;
+    SMESH_LogicalFilter*          myMeshOrSubMeshOrGroupFilter;
     
     QButtonGroup* GroupConstructors;
     QRadioButton* RadioButton1;
index c7fc33a565b679c75c4942f6d3be8882e480279e..b121d1113c0ae9a1d2e5f8b4c7ce0c2ec19202c1 100644 (file)
@@ -1,23 +1,23 @@
 //  SMESH SMESHGUI : GUI for SMESH component
 //
 //  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
-// 
-//  This library is free software; you can redistribute it and/or 
-//  modify it under the terms of the GNU Lesser General Public 
-//  License as published by the Free Software Foundation; either 
-//  version 2.1 of the License. 
-// 
-//  This library is distributed in the hope that it will be useful, 
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of 
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
-//  Lesser General Public License for more details. 
-// 
-//  You should have received a copy of the GNU Lesser General Public 
-//  License along with this library; if not, write to the Free Software 
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
-// 
-//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
 //
 //
 //
 #include "SMESHGUI.h"
 #include "SMESHGUI_VTKUtils.h"
 
+#include "SMESH_Actor.h"
+
+#include "SUIT_OverrideCursor.h"
+
+#include "SALOME_ListIO.hxx"
+#include "SALOME_ListIteratorOfListIO.hxx"
+#include "SALOME_InteractiveObject.hxx"
+
+#include "SalomeApp_Study.h"
+#include "SalomeApp_SelectionMgr.h"
+
+#include "SVTK_ViewWindow.h"
+
 // QT Includes
 #include <qlabel.h>
 #include <qpushbutton.h>
 #include <qlayout.h>
 #include <qgroupbox.h>
 
-#include "VTKViewer_ViewFrame.h"
-#include "QAD_RightFrame.h"
-#include "QAD_WaitCursor.h"
-#include "SALOME_ListIteratorOfListIO.hxx"
-#include "SMESH_Actor.h"
-#include "SALOME_Selection.h"
-#include "SALOME_InteractiveObject.hxx"
-
 using namespace std;
 
 //=================================================================================
 // class    : SMESHGUI_TransparencyDlg()
-// purpose  : 
+// purpose  :
 //
 //=================================================================================
-SMESHGUI_TransparencyDlg::SMESHGUI_TransparencyDlgQWidget* parent,
+SMESHGUI_TransparencyDlg::SMESHGUI_TransparencyDlg (QWidget* parent,
                                                    const char* name,
                                                    bool modal,
-                                                   WFlags fl )
-  : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | WDestructiveClose )
+                                                   WFlags fl)
+     : QDialog(parent, name, modal, WStyle_Customize | WStyle_NormalBorder |
+               WStyle_Title | WStyle_SysMenu | WDestructiveClose)
 {
-  if ( !name )
-    setName( "SMESHGUI_TransparencyDlg" );
-  setCaption( tr( "SMESH_TRANSPARENCY_TITLE"  ) );
-  setSizeGripEnabled( TRUE );
-  QGridLayout* SMESHGUI_TransparencyDlgLayout = new QGridLayout( this ); 
-  SMESHGUI_TransparencyDlgLayout->setSpacing( 6 );
-  SMESHGUI_TransparencyDlgLayout->setMargin( 11 );
+  if (!name)
+    setName("SMESHGUI_TransparencyDlg");
+  setCaption(tr("SMESH_TRANSPARENCY_TITLE" ));
+  setSizeGripEnabled(TRUE);
+  QGridLayout* SMESHGUI_TransparencyDlgLayout = new QGridLayout(this);
+  SMESHGUI_TransparencyDlgLayout->setSpacing(6);
+  SMESHGUI_TransparencyDlgLayout->setMargin(11);
 
   /*************************************************************************/
-  QGroupBox* GroupC1 = new QGroupBox( this, "GroupC1" );
-  GroupC1->setColumnLayout(0, Qt::Vertical );
-  GroupC1->layout()->setSpacing( 0 );
-  GroupC1->layout()->setMargin( 0 );
-  QGridLayout* GroupC1Layout = new QGridLayout( GroupC1->layout() );
-  GroupC1Layout->setAlignment( Qt::AlignTop );
-  GroupC1Layout->setSpacing( 6 );
-  GroupC1Layout->setMargin( 11 );
-  
-  TextLabelTransparent = new QLabel( GroupC1, "TextLabelTransparent" );
-  TextLabelTransparent->setText( tr( "SMESH_TRANSPARENCY_TRANSPARENT"  ) );
-  TextLabelTransparent->setAlignment( AlignLeft );
-  GroupC1Layout->addWidget( TextLabelTransparent, 0, 0 );
-  
-  ValueLab = new QLabel( GroupC1, "ValueLab" );
-  ValueLab->setAlignment( AlignCenter );
-  ValueLab->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
-  QFont fnt = ValueLab->font(); fnt.setBold( true ); ValueLab->setFont( fnt );
-  GroupC1Layout->addWidget( ValueLab, 0, 1 );
-
-  TextLabelOpaque = new QLabel( GroupC1, "TextLabelOpaque" );
-  TextLabelOpaque->setText( tr( "SMESH_TRANSPARENCY_OPAQUE"  ) );
-  TextLabelOpaque->setAlignment( AlignRight );
-  GroupC1Layout->addWidget( TextLabelOpaque, 0, 2 );
-  
-  Slider1 = new QSlider( 0, 10, 1, 5, Horizontal, GroupC1, "Slider1" );
-  Slider1->setFocusPolicy( QWidget::NoFocus );
-  Slider1->setMinimumSize( 300, 0 );
-  Slider1->setTickmarks( QSlider::Above );
-  Slider1->setTickInterval( 10 );
-  Slider1->setTracking( true );
-  Slider1->setMinValue( 0 ) ;
-  Slider1->setMaxValue( 100 );
-  Slider1->setLineStep( 1 );
-  Slider1->setPageStep( 10 );
-  GroupC1Layout->addMultiCellWidget( Slider1, 1, 1, 0, 2 );
+  QGroupBox* GroupC1 = new QGroupBox(this, "GroupC1");
+  GroupC1->setColumnLayout(0, Qt::Vertical);
+  GroupC1->layout()->setSpacing(0);
+  GroupC1->layout()->setMargin(0);
+  QGridLayout* GroupC1Layout = new QGridLayout(GroupC1->layout());
+  GroupC1Layout->setAlignment(Qt::AlignTop);
+  GroupC1Layout->setSpacing(6);
+  GroupC1Layout->setMargin(11);
+
+  TextLabelTransparent = new QLabel(GroupC1, "TextLabelTransparent");
+  TextLabelTransparent->setText(tr("SMESH_TRANSPARENCY_TRANSPARENT" ));
+  TextLabelTransparent->setAlignment(AlignLeft);
+  GroupC1Layout->addWidget(TextLabelTransparent, 0, 0);
+
+  ValueLab = new QLabel(GroupC1, "ValueLab");
+  ValueLab->setAlignment(AlignCenter);
+  ValueLab->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed));
+  QFont fnt = ValueLab->font(); fnt.setBold(true); ValueLab->setFont(fnt);
+  GroupC1Layout->addWidget(ValueLab, 0, 1);
+
+  TextLabelOpaque = new QLabel(GroupC1, "TextLabelOpaque");
+  TextLabelOpaque->setText(tr("SMESH_TRANSPARENCY_OPAQUE" ));
+  TextLabelOpaque->setAlignment(AlignRight);
+  GroupC1Layout->addWidget(TextLabelOpaque, 0, 2);
+
+  Slider1 = new QSlider(0, 10, 1, 5, Horizontal, GroupC1, "Slider1");
+  Slider1->setFocusPolicy(QWidget::NoFocus);
+  Slider1->setMinimumSize(300, 0);
+  Slider1->setTickmarks(QSlider::Above);
+  Slider1->setTickInterval(10);
+  Slider1->setTracking(true);
+  Slider1->setMinValue(0);
+  Slider1->setMaxValue(100);
+  Slider1->setLineStep(1);
+  Slider1->setPageStep(10);
+  GroupC1Layout->addMultiCellWidget(Slider1, 1, 1, 0, 2);
 
   /*************************************************************************/
-  QGroupBox* GroupButtons = new QGroupBox( this, "GroupButtons" );
-  GroupButtons->setColumnLayout(0, Qt::Vertical );
-  GroupButtons->layout()->setSpacing( 0 );
-  GroupButtons->layout()->setMargin( 0 );
-  QGridLayout* GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
-  GroupButtonsLayout->setAlignment( Qt::AlignTop );
-  GroupButtonsLayout->setSpacing( 6 );
-  GroupButtonsLayout->setMargin( 11 );
-
-  buttonOk = new QPushButton( GroupButtons, "buttonOk" );
-  buttonOk->setText( tr( "SMESH_BUT_CLOSE" ) );
-  buttonOk->setAutoDefault( TRUE );
-  buttonOk->setDefault( TRUE );
-  GroupButtonsLayout->addItem( new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum), 0, 0 );
-  GroupButtonsLayout->addWidget( buttonOk, 0, 1 );
-  GroupButtonsLayout->addItem( new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum), 0, 2 );
-
-  SMESHGUI_TransparencyDlgLayout->addWidget( GroupC1,      0, 0 );
-  SMESHGUI_TransparencyDlgLayout->addWidget( GroupButtons, 1, 0 );
-  
-  mySelection = SALOME_Selection::Selection( SMESHGUI::GetSMESHGUI()->GetActiveStudy()->getSelection());
+  QGroupBox* GroupButtons = new QGroupBox(this, "GroupButtons");
+  GroupButtons->setColumnLayout(0, Qt::Vertical);
+  GroupButtons->layout()->setSpacing(0);
+  GroupButtons->layout()->setMargin(0);
+  QGridLayout* GroupButtonsLayout = new QGridLayout(GroupButtons->layout());
+  GroupButtonsLayout->setAlignment(Qt::AlignTop);
+  GroupButtonsLayout->setSpacing(6);
+  GroupButtonsLayout->setMargin(11);
+
+  buttonOk = new QPushButton(GroupButtons, "buttonOk");
+  buttonOk->setText(tr("SMESH_BUT_CLOSE"));
+  buttonOk->setAutoDefault(TRUE);
+  buttonOk->setDefault(TRUE);
+  GroupButtonsLayout->addItem(new QSpacerItem(20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum), 0, 0);
+  GroupButtonsLayout->addWidget(buttonOk, 0, 1);
+  GroupButtonsLayout->addItem(new QSpacerItem(20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum), 0, 2);
+
+  SMESHGUI_TransparencyDlgLayout->addWidget(GroupC1,      0, 0);
+  SMESHGUI_TransparencyDlgLayout->addWidget(GroupButtons, 1, 0);
+
+  mySelectionMgr = SMESHGUI::selectionMgr();
 
   // Initial state
-  this->onSelectionChanged() ;
-  
+  this->onSelectionChanged();
+
   // signals and slots connections : after ValueHasChanged()
-  connect( buttonOk, SIGNAL( clicked() ),         this, SLOT( ClickOnOk() ) );
-  connect( Slider1,  SIGNAL( valueChanged(int) ), this, SLOT( SetTransparency() ) );
-  connect( Slider1,  SIGNAL( sliderMoved(int) ),  this, SLOT( ValueHasChanged() ) );
-  connect( SMESHGUI::GetSMESHGUI(), SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( ClickOnOk() ) ) ;
-  connect( mySelection,  SIGNAL( currentSelectionChanged() ), this, SLOT( onSelectionChanged() ) );
-  
+  connect(buttonOk, SIGNAL(clicked()),         this, SLOT(ClickOnOk()));
+  connect(Slider1,  SIGNAL(valueChanged(int)), this, SLOT(SetTransparency()));
+  connect(Slider1,  SIGNAL(sliderMoved(int)),  this, SLOT(ValueHasChanged()));
+  connect(SMESHGUI::GetSMESHGUI(), SIGNAL (SignalCloseAllDialogs()), this, SLOT(ClickOnOk()));
+  connect(mySelectionMgr,  SIGNAL(currentSelectionChanged()), this, SLOT(onSelectionChanged()));
+
   /* Move widget on the botton right corner of main widget */
-  int x, y ;
-  SMESHGUI::GetSMESHGUI()->DefineDlgPosition( this, x, y ) ;
-  this->move( x, y ) ;
+  int x, y;
+  SMESHGUI::GetSMESHGUI()->DefineDlgPosition(this, x, y);
+  this->move(x, y);
   this->show();
 }
 
-
 //=================================================================================
 // function : ~SMESHGUI_TransparencyDlg()
 // purpose  :
@@ -155,7 +160,6 @@ SMESHGUI_TransparencyDlg::~SMESHGUI_TransparencyDlg()
   // no need to delete child widgets, Qt does it all for us
 }
 
-
 //=======================================================================
 // function : ClickOnOk()
 // purpose  :
@@ -165,7 +169,6 @@ void SMESHGUI_TransparencyDlg::ClickOnOk()
   close();
 }
 
-
 //=================================================================================
 // function : SetTransparency()
 // purpose  : Called when value of slider change
@@ -173,17 +176,21 @@ void SMESHGUI_TransparencyDlg::ClickOnOk()
 //=================================================================================
 void SMESHGUI_TransparencyDlg::SetTransparency()
 {
-  if ( SMESHGUI::GetSMESHGUI()->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_VTK ) {
-    QAD_WaitCursor wc;
-    float opacity = this->Slider1->value() / 100. ;
-    SALOME_ListIteratorOfListIO It( mySelection->StoredIObjects() );
-    for( ;It.More(); It.Next() ) {
+  if (SVTK_ViewWindow* aVTKViewWindow = SMESH::GetCurrentVtkView()) {
+    SUIT_OverrideCursor wc;
+    float opacity = this->Slider1->value() / 100.;
+
+    SALOME_ListIO aList;
+    mySelectionMgr->selectedObjects(aList);
+
+    SALOME_ListIteratorOfListIO It (aList);
+    for (;It.More(); It.Next()) {
       Handle(SALOME_InteractiveObject) IOS = It.Value();
       SMESH_Actor* anActor = SMESH::FindActorByEntry(IOS->getEntry());
-      if ( anActor )
-       anActor->SetOpacity( opacity );
+      if (anActor)
+       anActor->SetOpacity(opacity);
     }
-    SMESHGUI::GetSMESHGUI()->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame()->Repaint();
+    aVTKViewWindow->Repaint();
   }
   ValueHasChanged();
 }
@@ -194,7 +201,7 @@ void SMESHGUI_TransparencyDlg::SetTransparency()
 //=================================================================================
 void SMESHGUI_TransparencyDlg::ValueHasChanged()
 {
-  ValueLab->setText( QString::number( this->Slider1->value() ) + "%" );
+  ValueLab->setText(QString::number(this->Slider1->value()) + "%");
 }
 
 //=================================================================================
@@ -203,38 +210,42 @@ void SMESHGUI_TransparencyDlg::ValueHasChanged()
 //=================================================================================
 void SMESHGUI_TransparencyDlg::onSelectionChanged()
 {
-  if ( SMESHGUI::GetSMESHGUI()->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_VTK ) {
+  if (SVTK_ViewWindow* aVTKViewWindow = SMESH::GetCurrentVtkView()) {
     int opacity = 100;
-    if ( mySelection->IObjectCount() == 1 ) {
-      Handle(SALOME_InteractiveObject) FirstIOS = mySelection->firstIObject();
-      if( !FirstIOS.IsNull() ) {
-       SMESH_Actor* anActor = SMESH::FindActorByEntry( FirstIOS->getEntry() );
-       if ( anActor )
-         opacity = int( anActor->GetOpacity() * 100. + 0.5 );
+
+    SALOME_ListIO aList;
+    mySelectionMgr->selectedObjects(aList);
+
+    if (aList.Extent() == 1) {
+      Handle(SALOME_InteractiveObject) FirstIOS = aList.First();
+      if (!FirstIOS.IsNull()) {
+       SMESH_Actor* anActor = SMESH::FindActorByEntry(FirstIOS->getEntry());
+       if (anActor)
+         opacity = int(anActor->GetOpacity() * 100. + 0.5);
       }
-    }
-    else if ( mySelection->IObjectCount() > 1 ) {
-      SALOME_ListIteratorOfListIO It( mySelection->StoredIObjects() );
+    } else if (aList.Extent() > 1) {
+      SALOME_ListIteratorOfListIO It (aList);
       int setOp = -1;
-      for ( ; It.More(); It.Next() ) {
+      for (; It.More(); It.Next()) {
        Handle(SALOME_InteractiveObject) IO = It.Value();
-       if( !IO.IsNull() ) {
-         SMESH_Actor* anActor = SMESH::FindActorByEntry( IO->getEntry() );
-         if ( anActor ) {
-           int op = int( anActor->GetOpacity() * 100. + 0.5 );
-           if ( setOp < 0 )
+       if (!IO.IsNull()) {
+         SMESH_Actor* anActor = SMESH::FindActorByEntry(IO->getEntry());
+         if (anActor) {
+           int op = int(anActor->GetOpacity() * 100. + 0.5);
+           if (setOp < 0)
              setOp = op;
-           else if ( setOp != op ) {
+           else if (setOp != op) {
              setOp = 100;
              break;
            }
          }
        }
       }
-      if ( setOp >= 0 )
+      if (setOp >= 0)
        opacity = setOp;
+    } else {
     }
-    Slider1->setValue( opacity ) ;
+    Slider1->setValue(opacity);
   }
   ValueHasChanged();
 }
index 2bc7767fabaf62b3999c2806dc9bb031126440de..211f06ee549a4cf6e6dd1a9a8ba7dd3b897ac6dc 100644 (file)
@@ -35,7 +35,7 @@
 class QLabel;
 class QPushButton;
 class QSlider;
-class SALOME_Selection;
+class SalomeApp_SelectionMgr;
 
 //=================================================================================
 // class    : SMESHGUI_TransparencyDlg
@@ -55,7 +55,7 @@ public:
 
 private :
 
-    SALOME_Selection* mySelection;
+    SalomeApp_SelectionMgr* mySelectionMgr;
 
     QPushButton*      buttonOk;
     QLabel*           TextLabelOpaque;
@@ -66,10 +66,9 @@ private :
 public slots:
       
     void ClickOnOk();
-    void ValueHasChanged() ;
+    void ValueHasChanged();
     void SetTransparency();
     void onSelectionChanged();
 };
 
 #endif // DIALOGBOX_TRANSPARENCYDLG_H
-
index e5579051513543e045792978f2d8d0fa635e872f..3b4976ea61c16e7e7de373eed84a403734b14a11 100644 (file)
@@ -1,20 +1,20 @@
 //  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 
-// 
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
 //  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
 
 
 
 #include "SMESHGUI_Utils.h"
 
-#include "QAD_Desktop.h"
+#include "OB_Browser.h"
+
+#include "SUIT_Desktop.h"
+#include "SUIT_Application.h"
+#include "SUIT_Session.h"
+
+#include "SalomeApp_SelectionMgr.h"
+#include "SalomeApp_Application.h"
+#include "SalomeApp_Module.h"
+#include "SalomeApp_Study.h"
+
+#include "SALOME_ListIO.hxx"
 
 #include "SALOMEconfig.h"
 #include CORBA_CLIENT_HEADER(GEOM_Gen)
-#include CORBA_CLIENT_HEADER(SALOMEDS_Attributes)
 
 #include "utilities.h"
 
-using namespace std;
+//using namespace std;
 
 namespace SMESH{
 
-  QAD_Study* GetActiveStudy(){
-    if(QAD_Desktop* aDesktop = QAD_Application::getDesktop())
-      return aDesktop->getActiveStudy();
-    return NULL;
+  SUIT_Desktop*
+  GetDesktop(const CAM_Module* theModule)
+  {
+    return theModule->application()->desktop();
+  }
+
+  SalomeApp_SelectionMgr*
+  GetSelectionMgr(const SalomeApp_Module* theModule)
+  {
+    return theModule->getApp()->selectionMgr();
   }
 
 
-  QAD_StudyFrame* GetActiveStudyFrame(){
-    if(QAD_Study* aStudy = GetActiveStudy())
-      return aStudy->getActiveStudyFrame();
-    return NULL;
+  _PTR(Study)
+  GetCStudy(const SalomeApp_Study* theStudy)
+  {
+    return theStudy->studyDS();
+  }
+
+  CORBA::Object_var 
+  DataOwnerToObject(const SalomeApp_DataOwnerPtr& theOwner)
+  {
+    CORBA::Object_var anObj;
+    if(theOwner){
+      const Handle(SALOME_InteractiveObject)& anIO = theOwner->IO();
+      if(!anIO.IsNull()){
+       if(anIO->hasEntry()){
+         _PTR(Study) aStudy = GetActiveStudyDocument();
+         _PTR(SObject) aSObj = aStudy->FindObjectID(anIO->getEntry());
+         anObj = SObjectToObject(aSObj,aStudy);
+       }
+      }
+    }
+    return anObj;
   }
 
 
-  SALOMEDS::Study_var GetActiveStudyDocument(){
-    if(QAD_Study* aStudy = GetActiveStudy())
-      return aStudy->getStudyDocument();
-    return SALOMEDS::Study::_nil();
+  SUIT_Study* GetActiveStudy()
+  {
+    SUIT_Application* app = SUIT_Session::session()->activeApplication();
+    if (app)
+      return app->activeStudy();
+    else
+      return NULL;
   }
 
+  SUIT_ViewWindow* GetActiveWindow()
+  {
+    SalomeApp_Application* app = dynamic_cast<SalomeApp_Application*>
+      (SUIT_Session::session()->activeApplication());
+    if (app && app->activeViewManager())
+      return app->activeViewManager()->getActiveView();
+    else
+      return NULL;
+  }
 
-  SALOMEDS::SObject_var FindSObject(CORBA::Object_ptr theObject){
-    if(!CORBA::is_nil(theObject)){
-      SALOMEDS::Study_var aStudy = GetActiveStudyDocument();
-      CORBA::String_var anIOR = aStudy->ConvertObjectToIOR(theObject);
-      if(strcmp(anIOR.in(),"") != 0)
-       return aStudy->FindObjectIOR(anIOR);
-    }
-    return SALOMEDS::SObject::_nil();
+  _PTR(Study) GetActiveStudyDocument()
+  {
+    SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>(GetActiveStudy());
+    if (aStudy)
+      return aStudy->studyDS();
+    else
+      return _PTR(Study)();
   }
 
+  _PTR(SObject) FindSObject (CORBA::Object_ptr theObject)
+  {
+    SalomeApp_Application* app = dynamic_cast<SalomeApp_Application*>
+      (SUIT_Session::session()->activeApplication());
+    if (app && !CORBA::is_nil(theObject)) {
+      if(_PTR(Study) aStudy = GetActiveStudyDocument()){
+       CORBA::String_var anIOR = app->orb()->object_to_string(theObject);
+       if (strcmp(anIOR.in(), "") != 0)
+         return aStudy->FindObjectIOR(anIOR.in());
+      }
+    }
+    return _PTR(SObject)();
+  }
 
-  void SetName(SALOMEDS::SObject_ptr theSObject, const char* theName){
-    using namespace SALOMEDS;
-    Study_var aStudy = GetActiveStudyDocument();
-    if(aStudy->GetProperties()->IsLocked())
+  void SetName (_PTR(SObject) theSObject, const char* theName)
+  {
+    _PTR(Study) aStudy = GetActiveStudyDocument();
+    if (aStudy->GetProperties()->IsLocked())
       return;
-    StudyBuilder_var aBuilder = aStudy->NewBuilder();
-    GenericAttribute_var anAttr = aBuilder->FindOrCreateAttribute(theSObject,"AttributeName");
-    AttributeName_var aName = AttributeName::_narrow(anAttr);
-    if(!aName->_is_nil())
+    _PTR(StudyBuilder) aBuilder = aStudy->NewBuilder();
+    _PTR(GenericAttribute) anAttr =
+      aBuilder->FindOrCreateAttribute(theSObject, "AttributeName");
+    _PTR(AttributeName) aName = anAttr;
+    if (aName)
       aName->SetValue(theName);
   }
 
-  void SetValue(SALOMEDS::SObject_ptr theSObject, const char* theValue){
-    using namespace SALOMEDS;
-    Study_var aStudy = GetActiveStudyDocument();
-    if(aStudy->GetProperties()->IsLocked())
+  void SetValue (_PTR(SObject) theSObject, const char* theValue)
+  {
+    _PTR(Study) aStudy = GetActiveStudyDocument();
+    if (aStudy->GetProperties()->IsLocked())
       return;
-    StudyBuilder_var aBuilder = aStudy->NewBuilder();
-    GenericAttribute_var anAttr = aBuilder->FindOrCreateAttribute(theSObject,"AttributeComment");
-    AttributeComment_var aComment = AttributeComment::_narrow(anAttr);
-    if(!aComment->_is_nil())
+    _PTR(StudyBuilder) aBuilder = aStudy->NewBuilder();
+    _PTR(GenericAttribute) anAttr =
+      aBuilder->FindOrCreateAttribute(theSObject, "AttributeComment");
+    _PTR(AttributeComment) aComment = anAttr;
+    if (aComment)
       aComment->SetValue(theValue);
   }
-  
 
-  CORBA::Object_var SObjectToObject(SALOMEDS::SObject_ptr theSObject,
-                                   SALOMEDS::Study_ptr theStudy)
+  CORBA::Object_var SObjectToObject (_PTR(SObject) theSObject,
+                                     _PTR(Study)   theStudy)
   {
-    if(!theSObject->_is_nil()){
-      SALOMEDS::GenericAttribute_var anAttr;
-      if(theSObject->FindAttribute(anAttr, "AttributeIOR")){
-       SALOMEDS::AttributeIOR_var anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
-       CORBA::String_var aVal = anIOR->Value();
-       return theStudy->ConvertIORToObject(aVal.in());
+    SalomeApp_Application* app = dynamic_cast<SalomeApp_Application*>
+      (SUIT_Session::session()->activeApplication());
+    if (theSObject) {
+      _PTR(GenericAttribute) anAttr;
+      if (theSObject->FindAttribute(anAttr, "AttributeIOR")) {
+       _PTR(AttributeIOR) anIOR = anAttr;
+       CORBA::String_var aVal = anIOR->Value().c_str();
+       return app->orb()->string_to_object(aVal);
       }
     }
     return CORBA::Object::_nil();
   }
 
-
-  CORBA::Object_var SObjectToObject(SALOMEDS::SObject_ptr theSObject){
-    SALOMEDS::Study_var aStudy = GetActiveStudyDocument();
+  CORBA::Object_var SObjectToObject (_PTR(SObject) theSObject)
+  {
+    _PTR(Study) aStudy = GetActiveStudyDocument();
     return SObjectToObject(theSObject,aStudy);
   }
 
-
-  CORBA::Object_var IObjectToObject(const Handle(SALOME_InteractiveObject)& theIO){
-    if(!theIO.IsNull()){
-      if(theIO->hasEntry()){
-       SALOMEDS::Study_var aStudy = GetActiveStudyDocument();
-       SALOMEDS::SObject_var anObj = aStudy->FindObjectID(theIO->getEntry());
+  CORBA::Object_var IObjectToObject (const Handle(SALOME_InteractiveObject)& theIO)
+  {
+    if (!theIO.IsNull()) {
+      if (theIO->hasEntry()) {
+       _PTR(Study) aStudy = GetActiveStudyDocument();
+       _PTR(SObject) anObj = aStudy->FindObjectID(theIO->getEntry());
        return SObjectToObject(anObj,aStudy);
       }
     }
     return CORBA::Object::_nil();
   }
 
-
-  CORBA::Object_var IORToObject(const char* theIOR){
-    SALOMEDS::Study_var aStudy = GetActiveStudyDocument();
-    return aStudy->ConvertIORToObject(theIOR);
+  CORBA::Object_var IORToObject (const char* theIOR)
+  {
+    SalomeApp_Application* app = dynamic_cast<SalomeApp_Application*>
+      (SUIT_Session::session()->activeApplication());
+    return app->orb()->string_to_object(theIOR);
   }
 
-
-  int GetNameOfSelectedIObjects(SALOME_Selection* theSel, QString& theName)
+  int GetNameOfSelectedIObjects(SalomeApp_SelectionMgr* theMgr, QString& theName)
   {
-    int aNbSel = theSel->IObjectCount();
+    if (!theMgr)
+      return 0;
+
+    SALOME_ListIO selected;
+    theMgr->selectedObjects(selected);
+    int aNbSel = selected.Extent();
     if (aNbSel == 1) {
-      Handle(SALOME_InteractiveObject) anIObject = theSel->firstIObject();
+      Handle(SALOME_InteractiveObject) anIObject = selected.First();
       theName = anIObject->getName();
-    }else{
+    } else {
       theName = QObject::tr("SMESH_OBJECTS_SELECTED").arg(aNbSel);
     }
     return aNbSel;
   }
 
-
-  SALOMEDS::SObject_var GetMeshOrSubmesh(SALOMEDS::SObject_ptr theSObject){
+  _PTR(SObject) GetMeshOrSubmesh (_PTR(SObject) theSObject)
+  {
     GEOM::GEOM_Object_var aShape = SObjectToInterface<GEOM::GEOM_Object>(theSObject);
-    if(!aShape->_is_nil()){ //It s a shape
+    if (!aShape->_is_nil()){ //It s a shape
       return theSObject->GetFather();
     }
-    SALOMEDS::SObject_var aSObject;
-    if(theSObject->ReferencedObject(aSObject)){
+    _PTR(SObject) aSObject;
+    if (theSObject->ReferencedObject(aSObject)) {
       aSObject = theSObject->GetFather();
       return aSObject->GetFather();
     }
     return theSObject->GetFather();
   }
 
-
-  void ModifiedMesh(SALOMEDS::SObject_ptr theSObject, bool theIsRight)
+  void ModifiedMesh (_PTR(SObject) theSObject, bool theIsRight)
   {
-    SALOMEDS::Study_var aStudy = GetActiveStudyDocument();
-    if(aStudy->GetProperties()->IsLocked())
-      return ;
+    _PTR(Study) aStudy = GetActiveStudyDocument();
+    if (aStudy->GetProperties()->IsLocked())
+      return;
 
-    SALOMEDS::StudyBuilder_var aBuilder = aStudy->NewBuilder();
-    SALOMEDS::GenericAttribute_var anAttr = 
+    _PTR(StudyBuilder) aBuilder = aStudy->NewBuilder();
+    _PTR(GenericAttribute) anAttr =
       aBuilder->FindOrCreateAttribute(theSObject,"AttributePixMap");
-    SALOMEDS::AttributePixMap_var aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr);
-    if(theIsRight){
+    _PTR(AttributePixMap) aPixmap = anAttr;
+    if (theIsRight) {
       aPixmap->SetPixMap("ICON_SMESH_TREE_MESH");
-    }else{
+    } else {
       aPixmap->SetPixMap("ICON_SMESH_TREE_MESH_WARN");
     }
-    
-    SALOMEDS::ChildIterator_var anIter = aStudy->NewChildIterator(theSObject);
+
+    _PTR(ChildIterator) anIter = aStudy->NewChildIterator(theSObject);
     for (int i = 1; anIter->More(); anIter->Next(), i++) {
-      SALOMEDS::SObject_var aSObj = anIter->Value();
-      if(i >= 4){
-       SALOMEDS::ChildIterator_var anIter1 = aStudy->NewChildIterator(aSObj);
-       for(; anIter1->More(); anIter1->Next()){
-         SALOMEDS::SObject_var aSObj1 = anIter1->Value();
-         anAttr = aBuilder->FindOrCreateAttribute(aSObj1,"AttributePixMap");
-         aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr);
-         if(theIsRight){
+      _PTR(SObject) aSObj = anIter->Value();
+      if (i >= 4) {
+       _PTR(ChildIterator) anIter1 = aStudy->NewChildIterator(aSObj);
+       for (; anIter1->More(); anIter1->Next()) {
+         _PTR(SObject) aSObj1 = anIter1->Value();
+         anAttr = aBuilder->FindOrCreateAttribute(aSObj1, "AttributePixMap");
+         aPixmap = anAttr;
+         if (theIsRight) {
            aPixmap->SetPixMap("ICON_SMESH_TREE_MESH");
-         }else{
+         } else {
            aPixmap->SetPixMap("ICON_SMESH_TREE_MESH_WARN");
          }
        }
@@ -192,5 +256,12 @@ namespace SMESH{
     }
   }
 
-
+//  void UpdateObjBrowser (bool)
+//  {
+//    //SMESHGUI::activeStudy()->updateObjBrowser(true);
+//    //SalomeApp_Application* anApp = dynamic_cast<SalomeApp_Application*>
+//    //  (SUIT_Session::session()->activeApplication());
+//    //if (anApp) anApp->objectBrowser()->updateTree();
+//    SMESHGUI::GetSMESHGUI()->updateObjBrowser();
+//  }
 }
index ab468bf32e2713ea9632ac4def9771df4fa23c98..15009ab9540167f0d7361434d8ab86768e7cee77 100644 (file)
@@ -1,67 +1,96 @@
 //  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
-// 
-//  This library is free software; you can redistribute it and/or 
-//  modify it under the terms of the GNU Lesser General Public 
-//  License as published by the Free Software Foundation; either 
-//  version 2.1 of the License. 
-// 
-//  This library is distributed in the hope that it will be useful, 
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of 
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
-//  Lesser General Public License for more details. 
-// 
-//  You should have received a copy of the GNU Lesser General Public 
-//  License along with this library; if not, write to the Free Software 
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
-// 
-//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
 
 #ifndef SMESHGUI_Utils_HeaderFile
 #define SMESHGUI_Utils_HeaderFile
 
+#include <CORBA.h>
+
+#include "SALOMEDSClient_definitions.hxx"
 #include "SALOME_InteractiveObject.hxx"
+#include "SalomeApp_DataOwner.h"
 
 class QString;
 
-class QAD_Study;
-class QAD_StudyFrame;
-class SALOME_Selection;
+class SUIT_ViewWindow;
+class SUIT_Desktop;
+class SUIT_Study;
+
+class CAM_Module;
 
-#include "SALOMEconfig.h"
-#include CORBA_CLIENT_HEADER(SALOMEDS)
+class SALOMEDSClient_Study;
+class SALOMEDSClient_SObject;
 
+class SalomeApp_Study;
+class SalomeApp_Module;
+class SalomeApp_SelectionMgr;
 
-namespace SMESH{
+namespace SMESH {
 
-  QAD_Study* GetActiveStudy();
+  SUIT_Desktop*
+  GetDesktop(const CAM_Module* theModule);
 
-  QAD_StudyFrame* GetActiveStudyFrame();
+  SalomeApp_SelectionMgr*
+  GetSelectionMgr(const SalomeApp_Module* theModule);
 
-  SALOMEDS::Study_var GetActiveStudyDocument();
+  SalomeApp_Study*
+  GetAppStudy(const CAM_Module* theModule);
 
-  SALOMEDS::SObject_var FindSObject(CORBA::Object_ptr theObject);
+  _PTR(Study)
+  GetCStudy(const SalomeApp_Study* theStudy);
 
+  CORBA::Object_var DataOwnerToObject(const SalomeApp_DataOwnerPtr& theOwner);
 
-  void SetName(SALOMEDS::SObject_ptr theSObject, const char* theName);
-  void SetValue(SALOMEDS::SObject_ptr theSObject, const char* theValue);
+  template<class TInterface> typename TInterface::_var_type
+    DataOwnerToInterface(const SalomeApp_DataOwnerPtr& theDataOwner)
+    {
+      CORBA::Object_var anObj = DataOwnerToObject(theDataOwner);
+      if(!CORBA::is_nil(anObj))
+       return TInterface::_narrow(anObj);
+      return TInterface::_nil();
+    }
 
 
-  CORBA::Object_var SObjectToObject(SALOMEDS::SObject_ptr theSObject,
-                                   SALOMEDS::Study_ptr theStudy);
-  
-  CORBA::Object_var SObjectToObject(SALOMEDS::SObject_ptr theSObject);
-  
+  SUIT_Study* GetActiveStudy();
+
+  SUIT_ViewWindow* GetActiveWindow();
+
+  _PTR(Study) GetActiveStudyDocument();
+
+  _PTR(SObject) FindSObject(CORBA::Object_ptr theObject);
+
+  void SetName  (_PTR(SObject) theSObject, const char* theName);
+  void SetValue (_PTR(SObject) theSObject, const char* theValue);
+
+  CORBA::Object_var SObjectToObject (_PTR(SObject) theSObject,
+                                    _PTR(Study) theStudy);
+
+  CORBA::Object_var SObjectToObject(_PTR(SObject) theSObject);
 
   template<class TInterface> typename TInterface::_var_type
-    SObjectToInterface(SALOMEDS::SObject_ptr theSObject)
+    SObjectToInterface(_PTR(SObject) theSObject)
     {
       CORBA::Object_var anObj = SObjectToObject(theSObject);
       if(!CORBA::is_nil(anObj))
        return TInterface::_narrow(anObj);
       return TInterface::_nil();
     }
-  
 
   CORBA::Object_var IObjectToObject(const Handle(SALOME_InteractiveObject)& theIO);
 
@@ -73,7 +102,6 @@ namespace SMESH{
        return TInterface::_narrow(anObj);
       return TInterface::_nil();
     }
-  
 
   CORBA::Object_var IORToObject(const char* theIOR);
 
@@ -85,15 +113,14 @@ namespace SMESH{
        return TInterface::_narrow(anObj);
       return TInterface::_nil();
     }
-  
 
-  int GetNameOfSelectedIObjects(SALOME_Selection* theSel, QString& theName);
+  int GetNameOfSelectedIObjects (SalomeApp_SelectionMgr*, QString& theName);
 
-  SALOMEDS::SObject_var GetMeshOrSubmesh(SALOMEDS::SObject_ptr theSObject);
+  _PTR(SObject) GetMeshOrSubmesh (_PTR(SObject) theSObject);
 
-  void ModifiedMesh(SALOMEDS::SObject_ptr theSObject, bool theIsRight);
+  void ModifiedMesh (_PTR(SObject) theSObject, bool theIsRight);
 
+//  void UpdateObjBrowser (bool);
 }
 
-
 #endif
index 89cebc3c456091b5c434993698eb8579379e459e..f09225878fdd3a61f1f9977713c482bab8d082e7 100644 (file)
@@ -1,20 +1,20 @@
 //  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 
-// 
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
 //  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
 
 
 
 #include <TColStd_IndexedMapOfInteger.hxx>
 
-#include "QAD_Config.h"
-#include "QAD_Desktop.h"
-#include "QAD_Study.h"
-#include "QAD_Settings.h"
-#include "QAD_RightFrame.h"
+#include <SUIT_Desktop.h>
+#include <SUIT_Session.h>
+#include <SUIT_Study.h>
 
-#include "SALOME_Selection.h"
-#include "SALOME_ListIteratorOfListIO.hxx"
+#include "SalomeApp_SelectionMgr.h"
 
-#include "VTKViewer_ViewFrame.h"
-#include "VTKViewer_RenderWindow.h"
-#include "VTKViewer_InteractorStyleSALOME.h"
-#include "VTKViewer_RenderWindowInteractor.h"
+#include "SVTK_Selector.h"
+#include "SVTK_ViewModel.h"
+#include "SVTK_ViewWindow.h"
+#include "SVTK_RenderWindow.h"
+#include "SVTK_InteractorStyle.h"
+#include "SVTK_RenderWindowInteractor.h"
 
 #include "utilities.h"
 
 #include CORBA_CLIENT_HEADER(SMESH_Mesh)
 #include CORBA_CLIENT_HEADER(SMESH_Group)
 #include CORBA_CLIENT_HEADER(SMESH_Hypothesis)
-#include CORBA_CLIENT_HEADER(SALOMEDS_Attributes)
 
+#include "SMESHGUI.h"
 #include "SMESH_Actor.h"
 #include "SMESH_ObjectDef.h"
 
+#include <SalomeApp_Application.h>
+#include <SalomeApp_SelectionMgr.h>
+#include <SalomeApp_Study.h>
+
+#include <SALOMEDSClient_Study.hxx>
+#include <SALOMEDSClient_SObject.hxx>
+
+#include <SALOME_ListIO.hxx>
+#include <SALOME_ListIteratorOfListIO.hxx>
+
+#include <set>
 using namespace std;
 
 namespace SMESH{
@@ -68,14 +78,15 @@ namespace SMESH{
       if(anIter != VISUAL_OBJ_CONT.end()){
        aVisualObj = anIter->second;
       }else{
-       SALOMEDS::Study_var aStudy = QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument();
-       SALOMEDS::SObject_var aSObj = aStudy->FindObjectID(theEntry);
-       if(!CORBA::is_nil(aSObj)){
-         SALOMEDS::GenericAttribute_var anAttr;
+        SalomeApp_Application* app = dynamic_cast<SalomeApp_Application*>( SMESHGUI::activeStudy()->application() );
+       _PTR(Study) aStudy = SMESHGUI::activeStudy()->studyDS();
+       _PTR(SObject) aSObj = aStudy->FindObjectID(theEntry);
+       if(aSObj){
+         _PTR(GenericAttribute) anAttr;
          if(aSObj->FindAttribute(anAttr,"AttributeIOR")){
-           SALOMEDS::AttributeIOR_var anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
-           CORBA::String_var aVal = anIOR->Value();
-           CORBA::Object_var anObj = aStudy->ConvertIORToObject(aVal.in());
+           _PTR(AttributeIOR) anIOR = anAttr;
+           CORBA::String_var aVal = anIOR->Value().c_str();
+           CORBA::Object_var anObj = app->orb()->string_to_object( aVal.in() );
            if(!CORBA::is_nil(anObj)){
              //Try narrow to SMESH_Mesh interafce
              SMESH::SMESH_Mesh_var aMesh = SMESH::SMESH_Mesh::_narrow(anObj);
@@ -89,16 +100,16 @@ namespace SMESH{
              //Try narrow to SMESH_Group interafce
              SMESH::SMESH_GroupBase_var aGroup = SMESH::SMESH_GroupBase::_narrow(anObj);
              if(!aGroup->_is_nil()){
-               SALOMEDS::SObject_var aFatherSObj = aSObj->GetFather();
-               if(aFatherSObj->_is_nil()) return aVisualObj;
+               _PTR(SObject) aFatherSObj = aSObj->GetFather();
+               if(!aFatherSObj) return aVisualObj;
                aFatherSObj = aFatherSObj->GetFather();
-               if(aFatherSObj->_is_nil()) return aVisualObj;
-               CORBA::String_var anEntry = aFatherSObj->GetID();
+               if(!aFatherSObj) return aVisualObj;
+               CORBA::String_var anEntry = aFatherSObj->GetID().c_str();
                TVisualObjPtr aVisObj = GetVisualObj(theStudyId,anEntry.in());
                if(SMESH_MeshObj* aMeshObj = dynamic_cast<SMESH_MeshObj*>(aVisObj.get())){
                  aVisualObj.reset(new SMESH_GroupObj(aGroup,aMeshObj));
                  aVisualObj->Update();
-                 TVisualObjCont::value_type aValue(aKey,aVisualObj); 
+                 TVisualObjCont::value_type aValue(aKey,aVisualObj);
                  VISUAL_OBJ_CONT.insert(aValue);
                  return aVisualObj;
                }
@@ -106,16 +117,16 @@ namespace SMESH{
              //Try narrow to SMESH_subMesh interafce
              SMESH::SMESH_subMesh_var aSubMesh = SMESH::SMESH_subMesh::_narrow(anObj);
              if(!aSubMesh->_is_nil()){
-               SALOMEDS::SObject_var aFatherSObj = aSObj->GetFather();
-               if(aFatherSObj->_is_nil()) return aVisualObj;
+               _PTR(SObject) aFatherSObj = aSObj->GetFather();
+               if(!aFatherSObj) return aVisualObj;
                aFatherSObj = aFatherSObj->GetFather();
-               if(aFatherSObj->_is_nil()) return aVisualObj;
-               CORBA::String_var anEntry = aFatherSObj->GetID();
+               if(!aFatherSObj) return aVisualObj;
+               CORBA::String_var anEntry = aFatherSObj->GetID().c_str();
                TVisualObjPtr aVisObj = GetVisualObj(theStudyId,anEntry.in());
                if(SMESH_MeshObj* aMeshObj = dynamic_cast<SMESH_MeshObj*>(aVisObj.get())){
                  aVisualObj.reset(new SMESH_subMeshObj(aSubMesh,aMeshObj));
                  aVisualObj->Update();
-                 TVisualObjCont::value_type aValue(aKey,aVisualObj); 
+                 TVisualObjCont::value_type aValue(aKey,aVisualObj);
                  VISUAL_OBJ_CONT.insert(aValue);
                  return aVisualObj;
                }
@@ -131,50 +142,72 @@ namespace SMESH{
   }
 
 
-  VTKViewer_ViewFrame* FindVtkViewFrame(QAD_Study* theStudy,
-                                       QAD_StudyFrame* theStudyFrame)
+  SVTK_ViewWindow*
+  GetViewWindow(const SalomeApp_Module* theModule)
   {
-    QList<QAD_Study>& aStudies = 
-      QAD_Application::getDesktop()->getActiveApp()->getStudies();
-    if(aStudies.containsRef(theStudy)){
-      const QList<QAD_StudyFrame>& aStudyFrames = theStudy->getStudyFrames();
-      if(aStudyFrames.containsRef(theStudyFrame)){
-       return GetVtkViewFrame(theStudyFrame);
+    if(SalomeApp_Application* anApp = theModule->getApp()){
+      if(SUIT_ViewManager* aViewManager = anApp->activeViewManager()){
+       if(aViewManager->getType() == SVTK_Viewer::Type()){
+         if(SUIT_ViewWindow* aViewWindow = aViewManager->getActiveView()){
+           return dynamic_cast<SVTK_ViewWindow*>(aViewWindow);
+         }
+       }
       }
     }
     return NULL;
   }
 
+  SVTK_ViewWindow* FindVtkViewWindow( SUIT_ViewManager* theMgr,
+                                          SUIT_ViewWindow* theWindow )
+  {
+    if( !theMgr )
+      return NULL;
 
-  VTKViewer_ViewFrame* GetVtkViewFrame(QAD_StudyFrame* theStudyFrame){
-    QAD_ViewFrame* aViewFrame = theStudyFrame->getRightFrame()->getViewFrame();
-    return dynamic_cast<VTKViewer_ViewFrame*>(aViewFrame);
+    QPtrVector<SUIT_ViewWindow> views = theMgr->getViews();
+    if( views.containsRef( theWindow ) )
+      return GetVtkViewWindow( theWindow );
+    else
+      return NULL;
   }
 
 
-  VTKViewer_ViewFrame* GetCurrentVtkView(){
-    return GetVtkViewFrame(GetActiveStudy()->getActiveStudyFrame());
+  SVTK_ViewWindow* GetVtkViewWindow(SUIT_ViewWindow* theWindow){
+    return dynamic_cast<SVTK_ViewWindow*>(theWindow);
   }
 
 
-  void RepaintViewFrame(VTKViewer_ViewFrame* theFrame)
+/*  SUIT_ViewWindow* GetActiveWindow()
   {
-    theFrame->Repaint();
-  }
+    SalomeApp_Application* app = dynamic_cast<SalomeApp_Application*>( SUIT_Session::session()->activeApplication() );
+    if( !app )
+      return NULL;
+    SUIT_ViewManager* mgr = app->activeViewManager();
+    if( mgr )
+      return mgr->getActiveView();
+    else
+      return NULL;
+  }*/
 
+  SVTK_ViewWindow* GetCurrentVtkView(){
+    return GetVtkViewWindow( GetActiveWindow() );
+  }
 
-  void RenderViewFrame(VTKViewer_ViewFrame* theFrame)
+  void RepaintViewWindow(SVTK_ViewWindow* theWindow)
   {
-    theFrame->getRW()->getRenderWindow()->Render();
-    theFrame->Repaint();
+    theWindow->Repaint();
   }
 
+  void RenderViewWindow(SVTK_ViewWindow* theWindow)
+  {
+    theWindow->getRenderer()->Render();
+    theWindow->Repaint();
+  }
 
-  SMESH_Actor* FindActorByEntry(QAD_StudyFrame *theStudyFrame, 
+  SMESH_Actor* FindActorByEntry(SUIT_ViewWindow *theWindow,
                                const char* theEntry)
   {
-    if(VTKViewer_ViewFrame* aViewFrame = GetVtkViewFrame(theStudyFrame)){
-      vtkRenderer *aRenderer = aViewFrame->getRenderer();
+    if(SVTK_ViewWindow* aViewWindow = GetVtkViewWindow(theWindow)){
+      vtkRenderer *aRenderer = aViewWindow->getRenderer();
       vtkActorCollection *aCollection = aRenderer->GetActors();
       aCollection->InitTraversal();
       while(vtkActor *anAct = aCollection->GetNextActor()){
@@ -190,20 +223,24 @@ namespace SMESH{
     }
     return NULL;
   }
-  
-  
+
+
   SMESH_Actor* FindActorByEntry(const char* theEntry){
-    return FindActorByEntry(GetActiveStudy()->getActiveStudyFrame(),theEntry);
+    return FindActorByEntry(GetActiveWindow(),theEntry);
   }
-  
-  
+
+
   SMESH_Actor* FindActorByObject(CORBA::Object_ptr theObject){
+    SalomeApp_Application* app = dynamic_cast<SalomeApp_Application*>( SUIT_Session::session()->activeApplication() );
+    if( !app )
+      return NULL;
+
     if(!CORBA::is_nil(theObject)){
-      SALOMEDS::Study_var aStudy = GetActiveStudyDocument();
-      CORBA::String_var anIOR = aStudy->ConvertObjectToIOR(theObject);
-      SALOMEDS::SObject_var aSObject = aStudy->FindObjectIOR(anIOR.in());
-      if(!aSObject->_is_nil()){
-       CORBA::String_var anEntry = aSObject->GetID();
+      _PTR(Study) aStudy = GetActiveStudyDocument();
+      CORBA::String_var anIOR = app->orb()->object_to_string( theObject );
+      _PTR(SObject) aSObject = aStudy->FindObjectIOR(anIOR.in());
+      if(aSObject){
+       CORBA::String_var anEntry = aSObject->GetID().c_str();
        return FindActorByEntry(anEntry.in());
       }
     }
@@ -211,20 +248,19 @@ namespace SMESH{
   }
 
 
-  SMESH_Actor* CreateActor(SALOMEDS::Study_ptr theStudy,
+  SMESH_Actor* CreateActor(_PTR(Study) theStudy,
                           const char* theEntry,
                           int theIsClear)
   {
     SMESH_Actor *anActor = NULL;
     CORBA::Long anId = theStudy->StudyId();
     if(TVisualObjPtr aVisualObj = GetVisualObj(anId,theEntry)){
-      SALOMEDS::SObject_var aSObj = theStudy->FindObjectID(theEntry);
-      if(!aSObj->_is_nil()){
-       SALOMEDS::GenericAttribute_var anAttr;
+      _PTR(SObject) aSObj = theStudy->FindObjectID(theEntry);
+      if(aSObj){
+       _PTR(GenericAttribute) anAttr;
        if(aSObj->FindAttribute(anAttr,"AttributeName")){
-         SALOMEDS::AttributeName_var aName = SALOMEDS::AttributeName::_narrow(anAttr);
-         CORBA::String_var aVal = aName->Value();
-         string aNameVal = aVal.in();
+         _PTR(AttributeName) aName = anAttr;
+         std::string aNameVal = aName->Value();
          anActor = SMESH_Actor::New(aVisualObj,theEntry,aNameVal.c_str(),theIsClear);
        }
       }
@@ -233,58 +269,56 @@ namespace SMESH{
   }
 
 
-  void DisplayActor(QAD_StudyFrame *theStudyFrame, SMESH_Actor* theActor){
-    if(VTKViewer_ViewFrame* aViewFrame = GetVtkViewFrame(theStudyFrame)){
-      aViewFrame->AddActor(theActor);
-      aViewFrame->Repaint();
+  void DisplayActor( SUIT_ViewWindow *theWnd, SMESH_Actor* theActor){
+    if(SVTK_ViewWindow* vtkWnd = GetVtkViewWindow(theWnd)){
+      vtkWnd->AddActor(theActor);
+      vtkWnd->Repaint();
     }
   }
 
 
-  void RemoveActor(QAD_StudyFrame *theStudyFrame, SMESH_Actor* theActor){
-    if(VTKViewer_ViewFrame* aViewFrame = GetVtkViewFrame(theStudyFrame)){
-      aViewFrame->RemoveActor(theActor);
+  void RemoveActor( SUIT_ViewWindow *theWnd, SMESH_Actor* theActor){
+    if(SVTK_ViewWindow* vtkWnd = GetVtkViewWindow(theWnd)){
+      vtkWnd->RemoveActor(theActor);
       if(theActor->hasIO()){
        Handle(SALOME_InteractiveObject) anIO = theActor->getIO();
        if(anIO->hasEntry()){
          std::string anEntry = anIO->getEntry();
-         QAD_Study* aStudy = theStudyFrame->getStudy();
-         int aStudyId = aStudy->getStudyId();
+         SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>( vtkWnd->getViewManager()->study() );
+         int aStudyId = aStudy->id();
          TVisualObjCont::key_type aKey(aStudyId,anEntry);
          VISUAL_OBJ_CONT.erase(aKey);
        }
       }
       theActor->Delete();
-      aViewFrame->Repaint();
+      vtkWnd->Repaint();
     }
   }
-  
+
 
   void FitAll(){
-    if(VTKViewer_ViewFrame* aViewFrame = GetVtkViewFrame(GetActiveStudy()->getActiveStudyFrame())){
-      aViewFrame->onViewFitAll();
-      aViewFrame->Repaint();
+    if(SVTK_ViewWindow* wnd = GetCurrentVtkView() ){
+      wnd->onFitAll();
+      wnd->Repaint();
     }
   }
-  
+
   vtkRenderer* GetCurrentRenderer(){
-    if(VTKViewer_ViewFrame* aViewFrame = GetVtkViewFrame(GetActiveStudy()->getActiveStudyFrame()))
-      return aViewFrame->getRenderer();
+    if(SVTK_ViewWindow* wnd = GetCurrentVtkView() )
+      return wnd->getRenderer();
     return NULL;
   }
 
   void RepaintCurrentView(){
-    if(VTKViewer_ViewFrame* aViewFrame = GetVtkViewFrame(GetActiveStudy()->getActiveStudyFrame())){
-      aViewFrame->getRW()->getRenderWindow()->Render();
-      //aViewFrame->Repaint();
-    }
+    if(SVTK_ViewWindow* wnd = GetCurrentVtkView() )
+      wnd->getRenderer()->Render();
+      //wnd->Repaint();
   }
-  
-  
-  void UpdateView(QAD_StudyFrame *theStudyFrame, EDisplaing theAction, const char* theEntry)
+
+  void UpdateView(SUIT_ViewWindow *theWnd, EDisplaing theAction, const char* theEntry)
   {
-    if(VTKViewer_ViewFrame* aViewFrame = GetVtkViewFrame(theStudyFrame)){
-      vtkRenderer *aRenderer = aViewFrame->getRenderer();
+    if(SVTK_ViewWindow* aViewWnd = GetVtkViewWindow(theWnd)){
+      vtkRenderer *aRenderer = aViewWnd->getRenderer();
       vtkActorCollection *aCollection = aRenderer->GetActors();
       aCollection->InitTraversal();
       switch(theAction){
@@ -305,7 +339,7 @@ namespace SMESH{
        }
       }
       default: {
-       if(SMESH_Actor *anActor = FindActorByEntry(theStudyFrame,theEntry)){
+       if(SMESH_Actor *anActor = FindActorByEntry(theWnd,theEntry)){
          switch(theAction) {
            case eDisplay:
            case eDisplayOnly:
@@ -319,10 +353,10 @@ namespace SMESH{
          switch(theAction){
          case eDisplay:
          case eDisplayOnly:{
-           QAD_Study* aStudy = theStudyFrame->getStudy();
-           SALOMEDS::Study_var aDocument = aStudy->getStudyDocument();
+           SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>( theWnd->getViewManager()->study() );
+           _PTR(Study) aDocument = aStudy->studyDS();
            if((anActor = CreateActor(aDocument,theEntry,true))) {
-             DisplayActor(theStudyFrame,anActor);
+             DisplayActor(theWnd,anActor);
              FitAll();
            }
            break;
@@ -336,16 +370,19 @@ namespace SMESH{
 
 
   void UpdateView(EDisplaing theAction, const char* theEntry){
-    QAD_Study* aStudy = GetActiveStudy();
-    QAD_StudyFrame *aStudyFrame = aStudy->getActiveStudyFrame();
-    UpdateView(aStudyFrame,theAction,theEntry);
+    SalomeApp_Study* aStudy = dynamic_cast< SalomeApp_Study* >( GetActiveStudy() );
+    SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( aStudy->application() );
+    SUIT_ViewWindow *aWnd = app->activeViewManager()->getActiveView();
+    UpdateView(aWnd,theAction,theEntry);
   }
-  
+
   void UpdateView(){
-    if(VTKViewer_ViewFrame* aViewFrame = SMESH::GetCurrentVtkView()){
-      SALOME_Selection *aSel = SALOME_Selection::Selection(GetActiveStudy()->getSelection());
-      if(aSel->IObjectCount() == 0){
-       vtkRenderer* aRenderer = aViewFrame->getRenderer();
+    if(SVTK_ViewWindow* aWnd = SMESH::GetCurrentVtkView()){
+      SalomeApp_SelectionMgr* mgr = SMESHGUI::selectionMgr();
+      SALOME_ListIO selected; mgr->selectedObjects( selected );
+
+      if( selected.Extent() == 0){
+       vtkRenderer* aRenderer = aWnd->getRenderer();
        vtkActorCollection *aCollection = aRenderer->GetActors();
        aCollection->InitTraversal();
        while(vtkActor *anAct = aCollection->GetNextActor()){
@@ -355,7 +392,7 @@ namespace SMESH{
          }
        }
       }else{
-       SALOME_ListIteratorOfListIO anIter(aSel->StoredIObjects());
+       SALOME_ListIteratorOfListIO anIter( selected );
        for(; anIter.More(); anIter.Next()){
          Handle(SALOME_InteractiveObject) anIO = anIter.Value();
          Update(anIO,true);
@@ -369,7 +406,7 @@ namespace SMESH{
   void Update(const Handle(SALOME_InteractiveObject)& theIO,
              bool theDisplay)
   {
-    SALOMEDS::Study_var aStudy = GetActiveStudyDocument();
+    _PTR(Study) aStudy = GetActiveStudyDocument();
     CORBA::Long anId = aStudy->StudyId();
     TVisualObjPtr aVisualObj = SMESH::GetVisualObj(anId,theIO->getEntry());
     aVisualObj->Update();
@@ -379,115 +416,99 @@ namespace SMESH{
 
 
   void UpdateSelectionProp() {
-    QAD_Study* aStudy = GetActiveStudy();
-    QList<QAD_StudyFrame> aFrameList = aStudy->getStudyFrames();
-    
-    QString SCr, SCg, SCb;
-    SCr = QAD_CONFIG->getSetting("SMESH:SettingsSelectColorRed");
-    SCg = QAD_CONFIG->getSetting("SMESH:SettingsSelectColorGreen");
-    SCb = QAD_CONFIG->getSetting("SMESH:SettingsSelectColorBlue");
-    QColor aHiColor = Qt::white;
-    if (!SCr.isEmpty() && !SCg.isEmpty() && !SCb.isEmpty())
-      aHiColor = QColor(SCr.toInt(), SCg.toInt(), SCb.toInt());
-    
-    SCr = QAD_CONFIG->getSetting("SMESH:SettingsItemSelectColorRed");
-    SCg = QAD_CONFIG->getSetting("SMESH:SettingsItemSelectColorGreen");
-    SCb = QAD_CONFIG->getSetting("SMESH:SettingsItemSelectColorBlue");
-    QColor aSelColor = Qt::yellow;
-    if (!SCr.isEmpty() && !SCg.isEmpty() && !SCb.isEmpty())
-      aSelColor = QColor(SCr.toInt(), SCg.toInt(), SCb.toInt());
-    QString SW = QAD_CONFIG->getSetting("SMESH:SettingsItemSelectWidth");
-    if (SW.isEmpty()) SW = "5";
-    
-    SCr = QAD_CONFIG->getSetting("SMESH:SettingsPreSelectColorRed");
-    SCg = QAD_CONFIG->getSetting("SMESH:SettingsPreSelectColorGreen");
-    SCb = QAD_CONFIG->getSetting("SMESH:SettingsPreSelectColorBlue");
-    QColor aPreColor = Qt::cyan;
-    if (!SCr.isEmpty() && !SCg.isEmpty() && !SCb.isEmpty())
-      aPreColor = QColor(SCr.toInt(), SCg.toInt(), SCb.toInt());
-    QString PW = QAD_CONFIG->getSetting("SMESH:SettingsPreSelectWidth");
-    if (PW.isEmpty()) PW = "5";
-    
-    QString SP1 = QAD_CONFIG->getSetting("SMESH:SettingsNodeSelectTol");
-    if (SP1.isEmpty()) SP1 = "0.025";
-    QString SP2 = QAD_CONFIG->getSetting("SMESH:SettingsElementsSelectTol");
-    if (SP2.isEmpty()) SP2 = "0.001";
-    
-    for (QAD_StudyFrame* aStudyFrame = aFrameList.first(); aStudyFrame; aStudyFrame = aFrameList.next()) {
-      if (aStudyFrame->getTypeView() == VIEW_VTK) {
-       VTKViewer_ViewFrame* aVtkViewFrame = GetVtkViewFrame(aStudyFrame);
-       if (!aVtkViewFrame) continue;
+    SUIT_Study* aStudy = GetActiveStudy();
+    SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( aStudy->application() );
+    SUIT_ViewManager* vm = app->activeViewManager();
+    QPtrVector<SUIT_ViewWindow> views = vm->getViews();
+
+    SUIT_ResourceMgr* mgr = SMESHGUI::resourceMgr();
+
+    QColor aHiColor = mgr->colorValue( "SMESH", "SettingsSelectColor", Qt::white ),
+           aSelColor = mgr->colorValue( "SMESH", "SettingsItemSelectColor", Qt::yellow ),
+          aPreColor = mgr->colorValue( "SMESH", "SettingsPreSelectColor", Qt::cyan );
+
+    int SW = mgr->integerValue( "SMESH", "SettingsItemSelectWidth", 5 ),
+        PW = mgr->integerValue( "SMESH", "SettingsPreSelectWidth", 5 );
+
+    double SP1 = mgr->doubleValue( "SMESH", "SettingsNodeSelectTol", 0.025 ),
+           SP2 = mgr->doubleValue( "SMESH", "SettingsElementsSelectTol", 0.001 );
+
+    for ( int i=0, n=views.count(); i<n; i++ ) {
+        SVTK_ViewWindow* aVtkView = GetVtkViewWindow( views[i] );
+       if (!aVtkView) continue;
        // update VTK viewer properties
-       VTKViewer_RenderWindowInteractor* anInteractor = aVtkViewFrame->getRWInteractor();
+       SVTK_RenderWindowInteractor* anInteractor = aVtkView->getRWInteractor();
        if (anInteractor) {
          // mesh element selection
-         anInteractor->SetSelectionProp(aSelColor.red()/255., aSelColor.green()/255., 
-                                        aSelColor.blue()/255., SW.toInt());
-         
+         anInteractor->SetSelectionProp(aSelColor.red()/255., aSelColor.green()/255.,
+                                        aSelColor.blue()/255., SW );
+
          // tolerances
-         anInteractor->SetSelectionTolerance(SP1.toDouble(), SP2.toDouble());
-         
+         anInteractor->SetSelectionTolerance(SP1, SP2);
+
          // pre-selection
-         VTKViewer_InteractorStyleSALOME* aStyle = anInteractor->GetInteractorStyleSALOME();
+         SVTK_InteractorStyle* aStyle =
+           dynamic_cast<SVTK_InteractorStyle*>( anInteractor->GetInteractorStyle() );
          if (aStyle) {
-           aStyle->setPreselectionProp(aPreColor.red()/255., aPreColor.green()/255., 
-                                       aPreColor.blue()/255., PW.toInt());
+           aStyle->setPreselectionProp(aPreColor.red()/255., aPreColor.green()/255.,
+                                       aPreColor.blue()/255., PW);
          }
        }
        // update actors
-       vtkRenderer* aRenderer = aVtkViewFrame->getRenderer();
+       vtkRenderer* aRenderer = aVtkView->getRenderer();
        vtkActorCollection *aCollection = aRenderer->GetActors();
        aCollection->InitTraversal();
        while(vtkActor *anAct = aCollection->GetNextActor()){
          if(SMESH_Actor *anActor = dynamic_cast<SMESH_Actor*>(anAct)){
-           anActor->SetHighlightColor(aHiColor.red()/255., aHiColor.green()/255., 
+           anActor->SetHighlightColor(aHiColor.red()/255., aHiColor.green()/255.,
                                       aHiColor.blue()/255.);
-           anActor->SetPreHighlightColor(aPreColor.red()/255., aPreColor.green()/255., 
+           anActor->SetPreHighlightColor(aPreColor.red()/255., aPreColor.green()/255.,
                                          aPreColor.blue()/255.);
          }
        }
-      }
     }
   }
 
-  
+
   //----------------------------------------------------------------------------
-  VTKViewer_InteractorStyleSALOME* GetInteractorStyle(QAD_StudyFrame *theStudyFrame){
-    if(VTKViewer_ViewFrame* aViewFrame = GetVtkViewFrame(theStudyFrame)){
-      if(VTKViewer_RenderWindowInteractor* anInteractor = aViewFrame->getRWInteractor()){
-       return anInteractor->GetInteractorStyleSALOME();
+  SVTK_InteractorStyle* GetInteractorStyle(SUIT_ViewWindow *theWindow){
+    if(SVTK_ViewWindow* aWnd = GetVtkViewWindow(theWindow)){
+      if(SVTK_RenderWindowInteractor* anInteractor = aWnd->getRWInteractor()){
+       return dynamic_cast<SVTK_InteractorStyle*>( anInteractor->GetInteractorStyle() );
       }
     }
     return NULL;
   }
 
   void SetFilter(const Handle(VTKViewer_Filter)& theFilter,
-                VTKViewer_InteractorStyleSALOME* theStyle)
+                SVTK_InteractorStyle* theStyle)
   {
     theStyle->SetFilter(theFilter);
   }
 
-  Handle(VTKViewer_Filter) GetFilter(int theId, VTKViewer_InteractorStyleSALOME* theStyle)
+  Handle(VTKViewer_Filter) GetFilter(int theId, SVTK_InteractorStyle* theStyle)
   {
     return theStyle->GetFilter(theId);
   }
 
-  bool IsFilterPresent(int theId, VTKViewer_InteractorStyleSALOME* theStyle)
+  bool IsFilterPresent(int theId, SVTK_InteractorStyle* theStyle)
   {
     return theStyle->IsFilterPresent(theId);
   }
 
-  void RemoveFilter(int theId, VTKViewer_InteractorStyleSALOME* theStyle){
+  void RemoveFilter(int theId, SVTK_InteractorStyle* theStyle)
+  {
     theStyle->RemoveFilter(theId);
   }
 
-  void RemoveFilters(VTKViewer_InteractorStyleSALOME* theStyle){
+  void RemoveFilters(SVTK_InteractorStyle* theStyle)
+  {
     for ( int id = SMESHGUI_NodeFilter; theStyle && id < SMESHGUI_LastFilter; id++ )
       theStyle->RemoveFilter( id );
   }
 
   bool IsValid(SALOME_Actor* theActor, int theCellId,
-              VTKViewer_InteractorStyleSALOME* theStyle)
+              SVTK_InteractorStyle* theStyle)
   {
     return theStyle->IsValid(theActor,theCellId);
   }
@@ -495,8 +516,8 @@ namespace SMESH{
 
   //----------------------------------------------------------------------------
   void SetPointRepresentation(bool theIsVisible){
-    if(VTKViewer_ViewFrame* aViewFrame = GetCurrentVtkView()){
-      vtkRenderer *aRenderer = aViewFrame->getRenderer();
+    if(SVTK_ViewWindow* aViewWindow = GetCurrentVtkView()){
+      vtkRenderer *aRenderer = aViewWindow->getRenderer();
       vtkActorCollection *aCollection = aRenderer->GetActors();
       aCollection->InitTraversal();
       while(vtkActor *anAct = aCollection->GetNextActor()){
@@ -512,9 +533,9 @@ namespace SMESH{
 
 
   void SetPickable(SMESH_Actor* theActor){
-    if(VTKViewer_ViewFrame* aViewFrame = GetCurrentVtkView()){
+    if(SVTK_ViewWindow* aWnd = GetCurrentVtkView()){
       int anIsAllPickable = (theActor == NULL);
-      vtkRenderer *aRenderer = aViewFrame->getRenderer();
+      vtkRenderer *aRenderer = aWnd->getRenderer();
       vtkActorCollection *aCollection = aRenderer->GetActors();
       aCollection->InitTraversal();
       while(vtkActor *anAct = aCollection->GetNextActor()){
@@ -531,15 +552,86 @@ namespace SMESH{
   }
 
 
-  int GetNameOfSelectedNodes(SALOME_Selection *theSel, 
+  //----------------------------------------------------------------------------
+  int GetNameOfSelectedNodes(SVTK_Selector* theSelector, 
                             const Handle(SALOME_InteractiveObject)& theIO, 
                             QString& theName)
+  {
+    theName = "";
+    TColStd_IndexedMapOfInteger aMapIndex;
+    theSelector->GetIndex(theIO,aMapIndex);
+
+    for(int i = 1; i <= aMapIndex.Extent(); i++)
+      theName += QString(" %1").arg(aMapIndex(i));
+
+    return aMapIndex.Extent();
+  }
+
+  int GetNameOfSelectedElements(SVTK_Selector* theSelector, 
+                               const Handle(SALOME_InteractiveObject)& theIO, 
+                               QString& theName)
+  {
+    theName = "";
+    TColStd_IndexedMapOfInteger aMapIndex;
+    theSelector->GetIndex(theIO,aMapIndex);
+
+    typedef std::set<int> TIdContainer;
+    TIdContainer anIdContainer;
+    for( int i = 1; i <= aMapIndex.Extent(); i++)
+      anIdContainer.insert(aMapIndex(i));
+
+    TIdContainer::const_iterator anIter = anIdContainer.begin();
+    for(; anIter != anIdContainer.end(); anIter++)
+      theName += QString(" %1").arg(*anIter);
+
+    return aMapIndex.Extent();
+  }
+
+
+  int GetEdgeNodes(SVTK_Selector* theSelector, 
+                  const TVisualObjPtr& theVisualObject,
+                  int& theId1, 
+                  int& theId2)
+  {
+    const SALOME_ListIO& selected = theSelector->StoredIObjects(); 
+
+    if ( selected.Extent() != 1 )
+      return -1;
+
+    Handle(SALOME_InteractiveObject) anIO = selected.First();
+    if ( anIO.IsNull() || !anIO->hasEntry() )
+      return -1;
+
+    TColStd_IndexedMapOfInteger aMapIndex;
+    theSelector->GetIndex( anIO, aMapIndex );
+    if ( aMapIndex.Extent() != 2 )
+      return -1;
+
+    int anObjId = -1, anEdgeNum = -1;
+    for ( int i = 1; i <= aMapIndex.Extent(); i++ ) {
+      int aVal = aMapIndex( i );
+      if ( aVal > 0 )
+       anObjId = aVal;
+      else
+       anEdgeNum = abs( aVal ) - 1;
+    }
+
+    if ( anObjId == -1 || anEdgeNum == -1 )
+      return -1;
+
+    return theVisualObject->GetEdgeNodes( anObjId, anEdgeNum, theId1, theId2 ) ? 1 : -1;
+  }
+
+  //----------------------------------------------------------------------------
+  int GetNameOfSelectedNodes(SalomeApp_SelectionMgr *theMgr,
+                            const Handle(SALOME_InteractiveObject)& theIO,
+                            QString& theName)
   {
     theName = "";
     if(theIO->hasEntry()){
       if(FindActorByEntry(theIO->getEntry())){
        TColStd_IndexedMapOfInteger aMapIndex;
-       theSel->GetIndex(theIO,aMapIndex);
+       theMgr->GetIndexes(theIO,aMapIndex);
        for(int i = 1; i <= aMapIndex.Extent(); i++){
          theName += QString(" %1").arg(aMapIndex(i));
        }
@@ -548,28 +640,28 @@ namespace SMESH{
     }
     return -1;
   }
-  
 
-  int GetNameOfSelectedNodes(SALOME_Selection *theSel, QString& theName){
+  int GetNameOfSelectedNodes(SalomeApp_SelectionMgr *theMgr, QString& theName){
     theName = "";
-    if(theSel->IObjectCount() == 1){
-      Handle(SALOME_InteractiveObject) anIO = theSel->firstIObject();
-      return GetNameOfSelectedNodes(theSel,anIO,theName);
+    SALOME_ListIO selected; theMgr->selectedObjects( selected );
+    if(selected.Extent() == 1){
+      Handle(SALOME_InteractiveObject) anIO = selected.First();
+      return GetNameOfSelectedNodes(theMgr,anIO,theName);
     }
     return -1;
   }
   
 
-  int GetNameOfSelectedElements(SALOME_Selection *theSel, 
-                               const Handle(SALOME_InteractiveObject)& theIO, 
+  int GetNameOfSelectedElements(SalomeApp_SelectionMgr *theMgr,
+                               const Handle(SALOME_InteractiveObject)& theIO,
                                QString& theName)
   {
     theName = "";
     if(theIO->hasEntry()){
       if(FindActorByEntry(theIO->getEntry())){
        TColStd_IndexedMapOfInteger aMapIndex;
-       theSel->GetIndex(theIO,aMapIndex);
-       typedef std::set<int> TIdContainer;
+       theMgr->GetIndexes(theIO,aMapIndex);
+       typedef set<int> TIdContainer;
        TIdContainer anIdContainer;
        for( int i = 1; i <= aMapIndex.Extent(); i++)
          anIdContainer.insert(aMapIndex(i));
@@ -584,40 +676,44 @@ namespace SMESH{
   }
 
 
-  int GetNameOfSelectedElements(SALOME_Selection *theSel, QString& theName)
+  int GetNameOfSelectedElements(SalomeApp_SelectionMgr *theMgr, QString& theName)
   {
     theName = "";
-    if(theSel->IObjectCount() == 1){
-      Handle(SALOME_InteractiveObject) anIO = theSel->firstIObject();
-      return GetNameOfSelectedElements(theSel,anIO,theName);
+    SALOME_ListIO selected; theMgr->selectedObjects( selected );
+
+    if( selected.Extent() == 1){
+      Handle(SALOME_InteractiveObject) anIO = selected.First();
+      return GetNameOfSelectedElements(theMgr,anIO,theName);
     }
     return -1;
   }
 
-  
-  int GetSelected(SALOME_Selection*            theSel, 
-                 TColStd_IndexedMapOfInteger& theMap, 
+  int GetSelected(SalomeApp_SelectionMgr*      theMgr,
+                 TColStd_IndexedMapOfInteger& theMap,
                  const bool                   theIsElement)
   {
     theMap.Clear();
+    SALOME_ListIO selected; theMgr->selectedObjects( selected );
 
-    if ( theSel->IObjectCount() == 1 )
+    if ( selected.Extent() == 1 )
     {
-      Handle(SALOME_InteractiveObject) anIO = theSel->firstIObject();
+      Handle(SALOME_InteractiveObject) anIO = selected.First();
       if ( anIO->hasEntry() ) {
-       theSel->GetIndex( anIO, theMap );
+       theMgr->GetIndexes( anIO, theMap );
       }
     }
     return theMap.Extent();
   }
 
 
-  int GetEdgeNodes( SALOME_Selection* theSel, int& theId1, int& theId2 )
+  int GetEdgeNodes( SalomeApp_SelectionMgr* theMgr, int& theId1, int& theId2 )
   {
-    if ( theSel->IObjectCount() != 1 )
+    SALOME_ListIO selected; theMgr->selectedObjects( selected );
+
+    if ( selected.Extent() != 1 )
       return -1;
 
-    Handle(SALOME_InteractiveObject) anIO = theSel->firstIObject();
+    Handle(SALOME_InteractiveObject) anIO = selected.First();
     if ( anIO.IsNull() || !anIO->hasEntry() )
       return -1;
 
@@ -626,10 +722,10 @@ namespace SMESH{
       return -1;
 
     TColStd_IndexedMapOfInteger aMapIndex;
-    theSel->GetIndex( anIO, aMapIndex );
+    theMgr->GetIndexes( anIO, aMapIndex );
     if ( aMapIndex.Extent() != 2 )
       return -1;
-    
+
     int anObjId = -1, anEdgeNum = -1;
     for ( int i = 1; i <= aMapIndex.Extent(); i++ ) {
       int aVal = aMapIndex( i );
@@ -638,18 +734,18 @@ namespace SMESH{
       else
        anEdgeNum = abs( aVal );
     }
-    
+
     if ( anObjId == -1 || anEdgeNum == -1 )
       return -1;
-    
+
     return anActor->GetObject()->GetEdgeNodes( anObjId, anEdgeNum, theId1, theId2 ) ? 1 : -1;
   }
-  
+
   void SetControlsPrecision( const long theVal )
   {
-    if( VTKViewer_ViewFrame* aViewFrame = SMESH::GetCurrentVtkView() )
+    if( SVTK_ViewWindow* aWnd = SMESH::GetCurrentVtkView() )
     {
-      vtkRenderer *aRenderer = aViewFrame->getRenderer();
+      vtkRenderer *aRenderer = aWnd->getRenderer();
       vtkActorCollection *aCollection = aRenderer->GetActors();
       aCollection->InitTraversal();
       
@@ -665,20 +761,3 @@ namespace SMESH{
     }
   }
 }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
index 6e6fd84ed0ca5c8711245b70881a4e3b1357fe35..ec68ea5b11a909cd2b39a306f92116f20c3ba302 100644 (file)
@@ -1,37 +1,44 @@
 //  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
-// 
-//  This library is free software; you can redistribute it and/or 
-//  modify it under the terms of the GNU Lesser General Public 
-//  License as published by the Free Software Foundation; either 
-//  version 2.1 of the License. 
-// 
-//  This library is distributed in the hope that it will be useful, 
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of 
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
-//  Lesser General Public License for more details. 
-// 
-//  You should have received a copy of the GNU Lesser General Public 
-//  License along with this library; if not, write to the Free Software 
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
-// 
-//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
 
 #ifndef SMESHGUI_VTKUtils_HeaderFile
 #define SMESHGUI_VTKUtils_HeaderFile
 
 class QString;
-class vtkRenderer;  
+class vtkRenderer;
 class TColStd_IndexedMapOfInteger;
 
+#include "SALOMEDSClient_definitions.hxx"
 #include "SALOME_InteractiveObject.hxx"
 #include "VTKViewer_Filter.h"
 
-class QAD_Study;
-class QAD_StudyFrame;
-class SALOME_Selection;
-class VTKViewer_ViewFrame;
-class VTKViewer_InteractorStyleSALOME;
+class SALOMEDSClient_Study;
+
+class SUIT_Study;
+class SUIT_ViewWindow;
+class SUIT_ViewManager;
+
+class SVTK_InteractorStyle;
+class SVTK_ViewWindow;
+class SVTK_Selector;
+
+class SalomeApp_SelectionMgr;
 
 #include <CORBA.h>
 
@@ -41,8 +48,10 @@ class VTKViewer_InteractorStyleSALOME;
 #include <boost/shared_ptr.hpp>
 #include "SMESH_Object.h"
 
-class SALOME_Actor;
 class SMESH_Actor;
+class SALOME_Actor;
+class SVTK_ViewWindow;
+class SalomeApp_Module;
 
 namespace SMESH{
 
@@ -52,47 +61,39 @@ namespace SMESH{
   TVisualObjPtr GetVisualObj(int theStudyId, 
                             const char* theEntry);
 
-
   //----------------------------------------------------------------------------
-  QAD_StudyFrame* GetActiveStudyFrame();
+  SVTK_ViewWindow* GetViewWindow(const SalomeApp_Module* theModule);
 
-  VTKViewer_ViewFrame* FindVtkViewFrame(QAD_Study* theStudy,
-                                       QAD_StudyFrame* theStudyFrame);
+  SUIT_ViewWindow* GetActiveWindow();
 
-  VTKViewer_ViewFrame* GetVtkViewFrame(QAD_StudyFrame* theStudyFrame);
+  SVTK_ViewWindow* FindVtkViewWindow( SUIT_ViewManager*,
+                                     SUIT_ViewWindow* );
 
-  VTKViewer_ViewFrame* GetCurrentVtkView();
+  SVTK_ViewWindow* GetVtkViewWindow( SUIT_ViewWindow* );
 
-  void RepaintViewFrame(VTKViewer_ViewFrame* theFrame);
+  SVTK_ViewWindow* GetCurrentVtkView();
 
-  void RenderViewFrame(VTKViewer_ViewFrame* theFrame);
+  void RepaintViewWindow(SVTK_ViewWindow*);
+  void RenderViewWindow(SVTK_ViewWindow*);
 
   //----------------------------------------------------------------------------
-  SMESH_Actor* FindActorByEntry(QAD_StudyFrame *theStudyFrame, 
-                               const char* theEntry);
-  SMESH_Actor* FindActorByEntry(const char* theEntry);
-
-  SMESH_Actor* FindActorByObject(CORBA::Object_ptr theObject);
+  SMESH_Actor* FindActorByEntry (SUIT_ViewWindow*, const char* theEntry);
+  SMESH_Actor* FindActorByEntry (const char* theEntry);
 
+  SMESH_Actor* FindActorByObject (CORBA::Object_ptr theObject);
 
   //----------------------------------------------------------------------------
-  SMESH_Actor* CreateActor(SALOMEDS::Study_ptr theStudy,
-                          const char* theEntry,
-                          int theIsClear = false);
-
-  void DisplayActor(QAD_StudyFrame *theStudyFrame, 
-                   SMESH_Actor* theActor);
-  void RemoveActor(QAD_StudyFrame *theStudyFrame, 
-                  SMESH_Actor* theActor);
-
+  SMESH_Actor* CreateActor (_PTR(Study), const char*, int = false);
+  void DisplayActor (SUIT_ViewWindow*, SMESH_Actor* theActor);
+  void RemoveActor  (SUIT_ViewWindow*, SMESH_Actor* theActor);
 
   //----------------------------------------------------------------------------
   enum EDisplaing {eDisplayAll, eDisplay, eDisplayOnly, eErase, eEraseAll};
-  void UpdateView(QAD_StudyFrame *theStudyFrame
-                 EDisplaing theAction, 
-                 const char* theEntry = "");
-  void UpdateView(EDisplaing theAction, 
-                 const char* theEntry = "");
+  void UpdateView (SUIT_ViewWindow*
+                  EDisplaing theAction, 
+                  const char* theEntry = "");
+  void UpdateView (EDisplaing theAction, 
+                  const char* theEntry = "");
 
   void UpdateView();
 
@@ -117,78 +118,62 @@ namespace SMESH{
 
 
   //----------------------------------------------------------------------------
-  VTKViewer_InteractorStyleSALOME
-    GetInteractorStyle(QAD_StudyFrame *theStudyFrame = GetActiveStudyFrame());
+  SVTK_InteractorStyle
+    GetInteractorStyle (SUIT_ViewWindow* = GetActiveWindow());
 
-  void SetFilter(const Handle(VTKViewer_Filter)& theFilter,
-                VTKViewer_InteractorStyleSALOME* theStyle = GetInteractorStyle());
+  void SetFilter (const Handle(VTKViewer_Filter)& theFilter,
+                 SVTK_InteractorStyle* theStyle = GetInteractorStyle());
 
   Handle(VTKViewer_Filter) 
-    GetFilter(int theId, VTKViewer_InteractorStyleSALOME* theStyle = GetInteractorStyle());
+    GetFilter (int theId, SVTK_InteractorStyle* theStyle = GetInteractorStyle());
 
-  bool IsFilterPresent(int theId, 
-                      VTKViewer_InteractorStyleSALOME* theStyle = GetInteractorStyle());
+  bool IsFilterPresent (int theId, 
+                       SVTK_InteractorStyle* theStyle = GetInteractorStyle());
 
-  void RemoveFilter(int theId, 
-                   VTKViewer_InteractorStyleSALOME* theStyle = GetInteractorStyle());
+  void RemoveFilter (int theId, 
+                    SVTK_InteractorStyle* theStyle = GetInteractorStyle());
 
-  void RemoveFilters(VTKViewer_InteractorStyleSALOME* theStyle = GetInteractorStyle());
+  void RemoveFilters (SVTK_InteractorStyle* theStyle = GetInteractorStyle());
 
-  bool IsValid(SALOME_Actor* theActor, int theCellId,
-              VTKViewer_InteractorStyleSALOME* theStyle = GetInteractorStyle());
+  bool IsValid (SALOME_Actor* theActor, int theCellId,
+               SVTK_InteractorStyle* theStyle = GetInteractorStyle());
 
   //----------------------------------------------------------------------------
-  int GetNameOfSelectedNodes(SALOME_Selection *theSel
+  int GetNameOfSelectedNodes(SVTK_Selector* theSelector
                             const Handle(SALOME_InteractiveObject)& theIO, 
                             QString& theName);
-
-  int GetNameOfSelectedNodes(SALOME_Selection *theSel, 
-                            QString& aName);
-
-  int GetNameOfSelectedElements(SALOME_Selection *theSel, 
+  
+  int GetNameOfSelectedElements(SVTK_Selector* theSelector, 
                                const Handle(SALOME_InteractiveObject)& theIO, 
                                QString& theName);
+  
+  int GetEdgeNodes(SVTK_Selector* theSelector, 
+                  const TVisualObjPtr& theVisualObj,
+                  int& theId1, 
+                  int& theId2);
 
-  int GetNameOfSelectedElements(SALOME_Selection *theSel, 
-                               QString& aName);
-
-  int GetSelected(SALOME_Selection* theSel, 
-                 TColStd_IndexedMapOfInteger& theMap, 
-                 const bool theIsElement = true );
-
-  int GetEdgeNodes(SALOME_Selection* theSel, int& theId1, int& theId2);
-
-  void SetControlsPrecision( const long theVal );
-
-};
-
-
-#endif
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+  //----------------------------------------------------------------------------
+  int GetNameOfSelectedNodes (SalomeApp_SelectionMgr*, 
+                             const Handle(SALOME_InteractiveObject)& theIO, 
+                             QString& theName);
 
+  int GetNameOfSelectedNodes (SalomeApp_SelectionMgr*, 
+                             QString& aName);
 
+  int GetNameOfSelectedElements (SalomeApp_SelectionMgr*, 
+                                const Handle(SALOME_InteractiveObject)& theIO, 
+                                QString& theName);
 
+  int GetNameOfSelectedElements (SalomeApp_SelectionMgr*, 
+                                QString& aName);
 
+  int GetSelected (SalomeApp_SelectionMgr*, 
+                  TColStd_IndexedMapOfInteger& theMap, 
+                  const bool theIsElement = true );
 
+  int GetEdgeNodes (SalomeApp_SelectionMgr*, int& theId1, int& theId2);
 
+  void SetControlsPrecision (const long theVal);
+};
 
+#endif
index 9939eb73043e41f5511451c0634e65f2488291fe..cf3a82c95c546078cc60c5353411788a78b63eb3 100644 (file)
@@ -30,8 +30,9 @@
 // QT Include
 #include <qfileinfo.h>
 
-#include "QAD_ResourceMgr.h"
-#include "QAD_Desktop.h"
+#include "SMESHGUI.h"
+#include "SUIT_ResourceMgr.h"
+#include "SUIT_Desktop.h"
 
 #include "SMESHGUI_XmlHandler.h"
 #include "SMESHGUI_Hypotheses.h"
@@ -92,10 +93,9 @@ bool SMESHGUI_XmlHandler::startElement (const QString&, const QString&,
       if (aResName != "")
       {
         MESSAGE("Loading Resources " << aResName);
-        QAD_ResourceMgr* resMgr = QAD_Desktop::createResourceManager();
-        QString msg;
-        if (!resMgr->loadResources(aResName, msg))
-          MESSAGE(msg);
+        SUIT_ResourceMgr* resMgr = SMESHGUI::resourceMgr();
+        resMgr->loadTranslator("resources",aResName+"_msg_en.qm");
+       resMgr->loadTranslator("resources",aResName+"_images.qm");
       }
     }
   }
index 7ba5e20dc774991f46940b9eccd2e857a4e2e84e..d52b641babcb2215caf00420b2a568477dd3d642 100644 (file)
@@ -1,23 +1,23 @@
 //  SMESH SMESHGUI : GUI for SMESH component
 //
 //  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
-// 
-//  This library is free software; you can redistribute it and/or 
-//  modify it under the terms of the GNU Lesser General Public 
-//  License as published by the Free Software Foundation; either 
-//  version 2.1 of the License. 
-// 
-//  This library is distributed in the hope that it will be useful, 
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of 
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
-//  Lesser General Public License for more details. 
-// 
-//  You should have received a copy of the GNU Lesser General Public 
-//  License along with this library; if not, write to the Free Software 
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
-// 
-//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
 //
 //
 //
 //  $Header$
 
 #include "SMESHGUI_aParameter.h"
-  
+
 #include <qspinbox.h>
 #include <qvalidator.h>
 #include <qtextedit.h>
 
-#include "QAD_SpinBoxDbl.h"
+#include <QtxDblSpinBox.h>
 
 SMESHGUI_aParameter::~SMESHGUI_aParameter() {}
 
@@ -39,93 +39,96 @@ SMESHGUI_aParameter::~SMESHGUI_aParameter() {}
 // class    : SMESHGUI_intParameter
 // purpose  :
 //=================================================================================
-SMESHGUI_intParameter::SMESHGUI_intParameter(const int      theInitValue,
-                                             const QString& theLabel,
-                                             const int      theBottom,   
-                                             const int      theTop)
+SMESHGUI_intParameter::SMESHGUI_intParameter (const int      theInitValue,
+                                              const QString& theLabel,
+                                              const int      theBottom,
+                                              const int      theTop)
      :SMESHGUI_aParameter(theLabel),
-       _top(theTop), _bottom(theBottom), _initValue( theInitValue )
+       _top(theTop), _bottom(theBottom), _initValue(theInitValue)
 {
 }
 SMESHGUI_aParameter::Type SMESHGUI_intParameter::GetType() const
 {
   return SMESHGUI_aParameter::INT;
 }
-bool SMESHGUI_intParameter::GetNewInt( int & theValue ) const
+bool SMESHGUI_intParameter::GetNewInt (int & theValue) const
 {
   theValue = _newValue;
   return _newValue != _initValue;
 }
-bool SMESHGUI_intParameter::GetNewDouble( double & Value ) const
+bool SMESHGUI_intParameter::GetNewDouble (double & Value) const
 {
   return false;
 }
-bool SMESHGUI_intParameter::GetNewText( QString & Value ) const
+bool SMESHGUI_intParameter::GetNewText (QString & Value) const
 {
   return false;
 }
-void SMESHGUI_intParameter::InitializeWidgetQWidget* theQWidget) const
+void SMESHGUI_intParameter::InitializeWidget (QWidget* theQWidget) const
 {
-  QSpinBox * aSpin = dynamic_cast< QSpinBox *>( theQWidget );
-  if ( aSpin ) {
-    aSpin->setMinValue( _bottom );
-    aSpin->setMaxValue( _top );
-    aSpin->setValue( _initValue );
+  QSpinBox * aSpin = dynamic_cast< QSpinBox *>(theQWidget);
+  if (aSpin) {
+    aSpin->setMinValue(_bottom);
+    aSpin->setMaxValue(_top);
+    aSpin->setValue(_initValue);
   }
 }
-void SMESHGUI_intParameter::TakeValueQWidget* theQWidget)
+void SMESHGUI_intParameter::TakeValue (QWidget* theQWidget)
 {
-  QSpinBox * aSpin = dynamic_cast< QSpinBox *>( theQWidget );
-  if ( aSpin )
+  QSpinBox * aSpin = dynamic_cast< QSpinBox *>(theQWidget);
+  if (aSpin)
     _newValue = aSpin->value();
 }
+
 //=================================================================================
 // class    : SMESHGUI_doubleParameter
 // purpose  :
 //=================================================================================
-SMESHGUI_doubleParameter::SMESHGUI_doubleParameter(const double   theInitValue,
-                                                   const QString& theLabel,
-                                                   const double   theBottom,   
-                                                   const double   theTop,
-                                                   const double   theStep,
-                                                   const int      theDecimals)
-     :SMESHGUI_aParameter( theLabel ),
-       _top( theTop ), _bottom( theBottom ), _step( theStep ),
-       _initValue( theInitValue ), _decimals( theDecimals )
+SMESHGUI_doubleParameter::SMESHGUI_doubleParameter (const double   theInitValue,
+                                                    const QString& theLabel,
+                                                    const double   theBottom,
+                                                    const double   theTop,
+                                                    const double   theStep,
+                                                    const int      theDecimals)
+     :SMESHGUI_aParameter(theLabel),
+       _top(theTop), _bottom(theBottom), _step(theStep),
+       _initValue(theInitValue), _decimals(theDecimals)
 {
 }
 SMESHGUI_aParameter::Type SMESHGUI_doubleParameter::GetType() const
 {
   return SMESHGUI_aParameter::DOUBLE;
 }
-bool SMESHGUI_doubleParameter::GetNewInt( int & theValue ) const
+bool SMESHGUI_doubleParameter::GetNewInt (int & theValue) const
 {
   return false;
 }
-bool SMESHGUI_doubleParameter::GetNewDouble( double & Value ) const
+bool SMESHGUI_doubleParameter::GetNewDouble (double & Value) const
 {
   Value = _newValue;
   return _newValue != _initValue;
 }
-bool SMESHGUI_doubleParameter::GetNewText( QString & Value ) const
+bool SMESHGUI_doubleParameter::GetNewText (QString & Value) const
 {
   return false;
 }
-void SMESHGUI_doubleParameter::InitializeWidget( QWidget* theQWidget) const
-{
-  QAD_SpinBoxDbl * aSpin = dynamic_cast< QAD_SpinBoxDbl *>( theQWidget );
-  if ( aSpin ) {
-    aSpin->setPrecision( _decimals );
-    aSpin->setDblPrecision( _bottom );
-    aSpin->setRange( _bottom, _top );
-    aSpin->setValue( _initValue );
-    aSpin->setLineStep( _step );
+void SMESHGUI_doubleParameter::InitializeWidget (QWidget* theQWidget) const
+{
+  QtxDblSpinBox* aSpin = dynamic_cast<QtxDblSpinBox*>(theQWidget);
+  if (aSpin) {
+    aSpin->setPrecision(_decimals);
+#ifdef NEW_GUI
+    aSpin->setDblPrecision(_bottom);
+#endif
+    aSpin->setRange(_bottom, _top);
+    aSpin->setValue(_initValue);
+    aSpin->setLineStep(_step);
   }
 }
-void SMESHGUI_doubleParameter::TakeValueQWidget* theQWidget)
+void SMESHGUI_doubleParameter::TakeValue (QWidget* theQWidget)
 {
-  QAD_SpinBoxDbl * aSpin = dynamic_cast< QAD_SpinBoxDbl *>( theQWidget );
-  if ( aSpin )
+  QtxDblSpinBox* aSpin = dynamic_cast<QtxDblSpinBox*>(theQWidget);
+  if (aSpin)
     _newValue = aSpin->value();
 }
 
@@ -133,39 +136,39 @@ void SMESHGUI_doubleParameter::TakeValue( QWidget* theQWidget)
 // class    : SMESHGUI_strParameter
 // purpose  :
 //=================================================================================
-SMESHGUI_strParameter::SMESHGUI_strParameter(const QString& theInitValue,
-                                             const QString& theLabel)
+SMESHGUI_strParameter::SMESHGUI_strParameter (const QString& theInitValue,
+                                              const QString& theLabel)
      :SMESHGUI_aParameter(theLabel),
-      _initValue( theInitValue )
+      _initValue(theInitValue)
 {
 }
 SMESHGUI_aParameter::Type SMESHGUI_strParameter::GetType() const
 {
   return SMESHGUI_aParameter::TEXT;
 }
-bool SMESHGUI_strParameter::GetNewInt( int & theValue ) const
+bool SMESHGUI_strParameter::GetNewInt (int & theValue) const
 {
   return false;
 }
-bool SMESHGUI_strParameter::GetNewDouble( double & Value ) const
+bool SMESHGUI_strParameter::GetNewDouble (double & Value) const
 {
   return false;
 }
-bool SMESHGUI_strParameter::GetNewText( QString & theValue ) const
+bool SMESHGUI_strParameter::GetNewText (QString & theValue) const
 {
   theValue = _newValue;
   return _newValue != _initValue;
 }
-void SMESHGUI_strParameter::InitializeWidgetQWidget* theQWidget) const
+void SMESHGUI_strParameter::InitializeWidget (QWidget* theQWidget) const
 {
-  QTextEdit * anEdit = dynamic_cast< QTextEdit *>( theQWidget );
-  if ( anEdit ) {
-    anEdit->setText( _initValue );
+  QTextEdit * anEdit = dynamic_cast< QTextEdit *>(theQWidget);
+  if (anEdit) {
+    anEdit->setText(_initValue);
   }
 }
-void SMESHGUI_strParameter::TakeValueQWidget* theQWidget)
+void SMESHGUI_strParameter::TakeValue (QWidget* theQWidget)
 {
-  QTextEdit * anEdit = dynamic_cast< QTextEdit *>( theQWidget );
-  if ( anEdit )
+  QTextEdit * anEdit = dynamic_cast< QTextEdit *>(theQWidget);
+  if (anEdit)
     _newValue = anEdit->text();
 }
index 67a11b56ce5ddea5b6e6ffe9ebecff00ce8d7c48..07c1ce1f9452378fe1b8bb2b1b45eb0dca2f5439 100644 (file)
@@ -1,23 +1,23 @@
 //  SMESH SMESHGUI : GUI for SMESH component
 //
 //  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
-// 
-//  This library is free software; you can redistribute it and/or 
-//  modify it under the terms of the GNU Lesser General Public 
-//  License as published by the Free Software Foundation; either 
-//  version 2.1 of the License. 
-// 
-//  This library is distributed in the hope that it will be useful, 
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of 
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
-//  Lesser General Public License for more details. 
-// 
-//  You should have received a copy of the GNU Lesser General Public 
-//  License along with this library; if not, write to the Free Software 
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
-// 
-//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
 //
 //
 //
 //  Module : SMESH
 //  $Header$
 
-#include "QAD_Tools.h"
-#include "QAD_Desktop.h"
-#include "QAD_Application.h"
-
 #include "SMESHGUI_aParameterDlg.h"
 #include "SMESHGUI_aParameter.h"
 #include "SMESHGUI.h"
 #include "SMESHGUI_SpinBox.h"
 
+#include "SUIT_Tools.h"
+#include "SUIT_Desktop.h"
+
 // QT Includes
 #include <qgroupbox.h>
 #include <qlabel.h>
 
 using namespace std;
 
-//====================================================================================== 
+//======================================================================================
 // function : SMESHGUI_aParameterDlg()
 //
 //  The dialog will by default be modal, unless you set 'modal' to
 //  false when constructing dialog
-// 
-//====================================================================================== 
+//
+//======================================================================================
 SMESHGUI_aParameterDlg::SMESHGUI_aParameterDlg
                                         (std::list<SMESHGUI_aParameterPtr> params,
                                          QWidget*                          parent,
                                          QString                           title,
-                                         bool                              modal ) 
-: QDialog( parent, "MyParameterDialog", modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ),
-  myParamList( params )
+                                         bool                              modal)
+: QDialog(parent, "MyParameterDialog", modal, WStyle_Customize |
+          WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu),
+  myParamList(params)
 {
   /* creating widgets */
   init();
   /* title */
-  setCaption( title );
+  setCaption(title);
 
   /* Move widget on the botton right corner of main widget */
-  QAD_Tools::centerWidget( this, parent );
+  SUIT_Tools::centerWidget(this, parent);
 }
 
-//====================================================================================== 
+//======================================================================================
 // function : SMESHGUI_aParameterDlg::init()
 // purpose  : creates dialog's layout
-//====================================================================================== 
+//======================================================================================
 void SMESHGUI_aParameterDlg::init()
 {
-  setSizeGripEnabled( TRUE );
-  
-  QGridLayout* topLayout = new QGridLayout( this );
-  topLayout->setMargin( 11 ); topLayout->setSpacing( 6 );
+  setSizeGripEnabled(TRUE);
+
+  QGridLayout* topLayout = new QGridLayout(this);
+  topLayout->setMargin(11); topLayout->setSpacing(6);
 
   /***************************************************************/
-  QGroupBox* GroupC1 = new QGroupBox( this, "GroupC1" );
-  GroupC1->setColumnLayout(0, Qt::Vertical );
-  GroupC1->layout()->setSpacing( 0 );
-  GroupC1->layout()->setMargin( 0 );
-  QGridLayout* GroupC1Layout = new QGridLayout( GroupC1->layout() );
-  GroupC1Layout->setAlignment( Qt::AlignTop );
-  GroupC1Layout->setSpacing( 6 );
-  GroupC1Layout->setMargin( 11 );
+  QGroupBox* GroupC1 = new QGroupBox(this, "GroupC1");
+  GroupC1->setColumnLayout(0, Qt::Vertical);
+  GroupC1->layout()->setSpacing(0);
+  GroupC1->layout()->setMargin(0);
+  QGridLayout* GroupC1Layout = new QGridLayout(GroupC1->layout());
+  GroupC1Layout->setAlignment(Qt::AlignTop);
+  GroupC1Layout->setSpacing(6);
+  GroupC1Layout->setMargin(11);
   /* Spin boxes with labels */
   list<SMESHGUI_aParameterPtr>::iterator paramIt = myParamList.begin();
-  for ( int row = 0; paramIt != myParamList.end(); paramIt++ , row++ )
+  for (int row = 0; paramIt != myParamList.end(); paramIt++ , row++)
   {
     SMESHGUI_aParameterPtr param = (*paramIt);
-    QLabel * label = new QLabel( GroupC1, "TextLabel" );
-    GroupC1Layout->addWidget( label, row, 0 );
-    label->setText( param->Label() );
+    QLabel * label = new QLabel(GroupC1, "TextLabel");
+    GroupC1Layout->addWidget(label, row, 0);
+    label->setText(param->Label());
     QWidget* aSpinWidget = 0;
-    switch ( param->GetType() ) {
+    switch (param->GetType()) {
     case SMESHGUI_aParameter::DOUBLE: {
-      SMESHGUI_SpinBox* spin = new SMESHGUI_SpinBox( GroupC1 );
+      SMESHGUI_SpinBox* spin = new SMESHGUI_SpinBox(GroupC1);
       aSpinWidget = spin;
-      spin->setPrecision( 12 );
+      spin->setPrecision(12);
       break;
     }
     case SMESHGUI_aParameter::INT: {
-      QSpinBox* spin = new QSpinBox( GroupC1 );
+      QSpinBox* spin = new QSpinBox(GroupC1);
       aSpinWidget = spin;
       break;
     }
     case SMESHGUI_aParameter::TEXT: {
-      QTextEdit* edit = new QTextEdit( GroupC1 );
-      edit->setWordWrap( QTextEdit::NoWrap );
-      edit->setTextFormat( Qt::PlainText );
+      QTextEdit* edit = new QTextEdit(GroupC1);
+      edit->setWordWrap(QTextEdit::NoWrap);
+      edit->setTextFormat(Qt::PlainText);
       aSpinWidget = edit;
       break;
     }
     default:;
     }
-    if ( aSpinWidget ) {
-      GroupC1Layout->addWidget( aSpinWidget, row, 1 );
-      aSpinWidget->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Minimum ) );
-      aSpinWidget->setMinimumSize( 150, 0 );
-      param->InitializeWidget( aSpinWidget );
-      mySpinList.push_back( aSpinWidget );
+    if (aSpinWidget) {
+      GroupC1Layout->addWidget(aSpinWidget, row, 1);
+      aSpinWidget->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum));
+      aSpinWidget->setMinimumSize(150, 0);
+      param->InitializeWidget(aSpinWidget);
+      mySpinList.push_back(aSpinWidget);
     }
   }
-  
+
   /***************************************************************/
-  QGroupBox* GroupButtons = new QGroupBox( this, "GroupButtons" );
-  GroupButtons->setColumnLayout(0, Qt::Vertical );
-  GroupButtons->layout()->setSpacing( 0 );
-  GroupButtons->layout()->setMargin( 0 );
-  QGridLayout* GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
-  GroupButtonsLayout->setAlignment( Qt::AlignTop );
-  GroupButtonsLayout->setSpacing( 6 );
-  GroupButtonsLayout->setMargin( 11 );
+  QGroupBox* GroupButtons = new QGroupBox(this, "GroupButtons");
+  GroupButtons->setColumnLayout(0, Qt::Vertical);
+  GroupButtons->layout()->setSpacing(0);
+  GroupButtons->layout()->setMargin(0);
+  QGridLayout* GroupButtonsLayout = new QGridLayout(GroupButtons->layout());
+  GroupButtonsLayout->setAlignment(Qt::AlignTop);
+  GroupButtonsLayout->setSpacing(6);
+  GroupButtonsLayout->setMargin(11);
   /* Ok button */
-  myButtonOk = new QPushButton( GroupButtons, "buttonOk" );
-  myButtonOk->setText( tr("SMESH_BUT_OK") );
-  myButtonOk->setAutoDefault( TRUE );
-  myButtonOk->setDefault( TRUE );
-  GroupButtonsLayout->addWidget( myButtonOk, 0, 0 );
+  myButtonOk = new QPushButton(GroupButtons, "buttonOk");
+  myButtonOk->setText(tr("SMESH_BUT_OK"));
+  myButtonOk->setAutoDefault(TRUE);
+  myButtonOk->setDefault(TRUE);
+  GroupButtonsLayout->addWidget(myButtonOk, 0, 0);
   /* add spacer between buttons */
-  GroupButtonsLayout->addItem( new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ), 0, 1 );
+  GroupButtonsLayout->addItem(new QSpacerItem(20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum), 0, 1);
   /* Cancel button */
-  myButtonCancel = new QPushButton( GroupButtons, "buttonCancel" );
-  myButtonCancel->setText( tr("SMESH_BUT_CANCEL") );
-  myButtonCancel->setAutoDefault( TRUE );
-  GroupButtonsLayout->addWidget( myButtonCancel, 0, 2 );
-  
+  myButtonCancel = new QPushButton(GroupButtons, "buttonCancel");
+  myButtonCancel->setText(tr("SMESH_BUT_CANCEL"));
+  myButtonCancel->setAutoDefault(TRUE);
+  GroupButtonsLayout->addWidget(myButtonCancel, 0, 2);
+
   /***************************************************************/
-  topLayout->addWidget( GroupC1,      0, 0);
-  topLayout->addWidget( GroupButtons, 1, 0);
+  topLayout->addWidget(GroupC1,      0, 0);
+  topLayout->addWidget(GroupButtons, 1, 0);
 
   /* signals and slots connections */
-  connect( myButtonOk,     SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
-  connect( myButtonCancel, SIGNAL( clicked() ), this, SLOT( reject() ) );
+  connect(myButtonOk,     SIGNAL(clicked()), this, SLOT(ClickOnOk()));
+  connect(myButtonCancel, SIGNAL(clicked()), this, SLOT(reject()));
 
   /* Retrieve SMESHGUI */
-  mySMESHGUI = SMESHGUI::GetSMESHGUI() ;
+  mySMESHGUI = SMESHGUI::GetSMESHGUI();
 }
 
-
-//====================================================================================== 
+//======================================================================================
 // function : ~SMESHGUI_aParameterDlg()
 // purpose  : Destructor
-//====================================================================================== 
-SMESHGUI_aParameterDlg::~SMESHGUI_aParameterDlg() 
+//======================================================================================
+SMESHGUI_aParameterDlg::~SMESHGUI_aParameterDlg()
 {
 }
 
 //=======================================================================
 //function : ClickOnOk
-//purpose  : 
+//purpose  :
 //=======================================================================
-
 void SMESHGUI_aParameterDlg::ClickOnOk()
 {
-  if ( !mySMESHGUI->ActiveStudyLocked() ) {
-    list<SMESHGUI_aParameterPtr>::iterator paramIt = myParamList.begin();
-    list<QWidget*>::iterator              widgetIt = mySpinList.begin();
-    for ( ;
+  if (!mySMESHGUI->isActiveStudyLocked()) {
+    list<SMESHGUI_aParameterPtr>::iterator paramIt  = myParamList.begin();
+    list<QWidget*>::iterator               widgetIt = mySpinList.begin();
+    for (;
          paramIt != myParamList.end() && widgetIt != mySpinList.end();
-         paramIt++ , widgetIt++ )
-      (*paramIt)->TakeValue( *widgetIt );
+         paramIt++ , widgetIt++)
+      (*paramIt)->TakeValue(*widgetIt);
 
     accept();
   }
 }
 
-
 //=======================================================================
 // function : Parameters()
 // purpose  : return a list of parameters from a dialog box
 //=======================================================================
-bool SMESHGUI_aParameterDlg::Parameters( list<SMESHGUI_aParameterPtr> params, const char *aTitle)
+bool SMESHGUI_aParameterDlg::Parameters (list<SMESHGUI_aParameterPtr> params,
+                                         const char *aTitle)
 {
-  if ( !params.empty() ) {
+  if (!params.empty()) {
     SMESHGUI_aParameterDlg *Dialog =
-      new SMESHGUI_aParameterDlg(params,
-                                 QAD_Application::getDesktop(),
-                                 aTitle,
-                                 TRUE);
+      new SMESHGUI_aParameterDlg(params, SMESHGUI::desktop(), aTitle, TRUE);
     return (Dialog->exec() == QDialog::Accepted);
   }
   return false;
index 0d7dcc3990d8d44f495745cb69d2cc2c6d726714..7c9cd19aa9f7af982d2365da5b65751f377650ee 100644 (file)
@@ -40,25 +40,24 @@ class QPushButton;
 class SMESHGUI;
 class QWidget;
 
-
 //=================================================================================
 // class    : SMESHGUI_aParameterDlg
 // purpose  :
 //=================================================================================
 class SMESHGUI_aParameterDlg : public QDialog
-{ 
+{
     Q_OBJECT
 
 public:
-    SMESHGUI_aParameterDlgstd::list<SMESHGUI_aParameterPtr> params,
+    SMESHGUI_aParameterDlg (std::list<SMESHGUI_aParameterPtr> params,
                            QWidget*                          parent = 0,
                            QString                           title  = QString::null,
-                           bool                              modal  = TRUE );
+                           bool                              modal  = TRUE);
 
     ~SMESHGUI_aParameterDlg();
 
     /* Parameter function */
-    static bool Parametersstd::list<SMESHGUI_aParameterPtr> params, const char *aTitle);
+    static bool Parameters (std::list<SMESHGUI_aParameterPtr> params, const char *aTitle);
 
 protected:
     void init();
@@ -67,7 +66,7 @@ private slots:
     void ClickOnOk();
 
 private:
-    SMESHGUI*       mySMESHGUI ;
+    SMESHGUI*       mySMESHGUI;
 
     QPushButton*    myButtonOk;
     QPushButton*    myButtonCancel;
diff --git a/src/SMESHGUI/SMESH_images.po b/src/SMESHGUI/SMESH_images.po
new file mode 100644 (file)
index 0000000..679a49c
--- /dev/null
@@ -0,0 +1,328 @@
+# This is a Qt message file in .po format.  Each msgid starts with
+# a scope.  This scope should *NOT* be translated - eg. "Foo::Bar"
+# would be translated to "Pub", not "Foo::Pub".
+msgid ""
+msgstr ""
+"Project-Id-Version: PROJECT VERSION\n"
+"POT-Creation-Date: 2002-05-28 10:57:43 AM CEST\n"
+"PO-Revision-Date: 2005-06-07 10:51+0400\n"
+"Last-Translator: FULLNAME <EMAIL@ADDRESS>\n"
+"Content-Type: text/plain; charset=iso-8859-1\n"
+
+
+#-----------------------------------------------------------
+# Divers Mesh
+#-----------------------------------------------------------
+
+#ObjectBrowser Icon
+msgid "ICON_OBJBROWSER_SMESH"
+msgstr "mesh.png"
+
+#Select Icon
+msgid "ICON_SELECT"
+msgstr "select1.png"
+
+#Mesh Init
+msgid "ICON_DLG_INIT_MESH"
+msgstr "mesh_init.png"
+
+#
+msgid "ICON_DLG_ADD_SUBMESH"
+msgstr "mesh_add_sub.png"
+
+#Move Node
+msgid "ICON_DLG_MOVE_NODE"
+msgstr "mesh_move_node.png"
+
+#Remove Node
+msgid "ICON_DLG_REM_NODE"
+msgstr "mesh_rem_node.png"
+
+#Remove Element
+msgid "ICON_DLG_REM_ELEMENT"
+msgstr "mesh_rem_element.png"
+
+#Orientation
+msgid "ICON_DLG_MESH_ORIENTATION"
+msgstr "mesh_orientation.png"
+
+#
+msgid "ICON_DLG_MESH_DIAGONAL"
+msgstr "mesh_diagonal.png"
+
+#Connectivity
+msgid "ICON_DLG_CONNECTIVITY"
+msgstr "mesh_connectivity.png"
+
+#Smoothing
+msgid "ICON_DLG_SMOOTHING"
+msgstr "mesh_smoothing.png"
+
+#Renumbering nodes
+msgid "ICON_DLG_RENUMBERING_NODES"
+msgstr "mesh_renumbering_nodes.png"
+
+#Renumbering elements
+msgid "ICON_DLG_RENUMBERING_ELEMENTS"
+msgstr "mesh_renumbering_elements.png"
+
+#Rotation
+msgid "ICON_DLG_ROTATION"
+msgstr "mesh_rotation.png"
+
+#Translation by vector
+msgid "ICON_SMESH_TRANSLATION_VECTOR"
+msgstr "mesh_translation_vector.png"
+
+#Translation by two points
+msgid "ICON_SMESH_TRANSLATION_POINTS"
+msgstr "mesh_translation_points.png"
+
+#Symmetry by point
+msgid "ICON_SMESH_SYMMETRY_POINT"
+msgstr "mesh_symmetry_point.png"
+
+#Symmetry by axis
+msgid "ICON_SMESH_SYMMETRY_AXIS"
+msgstr "mesh_symmetry_axis.png"
+
+#Symmetry by plane
+msgid "ICON_SMESH_SYMMETRY_PLANE"
+msgstr "mesh_symmetry_plane.png"
+
+#Sew free borders
+msgid "ICON_SMESH_SEWING_FREEBORDERS"
+msgstr "mesh_sew_freeborders.png"
+
+#Sew conform free borders
+msgid "ICON_SMESH_SEWING_CONFORM_FREEBORDERS"
+msgstr "mesh_sew_conform_freeborders.png"
+
+#Sew border to side
+msgid "ICON_SMESH_SEWING_BORDERTOSIDE"
+msgstr "mesh_sew_bordertoside.png"
+
+#Sew side elements
+msgid "ICON_SMESH_SEWING_SIDEELEMENTS"
+msgstr "mesh_sew_sideelements.png"
+
+#Merge nodes
+msgid "ICON_SMESH_MERGE_NODES"
+msgstr "mesh_merge_nodes.png"
+
+#-----------------------------------------------------------
+# Hypothesis
+#-----------------------------------------------------------
+
+msgid "ICON_HYPO"
+msgstr "mesh_hypo_length.png"
+
+#Set Algo
+msgid "ICON_DLG_ADD_ALGORITHM"
+msgstr "mesh_set_algo.png"
+
+#Set Hypo
+msgid "ICON_DLG_ADD_HYPOTHESIS"
+msgstr "mesh_set_hypo.png"
+
+#Edit Hypo.
+msgid "ICON_DLG_EDIT_MESH"
+msgstr "mesh_edit.png"
+
+
+#-----------------------------------------------------------
+# Elements
+#-----------------------------------------------------------
+
+#Vertex
+msgid "ICON_DLG_NODE"
+msgstr "mesh_vertex.png"
+
+#Line
+msgid "ICON_DLG_EDGE"
+msgstr "mesh_line.png"
+
+#triangle
+msgid "ICON_DLG_TRIANGLE"
+msgstr "mesh_triangle.png"
+
+#Quadrangle
+msgid "ICON_DLG_QUADRANGLE"
+msgstr "mesh_quad.png"
+#Polygone
+msgid "ICON_DLG_POLYGON"
+msgstr "mesh_polygon.png"
+#triangle
+msgid "ICON_DLG_TETRAS"
+msgstr "mesh_tetra.png"
+
+#Quadrangle
+msgid "ICON_DLG_HEXAS"
+msgstr "mesh_hexa.png"
+
+#Polyhedre
+msgid "ICON_DLG_POLYHEDRON"
+msgstr "mesh_polyhedron.png"
+#-----------------------------------------------------------
+# ObjectBrowser
+#-----------------------------------------------------------
+
+#mesh_tree_mesh
+msgid "ICON_SMESH_TREE_MESH"
+msgstr "mesh_tree_mesh.png"    
+
+#mesh_tree_group
+msgid "ICON_SMESH_TREE_GROUP"
+msgstr "mesh_tree_group.png"   
+
+#mesh_tree_algo
+msgid "ICON_SMESH_TREE_ALGO"
+msgstr "mesh_tree_algo.png"
+
+#mesh_tree_hypo
+msgid "ICON_SMESH_TREE_HYPO"
+msgstr "mesh_tree_hypo.png"
+
+#mesh_tree_mesh_warn
+msgid "ICON_SMESH_TREE_MESH_WARN"
+msgstr "mesh_tree_mesh_warn.png"
+
+#mesh_tree_mesh
+msgid "ICON_SMESH_TREE_MESH_IMPORTED"
+msgstr "mesh_tree_importedmesh.png"
+
+
+#-----------------------------------------------------------
+# Group
+#-----------------------------------------------------------
+
+msgid "ICON_EDIT_GROUP"
+msgstr "mesh_edit_group.png"
+
+msgid "ICON_CONSTRUCT_GROUP"
+msgstr "mesh_make_group.png"
+
+#-----------------------------------------------------------
+# Mesh pattern
+#-----------------------------------------------------------
+
+msgid "ICON_PATTERN_2d"
+msgstr "mesh_algo_mefisto.png"
+
+msgid "ICON_PATTERN_3d"
+msgstr "mesh_algo_hexa.png"
+
+msgid "ICON_PATTERN_SAMPLE_2D"
+msgstr "pattern_sample_2d.png"
+
+msgid "ICON_PATTERN_SAMPLE_3D"
+msgstr "pattern_sample_3D.png"
+
+#-----------------------------------------------------------
+# Add/Remove buttons
+#-----------------------------------------------------------
+
+msgid "ICON_APPEND"
+msgstr "mesh_add.png"
+
+msgid "ICON_REMOVE"
+
+msgid "ICON_DELETE"
+msgstr "delete.png"
+
+
+msgid "ICON_COMPUTE"
+msgstr "mesh_compute.png"
+
+msgid "ICON_UNION"
+msgstr "mesh_unionGroups.png"
+
+msgid "ICON_INTERSECT"
+msgstr "mesh_intersectGroups.png"
+
+msgid "ICON_CUT"
+msgstr "mesh_cutGroups.png"
+
+msgid "ICON_DEL_GROUP"
+msgstr "mesh_deleteGroups.png"
+
+msgid "ICON_ADV_INFO"
+msgstr "advanced_mesh_info.png"
+
+msgid "ICON_STD_INFO"
+msgstr "standard_mesh_info.png"
+
+msgid "ICON_LENGTH"
+msgstr "mesh_length.png"
+
+msgid "ICON_LENGTH_2D"
+msgstr "mesh_length_2d.png"
+
+msgid "ICON_AREA"
+msgstr "mesh_area.png"
+
+msgid "ICON_TAPER"
+msgstr "mesh_taper.png"
+
+msgid "ICON_FREE_EDGE"
+msgstr "mesh_free_edges.png"
+
+msgid "ICON_FREE_EDGE_2D"
+msgstr "mesh_free_edges_2d.png"
+
+msgid "ICON_CONNECTION"
+msgstr "mesh_multi_edges.png"
+
+msgid "ICON_CONNECTION_2D"
+msgstr "mesh_multi_edges_2d.png"
+
+msgid "ICON_WIRE"
+msgstr "mesh_wireframe.png"
+
+msgid "ICON_SHADE"
+msgstr "mesh_shading.png"
+
+msgid "ICON_SHRINK"
+msgstr "mesh_shrink.png"
+
+msgid "ICON_POINTS"
+msgstr "mesh_points.png"
+
+msgid "ICON_ASPECT"
+msgstr "mesh_aspect.png"
+
+msgid "ICON_ASPECT_3D"
+msgstr "mesh_aspect_3d.png"
+
+msgid "ICON_ANGLE"
+msgstr "mesh_angle.png"
+
+msgid "ICON_WRAP"
+msgstr "mesh_wrap.png"
+
+msgid "ICON_SKEW"
+msgstr "mesh_skew.png"
+
+msgid "ICON_UPDATE"
+msgstr "mesh_update.png"
+
+msgid "ICON_UNIONTRI"
+msgstr "mesh_uniontri.png"
+
+msgid "ICON_UNION2TRI"
+msgstr "mesh_union2tri.png"
+
+msgid "ICON_CUTQUAD"
+msgstr "mesh_cutquad.png"
+
+msgid "ICON_EXTRUSION"
+msgstr "mesh_extrusion.png"
+
+msgid "ICON_EXTRUSION_ALONG"
+msgstr "mesh_extrusionpath.png"
+
+msgid "ICON_REVOLUTION"
+msgstr "mesh_revolution.png"
+
+msgid "ICON_MAP"
+msgstr "mesh_pattern.png"
index a58c6a758c705591588dd6415f7bdcc474b1f81d..3ed799abeef31b96cab8534037e710759c162a0e 100644 (file)
@@ -1600,7 +1600,7 @@ msgstr "Detect"
 msgid "SMESHGUI_MergeNodesDlg::SELECT_ALL"
 msgstr "Select all"
 
-# Edit group of nodes 
+# Edit group of nodes
 msgid "SMESHGUI_MergeNodesDlg::EDIT_GROUP_OF_NODES"
 msgstr "Edit group of nodes"
 
@@ -1770,17 +1770,861 @@ msgstr "There are objects selected which do not belong to %1 component."
 
 
 
+#-----------   Menu   bar   ----------#
+#------ MEN -----#
+msgid "MEN_DAT"
+msgstr "DAT file"
 
+msgid "MEN_UNV"
+msgstr "UNV file"
 
+msgid "MEN_MED"
+msgstr "MED file"
 
+msgid "MEN_EXPORT_DAT"
+msgstr "Export to DAT file"
+
+msgid "MEN_EXPORT_UNV"
+msgstr "Export to UNV file"
+
+msgid "MEN_EXPORT_MED"
+msgstr "Export to MED file"
+
+msgid "MEN_DELETE"
+msgstr "Delete"
+
+msgid "MEN_SEL_FILTER_LIB"
+msgstr "Selection filters library"
+
+msgid "MEN_CREATE_HYPO"
+msgstr "Create Hypotheses"
+
+msgid "MEN_CREATE_ALG"
+msgstr "Create Algorithms"
+
+msgid "MEN_COMPUTE"
+msgstr "Compute"
+
+msgid "MEN_LOCAL_HYPO"
+msgstr "Local Hypothesis"
+
+msgid "MEN_GLOBAL_HYPO"
+msgstr "Global Hypothesis"
+
+msgid "MEN_EDIT"
+msgstr "Edit"
+
+msgid "MEN_EDIT_GLOBAL_HYPO"
+msgstr "Edit Global Hypothesis"
+
+msgid "MEN_EDIT_LOCAL_HYPO"
+msgstr "Edit Local Hypothesis"
+
+msgid "MEN_EDIT_HYPO"
+msgstr "Edit Hypothesis"
+
+msgid "MEN_CREATE_GROUP"
+msgstr "Create Group"
+
+msgid "MEN_CONSTRUCT_GROUP"
+msgstr "Construct Group"
+
+msgid "MEN_EDIT_GROUP"
+msgstr "Edit Group"
+
+msgid "MEN_UN_GROUP"
+msgstr "Union Groups"
+
+msgid "MEN_INT_GROUP"
+msgstr "Intersect Groups"
+
+msgid "MEN_CUT_GROUP"
+msgstr "Cut Groups"
+
+msgid "MEN_DEL_GROUP"
+msgstr "Delete Groups"
+
+msgid "MEN_ADV_INFO"
+msgstr "Advanced Mesh Infos"
+
+msgid "MEN_STD_INFO"
+msgstr "Standard Mesh Infos"
+
+msgid "MEN_LENGTH"
+msgstr "Length"
+
+msgid "MEN_FREE_EDGE"
+msgstr "Free Edges"
+
+msgid "MEN_FREE_BORDER"
+msgstr "Free Borders"
+
+msgid "MEN_CONNECTION"
+msgstr "Borders at Multi-Connection"
+
+msgid "MEN_AREA"
+msgstr "Area"
+
+msgid "MEN_TAPER"
+msgstr "Taper"
+
+msgid "MEN_ASPECT"
+msgstr "Aspect Ratio"
+
+msgid "MEN_MIN_ANG"
+msgstr "Minimum Angle"
+
+msgid "MEN_WRAP"
+msgstr "Wraping"
+
+msgid "MEN_SKEW"
+msgstr "Skew"
+
+msgid "MEN_ASPECT_3D"
+msgstr "Aspect Ratio 3D"
+
+msgid "MEN_LENGTH_2D"
+msgstr "Length 2D"
+
+msgid "MEN_CONNECTION_2D"
+msgstr "Borders at Multi-Connection 2D"
+
+msgid "MEN_NODE"
+msgstr "Node"
+
+msgid "MEN_EDGE"
+msgstr "Edge"
+
+msgid "MEN_TRIANGLE"
+msgstr "Triangle"
+
+msgid "MEN_QUAD"
+msgstr "Quadrangle"
+
+msgid "MEN_TETRA"
+msgstr "Tetrahedron"
+
+msgid "MEN_HEXA"
+msgstr "Hexahedron"
+
+msgid "MEN_NODES"
+msgstr "Nodes"
+
+msgid "MEN_ELEMENTS"
+msgstr "Elements"
+
+msgid "MEN_TRANS"
+msgstr "Translation"
+
+msgid "MEN_ROT"
+msgstr "Rotation"
+
+msgid "MEN_SYM"
+msgstr "Symmetry"
+
+msgid "MEN_SEW"
+msgstr "Sewing"
+
+msgid "MEN_MERGE"
+msgstr "Merge nodes"
+
+msgid "MEN_MOVE"
+msgstr "Move Node"
+
+msgid "MEN_INV"
+msgstr "Diagonal Inversion"
+
+msgid "MEN_UNION2"
+msgstr "Union of two triangles"
+
+msgid "MEN_ORIENT"
+msgstr "Orientation"
+
+msgid "MEN_UNION"
+msgstr "Union of triangles"
+
+msgid "MEN_CUT"
+msgstr "Cutting of quadrangles"
+
+msgid "MEN_SMOOTH"
+msgstr "Smoothing"
+
+msgid "MEN_EXTRUSION"
+msgstr "Extrusion"
+
+msgid "MEN_REVOLUTION"
+msgstr "Revolution"
+
+msgid "MEN_MAP"
+msgstr "Pattern mapping"
+
+msgid "MEN_EXTRUSION_ALONG"
+msgstr "Extrusion along a path"
+
+msgid "MEN_WIRE"
+msgstr "Wireframe"
+
+msgid "MEN_SHADE"
+msgstr "Shading"
+
+msgid "MEN_SHRINK"
+msgstr "Shrink"
+
+msgid "MEN_AUTO_UPD"
+msgstr "Automatic update"
+
+msgid "MEN_COLORS"
+msgstr "Colors / Size"
+
+msgid "MEN_SCALAR_BAR"
+msgstr "Scalar bar"
+
+msgid "MEN_SELECTION"
+msgstr "Selection"
+
+msgid "MEN_PRECISION"
+msgstr "Precision"
+
+msgid "MEN_DISP_ENT"
+msgstr "Display entity"
+
+msgid "MEN_UPDATE"
+msgstr "Update"
+
+msgid "MEN_FILE"
+msgstr "File"
+
+msgid "MEN_TOOLS"
+msgstr "Tools"
+
+msgid "MEN_HYPO"
+msgstr "Hypotheses"
+
+msgid "MEN_MESH"
+msgstr "Mesh"
+
+msgid "MEN_CTRL"
+msgstr "Controls"
+
+msgid "MEN_MODIFY"
+msgstr "Modification"
+
+msgid "MEN_PREF"
+msgstr "Preferences"
+
+msgid "MEN_VIEW"
+msgstr "View"
+
+msgid "MEN_IMPORT"
+msgstr "Import"
+
+msgid "MEN_EXPORT"
+msgstr "Export"
+
+msgid "MEN_ADD"
+msgstr "Add"
+
+msgid "MEN_REMOVE"
+msgstr "Remove"
+
+msgid "MEN_RENUM"
+msgstr "Renumbering"
+
+msgid "MEN_NUM"
+msgstr "Numbering"
+
+msgid "MEN_TRANSF"
+msgstr "Transformation"
+
+msgid "MEN_DISPMODE"
+msgstr "Display mode"
+
+msgid "MEN_QUALITY"
+msgstr "Quality controls"
+
+msgid "MEN_RENAME"
+msgstr "Rename"
+
+msgid "MEN_NUM_NODES"
+msgstr "Display Nodes #"
+
+msgid "MEN_NUM_ELEMENTS"
+msgstr "Display Elements #"
+
+msgid "MEN_RESET"
+msgstr "Reset"
+
+msgid "MEN_SCALAR_BAR_PROP"
+msgstr "Scalar bar Properties"
+
+msgid "MEN_EDGES"
+msgstr "Edges"
+
+msgid "MEN_FACES"
+msgstr "Faces"
+
+msgid "MEN_VOLUMES"
+msgstr "Volumes"
+
+msgid "MEN_ALL"
+msgstr "All"
+
+msgid "MEN_TRANSP"
+msgstr "Transparency"
+
+msgid "MEN_CLIP"
+msgstr "Clipping"
+
+msgid "MEN_DISPLAY"
+msgstr "Display"
+
+msgid "MEN_ERASE"
+msgstr "Erase"
+
+msgid "MEN_DISPLAY_ONLY"
+msgstr "Display only"
+
+
+#------ TOP -----#
+msgid "TOP_DAT"
+msgstr "Import DAT file"
+
+msgid "TOP_UNV"
+msgstr "Import UNV file"
+
+msgid "TOP_MED"
+msgstr "Import MED file"
+
+msgid "TOP_EXPORT_DAT"
+msgstr "Export to DAT file"
+
+msgid "TOP_EXPORT_UNV"
+msgstr "Export to UNV file"
+
+msgid "TOP_EXPORT_MED"
+msgstr "Export to MED file"
+
+msgid "TOP_DELETE"
+msgstr "Delete"
+
+msgid "TOP_SEL_FILTER_LIB"
+msgstr "Selection filters library"
+
+msgid "TOP_CREATE_HYPO"
+msgstr "Create Hypotheses"
+
+msgid "TOP_CREATE_ALG"
+msgstr "Create Algorithms"
+
+msgid "TOP_COMPUTE"
+msgstr "Compute"
+
+msgid "TOP_LOCAL_HYPO"
+msgstr "Local Hypothesis"
+
+msgid "TOP_GLOBAL_HYPO"
+msgstr "Global Hypothesis"
+
+msgid "TOP_EDIT_GLOBAL_HYPO"
+msgstr "Edit Global Hypothesis"
+
+msgid "TOP_EDIT_LOCAL_HYPO"
+msgstr "Edit Local Hypothesis"
+
+msgid "TOP_EDIT_HYPO"
+msgstr "Edit Hypothesis"
+
+msgid "TOP_CREATE_GROUP"
+msgstr "Create Group"
+
+msgid "TOP_CONSTRUCT_GROUP"
+msgstr "Construct Group"
+
+msgid "TOP_EDIT_GROUP"
+msgstr "Edit Group"
+
+msgid "TOP_UN_GROUP"
+msgstr "Union Groups"
+
+msgid "TOP_INT_GROUP"
+msgstr "Intersect Groups"
+
+msgid "TOP_CUT_GROUP"
+msgstr "Cut Groups"
+
+msgid "TOP_DEL_GROUP"
+msgstr "Delete Groups"
+
+msgid "TOP_ADV_INFO"
+msgstr "Advanced Mesh Infos"
+
+msgid "TOP_STD_INDO"
+msgstr "Standard Mesh Infos"
+
+msgid "TOP_LENGTH"
+msgstr "Length"
+
+msgid "TOP_FREE_EDGE"
+msgstr "Free Edges"
+
+msgid "TOP_FREE_BORDER"
+msgstr "Free Borders"
+
+msgid "TOP_CONNECTION"
+msgstr "Borders at Multi-Connection"
+
+msgid "TOP_AREA"
+msgstr "Area"
+
+msgid "TOP_TAPER"
+msgstr "Taper"
+
+msgid "TOP_ASPECT"
+msgstr "Aspect Ratio"
+
+msgid "TOP_MIN_ANG"
+msgstr "Minimum Angle"
+
+msgid "TOP_WARP"
+msgstr "Wraping"
+
+msgid "TOP_SKEW"
+msgstr "Skew"
+
+msgid "TOP_ASPECT_3D"
+msgstr "Aspect Ratio 3D"
+
+msgid "TOP_LENGTH_2D"
+msgstr "Length 2D"
+
+msgid "TOP_CONNECTION_2D"
+msgstr "Borders at Multi-Connection 2D"
+
+msgid "TOP_NODE"
+msgstr "Node"
+
+msgid "TOP_EDGE"
+msgstr "Edge"
+
+msgid "TOP_TRIANGLE"
+msgstr "Triangle"
+
+msgid "TOP_QUAD"
+msgstr "Quadrangle"
+
+msgid "TOP_TETRA"
+msgstr "Tetrahedron"
+
+msgid "TOP_HEXA"
+msgstr "Hexahedron"
+
+msgid "TOP_NODES"
+msgstr "Nodes"
+
+msgid "TOP_ELEMENTS"
+msgstr "Elements"
+
+msgid "TOP_TRANS"
+msgstr "Translation"
+
+msgid "TOP_ROT"
+msgstr "Rotation"
+
+msgid "TOP_SYM"
+msgstr "Symmetry"
+
+msgid "TOP_SEW"
+msgstr "Sewing"
+
+msgid "TOP_MERGE"
+msgstr "Merge nodes"
+
+msgid "TOP_MOVE"
+msgstr "Move Node"
+
+msgid "TOP_INV"
+msgstr "Diagonal Inversion"
+
+msgid "TOP_UNION2"
+msgstr "Union of two triangles"
+
+msgid "TOP_ORIENT"
+msgstr "Orientation"
+
+msgid "TOP_UNION"
+msgstr "Union of triangles"
+
+msgid "TOP_CUT"
+msgstr "Cutting of quadrangles"
+
+msgid "TOP_SMOOTH"
+msgstr "Smoothing"
+
+msgid "TOP_EXTRUSION"
+msgstr "Extrusion"
+
+msgid "TOP_REVOLUTION"
+msgstr "Revolution"
+
+msgid "TOP_MAP"
+msgstr "Pattern mapping"
+
+msgid "TOP_EXTRUSION_ALONG"
+msgstr "Extrusion along a path"
+
+msgid "TOP_WIRE"
+msgstr "Wireframe"
+
+msgid "TOP_SHADE"
+msgstr "Shading"
+
+msgid "TOP_SHRINK"
+msgstr "Shrink"
+
+msgid "TOP_AUTO_UPD"
+msgstr "Automatic update"
+
+msgid "TOP_COLORS"
+msgstr "Colors / Size"
+
+msgid "TOP_SCALAR_BAR"
+msgstr "Scalar bar"
+
+msgid "TOP_SELECTION"
+msgstr "Selection"
+
+msgid "TOP_PRECISION"
+msgstr "Precision"
+
+msgid "TOP_DISP_ENT"
+msgstr "Display entity"
+
+msgid "TOP_UPDATE"
+msgstr "Update"
+
+msgid "TOP_RENAME"
+msgstr "Rename"
+
+msgid "TOP_NUM_NODES"
+msgstr "Display Nodes"
+
+msgid "TOP_NUM_ELEMENTS"
+msgstr "Display Elements"
+
+msgid "TOP_RESET"
+msgstr "Reset"
+
+msgid "TOP_SCALAR_BAR_PROP"
+msgstr "Scalar bar Properties"
+
+msgid "TOP_EDGES"
+msgstr "Edges"
+
+msgid "TOP_FACES"
+msgstr "Faces"
+
+msgid "TOP_VOLUMES"
+msgstr "Volumes"
+
+msgid "TOP_ALL"
+msgstr "All"
+
+msgid "TOP_TRANSP"
+msgstr "Transparency"
+
+msgid "TOP_CLIP"
+msgstr "Clipping"
+
+msgid "TOP_DISPLAY"
+msgstr "Display"
+
+msgid "TOP_ERASE"
+msgstr "Erase"
+
+msgid "TOP_DISPLAY_ONLY"
+msgstr "Display only"
+
+
+
+
+#------ STB -----#
+msgid "STB_DAT"
+msgstr "Import DAT file"
+
+msgid "STB_UNV"
+msgstr "Import UNV file"
+
+msgid "STB_MED"
+msgstr "Import MED file"
+
+msgid "STB_EXPORT_DAT"
+msgstr "Export to DAT file"
+
+msgid "STB_EXPORT_UNV"
+msgstr "Export to UNV file"
+
+msgid "STB_EXPORT_MED"
+msgstr "Export to MED file"
+
+msgid "STB_DELETE"
+msgstr "Delete"
+
+msgid "STB_SEL_FILTER_LIB"
+msgstr "Selection filters library"
+
+msgid "STB_CREATE_HYPO"
+msgstr "Create Hypotheses"
+
+msgid "STB_CREATE_ALG"
+msgstr "Create Algorithms"
+
+msgid "STB_COMPUTE"
+msgstr "Compute"
+
+msgid "STB_LOCAL_HYPO"
+msgstr "Local Hypothesis"
+
+msgid "STB_GLOBAL_HYPO"
+msgstr "Global Hypothesis"
+
+msgid "STB_EDIT_HYPO"
+msgstr "Edit Hypothesis"
+
+msgid "STB_CREATE_GROUP"
+msgstr "Create Group"
+
+msgid "STB_CONSTRUCT_GROUP"
+msgstr "Construct Group"
+
+msgid "STB_EDIT_GROUP"
+msgstr "Edit Group"
+
+msgid "STB_UN_GROUP"
+msgstr "Union Groups"
+
+msgid "STB_INT_GROUP"
+msgstr "Intersect Groups"
+
+msgid "STB_CUT_GROUP"
+msgstr "Cut Groups"
+
+msgid "STB_DEL_GROUP"
+msgstr "Delete Groups"
+
+msgid "STB_ADV_INFO"
+msgstr "Advanced Mesh Infos"
+
+msgid "STB_STD_INDO"
+msgstr "Standard Mesh Infos"
+
+msgid "STB_LENGTH"
+msgstr "Length"
+
+msgid "STB_FREE_EDGE"
+msgstr "Free Edges"
+
+msgid "STB_FREE_BORDER"
+msgstr "Free Borders"
+
+msgid "STB_CONNECTION"
+msgstr "Borders at Multi-Connection"
+
+msgid "STB_AREA"
+msgstr "Area"
+
+msgid "STB_TAPER"
+msgstr "Taper"
+
+msgid "STB_ASPECT"
+msgstr "Aspect Ratio"
+
+msgid "STB_MIN_ANG"
+msgstr "Minimum Angle"
+
+msgid "STB_WARP"
+msgstr "Wraping"
+
+msgid "STB_SKEW"
+msgstr "Skew"
+
+msgid "STB_ASPECT_3D"
+msgstr "Aspect Ratio 3D"
+
+msgid "STB_LENGTH_2D"
+msgstr "Length 2D"
+
+msgid "STB_CONNECTION_2D"
+msgstr "Borders at Multi-Connection 2D"
+
+msgid "STB_NODE"
+msgstr "Node"
+
+msgid "STB_EDGE"
+msgstr "Edge"
+
+msgid "STB_TRIANGLE"
+msgstr "Triangle"
+
+msgid "STB_QUAD"
+msgstr "Quadrangle"
+
+msgid "STB_TETRA"
+msgstr "Tetrahedron"
+
+msgid "STB_HEXA"
+msgstr "Hexahedron"
+
+msgid "STB_NODES"
+msgstr "Nodes"
+
+msgid "STB_ELEMENTS"
+msgstr "Elements"
+
+msgid "STB_TRANS"
+msgstr "Translation"
+
+msgid "STB_ROT"
+msgstr "Rotation"
+
+msgid "STB_SYM"
+msgstr "Symmetry"
+
+msgid "STB_SEW"
+msgstr "Sewing"
+
+msgid "STB_MERGE"
+msgstr "Merge nodes"
+
+msgid "STB_MOVE"
+msgstr "Move Node"
+
+msgid "STB_INV"
+msgstr "Diagonal Inversion"
+
+msgid "STB_UNION2"
+msgstr "Union of two triangles"
+
+msgid "STB_ORIENT"
+msgstr "Orientation"
+
+msgid "STB_UNION"
+msgstr "Union of triangles"
+
+msgid "STB_CUT"
+msgstr "Cutting of quadrangles"
+
+msgid "STB_SMOOTH"
+msgstr "Smoothing"
+
+msgid "STB_EXTRUSION"
+msgstr "Extrusion"
+
+msgid "STB_REVOLUTION"
+msgstr "Revolution"
+
+msgid "STB_MAP"
+msgstr "Pattern mapping"
+
+msgid "STB_EXTRUSION_ALONG"
+msgstr "Extrusion along a path"
+
+msgid "STB_WIRE"
+msgstr "Wireframe"
+
+msgid "STB_SHADE"
+msgstr "Shading"
+
+msgid "STB_SHRINK"
+msgstr "Shrink"
+
+msgid "STB_AUTO_UPD"
+msgstr "Automatic update"
+
+msgid "STB_COLORS"
+msgstr "Colors / Size"
+
+msgid "STB_SCALAR_BAR"
+msgstr "Scalar bar"
+
+msgid "STB_SELECTION"
+msgstr "Selection"
+
+msgid "STB_PRECISION"
+msgstr "Precision"
+
+msgid "STB_DISP_ENT"
+msgstr "Display entity"
+
+msgid "STB_UPDATE"
+msgstr "Update"
+
+msgid "STB_EDIT_GLOBAL_HYPO"
+msgstr "Edit Global Hypothesis"
+
+msgid "STB_EDIT_LOCAL_HYPO"
+msgstr "Edit Local Hypothesis"
+
+msgid "STB_RENAME"
+msgstr "Rename"
+
+msgid "STB_NUM_NODES"
+msgstr "Display Nodes"
+
+msgid "STB_NUM_ELEMENTS"
+msgstr "Display Elements"
+
+msgid "STB_RESET"
+msgstr "Reset"
+
+msgid "STB_SCALAR_BAR_PROP"
+msgstr "Scalar bar Properties"
+
+msgid "STB_EDGES"
+msgstr "Edges"
+
+msgid "STB_FACES"
+msgstr "Faces"
+
+msgid "STB_VOLUMES"
+msgstr "Volumes"
+
+msgid "STB_ALL"
+msgstr "All"
+
+msgid "STB_TRANSP"
+msgstr "Transparency"
+
+msgid "STB_CLIP"
+msgstr "Clipping"
+
+msgid "STB_DISPLAY"
+msgstr "Display"
+
+msgid "STB_ERASE"
+msgstr "Erase"
+
+msgid "STB_DISPLAY_ONLY"
+msgstr "Display only"
 
 
 
 
 
+msgid "TB_MESH"
+msgstr "Mesh Toolbar"
 
+msgid "TB_HYPO"
+msgstr "Hypotheses Toolbar"
 
+msgid "TB_CTRL"
+msgstr "Controls Toolbar"
 
+msgid "TB_ADD_REMOVE"
+msgstr "Add/Remove Toolbar"
 
+msgid "TB_MODIFY"
+msgstr "Modification Toolbar"
 
+msgid "TB_DISP_MODE"
+msgstr "Display Mode Toolbar"
 
index 700a10d33a8f6b95d195e9435f3234166c76ae0e..af407e6e9458d332c326abebe5cff6c18b885d08 100644 (file)
@@ -56,6 +56,7 @@ LIB= libSMESHEngine.la
 LIB_SRC = \
        SMESH_Gen_i.cxx \
        SMESH_Gen_i_1.cxx \
+       SMESH_DumpPython.cxx \
        SMESH_Mesh_i.cxx \
        SMESH_MEDMesh_i.cxx \
         SMESH_MEDFamily_i.cxx \
diff --git a/src/SMESH_I/SMESH_DumpPython.cxx b/src/SMESH_I/SMESH_DumpPython.cxx
new file mode 100644 (file)
index 0000000..016e216
--- /dev/null
@@ -0,0 +1,683 @@
+// File    : SMESH_Gen_i_DumpPython.cxx
+// Created : Thu Mar 24 17:17:59 2005
+// Author  : Julia DOROVSKIKH
+// Module  : SMESH
+// $Header : $
+
+#include "SMESH_PythonDump.hxx"
+#include "SMESH_Gen_i.hxx"
+#include "SMESH_Filter_i.hxx"
+
+#include <TColStd_HSequenceOfInteger.hxx>
+#include <TCollection_AsciiString.hxx>
+
+
+#ifdef _DEBUG_
+static int MYDEBUG = 0;
+#else
+static int MYDEBUG = 0;
+#endif
+
+static TCollection_AsciiString NotPublishedObjectName()
+{
+  return "__NOT__Published__Object__";
+}
+
+namespace SMESH
+{
+
+  size_t TPythonDump::myCounter = 0;
+
+  TPythonDump::
+  TPythonDump()
+  {
+    ++myCounter;
+  }
+  TPythonDump::
+  ~TPythonDump()
+  {
+    if(--myCounter == 0){
+      SMESH_Gen_i* aSMESHGen = SMESH_Gen_i::GetSMESHGen();
+      SALOMEDS::Study_ptr aStudy = aSMESHGen->GetCurrentStudy();
+      if(!aStudy->_is_nil()){
+       std::string aString = myStream.str();
+       TCollection_AsciiString aCollection(Standard_CString(aString.c_str()));
+       aSMESHGen->AddToPythonScript(aStudy->StudyId(),aCollection);
+       if(MYDEBUG) MESSAGE(aString);
+      }
+    }
+  }
+
+  TPythonDump& 
+  TPythonDump::
+  operator<<(long int theArg){
+    myStream<<theArg;
+    return *this;
+  }
+
+  TPythonDump& 
+  TPythonDump::
+  operator<<(int theArg){
+    myStream<<theArg;
+    return *this;
+  }
+
+  TPythonDump& 
+  TPythonDump::
+  operator<<(double theArg){
+    myStream<<theArg;
+    return *this;
+  }
+
+  TPythonDump& 
+  TPythonDump::
+  operator<<(float theArg){
+    myStream<<theArg;
+    return *this;
+  }
+
+  TPythonDump& 
+  TPythonDump::
+  operator<<(const void* theArg){
+    myStream<<theArg;
+    return *this;
+  }
+
+  TPythonDump& 
+  TPythonDump::
+  operator<<(const char* theArg){
+    myStream<<theArg;
+    return *this;
+  }
+
+  TPythonDump& 
+  TPythonDump::
+  operator<<(const SMESH::ElementType& theArg)
+  {
+    myStream<<"SMESH.";
+    switch(theArg){
+    case ALL: 
+      myStream<<"ALL"; 
+      break;
+    case NODE: 
+      myStream<<"NODE"; 
+      break;
+    case EDGE: 
+      myStream<<"EDGE"; 
+      break;
+    case FACE: 
+      myStream<<"FACE"; 
+      break;
+    case VOLUME: 
+      myStream<<"VOLUME"; 
+      break;
+    }
+    return *this;
+  }
+
+
+  TPythonDump& 
+  TPythonDump::
+  operator<<(const SMESH::long_array& theArg)
+  {
+    myStream<<"[ ";
+    CORBA::Long i = 1, iEnd = theArg.length();
+    for(; i <= iEnd; i++) {
+      myStream<<theArg[i-1];
+      if(i < iEnd)
+       myStream<< ", ";
+    }
+    myStream<<" ]";
+    return *this;
+  }
+
+
+  TPythonDump& 
+  TPythonDump::
+  operator<<(CORBA::Object_ptr theArg)
+  {
+    TCollection_AsciiString aString("None");
+    SMESH_Gen_i* aSMESHGen = SMESH_Gen_i::GetSMESHGen();
+    SALOMEDS::Study_ptr aStudy = aSMESHGen->GetCurrentStudy();
+    SALOMEDS::SObject_var aSObject = SMESH_Gen_i::ObjectToSObject(aStudy,theArg);
+    if(!aSObject->_is_nil()){
+      aString = aSObject->GetID();
+    }else if(!CORBA::is_nil(theArg)){
+      aString = "smeshObj_";
+      if ( aSMESHGen->CanPublishInStudy( theArg )) // not published SMESH object
+        aString += (int) theArg;
+      else
+        aString = NotPublishedObjectName();
+    }
+    myStream<<aString.ToCString();
+    return *this;
+  }
+
+  TPythonDump& 
+  TPythonDump::
+  operator<<(SMESH::FilterLibrary_i* theArg)
+  {
+    myStream<<"aFilterLibrary"<<theArg;
+    return *this;
+  }
+
+  TPythonDump& 
+  TPythonDump::
+  operator<<(SMESH::FilterManager_i* theArg)
+  {
+    myStream<<"aFilterManager";
+    return *this;
+  }
+
+  TPythonDump& 
+  TPythonDump::
+  operator<<(SMESH::Filter_i* theArg)
+  {
+    myStream<<"aFilter"<<theArg;
+    return *this;
+  }
+
+  TPythonDump& 
+  TPythonDump::
+  operator<<(SMESH::Functor_i* theArg)
+  {
+    FunctorType aFunctorType = theArg->GetFunctorType();
+    switch(aFunctorType){
+    case FT_AspectRatio:
+      myStream<<"anAspectRatio";
+      break;
+    case FT_AspectRatio3D:
+      myStream<<"anAspectRatio3D";
+      break;
+    case FT_Warping:
+      myStream<<"aWarping";
+      break;
+    case FT_MinimumAngle:
+      myStream<<"aMinimumAngle";
+      break;
+    case FT_Taper:
+      myStream<<"aTaper";
+      break;
+    case FT_Skew:
+      myStream<<"aSkew";
+      break;
+    case FT_Area:
+      myStream<<"aArea";
+      break;
+    case FT_FreeBorders:
+      myStream<<"aFreeBorders";
+      break;
+    case FT_FreeEdges:
+      myStream<<"aFreeEdges";
+      break;
+    case FT_MultiConnection:
+      myStream<<"aMultiConnection";
+      break;
+    case FT_MultiConnection2D:
+      myStream<<"aMultiConnection2D";
+      break;
+    case FT_Length:
+      myStream<<"aLength";
+      break;
+    case FT_Length2D:
+      myStream<<"aLength";
+      break;
+    case FT_BelongToGeom:
+      myStream<<"aBelongToGeom";
+      break;
+    case FT_BelongToPlane:
+      myStream<<"aBelongToPlane";
+      break;
+    case FT_BelongToCylinder:
+      myStream<<"aBelongToCylinder";
+      break;
+    case FT_LyingOnGeom:
+      myStream<<"aLyingOnGeom";
+      break;
+    case FT_RangeOfIds:
+      myStream<<"aRangeOfIds";
+      break;
+    case FT_BadOrientedVolume:
+      myStream<<"aBadOrientedVolume";
+      break;
+    case FT_LessThan:
+      myStream<<"aLessThan";
+      break;
+    case FT_MoreThan:
+      myStream<<"aMoreThan";
+      break;
+    case FT_EqualTo:
+      myStream<<"anEqualTo";
+      break;
+    case FT_LogicalNOT:
+      myStream<<"aLogicalNOT";
+      break;
+    case FT_LogicalAND:
+      myStream<<"aLogicalAND";
+      break;
+    case FT_LogicalOR:
+      myStream<<"aLogicalOR";
+      break;
+    case FT_Undefined:
+      myStream<<"anUndefined";
+      break;
+    }
+    myStream<<theArg;
+    return *this;
+  }
+}
+
+//=======================================================================
+//function : DumpPython
+//purpose  : 
+//=======================================================================
+Engines::TMPFile* SMESH_Gen_i::DumpPython (CORBA::Object_ptr theStudy,
+                                           CORBA::Boolean isPublished,
+                                           CORBA::Boolean& isValidScript)
+{
+  SALOMEDS::Study_var aStudy = SALOMEDS::Study::_narrow(theStudy);
+  if (CORBA::is_nil(aStudy))
+    return new Engines::TMPFile(0);
+
+  SALOMEDS::SObject_var aSO = aStudy->FindComponent(ComponentDataType());
+  if (CORBA::is_nil(aSO))
+    return new Engines::TMPFile(0);
+
+  // Map study entries to object names
+  Resource_DataMapOfAsciiStringAsciiString aMap;
+  Resource_DataMapOfAsciiStringAsciiString aMapNames;
+  TCollection_AsciiString s ("qwertyuioplkjhgfdsazxcvbnmQWERTYUIOPLKJHGFDSAZXCVBNM0987654321_");
+
+  SALOMEDS::ChildIterator_var Itr = aStudy->NewChildIterator(aSO);
+  for (Itr->InitEx(true); Itr->More(); Itr->Next()) {
+    SALOMEDS::SObject_var aValue = Itr->Value();
+    CORBA::String_var anID = aValue->GetID();
+    CORBA::String_var aName = aValue->GetName();
+    TCollection_AsciiString aGUIName ( (char*) aName.in() );
+    TCollection_AsciiString anEnrty ( (char*) anID.in() );
+    if (aGUIName.Length() > 0) {
+      aMapNames.Bind( anEnrty, aGUIName );
+      aMap.Bind( anEnrty, aGUIName );
+    }
+  }
+
+  // Get trace of restored study
+  //SALOMEDS::SObject_var aSO = SMESH_Gen_i::ObjectToSObject(theStudy, _this());
+  SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder();
+  SALOMEDS::GenericAttribute_var anAttr =
+    aStudyBuilder->FindOrCreateAttribute(aSO, "AttributePythonObject");
+
+  char* oldValue = SALOMEDS::AttributePythonObject::_narrow(anAttr)->GetObject();
+  TCollection_AsciiString aSavedTrace (oldValue);
+
+  // Add trace of API methods calls and replace study entries by names
+  //TCollection_AsciiString aScript =
+  //  SALOMEDSImpl_Study::GetDumpStudyComment("SMESH") + "\n\n" +
+  //    DumpPython_impl(aStudy->StudyId(), aMap, aMapNames, isPublished, isValidScript, aSavedTrace);
+  TCollection_AsciiString aScript =
+    "### This file is generated by SALOME automatically by dump python functionality of SMESH component\n\n";
+  aScript += DumpPython_impl(aStudy->StudyId(), aMap, aMapNames,
+                             isPublished, isValidScript, aSavedTrace);
+
+  int aLen = aScript.Length(); 
+  unsigned char* aBuffer = new unsigned char[aLen+1];
+  strcpy((char*)aBuffer, aScript.ToCString());
+
+  CORBA::Octet* anOctetBuf =  (CORBA::Octet*)aBuffer;
+  Engines::TMPFile_var aStreamFile = new Engines::TMPFile(aLen+1, aLen+1, anOctetBuf, 1); 
+
+  bool hasNotPublishedObjects = aScript.Location( NotPublishedObjectName(), 1, aLen);
+  isValidScript = isValidScript && !hasNotPublishedObjects;
+
+  return aStreamFile._retn(); 
+}
+
+//=============================================================================
+/*!
+ *  AddToPythonScript
+ */
+//=============================================================================
+void SMESH_Gen_i::AddToPythonScript (int theStudyID, const TCollection_AsciiString& theString)
+{
+  if (myPythonScripts.find(theStudyID) == myPythonScripts.end()) {
+    myPythonScripts[theStudyID] = new TColStd_HSequenceOfAsciiString;
+  }
+  myPythonScripts[theStudyID]->Append(theString);
+}
+
+//=============================================================================
+/*!
+ *  RemoveLastFromPythonScript
+ */
+//=============================================================================
+void SMESH_Gen_i::RemoveLastFromPythonScript (int theStudyID)
+{
+  if (myPythonScripts.find(theStudyID) != myPythonScripts.end()) {
+    int aLen = myPythonScripts[theStudyID]->Length();
+    myPythonScripts[theStudyID]->Remove(aLen);
+  }
+}
+
+//=======================================================================
+//function : AddToCurrentPyScript
+//purpose  : 
+//=======================================================================
+
+void SMESH_Gen_i::AddToCurrentPyScript (const TCollection_AsciiString& theString)
+{
+  SMESH_Gen_i* aSMESHGen = SMESH_Gen_i::GetSMESHGen();
+  SALOMEDS::Study_ptr aStudy = aSMESHGen->GetCurrentStudy();
+  if (aStudy->_is_nil()) return;
+  aSMESHGen->AddToPythonScript(aStudy->StudyId(), theString);
+}
+
+
+//=======================================================================
+//function : AddObject
+//purpose  : add object to script string
+//=======================================================================
+
+TCollection_AsciiString& SMESH_Gen_i::AddObject(TCollection_AsciiString& theStr,
+                                                CORBA::Object_ptr        theObject)
+{
+  TCollection_AsciiString aString("None");
+  SMESH_Gen_i* aSMESHGen = SMESH_Gen_i::GetSMESHGen();
+  SALOMEDS::SObject_var aSObject =
+    aSMESHGen->ObjectToSObject(aSMESHGen->GetCurrentStudy(), theObject);
+  if ( !aSObject->_is_nil() ) {
+    aString = aSObject->GetID();
+  } else if ( !CORBA::is_nil( theObject )) {
+    aString = "smeshObj_";
+    if ( aSMESHGen->CanPublishInStudy( theObject )) // not published SMESH object
+      aString += (int) theObject;
+    else
+      aString = NotPublishedObjectName();
+  }
+  theStr += aString;
+  return theStr;
+}
+
+//=======================================================================
+//function : SavePython
+//purpose  : 
+//=======================================================================
+void SMESH_Gen_i::SavePython (SALOMEDS::Study_ptr theStudy)
+{
+  // Dump trace of API methods calls
+  TCollection_AsciiString aScript = GetNewPythonLines(theStudy->StudyId());
+
+  // Check contents of PythonObject attribute
+  SALOMEDS::SObject_var aSO = theStudy->FindComponent(ComponentDataType());
+  //SALOMEDS::SObject_var aSO = SMESH_Gen_i::ObjectToSObject(theStudy, _this());
+  SALOMEDS::StudyBuilder_var aStudyBuilder = theStudy->NewBuilder();
+  SALOMEDS::GenericAttribute_var anAttr =
+    aStudyBuilder->FindOrCreateAttribute(aSO, "AttributePythonObject");
+
+  char* oldValue = SALOMEDS::AttributePythonObject::_narrow(anAttr)->GetObject();
+  TCollection_AsciiString oldScript (oldValue);
+
+  if (oldScript.Length() > 0) {
+    oldScript += "\n";
+    oldScript += aScript;
+  } else {
+    oldScript = aScript;
+  }
+
+  // Store in PythonObject attribute
+  SALOMEDS::AttributePythonObject::_narrow(anAttr)->SetObject(oldScript.ToCString(), 1);
+
+  // Clean trace of API methods calls
+  CleanPythonTrace(theStudy->StudyId());
+}
+
+
+// impl
+
+
+//=============================================================================
+/*!
+ *  FindEntries: Returns a sequence of start/end positions of entries in the string
+ */
+//=============================================================================
+Handle(TColStd_HSequenceOfInteger) FindEntries (TCollection_AsciiString& theString)
+{
+  Handle(TColStd_HSequenceOfInteger) aSeq = new TColStd_HSequenceOfInteger;
+  Standard_Integer aLen = theString.Length();
+  Standard_Boolean isFound = Standard_False;
+
+  char* arr = theString.ToCString();
+  Standard_Integer i = 0, j;
+
+  while(i < aLen) {
+    int c = (int)arr[i];
+    j = i+1;
+    if(c >= 48 && c <= 57) { //Is digit?
+      isFound = Standard_False;
+      while((j < aLen) && ((c >= 48 && c <= 57) || c == 58) ) { //Check if it is an entry
+       c = (int)arr[j++];  
+       if(c == 58) isFound = Standard_True;
+      }
+
+      if (isFound) {
+        int prev = (i < 1) ? 0 : (int)arr[i - 1];
+        // last char should be a diggit,
+        // previous char should not be '"'.
+        if (arr[j-2] != 58 && prev != 34) {
+          aSeq->Append(i+1); // +1 because AsciiString starts from 1
+          aSeq->Append(j-1);
+        }
+      }
+    }
+
+    i = j;
+  }
+
+  return aSeq;
+}
+
+//=============================================================================
+/*!
+ *  DumpPython
+ */
+//=============================================================================
+TCollection_AsciiString SMESH_Gen_i::DumpPython_impl
+                        (int theStudyID, 
+                         Resource_DataMapOfAsciiStringAsciiString& theObjectNames,
+                         Resource_DataMapOfAsciiStringAsciiString& theNames,
+                         bool isPublished, 
+                         bool& aValidScript,
+                         const TCollection_AsciiString& theSavedTrace)
+{
+  TCollection_AsciiString aScript;
+  aScript = "def RebuildData(theStudy):";
+  aScript += "\n\tsmesh = salome.lcc.FindOrLoadComponent(\"FactoryServer\", \"SMESH\")";
+  aScript += "\n\taFilterManager = smesh.CreateFilterManager()";
+  if ( isPublished )
+    aScript += "\n\tsmesh.SetCurrentStudy(theStudy)";
+  else
+    aScript += "\n\tsmesh.SetCurrentStudy(None)";
+
+  // Dump trace of restored study
+  if (theSavedTrace.Length() > 0) {
+    aScript += "\n";
+    aScript += theSavedTrace;
+  }
+
+  // Dump trace of API methods calls
+  TCollection_AsciiString aNewLines = GetNewPythonLines(theStudyID);
+  if (aNewLines.Length() > 0) {
+    aScript += "\n";
+    aScript += aNewLines;
+  }
+
+  // Find entries to be replaced by names
+  Handle(TColStd_HSequenceOfInteger) aSeq = FindEntries(aScript);
+  Standard_Integer aLen = aSeq->Length();
+
+  if (aLen == 0)
+    return aScript;
+
+  // Replace entries by the names
+  GEOM::GEOM_Gen_ptr geom = GetGeomEngine();
+  TColStd_SequenceOfAsciiString seqRemoved;
+  Resource_DataMapOfAsciiStringAsciiString mapRemoved;
+  Standard_Integer objectCounter = 0, aStart = 1, aScriptLength = aScript.Length();
+  TCollection_AsciiString anUpdatedScript, anEntry, aName, aBaseName("smeshObj_"),
+    allowedChars ("qwertyuioplkjhgfdsazxcvbnmQWERTYUIOPLKJHGFDSAZXCVBNM0987654321_");
+
+  // Collect names of GEOM objects to exclude same names for SMESH objects
+  GEOM::string_array_var aGeomNames = geom->GetAllDumpNames();
+  int ign = 0, nbgn = aGeomNames->length();
+  for (; ign < nbgn; ign++) {
+    aName = aGeomNames[ign];
+    theObjectNames.Bind(aName, "1");
+  }
+
+  bool importGeom = false;
+  for (Standard_Integer i = 1; i <= aLen; i += 2) {
+    anUpdatedScript += aScript.SubString(aStart, aSeq->Value(i) - 1);
+    anEntry = aScript.SubString(aSeq->Value(i), aSeq->Value(i + 1));
+    // is a GEOM object?
+    aName = geom->GetDumpName( anEntry.ToCString() );
+    if (aName.IsEmpty()) {
+      // is a SMESH object
+      if (theObjectNames.IsBound(anEntry)) {
+        // The Object is in Study
+        aName = theObjectNames.Find(anEntry);
+        // check validity of aName
+        bool isValidName = true;
+        if ( aName.IsIntegerValue() ) { // aName must not start with a digit
+          aName.Insert( 1, 'a' );
+          isValidName = false;
+        }
+        int p, p2=1; // replace not allowed chars
+        while ((p = aName.FirstLocationNotInSet(allowedChars, p2, aName.Length()))) {
+          aName.SetValue(p, '_');
+          p2=p;
+          isValidName = false;
+        }
+        if (theObjectNames.IsBound(aName) && anEntry != theObjectNames(aName)) {
+          // diff objects have same name - make a new name by appending a digit
+          TCollection_AsciiString aName2;
+          Standard_Integer i = 0;
+          do {
+            aName2 = aName + "_" + ++i;
+          } while (theObjectNames.IsBound(aName2) && anEntry != theObjectNames(aName2));
+          aName = aName2;
+          isValidName = false;
+        }
+        if ( !isValidName )
+          theObjectNames(anEntry) = aName;
+
+      } else {
+        // Removed Object
+        do {
+          aName = aBaseName + TCollection_AsciiString(++objectCounter);
+        } while (theObjectNames.IsBound(aName));
+        seqRemoved.Append(aName);
+        mapRemoved.Bind(anEntry, "1");
+        theObjectNames.Bind(anEntry, aName);
+      }
+      theObjectNames.Bind(aName, anEntry); // to detect same name of diff objects
+    }
+    else
+    {
+      importGeom = true;
+    }
+    anUpdatedScript += aName;
+    aStart = aSeq->Value(i + 1) + 1;
+  }
+
+  // set initial part of aSript
+  TCollection_AsciiString initPart = "import salome, SMESH, StdMeshers\n\n";
+  if ( importGeom )
+  {
+    initPart += ("import string, os, sys, re\n"
+                 "sys.path.insert( 0, os.path.dirname(__file__) )\n"
+                 "exec(\"from \"+re.sub(\"SMESH$\",\"GEOM\",__name__)+\" import *\")\n\n");
+  }
+  anUpdatedScript.Insert ( 1, initPart );
+
+  // add final part of aScript
+  if (aSeq->Value(aLen) < aScriptLength)
+    anUpdatedScript += aScript.SubString(aSeq->Value(aLen) + 1, aScriptLength);
+
+  // Remove removed objects
+  anUpdatedScript += "\n\taStudyBuilder = theStudy.NewBuilder()";
+  for (int ir = 1; ir <= seqRemoved.Length(); ir++) {
+    anUpdatedScript += "\n\tSO = theStudy.FindObjectIOR(theStudy.ConvertObjectToIOR(";
+    anUpdatedScript += seqRemoved.Value(ir);
+    anUpdatedScript += "))\n\tif SO is not None: aStudyBuilder.RemoveObjectWithChildren(SO)";
+  }
+
+  // Set object names
+  anUpdatedScript += "\n\n\tisGUIMode = ";
+  anUpdatedScript += isPublished;
+  anUpdatedScript += "\n\tif isGUIMode:";
+  anUpdatedScript += "\n\t\tsmeshgui = salome.ImportComponentGUI(\"SMESH\")";
+  anUpdatedScript += "\n\t\tsmeshgui.Init(theStudy._get_StudyId())";
+  anUpdatedScript += "\n";
+
+  TCollection_AsciiString aGUIName;
+  Resource_DataMapOfAsciiStringAsciiString mapEntries;
+  for (Standard_Integer i = 1; i <= aLen; i += 2) {
+    anEntry = aScript.SubString(aSeq->Value(i), aSeq->Value(i + 1));
+    aName = geom->GetDumpName( anEntry.ToCString() );
+    if (aName.IsEmpty() && // Not a GEOM object
+        theNames.IsBound(anEntry) &&
+        !mapEntries.IsBound(anEntry) && // Not yet processed
+        !mapRemoved.IsBound(anEntry)) { // Was not removed
+      aName = theObjectNames.Find(anEntry);
+      aGUIName = theNames.Find(anEntry);
+      mapEntries.Bind(anEntry, aName);
+      anUpdatedScript += "\n\t\tsmeshgui.SetName(salome.ObjectToID(";
+      anUpdatedScript += aName + "), \"" + aGUIName + "\")";
+    }
+  }
+  anUpdatedScript += "\n\n\t\tsalome.sg.updateObjBrowser(0)";
+
+  anUpdatedScript += "\n\n\tpass\n";
+
+  aValidScript = true;
+
+  return anUpdatedScript;
+}
+
+//=============================================================================
+/*!
+ *  GetNewPythonLines
+ */
+//=============================================================================
+TCollection_AsciiString SMESH_Gen_i::GetNewPythonLines (int theStudyID)
+{
+  TCollection_AsciiString aScript;
+
+  // Dump trace of API methods calls
+  if (myPythonScripts.find(theStudyID) != myPythonScripts.end()) {
+    Handle(TColStd_HSequenceOfAsciiString) aPythonScript = myPythonScripts[theStudyID];
+    Standard_Integer istr, aLen = aPythonScript->Length();
+    for (istr = 1; istr <= aLen; istr++) {
+      aScript += "\n\t";
+      aScript += aPythonScript->Value(istr);
+    }
+    aScript += "\n";
+  }
+
+  return aScript;
+}
+
+//=============================================================================
+/*!
+ *  CleanPythonTrace
+ */
+//=============================================================================
+void SMESH_Gen_i::CleanPythonTrace (int theStudyID)
+{
+  TCollection_AsciiString aScript;
+
+  // Clean trace of API methods calls
+  if (myPythonScripts.find(theStudyID) != myPythonScripts.end()) {
+    myPythonScripts[theStudyID]->Clear();
+  }
+}
index 1348b83ef63c799bd0c0b455656344228c4b6afb..05d5f38482a1137aeee5e536db301aca76912719 100644 (file)
@@ -29,6 +29,7 @@
 #include "SMESH_Filter_i.hxx"
 
 #include "SMESH_Gen_i.hxx"
+#include "SMESH_PythonDump.hxx"
 
 #include "SMDS_Mesh.hxx"
 #include "SMDS_MeshNode.hxx"
 using namespace SMESH;
 using namespace SMESH::Controls;
 
+
+namespace SMESH
+{
+  Predicate_i* 
+  GetPredicate( Predicate_ptr thePredicate )
+  {
+    return DownCast<Predicate_i*>(thePredicate);
+  }
+}
+
+
 /*
   Class       : BelongToGeom
   Description : Predicate for verifying whether entiy belong to
@@ -74,9 +86,9 @@ Controls::BelongToGeom::BelongToGeom()
   myType(SMDSAbs_All)
 {}
 
-void Controls::BelongToGeom::SetMesh( SMDS_Mesh* theMesh )
+void Controls::BelongToGeom::SetMesh( const SMDS_Mesh* theMesh )
 {
-  myMeshDS = dynamic_cast<SMESHDS_Mesh*>(theMesh);
+  myMeshDS = dynamic_cast<const SMESHDS_Mesh*>(theMesh);
 }
 
 void Controls::BelongToGeom::SetGeom( const TopoDS_Shape& theShape )
@@ -84,7 +96,7 @@ void Controls::BelongToGeom::SetGeom( const TopoDS_Shape& theShape )
   myShape = theShape;
 }
 
-static bool IsContains( SMESHDS_Mesh*           theMeshDS,
+static bool IsContains( const SMESHDS_Mesh*     theMeshDS,
                         const TopoDS_Shape&     theShape,
                         const SMDS_MeshElement* theElem,
                         TopAbs_ShapeEnum        theFindShapeEnum,
@@ -166,7 +178,9 @@ TopoDS_Shape Controls::BelongToGeom::GetShape()
   return myShape;
 }
 
-SMESHDS_Mesh* Controls::BelongToGeom::GetMeshDS()
+const SMESHDS_Mesh* 
+Controls::BelongToGeom::
+GetMeshDS() const
 {
   return myMeshDS;
 }
@@ -182,9 +196,9 @@ Controls::LyingOnGeom::LyingOnGeom()
   myType(SMDSAbs_All)
 {}
 
-void Controls::LyingOnGeom::SetMesh( SMDS_Mesh* theMesh )
+void Controls::LyingOnGeom::SetMesh( const SMDS_Mesh* theMesh )
 {
myMeshDS = dynamic_cast<SMESHDS_Mesh*>(theMesh);
 myMeshDS = dynamic_cast<const SMESHDS_Mesh*>(theMesh);
 }
 
 void Controls::LyingOnGeom::SetGeom( const TopoDS_Shape& theShape )
@@ -254,12 +268,14 @@ TopoDS_Shape Controls::LyingOnGeom::GetShape()
   return myShape;
 }
 
-SMESHDS_Mesh* Controls::LyingOnGeom::GetMeshDS()
+const SMESHDS_Mesh* 
+Controls::LyingOnGeom::
+GetMeshDS() const
 {
   return myMeshDS;
 }
 
-bool Controls::LyingOnGeom::Contains( SMESHDS_Mesh*           theMeshDS,
+bool Controls::LyingOnGeom::Contains( const SMESHDS_Mesh*     theMeshDS,
                                      const TopoDS_Shape&     theShape,
                                      const SMDS_MeshElement* theElem,
                                      TopAbs_ShapeEnum        theFindShapeEnum,
@@ -301,14 +317,17 @@ bool Controls::LyingOnGeom::Contains( SMESHDS_Mesh*           theMeshDS,
                             AUXILIARY METHODS
 */
 
-static inline SMDS_Mesh* MeshPtr2SMDSMesh( SMESH_Mesh_ptr theMesh )
+inline 
+const SMDS_Mesh* 
+MeshPtr2SMDSMesh( SMESH_Mesh_ptr theMesh )
 {
-  SMESH_Mesh_i* anImplPtr = 
-    dynamic_cast<SMESH_Mesh_i*>( SMESH_Gen_i::GetServant( theMesh ).in() );
+  SMESH_Mesh_i* anImplPtr = DownCast<SMESH_Mesh_i*>(theMesh);
   return anImplPtr ? anImplPtr->GetImpl().GetMeshDS() : 0;
 }
 
-static inline SMESH::long_array* toArray( const TColStd_ListOfInteger& aList )
+inline 
+SMESH::long_array* 
+toArray( const TColStd_ListOfInteger& aList )
 {
   SMESH::long_array_var anArray = new SMESH::long_array;
   anArray->length( aList.Extent() );
@@ -320,7 +339,9 @@ static inline SMESH::long_array* toArray( const TColStd_ListOfInteger& aList )
   return anArray._retn();
 }
 
-static inline SMESH::double_array* toArray( const TColStd_ListOfReal& aList )
+inline 
+SMESH::double_array* 
+toArray( const TColStd_ListOfReal& aList )
 {
   SMESH::double_array_var anArray = new SMESH::double_array;
   anArray->length( aList.Extent() );
@@ -387,13 +408,19 @@ static TopoDS_Shape getShapeByName( const char* theName )
 Functor_i::Functor_i(): 
   SALOME::GenericObj_i( SMESH_Gen_i::GetPOA() )
 {
-  SMESH_Gen_i::GetPOA()->activate_object( this );
+  PortableServer::ObjectId_var anObjectId = 
+    SMESH_Gen_i::GetPOA()->activate_object( this );
+}
+
+Functor_i::~Functor_i()
+{
+  TPythonDump()<<this<<".Destroy()";
 }
 
 void Functor_i::SetMesh( SMESH_Mesh_ptr theMesh )
 {
   myFunctorPtr->SetMesh( MeshPtr2SMDSMesh( theMesh ) );
-  INFOS("Functor_i::SetMesh~");
+  TPythonDump()<<this<<".SetMesh("<<theMesh<<")";
 }
 
 ElementType Functor_i::GetElementType()
@@ -414,6 +441,7 @@ CORBA::Double NumericalFunctor_i::GetValue( CORBA::Long theId )
 void NumericalFunctor_i::SetPrecision( CORBA::Long thePrecision )
 {
   myNumericalFunctorPtr->SetPrecision( thePrecision );
+  TPythonDump()<<this<<".SetPrecision("<<thePrecision<<")";
 }
 
 CORBA::Long NumericalFunctor_i::GetPrecision()
@@ -708,6 +736,7 @@ void BelongToGeom_i::SetGeom( GEOM::GEOM_Object_ptr theGeom )
   GEOM::GEOM_Gen_var aGEOMGen = SMESH_Gen_i::GetGeomEngine();
   TopoDS_Shape aLocShape = aSMESHGen->GetShapeReader()->GetShape( aGEOMGen, theGeom );
   myBelongToGeomPtr->SetGeom( aLocShape );
+  TPythonDump()<<this<<".SetGeom("<<theGeom<<")";
 }
 
 void BelongToGeom_i::SetGeom( const TopoDS_Shape& theShape )
@@ -717,6 +746,7 @@ void BelongToGeom_i::SetGeom( const TopoDS_Shape& theShape )
 
 void BelongToGeom_i::SetElementType(ElementType theType){
   myBelongToGeomPtr->SetType(SMDSAbs_ElementType(theType));
+  TPythonDump()<<this<<".SetElementType("<<theType<<")";
 }
 
 FunctorType BelongToGeom_i::GetFunctorType()
@@ -729,6 +759,7 @@ void BelongToGeom_i::SetShapeName( const char* theName )
   delete myShapeName;
   myShapeName = strdup( theName );
   myBelongToGeomPtr->SetGeom( getShapeByName( myShapeName ) );
+  TPythonDump()<<this<<".SetShapeName('"<<theName<<"')";
 }
 
 char* BelongToGeom_i::GetShapeName()
@@ -772,6 +803,7 @@ void BelongToSurface_i::SetSurface( GEOM::GEOM_Object_ptr theGeom, ElementType t
   }
 
   myElementsOnSurfacePtr->SetSurface( TopoDS_Shape(), (SMDSAbs_ElementType)theType );
+  TPythonDump()<<this<<".SetSurface("<<theGeom<<",'"<<theType<<"')";
 }
 
 void BelongToSurface_i::SetShapeName( const char* theName, ElementType theType )
@@ -779,6 +811,7 @@ void BelongToSurface_i::SetShapeName( const char* theName, ElementType theType )
   delete myShapeName;
   myShapeName = strdup( theName );
   myElementsOnSurfacePtr->SetSurface( getShapeByName( myShapeName ), (SMDSAbs_ElementType)theType );
+  TPythonDump()<<this<<".SetShapeName('"<<theName<<"',"<<theType<<")";
 }
 
 char* BelongToSurface_i::GetShapeName()
@@ -789,6 +822,7 @@ char* BelongToSurface_i::GetShapeName()
 void BelongToSurface_i::SetTolerance( CORBA::Double theToler )
 {
   myElementsOnSurfacePtr->SetTolerance( theToler );
+  TPythonDump()<<this<<".SetTolerance("<<theToler<<")";
 }
 
 CORBA::Double BelongToSurface_i::GetTolerance()
@@ -809,6 +843,7 @@ BelongToPlane_i::BelongToPlane_i()
 void BelongToPlane_i::SetPlane( GEOM::GEOM_Object_ptr theGeom, ElementType theType )
 {
   BelongToSurface_i::SetSurface( theGeom, theType );
+  TPythonDump()<<this<<".SetPlane("<<theGeom<<","<<theType<<")";
 }
 
 FunctorType BelongToPlane_i::GetFunctorType()
@@ -829,6 +864,7 @@ BelongToCylinder_i::BelongToCylinder_i()
 void BelongToCylinder_i::SetCylinder( GEOM::GEOM_Object_ptr theGeom, ElementType theType )
 {
   BelongToSurface_i::SetSurface( theGeom, theType );
+  TPythonDump()<<this<<".SetCylinder("<<theGeom<<","<<theType<<")";
 }
 
 FunctorType BelongToCylinder_i::GetFunctorType()
@@ -860,6 +896,7 @@ void LyingOnGeom_i::SetGeom( GEOM::GEOM_Object_ptr theGeom )
   GEOM::GEOM_Gen_var aGEOMGen = SMESH_Gen_i::GetGeomEngine();
   TopoDS_Shape aLocShape = aSMESHGen->GetShapeReader()->GetShape( aGEOMGen, theGeom );
   myLyingOnGeomPtr->SetGeom( aLocShape );
+  TPythonDump()<<this<<".SetGeom("<<theGeom<<")";
 }
 
 void LyingOnGeom_i::SetGeom( const TopoDS_Shape& theShape )
@@ -869,6 +906,7 @@ void LyingOnGeom_i::SetGeom( const TopoDS_Shape& theShape )
 
 void LyingOnGeom_i::SetElementType(ElementType theType){
   myLyingOnGeomPtr->SetType(SMDSAbs_ElementType(theType));
+  TPythonDump()<<this<<".SetElementType("<<theType<<")";
 }
 
 FunctorType LyingOnGeom_i::GetFunctorType()
@@ -881,6 +919,7 @@ void LyingOnGeom_i::SetShapeName( const char* theName )
   delete myShapeName;
   myShapeName = strdup( theName );
   myLyingOnGeomPtr->SetGeom( getShapeByName( myShapeName ) );
+  TPythonDump()<<this<<".SetShapeName('"<<theName<<"')";
 }
 
 char* LyingOnGeom_i::GetShapeName()
@@ -963,10 +1002,12 @@ void RangeOfIds_i::SetRange( const SMESH::long_array& theIds )
   CORBA::Long iEnd = theIds.length();
   for ( CORBA::Long i = 0; i < iEnd; i++ )
     myRangeOfIdsPtr->AddToRange( theIds[ i ] );
+  TPythonDump()<<this<<".SetRange("<<theIds<<")";
 }
 
 CORBA::Boolean RangeOfIds_i::SetRangeStr( const char* theRange )
 {
+  TPythonDump()<<this<<".SetRangeStr('"<<theRange<<"')";
   return myRangeOfIdsPtr->SetRangeStr(
     TCollection_AsciiString( (Standard_CString)theRange ) );
 }
@@ -981,6 +1022,7 @@ char* RangeOfIds_i::GetRangeStr()
 void RangeOfIds_i::SetElementType( ElementType theType )
 {
   myRangeOfIdsPtr->SetType( SMDSAbs_ElementType( theType ) );
+  TPythonDump()<<this<<".SetElementType("<<theType<<")";
 }
 
 FunctorType RangeOfIds_i::GetFunctorType()
@@ -1005,6 +1047,7 @@ Comparator_i::~Comparator_i()
 void Comparator_i::SetMargin( CORBA::Double theValue )
 {
   myComparatorPtr->SetMargin( theValue );
+  TPythonDump()<<this<<".SetMargin("<<theValue<<")";
 }
 
 CORBA::Double Comparator_i::GetMargin()
@@ -1017,12 +1060,13 @@ void Comparator_i::SetNumFunctor( NumericalFunctor_ptr theFunct )
   if ( myNumericalFunctor )
     myNumericalFunctor->Destroy();
 
-  myNumericalFunctor = dynamic_cast<NumericalFunctor_i*>( SMESH_Gen_i::GetServant( theFunct ).in() );
+  myNumericalFunctor = DownCast<NumericalFunctor_i*>(theFunct);
 
   if ( myNumericalFunctor )
   {
     myComparatorPtr->SetNumFunctor( myNumericalFunctor->GetNumericalFunctor() );
     myNumericalFunctor->Register();
+    TPythonDump()<<this<<".SetNumFunctor("<<myNumericalFunctor<<")";
   }
 }
 
@@ -1082,6 +1126,7 @@ EqualTo_i::EqualTo_i()
 void EqualTo_i::SetTolerance( CORBA::Double theToler )
 {
   myEqualToPtr->SetTolerance( theToler );
+  TPythonDump()<<this<<".SetTolerance("<<theToler<<")";
 }
 
 CORBA::Double EqualTo_i::GetTolerance()
@@ -1111,16 +1156,17 @@ LogicalNOT_i::~LogicalNOT_i()
     myPredicate->Destroy();
 }
 
-void LogicalNOT_i::SetPredicate( Predicate_ptr thePred )
+void LogicalNOT_i::SetPredicate( Predicate_ptr thePredicate )
 {
   if ( myPredicate )
     myPredicate->Destroy();
 
-  myPredicate = dynamic_cast<Predicate_i*>( SMESH_Gen_i::GetServant( thePred ).in() );
+  myPredicate = SMESH::GetPredicate(thePredicate);
 
   if ( myPredicate ){
     myLogicalNOTPtr->SetPredicate(myPredicate->GetPredicate());
     myPredicate->Register();
+    TPythonDump()<<this<<".SetPredicate("<<myPredicate<<")";
   }
 }
 
@@ -1167,11 +1213,12 @@ void LogicalBinary_i::SetPredicate1( Predicate_ptr thePredicate )
   if ( myPredicate1 )
     myPredicate1->Destroy();
 
-  myPredicate1 = dynamic_cast<Predicate_i*>( SMESH_Gen_i::GetServant( thePredicate ).in() );
+  myPredicate1 = SMESH::GetPredicate(thePredicate);
 
   if ( myPredicate1 ){
     myLogicalBinaryPtr->SetPredicate1(myPredicate1->GetPredicate());
     myPredicate1->Register();
+    TPythonDump()<<this<<".SetPredicate1("<<myPredicate1<<")";
   }
 }
 
@@ -1180,11 +1227,12 @@ void LogicalBinary_i::SetPredicate2( Predicate_ptr thePredicate )
   if ( myPredicate2 )
     myPredicate2->Destroy();
 
-  myPredicate2 = dynamic_cast<Predicate_i*>( SMESH_Gen_i::GetServant( thePredicate ).in() );
+  myPredicate2 = SMESH::GetPredicate(thePredicate);
 
   if ( myPredicate2 ){
     myLogicalBinaryPtr->SetPredicate2(myPredicate2->GetPredicate());
     myPredicate2->Register();
+    TPythonDump()<<this<<".SetPredicate2("<<myPredicate2<<")";
   }
 }
 
@@ -1242,13 +1290,22 @@ FunctorType LogicalOR_i::GetFunctorType()
 FilterManager_i::FilterManager_i()
 : SALOME::GenericObj_i( SMESH_Gen_i::GetPOA() )
 {
-  SMESH_Gen_i::GetPOA()->activate_object( this );
+  PortableServer::ObjectId_var anObjectId = 
+    SMESH_Gen_i::GetPOA()->activate_object( this );
 }
 
+
+FilterManager_i::~FilterManager_i()
+{
+  TPythonDump()<<this<<".Destroy()";
+}
+
+
 MinimumAngle_ptr FilterManager_i::CreateMinimumAngle()
 {
   SMESH::MinimumAngle_i* aServant = new SMESH::MinimumAngle_i();
   SMESH::MinimumAngle_var anObj = aServant->_this();
+  TPythonDump()<<aServant<<" = "<<this<<".CreateMinimumAngle()";
   return anObj._retn();
 }
 
@@ -1257,6 +1314,7 @@ AspectRatio_ptr FilterManager_i::CreateAspectRatio()
 {
   SMESH::AspectRatio_i* aServant = new SMESH::AspectRatio_i();
   SMESH::AspectRatio_var anObj = aServant->_this();
+  TPythonDump()<<aServant<<" = "<<this<<".CreateAspectRatio()";
   return anObj._retn();
 }
 
@@ -1265,6 +1323,7 @@ AspectRatio3D_ptr FilterManager_i::CreateAspectRatio3D()
 {
   SMESH::AspectRatio3D_i* aServant = new SMESH::AspectRatio3D_i();
   SMESH::AspectRatio3D_var anObj = aServant->_this();
+  TPythonDump()<<aServant<<" = "<<this<<".CreateAspectRatio3D()";
   return anObj._retn();
 }
 
@@ -1273,6 +1332,7 @@ Warping_ptr FilterManager_i::CreateWarping()
 {
   SMESH::Warping_i* aServant = new SMESH::Warping_i();
   SMESH::Warping_var anObj = aServant->_this();
+  TPythonDump()<<aServant<<" = "<<this<<".CreateWarping()";
   return anObj._retn();
 }
 
@@ -1281,6 +1341,7 @@ Taper_ptr FilterManager_i::CreateTaper()
 {
   SMESH::Taper_i* aServant = new SMESH::Taper_i();
   SMESH::Taper_var anObj = aServant->_this();
+  TPythonDump()<<aServant<<" = "<<this<<".CreateTaper()";
   return anObj._retn();
 }
 
@@ -1289,6 +1350,7 @@ Skew_ptr FilterManager_i::CreateSkew()
 {
   SMESH::Skew_i* aServant = new SMESH::Skew_i();
   SMESH::Skew_var anObj = aServant->_this();
+  TPythonDump()<<aServant<<" = "<<this<<".CreateSkew()";
   return anObj._retn();
 }
 
@@ -1297,6 +1359,7 @@ Area_ptr FilterManager_i::CreateArea()
 {
   SMESH::Area_i* aServant = new SMESH::Area_i();
   SMESH::Area_var anObj = aServant->_this();
+  TPythonDump()<<aServant<<" = "<<this<<".CreateArea()";
   return anObj._retn();
 }
 
@@ -1305,6 +1368,7 @@ Length_ptr FilterManager_i::CreateLength()
 {
   SMESH::Length_i* aServant = new SMESH::Length_i();
   SMESH::Length_var anObj = aServant->_this();
+  TPythonDump()<<aServant<<" = "<<this<<".CreateLength()";
   return anObj._retn();
 }
 
@@ -1312,6 +1376,7 @@ Length2D_ptr FilterManager_i::CreateLength2D()
 {
   SMESH::Length2D_i* aServant = new SMESH::Length2D_i();
   SMESH::Length2D_var anObj = aServant->_this();
+  TPythonDump()<<aServant<<" = "<<this<<".CreateLength2D()";
   return anObj._retn();
 }
 
@@ -1319,6 +1384,7 @@ MultiConnection_ptr FilterManager_i::CreateMultiConnection()
 {
   SMESH::MultiConnection_i* aServant = new SMESH::MultiConnection_i();
   SMESH::MultiConnection_var anObj = aServant->_this();
+  TPythonDump()<<aServant<<" = "<<this<<".CreateMultiConnection()";
   return anObj._retn();
 }
 
@@ -1326,6 +1392,7 @@ MultiConnection2D_ptr FilterManager_i::CreateMultiConnection2D()
 {
   SMESH::MultiConnection2D_i* aServant = new SMESH::MultiConnection2D_i();
   SMESH::MultiConnection2D_var anObj = aServant->_this();
+  TPythonDump()<<aServant<<" = "<<this<<".CreateMultiConnection2D()";
   return anObj._retn();
 }
 
@@ -1333,6 +1400,7 @@ BelongToGeom_ptr FilterManager_i::CreateBelongToGeom()
 {
   SMESH::BelongToGeom_i* aServant = new SMESH::BelongToGeom_i();
   SMESH::BelongToGeom_var anObj = aServant->_this();
+  TPythonDump()<<aServant<<" = "<<this<<".CreateBelongToGeom()";
   return anObj._retn();
 }
 
@@ -1340,6 +1408,7 @@ BelongToPlane_ptr FilterManager_i::CreateBelongToPlane()
 {
   SMESH::BelongToPlane_i* aServant = new SMESH::BelongToPlane_i();
   SMESH::BelongToPlane_var anObj = aServant->_this();
+  TPythonDump()<<aServant<<" = "<<this<<".CreateBelongToPlane()";
   return anObj._retn();
 }
 
@@ -1347,6 +1416,7 @@ BelongToCylinder_ptr FilterManager_i::CreateBelongToCylinder()
 {
   SMESH::BelongToCylinder_i* aServant = new SMESH::BelongToCylinder_i();
   SMESH::BelongToCylinder_var anObj = aServant->_this();
+  TPythonDump()<<aServant<<" = "<<this<<".CreateBelongToCylinder()";
   return anObj._retn();
 }
 
@@ -1354,6 +1424,7 @@ LyingOnGeom_ptr FilterManager_i::CreateLyingOnGeom()
 {
   SMESH::LyingOnGeom_i* aServant = new SMESH::LyingOnGeom_i();
   SMESH::LyingOnGeom_var anObj = aServant->_this();
+  TPythonDump()<<aServant<<" = "<<this<<".CreateLyingOnGeom()";
   return anObj._retn();
 }
 
@@ -1361,6 +1432,7 @@ FreeBorders_ptr FilterManager_i::CreateFreeBorders()
 {
   SMESH::FreeBorders_i* aServant = new SMESH::FreeBorders_i();
   SMESH::FreeBorders_var anObj = aServant->_this();
+  TPythonDump()<<aServant<<" = "<<this<<".CreateFreeBorders()";
   return anObj._retn();
 }
 
@@ -1368,6 +1440,7 @@ FreeEdges_ptr FilterManager_i::CreateFreeEdges()
 {
   SMESH::FreeEdges_i* aServant = new SMESH::FreeEdges_i();
   SMESH::FreeEdges_var anObj = aServant->_this();
+  TPythonDump()<<aServant<<" = "<<this<<".CreateFreeEdges()";
   return anObj._retn();
 }
 
@@ -1375,6 +1448,7 @@ RangeOfIds_ptr FilterManager_i::CreateRangeOfIds()
 {
   SMESH::RangeOfIds_i* aServant = new SMESH::RangeOfIds_i();
   SMESH::RangeOfIds_var anObj = aServant->_this();
+  TPythonDump()<<aServant<<" = "<<this<<".CreateRangeOfIds()";
   return anObj._retn();
 }
 
@@ -1382,6 +1456,7 @@ BadOrientedVolume_ptr FilterManager_i::CreateBadOrientedVolume()
 {
   SMESH::BadOrientedVolume_i* aServant = new SMESH::BadOrientedVolume_i();
   SMESH::BadOrientedVolume_var anObj = aServant->_this();
+  TPythonDump()<<aServant<<" = "<<this<<".CreateBadOrientedVolume()";
   return anObj._retn();
 }
 
@@ -1389,6 +1464,7 @@ LessThan_ptr FilterManager_i::CreateLessThan()
 {
   SMESH::LessThan_i* aServant = new SMESH::LessThan_i();
   SMESH::LessThan_var anObj = aServant->_this();
+  TPythonDump()<<aServant<<" = "<<this<<".CreateLessThan()";
   return anObj._retn();
 }
 
@@ -1397,6 +1473,7 @@ MoreThan_ptr FilterManager_i::CreateMoreThan()
 {
   SMESH::MoreThan_i* aServant = new SMESH::MoreThan_i();
   SMESH::MoreThan_var anObj = aServant->_this();
+  TPythonDump()<<aServant<<" = "<<this<<".CreateMoreThan()";
   return anObj._retn();
 }
 
@@ -1404,6 +1481,7 @@ EqualTo_ptr FilterManager_i::CreateEqualTo()
 {
   SMESH::EqualTo_i* aServant = new SMESH::EqualTo_i();
   SMESH::EqualTo_var anObj = aServant->_this();
+  TPythonDump()<<aServant<<" = "<<this<<".CreateEqualTo()";
   return anObj._retn();
 }
 
@@ -1412,6 +1490,7 @@ LogicalNOT_ptr FilterManager_i::CreateLogicalNOT()
 {
   SMESH::LogicalNOT_i* aServant = new SMESH::LogicalNOT_i();
   SMESH::LogicalNOT_var anObj = aServant->_this();
+  TPythonDump()<<aServant<<" = "<<this<<".CreateLogicalNOT()";
   return anObj._retn();
 }
 
@@ -1420,6 +1499,7 @@ LogicalAND_ptr FilterManager_i::CreateLogicalAND()
 {
   SMESH::LogicalAND_i* aServant = new SMESH::LogicalAND_i();
   SMESH::LogicalAND_var anObj = aServant->_this();
+  TPythonDump()<<aServant<<" = "<<this<<".CreateLogicalAND()";
   return anObj._retn();
 }
 
@@ -1428,6 +1508,7 @@ LogicalOR_ptr FilterManager_i::CreateLogicalOR()
 {
   SMESH::LogicalOR_i* aServant = new SMESH::LogicalOR_i();
   SMESH::LogicalOR_var anObj = aServant->_this();
+  TPythonDump()<<aServant<<" = "<<this<<".CreateLogicalOR()";
   return anObj._retn();
 }
 
@@ -1435,6 +1516,7 @@ Filter_ptr FilterManager_i::CreateFilter()
 {
   SMESH::Filter_i* aServant = new SMESH::Filter_i();
   SMESH::Filter_var anObj = aServant->_this();
+  TPythonDump()<<aServant<<" = "<<this<<".CreateFilter()";
   return anObj._retn();
 }
 
@@ -1442,6 +1524,7 @@ FilterLibrary_ptr FilterManager_i::LoadLibrary( const char* aFileName )
 {
   SMESH::FilterLibrary_i* aServant = new SMESH::FilterLibrary_i( aFileName );
   SMESH::FilterLibrary_var anObj = aServant->_this();
+  TPythonDump()<<aServant<<" = "<<this<<".LoadLibrary("<<aFileName<<")";
   return anObj._retn();
 }
 
@@ -1449,11 +1532,13 @@ FilterLibrary_ptr FilterManager_i::CreateLibrary()
 {
   SMESH::FilterLibrary_i* aServant = new SMESH::FilterLibrary_i();
   SMESH::FilterLibrary_var anObj = aServant->_this();
+  TPythonDump()<<aServant<<" = "<<this<<".CreateLibrary()";
   return anObj._retn();
 }
 
 CORBA::Boolean FilterManager_i::DeleteLibrary( const char* aFileName )
 {
+  TPythonDump()<<this<<".DeleteLibrary("<<aFileName<<")";
   return remove( aFileName ) ? false : true;
 }
 
@@ -1493,6 +1578,11 @@ Filter_i::~Filter_i()
 {
   if ( myPredicate )
     myPredicate->Destroy();
+
+  if(!CORBA::is_nil(myMesh))
+    myMesh->Destroy();
+
+  TPythonDump()<<this<<".Destroy()";
 }
 
 //=======================================================================
@@ -1504,12 +1594,13 @@ void Filter_i::SetPredicate( Predicate_ptr thePredicate )
   if ( myPredicate )
     myPredicate->Destroy();
 
-  myPredicate = dynamic_cast<Predicate_i*>( SMESH_Gen_i::GetServant( thePredicate ).in() );
+  myPredicate = SMESH::GetPredicate(thePredicate);
 
   if ( myPredicate )
   {
     myFilter.SetPredicate( myPredicate->GetPredicate() );
     myPredicate->Register();
+    TPythonDump()<<this<<".SetPredicate("<<myPredicate<<")";
   }
 }
 
@@ -1526,28 +1617,63 @@ SMESH::ElementType Filter_i::GetElementType()
 // name    : Filter_i::SetMesh
 // Purpose : Set mesh
 //=======================================================================
-void Filter_i::SetMesh( SMESH_Mesh_ptr theMesh )
+void 
+Filter_i::
+SetMesh( SMESH_Mesh_ptr theMesh )
 {
-  if ( myPredicate )
-    myPredicate->SetMesh( theMesh );
+  if(!CORBA::is_nil(theMesh))
+    theMesh->Register();
+
+  if(!CORBA::is_nil(myMesh))
+    myMesh->Destroy();
+
+  myMesh = theMesh;
+  TPythonDump()<<this<<".SetMesh("<<theMesh<<")";
+}
+
+SMESH::long_array* 
+Filter_i::
+GetIDs()
+{
+  return GetElementsId(myMesh);
 }
 
 //=======================================================================
 // name    : Filter_i::GetElementsId
 // Purpose : Get ids of entities
 //=======================================================================
-SMESH::long_array* Filter_i::GetElementsId( SMESH_Mesh_ptr theMesh )
+void
+Filter_i::
+GetElementsId( Predicate_i* thePredicate,
+              const SMDS_Mesh* theMesh,
+              Controls::Filter::TIdSequence& theSequence )
 {
-  SMDS_Mesh* aMesh = MeshPtr2SMDSMesh(theMesh);
-  Controls::Filter::TIdSequence aSequence = myFilter.GetElementsId(aMesh);
-
-  SMESH::long_array_var anArray = new SMESH::long_array;
-  long i = 0, iEnd = aSequence.size();
+  Controls::Filter::GetElementsId(theMesh,thePredicate->GetPredicate(),theSequence);
+}
 
-  anArray->length( iEnd );
-  for ( ; i < iEnd; i++ )
-    anArray[ i ] = aSequence[i];
+void
+Filter_i::
+GetElementsId( Predicate_i* thePredicate,
+              SMESH_Mesh_ptr theMesh,
+              Controls::Filter::TIdSequence& theSequence )
+{
+  if(const SMDS_Mesh* aMesh = MeshPtr2SMDSMesh(theMesh))
+    Controls::Filter::GetElementsId(aMesh,thePredicate->GetPredicate(),theSequence);
+}
 
+SMESH::long_array* 
+Filter_i::
+GetElementsId( SMESH_Mesh_ptr theMesh )
+{
+  SMESH::long_array_var anArray = new SMESH::long_array;
+  if(!CORBA::is_nil(theMesh)){
+    Controls::Filter::TIdSequence aSequence;
+    GetElementsId(myPredicate,theMesh,aSequence);
+    long i = 0, iEnd = aSequence.size();
+    anArray->length( iEnd );
+    for ( ; i < iEnd; i++ )
+      anArray[ i ] = aSequence[i];
+  }
   return anArray._retn();
 }
 
@@ -1719,12 +1845,13 @@ CORBA::Boolean Filter_i::SetCriteria( const SMESH::Filter::Criteria& theCriteria
   if ( myPredicate != 0 )
     myPredicate->Destroy();
 
-    SMESH::FilterManager_i* aFilter = new SMESH::FilterManager_i();
-    FilterManager_ptr aFilterMgr = aFilter->_this();
-
+  SMESH::FilterManager_i* aFilter = new SMESH::FilterManager_i();
+  FilterManager_ptr aFilterMgr = aFilter->_this();
+  
   // CREATE two lists ( PREDICATES  and LOG OP )
 
   // Criterion
+  TPythonDump()<<"aCriteria = []";
   std::list<SMESH::Predicate_ptr> aPredicates;
   std::list<int>                  aBinaries;
   for ( int i = 0, n = theCriteria.length(); i < n; i++ )
@@ -1738,6 +1865,10 @@ CORBA::Boolean Filter_i::SetCriteria( const SMESH::Filter::Criteria& theCriteria
     const char* aThresholdStr = theCriteria[ i ].ThresholdStr;
     ElementType aTypeOfElem   = theCriteria[ i ].TypeOfElement;
     long        aPrecision    = theCriteria[ i ].Precision;
+
+    TPythonDump()<<"aCriteria.append(SMESH.Filter.Criterion("<<
+      aCriterion<<","<<aCompare<<","<<aThreshold<<",'"<<aThresholdStr<<"',"<<
+      aUnary<<","<<aBinary<<","<<aTolerance<<","<<aTypeOfElem<<","<<aPrecision<<"))";
     
     SMESH::Predicate_ptr aPredicate = SMESH::Predicate::_nil();
     SMESH::NumericalFunctor_ptr aFunctor = SMESH::NumericalFunctor::_nil();
@@ -1876,6 +2007,7 @@ CORBA::Boolean Filter_i::SetCriteria( const SMESH::Filter::Criteria& theCriteria
     aBinaries.push_back( aBinary );
 
   } // end of for
+  TPythonDump()<<this<<".SetCriteria(aCriteria)";
 
   // CREATE ONE PREDICATE FROM PREVIOUSLY CREATED MAP
 
@@ -2299,6 +2431,7 @@ FilterLibrary_i::FilterLibrary_i()
 FilterLibrary_i::~FilterLibrary_i()
 {
   delete myFileName;
+  TPythonDump()<<this<<".Destroy()";
 }
 
 //=======================================================================
@@ -2307,7 +2440,7 @@ FilterLibrary_i::~FilterLibrary_i()
 //=======================================================================
 Filter_ptr FilterLibrary_i::Copy( const char* theFilterName )
 {
-  Filter_ptr aRes;
+  Filter_ptr aRes = Filter::_nil();
   LDOM_Node aFilter = findFilter( theFilterName, myDoc );
 
   if ( aFilter.isNull() )
@@ -2368,7 +2501,9 @@ Filter_ptr FilterLibrary_i::Copy( const char* theFilterName )
 
   aRes = myFilterMgr->CreateFilter();
   aRes->SetCriteria( aCriteriaVar.inout() );
-
+  
+  TPythonDump()<<this<<".Copy('"<<theFilterName<<"')";
+  
   return aRes;
 }
 
@@ -2380,6 +2515,7 @@ void FilterLibrary_i::SetFileName( const char* theFileName )
 {
   delete myFileName;
   myFileName = strdup( theFileName );
+  TPythonDump()<<this<<".SetFileName('"<<theFileName<<"')";
 }
 
 //=======================================================================
@@ -2416,6 +2552,8 @@ CORBA::Boolean FilterLibrary_i::Add( const char* theFilterName, Filter_ptr theFi
   else
   {
     aSection.appendChild( aFilterItem );
+    if(Filter_i* aFilter = DownCast<Filter_i*>(theFilter))
+      TPythonDump()<<this<<".Add('"<<theFilterName<<"',"<<aFilter<<")";
     return true;
   }
 }
@@ -2444,6 +2582,7 @@ CORBA::Boolean FilterLibrary_i::AddEmpty( const char* theFilterName, ElementType
   else
   {
     aSection.appendChild( aFilterItem );
+    TPythonDump()<<this<<".AddEmpty('"<<theFilterName<<"',"<<theType<<")";
     return true;
   }
 }
@@ -2460,6 +2599,7 @@ CORBA::Boolean FilterLibrary_i::Delete ( const char* theFilterName )
     return false;
 
   aParentNode.removeChild( aFilterNode );
+  TPythonDump()<<this<<".Delete('"<<theFilterName<<"')";
   return true;
 }
 
@@ -2482,6 +2622,8 @@ CORBA::Boolean FilterLibrary_i::Replace( const char* theFilterName,
   else                                                                                          
   {
     aFilterItem.ReplaceElement( aNewItem );
+    if(Filter_i* aFilter = DownCast<Filter_i*>(theFilter))
+      TPythonDump()<<this<<".Replace('"<<theFilterName<<"',"<<theNewName<<"',"<<aFilter<<")";
     return true;
   }
 }
@@ -2504,6 +2646,7 @@ CORBA::Boolean FilterLibrary_i::Save()
   aWriter << myDoc;
   fclose( aOutFile );
 
+  TPythonDump()<<this<<".Save()";
   return true;
 }
 
@@ -2514,6 +2657,7 @@ CORBA::Boolean FilterLibrary_i::Save()
 CORBA::Boolean FilterLibrary_i::SaveAs( const char* aFileName )
 {
   myFileName = strdup ( aFileName );
+  TPythonDump()<<this<<".SaveAs('"<<aFileName<<"')";
   return Save();
 }
 
index 7a09289e05fbc6563a1e1cf789d95cc9ff421867..b634bfe9d4c7a94cf845635a45b8701dbd13f04f 100644 (file)
@@ -42,703 +42,740 @@ class SMESHDS_Mesh;
 namespace SMESH
 {
 
-namespace Controls
-{
-
-/*
-  Class       : BelongToGeom
-  Description : Predicate for verifying whether entiy belong to
-                specified geometrical support
-*/
-class BelongToGeom: public virtual Predicate
-{
-public:
-                                  BelongToGeom();
-
-  virtual void                    SetMesh( SMDS_Mesh* theMesh );
-  virtual void                    SetGeom( const TopoDS_Shape& theShape );
-
-  virtual bool                    IsSatisfy( long theElementId );
-
-  virtual void                    SetType( SMDSAbs_ElementType theType );
-  virtual                         SMDSAbs_ElementType GetType() const;
-
-  TopoDS_Shape                    GetShape();
-  SMESHDS_Mesh*                   GetMeshDS();
-
-private:
-  TopoDS_Shape                    myShape;
-  SMESHDS_Mesh*                   myMeshDS;
-  SMDSAbs_ElementType             myType;
-};
-typedef boost::shared_ptr<BelongToGeom> BelongToGeomPtr;
-
-/*
-  Class       : LyingOnGeom
-  Description : Predicate for verifying whether entiy lying or partially lying on
-                specified geometrical support
-*/
-class LyingOnGeom: public virtual Predicate
-{
-public:
-                                  LyingOnGeom();
+  namespace Controls
+  {
+    
+    /*
+      Class       : BelongToGeom
+      Description : Predicate for verifying whether entiy belong to
+      specified geometrical support
+    */
+    class BelongToGeom: public virtual Predicate
+    {
+    public:
+      BelongToGeom();
+      
+      virtual void                    SetMesh( const SMDS_Mesh* theMesh );
+      virtual void                    SetGeom( const TopoDS_Shape& theShape );
+      
+      virtual bool                    IsSatisfy( long theElementId );
+      
+      virtual void                    SetType( SMDSAbs_ElementType theType );
+      virtual                         SMDSAbs_ElementType GetType() const;
+      
+      TopoDS_Shape                    GetShape();
+      const SMESHDS_Mesh*             GetMeshDS() const;
+      
+    private:
+      TopoDS_Shape                    myShape;
+      const SMESHDS_Mesh*             myMeshDS;
+      SMDSAbs_ElementType             myType;
+    };
+    typedef boost::shared_ptr<BelongToGeom> BelongToGeomPtr;
+    
+    /*
+      Class       : LyingOnGeom
+      Description : Predicate for verifying whether entiy lying or partially lying on
+      specified geometrical support
+    */
+    class LyingOnGeom: public virtual Predicate
+    {
+    public:
+      LyingOnGeom();
+      
+      virtual void                    SetMesh( const SMDS_Mesh* theMesh );
+      virtual void                    SetGeom( const TopoDS_Shape& theShape );
+      
+      virtual bool                    IsSatisfy( long theElementId );
+      
+      virtual void                    SetType( SMDSAbs_ElementType theType );
+      virtual                         SMDSAbs_ElementType GetType() const;
+      
+      TopoDS_Shape                    GetShape();
+      const SMESHDS_Mesh*             GetMeshDS() const;
+      
+      virtual bool                    Contains( const SMESHDS_Mesh*     theMeshDS,
+                                               const TopoDS_Shape&     theShape,
+                                               const SMDS_MeshElement* theElem,
+                                               TopAbs_ShapeEnum        theFindShapeEnum,
+                                               TopAbs_ShapeEnum        theAvoidShapeEnum = TopAbs_SHAPE );
+    private:
+      TopoDS_Shape                    myShape;
+      const SMESHDS_Mesh*             myMeshDS;
+      SMDSAbs_ElementType             myType;
+    };
+    typedef boost::shared_ptr<LyingOnGeom> LyingOnGeomPtr;
+  }
   
-  virtual void                    SetMesh( SMDS_Mesh* theMesh );
-  virtual void                    SetGeom( const TopoDS_Shape& theShape );
-
-  virtual bool                    IsSatisfy( long theElementId );
-
-  virtual void                    SetType( SMDSAbs_ElementType theType );
-  virtual                         SMDSAbs_ElementType GetType() const;
-
-  TopoDS_Shape                    GetShape();
-  SMESHDS_Mesh*                   GetMeshDS();
-  
-  virtual bool                    Contains( SMESHDS_Mesh*           theMeshDS,
-                                           const TopoDS_Shape&     theShape,
-                                           const SMDS_MeshElement* theElem,
-                                           TopAbs_ShapeEnum        theFindShapeEnum,
-                                           TopAbs_ShapeEnum        theAvoidShapeEnum = TopAbs_SHAPE );
-private:
-  TopoDS_Shape                    myShape;
-  SMESHDS_Mesh*                   myMeshDS;
-  SMDSAbs_ElementType             myType;
-};
-typedef boost::shared_ptr<LyingOnGeom> LyingOnGeomPtr;
-}
-
-/*
-                                FUNCTORS
-*/
-
-/*
-  Class       : Functor_i
-  Description : An abstact class for all functors 
-*/
-class Functor_i: public virtual POA_SMESH::Functor,
-                 public virtual SALOME::GenericObj_i
-{
-public:
-  void                            SetMesh( SMESH_Mesh_ptr theMesh );
-  Controls::FunctorPtr            GetFunctor(){ return myFunctorPtr;}
-  ElementType                     GetElementType();
-  
-protected:
-                                  Functor_i();
-protected:                                
-  Controls::FunctorPtr            myFunctorPtr;
-};
-
-
-/*
-  Class       : NumericalFunctor_i
-  Description : Base class for numerical functors 
-*/
-class NumericalFunctor_i: public virtual POA_SMESH::NumericalFunctor,
-                          public virtual Functor_i
-{
-public:
-  CORBA::Double                   GetValue( CORBA::Long theElementId );
-  void                            SetPrecision( CORBA::Long thePrecision );
-  CORBA::Long                     GetPrecision();
-  Controls::NumericalFunctorPtr   GetNumericalFunctor();
-  
-protected:
-  Controls::NumericalFunctorPtr   myNumericalFunctorPtr;
-};
-
-
-/*
-  Class       : SMESH_MinimumAngleFunct
-  Description : Functor for calculation of minimum angle
-*/
-class MinimumAngle_i: public virtual POA_SMESH::MinimumAngle,
-                      public virtual NumericalFunctor_i
-{
-public:
-                                  MinimumAngle_i();
-  FunctorType                     GetFunctorType();
-};
-
-
-/*
-  Class       : AspectRatio_i
-  Description : Functor for calculating aspect ratio
-*/
-class AspectRatio_i: public virtual POA_SMESH::AspectRatio,
-                     public virtual NumericalFunctor_i
-{
-public:
-                                  AspectRatio_i();
-  FunctorType                     GetFunctorType();
-};
-
-
-/*
-  Class       : AspectRatio3D_i
-  Description : Functor for calculating aspect ratio for 3D
-*/
-class AspectRatio3D_i: public virtual POA_SMESH::AspectRatio3D,
+  /*
+    FUNCTORS
+  */
+  
+  /*
+    Class       : Functor_i
+    Description : An abstact class for all functors 
+  */
+  class Functor_i: public virtual POA_SMESH::Functor,
+                  public virtual SALOME::GenericObj_i
+  {
+  public:
+    void                            SetMesh( SMESH_Mesh_ptr theMesh );
+    Controls::FunctorPtr            GetFunctor(){ return myFunctorPtr;}
+    ElementType                     GetElementType();
+    
+  protected:
+    Functor_i();
+    ~Functor_i();
+  protected:                                
+    Controls::FunctorPtr            myFunctorPtr;
+  };
+  
+  /*
+    Class       : NumericalFunctor_i
+    Description : Base class for numerical functors 
+  */
+  class NumericalFunctor_i: public virtual POA_SMESH::NumericalFunctor,
+                           public virtual Functor_i
+  {
+  public:
+    CORBA::Double                   GetValue( CORBA::Long theElementId );
+    void                            SetPrecision( CORBA::Long thePrecision );
+    CORBA::Long                     GetPrecision();
+    Controls::NumericalFunctorPtr   GetNumericalFunctor();
+    
+  protected:
+    Controls::NumericalFunctorPtr   myNumericalFunctorPtr;
+  };
+  
+  
+  /*
+    Class       : SMESH_MinimumAngleFunct
+    Description : Functor for calculation of minimum angle
+  */
+  class MinimumAngle_i: public virtual POA_SMESH::MinimumAngle,
+                       public virtual NumericalFunctor_i
+  {
+  public:
+    MinimumAngle_i();
+    FunctorType                     GetFunctorType();
+  };
+  
+  
+  /*
+    Class       : AspectRatio_i
+    Description : Functor for calculating aspect ratio
+  */
+  class AspectRatio_i: public virtual POA_SMESH::AspectRatio,
                       public virtual NumericalFunctor_i
-{
-public:
-                                  AspectRatio3D_i();
-  FunctorType                     GetFunctorType();
-};
-
-
-/*
-  Class       : Warping_i
-  Description : Functor for calculating warping
-*/
-class Warping_i: public virtual POA_SMESH::Warping,
-                 public virtual NumericalFunctor_i
-{
-public:
-                                  Warping_i();
-  FunctorType                     GetFunctorType();
-};
-
-
-/*
-  Class       : Taper_i
-  Description : Functor for calculating taper
-*/
-class Taper_i: public virtual POA_SMESH::Taper,
-               public virtual NumericalFunctor_i
-{
-public:
-                                  Taper_i();
-  FunctorType                     GetFunctorType();
-};
-
-
-/*
-  Class       : Skew_i
-  Description : Functor for calculating skew in degrees
-*/
-class Skew_i: public virtual POA_SMESH::Skew,
-              public virtual NumericalFunctor_i
-{
-public:
-                                  Skew_i();
-  FunctorType                     GetFunctorType();
-};
-
-
-/*
-  Class       : Area_i
-  Description : Functor for calculating area
-*/
-class Area_i: public virtual POA_SMESH::Area,
-              public virtual NumericalFunctor_i
-{
-public:
-                                  Area_i();
-  FunctorType                     GetFunctorType();
-};
-
-
-/*
-  Class       : Length_i
-  Description : Functor for calculating length of edge
-*/
-class Length_i: public virtual POA_SMESH::Length,
-                public virtual NumericalFunctor_i
-{
-public:
-                                  Length_i();
-  FunctorType                     GetFunctorType();
-};
+  {
+  public:
+    AspectRatio_i();
+    FunctorType                     GetFunctorType();
+  };
+  
+  
+  /*
+    Class       : AspectRatio3D_i
+    Description : Functor for calculating aspect ratio for 3D
+  */
+  class AspectRatio3D_i: public virtual POA_SMESH::AspectRatio3D,
+                        public virtual NumericalFunctor_i
+  {
+  public:
+    AspectRatio3D_i();
+    FunctorType                     GetFunctorType();
+  };
+  
 
-/*
-  Class       : Length2D_i
-  Description : Functor for calculating length of edge
-*/
-class Length2D_i: public virtual POA_SMESH::Length2D,
+  /*
+    Class       : Warping_i
+    Description : Functor for calculating warping
+  */
+  class Warping_i: public virtual POA_SMESH::Warping,
+                  public virtual NumericalFunctor_i
+  {
+  public:
+    Warping_i();
+    FunctorType                     GetFunctorType();
+  };
+  
+  
+  /*
+    Class       : Taper_i
+    Description : Functor for calculating taper
+  */
+  class Taper_i: public virtual POA_SMESH::Taper,
+                public virtual NumericalFunctor_i
+  {
+  public:
+    Taper_i();
+    FunctorType                     GetFunctorType();
+  };
+  
+  
+  /*
+    Class       : Skew_i
+    Description : Functor for calculating skew in degrees
+  */
+  class Skew_i: public virtual POA_SMESH::Skew,
+               public virtual NumericalFunctor_i
+  {
+  public:
+    Skew_i();
+    FunctorType                     GetFunctorType();
+  };
+  
+  
+  /*
+    Class       : Area_i
+    Description : Functor for calculating area
+  */
+  class Area_i: public virtual POA_SMESH::Area,
+               public virtual NumericalFunctor_i
+  {
+  public:
+    Area_i();
+    FunctorType                     GetFunctorType();
+  };
+  
+  
+  /*
+    Class       : Length_i
+    Description : Functor for calculating length of edge
+  */
+  class Length_i: public virtual POA_SMESH::Length,
                  public virtual NumericalFunctor_i
-{
-public:
-                                  Length2D_i();
-  SMESH::Length2D::Values*        GetValues();
-  FunctorType                     GetFunctorType();
-
-protected:
-  Controls::Length2DPtr          myLength2DPtr;
-};
-
-
-/*
-  Class       : MultiConnection_i
-  Description : Functor for calculating number of faces conneted to the edge
-*/
-class MultiConnection_i: public virtual POA_SMESH::MultiConnection,
-                         public virtual NumericalFunctor_i
-{
-public:
-                                  MultiConnection_i();
-  FunctorType                     GetFunctorType();
-};
-
-/*
-  Class       : MultiConnection2D_i
-  Description : Functor for calculating number of faces conneted to the edge
-*/
-class MultiConnection2D_i: public virtual POA_SMESH::MultiConnection2D,
+  {
+  public:
+    Length_i();
+    FunctorType                     GetFunctorType();
+  };
+  
+  /*
+    Class       : Length2D_i
+    Description : Functor for calculating length of edge
+  */
+  class Length2D_i: public virtual POA_SMESH::Length2D,
+                   public virtual NumericalFunctor_i
+  {
+  public:
+    Length2D_i();
+    SMESH::Length2D::Values*        GetValues();
+    FunctorType                     GetFunctorType();
+    
+  protected:
+    Controls::Length2DPtr          myLength2DPtr;
+  };
+  
+  
+  /*
+    Class       : MultiConnection_i
+    Description : Functor for calculating number of faces conneted to the edge
+  */
+  class MultiConnection_i: public virtual POA_SMESH::MultiConnection,
                           public virtual NumericalFunctor_i
-{
-public:
-                                     MultiConnection2D_i();
-  SMESH::MultiConnection2D::Values*  GetValues();
-  FunctorType                        GetFunctorType();
-
-protected:
-  Controls::MultiConnection2DPtr     myMulticonnection2DPtr;
-};
-
-
-/*
-                            PREDICATES
-*/
-/*
-  Class       : Predicate_i
-  Description : Base class for all predicates
-*/
-class Predicate_i: public virtual POA_SMESH::Predicate,
-                   public virtual Functor_i
-{
-public:
-  CORBA::Boolean                  IsSatisfy( CORBA::Long theElementId );
-  Controls::PredicatePtr          GetPredicate();
+  {
+  public:
+    MultiConnection_i();
+    FunctorType                     GetFunctorType();
+  };
   
-protected:
-  Controls::PredicatePtr          myPredicatePtr;
-};
-
-
-/*
-  Class       : BadOrientedVolume_i
-  Description : Verify whether a mesh volume is incorrectly oriented from
-                the point of view of MED convention
-*/
-class BadOrientedVolume_i: public virtual POA_SMESH::BadOrientedVolume,
-                           public virtual Predicate_i
-{
- public:
-  BadOrientedVolume_i();
-  FunctorType                     GetFunctorType();
-};
-
-/*
-  Class       : BelongToGeom_i
-  Description : Predicate for selection on geometrical support
-*/
-class BelongToGeom_i: public virtual POA_SMESH::BelongToGeom,
-                      public virtual Predicate_i
-{
-public:
-                                  BelongToGeom_i();
-  virtual                         ~BelongToGeom_i();
-                                  
-  void                            SetGeom( GEOM::GEOM_Object_ptr theGeom );
-  void                            SetElementType( ElementType theType );
-  FunctorType                     GetFunctorType();
-
-  void                            SetGeom( const TopoDS_Shape& theShape );
-
-  void                            SetShapeName( const char* theName );
-  char*                           GetShapeName();
-
-protected:
-  Controls::BelongToGeomPtr       myBelongToGeomPtr;
-  char*                           myShapeName;
-};
-
-/*
-  Class       : BelongToSurface_i
-  Description : Verify whether mesh element lie in pointed Geom planar object
-*/
-class BelongToSurface_i: public virtual POA_SMESH::BelongToSurface,
-                         public virtual Predicate_i
-{
-public:
-                                  BelongToSurface_i( const Handle(Standard_Type)& );
-  virtual                         ~BelongToSurface_i();
-
-  void                            SetSurface( GEOM::GEOM_Object_ptr theGeom, ElementType theType );
-
-  void                            SetShapeName( const char* theName, ElementType theType );
-  char*                           GetShapeName();
-
-  void                            SetTolerance( CORBA::Double );
-  CORBA::Double                   GetTolerance();
-
-protected:
-  Controls::ElementsOnSurfacePtr  myElementsOnSurfacePtr;
-  char*                           myShapeName;
-  Handle(Standard_Type)           mySurfaceType;
-};
-
-/*
-  Class       : BelongToPlane_i
-  Description : Verify whether mesh element lie in pointed Geom planar object
-*/
-class BelongToPlane_i: public virtual POA_SMESH::BelongToPlane,
-                       public virtual BelongToSurface_i
-{
-public:
-                                  BelongToPlane_i();
-  void                            SetPlane( GEOM::GEOM_Object_ptr theGeom, ElementType theType );
-  FunctorType                     GetFunctorType();
-};
-
-/*
-  Class       : BelongToCylinder_i
-  Description : Verify whether mesh element lie in pointed Geom cylindrical object
-*/
-class BelongToCylinder_i: public virtual POA_SMESH::BelongToCylinder,
-                          public virtual BelongToSurface_i
-{
-public:
-                                  BelongToCylinder_i();
-  void                            SetCylinder( GEOM::GEOM_Object_ptr theGeom, ElementType theType );
-  FunctorType                     GetFunctorType();
-};
-
-/*
-  Class       : LyingOnGeom_i
-  Description : Predicate for selection on geometrical support(lying or partially lying)
-*/
-class LyingOnGeom_i: public virtual POA_SMESH::LyingOnGeom,
+  /*
+    Class       : MultiConnection2D_i
+    Description : Functor for calculating number of faces conneted to the edge
+  */
+  class MultiConnection2D_i: public virtual POA_SMESH::MultiConnection2D,
+                            public virtual NumericalFunctor_i
+  {
+  public:
+    MultiConnection2D_i();
+    SMESH::MultiConnection2D::Values*  GetValues();
+    FunctorType                        GetFunctorType();
+    
+  protected:
+    Controls::MultiConnection2DPtr     myMulticonnection2DPtr;
+  };
+  
+  
+  /*
+    PREDICATES
+  */
+  /*
+    Class       : Predicate_i
+    Description : Base class for all predicates
+  */
+  class Predicate_i: public virtual POA_SMESH::Predicate,
+                    public virtual Functor_i
+  {
+  public:
+    CORBA::Boolean                  IsSatisfy( CORBA::Long theElementId );
+    Controls::PredicatePtr          GetPredicate();
+    
+  protected:
+    Controls::PredicatePtr          myPredicatePtr;
+  };
+  
+  
+  /*
+    Class       : BadOrientedVolume_i
+    Description : Verify whether a mesh volume is incorrectly oriented from
+    the point of view of MED convention
+  */
+  class BadOrientedVolume_i: public virtual POA_SMESH::BadOrientedVolume,
+                            public virtual Predicate_i
+  {
+  public:
+    BadOrientedVolume_i();
+    FunctorType                     GetFunctorType();
+  };
+  
+  /*
+    Class       : BelongToGeom_i
+    Description : Predicate for selection on geometrical support
+  */
+  class BelongToGeom_i: public virtual POA_SMESH::BelongToGeom,
+                       public virtual Predicate_i
+  {
+  public:
+    BelongToGeom_i();
+    virtual                         ~BelongToGeom_i();
+    
+    void                            SetGeom( GEOM::GEOM_Object_ptr theGeom );
+    void                            SetElementType( ElementType theType );
+    FunctorType                     GetFunctorType();
+    
+    void                            SetGeom( const TopoDS_Shape& theShape );
+    
+    void                            SetShapeName( const char* theName );
+    char*                           GetShapeName();
+    
+  protected:
+    Controls::BelongToGeomPtr       myBelongToGeomPtr;
+    char*                           myShapeName;
+  };
+  
+  /*
+    Class       : BelongToSurface_i
+    Description : Verify whether mesh element lie in pointed Geom planar object
+  */
+  class BelongToSurface_i: public virtual POA_SMESH::BelongToSurface,
+                          public virtual Predicate_i
+  {
+  public:
+    BelongToSurface_i( const Handle(Standard_Type)& );
+    virtual                         ~BelongToSurface_i();
+    
+    void                            SetSurface( GEOM::GEOM_Object_ptr theGeom, ElementType theType );
+    
+    void                            SetShapeName( const char* theName, ElementType theType );
+    char*                           GetShapeName();
+    
+    void                            SetTolerance( CORBA::Double );
+    CORBA::Double                   GetTolerance();
+    
+  protected:
+    Controls::ElementsOnSurfacePtr  myElementsOnSurfacePtr;
+    char*                           myShapeName;
+    Handle(Standard_Type)           mySurfaceType;
+  };
+  
+  /*
+    Class       : BelongToPlane_i
+    Description : Verify whether mesh element lie in pointed Geom planar object
+  */
+  class BelongToPlane_i: public virtual POA_SMESH::BelongToPlane,
+                        public virtual BelongToSurface_i
+  {
+  public:
+    BelongToPlane_i();
+    void                            SetPlane( GEOM::GEOM_Object_ptr theGeom, ElementType theType );
+    FunctorType                     GetFunctorType();
+  };
+  
+  /*
+    Class       : BelongToCylinder_i
+    Description : Verify whether mesh element lie in pointed Geom cylindrical object
+  */
+  class BelongToCylinder_i: public virtual POA_SMESH::BelongToCylinder,
+                           public virtual BelongToSurface_i
+  {
+  public:
+    BelongToCylinder_i();
+    void                            SetCylinder( GEOM::GEOM_Object_ptr theGeom, ElementType theType );
+    FunctorType                     GetFunctorType();
+  };
+  
+  /*
+    Class       : LyingOnGeom_i
+    Description : Predicate for selection on geometrical support(lying or partially lying)
+  */
+  class LyingOnGeom_i: public virtual POA_SMESH::LyingOnGeom,
+                      public virtual Predicate_i
+  {
+  public:
+    LyingOnGeom_i();
+    virtual                         ~LyingOnGeom_i();
+    
+    void                            SetGeom( GEOM::GEOM_Object_ptr theGeom );
+    void                            SetElementType( ElementType theType );
+    FunctorType                     GetFunctorType();
+    
+    void                            SetGeom( const TopoDS_Shape& theShape );
+    
+    void                            SetShapeName( const char* theName );
+    char*                           GetShapeName();
+    
+  protected:
+    Controls::LyingOnGeomPtr        myLyingOnGeomPtr;
+    char*                           myShapeName;
+  };
+  
+  /*
+    Class       : FreeBorders_i
+    Description : Predicate for free borders
+  */
+  class FreeBorders_i: public virtual POA_SMESH::FreeBorders,
+                      public virtual Predicate_i
+  {
+  public:
+    FreeBorders_i();
+    FunctorType                     GetFunctorType();
+  };
+  
+  
+  /*
+    Class       : FreeEdges_i
+    Description : Predicate for free edges
+  */
+  class FreeEdges_i: public virtual POA_SMESH::FreeEdges,
                     public virtual Predicate_i
-{
-public:
-                                  LyingOnGeom_i();
-  virtual                         ~LyingOnGeom_i();
+  {
+  public:
+    FreeEdges_i();
+    SMESH::FreeEdges::Borders*      GetBorders();
+    FunctorType                     GetFunctorType();
     
-  void                            SetGeom( GEOM::GEOM_Object_ptr theGeom );
-  void                            SetElementType( ElementType theType );
-  FunctorType                     GetFunctorType();
+  protected:
+    Controls::FreeEdgesPtr          myFreeEdgesPtr;
+  };
   
-  void                            SetGeom( const TopoDS_Shape& theShape );
   
-  void                            SetShapeName( const char* theName );
-  char*                           GetShapeName();
+  /*
+    Class       : RangeOfIds_i
+    Description : Predicate for Range of Ids
+  */
+  class RangeOfIds_i: public virtual POA_SMESH::RangeOfIds,
+                     public virtual Predicate_i
+  {
+  public:
+    RangeOfIds_i();
+    void                            SetRange( const SMESH::long_array& theIds );
+    CORBA::Boolean                  SetRangeStr( const char* theRange );
+    char*                           GetRangeStr();
+    
+    void                            SetElementType( ElementType theType );
+    FunctorType                     GetFunctorType();
+    
+  protected:
+    Controls::RangeOfIdsPtr         myRangeOfIdsPtr;
+  };
   
-protected:
-  Controls::LyingOnGeomPtr        myLyingOnGeomPtr;
-  char*                           myShapeName;
-};
-
-/*
-  Class       : FreeBorders_i
-  Description : Predicate for free borders
-*/
-class FreeBorders_i: public virtual POA_SMESH::FreeBorders,
-                     public virtual Predicate_i
-{
-public:
-                                  FreeBorders_i();
-  FunctorType                     GetFunctorType();
-};
-
-
-/*
-  Class       : FreeEdges_i
-  Description : Predicate for free edges
-*/
-class FreeEdges_i: public virtual POA_SMESH::FreeEdges,
-                   public virtual Predicate_i
-{
-public:
-                                  FreeEdges_i();
-  SMESH::FreeEdges::Borders*      GetBorders();
-  FunctorType                     GetFunctorType();
-  
-protected:
-  Controls::FreeEdgesPtr          myFreeEdgesPtr;
-};
-
-
-/*
-  Class       : RangeOfIds_i
-  Description : Predicate for Range of Ids
-*/
-class RangeOfIds_i: public virtual POA_SMESH::RangeOfIds,
-                    public virtual Predicate_i
-{
-public:
-                                  RangeOfIds_i();
-  void                            SetRange( const SMESH::long_array& theIds );
-  CORBA::Boolean                  SetRangeStr( const char* theRange );
-  char*                           GetRangeStr();
-
-  void                            SetElementType( ElementType theType );
-  FunctorType                     GetFunctorType();
-
-protected:
-  Controls::RangeOfIdsPtr         myRangeOfIdsPtr;
-};
-
-/*
-  Class       : Comparator_i
-  Description : Base class for comparators
-*/
-class Comparator_i: public virtual POA_SMESH::Comparator,
-                    public virtual Predicate_i
-{
-public:
-  virtual                         ~Comparator_i();
-  
-  virtual void                    SetMargin( CORBA::Double );
-  virtual void                    SetNumFunctor( NumericalFunctor_ptr );
-  
-  Controls::ComparatorPtr         GetComparator();
-  NumericalFunctor_i*             GetNumFunctor_i();
-  CORBA::Double                   GetMargin();
-  
-protected:
-                                  Comparator_i();
-protected:                                  
-  Controls::ComparatorPtr         myComparatorPtr;
-  NumericalFunctor_i*             myNumericalFunctor;
-};
-
-
-/*
-  Class       : LessThan_i
-  Description : Comparator "<"
-*/
-class LessThan_i: public virtual POA_SMESH::LessThan,
-                  public virtual Comparator_i
-{
-public:
-                                  LessThan_i();
-  FunctorType                     GetFunctorType();
-};
-
-
-/*
-  Class       : MoreThan_i
-  Description : Comparator ">"
-*/
-class MoreThan_i: public virtual POA_SMESH::MoreThan,
-                  public virtual Comparator_i
-{
-public:
-                                  MoreThan_i();
-  FunctorType                     GetFunctorType();
-};
-
-
-/*
-  Class       : EqualTo_i
-  Description : Comparator "="
-*/
-class EqualTo_i: public virtual POA_SMESH::EqualTo,
-                 public virtual Comparator_i
-{
-public:
-                                  EqualTo_i();
-  virtual void                    SetTolerance( CORBA::Double );
-  CORBA::Double                   GetTolerance();
-  FunctorType                     GetFunctorType();
-  
-protected:
-  Controls::EqualToPtr            myEqualToPtr;
-};
-
-
-/*
-  Class       : LogicalNOT_i
-  Description : Logical NOT predicate
-*/
-class LogicalNOT_i: public virtual POA_SMESH::LogicalNOT,
-                    public virtual Predicate_i
-{
-public:
-                                  LogicalNOT_i();
+  /*
+    Class       : Comparator_i
+    Description : Base class for comparators
+  */
+  class Comparator_i: public virtual POA_SMESH::Comparator,
+                     public virtual Predicate_i
+  {
+  public:
+    virtual                         ~Comparator_i();
+    
+    virtual void                    SetMargin( CORBA::Double );
+    virtual void                    SetNumFunctor( NumericalFunctor_ptr );
+    
+    Controls::ComparatorPtr         GetComparator();
+    NumericalFunctor_i*             GetNumFunctor_i();
+    CORBA::Double                   GetMargin();
+    
+  protected:
+    Comparator_i();
+  protected:                                  
+    Controls::ComparatorPtr         myComparatorPtr;
+    NumericalFunctor_i*             myNumericalFunctor;
+  };
+  
+  
+  /*
+    Class       : LessThan_i
+    Description : Comparator "<"
+  */
+  class LessThan_i: public virtual POA_SMESH::LessThan,
+                   public virtual Comparator_i
+  {
+  public:
+    LessThan_i();
+    FunctorType                     GetFunctorType();
+  };
+  
+  
+  /*
+    Class       : MoreThan_i
+    Description : Comparator ">"
+  */
+  class MoreThan_i: public virtual POA_SMESH::MoreThan,
+                   public virtual Comparator_i
+  {
+  public:
+    MoreThan_i();
+    FunctorType                     GetFunctorType();
+  };
+  
+  
+  /*
+    Class       : EqualTo_i
+    Description : Comparator "="
+  */
+  class EqualTo_i: public virtual POA_SMESH::EqualTo,
+                  public virtual Comparator_i
+  {
+  public:
+    EqualTo_i();
+    virtual void                    SetTolerance( CORBA::Double );
+    CORBA::Double                   GetTolerance();
+    FunctorType                     GetFunctorType();
+    
+  protected:
+    Controls::EqualToPtr            myEqualToPtr;
+  };
+  
+  
+  /*
+    Class       : LogicalNOT_i
+    Description : Logical NOT predicate
+  */
+  class LogicalNOT_i: public virtual POA_SMESH::LogicalNOT,
+                     public virtual Predicate_i
+  {
+  public:
+    LogicalNOT_i();
   virtual                         ~LogicalNOT_i();
+    
+    virtual void                    SetPredicate( Predicate_ptr );
+    Predicate_i*                    GetPredicate_i();
+    FunctorType                     GetFunctorType();
+    
+  protected:
+    Controls::LogicalNOTPtr         myLogicalNOTPtr;
+    Predicate_i*                    myPredicate;
+  };
   
-  virtual void                    SetPredicate( Predicate_ptr );
-  Predicate_i*                    GetPredicate_i();
-  FunctorType                     GetFunctorType();
   
-protected:
-  Controls::LogicalNOTPtr         myLogicalNOTPtr;
-  Predicate_i*                    myPredicate;
-};
-
-
-/*
-  Class       : LogicalBinary_i
-  Description : Base class for binary logical predicate
-*/
-class LogicalBinary_i: public virtual POA_SMESH::LogicalBinary,
-                       public virtual Predicate_i
-{
-public:
-  virtual                         ~LogicalBinary_i();
-  virtual void                    SetMesh( SMESH_Mesh_ptr theMesh );
-  virtual void                    SetPredicate1( Predicate_ptr );
-  virtual void                    SetPredicate2( Predicate_ptr );
-  
-  Controls::LogicalBinaryPtr      GetLogicalBinary();
-  Predicate_i*                    GetPredicate1_i();
-  Predicate_i*                    GetPredicate2_i();
-  
-protected:
-                                  LogicalBinary_i();
-protected:  
-  Controls::LogicalBinaryPtr      myLogicalBinaryPtr;
-  Predicate_i*                    myPredicate1;
-  Predicate_i*                    myPredicate2;
-};
-
-
-/*
-  Class       : LogicalAND_i
-  Description : Logical AND
-*/
-class LogicalAND_i: public virtual POA_SMESH::LogicalAND,
-                    public virtual LogicalBinary_i
-{
-public:
-                                  LogicalAND_i();
-  FunctorType                     GetFunctorType();
-};
-
-
-/*
-  Class       : LogicalOR_i
-  Description : Logical OR
-*/
-class LogicalOR_i: public virtual POA_SMESH::LogicalOR,
-                   public virtual LogicalBinary_i
-{
-public:
-                                  LogicalOR_i();
-  FunctorType                     GetFunctorType();
-};
-
-
-/*
-                               FILTER
-*/
-class Filter_i: public virtual POA_SMESH::Filter,
-                public virtual SALOME::GenericObj_i
-{
-public:
-                                  Filter_i();
-  virtual                         ~Filter_i();
+  /*
+    Class       : LogicalBinary_i
+    Description : Base class for binary logical predicate
+  */
+  class LogicalBinary_i: public virtual POA_SMESH::LogicalBinary,
+                        public virtual Predicate_i
+  {
+  public:
+    virtual                         ~LogicalBinary_i();
+    virtual void                    SetMesh( SMESH_Mesh_ptr theMesh );
+    virtual void                    SetPredicate1( Predicate_ptr );
+    virtual void                    SetPredicate2( Predicate_ptr );
+    
+    Controls::LogicalBinaryPtr      GetLogicalBinary();
+    Predicate_i*                    GetPredicate1_i();
+    Predicate_i*                    GetPredicate2_i();
+    
+  protected:
+    LogicalBinary_i();
+  protected:  
+    Controls::LogicalBinaryPtr      myLogicalBinaryPtr;
+    Predicate_i*                    myPredicate1;
+    Predicate_i*                    myPredicate2;
+  };
   
-  void                            SetPredicate( Predicate_ptr );
-  void                            SetMesh( SMESH_Mesh_ptr );
-
-  long_array*                     GetElementsId( SMESH_Mesh_ptr );
-  ElementType                     GetElementType();
-
-  CORBA::Boolean                  GetCriteria( SMESH::Filter::Criteria_out theCriteria );
-  CORBA::Boolean                  SetCriteria( const SMESH::Filter::Criteria& theCriteria );
   
-  Predicate_ptr                   GetPredicate();
-  Predicate_i*                    GetPredicate_i();
-
-private:
-  Controls::Filter                myFilter;
-  Predicate_i*                    myPredicate;
-};
-
-
-/*
-                            FILTER LIBRARY
-*/
-class FilterLibrary_i: public virtual POA_SMESH::FilterLibrary,
-                       public virtual SALOME::GenericObj_i
-{
-public:
-                          FilterLibrary_i( const char* theFileName );
-                          FilterLibrary_i();
-                          ~FilterLibrary_i();
-
-  Filter_ptr              Copy( const char* theFilterName );
-
-  CORBA::Boolean          Add     ( const char* theFilterName, Filter_ptr theFilter );
-  CORBA::Boolean          AddEmpty( const char* theFilterName, ElementType theType );
-  CORBA::Boolean          Delete  ( const char* theFilterName );
-  CORBA::Boolean          Replace ( const char* theFilterName, 
-                                    const char* theNewName, 
-                                    Filter_ptr  theFilter );
-
-  CORBA::Boolean          Save();
-  CORBA::Boolean          SaveAs( const char* aFileName );
-  
-  CORBA::Boolean          IsPresent( const char* aFilterName );
-  CORBA::Long             NbFilters( ElementType );
-  string_array*           GetNames( ElementType );
-  string_array*           GetAllNames();
-  void                    SetFileName( const char* theFileName );
-  char*                   GetFileName();
-
-private:
-  char*                   myFileName;
-  LDOM_Document           myDoc;
-  FilterManager_var       myFilterMgr;
-};
-
-
-/*
-                            FILTER MANAGER
-*/
+  /*
+    Class       : LogicalAND_i
+    Description : Logical AND
+  */
+  class LogicalAND_i: public virtual POA_SMESH::LogicalAND,
+                     public virtual LogicalBinary_i
+  {
+  public:
+    LogicalAND_i();
+    FunctorType                     GetFunctorType();
+  };
+  
+  
+  /*
+    Class       : LogicalOR_i
+    Description : Logical OR
+  */
+  class LogicalOR_i: public virtual POA_SMESH::LogicalOR,
+                    public virtual LogicalBinary_i
+  {
+  public:
+    LogicalOR_i();
+    FunctorType                     GetFunctorType();
+  };
+  
+  
+  /*
+    FILTER
+  */
+  class Filter_i: public virtual POA_SMESH::Filter,
+                 public virtual SALOME::GenericObj_i
+  {
+  public:
+    Filter_i();
+    ~Filter_i();
+    
+    virtual
+    void
+    SetPredicate( Predicate_ptr );
 
-class FilterManager_i: public virtual POA_SMESH::FilterManager,
-                       public virtual SALOME::GenericObj_i
-{
-public:
-                            FilterManager_i();
-  MinimumAngle_ptr          CreateMinimumAngle();
-  AspectRatio_ptr           CreateAspectRatio();
-  AspectRatio3D_ptr         CreateAspectRatio3D();
-  Warping_ptr               CreateWarping();
-  Taper_ptr                 CreateTaper();
-  Skew_ptr                  CreateSkew();
-  Area_ptr                  CreateArea();
-  Length_ptr                CreateLength();
-  Length2D_ptr              CreateLength2D();
-  MultiConnection_ptr       CreateMultiConnection();
-  MultiConnection2D_ptr     CreateMultiConnection2D();
-  
-  BelongToGeom_ptr          CreateBelongToGeom();
-  BelongToPlane_ptr         CreateBelongToPlane();
-  BelongToCylinder_ptr      CreateBelongToCylinder();
+    virtual
+    void
+    SetMesh( SMESH_Mesh_ptr );
 
-  LyingOnGeom_ptr           CreateLyingOnGeom();
+    virtual
+    SMESH::long_array* 
+    GetIDs();
+    
+    static
+    void
+    GetElementsId( Predicate_i*,
+                  const SMDS_Mesh*,
+                  Controls::Filter::TIdSequence& );
+    static
+    void           
+    GetElementsId( Predicate_i*,
+                  SMESH_Mesh_ptr,
+                  Controls::Filter::TIdSequence& );
+    
+    virtual
+    long_array*      
+    GetElementsId( SMESH_Mesh_ptr );
 
-  FreeBorders_ptr           CreateFreeBorders();
-  FreeEdges_ptr             CreateFreeEdges();
+    virtual
+    ElementType      
+    GetElementType();
+    
+    virtual
+    CORBA::Boolean   
+    GetCriteria( SMESH::Filter::Criteria_out theCriteria );
 
-  RangeOfIds_ptr            CreateRangeOfIds();
+    virtual
+    CORBA::Boolean
+    SetCriteria( const SMESH::Filter::Criteria& theCriteria );
+    
+    virtual
+    Predicate_ptr
+    GetPredicate();
 
-  BadOrientedVolume_ptr     CreateBadOrientedVolume();
+    Predicate_i*     GetPredicate_i();
 
-  LessThan_ptr              CreateLessThan();
-  MoreThan_ptr              CreateMoreThan();
-  EqualTo_ptr               CreateEqualTo();
+  private:
+    Controls::Filter myFilter;
+    Predicate_i*     myPredicate;
+    SMESH_Mesh_var   myMesh;
+  };
   
-  LogicalNOT_ptr            CreateLogicalNOT();
-  LogicalAND_ptr            CreateLogicalAND();
-  LogicalOR_ptr             CreateLogicalOR();
-
-  Filter_ptr                CreateFilter();
-
-  FilterLibrary_ptr         LoadLibrary( const char* aFileName );
-  FilterLibrary_ptr         CreateLibrary();
-  CORBA::Boolean            DeleteLibrary( const char* aFileName );
-};
-
-
-
-};
+  
+  /*
+    FILTER LIBRARY
+  */
+  class FilterLibrary_i: public virtual POA_SMESH::FilterLibrary,
+                        public virtual SALOME::GenericObj_i
+  {
+  public:
+    FilterLibrary_i( const char* theFileName );
+    FilterLibrary_i();
+    ~FilterLibrary_i();
+    
+    Filter_ptr              Copy( const char* theFilterName );
+    
+    CORBA::Boolean          Add     ( const char* theFilterName, Filter_ptr theFilter );
+    CORBA::Boolean          AddEmpty( const char* theFilterName, ElementType theType );
+    CORBA::Boolean          Delete  ( const char* theFilterName );
+    CORBA::Boolean          Replace ( const char* theFilterName, 
+                                     const char* theNewName, 
+                                     Filter_ptr  theFilter );
+    
+    CORBA::Boolean          Save();
+    CORBA::Boolean          SaveAs( const char* aFileName );
+    
+    CORBA::Boolean          IsPresent( const char* aFilterName );
+    CORBA::Long             NbFilters( ElementType );
+    string_array*           GetNames( ElementType );
+    string_array*           GetAllNames();
+    void                    SetFileName( const char* theFileName );
+    char*                   GetFileName();
+    
+  private:
+    char*                   myFileName;
+    LDOM_Document           myDoc;
+    FilterManager_var       myFilterMgr;
+  };
+  
+  
+  /*
+    FILTER MANAGER
+  */
+  
+  class FilterManager_i: public virtual POA_SMESH::FilterManager,
+                        public virtual SALOME::GenericObj_i
+  {
+  public:
+    FilterManager_i();
+    ~FilterManager_i();
+
+    MinimumAngle_ptr          CreateMinimumAngle();
+    AspectRatio_ptr           CreateAspectRatio();
+    AspectRatio3D_ptr         CreateAspectRatio3D();
+    Warping_ptr               CreateWarping();
+    Taper_ptr                 CreateTaper();
+    Skew_ptr                  CreateSkew();
+    Area_ptr                  CreateArea();
+    Length_ptr                CreateLength();
+    Length2D_ptr              CreateLength2D();
+    MultiConnection_ptr       CreateMultiConnection();
+    MultiConnection2D_ptr     CreateMultiConnection2D();
+    
+    BelongToGeom_ptr          CreateBelongToGeom();
+    BelongToPlane_ptr         CreateBelongToPlane();
+    BelongToCylinder_ptr      CreateBelongToCylinder();
+    
+    LyingOnGeom_ptr           CreateLyingOnGeom();
+    
+    FreeBorders_ptr           CreateFreeBorders();
+    FreeEdges_ptr             CreateFreeEdges();
+    
+    RangeOfIds_ptr            CreateRangeOfIds();
+    
+    BadOrientedVolume_ptr     CreateBadOrientedVolume();
+    
+    LessThan_ptr              CreateLessThan();
+    MoreThan_ptr              CreateMoreThan();
+    EqualTo_ptr               CreateEqualTo();
+    
+    LogicalNOT_ptr            CreateLogicalNOT();
+    LogicalAND_ptr            CreateLogicalAND();
+    LogicalOR_ptr             CreateLogicalOR();
+    
+    Filter_ptr                CreateFilter();
+    
+    FilterLibrary_ptr         LoadLibrary( const char* aFileName );
+    FilterLibrary_ptr         CreateLibrary();
+    CORBA::Boolean            DeleteLibrary( const char* aFileName );
+  };
+  
+  
+  Predicate_i* 
+  GetPredicate( SMESH::Predicate_ptr thePredicate );
+}
 
 
 #endif
index 9eb0f79ffff02736c7124f8a7f99068630484f85..1817f0e237eb182632022c79e1755a9850c2651d 100644 (file)
@@ -472,12 +472,24 @@ SMESH::SMESH_Hypothesis_ptr SMESH_Gen_i::CreateHypothesis( const char* theHypNam
   SMESH::SMESH_Hypothesis_var hyp = this->createHypothesis( theHypName, theLibName );
 
   // Publish hypothesis/algorithm in the study
-  if ( CanPublishInStudy( hyp ) )
-    PublishHypothesis( myCurrentStudy, hyp );
+  if ( CanPublishInStudy( hyp ) ) {
+    SALOMEDS::SObject_var aSO = PublishHypothesis( myCurrentStudy, hyp );
+    if ( !aSO->_is_nil() ) {
+      // Update Python script
+      TCollection_AsciiString aStr (aSO->GetID());
+      aStr += " = smesh.CreateHypothesis(\"";
+      aStr += Standard_CString(theHypName);
+      aStr += "\", \"";
+      aStr += Standard_CString(theLibName);
+      aStr += "\")";
+
+      AddToCurrentPyScript(aStr);
+    }
+  }
 
   return hyp._retn();
 }
-  
+
 //=============================================================================
 /*!
  *  SMESH_Gen_i::CreateMesh
@@ -497,13 +509,23 @@ SMESH::SMESH_Mesh_ptr SMESH_Gen_i::CreateMesh( GEOM::GEOM_Object_ptr theShapeObj
   SMESH_Mesh_i* meshServant = dynamic_cast<SMESH_Mesh_i*>( GetServant( mesh ).in() );
   ASSERT( meshServant );
   meshServant->SetShape( theShapeObject );
+
   // publish mesh in the study
-  if( CanPublishInStudy( mesh ) ){
+  if ( CanPublishInStudy( mesh ) ) {
     SALOMEDS::StudyBuilder_var aStudyBuilder = myCurrentStudy->NewBuilder();
     aStudyBuilder->NewCommand();  // There is a transaction
-    PublishMesh( myCurrentStudy, mesh.in() );
+    SALOMEDS::SObject_var aSO = PublishMesh( myCurrentStudy, mesh.in() );
     aStudyBuilder->CommitCommand();
+    if ( !aSO->_is_nil() ) {
+      // Update Python script
+      TCollection_AsciiString aStr (aSO->GetID());
+      aStr += " = smesh.CreateMesh(";
+      SMESH_Gen_i::AddObject(aStr, theShapeObject) += ")";
+      
+      AddToCurrentPyScript(aStr);
+    }
   }
+
   return mesh._retn();
 }
 
@@ -524,11 +546,20 @@ SMESH::SMESH_Mesh_ptr SMESH_Gen_i::CreateMeshesFromUNV( const char* theFileName
   SMESH::SMESH_Mesh_var aMesh = createMesh();
   string aFileName; // = boost::filesystem::path(theFileName).leaf();
   // publish mesh in the study
-  if ( CanPublishInStudy( aMesh ) ){
+  if ( CanPublishInStudy( aMesh ) ) {
     SALOMEDS::StudyBuilder_var aStudyBuilder = myCurrentStudy->NewBuilder();
     aStudyBuilder->NewCommand();  // There is a transaction
-    PublishMesh( myCurrentStudy, aMesh.in(), aFileName.c_str() );
+    SALOMEDS::SObject_var aSO = PublishMesh( myCurrentStudy, aMesh.in(), aFileName.c_str() );
     aStudyBuilder->CommitCommand();
+    if ( !aSO->_is_nil() ) {
+      // Update Python script
+      TCollection_AsciiString aStr (aSO->GetID());
+      aStr += " = smesh.CreateMeshesFromUNV(\"";
+      aStr += Standard_CString(theFileName);
+      aStr += "\")";
+
+      AddToCurrentPyScript(aStr);
+    }
   }
 
   SMESH_Mesh_i* aServant = dynamic_cast<SMESH_Mesh_i*>( GetServant( aMesh ).in() );
@@ -552,6 +583,9 @@ SMESH::mesh_array* SMESH_Gen_i::CreateMeshesFromMED( const char* theFileName,
   Unexpect aCatch(SALOME_SalomeException);
   if(MYDEBUG) MESSAGE( "SMESH_Gen_i::CreateMeshFromMED" );
 
+  // Python Dump
+  TCollection_AsciiString aStr ("([");
+
   // Retrieve mesh names from the file
   DriverMED_R_SMESHDS_Mesh myReader;
   myReader.SetFile( theFileName );
@@ -560,22 +594,33 @@ SMESH::mesh_array* SMESH_Gen_i::CreateMeshesFromMED( const char* theFileName,
   list<string> aNames = myReader.GetMeshNames(aStatus);
   SMESH::mesh_array_var aResult = new SMESH::mesh_array();
   theStatus = (SMESH::DriverMED_ReadStatus)aStatus;
-  if(theStatus == SMESH::DRS_OK){
+  if (theStatus == SMESH::DRS_OK) {
     SALOMEDS::StudyBuilder_var aStudyBuilder = myCurrentStudy->NewBuilder();
     aStudyBuilder->NewCommand();  // There is a transaction
-
     aResult->length( aNames.size() );
     int i = 0;
-   
+    
     // Iterate through all meshes and create mesh objects
     for ( list<string>::iterator it = aNames.begin(); it != aNames.end(); it++ ) {
+      // Python Dump
+      if (i > 0) aStr += ", ";
+
       // create mesh
       SMESH::SMESH_Mesh_var mesh = createMesh();
       
       // publish mesh in the study
+      SALOMEDS::SObject_var aSO;
       if ( CanPublishInStudy( mesh ) )
-        PublishMesh( myCurrentStudy, mesh.in(), (*it).c_str() );
-      
+        aSO = PublishMesh( myCurrentStudy, mesh.in(), (*it).c_str() );
+      if ( !aSO->_is_nil() ) {
+        // Python Dump
+        aStr += aSO->GetID();
+      } else {
+        // Python Dump
+        aStr += "mesh_";
+        aStr += TCollection_AsciiString(i);
+      }
+
       // Read mesh data (groups are published automatically by ImportMEDFile())
       SMESH_Mesh_i* meshServant = dynamic_cast<SMESH_Mesh_i*>( GetServant( mesh ).in() );
       ASSERT( meshServant );
@@ -588,6 +633,14 @@ SMESH::mesh_array* SMESH_Gen_i::CreateMeshesFromMED( const char* theFileName,
     }
     aStudyBuilder->CommitCommand();
   }
+
+  // Update Python script
+  aStr += "], status) = smesh.CreateMeshesFromMED(\"";
+  aStr += Standard_CString(theFileName);
+  aStr += "\")";
+
+  AddToCurrentPyScript(aStr);
+
   return aResult._retn();
 }
 
@@ -608,11 +661,21 @@ SMESH::SMESH_Mesh_ptr SMESH_Gen_i::CreateMeshesFromSTL( const char* theFileName
   SMESH::SMESH_Mesh_var aMesh = createMesh();
   string aFileName; // = boost::filesystem::path(theFileName).leaf();
   // publish mesh in the study
-  if( CanPublishInStudy( aMesh ) ){
+  if ( CanPublishInStudy( aMesh ) ) {
     SALOMEDS::StudyBuilder_var aStudyBuilder = myCurrentStudy->NewBuilder();
     aStudyBuilder->NewCommand();  // There is a transaction
-    PublishInStudy( myCurrentStudy, SALOMEDS::SObject::_nil(), aMesh.in(), aFileName.c_str() );
+    SALOMEDS::SObject_var aSO = PublishInStudy
+      ( myCurrentStudy, SALOMEDS::SObject::_nil(), aMesh.in(), aFileName.c_str() );
     aStudyBuilder->CommitCommand();
+    if ( !aSO->_is_nil() ) {
+    // Update Python script
+      TCollection_AsciiString aStr (aSO->GetID());
+      aStr += " = smesh.CreateMeshesFromSTL(\"";
+      aStr += Standard_CString(theFileName);
+      aStr += "\")";
+
+      AddToCurrentPyScript(aStr);
+    }
   }
 
   SMESH_Mesh_i* aServant = dynamic_cast<SMESH_Mesh_i*>( GetServant( aMesh ).in() );
@@ -760,6 +823,17 @@ CORBA::Boolean SMESH_Gen_i::Compute( SMESH::SMESH_Mesh_ptr theMesh,
     THROW_SALOME_CORBA_EXCEPTION( "bad Mesh reference",
                                   SALOME::BAD_PARAM );
 
+  // Update Python script
+  TCollection_AsciiString aStr ("isDone = smesh.Compute(");
+  SMESH_Gen_i::AddObject(aStr, theMesh) += ", ";
+  SMESH_Gen_i::AddObject(aStr, theShapeObject) += ")";
+
+  AddToCurrentPyScript(aStr);
+
+  aStr = "if isDone == 0: print \"Mesh ";
+  SMESH_Gen_i::AddObject(aStr, theMesh) += " computation failed\"";
+  AddToCurrentPyScript(aStr);
+
   try {
     // get mesh servant
     SMESH_Mesh_i* meshServant = dynamic_cast<SMESH_Mesh_i*>( GetServant( theMesh ).in() );
@@ -801,6 +875,9 @@ SALOMEDS::TMPFile* SMESH_Gen_i::Save( SALOMEDS::SComponent_ptr theComponent,
        theComponent->GetStudy()->StudyId() != myCurrentStudy->StudyId() )
     SetCurrentStudy( theComponent->GetStudy() );
 
+  // Store study contents as a set of python commands
+  SavePython(myCurrentStudy);
+
   StudyContext* myStudyContext = GetCurrentStudyContext();
   
   // Declare a byte stream
index a9330165364c232e7c74da62819508ca51d88957..152edb6cea9a9dae43d351ce34053455c5b9cfa7 100644 (file)
 #include "SMESH_Gen.hxx"
 #include "GEOM_Client.hxx"
 
+#include <TCollection_AsciiString.hxx>
+#include <Resource_DataMapOfAsciiStringAsciiString.hxx>
+#include <TColStd_HSequenceOfAsciiString.hxx>
+
 #include <map>
+#include <sstream>
 
 class SMESH_Mesh_i;
 class SALOME_LifeCycleCORBA;
@@ -273,6 +278,56 @@ public:
     return aResultSO._retn();
   }
 
+  // ============
+  // Dump python
+  // ============
+
+  virtual Engines::TMPFile* DumpPython(CORBA::Object_ptr theStudy, 
+                                      CORBA::Boolean isPublished, 
+                                      CORBA::Boolean& isValidScript);
+
+  void AddToPythonScript (int theStudyID, const TCollection_AsciiString& theString);
+
+  void RemoveLastFromPythonScript (int theStudyID);
+
+  static void AddToCurrentPyScript (const TCollection_AsciiString& theString);
+
+  void SavePython (SALOMEDS::Study_ptr theStudy);
+
+  TCollection_AsciiString DumpPython_impl (int theStudyID, 
+                                           Resource_DataMapOfAsciiStringAsciiString& theObjectNames,
+                                           Resource_DataMapOfAsciiStringAsciiString& theNames,
+                                           bool isPublished, 
+                                           bool& aValidScript,
+                                           const TCollection_AsciiString& theSavedTrace);
+
+  TCollection_AsciiString GetNewPythonLines (int theStudyID);
+
+  void CleanPythonTrace (int theStudyID);
+
+  // Dump python comfort methods
+
+  static TCollection_AsciiString& AddObject(TCollection_AsciiString& theStr,
+                                            CORBA::Object_ptr        theObject);
+  // add object to script string
+
+  template <class _array>
+    static TCollection_AsciiString& AddArray(TCollection_AsciiString& theStr,
+                                             const _array &           array)
+      // put array contents into theStr like this: "[ 1, 2, 5 ]"
+    {
+      ostringstream sout; // can convert long int, and TCollection_AsciiString cant
+      sout << "[ ";
+      for (int i = 1; i <= array.length(); i++) {
+        sout << array[i-1];
+        if ( i < array.length() )
+          sout << ", ";
+      }
+      sout << " ]";
+      theStr += (char*) sout.str().c_str();
+      return theStr;
+    }
+
   // *****************************************
   // Internal methods
   // *****************************************
@@ -369,6 +424,21 @@ private:
 
   GEOM_Client*              myShapeReader;      // Shape reader
   SALOMEDS::Study_var       myCurrentStudy;     // Current study
+
+  // Dump Python: trace of API methods calls
+  std::map < int, Handle(TColStd_HSequenceOfAsciiString) > myPythonScripts;
 };
 
+
+namespace SMESH
+{
+  template<class T>
+  T
+  DownCast(CORBA::Object_ptr theArg)
+  {
+    return dynamic_cast<T>(SMESH_Gen_i::GetServant(theArg).in());
+  }
+}
+
+
 #endif
index 78ca5289810b95a4fb690ab38ca20f4365136ebf..47236abcc9b194f64a56a73a234650b350e590c1 100644 (file)
 #include "SMESHDS_Group.hxx"
 #include "SMESHDS_GroupOnGeom.hxx"
 #include "SMDSAbs_ElementType.hxx"
+
+#include "SMESH_Filter_i.hxx"
+#include "SMESH_PythonDump.hxx"
+
 #include "utilities.h"
 
+using namespace SMESH;
+
 //=============================================================================
 /*!
  *  
@@ -113,6 +119,14 @@ SMESHDS_GroupBase* SMESH_GroupBase_i::GetGroupDS() const
 
 void SMESH_GroupBase_i::SetName( const char* theName )
 {
+  // Update Python script
+  TCollection_AsciiString aStr, aStrName ((char*)theName);
+  SMESH_Gen_i::AddObject(aStr, _this()) += ".SetName(\"";
+  aStr += aStrName + "\")";
+
+  SMESH_Gen_i::AddToCurrentPyScript(aStr);
+
+  // Perform renaming
   ::SMESH_Group* aGroup = GetSmeshGroup();
   if (aGroup) {
     aGroup->SetName(theName);
@@ -204,6 +218,13 @@ CORBA::Boolean SMESH_GroupBase_i::IsEmpty()
 
 void SMESH_Group_i::Clear()
 {
+  // Update Python script
+  TCollection_AsciiString aStr;
+  SMESH_Gen_i::AddObject(aStr, _this()) += ".Clear()";
+
+  SMESH_Gen_i::AddToCurrentPyScript(aStr);
+
+  // Clear the group
   SMESHDS_Group* aGroupDS = dynamic_cast<SMESHDS_Group*>( GetGroupDS() );
   if (aGroupDS) {
     aGroupDS->Clear();
@@ -235,6 +256,14 @@ CORBA::Boolean SMESH_GroupBase_i::Contains( CORBA::Long theID )
 
 CORBA::Long SMESH_Group_i::Add( const SMESH::long_array& theIDs )
 {
+  // Update Python script
+  TCollection_AsciiString aStr ("nbAdd = ");
+  SMESH_Gen_i::AddObject(aStr, _this()) += ".Add(";
+  SMESH_Gen_i::AddArray(aStr, theIDs) += ")";
+
+  SMESH_Gen_i::AddToCurrentPyScript(aStr);
+
+  // Add elements to the group
   SMESHDS_Group* aGroupDS = dynamic_cast<SMESHDS_Group*>( GetGroupDS() );
   if (aGroupDS) {
     int nbAdd = 0;
@@ -255,6 +284,86 @@ CORBA::Long SMESH_Group_i::Add( const SMESH::long_array& theIDs )
  */
 //=============================================================================
 
+CORBA::Long SMESH_Group_i::Remove( const SMESH::long_array& theIDs )
+{
+  // Update Python script
+  TCollection_AsciiString aStr ("nbDel = ");
+  SMESH_Gen_i::AddObject(aStr, _this()) += ".Remove(";
+  SMESH_Gen_i::AddArray(aStr, theIDs) += ")";
+
+  SMESH_Gen_i::AddToCurrentPyScript(aStr);
+
+  // Remove elements from the group
+  SMESHDS_Group* aGroupDS = dynamic_cast<SMESHDS_Group*>( GetGroupDS() );
+  if (aGroupDS) {
+    int nbDel = 0;
+    for (int i = 0; i < theIDs.length(); i++) {
+      int anID = (int) theIDs[i];
+      if (aGroupDS->Remove(anID))
+        nbDel++;
+    }
+    return nbDel;
+  }
+  MESSAGE("attempt to remove elements from a vague group");
+  return 0;
+}
+
+//=============================================================================
+/*!
+ *  
+ */
+//=============================================================================
+
+typedef bool (SMESHDS_Group::*TFunChangeGroup)(const int);
+
+CORBA::Long 
+ChangeByPredicate( SMESH::Predicate_i* thePredicate,
+                  SMESHDS_GroupBase* theGroupBase,
+                  TFunChangeGroup theFun)
+{
+  CORBA::Long aNb = 0;
+  if(SMESHDS_Group* aGroupDS = dynamic_cast<SMESHDS_Group*>(theGroupBase)){
+    SMESH::Controls::Filter::TIdSequence aSequence;
+    const SMDS_Mesh* aMesh = theGroupBase->GetMesh();
+    SMESH::Filter_i::GetElementsId(thePredicate,aMesh,aSequence);
+    
+    CORBA::Long i = 0, iEnd = aSequence.size();
+    for(; i < iEnd; i++)
+      if((aGroupDS->*theFun)(aSequence[i]))
+       aNb++;
+    return aNb;
+  }
+  return aNb;
+}
+
+CORBA::Long 
+SMESH_Group_i::
+AddByPredicate( SMESH::Predicate_ptr thePredicate )
+{
+  if(SMESH::Predicate_i* aPredicate = SMESH::GetPredicate(thePredicate)){
+    TPythonDump()<<_this()<<".AddByPredicate("<<aPredicate<<")";
+    return ChangeByPredicate(aPredicate,GetGroupDS(),&SMESHDS_Group::Add);
+  }
+  return 0;
+}
+
+CORBA::Long 
+SMESH_Group_i::
+RemoveByPredicate( SMESH::Predicate_ptr thePredicate )
+{
+  if(SMESH::Predicate_i* aPredicate = SMESH::GetPredicate(thePredicate)){
+    TPythonDump()<<_this()<<".RemoveByPredicate("<<aPredicate<<")";
+    return ChangeByPredicate(aPredicate,GetGroupDS(),&SMESHDS_Group::Remove);
+  }
+  return 0;
+}
+
+//=============================================================================
+/*!
+ *  
+ */
+//=============================================================================
+
 CORBA::Long SMESH_GroupBase_i::GetID( CORBA::Long theIndex )
 {
   SMESHDS_GroupBase* aGroupDS = GetGroupDS();
@@ -285,28 +394,6 @@ SMESH::long_array* SMESH_GroupBase_i::GetListOfID()
   return aRes._retn();
 }
 
-//=============================================================================
-/*!
- *  
- */
-//=============================================================================
-
-CORBA::Long SMESH_Group_i::Remove( const SMESH::long_array& theIDs )
-{
-  SMESHDS_Group* aGroupDS = dynamic_cast<SMESHDS_Group*>( GetGroupDS() );
-  if (aGroupDS) {
-    int nbDel = 0;
-    for (int i = 0; i < theIDs.length(); i++) {
-      int anID = (int) theIDs[i];
-      if (aGroupDS->Remove(anID))
-        nbDel++;
-    }
-    return nbDel;
-  }
-  MESSAGE("attempt to remove elements from a vague group");
-  return 0;
-}
-
 //=============================================================================
 /*!
  *  
index 48fb1c036f5627e1b6e51e8a7484636157c65656..e9801b258b9eea32e898ff871c100ae7f3621b92 100644 (file)
@@ -37,7 +37,7 @@
 #include "SALOME_GenericObj_i.hh"
 
 class SMESH_Mesh_i;
-class ::SMESH_Group;
+class SMESH_Group;
 class SMESHDS_GroupBase;
 
 // ===========
@@ -70,7 +70,7 @@ class SMESH_GroupBase_i:
   // Internal C++ interface
   int GetLocalID() const { return myLocalID; }
   SMESH_Mesh_i* GetMeshServant() const { return myMeshServant; }
-  ::SMESH_Group* GetSmeshGroup() const;
+  SMESH_Group* GetSmeshGroup() const;
   SMESHDS_GroupBase* GetGroupDS() const;
 
 private:
@@ -93,6 +93,9 @@ class SMESH_Group_i:
   void Clear();
   CORBA::Long Add( const SMESH::long_array& theIDs );
   CORBA::Long Remove( const SMESH::long_array& theIDs );
+
+  CORBA::Long AddByPredicate( SMESH::Predicate_ptr thePredicate );
+  CORBA::Long RemoveByPredicate( SMESH::Predicate_ptr thePredicate );
 };
 
 // =========================
index e48a49626245dd9892ac97df99ebc7960742dd66..e60379c04908474c0b3bcf902e14fa57426fc5e2 100644 (file)
@@ -61,8 +61,8 @@ public :
   // IDL Methods
   void setProtocol(SALOME::TypeOfCommunication typ) {}
   void release() {}
-  SALOME::Sender_ptr getSenderForNumber(long int) {return SALOME::Sender::_nil();}
-  SALOME::Sender_ptr getSenderForNumberIndex() {return SALOME::Sender::_nil();}
+  SALOME::SenderInt_ptr getSenderForNumber(long int) {return SALOME::SenderInt::_nil();}
+  SALOME::SenderInt_ptr getSenderForNumberIndex() {return SALOME::SenderInt::_nil();}
   
   CORBA::Long            getIdentifier()      
     throw (SALOME::SALOME_Exception);
index e8e82f17bd068ae6f48362d6196aa7db6ffe2580..3e8fe7a35f49d93fbea05a845c2d709ecd4eae39 100644 (file)
@@ -77,8 +77,8 @@ class SMESH_MEDMesh_i:
        // IDL Methods
        void setProtocol(SALOME::TypeOfCommunication typ) {}
        void release() {}
-       SALOME::Sender_ptr getSenderForCoordinates(long int) {return SALOME::Sender::_nil();}
-       SALOME::Sender_ptr getSenderForConnectivity(long int, long int, long int, long int) {return SALOME::Sender::_nil();}
+       SALOME::SenderDouble_ptr getSenderForCoordinates(long int) {return SALOME::SenderDouble::_nil();}
+       SALOME::SenderInt_ptr getSenderForConnectivity(long int, long int, long int, long int) {return SALOME::SenderInt::_nil();}
        
        char *getName() throw(SALOME::SALOME_Exception);
        CORBA::Long getSpaceDimension() throw(SALOME::SALOME_Exception);
@@ -216,6 +216,8 @@ class SMESH_MEDMesh_i:
         SALOME_MED::MESH::meshInfos * getMeshGlobal()
          throw (SALOME::SALOME_Exception);
 
+       bool areEquals(SALOME_MED::MESH_ptr other) { return false;};
+
         SALOME_MED::MESH::coordinateInfos * getCoordGlobal()
          throw (SALOME::SALOME_Exception);
 
index 6a4799a73c29c14fdb8e5f74f920b41a3f10a5cd..2c444819c7bbabe0ebd1f1af78b0a5bfd020426f 100644 (file)
 #include <gp_Ax2.hxx>
 #include <gp_Vec.hxx>
 
+#include <sstream>
+
 using namespace std;
 
+//=======================================================================
+//function : addAxis
+//purpose  : 
+//=======================================================================
+
+static TCollection_AsciiString& addAxis(TCollection_AsciiString&  theStr,
+                                        const SMESH::AxisStruct & theAxis)
+{
+  theStr += "SMESH.AxisStruct( ";
+  theStr += TCollection_AsciiString( theAxis.x  ) + ", ";
+  theStr += TCollection_AsciiString( theAxis.y  ) + ", ";
+  theStr += TCollection_AsciiString( theAxis.z  ) + ", ";
+  theStr += TCollection_AsciiString( theAxis.vx ) + ", ";
+  theStr += TCollection_AsciiString( theAxis.vy ) + ", ";
+  theStr += TCollection_AsciiString( theAxis.vz ) + " )";
+  return theStr;
+}
+
 //=============================================================================
 /*!
  *  
@@ -62,14 +82,23 @@ SMESH_MeshEditor_i::SMESH_MeshEditor_i(SMESH_Mesh* theMesh)
  */
 //=============================================================================
 
-CORBA::Boolean SMESH_MeshEditor_i::RemoveElements(const SMESH::
-       long_array & IDsOfElements)
+CORBA::Boolean
+  SMESH_MeshEditor_i::RemoveElements(const SMESH::long_array & IDsOfElements)
 {
   ::SMESH_MeshEditor anEditor( _myMesh );
   list< int > IdList;
+
   for (int i = 0; i < IDsOfElements.length(); i++)
     IdList.push_back( IDsOfElements[i] );
 
+  // Update Python script
+  TCollection_AsciiString str ("isDone = mesh_editor.RemoveElements(");
+  SMESH_Gen_i::AddArray( str, IDsOfElements ) += ")";
+  SMESH_Gen_i::AddToCurrentPyScript( str );
+#ifdef _DEBUG_
+  SMESH_Gen_i::AddToCurrentPyScript( "print \"RemoveElements: \", isDone" );
+#endif
+  // Remove Elements
   return anEditor.Remove( IdList, false );
 };
 
@@ -87,6 +116,14 @@ CORBA::Boolean SMESH_MeshEditor_i::RemoveNodes(const SMESH::
   for (int i = 0; i < IDsOfNodes.length(); i++)
     IdList.push_back( IDsOfNodes[i] );
 
+  // Update Python script
+  TCollection_AsciiString str ("isDone = mesh_editor.RemoveNodes(");
+  SMESH_Gen_i::AddArray( str, IDsOfNodes ) += ")";
+  SMESH_Gen_i::AddToCurrentPyScript( str );
+#ifdef _DEBUG_
+  SMESH_Gen_i::AddToCurrentPyScript( "print \"RemoveNodes: \", isDone" );
+#endif
+
   return anEditor.Remove( IdList, true );
 };
 
@@ -98,14 +135,20 @@ CORBA::Boolean SMESH_MeshEditor_i::RemoveNodes(const SMESH::
 
 CORBA::Boolean SMESH_MeshEditor_i::AddEdge(const SMESH::long_array & IDsOfNodes)
 {
-       int NbNodes = IDsOfNodes.length();
-       if (NbNodes == 2)
-       {
-               CORBA::Long index1 = IDsOfNodes[0];
-               CORBA::Long index2 = IDsOfNodes[1];
-               GetMeshDS()->AddEdge(GetMeshDS()->FindNode(index1), GetMeshDS()->FindNode(index2));
-       }
-       return true;
+  int NbNodes = IDsOfNodes.length();
+  if (NbNodes == 2)
+  {
+    CORBA::Long index1 = IDsOfNodes[0];
+    CORBA::Long index2 = IDsOfNodes[1];
+    GetMeshDS()->AddEdge(GetMeshDS()->FindNode(index1), GetMeshDS()->FindNode(index2));
+
+    // Update Python script
+    TCollection_AsciiString str ("isDone = mesh_editor.AddEdge([");
+    str += TCollection_AsciiString((int) index1) + ", ";
+    str += TCollection_AsciiString((int) index2) + " ])";
+    SMESH_Gen_i::AddToCurrentPyScript( str );
+  }
+  return true;
 }
 
 //=============================================================================
@@ -115,33 +158,60 @@ CORBA::Boolean SMESH_MeshEditor_i::AddEdge(const SMESH::long_array & IDsOfNodes)
 //=============================================================================
 
 CORBA::Boolean SMESH_MeshEditor_i::AddNode(CORBA::Double x,
-       CORBA::Double y, CORBA::Double z)
+                                           CORBA::Double y, CORBA::Double z)
 {
-       MESSAGE(" AddNode " << x << " , " << y << " , " << z)
-               int idNode = GetMeshDS()->AddNode(x, y, z)->GetID();
-       MESSAGE(" idNode " << idNode) return true;
+  GetMeshDS()->AddNode(x, y, z);
+
+  // Update Python script
+  TCollection_AsciiString str ("isDone = mesh_editor.AddNode(");
+  str += TCollection_AsciiString( x ) + ", ";
+  str += TCollection_AsciiString( y ) + ", ";
+  str += TCollection_AsciiString( z ) + " )";
+  SMESH_Gen_i::AddToCurrentPyScript( str );
+
+  return true;
 }
 
 //=============================================================================
 /*!
- *  
+ *  AddFace
  */
 //=============================================================================
 
 CORBA::Boolean SMESH_MeshEditor_i::AddFace(const SMESH::long_array & IDsOfNodes)
 {
-       int NbNodes = IDsOfNodes.length();
-       const SMDS_MeshNode* nodes[4];
-       for(int i=0;i<NbNodes;i++) nodes[i]=GetMeshDS()->FindNode(IDsOfNodes[i]);
-       if (NbNodes == 3)
-       {
-               GetMeshDS()->AddFace(nodes[0], nodes[1], nodes[2]);
-       }
-       else if (NbNodes == 4)
-       {
-               GetMeshDS()->AddFace(nodes[0], nodes[1], nodes[2], nodes[3]);
-       }
-       return true;
+  int NbNodes = IDsOfNodes.length();
+  if (NbNodes < 3)
+  {
+    return false;
+  }
+
+  std::vector<const SMDS_MeshNode*> nodes (NbNodes);
+  for (int i = 0; i < NbNodes; i++)
+    nodes[i] = GetMeshDS()->FindNode(IDsOfNodes[i]);
+
+  if (NbNodes == 3)
+  {
+    GetMeshDS()->AddFace(nodes[0], nodes[1], nodes[2]);
+  }
+  else if (NbNodes == 4)
+  {
+    GetMeshDS()->AddFace(nodes[0], nodes[1], nodes[2], nodes[3]);
+  }
+  else
+  {
+    GetMeshDS()->AddPolygonalFace(nodes);
+  }
+
+  // Update Python script
+  TCollection_AsciiString str ("isDone = mesh_editor.AddFace(");
+  SMESH_Gen_i::AddArray( str, IDsOfNodes ) += ")";
+  SMESH_Gen_i::AddToCurrentPyScript( str );
+#ifdef _DEBUG_
+  SMESH_Gen_i::AddToCurrentPyScript( "print \"AddFace: \", isDone" );
+#endif
+
+  return true;
 };
 
 //=============================================================================
@@ -151,20 +221,97 @@ CORBA::Boolean SMESH_MeshEditor_i::AddFace(const SMESH::long_array & IDsOfNodes)
 //=============================================================================
 
 CORBA::Boolean SMESH_MeshEditor_i::AddVolume(const SMESH::
-       long_array & IDsOfNodes)
+                                             long_array & IDsOfNodes)
+{
+  int NbNodes = IDsOfNodes.length();
+  vector< const SMDS_MeshNode*> n(NbNodes);
+  for(int i=0;i<NbNodes;i++)
+    n[i]=GetMeshDS()->FindNode(IDsOfNodes[i]);
+
+  switch(NbNodes)
+  {
+  case 4:GetMeshDS()->AddVolume(n[0],n[1],n[2],n[3]); break;
+  case 5:GetMeshDS()->AddVolume(n[0],n[1],n[2],n[3],n[4]); break;
+  case 6:GetMeshDS()->AddVolume(n[0],n[1],n[2],n[3],n[4],n[5]); break;
+  case 8:GetMeshDS()->AddVolume(n[0],n[1],n[2],n[3],n[4],n[5],n[6],n[7]); break;
+  }
+  // Update Python script
+  TCollection_AsciiString str ("isDone = mesh_editor.AddVolume(");
+  SMESH_Gen_i::AddArray( str, IDsOfNodes ) += ")";
+  SMESH_Gen_i::AddToCurrentPyScript( str );
+#ifdef _DEBUG_
+  SMESH_Gen_i::AddToCurrentPyScript( "print \"AddVolume: \", isDone" );
+#endif
+  
+  return true;
+};
+
+//=============================================================================
+/*!
+ *  AddPolyhedralVolume
+ */
+//=============================================================================
+CORBA::Boolean SMESH_MeshEditor_i::AddPolyhedralVolume
+                                   (const SMESH::long_array & IDsOfNodes,
+                                    const SMESH::long_array & Quantities)
+{
+  int NbNodes = IDsOfNodes.length();
+  std::vector<const SMDS_MeshNode*> n (NbNodes);
+  for (int i = 0; i < NbNodes; i++)
+    n[i] = GetMeshDS()->FindNode(IDsOfNodes[i]);
+
+  int NbFaces = Quantities.length();
+  std::vector<int> q (NbFaces);
+  for (int j = 0; j < NbFaces; j++)
+    q[j] = Quantities[j];
+
+  GetMeshDS()->AddPolyhedralVolume(n, q);
+
+  // Update Python script
+  TCollection_AsciiString str ("isDone = mesh_editor.AddPolyhedralVolume(");
+  SMESH_Gen_i::AddArray( str, IDsOfNodes ) += ", ";
+  SMESH_Gen_i::AddArray( str, Quantities ) += ")";
+  SMESH_Gen_i::AddToCurrentPyScript( str );
+#ifdef _DEBUG_
+  SMESH_Gen_i::AddToCurrentPyScript( "print \"AddPolyhedralVolume: \", isDone" );
+#endif
+
+  return true;
+};
+
+//=============================================================================
+/*!
+ *  AddPolyhedralVolumeByFaces
+ */
+//=============================================================================
+CORBA::Boolean SMESH_MeshEditor_i::AddPolyhedralVolumeByFaces
+                                   (const SMESH::long_array & IdsOfFaces)
 {
-       int NbNodes = IDsOfNodes.length();
-       const SMDS_MeshNode* n[8];
-       for(int i=0;i<NbNodes;i++) n[i]=GetMeshDS()->FindNode(IDsOfNodes[i]);
-
-       switch(NbNodes)
-       {
-       case 4:GetMeshDS()->AddVolume(n[0],n[1],n[2],n[3]); break;
-       case 5:GetMeshDS()->AddVolume(n[0],n[1],n[2],n[3],n[4]); break;
-       case 6:GetMeshDS()->AddVolume(n[0],n[1],n[2],n[3],n[4],n[5]); break;
-       case 8:GetMeshDS()->AddVolume(n[0],n[1],n[2],n[3],n[4],n[5],n[6],n[7]); break;
-       }
-       return true;
+  int NbFaces = IdsOfFaces.length();
+  std::vector<const SMDS_MeshNode*> poly_nodes;
+  std::vector<int> quantities (NbFaces);
+
+  for (int i = 0; i < NbFaces; i++) {
+    const SMDS_MeshElement* aFace = GetMeshDS()->FindElement(IdsOfFaces[i]);
+    quantities[i] = aFace->NbNodes();
+
+    SMDS_ElemIteratorPtr It = aFace->nodesIterator();
+    while (It->more()) {
+      poly_nodes.push_back(static_cast<const SMDS_MeshNode *>(It->next()));
+    }
+  }
+
+  GetMeshDS()->AddPolyhedralVolume(poly_nodes, quantities);
+
+  // Update Python script
+  TCollection_AsciiString str ("isDone = mesh_editor.AddPolyhedralVolumeByFaces(");
+  SMESH_Gen_i::AddArray( str, IdsOfFaces ) += ")";
+  SMESH_Gen_i::AddToCurrentPyScript( str );
+#ifdef _DEBUG_
+  SMESH_Gen_i::AddToCurrentPyScript( "print \"AddPolyhedralVolume: \", isDone" );
+#endif
+
+  return true;
 };
 
 //=============================================================================
@@ -184,6 +331,14 @@ CORBA::Boolean SMESH_MeshEditor_i::MoveNode(CORBA::Long   NodeID,
   
   GetMeshDS()->MoveNode(node, x, y, z);
 
+  // Update Python script
+  TCollection_AsciiString str ("isDone = mesh_editor.MoveNode(");
+  str += TCollection_AsciiString((Standard_Integer) NodeID) + ", ";
+  str += TCollection_AsciiString((Standard_Real) x) + ", ";
+  str += TCollection_AsciiString((Standard_Real) y) + ", ";
+  str += TCollection_AsciiString((Standard_Real) z) + " )";
+  SMESH_Gen_i::AddToCurrentPyScript( str );
+
   return true;
 }
 
@@ -201,6 +356,12 @@ CORBA::Boolean SMESH_MeshEditor_i::InverseDiag(CORBA::Long NodeID1,
   if ( !n1 || !n2 )
     return false;
 
+  // Update Python script
+  TCollection_AsciiString str ("isDone = mesh_editor.InverseDiag(");
+  str += TCollection_AsciiString((Standard_Integer) NodeID1) + ", ";
+  str += TCollection_AsciiString((Standard_Integer) NodeID2) + " )";
+  SMESH_Gen_i::AddToCurrentPyScript( str );
+
   ::SMESH_MeshEditor aMeshEditor( _myMesh );
   return aMeshEditor.InverseDiag ( n1, n2 );
 }
@@ -219,6 +380,12 @@ CORBA::Boolean SMESH_MeshEditor_i::DeleteDiag(CORBA::Long NodeID1,
   if ( !n1 || !n2 )
     return false;
 
+  // Update Python script
+  TCollection_AsciiString str ("isDone = mesh_editor.DeleteDiag(");
+  str += TCollection_AsciiString((Standard_Integer) NodeID1) + ", ";
+  str += TCollection_AsciiString((Standard_Integer) NodeID2) + " )";
+  SMESH_Gen_i::AddToCurrentPyScript( str );
+
   ::SMESH_MeshEditor aMeshEditor( _myMesh );
   return aMeshEditor.DeleteDiag ( n1, n2 );
 }
@@ -239,6 +406,11 @@ CORBA::Boolean SMESH_MeshEditor_i::Reorient(const SMESH::long_array & IDsOfEleme
     if ( elem )
       anEditor.Reorient( elem );
   }
+  // Update Python script
+  TCollection_AsciiString str ("isDone = mesh_editor.Reorient(");
+  SMESH_Gen_i::AddArray( str, IDsOfElements ) += ")";
+  SMESH_Gen_i::AddToCurrentPyScript( str );
+
   return true;
 }
 
@@ -252,7 +424,18 @@ CORBA::Boolean SMESH_MeshEditor_i::Reorient(const SMESH::long_array & IDsOfEleme
 CORBA::Boolean SMESH_MeshEditor_i::ReorientObject(SMESH::SMESH_IDSource_ptr theObject)
 {
   SMESH::long_array_var anElementsId = theObject->GetIDs();
-  return Reorient(anElementsId);
+  CORBA::Boolean isDone = Reorient(anElementsId);
+
+  // Clear python line, created by Reorient()
+  SMESH_Gen_i* aSMESHGen = SMESH_Gen_i::GetSMESHGen();
+  aSMESHGen->RemoveLastFromPythonScript(aSMESHGen->GetCurrentStudyID());
+
+  // Update Python script
+  TCollection_AsciiString str ("isDone = mesh_editor.ReorientObject(");
+  SMESH_Gen_i::AddObject( str, theObject ) += ")";
+  SMESH_Gen_i::AddToCurrentPyScript( str );
+
+  return isDone;
 }
 
 //=============================================================================
@@ -282,6 +465,15 @@ CORBA::Boolean
   else
     aCrit = aNumericalFunctor->GetNumericalFunctor();
 
+  // Update Python script
+  TCollection_AsciiString str ("isDone = mesh_editor.TriToQuad(");
+  SMESH_Gen_i::AddArray( str, IDsOfElements ) += ", None, ";
+  str += (Standard_Real) MaxAngle;
+  SMESH_Gen_i::AddToCurrentPyScript( str + ")" );
+#ifdef _DEBUG_
+  SMESH_Gen_i::AddToCurrentPyScript( "print \"TriToQuad: \", isDone" );
+#endif
+
   ::SMESH_MeshEditor anEditor( _myMesh );
   return anEditor.TriToQuad( faces, aCrit, MaxAngle );
 }
@@ -298,7 +490,25 @@ CORBA::Boolean
                                       CORBA::Double               MaxAngle)
 {
   SMESH::long_array_var anElementsId = theObject->GetIDs();
-  return TriToQuad(anElementsId, Criterion, MaxAngle);
+  CORBA::Boolean isDone = TriToQuad(anElementsId, Criterion, MaxAngle);
+
+  // Clear python line(s), created by TriToQuad()
+  SMESH_Gen_i* aSMESHGen = SMESH_Gen_i::GetSMESHGen();
+  aSMESHGen->RemoveLastFromPythonScript(aSMESHGen->GetCurrentStudyID());
+#ifdef _DEBUG_
+  aSMESHGen->RemoveLastFromPythonScript(aSMESHGen->GetCurrentStudyID());
+#endif
+
+  // Update Python script
+  TCollection_AsciiString str ("isDone = mesh_editor.TriToQuadObject(");
+  SMESH_Gen_i::AddObject( str, theObject ) += ", None, ";
+  str += (Standard_Real) MaxAngle;
+  SMESH_Gen_i::AddToCurrentPyScript( str + ")" );
+#ifdef _DEBUG_
+  SMESH_Gen_i::AddToCurrentPyScript( "print \"TriToQuadObject: \", isDone" );
+#endif
+
+  return isDone;
 }
 
 //=============================================================================
@@ -327,6 +537,15 @@ CORBA::Boolean
   else
     aCrit = aNumericalFunctor->GetNumericalFunctor();
 
+
+  // Update Python script
+  TCollection_AsciiString str ("isDone = mesh_editor.QuadToTri(");
+  SMESH_Gen_i::AddArray( str, IDsOfElements ) += ", None ), ";
+  SMESH_Gen_i::AddToCurrentPyScript( str );
+#ifdef _DEBUG_
+  SMESH_Gen_i::AddToCurrentPyScript( "print \"QuadToTri: \", isDone" );
+#endif
+
   ::SMESH_MeshEditor anEditor( _myMesh );
   return anEditor.QuadToTri( faces, aCrit );
 }
@@ -350,6 +569,15 @@ CORBA::Boolean
       faces.insert( elem );
   }
 
+  // Update Python script
+  TCollection_AsciiString str ("isDone = mesh_editor.SplitQuad(");
+  SMESH_Gen_i::AddArray( str, IDsOfElements ) += ", ";
+  str += TCollection_AsciiString( Diag13 );
+  SMESH_Gen_i::AddToCurrentPyScript( str + ")" );
+#ifdef _DEBUG_
+  SMESH_Gen_i::AddToCurrentPyScript( "print \"SplitQuad: \", isDone" );
+#endif
+
   ::SMESH_MeshEditor anEditor( _myMesh );
   return anEditor.QuadToTri( faces, Diag13 );
 }
@@ -365,7 +593,89 @@ CORBA::Boolean
                                      CORBA::Boolean            Diag13)
 {
   SMESH::long_array_var anElementsId = theObject->GetIDs();
-  return SplitQuad(anElementsId, Diag13);
+  CORBA::Boolean isDone = SplitQuad(anElementsId, Diag13);
+
+  // Clear python line(s), created by SplitQuad()
+  SMESH_Gen_i* aSMESHGen = SMESH_Gen_i::GetSMESHGen();
+  aSMESHGen->RemoveLastFromPythonScript(aSMESHGen->GetCurrentStudyID());
+#ifdef _DEBUG_
+  aSMESHGen->RemoveLastFromPythonScript(aSMESHGen->GetCurrentStudyID());
+#endif
+
+  // Update Python script
+  TCollection_AsciiString str ("isDone = mesh_editor.SplitQuadObject(");
+  SMESH_Gen_i::AddObject( str, theObject ) += ", ";
+  str += TCollection_AsciiString( Diag13 ) + ")";
+  SMESH_Gen_i::AddToCurrentPyScript( str );
+#ifdef _DEBUG_
+  SMESH_Gen_i::AddToCurrentPyScript( "print \"SplitQuadObject: \", isDone" );
+#endif
+
+  return isDone;
+}
+
+//=======================================================================
+//function : Smooth
+//purpose  : 
+//=======================================================================
+
+CORBA::Boolean
+  SMESH_MeshEditor_i::Smooth(const SMESH::long_array &              IDsOfElements,
+                             const SMESH::long_array &              IDsOfFixedNodes,
+                             CORBA::Long                            MaxNbOfIterations,
+                             CORBA::Double                          MaxAspectRatio,
+                             SMESH::SMESH_MeshEditor::Smooth_Method Method)
+{
+  return smooth( IDsOfElements, IDsOfFixedNodes, MaxNbOfIterations,
+                MaxAspectRatio, Method, false );
+}
+
+//=======================================================================
+//function : SmoothParametric
+//purpose  : 
+//=======================================================================
+
+CORBA::Boolean
+  SMESH_MeshEditor_i::SmoothParametric(const SMESH::long_array &              IDsOfElements,
+                                       const SMESH::long_array &              IDsOfFixedNodes,
+                                       CORBA::Long                            MaxNbOfIterations,
+                                       CORBA::Double                          MaxAspectRatio,
+                                       SMESH::SMESH_MeshEditor::Smooth_Method Method)
+{
+  return smooth( IDsOfElements, IDsOfFixedNodes, MaxNbOfIterations,
+                MaxAspectRatio, Method, true );
+}
+
+//=======================================================================
+//function : SmoothObject
+//purpose  : 
+//=======================================================================
+
+CORBA::Boolean
+  SMESH_MeshEditor_i::SmoothObject(SMESH::SMESH_IDSource_ptr              theObject,
+                                  const SMESH::long_array &              IDsOfFixedNodes,
+                                  CORBA::Long                            MaxNbOfIterations,
+                                  CORBA::Double                          MaxAspectRatio,
+                                  SMESH::SMESH_MeshEditor::Smooth_Method Method)
+{
+  return smoothObject (theObject, IDsOfFixedNodes, MaxNbOfIterations,
+                       MaxAspectRatio, Method, false);
+}
+
+//=======================================================================
+//function : SmoothParametricObject
+//purpose  : 
+//=======================================================================
+
+CORBA::Boolean
+  SMESH_MeshEditor_i::SmoothParametricObject(SMESH::SMESH_IDSource_ptr              theObject,
+                                  const SMESH::long_array &              IDsOfFixedNodes,
+                                  CORBA::Long                            MaxNbOfIterations,
+                                  CORBA::Double                          MaxAspectRatio,
+                                  SMESH::SMESH_MeshEditor::Smooth_Method Method)
+{
+  return smoothObject (theObject, IDsOfFixedNodes, MaxNbOfIterations,
+                       MaxAspectRatio, Method, true);
 }
 
 //=============================================================================
@@ -375,11 +685,12 @@ CORBA::Boolean
 //=============================================================================
 
 CORBA::Boolean
-  SMESH_MeshEditor_i::Smooth(const SMESH::long_array &              IDsOfElements,
+  SMESH_MeshEditor_i::smooth(const SMESH::long_array &              IDsOfElements,
                              const SMESH::long_array &              IDsOfFixedNodes,
                              CORBA::Long                            MaxNbOfIterations,
                              CORBA::Double                          MaxAspectRatio,
-                             SMESH::SMESH_MeshEditor::Smooth_Method Method)
+                             SMESH::SMESH_MeshEditor::Smooth_Method Method,
+                             bool                                   IsParametric)
 {
   SMESHDS_Mesh* aMesh = GetMeshDS();
 
@@ -402,10 +713,30 @@ CORBA::Boolean
   }
   ::SMESH_MeshEditor::SmoothMethod method = ::SMESH_MeshEditor::LAPLACIAN;
   if ( Method != SMESH::SMESH_MeshEditor::LAPLACIAN_SMOOTH )
-     method = ::SMESH_MeshEditor::CENTROIDAL;
+    method = ::SMESH_MeshEditor::CENTROIDAL;
 
   ::SMESH_MeshEditor anEditor( _myMesh );
-  anEditor.Smooth( elements, fixedNodes, method, MaxNbOfIterations, MaxAspectRatio );
+  anEditor.Smooth(elements, fixedNodes, method,
+                  MaxNbOfIterations, MaxAspectRatio, IsParametric );
+
+  // Update Python script
+  TCollection_AsciiString str ("isDone = mesh_editor.");
+  str += (char*) (IsParametric ? "SmoothParametric( " : "Smooth( ");
+  SMESH_Gen_i::AddArray( str, IDsOfElements ) += ", ";
+  SMESH_Gen_i::AddArray( str, IDsOfFixedNodes ) += ", ";
+  str += (Standard_Integer) MaxNbOfIterations;
+  str += ", ";
+  str += (Standard_Real) MaxAspectRatio;
+  if ( method == ::SMESH_MeshEditor::CENTROIDAL )
+    str += ", SMESH.SMESH_MeshEditor.CENTROIDAL_SMOOTH, ";
+  else
+    str += ", SMESH.SMESH_MeshEditor.LAPLACIAN_SMOOTH, ";
+  str += IsParametric;
+  str += " )";
+  SMESH_Gen_i::AddToCurrentPyScript( str );
+#ifdef _DEBUG_
+  SMESH_Gen_i::AddToCurrentPyScript( "print \"Smooth: \", isDone" );
+#endif
 
   return true;
 }
@@ -417,14 +748,44 @@ CORBA::Boolean
 //=============================================================================
 
 CORBA::Boolean
-  SMESH_MeshEditor_i::SmoothObject(SMESH::SMESH_IDSource_ptr              theObject,
+  SMESH_MeshEditor_i::smoothObject(SMESH::SMESH_IDSource_ptr              theObject,
                                   const SMESH::long_array &              IDsOfFixedNodes,
                                   CORBA::Long                            MaxNbOfIterations,
                                   CORBA::Double                          MaxAspectRatio,
-                                  SMESH::SMESH_MeshEditor::Smooth_Method Method)
+                                  SMESH::SMESH_MeshEditor::Smooth_Method Method,
+                                   bool                                   IsParametric)
 {
   SMESH::long_array_var anElementsId = theObject->GetIDs();
-  return Smooth(anElementsId, IDsOfFixedNodes, MaxNbOfIterations, MaxAspectRatio, Method);
+  CORBA::Boolean isDone = smooth (anElementsId, IDsOfFixedNodes, MaxNbOfIterations,
+                                  MaxAspectRatio, Method, IsParametric);
+
+  // Clear python line(s), created by Smooth()
+  SMESH_Gen_i* aSMESHGen = SMESH_Gen_i::GetSMESHGen();
+  aSMESHGen->RemoveLastFromPythonScript(aSMESHGen->GetCurrentStudyID());
+#ifdef _DEBUG_
+  aSMESHGen->RemoveLastFromPythonScript(aSMESHGen->GetCurrentStudyID());
+#endif
+
+  // Update Python script
+  TCollection_AsciiString str ("isDone = mesh_editor.");
+  str += (char*) (IsParametric ? "SmoothParametricObject( " : "SmoothObject( ");
+  SMESH_Gen_i::AddObject( str, theObject ) += ", ";
+  SMESH_Gen_i::AddArray( str, IDsOfFixedNodes ) += ", ";
+  str += (Standard_Integer) MaxNbOfIterations;
+  str += ", ";
+  str += (Standard_Real) MaxAspectRatio;
+  if ( Method == ::SMESH_MeshEditor::CENTROIDAL )
+    str += ", SMESH.SMESH_MeshEditor.CENTROIDAL_SMOOTH, ";
+  else
+    str += ", SMESH.SMESH_MeshEditor.LAPLACIAN_SMOOTH, ";
+  str += IsParametric;
+  str += " )";
+  SMESH_Gen_i::AddToCurrentPyScript( str );
+#ifdef _DEBUG_
+  SMESH_Gen_i::AddToCurrentPyScript( "print \"SmoothObject: \", isDone" );
+#endif
+
+  return isDone;
 }
 
 //=============================================================================
@@ -435,6 +796,9 @@ CORBA::Boolean
 
 void SMESH_MeshEditor_i::RenumberNodes()
 {
+  // Update Python script
+  SMESH_Gen_i::AddToCurrentPyScript( "mesh_editor.RenumberNodes()" );
+
   GetMeshDS()->Renumber( true );
 }
 
@@ -446,6 +810,9 @@ void SMESH_MeshEditor_i::RenumberNodes()
 
 void SMESH_MeshEditor_i::RenumberElements()
 {
+  // Update Python script
+  SMESH_Gen_i::AddToCurrentPyScript( "mesh_editor.RenumberElements()" );
+
   GetMeshDS()->Renumber( false );
 }
 
@@ -455,7 +822,7 @@ void SMESH_MeshEditor_i::RenumberElements()
 //=======================================================================
 
 void SMESH_MeshEditor_i::RotationSweep(const SMESH::long_array & theIDsOfElements,
-                                       const SMESH::AxisStruct &  theAxis,
+                                       const SMESH::AxisStruct & theAxis,
                                        CORBA::Double             theAngleInRadians,
                                        CORBA::Long               theNbOfSteps,
                                        CORBA::Double             theTolerance)
@@ -476,6 +843,17 @@ void SMESH_MeshEditor_i::RotationSweep(const SMESH::long_array & theIDsOfElement
   ::SMESH_MeshEditor anEditor( _myMesh );
   anEditor.RotationSweep (elements, Ax1, theAngleInRadians,
                           theNbOfSteps, theTolerance);
+
+  // Update Python script
+  TCollection_AsciiString str = "axis = ";
+  addAxis( str, theAxis );
+  SMESH_Gen_i::AddToCurrentPyScript( str );
+  str = "mesh_editor.RotationSweep(";
+  SMESH_Gen_i::AddArray( str, theIDsOfElements ) += ", axis, ";
+  str += TCollection_AsciiString( theAngleInRadians ) + ", ";
+  str += TCollection_AsciiString( (int)theNbOfSteps ) + ", ";
+  str += TCollection_AsciiString( theTolerance      ) + " )";
+  SMESH_Gen_i::AddToCurrentPyScript( str );
 }
 
 //=======================================================================
@@ -491,6 +869,18 @@ void SMESH_MeshEditor_i::RotationSweepObject(SMESH::SMESH_IDSource_ptr theObject
 {
   SMESH::long_array_var anElementsId = theObject->GetIDs();
   RotationSweep(anElementsId, theAxis, theAngleInRadians, theNbOfSteps, theTolerance);
+
+  // Clear python line, created by RotationSweep()
+  SMESH_Gen_i* aSMESHGen = SMESH_Gen_i::GetSMESHGen();
+  aSMESHGen->RemoveLastFromPythonScript(aSMESHGen->GetCurrentStudyID());
+
+  // Update Python script
+  TCollection_AsciiString str ("mesh_editor.RotationSweepObject(");
+  SMESH_Gen_i::AddObject( str, theObject ) += ", axis, ";
+  str += TCollection_AsciiString( theAngleInRadians ) + ", ";
+  str += TCollection_AsciiString( (int)theNbOfSteps ) + ", ";
+  str += TCollection_AsciiString( theTolerance      ) + " )";
+  SMESH_Gen_i::AddToCurrentPyScript( str );
 }
 
 //=======================================================================
@@ -499,7 +889,7 @@ void SMESH_MeshEditor_i::RotationSweepObject(SMESH::SMESH_IDSource_ptr theObject
 //=======================================================================
 
 void SMESH_MeshEditor_i::ExtrusionSweep(const SMESH::long_array & theIDsOfElements,
-                                        const SMESH::DirStruct &   theStepVector,
+                                        const SMESH::DirStruct &  theStepVector,
                                         CORBA::Long               theNbOfSteps)
 {
   SMESHDS_Mesh* aMesh = GetMeshDS();
@@ -517,6 +907,17 @@ void SMESH_MeshEditor_i::ExtrusionSweep(const SMESH::long_array & theIDsOfElemen
 
   ::SMESH_MeshEditor anEditor( _myMesh );
   anEditor.ExtrusionSweep (elements, stepVec, theNbOfSteps);
+
+  // Update Python script
+  TCollection_AsciiString str = "stepVector = SMESH.DirStruct( SMESH.PointStruct ( ";
+  str += (TCollection_AsciiString) stepVec.X() + ", ";
+  str += (TCollection_AsciiString) stepVec.Y() + ", ";
+  str += (TCollection_AsciiString) stepVec.Z() + " ))";
+  SMESH_Gen_i::AddToCurrentPyScript( str );
+  str = ("mesh_editor.ExtrusionSweep(");
+  SMESH_Gen_i::AddArray( str, theIDsOfElements ) += ", stepVector, ";
+  str += TCollection_AsciiString((int)theNbOfSteps) + " )";
+  SMESH_Gen_i::AddToCurrentPyScript( str );
 }
 
 
@@ -531,8 +932,17 @@ void SMESH_MeshEditor_i::ExtrusionSweepObject(SMESH::SMESH_IDSource_ptr theObjec
 {
   SMESH::long_array_var anElementsId = theObject->GetIDs();
   ExtrusionSweep(anElementsId, theStepVector, theNbOfSteps);
-}
 
+  // Clear python line, created by ExtrusionSweep()
+  SMESH_Gen_i* aSMESHGen = SMESH_Gen_i::GetSMESHGen();
+  aSMESHGen->RemoveLastFromPythonScript(aSMESHGen->GetCurrentStudyID());
+
+  // Update Python script
+  TCollection_AsciiString str ("mesh_editor.ExtrusionSweepObject(");
+  SMESH_Gen_i::AddObject( str, theObject ) += ", stepVector, ";
+  str += TCollection_AsciiString((int)theNbOfSteps) + " )";
+  SMESH_Gen_i::AddToCurrentPyScript( str );
+}
 //=======================================================================
 //function : ExtrusionSweepObject1D
 //purpose  : 
@@ -653,6 +1063,22 @@ SMESH::SMESH_MeshEditor::Extrusion_Error
 
   gp_Pnt refPnt( theRefPoint.x, theRefPoint.y, theRefPoint.z );
 
+  // Update Python script
+  TCollection_AsciiString str = "refPoint = SMESH.PointStruct( ";
+  str += (TCollection_AsciiString) refPnt.X() + ", ";
+  str += (TCollection_AsciiString) refPnt.Y() + ", ";
+  str += (TCollection_AsciiString) refPnt.Z() + " )";
+  SMESH_Gen_i::AddToCurrentPyScript( str );
+  str = ("error = mesh_editor.ExtrusionAlongPath(");
+  SMESH_Gen_i::AddArray ( str, theIDsOfElements ) += ", ";
+  SMESH_Gen_i::AddObject( str, thePathMesh ) += ", ";
+  SMESH_Gen_i::AddObject( str, thePathShape ) += ", ";
+  str += TCollection_AsciiString( (int)theNodeStart ) + ", ";
+  str += TCollection_AsciiString( (int)theHasAngles ) + ", ";
+  SMESH_Gen_i::AddArray ( str, theAngles ) += ", ";
+  str += (TCollection_AsciiString) theHasRefPoint + ", refPoint )";
+  SMESH_Gen_i::AddToCurrentPyScript( str );
+
   ::SMESH_MeshEditor anEditor( _myMesh );
   return convExtrError( anEditor.ExtrusionAlongTrack( elements, aSubMesh, nodeStart, theHasAngles, angles, theHasRefPoint, refPnt ) );
 }
@@ -673,7 +1099,26 @@ SMESH::SMESH_MeshEditor::Extrusion_Error
                                               const SMESH::PointStruct &  theRefPoint)
 {
   SMESH::long_array_var anElementsId = theObject->GetIDs();
-  return ExtrusionAlongPath( anElementsId, thePathMesh, thePathShape, theNodeStart, theHasAngles, theAngles, theHasRefPoint, theRefPoint );
+  SMESH::SMESH_MeshEditor::Extrusion_Error error = ExtrusionAlongPath
+    (anElementsId, thePathMesh, thePathShape, theNodeStart,
+     theHasAngles, theAngles, theHasRefPoint, theRefPoint);
+
+  // Clear python line, created by ExtrusionAlongPath()
+  SMESH_Gen_i* aSMESHGen = SMESH_Gen_i::GetSMESHGen();
+  aSMESHGen->RemoveLastFromPythonScript(aSMESHGen->GetCurrentStudyID());
+
+  // Update Python script
+  TCollection_AsciiString str ("error = mesh_editor.ExtrusionAlongPathObject(");
+  SMESH_Gen_i::AddObject( str, theObject ) += ", ";
+  SMESH_Gen_i::AddObject( str, thePathMesh ) += ", ";
+  SMESH_Gen_i::AddObject( str, thePathShape ) += ", ";
+  str += TCollection_AsciiString( (int)theNodeStart ) + ", ";
+  str += TCollection_AsciiString( theHasAngles ) + ", ";
+  SMESH_Gen_i::AddArray ( str, theAngles ) += ", ";
+  str += TCollection_AsciiString( theHasRefPoint ) + ", refPoint )";
+  SMESH_Gen_i::AddToCurrentPyScript( str );
+
+  return error;
 }
 
 //=======================================================================
@@ -682,7 +1127,7 @@ SMESH::SMESH_MeshEditor::Extrusion_Error
 //=======================================================================
 
 void SMESH_MeshEditor_i::Mirror(const SMESH::long_array &           theIDsOfElements,
-                                const SMESH::AxisStruct &            theAxis,
+                                const SMESH::AxisStruct &           theAxis,
                                 SMESH::SMESH_MeshEditor::MirrorType theMirrorType,
                                 CORBA::Boolean                      theCopy)
 {
@@ -700,17 +1145,29 @@ void SMESH_MeshEditor_i::Mirror(const SMESH::long_array &           theIDsOfElem
   gp_Vec V ( theAxis.vx, theAxis.vy, theAxis.vz );
 
   gp_Trsf aTrsf;
+  TCollection_AsciiString typeStr, copyStr( theCopy );
   switch ( theMirrorType ) {
   case  SMESH::SMESH_MeshEditor::POINT:
     aTrsf.SetMirror( P );
+    typeStr = "SMESH.SMESH_MeshEditor.POINT";
     break;
   case  SMESH::SMESH_MeshEditor::AXIS:
     aTrsf.SetMirror( gp_Ax1( P, V ));
+    typeStr = "SMESH.SMESH_MeshEditor.AXIS";
     break;
   default:
     aTrsf.SetMirror( gp_Ax2( P, V ));
+    typeStr = "SMESH.SMESH_MeshEditor.PLANE";
   }
 
+  // Update Python script
+  TCollection_AsciiString str ("mesh_editor.Mirror(");
+  SMESH_Gen_i::AddArray( str, theIDsOfElements ) += ", ";
+  addAxis( str, theAxis )           += ", ";
+  str += typeStr                     + ", ";
+  str += copyStr                     + " )";
+  SMESH_Gen_i::AddToCurrentPyScript( str );
+
   ::SMESH_MeshEditor anEditor( _myMesh );
   anEditor.Transform (elements, aTrsf, theCopy);
 }
@@ -727,6 +1184,29 @@ void SMESH_MeshEditor_i::MirrorObject(SMESH::SMESH_IDSource_ptr           theObj
 {
   SMESH::long_array_var anElementsId = theObject->GetIDs();
   Mirror(anElementsId, theAxis, theMirrorType, theCopy);
+
+  // Clear python line, created by Mirror()
+  SMESH_Gen_i* aSMESHGen = SMESH_Gen_i::GetSMESHGen();
+  aSMESHGen->RemoveLastFromPythonScript(aSMESHGen->GetCurrentStudyID());
+
+  // Update Python script
+  TCollection_AsciiString typeStr, copyStr( theCopy );
+  switch ( theMirrorType ) {
+  case  SMESH::SMESH_MeshEditor::POINT:
+    typeStr = "SMESH.SMESH_MeshEditor.POINT";
+    break;
+  case  SMESH::SMESH_MeshEditor::AXIS:
+    typeStr = "SMESH.SMESH_MeshEditor.AXIS";
+    break;
+  default:
+    typeStr = "SMESH.SMESH_MeshEditor.PLANE";
+  }
+
+  TCollection_AsciiString str ("mesh_editor.MirrorObject(");
+  SMESH_Gen_i::AddObject( str, theObject ) += ", ";
+  addAxis( str, theAxis ) += ", ";
+  str += typeStr + ", " + copyStr + " )";
+  SMESH_Gen_i::AddToCurrentPyScript( str );
 }
 
 //=======================================================================
@@ -735,7 +1215,7 @@ void SMESH_MeshEditor_i::MirrorObject(SMESH::SMESH_IDSource_ptr           theObj
 //=======================================================================
 
 void SMESH_MeshEditor_i::Translate(const SMESH::long_array & theIDsOfElements,
-                                   const SMESH::DirStruct &   theVector,
+                                   const SMESH::DirStruct &  theVector,
                                    CORBA::Boolean            theCopy)
 {
   SMESHDS_Mesh* aMesh = GetMeshDS();
@@ -754,6 +1234,17 @@ void SMESH_MeshEditor_i::Translate(const SMESH::long_array & theIDsOfElements,
 
   ::SMESH_MeshEditor anEditor( _myMesh );
   anEditor.Transform (elements, aTrsf, theCopy);
+
+  // Update Python script
+  TCollection_AsciiString str = "vector = SMESH.DirStruct( SMESH.PointStruct ( ";
+  str += (TCollection_AsciiString) P->x + ", ";
+  str += (TCollection_AsciiString) P->y + ", ";
+  str += (TCollection_AsciiString) P->z + " ))";
+  SMESH_Gen_i::AddToCurrentPyScript( str );
+  str = ("mesh_editor.Translate(");
+  SMESH_Gen_i::AddArray( str, theIDsOfElements ) += ", vector, ";
+  str += (TCollection_AsciiString) theCopy + " )";
+  SMESH_Gen_i::AddToCurrentPyScript( str );
 }
 
 //=======================================================================
@@ -767,6 +1258,16 @@ void SMESH_MeshEditor_i::TranslateObject(SMESH::SMESH_IDSource_ptr theObject,
 {
   SMESH::long_array_var anElementsId = theObject->GetIDs();
   Translate(anElementsId, theVector, theCopy);
+
+  // Clear python line, created by Translate()
+  SMESH_Gen_i* aSMESHGen = SMESH_Gen_i::GetSMESHGen();
+  aSMESHGen->RemoveLastFromPythonScript(aSMESHGen->GetCurrentStudyID());
+
+  // Update Python script
+  TCollection_AsciiString str ("mesh_editor.TranslateObject(");
+  SMESH_Gen_i::AddObject( str, theObject ) += ", vector, ";
+  str += TCollection_AsciiString( theCopy ) + " )";
+  SMESH_Gen_i::AddToCurrentPyScript( str );
 }
 
 //=======================================================================
@@ -775,7 +1276,7 @@ void SMESH_MeshEditor_i::TranslateObject(SMESH::SMESH_IDSource_ptr theObject,
 //=======================================================================
 
 void SMESH_MeshEditor_i::Rotate(const SMESH::long_array & theIDsOfElements,
-                                const SMESH::AxisStruct &  theAxis,
+                                const SMESH::AxisStruct & theAxis,
                                 CORBA::Double             theAngle,
                                 CORBA::Boolean            theCopy)
 {
@@ -795,9 +1296,18 @@ void SMESH_MeshEditor_i::Rotate(const SMESH::long_array & theIDsOfElements,
   gp_Trsf aTrsf;
   aTrsf.SetRotation( gp_Ax1( P, V ), theAngle);
   
-
   ::SMESH_MeshEditor anEditor( _myMesh );
   anEditor.Transform (elements, aTrsf, theCopy);
+
+  // Update Python script
+  TCollection_AsciiString str ("axis = ");
+  addAxis( str, theAxis );
+  SMESH_Gen_i::AddToCurrentPyScript( str );
+  str = ("mesh_editor.Rotate(");
+  SMESH_Gen_i::AddArray( str, theIDsOfElements ) += ", axis, ";
+  str += (TCollection_AsciiString) theAngle + ", ";
+  str += (TCollection_AsciiString) theCopy + " )";
+  SMESH_Gen_i::AddToCurrentPyScript( str );
 }
 
 //=======================================================================
@@ -812,6 +1322,17 @@ void SMESH_MeshEditor_i::RotateObject(SMESH::SMESH_IDSource_ptr theObject,
 {
   SMESH::long_array_var anElementsId = theObject->GetIDs();
   Rotate(anElementsId, theAxis, theAngle, theCopy);
+
+  // Clear python line, created by Rotate()
+  SMESH_Gen_i* aSMESHGen = SMESH_Gen_i::GetSMESHGen();
+  aSMESHGen->RemoveLastFromPythonScript(aSMESHGen->GetCurrentStudyID());
+
+  // Update Python script
+  TCollection_AsciiString str ("mesh_editor.RotateObject(");
+  SMESH_Gen_i::AddObject( str, theObject ) += ", axis, ";
+  str += TCollection_AsciiString( theAngle ) + ", ";
+  str += TCollection_AsciiString( theCopy ) + " )";
+  SMESH_Gen_i::AddToCurrentPyScript( str );
 }
 
 //=======================================================================
@@ -850,8 +1371,8 @@ void SMESH_MeshEditor_i::MergeNodes (const SMESH::array_of_long_array& GroupsOfN
 {
   SMESHDS_Mesh* aMesh = GetMeshDS();
 
+  TCollection_AsciiString str( "mesh_editor.MergeNodes([" );
   ::SMESH_MeshEditor::TListOfListOfNodes aListOfListOfNodes;
-  list<const SMDS_MeshElement*> elements;
   for (int i = 0; i < GroupsOfNodes.length(); i++)
   {
     const SMESH::long_array& aNodeGroup = GroupsOfNodes[ i ];
@@ -866,9 +1387,16 @@ void SMESH_MeshEditor_i::MergeNodes (const SMESH::array_of_long_array& GroupsOfN
     }
     if ( aListOfNodes.size() < 2 )
       aListOfListOfNodes.pop_back();
+
+    if ( i > 0 )
+      str += ",";
+    SMESH_Gen_i::AddArray( str, aNodeGroup );
   }
   ::SMESH_MeshEditor anEditor( _myMesh );
   anEditor.MergeNodes( aListOfListOfNodes );
+
+  // Update Python script
+  SMESH_Gen_i::AddToCurrentPyScript( str + "])" );
 }
 
 //=======================================================================
@@ -880,6 +1408,9 @@ void SMESH_MeshEditor_i::MergeEqualElements()
 {
   ::SMESH_MeshEditor anEditor( _myMesh );
   anEditor.MergeEqualElements();
+
+  // Update Python script
+  SMESH_Gen_i::AddToCurrentPyScript( "mesh_editor.MergeEqualElements()" );
 }
 
 //=======================================================================
@@ -917,7 +1448,9 @@ SMESH::SMESH_MeshEditor::Sew_Error
                                      CORBA::Long LastNodeID1,
                                      CORBA::Long FirstNodeID2,
                                      CORBA::Long SecondNodeID2,
-                                     CORBA::Long LastNodeID2)
+                                     CORBA::Long LastNodeID2,
+                                     CORBA::Boolean CreatePolygons,
+                                     CORBA::Boolean CreatePolyedrs)
 {
   SMESHDS_Mesh* aMesh = GetMeshDS();
 
@@ -937,6 +1470,18 @@ SMESH::SMESH_MeshEditor::Sew_Error
       !aSide2ThirdNode)
     return SMESH::SMESH_MeshEditor::SEW_BORDER2_NOT_FOUND;
 
+  // Update Python script
+  TCollection_AsciiString str ("error = mesh_editor.SewFreeBorders( ");
+  str += TCollection_AsciiString( (int) FirstNodeID1  )  + ", ";
+  str += TCollection_AsciiString( (int) SecondNodeID1 )  + ", ";
+  str += TCollection_AsciiString( (int) LastNodeID1   )  + ", ";
+  str += TCollection_AsciiString( (int) FirstNodeID2  )  + ", ";
+  str += TCollection_AsciiString( (int) SecondNodeID2 )  + ", ";
+  str += TCollection_AsciiString( (int) LastNodeID2   )  + ", ";
+  str += TCollection_AsciiString( CreatePolygons      )  + ", ";
+  str += TCollection_AsciiString( CreatePolyedrs      )  + ") ";
+  SMESH_Gen_i::AddToCurrentPyScript( str );
+
   ::SMESH_MeshEditor anEditor( _myMesh );
   return convError( anEditor.SewFreeBorder (aBorderFirstNode,
                                             aBorderSecondNode,
@@ -944,7 +1489,9 @@ SMESH::SMESH_MeshEditor::Sew_Error
                                             aSide2FirstNode,
                                             aSide2SecondNode,
                                             aSide2ThirdNode,
-                                            true));
+                                            true,
+                                            CreatePolygons,
+                                            CreatePolyedrs) );
 }
 
 //=======================================================================
@@ -976,6 +1523,15 @@ SMESH::SMESH_MeshEditor::Sew_Error
       !aSide2SecondNode)
     return SMESH::SMESH_MeshEditor::SEW_BORDER2_NOT_FOUND;
 
+  // Update Python script
+  TCollection_AsciiString str ("error = mesh_editor.SewConformFreeBorders( ");
+  str += TCollection_AsciiString( (int) FirstNodeID1  )  + ", ";
+  str += TCollection_AsciiString( (int) SecondNodeID1 )  + ", ";
+  str += TCollection_AsciiString( (int) LastNodeID1   )  + ", ";
+  str += TCollection_AsciiString( (int) FirstNodeID2  )  + ", ";
+  str += TCollection_AsciiString( (int) SecondNodeID2 )  + ")";
+  SMESH_Gen_i::AddToCurrentPyScript( str );
+
   ::SMESH_MeshEditor anEditor( _myMesh );
   return convError( anEditor.SewFreeBorder (aBorderFirstNode,
                                             aBorderSecondNode,
@@ -983,7 +1539,8 @@ SMESH::SMESH_MeshEditor::Sew_Error
                                             aSide2FirstNode,
                                             aSide2SecondNode,
                                             aSide2ThirdNode,
-                                            true ));
+                                            true,
+                                            false, false) );
 }
 
 //=======================================================================
@@ -996,7 +1553,9 @@ SMESH::SMESH_MeshEditor::Sew_Error
                                       CORBA::Long SecondNodeIDOnFreeBorder,
                                       CORBA::Long LastNodeIDOnFreeBorder,
                                       CORBA::Long FirstNodeIDOnSide,
-                                      CORBA::Long LastNodeIDOnSide)
+                                      CORBA::Long LastNodeIDOnSide,
+                                      CORBA::Boolean CreatePolygons,
+                                      CORBA::Boolean CreatePolyedrs)
 {
   SMESHDS_Mesh* aMesh = GetMeshDS();
 
@@ -1015,6 +1574,17 @@ SMESH::SMESH_MeshEditor::Sew_Error
       !aSide2SecondNode)
     return SMESH::SMESH_MeshEditor::SEW_BAD_SIDE_NODES;
 
+  // Update Python script
+  TCollection_AsciiString str ("error = mesh_editor.SewBorderToSide( ");
+  str += TCollection_AsciiString( (int) FirstNodeIDOnFreeBorder  ) + ", ";
+  str += TCollection_AsciiString( (int) SecondNodeIDOnFreeBorder ) + ", ";
+  str += TCollection_AsciiString( (int) LastNodeIDOnFreeBorder   ) + ", ";
+  str += TCollection_AsciiString( (int) FirstNodeIDOnSide        ) + ", ";
+  str += TCollection_AsciiString( (int) LastNodeIDOnSide         ) + ", ";
+  str += TCollection_AsciiString( CreatePolygons                 ) + ", ";
+  str += TCollection_AsciiString( CreatePolyedrs                 ) + ") ";
+  SMESH_Gen_i::AddToCurrentPyScript( str );
+
   ::SMESH_MeshEditor anEditor( _myMesh );
   return convError( anEditor.SewFreeBorder (aBorderFirstNode,
                                             aBorderSecondNode,
@@ -1022,7 +1592,9 @@ SMESH::SMESH_MeshEditor::Sew_Error
                                             aSide2FirstNode,
                                             aSide2SecondNode,
                                             aSide2ThirdNode,
-                                            false));
+                                            false,
+                                            CreatePolygons,
+                                            CreatePolyedrs) );
 }
 
 //=======================================================================
@@ -1067,6 +1639,16 @@ SMESH::SMESH_MeshEditor::Sew_Error
     if ( elem )
       aSide2Elems.insert( elem );
   }
+  // Update Python script
+  TCollection_AsciiString str ("error = mesh_editor.SewSideElements( ");
+  SMESH_Gen_i::AddArray( str, IDsOfSide1Elements ) += ", ";
+  SMESH_Gen_i::AddArray( str, IDsOfSide2Elements ) += ", ";
+  str += TCollection_AsciiString( (int) NodeID1OfSide1ToMerge ) + ", ";
+  str += TCollection_AsciiString( (int) NodeID1OfSide2ToMerge ) + ", ";
+  str += TCollection_AsciiString( (int) NodeID2OfSide1ToMerge ) + ", ";
+  str += TCollection_AsciiString( (int) NodeID2OfSide2ToMerge ) + ")";
+  SMESH_Gen_i::AddToCurrentPyScript( str );
+
   ::SMESH_MeshEditor anEditor( _myMesh );
   return convError( anEditor.SewSideElements (aSide1Elems, aSide2Elems,
                                               aFirstNode1ToMerge,
index 941c519374b506681a39a6727c279e1e40e2b20e..9aba3bb4fe9871f3bb699759417644a35498977d 100644 (file)
@@ -51,6 +51,11 @@ class SMESH_MeshEditor_i: public POA_SMESH::SMESH_MeshEditor
   CORBA::Boolean AddEdge(const SMESH::long_array & IDsOfNodes);
   CORBA::Boolean AddFace(const SMESH::long_array & IDsOfNodes);
   CORBA::Boolean AddVolume(const SMESH::long_array & IDsOfNodes);
+
+  CORBA::Boolean AddPolyhedralVolume(const SMESH::long_array & IDsOfNodes,
+                                     const SMESH::long_array & Quantities);
+  CORBA::Boolean AddPolyhedralVolumeByFaces(const SMESH::long_array & IdsOfFaces);
+
   CORBA::Boolean MoveNode(CORBA::Long NodeID,
                           CORBA::Double x, CORBA::Double y, CORBA::Double z);
 
@@ -82,7 +87,28 @@ class SMESH_MeshEditor_i: public POA_SMESH::SMESH_MeshEditor
                              CORBA::Long                            MaxNbOfIterations,
                              CORBA::Double                          MaxAspectRatio,
                              SMESH::SMESH_MeshEditor::Smooth_Method Method);
-
+  CORBA::Boolean SmoothParametric(const SMESH::long_array &              IDsOfElements,
+                                  const SMESH::long_array &              IDsOfFixedNodes,
+                                  CORBA::Long                            MaxNbOfIterations,
+                                  CORBA::Double                          MaxAspectRatio,
+                                  SMESH::SMESH_MeshEditor::Smooth_Method Method);
+  CORBA::Boolean SmoothParametricObject(SMESH::SMESH_IDSource_ptr              theObject,
+                                        const SMESH::long_array &              IDsOfFixedNodes,
+                                        CORBA::Long                            MaxNbOfIterations,
+                                        CORBA::Double                          MaxAspectRatio,
+                                        SMESH::SMESH_MeshEditor::Smooth_Method Method);
+  CORBA::Boolean smooth(const SMESH::long_array &              IDsOfElements,
+                        const SMESH::long_array &              IDsOfFixedNodes,
+                        CORBA::Long                            MaxNbOfIterations,
+                        CORBA::Double                          MaxAspectRatio,
+                        SMESH::SMESH_MeshEditor::Smooth_Method Method,
+                        bool                                   IsParametric);
+  CORBA::Boolean smoothObject(SMESH::SMESH_IDSource_ptr              theObject,
+                             const SMESH::long_array &              IDsOfFixedNodes,
+                             CORBA::Long                            MaxNbOfIterations,
+                             CORBA::Double                          MaxAspectRatio,
+                             SMESH::SMESH_MeshEditor::Smooth_Method Method,
+                              bool                                   IsParametric);
 
   void RenumberNodes();
   void RenumberElements();
@@ -165,7 +191,9 @@ class SMESH_MeshEditor_i: public POA_SMESH::SMESH_MeshEditor
                    CORBA::Long LastNodeID1,
                    CORBA::Long FirstNodeID2,
                    CORBA::Long SecondNodeID2,
-                   CORBA::Long LastNodeID2);
+                   CORBA::Long LastNodeID2,
+                   CORBA::Boolean CreatePolygons,
+                   CORBA::Boolean CreatePolyedrs);
   SMESH::SMESH_MeshEditor::Sew_Error
     SewConformFreeBorders(CORBA::Long FirstNodeID1,
                           CORBA::Long SecondNodeID1,
@@ -177,7 +205,9 @@ class SMESH_MeshEditor_i: public POA_SMESH::SMESH_MeshEditor
                     CORBA::Long SecondNodeIDOnFreeBorder,
                     CORBA::Long LastNodeIDOnFreeBorder,
                     CORBA::Long FirstNodeIDOnSide,
-                    CORBA::Long LastNodeIDOnSide);
+                    CORBA::Long LastNodeIDOnSide,
+                    CORBA::Boolean CreatePolygons,
+                    CORBA::Boolean CreatePolyedrs);
   SMESH::SMESH_MeshEditor::Sew_Error
     SewSideElements(const SMESH::long_array& IDsOfSide1Elements,
                     const SMESH::long_array& IDsOfSide2Elements,
index 0fa06e0406a730b5d69f0abafefbbff655b074ea..d41a1f4f29c140e17df9be51790db37a26d55f68 100644 (file)
@@ -76,7 +76,7 @@ SMESH_Mesh_i::SMESH_Mesh_i( PortableServer::POA_ptr thePOA,
                            CORBA::Long studyId )
 : SALOME::GenericObj_i( thePOA )
 {
-  INFOS("SMESH_Mesh_i; this = "<<this);
+  INFOS("SMESH_Mesh_i");
   _impl = NULL;
   _gen_i = gen_i;
   _id = myIdGenerator++;
@@ -92,7 +92,7 @@ SMESH_Mesh_i::SMESH_Mesh_i( PortableServer::POA_ptr thePOA,
 
 SMESH_Mesh_i::~SMESH_Mesh_i()
 {
-  INFOS("~SMESH_Mesh_i; this = "<<this);
+  INFOS("~SMESH_Mesh_i");
   map<int, SMESH::SMESH_GroupBase_ptr>::iterator it;
   for ( it = _mapGroups.begin(); it != _mapGroups.end(); it++ ) {
     SMESH_GroupBase_i* aGroup = dynamic_cast<SMESH_GroupBase_i*>( SMESH_Gen_i::GetServant( it->second ).in() );
@@ -337,6 +337,14 @@ SMESH::Hypothesis_Status SMESH_Mesh_i::AddHypothesis(GEOM::GEOM_Object_ptr aSubS
 
   if(MYDEBUG) MESSAGE( " AddHypothesis(): status = " << status );
 
+  // Update Python script
+  TCollection_AsciiString aStr ("status = ");
+  SMESH_Gen_i::AddObject(aStr, _this()) += ".AddHypothesis(";
+  SMESH_Gen_i::AddObject(aStr, aSubShapeObject) += ", ";
+  SMESH_Gen_i::AddObject(aStr, anHyp) += ")";
+
+  SMESH_Gen_i::AddToCurrentPyScript(aStr);
+
   return ConvertHypothesisStatus(status);
 }
 
@@ -401,6 +409,14 @@ SMESH::Hypothesis_Status SMESH_Mesh_i::RemoveHypothesis(GEOM::GEOM_Object_ptr aS
     _gen_i->RemoveHypothesisFromShape(_gen_i->GetCurrentStudy(), _this(),
                                       aSubShapeObject, anHyp );
 
+  // Update Python script
+  TCollection_AsciiString aStr ("status = ");
+  SMESH_Gen_i::AddObject(aStr, _this()) += ".RemoveHypothesis(";
+  SMESH_Gen_i::AddObject(aStr, aSubShapeObject) += ", ";
+  SMESH_Gen_i::AddObject(aStr, anHyp) += ")";
+
+  SMESH_Gen_i::AddToCurrentPyScript(aStr);
+
   return ConvertHypothesisStatus(status);
 }
 
@@ -509,9 +525,22 @@ SMESH::SMESH_subMesh_ptr SMESH_Mesh_i::GetSubMesh(GEOM::GEOM_Object_ptr aSubShap
     if ( subMesh->_is_nil() )
       subMesh = createSubMesh( aSubShapeObject );
 
-    if ( _gen_i->CanPublishInStudy( subMesh ))
-      _gen_i->PublishSubMesh (_gen_i->GetCurrentStudy(), aMesh,
-                              subMesh, aSubShapeObject, theName );
+    if ( _gen_i->CanPublishInStudy( subMesh )) {
+      SALOMEDS::SObject_var aSO =
+        _gen_i->PublishSubMesh(_gen_i->GetCurrentStudy(), aMesh,
+                               subMesh, aSubShapeObject, theName );
+      if ( !aSO->_is_nil()) {
+        // Update Python script
+        TCollection_AsciiString aStr (aSO->GetID());
+        aStr += " = ";
+        SMESH_Gen_i::AddObject(aStr, _this()) += ".GetSubMesh(";
+        SMESH_Gen_i::AddObject(aStr, aSubShapeObject) += ", \"";
+        aStr += (char*)theName;
+        aStr += "\")";
+
+        SMESH_Gen_i::AddToCurrentPyScript(aStr);
+      }
+    }
   }
   catch(SALOME_Exception & S_ex) {
     THROW_SALOME_CORBA_EXCEPTION(S_ex.what(), SALOME::BAD_PARAM);
@@ -544,12 +573,49 @@ void SMESH_Mesh_i::RemoveSubMesh( SMESH::SMESH_subMesh_ptr theSubMesh )
        aSubShapeObject = GEOM::GEOM_Object::_narrow( aRef->GetObject() );
 
       aStudy->NewBuilder()->RemoveObjectWithChildren( anSO );
+
+      // Update Python script
+      TCollection_AsciiString aStr;
+      SMESH_Gen_i::AddObject(aStr, _this()) += ".RemoveSubMesh(";
+      aStr += anSO->GetID();
+      aStr += ")";
+
+      SMESH_Gen_i::AddToCurrentPyScript(aStr);
     }
   }
 
   removeSubMesh( theSubMesh, aSubShapeObject.in() );
 }
 
+//=============================================================================
+/*!
+ *  ElementTypeString
+ */
+//=============================================================================
+inline TCollection_AsciiString ElementTypeString (SMESH::ElementType theElemType)
+{
+  TCollection_AsciiString aStr;
+  switch (theElemType) {
+  case SMESH::ALL:
+    aStr = "SMESH.ALL";
+    break;
+  case SMESH::NODE:
+    aStr = "SMESH.NODE";
+    break;
+  case SMESH::EDGE:
+    aStr = "SMESH.EDGE";
+    break;
+  case SMESH::FACE:
+    aStr = "SMESH.FACE";
+    break;
+  case SMESH::VOLUME:
+    aStr = "SMESH.VOLUME";
+    break;
+  default:
+    break;
+  }
+  return aStr;
+}
 
 //=============================================================================
 /*!
@@ -565,8 +631,20 @@ SMESH::SMESH_Group_ptr SMESH_Mesh_i::CreateGroup( SMESH::ElementType theElemType
   SMESH::SMESH_Group_var aNewGroup =
     SMESH::SMESH_Group::_narrow( createGroup( theElemType, theName ));
 
-  _gen_i->PublishGroup( _gen_i->GetCurrentStudy(), _this(),
-                       aNewGroup, GEOM::GEOM_Object::_nil(), theName);
+  if ( _gen_i->CanPublishInStudy( aNewGroup ) ) {
+    SALOMEDS::SObject_var aSO =
+      _gen_i->PublishGroup(_gen_i->GetCurrentStudy(), _this(),
+                           aNewGroup, GEOM::GEOM_Object::_nil(), theName);
+    if ( !aSO->_is_nil()) {
+      // Update Python script
+      TCollection_AsciiString aStr (aSO->GetID());
+      aStr += " = ";
+      SMESH_Gen_i::AddObject(aStr, _this()) += ".CreateGroup(";
+      aStr += ElementTypeString(theElemType) + ", \"" + (char*)theName + "\")";
+
+      SMESH_Gen_i::AddToCurrentPyScript(aStr);
+    }
+  }
 
   return aNewGroup._retn();
 }
@@ -577,9 +655,9 @@ SMESH::SMESH_Group_ptr SMESH_Mesh_i::CreateGroup( SMESH::ElementType theElemType
  *  
  */
 //=============================================================================
-SMESH::SMESH_GroupOnGeom_ptr SMESH_Mesh_i::CreateGroupFromGEOMSMESH::ElementType    theElemType,
-                                                               const char*           theName,
-                                                               GEOM::GEOM_Object_ptr theGeomObj)
+SMESH::SMESH_GroupOnGeom_ptr SMESH_Mesh_i::CreateGroupFromGEOM (SMESH::ElementType    theElemType,
+                                                                const char*           theName,
+                                                                GEOM::GEOM_Object_ptr theGeomObj)
      throw(SALOME::SALOME_Exception)
 {
   Unexpect aCatch(SALOME_SalomeException);
@@ -589,13 +667,26 @@ SMESH::SMESH_GroupOnGeom_ptr SMESH_Mesh_i::CreateGroupFromGEOM( SMESH::ElementTy
   if ( !aShape.IsNull() ) {
     aNewGroup = SMESH::SMESH_GroupOnGeom::_narrow
       ( createGroup( theElemType, theName, aShape ));
-    if ( _gen_i->CanPublishInStudy( aNewGroup ) )
-      _gen_i->PublishGroup( _gen_i->GetCurrentStudy(), _this(), 
-                           aNewGroup, theGeomObj, theName );
+    if ( _gen_i->CanPublishInStudy( aNewGroup ) ) {
+      SALOMEDS::SObject_var aSO =
+        _gen_i->PublishGroup(_gen_i->GetCurrentStudy(), _this(), 
+                             aNewGroup, theGeomObj, theName);
+      if ( !aSO->_is_nil()) {
+        // Update Python script
+        TCollection_AsciiString aStr (aSO->GetID());
+        aStr += " = ";
+        SMESH_Gen_i::AddObject(aStr, _this()) += ".CreateGroupFromGEOM(";
+        aStr += ElementTypeString(theElemType) + ", \"" + (char*)theName + "\", ";
+        SMESH_Gen_i::AddObject(aStr, theGeomObj) += ")";
+
+        SMESH_Gen_i::AddToCurrentPyScript(aStr);
+      }
+    }
   }
 
   return aNewGroup._retn();
 }
+
 //=============================================================================
 /*!
  *  
@@ -615,10 +706,20 @@ void SMESH_Mesh_i::RemoveGroup( SMESH::SMESH_GroupBase_ptr theGroup )
 
   SALOMEDS::Study_ptr aStudy = _gen_i->GetCurrentStudy();
   if ( !aStudy->_is_nil() )  {
-    // Remove group's SObject
     SALOMEDS::SObject_var aGroupSO = _gen_i->ObjectToSObject( aStudy, theGroup );
-    if ( !aGroupSO->_is_nil() )
+
+    if ( !aGroupSO->_is_nil() ) {
+      // Update Python script
+      TCollection_AsciiString aStr;
+      SMESH_Gen_i::AddObject(aStr, _this()) += ".RemoveGroup(";
+      aStr += aGroupSO->GetID();
+      aStr += ")";
+
+      SMESH_Gen_i::AddToCurrentPyScript(aStr);
+
+      // Remove group's SObject
       aStudy->NewBuilder()->RemoveObject( aGroupSO );
+    }
   }
 
   // Remove the group from SMESH data structures
@@ -643,13 +744,26 @@ void SMESH_Mesh_i::RemoveGroupWithContents( SMESH::SMESH_GroupBase_ptr theGroup
   
   SMESH::long_array_var anIds = aGroup->GetListOfID();
   SMESH::SMESH_MeshEditor_var aMeshEditor = SMESH_Mesh_i::GetMeshEditor();
-    
+
+  // Update Python script
+  TCollection_AsciiString aStr;
+  SMESH_Gen_i::AddObject(aStr, _this()) += ".RemoveGroupWithContents(";
+  SMESH_Gen_i::AddObject(aStr, theGroup) += ")";
+
+  SMESH_Gen_i::AddToCurrentPyScript(aStr);
+
+  // Remove contents
   if ( aGroup->GetType() == SMESH::NODE )
     aMeshEditor->RemoveNodes( anIds );
   else
     aMeshEditor->RemoveElements( anIds );
-  
+
+  // Remove group
   RemoveGroup( theGroup );
+
+  // Clear python lines, created by RemoveNodes/Elements() and RemoveGroup()
+  _gen_i->RemoveLastFromPythonScript(_gen_i->GetCurrentStudy()->StudyId());
+  _gen_i->RemoveLastFromPythonScript(_gen_i->GetCurrentStudy()->StudyId());
 }
 
 //=============================================================================
@@ -665,13 +779,12 @@ SMESH::SMESH_Group_ptr SMESH_Mesh_i::UnionGroups( SMESH::SMESH_GroupBase_ptr the
 {
   try
   {
-    SMESH::SMESH_Group_var aResGrp;
-
     if ( theGroup1->_is_nil() || theGroup2->_is_nil() ||
          theGroup1->GetType() != theGroup2->GetType() )
       return SMESH::SMESH_Group::_nil();
 
-    aResGrp = CreateGroup( theGroup1->GetType(), theName );
+    // Create Union
+    SMESH::SMESH_Group_var aResGrp = CreateGroup( theGroup1->GetType(), theName );
     if ( aResGrp->_is_nil() )
       return SMESH::SMESH_Group::_nil();
 
@@ -696,6 +809,21 @@ SMESH::SMESH_Group_ptr SMESH_Mesh_i::UnionGroups( SMESH::SMESH_GroupBase_ptr the
 
     aResGrp->Add( aResIds );
 
+    // Clear python lines, created by CreateGroup() and Add()
+    SALOMEDS::Study_ptr aStudy = _gen_i->GetCurrentStudy();
+    _gen_i->RemoveLastFromPythonScript(aStudy->StudyId());
+    _gen_i->RemoveLastFromPythonScript(aStudy->StudyId());
+
+    // Update Python script
+    TCollection_AsciiString aStr;
+    SMESH_Gen_i::AddObject(aStr, aResGrp) += " = ";
+    SMESH_Gen_i::AddObject(aStr, _this()) += ".UnionGroups(";
+    SMESH_Gen_i::AddObject(aStr, theGroup1) += ", ";
+    SMESH_Gen_i::AddObject(aStr, theGroup2) += ", \"";
+    aStr += TCollection_AsciiString((char*)theName) + "\")";
+
+    SMESH_Gen_i::AddToCurrentPyScript(aStr);
+
     return aResGrp._retn();
   }
   catch( ... )
@@ -715,21 +843,20 @@ SMESH::SMESH_Group_ptr SMESH_Mesh_i::IntersectGroups( SMESH::SMESH_GroupBase_ptr
                                                       const char* theName )
   throw (SALOME::SALOME_Exception)
 {
-  SMESH::SMESH_Group_var aResGrp;
-  
   if ( theGroup1->_is_nil() || theGroup2->_is_nil() || 
        theGroup1->GetType() != theGroup2->GetType() )
-    return aResGrp;
-  
-  aResGrp = CreateGroup( theGroup1->GetType(), theName );
+    return SMESH::SMESH_Group::_nil();
+
+  // Create Intersection
+  SMESH::SMESH_Group_var aResGrp = CreateGroup( theGroup1->GetType(), theName );
   if ( aResGrp->_is_nil() )
     return aResGrp;
-  
+
   SMESH::long_array_var anIds1 = theGroup1->GetListOfID();
   SMESH::long_array_var anIds2 = theGroup2->GetListOfID();
-  
+
   TColStd_MapOfInteger aMap1;
-  
+
   for ( int i1 = 0, n1 = anIds1->length(); i1 < n1; i1++ )
     aMap1.Add( anIds1[ i1 ] );
 
@@ -738,15 +865,30 @@ SMESH::SMESH_Group_ptr SMESH_Mesh_i::IntersectGroups( SMESH::SMESH_GroupBase_ptr
   for ( int i2 = 0, n2 = anIds2->length(); i2 < n2; i2++ )
     if ( aMap1.Contains( anIds2[ i2 ] ) )
       aSeq.Append( anIds2[ i2 ] );
-  
+
   SMESH::long_array_var aResIds = new SMESH::long_array;
   aResIds->length( aSeq.Length() );
-  
+
   for ( int resI = 0, resN = aSeq.Length(); resI < resN; resI++ )
     aResIds[ resI ] = aSeq( resI + 1 );
-  
+
   aResGrp->Add( aResIds );
-  
+
+  // Clear python lines, created by CreateGroup() and Add()
+  SALOMEDS::Study_ptr aStudy = _gen_i->GetCurrentStudy();
+  _gen_i->RemoveLastFromPythonScript(aStudy->StudyId());
+  _gen_i->RemoveLastFromPythonScript(aStudy->StudyId());
+
+  // Update Python script
+  TCollection_AsciiString aStr;
+  SMESH_Gen_i::AddObject(aStr, aResGrp) += " = ";
+  SMESH_Gen_i::AddObject(aStr, _this()) += ".IntersectGroups(";
+  SMESH_Gen_i::AddObject(aStr, theGroup1) += ", ";
+  SMESH_Gen_i::AddObject(aStr, theGroup2) += ", \"";
+  aStr += TCollection_AsciiString((char*)theName) + "\")";
+
+  SMESH_Gen_i::AddToCurrentPyScript(aStr);
+
   return aResGrp._retn();
 }
 
@@ -761,21 +903,20 @@ SMESH::SMESH_Group_ptr SMESH_Mesh_i::CutGroups( SMESH::SMESH_GroupBase_ptr theGr
                                                 const char* theName )
   throw (SALOME::SALOME_Exception)
 {
-  SMESH::SMESH_Group_var aResGrp;
-  
   if ( theGroup1->_is_nil() || theGroup2->_is_nil() || 
        theGroup1->GetType() != theGroup2->GetType() )
-    return aResGrp;
-  
-  aResGrp = CreateGroup( theGroup1->GetType(), theName );
+    return SMESH::SMESH_Group::_nil();
+
+  // Perform Cutting
+  SMESH::SMESH_Group_var aResGrp = CreateGroup( theGroup1->GetType(), theName );
   if ( aResGrp->_is_nil() )
     return aResGrp;
-  
+
   SMESH::long_array_var anIds1 = theGroup1->GetListOfID();
   SMESH::long_array_var anIds2 = theGroup2->GetListOfID();
-  
+
   TColStd_MapOfInteger aMap2;
-  
+
   for ( int i2 = 0, n2 = anIds2->length(); i2 < n2; i2++ )
     aMap2.Add( anIds2[ i2 ] );
 
@@ -790,9 +931,24 @@ SMESH::SMESH_Group_ptr SMESH_Mesh_i::CutGroups( SMESH::SMESH_GroupBase_ptr theGr
 
   for ( int resI = 0, resN = aSeq.Length(); resI < resN; resI++ )
     aResIds[ resI ] = aSeq( resI + 1 );  
-  
+
   aResGrp->Add( aResIds );
-  
+
+  // Clear python lines, created by CreateGroup() and Add()
+  SALOMEDS::Study_ptr aStudy = _gen_i->GetCurrentStudy();
+  _gen_i->RemoveLastFromPythonScript(aStudy->StudyId());
+  _gen_i->RemoveLastFromPythonScript(aStudy->StudyId());
+
+  // Update Python script
+  TCollection_AsciiString aStr;
+  SMESH_Gen_i::AddObject(aStr, aResGrp) += " = ";
+  SMESH_Gen_i::AddObject(aStr, _this()) += ".CutGroups(";
+  SMESH_Gen_i::AddObject(aStr, theGroup1) += ", ";
+  SMESH_Gen_i::AddObject(aStr, theGroup2) += ", \"";
+  aStr += TCollection_AsciiString((char*)theName) + "\")";
+
+  SMESH_Gen_i::AddToCurrentPyScript(aStr);
+
   return aResGrp._retn();
 }
 
@@ -1051,24 +1207,51 @@ void SMESH_Mesh_i::SetImpl(::SMESH_Mesh * impl)
 
 SMESH::SMESH_MeshEditor_ptr SMESH_Mesh_i::GetMeshEditor()
 {
-       SMESH_MeshEditor_i *aMeshEditor = new SMESH_MeshEditor_i( _impl );
-       SMESH::SMESH_MeshEditor_var aMesh = aMeshEditor->_this();
-       return aMesh._retn();
+  // Update Python script
+  TCollection_AsciiString aStr ("mesh_editor = ");
+  SMESH_Gen_i::AddObject(aStr, _this()) += ".GetMeshEditor()";
+
+  SMESH_Gen_i::AddToCurrentPyScript(aStr);
+
+  // Create MeshEditor
+  SMESH_MeshEditor_i *aMeshEditor = new SMESH_MeshEditor_i( _impl );
+  SMESH::SMESH_MeshEditor_var aMesh = aMeshEditor->_this();
+  return aMesh._retn();
 }
 
 //=============================================================================
 /*!
- *  
+ *  Export in different formats
  */
 //=============================================================================
 
-void SMESH_Mesh_i::ExportToMEDconst char* file, 
+void SMESH_Mesh_i::ExportToMED (const char* file, 
                                CORBA::Boolean auto_groups, 
-                               SMESH::MED_VERSION theVersion )
+                               SMESH::MED_VERSION theVersion)
   throw(SALOME::SALOME_Exception)
 {
   Unexpect aCatch(SALOME_SalomeException);
-  
+
+  // Update Python script
+  TCollection_AsciiString aStr;
+  SMESH_Gen_i::AddObject(aStr, _this()) += ".ExportToMED(\"";
+  aStr += TCollection_AsciiString((char*)file) + "\", ";
+  aStr += TCollection_AsciiString((int)auto_groups) + ", ";
+  switch (theVersion) {
+  case SMESH::MED_V2_1:
+    aStr += "SMESH.MED_V2_1)";
+    break;
+  case SMESH::MED_V2_2:
+    aStr += "SMESH.MED_V2_2)";
+    break;
+  default:
+    aStr += TCollection_AsciiString(theVersion) + ")";
+    break;
+  }
+
+  SMESH_Gen_i::AddToCurrentPyScript(aStr);
+
+  // Perform Export
   char* aMeshName = "Mesh";
   SALOMEDS::Study_ptr aStudy = _gen_i->GetCurrentStudy();
   if ( !aStudy->_is_nil() ) {
@@ -1100,27 +1283,59 @@ void SMESH_Mesh_i::ExportToMED( const char* file,
   _impl->ExportMED( file, aMeshName, auto_groups, theVersion );
 }
 
-void SMESH_Mesh_i::ExportMEDconst char* file, 
+void SMESH_Mesh_i::ExportMED (const char* file, 
                              CORBA::Boolean auto_groups)
   throw(SALOME::SALOME_Exception)
 {
   ExportToMED(file,auto_groups,SMESH::MED_V2_1);
 }
 
-void SMESH_Mesh_i::ExportDAT(const char *file) throw(SALOME::SALOME_Exception)
+void SMESH_Mesh_i::ExportDAT (const char *file)
+  throw(SALOME::SALOME_Exception)
 {
   Unexpect aCatch(SALOME_SalomeException);
+
+  // Update Python script
+  TCollection_AsciiString aStr;
+  SMESH_Gen_i::AddObject(aStr, _this()) += ".ExportDAT(\"";
+  aStr += TCollection_AsciiString((char*)file) + "\")";
+
+  SMESH_Gen_i::AddToCurrentPyScript(aStr);
+
+  // Perform Export
   _impl->ExportDAT(file);
 }
-void SMESH_Mesh_i::ExportUNV(const char *file) throw(SALOME::SALOME_Exception)
+
+void SMESH_Mesh_i::ExportUNV (const char *file)
+  throw(SALOME::SALOME_Exception)
 {
   Unexpect aCatch(SALOME_SalomeException);
+
+  // Update Python script
+  TCollection_AsciiString aStr;
+  SMESH_Gen_i::AddObject(aStr, _this()) += ".ExportUNV(\"";
+  aStr += TCollection_AsciiString((char*)file) + "\")";
+
+  SMESH_Gen_i::AddToCurrentPyScript(aStr);
+
+  // Perform Export
   _impl->ExportUNV(file);
 }
 
-void SMESH_Mesh_i::ExportSTL(const char *file, const bool isascii) throw(SALOME::SALOME_Exception)
+void SMESH_Mesh_i::ExportSTL (const char *file, const bool isascii)
+  throw(SALOME::SALOME_Exception)
 {
   Unexpect aCatch(SALOME_SalomeException);
+
+  // Update Python script
+  TCollection_AsciiString aStr;
+  SMESH_Gen_i::AddObject(aStr, _this()) += ".ExportToMED(\"";
+  aStr += TCollection_AsciiString((char*)file) + "\", ";
+  aStr += TCollection_AsciiString((int)isascii) + ")";
+
+  SMESH_Gen_i::AddToCurrentPyScript(aStr);
+
+  // Perform Export
   _impl->ExportSTL(file, isascii);
 }
 
@@ -1194,6 +1409,12 @@ CORBA::Long SMESH_Mesh_i::NbQuadrangles()throw(SALOME::SALOME_Exception)
   return _impl->NbQuadrangles();
 }
 
+CORBA::Long SMESH_Mesh_i::NbPolygons()throw(SALOME::SALOME_Exception)
+{
+  Unexpect aCatch(SALOME_SalomeException);
+  return _impl->NbPolygons();
+}
+
 //=============================================================================
 /*!
  *  
@@ -1229,6 +1450,12 @@ CORBA::Long SMESH_Mesh_i::NbPrisms()throw(SALOME::SALOME_Exception)
   return _impl->NbPrisms();
 }
 
+CORBA::Long SMESH_Mesh_i::NbPolyhedrons()throw(SALOME::SALOME_Exception)
+{
+  Unexpect aCatch(SALOME_SalomeException);
+  return _impl->NbPolyhedrons();
+}
+
 //=============================================================================
 /*!
  *  
index 3035c1ad3df6539d1ed84c1af6e3e03a886f6e11..dc3d06c57725b8447884880b1889cd9b45ecfe4b 100644 (file)
@@ -164,16 +164,16 @@ public:
 
   SALOME_MED::MESH_ptr GetMEDMesh()
     throw (SALOME::SALOME_Exception);
-  
+
   CORBA::Long NbNodes()
     throw (SALOME::SALOME_Exception);
-  
+
   CORBA::Long NbElements()
     throw (SALOME::SALOME_Exception);
-  
+
   CORBA::Long NbEdges()
     throw (SALOME::SALOME_Exception);
-  
+
   CORBA::Long NbFaces()
     throw (SALOME::SALOME_Exception);
 
@@ -182,7 +182,10 @@ public:
 
   CORBA::Long NbQuadrangles()
     throw (SALOME::SALOME_Exception);
-  
+
+  CORBA::Long NbPolygons()
+    throw (SALOME::SALOME_Exception);
+
   CORBA::Long NbVolumes()
     throw (SALOME::SALOME_Exception);
 
@@ -191,13 +194,16 @@ public:
 
   CORBA::Long NbHexas()
     throw (SALOME::SALOME_Exception);
-  
+
   CORBA::Long NbPyramids()
     throw (SALOME::SALOME_Exception);
-  
+
   CORBA::Long NbPrisms()
     throw (SALOME::SALOME_Exception);
-  
+
+  CORBA::Long NbPolyhedrons()
+    throw (SALOME::SALOME_Exception);
+
   CORBA::Long NbSubMesh()
     throw (SALOME::SALOME_Exception);
 
index d0b8bd2161188c900139d0b9ce6a5fee5d7a2963..e8da5c8d1bd7ff6747cca32106d08def0deaaae4 100644 (file)
 #include <sstream>
 #include <set>
 
-// =============================================================================
+//=======================================================================
+//function : dumpErrorCode
+//purpose  : 
+//=======================================================================
+
+static void addErrorCode(const char* thePyCommand)
+{
+  SMESH_Gen_i::AddToCurrentPyScript("if (isDone != 1):");
+  TCollection_AsciiString str ("\tprint \"");
+  str += (char*) thePyCommand;
+  str += ":\", pattern.GetErrorCode()";
+  SMESH_Gen_i::AddToCurrentPyScript( str );
+}
+
 //=============================================================================
 /*!
-// =============================================================================
  *  SMESH_Gen_i::GetPattern
  *
  *  Create pattern mapper
@@ -54,6 +66,9 @@
 
 SMESH::SMESH_Pattern_ptr SMESH_Gen_i::GetPattern()
 {
+  // Update Python script
+  SMESH_Gen_i::AddToCurrentPyScript( "pattern = smesh.GetPattern()" );
+
   SMESH_Pattern_i* i = new SMESH_Pattern_i( this );
   SMESH::SMESH_Pattern_var anObj = i->_this();
   return anObj._retn();
@@ -91,6 +106,12 @@ SMESH_Pattern_i::SMESH_Pattern_i( SMESH_Gen_i* theGen_i ):
 
 CORBA::Boolean SMESH_Pattern_i::LoadFromFile(const char* theFileContents)
 {
+  // Update Python script
+  TCollection_AsciiString str( "isDone = pattern.LoadFromFile(" );
+  str += TCollection_AsciiString( (char*) theFileContents ) + ")";
+  SMESH_Gen_i::AddToCurrentPyScript( str );
+  addErrorCode( "LoadFromFile" );
+
   return myPattern.Load( theFileContents );
 }
 
@@ -114,6 +135,14 @@ CORBA::Boolean SMESH_Pattern_i::LoadFromFace(SMESH::SMESH_Mesh_ptr theMesh,
   if ( aFace.IsNull() )
     return false;
 
+  // Update Python script
+  TCollection_AsciiString str( "isDone = pattern.LoadFromFace( " );
+  SMESH_Gen_i::AddObject( str, theMesh ) += ", ";
+  SMESH_Gen_i::AddObject( str, theFace ) += ", ";
+  str += TCollection_AsciiString( theProject ) + " )";
+  SMESH_Gen_i::AddToCurrentPyScript( str );
+  addErrorCode( "LoadFromFace" );
+
   return myPattern.Load( aMesh, aFace, theProject );
 }
 
@@ -140,6 +169,13 @@ CORBA::Boolean SMESH_Pattern_i::LoadFrom3DBlock(SMESH::SMESH_Mesh_ptr theMesh,
   if ( !exp.More() )
     return false;
 
+  // Update Python script
+  TCollection_AsciiString str( "isDone = pattern.LoadFrom3DBlock( " );
+  SMESH_Gen_i::AddObject( str, theMesh ) += ", ";
+  SMESH_Gen_i::AddObject( str, theBlock ) += " )";
+  SMESH_Gen_i::AddToCurrentPyScript( str );
+  addErrorCode( "LoadFrom3DBlock" );
+
   return myPattern.Load( aMesh, TopoDS::Shell( exp.Current() ));
 }
 
@@ -172,6 +208,13 @@ SMESH::point_array* SMESH_Pattern_i::ApplyToFace(GEOM::GEOM_Object_ptr theFace,
     }
   }
 
+  // Update Python script
+  TCollection_AsciiString str( "pattern.ApplyToFace( " );
+  SMESH_Gen_i::AddObject( str, theFace ) += ", ";
+  SMESH_Gen_i::AddObject( str, theVertexOnKeyPoint1 ) += ", ";
+  str += TCollection_AsciiString( theReverse ) + " )";
+  SMESH_Gen_i::AddToCurrentPyScript( str );
+
   return points._retn();
 }
 
@@ -208,6 +251,13 @@ SMESH::point_array* SMESH_Pattern_i::ApplyTo3DBlock(GEOM::GEOM_Object_ptr theBlo
     }
   }
 
+  // Update Python script
+  TCollection_AsciiString str( "pattern.ApplyTo3DBlock( " );
+  SMESH_Gen_i::AddObject( str, theBlock ) += ", ";
+  SMESH_Gen_i::AddObject( str, theVertex000 ) += ", ";
+  SMESH_Gen_i::AddObject( str, theVertex001 ) += " )";
+  SMESH_Gen_i::AddToCurrentPyScript( str );
+
   return points._retn();
 }
 
@@ -248,6 +298,14 @@ SMESH::point_array*
     }
   }
 
+  // Update Python script
+  TCollection_AsciiString str( "pattern.ApplyToMeshFaces( " );
+  SMESH_Gen_i::AddObject( str, theMesh ) += ", ";
+  SMESH_Gen_i::AddArray( str, theFacesIDs ) += ", ";
+  str += TCollection_AsciiString( (int)theNodeIndexOnKeyPoint1 ) + ", ";
+  str += TCollection_AsciiString( theReverse ) + " )";
+  SMESH_Gen_i::AddToCurrentPyScript( str );
+
   return points._retn();
 }
 
@@ -288,6 +346,14 @@ SMESH::point_array*
     }
   }
 
+  // Update Python script
+  TCollection_AsciiString str( "pattern.ApplyToHexahedrons( " );
+  SMESH_Gen_i::AddObject( str, theMesh ) += ", ";
+  SMESH_Gen_i::AddArray( str, theVolumesIDs ) += ", ";
+  str += TCollection_AsciiString( (int)theNode000Index ) + ", ";
+  str += TCollection_AsciiString( (int)theNode001Index ) + " )";
+  SMESH_Gen_i::AddToCurrentPyScript( str );
+
   return points._retn();
 }
 
@@ -296,13 +362,23 @@ SMESH::point_array*
 //purpose  : 
 //=======================================================================
 
-CORBA::Boolean SMESH_Pattern_i::MakeMesh(SMESH::SMESH_Mesh_ptr theMesh)
+CORBA::Boolean SMESH_Pattern_i::MakeMesh (SMESH::SMESH_Mesh_ptr theMesh,
+                                          const CORBA::Boolean  CreatePolygons,
+                                          const CORBA::Boolean  CreatePolyedrs)
 {
   ::SMESH_Mesh* aMesh = getMesh( theMesh );
   if ( !aMesh )
     return false;
 
-  return myPattern.MakeMesh( aMesh );
+  // Update Python script
+  TCollection_AsciiString str( "isDone = pattern.MakeMesh( " );
+  SMESH_Gen_i::AddObject( str, theMesh ) += ", ";
+  str += TCollection_AsciiString( CreatePolygons ) + ", ";
+  str += TCollection_AsciiString( CreatePolyedrs ) + " )";
+  SMESH_Gen_i::AddToCurrentPyScript( str );
+  addErrorCode( "MakeMesh" );
+
+  return myPattern.MakeMesh( aMesh, CreatePolygons, CreatePolyedrs );
 }
 
 //=======================================================================
index d0a9656bd288b4de626bdee1a261c0b49b7e0cfd..29b5084cdf5c8b3818760f6ebad442285c5d1fe4 100644 (file)
@@ -75,7 +75,9 @@ class SMESH_Pattern_i:
                                          CORBA::Long              theNode000Index,
                                          CORBA::Long              theNode001Index);
 
-  CORBA::Boolean MakeMesh(SMESH::SMESH_Mesh_ptr theMesh);
+  CORBA::Boolean MakeMesh (SMESH::SMESH_Mesh_ptr theMesh,
+                           const CORBA::Boolean  CreatePolygons,
+                           const CORBA::Boolean  CreatePolyedrs);
 
   SMESH::SMESH_Pattern::ErrorCode GetErrorCode();
 
diff --git a/src/SMESH_I/SMESH_PythonDump.hxx b/src/SMESH_I/SMESH_PythonDump.hxx
new file mode 100644 (file)
index 0000000..86133cf
--- /dev/null
@@ -0,0 +1,85 @@
+//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
+// 
+//  This library is free software; you can redistribute it and/or 
+//  modify it under the terms of the GNU Lesser General Public 
+//  License as published by the Free Software Foundation; either 
+//  version 2.1 of the License. 
+// 
+//  This library is distributed in the hope that it will be useful, 
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of 
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
+//  Lesser General Public License for more details. 
+// 
+//  You should have received a copy of the GNU Lesser General Public 
+//  License along with this library; if not, write to the Free Software 
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
+// 
+//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+
+#ifndef _SMESH_PYTHONDUMP_HXX_
+#define _SMESH_PYTHONDUMP_HXX_
+
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(SMESH_Mesh)
+
+#include <sstream>
+
+namespace SMESH
+{
+  class FilterLibrary_i;
+  class FilterManager_i;
+  class Filter_i;
+  class Functor_i;
+
+  class TPythonDump
+  {
+    std::ostringstream myStream;
+    static size_t myCounter;
+  public:
+    TPythonDump();
+    virtual ~TPythonDump();
+    
+    TPythonDump& 
+    operator<<(long int theArg);
+
+    TPythonDump& 
+    operator<<(int theArg);
+
+    TPythonDump& 
+    operator<<(double theArg);
+
+    TPythonDump& 
+    operator<<(float theArg);
+
+    TPythonDump& 
+    operator<<(const void* theArg);
+
+    TPythonDump& 
+    operator<<(const char* theArg);
+
+    TPythonDump& 
+    operator<<(const SMESH::ElementType& theArg);
+
+    TPythonDump& 
+    operator<<(const SMESH::long_array& theArg);
+
+    TPythonDump& 
+    operator<<(CORBA::Object_ptr theArg);
+
+    TPythonDump& 
+    operator<<(SMESH::FilterLibrary_i* theArg);
+
+    TPythonDump& 
+    operator<<(SMESH::FilterManager_i* theArg);
+
+    TPythonDump& 
+    operator<<(SMESH::Filter_i* theArg);
+
+    TPythonDump& 
+    operator<<(SMESH::Functor_i* theArg);
+  };
+}
+
+
+#endif
index 03edab751e01e3ed94b394727467c6738fe03ff9..a6c0165aa2d26220a77df989976627c7018a106f 100644 (file)
@@ -114,6 +114,6 @@ EXPORT_SHAREDPYSCRIPTS=SMESH_shared_modules.py
 
 CPPFLAGS+=$(QT_INCLUDES) $(PYTHON_INCLUDES) $(OCC_INCLUDES) $(VTK_INCLUDES) $(OGL_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome -DHAVE_CONFIG_H
 LIBS+= $(PYTHON_LIBS)
-LDFLAGS+= -lSMESHGUI -L${KERNEL_ROOT_DIR}/lib/salome -lSalomeGenericObj
+LDFLAGS+= -lSMESH -L${KERNEL_ROOT_DIR}/lib/salome -lSalomeGenericObj
 
 @CONCLUDE@
index 913f5a129400fcad984ebc8d673f5e71bcde7728..da6b6a2e4ebff1db3d8a6f701705963ff33e7329 100644 (file)
@@ -136,7 +136,16 @@ bool StdMeshers_Quadrangle_2D::Compute (SMESH_Mesh& aMesh,
   int nbhoriz  = Min(nbdown, nbup);
   int nbvertic = Min(nbright, nbleft);
 
+  int nbVertices = nbhoriz * nbvertic;
+  int nbQuad = (nbhoriz - 1) * (nbvertic - 1);
+  //SCRUTE(nbVertices);
+  //SCRUTE(nbQuad);
+
+  //   const TopoDS_Face& FF = TopoDS::Face(aShape);
+  //   bool faceIsForward = (FF.Orientation() == TopAbs_FORWARD);
+  //   TopoDS_Face F = TopoDS::Face(FF.Oriented(TopAbs_FORWARD));
   const TopoDS_Face& F = TopoDS::Face(aShape);
+  bool faceIsForward = (F.Orientation() == TopAbs_FORWARD);
   Handle(Geom_Surface) S = BRep_Tool::Surface(F);
 
   // internal mesh nodes
@@ -511,18 +520,26 @@ FaceQuadStruct *StdMeshers_Quadrangle_2D::CheckAnd2Dcompute
   (SMESH_Mesh & aMesh, const TopoDS_Shape & aShape) throw(SALOME_Exception)
 {
   Unexpect aCatch(SalomeException);
+//  MESSAGE("StdMeshers_Quadrangle_2D::CheckAnd2Dcompute");
 
-  //SMESH_subMesh *theSubMesh = aMesh.GetSubMesh(aShape);
+  SMESH_subMesh *theSubMesh = aMesh.GetSubMesh(aShape);
 
+  //   const TopoDS_Face& FF = TopoDS::Face(aShape);
+  //   bool faceIsForward = (FF.Orientation() == TopAbs_FORWARD);
+  //   TopoDS_Face F = TopoDS::Face(FF.Oriented(TopAbs_FORWARD));
   const TopoDS_Face & F = TopoDS::Face(aShape);
+  bool faceIsForward = (F.Orientation() == TopAbs_FORWARD);
 
   // verify 1 wire only, with 4 edges
 
   if (NumberOfWires(F) != 1)
   {
-    INFOS("only 1 wire by face (quadrangles)");
+    MESSAGE("only 1 wire by face (quadrangles)");
     return 0;
+    //throw SALOME_Exception(LOCALIZED("only 1 wire by face (quadrangles)"));
   }
+  //   const TopoDS_Wire WW = BRepTools::OuterWire(F);
+  //   TopoDS_Wire W = TopoDS::Wire(WW.Oriented(TopAbs_FORWARD));
   const TopoDS_Wire& W = BRepTools::OuterWire(F);
   BRepTools_WireExplorer wexp (W, F);
 
@@ -534,6 +551,8 @@ FaceQuadStruct *StdMeshers_Quadrangle_2D::CheckAnd2Dcompute
   int nbEdges = 0;
   for (wexp.Init(W, F); wexp.More(); wexp.Next())
   {
+    //       const TopoDS_Edge& EE = wexp.Current();
+    //       TopoDS_Edge E = TopoDS::Edge(EE.Oriented(TopAbs_FORWARD));
     const TopoDS_Edge& E = wexp.Current();
     int nb = aMesh.GetSubMesh(E)->GetSubMeshDS()->NbNodes();
     if (nbEdges < 4)
@@ -546,11 +565,26 @@ FaceQuadStruct *StdMeshers_Quadrangle_2D::CheckAnd2Dcompute
 
   if (nbEdges != 4)
   {
-    INFOS("face must have 4 edges /quadrangles");
+    MESSAGE("face must have 4 edges /quadrangles");
     QuadDelete(quad);
     return 0;
+    //throw SALOME_Exception(LOCALIZED("face must have 4 edges /quadrangles"));
   }
 
+//  if (quad->nbPts[0] != quad->nbPts[2]) {
+//    MESSAGE("different point number-opposed edge");
+//    QuadDelete(quad);
+//    return 0;
+//    //throw SALOME_Exception(LOCALIZED("different point number-opposed edge"));
+//  }
+//
+//  if (quad->nbPts[1] != quad->nbPts[3]) {
+//    MESSAGE("different point number-opposed edge");
+//    QuadDelete(quad);
+//    return 0;
+//    //throw SALOME_Exception(LOCALIZED("different point number-opposed edge"));
+//  }
+
   // set normalized grid on unit square in parametric domain
 
   SetNormalizedGrid(aMesh, F, quad);
@@ -626,11 +660,10 @@ void StdMeshers_Quadrangle_2D::SetNormalizedGrid (SMESH_Mesh & aMesh,
     quad->isEdgeForward[i] = false;
   }
 
-  double l0f1 = pl[0].SquareDistance(pf[1]);
-  double l0l1 = pl[0].SquareDistance(pl[1]);
-  double f0f1 = pf[0].SquareDistance(pf[1]);
-  double f0l1 = pf[0].SquareDistance(pl[1]);
-  if ( Min( l0f1, l0l1 ) < Min ( f0f1, f0l1 ))
+  double eps2d = 1.e-3; // *** utiliser plutot TopExp::CommonVertex, puis
+  // distances si piece fausse
+//  int i = 0;
+  if ((pf[1].Distance(pl[0]) < eps2d) || (pl[1].Distance(pl[0]) < eps2d))
   {
     quad->isEdgeForward[0] = true;
   } else {
@@ -640,11 +673,10 @@ void StdMeshers_Quadrangle_2D::SetNormalizedGrid (SMESH_Mesh & aMesh,
     pf[0] = c2d[0]->Value(quad->first[0]);
     pl[0] = c2d[0]->Value(quad->last[0]);
   }
+
   for (int i = 1; i < 4; i++)
   {
-    l0l1 = pl[i - 1].SquareDistance(pl[i]);
-    l0f1 = pl[i - 1].SquareDistance(pf[i]);
-    quad->isEdgeForward[i] = ( l0f1 < l0l1 );
+    quad->isEdgeForward[i] = (pf[i].Distance(pl[i - 1]) < eps2d);
     if (!quad->isEdgeForward[i])
     {
       double tmp = quad->first[i];
@@ -652,8 +684,19 @@ void StdMeshers_Quadrangle_2D::SetNormalizedGrid (SMESH_Mesh & aMesh,
       quad->last[i] = tmp;
       pf[i] = c2d[i]->Value(quad->first[i]);
       pl[i] = c2d[i]->Value(quad->last[i]);
+      //SCRUTE(pf[i].Distance(pl[i-1]));
+      ASSERT(pf[i].Distance(pl[i - 1]) < eps2d);
     }
   }
+  //SCRUTE(pf[0].Distance(pl[3]));
+  ASSERT(pf[0].Distance(pl[3]) < eps2d);
+
+//   for (int i=0; i<4; i++)
+//     {
+//       SCRUTE(quad->isEdgeForward[i]);
+//       MESSAGE(" -first "<<i<<" "<<pf[i].X()<<" "<<pf[i].Y());
+//       MESSAGE(" -last  "<<i<<" "<<pl[i].X()<<" "<<pl[i].Y());
+//     }
 
   // 2 --- load 2d edge points (u,v) with orientation and value on unit square
 
@@ -663,6 +706,7 @@ void StdMeshers_Quadrangle_2D::SetNormalizedGrid (SMESH_Mesh & aMesh,
     quad->uv_edges[i] = LoadEdgePoints(aMesh, F, quad->edge[i],
                                        quad->first[i], quad->last[i]);
     if (!quad->uv_edges[i]) loadOk = false;
+    //    quad->isEdgeForward[i]);
   }
 
   for (int i = 2; i < 4; i++)
@@ -670,19 +714,23 @@ void StdMeshers_Quadrangle_2D::SetNormalizedGrid (SMESH_Mesh & aMesh,
     quad->uv_edges[i] = LoadEdgePoints(aMesh, F, quad->edge[i],
                                        quad->last[i], quad->first[i]);
     if (!quad->uv_edges[i]) loadOk = false;
+    //    !quad->isEdgeForward[i]);
   }
 
   if (!loadOk)
   {
-    INFOS("StdMeshers_Quadrangle_2D::SetNormalizedGrid - LoadEdgePoints failed");
+//    MESSAGE("StdMeshers_Quadrangle_2D::SetNormalizedGrid - LoadEdgePoints failed");
     QuadDelete( quad );
     quad = 0;
     return;
   }
   // 3 --- 2D normalized values on unit square [0..1][0..1]
 
+//  int nbdown = quad->nbPts[0];
+//  int nbright = quad->nbPts[1];
   int nbhoriz  = Min(quad->nbPts[0], quad->nbPts[2]);
   int nbvertic = Min(quad->nbPts[1], quad->nbPts[3]);
+//  MESSAGE("nbhoriz, nbvertic = " << nbhoriz << nbvertic);
 
   quad->isEdgeOut[0] = (quad->nbPts[0] > quad->nbPts[2]);
   quad->isEdgeOut[1] = (quad->nbPts[1] > quad->nbPts[3]);
@@ -798,6 +846,8 @@ void StdMeshers_Quadrangle_2D::SetNormalizedGrid (SMESH_Mesh & aMesh,
 
       uv_grid[ij].u = u;
       uv_grid[ij].v = v;
+
+      //MESSAGE("-uv- "<<i<<" "<<j<<" "<<uv_grid[ij].u<<" "<<uv_grid[ij].v);
     }
   }
 }
@@ -815,7 +865,7 @@ UVPtStruct* StdMeshers_Quadrangle_2D::LoadEdgePoints (SMESH_Mesh & aMesh,
 {
   //MESSAGE("StdMeshers_Quadrangle_2D::LoadEdgePoints");
 
-  //SMDS_Mesh* meshDS = aMesh.GetMeshDS();
+  SMDS_Mesh* meshDS = aMesh.GetMeshDS();
 
   // --- IDNodes of first and last Vertex
 
@@ -932,6 +982,7 @@ UVPtStruct* StdMeshers_Quadrangle_2D::LoadEdgePoints (SMESH_Mesh & aMesh,
   for (int i = 0; i < nbPoints + 2; i++)
   {
     uvslf[i].normParam = (uvslf[i].param - paramin) / (paramax - paramin);
+    //SCRUTE(uvslf[i].normParam);
   }
 
   return uvslf;
index 4cf3c4e2b166d3511fae68642ba169f09c41c5b7..9e0d5039821d3607f485304313a71971cf5c70fc 100644 (file)
@@ -35,7 +35,7 @@ VPATH=.:@srcdir@:@top_srcdir@/idl:$(top_builddir)/idl:${KERNEL_ROOT_DIR}/idl/sal
 
 # .po files to transform in .qm
  PO_FILES = \
-       StdMeshers_icons.po \
+       StdMeshers_images.po \
        StdMeshers_msg_en.po
 
 # Libraries targets
@@ -60,18 +60,20 @@ LIB_CLIENT_IDL = \
 
 ## pb in dependencies search
 LIB_CLIENT_IDL += \
-       SALOME_GenericObj.idl
+       SALOME_GenericObj.idl \
+       SALOME_Component.idl \
+       GEOM_Gen.idl
 
 LIB_SERVER_IDL = 
 
 # additionnal information to compil and link file
 
 CPPFLAGS += $(QT_INCLUDES) $(VTK_INCLUDES) $(OGL_INCLUDES) $(OCC_INCLUDES) $(PYTHON_INCLUDES) \
-            -I${KERNEL_ROOT_DIR}/include/salome -I${GEOM_ROOT_DIR}/include/salome \
+            -I${KERNEL_ROOT_DIR}/include/salome -I${GUI_ROOT_DIR}/include/salome -I${GEOM_ROOT_DIR}/include/salome \
             $(BOOST_CPPFLAGS)
-CXXFLAGS += -I${KERNEL_ROOT_DIR}/include/salome -I${GEOM_ROOT_DIR}/include/salome
+CXXFLAGS += -I${KERNEL_ROOT_DIR}/include/salome -I${GUI_ROOT_DIR}/include/salome -I${GEOM_ROOT_DIR}/include/salome
 #$(OCC_CXXFLAGS)
 
-LDFLAGS += -lSMESHGUI -lVTKViewer -lSalomeGUI -lSMESHObject -lSMESHFiltersSelection $(OCC_KERNEL_LIBS) -lTKBO -L${KERNEL_ROOT_DIR}/lib/salome -L${GEOM_ROOT_DIR}/lib/salome
+LDFLAGS += -lSMESH -lVTKViewer -lSalomeApp -lSMESHObject -lSMESHFiltersSelection $(OCC_KERNEL_LIBS) -lTKBO -L${KERNEL_ROOT_DIR}/lib/salome -L${GEOM_ROOT_DIR}/lib/salome -L${GUI_ROOT_DIR}/lib/salome
 
 @CONCLUDE@
index 36a65f6f07c182dc52cc9b0b2843929e75c24d4e..aa7bd34bd3bdf86de5c09256dbb13783696bb87f 100644 (file)
@@ -37,8 +37,8 @@
 #include "StdMeshersGUI_Parameters.h"
 #include "StdMeshersGUI_CreateStdHypothesisDlg.h"
 
-#include "QAD_Desktop.h"
-#include "QAD_ResourceMgr.h"
+#include "SUIT_Desktop.h"
+#include "SUIT_ResourceMgr.h"
 
 #include <qobject.h>
 
@@ -98,7 +98,7 @@ void StdMeshersGUI_HypothesisCreator::CreateHypothesis
   {
     if ( StdMeshersGUI_Parameters::HasParameters( myHypType ))
     // Show Dialog for hypothesis creation
-      StdMeshersGUI_CreateStdHypothesisDlg *aDlg =
+      //StdMeshersGUI_CreateStdHypothesisDlg *aDlg =
         new StdMeshersGUI_CreateStdHypothesisDlg(myHypType, parent, "");
     else
       SMESH::CreateHypothesis(myHypType, aHypName, isAlgo); // without GUI
@@ -115,9 +115,8 @@ void StdMeshersGUI_HypothesisCreator::EditHypothesis
 {
   MESSAGE("StdMeshersGUI_HypothesisCreator::EditHypothesis");
 
-  SALOMEDS::Study::ListOfSObject_var listSOmesh =
-    SMESH::GetMeshesUsingAlgoOrHypothesis(theHyp);
-  
+  SMESH::SObjectList listSOmesh = SMESH::GetMeshesUsingAlgoOrHypothesis(theHyp);
+
   list<SMESHGUI_aParameterPtr> paramList;
   StdMeshersGUI_Parameters::GetParameters( theHyp, paramList );
 
@@ -129,22 +128,22 @@ void StdMeshersGUI_HypothesisCreator::EditHypothesis
     //set new Attribute Comment for hypothesis which parameters were modified
     QString aParams = "";
     StdMeshersGUI_Parameters::GetParameters( theHyp, paramList, aParams );
-    SALOMEDS::SObject_var SHyp = SMESH::FindSObject(theHyp);
-    if (!SHyp->_is_nil()) 
+    _PTR(SObject) SHyp = SMESH::FindSObject(theHyp);
+    if (SHyp)
       if (!aParams.isEmpty()) {
        SMESH::SetValue(SHyp, aParams);
        //mySMESHGUI->GetActiveStudy()->updateObjBrowser(true);
       }    
-       
-    if ( listSOmesh->length() > 0 ) {
-      SALOMEDS::SObject_var submSO = listSOmesh[0];
+
+    if ( listSOmesh.size() > 0 ) {
+      _PTR(SObject) submSO = listSOmesh[0];
       SMESH::SMESH_Mesh_var aMesh =
         SMESH::SObjectToInterface<SMESH::SMESH_Mesh>(submSO);
       SMESH::SMESH_subMesh_var aSubMesh =
         SMESH::SObjectToInterface<SMESH::SMESH_subMesh>(submSO);
       if ( !aSubMesh->_is_nil() )
         aMesh = aSubMesh->GetFather();
-      SALOMEDS::SObject_var meshSO = SMESH::FindSObject( aMesh );
+      _PTR(SObject) meshSO = SMESH::FindSObject( aMesh );
       SMESH::ModifiedMesh( meshSO, false);
     }
   }
index e1485700818147e2ad40689e079e1ab63e9fa07f..b68b6d24c1008f527892c4f11ec5139e8324a8eb 100644 (file)
 #include "SMESHGUI_HypothesesUtils.h"
 #include "SMESHGUI_Utils.h"
 
-#include "QAD_Application.h"
-#include "QAD_Desktop.h"
+#include "SUIT_Application.h"
+#include "SUIT_Desktop.h"
+#include "SUIT_MessageBox.h"
+#include "SUIT_OverrideCursor.h"
 #include "utilities.h"
 
-#include "SALOMEGUI_QtCatchCorbaException.hxx"
-#include "QAD_MessageBox.h"
-#include "QAD_WaitCursor.h"
+#include "SalomeApp_Tools.h"
+#include "SalomeApp_Application.h"
+
+#include "OB_Browser.h"
 
 // QT Includes
 #include <qgroupbox.h>
@@ -227,7 +230,7 @@ void StdMeshersGUI_CreateHypothesisDlg::Init()
   /* Move widget on the botton right corner of main widget */
   int x, y ;
   mySMESHGUI->DefineDlgPosition( this, x, y ) ;
-  this->move( x, y ) ; 
+  this->move( x, y ) ;
   this->show() ; /* displays Dialog */
 }
 
@@ -248,17 +251,17 @@ void StdMeshersGUI_CreateHypothesisDlg::ClickOnOk()
 //=================================================================================
 bool StdMeshersGUI_CreateHypothesisDlg::ClickOnApply()
 {
-  if ( !mySMESHGUI || mySMESHGUI->ActiveStudyLocked() )
+  if ( !mySMESHGUI || mySMESHGUI->isActiveStudyLocked() )
     return false;
 
   QString myHypName = LineEdit_NameHypothesis->text().stripWhiteSpace();
   if ( myHypName.isEmpty() ) {
-    QAD_MessageBox::warn1 (this, tr( "SMESH_WRN_WARNING" ),
+    SUIT_MessageBox::warn1 (this, tr( "SMESH_WRN_WARNING" ),
                            tr( "SMESH_WRN_EMPTY_NAME" ), tr( "SMESH_BUT_OK" ) );
     return false;
   }
 
-  QAD_WaitCursor wc;
+  SUIT_OverrideCursor wc;
 
   try {
     SMESH::SMESH_Hypothesis_var Hyp = SMESH::SMESH_Hypothesis::_narrow
@@ -278,16 +281,16 @@ bool StdMeshersGUI_CreateHypothesisDlg::ClickOnApply()
     //set new Attribute Comment for hypothesis which parameters were set
     QString aParams = "";
     StdMeshersGUI_Parameters::GetParameters( Hyp.in(), myParamList, aParams );
-    SALOMEDS::SObject_var SHyp = SMESH::FindSObject(Hyp.in());
-    if (!SHyp->_is_nil()) 
+    _PTR(SObject) SHyp = SMESH::FindSObject(Hyp.in());
+    if (SHyp)
       if (!aParams.isEmpty()) {
        SMESH::SetValue(SHyp, aParams);
-       mySMESHGUI->GetActiveStudy()->updateObjBrowser(true);
-      }    
+       mySMESHGUI->getApp()->objectBrowser()->updateTree();
+      }
   }
   catch (const SALOME::SALOME_Exception& S_ex) {
-    wc.stop();
-    QtCatchCorbaException(S_ex);
+    wc.suspend();
+    SalomeApp_Tools::QtCatchCorbaException(S_ex);
     return false;
   }
   return true;
index 32aa02df3938459e3d6a37f0dda20b2549127aa2..5cc014eeab22c24b87729ea7f8b59a722213240a 100644 (file)
@@ -35,10 +35,10 @@ using namespace std;
 
 #include "utilities.h"
 
-#include "SALOMEGUI_QtCatchCorbaException.hxx"
-#include "QAD_MessageBox.h"
-#include "QAD_WaitCursor.h"
-#include "QAD_Desktop.h"
+#include "SUIT_MessageBox.h"
+#include "SUIT_ResourceMgr.h"
+#include "SUIT_OverrideCursor.h"
+#include "SUIT_Desktop.h"
 
 //=================================================================================
 // class    : StdMeshersGUI_CreateStdHypothesisDlg()
@@ -72,9 +72,9 @@ StdMeshersGUI_CreateStdHypothesisDlg::StdMeshersGUI_CreateStdHypothesisDlg (cons
   QString caption( tr ( QString( "SMESH_%1_TITLE" ).arg( hypTypeStr )));
   QString hypTypeName( tr ( QString( "SMESH_%1_HYPOTHESIS" ).arg( hypTypeStr )));
   QString hypIconName( tr ( QString( "ICON_DLG_%1" ).arg( hypTypeStr )));
-  
-  CreateDlgLayout(caption, 
-                  QAD_Desktop::getResourceManager()->loadPixmap( "SMESH", hypIconName ),
+
+  CreateDlgLayout(caption,
+                  SMESHGUI::resourceMgr()->loadPixmap( "SMESH", hypIconName ),
                   hypTypeName);
 }
 
diff --git a/src/StdMeshersGUI/StdMeshers_images.po b/src/StdMeshersGUI/StdMeshers_images.po
new file mode 100644 (file)
index 0000000..64fe984
--- /dev/null
@@ -0,0 +1,113 @@
+# This is a Qt message file in .po format.  Each msgid starts with
+# a scope.  This scope should *NOT* be translated - eg. "Foo::Bar"
+# would be translated to "Pub", not "Foo::Pub".
+msgid ""
+msgstr ""
+"Project-Id-Version: PROJECT VERSION\n"
+"POT-Creation-Date: 2002-05-28 10:57:43 AM CEST\n"
+"PO-Revision-Date: YYYY-MM-DD\n"
+"Last-Translator: FULLNAME <EMAIL@ADDRESS>\n"
+"Content-Type: text/plain; charset=iso-8859-1\n"
+
+
+#Select Icon
+msgid "ICON_SELECT"
+msgstr "select1.png"
+
+
+#-----------------------------------------------------------
+# Hypothesis
+#-----------------------------------------------------------
+
+#Hypo Local Length
+msgid "ICON_DLG_LOCAL_LENGTH"
+msgstr "mesh_hypo_length.png"
+
+#Hypo Nb Segments
+msgid "ICON_DLG_NB_SEGMENTS"
+msgstr "mesh_hypo_segment.png"
+
+#Hypo Max Area
+msgid "ICON_DLG_MAX_ELEMENT_AREA"
+msgstr "mesh_hypo_area.png"
+
+#Hypo Max Volume
+msgid "ICON_DLG_MAX_ELEMENT_VOLUME"
+msgstr "mesh_hypo_volume.png"
+
+#Hypo Start End Length
+msgid "ICON_DLG_START_END_LENGTH"
+msgstr "mesh_hypo_length.png"
+
+#Hypo deflection 1D
+msgid "ICON_DLG_DEFLECTION1D"
+msgstr "mesh_hypo_length.png"
+
+#Hypo Geometric 1D
+msgid "ICON_DLG_GEOMETRIC_1D"
+msgstr "mesh_hypo_length.png"
+
+#Hypo Arithmetic 1D
+msgid "ICON_DLG_ARITHMETIC_1D"
+msgstr "mesh_hypo_length.png"
+
+
+#-----------------------------------------------------------
+# ObjectBrowser
+#-----------------------------------------------------------
+
+#mesh_tree_algo_regular
+msgid "ICON_SMESH_TREE_ALGO_Regular_1D"
+msgstr "mesh_tree_algo_regular.png"
+
+#mesh_tree_algo_hexa
+msgid "ICON_SMESH_TREE_ALGO_Hexa_3D"
+msgstr "mesh_tree_algo_hexa.png"
+
+#mesh_tree_algo_mefisto
+msgid "ICON_SMESH_TREE_ALGO_MEFISTO_2D"
+msgstr "mesh_tree_algo_mefisto.png"
+
+#mesh_tree_algo_quad
+msgid "ICON_SMESH_TREE_ALGO_Quadrangle_2D"
+msgstr "mesh_tree_algo_quad.png"
+
+#mesh_tree_hypo_area
+msgid "ICON_SMESH_TREE_HYPO_MaxElementArea"
+msgstr "mesh_tree_hypo_area.png"
+
+#mesh_tree_hypo_length
+msgid "ICON_SMESH_TREE_HYPO_LocalLength"
+msgstr "mesh_tree_hypo_length.png"
+
+#mesh_tree_hypo_segment
+msgid "ICON_SMESH_TREE_HYPO_NumberOfSegments"
+msgstr "mesh_tree_hypo_segment.png"
+
+#mesh_tree_hypo_volume
+msgid "ICON_SMESH_TREE_HYPO_MaxElementVolume"
+msgstr "mesh_tree_hypo_volume.png"
+
+#mesh_tree_hypo_length
+msgid "ICON_SMESH_TREE_HYPO_LengthFromEdges"
+msgstr "mesh_tree_hypo_length.png"
+
+#mesh_tree_hypo_nonconform
+msgid "ICON_SMESH_TREE_HYPO_NotConformAllowed"
+msgstr "mesh_tree_hypo_length.png"
+
+#mesh_tree_hypo_start_end_length
+msgid "ICON_SMESH_TREE_HYPO_StartEndLength"
+msgstr "mesh_tree_hypo_length.png"
+
+#mesh_tree_hypo_deflection1d
+msgid "ICON_SMESH_TREE_HYPO_Deflection1D"
+msgstr "mesh_tree_hypo_length.png"
+
+#mesh_tree_hypo_Arithmetic1d
+msgid "ICON_SMESH_TREE_HYPO_Arithmetic1D"
+msgstr "mesh_tree_hypo_length.png"
+
+#mesh_tree_hypo_propagation
+msgid "ICON_SMESH_TREE_HYPO_Propagation"
+msgstr "mesh_tree_hypo_length.png"
index aad7d1e39c65410206bf238554774f91afce300a..9c142aab82e5d20e92ae3031d058e5ec612397f2 100644 (file)
 
 using namespace std;
 #include "StdMeshers_Arithmetic1D_i.hxx"
+#include "SMESH_Gen_i.hxx"
 #include "SMESH_Gen.hxx"
 
 #include "Utils_CorbaException.hxx"
 #include "utilities.h"
 
+#include <TCollection_AsciiString.hxx>
+
 //=============================================================================
 /*!
  *  StdMeshers_Arithmetic1D_i::StdMeshers_Arithmetic1D_i
@@ -87,6 +90,13 @@ void StdMeshers_Arithmetic1D_i::SetLength(CORBA::Double theLength,
     THROW_SALOME_CORBA_EXCEPTION( S_ex.what(),
                                  SALOME::BAD_PARAM );
   }
+
+  // Update Python script
+  TCollection_AsciiString aStr, aStrLen ((double)theLength), aStrFlag ((int)theIsStart);
+  SMESH_Gen_i::AddObject(aStr, _this()) += ".SetLength(";
+  aStr += aStrLen + ", " + aStrFlag + ")";
+
+  SMESH_Gen_i::AddToCurrentPyScript(aStr);
 }
 
 //=============================================================================
index 84ef5e96d3de9de4f91ee41c11583ca41ec200ea..78ef384cc2b8e948867619a7ce2a83799c792e67 100644 (file)
 
 using namespace std;
 #include "StdMeshers_Deflection1D_i.hxx"
+#include "SMESH_Gen_i.hxx"
 #include "SMESH_Gen.hxx"
 
 #include "Utils_CorbaException.hxx"
 #include "utilities.h"
 
+#include <TCollection_AsciiString.hxx>
+
 //=============================================================================
 /*!
  *  StdMeshers_Deflection1D_i::StdMeshers_Deflection1D_i
@@ -87,6 +90,13 @@ void StdMeshers_Deflection1D_i::SetDeflection( CORBA::Double theValue )
     THROW_SALOME_CORBA_EXCEPTION( S_ex.what(),
                                  SALOME::BAD_PARAM );
   }
+
+  // Update Python script
+  TCollection_AsciiString aStr, aStrVal ((double)theValue);
+  SMESH_Gen_i::AddObject(aStr, _this()) += ".SetDeflection(";
+  aStr += aStrVal + ")";
+
+  SMESH_Gen_i::AddToCurrentPyScript(aStr);
 }
 
 //=============================================================================
index 15b3eb79f39877a655f2d0da5d2698d4868175e5..fe694f7f7a02252779c008abe7e8f201839c295f 100644 (file)
 
 using namespace std;
 #include "StdMeshers_LocalLength_i.hxx"
+#include "SMESH_Gen_i.hxx"
 #include "SMESH_Gen.hxx"
 
 #include "Utils_CorbaException.hxx"
 #include "utilities.h"
 
+#include <TCollection_AsciiString.hxx>
+
 //=============================================================================
 /*!
  *  StdMeshers_LocalLength_i::StdMeshers_LocalLength_i
@@ -87,6 +90,13 @@ void StdMeshers_LocalLength_i::SetLength( CORBA::Double theLength )
     THROW_SALOME_CORBA_EXCEPTION( S_ex.what(),
                                  SALOME::BAD_PARAM );
   }
+
+  // Update Python script
+  TCollection_AsciiString aStr, aStrLen ((double)theLength);
+  SMESH_Gen_i::AddObject(aStr, _this()) += ".SetLength(";
+  aStr += aStrLen + ")";
+
+  SMESH_Gen_i::AddToCurrentPyScript(aStr);
 }
 
 //=============================================================================
index 51810e0a71a8d5969cf40153af0588828b571e19..09544be6b3c67fdb76c44b1ddb4c8f87a0fdaf85 100644 (file)
 
 using namespace std;
 #include "StdMeshers_MaxElementArea_i.hxx"
+#include "SMESH_Gen_i.hxx"
 #include "SMESH_Gen.hxx"
 
 #include "Utils_CorbaException.hxx"
 #include "utilities.h"
 
+#include <TCollection_AsciiString.hxx>
+
 //=============================================================================
 /*!
  *  StdMeshers_MaxElementArea_i::StdMeshers_MaxElementArea_i
@@ -87,6 +90,13 @@ void StdMeshers_MaxElementArea_i::SetMaxElementArea( CORBA::Double theArea )
     THROW_SALOME_CORBA_EXCEPTION( S_ex.what(),
                                  SALOME::BAD_PARAM );
   }
+
+  // Update Python script
+  TCollection_AsciiString aStr, aStrArea ((double)theArea);
+  SMESH_Gen_i::AddObject(aStr, _this()) += ".SetMaxElementArea(";
+  aStr += aStrArea + ")";
+
+  SMESH_Gen_i::AddToCurrentPyScript(aStr);
 }
 
 //=============================================================================
index eb071b6646391c157b3488820adbf18afd13647d..f571bab827e6c868fe70d49a3bbb9f1203c19fe8 100644 (file)
 
 using namespace std;
 #include "StdMeshers_MaxElementVolume_i.hxx"
+#include "SMESH_Gen_i.hxx"
 #include "SMESH_Gen.hxx"
 
 #include "Utils_CorbaException.hxx"
 #include "utilities.h"
 
+#include <TCollection_AsciiString.hxx>
+
 //=============================================================================
 /*!
  *  StdMeshers_MaxElementVolume_i::StdMeshers_MaxElementVolume_i
@@ -87,6 +90,13 @@ void StdMeshers_MaxElementVolume_i::SetMaxElementVolume( CORBA::Double theVolume
     THROW_SALOME_CORBA_EXCEPTION( S_ex.what(),
                                  SALOME::BAD_PARAM );
   }
+
+  // Update Python script
+  TCollection_AsciiString aStr, aStrVol ((double)theVolume);
+  SMESH_Gen_i::AddObject(aStr, _this()) += ".SetMaxElementVolume(";
+  aStr += aStrVol + ")";
+
+  SMESH_Gen_i::AddToCurrentPyScript(aStr);
 }
 
 //=============================================================================
index bf326bdf3def52d9d74e6abd4b173bc9ccf8f49f..356d19ad30900cd069a534f0dd4bb6c6312148bc 100644 (file)
 
 using namespace std;
 #include "StdMeshers_NumberOfSegments_i.hxx"
+#include "SMESH_Gen_i.hxx"
 #include "SMESH_Gen.hxx"
 
 #include "Utils_CorbaException.hxx"
 #include "utilities.h"
 
+#include <TCollection_AsciiString.hxx>
+
 //=============================================================================
 /*!
  *  StdMeshers_NumberOfSegments_i::StdMeshers_NumberOfSegments_i
@@ -87,6 +90,13 @@ void StdMeshers_NumberOfSegments_i::SetNumberOfSegments( CORBA::Long theSegments
     THROW_SALOME_CORBA_EXCEPTION( S_ex.what(),
                                  SALOME::BAD_PARAM );
   }
+
+  // Update Python script
+  TCollection_AsciiString aStr, aStrNb ((int)theSegmentsNumber);
+  SMESH_Gen_i::AddObject(aStr, _this()) += ".SetNumberOfSegments(";
+  aStr += aStrNb + ")";
+
+  SMESH_Gen_i::AddToCurrentPyScript(aStr);
 }
 
 //=============================================================================
index 08ffa4c815d0b246c8795e7ffb17084d3b564166..1d175ea632c13158ec2971bcfe88c8844105af3e 100644 (file)
 
 using namespace std;
 #include "StdMeshers_StartEndLength_i.hxx"
+#include "SMESH_Gen_i.hxx"
 #include "SMESH_Gen.hxx"
 
 #include "Utils_CorbaException.hxx"
 #include "utilities.h"
 
+#include <TCollection_AsciiString.hxx>
+
 //=============================================================================
 /*!
  *  StdMeshers_StartEndLength_i::StdMeshers_StartEndLength_i
@@ -88,6 +91,13 @@ void StdMeshers_StartEndLength_i::SetLength(CORBA::Double theLength,
     THROW_SALOME_CORBA_EXCEPTION( S_ex.what(),
                                  SALOME::BAD_PARAM );
   }
+
+  // Update Python script
+  TCollection_AsciiString aStr, aStrLen ((double)theLength), aStrFlag ((int)theIsStart);
+  SMESH_Gen_i::AddObject(aStr, _this()) += ".SetLength(";
+  aStr += aStrLen + ", " + aStrFlag + ")";
+
+  SMESH_Gen_i::AddToCurrentPyScript(aStr);
 }
 
 //=============================================================================