]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
Issue 0020336: [CEA 339] specifying a cut line with 2 points
authorouv <ouv@opencascade.com>
Wed, 5 Aug 2009 12:59:08 +0000 (12:59 +0000)
committerouv <ouv@opencascade.com>
Wed, 5 Aug 2009 12:59:08 +0000 (12:59 +0000)
57 files changed:
doc/salome/gui/VISU/images/cutsegment.png [new file with mode: 0644]
doc/salome/gui/VISU/images/cutsegmenticon.jpg [new file with mode: 0755]
doc/salome/gui/VISU/images/cutsegmentprsnt.png [new file with mode: 0755]
doc/salome/gui/VISU/input/cut_segment.doc [new file with mode: 0644]
doc/salome/gui/VISU/input/field_presentations.doc
doc/salome/gui/VISU/input/table_presentations.doc
idl/VISU_Gen.idl
resources/Makefile.am
resources/SalomeApp.xml
resources/VISU_en.xml
resources/VISU_fr.xml
resources/Visu_cutsegment.png [new file with mode: 0644]
resources/Visu_tree_cutsegment.png [new file with mode: 0644]
resources/Visu_tree_cutsegment_gr.png [new file with mode: 0644]
src/ENGINE/VISU_Engine_i.cc
src/ENGINE/VISU_Engine_i.hh
src/PIPELINE/Makefile.am
src/PIPELINE/VISU_CutLinesBasePL.cxx [new file with mode: 0644]
src/PIPELINE/VISU_CutLinesBasePL.hxx [new file with mode: 0644]
src/PIPELINE/VISU_CutLinesPL.cxx
src/PIPELINE/VISU_CutLinesPL.hxx
src/PIPELINE/VISU_CutSegmentPL.cxx [new file with mode: 0644]
src/PIPELINE/VISU_CutSegmentPL.hxx [new file with mode: 0644]
src/VISUGUI/Makefile.am
src/VISUGUI/VISU_images.ts
src/VISUGUI/VISU_msg_en.ts
src/VISUGUI/VisuGUI.cxx
src/VISUGUI/VisuGUI.h
src/VISUGUI/VisuGUI_ActionsDef.h
src/VISUGUI/VisuGUI_CutSegmentDlg.cxx [new file with mode: 0644]
src/VISUGUI/VisuGUI_CutSegmentDlg.h [new file with mode: 0644]
src/VISUGUI/VisuGUI_Module.cxx
src/VISUGUI/VisuGUI_Prs3dTools.h
src/VISUGUI/VisuGUI_Selection.cxx
src/VISUGUI/VisuGUI_TimeAnimation.cxx
src/VISUGUI/VisuGUI_Tools.cxx
src/VISU_I/Makefile.am
src/VISU_I/VISUConfig.cc
src/VISU_I/VISU_ColoredPrs3dFactory.cc
src/VISU_I/VISU_ColoredPrs3dFactory.hh
src/VISU_I/VISU_CutLinesBase_i.cc [new file with mode: 0644]
src/VISU_I/VISU_CutLinesBase_i.hh [new file with mode: 0644]
src/VISU_I/VISU_CutLines_i.cc
src/VISU_I/VISU_CutLines_i.hh
src/VISU_I/VISU_CutSegment_i.cc [new file with mode: 0644]
src/VISU_I/VISU_CutSegment_i.hh [new file with mode: 0644]
src/VISU_I/VISU_DumpPython.cc
src/VISU_I/VISU_Gen_i.cc
src/VISU_I/VISU_Gen_i.hh
src/VISU_I/VISU_I.cxx
src/VISU_I/VISU_PointMap3d_i.cc
src/VISU_I/VISU_Table_i.cc
src/VISU_I/VISU_TimeAnimation.cxx
src/VISU_SWIG/batchmode_visu_view3d.py
src/VISU_SWIG/visu.py
src/VISU_SWIG/visu_cache.py
src/VISU_SWIG/visu_view3d.py

diff --git a/doc/salome/gui/VISU/images/cutsegment.png b/doc/salome/gui/VISU/images/cutsegment.png
new file mode 100644 (file)
index 0000000..c75bf7e
Binary files /dev/null and b/doc/salome/gui/VISU/images/cutsegment.png differ
diff --git a/doc/salome/gui/VISU/images/cutsegmenticon.jpg b/doc/salome/gui/VISU/images/cutsegmenticon.jpg
new file mode 100755 (executable)
index 0000000..fb551c9
Binary files /dev/null and b/doc/salome/gui/VISU/images/cutsegmenticon.jpg differ
diff --git a/doc/salome/gui/VISU/images/cutsegmentprsnt.png b/doc/salome/gui/VISU/images/cutsegmentprsnt.png
new file mode 100755 (executable)
index 0000000..51cde70
Binary files /dev/null and b/doc/salome/gui/VISU/images/cutsegmentprsnt.png differ
diff --git a/doc/salome/gui/VISU/input/cut_segment.doc b/doc/salome/gui/VISU/input/cut_segment.doc
new file mode 100644 (file)
index 0000000..c3133f9
--- /dev/null
@@ -0,0 +1,66 @@
+/*!
+
+\page cut_segment_page Cut Segment presentation
+\image html cutsegmentprsnt.png "Example of Cut Segment presentation"
+
+\n <b>Cut Segment</b> is a simplified variant of
+\ref cut_lines_page "Cut Lines" presentation, which is used to
+display a single line instead of set of them. Axis of this line is
+defined by coordinates of two points in 3D space.
+
+<em>To create a Cut Segment presentation:</em>
+\par
+&ndash; Right-click on one of the time stamps of the field in the
+Object browser and from the pop-up menu choose <b>Cut Segment</b>, or
+\n &ndash; Click on one of the time stamps of the field in the Object
+browser and select from the main menu <b>Visualization > Cut
+Segment</b>, or click <em>"Cut Segment"</em> icon in the <b>Visualization
+Toolbar</b>.
+
+\image html cutsegmenticon.jpg
+<center><em>"Cut Segment" icon</em></center>
+
+\image html cutsegment.png
+
+\par
+<b>Cut Segment:</b> this tab of the dialog box contains the
+parameters of the cut segment.
+<ul>
+<li><b>Point 1</b> and <b>Point 2</b> spin boxes allow to set coordinates
+of two points, defining an axis of the segment.</li>
+<li><b>Show preview</b> check box allows to edit the parameters of the
+presentation and simultaneously observe the preview of this
+presentation in the viewer.</li>
+<li><b>Invert curve</b> check box allows to invert the resulting
+curve.</li>
+<li><b>Use absolute length</b> check box allows to see the real length
+of the line, instead of [0,1] interval.</li>
+<li><b>Generate Data Table:</b> If this check box is marked, Post-Pro
+will automatically generate a data table on the basis of your Cut
+Segment presentation. This table will be created in the structure of the
+study.</li>
+<li><b>Generate Curve:</b> If this check box is marked, Post Pro
+will automatically generate curve line on the basis of values taken
+from the generated data table. This curve will be created in the
+structure of the study and can be visualized in a XY plot.</li>
+</ul>
+See more about table presentations and curve lines 
+\ref table_presentations_page "here".
+
+\par
+<b>Scalar Bar</b> tab allows to define the parameters of the scalar bar
+displayed with this presentation (\ref scalar_map_page "see also").
+
+After you have finished with setting these parameters, click \b
+OK. Your presentation with scalar bar will be immediately displayed in
+the viewer:
+
+<b>Tip:</b> From <b>Cut Segment</b> presentation you can create a
+<b>data table</b>. This table will consist of the field scalar values
+located on the cut line of the constructed presentation. After that
+your data table can be used for construction of a 2d plot of curves
+based on the scalar values from the table (see also:
+\ref creating_curves_page "Creating curves" and 
+\ref creating_plot2d_page "Creating Plot 2D presentation").
+
+*/
\ No newline at end of file
index 2755401b3b0961d86ad441312aea7111e1865bce..45724ebf398be533246e3473f199b326b2b4ed98 100644 (file)
@@ -8,6 +8,7 @@ presentations:
         <li>\subpage scalar_map_page</li>
         <li>\subpage iso_surfaces_page</li>
         <li>\subpage cut_lines_page</li>
+        <li>\subpage cut_segment_page</li>
         <li>\subpage cut_planes_page</li>
         <li>\subpage deformed_shape_page</li>
         <li>\subpage vectors_page</li>
index ee162476d4e48239c66989c16c17a139279c6876..3a57a993dcfa6f06aaef8bcb6578ea385aaacab2 100644 (file)
@@ -15,8 +15,9 @@ from properly defined ACSII files.
 
 \note Alternatively, it is possible to  create a table from
 the scalar values applied to the cells forming a \ref cut_lines_page "Cut Lines"
-presentation. Simply  right-click on the presentation in the Object
-Browser or in the viewer and select <b>Create Table</b> from the pop-up menu.
+or a \ref cut_segment_page "Cut Segment" presentation. Simply right-click on the 
+presentation in the Object Browser or in the viewer and select <b>Create Table</b>
+from the pop-up menu.
 
 Tables are not displayed automatically. To view the imported table,
 right-click on it in the Object Brower and select <b>Show Table</b>
