--- /dev/null
+/*!
+
+\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
+– 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 – 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
<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>
\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>
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 */
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.
*
* 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.
* \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
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)
Visu_close.png \
VISU.config \
Visu_cutlines.png \
+Visu_cutsegment.png \
Visu_cutplanes.png \
Visu_deformed_anim.png \
Visu_deformed.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 \
<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"/>
<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=""/>
<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=""/>
}
+ 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,
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,
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 \
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 \
--- /dev/null
+// 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);
+}
--- /dev/null
+// 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
VISU_CutLinesPL
::VISU_CutLinesPL()
{
- SetIsShrinkable(false);
- SetIsFeatureEdgesAllowed(false);
-
myCondition = 1;
myPosition = 0;
}
#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*
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();
DoShallowCopy(VISU_PipeLine *thePipeLine,
bool theIsCopyInput);
- vtkFloatingPointType myDirLn[3];
- vtkFloatingPointType myRealDirLn[3];
- vtkFloatingPointType myBoundPrjLn[3];
- vtkFloatingPointType myBasePnt[3];
vtkFloatingPointType myPosition;
int myCondition;
--- /dev/null
+// 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();
+}
--- /dev/null
+// 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
VisuGUI_DeformedShapeDlg.h \
VisuGUI_IsoSurfacesDlg.h \
VisuGUI_CutLinesDlg.h \
+ VisuGUI_CutSegmentDlg.h \
VisuGUI_CutPlanesDlg.h \
VisuGUI_StreamLinesDlg.h \
VisuGUI_VectorsDlg.h \
VisuGUI_DeformedShapeDlg.cxx \
VisuGUI_IsoSurfacesDlg.cxx \
VisuGUI_CutLinesDlg.cxx \
+ VisuGUI_CutSegmentDlg.cxx \
VisuGUI_CutPlanesDlg.cxx \
VisuGUI_StreamLinesDlg.cxx \
VisuGUI_VectorsDlg.cxx \
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 \
<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>
<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>
<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>
<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>
#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"
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 ) );
}
}
- 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);
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()
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
_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);
}
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" ||
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;
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,
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()));
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
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 );
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
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 );
// 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
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 );
" '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'}";
"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 ),
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 + "})";
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" );
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 );
void OnCreateIsoSurfaces();
void OnCreateCutPlanes();
void OnCreateCutLines();
+ void OnCreateCutSegment();
void OnCreateStreamLines();
void OnCreatePlot3D();
void OnCreateManyMesh();
void OnEditDeformedShape();
void OnEditCutPlanes();
void OnEditCutLines();
+ void OnEditCutSegment();
void OnEditIsoSurfaces();
void OnEditVectors();
void OnEditStreamLines();
#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
#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
--- /dev/null
+// 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";
+}
--- /dev/null
+// 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
#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"
void
CreateCurves( SalomeApp_Module* theModule,
- VISU::CutLines_i* thePrs,
+ VISU::CutLinesBase_i* thePrs,
QDialog* theDlg,
const bool theCreate = true );
// 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();
// 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);
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 );
#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"
#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"
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
};
//------------------------------------------------------------------------
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);;
}
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);;
}
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;
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;
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);
case VISU::TDEFORMEDSHAPE:
case VISU::TCUTPLANES:
case VISU::TCUTLINES:
+ case VISU::TCUTSEGMENT:
case VISU::TVECTORS:
case VISU::TSTREAMLINES:
case VISU::TPLOT3D:
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 \
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 \
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" )
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);
}
case TCUTLINES:
aMemory = CheckIsPossible<TCUTLINES>(theInput, theMemoryCheck);
break;
+ case TCUTSEGMENT:
+ aMemory = CheckIsPossible<TCUTSEGMENT>(theInput, theMemoryCheck);
+ break;
case TVECTORS:
aMemory = CheckIsPossible<TVECTORS>(theInput, theMemoryCheck);
break;
#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"
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;
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;
--- /dev/null
+// 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 !!!");
+ }
+}
--- /dev/null
+// 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
#include <vtkAppendPolyData.h>
-static vtkFloatingPointType EPS_machine = 1.0E-7;
-
#ifdef _DEBUG_
static int MYDEBUG = 0;
#else
CutLines_i(EPublishInStudyMode thePublishInStudyMode) :
ColoredPrs3d_i(thePublishInStudyMode),
ScalarMap_i(thePublishInStudyMode),
- myUseAbsLength( false ),
+ CutLinesBase_i(thePublishInStudyMode),
myCutLinesPL(NULL)
{}
::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;
}
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);
}
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()),
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();
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;
}
{
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()) );
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());
}
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
}
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 !!!");
- }
-}
#define VISU_CutLines_i_HeaderFile
#include "VISU_I.hxx"
-#include "VISU_ScalarMap_i.hh"
+#include "VISU_CutLinesBase_i.hh"
class VISU_CutLinesPL;
{
//----------------------------------------------------------------------------
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
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
{
GetIconName();
VISU_CutLinesPL *myCutLinesPL;
- TCurvesInv myMapCurvesInverted;
- CORBA::Boolean myUseAbsLength;
public:
//! Extends VISU_ColoredPrs3d_i::IsPossible
VISU_Actor*
CreateActor();
- void BuildTableOfReal(SALOMEDS::SObject_var theSObject);
-
static const std::string myComment;
virtual
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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
#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"
}
+ //---------------------------------------------------------------------------
+ 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,
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);
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);
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>));
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
{
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,
#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"
//
#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"
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);
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();
//
#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"
// 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);
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;
#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"
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,
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;
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())
+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()"
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,
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
# ----------------------
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)
+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()"