index 2e98fc191536ae708655be10d601dfa4ad1389e7..1d7e764013221a4b7cca159a0043005b60b98c45 100644 (file)
@@ -98,6 +98,7 @@ module VISU {
     TPOINTMAP3D, /*!< 3D presentation for table object */
     TCUTPLANES, /*!< Cut planes 3D presentation object */
     TCUTLINES, /*!< Cut lines 3D presentation object */
+    TCUTSEGMENT, /*!< Cut segment 3D presentation object */
     TVECTORS, /*!< Vectors 3D presentation object */
     TSTREAMLINES, /*!< Streamlines 3D presentation object */
     TVISUGEN, /*!< %VISU generator used for performing operations with different %VISU objects */
@@ -1352,6 +1353,42 @@ module VISU {
     long GetNbPlanes();
   };
 
+  //-------------------------------------------------------
+  /*! \brief Base interface for Cut Lines and Cut Segment tools
+   *
+   */
+  interface CutLinesBase : ScalarMap {
+    /*!
+     * Sets the number of cut lines.
+     * \param theNb The number of cut lines.
+     */
+    void SetNbLines(in long theNb);
+
+    /*!
+     * Gets the number of cut lines.
+     */
+    long GetNbLines();
+
+    /*! Invert all curves of corresponding table
+     * \param theInvert - Invert all curves, if value is TRUE, else not.
+     */
+    void SetAllCurvesInverted(in boolean theInvert);
+
+    /*! Checks the orientation of all curves
+     * \retval TRUE - if all curves are inverted, else FALSE
+     */
+    boolean IsAllCurvesInverted();
+
+    /*! Sets values which cutlines would be shown: aboslute or relative values
+     * \param theAbsLength - boolean value, TRUE or false.
+     */
+    void SetUseAbsoluteLength(in boolean theAbsLength);
+
+    /*! Checks values of cutlines: using aboslute or relative values
+     */
+    boolean IsUseAbsoluteLength();
+  };
+
   //-------------------------------------------------------
   /*! \brief Cut lines presentation.
    *
@@ -1367,7 +1404,7 @@ module VISU {
    *      operation is a regular array of lines in space, belonging to the same plane
    *      and having the same orientation. They are located inside or on the mesh.
    */
-  interface CutLines : ScalarMap {
+  interface CutLines : CutLinesBase {
     /*!
      * Sets the type of orientation in 3D space of the base plane of a cut lines presentation.
      * \param theOrientation The orientation of the base plane in 3D space.
@@ -1487,36 +1524,48 @@ module VISU {
      * \return True if this cutting plane has default position.
      */
     boolean IsDefaultPosition(in long thePlaneNumber);
+  };
 
+  //-------------------------------------------------------
+  /*! \brief Cut segment presentation.
+   *
+   * Presentation parameters of a Cut segment presentation.
+   * Cut Segment is a simplified variant of Cut Lines presentation, which is used
+   * to display a single line instead of set of them. Axis of this line is defined
+   * by coordinates of two points in 3D space.
+   */
+  interface CutSegment : CutLinesBase {
     /*!
-     * Sets the number of cut lines.
-     * \param theNb The number of cut lines.
+     * Sets coordinates of the first point of axis of the segment.
+     * \param theX X coordinate of the point
+     * \param theY Y coordinate of the point
+     * \param theZ Z coordinate of the point
      */
-    void SetNbLines(in long theNb);
+    void SetPoint1(in double theX, in double theY, in double theZ);
 
     /*!
-     * Gets the number of cut lines.
-     */
-    long GetNbLines();
-
-    /*! Invert all curves of corresponding table
-     * \param theInvert - Invert all curves, if value is TRUE, else not.
-     */
-    void SetAllCurvesInverted(in boolean theInvert);
-
-    /*! Checks the orientation of all curves
-     * \retval TRUE - if all curves are inverted, else FALSE
+     * Gets coordinates of the first point of axis of the segment.
+     * \param theX X coordinate of the point
+     * \param theY Y coordinate of the point
+     * \param theZ Z coordinate of the point
      */
-    boolean IsAllCurvesInverted();
+    void GetPoint1(out double theX, out double theY, out double theZ);
 
-    /*! Sets values which cutlines would be shown: aboslute or relative values
-     * \param theAbsLength - boolean value, TRUE or false.
+    /*!
+     * Sets coordinates of the second point of axis of the segment.
+     * \param theX X coordinate of the point
+     * \param theY Y coordinate of the point
+     * \param theZ Z coordinate of the point
      */
-    void SetUseAbsoluteLength(in boolean theAbsLength);
+    void SetPoint2(in double theX, in double theY, in double theZ);
 
-    /*! Checks values of cutlines: using aboslute or relative values
+    /*!
+     * Gets coordinates of the second point of axis of the segment.
+     * \param theX X coordinate of the point
+     * \param theY Y coordinate of the point
+     * \param theZ Z coordinate of the point
      */
-    boolean IsUseAbsoluteLength();
+    void GetPoint2(out double theX, out double theY, out double theZ);
   };
 
   /*! \brief Interface of the stream lines representation
@@ -2275,6 +2324,18 @@ module VISU {
                             in Entity theEntity, in string theFieldName,
                             in long theTimeStampNumber);
 
+    /*!
+     * Creates a presentation of cut segment.
+     * \param theResult    Data generated in other sources. (MED object or file)
+     * \param theMeshName  One of the meshes presented in MED file
+     * \param theEntity    Type of entity where the field is defined
+     * \param theFieldName Group of data attributed to the %MESH. The data can be scalar or vector.
+     * \param theTimeStampNumber Number of iteration on the field
+     */
+    CutSegment CutSegmentOnField(in Result theResult, in string theMeshName,
+                                in Entity theEntity, in string theFieldName,
+                                in long theTimeStampNumber);
+
     /*!
      * Creates a Plot3D presentation.
      * \param theResult    Data generated in other sources. (MED object or file)
index ae592ccd688bdc53dae3f44631eb9ce1a39adf99..c9ae429130bca12003807e1e8acdcb1bd4743cc5 100644 (file)
@@ -43,6 +43,7 @@ Visu_cell_selection.png \
 Visu_close.png \
 VISU.config \
 Visu_cutlines.png \
+Visu_cutsegment.png \
 Visu_cutplanes.png \
 Visu_deformed_anim.png \
 Visu_deformed.png \
@@ -88,6 +89,8 @@ Visu_tree_container.png \
 Visu_tree_curve.png \
 Visu_tree_cutlines_gr.png \
 Visu_tree_cutlines.png \
+Visu_tree_cutsegment_gr.png \
+Visu_tree_cutsegment.png \
 Visu_tree_cutplanes_gr.png \
 Visu_tree_cutplanes.png \
 Visu_tree_deformed_gr.png \
index 48c8051b1b3e757213e6b7b88b9eab1207ec9176..d168f5b79ba332f451bdc3ff086298a9c5bea825 100644 (file)
@@ -42,6 +42,7 @@
     <parameter name="iso_surfaces_represent"   value="2"/>
     <parameter name="cut_planes_represent"     value="2"/>
     <parameter name="cut_lines_represent"      value="1"/>
+    <parameter name="cut_segment_represent"    value="1"/>
     <parameter name="deformed_shape_represent" value="1"/>
     <parameter name="deformed_shape_shrink"    value="false"/>
     <parameter name="vectors_represent"        value="1"/>
index db3d178f7d223c95d3a787c46739d5adc6c6cb71..7e7e28c63f5b711f5594901f495898e2184f0013 100644 (file)
@@ -53,6 +53,7 @@
   <popup-item item-id="4014" pos-id="" label-id="Iso Surfaces" icon-id="Visu_isosurfaces.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
   <popup-item item-id="4015" pos-id="" label-id="Cut Planes" icon-id="Visu_cutplane.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
   <popup-item item-id="4018" pos-id="" label-id="Cut Lines" icon-id="Visu_cutlines.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
+  <popup-item item-id="40181" pos-id="" label-id="Cut Segment" icon-id="Visu_cutsegment.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
   <popup-item item-id="4016" pos-id="" label-id="Stream Lines" icon-id="Visu_streamlines.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
   <popup-item item-id="4017" pos-id="" label-id="Plot 3D" icon-id="Visu_plot3d.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
   <popup-item item-id="4020" pos-id="" label-id="Scalar Map on Deformed Shape" icon-id="Visu_scalarmapondeformedshape.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
   <toolbutton-item item-id="4014" pos-id="" label-id="Iso Surfaces" icon-id="Visu_isosurfaces.png" tooltip-id="Iso Surfaces" accel-id="" toggle-id="" execute-action=""/>
   <toolbutton-item item-id="4015" pos-id="" label-id="Cut Planes" icon-id="Visu_cutplane.png" tooltip-id="Cut Planes" accel-id="" toggle-id="" execute-action=""/>
   <toolbutton-item item-id="4018" pos-id="" label-id="Cut Lines" icon-id="Visu_cutlines.png" tooltip-id="Cut Lines" accel-id="" toggle-id="" execute-action=""/>
+  <toolbutton-item item-id="40181" pos-id="" label-id="Cut Segment" icon-id="Visu_cutsegment.png" tooltip-id="Cut Segment" accel-id="" toggle-id="" execute-action=""/>
   <toolbutton-item item-id="4016" pos-id="" label-id="Stream Lines" icon-id="Visu_streamlines.png" tooltip-id="Stream Lines" accel-id="" toggle-id="" execute-action=""/>
   <toolbutton-item item-id="4017" pos-id="" label-id="Plot 3D" icon-id="Visu_plot3d.png" tooltip-id="Plot 3D" accel-id="" toggle-id="" execute-action=""/>
   <toolbutton-item item-id="4020" pos-id="" label-id="Scalar map on deformed shape" icon-id="Visu_scalarmapondeformedshape.png" tooltip-id="Scalar Map on Deformed Shape" accel-id="" toggle-id="" execute-action=""/>
index a7c3b3d559afe4e38d1287f185da9a4ba8002078..decdc38b1b81d1d3c39d5374e313885391aa09a5 100644 (file)
@@ -53,6 +53,7 @@
   <popup-item item-id="4014" pos-id="" label-id="Iso Surfaces" icon-id="Visu_isosurfaces.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
   <popup-item item-id="4015" pos-id="" label-id="Cut Planes" icon-id="Visu_cutplane.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
   <popup-item item-id="4018" pos-id="" label-id="Cut Lines" icon-id="Visu_cutlines.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
+  <popup-item item-id="40181" pos-id="" label-id="Cut Lines" icon-id="Visu_cutsegment.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
   <popup-item item-id="4016" pos-id="" label-id="Stream Lines" icon-id="Visu_streamlines.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
   <popup-item item-id="4017" pos-id="" label-id="Plot 3D" icon-id="Visu_plot3d.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
   <popup-item item-id="4020" pos-id="" label-id="Scalar Map on Deformed Shape" icon-id="Visu_scalarmapondeformedshape.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
   <toolbutton-item item-id="4014" pos-id="" label-id="Iso Surfaces" icon-id="Visu_isosurfaces.png" tooltip-id="Iso Surfaces" accel-id="" toggle-id="" execute-action=""/>
   <toolbutton-item item-id="4015" pos-id="" label-id="Cut Planes" icon-id="Visu_cutplane.png" tooltip-id="Cut Planes" accel-id="" toggle-id="" execute-action=""/>
   <toolbutton-item item-id="4018" pos-id="" label-id="Cut Lines" icon-id="Visu_cutlines.png" tooltip-id="Cut Lines" accel-id="" toggle-id="" execute-action=""/>
+  <toolbutton-item item-id="40181" pos-id="" label-id="Cut Segment" icon-id="Visu_cutsegment.png" tooltip-id="Cut Segment" accel-id="" toggle-id="" execute-action=""/>
   <toolbutton-item item-id="4016" pos-id="" label-id="Stream Lines" icon-id="Visu_streamlines.png" tooltip-id="Stream Lines" accel-id="" toggle-id="" execute-action=""/>
   <toolbutton-item item-id="4017" pos-id="" label-id="Plot 3D" icon-id="Visu_plot3d.png" tooltip-id="Plot 3D" accel-id="" toggle-id="" execute-action=""/>
   <toolbutton-item item-id="4020" pos-id="" label-id="Scalar map on deformed shape" icon-id="Visu_scalarmapondeformedshape.png" tooltip-id="Scalar Map on Deformed Shape" accel-id="" toggle-id="" execute-action=""/>
diff --git a/resources/Visu_cutsegment.png b/resources/Visu_cutsegment.png
new file mode 100644 (file)
index 0000000..bff1ebc
Binary files /dev/null and b/resources/Visu_cutsegment.png differ
diff --git a/resources/Visu_tree_cutsegment.png b/resources/Visu_tree_cutsegment.png
new file mode 100644 (file)
index 0000000..0aea43f
Binary files /dev/null and b/resources/Visu_tree_cutsegment.png differ
diff --git a/resources/Visu_tree_cutsegment_gr.png b/resources/Visu_tree_cutsegment_gr.png
new file mode 100644 (file)
index 0000000..2c62919
Binary files /dev/null and b/resources/Visu_tree_cutsegment_gr.png differ
index 887f2da125d1748309985e83c906160324f8cac5..7f8731e6d766e0c8d00c0170c35c675b449d3714 100644 (file)
@@ -361,6 +361,18 @@ namespace VISU{
   }
 
 
+  CutSegment_ptr 
+  VISU_Gen_i
+  ::CutSegmentOnField(Result_ptr theResult, 
+                     const char* theMeshName, 
+                     VISU::Entity theEntity,
+                     const char* theFieldName, 
+                     CORBA::Long theIteration)
+  {
+    return myVisuGen->CutSegmentOnField(theResult,theMeshName,theEntity,theFieldName,theIteration);
+  }
+
+
   Plot3D_ptr 
   VISU_Gen_i
   ::Plot3DOnField(Result_ptr theResult, 
index 93847a27f4ab837ff8849c4cdb8f503da8bf732e..bf44466e12c67363f921f94665de943c0de4a274 100644 (file)
@@ -138,6 +138,14 @@ namespace VISU
                    const char* theFieldName, 
                    CORBA::Long theIteration);
 
+    virtual
+    CutSegment_ptr
+    CutSegmentOnField(Result_ptr theResult, 
+                     const char* theMeshName, 
+                     VISU::Entity theEntity,
+                     const char* theFieldName, 
+                     CORBA::Long theIteration);
+
     virtual
     StreamLines_ptr 
     StreamLinesOnField(Result_ptr theResult, 
index d918d23a5c402f5c4f24fc8e278e0363d13e54a5..133fa81a32c4138c1cd4d0e0da9616846ff5bbd1 100644 (file)
@@ -40,7 +40,9 @@ salomeinclude_HEADERS= \
        VISU_MeshPL.hxx \
        VISU_ScalarMapPL.hxx \
        VISU_CutPlanesPL.hxx \
+       VISU_CutLinesBasePL.hxx \
        VISU_CutLinesPL.hxx \
+       VISU_CutSegmentPL.hxx \
        VISU_IsoSurfacesPL.hxx \
        VISU_DeformedShapePL.hxx \
        VISU_VectorsPL.hxx \
@@ -84,7 +86,9 @@ dist_libVisuPipeLine_la_SOURCES= \
        VISU_MeshPL.cxx \
        VISU_ScalarMapPL.cxx \
        VISU_CutPlanesPL.cxx \
+       VISU_CutLinesBasePL.cxx \
        VISU_CutLinesPL.cxx \
+       VISU_CutSegmentPL.cxx \
        VISU_IsoSurfacesPL.cxx \
        VISU_DeformedShapePL.cxx \
        VISU_VectorsPL.cxx \
diff --git a/src/PIPELINE/VISU_CutLinesBasePL.cxx b/src/PIPELINE/VISU_CutLinesBasePL.cxx
new file mode 100644 (file)
index 0000000..1337090
--- /dev/null
@@ -0,0 +1,40 @@
+//  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// File:    VISU_CutLinesBasePL.cxx
+// Author:  Oleg UVAROV
+// Module : VISU
+//
+#include "VISU_CutLinesBasePL.hxx"
+
+#include <vtkObjectFactory.h>
+
+//----------------------------------------------------------------------------
+vtkStandardNewMacro(VISU_CutLinesBasePL);
+
+
+//----------------------------------------------------------------------------
+VISU_CutLinesBasePL
+::VISU_CutLinesBasePL()
+{
+  SetIsShrinkable(false);
+  SetIsFeatureEdgesAllowed(false);
+}
diff --git a/src/PIPELINE/VISU_CutLinesBasePL.hxx b/src/PIPELINE/VISU_CutLinesBasePL.hxx
new file mode 100644 (file)
index 0000000..d3ed3d0
--- /dev/null
@@ -0,0 +1,98 @@
+//  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// File:    VISU_CutLinesBasePL.hxx
+// Author:  Oleg UVAROV
+// Module : VISU
+//
+#ifndef VISU_CutLinesBasePL_HeaderFile
+#define VISU_CutLinesBasePL_HeaderFile
+
+#include "VISUPipeline.hxx"
+#include "VISU_CutPlanesPL.hxx"
+
+//----------------------------------------------------------------------------
+class VISU_PIPELINE_EXPORT VISU_CutLinesBasePL : public VISU_CutPlanesPL
+{
+public:
+  vtkTypeMacro(VISU_CutLinesBasePL,VISU_CutPlanesPL);
+
+  static 
+  VISU_CutLinesBasePL* 
+  New();
+
+public:
+  //! Returns direction that is defined by position & orientation of the basic and tool planes
+  const vtkFloatingPointType* 
+  GetRealDirLn()
+  {
+    return myRealDirLn;
+  }
+
+  /*! 
+    Returns direction that corresponds to the myRealDirLn,
+    but has the same direction as main axis.
+  */
+  const vtkFloatingPointType* 
+  GetDirLn()
+  {
+    return myDirLn;
+  }
+
+  /*!
+    Returns coordinates of 3D point that shows 
+    where is the first intersection of the given mesh.
+    with the defined direction.
+  */
+  const vtkFloatingPointType* 
+  GetBasePnt()
+  { 
+    return myBasePnt;
+  }
+
+  /*!
+    Returns three floating point numbers that defines the following values:
+    1. Distance between the initial point of intersection and origin of coordinates;
+    2. Distance between the last point of intersection and origin of coordinates;
+    3. Distance between the last point and initial points of intersection.
+    with the defined direction.
+  */
+  const vtkFloatingPointType* 
+  GetBoundPrjLn()
+  {
+    return myBoundPrjLn;
+  }
+
+protected:
+  VISU_CutLinesBasePL();
+
+  vtkFloatingPointType myDirLn[3];
+  vtkFloatingPointType myRealDirLn[3];
+  vtkFloatingPointType myBoundPrjLn[3];
+  vtkFloatingPointType myBasePnt[3];
+
+private:
+  VISU_CutLinesBasePL(const VISU_CutLinesBasePL&);  // Not implemented.
+  void operator=(const VISU_CutLinesBasePL&);  // Not implemented.
+};
+
+
+#endif
index 7fcfb1fd4d11b8308a11ece0f670a0f4351e6388..f6980dd505766abc1a9182f2d42221a068c03691 100644 (file)
@@ -39,9 +39,6 @@ vtkStandardNewMacro(VISU_CutLinesPL);
 VISU_CutLinesPL
 ::VISU_CutLinesPL()
 {
-  SetIsShrinkable(false);
-  SetIsFeatureEdgesAllowed(false);
-
   myCondition = 1;
   myPosition = 0;
 }
index 5607bf3a2ad200281b1f6b5acfe876c03df35c26..afe46a3c6bea142ebb11981c2e70ebc2bf557189 100644 (file)
 #define VISU_CutLinesPL_HeaderFile
 
 #include "VISUPipeline.hxx"
-#include "VISU_CutPlanesPL.hxx"
+#include "VISU_CutLinesBasePL.hxx"
 
 class vtkAppendPolyData;
 
 
 //----------------------------------------------------------------------------
-class VISU_PIPELINE_EXPORT VISU_CutLinesPL : public VISU_CutPlanesPL
+class VISU_PIPELINE_EXPORT VISU_CutLinesPL : public VISU_CutLinesBasePL
 {
 public:
-  vtkTypeMacro(VISU_CutLinesPL,VISU_CutPlanesPL);
+  vtkTypeMacro(VISU_CutLinesPL,VISU_CutLinesBasePL);
 
   static 
   VISU_CutLinesPL* 
@@ -82,47 +82,6 @@ public:
                int thePlaneCondition,
                vtkFloatingPointType theDisplacement);
 
-  //! Returns direction that is defined by position & orientation of the basic and tool planes
-  const vtkFloatingPointType* 
-  GetRealDirLn()
-  {
-    return myRealDirLn;
-  }
-
-  /*! 
-    Returns direction that corresponds to the myRealDirLn,
-    but has the same direction as main axis.
-  */
-  const vtkFloatingPointType* 
-  GetDirLn()
-  {
-    return myDirLn;
-  }
-
-  /*!
-    Returns coordinates of 3D point that shows 
-    where is the first intersection of the given mesh.
-    with the defined direction.
-  */
-  const vtkFloatingPointType* 
-  GetBasePnt()
-  { 
-    return myBasePnt;
-  }
-
-  /*!
-    Returns three floating point numbers that defines the following values:
-    1. Distance between the initial point of intersection and origin of coordinates;
-    2. Distance between the last point of intersection and origin of coordinates;
-    3. Distance between the last point and initial points of intersection.
-    with the defined direction.
-  */
-  const vtkFloatingPointType* 
-  GetBoundPrjLn()
-  {
-    return myBoundPrjLn;
-  }
-
 protected:
   VISU_CutLinesPL();
 
@@ -131,10 +90,6 @@ protected:
   DoShallowCopy(VISU_PipeLine *thePipeLine,
                bool theIsCopyInput);
 
-  vtkFloatingPointType myDirLn[3];
-  vtkFloatingPointType myRealDirLn[3];
-  vtkFloatingPointType myBoundPrjLn[3];
-  vtkFloatingPointType myBasePnt[3];
   vtkFloatingPointType myPosition;
   int myCondition;
 
diff --git a/src/PIPELINE/VISU_CutSegmentPL.cxx b/src/PIPELINE/VISU_CutSegmentPL.cxx
new file mode 100644 (file)
index 0000000..2e1fcfe
--- /dev/null
@@ -0,0 +1,216 @@
+//  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// File:    VISU_CutSegmentPL.hxx
+// Author:  Oleg UVAROV
+// Module : VISU
+//
+#include "VISU_CutSegmentPL.hxx"
+#include "VISU_PipeLineUtils.hxx"
+
+#include <vtkAppendPolyData.h>
+
+//----------------------------------------------------------------------------
+vtkStandardNewMacro(VISU_CutSegmentPL);
+
+
+//----------------------------------------------------------------------------
+VISU_CutSegmentPL
+::VISU_CutSegmentPL()
+{
+}
+
+//----------------------------------------------------------------------------
+void
+VISU_CutSegmentPL
+::DoShallowCopy(VISU_PipeLine *thePipeLine,
+               bool theIsCopyInput)
+{
+  Superclass::DoShallowCopy(thePipeLine, theIsCopyInput);
+
+  if(VISU_CutSegmentPL *aPipeLine = dynamic_cast<VISU_CutSegmentPL*>(thePipeLine)){
+    vtkFloatingPointType x, y, z;
+    aPipeLine->GetPoint1(x, y, z);
+    SetPoint1(x, y, z);
+    aPipeLine->GetPoint2(x, y, z);
+    SetPoint2(x, y, z);
+  }
+}
+
+//----------------------------------------------------------------------------
+void
+VISU_CutSegmentPL
+::Init()
+{
+  Superclass::Init();
+
+  vtkFloatingPointType aBounds[6];
+  GetMergedInput()->GetBounds(aBounds);
+
+  for( int i = 0; i < 3; i++ ) {
+    vtkFloatingPointType min = aBounds[ 2*i ];
+    vtkFloatingPointType max = aBounds[ 2*i+1 ];
+    myPoint1[ i ] = i == 1 ? min : ( min + max ) / 2;
+    myPoint2[ i ] = i == 1 ? max : ( min + max ) / 2;
+  }
+}
+
+//----------------------------------------------------------------------------
+void
+VISU_CutSegmentPL
+::SetPoint1(vtkFloatingPointType theX,
+           vtkFloatingPointType theY,
+           vtkFloatingPointType theZ )
+{
+  myPoint1[0] = theX;
+  myPoint1[1] = theY;
+  myPoint1[2] = theZ;
+}
+
+//----------------------------------------------------------------------------
+void
+VISU_CutSegmentPL
+::GetPoint1(vtkFloatingPointType& theX,
+           vtkFloatingPointType& theY,
+           vtkFloatingPointType& theZ )
+{
+  theX = myPoint1[0];
+  theY = myPoint1[1];
+  theZ = myPoint1[2];
+}
+
+//----------------------------------------------------------------------------
+void
+VISU_CutSegmentPL
+::SetPoint2(vtkFloatingPointType theX,
+           vtkFloatingPointType theY,
+           vtkFloatingPointType theZ )
+{
+  myPoint2[0] = theX;
+  myPoint2[1] = theY;
+  myPoint2[2] = theZ;
+}
+
+//----------------------------------------------------------------------------
+void
+VISU_CutSegmentPL
+::GetPoint2(vtkFloatingPointType& theX,
+           vtkFloatingPointType& theY,
+           vtkFloatingPointType& theZ )
+{
+  theX = myPoint2[0];
+  theY = myPoint2[1];
+  theZ = myPoint2[2];
+}
+
+//----------------------------------------------------------------------------
+vtkDataSet* 
+VISU_CutSegmentPL
+::InsertCustomPL()
+{
+  return myAppendPolyData->GetOutput();
+}
+
+//----------------------------------------------------------------------------
+void
+VISU_CutSegmentPL
+::Update()
+{
+  vtkDataSet* aMergedInput = GetMergedInput();
+  if(VISU::IsQuadraticData(aMergedInput)) // Bug 0020123, note 0005343
+    throw std::runtime_error("Impossible to build presentation");
+
+  vtkFloatingPointType aVector12[3], aVector21[3];
+  VISU::Sub( myPoint2, myPoint1, aVector12 );
+  VISU::Sub( myPoint1, myPoint2, aVector21 );
+
+  double aPrecision = 1.0 / VTK_LARGE_FLOAT;
+  double aNorm = vtkMath::Normalize( aVector12 );
+  if( aNorm < aPrecision )
+    return;
+
+  // compute two vectors which are orthogonal to the line between the input points
+  // these vectors could be used as normals of two planes, intersected exactly at this line
+  // origin of these planes should be places at one of the input points
+  vtkFloatingPointType aVector1[3], aVector2[3];
+  vtkMath::Perpendiculars( aVector12, aVector1, aVector2, 0 );
+
+  ClearAppendPolyData(myAppendPolyData);
+
+  SetPartPosition(1);
+
+  vtkFloatingPointType aBounds[6];
+  GetMergedInput()->GetBounds(aBounds);
+
+  // check if the input is planar -  in this case one cut plane will be enough
+  // (besides, the second cut corrupts the resulting output, splitting it to points)
+  bool isPlanar = true;
+  vtkFloatingPointType aNormal[3] = { 0.0, 0.0, 0.0 };
+  if( fabs( aBounds[0] - aBounds[1] ) < aPrecision )
+    aNormal[0] = 1.0;
+  else if( fabs( aBounds[2] - aBounds[3] ) < aPrecision )
+    aNormal[1] = 1.0;
+  else if( fabs( aBounds[4] - aBounds[5] ) < aPrecision )
+    aNormal[2] = 1.0;
+  else
+    isPlanar = false;
+
+  if( isPlanar ) {
+    // choose a vector which is not collinear with normal of the plane
+    vtkFloatingPointType aCross[3];
+    vtkMath::Cross( aVector1, aNormal, aCross );
+    bool isFirst = vtkMath::Norm( aCross ) > aPrecision;
+    VISU_CutPlanesPL::CutWithPlane(myAppendPolyData, GetMergedInput(), isFirst ? aVector1 : aVector2, myPoint1);
+    myAppendPolyData->Update();
+  }
+  else {
+    vtkAppendPolyData *anAppendPolyData = vtkAppendPolyData::New();
+
+    VISU_CutPlanesPL::CutWithPlane(anAppendPolyData, GetMergedInput(), aVector1, myPoint1);
+    vtkDataSet *aDataSet = anAppendPolyData->GetOutput();
+    aDataSet->Update();
+
+    VISU_CutPlanesPL::CutWithPlane(myAppendPolyData, aDataSet, aVector2, myPoint1);
+    myAppendPolyData->Update();
+
+    anAppendPolyData->Delete();
+  }
+
+  // calculate values for building of table
+  for (int i = 0; i<3 ; i++) {
+    myRealDirLn[i] = myDirLn[i] = aVector12[i];
+    if(myDirLn[i] < 0.0) 
+      myDirLn[i] = -1.0*myDirLn[i]; //enk:: correction of bug Bug PAL10401
+  }
+
+  GetBoundProject(myBoundPrjLn, 
+                 aBounds, 
+                 myDirLn);
+
+  VISU::Mul(myDirLn,
+           myBoundPrjLn[0],
+           myBasePnt);
+  
+  CorrectPnt(myBasePnt,
+            aBounds);
+
+  VISU_ScalarMapPL::Update();
+}
diff --git a/src/PIPELINE/VISU_CutSegmentPL.hxx b/src/PIPELINE/VISU_CutSegmentPL.hxx
new file mode 100644 (file)
index 0000000..9ead72e
--- /dev/null
@@ -0,0 +1,96 @@
+//  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// File:    VISU_CutSegmentPL.hxx
+// Author:  Oleg UVAROV
+// Module : VISU
+//
+#ifndef VISU_CutSegmentPL_HeaderFile
+#define VISU_CutSegmentPL_HeaderFile
+
+#include "VISUPipeline.hxx"
+#include "VISU_CutLinesBasePL.hxx"
+
+
+//----------------------------------------------------------------------------
+class VISU_PIPELINE_EXPORT VISU_CutSegmentPL : public VISU_CutLinesBasePL
+{
+public:
+  vtkTypeMacro(VISU_CutSegmentPL,VISU_CutLinesBasePL);
+
+  static 
+  VISU_CutSegmentPL* 
+  New();
+
+  virtual 
+  void
+  SetPoint1(vtkFloatingPointType theX,
+           vtkFloatingPointType theY,
+           vtkFloatingPointType theZ);
+
+  virtual 
+  void
+  GetPoint1(vtkFloatingPointType& theX,
+           vtkFloatingPointType& theY,
+           vtkFloatingPointType& theZ);
+
+  virtual 
+  void
+  SetPoint2(vtkFloatingPointType theX,
+           vtkFloatingPointType theY,
+           vtkFloatingPointType theZ);
+
+  virtual 
+  void
+  GetPoint2(vtkFloatingPointType& theX,
+           vtkFloatingPointType& theY,
+           vtkFloatingPointType& theZ);
+
+public:
+  virtual
+  void
+  Init();
+
+  vtkDataSet*
+  InsertCustomPL();
+
+  virtual
+  void
+  Update();
+
+protected:
+  VISU_CutSegmentPL();
+
+  virtual
+  void
+  DoShallowCopy(VISU_PipeLine *thePipeLine,
+               bool theIsCopyInput);
+
+  vtkFloatingPointType myPoint1[3];
+  vtkFloatingPointType myPoint2[3];
+
+private:
+  VISU_CutSegmentPL(const VISU_CutSegmentPL&);  // Not implemented.
+  void operator=(const VISU_CutSegmentPL&);  // Not implemented.
+};
+
+
+#endif
index 29cb40eefefdca6eed3760b109fadd07af7b33a7..ab4caa6757c9c6160612dffebca4d1bfaadde5b8 100644 (file)
@@ -56,6 +56,7 @@ salomeinclude_HEADERS= \
        VisuGUI_DeformedShapeDlg.h \
        VisuGUI_IsoSurfacesDlg.h \
        VisuGUI_CutLinesDlg.h \
+       VisuGUI_CutSegmentDlg.h \
        VisuGUI_CutPlanesDlg.h \
        VisuGUI_StreamLinesDlg.h \
        VisuGUI_VectorsDlg.h \
@@ -101,6 +102,7 @@ dist_libVISU_la_SOURCES= \
        VisuGUI_DeformedShapeDlg.cxx \
        VisuGUI_IsoSurfacesDlg.cxx \
        VisuGUI_CutLinesDlg.cxx \
+       VisuGUI_CutSegmentDlg.cxx \
        VisuGUI_CutPlanesDlg.cxx \
        VisuGUI_StreamLinesDlg.cxx \
        VisuGUI_VectorsDlg.cxx \
@@ -148,6 +150,7 @@ MOC_FILES= \
        VisuGUI_DeformedShapeDlg_moc.cxx \
        VisuGUI_IsoSurfacesDlg_moc.cxx \
        VisuGUI_CutLinesDlg_moc.cxx \
+       VisuGUI_CutSegmentDlg_moc.cxx \
        VisuGUI_CutPlanesDlg_moc.cxx \
        VisuGUI_StreamLinesDlg_moc.cxx \
        VisuGUI_VectorsDlg_moc.cxx \
index 143e7563c7bfd2c17191c387b3701f96735ea3f5..a5b74650858a6053219f65676904cd0c834f1c16 100644 (file)
             <source>ICON_CUT_LINES</source>
             <translation>Visu_cutlines.png</translation>
         </message>
+        <message>
+            <source>ICON_CUT_SEGMENT</source>
+            <translation>Visu_cutsegment.png</translation>
+        </message>
         <message>
             <source>ICON_CUT_PLANES</source>
             <translation>Visu_cutplanes.png</translation>
             <source>ICON_TREE_CUT_LINES_GROUPS</source>
             <translation>Visu_tree_cutlines_gr.png</translation>
         </message>
+        <message>
+            <source>ICON_TREE_CUT_SEGMENT</source>
+            <translation>Visu_tree_cutsegment.png</translation>
+        </message>
+        <message>
+            <source>ICON_TREE_CUT_SEGMENT_GROUPS</source>
+            <translation>Visu_tree_cutsegment_gr.png</translation>
+        </message>
         <message>
             <source>ICON_TREE_CUT_PLANES</source>
             <translation>Visu_tree_cutplanes.png</translation>
index 6e63b37858af7e42d1c74455556c3ae08abee620..16a5edf9bcfaa535aa0ae3604d17b43c84aeedd6 100644 (file)
@@ -133,14 +133,22 @@ number of time stamps or number of components is not the same!</translation>
             <source>VISU_COS_SWEEP</source>
             <translation>Cosinusoidal ( (1 - cos(t))/2 )</translation>
         </message>
-        <message>
-            <source>VISU_CUT_LINES_PREF</source>
-            <translation>Cut Lines preferences</translation>
-        </message>
         <message>
             <source>VISU_CUT_LINES</source>
             <translation>Cut Lines</translation>
         </message>
+        <message>
+            <source>VISU_CUT_LINES_SEGMENT</source>
+            <translation>Cut Lines/Segment</translation>
+        </message>
+        <message>
+            <source>VISU_CUT_LINES_SEGMENT_PREF</source>
+            <translation>Cut Lines/Segment preferences</translation>
+        </message>
+        <message>
+            <source>VISU_CUT_SEGMENT</source>
+            <translation>Cut Segment</translation>
+        </message>
         <message>
             <source>VISU_CUT_PLANES</source>
             <translation>Cut Planes</translation>
@@ -1037,6 +1045,10 @@ Please, refer to the documentation.</translation>
             <source>MEN_CUT_LINES</source>
             <translation>Cut Lines</translation>
         </message>
+        <message>
+            <source>MEN_CUT_SEGMENT</source>
+            <translation>Cut Segment</translation>
+        </message>
         <message>
             <source>MEN_CUT_PLANES</source>
             <translation>Cut Planes</translation>
@@ -1780,6 +1792,57 @@ Please, provide non-empty resulting presentation.</translation>
             <translation>Orientation</translation>
         </message>
     </context>
+    <context>
+        <name>VisuGUI_CutSegmentDlg</name>
+        <message>
+            <source>LBL_ABSOLUTE_LENGTH</source>
+            <translation>Use absolute length</translation>
+        </message>
+        <message>
+            <source>LBL_CUT_SEGMENT</source>
+            <translation>Cut Segment</translation>
+        </message>
+        <message>
+            <source>LBL_GENERATE_CURVES</source>
+            <translation>Generate Curve</translation>
+        </message>
+        <message>
+            <source>LBL_GENERATE_TABLE</source>
+            <translation>Generate Data Table</translation>
+        </message>
+        <message>
+            <source>LBL_INVERT_CURVES</source>
+            <translation>Invert curve</translation>
+        </message>
+        <message>
+            <source>LBL_POINT_1</source>
+            <translation>Point 1:</translation>
+        </message>
+        <message>
+            <source>LBL_POINT_2</source>
+            <translation>Point 2:</translation>
+        </message>
+        <message>
+            <source>LBL_SEGMENT</source>
+            <translation>Segment</translation>
+        </message>
+        <message>
+            <source>LBL_SHOW_PREVIEW</source>
+            <translation>Show preview</translation>
+        </message>
+        <message>
+            <source>LBL_X</source>
+            <translation>X</translation>
+        </message>
+        <message>
+            <source>LBL_Y</source>
+            <translation>Y</translation>
+        </message>
+        <message>
+            <source>LBL_Z</source>
+            <translation>Z</translation>
+        </message>
+    </context>
     <context>
         <name>VisuGUI_CutPlanesDlg</name>
         <message>
index afaa6c4341fd7063d7ea428e0e224ae1a2361ea9..bbaaa4e75e2b0f427709b30cbed908f1bf9098a2 100644 (file)
 #include "VISU_CutLines_i.hh"
 #include "VisuGUI_CutLinesDlg.h"
 
+#include "VISU_CutSegment_i.hh"
+#include "VisuGUI_CutSegmentDlg.h"
+
 #include "VISU_StreamLines_i.hh"
 #include "VisuGUI_StreamLinesDlg.h"
 
@@ -599,14 +602,26 @@ void VisuGUI::OnLoadComponentData()
 
 void
 CreateCurves( SalomeApp_Module* theModule,
-              VISU::CutLines_i* thePrs,
+              VISU::CutLinesBase_i* thePrs,
               QDialog* theDlg,
               const bool theCreate = true )
 {
   if ( !thePrs )
     return;
-  VisuGUI_CutLinesDlg* aCutDlg = dynamic_cast<VisuGUI_CutLinesDlg*>( theDlg );
-  if ( !aCutDlg )
+
+  // temporary code, to be revised (VisuGUI_CutLinesDlg and VisuGUI_CutSegmentDlg classes
+  // should have common intermediate interface with at least two methods called below)
+  bool isGenerateTable = false;
+  bool isGenerateCurves = false;
+  if ( VisuGUI_CutLinesDlg* aCutDlg = dynamic_cast<VisuGUI_CutLinesDlg*>( theDlg ) ) {
+    isGenerateTable = aCutDlg->isGenerateTable();
+    isGenerateCurves = aCutDlg->isGenerateCurves();
+  }
+  else if ( VisuGUI_CutSegmentDlg* aCutDlg = dynamic_cast<VisuGUI_CutSegmentDlg*>( theDlg ) ) {
+    isGenerateTable = aCutDlg->isGenerateTable();
+    isGenerateCurves = aCutDlg->isGenerateCurves();
+  }
+  else
     return;
 
   _PTR(Study)   aStudy = GetCStudy( GetAppStudy( theModule ) );
@@ -650,9 +665,9 @@ CreateCurves( SalomeApp_Module* theModule,
     }
   }
 
-  if ( aCutDlg->isGenerateTable() ) {
+  if ( isGenerateTable ) {
     GetVisuGen( theModule )->CreateTable( thePrs->GetEntry().c_str() );
-    if ( aCutDlg->isGenerateCurves() ) {
+    if ( isGenerateCurves ) {
       if ( aSObject ) {
         _PTR(StudyBuilder) aBuilder = aStudy->NewBuilder();
         _PTR(ChildIterator) aIter = aStudy->NewChildIterator(aSObject);
@@ -795,6 +810,15 @@ VisuGUI
     emit presentationCreated(aPrs);
 }
 
+void
+VisuGUI
+::OnCreateCutSegment()
+{
+  Prs3d_i* aPrs = CreatePrs3d<VISU::CutSegment_i,VisuGUI_CutSegmentDlg,0>(this);
+  if (aPrs)
+    emit presentationCreated(aPrs);
+}
+
 void
 VisuGUI
 ::OnCreateStreamLines()
@@ -1080,6 +1104,16 @@ VisuGUI
     EditPrs3d<VISU::CutLines_i, VisuGUI_CutLinesDlg, 0>(this, anIO, aPrs3d);
 }
 
+//----------------------------------------------------------------------------
+void
+VisuGUI
+::OnEditCutSegment()
+{
+  Handle(SALOME_InteractiveObject) anIO;
+  if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
+    EditPrs3d<VISU::CutSegment_i, VisuGUI_CutSegmentDlg, 0>(this, anIO, aPrs3d);
+}
+
 //----------------------------------------------------------------------------
 void
 VisuGUI
@@ -1464,7 +1498,9 @@ VisuGUI
   _PTR(SObject) aSObject = aSelectionItem.myObjectInfo.mySObject;
   VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase;
 
-  if((aBase && aBase->GetType() == VISU::TCUTLINES) || IsSObjectTable(aSObject)) {
+  if(aBase &&
+     (aBase->GetType() == VISU::TCUTLINES || aBase->GetType() == VISU::TCUTSEGMENT) ||
+     IsSObjectTable(aSObject)) {
     GetVisuGen( this )->CreateTable( aSObject->GetID().c_str() );
     UpdateObjBrowser(this);
   }
@@ -1884,7 +1920,7 @@ VisuGUI
     QString aStr = aSel.parameter(i, "type" ).toString();
     if (aStr == "VISU::TSCALARMAP" || aStr == "VISU::TISOSURFACES" ||
         aStr == "VISU::TDEFORMEDSHAPE" || aStr == "VISU::TCUTPLANES" ||
-        aStr == "VISU::TCUTLINES" || aStr == "VISU::TVECTORS" ||
+        aStr == "VISU::TCUTLINES" || aStr == "VISU::TCUTSEGMENT" || aStr == "VISU::TVECTORS" ||
         aStr == "VISU::TSTREAMLINES" || aStr == "VISU::TPLOT3D" ||
         aStr == "VISU::TSCALARMAPONDEFORMEDSHAPE" || aStr == "VISU::TCOLOREDPRS3DHOLDER" ||
         aStr == "VISU::TTABLE" || aStr == "VISU::TCURVE" || aStr == "VISU::TCONTAINER" ||
@@ -2097,6 +2133,9 @@ VisuGUI
     case VISU::TCUTLINES:
       TSameAsFactory<VISU::TCUTLINES>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp, false);
       break;
+    case VISU::TCUTSEGMENT:
+      TSameAsFactory<VISU::TCUTSEGMENT>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp, false);
+      break;
     case VISU::TISOSURFACES:
       TSameAsFactory<VISU::TISOSURFACES>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp, false);
       break;
@@ -2380,6 +2419,11 @@ VisuGUI
                 tr("MEN_CUT_LINES"), "", 0, aParent, false,
                 this, SLOT(OnCreateCutLines()));
 
+  aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_CUT_SEGMENT"));
+  createAction( VISU_CUT_SEGMENT, tr("MEN_CUT_SEGMENT"), QIcon(aPixmap),
+                tr("MEN_CUT_SEGMENT"), "", 0, aParent, false,
+                this, SLOT(OnCreateCutSegment()));
+
   aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_PLOT_3D"));
   createAction( VISU_PLOT_3D, tr("MEN_PLOT_3D"), QIcon(aPixmap),
                 tr("MEN_PLOT_3D"), "", 0, aParent, false,
@@ -2585,6 +2629,10 @@ VisuGUI
                 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
                 this, SLOT(OnEditCutLines()));
 
+  createAction( VISU_EDIT_CUTSEGMENT, tr("MEN_EDIT_PRS"), QIcon(),
+                tr("MEN_EDIT_PRS"), "", 0, aParent, false,
+                this, SLOT(OnEditCutSegment()));
+
   createAction( VISU_EDIT_ISOSURFACES, tr("MEN_EDIT_PRS"), QIcon(),
                 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
                 this, SLOT(OnEditIsoSurfaces()));
@@ -2745,6 +2793,7 @@ VisuGUI
   createMenu( VISU_ISO_SURFACES, aMenuId, 10 ); // iso surfaces
   createMenu( VISU_CUT_PLANES, aMenuId, 10 ); // cut planes
   createMenu( VISU_CUT_LINES, aMenuId, 10 ); // cut lines
+  createMenu( VISU_CUT_SEGMENT, aMenuId, 10 ); // cut segment
   createMenu( VISU_STREAM_LINES, aMenuId, 10 ); // stream lines
   createMenu( VISU_PLOT_3D, aMenuId, 10 ); // Plot3d
   createMenu( VISU_DEFORMED_SHAPE_AND_SCALAR_MAP, aMenuId, 10 ); // scalar map on deformed shape
@@ -2777,6 +2826,7 @@ VisuGUI
   createTool( VISU_ISO_SURFACES, aToolId );
   createTool( VISU_CUT_PLANES, aToolId );
   createTool( VISU_CUT_LINES, aToolId );
+  createTool( VISU_CUT_SEGMENT, aToolId );
   createTool( VISU_STREAM_LINES, aToolId );
   createTool( VISU_PLOT_3D, aToolId );
   createTool( VISU_DEFORMED_SHAPE_AND_SCALAR_MAP, aToolId );
@@ -2820,6 +2870,7 @@ VisuGUI
   mgr->insert( action( VISU_ISO_SURFACES ), -1, -1, -1 ); // iso surface
   mgr->insert( action( VISU_CUT_PLANES ), -1, -1, -1 ); // cut planes
   mgr->insert( action( VISU_CUT_LINES ), -1, -1, -1 ); // cut lines
+  mgr->insert( action( VISU_CUT_SEGMENT ), -1, -1, -1 ); // cut segment
   mgr->insert( action( VISU_DEFORMED_SHAPE ), -1, -1, -1 ); // deformed shape
   mgr->insert( action( VISU_VECTORS ), -1, -1, -1 ); // vectors
   mgr->insert( action( VISU_STREAM_LINES ), -1, -1, -1 ); // stream lines
@@ -2836,6 +2887,7 @@ VisuGUI
   mgr->insert( action( VISU_EDIT_DEFORMEDSHAPE ), -1, -1, -1 );
   mgr->insert( action( VISU_EDIT_CUTPLANES ), -1, -1, -1 );
   mgr->insert( action( VISU_EDIT_CUTLINES ), -1, -1, -1 );
+  mgr->insert( action( VISU_EDIT_CUTSEGMENT ), -1, -1, -1 );
   mgr->insert( action( VISU_EDIT_ISOSURFACES ), -1, -1, -1 );
   mgr->insert( action( VISU_EDIT_VECTORS ), -1, -1, -1 );
   mgr->insert( action( VISU_EDIT_STREAMLINES ), -1, -1, -1 );
@@ -2938,10 +2990,10 @@ VisuGUI
   // Rules
 
   QString aPrsAll ("'VISU::TSCALARMAP' 'VISU::TISOSURFACES' 'VISU::TDEFORMEDSHAPE' 'VISU::TCUTPLANES' "
-                   "'VISU::TCUTLINES' 'VISU::TVECTORS' 'VISU::TSTREAMLINES' 'VISU::TPLOT3D' "
+                   "'VISU::TCUTLINES' 'VISU::TCUTSEGMENT' 'VISU::TVECTORS' 'VISU::TSTREAMLINES' 'VISU::TPLOT3D' "
                   "'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP' 'VISU::TCOLOREDPRS3DHOLDER'");
   QString aSimplePrsAll ("'VISU::TSCALARMAP' 'VISU::TISOSURFACES' 'VISU::TDEFORMEDSHAPE' 'VISU::TCUTPLANES' "
-                        "'VISU::TCUTLINES' 'VISU::TVECTORS' 'VISU::TSTREAMLINES' 'VISU::TPLOT3D' "
+                        "'VISU::TCUTLINES' 'VISU::TCUTSEGMENT' 'VISU::TVECTORS' 'VISU::TSTREAMLINES' 'VISU::TPLOT3D' "
                         "'VISU::TSCALARMAPONDEFORMEDSHAPE'");
 
   // VISU root commands
@@ -2956,6 +3008,7 @@ VisuGUI
   mgr->setRule( action( VISU_ISO_SURFACES ), aRule );
   mgr->setRule( action( VISU_CUT_PLANES ), aRule );
   mgr->setRule( action( VISU_CUT_LINES ), aRule );
+  mgr->setRule( action( VISU_CUT_SEGMENT ), aRule );
   mgr->setRule( action( VISU_PLOT_3D ), aRule );
   aRule += " and nbComponents>1";
   mgr->setRule( action( VISU_DEFORMED_SHAPE ), aRule );
@@ -3039,7 +3092,7 @@ VisuGUI
                         " 'VISU::TPLOT3D' 'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP' 'VISU::TPOINTMAP3D'}";
   QString aShrinkType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TDEFORMEDSHAPE' 'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP' 'VISU::TPOINTMAP3D'}";
   QString aLineType   = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TSCALARMAP' 'VISU::TISOSURFACES' 'VISU::TDEFORMEDSHAPE' "
-                        "'VISU::TCUTPLANES' 'VISU::TCUTLINES' 'VISU::TSTREAMLINES' 'VISU::TPLOT3D' 'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP' 'VISU::TPOINTMAP3D'}";
+                        "'VISU::TCUTPLANES' 'VISU::TCUTLINES' 'VISU::TCUTSEGMENT' 'VISU::TSTREAMLINES' 'VISU::TPLOT3D' 'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP' 'VISU::TPOINTMAP3D'}";
 
   QString aFeatureEdgesType =  " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP''VISU::TDEFORMEDSHAPE' 'VISU::TSCALARMAPONDEFORMEDSHAPE'}";
 
@@ -3112,6 +3165,8 @@ VisuGUI
                "selcount=1 and type='VISU::TCUTPLANES'" );
   mgr->setRule( action( VISU_EDIT_CUTLINES ),
                "selcount=1 and type='VISU::TCUTLINES'" );
+  mgr->setRule( action( VISU_EDIT_CUTSEGMENT ),
+               "selcount=1 and type='VISU::TCUTSEGMENT'" );
   mgr->setRule( action( VISU_EDIT_ISOSURFACES ),
                "selcount=1 and type='VISU::TISOSURFACES'" );
   mgr->setRule( action( VISU_EDIT_VECTORS ),
@@ -3123,7 +3178,7 @@ VisuGUI
   mgr->setRule( action( VISU_EDIT_POINTMAP3D ),
                "selcount=1 and type='VISU::TPOINTMAP3D'" );
 
-  aRule = "selcount=1 and type='VISU::TCUTLINES' and nbNamedChildren=0";
+  aRule = "selcount=1 and $type in {'VISU::TCUTLINES' 'VISU::TCUTSEGMENT'} and nbNamedChildren=0";
   mgr->setRule( action( VISU_CREATE_TABLE ), aRule );
 
   aRule = "selcount=1 and ($type in {" + aSimplePrsAll + "})";
@@ -3686,10 +3741,10 @@ void VisuGUI::createPreferences()
   setPreferenceProperty( bhh, "max", 100 );
 
   // TAB: "CutLines"
-  int cutLineTab = addPreference( tr( "VISU_CUT_LINES" ) );
+  int cutLineTab = addPreference( tr( "VISU_CUT_LINES_SEGMENT" ) );
 
   // group: "CutLines preferences"
-  int cutLineGr = addPreference( tr( "VISU_CUT_LINES_PREF" ), cutLineTab );
+  int cutLineGr = addPreference( tr( "VISU_CUT_LINES_SEGMENT_PREF" ), cutLineTab );
   setPreferenceProperty( cutLineGr, "columns", 1 );
   addPreference( tr( "Show preview" ), cutLineGr, LightApp_Preferences::Bool, "VISU", "show_preview" );
   addPreference( tr( "Invert all curves" ), cutLineGr, LightApp_Preferences::Bool, "VISU", "invert_all_curves" );
@@ -3851,6 +3906,13 @@ void VisuGUI::createPreferences()
   setPreferenceProperty( sp, "hstretch", 0 );
   setPreferenceProperty( sp, "vstretch", 0 );
 
+  int cut_segment_represent = addPreference( tr( "VISU_CUT_SEGMENT" ), representGr, LightApp_Preferences::Selector, "VISU", "cut_segment_represent" );
+  setPreferenceProperty( cut_segment_represent, "strings", modes3 );
+  setPreferenceProperty( cut_segment_represent, "indexes", indices3 );
+  sp = addPreference( "", representGr, LightApp_Preferences::Space );
+  setPreferenceProperty( sp, "hstretch", 0 );
+  setPreferenceProperty( sp, "vstretch", 0 );
+
   int deformed_shape_represent = addPreference( tr( "VISU_DEFORMED_SHAPE" ), representGr, LightApp_Preferences::Selector, "VISU", "deformed_shape_represent" );
   setPreferenceProperty( deformed_shape_represent, "strings", modes0 );
   setPreferenceProperty( deformed_shape_represent, "indexes", indices0 );
index 58d8f2ce21389863bf7a1fcbf8334475f9b2702a..dff83e2f07953e042f810163c4ba42dc42778042 100644 (file)
@@ -110,6 +110,7 @@ protected slots:
   void OnCreateIsoSurfaces();
   void OnCreateCutPlanes();
   void OnCreateCutLines();
+  void OnCreateCutSegment();
   void OnCreateStreamLines();
   void OnCreatePlot3D();
   void OnCreateManyMesh();
@@ -120,6 +121,7 @@ protected slots:
   void OnEditDeformedShape();
   void OnEditCutPlanes();
   void OnEditCutLines();
+  void OnEditCutSegment();
   void OnEditIsoSurfaces();
   void OnEditVectors();
   void OnEditStreamLines();
index 184aee88e77953e19a7603ea472b2fcc0fac0142..e0bc6e7ba258508a7c9674ae870626b1871c498a 100644 (file)
@@ -39,6 +39,7 @@
 #define VISU_CUT_PLANES             4015
 #define VISU_STREAM_LINES           4016
 #define VISU_CUT_LINES              4017
+#define VISU_CUT_SEGMENT            40181 // like in VISU_en.xml
 #define VISU_PLOT2D                 4018
 #define VISU_PLOT_3D                4019
 #define VISU_DEFORMED_SHAPE_AND_SCALAR_MAP 40110
@@ -96,6 +97,7 @@
 #define VISU_EDIT_DEFORMEDSHAPE     40621
 #define VISU_EDIT_CUTPLANES         40622
 #define VISU_EDIT_CUTLINES          40623
+#define VISU_EDIT_CUTSEGMENT        406231
 #define VISU_EDIT_ISOSURFACES       40624
 #define VISU_EDIT_VECTORS           40625
 #define VISU_EDIT_STREAMLINES       40626
diff --git a/src/VISUGUI/VisuGUI_CutSegmentDlg.cxx b/src/VISUGUI/VisuGUI_CutSegmentDlg.cxx
new file mode 100644 (file)
index 0000000..764f810
--- /dev/null
@@ -0,0 +1,514 @@
+//  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+//  File   : VisuGUI_CutSegmentDlg.cxx
+//  Author : Oleg UVAROV
+//  Module : VISU
+//
+#include "VisuGUI_CutSegmentDlg.h"
+
+#include "VisuGUI.h"
+#include "VisuGUI_Tools.h"
+#include "VisuGUI_ViewTools.h"
+#include "VisuGUI_InputPane.h"
+
+#include "VISU_Gen_i.hh"
+#include "VISU_CutSegment_i.hh"
+#include "VISU_ColoredPrs3dFactory.hh"
+
+#include "VISU_PipeLine.hxx"
+#include "VISU_CutSegmentPL.hxx"
+
+#include "SVTK_ViewWindow.h"
+
+#include "LightApp_Application.h"
+#include "SalomeApp_Study.h"
+
+#include "SUIT_ResourceMgr.h"
+
+#include <QLayout>
+#include <QTabWidget>
+#include <QLabel>
+#include <QPushButton>
+
+#include <vtkAppendPolyData.h>
+#include <vtkCellArray.h>
+#include <vtkDataSetMapper.h>
+#include <vtkFloatArray.h>
+#include <vtkGlyph3D.h>
+#include <vtkGlyphSource2D.h>
+#include <vtkPointData.h>
+#include <vtkPolyData.h>
+#include <vtkPolyDataMapper.h>
+#include <vtkRenderer.h>
+
+using namespace std;
+
+VisuGUI_CutSegmentDlg::VisuGUI_CutSegmentDlg (SalomeApp_Module* theModule)
+  : VisuGUI_ScalarBarBaseDlg(theModule),
+    myPreviewActor(0),
+    myPreviewActorGlyphs(0),
+    myPreviewActorPoints(0)
+{
+  setWindowTitle("Cut Segment Definition");
+  setSizeGripEnabled(true);
+
+  QVBoxLayout* aMainLayout = new QVBoxLayout (this);
+  aMainLayout->setMargin( 7 );
+  aMainLayout->setSpacing(5);
+
+  SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
+  hasInit = false;  
+
+  // Tab pane
+  myTabBox = new QTabWidget(this);
+
+  // Cut Segment
+  QFrame* aCutSegmentPane = new QFrame( this );
+
+  QGroupBox* aSegmentBox = new QGroupBox( tr( "LBL_SEGMENT" ), aCutSegmentPane );
+
+  QLabel* aPoint1Label = new QLabel( tr( "LBL_POINT_1" ), aSegmentBox );
+  QLabel* aPoint1XLabel = new QLabel( tr( "LBL_X" ), aSegmentBox );
+  QLabel* aPoint1YLabel = new QLabel( tr( "LBL_Y" ), aSegmentBox );
+  QLabel* aPoint1ZLabel = new QLabel( tr( "LBL_Z" ), aSegmentBox );
+  QLabel* aPoint2Label = new QLabel( tr( "LBL_POINT_2" ), aSegmentBox );
+  QLabel* aPoint2XLabel = new QLabel( tr( "LBL_X" ), aSegmentBox );
+  QLabel* aPoint2YLabel = new QLabel( tr( "LBL_Y" ), aSegmentBox );
+  QLabel* aPoint2ZLabel = new QLabel( tr( "LBL_Z" ), aSegmentBox );
+  for( int i = 0; i < 3; i++ ) {
+    myPoint1.append( new QtxDoubleSpinBox( aSegmentBox ) );
+    myPoint2.append( new QtxDoubleSpinBox( aSegmentBox ) );
+  }
+
+  QListIterator<QtxDoubleSpinBox*> anIter( myPoint1 + myPoint2 );
+  while( anIter.hasNext() ) {
+    QtxDoubleSpinBox* aSpinBox = anIter.next();
+    aSpinBox->setDecimals( 6 );
+    aSpinBox->setMinimumWidth( 100 );
+  }
+
+  QGridLayout* aSegmentBoxLayout = new QGridLayout( aSegmentBox );
+  aSegmentBoxLayout->addWidget( aPoint1Label,  0, 0 );
+  aSegmentBoxLayout->addWidget( aPoint1XLabel, 0, 1 );
+  aSegmentBoxLayout->addWidget( myPoint1[0],   0, 2 );
+  aSegmentBoxLayout->addWidget( aPoint1YLabel, 0, 3 );
+  aSegmentBoxLayout->addWidget( myPoint1[1],   0, 4 );
+  aSegmentBoxLayout->addWidget( aPoint1ZLabel, 0, 5 );
+  aSegmentBoxLayout->addWidget( myPoint1[2],   0, 6 );
+  aSegmentBoxLayout->addWidget( aPoint2Label,  1, 0 );
+  aSegmentBoxLayout->addWidget( aPoint2XLabel, 1, 1 );
+  aSegmentBoxLayout->addWidget( myPoint2[0],   1, 2 );
+  aSegmentBoxLayout->addWidget( aPoint2YLabel, 1, 3 );
+  aSegmentBoxLayout->addWidget( myPoint2[1],   1, 4 );
+  aSegmentBoxLayout->addWidget( aPoint2ZLabel, 1, 5 );
+  aSegmentBoxLayout->addWidget( myPoint2[2],   1, 6 );
+
+  myPreviewCheck = new QCheckBox( tr( "LBL_SHOW_PREVIEW" ), aCutSegmentPane );
+  myPreviewCheck->setChecked( aResourceMgr->booleanValue( "VISU", "show_preview", false ) );
+
+  myAllCurvesInvertedCheck = new QCheckBox( tr( "LBL_INVERT_CURVES" ), aCutSegmentPane );
+  myAllCurvesInvertedCheck->setChecked( false );
+
+  myUseAbsoluteLengthCheck = new QCheckBox( tr( "LBL_ABSOLUTE_LENGTH" ), aCutSegmentPane );
+  myUseAbsoluteLengthCheck->setChecked( false );
+
+  myCreateTable = new QCheckBox( tr("LBL_GENERATE_TABLE"), aCutSegmentPane );
+  myCreateTable->setChecked( aResourceMgr->booleanValue( "VISU", "generate_data_table", true ) );
+
+  QWidget* aCheckPane = new QWidget( aCutSegmentPane );
+  myCurvesCheck = new QCheckBox( tr( "LBL_GENERATE_CURVES" ), aCheckPane );
+  myCurvesCheck->setChecked( aResourceMgr->booleanValue( "VISU", "generate_curves", true ) );
+  myCurvesCheck->setEnabled( aResourceMgr->booleanValue( "VISU", "generate_data_table", true ) );
+
+  QHBoxLayout* aCheckLayout = new QHBoxLayout( aCheckPane );
+  aCheckLayout->setMargin( 0 );
+  aCheckLayout->setSpacing( 0 );
+  aCheckLayout->insertSpacing( 0, 20 );
+  aCheckLayout->addWidget( myCurvesCheck );
+
+  QVBoxLayout* aCutSegmentLayout = new QVBoxLayout( aCutSegmentPane );
+  aCutSegmentLayout->setMargin( 5 );
+  aCutSegmentLayout->setSpacing( 6 );
+  aCutSegmentLayout->addWidget( aSegmentBox );
+  aCutSegmentLayout->addWidget( myPreviewCheck );
+  aCutSegmentLayout->addWidget( myAllCurvesInvertedCheck );
+  aCutSegmentLayout->addWidget( myUseAbsoluteLengthCheck );
+  aCutSegmentLayout->addWidget( myCreateTable );
+  aCutSegmentLayout->addWidget( aCheckPane );
+  aCutSegmentLayout->addStretch();
+
+  myTabBox->addTab( aCutSegmentPane, tr("LBL_CUT_SEGMENT") );
+
+  myInputPane = new VisuGUI_InputPane(VISU::TCUTSEGMENT, theModule, this);
+  myTabBox->addTab(GetScalarPane(), "Scalar Bar");
+  myTabBox->addTab(myInputPane, "Input");
+
+  aMainLayout->addWidget(myTabBox);
+
+  // Dialog buttons
+  QFrame* aBtnBox = new QFrame(this);
+  QHBoxLayout* aHBLay = new QHBoxLayout( aBtnBox );
+  aBtnBox->setFrameStyle(QFrame::Box | QFrame::Sunken);
+  aBtnBox->setLineWidth( 1 );
+  aHBLay->setSpacing( 5 );
+  aHBLay->setMargin( 11 );
+
+  QPushButton* aOkBtn = new QPushButton (tr("BUT_OK"), aBtnBox);
+  aOkBtn->setAutoDefault( TRUE );
+  aOkBtn->setDefault( true );
+  aHBLay->addWidget(aOkBtn);
+
+  aHBLay->addStretch();
+
+  QPushButton* aCloseBtn = new QPushButton(tr("BUT_CANCEL"), aBtnBox);
+  aHBLay->addWidget(aCloseBtn);
+
+  QPushButton* aHelpBtn = new QPushButton(tr("BUT_HELP"), aBtnBox);
+  aHBLay->addWidget(aHelpBtn);
+
+  aMainLayout->addWidget(aBtnBox);
+
+  // signals and slots connections
+  connect(myPreviewCheck, SIGNAL(toggled(bool))         , this, SLOT(onPreviewCheck(bool)));
+  connect(myAllCurvesInvertedCheck, SIGNAL(toggled(bool)),this, SLOT(onAllCurvesInvertedCheck(bool)));
+  for( int i = 0; i < 3; i++ ) {
+    connect(myPoint1[ i ], SIGNAL(valueChanged(double)), this, SLOT(onPointModified()));
+    connect(myPoint2[ i ], SIGNAL(valueChanged(double)), this, SLOT(onPointModified()));
+  }
+  connect(myCreateTable , SIGNAL(toggled(bool)), myCurvesCheck, SLOT(setEnabled(bool)));
+
+  connect(aOkBtn, SIGNAL(clicked()), this, SLOT(accept()));
+  connect(aCloseBtn, SIGNAL(clicked()), this, SLOT(reject()));
+  connect(aHelpBtn, SIGNAL(clicked()), this, SLOT(onHelp()));
+}
+
+/*!
+  Destructor
+*/
+VisuGUI_CutSegmentDlg::~VisuGUI_CutSegmentDlg()
+{
+  deletePlanes();
+  if (SVTK_ViewWindow* vf = VISU::GetActiveViewWindow<SVTK_ViewWindow>())
+    vf->Repaint();
+}
+
+//------------------------------------------------------------------------------
+void VisuGUI_CutSegmentDlg::initFromPrsObject ( VISU::ColoredPrs3d_i* thePrs,
+                                               bool theInit )
+{
+  if( theInit )
+    myPrsCopy = VISU::TSameAsFactory<VISU::TCUTSEGMENT>().Create(thePrs, VISU::ColoredPrs3d_i::EDoNotPublish);
+
+  VisuGUI_ScalarBarBaseDlg::initFromPrsObject(myPrsCopy, theInit);
+
+  hasInit = true;
+  myCutSegment = VISU::TSameAsFactory<VISU::TCUTSEGMENT>().Create(myPrsCopy, VISU::ColoredPrs3d_i::EDoNotPublish);
+  myCutSegment->CopyCurvesInverted(myPrsCopy->GetCurvesInverted());
+  myAllCurvesInvertedCheck->setChecked( myCutSegment->IsAllCurvesInverted() );
+  myUseAbsoluteLengthCheck->setChecked( myCutSegment->IsUseAbsoluteLength() );
+
+  vtkDataSet* anInput = myCutSegment->GetPipeLine()->GetInput();
+  anInput->Update();
+
+  vtkFloatingPointType bounds[6];
+  anInput->GetBounds( bounds );
+
+  for( int i = 0; i < 3; i++ ) {
+    double min = bounds[ 2*i ], max = bounds[ 2*i+1 ];
+    myPoint1[ i ]->setRange( min, max );
+    myPoint2[ i ]->setRange( min, max );
+
+    myPoint1[ i ]->setSingleStep( ( max - min ) / 10 );
+    myPoint2[ i ]->setSingleStep( ( max - min ) / 10 );
+  }
+
+  double p1[3], p2[3];
+  myPrsCopy->GetPoint1( p1[0], p1[1], p1[2] );
+  myPrsCopy->GetPoint2( p2[0], p2[1], p2[2] );
+
+  for( int i = 0; i < 3; i++ ) {
+    myPoint1[i]->setValue( p1[i] );
+    myPoint2[i]->setValue( p2[i] );
+  }
+
+  // Draw Preview
+  if (myPreviewCheck->isChecked()) {
+    createPlanes();
+  }
+
+  if( !theInit )
+    return;
+
+  myInputPane->initFromPrsObject( myPrsCopy );
+  myTabBox->setCurrentIndex( 0 );
+}
+
+//------------------------------------------------------------------------------
+int VisuGUI_CutSegmentDlg::storeToPrsObject (VISU::ColoredPrs3d_i* thePrs)
+{
+  if(!myInputPane->check() || !GetScalarPane()->check())
+    return 0;
+  
+  int anIsOk = myInputPane->storeToPrsObject( myPrsCopy );
+  anIsOk &= GetScalarPane()->storeToPrsObject( myPrsCopy );
+
+  myPrsCopy->SetAllCurvesInverted( myAllCurvesInvertedCheck->isChecked() );
+  myPrsCopy->SetUseAbsoluteLength( myUseAbsoluteLengthCheck->isChecked() );
+
+  double p1[3], p2[3];
+  for( int i = 0; i < 3; i++ ) {
+    p1[i] = myPoint1[i]->value();
+    p2[i] = myPoint2[i]->value();
+  }
+  myPrsCopy->SetPoint1( p1[0], p1[1], p1[2] );
+  myPrsCopy->SetPoint2( p2[0], p2[1], p2[2] );
+
+  VISU::TSameAsFactory<VISU::TCUTSEGMENT>().Copy(myPrsCopy, thePrs);
+
+  return anIsOk;
+}
+
+//------------------------------------------------------------------------------
+void VisuGUI_CutSegmentDlg::createPlanes()
+{
+  SVTK_ViewWindow* aView = VISU::GetActiveViewWindow<SVTK_ViewWindow>();
+  if (aView == NULL) return;
+  if (!(bool)myCutSegment) return;
+  if (myPreviewActor != 0) return;
+
+  storeToPrsObject(myCutSegment);
+  myCutSegment->GetPipeLine()->Update();
+  vtkAppendPolyData* aPolyData = myCutSegment->GetSpecificPL()->GetAppendPolyData();
+  vtkDataSetMapper* aPlaneMapper = vtkDataSetMapper::New();
+  aPlaneMapper->SetInput(aPolyData->GetOutput());
+  aPlaneMapper->ScalarVisibilityOff();
+  
+  myPreviewActorGlyphs = SALOME_Actor::New();
+  myPreviewActorGlyphs->PickableOff();
+  updateGlyphs(false);
+  
+  myPreviewActorPoints = SALOME_Actor::New();
+  myPreviewActorPoints->PickableOff();
+  updatePoints(false);
+  
+  myPreviewActor = SALOME_Actor::New();
+  myPreviewActor->PickableOff();
+  myPreviewActor->SetMapper(aPlaneMapper);
+  aPlaneMapper->Delete();
+  aView->AddActor(myPreviewActor);
+  aView->AddActor(myPreviewActorGlyphs);
+  aView->AddActor(myPreviewActorPoints);
+  aView->getRenderer()->Render();
+  aView->onFitAll();
+}
+
+//------------------------------------------------------------------------------
+void VisuGUI_CutSegmentDlg::deletePlanes()
+{
+  if (myPreviewActor == 0) return;
+  vtkRenderer* aRend       = myPreviewActor->GetRenderer();
+  vtkRenderer* aRendGlyphs = myPreviewActorGlyphs->GetRenderer();
+  vtkRenderer* aRendPoints = myPreviewActorPoints->GetRenderer();
+  
+  vtkRenderWindow* aWnd1 = aRend->GetRenderWindow();
+  vtkRenderWindow* aWnd2 = aRendGlyphs->GetRenderWindow();
+  vtkRenderWindow* aWnd3 = aRendPoints->GetRenderWindow();
+  if(aRend && aWnd1)
+    myPreviewActor->RemoveFromRender(aRend);
+  if(aRendGlyphs && aWnd2)
+    myPreviewActorGlyphs->RemoveFromRender(aRendGlyphs);
+  if(aRendPoints && aWnd3)
+    myPreviewActorPoints->RemoveFromRender(aRendPoints);
+
+  myPreviewActor->Delete();
+  myPreviewActorGlyphs->Delete();
+  myPreviewActorPoints->Delete();
+  myPreviewActor = 0;
+  myPreviewActorGlyphs = 0;
+  myPreviewActorPoints = 0;
+}
+
+//------------------------------------------------------------------------------
+void VisuGUI_CutSegmentDlg::updateGlyphs(bool update){
+  if (myPreviewActorGlyphs == 0 ) return;
+  const vtkFloatingPointType *aDirLn = myCutSegment->GetSpecificPL()->GetRealDirLn();
+  vtkFloatingPointType aSecondPnt[3];
+  vtkFloatingPointType aBoundCenter[3];
+
+  vtkAppendPolyData* aPolyData = myCutSegment->GetSpecificPL()->GetAppendPolyData();
+  vtkDataSetMapper* aPlaneMapper = vtkDataSetMapper::New();
+  aPlaneMapper->SetInput(aPolyData->GetOutput());
+  vtkFloatingPointType bounds[6];
+  aPlaneMapper->GetBounds(bounds);
+
+  for(int i=0; i<3; i++) aBoundCenter[i] = (bounds[i*2] + bounds[i*2+1])/2.0;
+  for(int i=0; i<3; i++){ 
+    if (!myAllCurvesInvertedCheck->isChecked())
+      aSecondPnt[i] = aDirLn[i];
+    else
+      aSecondPnt[i] = - aDirLn[i];
+  }
+  
+  vtkFloatingPointType max_bound = 0;
+  max_bound < bounds[1]-bounds[0] ? max_bound = bounds[1] - bounds[0] : max_bound = max_bound;
+  max_bound < bounds[3]-bounds[2] ? max_bound = bounds[3] - bounds[2] : max_bound = max_bound;
+  max_bound < bounds[5]-bounds[4] ? max_bound = bounds[5] - bounds[4] : max_bound = max_bound;
+
+  vtkPolyData* profile = vtkPolyData::New();
+  vtkPoints* aPoints = vtkPoints::New();
+  vtkGlyph3D* glyphs = vtkGlyph3D::New();
+  vtkFloatArray *aFloatArray = vtkFloatArray::New();
+  vtkGlyphSource2D* source = vtkGlyphSource2D::New();
+  
+  source->FilledOn();
+  source->SetGlyphTypeToArrow();
+  
+  aPoints->InsertNextPoint(aBoundCenter);
+  profile->SetPoints(aPoints);
+  
+  aFloatArray->SetNumberOfComponents(3);
+  for(int i=0; i<3 ;i++)
+    aFloatArray->InsertNextValue(aSecondPnt[i]);
+  
+  vtkDataSetAttributes* aDataSetAttributes;
+  aDataSetAttributes = profile->GetPointData();
+  aDataSetAttributes->SetVectors(aFloatArray);
+  
+  glyphs->SetScaleFactor(0.25*max_bound);
+  glyphs->SetVectorModeToUseVector();
+  glyphs->SetScaleModeToScaleByVector();
+  glyphs->SetInput(profile);
+  glyphs->SetSource(source->GetOutput());
+
+  vtkPolyDataMapper* aGlyphsMapper = vtkPolyDataMapper::New();
+  aGlyphsMapper->ScalarVisibilityOff();
+  aGlyphsMapper->SetInput(glyphs->GetOutput());
+  
+  myPreviewActorGlyphs->SetMapper(aGlyphsMapper);
+
+  profile->Delete();
+  glyphs->Delete();
+  aPoints->Delete();
+  aGlyphsMapper->Delete();
+  aFloatArray->Delete();
+  source->Delete();
+  aPlaneMapper->Delete();
+
+  if (SVTK_ViewWindow* vf = VISU::GetActiveViewWindow<SVTK_ViewWindow>())
+    if (update)
+      vf->Repaint();
+}
+
+//------------------------------------------------------------------------------
+void VisuGUI_CutSegmentDlg::updatePoints( bool update )
+{
+  if( !myPreviewActorPoints )
+    return;
+
+  vtkFloatingPointType aPoint1[3], aPoint2[3];
+  myCutSegment->GetSpecificPL()->GetPoint1( aPoint1[0], aPoint1[1], aPoint1[2] );
+  myCutSegment->GetSpecificPL()->GetPoint2( aPoint2[0], aPoint2[1], aPoint2[2] );
+
+  vtkPoints* aPoints = vtkPoints::New();
+  aPoints->InsertNextPoint( aPoint1 );
+  aPoints->InsertNextPoint( aPoint2 );
+
+  vtkCellArray* aVerts = vtkCellArray::New();
+  for( int i = 0, n = aPoints->GetNumberOfPoints(); i < n; i++ )
+    aVerts->InsertNextCell( 1, &i );
+
+  vtkPolyData* aProfile = vtkPolyData::New();
+  aProfile->SetPoints( aPoints );
+  aProfile->SetVerts( aVerts );
+
+  vtkPolyDataMapper* aPointsMapper = vtkPolyDataMapper::New();
+  aPointsMapper->ScalarVisibilityOff();
+  aPointsMapper->SetInput( aProfile );
+  
+  myPreviewActorPoints->SetMapper( aPointsMapper );
+  myPreviewActorPoints->GetProperty()->SetRepresentationToPoints();
+  myPreviewActorPoints->GetProperty()->SetPointSize( 5 );
+
+  aProfile->Delete();
+  aPoints->Delete();
+  aVerts->Delete();
+
+  if( SVTK_ViewWindow* vf = VISU::GetActiveViewWindow<SVTK_ViewWindow>() )
+    if( update )
+      vf->Repaint();
+}
+
+//------------------------------------------------------------------------------
+void VisuGUI_CutSegmentDlg::accept()
+{
+  VisuGUI_ScalarBarBaseDlg::accept();
+}
+
+//------------------------------------------------------------------------------
+void VisuGUI_CutSegmentDlg::reject()
+{
+  VisuGUI_ScalarBarBaseDlg::reject();
+}
+
+//------------------------------------------------------------------------------
+void VisuGUI_CutSegmentDlg::onPreviewCheck (bool thePreview)
+{
+  if (SVTK_ViewWindow* vf = VISU::GetActiveViewWindow<SVTK_ViewWindow>()) {
+    if (thePreview) {
+      createPlanes();
+    } else {
+      deletePlanes();
+      vf->Repaint();
+    }
+  }
+}
+
+//------------------------------------------------------------------------------
+void VisuGUI_CutSegmentDlg::onAllCurvesInvertedCheck(bool theInvert)
+{
+  bool anIsAllCurvesInverted = myAllCurvesInvertedCheck->isChecked();
+
+  myCutSegment->SetAllCurvesInverted( anIsAllCurvesInverted );
+  myPrsCopy->SetAllCurvesInverted( anIsAllCurvesInverted );
+
+  updateGlyphs(true);
+  updatePoints(true);
+}
+
+//------------------------------------------------------------------------------
+void VisuGUI_CutSegmentDlg::onPointModified ()
+{
+  if (!(bool)myCutSegment) return;
+  SVTK_ViewWindow* aView = VISU::GetActiveViewWindow<SVTK_ViewWindow>();
+  if (aView) {
+    if (myPreviewCheck->isChecked()) {
+      deletePlanes();
+      createPlanes();
+    }
+  }
+}
+
+//------------------------------------------------------------------------------
+QString VisuGUI_CutSegmentDlg::GetContextHelpFilePath()
+{
+  return "cut_segment_page.html";
+}
diff --git a/src/VISUGUI/VisuGUI_CutSegmentDlg.h b/src/VISUGUI/VisuGUI_CutSegmentDlg.h
new file mode 100644 (file)
index 0000000..b57762f
--- /dev/null
@@ -0,0 +1,101 @@
+//  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+//  File   : VisuGUI_CutSegmentDlg.h
+//  Author : Oleg UVAROV
+//  Module : VISU
+//
+#ifndef VISUGUI_CUTSEGMENTDLG_H
+#define VISUGUI_CUTSEGMENTDLG_H
+
+#include "VisuGUI_CutPlanesDlg.h"
+
+#include <QCheckBox>
+#include <QList>
+
+class QTabWidget;
+
+class SalomeApp_Module;
+class VisuGUI_InputPane;
+
+namespace VISU
+{
+  class CutSegment_i;
+}
+
+class VisuGUI_CutSegmentDlg: public VisuGUI_ScalarBarBaseDlg
+{
+  Q_OBJECT
+
+public:
+  VisuGUI_CutSegmentDlg (SalomeApp_Module* theModule);
+  ~VisuGUI_CutSegmentDlg();
+
+  virtual void initFromPrsObject( VISU::ColoredPrs3d_i* thePrs,
+                                 bool theInit );
+
+  virtual int  storeToPrsObject(VISU::ColoredPrs3d_i* thePrs);
+
+  bool isGenerateTable() { return myCreateTable->isChecked(); }
+  bool isGenerateCurves() { return myCreateTable->isChecked() && myCurvesCheck->isChecked(); }
+
+protected:
+  virtual QString GetContextHelpFilePath();
+protected slots:
+  void accept();
+  void reject();
+
+private slots:
+  void onPreviewCheck(bool thePreview);
+  void onAllCurvesInvertedCheck(bool theInvert);
+  void onPointModified();
+
+private:
+  void createPlanes();
+  void deletePlanes();
+  void updateGlyphs(bool update);
+  void updatePoints(bool update);
+
+  QCheckBox* myCreateTable;
+  QCheckBox* myCurvesCheck;
+
+  bool hasInit;
+
+  QList<QtxDoubleSpinBox*> myPoint1;
+  QList<QtxDoubleSpinBox*> myPoint2;
+
+  SALOME::GenericObjPtr<VISU::CutSegment_i> myCutSegment;
+
+  QTabWidget*            myTabBox;
+  VisuGUI_InputPane*     myInputPane;
+
+  SALOME_Actor* myPreviewActor;
+  SALOME_Actor* myPreviewActorGlyphs;
+  SALOME_Actor* myPreviewActorPoints;
+  QCheckBox* myPreviewCheck;
+  QCheckBox* myAllCurvesInvertedCheck;
+  QCheckBox* myUseAbsoluteLengthCheck;
+
+  SALOME::GenericObjPtr<VISU::CutSegment_i> myPrsCopy;
+};
+
+#endif // VISUGUI_CUTSEGMENTDLG_H
index 862995878ed71d9b2be7c6a4a13bec18a53aec5a..1e9b560c9661f4f3ae8376072a76892011655619 100644 (file)
@@ -68,7 +68,7 @@
 
 #include "VISU_Gen_i.hh"
 #include "VISU_Result_i.hh"
-#include "VISU_CutLines_i.hh"
+#include "VISU_CutLinesBase_i.hh"
 
 #include "VISU_Actor.h"
 #include "VISU_ScalarMapAct.h"
@@ -151,7 +151,7 @@ using namespace std;
 
 void
 CreateCurves( SalomeApp_Module* theModule,
-              VISU::CutLines_i* thePrs,
+              VISU::CutLinesBase_i* thePrs,
               QDialog* theDlg,
               const bool theCreate = true );
 
index c9864171535fce5997e86534e3d333b4d5117519..96aab2437f85dbd89dfb92b80645a4bfcd206d9a 100644 (file)
@@ -81,7 +81,7 @@ namespace VISU
        // Optionally, create table and curves for cut lines
        QApplication::setOverrideCursor(Qt::WaitCursor);
        CreateCurves( theModule,
-                     dynamic_cast<VISU::CutLines_i*>( aPrs3d ),
+                     dynamic_cast<VISU::CutLinesBase_i*>( aPrs3d ),
                      aDlg,
                      false ); // in edition mode
        QApplication::restoreOverrideCursor();
@@ -245,7 +245,7 @@ namespace VISU
            // Optionally, create table and curves for cut lines
            QApplication::setOverrideCursor(Qt::WaitCursor);
            CreateCurves( theModule,
-                         dynamic_cast<VISU::CutLines_i*>( aPrs3d ),
+                         dynamic_cast<VISU::CutLinesBase_i*>( aPrs3d ),
                          aDlg,
                          true ); // in creation mode
            UpdateObjBrowser(theModule,true,theTimeStamp);
index 3828a0ca0dceb862bf6b56ac4f53d7b457c2f3b1..381ad9bc09dd41f5d3ec96cbb557b2922fc27c2a 100644 (file)
@@ -122,6 +122,7 @@ QString VisuGUI_Selection::type( const int ind ) const
       ENUM2STRING( aResStr, VISU::TSCALARMAPONDEFORMEDSHAPE );
       ENUM2STRING( aResStr, VISU::TCUTPLANES );
       ENUM2STRING( aResStr, VISU::TCUTLINES );
+      ENUM2STRING( aResStr, VISU::TCUTSEGMENT );
       ENUM2STRING( aResStr, VISU::TVECTORS );
       ENUM2STRING( aResStr, VISU::TSTREAMLINES );
       ENUM2STRING( aResStr, VISU::TPLOT3D );
index 48022226a0e08769d943f408092255c05b2089e4..c0a9c0e5f386282f560945ce17446b1ca193bd61 100644 (file)
@@ -32,6 +32,7 @@
 #include "VisuGUI_DeformedShapeDlg.h"
 #include "VisuGUI_CutPlanesDlg.h"
 #include "VisuGUI_CutLinesDlg.h"
+#include "VisuGUI_CutSegmentDlg.h"
 #include "VisuGUI_Plot3DDlg.h"
 #include "VisuGUI_VectorsDlg.h"
 #include "VisuGUI_IsoSurfacesDlg.h"
@@ -47,6 +48,7 @@
 #include "VISU_CutPlanes_i.hh"
 #include "VISU_Plot3D_i.hh"
 #include "VISU_CutLines_i.hh"
+#include "VISU_CutSegment_i.hh"
 #include "VISU_Vectors_i.hh"
 #include "VISU_StreamLines_i.hh"
 #include "VISU_DeformedShapeAndScalarMap_i.hh"
@@ -903,12 +905,13 @@ enum PrsComboItem {
   TISOSURFACES_ITEM   = 1, // VISU::TISOSURFACES
   TCUTPLANES_ITEM     = 2, // VISU::TCUTPLANES
   TCUTLINES_ITEM      = 3, // VISU::TCUTLINES
-  TPLOT3D_ITEM        = 4, // VISU::TPLOT3D
-  TDEFORMEDSHAPE_ITEM = 5, // VISU::TDEFORMEDSHAPE
-  TVECTORS_ITEM       = 6, // VISU::TVECTORS
-  TSTREAMLINES_ITEM   = 7, // VISU::TSTREAMLINES
-  TGAUSSPOINTS_ITEM   = 8, // VISU::TGAUSSPOINTS
-  TDEFORMEDSHAPEANDSCALARMAP_ITEM = 9 // VISU::TDEFORMEDSHAPEANDSCALARMAP
+  TCUTSEGMENT_ITEM    = 4, // VISU::TCUTSEGMENT
+  TPLOT3D_ITEM        = 5, // VISU::TPLOT3D
+  TDEFORMEDSHAPE_ITEM = 6, // VISU::TDEFORMEDSHAPE
+  TVECTORS_ITEM       = 7, // VISU::TVECTORS
+  TSTREAMLINES_ITEM   = 8, // VISU::TSTREAMLINES
+  TGAUSSPOINTS_ITEM   = 9, // VISU::TGAUSSPOINTS
+  TDEFORMEDSHAPEANDSCALARMAP_ITEM = 10 // VISU::TDEFORMEDSHAPEANDSCALARMAP
 };
 
 //------------------------------------------------------------------------
@@ -956,7 +959,11 @@ void SetupDlg::onFieldChange (int theIndex)
   myTypeId2ComboId[TCUTLINES_ITEM] = myComboId2TypeId.size();
   myComboId2TypeId.push_back(TCUTLINES_ITEM);;
 
-  myTypeCombo->addItem("Plot 3D");      // item 4
+  myTypeCombo->addItem("Cut Segment");  // item 4
+  myTypeId2ComboId[TCUTSEGMENT_ITEM] = myComboId2TypeId.size();
+  myComboId2TypeId.push_back(TCUTSEGMENT_ITEM);;
+
+  myTypeCombo->addItem("Plot 3D");      // item 5
   myTypeId2ComboId[TPLOT3D_ITEM] = myComboId2TypeId.size();
   myComboId2TypeId.push_back(TPLOT3D_ITEM);;
 
@@ -996,25 +1003,25 @@ void SetupDlg::onFieldChange (int theIndex)
   }
 
   if (anEnableItems) {
-    myTypeCombo->addItem("Deformed Shape"); // item 5
+    myTypeCombo->addItem("Deformed Shape"); // item 6
     myTypeId2ComboId[TDEFORMEDSHAPE_ITEM] = myComboId2TypeId.size();
     myComboId2TypeId.push_back(TDEFORMEDSHAPE_ITEM);;
 
-    myTypeCombo->addItem("Vectors");        // item 6
+    myTypeCombo->addItem("Vectors");        // item 7
     myTypeId2ComboId[TVECTORS_ITEM] = myComboId2TypeId.size();
     myComboId2TypeId.push_back(TVECTORS_ITEM);;
 
-    myTypeCombo->addItem("Stream Lines");   // item 7
+    myTypeCombo->addItem("Stream Lines");   // item 8
     myTypeId2ComboId[TSTREAMLINES_ITEM] = myComboId2TypeId.size();
     myComboId2TypeId.push_back(TSTREAMLINES_ITEM);;
 
-    myTypeCombo->addItem("Deformed shape and Scalar map");   // item 9
+    myTypeCombo->addItem("Deformed shape and Scalar map");   // item 10
     myTypeId2ComboId[TDEFORMEDSHAPEANDSCALARMAP_ITEM] = myComboId2TypeId.size();
     myComboId2TypeId.push_back(TDEFORMEDSHAPEANDSCALARMAP_ITEM);;
   }
 
   if(anEnableGP){
-    myTypeCombo->addItem("Gauss Points");   // item 8
+    myTypeCombo->addItem("Gauss Points");   // item 9
     myTypeId2ComboId[TGAUSSPOINTS_ITEM] = myComboId2TypeId.size();
     myComboId2TypeId.push_back(TGAUSSPOINTS_ITEM);;
   }
@@ -1032,6 +1039,9 @@ void SetupDlg::onFieldChange (int theIndex)
   case VISU::TCUTLINES: //Cut Lines
     myTypeCombo->setCurrentIndex(myTypeId2ComboId[TCUTLINES_ITEM]);
     break;
+  case VISU::TCUTSEGMENT: //Cut Segment
+    myTypeCombo->setCurrentIndex(myTypeId2ComboId[TCUTSEGMENT_ITEM]);
+    break;
   case VISU::TPLOT3D: //Plot 3D
     myTypeCombo->setCurrentIndex(myTypeId2ComboId[TPLOT3D_ITEM]);
     break;
@@ -1078,6 +1088,9 @@ void SetupDlg::onTypeChanged (int theIndex)
     case TCUTLINES_ITEM: //Cut Lines
       aData.myPrsType = VISU::TCUTLINES;
       break;
+    case TCUTSEGMENT_ITEM: //Cut Segment
+      aData.myPrsType = VISU::TCUTSEGMENT;
+      break;
     case TPLOT3D_ITEM: //Plot 3D
       aData.myPrsType = VISU::TPLOT3D;
       break;
@@ -1195,6 +1208,10 @@ void SetupDlg::onPreferencesDlg()
     c.suspend();
     EditPrs<VISU::CutLines_i,VisuGUI_CutLinesDlg>(myModule,aData,myAnimator);
     break;
+  case TCUTSEGMENT_ITEM: //Cut Segment
+    c.suspend();
+    EditPrs<VISU::CutSegment_i,VisuGUI_CutSegmentDlg>(myModule,aData,myAnimator);
+    break;
   case TPLOT3D_ITEM: //Plot 3D
     c.suspend();
     EditPrs<VISU::Plot3D_i,VisuGUI_Plot3DDlg>(myModule,aData,myAnimator);
index dc16a1870068468fd05435299ba12d3740624f1d..4748228c14b6503032c31862c1c168916063e586 100644 (file)
@@ -1355,6 +1355,7 @@ namespace VISU
         case VISU::TDEFORMEDSHAPE:
         case VISU::TCUTPLANES:
         case VISU::TCUTLINES:
+        case VISU::TCUTSEGMENT:
         case VISU::TVECTORS:
         case VISU::TSTREAMLINES:
         case VISU::TPLOT3D:
index 56aad8391431f42e486c157adb864eacea0687c8..960e39b7a523e46b65d2bb4c42fc3b0529a76213 100644 (file)
@@ -47,7 +47,9 @@ salomeinclude_HEADERS = \
        VISU_DeformedShape_i.hh \
        VISU_Plot3D_i.hh \
        VISU_CutPlanes_i.hh \
+       VISU_CutLinesBase_i.hh \
        VISU_CutLines_i.hh \
+       VISU_CutSegment_i.hh \
        VISU_Prs3dUtils.hh \
        VISU_Vectors_i.hh \
        VISU_StreamLines_i.hh \
@@ -83,7 +85,9 @@ libVISUEngineImpl_la_SOURCES = \
        VISU_DeformedShape_i.cc \
        VISU_Plot3D_i.cc \
        VISU_CutPlanes_i.cc \
+       VISU_CutLinesBase_i.cc \
        VISU_CutLines_i.cc \
+       VISU_CutSegment_i.cc \
        VISU_Vectors_i.cc \
        VISU_StreamLines_i.cc \
        VISU_DeformedShapeAndScalarMap_i.cc \
index 882342406e7c30163cb0b0704cc43baff689c735..84739c3836fe2941b5366d642401ec7943d23bff 100644 (file)
@@ -223,8 +223,8 @@ namespace VISU
       return VISU::TPLOT3D;
     if ( theComment == "CUTPLANES" ) 
       return VISU::TCUTPLANES;
-    if ( theComment == "CUTLINES" ) 
-      return VISU::TCUTLINES;
+    if ( theComment == "CUTSEGMENT" ) 
+      return VISU::TCUTSEGMENT;
     if ( theComment == "VECTORS" ) 
       return VISU::TVECTORS;
     if ( theComment == "STREAMLINES" ) 
index bb3a816a1dab99a4bda8d6b60009e72095a28253..26327b58ba40cc9f82b15d6244a02e65ec57b2ac 100644 (file)
@@ -110,6 +110,8 @@ namespace VISU
       return VISU::CreatePrs3dByEnum<TCUTPLANES>(theStudy, thePublishInStudyMode);
     case TCUTLINES:
       return VISU::CreatePrs3dByEnum<TCUTLINES>(theStudy, thePublishInStudyMode);
+    case TCUTSEGMENT:
+      return VISU::CreatePrs3dByEnum<TCUTSEGMENT>(theStudy, thePublishInStudyMode);
     case TVECTORS:
       return VISU::CreatePrs3dByEnum<TVECTORS>(theStudy, thePublishInStudyMode);
     }
@@ -221,6 +223,9 @@ namespace VISU
     case TCUTLINES:
       aMemory = CheckIsPossible<TCUTLINES>(theInput, theMemoryCheck);
       break;
+    case TCUTSEGMENT:
+      aMemory = CheckIsPossible<TCUTSEGMENT>(theInput, theMemoryCheck);
+      break;
     case TVECTORS:
       aMemory = CheckIsPossible<TVECTORS>(theInput, theMemoryCheck);
       break;
index 4b5c2b41cf6836fc3a0c817dc1e5bfdd1901b0e1..e3633e4048bffea70757bfd13d8e7997d27506af 100644 (file)
@@ -39,6 +39,7 @@
 #include "VISU_StreamLines_i.hh"
 #include "VISU_Vectors_i.hh"
 #include "VISU_CutLines_i.hh"
+#include "VISU_CutSegment_i.hh"
 #include "VISU_CutPlanes_i.hh"
 #include "VISU_DeformedShape_i.hh"
 #include "VISU_IsoSurfaces_i.hh"
@@ -61,9 +62,10 @@ namespace VISU
                                          TList<IsoSurfaces_i,
                                                TList<CutPlanes_i,
                                                      TList<CutLines_i,
-                                                           TList<Vectors_i,
-                                                                 TList<Plot3D_i, 
-                                                                       TNullType> > > > > > > > > > >
+                                                           TList<CutSegment_i,
+                                                                 TList<Vectors_i,
+                                                                       TList<Plot3D_i, 
+                                                                             TNullType> > > > > > > > > > > >
     TColoredPrs3dTypeList;
     
 
@@ -76,9 +78,10 @@ namespace VISU
                                          TList<TInt2Type<TISOSURFACES>,
                                                TList<TInt2Type<TCUTPLANES>,
                                                      TList<TInt2Type<TCUTLINES>,
-                                                           TList<TInt2Type<TVECTORS>,
-                                                                 TList<TInt2Type<TPLOT3D>, 
-                                                                       TNullType> > > > > > > > > > >
+                                                           TList<TInt2Type<TCUTSEGMENT>,
+                                                                 TList<TInt2Type<TVECTORS>,
+                                                                       TList<TInt2Type<TPLOT3D>, 
+                                                                             TNullType> > > > > > > > > > > >
     TColoredPrs3dEnumList;
     
 
diff --git a/src/VISU_I/VISU_CutLinesBase_i.cc b/src/VISU_I/VISU_CutLinesBase_i.cc
new file mode 100644 (file)
index 0000000..5c474f9
--- /dev/null
@@ -0,0 +1,468 @@
+//  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+//  File   : VISU_CutLinesBase_i.cc
+//  Author : Oleg UVAROV
+//  Module : VISU
+//
+#include "VISU_CutLinesBase_i.hh"
+#include "VISU_Prs3dUtils.hh"
+#include "VISU_Result_i.hh"
+
+#include "VISU_Actor.h"
+#include "VISU_CutLinesBasePL.hxx"
+#include "VISU_Convertor.hxx"
+#include "VISU_PipeLineUtils.hxx"
+
+#include "SUIT_ResourceMgr.h"
+
+#include <vtkAppendPolyData.h>
+
+static vtkFloatingPointType EPS_machine = 1.0E-7;
+
+#ifdef _DEBUG_
+static int MYDEBUG = 0;
+#else
+static int MYDEBUG = 0;
+#endif
+
+using namespace std;
+
+//---------------------------------------------------------------
+VISU::CutLinesBase_i::
+CutLinesBase_i(EPublishInStudyMode thePublishInStudyMode) :
+  ColoredPrs3d_i(thePublishInStudyMode),
+  ScalarMap_i(thePublishInStudyMode),
+  myUseAbsLength( false ),
+  myCutLinesBasePL(NULL)
+{}
+
+
+//---------------------------------------------------------------
+void
+VISU::CutLinesBase_i
+::SameAs(const Prs3d_i* theOrigin)
+{
+  TSuperClass::SameAs(theOrigin);
+
+  if(const CutLinesBase_i* aPrs3d = dynamic_cast<const CutLinesBase_i*>(theOrigin)){
+    CutLinesBase_i* anOrigin = const_cast<CutLinesBase_i*>(aPrs3d);
+    myUseAbsLength = anOrigin->IsUseAbsoluteLength();
+    CopyCurvesInverted(anOrigin->GetCurvesInverted());
+  }
+}
+
+
+//---------------------------------------------------------------
+/*! Copy map to /a myMapCurvesInverted.
+ * \param theCurves - map
+ */
+void 
+VISU::CutLinesBase_i
+::CopyCurvesInverted(const TCurvesInv& theCurves)
+{
+  myMapCurvesInverted = theCurves;
+}
+
+
+//---------------------------------------------------------------
+VISU::Storable* 
+VISU::CutLinesBase_i
+::Create(const std::string& theMeshName, 
+        VISU::Entity theEntity,
+        const std::string& theFieldName, 
+        CORBA::Long theTimeStampNumber)
+{
+  SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
+  SetUseAbsoluteLength( aResourceMgr->booleanValue( "VISU", "use_absolute_length", false ) );
+  SetAllCurvesInverted( aResourceMgr->booleanValue( "VISU", "invert_all_curves", false ) );
+  return TSuperClass::Create(theMeshName,theEntity,theFieldName,theTimeStampNumber);
+}
+
+
+//---------------------------------------------------------------
+VISU::Storable* 
+VISU::CutLinesBase_i
+::Restore(SALOMEDS::SObject_ptr theSObject,
+         const Storable::TRestoringMap& theMap)
+{
+  if(!TSuperClass::Restore(theSObject, theMap))
+    return NULL;
+
+  SetNbLines(VISU::Storable::FindValue(theMap,"myNbLines").toInt());
+
+  SetUseAbsoluteLength(VISU::Storable::FindValue(theMap,"myUseAbsLength").toInt());
+
+  // Restoring the map - \a myMapCurvesInverted
+  QStringList aMapCurvesInverted = VISU::Storable::FindValue(theMap,"myMapCurvesInverted").split("|",QString::SkipEmptyParts );
+  if (aMapCurvesInverted.count() == GetNbLines()){
+    for(int i = 0, iEnd = GetNbLines(); i < iEnd ; i++){
+      if(aMapCurvesInverted[i].toInt())
+       SetCurveInverted(i,true);
+      else
+       SetCurveInverted(i,false);
+    }
+  } else {
+    for(int i = 0, iEnd = GetNbLines(); i < iEnd ; i++)
+      SetCurveInverted(i,false);
+  }
+      
+  return this;
+}
+
+
+//---------------------------------------------------------------
+void
+VISU::CutLinesBase_i
+::ToStream(std::ostringstream& theStr)
+{
+  TSuperClass::ToStream(theStr);
+
+  Storable::DataToStream( theStr, "myNbLines",      GetNbLines() );
+
+  Storable::DataToStream( theStr, "myUseAbsLength", IsUseAbsoluteLength());
+
+  // Storing the map - \a myMapCurvesInverted
+  QString aStrCurvesInverted;
+  for(int i = 0, iEnd = GetNbLines(); i < iEnd; i++) 
+    aStrCurvesInverted.append(QString::number(IsCurveInverted(i)) + "|");
+  Storable::DataToStream( theStr, "myMapCurvesInverted", (const char*)aStrCurvesInverted.toLatin1());
+}
+
+
+//---------------------------------------------------------------
+VISU::CutLinesBase_i
+::~CutLinesBase_i()
+{
+  if(MYDEBUG) MESSAGE("CutLinesBase_i::~CutLinesBase_i()");
+}
+
+
+//---------------------------------------------------------------
+void
+VISU::CutLinesBase_i
+::SetNbLines(CORBA::Long theNb) 
+{ 
+  VISU::TSetModified aModified(this);
+
+  ProcessVoidEvent(new TVoidMemFun1ArgEvent<VISU_CutLinesBasePL, int>
+                  (GetSpecificPL(), &VISU_CutLinesBasePL::SetNbParts, theNb));
+}
+
+//---------------------------------------------------------------
+CORBA::Long
+VISU::CutLinesBase_i
+::GetNbLines() 
+{ 
+  return myCutLinesBasePL->GetNbParts();
+}
+
+//---------------------------------------------------------------
+/*! Invert all curves of corresponding table
+ * see void VISU::CutLinesBase_i::SetCurveInverted(CORBA::Long theCurveNumber,CORBA::Boolean theInvert)
+ * \param theInvert - Invert all curves, if value is TRUE, else not.
+ */
+void
+VISU::CutLinesBase_i
+::SetAllCurvesInverted(CORBA::Boolean theInvert)
+{
+  for(int i=0; i < GetNbLines(); i++)
+    SetCurveInverted(i, theInvert);
+}
+
+//---------------------------------------------------------------
+/*! Checks the orientation of all curves
+ * \retval TRUE - if all curves are inverted, else FALSE
+ */
+CORBA::Boolean 
+VISU::CutLinesBase_i
+::IsAllCurvesInverted()
+{
+  for (int i=0; i<GetNbLines(); i++)
+    if (!IsCurveInverted(i)) return false;
+  return true;
+}
+
+//---------------------------------------------------------------
+/*! Sets orientation of curve
+ * \param theCurveNumber - integer value, number of cut line.
+ * \param theInvert      - boolean value, TRUE or false.
+ */
+void
+VISU::CutLinesBase_i
+::SetCurveInverted(CORBA::Long theCurveNumber, CORBA::Boolean theInvert)
+{
+  if(myMapCurvesInverted[theCurveNumber] == theInvert)
+    return;
+
+  VISU::TSetModified aModified(this);
+
+  myMapCurvesInverted[theCurveNumber] = theInvert;
+  myParamsTime.Modified();
+}
+
+//---------------------------------------------------------------
+/*! Checks orientation of curve.
+ * \param theCurveNumber - integer value, number of cut line.
+ * \retval TRUE - if line in the table is inverted, else FALSE.
+ */
+CORBA::Boolean
+VISU::CutLinesBase_i
+::IsCurveInverted(CORBA::Long theCurveNumber)
+{
+  return myMapCurvesInverted[theCurveNumber];
+}
+
+//---------------------------------------------------------------
+/*! It control the way the length of cutlines is shown: using aboslute or relative values
+* \param theAbsLength - boolean value, TRUE or false.
+*/
+void
+VISU::CutLinesBase_i
+::SetUseAbsoluteLength(CORBA::Boolean theAbsLength)
+{
+  if ( myUseAbsLength == theAbsLength )
+    return;
+
+  VISU::TSetModified aModified(this);
+
+  myUseAbsLength = theAbsLength;
+  myParamsTime.Modified();
+}
+
+//---------------------------------------------------------------
+CORBA::Boolean
+VISU::CutLinesBase_i
+::IsUseAbsoluteLength()
+{
+  return myUseAbsLength;
+}
+
+
+//---------------------------------------------------------------
+void
+VISU::CutLinesBase_i
+::CreatePipeLine(VISU_PipeLine* thePipeLine)
+{
+  /*if(!thePipeLine){
+    myCutLinesBasePL = VISU_CutLinesBasePL::New();
+    }else*/
+    myCutLinesBasePL = dynamic_cast<VISU_CutLinesBasePL*>(thePipeLine);
+
+  TSuperClass::CreatePipeLine(myCutLinesBasePL);
+}
+
+
+//---------------------------------------------------------------
+void
+VISU::CutLinesBase_i
+::BuildTableOfReal(SALOMEDS::SObject_var theSObject)
+{
+  try{
+    if(MYDEBUG) MESSAGE("CutPlanes_i::BuildTableOfReal");
+    Update();
+    SALOMEDS::GenericAttribute_var anAttr;
+    SALOMEDS::StudyBuilder_var aStudyBuilder = GetStudyDocument()->NewBuilder();
+    anAttr = aStudyBuilder->FindOrCreateAttribute(theSObject, "AttributeTableOfReal");
+    SALOMEDS::AttributeTableOfReal_var aTableOfReal = SALOMEDS::AttributeTableOfReal::_narrow(anAttr);
+    
+    typedef set<vtkFloatingPointType> TXCont;
+    typedef map<vtkFloatingPointType,vtkFloatingPointType> TXYMap;
+    typedef map<int,TXYMap> TXYMapCont;
+    typedef map<long,long> TLineIdCont;
+    
+    QString aTitle( GetScalarBarTitle().c_str() );
+    aTitle = aTitle.simplified();
+    aTableOfReal->SetTitle( aTitle.toLatin1().data() );
+    
+    int iLineEnd = myCutLinesBasePL->GetAppendPolyData()->GetNumberOfInputConnections(0);
+    if(MYDEBUG) MESSAGE("CutPlanes_i::BuildTableOfReal iLineEnd = "<<iLineEnd);
+    TXCont aXCont;
+    TXYMapCont aXYMapCont; 
+    TLineIdCont aLineIdCont;  // Define internal numeration of lines
+    const vtkFloatingPointType *aDirLn = myCutLinesBasePL->GetDirLn();
+    const vtkFloatingPointType *aBasePnt = myCutLinesBasePL->GetBasePnt();
+    const vtkFloatingPointType *aBoundPrjLn = myCutLinesBasePL->GetBoundPrjLn();
+    for(int iLine = 0, jLine = 0; iLine < iLineEnd; iLine++){
+      vtkDataSet *aDataSet = myCutLinesBasePL->GetAppendPolyData()->GetInput(iLine);
+      aDataSet->Update();
+      int aNbPoints = aDataSet->GetNumberOfPoints();
+      if(!aNbPoints) continue;
+      vtkPointData *aPointData = aDataSet->GetPointData();
+      vtkDataArray *aScalars = aPointData->GetScalars();
+      vtkCellDataToPointData *aFilter = NULL;
+      if(!aScalars) {
+       aFilter = vtkCellDataToPointData::New();
+       aFilter->SetInput(aDataSet);
+       aFilter->PassCellDataOn();
+       aDataSet = aFilter->GetOutput();
+       aDataSet->Update();
+      }
+      aPointData = aDataSet->GetPointData();
+      aScalars = aPointData->GetScalars();
+      if(!aScalars) continue;
+      if(MYDEBUG) MESSAGE("CutPlanes_i::BuildTableOfReal iLine = "<<iLine<<"; aNbPoints = "<<aNbPoints);
+      aLineIdCont[iLine] = jLine++;
+      TXYMap& aXYMap = aXYMapCont[iLine];
+      vtkFloatingPointType aPnt[3], aVect[3], aDist, aTopBnd, aDivide;
+      aTopBnd = aBoundPrjLn[2];
+      aDivide = aBoundPrjLn[2];
+      if( !IsUseAbsoluteLength() ){
+        aTopBnd = 1.0;
+      }
+      else aDivide = 1.0;
+
+      for(int i = 0; i < aNbPoints; i++){
+       aDataSet->GetPoint(i,aPnt);
+        for(int j = 0; j < 3; j++)
+          aVect[j] = aPnt[j] - aBasePnt[j];
+       //VISU::Sub(aPnt,aBasePnt,aVect);
+       if ( fabs(aBoundPrjLn[2]) < EPS_machine )
+         aDist = 0.5;
+       else
+         {
+           aDist = vtkMath::Dot(aVect,aDirLn)/aDivide; 
+           // the workaround
+           if(aDist < 0.0) aDist = 0.0; 
+           if(aDist > aTopBnd) aDist = aTopBnd;
+         }
+       aXYMap[aDist] = aScalars->GetTuple1(i);
+      }
+      if(aFilter)
+       aFilter->Delete();
+    }
+    if(aXYMapCont.size() == 0)
+      throw std::runtime_error("CutPlanes_i::BuildTableOfReal aXYMapCont.size() == 0 !!!");
+
+    {
+      // Invertion all curves in the table, which has inversion flag is TRUE (see \a myMapCurvesInverted)
+      for(int iLine=0; iLine < iLineEnd; iLine++){
+       if (!IsCurveInverted(iLine)) continue;
+       TXYMap aNewXYMap;
+       TXYMap& aXYMap = aXYMapCont[iLine];
+       TXYMap::const_iterator aXYMapIter = aXYMap.begin();
+       std::list<vtkFloatingPointType> XKeys;
+       for (;aXYMapIter != aXYMap.end() ; aXYMapIter++) XKeys.push_back(aXYMapIter->first);
+       XKeys.sort();
+       if (XKeys.size() > 1) {
+         vtkFloatingPointType a_first_indx = XKeys.front();
+         vtkFloatingPointType a_last_indx = XKeys.back();
+         if (a_first_indx > a_last_indx){
+           XKeys.reverse();
+           vtkFloatingPointType tmp = a_first_indx;
+           a_first_indx = a_last_indx;
+           a_last_indx = tmp;
+         }
+         std::list<vtkFloatingPointType>::const_iterator aIter = XKeys.begin();
+         for (int k=0;k<XKeys.size() && aIter != XKeys.end();k++,aIter++){
+           // Warning: value '1.0' come from workaround:
+           // see also aDist = vtkMath::Dot(aVect,aDirLn) / aBoundPrjLn[2];
+           // aDist >= 0 and aDist<=1.0
+           vtkFloatingPointType aTopBnd = aBoundPrjLn[2];
+           if( !IsUseAbsoluteLength() ){
+             aTopBnd = 1.0;
+           }
+           aNewXYMap[aTopBnd - *aIter] = aXYMap[*aIter];
+         }
+         TXYMap::const_iterator aNewXYMapIter = aNewXYMap.begin();
+         aXYMap.clear();
+         for (;aNewXYMapIter != aNewXYMap.end();aNewXYMapIter++) {
+           aXYMap[aNewXYMapIter->first] = aNewXYMapIter->second;
+         }
+       }
+      }
+    }
+    //Resorting of theXYMap
+    TXYMapCont::iterator aXYMapContIter = aXYMapCont.begin();
+    for(; aXYMapContIter != aXYMapCont.end(); aXYMapContIter++){
+      TXYMap& aXYMap = aXYMapContIter->second, aNewXYMap;
+      if(aXYMap.size() > 2){  
+       // Try to smooth the values of the line by applying linear approximation
+       TXYMap::const_iterator aXYMapIter[2] = {aXYMap.begin(), ++aXYMap.begin()};
+       aNewXYMap[aXYMapIter[0]->first] = aXYMapIter[0]->second;
+       aXCont.insert(aXYMapIter[0]->first);
+       for(; aXYMapIter[1] != aXYMap.end(); aXYMapIter[0]++, aXYMapIter[1]++){
+         vtkFloatingPointType aY[3] = {aXYMapIter[0]->second, aXYMapIter[1]->second, 0.0};
+         aY[2] = (aY[0] + aY[1])/2.0;
+         vtkFloatingPointType aX[3] = {aXYMapIter[0]->first, aXYMapIter[1]->first, 0.0};
+         aX[2] = (aX[0] + aX[1])/2.0;
+         aNewXYMap[aX[2]] = aY[2];
+         aXCont.insert(aX[2]);
+       }
+       aNewXYMap[aXYMapIter[0]->first] = aXYMapIter[0]->second;
+       aXCont.insert(aXYMapIter[0]->first);
+       aXYMap = aNewXYMap;
+      }else{
+       TXYMap::const_iterator aXYMapIter = aXYMap.begin();
+       for(; aXYMapIter != aXYMap.end(); aXYMapIter++)
+         aXCont.insert(aXYMapIter->first);
+      }
+    }
+    if(aXCont.size() == 0)
+      throw std::runtime_error("CutPlanes_i::BuildTableOfReal aXCont.size() == 0 !!!");
+    QString aString;
+    int iEnd = aXCont.size();
+    aTableOfReal->SetNbColumns(iEnd);
+    TXCont::const_iterator aXContIter = aXCont.begin();
+    for(long i = 0; aXContIter != aXCont.end(); aXContIter++, i++){
+      vtkFloatingPointType aDist = *aXContIter; 
+      aTableOfReal->PutValue(aDist,1,i+1);
+      aString.sprintf("%d",i);
+      aTableOfReal->SetColumnTitle(i+1,(const char*)aString.toLatin1());
+      if(MYDEBUG) MESSAGE("CutPlanes_i::BuildTableOfReal aDist = "<<aDist);
+      TXYMapCont::const_iterator aXYMapContIter = aXYMapCont.begin();
+      for(; aXYMapContIter != aXYMapCont.end(); aXYMapContIter++){
+       long iLine = aXYMapContIter->first;
+       long iLineId = aLineIdCont[iLine];
+       const TXYMap& aXYMap = aXYMapCont[iLine];
+       TXYMap::const_iterator aXYMapIter = aXYMap.find(aDist);
+       // Can we find some value that belong to the line and have the same X coordinate?
+       if(aXYMapIter == aXYMap.end()) continue;
+       vtkFloatingPointType aVal = aXYMapIter->second;
+       aTableOfReal->PutValue(aVal,iLineId+2,i+1);
+      }
+    }
+    {
+      aTableOfReal->SetRowTitle(1,"X");
+      aTableOfReal->SetRowUnit(1,"-");
+      QString aUnitName = GetField()->myUnitNames[0].c_str();
+      int aScalarMode = myCutLinesBasePL->GetScalarMode();
+      if(aScalarMode != 0) 
+       aUnitName = GetField()->myUnitNames[aScalarMode-1].c_str();
+      aUnitName = aUnitName.simplified();
+      if(aUnitName.isEmpty()) aUnitName = "-";
+      TXYMapCont::const_iterator aXYMapContIter = aXYMapCont.begin();
+      for(; aXYMapContIter != aXYMapCont.end(); aXYMapContIter++){
+       long iLine = aXYMapContIter->first;
+       long iLineId = aLineIdCont[iLine];
+       aString.sprintf("Y%d",iLine);
+       if(MYDEBUG) 
+         MESSAGE("CutPlanes_i::BuildTableOfReal - SetRowTitle("<<iLineId+2<<",'"<<(const char*)aString.toLatin1()<<"')");
+       aTableOfReal->SetRowTitle(iLineId+2,(const char*)aString.toLatin1());
+       aTableOfReal->SetRowUnit(iLineId+2,(const char*)aUnitName.toLatin1());
+      }
+    }
+  }catch(std::exception& exc){
+    INFOS("Follow exception was occured :\n"<<exc.what());
+  }catch (...){
+    INFOS("Unknown exception was occured !!!");
+  }
+}
diff --git a/src/VISU_I/VISU_CutLinesBase_i.hh b/src/VISU_I/VISU_CutLinesBase_i.hh
new file mode 100644 (file)
index 0000000..db1535a
--- /dev/null
@@ -0,0 +1,140 @@
+//  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+//  File   : VISU_CutLinesBase_i.hh
+//  Author : Oleg UVAROV
+//  Module : VISU
+//
+#ifndef VISU_CutLinesBase_i_HeaderFile
+#define VISU_CutLinesBase_i_HeaderFile
+
+#include "VISU_I.hxx"
+#include "VISU_ScalarMap_i.hh"
+
+class VISU_CutLinesBasePL;
+
+namespace VISU
+{
+  //----------------------------------------------------------------------------
+  class VISU_I_EXPORT CutLinesBase_i : public virtual POA_VISU::CutLinesBase,
+                                      public virtual ScalarMap_i
+  {
+    CutLinesBase_i(const CutLinesBase_i&);
+
+  public:
+    //----------------------------------------------------------------------------
+    typedef ScalarMap_i TSuperClass;
+    typedef VISU::CutLinesBase TInterface;
+
+    explicit
+    CutLinesBase_i(EPublishInStudyMode thePublishInStudyModep);
+
+    virtual
+    ~CutLinesBase_i();
+
+    virtual 
+    void 
+    SetNbLines(CORBA::Long theNb);
+
+    virtual
+    CORBA::Long
+    GetNbLines();
+
+    virtual
+    void
+    SetAllCurvesInverted(CORBA::Boolean theInvert);
+
+    virtual
+    CORBA::Boolean
+    IsAllCurvesInverted();
+
+    virtual
+    void
+    SetCurveInverted(CORBA::Long theCurveNumber,
+                    CORBA::Boolean theInvert);
+
+    virtual
+    CORBA::Boolean
+    IsCurveInverted(CORBA::Long theCurveNumber);
+
+    virtual
+    void
+    SetUseAbsoluteLength(CORBA::Boolean theAbsLength);
+
+    virtual
+    CORBA::Boolean 
+    IsUseAbsoluteLength();
+
+    typedef std::map<int,bool> TCurvesInv;
+    TCurvesInv
+    GetCurvesInverted() 
+    {
+      return myMapCurvesInverted;
+    }
+
+    void
+    CopyCurvesInverted(const TCurvesInv& theCurves);
+
+    VISU_CutLinesBasePL* 
+    GetSpecificPL() const
+    { 
+      return myCutLinesBasePL; 
+    }
+    
+  protected:
+    //! Extends VISU_ColoredPrs3d_i::CreatePipeLine
+    virtual 
+    void
+    CreatePipeLine(VISU_PipeLine* thePipeLine);
+
+    VISU_CutLinesBasePL *myCutLinesBasePL;
+    TCurvesInv myMapCurvesInverted;
+    CORBA::Boolean myUseAbsLength;
+
+  public:
+    //! Extends VISU_ColoredPrs3d_i::Create
+    virtual 
+    Storable* 
+    Create(const std::string& theMeshName, 
+          VISU::Entity theEntity,
+          const std::string& theFieldName, 
+          CORBA::Long theTimeStampNumber);
+
+    //! Extends VISU_ColoredPrs3d_i::ToStream
+    virtual 
+    void
+    ToStream(std::ostringstream& theStr);
+
+    //! Extends VISU_ColoredPrs3d_i::Restore
+    virtual
+    Storable* 
+    Restore(SALOMEDS::SObject_ptr theSObject,
+           const Storable::TRestoringMap& theMap);
+
+    virtual 
+    void
+    SameAs(const Prs3d_i* theOrigin);
+
+    void BuildTableOfReal(SALOMEDS::SObject_var theSObject);
+  };
+}
+
+#endif
index 76dfaab6dbd9fdd76c43deb3ff233425ddb9ecab..a1dccb01ee4899bcca00e57490c7971d14125ebd 100644 (file)
@@ -38,8 +38,6 @@
 
 #include <vtkAppendPolyData.h>
 
-static vtkFloatingPointType EPS_machine = 1.0E-7;
-
 #ifdef _DEBUG_
 static int MYDEBUG = 0;
 #else
@@ -103,7 +101,7 @@ VISU::CutLines_i::
 CutLines_i(EPublishInStudyMode thePublishInStudyMode) :
   ColoredPrs3d_i(thePublishInStudyMode),
   ScalarMap_i(thePublishInStudyMode),
-  myUseAbsLength( false ),
+  CutLinesBase_i(thePublishInStudyMode),
   myCutLinesPL(NULL)
 {}
 
@@ -114,24 +112,6 @@ VISU::CutLines_i
 ::SameAs(const Prs3d_i* theOrigin)
 {
   TSuperClass::SameAs(theOrigin);
-
-  if(const CutLines_i* aPrs3d = dynamic_cast<const CutLines_i*>(theOrigin)){
-    CutLines_i* anOrigin = const_cast<CutLines_i*>(aPrs3d);
-    myUseAbsLength = anOrigin->IsUseAbsoluteLength();
-    CopyCurvesInverted(anOrigin->GetCurvesInverted());
-  }
-}
-
-
-//---------------------------------------------------------------
-/*! Copy map to /a myMapCurvesInverted.
- * \param theCurves - map
- */
-void 
-VISU::CutLines_i
-::CopyCurvesInverted(const TCurvesInv& theCurves)
-{
-  myMapCurvesInverted = theCurves;
 }
 
 
@@ -143,9 +123,6 @@ VISU::CutLines_i
         const std::string& theFieldName, 
         CORBA::Long theTimeStampNumber)
 {
-  SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
-  SetUseAbsoluteLength( aResourceMgr->booleanValue( "VISU", "use_absolute_length", false ) );
-  SetAllCurvesInverted( aResourceMgr->booleanValue( "VISU", "invert_all_curves", false ) );
   return TSuperClass::Create(theMeshName,theEntity,theFieldName,theTimeStampNumber);
 }
 
@@ -159,7 +136,6 @@ VISU::CutLines_i
   if(!TSuperClass::Restore(theSObject, theMap))
     return NULL;
 
-  SetNbLines(VISU::Storable::FindValue(theMap,"myNbLines").toInt());
   SetDisplacement(VISU::Storable::FindValue(theMap,"myDisplacement[0]").toDouble());
   SetDisplacement2(VISU::Storable::FindValue(theMap,"myDisplacement[1]").toDouble());
   SetOrientation(CutPlanes::Orientation(VISU::Storable::FindValue(theMap,"myBasePlane[0]").toInt()),
@@ -168,7 +144,6 @@ VISU::CutLines_i
   SetOrientation2(CutPlanes::Orientation(VISU::Storable::FindValue(theMap,"myBasePlane[1]").toInt()),
                  Storable::FindValue(theMap,"aRot[1][0]").toDouble(),
                  Storable::FindValue(theMap,"aRot[1][1]").toDouble());
-  SetUseAbsoluteLength(VISU::Storable::FindValue(theMap,"myUseAbsLength").toInt());
 
   if (VISU::Storable::FindValue(theMap,"myBasePlaneCondition").toInt())
     SetDefault();
@@ -181,20 +156,6 @@ VISU::CutLines_i
     if(aCondList[i].toInt() == 0)
       SetLinePosition(i,aPosList[i].toDouble());
 
-  // Restoring the map - \a myMapCurvesInverted
-  QStringList aMapCurvesInverted = VISU::Storable::FindValue(theMap,"myMapCurvesInverted").split("|",QString::SkipEmptyParts );
-  if (aMapCurvesInverted.count() == GetNbLines()){
-    for(int i = 0, iEnd = GetNbLines(); i < iEnd ; i++){
-      if(aMapCurvesInverted[i].toInt())
-       SetCurveInverted(i,true);
-      else
-       SetCurveInverted(i,false);
-    }
-  } else {
-    for(int i = 0, iEnd = GetNbLines(); i < iEnd ; i++)
-      SetCurveInverted(i,false);
-  }
-      
   return this;
 }
 
@@ -206,9 +167,6 @@ VISU::CutLines_i
 {
   TSuperClass::ToStream(theStr);
 
-  int aNbLines = GetNbLines();
-  
-  Storable::DataToStream( theStr, "myNbLines",         aNbLines );
   Storable::DataToStream( theStr, "myDisplacement[0]", GetDisplacement() );
   Storable::DataToStream( theStr, "myDisplacement[1]", GetDisplacement2() );
   Storable::DataToStream( theStr, "myBasePlane[0]",    int(GetOrientationType()) );
@@ -228,13 +186,6 @@ VISU::CutLines_i
 
   Storable::DataToStream( theStr, "myLinePosition",  (const char*)aStrPos.toLatin1());
   Storable::DataToStream( theStr, "myLineCondition", (const char*)aStrCon.toLatin1());
-  Storable::DataToStream( theStr,"myUseAbsLength", IsUseAbsoluteLength());
-
-  // Storing the map - \a myMapCurvesInverted
-  QString aStrCurvesInverted;
-  for(int i = 0, iEnd = GetNbLines(); i < iEnd; i++) 
-    aStrCurvesInverted.append(QString::number(IsCurveInverted(i)) + "|");
-  Storable::DataToStream( theStr, "myMapCurvesInverted", (const char*)aStrCurvesInverted.toLatin1());
 }
 
 
@@ -489,107 +440,6 @@ VISU::CutLines_i
   return myCutLinesPL->IsPartDefault(thePlaneNumber);
 }
 
-//---------------------------------------------------------------
-/*! Invert all curves of corresponding table
- * see void VISU::CutLines_i::SetCurveInverted(CORBA::Long theCurveNumber,CORBA::Boolean theInvert)
- * \param theInvert - Invert all curves, if value is TRUE, else not.
- */
-void
-VISU::CutLines_i
-::SetAllCurvesInverted(CORBA::Boolean theInvert)
-{
-  for(int i=0; i < GetNbLines(); i++)
-    SetCurveInverted(i, theInvert);
-}
-
-//---------------------------------------------------------------
-/*! Checks the orientation of all curves
- * \retval TRUE - if all curves are inverted, else FALSE
- */
-CORBA::Boolean 
-VISU::CutLines_i
-::IsAllCurvesInverted()
-{
-  for (int i=0; i<GetNbLines(); i++)
-    if (!IsCurveInverted(i)) return false;
-  return true;
-}
-
-//---------------------------------------------------------------
-/*! Sets orientation of curve
- * \param theCurveNumber - integer value, number of cut line.
- * \param theInvert      - boolean value, TRUE or false.
- */
-void
-VISU::CutLines_i
-::SetCurveInverted(CORBA::Long theCurveNumber, CORBA::Boolean theInvert)
-{
-  if(myMapCurvesInverted[theCurveNumber] == theInvert)
-    return;
-
-  VISU::TSetModified aModified(this);
-
-  myMapCurvesInverted[theCurveNumber] = theInvert;
-  myParamsTime.Modified();
-}
-
-//---------------------------------------------------------------
-/*! Checks orientation of curve.
- * \param theCurveNumber - integer value, number of cut line.
- * \retval TRUE - if line in the table is inverted, else FALSE.
- */
-CORBA::Boolean
-VISU::CutLines_i
-::IsCurveInverted(CORBA::Long theCurveNumber)
-{
-  return myMapCurvesInverted[theCurveNumber];
-}
-
-//---------------------------------------------------------------
-/*! It control the way the length of cutlines is shown: using aboslute or relative values
-* \param theAbsLength - boolean value, TRUE or false.
-*/
-void
-VISU::CutLines_i
-::SetUseAbsoluteLength(CORBA::Boolean theAbsLength)
-{
-  if ( myUseAbsLength == theAbsLength )
-    return;
-
-  VISU::TSetModified aModified(this);
-
-  myUseAbsLength = theAbsLength;
-  myParamsTime.Modified();
-}
-
-//---------------------------------------------------------------
-CORBA::Boolean
-VISU::CutLines_i
-::IsUseAbsoluteLength()
-{
-  return myUseAbsLength;
-}
-
-//---------------------------------------------------------------
-void
-VISU::CutLines_i
-::SetNbLines(CORBA::Long theNb) 
-{ 
-  VISU::TSetModified aModified(this);
-
-  ProcessVoidEvent(new TVoidMemFun1ArgEvent<VISU_CutLinesPL, int>
-                  (GetSpecificPL(), &VISU_CutLinesPL::SetNbParts, theNb));
-}
-
-//---------------------------------------------------------------
-CORBA::Long
-VISU::CutLines_i
-::GetNbLines() 
-{ 
-  return myCutLinesPL->GetNbParts();
-}
-
-
 //---------------------------------------------------------------
 void
 VISU::CutLines_i
@@ -627,199 +477,3 @@ VISU::CutLines_i
   }
   return NULL;
 }
-
-//---------------------------------------------------------------
-void
-VISU::CutLines_i
-::BuildTableOfReal(SALOMEDS::SObject_var theSObject)
-{
-  try{
-    if(MYDEBUG) MESSAGE("CutPlanes_i::BuildTableOfReal");
-    Update();
-    SALOMEDS::GenericAttribute_var anAttr;
-    SALOMEDS::StudyBuilder_var aStudyBuilder = GetStudyDocument()->NewBuilder();
-    anAttr = aStudyBuilder->FindOrCreateAttribute(theSObject, "AttributeTableOfReal");
-    SALOMEDS::AttributeTableOfReal_var aTableOfReal = SALOMEDS::AttributeTableOfReal::_narrow(anAttr);
-    
-    typedef set<vtkFloatingPointType> TXCont;
-    typedef map<vtkFloatingPointType,vtkFloatingPointType> TXYMap;
-    typedef map<int,TXYMap> TXYMapCont;
-    typedef map<long,long> TLineIdCont;
-    
-    QString aTitle( GetScalarBarTitle().c_str() );
-    aTitle = aTitle.simplified();
-    aTableOfReal->SetTitle( aTitle.toLatin1().data() );
-    
-    int iLineEnd = myCutLinesPL->GetAppendPolyData()->GetNumberOfInputConnections(0);
-    if(MYDEBUG) MESSAGE("CutPlanes_i::BuildTableOfReal iLineEnd = "<<iLineEnd);
-    TXCont aXCont;
-    TXYMapCont aXYMapCont; 
-    TLineIdCont aLineIdCont;  // Define internal numeration of lines
-    const vtkFloatingPointType *aDirLn = myCutLinesPL->GetDirLn();
-    const vtkFloatingPointType *aBasePnt = myCutLinesPL->GetBasePnt();
-    const vtkFloatingPointType *aBoundPrjLn = myCutLinesPL->GetBoundPrjLn();
-    for(int iLine = 0, jLine = 0; iLine < iLineEnd; iLine++){
-      vtkDataSet *aDataSet = myCutLinesPL->GetAppendPolyData()->GetInput(iLine);
-      aDataSet->Update();
-      int aNbPoints = aDataSet->GetNumberOfPoints();
-      if(!aNbPoints) continue;
-      vtkPointData *aPointData = aDataSet->GetPointData();
-      vtkDataArray *aScalars = aPointData->GetScalars();
-      vtkCellDataToPointData *aFilter = NULL;
-      if(!aScalars) {
-       aFilter = vtkCellDataToPointData::New();
-       aFilter->SetInput(aDataSet);
-       aFilter->PassCellDataOn();
-       aDataSet = aFilter->GetOutput();
-       aDataSet->Update();
-      }
-      aPointData = aDataSet->GetPointData();
-      aScalars = aPointData->GetScalars();
-      if(!aScalars) continue;
-      if(MYDEBUG) MESSAGE("CutPlanes_i::BuildTableOfReal iLine = "<<iLine<<"; aNbPoints = "<<aNbPoints);
-      aLineIdCont[iLine] = jLine++;
-      TXYMap& aXYMap = aXYMapCont[iLine];
-      vtkFloatingPointType aPnt[3], aVect[3], aDist, aTopBnd, aDivide;
-      aTopBnd = aBoundPrjLn[2];
-      aDivide = aBoundPrjLn[2];
-      if( !IsUseAbsoluteLength() ){
-        aTopBnd = 1.0;
-      }
-      else aDivide = 1.0;
-
-      for(int i = 0; i < aNbPoints; i++){
-       aDataSet->GetPoint(i,aPnt);
-        for(int j = 0; j < 3; j++)
-          aVect[j] = aPnt[j] - aBasePnt[j];
-       //VISU::Sub(aPnt,aBasePnt,aVect);
-       if ( fabs(aBoundPrjLn[2]) < EPS_machine )
-         aDist = 0.5;
-       else
-         {
-           aDist = vtkMath::Dot(aVect,aDirLn)/aDivide; 
-           // the workaround
-           if(aDist < 0.0) aDist = 0.0; 
-           if(aDist > aTopBnd) aDist = aTopBnd;
-         }
-       aXYMap[aDist] = aScalars->GetTuple1(i);
-      }
-      if(aFilter)
-       aFilter->Delete();
-    }
-    if(aXYMapCont.size() == 0)
-      throw std::runtime_error("CutPlanes_i::BuildTableOfReal aXYMapCont.size() == 0 !!!");
-
-    {
-      // Invertion all curves in the table, which has inversion flag is TRUE (see \a myMapCurvesInverted)
-      for(int iLine=0; iLine < iLineEnd; iLine++){
-       if (!IsCurveInverted(iLine)) continue;
-       TXYMap aNewXYMap;
-       TXYMap& aXYMap = aXYMapCont[iLine];
-       TXYMap::const_iterator aXYMapIter = aXYMap.begin();
-       std::list<vtkFloatingPointType> XKeys;
-       for (;aXYMapIter != aXYMap.end() ; aXYMapIter++) XKeys.push_back(aXYMapIter->first);
-       XKeys.sort();
-       if (XKeys.size() > 1) {
-         vtkFloatingPointType a_first_indx = XKeys.front();
-         vtkFloatingPointType a_last_indx = XKeys.back();
-         if (a_first_indx > a_last_indx){
-           XKeys.reverse();
-           vtkFloatingPointType tmp = a_first_indx;
-           a_first_indx = a_last_indx;
-           a_last_indx = tmp;
-         }
-         std::list<vtkFloatingPointType>::const_iterator aIter = XKeys.begin();
-         for (int k=0;k<XKeys.size() && aIter != XKeys.end();k++,aIter++){
-           // Warning: value '1.0' come from workaround:
-           // see also aDist = vtkMath::Dot(aVect,aDirLn) / aBoundPrjLn[2];
-           // aDist >= 0 and aDist<=1.0
-           vtkFloatingPointType aTopBnd = aBoundPrjLn[2];
-           if( !IsUseAbsoluteLength() ){
-             aTopBnd = 1.0;
-           }
-           aNewXYMap[aTopBnd - *aIter] = aXYMap[*aIter];
-         }
-         TXYMap::const_iterator aNewXYMapIter = aNewXYMap.begin();
-         aXYMap.clear();
-         for (;aNewXYMapIter != aNewXYMap.end();aNewXYMapIter++) {
-           aXYMap[aNewXYMapIter->first] = aNewXYMapIter->second;
-         }
-       }
-      }
-    }
-    //Resorting of theXYMap
-    TXYMapCont::iterator aXYMapContIter = aXYMapCont.begin();
-    for(; aXYMapContIter != aXYMapCont.end(); aXYMapContIter++){
-      TXYMap& aXYMap = aXYMapContIter->second, aNewXYMap;
-      if(aXYMap.size() > 2){  
-       // Try to smooth the values of the line by applying linear approximation
-       TXYMap::const_iterator aXYMapIter[2] = {aXYMap.begin(), ++aXYMap.begin()};
-       aNewXYMap[aXYMapIter[0]->first] = aXYMapIter[0]->second;
-       aXCont.insert(aXYMapIter[0]->first);
-       for(; aXYMapIter[1] != aXYMap.end(); aXYMapIter[0]++, aXYMapIter[1]++){
-         vtkFloatingPointType aY[3] = {aXYMapIter[0]->second, aXYMapIter[1]->second, 0.0};
-         aY[2] = (aY[0] + aY[1])/2.0;
-         vtkFloatingPointType aX[3] = {aXYMapIter[0]->first, aXYMapIter[1]->first, 0.0};
-         aX[2] = (aX[0] + aX[1])/2.0;
-         aNewXYMap[aX[2]] = aY[2];
-         aXCont.insert(aX[2]);
-       }
-       aNewXYMap[aXYMapIter[0]->first] = aXYMapIter[0]->second;
-       aXCont.insert(aXYMapIter[0]->first);
-       aXYMap = aNewXYMap;
-      }else{
-       TXYMap::const_iterator aXYMapIter = aXYMap.begin();
-       for(; aXYMapIter != aXYMap.end(); aXYMapIter++)
-         aXCont.insert(aXYMapIter->first);
-      }
-    }
-    if(aXCont.size() == 0)
-      throw std::runtime_error("CutPlanes_i::BuildTableOfReal aXCont.size() == 0 !!!");
-    QString aString;
-    int iEnd = aXCont.size();
-    aTableOfReal->SetNbColumns(iEnd);
-    TXCont::const_iterator aXContIter = aXCont.begin();
-    for(long i = 0; aXContIter != aXCont.end(); aXContIter++, i++){
-      vtkFloatingPointType aDist = *aXContIter; 
-      aTableOfReal->PutValue(aDist,1,i+1);
-      aString.sprintf("%d",i);
-      aTableOfReal->SetColumnTitle(i+1,(const char*)aString.toLatin1());
-      if(MYDEBUG) MESSAGE("CutPlanes_i::BuildTableOfReal aDist = "<<aDist);
-      TXYMapCont::const_iterator aXYMapContIter = aXYMapCont.begin();
-      for(; aXYMapContIter != aXYMapCont.end(); aXYMapContIter++){
-       long iLine = aXYMapContIter->first;
-       long iLineId = aLineIdCont[iLine];
-       const TXYMap& aXYMap = aXYMapCont[iLine];
-       TXYMap::const_iterator aXYMapIter = aXYMap.find(aDist);
-       // Can we find some value that belong to the line and have the same X coordinate?
-       if(aXYMapIter == aXYMap.end()) continue;
-       vtkFloatingPointType aVal = aXYMapIter->second;
-       aTableOfReal->PutValue(aVal,iLineId+2,i+1);
-      }
-    }
-    {
-      aTableOfReal->SetRowTitle(1,"X");
-      aTableOfReal->SetRowUnit(1,"-");
-      QString aUnitName = GetField()->myUnitNames[0].c_str();
-      int aScalarMode = myCutLinesPL->GetScalarMode();
-      if(aScalarMode != 0) 
-       aUnitName = GetField()->myUnitNames[aScalarMode-1].c_str();
-      aUnitName = aUnitName.simplified();
-      if(aUnitName.isEmpty()) aUnitName = "-";
-      TXYMapCont::const_iterator aXYMapContIter = aXYMapCont.begin();
-      for(; aXYMapContIter != aXYMapCont.end(); aXYMapContIter++){
-       long iLine = aXYMapContIter->first;
-       long iLineId = aLineIdCont[iLine];
-       aString.sprintf("Y%d",iLine);
-       if(MYDEBUG) 
-         MESSAGE("CutPlanes_i::BuildTableOfReal - SetRowTitle("<<iLineId+2<<",'"<<(const char*)aString.toLatin1()<<"')");
-       aTableOfReal->SetRowTitle(iLineId+2,(const char*)aString.toLatin1());
-       aTableOfReal->SetRowUnit(iLineId+2,(const char*)aUnitName.toLatin1());
-      }
-    }
-  }catch(std::exception& exc){
-    INFOS("Follow exception was occured :\n"<<exc.what());
-  }catch (...){
-    INFOS("Unknown exception was occured !!!");
-  }
-}
index 41c53209dfb136dbdc2ad7ae4fd0f9ab511a1f6f..daccbc3af8f3101e7489c85fe5a99d40df83bba5 100644 (file)
@@ -28,7 +28,7 @@
 #define VISU_CutLines_i_HeaderFile
 
 #include "VISU_I.hxx"
-#include "VISU_ScalarMap_i.hh"
+#include "VISU_CutLinesBase_i.hh"
 
 class VISU_CutLinesPL;
 
@@ -36,14 +36,14 @@ namespace VISU
 {
   //----------------------------------------------------------------------------
   class VISU_I_EXPORT CutLines_i : public virtual POA_VISU::CutLines,
-                                   public virtual ScalarMap_i
+                                   public virtual CutLinesBase_i
   {
     static int myNbPresent;
-       CutLines_i(const CutLines_i&);
+    CutLines_i(const CutLines_i&);
 
   public:
     //----------------------------------------------------------------------------
-    typedef ScalarMap_i TSuperClass;
+    typedef CutLinesBase_i TSuperClass;
     typedef VISU::CutLines TInterface;
 
     explicit
@@ -144,49 +144,6 @@ namespace VISU
     CORBA::Boolean 
     IsDefaultPosition(CORBA::Long thePlaneNumber);
 
-    virtual
-    void
-    SetAllCurvesInverted(CORBA::Boolean theInvert);
-
-    virtual
-    CORBA::Boolean
-    IsAllCurvesInverted();
-
-    virtual
-    void
-    SetCurveInverted(CORBA::Long theCurveNumber,
-                    CORBA::Boolean theInvert);
-
-    virtual
-    CORBA::Boolean
-    IsCurveInverted(CORBA::Long theCurveNumber);
-
-    virtual
-    void
-    SetUseAbsoluteLength(CORBA::Boolean theAbsLength);
-
-    virtual
-    CORBA::Boolean 
-    IsUseAbsoluteLength();
-
-    virtual 
-    void 
-    SetNbLines(CORBA::Long theNb);
-
-    virtual
-    CORBA::Long
-    GetNbLines();
-
-    typedef std::map<int,bool> TCurvesInv;
-    TCurvesInv
-    GetCurvesInverted() 
-    {
-      return myMapCurvesInverted;
-    }
-
-    void
-    CopyCurvesInverted(const TCurvesInv& theCurves);
-
     VISU_CutLinesPL* 
     GetSpecificPL() const
     { 
@@ -209,8 +166,6 @@ namespace VISU
     GetIconName();
 
     VISU_CutLinesPL *myCutLinesPL;
-    TCurvesInv myMapCurvesInverted;
-    CORBA::Boolean myUseAbsLength;
 
   public:
     //! Extends VISU_ColoredPrs3d_i::IsPossible
@@ -251,8 +206,6 @@ namespace VISU
     VISU_Actor* 
     CreateActor();
 
-    void BuildTableOfReal(SALOMEDS::SObject_var theSObject);
-
     static const std::string myComment;
 
     virtual
diff --git a/src/VISU_I/VISU_CutSegment_i.cc b/src/VISU_I/VISU_CutSegment_i.cc
new file mode 100644 (file)
index 0000000..4e01b20
--- /dev/null
@@ -0,0 +1,305 @@
+//  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+//  File   : VISU_CutSegment_i.cc
+//  Author : Oleg UVAROV
+//  Module : VISU
+//
+#include "VISU_CutSegment_i.hh"
+#include "VISU_Prs3dUtils.hh"
+#include "VISU_Result_i.hh"
+
+#include "VISU_Actor.h"
+#include "VISU_CutSegmentPL.hxx"
+#include "VISU_Convertor.hxx"
+#include "VISU_PipeLineUtils.hxx"
+
+#include "SUIT_ResourceMgr.h"
+#include "SALOME_Event.h"
+
+#include <vtkAppendPolyData.h>
+
+#ifdef _DEBUG_
+static int MYDEBUG = 0;
+#else
+static int MYDEBUG = 0;
+#endif
+
+using namespace std;
+
+//---------------------------------------------------------------
+size_t
+VISU::CutSegment_i
+::IsPossible(Result_i* theResult, 
+            const std::string& theMeshName, 
+            VISU::Entity theEntity, 
+            const std::string& theFieldName, 
+            CORBA::Long theTimeStampNumber, 
+            bool theIsMemoryCheck)
+{
+  return TSuperClass::IsPossible(theResult,
+                                theMeshName,
+                                theEntity,
+                                theFieldName,
+                                theTimeStampNumber,
+                                theIsMemoryCheck);
+}
+
+//---------------------------------------------------------------
+int VISU::CutSegment_i::myNbPresent = 0;
+
+//---------------------------------------------------------------
+QString 
+VISU::CutSegment_i::GenerateName() 
+{ 
+  return VISU::GenerateName("CutSegment",myNbPresent++);
+}
+
+//---------------------------------------------------------------
+const string VISU::CutSegment_i::myComment = "CUTSEGMENT";
+
+//---------------------------------------------------------------
+const char* 
+VISU::CutSegment_i
+::GetComment() const 
+{ 
+  return myComment.c_str();
+}
+
+//----------------------------------------------------------------------------
+const char*
+VISU::CutSegment_i
+::GetIconName()
+{
+  if (!IsGroupsUsed())
+    return "ICON_TREE_CUT_SEGMENT";
+  else
+    return "ICON_TREE_CUT_SEGMENT_GROUPS";
+}
+
+//---------------------------------------------------------------
+VISU::CutSegment_i::
+CutSegment_i(EPublishInStudyMode thePublishInStudyMode) :
+  ColoredPrs3d_i(thePublishInStudyMode),
+  ScalarMap_i(thePublishInStudyMode),
+  CutLinesBase_i(thePublishInStudyMode),
+  myCutSegmentPL(NULL)
+{}
+
+
+//---------------------------------------------------------------
+void
+VISU::CutSegment_i
+::SameAs(const Prs3d_i* theOrigin)
+{
+  TSuperClass::SameAs(theOrigin);
+}
+
+
+//---------------------------------------------------------------
+VISU::Storable* 
+VISU::CutSegment_i
+::Create(const std::string& theMeshName, 
+        VISU::Entity theEntity,
+        const std::string& theFieldName, 
+        CORBA::Long theTimeStampNumber)
+{
+  return TSuperClass::Create(theMeshName,theEntity,theFieldName,theTimeStampNumber);
+}
+
+
+//---------------------------------------------------------------
+VISU::Storable* 
+VISU::CutSegment_i
+::Restore(SALOMEDS::SObject_ptr theSObject,
+         const Storable::TRestoringMap& theMap)
+{
+  if(!TSuperClass::Restore(theSObject, theMap))
+    return NULL;
+
+  SetPoint1(VISU::Storable::FindValue(theMap,"myPoint1[0]").toDouble(),
+           VISU::Storable::FindValue(theMap,"myPoint1[1]").toDouble(),
+           VISU::Storable::FindValue(theMap,"myPoint1[2]").toDouble());
+  SetPoint2(VISU::Storable::FindValue(theMap,"myPoint2[0]").toDouble(),
+           VISU::Storable::FindValue(theMap,"myPoint2[1]").toDouble(),
+           VISU::Storable::FindValue(theMap,"myPoint2[2]").toDouble());
+
+  return this;
+}
+
+
+//---------------------------------------------------------------
+void
+VISU::CutSegment_i
+::ToStream(std::ostringstream& theStr)
+{
+  TSuperClass::ToStream(theStr);
+
+  double aCoord[3];
+  GetPoint1( aCoord[0], aCoord[1], aCoord[2] );
+  Storable::DataToStream( theStr, "myPoint1[0]",       aCoord[0] );
+  Storable::DataToStream( theStr, "myPoint1[1]",       aCoord[1] );
+  Storable::DataToStream( theStr, "myPoint1[2]",       aCoord[2] );
+
+  GetPoint2( aCoord[0], aCoord[1], aCoord[2] );
+  Storable::DataToStream( theStr, "myPoint2[0]",       aCoord[0] );
+  Storable::DataToStream( theStr, "myPoint2[1]",       aCoord[1] );
+  Storable::DataToStream( theStr, "myPoint2[2]",       aCoord[2] );
+}
+
+
+//---------------------------------------------------------------
+VISU::CutSegment_i
+::~CutSegment_i()
+{
+  if(MYDEBUG) MESSAGE("CutSegment_i::~CutSegment_i()");
+}
+
+
+//---------------------------------------------------------------
+struct TSetPoint1Event: public SALOME_Event 
+{
+  VISU_CutSegmentPL* myCutSegmentPL;
+  CORBA::Double myX, myY, myZ;
+  TSetPoint1Event(VISU_CutSegmentPL* theCutSegment, 
+        CORBA::Double theX, 
+        CORBA::Double theY,
+        CORBA::Double theZ):
+    myCutSegmentPL(theCutSegment), 
+    myX(theX), 
+    myY(theY),
+    myZ(theZ)
+  {}
+
+  virtual
+  void
+  Execute()
+  {
+    myCutSegmentPL->SetPoint1(myX, myY, myZ);
+  }
+};
+
+void
+VISU::CutSegment_i
+::SetPoint1(CORBA::Double theX,
+           CORBA::Double theY,
+           CORBA::Double theZ)
+{
+  VISU::TSetModified aModified(this);
+
+  ProcessVoidEvent(new TSetPoint1Event(myCutSegmentPL, theX, theY, theZ));
+}
+
+
+//---------------------------------------------------------------
+void
+VISU::CutSegment_i
+::GetPoint1(CORBA::Double& theX,
+           CORBA::Double& theY,
+           CORBA::Double& theZ)
+{
+  myCutSegmentPL->GetPoint1(theX, theY, theZ);
+}
+
+
+//---------------------------------------------------------------
+struct TSetPoint2Event: public SALOME_Event 
+{
+  VISU_CutSegmentPL* myCutSegmentPL;
+  CORBA::Double myX, myY, myZ;
+  TSetPoint2Event(VISU_CutSegmentPL* theCutSegment, 
+        CORBA::Double theX, 
+        CORBA::Double theY,
+        CORBA::Double theZ):
+    myCutSegmentPL(theCutSegment), 
+    myX(theX), 
+    myY(theY),
+    myZ(theZ)
+  {}
+
+  virtual
+  void
+  Execute()
+  {
+    myCutSegmentPL->SetPoint2(myX, myY, myZ);
+  }
+};
+
+void
+VISU::CutSegment_i
+::SetPoint2(CORBA::Double theX,
+           CORBA::Double theY,
+           CORBA::Double theZ)
+{
+  VISU::TSetModified aModified(this);
+
+  ProcessVoidEvent(new TSetPoint2Event(myCutSegmentPL, theX, theY, theZ));
+}
+
+
+//---------------------------------------------------------------
+void
+VISU::CutSegment_i
+::GetPoint2(CORBA::Double& theX,
+           CORBA::Double& theY,
+           CORBA::Double& theZ)
+{
+  myCutSegmentPL->GetPoint2(theX, theY, theZ);
+}
+
+
+//---------------------------------------------------------------
+void
+VISU::CutSegment_i
+::CreatePipeLine(VISU_PipeLine* thePipeLine)
+{
+  if(!thePipeLine){
+    myCutSegmentPL = VISU_CutSegmentPL::New();
+  }else
+    myCutSegmentPL = dynamic_cast<VISU_CutSegmentPL*>(thePipeLine);
+
+  TSuperClass::CreatePipeLine(myCutSegmentPL);
+}
+
+
+//----------------------------------------------------------------------------
+bool
+VISU::CutSegment_i
+::CheckIsPossible() 
+{
+  return IsPossible(GetCResult(),GetCMeshName(),GetEntity(),GetCFieldName(),GetTimeStampNumber(),true);
+}
+
+
+//---------------------------------------------------------------
+VISU_Actor* 
+VISU::CutSegment_i
+::CreateActor()
+{
+  if(VISU_Actor* anActor = TSuperClass::CreateActor()){
+    anActor->SetVTKMapping(true);
+    SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
+    int aDispMode = aResourceMgr->integerValue("VISU", "cut_segment_represent", 2);
+    anActor->SetRepresentation(aDispMode);
+    return anActor;
+  }
+  return NULL;
+}
diff --git a/src/VISU_I/VISU_CutSegment_i.hh b/src/VISU_I/VISU_CutSegment_i.hh
new file mode 100644 (file)
index 0000000..6f7abdc
--- /dev/null
@@ -0,0 +1,159 @@
+//  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+//  File   : VISU_CutSegment_i.hh
+//  Author : Oleg UVAROV
+//  Module : VISU
+//
+#ifndef VISU_CutSegment_i_HeaderFile
+#define VISU_CutSegment_i_HeaderFile
+
+#include "VISU_I.hxx"
+#include "VISU_CutLinesBase_i.hh"
+
+class VISU_CutSegmentPL;
+
+namespace VISU
+{
+  //----------------------------------------------------------------------------
+  class VISU_I_EXPORT CutSegment_i : public virtual POA_VISU::CutSegment,
+                                     public virtual CutLinesBase_i
+  {
+    static int myNbPresent;
+    CutSegment_i(const CutSegment_i&);
+
+  public:
+    //----------------------------------------------------------------------------
+    typedef CutLinesBase_i TSuperClass;
+    typedef VISU::CutSegment TInterface;
+
+    explicit
+    CutSegment_i(EPublishInStudyMode thePublishInStudyModep);
+
+    virtual
+    ~CutSegment_i();
+
+    virtual
+    VISU::VISUType
+    GetType() 
+    {
+      return VISU::TCUTSEGMENT;
+    }
+
+    virtual
+    void
+    SetPoint1(CORBA::Double theX,
+             CORBA::Double theY,
+             CORBA::Double theZ );
+
+    virtual
+    void
+    GetPoint1(CORBA::Double& theX,
+             CORBA::Double& theY,
+             CORBA::Double& theZ );
+
+    virtual
+    void
+    SetPoint2(CORBA::Double theX,
+             CORBA::Double theY,
+             CORBA::Double theZ );
+
+    virtual
+    void
+    GetPoint2(CORBA::Double& theX,
+             CORBA::Double& theY,
+             CORBA::Double& theZ );
+
+    VISU_CutSegmentPL* 
+    GetSpecificPL() const
+    { 
+      return myCutSegmentPL; 
+    }
+    
+  protected:
+    //! Extends VISU_ColoredPrs3d_i::CreatePipeLine
+    virtual 
+    void
+    CreatePipeLine(VISU_PipeLine* thePipeLine);
+
+    //! Extends VISU_ColoredPrs3d_i::CheckIsPossible
+    virtual 
+    bool 
+    CheckIsPossible();
+
+    virtual 
+    const char* 
+    GetIconName();
+
+    VISU_CutSegmentPL *myCutSegmentPL;
+
+  public:
+    //! Extends VISU_ColoredPrs3d_i::IsPossible
+    static
+    size_t
+    IsPossible(Result_i* theResult, 
+              const std::string& theMeshName, 
+              VISU::Entity theEntity,
+              const std::string& theFieldName, 
+              CORBA::Long theTimeStampNumber,
+              bool theIsMemoryCheck);
+
+    //! Extends VISU_ColoredPrs3d_i::Create
+    virtual 
+    Storable* 
+    Create(const std::string& theMeshName, 
+          VISU::Entity theEntity,
+          const std::string& theFieldName, 
+          CORBA::Long theTimeStampNumber);
+
+    //! Extends VISU_ColoredPrs3d_i::ToStream
+    virtual 
+    void
+    ToStream(std::ostringstream& theStr);
+
+    //! Extends VISU_ColoredPrs3d_i::Restore
+    virtual
+    Storable* 
+    Restore(SALOMEDS::SObject_ptr theSObject,
+           const Storable::TRestoringMap& theMap);
+
+    virtual 
+    void
+    SameAs(const Prs3d_i* theOrigin);
+
+    //! Extends VISU_ColoredPrs3d_i::CreateActor
+    virtual 
+    VISU_Actor* 
+    CreateActor();
+
+    static const std::string myComment;
+
+    virtual
+    const char* 
+    GetComment() const;
+
+    virtual
+    QString 
+    GenerateName();
+  };
+}
+
+#endif
index 14e0e6f31c04a4fb70774993da769609c621649d..4d008943e1fbcee74e69b0453358ee6343fbf14f 100644 (file)
@@ -35,6 +35,7 @@
 #include "VISU_DeformedShape_i.hh"
 #include "VISU_CutPlanes_i.hh"
 #include "VISU_CutLines_i.hh"
+#include "VISU_CutSegment_i.hh"
 #include "VISU_Vectors_i.hh"
 #include "VISU_StreamLines_i.hh"
 #include "VISU_Plot3D_i.hh"
@@ -782,6 +783,31 @@ namespace VISU
   }
 
 
+  //---------------------------------------------------------------------------
+  std::string
+  CutSegmentToPython(SALOMEDS::SObject_ptr theSObject,
+                    VISU::CutSegment_i* theServant,
+                    std::ostream& theStr,
+                    const std::string& theName,
+                    TColoredPrs3dFactory& thePrsFactory,
+                    std::string thePrefix)
+  {
+    thePrefix = ScalarMapToPython(theSObject, theServant, theStr, theName, thePrsFactory, thePrefix);
+    theStr<<thePrefix<<endl;
+
+    double x1, y1, z1, x2, y2, z2;
+    theServant->GetPoint1(x1, y1, z1);
+    theServant->GetPoint2(x2, y2, z2);
+    theStr<<thePrefix<<theName<<".SetPoint1("<<x1<<", "<<y1<<", "<<z1<<")"<<endl;
+    theStr<<thePrefix<<theName<<".SetPoint2("<<x2<<", "<<y2<<", "<<z2<<")"<<endl;
+
+    CORBA::Boolean aUseAbsLength = theServant->IsUseAbsoluteLength();
+    theStr<<thePrefix<<theName<<".SetUseAbsoluteLength("<<aUseAbsLength<<")"<<endl;
+
+    return thePrefix;
+  }
+
+
   //---------------------------------------------------------------------------
   std::string
   Plot3DToPython(SALOMEDS::SObject_ptr theSObject,
@@ -1376,6 +1402,25 @@ namespace VISU
            theStr<<thePrefix<<"pass"<<endl<<endl;
           }
           return;
+        case VISU::TCUTSEGMENT:
+          if(CutSegment_i* aServant = dynamic_cast<CutSegment_i*>(GetServant(anObj).in())){
+           TCreateFromResult aPrsFactory(theSObject, aServant, aName, "CutSegmentOnField", theArgumentName);
+           thePrefix = CutSegmentToPython(theSObject, aServant, theStr, aName, aPrsFactory, thePrefix);
+
+           theArgumentName = aName;
+           DumpChildrenToPython(theStudy,
+                                theIsPublished,
+                                theIsValidScript,
+                                theSObject,
+                                theStr,
+                                theName2EntryMap,
+                                theEntry2NameMap,
+                                theArgumentName,
+                                thePrefix);
+
+           theStr<<thePrefix<<"pass"<<endl<<endl;
+          }
+          return;
         case VISU::TPLOT3D:
           if (Plot3D_i* aServant = dynamic_cast<Plot3D_i*>(GetServant(anObj).in())) {
            TCreateFromResult aPrsFactory(theSObject, aServant, aName, "Plot3DOnField", theArgumentName);
@@ -1916,6 +1961,11 @@ namespace VISU
                    CutLinesToPython(aSObject, aServant, theStr, "aDevice", aPrsFactory, aPrefix3);
                    break;
                  }
+               case VISU::TCUTSEGMENT:
+                 if(CutSegment_i* aServant = dynamic_cast<CutSegment_i*>(aDevice)){
+                   CutSegmentToPython(aSObject, aServant, theStr, "aDevice", aPrsFactory, aPrefix3);
+                   break;
+                 }
                case VISU::TPLOT3D:
                  if(Plot3D_i* aServant = dynamic_cast<Plot3D_i*>(aDevice)){
                    Plot3DToPython(aSObject, aServant, theStr, "aDevice", aPrsFactory, aPrefix3);
index 9862db8362460ee999b4071cbb34f9473b313cc9..0dd7a7b56914e44423796855823205abb0129227 100644 (file)
@@ -210,6 +210,7 @@ namespace VISU
     Storable::RegistryStorableEngine(DeformedShape_i::myComment.c_str(),&(StorableEngine<DeformedShape_i>));
     Storable::RegistryStorableEngine(CutPlanes_i::myComment.c_str(),&(StorableEngine<CutPlanes_i>));
     Storable::RegistryStorableEngine(CutLines_i::myComment.c_str(),&(StorableEngine<CutLines_i>));
+    Storable::RegistryStorableEngine(CutSegment_i::myComment.c_str(),&(StorableEngine<CutSegment_i>));
     Storable::RegistryStorableEngine(IsoSurfaces_i::myComment.c_str(),&(StorableEngine<IsoSurfaces_i>));
     Storable::RegistryStorableEngine(StreamLines_i::myComment.c_str(),&(StorableEngine<StreamLines_i>));
     Storable::RegistryStorableEngine(Plot3D_i::myComment.c_str(),&(StorableEngine<Plot3D_i>));
@@ -1109,6 +1110,22 @@ namespace VISU
                                          theIteration)._retn();
   }
 
+  //---------------------------------------------------------------
+  CutSegment_ptr
+  VISU_Gen_i
+  ::CutSegmentOnField(Result_ptr theResult,
+                     const char* theMeshName,
+                     VISU::Entity theEntity,
+                     const char* theFieldName,
+                     CORBA::Long theIteration)
+  {
+    return Prs3dOnField<VISU::CutSegment_i>(theResult,
+                                           theMeshName,
+                                           theEntity,
+                                           theFieldName,
+                                           theIteration)._retn();
+  }
+
   //---------------------------------------------------------------
   struct CreateTableEvent: public SALOME_Event
   {
index baee283131ba4498ee354655a184a20b4ca93518..26a42a5b428eb642821264df3761f9a571e2d728 100644 (file)
@@ -231,6 +231,14 @@ namespace VISU
                    const char* theFieldName, 
                    CORBA::Long theIteration);
 
+    virtual
+    CutSegment_ptr
+    CutSegmentOnField(Result_ptr theResult,
+                     const char* theMeshName, 
+                     VISU::Entity theEntity,
+                     const char* theFieldName, 
+                     CORBA::Long theIteration);
+
     virtual
     StreamLines_ptr
     StreamLinesOnField(Result_ptr theResult,
index 825aec9f1d935c4cf51f7e2c2459b01e6be789ad..49d32432af543c336525945eccf928503b1c0cd0 100644 (file)
@@ -39,6 +39,7 @@
 #include "VISU_Plot3D_i.hh"
 #include "VISU_CutPlanes_i.hh"
 #include "VISU_CutLines_i.hh"
+#include "VISU_CutSegment_i.hh"
 #include "VISU_Vectors_i.hh"
 #include "VISU_StreamLines_i.hh"
 #include "VISU_GaussPoints_i.hh"
index f03b72cab7735d782c652b202386b73b51ae3ab1..aebf5c9c97678d5b9fa3f079e2a3ea4a2f1ae5a1 100644 (file)
@@ -26,7 +26,7 @@
 //
 #include "VISU_PointMap3d_i.hh"
 
-#include "VISU_CutLines_i.hh"
+#include "VISU_CutLinesBase_i.hh"
 #include "VISU_Result_i.hh"
 #include "VISU_ViewManager_i.hh"
 #include "VISU_ScalarBarActor.hxx"
@@ -174,12 +174,12 @@ VISU::Storable* VISU::PointMap3d_i::Create()
 
   if ( GetName() == "" ) {
     if ( !mySObj->_is_nil() ) {
-      CutLines_i* pCutLines = NULL;
+      CutLinesBase_i* pCutLines = NULL;
       CORBA::Object_var anObj = SObjectToObject(mySObj);
       if(!CORBA::is_nil(anObj)){
-       VISU::CutLines_var aCutLines = VISU::CutLines::_narrow(anObj);
+       VISU::CutLinesBase_var aCutLines = VISU::CutLinesBase::_narrow(anObj);
        if(!aCutLines->_is_nil())
-         pCutLines = dynamic_cast<CutLines_i*>(GetServant(aCutLines).in());
+         pCutLines = dynamic_cast<CutLinesBase_i*>(GetServant(aCutLines).in());
       }
       if (!pCutLines)
        if (mySObj->GetName()) SetName(mySObj->GetName(), false);
@@ -487,12 +487,12 @@ VISU::Storable* VISU::PointMap3d_i::Build( int theRestoring )
   SALOMEDS::SObject_var SO = mySObj;
 
   if ( !SO->_is_nil() ) {
-    CutLines_i* pCutLines = NULL;
+    CutLinesBase_i* pCutLines = NULL;
     CORBA::Object_var anObj = SObjectToObject(SO);
     if(!CORBA::is_nil(anObj)){
-      VISU::CutLines_var aCutLines = VISU::CutLines::_narrow(anObj);
+      VISU::CutLinesBase_var aCutLines = VISU::CutLinesBase::_narrow(anObj);
       if(!aCutLines->_is_nil())
-       pCutLines = dynamic_cast<CutLines_i*>(GetServant(aCutLines).in());
+       pCutLines = dynamic_cast<CutLinesBase_i*>(GetServant(aCutLines).in());
     }
     SALOMEDS::Study_var aStudy = GetStudyDocument();
     SALOMEDS::StudyBuilder_var Builder = GetStudyDocument()->NewBuilder();
index 2516a24d1e946e72e8b0f43ec47112937b8b9e24..cf044b28977f5ccb4b5d399ff43a41f82a2c16bc 100644 (file)
@@ -26,7 +26,7 @@
 //
 #include "VISU_Table_i.hh"
 
-#include "VISU_CutLines_i.hh"
+#include "VISU_CutLinesBase_i.hh"
 #include "VISU_Result_i.hh"
 #include "VISU_ViewManager_i.hh"
 
@@ -183,12 +183,12 @@ VISU::Storable* VISU::Table_i::Create()
   // mpv (PAL 5357): if name attribute already exist at this label, use it as name of table
   if ( GetName() == "" )
     if ( !mySObj->_is_nil() ) {
-      CutLines_i* pCutLines = NULL;
+      CutLinesBase_i* pCutLines = NULL;
       CORBA::Object_var anObj = SObjectToObject(mySObj);
       if(!CORBA::is_nil(anObj)){
-       VISU::CutLines_var aCutLines = VISU::CutLines::_narrow(anObj);
+       VISU::CutLinesBase_var aCutLines = VISU::CutLinesBase::_narrow(anObj);
          if(!aCutLines->_is_nil())
-           pCutLines = dynamic_cast<CutLines_i*>(GetServant(aCutLines).in());
+           pCutLines = dynamic_cast<CutLinesBase_i*>(GetServant(aCutLines).in());
        }
       if (!pCutLines)
        if (mySObj->GetName()) SetName(mySObj->GetName(), false);
@@ -209,12 +209,12 @@ VISU::Storable* VISU::Table_i::Build( int theRestoring )
   SALOMEDS::SObject_var SO = mySObj;
 
   if ( !SO->_is_nil() ) {
-    CutLines_i* pCutLines = NULL;
+    CutLinesBase_i* pCutLines = NULL;
     CORBA::Object_var anObj = SObjectToObject(SO);
     if(!CORBA::is_nil(anObj)){
-      VISU::CutLines_var aCutLines = VISU::CutLines::_narrow(anObj);
+      VISU::CutLinesBase_var aCutLines = VISU::CutLinesBase::_narrow(anObj);
       if(!aCutLines->_is_nil())
-       pCutLines = dynamic_cast<CutLines_i*>(GetServant(aCutLines).in());
+       pCutLines = dynamic_cast<CutLinesBase_i*>(GetServant(aCutLines).in());
     }
     SALOMEDS::StudyBuilder_var Builder = GetStudyDocument()->NewBuilder();
     SALOMEDS::GenericAttribute_var anAttr;
index 3437df86b508ce7af261c8016e571065917d891b..20fb195cae091caf7dc17475c9f1c4f2aea06d74 100644 (file)
@@ -42,6 +42,7 @@
 #include "VISU_CutPlanes_i.hh"
 #include "VISU_Plot3D_i.hh"
 #include "VISU_CutLines_i.hh"
+#include "VISU_CutSegment_i.hh"
 #include "VISU_Vectors_i.hh"
 #include "VISU_StreamLines_i.hh"
 #include "VISU_GaussPoints_i.hh"
@@ -567,6 +568,15 @@ void VISU_TimeAnimation::generatePresentations(CORBA::Long theFieldNum)
                                      myTimeMaxVal,
                                      aSequence);
     break;
+  case VISU::TCUTSEGMENT: // Cut Segment
+    GeneratePresentations<CutSegment_i>(myStudy,
+                                       aData,
+                                       aResult,
+                                       isRangeDefined(),
+                                       myTimeMinVal,
+                                       myTimeMaxVal,
+                                       aSequence);
+    break;
   case VISU::TPLOT3D: // Plot3d
     GeneratePresentations<Plot3D_i>(myStudy,
                                    aData,
@@ -1688,6 +1698,9 @@ std::string GetPresentationComment (VISU::VISUType thePrsType)
   case VISU::TCUTLINES:
     aPrsCmt = VISU::CutLines_i::myComment;
     break;
+  case VISU::TCUTSEGMENT:
+    aPrsCmt = VISU::CutSegment_i::myComment;
+    break;
   case VISU::TPLOT3D:
     aPrsCmt = VISU::Plot3D_i::myComment;
     break;
@@ -1910,6 +1923,8 @@ void VISU_TimeAnimation::restoreFromStudy(_PTR(SObject) theField)
       aData.myPrsType = VISU::TCUTPLANES;
     else if (strName == VISU::CutLines_i::myComment.c_str())
       aData.myPrsType = VISU::TCUTLINES;
+    else if (strName == VISU::CutSegment_i::myComment.c_str())
+      aData.myPrsType = VISU::TCUTSEGMENT;
     else if (strName == VISU::Plot3D_i::myComment.c_str())
       aData.myPrsType = VISU::TPLOT3D;
     else if (strName == VISU::DeformedShape_i::myComment.c_str())
index 3bab3fb3c1ac64d98a09d45ba38b6f2dea956dd2..77dbab7557963b61df649a5769e9f72e04dc76ff 100644 (file)
@@ -248,6 +248,49 @@ myView.Display(aContainer)
 
 
 
+myView = myViewManager.Create3DView();
+myView.SetTitle("The viewer for CutSegment")
+print "myViewManager.Create3DView()"
+time.sleep(aDelay)
+
+print "myView.SetBackground(...)"
+aColor = SALOMEDS.Color(0.0,0.7,0.3)
+myView.SetBackground(aColor);
+time.sleep(aDelay)
+
+aCutSegment = myVisu.CutSegmentOnField(myResult, aMeshName, anEntity, myFieldName, aTimeStampId)
+aCutSegment.SetPoint1(0.0,0.0,0.0)
+aCutSegment.SetPoint2(0.4,0.05,1.0)
+
+myView.DisplayOnly(aCutSegment);
+myView.FitAll();
+print "myView.DisplayOnly(aCutSegment)"
+time.sleep(aDelay)
+
+aSObj = myStudy.FindObjectIOR(aCutSegment.GetID())
+aTable = myVisu.CreateTable( aSObj.GetID() )
+print "myVisu.CreateTable(...)"
+
+aTableView = myViewManager.CreateTableView(aTable)
+aTableView.SetTitle('Changed Title')
+
+aContainer = myVisu.CreateContainer()
+print "myVisu.CreateContainer(...)"
+
+aCurve = myVisu.CreateCurve( aTable, 1, 2 )
+print aCurve
+aContainer.AddCurve(aCurve)
+
+
+myView = myViewManager.CreateXYPlot();
+myView.SetTitle("The viewer for Curve from CutSegment")
+print "myViewManager.CreateXYPlot()"
+time.sleep(aDelay)
+
+myView.Display(aContainer)
+
+
+
 myView = myViewManager.Create3DView();
 myView.SetTitle("The viewer for Animation")
 print "myViewManager.Create3DView()"
index 42fead876d7d175b70d262894fe809df17af8e7a..14c06e435e3f25d2017c9d80d873e7f54e318098 100644 (file)
@@ -559,6 +559,22 @@ def CreatePrsForResult(theVisu, theResult, theView, thePrsTypeList, thePictureDi
                                     else :
                                         aVISUObjList.append(aPrsObj)
                                 
+                            if HasValue(thePrsTypeList,VISU.TCUTSEGMENT) :
+                                print "          Creating CutSegmentOnField",
+                                aPrsObj = theVisu.CutSegmentOnField(theResult,aMeshName,anEntity,aFieldName,aTimeStampId)
+                                if aPrsObj is None : print "Error"
+                                else :
+                                    print ",OK"
+                                    theView.DisplayOnly(aPrsObj)
+                                    theView.FitAll()
+                                    aPictureName = thePictureDir + aMeshNamePic + "_" + anEntityId + "_" + aFieldName + "_" + str(aTimeStampId) + "_TCUTSEGMENT." + thePictureExt
+                                    aPictureName = re.sub("\s+","_", aPictureName)
+                                    theView.SavePicture(aPictureName)
+                                    if theIsAutoDelete :
+                                       aPrsObj.RemoveFromStudy()
+                                    else :
+                                        aVISUObjList.append(aPrsObj)
+                                
                             if HasValue(thePrsTypeList,VISU.TPLOT3D) :
                                 print "          Creating Plot3DOnField",
                                 aPrsObj = theVisu.Plot3DOnField(theResult,aMeshName,anEntity,
@@ -900,6 +916,36 @@ def dump_cutlines_parameters(theObject):
     print "GetRotateY() = ", str(theObject.GetRotateY())
     print "GetRotateY2() = ", str(theObject.GetRotateY2())
 
+# ----------------------
+# CUT SEGMENT
+# ----------------------
+def try_cutsegment_parameters(thePattern):
+
+    if thePattern  is None : return None 
+    import copy
+    import random
+
+    anObj = try_scalarmap_parameters(thePattern)
+
+    anObj.SetPoint1(random.randint(-100,100)*random.random(),
+                    random.randint(-100,100)*random.random(),
+                    random.randint(-100,100)*random.random())
+    anObj.SetPoint2(random.randint(-100,100)*random.random(),
+                    random.randint(-100,100)*random.random(),
+                    random.randint(-100,100)*random.random())
+
+    return anObj
+
+def dump_cutsegment_parameters(theObject):
+    dump_scalarmap_parameters(theObject)
+
+    x1 = y1 = z1 = 0
+    x2 = y2 = z2 = 0
+    theObject.GetPoint1(x1, y1, z1)
+    theObject.GetPoint1(x2, y2, z2)
+    print "GetPoint1() = " + str(x1) + ", " + str(y1) + ", " + str(z1)
+    print "GetPoint2() = " + str(x2) + ", " + str(y2) + ", " + str(z2)
+
 # ----------------------
 # STREAM LINES
 # ----------------------
index 432a14fa75a3c07406f3c68e3db7e2362d5baeed..6bb8163970e843aa464aca40558afb57241b3c08 100644 (file)
@@ -72,6 +72,7 @@ PRS3D_TYPE_LIST.append(VISU.TSCALARMAP)
 PRS3D_TYPE_LIST.append(VISU.TISOSURFACES)
 PRS3D_TYPE_LIST.append(VISU.TCUTPLANES)
 PRS3D_TYPE_LIST.append(VISU.TCUTLINES)
+PRS3D_TYPE_LIST.append(VISU.TCUTSEGMENT)
 PRS3D_TYPE_LIST.append(VISU.TPLOT3D)
 PRS3D_TYPE_LIST.append(VISU.TDEFORMEDSHAPE)
 PRS3D_TYPE_LIST.append(VISU.TVECTORS)
index fa68e6f8a9b58b32628bd84dbe976f76dd57b6e3..bc95a9e6c82e4361ae68844fea0e153824014b45 100644 (file)
@@ -255,6 +255,49 @@ myView.Display(aContainer)
 
 
 
+myView = myViewManager.Create3DView();
+myView.SetTitle("The viewer for CutSegment")
+print "myViewManager.Create3DView()"
+time.sleep(aDelay)
+
+print "myView.SetBackground(...)"
+aColor = SALOMEDS.Color(0.0,0.7,0.3)
+myView.SetBackground(aColor);
+time.sleep(aDelay)
+
+aCutSegment = myVisu.CutSegmentOnField(myResult, aMeshName, anEntity, myFieldName, aTimeStampId)
+aCutSegment.SetPoint1(0.0,0.0,0.0)
+aCutSegment.SetPoint2(0.4,0.05,1.0)
+
+myView.DisplayOnly(aCutSegment);
+myView.FitAll();
+print "myView.DisplayOnly(aCutSegment)"
+time.sleep(aDelay)
+
+aSObj = myStudy.FindObjectIOR(aCutSegment.GetID())
+aTable = myVisu.CreateTable( aSObj.GetID() )
+print "myVisu.CreateTable(...)"
+
+aTableView = myViewManager.CreateTableView(aTable)
+aTableView.SetTitle('Changed Title')
+
+aContainer = myVisu.CreateContainer()
+print "myVisu.CreateContainer(...)"
+
+aCurve = myVisu.CreateCurve( aTable, 1, 2 )
+print aCurve
+aContainer.AddCurve(aCurve)
+
+
+myView = myViewManager.CreateXYPlot();
+myView.SetTitle("The viewer for Curve from CutSegment")
+print "myViewManager.CreateXYPlot()"
+time.sleep(aDelay)
+
+myView.Display(aContainer)
+
+
+
 myView = myViewManager.Create3DView();
 myView.SetTitle("The viewer for Animation")
 print "myViewManager.Create3DView()"