VISU.config \
VISUCatalog.xml \
Visu_tree_visu.png \
-Visu_streamlines.png
+Visu_streamlines.png \
+Visu_graduated_axes.png
BIN_SCRIPT= \
VERSION
// Author : Alexey Petrov
/*! \file VISU_Gen.idl This file conatins a set of interfaces of the %VISU module.
- This module provides various forms of data visualization in %SALOME application.
- These forms include data tables, XY plots, 3d representations
- and combination of these forms.
-*/
+ * This module provides various forms of data visualization in %SALOME application.
+ * These forms include data tables, XY plots, 3d representations
+ * and combination of these forms.
+ */
#ifndef __VISU_GEN__
-#define __VISU_GEN__
-
-#include "SALOME_Exception.idl"
+#define __VISU_GEN__
+
+#include "SALOME_Exception.idl"
#include "SALOME_GenericObj.idl"
-#include "SALOME_Component.idl"
-#include "SALOMEDS.idl"
-#include "SALOMEDS_Attributes.idl"
-#include "MED.idl"
-
-/*!
- The main package of interfaces of the post-processing module %VISU.
-*/
+#include "SALOME_Component.idl"
+#include "SALOMEDS.idl"
+#include "SALOMEDS_Attributes.idl"
+#include "MED.idl"
+
+/*!
+ The main package of interfaces of the post-processing module %VISU.
+*/
module VISU {
- //-------------------------------------------------------
- typedef string IdType;
-/*!
- This enumeration contains a set of elements defining the type of the scaling, which
-can be applied on different presentations.
-*/
- enum Scaling{ LINEAR, /*!< Linear type of scaling. */
- LOGARITHMIC /*!< Logarithmic type of scaling. */
- };
-/*!
- This enumeration contains a set of elements defining the type of the %entity (topological units) constituting a mesh.
-*/
-
+ //-------------------------------------------------------
+ typedef string IdType;
+
+ /*!
+ * This enumeration contains a set of elements defining the type
+ * of the scaling, which can be applied on different presentations.
+ */
+ enum Scaling{ LINEAR, /*!< Linear type of scaling. */
+ LOGARITHMIC /*!< Logarithmic type of scaling. */
+ };
+
+ /*!
+ * This enumeration contains a set of elements defining the
+ * type of the %entity (topological units) constituting a mesh.
+ */
enum Entity{ NODE, /*!< Node corresponds to a geometrical point. */
EDGE, /*!< Edge corresponds to a geometrical line connecting two points. */
FACE, /*!< Face corresponds to a geometrical plane bounded by several lines. */
CELL /*!< Cell is a volumic element of a mesh */
};
-/*!
- This enumeration contains a set of elements defining the type of the %VISU object. This enumeration is used for navigation between a set of %VISU interfaces.
-*/
- enum VISUType{ TNONE, /*!< Not a %VISU object */
- TCURVE, /*!< Curve line object for construction of 2D XY plots */
- TTABLE, /*!< Table containing numerical data */
- TCONTAINER, /*!< Container object used for storing a set of curve lines */
- TMESH, /*!< Meshing object */
- TSCALARMAP, /*!< Scalarmap 3D presentation object */
- TISOSURFACE, /*!< Iso surface 3D presentation object */
- TDEFORMEDSHAPE, /*!< Deformed shape 3D presentation object */
- TCUTPLANES, /*!< Cut planes 3D presentation object */
- TCUTLINES, /*!< Cut lines 3D presentation object */
- TVECTORS, /*!< Vectors 3D presentation object */
- TSTREAMLINES, /*!< Streamlines 3D presentation object */
- TVISUGEN, /*!< %VISU generator used for performing operations with different %VISU objects */
- TVIEWMANAGER, /*!< View manager used for performing operations with different views */
- TRESULT, /*!< The data on which different presentations are based */
- TXYPLOT, /*!< 2D XY plot consisting of one or several curve lines */
- TTABLEVIEW, /*!< Table view is used for displaying data tables */
- TVIEW3D, /*!< 3D view is used for displaying 3D graphical presentations */
- TENTITY, /*!< An element composing a mesh: node, edge, face or cell */
- TFAMILY, /*!< The whole mesh can be divided into one or several submeshes, called families, which are defined by the user. Each family in its turn is composed of entities of a definite type. */
- TGROUP, /*!< A group of families */
- TFIELD, /*!< Field represents the results of calculations (it can be scalar or vector values), grouped together under one physical concept. */
- TTIMESTAMP, /*!<Time stamp represents a subfield: the results of calculations are taken in one definite moment. */
- TALL
- };
+
+ /*!
+ * This enumeration contains a set of elements defining the type of the %VISU object.
+ * This enumeration is used for navigation between a set of %VISU interfaces.
+ */
+ enum VISUType {
+ TNONE, /*!< Not a %VISU object */
+ TCURVE, /*!< Curve line object for construction of 2D XY plots */
+ TTABLE, /*!< Table containing numerical data */
+ TCONTAINER, /*!< Container object used for storing a set of curve lines */
+ TMESH, /*!< Meshing object */
+ TSCALARMAP, /*!< Scalarmap 3D presentation object */
+ TISOSURFACE, /*!< Iso surface 3D presentation object */
+ TDEFORMEDSHAPE, /*!< Deformed shape 3D presentation object */
+ TPLOT3D, /*!< Plot3D 3D presentation object */
+ TCUTPLANES, /*!< Cut planes 3D presentation object */
+ TCUTLINES, /*!< Cut lines 3D presentation object */
+ TVECTORS, /*!< Vectors 3D presentation object */
+ TSTREAMLINES, /*!< Streamlines 3D presentation object */
+ TVISUGEN, /*!< %VISU generator used for performing operations with different %VISU objects */
+ TVIEWMANAGER, /*!< View manager used for performing operations with different views */
+ TRESULT, /*!< The data on which different presentations are based */
+ TXYPLOT, /*!< 2D XY plot consisting of one or several curve lines */
+ TTABLEVIEW, /*!< Table view is used for displaying data tables */
+ TVIEW3D, /*!< 3D view is used for displaying 3D graphical presentations */
+ TENTITY, /*!< An element composing a mesh: node, edge, face or cell */
+ TFAMILY, /*!< The whole mesh can be divided into one or several submeshes, called families, which are defined by the user. Each family in its turn is composed of entities of a definite type. */
+ TGROUP, /*!< A group of families */
+ TFIELD, /*!< Field represents the results of calculations (it can be scalar or vector values), grouped together under one physical concept. */
+ TTIMESTAMP, /*!<Time stamp represents a subfield: the results of calculations are taken in one definite moment. */
+ TANIMATION, /*!< Represents Animation object. */
+ TALL
+ };
+
interface Base {
-/*!
- Returns ID of the object.
-*/
+ /*!
+ * Returns ID of the object.
+ */
IdType GetID();
-/*!
-Returns the type of the presentable object
-*/
+
+ /*!
+ * Returns the type of the presentable object
+ */
VISUType GetType();
};
-/*! \brief Presentable object interface
-Presentable object interface is the root class of all presentable objects.
-*/
- interface PrsObject : Base{
+ /*!
+ * \brief Removable object interface
+ *
+ * Removable object interface is the root class of all removable objects.
+ */
+ interface RemovableObject : Base {
+ /*!
+ * Remove object from study.
+ */
+ void RemoveFromStudy();
};
- //-------------------------------------------------------
-/*! \brief %Table representation interface
-Presentation parameters of the %Table view.
-*/
+ /*! \brief Presentable object interface
+ *
+ * Presentable object interface is the root class of all presentable objects.
+ */
+ interface PrsObject : RemovableObject {
+ };
+
+ //-------------------------------------------------------
+ /*! \brief %Table representation interface
+ *
+ * Presentation parameters of the %Table view.
+ */
interface Table : PrsObject {
-/*!
-Sets the title of the table.
-\param theTitle String parameter defining the title of this table.
-*/
+ /*!
+ * Sets the title of the table.
+ * \param theTitle String parameter defining the title of this table.
+ */
void SetTitle(in string theTitle);
-/*!
-Gets the title of the table.
-\return A string value containing the title of the table.
-*/
+
+ /*!
+ * Gets the title of the table.
+ * \return A string value containing the title of the table.
+ */
string GetTitle();
-/*!
- This enumeration contains a set of elements defining the orientation of the table.
-*/
- enum Orientation{ HORIZONTAL, /*!<Horizontal orientation of the table.*/
- VERTIACAL /*!<Vertical orientation of the table.*/
- };
-/*!
-Sets orientation of the table.
-\param theOrientation This input parameter defines the orientation of the table. It is taken from
-the <VAR>Orientation</VAR> enumeration.
-*/
+
+ /*!
+ * This enumeration contains a set of elements defining the orientation of the table.
+ */
+ enum Orientation {
+ HORIZONTAL, /*!< Horizontal orientation of the table. */
+ VERTIACAL /*!< Vertical orientation of the table. */
+ };
+
+ /*!
+ * Sets orientation of the table.
+ * \param theOrientation This input parameter defines the orientation of the table.
+ * It is taken from the <VAR>Orientation</VAR> enumeration.
+ */
void SetOrientation(in Orientation theOrientation);
-/*!
-Gets orientation of the table.
-\return Orientation of the table. The returned value will correspond to one of the elements the <VAR>Orientation</VAR> enumeration.
-*/
+ /*!
+ * Gets orientation of the table.
+ * \return Orientation of the table. The returned value will correspond
+ * to one of the elements the <VAR>Orientation</VAR> enumeration.
+ */
Orientation GetOrientation();
- /*!
-Gets the number of rows of the table.
-\return Long value corresponding to the number of rows of the table
- */
+
+ /*!
+ * Gets the number of rows of the table.
+ * \return Long value corresponding to the number of rows of the table
+ */
long GetNbRows();
- /*!
-Gets the number of columns of the table.
-\return Long value corresponding to the number of columns of the table
- */
+ /*!
+ * Gets the number of columns of the table.
+ * \return Long value corresponding to the number of columns of the table
+ */
long GetNbColumns();
};
- //-------------------------------------------------------
-/*! \brief Interface of curve representation.
-Manages presentation parameters of one curve.
-It can be used for presentation of a set of curves using a combined presentation.
-*/
- interface Curve : PrsObject{
-/*!
-Sets the title of the curve.
-\param theTitle This string parameter defines the title of this curve.
-*/
+ //-------------------------------------------------------
+ /*! \brief Interface of curve representation.
+ *
+ * Manages presentation parameters of one curve.
+ * It can be used for presentation of a set of curves using a combined presentation.
+ */
+ interface Curve : PrsObject {
+ /*!
+ * Sets the title of the curve.
+ * \param theTitle This string parameter defines the title of this curve.
+ */
void SetTitle(in string theTitle);
-/*!
-Gets the title of the curve.
-\return String value corresponding to the title of the curve.
-*/
+
+ /*!
+ * Gets the title of the curve.
+ * \return String value corresponding to the title of the curve.
+ */
string GetTitle();
-/*!
-Sets the color of the curve.
-\param theColor The color of the curve. This parameter is taken from the <VAR>Orientation</VAR> enumeration.
-*/
+ /*!
+ * Sets the color of the curve.
+ * \param theColor The color of the curve. This parameter is taken
+ * from the <VAR>Orientation</VAR> enumeration.
+ */
void SetColor(in SALOMEDS::Color theColor);
-/*!
-Gets the color of the curve.
-\return Color of the curve. The returned value will correspond to one of the elements the <VAR>Color</VAR> enumeration.
-*/
+ /*!
+ * Gets the color of the curve.
+ * \return Color of the curve. The returned value will correspond
+ * to one of the elements the <VAR>Color</VAR> enumeration.
+ */
SALOMEDS::Color GetColor();
- /*!
- This enumeration contains a set of elements defining the presentation type of markers (data points) with help of
-which the curve is constructed on the graphics.
-*/
- enum MarkerType{ NONE,
- CIRCLE,
- RECTANGLE,
- DIAMOND,
- DTRIANGLE,
- UTRIANGLE,
- LTRIANGLE,
- RTRIANGLE,
- CROSS,
- XCROSS
- };
-/*!
-Sets the presentation type of markers (data points) with help of
-which the curve is constructed on the graphics.
-\param theType This parameter defines the type of marker with help of which the curve is constructed on the graphics. It is taken from <VAR>MarkerType</VAR> enumeration.
-*/
+
+ /*!
+ * This enumeration contains a set of elements defining the
+ * presentation type of markers (data points) with help of
+ * which the curve is constructed on the graphics.
+ */
+ enum MarkerType { NONE,
+ CIRCLE,
+ RECTANGLE,
+ DIAMOND,
+ DTRIANGLE,
+ UTRIANGLE,
+ LTRIANGLE,
+ RTRIANGLE,
+ CROSS,
+ XCROSS
+ };
+
+ /*!
+ * Sets the presentation type of markers (data points) with help of
+ * which the curve is constructed on the graphics.
+ * \param theType This parameter defines the type of marker with help
+ * of which the curve is constructed on the graphics.
+ * It is taken from <VAR>MarkerType</VAR> enumeration.
+ */
void SetMarker(in MarkerType theType);
-/*!
-Gets the presentation type of markers (data points) with help of
-which the curve is constructed on the graphics.
-\return The type of marker with help of which the curve is constructed on the graphics. The returned value will correspond to one of the elements the <VAR>MarkerType</VAR> enumeration.
-*/
+ /*!
+ * Gets the presentation type of markers (data points) with
+ * help of which the curve is constructed on the graphics.
+ * \return The type of marker with help of which the curve is constructed
+ * on the graphics. The returned value will correspond to
+ * one of the elements the <VAR>MarkerType</VAR> enumeration.
+ */
MarkerType GetMarker();
-/*!
- This enumeration contains a set of elements defining the
- type of presentation of a curve line on the graphics.
-*/
+
+ /*!
+ * This enumeration contains a set of elements defining the
+ * type of presentation of a curve line on the graphics.
+ */
enum LineType{ VOIDLINE, SOLIDLINE, DASHLINE, DOTLINE, DASHDOTLINE, DASHDOTDOTLINE};
-/*!
-Sets the type of presentation of curve lines on the graphics.
-\param theType This parameter defines the type of presentation of curve lines on the graphics.
-\param theLineWidth Long value defining the width of the curve line.
-*/
+
+ /*!
+ * Sets the type of presentation of curve lines on the graphics.
+ * \param theType This parameter defines the type of presentation of curve lines on the graphics.
+ * \param theLineWidth Long value defining the width of the curve line.
+ */
void SetLine(in LineType theType, in long theLineWidth);
-/*!
-Gets the type of representation of curve lines on the graphics.
-\return The type of representation of curve lines on the graphics.
-*/
+
+ /*!
+ * Gets the type of representation of curve lines on the graphics.
+ * \return The type of representation of curve lines on the graphics.
+ */
LineType GetLine();
-/*!
-Gets the width of the curve line.
-\return Long value corresponding to the width of the curve line.
-*/
+ /*!
+ * Gets the width of the curve line.
+ * \return Long value corresponding to the width of the curve line.
+ */
long GetLineWidth();
};
-//-------------------------------------------------------
-/*! \brief %Container presentable object interface
-This class is provided in order to create one presentation using several presentable objects.
-This can provide a combination of a set of curves to display them in XY plot view.
-*/
- interface Container : PrsObject{
-/*!
-Adds a curve into the container.
-\param theCurve The added curve.
-*/
+ //-------------------------------------------------------
+ /*! \brief %Container presentable object interface
+ *
+ * This class is provided in order to create one presentation using several presentable objects.
+ * This can provide a combination of a set of curves to display them in XY plot view.
+ */
+ interface Container : PrsObject {
+ /*!
+ * Adds a curve into the container.
+ * \param theCurve The added curve.
+ */
void AddCurve(in Curve theCurve);
-/*!
-Removes a curve from the container.
-\param theCurve The removed curve.
-*/
+
+ /*!
+ * Removes a curve from the container.
+ * \param theCurve The removed curve.
+ */
void RemoveCurve(in Curve theCurve);
-/*!
-Gets the number of curves which are stored in the container.
-\return A long value corresponding to the number of curves which are stored in the container.
-*/
+
+ /*!
+ * Gets the number of curves which are stored in the container.
+ * \return A long value corresponding to the number of curves which are stored in the container.
+ */
long GetNbCurves();
-/*!
-Removes all curves from the container.
-*/
- void Clear();
+ /*!
+ * Removes all curves from the container.
+ */
+ void Clear();
};
- //-------------------------------------------------------
-/*! \brief 3D presentation interface
-This is a root class for all 3D presentations, which can be displayed in %VISU module.
-*/
- interface Prs3d : PrsObject, SALOME::GenericObj{
+ //-------------------------------------------------------
+ /*! \brief 3D presentation interface
+ *
+ * This is a root class for all 3D presentations, which can be displayed in %VISU module.
+ */
+ interface Prs3d : PrsObject, SALOME::GenericObj {
//interface Prs3d : PrsObject{
+ void SetOffset(in float theDx, in float theDy, in float theDz);
+ void GetOffset(out float theDx, out float theDy, out float theDz);
};
-/*!
- This enumeration contains a set of elements defining the
- type of presentation of the mesh.
-*/
-
- enum PresentationType{ POINT,
- WIREFRAME,
- SHADED,
- INSIDEFRAME,
- SURFACEFRAME,
- SHRINK
- };
-/*! \brief Interface of the mesh.
-Manages presentation parameters of a 3D presentation of a mesh.
-This object can be used for presentation of set of curves using Container class.
-
-*/
- interface Mesh : Prs3d{
-/*!
-Sets the color of mesh cells.
-\param theColor The color of the cells. This parameter is taken from <VAR>Color</VAR> enumeration.
+ /*!
+ * This enumeration contains a set of elements defining the
+ * type of presentation of the mesh.
+ */
+ enum PresentationType{ POINT,
+ WIREFRAME,
+ SHADED,
+ INSIDEFRAME,
+ SURFACEFRAME,
+ SHRINK
+ };
-*/
+ /*! \brief Interface of the mesh.
+ *
+ * Manages presentation parameters of a 3D presentation of a mesh.
+ * This object can be used for presentation of set of curves using Container class.
+ */
+ interface Mesh : Prs3d {
+ /*!
+ * Sets the color of mesh cells.
+ * \param theColor The color of the cells. This parameter is taken from <VAR>Color</VAR> enumeration.
+ */
void SetCellColor(in SALOMEDS::Color theColor);
-/*!
-Gets the color of mesh cells.
-*/
+
+ /*!
+ * Gets the color of mesh cells.
+ */
SALOMEDS::Color GetCellColor();
-/*!
-Sets the color of mesh nodes.
-\param theColor The color of the nodes. This parameter is taken from <VAR>Color</VAR> enumeration.
-*/
+ /*!
+ * Sets the color of mesh nodes.
+ * \param theColor The color of the nodes. This parameter is taken from <VAR>Color</VAR> enumeration.
+ */
void SetNodeColor(in SALOMEDS::Color theColor);
-/*!
-Gets the color of mesh nodes.
-*/
- SALOMEDS::Color GetNodeColor();
-/*!
-Sets the color of mesh links.
-\param theColor The color of the links. This parameter is taken from <VAR>Color</VAR> enumeration.
+ /*!
+ * Gets the color of mesh nodes.
+ */
+ SALOMEDS::Color GetNodeColor();
-*/
+ /*!
+ * Sets the color of mesh links.
+ * \param theColor The color of the links. This parameter is taken from <VAR>Color</VAR> enumeration.
+ */
void SetLinkColor(in SALOMEDS::Color theColor);
-/*!
-Gets the color of mesh links.
-*/
+
+ /*!
+ * Gets the color of mesh links.
+ */
SALOMEDS::Color GetLinkColor();
-/*!
-Sets the type of representation of a mesh.
-\param theType The of representation of a mesh. This parameter is taken from <VAR>PresentationType</VAR> enumeration.
-*/
+
+ /*!
+ * Sets the type of representation of a mesh.
+ * \param theType The of representation of a mesh. This parameter is
+ * taken from <VAR>PresentationType</VAR> enumeration.
+ */
void SetPresentationType(in PresentationType theType);
-/*!
-Gets the type of representation of the mesh.
-\return The type of representation of the mesh.
-*/
+
+ /*!
+ * Gets the type of representation of the mesh.
+ * \return The type of representation of the mesh.
+ */
PresentationType GetPresentationType();
};
- //-------------------------------------------------------
-/*! \brief Interface of the %Scalar Map
-
-This interface is responsable for coloring of 3D field presentations according the scalar values applied to different cells.
-As well it contains presentation parameters of the scalar bar. The scalar bar is displayed
-along with each colored field presentation and serves for consulting the correspondance
-between colors and data values.
-*/
- interface ScalarMap : Prs3d{
-/*! Sets the method of coloring of the elements composing a 3D presentation.
-*/
+ //-------------------------------------------------------
+ /*! \brief Interface of the %Scalar Map
+ *
+ * This interface is responsable for coloring of 3D field presentations
+ * according the scalar values applied to different cells.
+ * As well it contains presentation parameters of the scalar bar. The scalar
+ * bar is displayed along with each colored field presentation and serves for
+ * consulting the correspondance between colors and data values.
+ */
+ interface ScalarMap : Prs3d {
+ /*! Sets the method of coloring of the elements composing a 3D presentation.
+ */
void SetScalarMode(in long theScalarMode);
-/*! Gets the method of coloring of the elements composing a 3D presentation.
-*/
+
+ /*! Gets the method of coloring of the elements composing a 3D presentation.
+ */
long GetScalarMode();
-/*!
-Sets the type of scaling of the values reflected by the scalar bar.
-\param theScaling The value of this parameter is taken from the <VAR>Scaling</VAR> enumeration.
-*/
+
+ /*!
+ * Sets the type of scaling of the values reflected by the scalar bar.
+ * \param theScaling The value of this parameter is taken from the <VAR>Scaling</VAR> enumeration.
+ */
void SetScaling(in Scaling theScaling);
-/*!
-Gets the type of scaling of the values reflected by this presentation.
-*/
+
+ /*!
+ * Gets the type of scaling of the values reflected by this presentation.
+ */
Scaling GetScaling();
-/*!
-Sets scalar range - min and max boundaries of the scalar bar.
-\param theMin Min boundary of the scalar bar.
-\param theMax Max boundary of the scalar bar.
-*/
+
+ /*!
+ * Sets scalar range - min and max boundaries of the scalar bar.
+ * \param theMin Min boundary of the scalar bar.
+ * \param theMax Max boundary of the scalar bar.
+ */
void SetRange(in double theMin, in double theMax);
-/*!
- Gets the min boundary of the scalar bar.
-*/
+
+ /*!
+ * Gets the min boundary of the scalar bar.
+ */
double GetMin();
-/*!
- Gets the max boundary of the scalar bar.
-*/
+
+ /*!
+ * Gets the max boundary of the scalar bar.
+ */
double GetMax();
-/*! %Orientation of the scalar bar. */
- enum Orientation{
- HORIZONTAL, /*!< Horizontal orientation of the scalar bar.*/
- VERTICAL /*!< Vertical orientation of the scalar bar.*/
- };
-/*!
- Sets the type of orientation of the scalar bar.
- \param theOrientation This parameter defines the orientation of the scalar bar. It is taken from the <VAR>Orientaton</VAR> enumeration.
-*/
+ /*! %Orientation of the scalar bar. */
+ enum Orientation {
+ HORIZONTAL, /*!< Horizontal orientation of the scalar bar.*/
+ VERTICAL /*!< Vertical orientation of the scalar bar.*/
+ };
+
+ /*!
+ * Sets the type of orientation of the scalar bar.
+ * \param theOrientation This parameter defines the orientation of the scalar bar.
+ * It is taken from the <VAR>Orientaton</VAR> enumeration.
+ */
void SetBarOrientation(in Orientation theOrientation);
-/*!
- Gets the type of orientation of the scalar bar.
-*/
- Orientation GetBarOrientation();
-/*! \brief Position of the scalar bar.
+ /*!
+ * Gets the type of orientation of the scalar bar.
+ */
+ Orientation GetBarOrientation();
-Sets the position of the scalar bar origin on the screen.
-\param X Horizontal position. The value can be between 0 and 1.
-\param Y Vertical position. The value can be between 0 and 1.
-*/
+ /*! \brief Position of the scalar bar.
+ *
+ * Sets the position of the scalar bar origin on the screen.
+ * \param X Horizontal position. The value can be between 0 and 1.
+ * \param Y Vertical position. The value can be between 0 and 1.
+ */
void SetPosition(in double X, in double Y);
-/*!
- Gets horizontal position of the scalar bar origin.
-*/
+
+ /*!
+ * Gets horizontal position of the scalar bar origin.
+ */
double GetPosX();
-/*!
- Gets vertical position of the scalar bar origin.
-*/
+
+ /*!
+ * Gets vertical position of the scalar bar origin.
+ */
double GetPosY();
-/*! \brief Size of this presentable object.
-Sets the size of the scalar bar.
-\param theWidth Width of this presentable object. The value can be between 0 and 1.
-\param theHeight Height of this presentable object. The value can be between 0 and 1.
-*/
+ /*! \brief Size of this presentable object.
+ *
+ * Sets the size of the scalar bar.
+ * \param theWidth Width of this presentable object. The value can be between 0 and 1.
+ * \param theHeight Height of this presentable object. The value can be between 0 and 1.
+ */
void SetSize(in double theWidth, in double theHeight);
-/*!
-Gets the width of this presentable object.
-\return A double value corresponding to the width of this presentable object.
-*/
+
+ /*!
+ * Gets the width of this presentable object.
+ * \return A double value corresponding to the width of this presentable object.
+ */
double GetWidth();
-/*!
-Gets the height of this presentable object.
-\return A double value corresponding to the height of this presentable object.
-*/
+
+ /*!
+ * Gets the height of this presentable object.
+ * \return A double value corresponding to the height of this presentable object.
+ */
double GetHeight();
-/*!
-Sets the number of colors which will be used for presentation of this presentable object.
-\param theNbColors A long value defining the number of colors.
-*/
+
+ /*!
+ * Sets the number of colors which will be used for presentation of this presentable object.
+ * \param theNbColors A long value defining the number of colors.
+ */
void SetNbColors(in long theNbColors);
-/*!
-Gets the number of colors which will be used for visualization of this presentable object.
-\return A long value corresponding to the number of colors which will be used for visualization of this presentable object.
-*/
+
+ /*!
+ * Gets the number of colors which will be used for visualization of this presentable object.
+ * \return A long value corresponding to the number of colors which
+ * will be used for visualization of this presentable object.
+ */
long GetNbColors();
-/*!
-Sets the number of labels which will be used for indication of color gradation
- of the scalar bar.
- \param theNbLabels A long value defining the number of labels.
-*/
+
+ /*!
+ * Sets the number of labels which will be used for indication of color gradation
+ * of the scalar bar.
+ * \param theNbLabels A long value defining the number of labels.
+ */
void SetLabels(in long theNbLabels);
-/*!
-Gets the number of labels which will be used for indication of color gradation
- of the scalar bar.
- \return A long value corresponding to the number of labels which will be used for indication of color gradation
- of the scalar bar.
-*/
+
+ /*!
+ * Gets the number of labels which will be used for indication of color gradation of the scalar bar.
+ * \return A long value corresponding to the number of labels which will
+ * be used for indication of color gradation of the scalar bar.
+ */
long GetLabels();
-/*!
-Sets the title of the scalar bar. By default - the name of the selected result is used.
-\param theName String parameter defining the name of the scalar bar.
-*/
+
+ /*!
+ * Sets the title of the scalar bar. By default - the name of the selected result is used.
+ * \param theName String parameter defining the name of the scalar bar.
+ */
void SetTitle(in string theName);
-/*!
-Gets the title of the scalar bar.
-*/
+
+ /*!
+ * Gets the title of the scalar bar.
+ */
string GetTitle();
};
- //-------------------------------------------------------
-/*! \brief Deformed shape presentation interface
-Presentation parameters of the deformed shape presentation.
-*/
- interface DeformedShape : ScalarMap{
-/*!
-Sets the scale of the presentatable object.
-\param theScale Double value defining the scale of this presentable object.
-*/
+ //-------------------------------------------------------
+ /*! \brief Deformed shape presentation interface
+ *
+ * Presentation parameters of the deformed shape presentation.
+ */
+ interface DeformedShape : ScalarMap {
+ /*!
+ * Sets the scale of the presentatable object.
+ * \param theScale Double value defining the scale of this presentable object.
+ */
void SetScale(in double theScale);
-/*!
-Gets the scale of the presentatable object.
-*/
+
+ /*!
+ * Gets the scale of the presentatable object.
+ */
double GetScale();
-/*! This boolean method returns True if this deformed shape presentation is colored.
-*/
+
+ /*! This boolean method returns True if this deformed shape presentation is colored.
+ */
boolean IsColored();
-/*! Shows this presentation in colored mode.
-\param theColored If this boolean parameter is True this presentable object will be shown in colored mode.
-*/
+
+ /*! Shows this presentation in colored mode.
+ * \param theColored If this boolean parameter is True this presentable
+ * object will be shown in colored mode.
+ */
void ShowColored(in boolean theColored);
-/*! Gets the color of this presentable object.
-\return The color of this presentable object.
-*/
+
+ /*! Gets the color of this presentable object.
+ * \return The color of this presentable object.
+ */
SALOMEDS::Color GetColor();
-/*! Sets the color of this presentation.
-\param theColor The color of this presentation. This parameter is taken from the <VAR>Color</VAR> enumeration.
-*/
+
+ /*! Sets the color of this presentation.
+ * \param theColor The color of this presentation. This parameter
+ * is taken from the <VAR>Color</VAR> enumeration.
+ */
void SetColor(in SALOMEDS::Color theColor);
};
+
//-------------------------------------------------------
-/*! \brief Cut planes interface
+ /*!
+ * \brief Plot3D interface
+ *
+ * Presentation parameters of Plot3D presentation. This type of presentation
+ * consists of deforming initial planar mesh according to values assigned to the mesh elements.
+ * If mesh not planar but volumic one, it is possible to generate intermediate planar mesh.
+ */
+ interface Plot3D : ScalarMap {
+ /*!
+ * This enumeration contains a set of elements defining
+ * the type of orientation in 3D space of the cutting plane.
+ */
+ enum Orientation { XY, /*!< The object is located in the plane formed by X and Y axis. */
+ YZ, /*!< The object is located in the plane formed by Y and Z axis. */
+ ZX }; /*!< The object is located in the plane formed by Z and X axis. */
-Presentation parameters of Cut planes presentation. This type of presentation consists of
-cutting your initial mesh by a definite number of planes. As the result you will see these planes
-which will be cutted by the borders of the mesh.
-*/
- interface CutPlanes : ScalarMap{
-/*!
- This enumeration contains a set of elements defining the type of orientation in 3D space
- of the cut planes.
-*/
+ /*!
+ * Sets the orientation in 3D space of cutting plane for the presentation.
+ * \param theOrientation This parameter defines the type of orientation of cutting plane
+ * in 3D space. It is taken from the <VAR>Orientation</VAR> enumeration.
+ * \param theXAngle The angle of rotation of the cutting plane
+ * around the first axis of the chosen orientation.
+ * \param theXAngle The angle of rotation of the cutting plane
+ * around the second axis of the chosen orientation.
+ */
+ void SetOrientation (in Orientation theOrientation, in double theXAngle, in double theYAngle);
+
+ /*!
+ * Gets the type of orientation in 3D space of cutting plane.
+ */
+ Orientation GetOrientationType();
+
+ /*!
+ * Gets rotation angle of the cutting plane
+ * around the first axis of the chosen orientation.
+ */
+ double GetRotateX();
+
+ /*!
+ * Gets rotation angle of the cutting plane
+ * around the second axis of the chosen orientation.
+ */
+ double GetRotateY();
+
+ /*!
+ * Sets the position of a cutting plane.
+ * \param thePlanePosition The position of the cutting plane.
+ * \param theIsRelative Define, whether the input position is relative.
+ */
+ void SetPlanePosition (in double thePlanePosition,
+ in boolean theIsRelative);
+
+ /*!
+ * Gets the position of the cutting plane
+ */
+ double GetPlanePosition();
+
+ /*!
+ * Returns true if a position of cutting plane is relative
+ */
+ boolean IsPositionRelative();
+
+ /*!
+ * Sets the scale factor for scalar values
+ * (how much corresponding mesh elements should be translated).
+ * \param theScaleFactor The scaling factor.
+ */
+ void SetScaleFactor (in double theScaleFactor);
+
+ /*!
+ * Gets the scale factor for scalar values.
+ * (how much corresponding mesh elements is translated)
+ */
+ double GetScaleFactor();
+
+ /*!
+ * Sets presentation type: contour or surface.
+ * \param theIsContourPrs Define, whether presentation type is contour.
+ */
+ void SetContourPrs (in boolean theIsContourPrs );
+
+ /*!
+ * Returns true if presentation type is contour.
+ */
+ boolean GetIsContourPrs();
+
+ /*!
+ * Sets the number of contours.
+ * \param theNb The number of contours.
+ */
+ void SetNbOfContours (in long theNb);
+
+ /*!
+ * Gets the number of contours.
+ */
+ long GetNbOfContours();
+ };
+
+ //-------------------------------------------------------
+ /*! \brief Cut planes interface
+ *
+ * Presentation parameters of Cut planes presentation. This type of presentation
+ * consists of cutting your initial mesh by a definite number of planes. As the
+ * result you will see these planes which will be cutted by the borders of the mesh.
+ */
+ interface CutPlanes : ScalarMap {
+ /*!
+ * This enumeration contains a set of elements defining the type of orientation in 3D space
+ * of the cut planes.
+ */
enum Orientation {XY, /*!< The object is located in the plane formed by X and Y axis. */
YZ, /*!< The object is located in the plane formed by Y and Z axis. */
ZX}; /*!< The object is located in the plane formed by Z and X axis. */
-/*!
-Sets the type of orientation in 3D space of cut planes presentation.
-\param theOrientation This parameter defines the type of orientation of cut planes in 3D space. It is taken from the <VAR>Orientation</VAR> enumeration.
-\param theXAngle The angle of rotation of the cut planes around the first axis of the chosen orientation.
-\param theXAngle The angle of rotation of the cut planes around the second axis of the chosen orientation.
-*/
+
+ /*!
+ * Sets the type of orientation in 3D space of cut planes presentation.
+ * \param theOrientation This parameter defines the type of orientation of cut planes
+ * in 3D space. It is taken from the <VAR>Orientation</VAR> enumeration.
+ * \param theXAngle The angle of rotation of the cut planes around
+ * the first axis of the chosen orientation.
+ * \param theXAngle The angle of rotation of the cut planes around
+ * the second axis of the chosen orientation.
+ */
void SetOrientation(in Orientation theOrientation, in double theXAngle, in double theYAngle);
-/*!
-Gets the type of orientation in 3D space of cut planes presentation.
-*/
+
+ /*!
+ * Gets the type of orientation in 3D space of cut planes presentation.
+ */
Orientation GetOrientationType();
-/*!
-Gets rotation angle of the cut plane presentation around the first axis of the chosen orientation.
-*/
+
+ /*!
+ * Gets rotation angle of the cut plane presentation around the first axis of the chosen orientation.
+ */
double GetRotateX();
-/*!
-Gets rotation angle of the cut plane presentation around the second axis of the chosen orientation.
-*/
+
+ /*!
+ * Gets rotation angle of the cut plane presentation around the second axis of the chosen orientation.
+ */
double GetRotateY();
-/*!
-Sets the displacement of the cut planes in 3D space.
-\param theDisp This parameter defines position of the cut planes
-in 3D space. It varies from 0 to 1. If the chosen value is 0.5, the cut planes
-will be evenly located regarding each other; in other words, the distance between all
-of them will be equal. If the value is higher or lower than 0.5, the planes will be displaced
-to one or another side.
-*/
+ /*!
+ * Sets the displacement of the cut planes in 3D space.
+ *
+ * \param theDisp This parameter defines position of the cut planes
+ * in 3D space. It varies from 0 to 1. If the chosen value is 0.5, the cut planes
+ * will be evenly located regarding each other; in other words, the distance between all
+ * of them will be equal. If the value is higher or lower than 0.5, the planes will be displaced
+ * to one or another side.
+ */
void SetDisplacement(in double theDisp);
-/*!
-Gets the displacement of the cut planes in 3D space.
-*/
+
+ /*!
+ * Gets the displacement of the cut planes in 3D space.
+ */
double GetDisplacement();
-/*!
-Sets the position of a definite cut plane.
-\param thePlaneNumber The number of this cut plane.
-\param thePlanePosition The position of this cut plane.
-*/
+
+ /*!
+ * Sets the position of a definite cut plane.
+ * \param thePlaneNumber The number of this cut plane.
+ * \param thePlanePosition The position of this cut plane.
+ */
void SetPlanePosition(in long thePlaneNumber, in double thePlanePosition);
-/*!
-Sets the position of the choosen plane to default value.
-\param thePlaneNumber The number of this cut plane.
-*/
+ /*!
+ * Sets the position of the choosen plane to default value.
+ * \param thePlaneNumber The number of this cut plane.
+ */
void SetDefault(in long thePlaneNumber);
-/*!
-Gets the position of the choosen plane
-*/
-
+ /*!
+ * Gets the position of the choosen plane
+ */
double GetPlanePosition(in long thePlaneNumber);
-/*!
-Determines whether the choosen plane has default position.
-\param thePlaneNumber The number of this cut plane.
-*/
-
+ /*!
+ * Determines whether the choosen plane has default position.
+ * \param thePlaneNumber The number of this cut plane.
+ */
boolean IsDefault(in long thePlaneNumber);
-/*!
-Sets the number of cut planes.
-\param theNb The number of cut planes.
-*/
+ /*!
+ * Sets the number of cut planes.
+ * \param theNb The number of cut planes.
+ */
void SetNbPlanes(in long theNb);
-/*!
-Gets the number of cut planes.
-*/
+
+ /*!
+ * Gets the number of cut planes.
+ */
long GetNbPlanes();
};
- //-------------------------------------------------------
-/*! \brief Cut lines presentation.
-
-Presentation parameters of a Cut lines presentation.
-Cut Lines is a type of presentation which displays colored cells with applied scalar values on the mesh where lines are placed.
-The procedure of construction of a Cut Lines presentation reuses the algorithm of creation of Cut Planes presentation and consists of two steps:
-
- 1. From Cut Planes presentation one plane is taken and it is used as base plane for construction of cut lines.
- 2. This plane is cut by a regular array of planes. The result of this 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{
+ //-------------------------------------------------------
+ /*! \brief Cut lines presentation.
+ *
+ * Presentation parameters of a Cut lines presentation.
+ * Cut Lines is a type of presentation which displays colored cells
+ * with applied scalar values on the mesh where lines are placed.
+ * The procedure of construction of a Cut Lines presentation reuses the algorithm
+ * of creation of Cut Planes presentation and consists of two steps:
+ *
+ * 1. From Cut Planes presentation one plane is taken and
+ * it is used as base plane for construction of cut lines.
+ * 2. This plane is cut by a regular array of planes. The result of this
+ * 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 {
/*!
- 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.
-\param theXAngle The angle of rotation of the base plane around the first axis of the chosen orientation.
-\param theXAngle The angle of rotation of the base plane around the second axis of the chosen orientation.
-
- */
+ * 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.
+ * \param theXAngle The angle of rotation of the base plane around
+ * the first axis of the chosen orientation.
+ * \param theXAngle The angle of rotation of the base plane around
+ * the second axis of the chosen orientation.
+ */
void SetOrientation(in CutPlanes::Orientation theOrientation, in double theXAngle, in double theYAngle);
- /*!
- Sets the type of orientation in 3D space of the cutting planes of a cut lines presentation.
- \param theOrientation This parameter defines the type of orientation of the cutting planes in 3D space. It is taken from the <VAR>Orientation</VAR> enumeration.
-\param theXAngle The angle of rotation of the cutting planes around the first axis of the chosen orientation.
-\param theXAngle The angle of rotation of the cutting planes around the second axis of the chosen orientation.
- */
+ /*!
+ * Sets the type of orientation in 3D space of the cutting planes of a cut lines presentation.
+ * \param theOrientation This parameter defines the type of orientation of the cutting planes
+ * in 3D space. It is taken from the <VAR>Orientation</VAR> enumeration.
+ * \param theXAngle The angle of rotation of the cutting planes
+ * around the first axis of the chosen orientation.
+ * \param theXAngle The angle of rotation of the cutting planes
+ * around the second axis of the chosen orientation.
+ */
void SetOrientation2(in CutPlanes::Orientation theOrientation, in double theXAngle, in double theYAngle);
-/*!
- Gets the type of orientation in 3D space of the base plane of a cut lines presentation.
-*/
+ /*!
+ * Gets the type of orientation in 3D space of the base plane of a cut lines presentation.
+ */
CutPlanes::Orientation GetOrientationType();
-/*!
- Gets the type of orientation in 3D space of the cutting planes of a cut lines presentation.
-*/
+
+ /*!
+ * Gets the type of orientation in 3D space of the cutting planes of a cut lines presentation.
+ */
CutPlanes::Orientation GetOrientationType2();
-/*!
-Gets rotation angle of the base plane around the first axis of the chosen orientation.
-*/
+
+ /*!
+ * Gets rotation angle of the base plane around the first axis of the chosen orientation.
+ */
double GetRotateX();
-/*!
-Gets rotation angle of the cutting planes around the first axis of the chosen orientation.
-*/
+
+ /*!
+ * Gets rotation angle of the cutting planes around the first axis of the chosen orientation.
+ */
double GetRotateX2();
-/*!
-Gets rotation angle of the base plane around the second axis of the chosen orientation.
-*/
+ /*!
+ * Gets rotation angle of the base plane around the second axis of the chosen orientation.
+ */
double GetRotateY();
-/*!
-Gets rotation angle of the cutting planes around the second axis of the chosen orientation.
-*/
- double GetRotateY2();
-/*!
-Sets the displacement of the base plane of the cut lines presentation in 3D space.
+ /*!
+ * Gets rotation angle of the cutting planes around the second axis of the chosen orientation.
+ */
+ double GetRotateY2();
-\param theDisp This parameter defines position of the base plane
-in 3D space. It varies from 0 to 1.
-*/
+ /*!
+ * Sets the displacement of the base plane of the cut lines presentation in 3D space.
+ *
+ * \param theDisp This parameter defines position of the base plane
+ * in 3D space. It varies from 0 to 1.
+ */
void SetDisplacement(in double theDisp);
-/*!
-Sets the displacement of the cutting planes of the cut lines presentation in 3D space.
-
-\param theDisp This parameter defines position of the cutting planes
-in 3D space. It varies from 0 to 1.
-*/
+ /*!
+ * Sets the displacement of the cutting planes of the cut lines presentation in 3D space.
+ *
+ * \param theDisp This parameter defines position of the cutting planes
+ * in 3D space. It varies from 0 to 1.
+ */
void SetDisplacement2(in double theDisp);
-/*!
-Gets the displacement of the base plane of the cut lines presentation in 3D space.
-*/
+ /*!
+ * Gets the displacement of the base plane of the cut lines presentation in 3D space.
+ */
double GetDisplacement();
-/*!
-Gets the displacement of the cutting planes of the cut lines presentation in 3D space.
-*/
+
+ /*!
+ * Gets the displacement of the cutting planes of the cut lines presentation in 3D space.
+ */
double GetDisplacement2();
-/*! Sets the position of the base plane in 3D space.
-\param thePlanePosition A double value defining the position of the base plane in 3D space.
-*/
+
+ /*! Sets the position of the base plane in 3D space.
+ * \param thePlanePosition A double value defining the position of the base plane in 3D space.
+ */
void SetBasePlanePosition(in double thePlanePosition);
-/*! Gets the position of the base plane in 3D space.
-*/
+
+ /*! Gets the position of the base plane in 3D space.
+ */
double GetBasePlanePosition();
-/*! Sets the position of one of cutting planes in 3D space.
-\param thePlaneNumber A long value defining the order number of this cutting plane.
-\param thePlanePosition A double value defining the position of the base plane in 3D space.
-*/
+ /*! Sets the position of one of cutting planes in 3D space.
+ * \param thePlaneNumber A long value defining the order number of this cutting plane.
+ * \param thePlanePosition A double value defining the position of the base plane in 3D space.
+ */
void SetLinePosition(in long thePlaneNumber, in double thePlanePosition);
-/*! Gets the position of one of cutting planes in 3D space.
-\param thePlaneNumber A long value defining the order number of this cutting plane.
-*/
+ /*! Gets the position of one of cutting planes in 3D space.
+ * \param thePlaneNumber A long value defining the order number of this cutting plane.
+ */
double GetLinePosition(in long thePlaneNumber);
-/*! Sets the position of the base plane to default value.
-*/
+ /*! Sets the position of the base plane to default value.
+ */
void SetDefault();
-/*!
-Determines whether the base plane has default position.
-\return True if the base plane has default position.
-*/
- boolean IsDefault();
-/*!
-Sets the position of the choosen cutting plane to default value.
-\param thePlaneNumber The number of this cutting plane.
-*/
+ /*!
+ * Determines whether the base plane has default position.
+ * \return True if the base plane has default position.
+ */
+ boolean IsDefault();
+ /*!
+ * Sets the position of the choosen cutting plane to default value.
+ * \param thePlaneNumber The number of this cutting plane.
+ */
void SetDefaultPosition(in long thePlaneNumber);
-/*!
-Determines whether the choosen cutting plane has default position.
-\param thePlaneNumber The number of this cutting plane.
-\return True if this cutting plane has default position.
-*/
+ /*!
+ * Determines whether the choosen cutting plane has default position.
+ * \param thePlaneNumber The number of this cutting plane.
+ * \return True if this cutting plane has default position.
+ */
boolean IsDefaultPosition(in long thePlaneNumber);
-/*!
-Sets the number of cut lines.
-\param theNb The number of cut lines.
-*/
+
+ /*!
+ * Sets the number of cut lines.
+ * \param theNb The number of cut lines.
+ */
void SetNbLines(in long theNb);
-/*!
-Gets the number of cut lines.
-*/
+
+ /*!
+ * Gets the number of cut lines.
+ */
long GetNbLines();
};
- /*! \brief Interface of the stream lines representation
- This interface contains presentation parameters of
- stream lines presentations.
-<BR>Stream lines is a type of presentation transforming into lines the cells with vectors having most similar direction.
-A stream line can be thought of as the path that a massless particle takes in a vector field. Streamlines are used to convey the structure of a vector field.
-Usually streamlines are created to explore the most interesting features in the field.
- */
- interface StreamLines : DeformedShape{
-/*! This enumerations contains a set of elements necessary
-for definition of direction of the stream lines.
-
-*/
+ /*! \brief Interface of the stream lines representation
+ *
+ * This interface contains presentation parameters of stream lines presentations.
+ * <BR>Stream lines is a type of presentation transforming into lines the
+ * cells with vectors having most similar direction. A stream line can be thought
+ * of as the path that a massless particle takes in a vector field.
+ * Streamlines are used to convey the structure of a vector field.
+ * Usually streamlines are created to explore the most interesting features in the field.
+ */
+ interface StreamLines : DeformedShape {
+ /*! This enumerations contains a set of elements necessary
+ * for definition of direction of the stream lines.
+ */
enum Direction{ FORWARD,
BACKWARD,
BOTH
};
-/*! Sets the parameters of the stream lines presentation.
-\param theIntStep Inegration step is a parameter of smoothness of the stream lines. This parameter defines the accuracy of construction of the streamlines. A smaller value of this parameter allows to construct smoother streamlines (at the cost of more computation time).
-\param thePropogationTime This parameter controls the maximum length of the stream line (measured in units of time).
-\param theStepLength This parameter defines the size of the output line segments that make up the streamline (which is represented as a polyline).
-\param thePrs3d The source presentation. The points of the field located on this source presentation
- will serve as starting points for generation of stream lines.
- \note If this parameter is not defined, your stream lines presentation will be generated on all points of the field.
-\param thePercents This parameter defines the quantity of points of the field (from 0 to 100%) which will be used as starting points for construction of the stream lines. Thus, the value of this parameter can vary from 0 to 1.
-\param theDirection Direction of the stream lines.(Forward, Backward or Both)
-\return True if all parameters are properly set.
-*/
+
+ /*! Sets the parameters of the stream lines presentation.
+ * \param theIntStep Inegration step is a parameter of smoothness of the stream lines.
+ * This parameter defines the accuracy of construction of the streamlines.
+ * A smaller value of this parameter allows to construct smoother
+ * streamlines (at the cost of more computation time).
+ * \param thePropogationTime This parameter controls the maximum length of
+ * the stream line (measured in units of time).
+ * \param theStepLength This parameter defines the size of the output line segments
+ * that make up the streamline (which is represented as a polyline).
+ * \param thePrs3d The source presentation. The points of the field located on this source
+ * presentation will serve as starting points for generation of stream lines.
+ * \note If this parameter is not defined, your stream lines
+ * presentation will be generated on all points of the field.
+ * \param thePercents This parameter defines the quantity of points of the field
+ * (from 0 to 100%) which will be used as starting points for
+ * construction of the stream lines. Thus, the value of this
+ * parameter can vary from 0 to 1.
+ * \param theDirection Direction of the stream lines (Forward, Backward or Both).
+ * \return True if all parameters are properly set.
+ */
boolean SetParams(in double theIntStep,
- in double thePropogationTime,
- in double theStepLength,
- in Prs3d thePrs3d,
- in double thePercents,
- in Direction theDirection);
-/*! Gets the value of integration step of the stream lines presentation.
-*/
+ in double thePropogationTime,
+ in double theStepLength,
+ in Prs3d thePrs3d,
+ in double thePercents,
+ in Direction theDirection);
+
+ /*! Gets the value of integration step of the stream lines presentation.
+ */
double GetIntegrationStep();
-/*! Gets the value of propagation time of the stream lines presentation.
-*/
+
+ /*! Gets the value of propagation time of the stream lines presentation.
+ */
double GetPropagationTime();
-/*! Gets the value of step length of the stream lines presentation.
-*/
+
+ /*! Gets the value of step length of the stream lines presentation.
+ */
double GetStepLength();
-/*! Returns the source presentation used for generation of the stream lines.
-*/
+
+ /*! Returns the source presentation used for generation of the stream lines.
+ */
Prs3d GetSource();
-/*! Gets the quantity of points of the field used as starting points for generation of the stream lines presentation.
-*/
+
+ /*! Gets the quantity of points of the field used as starting
+ * points for generation of the stream lines presentation.
+ */
double GetUsedPoints();
-/*! Returns the direction of the stream lines.
-*/
+
+ /*! Returns the direction of the stream lines.
+ */
Direction GetDirection();
};
-
-/*! \brief Interface of the isometric surface presentation
-
- This interface contains presentation parameters of
- isometric surface presentations.
-<BR>Iso surfaces presentation combines all equal scalar values on the cells and on the basis of them constructs
-isobaric surfaces, which form this presentation.
-*/
- interface IsoSurfaces : ScalarMap{
-/*!
- Sets the number of isometric surfaces.
-\param theNb A long value defining the number of isometric surfaces which will be used for construction of this presentation.
-*/
+ /*! \brief Interface of the isometric surface presentation
+ *
+ * This interface contains presentation parameters of
+ * isometric surface presentations.
+ * <BR>Iso surfaces presentation combines all equal scalar
+ * values on the cells and on the basis of them constructs
+ * isobaric surfaces, which form this presentation.
+ */
+ interface IsoSurfaces : ScalarMap {
+ /*!
+ * Sets the number of isometric surfaces.
+ * \param theNb A long value defining the number of isometric surfaces
+ * which will be used for construction of this presentation.
+ */
void SetNbSurfaces(in long theNb);
-/*!
- Gets the number of isometric surfaces
-*/
+
+ /*!
+ * Gets the number of isometric surfaces
+ */
long GetNbSurfaces();
};
- //-------------------------------------------------------
-/*! \brief Interface of the vector presentation.
-This interface contains presentation parameters of vector presentations.
-*/
- interface Vectors : DeformedShape{
-/*!
-Sets the width of the lines of the vectors.
-\param theWidth A double value defining the width of the lines of the vectors.
-*/
+ //-------------------------------------------------------
+ /*! \brief Interface of the vector presentation.
+ *
+ * This interface contains presentation parameters of vector presentations.
+ */
+ interface Vectors : DeformedShape {
+ /*!
+ * Sets the width of the lines of the vectors.
+ * \param theWidth A double value defining the width of the lines of the vectors.
+ */
void SetLineWidth(in double theWidth);
-/*!
-Gets the width of the lines of the vectors.
-*/
+
+ /*!
+ * Gets the width of the lines of the vectors.
+ */
double GetLineWidth();
-/*!
- This enumeration contains a set of elements defining the type of representation of the vector head.
-*/
+
+ /*!
+ * This enumeration contains a set of elements defining the type of representation of the vector head.
+ */
enum GlyphType{ ARROW,
CONE2,
CONE6,
NONE
};
-/*!
-Sets the type of representation of the vector head.
-\param theType This parameter defines the type of representation of the vector head.
-This value is taken from the <VAR>GlyphType</VAR> enumeration.
-*/
+
+ /*!
+ * Sets the type of representation of the vector head.
+ * \param theType This parameter defines the type of representation of the vector head.
+ * This value is taken from the <VAR>GlyphType</VAR> enumeration.
+ */
void SetGlyphType(in GlyphType theType);
-/*!
-Gets the type of representation of the vector head.
-*/
+
+ /*!
+ * Gets the type of representation of the vector head.
+ */
GlyphType GetGlyphType();
-/*!
- This enumeration contains a set of elements defining the position of the vector head.
-*/
+ /*!
+ * This enumeration contains a set of elements defining the position of the vector head.
+ */
enum GlyphPos{ CENTER, /*!<In the center of the vector.*/
TAIL, /*!<In the tail of the vector.*/
HEAD /*!<In the head of the vector.*/
};
-/*!
-Sets the position of the vector head.
-\param thePos This parameter defines the position of the vector head.
-This value is taken from the <VAR>GlyphPos</VAR> enumeration.
-*/
+
+ /*!
+ * Sets the position of the vector head.
+ * \param thePos This parameter defines the position of the vector head.
+ * This value is taken from the <VAR>GlyphPos</VAR> enumeration.
+ */
void SetGlyphPos(in GlyphPos thePos);
-/*!
-Gets the position of the vector head.
-*/
+
+ /*!
+ * Gets the position of the vector head.
+ */
GlyphPos GetGlyphPos();
};
- //-------------------------------------------------------
-/*! \brief %Animation class
-
-This class provides a set of methods used for:<br>
-<ul>
- <li> generating different animations on the basis of a field,
- <li> setting the parameters of the animations,
- <li> playing these animations in the %VISU module.
-</ul>
-\note
-<BR><B>Field</B> represents the results of calculations (it can be scalar or vector values), grouped together under one physical concept.
-<BR><B>Time stamp</B> represents a subfield: the results of calculations are taken in one definite moment.
-*/
- interface Animation : Base{
-/*! Defines the field which will be used as a base for generation of the animation.
-\param theObject The %SObject corresponding to the field.
-*/
+ //-------------------------------------------------------
+ /*! \brief %Animation class
+ *
+ * This class provides a set of methods used for:<br>
+ * <ul>
+ * <li> generating different animations on the basis of a field,
+ * <li> setting the parameters of the animations,
+ * <li> playing these animations in the %VISU module.
+ * </ul>
+ * \note
+ * <BR><B>Field</B> represents the results of calculations
+ * (it can be scalar or vector values), grouped together under one physical concept.
+ * <BR><B>Time stamp</B> represents a subfield: the results
+ * of calculations are taken in one definite moment.
+ */
+ interface Animation : Base {
+ /*! Defines the field which will be used as a base for generation of the animation.
+ * \param theObject The %SObject corresponding to the field.
+ */
void addField(in SALOMEDS::SObject theObject);
-/*! Generates presentations on the basis of the field.
-\param theFieldNum The number of the field, which will be used as the basis for construction of the presentation.
-*/
+
+ /*! Generates presentations on the basis of the field.
+ * \param theFieldNum The number of the field, which will be used
+ * as the basis for construction of the presentation.
+ */
void generatePresentations(in long theFieldNum);
-/*! Generates a set of frames from the created by the method <VAR>generatePresentations</VAR>3D presentations. A sequence of these frames will be
-transformed into an animation.
-\return True, if the frames have been successfully generated.
-*/
+
+ /*! Generates a set of frames from the created by the method
+ * <VAR>generatePresentations</VAR>3D presentations. A sequence of
+ * these frames will be transformed into an animation.
+ * \return True, if the frames have been successfully generated.
+ */
boolean generateFrames();
-/*! Clears the view before starting an animation.
-*/
+
+ /*! Clears the view before starting an animation.
+ */
void clearView();
-/*! \name Playback of an animation:
-*/
+ /*! \name Playback of an animation:
+ */
/*@{*/
-/*! Starts an animation.
-*/
+ /*! Starts an animation.
+ */
void startAnimation();
-/*! Stops an animation.
-*/
+
+ /*! Stops an animation.
+ */
void stopAnimation();
-/*! Forwards to the next frame.
-*/
+ /*! Forwards to the next frame.
+ */
void nextFrame();
-/*! Returns to the previous frame.
-*/
+
+ /*! Returns to the previous frame.
+ */
void prevFrame();
-/*! Returns to the first frame of the animation.
-*/
+
+ /*! Returns to the first frame of the animation.
+ */
void firstFrame();
-/*! Forwards to the last frame of the animation.
-*/
+
+ /*! Forwards to the last frame of the animation.
+ */
void lastFrame();
-/*! Passes to a definite frame of the animation.
-\param theFrame A long value defining the number of the frame.
-*/
+
+ /*! Passes to a definite frame of the animation.
+ * \param theFrame A long value defining the number of the frame.
+ */
void gotoFrame(in long theFrame);
/*@}*/
-/*! Gets the number of time stamps (subfields) contained in the given field.
-*/
+ /*! Gets the number of time stamps (subfields) contained in the given field.
+ */
long getNbFields();
-/*! Gets the number of generated frames
-*/
+
+ /*! Gets the number of generated frames
+ */
long getNbFrames();
-/*! Returns True, if the animation is currently running.
-*/
+
+ /*! Returns True, if the animation is currently running.
+ */
boolean isRunning();
-/*! Returns the number of the current frame.
-*/
+
+ /*! Returns the number of the current frame.
+ */
long getCurrentFrame();
-/*!
-*/
+
+ /*!
+ */
ScalarMap getPresentation(in long theField, in long theFrame);
-/*! Sets the type of presentation (vectors, deformed shape etc.) which will be generated by the method <VAR>generatePresentations</VAR>.
-*/
+
+ /*! Sets the type of presentation (vectors, deformed shape etc.)
+ * which will be generated by the method <VAR>generatePresentations</VAR>.
+ */
void setPresentationType(in long theFieldNum, in VISUType theType);
-/*! Gets the type of presentation (vectors, deformed shape etc.) which will
-be generated by the method <VAR>generatePresentations</VAR>.
-*/
+
+ /*! Gets the type of presentation (vectors, deformed shape etc.) which will
+ * be generated by the method <VAR>generatePresentations</VAR>.
+ */
VISUType getPresentationType(in long theFieldNum);
-/*! Sets the speed of the animation.
-\param theSpeed The speed of the animation. The value varies from 1 to 99.
-*/
+ /*! Sets the speed of the animation.
+ * \param theSpeed The speed of the animation. The value varies from 1 to 99.
+ */
void setSpeed(in long theSpeed);
-/*! Gets the speed of the animation.
-*/
+
+ /*! Gets the speed of the animation.
+ */
long getSpeed();
-/*! Ruturns True, if playback of the animation is proportional.
-This option allows to render your animation with proportional periods of time between every frame (not depending on the time stamps).
-*/
+
+ /*! Ruturns True, if playback of the animation is proportional.
+ * This option allows to render your animation with proportional periods
+ * of time between every frame (not depending on the time stamps).
+ */
boolean isProportional();
-/*! Sets the range of the animation. The range is defined on the basis of
-the time stamps of the field which have been used for generation of the animation. This method allows to bound the range of generated frames.
-If this method is not used, the animation will be generated on the basis of all time stamps contained in the field.
-/param theMin The value of the first time stamp which will be used for generation of the animation.
-/param theMax The value of the last time stamp which will be used for generation of the animation.
-*/
+ /*! Sets the range of the animation. The range is defined on the basis of
+ * the time stamps of the field which have been used for generation of the animation.
+ * This method allows to bound the range of generated frames.
+ * If this method is not used, the animation will be generated
+ * on the basis of all time stamps contained in the field.
+ * /param theMin The value of the first time stamp which will be used for generation of the animation.
+ * /param theMax The value of the last time stamp which will be used for generation of the animation.
+ */
void setAnimationRange(in double theMin, in double theMax);
-/*! Gets the number of the first time stamp which will be used for generation of the animation.
-*/
+
+ /*! Gets the number of the first time stamp which will be used for generation of the animation.
+ */
double getMinRange();
-/*! Gets the number of the last time stamp which will be used for generation of the animation.
-*/
+
+ /*! Gets the number of the last time stamp which will be used for generation of the animation.
+ */
double getMaxRange();
-/*! Returns True if the range of the animation has been defined by the method <VAR>setAnimationRange</VAR>. Otherwise
-the animation will be generated on the basis of all time stamps contained in the field.
-*/
+
+ /*! Returns True if the range of the animation has been defined
+ * by the method <VAR>setAnimationRange</VAR>. Otherwise
+ * the animation will be generated on the basis of all time stamps contained in the field.
+ */
boolean isRangeDefined();
-/*! Saves all the frames composing the animation into a definite directory.
-\param thePath The directory where all the frames will be saved.
-*/
+
+ /*! Saves all the frames composing the animation into a definite directory.
+ * \param thePath The directory where all the frames will be saved.
+ */
void dumpTo(in string thePath);
-/*! Returns True, if the playback of the animation is cycling.
-*/
+ /*! Returns True, if the playback of the animation is cycling.
+ */
boolean isCycling();
-/*! Gets the first time stamp of the field defined at the input of the animation.
-\note This method is used if animation range is <b>NOT</b> defined.
-*/
+
+ /*! Gets the first time stamp of the field defined at the input of the animation.
+ * \note This method is used if animation range is <b>NOT</b> defined.
+ */
double getMinTime();
-/*! Gets the last time stamp of the field defined at the input of the animation.
-\note This method is used if animation range is <b>NOT</b> defined.
-*/
+
+ /*! Gets the last time stamp of the field defined at the input of the animation.
+ * \note This method is used if animation range is <b>NOT</b> defined.
+ */
double getMaxTime();
-/*! Sets proprtional playback of the animation. This option allows to render your animation with proportional periods of time between every frame (not depending on the time stamps).
-\param theProp If this boolean parameter is True, playback of your animation will be set as proportional.
-*/
+
+ /*! Sets proprtional playback of the animation. This option allows to render your animation
+ * with proportional periods of time between every frame (not depending on the time stamps).
+ * \param theProp If this boolean parameter is True, playback
+ * of your animation will be set as proportional.
+ */
void setProportional(in boolean theProp);
-/*! Sets cycling playback of the animation. The number of cycles can be infinite, untill you use <VAR>startAnimation</VAR> method.
-\param theCycle If this boolean parameter is True, playback of your animation will be set as cycling.
-*/
+
+ /*! Sets cycling playback of the animation. The number of cycles
+ * can be infinite, untill you use <VAR>startAnimation</VAR> method.
+ * \param theCycle If this boolean parameter is True, playback
+ * of your animation will be set as cycling.
+ */
void setCycling(in boolean theCycle);
- };
-/*! \brief Interface %Result
+ SALOMEDS::SObject publishInStudy();
-This interface serves for inner representation of data generated in other sources. (MED object or file)
-This data is needed for further construction of graphical presentations.
-*/
- interface Result : Base, SALOME::GenericObj{
+ void saveAnimation();
+
+ void restoreFromStudy(in SALOMEDS::SObject theSObj);
+
+ boolean isSavedInStudy();
+ };
+
+ /*! \brief Interface %Result
+ *
+ * This interface serves for inner representation of data generated
+ * in other sources (MED object or file). This data is needed
+ * for further construction of graphical presentations.
+ */
+ interface Result : RemovableObject, SALOME::GenericObj {
//interface Result : Base{
-/*! Reads all data from the corresponding sources. By default the data is loaded on demand.
-*/
+ /*! Reads all data from the corresponding sources. By default the data is loaded on demand.
+ */
boolean BuildAll();
};
+
//-------------------------------------------------------
interface ViewManager;
interface View3D;
-/*! \brief %VISU_Gen interface
-This is the main interface of %VISU component. It is necessary for creation of
-post-processing presentations from given %Result and %Table object reference, using the views
-provided by %ViewManager.
-*/
- interface VISU_Gen : Engines::Component, SALOMEDS::Driver, Base{
-/*! Sets a definite study to be current.
-*/
- void SetCurrentStudy(in SALOMEDS::Study theStudy);
-/*! Gets the current study.
-*/
- SALOMEDS::Study GetCurrentStudy();
-/*!
- Gets the %View Manager which is used for creation of
- post-processing presentations.
-*/
+ /*! \brief %VISU_Gen interface
+ *
+ * This is the main interface of %VISU component. It is necessary for creation of
+ * post-processing presentations from given %Result and %Table object reference,
+ * using the views provided by %ViewManager.
+ */
+ interface VISU_Gen : Engines::Component, SALOMEDS::Driver, Base {
+ /*! Sets a definite study to be current.
+ */
+ void SetCurrentStudy(in SALOMEDS::Study theStudy);
+
+ /*! Gets the current study.
+ */
+ SALOMEDS::Study GetCurrentStudy();
+
+ /*!
+ * Gets the %View Manager which is used for creation of
+ * post-processing presentations.
+ */
ViewManager GetViewManager();
-/*!
-Imports tables from a file and create TableAttribute in Sudy
-*/
+ /*!
+ * Imports tables from a file and create TableAttribute in Sudy
+ */
SALOMEDS::SObject ImportTables(in string theFileName);
-/*!
-Export table to a file
-*/
- boolean ExportTableToFile(in SALOMEDS::SObject theTable, in string theFileName);
-/*!
-Imports data from a file. The access to this file will be conserved outside of the application.
-\param theFileName String parameter defining the name of the file from which the data will
-be imported.
-*/
+ /*!
+ * Export table to a file
+ */
+ boolean ExportTableToFile(in SALOMEDS::SObject theTable, in string theFileName);
+
+ /*!
+ * Imports data from a file. The access to this file will be conserved outside of the application.
+ * \param theFileName String parameter defining the name of the file
+ * from which the data will be imported.
+ */
Result ImportFile(in string theFileName);
-/*!
-Imports data from a file. The access to this file will closed.
-\param theFileName String parameter defining the name of the file from which the data will
-be imported.
-*/
+ /*!
+ * Imports data from a file. The access to this file will closed.
+ * \param theFileName String parameter defining the name of the file
+ * from which the data will be imported.
+ */
Result CopyAndImportFile(in string theFileName);
-/*!
-Imports data from a %MED object.
-*/
+
+ /*!
+ * Imports data from a %MED object.
+ */
Result ImportMed(in SALOMEDS::SObject theMedSObject);
-/*!
-Imports data from a %MED field.
-*/
+
+ /*!
+ * Imports data from a %MED field.
+ */
Result ImportMedField(in SALOME_MED::FIELD theField);
-/*!
-Creates a mesh on the basis of the data generated in other sources (MED object or file).
-\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
-*/
+
+ /*!
+ * Creates a mesh on the basis of the data generated in other sources (MED object or file).
+ * \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
+ */
Mesh MeshOnEntity(in Result theResult, in string theMeshName, in Entity theEntity);
-/*!
-Creates on the basis of a family a mesh which will
-be composed of geometrical elements, corresponding to the type of cells (node, edge, face or cell) of this family.
-\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.
-*/
- Mesh FamilyMeshOnEntity(in Result theResult, in string theMeshName, in Entity theEntity, in string theFamilyName);
-/*!
-Creates a mesh on the basis of a group of families.
-\param theResult Data generated in other sources. (MED object or file)
-\param theMeshName One of the meshes presented in MED file
-\param theGroupName Name of the group.
-*/
+ /*!
+ * Creates on the basis of a family a mesh which will be composed of geometrical
+ * elements, corresponding to the type of cells (node, edge, face or cell) of this family.
+ * \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.
+ */
+ Mesh FamilyMeshOnEntity(in Result theResult, in string theMeshName,
+ in Entity theEntity, in string theFamilyName);
+
+ /*!
+ * Creates a mesh on the basis of a group of families.
+ * \param theResult Data generated in other sources. (MED object or file)
+ * \param theMeshName One of the meshes presented in MED file
+ * \param theGroupName Name of the group.
+ */
Mesh GroupMesh(in Result theResult, in string theMeshName, in string theGroupName);
-/*!
-Creates a scalar map presentation.
-\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 theIteration Number of iteration on the field
-*/
- ScalarMap ScalarMapOnField(in Result theResult, in string theMeshName, in Entity theEntity, in string theFieldName, in double theIteration);
-/*!
-Creates a deformed shape presentation.
-\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 theIteration Number of iteration on the field
-*/
- DeformedShape DeformedShapeOnField(in Result theResult, in string theMeshName, in Entity theEntity, in string theFieldName, in double theIteration);
-/*!
-Creates a vector presentation.
-\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 theIteration Number of iteration on the field
-*/
- Vectors VectorsOnField(in Result theResult, in string theMeshName, in Entity theEntity, in string theFieldName, in double theIteration);
-/*!
-Creates an iso surface presentation.
-\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 theIteration Number of iteration on the field
-*/
+ /*!
+ * Creates a scalar map presentation.
+ * \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 theIteration Number of iteration on the field
+ */
+ ScalarMap ScalarMapOnField(in Result theResult, in string theMeshName,
+ in Entity theEntity, in string theFieldName,
+ in double theIteration);
- IsoSurfaces IsoSurfacesOnField(in Result theResult, in string theMeshName, in Entity theEntity, in string theFieldName, in double theIteration);
-/*!
-Creates an stream lines presentation.
-\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 theIteration Number of iteration on the field
-*/
- StreamLines StreamLinesOnField(in Result theResult, in string theMeshName, in Entity theEntity, in string theFieldName, in double theIteration);
+ /*!
+ * Creates a deformed shape presentation.
+ * \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 theIteration Number of iteration on the field
+ */
+ DeformedShape DeformedShapeOnField(in Result theResult, in string theMeshName,
+ in Entity theEntity, in string theFieldName,
+ in double theIteration);
-/*!
-Creates a presentation of cut planes.
-\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 theIteration Number of iteration on the field
-*/
- CutPlanes CutPlanesOnField(in Result theResult, in string theMeshName, in Entity theEntity, in string theFieldName, in double theIteration);
+ /*!
+ * Creates a vector presentation.
+ * \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 theIteration Number of iteration on the field
+ */
+ Vectors VectorsOnField(in Result theResult, in string theMeshName,
+ in Entity theEntity, in string theFieldName,
+ in double theIteration);
-/*!
-Creates a presentation of cut lines.
-\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 theIteration Number of iteration on the field
-*/
- CutLines CutLinesOnField(in Result theResult, in string theMeshName, in Entity theEntity, in string theFieldName, in double theIteration);
+ /*!
+ * Creates an iso surface presentation.
+ * \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 theIteration Number of iteration on the field
+ */
+ IsoSurfaces IsoSurfacesOnField(in Result theResult, in string theMeshName,
+ in Entity theEntity, in string theFieldName,
+ in double theIteration);
-/*!
-Creates a table presentation.
-\param theTableEntry The entry of the table which will be displayed.
+ /*!
+ * Creates an stream lines presentation.
+ * \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 theIteration Number of iteration on the field
+ */
+ StreamLines StreamLinesOnField(in Result theResult, in string theMeshName,
+ in Entity theEntity, in string theFieldName,
+ in double theIteration);
-*/
+ /*!
+ * Creates a presentation of cut planes.
+ * \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 theIteration Number of iteration on the field
+ */
+ CutPlanes CutPlanesOnField(in Result theResult, in string theMeshName,
+ in Entity theEntity, in string theFieldName,
+ in double theIteration);
+
+ /*!
+ * Creates a presentation of cut lines.
+ * \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 theIteration Number of iteration on the field
+ */
+ CutLines CutLinesOnField(in Result theResult, in string theMeshName,
+ in Entity theEntity, in string theFieldName,
+ in double theIteration);
+
+ /*!
+ * Creates a Plot3D presentation.
+ * \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 theIteration Number of iteration on the field
+ */
+ Plot3D Plot3DOnField(in Result theResult, in string theMeshName,
+ in Entity theEntity, in string theFieldName,
+ in double theIteration);
+
+ /*!
+ * Creates a table presentation.
+ * \param theTableEntry The entry of the table which will be displayed.
+ */
Table CreateTable(in string theTableEntry);
-/*!
-Creates a curve on the basis of points, whose values are taken from the table.
-\param theTable Table containing the data for construction of curves.
-\param HRow Index of the row in the table: abscissa of the point.
-\param VRow Index of the row in the table: ordinate of the point.
-*/
+
+ /*!
+ * Creates a curve on the basis of points, whose values are taken from the table.
+ * \param theTable Table containing the data for construction of curves.
+ * \param HRow Index of the row in the table: abscissa of the point.
+ * \param VRow Index of the row in the table: ordinate of the point.
+ */
Curve CreateCurve(in Table theTable, in long theHRow, in long theVRow);
-/*!
-Creates a presentation form containing an array of references to the curves.
-*/
- Container CreateContainer();
-/*! Creates an animation in the 3D view.
-\param theView3d The 3D view, where the animation will be rendered.
-*/
- Animation CreateAnimation(in View3D theView3d);
- void DeleteResult(in Result theResult);
+ /*!
+ * Creates a presentation form containing an array of references to the curves.
+ */
+ Container CreateContainer();
+
+ /*! Creates an animation in the 3D view.
+ * \param theView3d The 3D view, where the animation will be rendered.
+ */
+ Animation CreateAnimation(in View3D theView3d);
- void DeletePrs3d(in Prs3d thePrs3d);
+ void DeleteResult(in Result theResult);
+ void DeletePrs3d(in Prs3d thePrs3d);
};
/*! \brief %View interface
* Old methods for view parameters management, they don't work now
*/
void SetViewWidth (in long Width); //setting width of view
- void SetViewHeight (in long Height); //setting height of view
+ void SetViewHeight (in long Height); //setting height of view
long GetViewWidth(); //getting view width
long GetViewHeight(); //getting view height
enum ViewPosition {TOP, CENTER, BOTTOM, RIGHT, LEFT}; //position of the study frame
void Destroy(in View theView);
};
};
+
#endif
<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="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="Same As..." icon-id="Visu_sameas.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=""/>
</menu-item>
<!-- ************************* Selection (menubar) ************************************** -->
<popup-item item-id="423" pos-id="" label-id="Global Selection" icon-id="Visu_selectall.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="424" pos-id="" label-id="Partial Selection" icon-id="Visu_selectonly.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="430" pos-id="" label-id="Scaling" icon-id="Visu_scaling.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
+ <popup-item item-id="431" pos-id="" label-id="Graduated axes" icon-id="Visu_graduated_axes.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
</menu-item>
</menubar> <!-- MENUBAR END -->
<toolbutton-item item-id="423" pos-id="" label-id="Global Selection" icon-id="Visu_selectall.png" tooltip-id="Global Selection" accel-id="" toggle-id="" execute-action=""/>
<toolbutton-item item-id="424" pos-id="" label-id="Partial Selection" icon-id="Visu_selectonly.png" tooltip-id="Partial Selection" accel-id="" toggle-id="" execute-action=""/>
<toolbutton-item item-id="430" pos-id="" label-id="Scaling" icon-id="Visu_scaling.png" tooltip-id="Scaling" accel-id="" toggle-id="" execute-action=""/>
+ <toolbutton-item item-id="431" pos-id="" label-id="Graduated axes" icon-id="Visu_graduated_axes.png" tooltip-id="Graduated axes" accel-id="" toggle-id="" execute-action=""/>
</toolbar>
<toolbar label-id="Visualization Toolbar">
<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="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="Same As..." icon-id="Visu_sameas.png" tooltip-id="Same As" 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=""/>
</toolbar>
</desktop> <!-- DESKTOP END -->
<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="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="Same As..." icon-id="Visu_sameas.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=""/>
</menu-item>
<!-- ************************* Selection (menubar) ************************************** -->
<menu-item label-id="Selection" item-id="41" pos-id="4">
- <submenu label-id="Cell" item-id="411" pos-id="">
- <popup-item item-id="4111" pos-id="" label-id="Select by number" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
- <popup-item item-id="4112" pos-id="" label-id="Return attributes" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
- </submenu>
- <endsubmenu />
- <submenu label-id="Point" item-id="412" pos-id="">
- <popup-item item-id="4121" pos-id="" label-id="Select by number" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
- <popup-item item-id="4122" pos-id="" label-id="Return attributes" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
- </submenu>
- <endsubmenu />
- <popup-item item-id="413" pos-id="" label-id="Shape" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
+ <popup-item item-id="4111" pos-id="" label-id="Selection info..." icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
</menu-item>
<!-- ************************* Representation (menubar) ************************************** -->
<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="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="Same As..." icon-id="Visu_sameas.png" tooltip-id="Same As" 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=""/>
</toolbar>
-<toolbar label-id="Selection Toolbar">
- <toolbutton-item item-id="101" pos-id="" label-id="Point" icon-id="Visu_selectionpoint.png" tooltip-id="Point selection" accel-id="" toggle-id="" execute-action=""/>
- <toolbutton-item item-id="102" pos-id="" label-id="Edge" icon-id="Visu_selectionedge.png" tooltip-id="Edge selection" accel-id="" toggle-id="" execute-action=""/>
- <toolbutton-item item-id="103" pos-id="" label-id="Cell" icon-id="Visu_selectioncell.png" tooltip-id="Cell selection" accel-id="" toggle-id="" execute-action=""/>
- <toolbutton-item item-id="104" pos-id="" label-id="Actor" icon-id="Visu_selectionactor.png" tooltip-id="Actor selection" accel-id="" toggle-id="" execute-action=""/>
-</toolbar>
-
</desktop> <!-- DESKTOP END -->
</application> <!-- APPLICATION END -->
}
+ Plot3D_ptr VISU_Gen_i::Plot3DOnField(Result_ptr theResult,
+ const char* theMeshName,
+ VISU::Entity theEntity,
+ const char* theFieldName,
+ CORBA::Double theIteration)
+ {
+ return myVisuGen->Plot3DOnField(theResult,theMeshName,theEntity,theFieldName,theIteration);
+ }
+
+
Table_ptr VISU_Gen_i::CreateTable(const char* theTableEntry){
return myVisuGen->CreateTable(theTableEntry);
}
const char* theFieldName, CORBA::Double theIteration);
virtual StreamLines_ptr StreamLinesOnField(Result_ptr theResult, const char* theMeshName, VISU::Entity theEntity,
const char* theFieldName, CORBA::Double theIteration);
+ virtual Plot3D_ptr Plot3DOnField(Result_ptr theResult, const char* theMeshName, VISU::Entity theEntity,
+ const char* theFieldName, CORBA::Double theIteration);
//Create Digital Presentation
virtual Table_ptr CreateTable(const char* theTableEntry);
virtual Curve_ptr CreateCurve(Table_ptr theTable, CORBA::Long theHRow, CORBA::Long theVRow);
throw std::runtime_error("VISU_Actor::SetPipeLine >> There is no visible elements");
//Bug SAL4221: Mesh with less than 10 cells : shrink mode disable
//SetShrinkable(aDataSet->GetNumberOfCells() > 10);
- SetShrinkable(true);
+ SetShrinkable(thePipeLine->IsShrinkable());
//Now, we use vtkShrinkPolyData (not vtkShrinkFilter),
//and the class there is no such limitation.
-
+
myMapper->SetInput(aDataSet);
SetMapper(myMapper);
}
# VISU OBJECT : interactive object for VISU entities implementation
#
# Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2.1 of the License.
-#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-#
-# See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
#
#
#
VISU_VectorsPL.hxx VISU_StreamLinesPL.hxx \
VISU_LookupTable.hxx VISU_ScalarBarActor.hxx \
VISU_Extractor.hxx VISU_FieldTransform.hxx \
- VISU_UsedPointsFilter.hxx
+ VISU_UsedPointsFilter.hxx VISU_Plot3DPL.hxx
# Libraries targets
VISU_VectorsPL.cxx VISU_StreamLinesPL.cxx \
VISU_LookupTable.cxx VISU_ScalarBarActor.cxx \
VISU_Extractor.cxx VISU_FieldTransform.cxx \
- VISU_UsedPointsFilter.cxx
+ VISU_UsedPointsFilter.cxx VISU_Plot3DPL.cxx \
+ SALOME_ExtractGeometry.cxx
# Executables targets
BIN = VISUPipeLine
-BIN_SRC =
+BIN_SRC =
CPPFLAGS+= $(VTK_INCLUDES) \
-I${KERNEL_ROOT_DIR}/include/salome \
--- /dev/null
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+
+
+#include "SALOME_ExtractGeometry.h"
+
+#include <vtkCell.h>
+#include <vtkCellData.h>
+#include <vtkFloatArray.h>
+#include <vtkIdList.h>
+#include <vtkImplicitFunction.h>
+#include <vtkObjectFactory.h>
+#include <vtkPointData.h>
+#include <vtkUnstructuredGrid.h>
+
+#include <vtkImplicitBoolean.h>
+#include <vtkImplicitFunctionCollection.h>
+
+using namespace std;
+
+
+vtkStandardNewMacro(SALOME_ExtractGeometry);
+
+
+SALOME_ExtractGeometry::SALOME_ExtractGeometry()
+{}
+
+
+SALOME_ExtractGeometry::~SALOME_ExtractGeometry(){}
+
+
+vtkIdType SALOME_ExtractGeometry::GetElemObjId(int theID){
+ if(myElemVTK2ObjIds.empty() || theID > myElemVTK2ObjIds.size())
+ return theID;
+ return myElemVTK2ObjIds[theID];
+}
+
+
+vtkIdType SALOME_ExtractGeometry::GetNodeObjId(int theID){
+ if(myNodeVTK2ObjIds.empty() || theID > myNodeVTK2ObjIds.size())
+ return theID;
+ return myNodeVTK2ObjIds[theID];
+}
+
+
+void SALOME_ExtractGeometry::SetImplicitBoolean(vtkImplicitBoolean* theImplicitBoolean)
+{
+ myImplicitBoolean = theImplicitBoolean;
+ SetImplicitFunction(theImplicitBoolean);
+}
+
+
+void SALOME_ExtractGeometry::SetStoreMapping(bool theStoreMapping)
+{
+ myStoreMapping = theStoreMapping;
+ Modified();
+}
+
+
+void SALOME_ExtractGeometry::Execute()
+{
+ if(myImplicitBoolean.GetPointer()){
+ if(vtkImplicitFunctionCollection* aFunction = myImplicitBoolean->GetFunction()){
+ if(aFunction->GetNumberOfItems() == 0){
+ vtkDebugMacro(<< "Extracting geometry - ShallowCopy");
+ GetOutput()->ShallowCopy(GetInput());
+ return;
+ }
+ }
+ }
+ Execute2();
+}
+
+void SALOME_ExtractGeometry::Execute2()
+{
+ vtkIdType ptId, numPts, numCells, i, cellId, newCellId, newId, *pointMap;
+ vtkIdList *cellPts;
+ vtkCell *cell;
+ int numCellPts;
+ float *x;
+ float multiplier;
+ vtkPoints *newPts;
+ vtkIdList *newCellPts;
+ vtkDataSet *input = this->GetInput();
+ vtkPointData *pd = input->GetPointData();
+ vtkCellData *cd = input->GetCellData();
+ vtkUnstructuredGrid *output = this->GetOutput();
+ vtkPointData *outputPD = output->GetPointData();
+ vtkCellData *outputCD = output->GetCellData();
+ int npts;
+ numCells = input->GetNumberOfCells();
+ numPts = input->GetNumberOfPoints();
+
+ vtkDebugMacro(<< "Extracting geometry");
+
+ if ( ! this->ImplicitFunction )
+ {
+ vtkErrorMacro(<<"No implicit function specified");
+ return;
+ }
+
+ newCellPts = vtkIdList::New();
+ newCellPts->Allocate(VTK_CELL_SIZE);
+
+ if ( this->ExtractInside )
+ {
+ multiplier = 1.0;
+ }
+ else
+ {
+ multiplier = -1.0;
+ }
+
+ // Loop over all points determining whether they are inside the
+ // implicit function. Copy the points and point data if they are.
+ //
+ pointMap = new vtkIdType[numPts]; // maps old point ids into new
+ for (i=0; i < numPts; i++)
+ {
+ pointMap[i] = -1;
+ }
+
+ output->Allocate(numCells/4); //allocate storage for geometry/topology
+ newPts = vtkPoints::New();
+ newPts->Allocate(numPts/4,numPts);
+ outputPD->CopyAllocate(pd);
+ outputCD->CopyAllocate(cd);
+ vtkFloatArray *newScalars = NULL;
+
+ if(myStoreMapping){
+ myElemVTK2ObjIds.clear();
+ myElemVTK2ObjIds.reserve(numCells);
+ myNodeVTK2ObjIds.clear();
+ myNodeVTK2ObjIds.reserve(numPts);
+ }
+
+ if ( ! this->ExtractBoundaryCells )
+ {
+ for ( ptId=0; ptId < numPts; ptId++ )
+ {
+ x = input->GetPoint(ptId);
+ if ( (this->ImplicitFunction->FunctionValue(x)*multiplier) < 0.0 )
+ {
+ newId = newPts->InsertNextPoint(x);
+ pointMap[ptId] = newId;
+ myNodeVTK2ObjIds.push_back(ptId);
+ outputPD->CopyData(pd,ptId,newId);
+ }
+ }
+ }
+ else
+ {
+ // To extract boundary cells, we have to create supplemental information
+ if ( this->ExtractBoundaryCells )
+ {
+ float val;
+ newScalars = vtkFloatArray::New();
+ newScalars->SetNumberOfValues(numPts);
+
+ for (ptId=0; ptId < numPts; ptId++ )
+ {
+ x = input->GetPoint(ptId);
+ val = this->ImplicitFunction->FunctionValue(x) * multiplier;
+ newScalars->SetValue(ptId, val);
+ if ( val < 0.0 )
+ {
+ newId = newPts->InsertNextPoint(x);
+ pointMap[ptId] = newId;
+ myNodeVTK2ObjIds.push_back(ptId);
+ outputPD->CopyData(pd,ptId,newId);
+ }
+ }
+ }
+ }
+
+ // Now loop over all cells to see whether they are inside implicit
+ // function (or on boundary if ExtractBoundaryCells is on).
+ //
+ for (cellId=0; cellId < numCells; cellId++)
+ {
+ cell = input->GetCell(cellId);
+ cellPts = cell->GetPointIds();
+ numCellPts = cell->GetNumberOfPoints();
+
+ newCellPts->Reset();
+ if ( ! this->ExtractBoundaryCells ) //requires less work
+ {
+ for ( npts=0, i=0; i < numCellPts; i++, npts++)
+ {
+ ptId = cellPts->GetId(i);
+ if ( pointMap[ptId] < 0 )
+ {
+ break; //this cell won't be inserted
+ }
+ else
+ {
+ newCellPts->InsertId(i,pointMap[ptId]);
+ }
+ }
+ } //if don't want to extract boundary cells
+
+ else //want boundary cells
+ {
+ for ( npts=0, i=0; i < numCellPts; i++ )
+ {
+ ptId = cellPts->GetId(i);
+ if ( newScalars->GetValue(ptId) <= 0.0 )
+ {
+ npts++;
+ }
+ }
+ if ( npts > 0 )
+ {
+ for ( i=0; i < numCellPts; i++ )
+ {
+ ptId = cellPts->GetId(i);
+ if ( pointMap[ptId] < 0 )
+ {
+ x = input->GetPoint(ptId);
+ newId = newPts->InsertNextPoint(x);
+ pointMap[ptId] = newId;
+ myNodeVTK2ObjIds.push_back(ptId);
+ outputPD->CopyData(pd,ptId,newId);
+ }
+ newCellPts->InsertId(i,pointMap[ptId]);
+ }
+ }//a boundary or interior cell
+ }//if mapping boundary cells
+
+ if ( npts >= numCellPts || (this->ExtractBoundaryCells && npts > 0) )
+ {
+ newCellId = output->InsertNextCell(cell->GetCellType(),newCellPts);
+ myElemVTK2ObjIds.push_back(cellId);
+ outputCD->CopyData(cd,cellId,newCellId);
+ }
+ }//for all cells
+
+ // Update ourselves and release memory
+ //
+ delete [] pointMap;
+ newCellPts->Delete();
+ output->SetPoints(newPts);
+ newPts->Delete();
+
+ if ( this->ExtractBoundaryCells )
+ {
+ newScalars->Delete();
+ }
+
+ output->Squeeze();
+}
--- /dev/null
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+
+#ifndef SALOME_ExtractGeometry_H
+#define SALOME_ExtractGeometry_H
+
+#include <vtkExtractGeometry.h>
+#include <vtkSmartPointer.h>
+#include <vector>
+
+class vtkImplicitBoolean;
+
+class SALOME_ExtractGeometry : public vtkExtractGeometry{
+public:
+ vtkTypeMacro(SALOME_ExtractGeometry,vtkExtractGeometry);
+
+ static SALOME_ExtractGeometry *New();
+
+ void SetImplicitBoolean(vtkImplicitBoolean* theImplicitBoolean);
+ vtkImplicitBoolean* GetImplicitBoolean() const {
+ return myImplicitBoolean.GetPointer();
+ }
+
+ void SetStoreMapping(bool theStoreMapping);
+ bool GetStoreMapping() const {
+ return myStoreMapping;
+ }
+
+ virtual vtkIdType GetNodeObjId(int theID);
+ virtual vtkIdType GetElemObjId(int theID);
+
+protected:
+ SALOME_ExtractGeometry();
+ ~SALOME_ExtractGeometry();
+
+ virtual void Execute();
+ void Execute2();
+
+private:
+ bool myStoreMapping;
+ typedef std::vector<vtkIdType> TVectorId;
+ TVectorId myElemVTK2ObjIds;
+ TVectorId myNodeVTK2ObjIds;
+
+ vtkSmartPointer<vtkImplicitBoolean> myImplicitBoolean;
+
+ SALOME_ExtractGeometry(const SALOME_ExtractGeometry&); // Not implemented.
+ void operator=(const SALOME_ExtractGeometry&); // Not implemented.
+};
+
+
+#endif
+
+
// VISU OBJECT : interactive object for VISU entities implementation
//
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
//
//
// File: VISU_PipeLine.hxx
#include "VISU_DeformedShapePL.hxx"
#include "VISU_VectorsPL.hxx"
#include "VISU_StreamLinesPL.hxx"
+#include "VISU_Plot3DPL.hxx"
-typedef VISU_ScalarMapPL TPresent;
+typedef VISU_Plot3DPL TPresent;
#include <vtkUnstructuredGrid.h>
#include <vtkDataSetMapper.h>
#include <vtkRenderWindowInteractor.h>
-#include <vtkRenderWindow.h>
+#include <vtkRenderWindow.h>
#include <vtkRenderer.h>
#include <vtkCamera.h>
#include <vtkActor.h>
+#include <vtkProperty.h>
+
#include "utilities.h"
using namespace std;
static int isOnlyMesh = false;
-int main(int argc, char** argv){
+int main(int argc, char** argv){
try{
if(argc > 1){
vtkRenderWindow *renWin = vtkRenderWindow::New();
const VISU::TEntity& anEntity = VISU::CELL_ENTITY;
aMeshOnEntityMapIter = aMeshOnEntityMap.find(anEntity);
vtkUnstructuredGrid* aDataSet = aConvertor->GetMeshOnEntity(aMeshName,anEntity);
-
+
VISU_MeshPL* aPresent = VISU_MeshPL::New();
aPresent->SetInput(aDataSet);
aPresent->Build();
-
+
vtkActor* aActor = vtkActor::New();
aActor->SetMapper(aPresent->GetMapper());
aActor->GetProperty()->SetRepresentation(VTK_WIREFRAME);
//ren->ResetCameraClippingRange();
-
+
ren->AddActor(aActor);
-
+
renWin->Render();
iren->Start();
return 0;
if(aValFieldIter == aValField.end()) return 0;
int aTimeStamp = aValFieldIter->first;
vtkUnstructuredGrid* aDataSet = aConvertor->GetTimeStampOnMesh(aMeshName,anEntity,aFieldName,aTimeStamp);
-
+
TPresent* aPresent = TPresent::New();
aPresent->SetInput(aDataSet);
aPresent->Build();
aPresent->Init();
aPresent->SetSourceRange();
- //aPresent->SetPartDefault(0);
- //aPresent->SetScalarMin(0.01);
+ //aPresent->SetNumberOfContours(50);
+ //aPresent->SetNbParts(1);
+ //aPresent->SetOrientation(VISU_CutPlanesPL::XY,0.0,0.0);
//aPresent->SetScaling(VTK_SCALE_LOG10);
aPresent->Update();
-
+
vtkActor* anActor = vtkActor::New();
anActor->SetMapper(aPresent->GetMapper());
-
+
VISU_ScalarBarActor * aScalarBar = VISU_ScalarBarActor::New();
aScalarBar->SetLookupTable(aPresent->GetBarTable());
ren->AddActor(anActor);
ren->AddActor2D(aScalarBar);
- ren->ResetCameraClippingRange();
-
+
renWin->Render();
+ ren->ResetCamera();
+
iren->Start();
return 0;
}
MESSAGE("Follow exception was occured :\n"<<exc.what());
}catch(...){
MESSAGE("Unknown exception was occured in VISU_Convertor_impl");
- }
+ }
return 1;
}
//
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
//
//
// File: VISU_PipeLine.cxx
SetOrientation(aPipeLine->GetPlaneOrientation(1),
aPipeLine->GetRotateX(1),aPipeLine->GetRotateY(1),1);
SetDisplacement(aPipeLine->GetDisplacement(1),1);
- SetDefault();
+ SetDefault();
if (!aPipeLine->IsDefault()) SetPosition(aPipeLine->GetPosition());
}
}
float aPosition = myPosition;
if(myCondition){
float aDir[3], aBounds[6], aBoundPrj[3];
- myInput->GetBounds(aBounds);
+ GetInput2()->GetBounds(aBounds);
GetDir(aDir,myAng[0],myBasePlane[0]);
GetBoundProject(aBoundPrj,aBounds,aDir);
aPosition = aBoundPrj[0] + aBoundPrj[2]*myDisplacement[0];
vtkAppendPolyData *anAppendPolyData = vtkAppendPolyData::New();
//Build base plane
float aDir[2][3], aBaseBounds[6];
- myInput->GetBounds(aBaseBounds);
+ GetInput2()->GetBounds(aBaseBounds);
GetDir(aDir[0],myAng[0],myBasePlane[0]);
- vtkUnstructuredGrid* anUnstructuredGrid =
+ vtkUnstructuredGrid* anUnstructuredGrid =
myFieldTransform->GetUnstructuredGridOutput();
CutWithPlanes(anAppendPolyData,anUnstructuredGrid,1,aDir[0],aBaseBounds,
myPosition,myCondition,myDisplacement[0]);
anAppendPolyData->Register(myAppendPolyData);
anAppendPolyData->Delete();
//Calculate values for building of table
- vtkMath::Cross(aDir[0],aDir[1],myDirLn);
+ vtkMath::Cross(aDir[0],aDir[1],myDirLn);
GetBoundProject(myBoundPrjLn, aBaseBounds, myDirLn);
VISU::Mul(myDirLn,myBoundPrjLn[0],myBasePnt);
CorrectPnt(myBasePnt,aBaseBounds);
void VISU_CutLinesPL::CutWithPlanes(vtkAppendPolyData* theAppendPolyData, vtkDataSet* theDataSet,
- int theNbPlanes, float theDir[3], float theBounds[6],
+ int theNbPlanes, float theDir[3], float theBounds[6],
float thePartPosition, int thePartCondition,
float theDisplacement)
{
// VISU OBJECT : interactive object for VISU entities implementation
//
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
//
//
// File: VISU_PipeLine.cxx
VISU_CutPlanesPL::VISU_CutPlanesPL(){
myAppendPolyData = vtkAppendPolyData::New();
+ myIsShrinkable = false;
}
VISU_CutPlanesPL::~VISU_CutPlanesPL(){
float aDir[3];
GetDir(aDir,myAng[0],myBasePlane[0]);
float aBounds[6];
- myInput->GetBounds(aBounds);
+ GetInput2()->GetBounds(aBounds);
vtkDataSet* aDataSet = myFieldTransform->GetUnstructuredGridOutput();
CutWithPlanes(myAppendPolyData,aDataSet,myNbParts,aDir,aBounds,
myPartPosition,myPartCondition,myDisplacement[0]);
float* VISU_CutPlanesPL::GetRy(float theRy[3][3], float thaAng){
theRy[0][0] = cos(thaAng); theRy[0][1] = 0.0; theRy[0][2] = sin(thaAng);
- theRy[1][0] = 0.0; theRy[1][1] = 1.0; theRy[1][2] = 0.0;
- theRy[2][0] = -sin(thaAng); theRy[2][1] = 0.0; theRy[2][2] = cos(thaAng);
+ theRy[1][0] = 0.0; theRy[1][1] = 1.0; theRy[1][2] = 0.0;
+ theRy[2][0] = -sin(thaAng); theRy[2][1] = 0.0; theRy[2][2] = cos(thaAng);
return theRy[0];
}
float* VISU_CutPlanesPL::GetRz(float theRz[3][3], float thaAng){
theRz[0][0] = cos(thaAng); theRz[0][1] = -sin(thaAng); theRz[0][2] = 0.0;
- theRz[1][0] = sin(thaAng); theRz[1][1] = cos(thaAng); theRz[1][2] = 0.0;
- theRz[2][0] = 0.0; theRz[2][1] = 0.0; theRz[2][2] = 1.0;
+ theRz[1][0] = sin(thaAng); theRz[1][1] = cos(thaAng); theRz[1][2] = 0.0;
+ theRz[2][0] = 0.0; theRz[2][1] = 0.0; theRz[2][2] = 1.0;
return theRz[0];
}
{BoundBox[0],BoundBox[3],BoundBox[4]},
{BoundBox[1],BoundBox[3],BoundBox[4]},
{BoundBox[0],BoundBox[2],BoundBox[5]},
- {BoundBox[1],BoundBox[2],BoundBox[5]},
- {BoundBox[0],BoundBox[3],BoundBox[5]},
+ {BoundBox[1],BoundBox[2],BoundBox[5]},
+ {BoundBox[0],BoundBox[3],BoundBox[5]},
{BoundBox[1],BoundBox[3],BoundBox[5]}};
BoundPrj[0] = vtkMath::Dot(Dir,BoundPoints[0]), BoundPrj[1] = BoundPrj[0];
for(int i = 1; i < 8; i++){
}
-void VISU_CutPlanesPL::SetOrientation(const VISU_CutPlanesPL::PlaneOrientation& theOrient,
+void VISU_CutPlanesPL::SetOrientation(const VISU_CutPlanesPL::PlaneOrientation& theOrient,
float theXAng, float theYAng, int theNum)
-{
+{
myBasePlane[theNum] = theOrient;
switch(myBasePlane[theNum]){
case XY: myAng[theNum][0] = theXAng; break;
}
-const VISU_CutPlanesPL::PlaneOrientation& VISU_CutPlanesPL::GetPlaneOrientation(int theNum){
+const VISU_CutPlanesPL::PlaneOrientation& VISU_CutPlanesPL::GetPlaneOrientation(int theNum){
return myBasePlane[theNum];
}
}
-void VISU_CutPlanesPL::SetNbParts(int theNb) {
+void VISU_CutPlanesPL::SetNbParts(int theNb) {
myNbParts = theNb;
myPartPosition.resize(myNbParts);
myPartCondition.resize(myNbParts,1);
float aPosition = myPartPosition[thePartNumber];
if(myPartCondition[thePartNumber]){
float aDir[3], aBounds[6], aBoundPrj[3];
- myInput->GetBounds(aBounds);
+ GetInput2()->GetBounds(aBounds);
GetDir(aDir,myAng[theNum],myBasePlane[theNum]);
GetBoundProject(aBoundPrj,aBounds,aDir);
if (myNbParts > 1){
float aStartPosition = aBoundPrj[0] - 0.5*aDBoundPrj + aDisplacement;
aPosition = aStartPosition + thePartNumber*aDBoundPrj;
}else
- aPosition = aBoundPrj[0] + aBoundPrj[2]*myDisplacement[theNum];
+ aPosition = aBoundPrj[0] + aBoundPrj[2]*myDisplacement[theNum];
}
return aPosition;
}
}
-void VISU_CutPlanesPL::GetDir(float theDir[3], float theAng[3], const PlaneOrientation& theBasePlane){
+void VISU_CutPlanesPL::GetDir(float theDir[3],
+ const float theAng[3],
+ const PlaneOrientation& theBasePlane)
+{
int iPlane = 0;
float aRx[3][3], aRy[3][3], aRz[3][3], aRotation[3][3];
switch(theBasePlane){
- case XY:
+ case XY:
if(fabs(theAng[0]) > EPS) GetRx(aRx,theAng[0]); else vtkMath::Identity3x3(aRx);
if(fabs(theAng[1]) > EPS) GetRy(aRy,theAng[1]); else vtkMath::Identity3x3(aRy);
vtkMath::Multiply3x3(aRx,aRy,aRotation);
iPlane = 2;
break;
- case YZ:
+ case YZ:
if(fabs(theAng[1]) > EPS) GetRy(aRy,theAng[1]); else vtkMath::Identity3x3(aRy);
if(fabs(theAng[2]) > EPS) GetRz(aRz,theAng[2]); else vtkMath::Identity3x3(aRz);
vtkMath::Multiply3x3(aRy,aRz,aRotation);
iPlane = 0;
break;
- case ZX:
+ case ZX:
if(fabs(theAng[2]) > EPS) GetRz(aRz,theAng[2]); else vtkMath::Identity3x3(aRz);
if(fabs(theAng[0]) > EPS) GetRx(aRx,theAng[0]); else vtkMath::Identity3x3(aRx);
vtkMath::Multiply3x3(aRz,aRx,aRotation);
iPlane = 1;
break;
}
- for(int i = 0; i < 3; i++)
+ for(int i = 0; i < 3; i++)
theDir[i] = aRotation[i][iPlane];
}
-void VISU_CutPlanesPL::CutWithPlane(vtkAppendPolyData* theAppendPolyData,
+void VISU_CutPlanesPL::CutWithPlane(vtkAppendPolyData* theAppendPolyData,
vtkDataSet* theDataSet,
float theDir[3], float theOrig[3])
{
aCutPlane->SetInput(theDataSet);
vtkPlane *aPlane = vtkPlane::New();
aPlane->SetOrigin(theOrig);
-
+
aPlane->SetNormal(theDir);
aCutPlane->SetCutFunction(aPlane);
aPlane->Delete();
void VISU_CutPlanesPL::CutWithPlanes(vtkAppendPolyData* theAppendPolyData, vtkDataSet* theDataSet,
- int theNbPlanes, float theDir[3], float theBounds[6],
- const vector<float>& thePlanePosition,
+ int theNbPlanes, float theDir[3], float theBounds[6],
+ const vector<float>& thePlanePosition,
const vector<int>& thePlaneCondition,
float theDisplacement)
{
// VISU OBJECT : interactive object for VISU entities implementation
//
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
//
//
// File: VISU_CutPlanesPL.hxx
virtual void ShallowCopy(VISU_PipeLine *thePipeLine);
enum PlaneOrientation {XY, YZ, ZX};
- virtual void SetOrientation(const VISU_CutPlanesPL::PlaneOrientation& theOrient,
+ virtual void SetOrientation(const VISU_CutPlanesPL::PlaneOrientation& theOrient,
float theXAng, float theYAng, int theNum = 0);
virtual const PlaneOrientation& GetPlaneOrientation(int theNum = 0);
virtual float GetRotateX(int theNum = 0);
virtual float GetRotateY(int theNum = 0);
-
+
virtual float GetDisplacement(int theNum = 0) { return myDisplacement[theNum];}
virtual void SetDisplacement(float theDisp, int theNum = 0) { myDisplacement[theNum] = theDisp;}
virtual void SetNbParts(int theNb);
virtual int GetNbParts(){ return myNbParts;}
-
+
public:
virtual void Init();
virtual void Update();
virtual vtkAppendPolyData* GetAppendPolyData() { return myAppendPolyData; }
-
+
public:
static float* GetRx(float theRx[3][3], float thaAng);
static float* GetRy(float theRy[3][3], float thaAng);
static void CorrectPnt(float thePnt[3], const float BoundPrj[6]);
static void GetBoundProject(float BoundPrj[3], const float BoundBox[6], const float Dir[3]);
- static void GetDir(float theDir[3], float theAng[3], const PlaneOrientation& theBasePlane);
+ static void GetDir(float theDir[3],
+ const float theAng[3],
+ const PlaneOrientation& theBasePlane);
static void ClearAppendPolyData(vtkAppendPolyData *theAppendPolyData);
static void CutWithPlane(vtkAppendPolyData* theAppendPolyData, vtkDataSet* theDataSet,
float theDir[3], float theOrig[3]);
static void CutWithPlanes(vtkAppendPolyData* theAppendPolyData, vtkDataSet* theDataSet,
- int theNbPlanes, float theDir[3], float theBounds[6],
- const std::vector<float>& thePlanePosition,
+ int theNbPlanes, float theDir[3], float theBounds[6],
+ const std::vector<float>& thePlanePosition,
const std::vector<int>& thePlaneCondition,
float theDisplacement);
protected:
// VISU OBJECT : interactive object for VISU entities implementation
//
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
//
//
// File: VISU_PipeLine.cxx
#include <vtkWarpVector.h>
-#ifdef _DEBUG_
-static int MYDEBUG = 1;
-#else
-static int MYDEBUG = 0;
-#endif
-
vtkStandardNewMacro(VISU_DeformedShapePL);
VISU_DeformedShapePL::VISU_DeformedShapePL(){
for(int i = 0; i < 6; i += 2){
aVol = fabs(aBounds[i+1] - aBounds[i]);
if(aVol > 0) {
- idim++;
+ idim++;
aVolume *= aVol;
}
}
}
-void VISU_DeformedShapePL::SetScale(float theScale) {
+void VISU_DeformedShapePL::SetScale(float theScale) {
if(myScaleFactor == theScale) return;
myScaleFactor = theScale;
myWarpVector->SetScaleFactor(myScaleFactor);
Modified();
}
-float VISU_DeformedShapePL::GetScale() {
+float VISU_DeformedShapePL::GetScale() {
return myWarpVector->GetScaleFactor();
}
VISU_ScalarMapPL::Init();
float aScalarRange[2];
GetSourceRange(aScalarRange);
- SetScale(GetScaleFactor(myInput)/aScalarRange[1]);
+ SetScale(GetScaleFactor(GetInput2())/aScalarRange[1]);
}
VISU_ScalarMapPL::THook* VISU_DeformedShapePL::DoHook(){
- VISU::CellDataToPoint(myWarpVector,myCellDataToPointData,myInput,myFieldTransform);
+ VISU::CellDataToPoint(myWarpVector,myCellDataToPointData,GetInput2(),myFieldTransform);
return myWarpVector->GetOutput();
}
// VISU OBJECT : interactive object for VISU entities implementation
//
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
//
//
// File : VISU_Extractor.cxx
// Module : VISU
-#include "VISU_Extractor.hxx"
+#include "VISU_Extractor.hxx"
#include "VISU_PipeLineUtils.hxx"
-#include <sstream>
+#include <sstream>
#include <vtkObjectFactory.h>
#include <vtkUnstructuredGrid.h>
using namespace std;
-#ifdef _DEBUG_
-static int MYDEBUG = 0;
-#else
-static int MYDEBUG = 0;
-#endif
-
vtkStandardNewMacro(VISU_Extractor);
template<typename TypeData> void
execute(int theNbComp, int theScalarMode, TypeData* theInputData, TypeData* theOutputData){
vtkDataArray *inVectors = theInputData->GetVectors();
- if ( !inVectors || theNbComp < 1 )
- return;
+ if ( !inVectors || theNbComp < 1 )
+ return;
vtkFloatArray *newScalars = vtkFloatArray::New();
ostringstream aName;
aName<<inVectors->GetName(); aName<<", "; aName<<theScalarMode;
// File : VISU_FieldTransform.cxx
// Module : VISU
-#include "VISU_FieldTransform.hxx"
+#include "VISU_FieldTransform.hxx"
#include "VTKViewer_Transform.h"
#include <vtkObjectFactory.h>
using namespace std;
-#ifdef DEBUG
-static int MYDEBUG = 0;
-#else
-static int MYDEBUG = 0;
-#endif
-
vtkStandardNewMacro(VISU_FieldTransform);
-double VISU_FieldTransform::Ident(double theArg){
+double VISU_FieldTransform::Ident(double theArg){
return theArg;
}
-double VISU_FieldTransform::Log10(double theArg){
+double VISU_FieldTransform::Log10(double theArg){
if(theArg <= 0.0) return -VTK_LARGE_FLOAT;
return log10(theArg);
}
return vtkSource::GetMTime();
}
-void VISU_FieldTransform::SetScalarTransform(TTransformFun theFunction) {
+void VISU_FieldTransform::SetScalarTransform(TTransformFun theFunction) {
myFunction = theFunction;
if(myFunction == NULL) myFunction = &Ident;
Modified();
}
-void VISU_FieldTransform::SetScalarRange(float theScalarRange[2]) {
+void VISU_FieldTransform::SetScalarRange(float theScalarRange[2]) {
myScalarRange[0] = theScalarRange[0];
myScalarRange[1] = theScalarRange[1];
Modified();
template<typename TypeData> void
-ExecVectors(VISU_FieldTransform::TTransformFun theFunction,
+ExecVectors(VISU_FieldTransform::TTransformFun theFunction,
VTKViewer_Transform* theTransform,
- float theScalarRange[2], int theNbComponent,
+ float theScalarRange[2], int theNbComponent,
TypeData* theInputData, TypeData* theOutputData)
{
vtkDataArray *inVectors = theInputData->GetVectors();
- if ( !inVectors || theNbComponent < 1 ) return;
+ if ( !inVectors || theNbComponent < 1 ) return;
vtkFloatArray *newVectors = vtkFloatArray::New();
newVectors->SetNumberOfComponents(3);
newVectors->SetNumberOfTuples(theNbComponent);
int theNbComponent, TypeData* theInputData, TypeData* theOutputData)
{
vtkDataArray *inScalars = theInputData->GetScalars();
- if ( !inScalars || theNbComponent < 1 )
- return;
+ if ( !inScalars || theNbComponent < 1 )
+ return;
vtkFloatArray *newScalars = vtkFloatArray::New();
newScalars->SetNumberOfComponents(1);
newScalars->SetNumberOfTuples(theNbComponent);
// VISU OBJECT : interactive object for VISU entities implementation
//
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
//
//
//
VISU_IsoSurfacesPL::VISU_IsoSurfacesPL(){
myContourFilter = vtkContourFilter::New();
myCellDataToPointData = vtkCellDataToPointData::New();
+ myIsShrinkable = false;
}
VISU_IsoSurfacesPL::~VISU_IsoSurfacesPL(){
}
}
-int VISU_IsoSurfacesPL::GetNbParts() {
+int VISU_IsoSurfacesPL::GetNbParts() {
return myContourFilter->GetNumberOfContours();
}
-void VISU_IsoSurfacesPL::SetNbParts(int theNb) {
+void VISU_IsoSurfacesPL::SetNbParts(int theNb) {
myContourFilter->SetNumberOfContours(theNb);
Modified();
}
VISU_ScalarMapPL::SetScaling(theScaling);
SetRange(myRange);
}
-void VISU_IsoSurfacesPL::SetRange(float theRange[2]){
+void VISU_IsoSurfacesPL::SetRange(float theRange[2]){
if(theRange[0] <= theRange[1]){
myRange[0] = theRange[0]; myRange[1] = theRange[1];
float aRange[2] = {myRange[0], myRange[1]};
float VISU_IsoSurfacesPL::GetMax() {
return myRange[1];
}
-
+
void VISU_IsoSurfacesPL::Init(){
VISU_ScalarMapPL::Init();
void VISU_IsoSurfacesPL::Update(){
- VISU::CellDataToPoint(myContourFilter,myCellDataToPointData,myInput,myFieldTransform);
+ VISU::CellDataToPoint(myContourFilter,myCellDataToPointData,GetInput2(),myFieldTransform);
SetMapScale();
VISU_ScalarMapPL::Update();
// VISU OBJECT : interactive object for VISU entities implementation
//
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
//
//
//
vtkStandardNewMacro(VISU_MeshPL);
-VISU_MeshPL::VISU_MeshPL(){}
+VISU_MeshPL::VISU_MeshPL()
+{
+ myIsShrinkable = true;
+}
-void VISU_MeshPL::Build() {
- myMapper->SetInput(myInput);
+void VISU_MeshPL::Build()
+{
+ myMapper->SetInput(GetInput2());
}
-void VISU_MeshPL::Init(){
+void VISU_MeshPL::Init()
+{
}
// VISU OBJECT : interactive object for VISU entities implementation
//
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
//
//
//
#include "VISU_PipeLine.hxx"
#include "VISU_PipeLineUtils.hxx"
-#include <limits.h>
+#include "SALOME_ExtractGeometry.h"
+
+#include <float.h>
#include <vtkObjectFactory.h>
#include <vtkDataSetMapper.h>
#include <vtkUnstructuredGrid.h>
+#include <vtkPlane.h>
+#include <vtkExtractGeometry.h>
+#include <vtkImplicitBoolean.h>
+#include <vtkImplicitFunctionCollection.h>
+#include <vtkMath.h>
+
static int MYVTKDEBUG = 0;
#ifdef _DEBUG_
static int MYDEBUG = 0;
-static int MYDEBUGWITHFILES = 0;
#else
static int MYDEBUG = 0;
-static int MYDEBUGWITHFILES = 0;
#endif
-VISU_PipeLine::VISU_PipeLine(){
+VISU_PipeLine::VISU_PipeLine()
+{
+ if(MYDEBUG) MESSAGE("VISU_PipeLine - "<<this);
+ // Clipping planes
+ myExtractGeometry = SALOME_ExtractGeometry::New();
+ //myExtractGeometry->SetReleaseDataFlag(true);
+ myExtractGeometry->Delete();
+ //myExtractGeometry->DebugOn();
+
+ vtkImplicitBoolean* anImplicitBoolean = vtkImplicitBoolean::New();
+ myExtractGeometry->SetImplicitBoolean(anImplicitBoolean);
+ anImplicitBoolean->SetOperationTypeToIntersection();
+ anImplicitBoolean->Delete();
+
+ // Mapper
myMapper = TMapper::New();
myInput = NULL;
+
+ myIsShrinkable = false;
+
SetDebug(MYVTKDEBUG);
}
-VISU_PipeLine::~VISU_PipeLine(){
- if(MYDEBUG) MESSAGE("~VISU_PipeLine - myInput = "<<myInput->GetReferenceCount());
- SetInput(NULL);
- myMapper->RemoveAllInputs();
+VISU_PipeLine::~VISU_PipeLine()
+{
+ if(MYDEBUG) MESSAGE("~VISU_PipeLine - "<<this);
myMapper->Delete();
}
void VISU_PipeLine::ShallowCopy(VISU_PipeLine *thePipeLine){
SetInput(thePipeLine->GetInput());
myMapper->ShallowCopy(thePipeLine->GetMapper());
+ myExtractGeometry->SetImplicitBoolean(thePipeLine->myExtractGeometry->GetImplicitBoolean());
Build();
}
-void VISU_PipeLine::SetInput(TInput* theInput){
- if(myInput != theInput){
- if (myInput != NULL) myInput->UnRegister(this);
- myInput = theInput;
- if(myInput != NULL){
- myInput->Register(this);
- myInput->Update();
- }else
- myMapper->SetInput(NULL);
- Modified();
- }
+void VISU_PipeLine::SameAs(VISU_PipeLine *thePipeLine){
+ ShallowCopy(thePipeLine);
+ myExtractGeometry->SetImplicitBoolean(vtkImplicitBoolean::New());
+ myExtractGeometry->GetImplicitBoolean()->Delete();
+}
+
+TInput* VISU_PipeLine::GetInput() const
+{
+ return myInput;
+}
+
+TInput* VISU_PipeLine::GetInput2() const
+{
+ vtkUnstructuredGrid* aDataSet = myExtractGeometry->GetOutput();
+ aDataSet->Update();
+ return aDataSet;
+}
+
+void VISU_PipeLine::SetInput(TInput* theInput)
+{
+ myExtractGeometry->SetInput(theInput);
+ if((myInput = theInput))
+ myInput->Update();
+
+ Modified();
}
-VISU_PipeLine::TMapper* VISU_PipeLine::GetMapper() {
- if(myInput){
+VISU_PipeLine::TMapper* VISU_PipeLine::GetMapper()
+{
+ if(GetInput()){
if(!myMapper->GetInput()){
- myInput->Update();
+ GetInput2()->Update();
Build();
}
myMapper->Update();
return myMapper;
}
-void VISU_PipeLine::Update(){
+void VISU_PipeLine::Update()
+{
myMapper->Update();
}
-int VISU_PipeLine::CheckAvailableMemory(const float& theSize){
+int VISU_PipeLine::CheckAvailableMemory(const float& theSize)
+{
try{
if(theSize > ULONG_MAX) return 0;
size_t aSize = size_t(theSize);
return aCheck != NULL;
//return theSize < 1000*1024*1024;
}catch(std::bad_alloc& exc){
- if(MYDEBUG)
+ if(MYDEBUG)
MESSAGE("CheckAvailableMemory("<<theSize<<") " << exc.what());
} catch(...) {
- if(MYDEBUG)
+ if(MYDEBUG)
MESSAGE("CheckAvailableMemory("<<theSize<<") - unexpected exception was caught!!!");
}
return 0;
}
-
-float VISU_PipeLine::GetAvailableMemory(float theSize, float theMinSize){
+float VISU_PipeLine::GetAvailableMemory(float theSize, float theMinSize)
+{
while(!CheckAvailableMemory(theSize))
if(theSize > theMinSize)
theSize /= 2;
return 0;
return theSize;
}
+
+//------------------------ Clipping planes -----------------------------------
+
+void VISU_PipeLine::AddClippingPlane(vtkPlane* thePlane)
+{
+ if(thePlane){
+ if(vtkImplicitBoolean* aBoolean = myExtractGeometry->GetImplicitBoolean()){
+ vtkImplicitFunctionCollection* aFunction = aBoolean->GetFunction();
+ aFunction->AddItem(thePlane);
+ }
+ }
+}
+
+vtkPlane* VISU_PipeLine::GetClippingPlane(vtkIdType theID) const
+{
+ vtkPlane* aPlane = NULL;
+ if(theID >= 0 && theID < GetNumberOfClippingPlanes()){
+ if(vtkImplicitBoolean* aBoolean = myExtractGeometry->GetImplicitBoolean()){
+ vtkImplicitFunctionCollection* aFunction = aBoolean->GetFunction();
+ vtkImplicitFunction* aFun = NULL;
+ aFunction->InitTraversal();
+ for(vtkIdType anID = 0; anID <= theID; anID++)
+ aFun = aFunction->GetNextItem();
+ aPlane = dynamic_cast<vtkPlane*>(aFun);
+ }
+ }
+ return aPlane;
+}
+
+void VISU_PipeLine::RemoveAllClippingPlanes()
+{
+ if(vtkImplicitBoolean* aBoolean = myExtractGeometry->GetImplicitBoolean()){
+ vtkImplicitFunctionCollection* aFunction = aBoolean->GetFunction();
+ aFunction->RemoveAllItems();
+ aBoolean->Modified(); // VTK bug
+ }
+}
+
+vtkIdType VISU_PipeLine::GetNumberOfClippingPlanes() const
+{
+ if(vtkImplicitBoolean* aBoolean = myExtractGeometry->GetImplicitBoolean()){
+ vtkImplicitFunctionCollection* aFunction = aBoolean->GetFunction();
+ return aFunction->GetNumberOfItems();
+ }
+ return 0;
+}
+
+static void ComputeBoundsParam (vtkDataSet* theDataSet,
+ float theDirection[3], float theMinPnt[3],
+ float& theMaxBoundPrj, float& theMinBoundPrj)
+{
+ float aBounds[6];
+ theDataSet->GetBounds(aBounds);
+
+ //Enlarge bounds in order to avoid conflicts of precision
+ for(int i = 0; i < 6; i += 2){
+ static double EPS = 1.0E-3;
+ float aDelta = (aBounds[i+1] - aBounds[i])*EPS;
+ aBounds[i] -= aDelta;
+ aBounds[i+1] += aDelta;
+ }
+
+ float aBoundPoints[8][3] = { {aBounds[0],aBounds[2],aBounds[4]},
+ {aBounds[1],aBounds[2],aBounds[4]},
+ {aBounds[0],aBounds[3],aBounds[4]},
+ {aBounds[1],aBounds[3],aBounds[4]},
+ {aBounds[0],aBounds[2],aBounds[5]},
+ {aBounds[1],aBounds[2],aBounds[5]},
+ {aBounds[0],aBounds[3],aBounds[5]},
+ {aBounds[1],aBounds[3],aBounds[5]}};
+
+ int aMaxId = 0, aMinId = aMaxId;
+ theMaxBoundPrj = vtkMath::Dot(theDirection,aBoundPoints[aMaxId]);
+ theMinBoundPrj = theMaxBoundPrj;
+ for(int i = 1; i < 8; i++){
+ float aTmp = vtkMath::Dot(theDirection,aBoundPoints[i]);
+ if(theMaxBoundPrj < aTmp){
+ theMaxBoundPrj = aTmp;
+ aMaxId = i;
+ }
+ if(theMinBoundPrj > aTmp){
+ theMinBoundPrj = aTmp;
+ aMinId = i;
+ }
+ }
+ float *aMinPnt = aBoundPoints[aMaxId];
+ theMinPnt[0] = aMinPnt[0];
+ theMinPnt[1] = aMinPnt[1];
+ theMinPnt[2] = aMinPnt[2];
+}
+
+static void DistanceToPosition (vtkDataSet* theDataSet,
+ float theDirection[3], float theDist, float thePos[3])
+{
+ float aMaxBoundPrj, aMinBoundPrj, aMinPnt[3];
+ ComputeBoundsParam(theDataSet,theDirection,aMinPnt,aMaxBoundPrj,aMinBoundPrj);
+ float aLength = (aMaxBoundPrj-aMinBoundPrj)*theDist;
+ thePos[0] = aMinPnt[0]-theDirection[0]*aLength;
+ thePos[1] = aMinPnt[1]-theDirection[1]*aLength;
+ thePos[2] = aMinPnt[2]-theDirection[2]*aLength;
+}
+
+static void PositionToDistance (vtkDataSet* theDataSet,
+ float theDirection[3], float thePos[3], float& theDist)
+{
+ float aMaxBoundPrj, aMinBoundPrj, aMinPnt[3];
+ ComputeBoundsParam(theDataSet,theDirection,aMinPnt,aMaxBoundPrj,aMinBoundPrj);
+ float aPrj = vtkMath::Dot(theDirection,thePos);
+ theDist = (aPrj-aMinBoundPrj)/(aMaxBoundPrj-aMinBoundPrj);
+}
+
+void VISU_PipeLine::SetPlaneParam (float theDir[3], float theDist, vtkPlane* thePlane)
+{
+ thePlane->SetNormal(theDir);
+ float anOrigin[3];
+ ::DistanceToPosition(GetInput(),theDir,theDist,anOrigin);
+ thePlane->SetOrigin(anOrigin);
+}
+
+void VISU_PipeLine::GetPlaneParam (float theDir[3], float& theDist, vtkPlane* thePlane)
+{
+ thePlane->GetNormal(theDir);
+
+ float anOrigin[3];
+ thePlane->GetOrigin(anOrigin);
+ ::PositionToDistance(GetInput(),theDir,anOrigin,theDist);
+}
+
+//=======================================================================
+//function : IsPlanarInput
+//purpose :
+//=======================================================================
+bool VISU_PipeLine::IsPlanarInput() const
+{
+ float aBounds[6];
+ GetInput()->GetBounds( aBounds ); // xmin,xmax, ymin,ymax, zmin,zmax
+ if (fabs( aBounds[0] - aBounds[1] ) <= FLT_MIN ||
+ fabs( aBounds[2] - aBounds[3] ) <= FLT_MIN ||
+ fabs( aBounds[4] - aBounds[5] ) <= FLT_MIN )
+ return true;
+
+ return false;
+}
// VISU OBJECT : interactive object for VISU entities implementation
//
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
//
//
// File: VISU_PipeLine.hxx
#ifndef VISU_PipeLine_HeaderFile
#define VISU_PipeLine_HeaderFile
-#include <string>
-#include <algorithm>
#include <vtkObject.h>
-#include <vtkProperty.h>
+#include <vtkSmartPointer.h>
+
+#include <vector>
+
+template <class T>
+class TVTKSmartPtr: public vtkSmartPointer<T>
+{
+public:
+ TVTKSmartPtr() {}
+ TVTKSmartPtr(T* r, bool theIsOwner = false): vtkSmartPointer<T>(r) {
+ if(r && theIsOwner)
+ r->Delete();
+ }
+ TVTKSmartPtr& operator()(T* r, bool theIsOwner = false){
+ vtkSmartPointer<T>::operator=(r);
+ if(r && theIsOwner)
+ r->Delete();
+ return *this;
+ }
+ TVTKSmartPtr& operator=(T* r){
+ vtkSmartPointer<T>::operator=(r);
+ return *this;
+ }
+ operator T* () const {
+ return vtkSmartPointer<T>::GetPointer();
+ }
+};
class vtkDataSetMapper;
class vtkUnstructuredGrid;
+class vtkExtractGeometry;
+class vtkImplicitBoolean;
+class vtkPlane;
+
+class SALOME_ExtractGeometry;
+
+typedef vtkUnstructuredGrid TInput;
class VISU_PipeLine : public vtkObject{
-protected:
- VISU_PipeLine();
- VISU_PipeLine(const VISU_PipeLine&);
public:
vtkTypeMacro(VISU_PipeLine,vtkObject);
virtual ~VISU_PipeLine();
+
virtual void ShallowCopy(VISU_PipeLine *thePipeLine);
+ virtual void SameAs(VISU_PipeLine *thePipeLine);
-public:
- typedef vtkUnstructuredGrid TInput;
+public:
virtual void SetInput(TInput* theInput);
- virtual TInput* GetInput() { return myInput;}
+ virtual TInput* GetInput() const;
+
+ bool IsPlanarInput() const;
typedef vtkDataSetMapper TMapper;
virtual TMapper* GetMapper();
static int CheckAvailableMemory(const float& theSize);
static float GetAvailableMemory(float theSize = 16*1024*1024.0,
float theMinSize = 1024*1024.0);
+
+ // Clipping planes
+ void RemoveAllClippingPlanes();
+ vtkIdType GetNumberOfClippingPlanes() const;
+ void AddClippingPlane(vtkPlane* thePlane);
+ vtkPlane* GetClippingPlane(vtkIdType theID) const;
+
+ void SetPlaneParam(float theDir[3], float theDist, vtkPlane* thePlane);
+ void GetPlaneParam(float theDir[3], float& theDist, vtkPlane* thePlane);
+
+ bool IsShrinkable() { return myIsShrinkable; }
+
protected:
+ VISU_PipeLine();
+ VISU_PipeLine(const VISU_PipeLine&);
+
+ virtual TInput* GetInput2() const;
virtual void Build() = 0;
-
- TInput *myInput;
+
+ bool myIsShrinkable;
+
+ TInput *myInput;
TMapper *myMapper;
+
+ // Clipping planes
+ TVTKSmartPtr<SALOME_ExtractGeometry> myExtractGeometry;
};
#endif
--- /dev/null
+// VISU OBJECT : interactive object for VISU entities implementation
+//
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+// File: VISU_PipeLine.cxx
+// Author: Alexey PETROV
+// Module : VISU
+
+
+#include "VISU_Plot3DPL.hxx"
+#include "VISU_CutPlanesPL.hxx"
+#include "VISU_PipeLineUtils.hxx"
+
+#include <vtkAppendPolyData.h>
+#include <vtkCutter.h>
+#include <vtkPlane.h>
+
+#include <vtkCellDataToPointData.h>
+#include <vtkGeometryFilter.h>
+#include <vtkContourFilter.h>
+#include <vtkWarpScalar.h>
+#include <vtkOutlineFilter.h>
+
+using namespace std;
+
+vtkStandardNewMacro(VISU_Plot3DPL);
+
+VISU_Plot3DPL::VISU_Plot3DPL():
+ myCellDataToPointData(vtkCellDataToPointData::New(),true),
+ myAppendPolyData(vtkAppendPolyData::New(),true),
+ myGeometryFilter(vtkGeometryFilter::New(),true),
+ myContourFilter(vtkContourFilter::New(),true),
+ myWarpScalar(vtkWarpScalar::New(),true),
+ myOrientation(VISU_CutPlanesPL::YZ),
+ myIsRelative(true),
+ myIsContour(false),
+ myPosition(0.5),
+ myScaleFactor(1.)
+{
+ myAngle[0] = myAngle[1] = myAngle[2] = 0.;
+ SetNumberOfContours(32);
+ myIsShrinkable = false;
+}
+
+VISU_Plot3DPL::~VISU_Plot3DPL()
+{
+}
+
+void
+VISU_Plot3DPL::
+ShallowCopy(VISU_PipeLine *thePipeLine)
+{
+ VISU_ScalarMapPL::ShallowCopy(thePipeLine);
+ if(VISU_Plot3DPL *aPipeLine = dynamic_cast<VISU_Plot3DPL*>(thePipeLine)){
+ SetOrientation (aPipeLine->GetPlaneOrientation(),
+ aPipeLine->GetRotateX(), aPipeLine->GetRotateY());
+ SetPlanePosition (aPipeLine->GetPlanePosition(),
+ aPipeLine->IsPositionRelative() );
+ SetScaleFactor( aPipeLine->GetScaleFactor() );
+ SetContourPrs( aPipeLine->GetIsContourPrs() );
+ SetNumberOfContours( aPipeLine->GetNumberOfContours() );
+ }
+}
+
+VISU_CutPlanesPL::PlaneOrientation
+VISU_Plot3DPL::
+GetOrientation(vtkDataSet* theDataSet)
+{
+ theDataSet->Update();
+
+ float aBounds[6];
+ theDataSet->GetBounds(aBounds);
+ float aDelta[3] = {aBounds[1] - aBounds[0], aBounds[3] - aBounds[2], aBounds[5] - aBounds[4]};
+
+ if(aDelta[0] >= aDelta[1] && aDelta[0] >= aDelta[2])
+ if(aDelta[1] >= aDelta[2])
+ return VISU_CutPlanesPL::XY;
+ else
+ return VISU_CutPlanesPL::ZX;
+
+ if(aDelta[1] >= aDelta[0] && aDelta[1] >= aDelta[2])
+ if(aDelta[0] >= aDelta[2])
+ return VISU_CutPlanesPL::XY;
+ else
+ return VISU_CutPlanesPL::YZ;
+
+ if(aDelta[2] >= aDelta[0] && aDelta[2] >= aDelta[1])
+ if(aDelta[0] >= aDelta[1])
+ return VISU_CutPlanesPL::ZX;
+ else
+ return VISU_CutPlanesPL::YZ;
+
+ return VISU_CutPlanesPL::XY;
+}
+
+float
+VISU_Plot3DPL::
+GetScaleFactor(vtkDataSet* theDataSet)
+{
+ theDataSet->Update();
+ float aLength = theDataSet->GetLength(); // diagonal length
+
+ float aScalarRange[2];
+ GetSourceRange(aScalarRange);
+
+ static float EPS = 0.3;
+ float aRange = aScalarRange[1];
+ if(aRange > 0.0)
+ return aLength / aRange * EPS;
+
+ return 0.0;
+}
+
+void
+VISU_Plot3DPL::
+Init()
+{
+ VISU_ScalarMapPL::Init();
+
+ myOrientation = GetOrientation(GetInput2());
+ SetScaleFactor(GetScaleFactor(GetInput2()));
+}
+
+VISU_ScalarMapPL::THook*
+VISU_Plot3DPL::
+DoHook()
+{
+ return myAppendPolyData->GetOutput();
+}
+
+void
+VISU_Plot3DPL::
+Update()
+{
+ float aPlaneNormal[3];
+ float anOrigin[3];
+ GetBasePlane( anOrigin, aPlaneNormal );
+
+ vtkPolyData* aPolyData = 0;
+ vtkCutter *aCutPlane = 0;
+ vtkUnstructuredGrid* anUnstructuredGrid =
+ myFieldTransform->GetUnstructuredGridOutput();
+
+ if ( !IsPlanarInput() )
+ {
+ aCutPlane = vtkCutter::New();
+ aCutPlane->SetInput(anUnstructuredGrid);
+
+ vtkPlane *aPlane = vtkPlane::New();
+ aPlane->SetOrigin(anOrigin);
+ aPlane->SetNormal(aPlaneNormal);
+
+ aCutPlane->SetCutFunction(aPlane);
+ aPlane->Delete();
+
+ aPolyData = aCutPlane->GetOutput();
+ aPolyData->Update();
+ }
+
+ if ( !aPolyData || aPolyData->GetNumberOfCells() == 0 ) {
+ myGeometryFilter->SetInput(anUnstructuredGrid);
+ aPolyData = myGeometryFilter->GetOutput();
+ aPolyData->Update();
+ }
+ if ( !myIsContour ) // surface prs
+ {
+ if(aPolyData->GetCellData()->GetNumberOfArrays()) {
+ myCellDataToPointData->SetInput(aPolyData);
+ myCellDataToPointData->PassCellDataOn();
+ myWarpScalar->SetInput(myCellDataToPointData->GetPolyDataOutput());
+ }else
+ myWarpScalar->SetInput(aPolyData);
+ }
+ else // contour prs
+ {
+ if(aPolyData->GetCellData()->GetNumberOfArrays()) {
+ myCellDataToPointData->SetInput(aPolyData);
+ myCellDataToPointData->PassCellDataOn();
+ myContourFilter->SetInput(myCellDataToPointData->GetOutput());
+ }else
+ myContourFilter->SetInput(aPolyData);
+
+ float aScalarRange[2];
+ GetSourceRange(aScalarRange);
+
+ myContourFilter->GenerateValues(GetNumberOfContours(),aScalarRange);
+ myWarpScalar->SetInput(myContourFilter->GetOutput());
+ }
+
+ VISU_CutPlanesPL::ClearAppendPolyData(myAppendPolyData);
+ myAppendPolyData->AddInput(myWarpScalar->GetPolyDataOutput());
+
+ if ( aCutPlane )
+ aCutPlane->Delete();
+
+ myWarpScalar->SetNormal(aPlaneNormal);
+
+ VISU_ScalarMapPL::Update();
+}
+
+void
+VISU_Plot3DPL::
+SetNumberOfContours(int theNumber)
+{
+ myContourFilter->SetNumberOfContours(theNumber);
+}
+
+int
+VISU_Plot3DPL::
+GetNumberOfContours() const
+{
+ return myContourFilter->GetNumberOfContours();
+}
+
+void
+VISU_Plot3DPL::
+SetScaleFactor(float theScaleFactor)
+{
+ myScaleFactor = theScaleFactor;
+ myWarpScalar->SetScaleFactor(theScaleFactor);
+}
+
+float
+VISU_Plot3DPL::
+GetScaleFactor() const
+{
+ return myScaleFactor;
+}
+
+void
+VISU_Plot3DPL::
+SetPlanePosition(float thePosition,
+ bool theIsRelative)
+{
+ myIsRelative = theIsRelative;
+ myPosition = thePosition;
+}
+
+bool
+VISU_Plot3DPL::
+IsPositionRelative() const
+{
+ return myIsRelative;
+}
+
+VISU_CutPlanesPL::PlaneOrientation
+VISU_Plot3DPL::
+GetPlaneOrientation() const
+{
+ return myOrientation;
+}
+
+
+float
+VISU_Plot3DPL::
+GetRotateX()
+{
+ switch(myOrientation){
+ case VISU_CutPlanesPL::XY: return myAngle[0];
+ case VISU_CutPlanesPL::YZ: return myAngle[1];
+ case VISU_CutPlanesPL::ZX: return myAngle[2];
+ }
+ return 0;
+}
+
+float
+VISU_Plot3DPL::
+GetRotateY(){
+ switch(myOrientation){
+ case VISU_CutPlanesPL::XY: return myAngle[1];
+ case VISU_CutPlanesPL::YZ: return myAngle[2];
+ case VISU_CutPlanesPL::ZX: return myAngle[0];
+ }
+ return 0;
+}
+
+void
+VISU_Plot3DPL::
+SetOrientation(VISU_CutPlanesPL::PlaneOrientation theOrientation,
+ float theXAngle,
+ float theYAngle)
+{
+ switch(theOrientation){
+ case VISU_CutPlanesPL::XY: myAngle[0] = theXAngle; break;
+ case VISU_CutPlanesPL::YZ: myAngle[1] = theXAngle; break;
+ case VISU_CutPlanesPL::ZX: myAngle[2] = theXAngle; break;
+ }
+ switch(theOrientation){
+ case VISU_CutPlanesPL::XY: myAngle[1] = theYAngle; break;
+ case VISU_CutPlanesPL::YZ: myAngle[2] = theYAngle; break;
+ case VISU_CutPlanesPL::ZX: myAngle[0] = theYAngle; break;
+ }
+ myOrientation = theOrientation;
+}
+
+float
+VISU_Plot3DPL::
+GetPlanePosition() const
+{
+ return myPosition;
+}
+
+//=======================================================================
+//function : GetBasePlane
+//purpose :
+//=======================================================================
+
+void VISU_Plot3DPL::GetBasePlane(float theOrigin[3],
+ float theNormal[3],
+ bool theCenterOrigine ) const
+{
+ VISU_CutPlanesPL::GetDir(theNormal,myAngle,myOrientation);
+
+ float aPosition = myPosition;
+ float aBounds[6], aBoundPrj[3];
+ if ( myIsRelative )
+ {
+ GetInput()->GetBounds(aBounds);
+ VISU_CutPlanesPL::GetBoundProject(aBoundPrj,aBounds,theNormal);
+ aPosition = aBoundPrj[0] + aBoundPrj[2]*myPosition;
+ }
+ VISU::Mul(theNormal,aPosition,theOrigin);
+
+ if ( theCenterOrigine ) {
+ // move theOrigin to the center of aBounds projections to the plane
+ GetInput2()->GetBounds(aBounds);
+ float boundPoints[8][3] = {
+ {aBounds[0],aBounds[2],aBounds[4]},
+ {aBounds[1],aBounds[2],aBounds[4]},
+ {aBounds[0],aBounds[3],aBounds[4]},
+ {aBounds[1],aBounds[3],aBounds[4]},
+ {aBounds[0],aBounds[2],aBounds[5]},
+ {aBounds[1],aBounds[2],aBounds[5]},
+ {aBounds[0],aBounds[3],aBounds[5]},
+ {aBounds[1],aBounds[3],aBounds[5]}};
+ float newOrigin[3] = { 0,0,0 };
+ for(int i = 0; i < 8; i++) {
+ float proj[3];
+ vtkPlane::ProjectPoint( boundPoints[i], theOrigin, theNormal, proj );
+ newOrigin[0] += proj[0];
+ newOrigin[1] += proj[1];
+ newOrigin[2] += proj[2];
+ }
+ theOrigin[0] = newOrigin[0] / 8.;
+ theOrigin[1] = newOrigin[1] / 8.;
+ theOrigin[2] = newOrigin[2] / 8.;
+ }
+}
+
+//=======================================================================
+//function : GetMinMaxPosition
+//purpose : return absolute position range
+//=======================================================================
+
+void VISU_Plot3DPL::GetMinMaxPosition( float& minPos, float& maxPos ) const
+{
+ float aBounds[6], aBoundPrj[3], aNormal[3];
+ VISU_CutPlanesPL::GetDir(aNormal,myAngle,myOrientation);
+ GetInput()->GetBounds(aBounds);
+ VISU_CutPlanesPL::GetBoundProject(aBoundPrj,aBounds,aNormal);
+ minPos = aBoundPrj[0];
+ maxPos = aBoundPrj[1];
+}
+
+//=======================================================================
+//function : SetMapScale
+//purpose :
+//=======================================================================
+
+void VISU_Plot3DPL::SetMapScale(float theMapScale)
+{
+ VISU_ScalarMapPL::SetMapScale(theMapScale);
+
+ if ( myIsContour ) {
+ float aRange[2];
+ GetSourceRange(aRange);
+ float aNewRange[] = { aRange[1] - theMapScale*(aRange[1]-aRange[0]), aRange[1] };
+ myContourFilter->GenerateValues(GetNumberOfContours(),aNewRange);
+ }
+ myWarpScalar->SetScaleFactor(myScaleFactor*theMapScale);
+
+ Modified();
+}
--- /dev/null
+// VISU OBJECT : interactive object for VISU entities implementation
+//
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+// File: VISU_CutPlanesPL.hxx
+// Author: Alexey PETROV
+// Module : VISU
+
+#ifndef VISU_Plot3DPL_HeaderFile
+#define VISU_Plot3DPL_HeaderFile
+
+#include "VISU_ScalarMapPL.hxx"
+#include "VISU_CutPlanesPL.hxx"
+
+class vtkWarpScalar;
+class vtkContourFilter;
+class vtkGeometryFilter;
+class vtkCellDataToPointData;
+
+class VISU_Plot3DPL : public VISU_ScalarMapPL{
+protected:
+ VISU_Plot3DPL();
+ VISU_Plot3DPL(const VISU_Plot3DPL&);
+
+public:
+ vtkTypeMacro(VISU_Plot3DPL,VISU_ScalarMapPL);
+ static VISU_Plot3DPL* New();
+ virtual ~VISU_Plot3DPL();
+
+ virtual
+ void
+ ShallowCopy(VISU_PipeLine *thePipeLine);
+
+ VISU_CutPlanesPL::PlaneOrientation
+ GetPlaneOrientation() const;
+
+ float
+ GetRotateX();
+
+ float
+ GetRotateY();
+
+ void
+ SetOrientation(VISU_CutPlanesPL::PlaneOrientation theOrientation,
+ float theXAngle = 0.0,
+ float theYAngle = 0.0);
+
+ float
+ GetPlanePosition() const;
+
+ bool
+ IsPositionRelative() const;
+
+ void
+ SetPlanePosition(float thePosition,
+ bool theIsRelative);
+
+ void
+ SetScaleFactor(float theScaleFactor);
+
+ float
+ GetScaleFactor() const;
+
+ void
+ SetContourPrs (bool theIsContourPrs ) { myIsContour = theIsContourPrs; }
+
+ bool
+ GetIsContourPrs() { return myIsContour; }
+
+ void
+ SetNumberOfContours(int theNumber);
+
+ int
+ GetNumberOfContours() const;
+
+ void GetBasePlane (float theOrigin[3],
+ float theNormal[3],
+ bool theCenterOrigine = false ) const;
+
+ void GetMinMaxPosition( float& minPos, float& maxPos ) const;
+
+public:
+ virtual void Init();
+ virtual void Update();
+
+ static
+ VISU_CutPlanesPL::PlaneOrientation
+ GetOrientation(vtkDataSet* theDataSet);
+
+ float
+ GetScaleFactor(vtkDataSet* theDataSet);
+
+ void SetMapScale(float theMapScale);
+
+protected:
+ virtual THook* DoHook();
+
+ float myAngle[3];
+ bool myIsRelative, myIsContour;
+ float myPosition, myScaleFactor;
+ VISU_CutPlanesPL::PlaneOrientation myOrientation;
+
+ TVTKSmartPtr<vtkCellDataToPointData> myCellDataToPointData;
+ TVTKSmartPtr<vtkAppendPolyData> myAppendPolyData;
+ TVTKSmartPtr<vtkGeometryFilter> myGeometryFilter;
+ TVTKSmartPtr<vtkContourFilter> myContourFilter;
+ TVTKSmartPtr<vtkWarpScalar> myWarpScalar;
+};
+
+#endif
// VISU OBJECT : interactive object for VISU entities implementation
//
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
//
//
//
#include "VISU_ScalarMapPL.hxx"
#include "VISU_PipeLineUtils.hxx"
-#ifdef _DEBUG_
-static int MYDEBUG = 1;
-#else
-static int MYDEBUG = 0;
-#endif
-
vtkStandardNewMacro(VISU_ScalarMapPL);
myExtractor = VISU_Extractor::New();
//myExtractor->DebugOn();
+ myIsShrinkable = true;
}
}
-int VISU_ScalarMapPL::GetScaling() {
+int VISU_ScalarMapPL::GetScaling() {
return myBarTable->GetScale();
}
void VISU_ScalarMapPL::SetScaling(int theScaling) {
}
-float* VISU_ScalarMapPL::GetScalarRange() {
+float* VISU_ScalarMapPL::GetScalarRange() {
return myFieldTransform->GetScalarRange();
-}
+}
void VISU_ScalarMapPL::SetScalarRange(float theRange[2]){
myFieldTransform->SetScalarRange(theRange);
myBarTable->SetRange(theRange);
}
-void VISU_ScalarMapPL::SetNbColors(int theNbColors) {
+void VISU_ScalarMapPL::SetNbColors(int theNbColors) {
myMapperTable->SetNumberOfColors(theNbColors);
myBarTable->SetNumberOfColors(theNbColors);
Modified();
}
-int VISU_ScalarMapPL::GetNbColors() {
+int VISU_ScalarMapPL::GetNbColors() {
return myMapperTable->GetNumberOfColors();
}
}
-void VISU_ScalarMapPL::Build() {
- myExtractor->SetInput(myInput);
+void VISU_ScalarMapPL::Build() {
+ myExtractor->SetInput(GetInput2());
myFieldTransform->SetInput(myExtractor->GetOutput());
myMapper->SetInput(DoHook());
}
myMapperTable->Build();
myBarTable->Build();
- myMapper->SetLookupTable(myMapperTable);
+ myMapper->SetLookupTable(myMapperTable);
myMapper->SetScalarRange(aScalarRange);
VISU_PipeLine::Update();
// VISU OBJECT : interactive object for VISU entities implementation
//
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
//
//
// File: VISU_PipeLine.cxx
static float EPS = 1.0e-7;
static float aMinNbOfSteps = 1.0E+2;
-static float aMaxNbOfSteps = 1.0E+3;
+//static float aMaxNbOfSteps = 1.0E+3;
static float aCoeffOfIntStep = 1.0E+1;
}
-float VISU_StreamLinesPL::GetNecasseryMemorySize(vtkIdType theNbOfPoints, float theStepLength,
+float VISU_StreamLinesPL::GetNecasseryMemorySize(vtkIdType theNbOfPoints, float theStepLength,
float thePropogationTime, float thePercents)
{
static float aStreamPointSize = sizeof(float)*15 + sizeof(vtkIdType)*2;
float aConnectivitySize = aCellsSize*sizeof(vtkIdType);
float aTypesSize = aNbCells*sizeof(char);
float aLocationsSize = aNbCells*sizeof(int);
- float aNbCellsPerPoint = aCellsSize / aNbCells - 1;
+ //float aNbCellsPerPoint = aCellsSize / aNbCells - 1;
float aMeshSize = aPointsSize + aConnectivitySize + aTypesSize + aLocationsSize;
float anAssignedDataSize = aCellsSize*4.0*sizeof(float);
return aResult;
}
-int VISU_StreamLinesPL::FindPossibleParams(vtkPointSet* theDataSet, float& theStepLength,
+int VISU_StreamLinesPL::FindPossibleParams(vtkPointSet* theDataSet, float& theStepLength,
float& thePropogationTime, float& thePercents)
{
static float aPercentsDecrease = 3.0, aStepLengthIncrease = 9.0;
}
-int VISU_StreamLinesPL::SetParams(float theIntStep,
+int VISU_StreamLinesPL::SetParams(float theIntStep,
float thePropogationTime,
float theStepLength,
- vtkPointSet* theSource,
- float thePercents,
+ vtkPointSet* theSource,
+ float thePercents,
int theDirection,
int isOnlyTry)
{
if((!isOnlyTry && isAccepted) || (isOnlyTry && isAccepted == 1)){
mySource = theSource;
myPercents = thePercents;
- if(myInput->GetCellData()->GetNumberOfArrays()){
+ if(GetInput2()->GetCellData()->GetNumberOfArrays()){
myCenters->SetInput(aDataSet);
myCenters->VertexCellsOn();
aDataSet = myCenters->GetOutput();
return mySource;
}
-float VISU_StreamLinesPL::GetUsedPoints() {
+float VISU_StreamLinesPL::GetUsedPoints() {
return myPercents;
}
float VISU_StreamLinesPL::GetIntegrationStep(){
return myStream->GetIntegrationStepLength();
}
-float VISU_StreamLinesPL::GetStepLength() {
+float VISU_StreamLinesPL::GetStepLength() {
return myStream->GetStepLength();
}
-float VISU_StreamLinesPL::GetPropagationTime() {
+float VISU_StreamLinesPL::GetPropagationTime() {
return myStream->GetMaximumPropagationTime();
}
int VISU_StreamLinesPL::GetDirection(){
vtkIdType aNbOfPoints = theDataSet->GetNumberOfPoints();
float aSize = GetNecasseryMemorySize(aNbOfPoints,anStepLength,aBasePropTime,thePercents);
float aRealSize = GetAvailableMemory(aSize);
- float anAverageVolume = aVolume / aRealSize;
+ float anAverageVolume = aVolume / aRealSize;
float aStep = pow(double(anAverageVolume), double(1.0/double(degree)));
return aStep;
}
-float VISU_StreamLinesPL::GetMinIntegrationStep(){
+float VISU_StreamLinesPL::GetMinIntegrationStep(){
return GetMinIntegrationStep(myExtractor->GetOutput(),GetUsedPoints());
}
if (aMinMax < EPS || (aMaxSizeY < aMinMax && aMaxSizeY > EPS)) aMinMax = aMaxSizeY;
if (aMinMax < EPS || (aMaxSizeZ < aMinMax && aMaxSizeZ > EPS)) aMinMax = aMaxSizeZ;
return aMinMax*aLength/2.0;
-}
-float VISU_StreamLinesPL::GetMaxIntegrationStep(){
+}
+float VISU_StreamLinesPL::GetMaxIntegrationStep(){
return GetMaxIntegrationStep(myExtractor->GetOutput());
}
-float VISU_StreamLinesPL::GetBaseIntegrationStep(vtkPointSet* theDataSet, float thePercents){
+float VISU_StreamLinesPL::GetBaseIntegrationStep(vtkPointSet* theDataSet, float thePercents){
theDataSet->Update();
float aMinIntegrationStep = GetMinIntegrationStep(theDataSet,thePercents);
float aMaxIntegrationStep = GetMaxIntegrationStep(theDataSet);
float anIntegrationStep = aMaxIntegrationStep / aCoeffOfIntStep;
float aMinMax = theDataSet->GetLength()/theDataSet->GetNumberOfPoints();
- if(aMinMax > anIntegrationStep)
+ if(aMinMax > anIntegrationStep)
anIntegrationStep = (anIntegrationStep*aCoeffOfIntStep*0.9+aMinMax)/aCoeffOfIntStep;
- if(aMinIntegrationStep > anIntegrationStep)
+ if(aMinIntegrationStep > anIntegrationStep)
anIntegrationStep = aMinIntegrationStep;
return anIntegrationStep;
}
-float VISU_StreamLinesPL::CorrectIntegrationStep(float theStep, vtkPointSet* theDataSet, float thePercents){
+float VISU_StreamLinesPL::CorrectIntegrationStep(float theStep, vtkPointSet* theDataSet, float thePercents){
theDataSet->Update();
float aMinIntegrationStep = GetMinIntegrationStep(theDataSet,thePercents);
float aMaxIntegrationStep = GetMaxIntegrationStep(theDataSet);
float aPropagationTime = theDataSet->GetLength()/GetVelocityCoeff(theDataSet);
return aPropagationTime;
}
-float VISU_StreamLinesPL::GetBasePropagationTime(){
+float VISU_StreamLinesPL::GetBasePropagationTime(){
return GetBasePropagationTime(myExtractor->GetOutput());
}
}
VISU_ScalarMapPL::THook* VISU_StreamLinesPL::DoHook(){
- myInput->Update();
- VISU::CellDataToPoint(myStream,myCellDataToPointData,myInput,myFieldTransform);
- float *aBounds = myInput->GetBounds();
+ GetInput2()->Update();
+ VISU::CellDataToPoint(myStream,myCellDataToPointData,GetInput2(),myFieldTransform);
+ float *aBounds = GetInput2()->GetBounds();
myGeomFilter->SetExtent(aBounds);
myGeomFilter->ExtentClippingOn();
myGeomFilter->SetInput(myStream->GetOutput());
// VISU OBJECT : interactive object for VISU entities implementation
//
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
//
//
// File: VISU_StreamLinesPL.cxx
#include <vtkPoints.h>
#include <vtkIdList.h>
-#ifdef _DEBUG_
-static int MYDEBUG = 0;
-#else
-static int MYDEBUG = 0;
-#endif
-
vtkStandardNewMacro(VISU_UsedPointsFilter);
VISU_UsedPointsFilter::VISU_UsedPointsFilter(){
anOutput->CopyStructure(anInput);
vtkPoints* aPoints = vtkPoints::New();
- vtkIdList *anIdList = vtkIdList::New();
+ vtkIdList *anIdList = vtkIdList::New();
vtkIdType iEnd = anInput->GetNumberOfPoints();
for(vtkIdType i = 0; i < iEnd; i++){
anInput->GetPointCells(i,anIdList);
// VISU OBJECT : interactive object for VISU entities implementation
//
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
//
//
// File: VISU_PipeLine.cxx
myCenters = vtkCellCenters::New();
myTransformFilter = VTKViewer_TransformFilter::New();
+ myIsShrinkable = false;
}
VISU_VectorsPL::~VISU_VectorsPL(){
}
-void VISU_VectorsPL::SetScale(float theScale) {
+void VISU_VectorsPL::SetScale(float theScale) {
if(myScaleFactor == theScale) return;
myScaleFactor = theScale;
myGlyph->SetScaleFactor(myScaleFactor);
Modified();
}
-float VISU_VectorsPL::GetScale() {
+float VISU_VectorsPL::GetScale() {
return myGlyph->GetScaleFactor();
}
VISU_ScalarMapPL::THook* VISU_VectorsPL::DoHook(){
- VISU::ToCellCenters(myTransformFilter,myCenters,myInput,myFieldTransform);
+ VISU::ToCellCenters(myTransformFilter,myCenters,GetInput2(),myFieldTransform);
myGlyph->SetInput(myTransformFilter->GetOutput());
myGlyph->SetVectorModeToUseVector();
myGlyph->SetScaleModeToScaleByVector();
myConeSource->SetResolution(7);
myConeSource->SetHeight(1.0);
myConeSource->SetRadius(.1);
-
+
switch (myPosGlyph) {
case TAIL:
myConeSource->SetCenter(0.5, 0.0, 0.0);
VisuGUI_CursorDlg.cxx \
VisuGUI_TimeAnimation.cxx \
VisuGUI_EditContainerDlg.cxx \
+ VisuGUI_ClippingDlg.cxx \
+ VisuGUI_CubeAxesDlg.cxx \
+ VisuGUI_FontWg.cxx \
+ VisuGUI_OffsetDlg.cxx \
+ VisuGUI_Plot3DDlg.cxx \
VisuGUI_NonIsometricDlg.cxx \
VisuGUI_ScalarBarDlg.cxx \
VisuGUI_DeformedShapeDlg.cxx \
VisuGUI_CursorDlg.h \
VisuGUI_TimeAnimation.h \
VisuGUI_EditContainerDlg.h \
+ VisuGUI_ClippingDlg.h \
+ VisuGUI_CubeAxesDlg.h \
+ VisuGUI_FontWg.h \
+ VisuGUI_OffsetDlg.h \
+ VisuGUI_Plot3DDlg.h \
VisuGUI_NonIsometricDlg.h \
VisuGUI_ScalarBarDlg.h \
VisuGUI_DeformedShapeDlg.h \
msgid "ICON_SWEEP"
msgstr "Visu_scalars_anim.png"
+
+msgid "ICON_PLOT_3D"
+msgstr "Visu_plot3d.png"
#: VisuGUI.cxx
-#msgid "MEN_IMPORT_FROM_FILE"
msgid "VisuGUI::MEN_IMPORT_FROM_FILE"
msgstr "Import from File"
-#msgid "MEN_EXPLORE_MED_FILE"
msgid "VisuGUI::MEN_EXPLORE_MED_FILE"
msgstr "Explore MED File"
-#msgid "MEN_IMPORT_TABLE"
msgid "VisuGUI::MEN_IMPORT_TABLE"
msgstr "Import table from File"
-#msgid "ERR_CANT_BUILD_PRESENTATION"
-#msgid "VisuGUI::ERR_CANT_BUILD_PRESENTATION"
-#msgstr "Cannot build presentation"
-
-#msgid "ERR_ERROR_IN_THE_FILE"
msgid "VisuGUI::ERR_ERROR_IN_THE_FILE"
msgstr "Error in the file"
-#msgid "FLT_ALL_FILES"
msgid "VisuGUI::FLT_ALL_FILES"
msgstr "All Files (*.*)"
-#msgid "FLT_MED_FILES"
msgid "VisuGUI::FLT_MED_FILES"
msgstr "MED Files (*.med)"
-#msgid "FLT_TABLE_FILES"
msgid "VisuGUI::FLT_TABLE_FILES"
msgstr "Tables (*.xls *.txt *.tab)"
-#msgid "MEN_SCALAR_MAP"
msgid "VisuGUI::MEN_SCALAR_MAP"
msgstr "Scalar Map"
-#msgid "MEN_DEFORMED_SHAPE"
msgid "VisuGUI::MEN_DEFORMED_SHAPE"
msgstr "Deformed Shape"
-#msgid "MEN_VISUALIZATION"
msgid "VisuGUI::MEN_VISUALIZATION"
msgstr "Visualization"
-#msgid "TOOL_VISUALISATION"
msgid "VisuGUI::TOOL_VISUALISATION"
msgstr "Visualization Toolbar"
msgid "VisuGUI::MEN_CUT_PLANES"
msgstr "Cut Planes"
-msgid "VisuGUI::MEN_DELETE_OBJ"
-msgstr "Delete"
+#msgid "VisuGUI::MEN_DELETE_OBJ"
+#msgstr "Delete"
-msgid "VisuGUI::MEN_DELETE_PRS"
-msgstr "Delete"
+#msgid "VisuGUI::MEN_DELETE_PRS"
+#msgstr "Delete"
msgid "VisuGUI::MEN_DISPLAY"
msgstr "Display"
msgid "BUT_CANCEL"
msgstr "Cancel"
+msgid "BUT_APPLY"
+msgstr "Apply"
+
msgid "WRN_NO_AVAILABLE_DATA"
msgstr "No Available data in selection"
msgid "VisuGUI::MEN_IMPORT_MED"
msgstr "Import Structure"
+msgid "VisuGUI::MEN_DELETE_OBJS"
+msgstr "Delete"
+
+msgid "VisuGUI::MEN_PLOT_3D"
+msgstr "Plot3D"
+
+msgid "VisuGUI::MEN_TRANSLATE_PRS"
+msgstr "Translate Presentation"
+
+msgid "VisuGUI::MEN_CLIPPING"
+msgstr "Clipping planes"
+
+msgid "VisuGUI::MEN_MERGE_SCALAR_BARS"
+msgstr "Merge Scalar Range"
+
+msgid "VisuGUI::MEN_FREE_SCALAR_BARS"
+msgstr "Use Field Range"
+
+msgid "VisuGUI::MEN_ARRANGE_ACTORS"
+msgstr "Arrange Actors"
+
msgid "VisuGUI::DLG_OPACITY_TITLE"
msgstr "Opacity"
msgid "VisuGUI_TableWidget::TITLE_LBL"
msgstr "Title:"
+
+# -------------- Clipping --------------
+
+#Title
+msgid "VisuGUI_ClippingDlg::TITLE"
+msgstr "Change Clipping"
+
+msgid "VisuGUI_ClippingDlg::GRP_PLANES"
+msgstr "Clipping planes"
+
+msgid "VisuGUI_ClippingDlg::BUT_NEW"
+msgstr "New"
+
+msgid "VisuGUI_ClippingDlg::BUT_DELETE"
+msgstr "Delete"
+
+msgid "VisuGUI_ClippingDlg::GRP_PARAMETERS"
+msgstr "Parameters"
+
+msgid "VisuGUI_ClippingDlg::TAB_NON_STRUCTURED"
+msgstr "Non structured"
+
+msgid "VisuGUI_ClippingDlg::TAB_IJK_STRUCTURED"
+msgstr "IJK (Structured)"
+
+msgid "VisuGUI_ClippingDlg::SHOW_PREVIEW_CHK"
+msgstr "Show preview"
+
+msgid "VisuGUI_ClippingDlg::AUTO_APPLY_CHK"
+msgstr "Auto Apply"
+
+msgid "VisuGUI_ClippingDlg::PARALLEL_XOY_COMBO_ITEM"
+msgstr "|| X-Y"
+
+msgid "VisuGUI_ClippingDlg::PARALLEL_YOZ_COMBO_ITEM"
+msgstr "|| Y-Z"
+
+msgid "VisuGUI_ClippingDlg::PARALLEL_ZOX_COMBO_ITEM"
+msgstr "|| Z-X"
+
+msgid "VisuGUI_ClippingDlg::LBL_ORIENTATION"
+msgstr "Orientation"
+
+msgid "VisuGUI_ClippingDlg::LBL_DISTANCE"
+msgstr "Distance"
+
+msgid "VisuGUI_ClippingDlg::LBL_ROTATION_YZ"
+msgstr "Rotation around X (Y to Z):"
+
+msgid "VisuGUI_ClippingDlg::LBL_ROTATION_ZY"
+msgstr "Rotation around X (Z to Y):"
+
+msgid "VisuGUI_ClippingDlg::LBL_ROTATION_ZX"
+msgstr "Rotation around Y (Z to X):"
+
+msgid "VisuGUI_ClippingDlg::LBL_ROTATION_XZ"
+msgstr "Rotation around Y (X to Z):"
+
+msgid "VisuGUI_ClippingDlg::LBL_ROTATION_XY"
+msgstr "Rotation around Z (X to Y):"
+
+msgid "VisuGUI_ClippingDlg::LBL_ROTATION_YX"
+msgstr "Rotation around Z (Y to X):"
+
+msgid "VisuGUI_ClippingDlg::GRP_IJK_AXIS"
+msgstr "Axis"
+
+msgid "VisuGUI_ClippingDlg::I_RADIO_BTN"
+msgstr "I"
+
+msgid "VisuGUI_ClippingDlg::J_RADIO_BTN"
+msgstr "J"
+
+msgid "VisuGUI_ClippingDlg::K_RADIO_BTN"
+msgstr "K"
+
+msgid "VisuGUI_ClippingDlg::LBL_IJK_INDEX"
+msgstr "Index (from 0 to ...)"
+
+msgid "VisuGUI_ClippingDlg::LBL_IJK_INDEX_TO_arg"
+msgstr "Index (from 0 to %1) "
+
+msgid "VisuGUI_ClippingDlg::REVERSE_NORMAL_CHK"
+msgstr "Reverse normal"
+
+msgid "VisuGUI_ClippingDlg::PLANES_COMBO_ITEM_i"
+msgstr "Plane# %1"
+
+msgid "VisuGUI_ClippingDlg::PLANES_COMBO_ITEM_no"
+msgstr "No planes"
+
+# -------------- Plot 3D --------------
+
+msgid "VisuGUI_Plot3DDlg::TITLE"
+msgstr "Plot3D Definition"
+
+msgid "VisuGUI_Plot3DDlg::PLOT3D_TAB_TITLE"
+msgstr "Plot 3D"
+
+msgid "VisuGUI_Plot3DDlg::SCALAR_BAR_TAB_TITLE"
+msgstr "Scalar Bar"
+
+msgid "VisuGUI_Plot3DPane::ORIENTATION"
+msgstr "Orientation"
+
+msgid "VisuGUI_Plot3DPane::ROTATIONS"
+msgstr "Rotations"
+
+msgid "VisuGUI_Plot3DPane::ROTATION_X"
+msgstr "Rotation around X (Y to Z):"
+
+msgid "VisuGUI_Plot3DPane::ROTATION_Y"
+msgstr "Rotation around Y (Z to X):"
+
+msgid "VisuGUI_Plot3DPane::ROTATION_Z"
+msgstr "Rotation around Z (X to Y):"
+
+msgid "VisuGUI_Plot3DPane::POSITION"
+msgstr "Position"
+
+msgid "VisuGUI_Plot3DPane::POSITION_VALUE"
+msgstr "Value: "
+
+msgid "VisuGUI_Plot3DPane::RELATIVE"
+msgstr "Relative"
+
+msgid "VisuGUI_Plot3DPane::SCALE"
+msgstr "Scale Factor:"
+
+msgid "VisuGUI_Plot3DPane::PRESENTATION_TYPE"
+msgstr "Presentation type"
+
+msgid "VisuGUI_Plot3DPane::SURFACE"
+msgstr "Surface"
+
+msgid "VisuGUI_Plot3DPane::CONTOUR"
+msgstr "Contour"
+
+msgid "VisuGUI_Plot3DPane::NUMBER_CONTOURS"
+msgstr "Number of contours:"
+
+msgid "VisuGUI_Plot3DPane::PREVIEW"
+msgstr "Preview cutting plane"
+
+# --------------------------------------
+
+msgid "TIT_OFFSETDLG"
+msgstr "Translate Presentation"
+
+msgid "BTN_RESET"
+msgstr "Reset"
+
+# --------------------------------------
+
+msgid "VisuGUI_CubeAxesDlg::CAPTION"
+msgstr "Graduated axes"
+
+msgid "VisuGUI_AxisWg::AXIS_NAME"
+msgstr "Axis name"
+
+msgid "VisuGUI_AxisWg::IS_VISIBLE"
+msgstr "Is visible"
+
+msgid "VisuGUI_CubeAxesDlg::X_AXIS"
+msgstr "X axis"
+
+msgid "VisuGUI_CubeAxesDlg::Y_AXIS"
+msgstr "Y axis"
+
+msgid "VisuGUI_CubeAxesDlg::Z_AXIS"
+msgstr "Z axis"
+
+msgid "VisuGUI_AxisWg::NAME"
+msgstr "Name"
+
+msgid "VisuGUI_AxisWg::FONT"
+msgstr "Font"
+
+msgid "VisuGUI_AxisWg::LABELS"
+msgstr "Labels"
+
+msgid "VisuGUI_AxisWg::NUMBER"
+msgstr "Number"
+
+msgid "VisuGUI_AxisWg::OFFSET"
+msgstr "Offset"
+
+msgid "VisuGUI_AxisWg::TICK_MARKS"
+msgstr "Tick marks"
+
+msgid "VisuGUI_AxisWg::LENGTH"
+msgstr "Length"
+
+# --------------------------------------
+
+msgid "VisuGUI_FontWg::ARIAL"
+msgstr "Arial"
+
+msgid "VisuGUI_FontWg::COURIER"
+msgstr "Courier"
+
+msgid "VisuGUI_FontWg::TIMES"
+msgstr "Times"
+
+msgid "VisuGUI_FontWg::BOLD"
+msgstr "Bold"
+
+msgid "VisuGUI_FontWg::ITALIC"
+msgstr "Italic"
+
+msgid "VisuGUI_FontWg::SHADOW"
+msgstr "Shadow"
+
+msgid "VisuGUI_CubeAxesDlg::IS_VISIBLE"
+msgstr "Is visible"
// Module : VISU
// $Header$
+#include "VisuGUI.h"
+
+// STL Includes
#include <exception>
#include <typeinfo>
#include <vector>
+// QT Includes
#include <qptrlist.h>
#include <qptrvector.h>
#include <qcolordialog.h>
+// VTK Includes
#include <vtkRenderer.h>
#include <vtkRenderWindow.h>
#include <vtkActorCollection.h>
+// SALOME Includes
#include "SALOME_LifeCycleCORBA.hxx"
#include "SUIT_ResourceMgr.h"
#include "VISU_Result_i.hh"
#include "VISU_View_i.hh"
#include "VISU_ViewManager_i.hh"
+#include "VISU_Plot3D_i.hh"
#include "VISU_Actor.h"
-#include "VisuGUI.h"
#include "VisuGUI_Tools.h"
#include "VisuGUI_PopupTools.h"
#include "VisuGUI_NameDlg.h"
#include "VisuGUI_TimeAnimation.h"
#include "VisuGUI_EditContainerDlg.h"
#include "VisuGUI_NonIsometricDlg.h"
+#include "VisuGUI_ClippingDlg.h"
+#include "VisuGUI_Plot3DDlg.h"
+#include "VisuGUI_CubeAxesDlg.h"
+#include "VisuGUI_OffsetDlg.h"
#include "VISU_ScalarMap_i.hh"
#include "VisuGUI_ScalarBarDlg.h"
aView->onFitAll();
}
-void VisuGUI::CreateMesh (const Handle(SALOME_InteractiveObject)& theIO)
-{
- _PTR(Study) aStudy = GetCStudy(GetAppStudy(this));
- //if (CheckLock(aStudy))
- // return;
-
- SALOMEDS::SObject_var aResultSObj =
- GetDSStudy(aStudy)->FindObjectID(theIO->getEntry());
-
- // Get VISU::Result
- VISU::Result_var aResult;
- VISU::Result_i* pResult = CheckResult(this, aResultSObj, aResult);
- if (pResult == NULL)
- return;
-
- Storable::TRestoringMap aMap = getMapOfValue(aResultSObj);
- bool isExist;
- string aComment = Storable::FindValue(aMap,"myComment",&isExist).latin1();
- if (!isExist)
- return;
-
- CORBA::Object_var aMesh;
- string aMeshName = Storable::FindValue(aMap,"myMeshName").latin1();
-#ifdef CHECKTIME
- Utils_Timer timer;
- timer.Start();
-#endif
- if (aComment == "ENTITY") {
- VISU::Entity anEntity = (VISU::Entity)Storable::FindValue(aMap,"myId").toInt();
- if (VISU::Mesh_i::IsPossible(pResult,aMeshName.c_str(),anEntity))
- aMesh = GetVisuGen(this)->MeshOnEntity(aResult,aMeshName.c_str(),anEntity);
- } else if (aComment == "FAMILY") {
- VISU::Entity anEntity = (VISU::Entity)Storable::FindValue(aMap,"myEntityId").toInt();
- string aFamilyName = Storable::FindValue(aMap,"myName").latin1();
- if (VISU::Mesh_i::IsPossible(pResult,aMeshName.c_str(),anEntity,aFamilyName.c_str()))
- aMesh = GetVisuGen(this)->FamilyMeshOnEntity(aResult,aMeshName.c_str(),anEntity,aFamilyName.c_str());
- } else if (aComment == "GROUP") {
- string aGroupName = Storable::FindValue(aMap,"myName").latin1();
- if (VISU::Mesh_i::IsPossible(pResult,aMeshName.c_str(),aGroupName.c_str()))
- aMesh = GetVisuGen(this)->GroupMesh(aResult,aMeshName.c_str(),aGroupName.c_str());
- }
-#ifdef CHECKTIME
- timer.Stop();
- MESSAGE("VisuGUI::CreateMesh() - CREATE MESH");
- timer.Show();
-#endif
-
- QApplication::restoreOverrideCursor();
- VISU::Mesh_i* pPresent = NULL;
- if (!CORBA::is_nil(aMesh))
- pPresent = dynamic_cast<VISU::Mesh_i*>(VISU::GetServant(aMesh).in());
- if (pPresent == NULL) {
- SUIT_MessageBox::warn1 (GetDesktop(this),
- tr("WRN_VISU"),
- tr("ERR_CANT_BUILD_PRESENTATION"),
- tr("BUT_OK"));
- return;
- }
-
- if (SVTK_ViewWindow* aView = GetViewWindow(this)){
- try {
-#ifdef CHECKTIME
- Utils_Timer timer;
- timer.Start();
-#endif
- PublishInView(this, pPresent);
- aView->onFitAll();
-#ifdef CHECKTIME
- timer.Stop();
- MESSAGE("VisuGUI::CreateMesh() - DISPLAY MESH");
- timer.Show();
-#endif
- application()->putInfo(QObject::tr("INF_DONE"));
- } catch (std::runtime_error& exc) {
- INFOS(exc.what());
- SUIT_MessageBox::warn1 (GetDesktop(this),
- tr("WRN_VISU"),
- tr("ERR_CANT_CREATE_ACTOR") + " " + tr(exc.what()),
- tr("BUT_OK"));
- }
- }
-}
-
void
VisuGUI::
OnCreateMesh()
if (anIO.IsNull() || !anIO->hasEntry())
return;
- CreateMesh(anIO);
+ CreateMesh(this, anIO);
}
void
if (anIO.IsNull() || !anIO->hasEntry())
return;
- CreateMesh(anIO);
+ CreateMesh(this, anIO);
}
}
CreatePrs3d<VISU::StreamLines_i,VisuGUI_StreamLinesDlg,1>(this);
}
+void
+VisuGUI::
+OnCreatePlot3D()
+{
+ CreatePrs3d<VISU::Plot3D_i,VisuGUI_Plot3DDlg,1>(this);
+}
+
void
VisuGUI::
OnCreatePlot2dView()
OnDisplayPrs();
}
-void VisuGUI::ErasePrs (CORBA::Object_ptr theObject, bool theUpdate)
-{
- if (MYDEBUG) MESSAGE("ErasePrs");
-
- if ( !CORBA::is_nil( theObject ) ) {
- VISU::Base_var aBase = VISU::Base::_narrow(theObject);
- if ( CORBA::is_nil( aBase ) ) return;
- VISU::VISUType aType = aBase->GetType();
- switch (aType){
- case VISU::TCURVE:{
- if(VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aBase).in()))
- PlotCurve(this, aCurve, VISU::eErase );
- break;
- }
- case VISU::TCONTAINER:{
- if(VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(VISU::GetServant(aBase).in()))
- PlotContainer(this, aContainer, VISU::eErase );
- break;
- }
- case VISU::TTABLE:{
- if(VISU::Table_i* aTable = dynamic_cast<VISU::Table_i*>(VISU::GetServant(aBase).in()))
- PlotTable(this, aTable, VISU::eErase );
- break;
- }
- default:{
- if(VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(VISU::GetServant(aBase).in())){
- ErasePrs3d( this, aPrsObject );
- if (theUpdate) {
- if (SVTK_ViewWindow* vw = GetViewWindow( this ))
- vw->Repaint();
- }
- }
- }
- } // switch (aType)
- }
-}
-
void
VisuGUI::
OnErasePrs()
for ( SALOME_ListIteratorOfListIO it( aList ); it.More(); it.Next() ) {
anIO = it.Value();
CORBA::Object_var anObject = GetSelectedObj( GetAppStudy(this), anIO->getEntry() );
- ErasePrs(anObject, false);
+ ErasePrs(this, anObject, false);
}
if (SVTK_ViewWindow* vw = GetViewWindow( this ))
vw->Repaint();
case VISU::TSTREAMLINES:
EditPrs3d<VISU::StreamLines_i, VisuGUI_StreamLinesDlg>(this, aPrs3d);
break;
+ case VISU::TPLOT3D:
+ EditPrs3d<VISU::Plot3D_i, VisuGUI_Plot3DDlg>(this, aPrs3d);
+ /*{
+ VISU::Plot3D_i* aPrsObject = dynamic_cast<VISU::Plot3D_i*>(aPrs3d);
+ if (aPrsObject) {
+ VisuGUI_Plot3DDlg* aDlg = new VisuGUI_Plot3DDlg();
+ aDlg->initFromPrsObject(aPrsObject);
+ aDlg->show();
+ myActiveDialogBox = aDlg;
+ }
+ }*/
+ break;
default:
return;
}
}
}
-void VisuGUI::ChangeRepresentation (VISU::PresentationType theType)
-{
- SUIT_ViewWindow* aView = GetActiveView(this, VTKViewer_Viewer::Type());
- if (!aView) return;
- SVTK_ViewWindow* vw = (SVTK_ViewWindow*) aView;
-
- Handle(SALOME_InteractiveObject) anIO;
- CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
- if (CORBA::is_nil(anObject)) return;
- PortableServer::ServantBase_var aServant = VISU::GetServant(anObject);
- if (!aServant.in()) return;
-
- VISU::Prs3d_i* aPrs3d = dynamic_cast<VISU::Prs3d_i*>(aServant.in());
- if (aPrs3d) {
- if (VISU_Actor* anActor = GetActor(aPrs3d, vw)) {
- switch (theType) {
- case VISU::SHRINK:
- if (anActor->IsShrunk())
- anActor->UnShrink();
- else
- anActor->SetShrink();
- break;
- default:
- if (VISU::Mesh_i* aMesh = dynamic_cast<VISU::Mesh_i*>(aPrs3d)) {
- aMesh->SetPresentationType(theType);
- RecreateActor(this, aMesh);
- } else {
- anActor->SetRepresentation(theType);
- }
- }
- vw->Repaint();
- }
- }
-}
-
void
VisuGUI::
OnMakeSurfaceframe()
{
- ChangeRepresentation(VISU::SURFACEFRAME);
+ ChangeRepresentation(this, VISU::SURFACEFRAME);
}
void
VisuGUI::
OnMakeInsideframe()
{
- ChangeRepresentation(VISU::INSIDEFRAME);
+ ChangeRepresentation(this, VISU::INSIDEFRAME);
}
void
VisuGUI::
OnMakeWireframe()
{
- ChangeRepresentation(VISU::WIREFRAME);
+ ChangeRepresentation(this, VISU::WIREFRAME);
}
void
VisuGUI::
OnMakeSurface()
{
- ChangeRepresentation(VISU::SHADED);
+ ChangeRepresentation(this, VISU::SHADED);
}
void
VisuGUI::
OnMakePoints()
{
- ChangeRepresentation(VISU::POINT);
+ ChangeRepresentation(this, VISU::POINT);
}
void
VisuGUI::
OnMakeShrink()
{
- ChangeRepresentation(VISU::SHRINK);
+ ChangeRepresentation(this, VISU::SHRINK);
}
void
for (aChildIter->InitEx(true); aChildIter->More(); aChildIter->Next()) {
SALOMEDS::SObject_var aChildSObject = aChildIter->Value();
CORBA::Object_var aChildObj = VISU::SObjectToObject(aChildSObject);
- ErasePrs(aChildObj);
+ ErasePrs(this, aChildObj);
}
SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder();
// There is a transaction
}
}
+void
+VisuGUI::
+OnDeleteObjects()
+{
+ _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
+ if (CheckLock(aCStudy))
+ return;
+ SALOMEDS::Study_var aStudy = GetDSStudy(aCStudy);
+
+ SALOME_ListIO aList;
+ SalomeApp_SelectionMgr* mgr = GetSelectionMgr(this);
+ mgr->selectedObjects(aList);
+ int i = 0, nbSelected = aList.Extent();
+ if (nbSelected < 1) return;
+
+ const char* entries [nbSelected];
+ Handle(SALOME_InteractiveObject) anIO;
+ for (SALOME_ListIteratorOfListIO it (aList); it.More(); it.Next()) {
+ anIO = it.Value();
+ if (anIO->hasEntry())
+ entries[i++] = anIO->getEntry();
+ }
+ nbSelected = i;
+ if (nbSelected < 1) return;
+
+ // There is a transaction
+ SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder();
+ aStudyBuilder->NewCommand();
+
+ for (i = 0; i < nbSelected; i++) {
+ SALOMEDS::SObject_var aSObject = aStudy->FindObjectID(entries[i]);
+ if (!aSObject->_is_nil()) {
+ DeleteSObject(this, aStudy, aSObject);
+ }
+ }
+
+ // Finish transaction
+ aStudyBuilder->CommitCommand();
+
+ //GetActiveStudy()->unHighlightAll();
+ updateObjBrowser(true);
+}
+
void
VisuGUI::
OnPlotData()
SPlot2d_SetupPlot2dDlg* dlg = new SPlot2d_SetupPlot2dDlg( SO, GetDesktop( this ) );
if ( dlg->exec() == QDialog::Accepted ) {
if ( !IsStudyLocked( aStudy ) ) {
- // if study is not locked - create new container, create curves
- // and insert them into container, then plot container if current viewer is of VIEW_PLOT2D type
+ // if study is not locked - create new container, create curves and insert them
+ // into container, then plot container if current viewer is of VIEW_PLOT2D type
int horIndex;
QValueList<int> verIndices;
dlg->getCurvesSource( horIndex, verIndices );
if ( horIndex >= 0 && verIndices.count() > 0 ) {
CORBA::Object_var aContainer = GetVisuGen(this)->CreateContainer();
if( !CORBA::is_nil( aContainer ) ) {
- VISU::Container_i* pContainer = dynamic_cast<VISU::Container_i*>(VISU::GetServant(aContainer).in());
+ VISU::Container_i* pContainer =
+ dynamic_cast<VISU::Container_i*>(VISU::GetServant(aContainer).in());
if ( pContainer ) {
for ( int i = 0; i < verIndices.count(); i++ ) {
- CORBA::Object_var aNewCurve = GetVisuGen(this)->CreateCurve( table->_this(), horIndex+1, verIndices[i]+1 );
+ CORBA::Object_var aNewCurve =
+ GetVisuGen(this)->CreateCurve( table->_this(), horIndex+1, verIndices[i]+1 );
if( !CORBA::is_nil( aNewCurve ) ) {
- VISU::Curve_i* pCrv = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aNewCurve).in());
+ VISU::Curve_i* pCrv =
+ dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aNewCurve).in());
if ( pCrv ) {
bool isAuto;
int marker, line, lineWidth;
QColor color;
- if ( dlg->getCurveAttributes( verIndices[i], isAuto, marker, line, lineWidth, color ) && !isAuto ) {
- SALOMEDS::Color c; c.R = color.red()/255.; c.G = color.green()/255.; c.B = color.blue()/255.;
+ if ( dlg->getCurveAttributes(verIndices[i], isAuto, marker,
+ line, lineWidth, color) && !isAuto ) {
+ SALOMEDS::Color c;
+ c.R = color.red() /255.;
+ c.G = color.green()/255.;
+ c.B = color.blue() /255.;
pCrv->SetColor( c );
pCrv->SetMarker( ( VISU::Curve::MarkerType )marker );
pCrv->SetLine( ( VISU::Curve::LineType )line, lineWidth );
}
}
else {
- // if study is locked just get curves info and plot them if current viewer is of VIEW_PLOT2D type
+ // if study is locked just get curves info and plot them
+ // if current viewer is of VIEW_PLOT2D type
QPtrList<Plot2d_Curve> container;
dlg->getCurves( container );
if ( !container.isEmpty() ) {
if ( pContainer && pTable ) {
for ( int i = 0; i < verIndices.count(); i++ ) {
- CORBA::Object_var aNewCurve = GetVisuGen(this)->CreateCurve( pTable->_this(), horIndex+1, verIndices[i]+1 );
+ CORBA::Object_var aNewCurve = GetVisuGen(this)->CreateCurve
+ ( pTable->_this(), horIndex+1, verIndices[i]+1 );
if( !CORBA::is_nil( aNewCurve ) ) {
VISU::Curve_i* pCrv = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aNewCurve).in());
if ( pCrv ) {
bool isAuto;
int marker, line, lineWidth;
QColor color;
- if ( dlg->getCurveAttributes( verIndices[i], isAuto, marker, line, lineWidth, color ) && !isAuto ) {
- SALOMEDS::Color c; c.R = color.red()/255.; c.G = color.green()/255.; c.B = color.blue()/255.;
+ if ( dlg->getCurveAttributes(verIndices[i], isAuto, marker,
+ line, lineWidth, color) && !isAuto ) {
+ SALOMEDS::Color c;
+ c.R = color.red()/255.;
+ c.G = color.green()/255.;
+ c.B = color.blue()/255.;
pCrv->SetColor( c );
pCrv->SetMarker( ( VISU::Curve::MarkerType )marker );
pCrv->SetLine( ( VISU::Curve::LineType )line, lineWidth );
}
}
+void
+VisuGUI::
+OnClippingPlanes()
+{
+ new VisuGUI_ClippingDlg (this, "", false);
+}
+
void
VisuGUI::
OnSweep()
VisuGUI::
OnTimeAnimation()
{
- _PTR(Study) aStudyDS = GetCStudy(GetAppStudy(this));
+ _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
VisuGUI_TimeAnimationDlg* aAnimationDlg =
- new VisuGUI_TimeAnimationDlg(GetDesktop(this), aStudyDS);
+// new VisuGUI_TimeAnimationDlg(GetDesktop(this), aCStudy);
+ new VisuGUI_TimeAnimationDlg (this, aCStudy);
SalomeApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
SALOME_ListIO aListIO;
long aNbTimes = 0;
SALOME_ListIteratorOfListIO It (aListIO);
for (; It.More(); It.Next()) {
- _PTR(SObject) aSObject = aStudyDS->FindObjectID(It.Value()->getEntry());
+ _PTR(SObject) aSObject = aCStudy->FindObjectID(It.Value()->getEntry());
if (!aSObject) continue;
if (getValue(aSObject, "myComment") == QString("FIELD")) {
long aNumber = getValue(aSObject, "myNbTimeStamps").toLong();
else delete aAnimationDlg;
}
+//************************************************************************
+void
+VisuGUI::
+OnShowAnimation()
+{
+ SalomeApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
+ SALOME_ListIO aListIO;
+ aSelectionMgr->selectedObjects(aListIO);
+
+ if (aListIO.Extent() != 1)
+ return;
+
+ const Handle(SALOME_InteractiveObject)& anIO = aListIO.First();
+
+ _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
+ SALOMEDS::Study_var aStudy = GetDSStudy(aCStudy);
+
+ SALOMEDS::SObject_var aSObj = aStudy->FindObjectID(anIO->getEntry());
+ if (aSObj->_is_nil()) return;
+
+ VISU::Storable::TRestoringMap aMap;
+ SALOMEDS::GenericAttribute_var anAttr;
+ if (!aSObj->FindAttribute(anAttr, "AttributeComment")) return;
+
+ SALOMEDS::AttributeComment_var aComment = SALOMEDS::AttributeComment::_narrow(anAttr);
+ string aComm = aComment->Value();
+ QString strIn(aComm.c_str());
+ VISU::Storable::StrToMap(strIn,aMap);
+ bool isExist;
+ VISU::VISUType aType = (VISU::VISUType)VISU::Storable::FindValue(aMap,"myType",&isExist).toInt();
+ if (aType != VISU::TANIMATION) return;
+
+ VisuGUI_TimeAnimationDlg* aAnimationDlg =
+// new VisuGUI_TimeAnimationDlg(GetDesktop(this), aCStudy);
+ new VisuGUI_TimeAnimationDlg(this, aCStudy);
+ aAnimationDlg->restoreFromStudy(aSObj);
+ aAnimationDlg->show();
+}
+
void
VisuGUI::
OnCopyPresentation()
UpdateViewer(this, aSameVectors);
}
break;
+ case VISU::TPLOT3D:
+ {
+ VISU::Plot3D_i* aPlot3DPrs = dynamic_cast<VISU::Plot3D_i*>(aPrsObject);
+ VISU::Plot3D_i* aSamePlot3D = new VISU::Plot3D_i(aPlot3DPrs->GetResult());
+ aSamePlot3D->SameAs(aPlot3DPrs);
+ UpdateViewer(this, aSamePlot3D);
+ }
+ break;
}
updateObjBrowser();
}
m_NonIsoDlg->show();
}
+void
+VisuGUI::
+OnCubeAxes()
+{
+ //Show dialog that allows to select scale function and corresponding scale factor
+ VisuGUI_CubeAxesDlg* aDlg = new VisuGUI_CubeAxesDlg (GetDesktop(this));
+ aDlg->show();
+}
+
+void
+VisuGUI::
+OnMergeScalarBars()
+{
+ SalomeApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
+ SALOME_ListIO aListIO;
+ aSelectionMgr->selectedObjects(aListIO);
+
+ SALOME_ListIteratorOfListIO It (aListIO);
+
+ // first find the bounds
+ double aMin, aMax; bool first = true;
+ for (; It.More(); It.Next()) {
+ Handle(SALOME_InteractiveObject)& anIO = It.Value();
+ std::vector<VISU::Prs3d_i*> aPrsList = GetPrs3dList(this, anIO);
+ if (!aPrsList.empty()) {
+ for (int i = 0, n = aPrsList.size(); i < n; i++) {
+ VISU::Prs3d_i* aPrsObject = aPrsList[i];
+ if (aPrsObject) {
+ VISU::ScalarMap_i* aScalar = dynamic_cast<VISU::ScalarMap_i*>(aPrsObject);
+ if (aScalar) {
+ if (first) {
+ first = false;
+ aMin = aScalar->GetMin(); aMax = aScalar->GetMax();
+ } else {
+ if (aScalar->GetMin() < aMin) aMin = aScalar->GetMin();
+ if (aScalar->GetMax() > aMax) aMax = aScalar->GetMax();
+ }
+ }
+ }
+ }
+ }
+ }
+
+ // set the computed range to every selected ScalarMap
+ bool update = false;
+ for (It.Initialize(aListIO); It.More(); It.Next() ) {
+ Handle(SALOME_InteractiveObject)& anIO = It.Value();
+ std::vector<VISU::Prs3d_i*> aPrsList = GetPrs3dList(this, anIO);
+ if (!aPrsList.empty()) {
+ for (int i = 0, n = aPrsList.size(); i < n; i++) {
+ VISU::Prs3d_i* aPrsObject = aPrsList[i];
+ if(aPrsObject){
+ VISU::ScalarMap_i* aScalar = dynamic_cast<VISU::ScalarMap_i*>(aPrsObject);
+ if (aScalar) {
+ aScalar->SetRange(aMin, aMax);
+ RecreateActor(this, aScalar);
+ update = true;
+ }
+ }
+ }
+ }
+ }
+ if (update) {
+ if (SVTK_ViewWindow* vw = GetViewWindow(this)) {
+//if (vw->getRenderer()->GetActors()->GetNumberOfItems() > 0) {
+ vw->getRenderer()->ResetCameraClippingRange();
+ vw->Repaint();
+//}
+ }
+ }
+}
+
+void
+VisuGUI::
+OnFreeScalarBars()
+{
+ SalomeApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
+ SALOME_ListIO aListIO;
+ aSelectionMgr->selectedObjects(aListIO);
+
+ SALOME_ListIteratorOfListIO It (aListIO);
+
+ // restore the source range for every ScalarMap
+ bool update = false;
+ for (; It.More(); It.Next()) {
+ Handle(SALOME_InteractiveObject)& anIO = It.Value();
+ std::vector<VISU::Prs3d_i*> aPrsList = GetPrs3dList(this, anIO);
+ if (!aPrsList.empty()) {
+ for (int i = 0, n = aPrsList.size(); i < n; i++) {
+ VISU::Prs3d_i* aPrsObject = aPrsList[i];
+ if (aPrsObject) {
+ VISU::ScalarMap_i* aScalar = dynamic_cast<VISU::ScalarMap_i*>(aPrsObject);
+ if (aScalar) {
+ aScalar->SetSourceRange();
+ RecreateActor(this, aScalar);
+ update = true;
+ }
+ }
+ }
+ }
+ }
+ if (update) {
+ if (SVTK_ViewWindow* vw = GetViewWindow(this)) {
+//if (vw->getRenderer()->GetActors()->GetNumberOfItems() > 0) {
+ vw->getRenderer()->ResetCameraClippingRange();
+ vw->Repaint();
+//}
+ }
+ }
+}
+
+void
+VisuGUI::
+OnTranslatePrs()
+{
+ if(MYDEBUG) MESSAGE("VisuGUI::OnTranslatePrs");
+ VisuGUI_OffsetDlg* aDlg = new VisuGUI_OffsetDlg (this);
+
+ _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
+ SALOMEDS::Study_var aStudy = GetDSStudy(aCStudy);
+
+ SalomeApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
+ SALOME_ListIO aListIO;
+ aSelectionMgr->selectedObjects(aListIO);
+
+ SALOME_ListIteratorOfListIO It (aListIO);
+ for (; It.More(); It.Next()) {
+ Handle(SALOME_InteractiveObject)& anIO = It.Value();
+ if (anIO->hasEntry()) {
+ SALOMEDS::SObject_var aSObject = aStudy->FindObjectID(anIO->getEntry());
+ if (!aSObject->_is_nil()) {
+ CORBA::Object_var aCORBAObject = VISU::SObjectToObject(aSObject);
+ if (!CORBA::is_nil(aCORBAObject)) {
+ PortableServer::ServantBase_var aServant = VISU::GetServant(aCORBAObject);
+ if (VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(aServant.in())) {
+ aDlg->addPresentation(aPrsObject);
+ }
+ }
+ }
+ }
+ }
+ if (aDlg->getPrsCount() > 0)
+ aDlg->show();
+ else
+ delete aDlg;
+}
+
+void
+VisuGUI::
+OnArrangeActors()
+{
+ SVTK_ViewWindow* vw = GetViewWindow();
+ if (vw) {
+ ArrangeDlg* aDlg = new ArrangeDlg (GetDesktop(this), vw);
+ aDlg->exec();
+ delete aDlg;
+ }
+}
+
+
void
VisuGUI::
initialize( CAM_Application* theApp )
createAction( VISU_CUT_LINES, tr("MEN_CUT_LINES"), QIconSet(aPixmap), tr("MEN_CUT_LINES"), "", 0, aParent, false,
this, SLOT(OnCreateCutLines()));
+ aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_PLOT_3D"));
+ createAction( VISU_PLOT_3D, tr("MEN_PLOT_3D"), QIconSet(aPixmap),
+ tr("MEN_PLOT_3D"), "", 0, aParent, false,
+ this, SLOT(OnCreatePlot3D()));
+
aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_PLOT2D"));
createAction( VISU_PLOT2D, tr("MEN_CREATE_PLOT2D"), QIconSet(aPixmap), tr("MEN_CREATE_PLOT2D"), "", 0, aParent, false,
this, SLOT(OnCreatePlot2dView()));
//aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
- createAction( VISU_DELETE, tr("MEN_DELETE_OBJ"), QIconSet(), tr("MEN_DELETE_OBJ"), "", 0, aParent, false,
- this, SLOT(OnDeleteObject()));
+ //createAction( VISU_DELETE, tr("MEN_DELETE_OBJ"), QIconSet(), tr("MEN_DELETE_OBJ"), "", 0, aParent, false,
+ // this, SLOT(OnDeleteObject()));
+
+ createAction( VISU_DELETE_OBJS, tr("MEN_DELETE_OBJS"), QIconSet(),
+ tr("MEN_DELETE_OBJS"), "", 0, aParent, false,
+ this, SLOT(OnDeleteObjects()));
//aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
//createAction( 4022, tr("MEN_RENAME_TABLE"), QIconSet(aPixmap), tr("MEN_RENAME_TABLE"), "", 0, aParent, false,
this, SLOT(OnCreateMesh()));
//aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
- createAction( VISU_CREATE_MANY_PRS, tr("MEN_CREATE_MANY_PRS"), QIconSet(), tr("MEN_CREATE_MANY_PRS"), "", 0, aParent, false,
+ createAction( VISU_CREATE_MANY_PRS, tr("MEN_CREATE_MANY_PRS"), QIconSet(),
+ tr("MEN_CREATE_MANY_PRS"), "", 0, aParent, false,
this, SLOT(OnCreateManyMesh()));
+ createAction( VISU_TRANSLATE_PRS, tr("MEN_TRANSLATE_PRS"), QIconSet(),
+ tr("MEN_TRANSLATE_PRS"), "", 0, aParent, false,
+ this, SLOT(OnTranslatePrs()));
+
+ createAction( VISU_MERGE_SCALAR_BARS, tr("MEN_MERGE_SCALAR_BARS"), QIconSet(),
+ tr("MEN_MERGE_SCALAR_BARS"), "", 0, aParent, false,
+ this, SLOT(OnMergeScalarBars()));
+
+ createAction( VISU_FREE_SCALAR_BARS, tr("MEN_FREE_SCALAR_BARS"), QIconSet(),
+ tr("MEN_FREE_SCALAR_BARS"), "", 0, aParent, false,
+ this, SLOT(OnFreeScalarBars()));
+
//aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_ERASE"));
createAction( VISU_ERASE, tr("MEN_ERASE"), QIconSet(), tr("MEN_ERASE"), "", 0, aParent, false,
this, SLOT(OnErasePrs()));
this, SLOT(OnClearContainer()));
//aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
- createAction( VISU_VIEW_PARAMS, tr("MEN_SAVE_VIEWPARAMS"), QIconSet(),
+ createAction( VISU_SAVE_VIEW_PARAMS, tr("MEN_SAVE_VIEWPARAMS"), QIconSet(),
tr("MEN_SAVE_VIEWPARAMS"), "", 0, aParent, false,
this, SLOT(OnSaveViewParams()));
tr("MEN_DELETE_VIEWPARAMS"), "", 0, aParent, false,
this, SLOT(OnDeleteViewParams()));
+ createAction( VISU_ARRANGE_ACTORS, tr("MEN_ARRANGE_ACTORS"), QIconSet(),
+ tr("MEN_ARRANGE_ACTORS"), "", 0, aParent, false,
+ this, SLOT(OnArrangeActors()));
+
aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_POINTS"));
createAction( VISU_POINTS, tr("MEN_POINTS"), QIconSet(aPixmap), tr("MEN_POINTS"), "", 0, aParent, false,
this, SLOT(OnMakePoints()));
createAction( VISU_SWEEP, tr("MEN_SWEEP"), QIconSet(aPixmap), tr("MEN_SWEEP"), "", 0, aParent, false,
this, SLOT(OnSweep()));
+ createAction( VISU_CLIPPING, tr("MEN_CLIPPING"), QIconSet(),
+ tr("MEN_CLIPPING"), "", 0, aParent, false,
+ this, SLOT(OnClippingPlanes()));
+
//aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
createAction( VISU_SELECTION_INFO, tr("MEN_SELECTION_INFO"), QIconSet(),
tr("MEN_SELECTION_INFO"), "", 0, aParent, false,
createAction( VISU_SCALING, tr("MEN_SCALING"), QIconSet(aPixmap),
tr("MEN_SCALING"), "", 0, aParent, false,
this, SLOT(OnScaling()));
+
+ //aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_CUBE_AXES"));
+ createAction( VISU_CUBE_AXES, tr("MEN_CUBE_AXES"), QIconSet(/*aPixmap*/),
+ tr("MEN_CUBE_AXES"), "", 0, aParent, false,
+ this, SLOT(OnCubeAxes()));
+
+ createAction( VISU_SHOW_ANIMATION, tr("MEN_SHOW_ANIMATION"), QIconSet(),
+ tr("MEN_SHOW_ANIMATION"), "", 0, aParent, false,
+ this, SLOT(OnShowAnimation()));
}
void
createMenu( VISU_CUT_PLANES, aMenuId, 10 ); // cut planes
createMenu( VISU_CUT_LINES, aMenuId, 10 ); // cut lines
createMenu( VISU_STREAM_LINES, aMenuId, 10 ); // stream lines
+ createMenu( VISU_PLOT_3D, aMenuId, 10 ); // Plot3d
aMenuId = createMenu( tr( "MEN_SELECTION" ), -1, -1, 30 );
createMenu( VISU_SELECTION_INFO, aMenuId, 10 ); // selection info
createMenu( VISU_GLOBAL_SELECTION, aMenuId, 10 ); // global selection
createMenu( VISU_PARTIAL_SELECTION, aMenuId, 10 ); // partial selection
createMenu( VISU_SCALING, aMenuId, 10 ); // scaling
+ createMenu( VISU_CUBE_AXES, aMenuId, 10 ); // scaling
}
void
createTool( VISU_CUT_PLANES, aToolId );
createTool( VISU_CUT_LINES, aToolId );
createTool( VISU_STREAM_LINES, aToolId );
+ createTool( VISU_PLOT_3D, aToolId );
}
void
QtxPopupMgr* mgr = popupMgr();
// VISU root commands
- QString aRule( "client='ObjectBrowser' and selcount=1 and type='VISU::TVISUGEN'" );
- mgr->insert( action( VISU_IMPORT_FROM_FILE ), -1, -1, -1 ); // import MED
+ mgr->insert( action( VISU_IMPORT_FROM_FILE ), -1, -1, -1 ); // import MED file
+ mgr->insert( action( VISU_IMPORT_TABLE ), -1, -1, -1 ); // import tables from file
+ mgr->insert( action( VISU_PLOT2D ), -1, -1, -1 ); // create Plot2d View
+
+ mgr->insert( action( VISU_IMPORT_MED ), -1, -1, -1 ); // import MED structure from MED module
+
+ // create
+ mgr->insert( action( VISU_SCALAR_MAP ), -1, -1, -1 ); // scalar bar
+ 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_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_PLOT_3D ), -1, -1, -1 ); // Plot3d
+
+ mgr->insert( action( VISU_CREATE_PRS ), -1, -1, -1 ); // create presentation
+ mgr->insert( action( VISU_CREATE_MANY_PRS ), -1, -1, -1 ); // create presentations
+
+ mgr->insert( action( VISU_CREATE_TABLE ), -1, -1, -1 ); // create table
+
+ // edit
+ mgr->insert( action( VISU_EDIT_PRS ), -1, -1, -1 );
+ mgr->insert( action( VISU_EDIT_CONTAINER ), -1, -1, -1 );
+
+ // rename
+ mgr->insert( action( VISU_RENAME ), -1, -1, -1 );
+
+ // copy
+ mgr->insert( action( VISU_COPY_PRS ), -1, -1, -1 );
+
+ // delete
+ mgr->insert( action( VISU_DELETE_OBJS ), -1, -1, -1 );
+ //mgr->insert( action( VISU_DELETE ), -1, -1, -1 ); // TODO: remove
+ //mgr->insert( action( VISU_DELETE_PRS ), -1, -1, -1 ); // TODO: remove
+ mgr->insert( action( VISU_CLEAR_CONTAINER ), -1, -1, -1 );
+
+ // table commands
+ mgr->insert( action( VISU_SHOW_TABLE ), -1, -1, -1 ); // show table
+ mgr->insert( action( VISU_CREATE_CURVES ), -1, -1, -1 ); // create curves
+ mgr->insert( action( VISU_EXPORT_TABLE ), -1, -1, -1 ); // export table
+
+ mgr->insert( separator(), -1, -1, -1 );
+
+ mgr->insert( action( VISU_ERASE ), -1, -1, -1 ); // erase
+ mgr->insert( action( VISU_DISPLAY ), -1, -1, -1 ); // display
+ mgr->insert( action( VISU_DISPLAY_ONLY ), -1, -1, -1 ); // display only
+
+ // "Representation" submenu
+ int parentId = mgr->insert( tr( "MEN_REPRESENTATION" ), -1, -1 );
+ mgr->insert( action( VISU_POINTS ) , parentId, -1, -1 ); // points
+ mgr->insert( action( VISU_WIREFRAME ) , parentId, -1, -1 ); // wireframe
+ mgr->insert( action( VISU_SURFACE ) , parentId, -1, -1 ); // surface
+ mgr->insert( action( VISU_INSIDEFRAME ) , parentId, -1, -1 ); // insideframe
+ mgr->insert( action( VISU_SURFACEFRAME ), parentId, -1, -1 ); // surfaceframe
+ mgr->insert( action( VISU_SHRINK ) , parentId, -1, -1 ); // shrink
+ mgr->insert( action( VISU_UNSHRINK ) , parentId, -1, -1 ); // unshrink
+
+ // "Properties" submenu
+ parentId = mgr->insert( tr( "MEN_PROPERTIES" ), -1, -1 );
+ mgr->insert( action( VISU_CELL_COLOR ), parentId, -1, -1 ); // cell color
+ mgr->insert( action( VISU_EDGE_COLOR ), parentId, -1, -1 ); // edge color
+ mgr->insert( action( VISU_COLOR ) , parentId, -1, -1 ); // color
+ mgr->insert( action( VISU_OPACITY ) , parentId, -1, -1 ); // opacity
+ mgr->insert( action( VISU_LINE_WIDTH ), parentId, -1, -1 ); // line width
+
+ mgr->insert( separator(), -1, -1, -1 );
+
+ // Other presentations management
+ mgr->insert( action( VISU_TRANSLATE_PRS ), -1, -1, -1 );
+ mgr->insert( action( VISU_CLIPPING ), -1, -1, -1 );
+
+ mgr->insert( action( VISU_MERGE_SCALAR_BARS ), -1, -1, -1 );
+ mgr->insert( action( VISU_FREE_SCALAR_BARS ), -1, -1, -1 );
+
+ mgr->insert( action( VISU_SWEEP ), -1, -1, -1 );
+ mgr->insert( action( VISU_ANIMATION ), -1, -1, -1 );
+ mgr->insert( action( VISU_SHOW_ANIMATION ), -1, -1, -1 );
+
+ mgr->insert( separator(), -1, -1, -1 );
+
+ // view parameters commands
+ mgr->insert( action( VISU_SAVE_VIEW_PARAMS ), -1, -1, -1 ); // save view params
+ mgr->insert( action( VISU_RESTORE_VIEW_PARAMS ), -1, -1, -1 ); // restore view params
+ mgr->insert( action( VISU_DELETE_VIEW_PARAMS ), -1, -1, -1 ); // delete view params
+
+ mgr->insert( action( VISU_ARRANGE_ACTORS ), -1, -1, -1 ); // arrange actors
+
+ mgr->insert( action( VISU_CURVE_PROPS ), -1, -1, -1 ); // curve properties
+
+ mgr->insert( action( VISU_SELECTION_INFO ), -1, -1, -1 ); // Selection info
+
+ // Rules
+
+ QString aSel_One_ObjBr ("client='ObjectBrowser' and selcount=1");
+ QString aSel_Some_ObjBr ("client='ObjectBrowser' and selcount>0");
+ QString aSel_Many_ObjBr ("client='ObjectBrowser' and selcount>1");
+
+ QString aPrsAll ("'VISU::TSCALARMAP' 'VISU::TISOSURFACE' 'VISU::TDEFORMEDSHAPE' 'VISU::TCUTPLANES' "
+ "'VISU::TCUTLINES' 'VISU::TVECTORS' 'VISU::TSTREAMLINES' 'VISU::TPLOT3D'");
+
+ QString aCurveAll = "'VISU::TTABLE' 'VISU::TCURVE' 'VISU::TCONTAINER'";
+
+ // VISU root commands
+ QString aRule = aSel_One_ObjBr + " and type='VISU::TVISUGEN'";
mgr->setRule( action( VISU_IMPORT_FROM_FILE ), aRule, true );
- mgr->insert( action( VISU_IMPORT_TABLE ), -1, -1, -1 ); // import tables
mgr->setRule( action( VISU_IMPORT_TABLE ), aRule, true );
- mgr->insert( action( VISU_PLOT2D ), -1, -1, -1 ); // create Plot2d
mgr->setRule( action( VISU_PLOT2D ), aRule, true );
- aRule = "client='ObjectBrowser' and selcount=1 and $type in {'VISU::TRESULT' 'VISU::TTABLE' 'VISU::TCONTAINER'}";
- mgr->insert( action( VISU_DELETE ), -1, -1, -1 ); // delete object
- mgr->setRule( action( VISU_DELETE ), aRule, true );
+
+ //aRule = aSel_One_ObjBr + " and $type in {'VISU::TRESULT' 'VISU::TTABLE' 'VISU::TCONTAINER'}";
+ //mgr->setRule( action( VISU_DELETE ), aRule, true );
+
+ QString aDeletable ("$type in {'VISU::TTABLE' 'VISU::TCURVE' 'VISU::TCONTAINER' ");
+ aDeletable += aPrsAll + " 'VISU::TRESULT' 'VISU::TMESH'}";
+ mgr->setRule( action( VISU_DELETE_OBJS ), aSel_Some_ObjBr + " and " + aDeletable, true );
// timestamp commands
- aRule = "client='ObjectBrowser' and selcount=1 and type='VISU::TTIMESTAMP'";
- mgr->insert( action( VISU_SCALAR_MAP ), -1, -1, -1 ); // scalar bar
+ aRule = aSel_One_ObjBr + " and type='VISU::TTIMESTAMP'";
mgr->setRule( action( VISU_SCALAR_MAP ), aRule, true );
- mgr->insert( action( VISU_ISO_SURFACES ), -1, -1, -1 ); // iso surface
mgr->setRule( action( VISU_ISO_SURFACES ), aRule, true );
- mgr->insert( action( VISU_CUT_PLANES ), -1, -1, -1 ); // cut planes
mgr->setRule( action( VISU_CUT_PLANES ), aRule, true );
- mgr->insert( action( VISU_CUT_LINES ), -1, -1, -1 ); // cut lines
mgr->setRule( action( VISU_CUT_LINES ), aRule, true );
aRule += " and nbComponents>1";
- mgr->insert( action( VISU_DEFORMED_SHAPE ), -1, -1, -1 ); // deformed shape
mgr->setRule( action( VISU_DEFORMED_SHAPE ), aRule, true );
- mgr->insert( action( VISU_VECTORS ), -1, -1, -1 ); // vectors
mgr->setRule( action( VISU_VECTORS ), aRule, true );
- mgr->insert( action( VISU_STREAM_LINES ), -1, -1, -1 ); // stream lines
mgr->setRule( action( VISU_STREAM_LINES ), aRule, true );
+ mgr->setRule( action( VISU_PLOT_3D ), aRule, true );
- aRule = "client='ObjectBrowser' and selcount=1 and type='VISU::TTABLE'";
- //mgr->insert( action( 4022 ), -1, -1, -1 ); // rename table
- //mgr->setRule( action( 4022 ), aRule, true );
- mgr->insert( action( VISU_SHOW_TABLE ), -1, -1, -1 ); // show table
+ // table commands
+ aRule = aSel_One_ObjBr + " and type='VISU::TTABLE'";
mgr->setRule( action( VISU_SHOW_TABLE ), aRule, true );
- mgr->insert( action( VISU_CREATE_CURVES ), -1, -1, -1 ); // create curves
mgr->setRule( action( VISU_CREATE_CURVES ), aRule, true );
- mgr->insert( action( VISU_EXPORT_TABLE ), -1, -1, -1 ); // export table
mgr->setRule( action( VISU_EXPORT_TABLE ), aRule, true );
- mgr->insert( separator(), -1, -1, -1 );
- aRule = "(client='ObjectBrowser' and selcount>0 and ((type='VISU::TTABLE' and nbChildren>0) "
- "or (type='VISU::TCURVE') or (type='VISU::TCONTAINER'))) "
- " or (selcount>0 and $type in {"
- "'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TISOSURFACE' 'VISU::TDEFORMEDSHAPE' "
- "'VISU::TCUTPLANES' 'VISU::TCUTLINES' 'VISU::TVECTORS' 'VISU::TSTREAMLINES'})";
- mgr->insert( action( VISU_ERASE ), -1, -1, -1 ); // erase
+
+ aRule = "(" + aSel_Some_ObjBr + " and ((type='VISU::TTABLE' and nbChildren>0) or"
+ " ($type in {'VISU::TCURVE' 'VISU::TCONTAINER'}))"
+ ") or (selcount>0 and $type in {'VISU::TMESH' " + aPrsAll + "})";
+
mgr->setRule( action( VISU_ERASE ), aRule + "and (isVisible=true)", true );// TODO: aRule.arg(" and isVisible=1"), true );
- mgr->insert( action( VISU_DISPLAY ), -1, -1, -1 ); // display
mgr->setRule( action( VISU_DISPLAY ), aRule + "and (isVisible=false)", true );// TODO: aRule.arg(" and isVisible=0"), true );
- mgr->insert( action( VISU_DISPLAY_ONLY ), -1, -1, -1 ); // display only
mgr->setRule( action( VISU_DISPLAY_ONLY ), aRule, true );
- /* aRule = "client='ObjectBrowser' and selcount=1 and $type in {'VISU::TTABLE' "
- "'VISU::TCURVE' 'VISU::TCONTAINER' 'VISU::TMESH' 'VISU::TSCALARMAP' "
- "'VISU::TISOSURFACE' 'VISU::TDEFORMEDSHAPE' 'VISU::TCUTPLANES' "
- "'VISU::TCUTLINES' 'VISU::TVECTORS' 'VISU::TSTREAMLINES'}";*/
- aRule = "selcount=1 and $type in {'VISU::TTABLE' "
- "'VISU::TCURVE' 'VISU::TCONTAINER' 'VISU::TMESH' 'VISU::TSCALARMAP' "
- "'VISU::TISOSURFACE' 'VISU::TDEFORMEDSHAPE' 'VISU::TCUTPLANES' "
- "'VISU::TCUTLINES' 'VISU::TVECTORS' 'VISU::TSTREAMLINES'}";
- mgr->insert( action( VISU_DELETE_PRS ), -1, -1, -1 ); // delete presentation
- mgr->setRule( action( VISU_DELETE_PRS ), aRule, true );
+ mgr->setRule( action( VISU_TRANSLATE_PRS ), aRule, true );
- // View parameters
- mgr->insert ( action( VISU_VIEW_PARAMS ), -1, -1, -1 ); // save view params
- //jfa tmp:mgr->setRule( action( 4046 ),"(client='VTKViewer' and selcount=0) or (selcount=1 and type='VISU::TVIEW3D')", true );
+ mgr->setRule( action( VISU_MERGE_SCALAR_BARS ), aRule, true );
+ mgr->setRule( action( VISU_FREE_SCALAR_BARS ), aRule, true );
+
+ //aRule = "selcount=1 and $type in {'VISU::TTABLE' 'VISU::TCURVE' "
+ // "'VISU::TCONTAINER' 'VISU::TMESH' " + aPrsAll + "}";
+ //mgr->setRule( action( VISU_DELETE_PRS ), aRule, true );
- mgr->setRule( action( VISU_VIEW_PARAMS ), "client='VTKViewer' and selcount=0", true ); //jfa tmp
- mgr->insert ( action( VISU_RESTORE_VIEW_PARAMS ), -1, -1, -1 ); // restore view params
+ // View parameters
+ //jfa tmp:aRule = "(client='VTKViewer' and selcount=0) or (selcount=1 and type='VISU::TVIEW3D')";
+ //jfa tmp:mgr->setRule( action( VISU_SAVE_VIEW_PARAMS ), aRule, true );
+ mgr->setRule( action( VISU_SAVE_VIEW_PARAMS ), "client='VTKViewer' and selcount=0", true ); //jfa tmp
mgr->setRule( action( VISU_RESTORE_VIEW_PARAMS ), "selcount=1 and type='VISU::TVIEW3D'", true );
- mgr->insert ( action( VISU_DELETE_VIEW_PARAMS ), -1, -1, -1 ); // delete view params
mgr->setRule( action( VISU_DELETE_VIEW_PARAMS ), "selcount=1 and type='VISU::TVIEW3D'", true );
+ mgr->setRule( action( VISU_ARRANGE_ACTORS ), "client='VTKViewer' and selcount=0", true );
+
// 3D presentations commands
- QString aPrsType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TISOSURFACE' 'VISU::TDEFORMEDSHAPE' "
- "'VISU::TCUTPLANES' 'VISU::TCUTLINES' 'VISU::TVECTORS' 'VISU::TSTREAMLINES'}";
+ QString aPrsType = " and $type in {'VISU::TMESH' " + aPrsAll + "}";
QString aInsideType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TDEFORMEDSHAPE'}";
QString aSurfType = " and $type in {'VISU::TMESH'}";
- QString aShrinkType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TISOSURFACE' 'VISU::TDEFORMEDSHAPE' "
- "'VISU::TCUTPLANES' 'VISU::TCUTLINES'}";
+ QString aShrinkType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TISOSURFACE' "
+ "'VISU::TDEFORMEDSHAPE' 'VISU::TCUTPLANES' 'VISU::TCUTLINES' 'VISU::TPLOT3D'}";
QString aLineType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TISOSURFACE' 'VISU::TDEFORMEDSHAPE' "
- "'VISU::TCUTPLANES' 'VISU::TCUTLINES' 'VISU::TSTREAMLINES'}";
- aRule = "selcount=1";
+ "'VISU::TCUTPLANES' 'VISU::TCUTLINES' 'VISU::TSTREAMLINES' 'VISU::TPLOT3D'}";
- int parentId = mgr->insert( tr( "MEN_REPRESENTATION" ), -1, -1 ); // "Representation" submenu
- mgr->insert( action( VISU_POINTS ), parentId, -1, -1 ); // points
- mgr->setRule( action( VISU_POINTS ), aRule + aPrsType +
- " and $representation in {'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::INSIDEFRAME' 'VISU::SURFACEFRAME'}", true );
- mgr->insert( action( VISU_WIREFRAME ), parentId, -1, -1 ); // wireframe
- mgr->setRule( action( VISU_WIREFRAME ), aRule + aPrsType +
- " and $representation in {'VISU::POINT' 'VISU::SHADED' 'VISU::INSIDEFRAME' 'VISU::SURFACEFRAME'}", true );
- mgr->insert( action( VISU_SURFACE ), parentId, -1, -1 ); // surface
- mgr->setRule( action( VISU_SURFACE ), aRule + aPrsType +
- " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::INSIDEFRAME' 'VISU::SURFACEFRAME'}", true );
- mgr->insert( action( VISU_INSIDEFRAME ), parentId, -1, -1 ); // insideframe
- mgr->setRule( action( VISU_INSIDEFRAME ), aRule + aInsideType +
- " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::SURFACEFRAME'}", true );
- mgr->insert( action( VISU_SURFACEFRAME ), parentId, -1, -1 ); // surfaceframe
- mgr->setRule( action( VISU_SURFACEFRAME ), aRule + aSurfType +
- " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::INSIDEFRAME'}", true );
- mgr->insert( action( VISU_SHRINK ), parentId, -1, -1 ); // shrink
- mgr->setRule( action( VISU_SHRINK ), aRule + aShrinkType + " and isShrunk=0", true );
- mgr->insert( action( VISU_UNSHRINK ), parentId, -1, -1 ); // unshrink
+ aRule = "selcount=1";
+ mgr->setRule( action( VISU_CLIPPING ), aRule + aPrsType, true );
+
+ // "Representation" submenu
+ QString aNotPoints = " and $representation in {'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::INSIDEFRAME' 'VISU::SURFACEFRAME'}";
+ QString aNotWirefr = " and $representation in {'VISU::POINT' 'VISU::SHADED' 'VISU::INSIDEFRAME' 'VISU::SURFACEFRAME'}";
+ QString aNotSurfac = " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::INSIDEFRAME' 'VISU::SURFACEFRAME'}";
+ QString aNotInside = " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::SURFACEFRAME'}";
+ QString aNotSurffr = " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::INSIDEFRAME'}";
+
+ mgr->setRule( action( VISU_POINTS ) , aRule + aPrsType + aNotPoints, true );
+ mgr->setRule( action( VISU_WIREFRAME ) , aRule + aPrsType + aNotWirefr, true );
+ mgr->setRule( action( VISU_SURFACE ) , aRule + aPrsType + aNotSurfac, true );
+ mgr->setRule( action( VISU_INSIDEFRAME ) , aRule + aInsideType + aNotInside, true );
+ mgr->setRule( action( VISU_SURFACEFRAME ), aRule + aSurfType + aNotSurffr, true );
+
+ mgr->setRule( action( VISU_SHRINK ) , aRule + aShrinkType + " and isShrunk=0", true );
mgr->setRule( action( VISU_UNSHRINK ), aRule + aShrinkType + " and isShrunk=1", true );
- parentId = mgr->insert( tr( "MEN_PROPERTIES" ), -1, -1 ); // "Properties" submenu
- mgr->insert( action( VISU_CELL_COLOR ), parentId, -1, -1 ); // cell color
+ // "Properties" submenu
mgr->setRule( action( VISU_CELL_COLOR ), aRule + " and type='VISU::TMESH' and representation='VISU::SURFACEFRAME'", true );
- mgr->insert( action( VISU_EDGE_COLOR ), parentId, -1, -1 ); // edge color
mgr->setRule( action( VISU_EDGE_COLOR ), aRule + " and type='VISU::TMESH' and representation='VISU::SURFACEFRAME'", true );
- mgr->insert( action( VISU_COLOR ), parentId, -1, -1 ); // color
mgr->setRule( action( VISU_COLOR ), aRule + " and ((type='VISU::TMESH'"
" and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::INSIDEFRAME'}) "
"or (type='VISU::TDEFORMEDSHAPE' and hasActor=1))", true );
- mgr->insert( action( VISU_OPACITY ), parentId, -1, -1 ); // opacity
mgr->setRule( action( VISU_OPACITY ), aRule + aShrinkType + " and hasActor=1", true );
- mgr->insert( action( VISU_LINE_WIDTH ), parentId, -1, -1 ); // line width
mgr->setRule( action( VISU_LINE_WIDTH ), aRule + aLineType + " and hasActor=1", true );
// rename command
- QString aCurveType = "$type in {'VISU::TTABLE' 'VISU::TCURVE' 'VISU::TCONTAINER'}";
- aPrsType = "$type in {'VISU::TSCALARMAP' 'VISU::TISOSURFACE' 'VISU::TDEFORMEDSHAPE' "
- "'VISU::TCUTPLANES' 'VISU::TCUTLINES' 'VISU::TVECTORS' 'VISU::TSTREAMLINES'}";
-
- aRule = "selcount=1 and (type=VISU::TVIEW3D or " + aCurveType + " or " + aPrsType + ")";
- mgr->insert ( action( VISU_RENAME ), -1, -1, -1 ); // rename
+ aRule = "selcount=1 and ($type in {'VISU::TVIEW3D' " + aCurveAll + " " + aPrsAll + "})";
mgr->setRule( action( VISU_RENAME ), aRule, true );
// copy presentation command
- aRule = "selcount=1 and " + aPrsType;
- mgr->insert ( action( VISU_COPY_PRS ), -1, -1, -1 ); // copy
+ aRule = "selcount=1 and ($type in {" + aPrsAll + "})";
mgr->setRule( action( VISU_COPY_PRS ), aRule, true );
// curve commands
aRule = "selcount=1 and type='VISU::TCURVE'";
- mgr->insert( action( VISU_CURVE_PROPS ), -1, -1, -1 ); // curve properties
mgr->setRule( action( VISU_CURVE_PROPS ), aRule, true );
// curve container commands
- aRule = "client='ObjectBrowser' and selcount=1 and type='VISU::TCONTAINER'";
- mgr->insert( action( VISU_EDIT_CONTAINER ), -1, -1, -1 ); // edit container
+ aRule = aSel_One_ObjBr + " and type='VISU::TCONTAINER'";
mgr->setRule( action( VISU_EDIT_CONTAINER ), aRule, true );
- //mgr->insert( action( 4043 ), -1, -1, -1 ); // rename container
- //mgr->setRule( action( 4043 ), aRule, true );
- mgr->insert( action( VISU_CLEAR_CONTAINER ), -1, -1, -1 ); // clear container
mgr->setRule( action( VISU_CLEAR_CONTAINER ), aRule, true );
- aRule = "selcount=1 and ";
- mgr->insert( action( VISU_EDIT_PRS ), -1, -1, -1 ); // edit prs
- mgr->setRule( action( VISU_EDIT_PRS ), aRule + aPrsType, true );
+ aRule = "selcount=1 and $type in {" + aPrsAll + "}";
+ mgr->setRule( action( VISU_EDIT_PRS ), aRule, true );
aRule = "selcount=1 and type='VISU::TCUTLINES' and nbNamedChildren=0";
- mgr->insert( action( VISU_CREATE_TABLE ), -1, -1, -1 ); // create table
mgr->setRule( action( VISU_CREATE_TABLE ), aRule, true );
- //aRule = "client='ObjectBrowser' and selcount=1 and type='VISU::TSCALARMAP'";
aRule = "selcount=1 and type='VISU::TSCALARMAP'";
- mgr->insert ( action( VISU_SWEEP ), -1, -1, -1 ); // sweep
mgr->setRule( action( VISU_SWEEP ), aRule, true );
// Selection info popup item
aRule = "client='ObjectBrowser' and selcount=1" + aInsideType;
- mgr->insert( action( VISU_SELECTION_INFO ), -1, -1, -1 ); // Selection info
mgr->setRule( action( VISU_SELECTION_INFO ), aRule, true );
aRule = "client='ObjectBrowser' and selcount>0 and $type in {'VISU::TFIELD'} and nbTimeStamps>1";
- mgr->insert( action( VISU_ANIMATION ), -1, -1, -1 ); // animation
mgr->setRule( action( VISU_ANIMATION ), aRule, true );
aRule = "client='ObjectBrowser' and $type in {'VISU::TENTITY' 'VISU::TFAMILY' 'VISU::TGROUP'}";
- mgr->insert( action( VISU_CREATE_PRS ), -1, -1, -1 ); // create presentation
mgr->setRule( action( VISU_CREATE_PRS ), aRule + " and selcount=1", true );
- mgr->insert( action( VISU_CREATE_MANY_PRS ), -1, -1, -1 ); // create presentations
mgr->setRule( action( VISU_CREATE_MANY_PRS ), aRule + " and selcount>1", true );
aRule = "client='ObjectBrowser' and type='MEDFIELD'";
- mgr->insert( action( VISU_IMPORT_MED ), -1, -1, -1 ); // import MED structure
mgr->setRule( action( VISU_IMPORT_MED ), aRule, true );
+
+ aRule = "client='ObjectBrowser' and selcount=1 and type='VISU::TANIMATION'";
+ mgr->setRule( action( VISU_SHOW_ANIMATION ), aRule, true );
}
//***************************************************************************
{
SalomeApp_Module::contextMenuPopup(theClient, theMenu, theTitle);
+ // Check multiple selection
+ if (IsRemovableSelected(this)) {
+ action( VISU_DELETE_OBJS )->addTo(theMenu);
+ }
+
+ // Check single selection
SalomeApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
SALOME_ListIO aListIO;
aSelectionMgr->selectedObjects(aListIO);
action( VISU_CREATE_CURVES )->addTo(theMenu);
action( VISU_EXPORT_TABLE )->addTo(theMenu);
theMenu->insertSeparator();
- action( VISU_DELETE )->addTo(theMenu);
+ //action( VISU_DELETE )->addTo(theMenu);
} else {
if (!CORBA::is_nil(anObject)) {
SALOME_MED::MED_var aMED = SALOME_MED::MED::_narrow(anObject);
action( VISU_IMPORT_MED )->addTo(theMenu);
} else {
_PTR(SObject) aSFather = SO->GetFather();
- _PTR(GenericAttribute) anAttr;
- aSFather->FindAttribute(anAttr, "AttributeName");
- _PTR(AttributeName) aName (anAttr);
- std::string aValue = aName->Value();
- if (strcmp(aValue.c_str(), "MEDFIELD") == 0)
- action( VISU_IMPORT_MED )->addTo(theMenu);
+ if (aSFather) {
+ _PTR(GenericAttribute) anAttr;
+ aSFather->FindAttribute(anAttr, "AttributeName");
+ if (anAttr) {
+ _PTR(AttributeName) aName (anAttr);
+ std::string aValue = aName->Value();
+ if (strcmp(aValue.c_str(), "MEDFIELD") == 0)
+ action( VISU_IMPORT_MED )->addTo(theMenu);
+ }
+ }
}
}
}
class SUIT_Desktop;
-namespace VISU{
- class ScalarMap_i;
+namespace VISU {
+ class Prs3d_i;
}
class VisuGUI: public SalomeApp_Module
virtual void initialize( CAM_Application* );
virtual void windows( QMap<int, int>& ) const;
virtual void viewManagers( QStringList& ) const;
+
virtual QString engineIOR() const;
virtual void studyActivated();
void OnCreateCutPlanes();
void OnCreateCutLines();
void OnCreateStreamLines();
+ void OnCreatePlot3D();
void OnCreateManyMesh();
void OnCreatePlot2dView();
void OnShowTable();
void OnCreateTable();
void OnDeleteObject();
+ void OnDeleteObjects();
void OnPlotData();
void OnCurveProperties();
void OnClearContainer();
void OnEditContainer();
+ void OnMergeScalarBars();
+ void OnFreeScalarBars();
+
void OnSaveViewParams();
void OnRestoreViewParams();
void OnDeleteViewParams();
void OnRename();
+ void OnClippingPlanes();
void OnSweep();
void OnTimeAnimation();
+ void OnShowAnimation();
void OnCopyPresentation();
void OnSelectionInfo();
- void OnScaling();
+ void OnTranslatePrs();
+ void OnArrangeActors();
+ void OnScaling();
+ void OnCubeAxes();
protected:
virtual SalomeApp_Selection* createSelection() const;
- void ErasePrs (CORBA::Object_ptr theObject, bool theUpdate = true);
- void ChangeRepresentation (VISU::PresentationType theType);
- void CreateMesh (const Handle(SALOME_InteractiveObject)& theIO);
-
private:
- void createActions();
- void createMenus();
- void createToolBars();
- void createPopupMenus();
+ void createActions();
+ void createMenus();
+ void createToolBars();
+ void createPopupMenus();
};
#endif
#ifndef VISUGUI_ACTIONSDEF
#define VISUGUI_ACTIONSDEF
-#define VISU_IMPORT_FROM_FILE 112
-#define VISU_EXPLORE_MED 113
-#define VISU_IMPORT_TABLE 199
+//#define VISU_IMPORT_FROM_FILE 112
+//#define VISU_EXPLORE_MED 113
+//#define VISU_IMPORT_MED 114
+//#define VISU_IMPORT_TABLE 199
+#define VISU_IMPORT_FROM_FILE 4002
+#define VISU_EXPLORE_MED 4003
+#define VISU_IMPORT_MED 4004
+#define VISU_IMPORT_TABLE 4005
#define VISU_SCALAR_MAP 4011
#define VISU_DEFORMED_SHAPE 4012
#define VISU_ISO_SURFACES 4014
#define VISU_CUT_PLANES 4015
#define VISU_STREAM_LINES 4016
-#define VISU_CUT_LINES 4018
-#define VISU_PLOT2D 4020
+#define VISU_CUT_LINES 4017
+#define VISU_PLOT2D 4018
+#define VISU_PLOT_3D 4019
#define VISU_DELETE 4021
+#define VISU_DELETE_OBJS 4022
+
#define VISU_SHOW_TABLE 4023
#define VISU_CREATE_CURVES 4024
#define VISU_EXPORT_TABLE 4025
#define VISU_EDIT_CONTAINER 4042
#define VISU_CLEAR_CONTAINER 4044
-#define VISU_VIEW_PARAMS 4046
+#define VISU_SAVE_VIEW_PARAMS 4046
#define VISU_RESTORE_VIEW_PARAMS 4047
#define VISU_DELETE_VIEW_PARAMS 4048
#define VISU_PARTIAL_SELECTION 4072
#define VISU_SCALING 4073
-#define VISU_IMPORT_MED 4074
+#define VISU_CUBE_AXES 4075
+#define VISU_CLIPPING 4077
+#define VISU_ARRANGE_ACTORS 4078
+#define VISU_TRANSLATE_PRS 4079
+#define VISU_MERGE_SCALAR_BARS 4080
+#define VISU_FREE_SCALAR_BARS 4081
+#define VISU_SHOW_ANIMATION 4082
#endif
--- /dev/null
+
+#include "VisuGUI_ClippingDlg.h"
+
+#include "VisuGUI.h"
+#include "VisuGUI_Tools.h"
+
+#include "VISU_Prs3d_i.hh"
+#include "VISU_Result_i.hh"
+
+#include "SalomeApp_SelectionMgr.h"
+
+#include "SVTK_ViewWindow.h"
+
+#include "SUIT_Session.h"
+#include "SUIT_Desktop.h"
+#include "SUIT_ResourceMgr.h"
+#include "SUIT_OverrideCursor.h"
+
+#include "SALOME_Actor.h"
+
+// QT Includes
+#include <qlabel.h>
+#include <qpushbutton.h>
+#include <qcombobox.h>
+#include <qcheckbox.h>
+#include <qlayout.h>
+#include <qgroupbox.h>
+#include <qvalidator.h>
+#include <qtabwidget.h>
+#include <qhbuttongroup.h>
+#include <qradiobutton.h>
+#include <qspinbox.h>
+
+// VTK Includes
+#include <vtkMath.h>
+#include <vtkCamera.h>
+#include <vtkRenderer.h>
+#include <vtkDataSet.h>
+#include <vtkDataSetMapper.h>
+#include <vtkImplicitFunction.h>
+#include <vtkPlaneSource.h>
+#include <vtkPolyData.h>
+#include <vtkUnstructuredGrid.h>
+
+// OCCT Includes
+#include <gp_Dir.hxx>
+
+using namespace std;
+
+namespace VISU {
+ float GetFloat (const QString& theValue, float theDefault)
+ {
+ if (theValue.isEmpty()) return theDefault;
+ SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
+ QString aValue = aResourceMgr->stringValue(theValue);
+ if (aValue.isEmpty()) return theDefault;
+ return aValue.toFloat();
+ }
+
+ void RenderViewWindow (SVTK_ViewWindow* vw)
+ {
+ if (vw) {
+//if (vw->getRenderer()->GetActors()->GetNumberOfItems() > 0) {
+ vw->getRenderer()->ResetCameraClippingRange();
+ vw->Repaint();
+//}
+ }
+ }
+
+ void RangeStepAndValidator (QtxDblSpinBox* theSpinBox, double min, double max,
+ double step, unsigned short decimals)
+ {
+ theSpinBox->setRange(min, max);
+ theSpinBox->setLineStep(step);
+ ((QDoubleValidator*)theSpinBox->validator())->setRange(min, max, decimals);
+ }
+};
+
+//=================================================================================
+//class : OrientedPlane
+//purpose :
+//=================================================================================
+class OrientedPlane: public vtkPlane
+{
+ SVTK_ViewWindow* myViewWindow;
+
+ vtkDataSetMapper* myMapper;
+
+public:
+ static OrientedPlane * New() {
+ return new OrientedPlane();
+ }
+ static OrientedPlane * New (SVTK_ViewWindow* vw) {
+ return new OrientedPlane(vw);
+ }
+ vtkTypeMacro(OrientedPlane, vtkPlane);
+
+
+ VISU::Orientation myOrientation;
+ float myDistance;
+ double myAngle[2];
+
+ vtkPlaneSource* myPlaneSource;
+ SALOME_Actor *myActor;
+
+ void SetOrientation(VISU::Orientation theOrientation) {myOrientation = theOrientation;}
+ VISU::Orientation GetOrientation() {return myOrientation;}
+
+ void SetDistance(float theDistance) {myDistance = theDistance;}
+ float GetDistance() {return myDistance;}
+
+ void ShallowCopy(OrientedPlane* theOrientedPlane){
+ SetNormal(theOrientedPlane->GetNormal());
+ SetOrigin(theOrientedPlane->GetOrigin());
+
+ myOrientation = theOrientedPlane->GetOrientation();
+ myDistance = theOrientedPlane->GetDistance();
+
+ myAngle[0] = theOrientedPlane->myAngle[0];
+ myAngle[1] = theOrientedPlane->myAngle[1];
+
+ myPlaneSource->SetNormal(theOrientedPlane->myPlaneSource->GetNormal());
+ myPlaneSource->SetOrigin(theOrientedPlane->myPlaneSource->GetOrigin());
+ myPlaneSource->SetPoint1(theOrientedPlane->myPlaneSource->GetPoint1());
+ myPlaneSource->SetPoint2(theOrientedPlane->myPlaneSource->GetPoint2());
+ }
+
+protected:
+ OrientedPlane(SVTK_ViewWindow* vw):
+ myOrientation(VISU::XY),
+ myDistance(0.5),
+ myViewWindow(vw)
+ {
+ Init();
+ myViewWindow->AddActor(myActor);
+ }
+
+ OrientedPlane():
+ myOrientation(VISU::XY),
+ myDistance(0.5),
+ myViewWindow(NULL)
+ {
+ Init();
+ }
+
+ void Init(){
+ myPlaneSource = vtkPlaneSource::New();
+
+ myAngle[0] = myAngle[1] = 0.0;
+
+ // Create and display actor
+ myMapper = vtkDataSetMapper::New();
+ myMapper->SetInput(myPlaneSource->GetOutput());
+
+ myActor = SALOME_Actor::New();
+ myActor->VisibilityOff();
+ myActor->PickableOff();
+ myActor->SetInfinitive(true);
+ myActor->SetMapper(myMapper);
+
+ vtkProperty* aProp = vtkProperty::New();
+ float anRGB[3];
+ anRGB[0] = VISU::GetFloat("SMESH:SettingsFillColorRed", 0)/255.;
+ anRGB[1] = VISU::GetFloat("SMESH:SettingsFillColorGreen", 170)/255.;
+ anRGB[2] = VISU::GetFloat("SMESH:SettingsFillColorBlue", 255)/255.;
+ aProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
+ aProp->SetOpacity(0.75);
+ myActor->SetProperty(aProp);
+ aProp->Delete();
+
+ vtkProperty* aBackProp = vtkProperty::New();
+ anRGB[0] = VISU::GetFloat("SMESH:SettingsBackFaceColorRed", 0)/255.;
+ anRGB[1] = VISU::GetFloat("SMESH:SettingsBackFaceColorGreen", 0)/255.;
+ anRGB[2] = VISU::GetFloat("SMESH:SettingsBackFaceColorBlue", 255)/255.;
+ aBackProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
+ aBackProp->SetOpacity(0.75);
+ myActor->SetBackfaceProperty(aBackProp);
+ aBackProp->Delete();
+ }
+
+ ~OrientedPlane()
+ {
+ if (myViewWindow)
+ myViewWindow->RemoveActor(myActor);
+
+ myActor->Delete();
+
+ myMapper->RemoveAllInputs();
+ myMapper->Delete();
+
+ myPlaneSource->UnRegisterAllOutputs();
+ myPlaneSource->Delete();
+ };
+
+private:
+ // Not implemented.
+ OrientedPlane(const OrientedPlane&);
+ void operator=(const OrientedPlane&);
+};
+
+struct TSetVisiblity {
+ TSetVisiblity(int theIsVisible): myIsVisible(theIsVisible){}
+ void operator()(VISU::TVTKPlane& theOrientedPlane){
+ theOrientedPlane->myActor->SetVisibility(myIsVisible);
+ }
+ int myIsVisible;
+};
+
+//=================================================================================
+// class : VisuGUI_ClippingDlg()
+// purpose :
+//
+//=================================================================================
+VisuGUI_ClippingDlg::VisuGUI_ClippingDlg (VisuGUI* theModule,
+ const char* name,
+ bool modal,
+ WFlags fl)
+ : QDialog(VISU::GetDesktop(theModule), name, modal, WStyle_Customize |
+ WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | WDestructiveClose),
+ mySelectionMgr(VISU::GetSelectionMgr(theModule)),
+ myVisuGUI(theModule)
+{
+ if (!name)
+ setName("VisuGUI_ClippingDlg");
+ setCaption(tr("TITLE"));
+ setSizeGripEnabled(TRUE);
+ QGridLayout* VisuGUI_ClippingDlgLayout = new QGridLayout(this);
+ VisuGUI_ClippingDlgLayout->setSpacing(6);
+ VisuGUI_ClippingDlgLayout->setMargin(11);
+
+ // Controls for selecting, creating, deleting planes
+ QGroupBox* GroupPlanes = new QGroupBox (this, "GroupPlanes");
+ GroupPlanes->setTitle(tr("GRP_PLANES"));
+ GroupPlanes->setColumnLayout(0, Qt::Vertical);
+ GroupPlanes->layout()->setSpacing(0);
+ GroupPlanes->layout()->setMargin(0);
+ QGridLayout* GroupPlanesLayout = new QGridLayout (GroupPlanes->layout());
+ GroupPlanesLayout->setAlignment(Qt::AlignTop);
+ GroupPlanesLayout->setSpacing(6);
+ GroupPlanesLayout->setMargin(11);
+
+ ComboBoxPlanes = new QComboBox (GroupPlanes, "ComboBoxPlanes");
+ GroupPlanesLayout->addWidget(ComboBoxPlanes, 0, 0);
+
+ QSpacerItem* spacerGP = new QSpacerItem (20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
+ GroupPlanesLayout->addItem(spacerGP, 0, 1);
+
+ buttonNew = new QPushButton (GroupPlanes, "buttonNew");
+ buttonNew->setText(tr("BUT_NEW"));
+ GroupPlanesLayout->addWidget(buttonNew, 0, 2);
+
+ buttonDelete = new QPushButton(GroupPlanes, "buttonDelete");
+ buttonDelete->setText(tr("BUT_DELETE"));
+ GroupPlanesLayout->addWidget(buttonDelete, 0, 3);
+
+ // Controls for defining plane parameters
+
+ // Tab pane
+ QGroupBox* GroupParameters = new QGroupBox(this, "GroupParameters");
+ GroupParameters->setTitle(tr("GRP_PARAMETERS"));
+ GroupParameters->setColumnLayout(0, Qt::Vertical);
+ GroupParameters->layout()->setSpacing(0);
+ GroupParameters->layout()->setMargin(0);
+ QGridLayout* GroupParametersLayout = new QGridLayout (GroupParameters->layout());
+ GroupParametersLayout->setAlignment(Qt::AlignTop);
+ GroupParametersLayout->setSpacing(6);
+ GroupParametersLayout->setMargin(11);
+
+ TabPane = new QTabWidget (GroupParameters);
+ TabPane->addTab(createParamsTab() , tr("TAB_NON_STRUCTURED"));
+ TabPane->addTab(createIJKParamsTab(), tr("TAB_IJK_STRUCTURED"));
+ GroupParametersLayout->addWidget(TabPane, 0, 0);
+
+ // "Show preview" and "Auto Apply" check boxes
+
+ PreviewCheckBox = new QCheckBox (tr("SHOW_PREVIEW_CHK"), this);
+ PreviewCheckBox->setChecked(true);
+
+ AutoApplyCheckBox = new QCheckBox (tr("AUTO_APPLY_CHK"), this);
+ AutoApplyCheckBox->setChecked(false);
+
+ // Controls for "Ok", "Apply" and "Close" button
+ QGroupBox* GroupButtons = new QGroupBox (this, "GroupButtons");
+ GroupButtons->setSizePolicy(QSizePolicy((QSizePolicy::SizeType)7,
+ (QSizePolicy::SizeType)0, 0, 0,
+ GroupButtons->sizePolicy().hasHeightForWidth()));
+ GroupButtons->setGeometry(QRect(10, 10, 281, 48));
+ //GroupButtons->setTitle(tr(""));
+ GroupButtons->setColumnLayout(0, Qt::Vertical);
+ GroupButtons->layout()->setSpacing(0);
+ GroupButtons->layout()->setMargin(0);
+ QGridLayout* GroupButtonsLayout = new QGridLayout (GroupButtons->layout());
+ GroupButtonsLayout->setAlignment(Qt::AlignTop);
+ GroupButtonsLayout->setSpacing(6);
+ GroupButtonsLayout->setMargin(11);
+ buttonCancel = new QPushButton (GroupButtons, "buttonCancel");
+ buttonCancel->setText(tr("BUT_CLOSE"));
+ buttonCancel->setAutoDefault(TRUE);
+ GroupButtonsLayout->addWidget(buttonCancel, 0, 3);
+ buttonApply = new QPushButton (GroupButtons, "buttonApply");
+ buttonApply->setText(tr("BUT_APPLY"));
+ buttonApply->setAutoDefault(TRUE);
+ GroupButtonsLayout->addWidget(buttonApply, 0, 1);
+ QSpacerItem* spacer_9 = new QSpacerItem (20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
+ GroupButtonsLayout->addItem(spacer_9, 0, 2);
+ buttonOk = new QPushButton (GroupButtons, "buttonOk");
+ buttonOk->setText(tr("BUT_OK"));
+ buttonOk->setAutoDefault(TRUE);
+ buttonOk->setDefault(TRUE);
+ GroupButtonsLayout->addWidget(buttonOk, 0, 0);
+
+ VisuGUI_ClippingDlgLayout->addMultiCellWidget(GroupPlanes, 0, 0, 0, 1);
+ VisuGUI_ClippingDlgLayout->addMultiCellWidget(GroupParameters, 1, 1, 0, 1);
+ VisuGUI_ClippingDlgLayout->addWidget(PreviewCheckBox, 2, 0);
+ VisuGUI_ClippingDlgLayout->addWidget(AutoApplyCheckBox, 2, 1);
+ VisuGUI_ClippingDlgLayout->addMultiCellWidget(GroupButtons, 3, 3, 0, 1);
+
+ // Initial state
+ VISU::RangeStepAndValidator(SpinBoxDistance, 0.0, 1.0, 0.01, 3);
+ VISU::RangeStepAndValidator(SpinBoxRot1, -180.0, 180.0, 1, 3);
+ VISU::RangeStepAndValidator(SpinBoxRot2, -180.0, 180.0, 1, 3);
+
+ ComboBoxOrientation->insertItem(tr("PARALLEL_XOY_COMBO_ITEM"));
+ ComboBoxOrientation->insertItem(tr("PARALLEL_YOZ_COMBO_ITEM"));
+ ComboBoxOrientation->insertItem(tr("PARALLEL_ZOX_COMBO_ITEM"));
+
+ SpinBoxDistance->setValue(0.5);
+
+ myPrs3d = 0;
+ myIsSelectPlane = false;
+ onSelectionChanged();
+
+ // signals and slots connections :
+ connect(ComboBoxPlanes, SIGNAL(activated(int)), this, SLOT(onSelectPlane(int)));
+ connect(buttonNew, SIGNAL(clicked()), this, SLOT(ClickOnNew()));
+ connect(buttonDelete, SIGNAL(clicked()), this, SLOT(ClickOnDelete()));
+ connect(ComboBoxOrientation, SIGNAL(activated(int)), this, SLOT(onSelectOrientation(int)));
+ connect(SpinBoxDistance, SIGNAL(valueChanged(double)), this, SLOT(SetCurrentPlaneParam()));
+ connect(SpinBoxRot1, SIGNAL(valueChanged(double)), this, SLOT(SetCurrentPlaneParam()));
+ connect(SpinBoxRot2, SIGNAL(valueChanged(double)), this, SLOT(SetCurrentPlaneParam()));
+ connect(ButtonGroupIJKAxis, SIGNAL(clicked(int)), this, SLOT(onIJKAxisChanged(int)));
+ connect(SpinBoxIJKIndex, SIGNAL(valueChanged(int)), this, SLOT(SetCurrentPlaneIJKParam()));
+ connect(CheckBoxIJKPlaneReverse, SIGNAL(toggled(bool)), this, SLOT(SetCurrentPlaneIJKParam()));
+ connect(TabPane, SIGNAL(currentChanged (QWidget*)), this, SLOT(onTabChanged(QWidget*)));
+
+ connect(PreviewCheckBox, SIGNAL(toggled(bool)), this, SLOT(OnPreviewToggle(bool)));
+ connect(AutoApplyCheckBox, SIGNAL(toggled(bool)), this, SLOT(ClickOnApply()));
+ connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk()));
+ connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel()));
+ connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply()));
+ connect(myVisuGUI, SIGNAL(SignalCloseAllDialogs()), this, SLOT(ClickOnOk()));
+ connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(onSelectionChanged()));
+ /* to close dialog if study frame change */
+ connect(myVisuGUI, SIGNAL(SignalStudyFrameChanged()), this, SLOT(ClickOnCancel()));
+
+ this->show();
+}
+
+//=================================================================================
+// function : ~VisuGUI_ClippingDlg()
+// purpose :
+//=================================================================================
+VisuGUI_ClippingDlg::~VisuGUI_ClippingDlg()
+{
+ // no need to delete child widgets, Qt does it all for us
+ std::for_each(myPlanes.begin(),myPlanes.end(),TSetVisiblity(false));
+ VISU::RenderViewWindow(VISU::GetViewWindow(myVisuGUI));
+}
+
+//=================================================================================
+// function : createParamsTab
+// purpose :
+//=================================================================================
+QWidget* VisuGUI_ClippingDlg::createParamsTab()
+{
+ QFrame* GroupParameters = new QFrame(this);
+ QGridLayout* GroupParametersLayout = new QGridLayout(GroupParameters);
+ GroupParametersLayout->setAlignment(Qt::AlignTop);
+ GroupParametersLayout->setSpacing(6);
+ GroupParametersLayout->setMargin(11);
+
+ TextLabelOrientation = new QLabel(GroupParameters, "TextLabelOrientation");
+ TextLabelOrientation->setText(tr("LBL_ORIENTATION"));
+ GroupParametersLayout->addWidget(TextLabelOrientation, 0, 0);
+
+ ComboBoxOrientation = new QComboBox(GroupParameters, "ComboBoxOrientation");
+ GroupParametersLayout->addWidget(ComboBoxOrientation, 0, 1);
+
+ TextLabelDistance = new QLabel(GroupParameters, "TextLabelDistance");
+ TextLabelDistance->setText(tr("LBL_DISTANCE"));
+ GroupParametersLayout->addWidget(TextLabelDistance, 1, 0);
+
+ SpinBoxDistance = new QtxDblSpinBox(GroupParameters, "SpinBoxDistance");
+ GroupParametersLayout->addWidget(SpinBoxDistance, 1, 1);
+
+ TextLabelRot1 = new QLabel(GroupParameters, "TextLabelRot1");
+ TextLabelRot1->setText(tr("LBL_ROTATION_YZ"));
+ GroupParametersLayout->addWidget(TextLabelRot1, 2, 0);
+
+ SpinBoxRot1 = new QtxDblSpinBox(GroupParameters, "SpinBoxRot1");
+ GroupParametersLayout->addWidget(SpinBoxRot1, 2, 1);
+
+ TextLabelRot2 = new QLabel(GroupParameters, "TextLabelRot2");
+ TextLabelRot2->setText(tr("LBL_ROTATION_XZ"));
+ GroupParametersLayout->addWidget(TextLabelRot2, 3, 0);
+
+ SpinBoxRot2 = new QtxDblSpinBox(GroupParameters, "SpinBoxRot2");
+ GroupParametersLayout->addWidget(SpinBoxRot2, 3, 1);
+
+ return GroupParameters;
+}
+
+//=================================================================================
+// function : createIJKParamsTab
+// purpose :
+//=================================================================================
+QWidget* VisuGUI_ClippingDlg::createIJKParamsTab()
+{
+ // tab layout
+ WidgetIJKTab = new QFrame(this);
+ QGridLayout* IJKParametersLayout = new QGridLayout(WidgetIJKTab);
+ IJKParametersLayout->setAlignment(Qt::AlignTop);
+ IJKParametersLayout->setSpacing(6);
+ IJKParametersLayout->setMargin(11);
+
+ // Axis group
+ ButtonGroupIJKAxis = new QHButtonGroup (tr("GRP_IJK_AXIS"), WidgetIJKTab);
+ new QRadioButton (tr("I_RADIO_BTN"), ButtonGroupIJKAxis); // 0
+ new QRadioButton (tr("J_RADIO_BTN"), ButtonGroupIJKAxis); // 1
+ new QRadioButton (tr("K_RADIO_BTN"), ButtonGroupIJKAxis); // 2
+ ButtonGroupIJKAxis->setButton(0);
+
+ // Index
+ TextLabelIJKIndex = new QLabel(WidgetIJKTab, "TextLabelIJKIndex");
+ TextLabelIJKIndex->setText(tr("LBL_IJK_INDEX"));
+ SpinBoxIJKIndex = new QSpinBox(WidgetIJKTab, "SpinBoxIJKIndex");
+
+ // Orientation
+ CheckBoxIJKPlaneReverse = new QCheckBox (tr("REVERSE_NORMAL_CHK"), WidgetIJKTab);
+ CheckBoxIJKPlaneReverse->setChecked(false);
+
+ IJKParametersLayout->addMultiCellWidget(ButtonGroupIJKAxis, 0, 0, 0, 1);
+ IJKParametersLayout->addWidget(TextLabelIJKIndex, 1, 0);
+ IJKParametersLayout->addWidget(SpinBoxIJKIndex, 1, 1);
+ IJKParametersLayout->addWidget(CheckBoxIJKPlaneReverse, 2, 0);
+
+ return WidgetIJKTab;
+}
+
+//=================================================================================
+// function : ClickOnApply()
+// purpose :
+//=================================================================================
+void VisuGUI_ClippingDlg::ClickOnApply()
+{
+ if (!myPrs3d)
+ return;
+
+ if (SVTK_ViewWindow* aViewWindow = VISU::GetViewWindow(myVisuGUI)) {
+ SUIT_OverrideCursor wc;
+
+ myPrs3d->RemoveAllClippingPlanes();
+
+ VISU::TPlanes::iterator anIter = myPlanes.begin();
+ for (;anIter != myPlanes.end();anIter++) {
+ OrientedPlane* anOrientedPlane = OrientedPlane::New(aViewWindow);
+ anOrientedPlane->ShallowCopy(anIter->GetPointer());
+ myPrs3d->AddClippingPlane(anOrientedPlane);
+ anOrientedPlane->Delete();
+ }
+
+ VISU::RenderViewWindow(aViewWindow);
+ }
+}
+
+//=================================================================================
+// function : ClickOnOk()
+// purpose :
+//=================================================================================
+void VisuGUI_ClippingDlg::ClickOnOk()
+{
+ ClickOnApply();
+ ClickOnCancel();
+}
+
+//=================================================================================
+// function : ClickOnCancel()
+// purpose :
+//=================================================================================
+void VisuGUI_ClippingDlg::ClickOnCancel()
+{
+ close();
+}
+
+//=================================================================================
+// function : onSelectionChanged()
+// purpose : Called when selection is changed
+//=================================================================================
+void VisuGUI_ClippingDlg::onSelectionChanged()
+{
+ if (SVTK_ViewWindow* aViewWindow = VISU::GetViewWindow(myVisuGUI)) {
+ Handle(SALOME_InteractiveObject) anIO;
+ CORBA::Object_var anObject = VISU::GetSelectedObj(myVisuGUI, &anIO);
+ if (CORBA::is_nil(anObject)) return;
+ PortableServer::ServantBase_var aServant = VISU::GetServant(anObject);
+ if (!aServant.in()) return;
+
+ myPrs3d = dynamic_cast<VISU::Prs3d_i*>(aServant.in());
+ if (myPrs3d) {
+ std::for_each(myPlanes.begin(),myPlanes.end(),TSetVisiblity(false));
+ myPlanes.clear();
+
+ float anOffset [3];
+ myPrs3d->GetOffset(anOffset);
+
+ vtkIdType anId = 0, anEnd = myPrs3d->GetNumberOfClippingPlanes();
+ for (; anId < anEnd; anId++) {
+ if (vtkImplicitFunction* aFunction = myPrs3d->GetClippingPlane(anId)) {
+ if (OrientedPlane* aPlane = OrientedPlane::SafeDownCast(aFunction)) {
+ OrientedPlane* anOrientedPlane = OrientedPlane::New(aViewWindow);
+ VISU::TVTKPlane aTVTKPlane(anOrientedPlane);
+ anOrientedPlane->Delete();
+ aTVTKPlane->ShallowCopy(aPlane);
+ aTVTKPlane->myActor->SetPosition(anOffset);
+ myPlanes.push_back(aTVTKPlane);
+ }
+ }
+ }
+
+ std::for_each(myPlanes.begin(),myPlanes.end(),
+ TSetVisiblity(PreviewCheckBox->isChecked()));
+ }
+
+ // enable/disable IJK tab
+ TabPane->setTabEnabled(WidgetIJKTab, isStructured());
+ Sinchronize();
+ VISU::RenderViewWindow(aViewWindow);
+ }
+}
+
+//=================================================================================
+// function : onSelectPlane()
+// purpose :
+//=================================================================================
+void VisuGUI_ClippingDlg::onSelectPlane(int theIndex)
+{
+ if (!myPrs3d || myPlanes.empty())
+ return;
+
+ OrientedPlane* aPlane = myPlanes[theIndex].GetPointer();
+
+ // Orientation
+ VISU::Orientation anOrientation = aPlane->GetOrientation();
+
+ // Rotations
+ double aRot[2] = {aPlane->myAngle[0], aPlane->myAngle[1]};
+
+ // Set plane parameters in the dialog
+ myIsSelectPlane = true;
+ setDistance(aPlane->GetDistance());
+ setRotation(aRot[0], aRot[1]);
+ int item = 0;
+ switch (anOrientation) {
+ case VISU::XY: item = 0; break;
+ case VISU::YZ: item = 1; break;
+ case VISU::ZX: item = 2; break;
+ }
+ ComboBoxOrientation->setCurrentItem(item);
+
+ bool isIJK = (TabPane->currentPage() == WidgetIJKTab);
+ if (isIJK)
+ setIJKByNonStructured();
+ else
+ onSelectOrientation(item);
+
+ myIsSelectPlane = false;
+}
+
+//=================================================================================
+// function : ClickOnNew()
+// purpose :
+//=================================================================================
+void VisuGUI_ClippingDlg::ClickOnNew()
+{
+ if (!myPrs3d)
+ return;
+
+ if (SVTK_ViewWindow* aViewWindow = VISU::GetViewWindow(myVisuGUI)) {
+ OrientedPlane* aPlane = OrientedPlane::New(aViewWindow);
+ VISU::TVTKPlane aTVTKPlane(aPlane);
+ myPlanes.push_back(aTVTKPlane);
+
+ float anOffset [3];
+ myPrs3d->GetOffset(anOffset);
+ aTVTKPlane->myActor->SetPosition(anOffset);
+
+ if (PreviewCheckBox->isChecked())
+ aTVTKPlane->myActor->VisibilityOn();
+
+ Sinchronize();
+ SetCurrentPlaneParam();
+ }
+}
+
+//=================================================================================
+// function : ClickOnDelete()
+// purpose :
+//=================================================================================
+void VisuGUI_ClippingDlg::ClickOnDelete()
+{
+ if (!myPrs3d || myPlanes.empty())
+ return;
+
+ int aPlaneIndex = ComboBoxPlanes->currentItem();
+
+ VISU::TPlanes::iterator anIter = myPlanes.begin() + aPlaneIndex;
+ anIter->GetPointer()->myActor->SetVisibility(false);
+ myPlanes.erase(anIter);
+
+ if(AutoApplyCheckBox->isChecked())
+ ClickOnApply();
+
+ Sinchronize();
+ if (SVTK_ViewWindow* aViewWindow = VISU::GetViewWindow(myVisuGUI))
+ VISU::RenderViewWindow(aViewWindow);
+}
+
+//=================================================================================
+// function : onSelectOrientation()
+// purpose :
+//=================================================================================
+void VisuGUI_ClippingDlg::onSelectOrientation(int theItem)
+{
+ if (myPlanes.empty())
+ return;
+
+ if (theItem == 0) {
+ TextLabelRot1->setText(tr("LBL_ROTATION_YZ"));
+ TextLabelRot2->setText(tr("LBL_ROTATION_XZ"));
+ }
+ else if (theItem == 1) {
+ TextLabelRot1->setText(tr("LBL_ROTATION_ZX"));
+ TextLabelRot2->setText(tr("LBL_ROTATION_YX"));
+ }
+ else if (theItem == 2) {
+ TextLabelRot1->setText(tr("LBL_ROTATION_XY"));
+ TextLabelRot2->setText(tr("LBL_ROTATION_ZY"));
+ }
+
+ if((QComboBox*)sender() == ComboBoxOrientation)
+ SetCurrentPlaneParam();
+}
+
+//=================================================================================
+// function : Sinchronize()
+// purpose : update control values according to plane selection
+//=================================================================================
+void VisuGUI_ClippingDlg::Sinchronize()
+{
+ int aNbPlanes = myPlanes.size();
+ ComboBoxPlanes->clear();
+
+ QString aName;
+ for (int i = 1; i<=aNbPlanes; i++) {
+ aName = QString(tr("PLANES_COMBO_ITEM_i")).arg(i);
+ ComboBoxPlanes->insertItem(aName);
+ }
+
+ int aPos = ComboBoxPlanes->count() - 1;
+ ComboBoxPlanes->setCurrentItem(aPos);
+
+ bool anIsControlsEnable = (aPos >= 0);
+ if (anIsControlsEnable) {
+ onSelectPlane(aPos);
+ } else {
+ ComboBoxPlanes->insertItem(tr("PLANES_COMBO_ITEM_no"));
+ SpinBoxRot1->setValue(0.0);
+ SpinBoxRot2->setValue(0.0);
+ SpinBoxDistance->setValue(0.5);
+ }
+
+ buttonDelete ->setEnabled(anIsControlsEnable);
+ buttonApply ->setEnabled(anIsControlsEnable);
+ PreviewCheckBox ->setEnabled(anIsControlsEnable);
+ AutoApplyCheckBox ->setEnabled(anIsControlsEnable);
+
+ ComboBoxOrientation ->setEnabled(anIsControlsEnable);
+ SpinBoxDistance ->setEnabled(anIsControlsEnable);
+ SpinBoxRot1 ->setEnabled(anIsControlsEnable);
+ SpinBoxRot2 ->setEnabled(anIsControlsEnable);
+
+ ButtonGroupIJKAxis ->setEnabled(anIsControlsEnable);
+ SpinBoxIJKIndex ->setEnabled(anIsControlsEnable);
+ CheckBoxIJKPlaneReverse->setEnabled(anIsControlsEnable);
+}
+
+//=================================================================================
+// function : setRotation()
+// purpose :
+//=================================================================================
+void VisuGUI_ClippingDlg::setRotation(const double theRot1, const double theRot2)
+{
+ SpinBoxRot1->setValue(theRot1);
+ SpinBoxRot2->setValue(theRot2);
+}
+
+//=================================================================================
+// function : SetCurrentPlaneParam()
+// purpose :
+//=================================================================================
+void VisuGUI_ClippingDlg::SetCurrentPlaneParam()
+{
+ if (myPlanes.empty() || myIsSelectPlane)
+ return;
+
+ int aCurPlaneIndex = ComboBoxPlanes->currentItem();
+
+ OrientedPlane* aPlane = myPlanes[aCurPlaneIndex].GetPointer();
+
+ float aNormal[3];
+ VISU::Orientation anOrientation;
+ float aDir[3][3] = {{0, 0, 0}, {0, 0, 0}};
+ {
+ static double aCoeff = vtkMath::Pi()/180.0;
+
+ float aRot[2] = {getRotation1(), getRotation2()};
+ aPlane->myAngle[0] = aRot[0];
+ aPlane->myAngle[1] = aRot[1];
+
+ float anU[2] = {cos(aCoeff*aRot[0]), cos(aCoeff*aRot[1])};
+ float aV[2] = {sqrt(1.0-anU[0]*anU[0]), sqrt(1.0-anU[1]*anU[1])};
+ aV[0] = aRot[0] > 0? aV[0]: -aV[0];
+ aV[1] = aRot[1] > 0? aV[1]: -aV[1];
+
+ switch (ComboBoxOrientation->currentItem()) {
+ case 0:
+ anOrientation = VISU::XY;
+
+ aDir[0][1] = anU[0];
+ aDir[0][2] = aV[0];
+
+ aDir[1][0] = anU[1];
+ aDir[1][2] = aV[1];
+
+ break;
+ case 1:
+ anOrientation = VISU::YZ;
+
+ aDir[0][2] = anU[0];
+ aDir[0][0] = aV[0];
+
+ aDir[1][1] = anU[1];
+ aDir[1][0] = aV[1];
+
+ break;
+ case 2:
+ anOrientation = VISU::ZX;
+
+ aDir[0][0] = anU[0];
+ aDir[0][1] = aV[0];
+
+ aDir[1][2] = anU[1];
+ aDir[1][1] = aV[1];
+
+ break;
+ }
+
+ vtkMath::Cross(aDir[1],aDir[0],aNormal);
+ vtkMath::Normalize(aNormal);
+ vtkMath::Cross(aNormal,aDir[1],aDir[0]);
+ }
+
+ aPlane->SetOrientation(anOrientation);
+ aPlane->SetDistance(getDistance());
+
+ myPrs3d->SetPlaneParam(aNormal, 1. - getDistance(), aPlane);
+
+ vtkDataSet* aDataSet = myPrs3d->GetInput();
+ float *aPnt = aDataSet->GetCenter();
+
+ float* anOrigin = aPlane->GetOrigin();
+ float aDel = aDataSet->GetLength()/2.0;
+
+ float aDelta[2][3] = {{aDir[0][0]*aDel, aDir[0][1]*aDel, aDir[0][2]*aDel},
+ {aDir[1][0]*aDel, aDir[1][1]*aDel, aDir[1][2]*aDel}};
+ float aParam, aPnt0[3], aPnt1[3], aPnt2[3];
+
+ float aPnt01[3] = {aPnt[0] - aDelta[0][0] - aDelta[1][0],
+ aPnt[1] - aDelta[0][1] - aDelta[1][1],
+ aPnt[2] - aDelta[0][2] - aDelta[1][2]};
+ float aPnt02[3] = {aPnt01[0] + aNormal[0],
+ aPnt01[1] + aNormal[1],
+ aPnt01[2] + aNormal[2]};
+ vtkPlane::IntersectWithLine(aPnt01,aPnt02,aNormal,anOrigin,aParam,aPnt0);
+
+ float aPnt11[3] = {aPnt[0] - aDelta[0][0] + aDelta[1][0],
+ aPnt[1] - aDelta[0][1] + aDelta[1][1],
+ aPnt[2] - aDelta[0][2] + aDelta[1][2]};
+ float aPnt12[3] = {aPnt11[0] + aNormal[0],
+ aPnt11[1] + aNormal[1],
+ aPnt11[2] + aNormal[2]};
+ vtkPlane::IntersectWithLine(aPnt11,aPnt12,aNormal,anOrigin,aParam,aPnt1);
+
+ float aPnt21[3] = {aPnt[0] + aDelta[0][0] - aDelta[1][0],
+ aPnt[1] + aDelta[0][1] - aDelta[1][1],
+ aPnt[2] + aDelta[0][2] - aDelta[1][2]};
+ float aPnt22[3] = {aPnt21[0] + aNormal[0],
+ aPnt21[1] + aNormal[1],
+ aPnt21[2] + aNormal[2]};
+ vtkPlane::IntersectWithLine(aPnt21,aPnt22,aNormal,anOrigin,aParam,aPnt2);
+
+ vtkPlaneSource* aPlaneSource = aPlane->myPlaneSource;
+ aPlaneSource->SetNormal(aNormal[0],aNormal[1],aNormal[2]);
+ aPlaneSource->SetOrigin(aPnt0[0],aPnt0[1],aPnt0[2]);
+ aPlaneSource->SetPoint1(aPnt1[0],aPnt1[1],aPnt1[2]);
+ aPlaneSource->SetPoint2(aPnt2[0],aPnt2[1],aPnt2[2]);
+
+ if (AutoApplyCheckBox->isChecked())
+ ClickOnApply();
+
+ if (SVTK_ViewWindow* vw = VISU::GetViewWindow(myVisuGUI))
+ VISU::RenderViewWindow(vw);
+}
+
+//=================================================================================
+// function : onTabChanged
+// purpose :
+//=================================================================================
+void VisuGUI_ClippingDlg::onTabChanged(QWidget* newTab)
+{
+ if (newTab == WidgetIJKTab) // IJK
+ setIJKByNonStructured();
+}
+
+//=================================================================================
+// function : SetCurrentPlaneIJKParam
+// purpose : set non structured parameters by IJK parameters
+//=================================================================================
+void VisuGUI_ClippingDlg::SetCurrentPlaneIJKParam()
+{
+ if (myPlanes.empty() || myIsSelectPlane || !WidgetIJKTab->isEnabled())
+ return;
+
+ VISU::Result_i* result = myPrs3d ? myPrs3d->GetResult() : 0;
+ if (!result)
+ return;
+
+ // get axis data
+ int i, axId = ButtonGroupIJKAxis->id (ButtonGroupIJKAxis->selected());
+ VISU::Result_i::TAxis axis = (VISU::Result_i::TAxis) axId;
+ gp_Dir dir;
+ const vector<float> * values =
+ result->GetAxisInfo(myPrs3d->GetMeshName(), axis, dir);
+ if (!values)
+ return;
+
+ // find distance;
+ int index = SpinBoxIJKIndex->value();
+ float distance = 0;
+ if (index < values->size())
+ distance = (*values)[ index ];
+
+ // find id of axis closest to dir
+ // 0 || X-Y - axis Z
+ // 1 || Y-Z - azis X
+ // 2 || Z-X - axiz Y
+ double cos[3] = { gp::DZ() * dir, gp::DX() * dir, gp::DY() * dir };
+ double maxCos = 0;
+ for (i = 0; i < 3; ++i) {
+ if (Abs(cos[ i ]) > Abs (maxCos)) {
+ maxCos = cos[ i ];
+ axId = i;
+ }
+ }
+ // find rotation angles
+ float angle[2];
+ int rotId[2] = {
+ (axId == 0) ? 2 : axId - 1,
+ (axId == 2) ? 0 : axId + 1
+ };
+ static double aCoeff = 180.0/vtkMath::Pi();
+ for (i = 0; i < 2; ++i) {
+ float cosin = cos[ rotId[ i ]];
+ if (maxCos < 0)
+ cosin = -cosin;
+ angle[ i ] = asin(cosin) * aCoeff;
+ if (maxCos < 0)
+ angle[ i ] += 180. * (angle[ i ] < 0 ? 1. : -1.);
+ }
+ if (CheckBoxIJKPlaneReverse->isChecked()) {
+ angle[ 0 ] += 180. * (angle[ 0 ] < 0 ? 1. : -1.);
+ distance = 1. - distance;
+ }
+ if (maxCos < 0)
+ distance = 1. - distance;
+
+ // set paramerets
+ myIsSelectPlane = true;
+ ComboBoxOrientation->setCurrentItem(axId);
+ setRotation(-angle[0], -angle[1]);
+ setDistance(distance);
+ myIsSelectPlane = false;
+
+ SetCurrentPlaneParam();
+}
+
+//=================================================================================
+// function : setIJKByNonStructured
+// purpose : convert current non structured parameters to structured ones
+//=================================================================================
+void VisuGUI_ClippingDlg::setIJKByNonStructured()
+{
+ if (!myPrs3d || myPlanes.empty() || !myPrs3d->GetResult())
+ return;
+
+ // get plane normal
+ int planeIndex = ComboBoxPlanes->currentItem();
+ OrientedPlane* plane = myPlanes[ planeIndex ].GetPointer();
+ vtkPlaneSource* planeSource = plane->myPlaneSource;
+ float * planeNormal = planeSource->GetNormal();
+ gp_Dir normal(planeNormal[0], planeNormal[1], planeNormal[2]);
+
+ // find a grid axis most co-directed with plane normal
+ // and cartesian axis most co-directed with plane normal
+ int i, maxAx = 0, gridAxId = 0;
+ gp_Dir dir, gridDir;
+ double maxDot = 0;
+ const vector<float> *curValues, *values = 0;
+ VISU::Result_i* result = myPrs3d->GetResult();
+ for (i = 0; i < 3; ++i) {
+ VISU::Result_i::TAxis axis = (VISU::Result_i::TAxis) i;
+ curValues = result->GetAxisInfo(myPrs3d->GetMeshName(), axis, dir);
+ if (curValues) {
+ double dot = normal * dir;
+ if (Abs(dot) > Abs(maxDot)) {
+ maxDot = dot;
+ gridDir = dir;
+ values = curValues;
+ gridAxId = i;
+ }
+ }
+ if (Abs (planeNormal[ maxAx ]) < Abs (planeNormal[ i ]))
+ maxAx = i;
+ }
+ gp_XYZ axDir(0,0,0);
+ axDir.SetCoord(maxAx + 1, 1.);
+
+ // find index value
+ double v = SpinBoxDistance->value();
+ // reverse value?
+ bool reverse = (normal * axDir < 0); // normal and axis are opposite
+ if (gridDir * axDir < 0) // grid dir and axis are opposite
+ reverse = !reverse;
+ if (reverse)
+ v = 1. - v;
+ for (i = 0; i < values->size(); ++i)
+ if ((*values)[ i ] > v)
+ break;
+ if (i == values->size())
+ --i;
+ if (i != 0 && (*values)[ i ] - v > v - (*values)[ i - 1])
+ --i;
+
+ // set control values
+ myIsSelectPlane = true;
+ CheckBoxIJKPlaneReverse->setChecked(normal * axDir < 0);
+ SpinBoxIJKIndex->setValue(i);
+ ButtonGroupIJKAxis->setButton(gridAxId);
+ onIJKAxisChanged(gridAxId); // update label and range of index
+ myIsSelectPlane = false;
+
+ SetCurrentPlaneIJKParam();
+}
+
+//=================================================================================
+// function : isStructured
+// purpose : return true if mesh is structured
+//=================================================================================
+bool VisuGUI_ClippingDlg::isStructured() const
+{
+ VISU::Result_i* result = myPrs3d ? myPrs3d->GetResult() : 0;
+ if (result) {
+ gp_Dir dir;
+ return result->GetAxisInfo(myPrs3d->GetMeshName(),
+ VISU::Result_i::AXIS_X,
+ dir);
+ }
+ return false;
+}
+
+//=================================================================================
+// function : onIJKAxisChanged
+// purpose : update Index range and call SetCurrentPlaneParam()
+//=================================================================================
+void VisuGUI_ClippingDlg::onIJKAxisChanged(int axisId)
+{
+ // set index range
+ int maxIndex = 0;
+ VISU::Result_i* result = myPrs3d ? myPrs3d->GetResult() : 0;
+ if (result) {
+ VISU::Result_i::TAxis axis = (VISU::Result_i::TAxis) axisId;
+ gp_Dir dir;
+ const vector<float> * indices = result->GetAxisInfo(myPrs3d->GetMeshName(),
+ axis, dir);
+ if (indices)
+ maxIndex = indices->size() - 1;
+ }
+ QString text = tr("LBL_IJK_INDEX_TO_arg").arg(maxIndex);
+ TextLabelIJKIndex->setText(text);
+ SpinBoxIJKIndex->setRange(0, maxIndex);
+
+ if (SpinBoxIJKIndex->value() > maxIndex)
+ SpinBoxIJKIndex->setValue(0);
+
+ SetCurrentPlaneIJKParam();
+}
+
+//=================================================================================
+// function : OnPreviewToggle()
+// purpose :
+//=================================================================================
+void VisuGUI_ClippingDlg::OnPreviewToggle (bool theIsToggled)
+{
+ std::for_each(myPlanes.begin(),myPlanes.end(),TSetVisiblity(theIsToggled));
+ if (SVTK_ViewWindow* vw = VISU::GetViewWindow(myVisuGUI))
+ VISU::RenderViewWindow(vw);
+}
--- /dev/null
+
+#ifndef DIALOGBOX_CLIPPING_H
+#define DIALOGBOX_CLIPPING_H
+
+#include "QtxDblSpinBox.h"
+
+// QT Includes
+#include <qdialog.h>
+#include <qtable.h>
+
+// VTK Includes
+#include <vtkSmartPointer.h>
+#include <vtkPlane.h>
+
+// STL Includes
+#include <vector>
+
+class QLabel;
+class QPushButton;
+class QTable;
+class QCheckBox;
+class QComboBox;
+class QHButtonGroup;
+class QSpinBox;
+class QTabWidget;
+
+class QtxDblSpinBox;
+
+class SalomeApp_SelectionMgr;
+
+class VisuGUI;
+
+class OrientedPlane;
+
+namespace VISU {
+ class Prs3d_i;
+
+ typedef vtkSmartPointer<OrientedPlane> TVTKPlane;
+ typedef std::vector<TVTKPlane> TPlanes;
+ enum Orientation {XY, YZ, ZX};
+};
+
+
+//=================================================================================
+// class : VisuGUI_ClippingDlg
+// purpose :
+//=================================================================================
+class VisuGUI_ClippingDlg : public QDialog
+{
+ Q_OBJECT
+
+public:
+ VisuGUI_ClippingDlg( VisuGUI* theModule,
+ const char* name = 0,
+ bool modal = false,
+ WFlags fl = 0 );
+
+ float getDistance() { return (float)SpinBoxDistance->value(); }
+ void setDistance(const float theDistance) { SpinBoxDistance->setValue(theDistance); }
+ double getRotation1() { return SpinBoxRot1->value(); }
+ double getRotation2() { return SpinBoxRot2->value(); }
+ void setRotation(const double theRot1, const double theRot2);
+ void Sinchronize();
+
+ ~VisuGUI_ClippingDlg();
+
+private:
+
+ SalomeApp_SelectionMgr* mySelectionMgr;
+
+ VisuGUI * myVisuGUI;
+ VISU::Prs3d_i * myPrs3d;
+ VISU::TPlanes myPlanes;
+
+ QComboBox* ComboBoxPlanes;
+ QPushButton* buttonNew;
+ QPushButton* buttonDelete;
+
+ QLabel* TextLabelOrientation;
+ QLabel* TextLabelDistance;
+ QLabel* TextLabelRot1;
+ QLabel* TextLabelRot2;
+
+ QTabWidget* TabPane;
+
+ QComboBox* ComboBoxOrientation;
+ QtxDblSpinBox* SpinBoxDistance;
+ QtxDblSpinBox* SpinBoxRot1;
+ QtxDblSpinBox* SpinBoxRot2;
+
+ QWidget* WidgetIJKTab;
+ QHButtonGroup* ButtonGroupIJKAxis;
+ QLabel* TextLabelIJKIndex;
+ QSpinBox* SpinBoxIJKIndex;
+ QCheckBox* CheckBoxIJKPlaneReverse;
+
+ QCheckBox* PreviewCheckBox;
+ QCheckBox* AutoApplyCheckBox;
+
+ QPushButton* buttonOk;
+ QPushButton* buttonCancel;
+ QPushButton* buttonApply;
+
+ bool myIsSelectPlane;
+
+protected:
+ QWidget* createParamsTab();
+ QWidget* createIJKParamsTab();
+ void setIJKByNonStructured();
+ bool isStructured() const;
+
+public slots:
+
+ void onSelectPlane(int theIndex);
+ void ClickOnNew();
+ void ClickOnDelete();
+ void onSelectOrientation(int theItem);
+ void SetCurrentPlaneParam();
+ void SetCurrentPlaneIJKParam();
+ void onIJKAxisChanged(int axis);
+ void onTabChanged(QWidget* newTab);
+ void onSelectionChanged();
+ void OnPreviewToggle(bool theIsToggled);
+ void ClickOnOk();
+ void ClickOnCancel();
+ void ClickOnApply();
+};
+
+#endif // DIALOGBOX_TRANSPARENCYDLG_H
--- /dev/null
+// VISU VISUGUI : GUI for SMESH component
+//
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//
+// File : VisuGUI_CubeAxesDlg.cxx
+// Author : Sergey LITONIN
+// Module : VISU
+
+#include "VisuGUI_CubeAxesDlg.h"
+
+#include "VisuGUI.h"
+#include "VisuGUI_Tools.h"
+#include "VisuGUI_FontWg.h"
+
+#include "SVTK_ViewWindow.h"
+#include "SVTK_CubeAxesActor2D.h"
+
+#include <qlayout.h>
+#include <qframe.h>
+#include <qpushbutton.h>
+#include <qtabwidget.h>
+#include <qcheckbox.h>
+#include <qgroupbox.h>
+#include <qlineedit.h>
+#include <qlabel.h>
+#include <qobjectlist.h>
+#include <qvalidator.h>
+
+#include <vtkAxisActor2D.h>
+#include <vtkTextProperty.h>
+
+/*!
+ * Class : AxisWg
+ * Description : Tab of dialog
+ */
+
+//=======================================================================
+// name : VisuGUI_AxisWg::AxisWg
+// Purpose : Constructor
+//=======================================================================
+VisuGUI_AxisWg::VisuGUI_AxisWg (QWidget* theParent)
+: QFrame(theParent)
+{
+ QValueList< QLabel* > aLabels;
+
+ // "Name" grp
+
+ myNameGrp = new QGroupBox(3, Qt::Vertical, tr("AXIS_NAME"), this);
+ myIsNameVisible = new QCheckBox(tr("IS_VISIBLE"), myNameGrp);
+
+ QHBox* aHBox = new QHBox(myNameGrp);
+ aHBox->setSpacing(5);
+ QLabel* aLabel = new QLabel(tr("NAME"), aHBox);
+ myAxisName = new QLineEdit(aHBox);
+ aLabels.append(aLabel);
+
+ aHBox = new QHBox(myNameGrp);
+ aHBox->setSpacing(5);
+ aLabel = new QLabel(tr("FONT"), aHBox);
+ myNameFont = new VisuGUI_FontWg(aHBox);
+ aLabels.append(aLabel);
+
+
+ // "Labels" grp
+
+ myLabelsGrp = new QGroupBox(4, Qt::Vertical, tr("LABELS"), this);
+ myIsLabelsVisible = new QCheckBox(tr("IS_VISIBLE"), myLabelsGrp);
+
+ aHBox = new QHBox(myLabelsGrp);
+ aHBox->setSpacing(5);
+ aLabel = new QLabel(tr("NUMBER"), aHBox);
+ myLabelNumber = new QLineEdit(aHBox);
+ myLabelNumber->setValidator(new QIntValidator(0, 25, this));
+ myLabelNumber->installEventFilter(this);
+ aLabels.append(aLabel);
+
+ aHBox = new QHBox(myLabelsGrp);
+ aHBox->setSpacing(5);
+ aLabel = new QLabel(tr("OFFSET"), aHBox);
+ myLabelOffset = new QLineEdit(aHBox);
+ aLabels.append(aLabel);
+
+ aHBox = new QHBox(myLabelsGrp);
+ aHBox->setSpacing(5);
+ aLabel = new QLabel(tr("FONT"), aHBox);
+ myLabelsFont = new VisuGUI_FontWg(aHBox);
+ aLabels.append(aLabel);
+
+ // "Tick marks" grp
+
+ myTicksGrp = new QGroupBox(2, Qt::Vertical, tr("TICK_MARKS"), this);
+ myIsTicksVisible = new QCheckBox(tr("IS_VISIBLE"), myTicksGrp);
+
+ aHBox = new QHBox(myTicksGrp);
+ aHBox->setSpacing(5);
+ aLabel = new QLabel(tr("LENGTH"), aHBox);
+ myTickLength = new QLineEdit(aHBox);
+ aLabels.append(aLabel);
+
+ // Layout
+
+ QVBoxLayout* aLay = new QVBoxLayout(this, 0, 5);
+ aLay->addWidget(myNameGrp);
+ aLay->addWidget(myLabelsGrp);
+ aLay->addWidget(myTicksGrp);
+
+ // init
+ myIsNameVisible->setChecked(true);
+ myIsLabelsVisible->setChecked(true);
+ myIsTicksVisible->setChecked(true);
+ updateControlState();
+
+ // Adjust label widths
+ QValueList< QLabel* >::iterator anIter;
+ int aMaxWidth = 0;
+ for (anIter = aLabels.begin(); anIter != aLabels.end(); anIter++)
+ aMaxWidth = QMAX(aMaxWidth, (*anIter)->sizeHint().width());
+ for (anIter = aLabels.begin(); anIter != aLabels.end(); anIter++)
+ (*anIter)->setFixedWidth(aMaxWidth);
+
+ // connect signals and slots
+ connect(myIsNameVisible, SIGNAL(stateChanged(int)), SLOT(onNameChecked()));
+ connect(myIsLabelsVisible, SIGNAL(stateChanged(int)), SLOT(onLabelsChecked()));
+ connect(myIsTicksVisible, SIGNAL(stateChanged(int)), SLOT(onTicksChecked()));
+}
+
+VisuGUI_AxisWg::~VisuGUI_AxisWg()
+{
+}
+
+void VisuGUI_AxisWg::updateControlState()
+{
+ onNameChecked();
+ onLabelsChecked();
+ onTicksChecked();
+}
+
+bool VisuGUI_AxisWg::eventFilter(QObject* o, QEvent* e)
+{
+ if (e->type() == QEvent::FocusOut) {
+ bool isOK = false;
+ int k = myLabelNumber->text().toInt(&isOK);
+ if (isOK && k > 25) myLabelNumber->setText("25");
+ }
+ return false;
+}
+
+//=======================================================================
+// name : VisuGUI_AxisWg::onNameChecked
+// Purpose :
+//=======================================================================
+void VisuGUI_AxisWg::setEnabled(QGroupBox* theGrp, const bool theState)
+{
+ QObjectList aChildren(*theGrp->children());
+ QObject* anObj;
+ for(anObj = aChildren.first(); anObj !=0; anObj = aChildren.next())
+ if (anObj !=0 && anObj->inherits("QHBox"))
+ ((QHBox*)anObj)->setEnabled(theState);
+}
+
+//=======================================================================
+// Labels : VisuGUI_AxisWg::onLabelsChecked
+// Purpose :
+//=======================================================================
+void VisuGUI_AxisWg::onLabelsChecked()
+{
+ setEnabled(myLabelsGrp, myIsLabelsVisible->isChecked());
+}
+
+//=======================================================================
+// Labels : VisuGUI_AxisWg::onTicksChecked
+// Purpose :
+//=======================================================================
+void VisuGUI_AxisWg::onTicksChecked()
+{
+ setEnabled(myTicksGrp, myIsTicksVisible->isChecked());
+}
+
+//=======================================================================
+// name : VisuGUI_AxisWg::onNameChecked
+// Purpose :
+//=======================================================================
+void VisuGUI_AxisWg::onNameChecked()
+{
+ setEnabled(myNameGrp, myIsNameVisible->isChecked());
+}
+
+//=======================================================================
+// name : VisuGUI_AxisWg::UseName
+// Purpose :
+//=======================================================================
+void VisuGUI_AxisWg::UseName(const bool toUse)
+{
+ myIsNameVisible->setChecked(toUse);
+}
+
+//=======================================================================
+// name : VisuGUI_AxisWg::SetName
+// Purpose :
+//================================================== =====================
+void VisuGUI_AxisWg::SetName(const QString& theName)
+{
+ myAxisName->setText(theName);
+}
+
+//=======================================================================
+// name : VisuGUI_AxisWg::SetNameFont
+// Purpose :
+//=======================================================================
+void VisuGUI_AxisWg::SetNameFont(const QColor& theColor,
+ const int theFont,
+ const bool theIsBold,
+ const bool theIsItalic,
+ const bool theIsShadow)
+{
+ myNameFont->SetData(theColor, theFont, theIsBold, theIsItalic, theIsShadow);
+}
+
+//=======================================================================
+// name : VisuGUI_AxisWg::SetNameFont
+// Purpose :
+//=======================================================================
+bool VisuGUI_AxisWg::ReadData(vtkAxisActor2D* theActor)
+{
+ if (theActor == 0)
+ return false;
+
+ // Name
+
+ bool useName = theActor->GetTitleVisibility();
+ QString aTitle(theActor->GetTitle());
+
+ QColor aTitleColor(255, 255, 255);
+ int aTitleFontFamily = VTK_ARIAL;
+ bool isTitleBold = false;
+ bool isTitleItalic = false;
+ bool isTitleShadow = false;
+
+ vtkTextProperty* aTitleProp = theActor->GetTitleTextProperty();
+ if (aTitleProp !=0)
+ {
+ float c[ 3 ];
+ aTitleProp->GetColor(c);
+ aTitleColor.setRgb((int)(c[ 0 ] * 255), (int)(c[ 1 ] * 255), (int)(c[ 2 ] * 255));
+ aTitleFontFamily = aTitleProp->GetFontFamily();
+ isTitleBold = aTitleProp->GetBold() ? true : false;
+ isTitleItalic = aTitleProp->GetItalic() ? true : false;
+ isTitleShadow = aTitleProp->GetShadow() ? true : false;
+ }
+
+ myIsNameVisible->setChecked(useName);
+ myAxisName->setText(aTitle);
+ myNameFont->SetData(aTitleColor, aTitleFontFamily, isTitleBold, isTitleItalic, isTitleShadow);
+
+ // Labels
+
+ bool useLabels = theActor->GetLabelVisibility();
+ int nbLabels = theActor->GetNumberOfLabels();
+ int anOffset = theActor->GetTickOffset();
+
+ QColor aLabelsColor(255, 255, 255);
+ int aLabelsFontFamily = VTK_ARIAL;
+ bool isLabelsBold = false;
+ bool isLabelsItalic = false;
+ bool isLabelsShadow = false;
+
+ vtkTextProperty* aLabelsProp = theActor->GetLabelTextProperty();
+ if (aLabelsProp !=0)
+ {
+ float c[ 3 ];
+ aLabelsProp->GetColor(c);
+ aLabelsColor.setRgb((int)(c[ 0 ] * 255), (int)(c[ 1 ] * 255), (int)(c[ 2 ] * 255));
+ aLabelsFontFamily = aLabelsProp->GetFontFamily();
+ isLabelsBold = aLabelsProp->GetBold() ? true : false;
+ isLabelsItalic = aLabelsProp->GetItalic() ? true : false;
+ isLabelsShadow = aLabelsProp->GetShadow() ? true : false;
+ }
+
+ myIsLabelsVisible->setChecked(useLabels);
+ myLabelNumber->setText(QString("%1").arg(nbLabels));
+ myLabelOffset->setText(QString("%1").arg(anOffset));
+ myLabelsFont->SetData(aLabelsColor, aLabelsFontFamily, isLabelsBold, isLabelsItalic, isLabelsShadow);
+
+ // Tick marks
+ bool useTickMarks = theActor->GetTickVisibility();
+ int aTickLength = theActor->GetTickLength();
+
+ myIsTicksVisible->setChecked(useTickMarks);
+ myTickLength->setText(QString("%1").arg(aTickLength));
+
+ return true;
+}
+
+//=======================================================================
+// name : VisuGUI_CubeAxesDlg::Apply
+// Purpose :
+//=======================================================================
+bool VisuGUI_AxisWg::Apply(vtkAxisActor2D* theActor)
+{
+ if (theActor == 0)
+ return false;
+
+ // Name
+
+ theActor->SetTitleVisibility(myIsNameVisible->isChecked() ? 1 : 0);
+ theActor->SetTitle(myAxisName->text().latin1());
+
+ QColor aTitleColor(255, 255, 255);
+ int aTitleFontFamily = VTK_ARIAL;
+ bool isTitleBold = false;
+ bool isTitleItalic = false;
+ bool isTitleShadow = false;
+
+ myNameFont->GetData(aTitleColor, aTitleFontFamily, isTitleBold, isTitleItalic, isTitleShadow);
+ vtkTextProperty* aTitleProp = theActor->GetTitleTextProperty();
+ if (aTitleProp)
+ {
+ aTitleProp->SetColor(aTitleColor.red() / 255.,
+ aTitleColor.green() / 255.,
+ aTitleColor.blue() / 255.);
+ aTitleProp->SetFontFamily(aTitleFontFamily);
+
+ aTitleProp->SetBold(isTitleBold ? 1 : 0);
+ aTitleProp->SetItalic(isTitleItalic ? 1 : 0);
+ aTitleProp->SetShadow(isTitleShadow ? 1 : 0);
+
+ theActor->SetTitleTextProperty(aTitleProp);
+ }
+
+ // Labels
+
+ theActor->SetLabelVisibility(myIsLabelsVisible->isChecked() ? 1 : 0);
+
+ bool isOk = false;
+ int nbLabels = myLabelNumber->text().toInt(&isOk);
+ if (isOk)
+ theActor->SetNumberOfLabels(nbLabels);
+
+ int anOffset = myLabelOffset->text().toInt(&isOk);
+ if (isOk)
+ theActor->SetTickOffset(anOffset);
+
+ QColor aLabelsColor(255, 255, 255);
+ int aLabelsFontFamily = VTK_ARIAL;
+ bool isLabelsBold = false;
+ bool isLabelsItalic = false;
+ bool isLabelsShadow = false;
+
+ myLabelsFont->GetData(aLabelsColor, aLabelsFontFamily, isLabelsBold, isLabelsItalic, isLabelsShadow);
+ vtkTextProperty* aLabelsProp = theActor->GetLabelTextProperty();
+ if (aLabelsProp)
+ {
+ aLabelsProp->SetColor(aLabelsColor.red() / 255.,
+ aLabelsColor.green() / 255.,
+ aLabelsColor.blue() / 255.);
+ aLabelsProp->SetFontFamily(aLabelsFontFamily);
+
+ aLabelsProp->SetBold(isLabelsBold ? 1 : 0);
+ aLabelsProp->SetItalic(isLabelsItalic ? 1 : 0);
+ aLabelsProp->SetShadow(isLabelsShadow ? 1 : 0);
+
+ aLabelsProp->Modified();
+ theActor->SetLabelTextProperty(aLabelsProp);
+ }
+
+
+ // Tick marks
+ theActor->SetTickVisibility(myIsTicksVisible->isChecked());
+ int aTickLength = myTickLength->text().toInt(&isOk);
+ if (isOk)
+ theActor->SetTickLength(aTickLength);
+
+ return true;
+}
+
+/*
+ Class : VisuGUI_CubeAxesDlg
+ Description : Dialog for specifynig cube axes properties
+*/
+
+//=======================================================================
+// name : VisuGUI_CubeAxesDlg::VisuGUI_CubeAxesDlg
+// Purpose : Constructor
+//=======================================================================
+VisuGUI_CubeAxesDlg::VisuGUI_CubeAxesDlg(QWidget* theParent)
+: QDialog(theParent, "VisuGUI_CubeAxesDlg", false,
+ WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | WDestructiveClose)
+{
+ setCaption(tr("CAPTION"));
+
+ QVBoxLayout* aLay = new QVBoxLayout(this, 5, 5);
+ aLay->addWidget(createMainFrame(this));
+ aLay->addWidget(createButtonFrame(this));
+
+ Init();
+
+//if (VISU::GetDesktop()->getMainFrame())
+// connect(VISU::GetDesktop()->getMainFrame(), SIGNAL(windowActivated(QWidget*)),
+// SLOT(onWindowActivated(QWidget*)));
+}
+
+//=======================================================================
+// name : VisuGUI_CubeAxesDlg::createMainFrame
+// Purpose : Create frame containing dialog's input fields
+//=======================================================================
+QWidget* VisuGUI_CubeAxesDlg::createMainFrame(QWidget* theParent)
+{
+ QFrame* aFrame = new QFrame(theParent);
+
+ myTabWg = new QTabWidget(aFrame);
+
+ myAxes[ 0 ] = new VisuGUI_AxisWg(myTabWg);
+ myAxes[ 1 ] = new VisuGUI_AxisWg(myTabWg);
+ myAxes[ 2 ] = new VisuGUI_AxisWg(myTabWg);
+
+ myTabWg->addTab(myAxes[ 0 ], tr("X_AXIS"));
+ myTabWg->addTab(myAxes[ 1 ], tr("Y_AXIS"));
+ myTabWg->addTab(myAxes[ 2 ], tr("Z_AXIS"));
+
+ myTabWg->setMargin(5);
+
+ myIsVisible = new QCheckBox(tr("IS_VISIBLE"), aFrame);
+
+ QVBoxLayout* aLay = new QVBoxLayout(aFrame, 0, 5);
+ aLay->addWidget(myTabWg);
+ aLay->addWidget(myIsVisible);
+
+ return aFrame;
+}
+
+//=======================================================================
+// name : VisuGUI_CubeAxesDlg::createButtonFrame
+// Purpose : Create frame containing buttons
+//=======================================================================
+QWidget* VisuGUI_CubeAxesDlg::createButtonFrame(QWidget* theParent)
+{
+ QFrame* aFrame = new QFrame(theParent);
+ aFrame->setFrameStyle(QFrame::Box | QFrame::Sunken);
+
+ myOkBtn = new QPushButton(tr("BUT_OK"), aFrame);
+ myApplyBtn = new QPushButton(tr("BUT_APPLY"), aFrame);
+ myCloseBtn = new QPushButton(tr("BUT_CLOSE"), aFrame);
+
+ QSpacerItem* aSpacer = new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum);
+
+ QHBoxLayout* aLay = new QHBoxLayout(aFrame, 5, 5);
+
+ aLay->addWidget(myOkBtn);
+ aLay->addWidget(myApplyBtn);
+ aLay->addItem(aSpacer);
+ aLay->addWidget(myCloseBtn);
+
+ connect(myOkBtn, SIGNAL(clicked()), SLOT(onOk()));
+ connect(myApplyBtn, SIGNAL(clicked()), SLOT(onApply()));
+ connect(myCloseBtn, SIGNAL(clicked()), SLOT(onClose()));
+
+ return aFrame;
+}
+
+//=======================================================================
+// name : VisuGUI_CubeAxesDlg::~VisuGUI_CubeAxesDlg
+// Purpose : Destructor
+//=======================================================================
+VisuGUI_CubeAxesDlg::~VisuGUI_CubeAxesDlg()
+{
+}
+
+//=======================================================================
+// name : VisuGUI_CubeAxesDlg::Init
+// Purpose : Init dialog fields, connect signals and slots, show dialog
+//=======================================================================
+bool VisuGUI_CubeAxesDlg::Init()
+{
+ SVTK_ViewWindow* aFrame = VISU::GetViewWindow();
+ if (aFrame == 0)
+ return false;
+
+ SVTK_CubeAxesActor2D* anActor = aFrame->GetCubeAxes();
+ if (anActor == 0)
+ return false;
+
+ myAxes[ 0 ]->ReadData(anActor->GetXAxisActor2D());
+ myAxes[ 1 ]->ReadData(anActor->GetYAxisActor2D());
+ myAxes[ 2 ]->ReadData(anActor->GetZAxisActor2D());
+
+ myIsVisible->setChecked(anActor->GetVisibility() ? true : false);
+
+ return true;
+
+}
+
+//=======================================================================
+// name : VisuGUI_CubeAxesDlg::isValid
+// Purpose : Verify validity of entry data
+//=======================================================================
+bool VisuGUI_CubeAxesDlg::isValid() const
+{
+ return true;
+}
+
+//=======================================================================
+// name : VisuGUI_CubeAxesDlg::onApply
+// Purpose : Verify validity of entry data
+//=======================================================================
+bool VisuGUI_CubeAxesDlg::onApply()
+{
+ bool isOk = true;
+
+ try
+ {
+ SVTK_ViewWindow* aFrame = VISU::GetViewWindow();
+ if (aFrame == 0)
+ return false;
+
+ SVTK_CubeAxesActor2D* anActor = aFrame->GetCubeAxes();
+ if (anActor == 0)
+ return false;
+
+ isOk = isOk && myAxes[ 0 ]->Apply(anActor->GetXAxisActor2D());
+ isOk = isOk && myAxes[ 1 ]->Apply(anActor->GetYAxisActor2D());
+ isOk = isOk && myAxes[ 2 ]->Apply(anActor->GetZAxisActor2D());
+
+
+ //anActor->SetXLabel(myAxes[ 0 ]->myAxisName->text());
+ //anActor->SetYLabel(myAxes[ 1 ]->myAxisName->text());
+ //anActor->SetZLabel(myAxes[ 2 ]->myAxisName->text());
+
+ //anActor->SetNumberOfLabels(anActor->GetXAxisActor2D()->GetNumberOfLabels());
+ if (myIsVisible->isChecked())
+ anActor->VisibilityOn();
+ else
+ anActor->VisibilityOff();
+
+ if (isOk)
+ aFrame->Repaint();
+ }
+ catch(...)
+ {
+ isOk = false;
+ }
+
+ return isOk;
+}
+
+//=======================================================================
+// name : VisuGUI_CubeAxesDlg::onOk
+// Purpose : SLOT called when "Ok" button pressed.
+//=======================================================================
+void VisuGUI_CubeAxesDlg::onOk()
+{
+ if (onApply())
+ onClose();
+}
+
+//=======================================================================
+// name : VisuGUI_CubeAxesDlg::onClose
+// Purpose : SLOT called when "Close" button pressed. Close dialog
+//=======================================================================
+void VisuGUI_CubeAxesDlg::onClose()
+{
+ reject();
+}
+
+//=======================================================================
+// name : VisuGUI_CubeAxesDlg::onClose
+// Purpose : SLOT called when "Close" button pressed. Close dialog
+//=======================================================================
+void VisuGUI_CubeAxesDlg::onWindowActivated (QWidget*)
+{
+ SVTK_ViewWindow* aFrame = VISU::GetViewWindow();
+ if (aFrame)
+ Init();
+ else
+ onClose();
+}
--- /dev/null
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//
+// File : VisuGUI_CubeAxesDlg.h
+// Author : Sergey LITONIN
+// Module : VISU
+
+
+#ifndef VisuGUI_CubeAxesDlg_H
+#define VisuGUI_CubeAxesDlg_H
+
+#include <qdialog.h>
+#include <qframe.h>
+
+class QWidget;
+class QFrame;
+class QPushButton;
+class QTabWidget;
+class QCheckBox;
+class QLineEdit;
+class VisuGUI_FontWg;
+class QGroupBox;
+class VisuGUI_AxisWg;
+class vtkAxisActor2D;
+
+/*!
+ * Class : VisuGUI_CubeAxesDlg
+ * Description : Dialog for specifynig cube axes properties
+ */
+class VisuGUI_CubeAxesDlg : public QDialog
+{
+ Q_OBJECT
+
+public:
+ VisuGUI_CubeAxesDlg( QWidget* );
+ virtual ~VisuGUI_CubeAxesDlg();
+
+ bool Init();
+
+private slots:
+ void onOk();
+ bool onApply();
+ void onClose();
+
+ void onWindowActivated( QWidget* );
+
+private:
+ QWidget* createButtonFrame( QWidget* );
+ QWidget* createMainFrame ( QWidget* );
+ bool isValid() const;
+
+private:
+ QTabWidget* myTabWg;
+ QCheckBox* myIsVisible;
+
+ QPushButton* myOkBtn;
+ QPushButton* myApplyBtn;
+ QPushButton* myCloseBtn;
+ VisuGUI_AxisWg* myAxes[ 3 ];
+};
+
+/*!
+ * Class : VisuGUI_AxisWg
+ * Description : Tab of dialog
+ */
+class VisuGUI_AxisWg : public QFrame
+{
+ Q_OBJECT
+
+public:
+ VisuGUI_AxisWg( QWidget* );
+ ~VisuGUI_AxisWg();
+
+ void UseName( const bool );
+ void SetName( const QString& );
+ void SetNameFont( const QColor&, const int, const bool, const bool, const bool );
+ bool ReadData( vtkAxisActor2D* );
+ bool Apply( vtkAxisActor2D* );
+
+protected:
+ bool eventFilter(QObject*, QEvent*);
+
+private slots:
+ void onNameChecked();
+ void onLabelsChecked();
+ void onTicksChecked();
+
+private:
+ void updateControlState();
+ void setEnabled( QGroupBox*, const bool );
+
+private:
+ // name
+ QGroupBox* myNameGrp;
+ QCheckBox* myIsNameVisible;
+ QLineEdit* myAxisName;
+ VisuGUI_FontWg* myNameFont;
+
+ // labels
+ QGroupBox* myLabelsGrp;
+ QCheckBox* myIsLabelsVisible;
+ QLineEdit* myLabelNumber;
+ QLineEdit* myLabelOffset;
+ VisuGUI_FontWg* myLabelsFont;
+
+ // tick marks
+ QGroupBox* myTicksGrp;
+ QCheckBox* myIsTicksVisible;
+ QLineEdit* myTickLength;
+
+ friend class VisuGUI_CubeAxesDlg;
+};
+
+#endif
void VisuGUI_CutLinesDlg::accept()
{
+ //if ( !VisuGUI::CheckActiveStudyLock() ) {
+ // reject();
+ // return;
+ //}
MYGenerateTable = myCreateTable->isChecked();
MYGenerateCurve = myCurvesCheck->isChecked();
// if (myScalarPane->check()) {
void VisuGUI_CutLinesDlg::reject()
{
/*jfa tmp:if (myIsCreation) {
- visuGUI->DeletePresentation(myPrs);
+ myPrs->RemoveFromStudy();
VisuGUI::application()->objectBrowser()->updateTree();
}*/
deletePlanes();
if (myPreviewActor != 0) return;
vtkAppendPolyData* aPolyData = myCutPlanes->GetCutPlanesPL()->GetAppendPolyData();
- vtkDataSetMapper* aPlaneMapper = vtkDataSetMapper::New();
if (!aPolyData->GetOutput()->GetNumberOfCells()) {
onPreviewCheck(false);
return;
}
+ vtkDataSetMapper* aPlaneMapper = vtkDataSetMapper::New();
aPlaneMapper->SetInput(aPolyData->GetOutput());
aPlaneMapper->ScalarVisibilityOff();
void VisuGUI_CutPlanesDlg::accept()
{
+ //if ( !VisuGUI::CheckActiveStudyLock() ) {
+ // reject();
+ // return;
+ //}
if (myScalarPane->check())
QDialog::accept();
}
--- /dev/null
+// VISU VISUGUI : GUI for SMESH component
+//
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//
+// File : VisuGUI_CubeAxesDlg.cxx
+// Author : Sergey LITONIN
+// Module : VISU
+
+#include "VisuGUI_FontWg.h"
+
+#include <qtoolbutton.h>
+#include <qcombobox.h>
+#include <qcolordialog.h>
+#include <qcheckbox.h>
+
+#include <vtkTextProperty.h>
+
+/*!
+ * Class : VisuGUI_FontWg
+ * Description : Dialog for specifynig font
+ */
+
+//=======================================================================
+// name : VisuGUI_FontWg
+// Purpose : Constructor
+//=======================================================================
+VisuGUI_FontWg::VisuGUI_FontWg( QWidget* theParent )
+: QHBox( theParent )
+{
+ setSpacing( 5 );
+ myColorBtn = new QToolButton( this );
+
+ myFamily = new QComboBox( this );
+ myFamily->insertItem( tr( "ARIAL" ) );
+ myFamily->insertItem( tr( "COURIER" ) );
+ myFamily->insertItem( tr( "TIMES" ) );
+
+ myBold = new QCheckBox( tr( "BOLD" ), this );
+ myItalic = new QCheckBox( tr( "ITALIC" ), this );
+ myShadow = new QCheckBox( tr( "SHADOW" ), this );
+
+ connect( myColorBtn, SIGNAL( clicked() ), SLOT( onColor() ) );
+}
+
+//=======================================================================
+// name : ~VisuGUI_FontWg
+// Purpose : Destructor
+//=======================================================================
+VisuGUI_FontWg::~VisuGUI_FontWg()
+{
+}
+
+//=======================================================================
+// name : SetColor
+// Purpose :
+//=======================================================================
+void VisuGUI_FontWg::SetColor( const QColor& theColor )
+{
+ myColorBtn->setPaletteBackgroundColor( theColor );
+}
+
+//=======================================================================
+// name : GetColor
+// Purpose :
+//=======================================================================
+QColor VisuGUI_FontWg::GetColor() const
+{
+ return myColorBtn->paletteBackgroundColor();
+}
+
+//=======================================================================
+// name : onColor
+// Purpose :
+//=======================================================================
+void VisuGUI_FontWg::onColor()
+{
+ QColor aColor = QColorDialog::getColor( GetColor(), this );
+ if ( aColor.isValid() )
+ SetColor( aColor );
+}
+
+//=======================================================================
+// name : SetData
+// Purpose :
+//=======================================================================
+void VisuGUI_FontWg::SetData( const QColor& theColor,
+ const int theFamily,
+ const bool theBold,
+ const bool theItalic,
+ const bool theShadow )
+{
+ SetColor( theColor );
+
+ if ( theFamily == VTK_ARIAL )
+ myFamily->setCurrentItem( 0 );
+ else if ( theFamily == VTK_COURIER )
+ myFamily->setCurrentItem( 1 );
+ else
+ myFamily->setCurrentItem( 2 );
+
+ myBold->setChecked( theBold );
+ myItalic->setChecked( theItalic );
+ myShadow->setChecked( theShadow );
+}
+
+//=======================================================================
+// name : GetData
+// Purpose :
+//=======================================================================
+void VisuGUI_FontWg::GetData( QColor& theColor,
+ int& theFamily,
+ bool& theBold,
+ bool& theItalic,
+ bool& theShadow ) const
+{
+ theColor = GetColor();
+
+ int anItem =myFamily->currentItem();
+ if ( anItem == 0 )
+ theFamily = VTK_ARIAL;
+ else if ( anItem == 1 )
+ theFamily = VTK_COURIER;
+ else
+ theFamily = VTK_TIMES;
+
+ theBold = myBold->isChecked();
+ theItalic = myItalic->isChecked();
+ theShadow = myShadow->isChecked();
+}
--- /dev/null
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//
+// File : VisuGUI_FontWg.h
+// Author : Sergey LITONIN
+// Module : VISU
+
+
+#ifndef VisuGUI_FontWg_H
+#define VisuGUI_FontWg_H
+
+#include <qhbox.h>
+
+class QToolButton;
+class QComboBox;
+class QCheckBox;
+class QColor;
+
+
+/*!
+ * Class : VisuGUI_FontWg
+ * Description : Dialog for specifynig font
+ */
+class VisuGUI_FontWg : public QHBox
+{
+ Q_OBJECT
+
+public:
+ VisuGUI_FontWg( QWidget* );
+ virtual ~VisuGUI_FontWg();
+
+ void SetColor( const QColor& );
+ QColor GetColor() const;
+
+ void SetData( const QColor&, const int, const bool, const bool, const bool );
+
+ void GetData( QColor&, int&, bool&, bool&, bool& ) const;
+
+private slots:
+ void onColor();
+
+private:
+ QToolButton* myColorBtn;
+ QComboBox* myFamily;
+ QCheckBox* myBold;
+ QCheckBox* myItalic;
+ QCheckBox* myShadow;
+};
+
+#endif
--- /dev/null
+
+#include "VisuGUI_OffsetDlg.h"
+
+#include "VisuGUI.h"
+#include "VisuGUI_Tools.h"
+
+#include "VISU_ViewManager_i.hh"
+#include "VISU_Actor.h"
+
+#include "SalomeApp_Application.h"
+#include "SVTK_ViewWindow.h"
+#include "SVTK_ViewModel.h"
+#include "SUIT_Desktop.h"
+
+#include "QtxDblSpinBox.h"
+
+// VTK Includes
+#include "vtkRenderer.h"
+
+// QT Includes
+#include <qhbox.h>
+#include <qlabel.h>
+#include <qlayout.h>
+#include <qcheckbox.h>
+#include <qgroupbox.h>
+#include <qpushbutton.h>
+
+
+#define MAXVAL 1e10
+
+
+VisuGUI_OffsetDlg::VisuGUI_OffsetDlg (VisuGUI* theModule)
+: QDialog(VISU::GetDesktop(theModule), 0, false, WStyle_Customize |
+ WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | WDestructiveClose),
+myModule(theModule)
+{
+ myPrsList.setAutoDelete(false);
+
+ setName("VisuGUI_OffsetDlg");
+ setCaption(tr("TIT_OFFSETDLG"));
+ setSizeGripEnabled(TRUE);
+
+ QVBoxLayout* TopLayout = new QVBoxLayout (this);
+ TopLayout->setSpacing(6);
+ TopLayout->setMargin(11);
+
+ QHBox* aOffsetsPane = new QHBox (this);
+ aOffsetsPane->setSpacing(6);
+
+ new QLabel ("dX:", aOffsetsPane);
+ myDxEdt = new QtxDblSpinBox (aOffsetsPane, "myDxEdt");
+ myDxEdt->setRange(-MAXVAL, MAXVAL);
+
+ new QLabel("dY:", aOffsetsPane);
+ myDyEdt = new QtxDblSpinBox (aOffsetsPane, "myDyEdt");
+ myDyEdt->setRange(-MAXVAL, MAXVAL);
+
+ new QLabel("dZ:", aOffsetsPane);
+ myDzEdt = new QtxDblSpinBox (aOffsetsPane, "myDzEdt");
+ myDzEdt->setRange(-MAXVAL, MAXVAL);
+
+ QPushButton* aResetBtn = new QPushButton(tr("BTN_RESET"), aOffsetsPane);
+ connect(aResetBtn, SIGNAL(clicked()), this, SLOT(onReset()));
+
+ TopLayout->addWidget(aOffsetsPane);
+
+ if (!VISU::GetCStudy(VISU::GetAppStudy(theModule))->GetProperties()->IsLocked()) {
+ mySaveChk = new QCheckBox ("Save to presentation", this);
+ TopLayout->addWidget(mySaveChk);
+ mySaveChk->setChecked(true);
+ } else {
+ mySaveChk = 0;
+ }
+
+ // Common buttons ===========================================================
+ QGroupBox* GroupButtons = new QGroupBox(this, "GroupButtons");
+ GroupButtons->setColumnLayout(0, Qt::Vertical);
+ GroupButtons->layout()->setSpacing(0);
+ GroupButtons->layout()->setMargin(0);
+ QGridLayout* GroupButtonsLayout = new QGridLayout(GroupButtons->layout());
+ GroupButtonsLayout->setAlignment(Qt::AlignTop);
+ GroupButtonsLayout->setSpacing(6);
+ GroupButtonsLayout->setMargin(11);
+
+ QPushButton* buttonOk = new QPushButton(tr("&OK"), GroupButtons, "buttonOk");
+ buttonOk->setAutoDefault(TRUE);
+ buttonOk->setDefault(TRUE);
+ GroupButtonsLayout->addWidget(buttonOk, 0, 0);
+ GroupButtonsLayout->addItem(new QSpacerItem(5, 5, QSizePolicy::Expanding, QSizePolicy::Minimum), 0, 1);
+
+ QPushButton* buttonApply = new QPushButton(tr("&Apply"), GroupButtons, "buttonApply");
+ buttonOk->setAutoDefault(TRUE);
+ GroupButtonsLayout->addWidget(buttonApply, 0, 2);
+ GroupButtonsLayout->addItem(new QSpacerItem(5, 5, QSizePolicy::Expanding, QSizePolicy::Minimum), 0, 3);
+
+ QPushButton* buttonCancel = new QPushButton(tr("&Cancel") , GroupButtons, "buttonCancel");
+ buttonCancel->setAutoDefault(TRUE);
+ GroupButtonsLayout->addWidget(buttonCancel, 0, 4);
+
+ TopLayout->addWidget(GroupButtons);
+
+ connect(buttonOk, SIGNAL(clicked()), this, SLOT(accept()));
+ connect(buttonApply, SIGNAL(clicked()), this, SLOT(onApply()));
+ connect(buttonCancel, SIGNAL(clicked()), this, SLOT(reject()));
+}
+
+void VisuGUI_OffsetDlg::addPresentation (VISU::Prs3d_i* thePrs)
+{
+ myPrsList.append(thePrs);
+ OffsetStruct aOffs;
+ thePrs->GetOffset(aOffs.myOffset);
+ myOldOffsets.append(aOffs);
+ if (myPrsList.count() == 1) {
+ setOffset(aOffs.myOffset);
+ } else if (myPrsList.count() == 2) {
+ float aOffset[3];
+ aOffset[0] = aOffset[1] = aOffset[2] = 0;
+ setOffset(aOffset);
+ }
+}
+
+void VisuGUI_OffsetDlg::setOffset (const float* theOffset)
+{
+ myDxEdt->setValue(theOffset[0]);
+ myDyEdt->setValue(theOffset[1]);
+ myDzEdt->setValue(theOffset[2]);
+}
+
+void VisuGUI_OffsetDlg::getOffset (float* theOffset) const
+{
+ theOffset[0] = myDxEdt->value();
+ theOffset[1] = myDyEdt->value();
+ theOffset[2] = myDzEdt->value();
+}
+
+void VisuGUI_OffsetDlg::onReset()
+{
+ myDxEdt->setValue(0);
+ myDyEdt->setValue(0);
+ myDzEdt->setValue(0);
+}
+
+bool VisuGUI_OffsetDlg::isToSave() const
+{
+ if (mySaveChk)
+ return mySaveChk->isChecked();
+ else
+ return false;
+}
+
+void VisuGUI_OffsetDlg::updateOffset (VISU::Prs3d_i* thePrs, float* theOffset)
+{
+ if (myPrsList.count() == 0) return;
+
+ if (isToSave()) thePrs->SetOffset(theOffset);
+
+ ViewManagerList aViewManagerList;
+ SalomeApp_Application* anApp = myModule->getApp();
+ anApp->viewManagers(SVTK_Viewer::Type(), aViewManagerList);
+ QPtrListIterator<SUIT_ViewManager> anVMIter (aViewManagerList);
+ for (; anVMIter.current(); ++anVMIter) {
+ SUIT_ViewManager* aViewManager = anVMIter.current();
+ QPtrVector<SUIT_ViewWindow> aViews = aViewManager->getViews();
+ for (int i = 0, iEnd = aViews.size(); i < iEnd; i++) {
+ if (SUIT_ViewWindow* aViewWindow = aViews.at(i)) {
+ if (SVTK_ViewWindow* vw = dynamic_cast<SVTK_ViewWindow*>(aViewWindow)) {
+ vw->onAdjustTrihedron();
+
+ if (VISU_Actor* anActor = VISU::GetActor(thePrs, vw)) {
+ anActor->SetPosition(theOffset);
+ vw->getRenderer()->ResetCameraClippingRange();
+ vw->Repaint();
+
+ Handle(SALOME_InteractiveObject) anIO;
+ CORBA::Object_var anObject = VISU::GetSelectedObj(myModule, &anIO);
+ if (!CORBA::is_nil(anObject))
+ vw->highlight(anIO, 1);
+ }
+ }
+ }
+ }
+ }
+}
+
+void VisuGUI_OffsetDlg::accept()
+{
+ float aOffset[3];
+ getOffset(aOffset);
+ for (int i = 0; i < myPrsList.count(); i++) {
+ updateOffset(myPrsList.at(i), aOffset);
+ }
+ QDialog::accept();
+}
+
+void VisuGUI_OffsetDlg::reject()
+{
+ for (int i = 0; i < myPrsList.count(); i++) {
+ updateOffset(myPrsList.at(i), myOldOffsets[i].myOffset);
+ }
+ QDialog::reject();
+}
+
+void VisuGUI_OffsetDlg::onApply()
+{
+ float aOffset[3];
+ getOffset(aOffset);
+ for (int i = 0; i < myPrsList.count(); i++) {
+ updateOffset(myPrsList.at(i), aOffset);
+ }
+}
--- /dev/null
+
+#ifndef DIALOGBOX_OFFSET_H
+#define DIALOGBOX_OFFSET_H
+
+#include "VISU_Prs3d_i.hh"
+
+// QT Includes
+#include <qdialog.h>
+#include <qptrlist.h>
+
+class QCheckBox;
+class QtxDblSpinBox;
+class VisuGUI;
+
+struct OffsetStruct {
+ float myOffset[3];
+};
+
+class VisuGUI_OffsetDlg: public QDialog
+{
+ Q_OBJECT
+ public:
+ VisuGUI_OffsetDlg (VisuGUI* theModule);
+ ~VisuGUI_OffsetDlg() {};
+
+ void addPresentation (VISU::Prs3d_i* thePrs);
+ int getPrsCount() const { return myPrsList.count(); }
+
+ void setOffset (const float* theOffset);
+ void getOffset (float* theOffset) const;
+ bool isToSave() const;
+
+ public slots:
+ void onReset();
+
+ protected slots:
+ virtual void accept();
+ virtual void reject();
+ void onApply();
+
+ private:
+ void updateOffset (VISU::Prs3d_i* thePrs, float* theOffset);
+
+ VisuGUI * myModule;
+
+ QtxDblSpinBox * myDxEdt;
+ QtxDblSpinBox * myDyEdt;
+ QtxDblSpinBox * myDzEdt;
+ QCheckBox * mySaveChk;
+
+ QPtrList<VISU::Prs3d_i> myPrsList;
+ QValueList<OffsetStruct> myOldOffsets;
+};
+
+#endif // DIALOGBOX_OFFSET_H
--- /dev/null
+// VISU VISUGUI : GUI of VISU component
+//
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//
+// File : VisuGUI_Plot3DDlg.cxx
+// Author : Laurent CORNABE & Hubert ROLLAND
+// Module : VISU
+// $Header$
+
+#include "VisuGUI_Plot3DDlg.h"
+
+#include "VisuGUI.h"
+#include "VisuGUI_Tools.h"
+
+#include "VISU_ViewManager_i.hh"
+#include "VISU_Plot3DPL.hxx"
+
+#include "SALOME_Actor.h"
+#include "SVTK_ViewWindow.h"
+
+#include <qlayout.h>
+#include <qvalidator.h>
+#include <qtabwidget.h>
+
+#include <vtkUnstructuredGrid.h>
+#include <vtkDataSetMapper.h>
+#include <vtkRenderer.h>
+#include <vtkPlaneSource.h>
+#include <vtkPolyData.h>
+#include <vtkMath.h>
+
+using namespace std;
+
+#define SURFACE_PRS_ID 0
+#define CONTOUR_PRS_ID 1
+
+//=======================================================================
+//function : renderViewFrame
+//purpose :
+//=======================================================================
+static void renderViewFrame (SVTK_ViewWindow* vw)
+{
+ if (vw) {
+//if (vw->getRenderer()->GetActors()->GetNumberOfItems() > 0) {
+ vw->getRenderer()->ResetCameraClippingRange();
+ vw->Repaint();
+//}
+ }
+}
+
+//=======================================================================
+//class : TPlane
+//purpose : actor of plane preview
+//=======================================================================
+class TPlane : public SALOME_Actor
+{
+ float mySize;
+ vtkDataSetMapper* myMapper;
+ vtkPlaneSource* myPlaneSource;
+
+ public:
+ // constructor
+ TPlane(float planeSize): mySize(planeSize)
+ {
+ Init();
+ }
+ // set plane parameters
+ void Set(float origin[3], float normal[3])
+ {
+ float point2[3], point1[3];
+ vtkMath::Perpendiculars(normal, point1, point2, 0.);
+ for (int i = 0; i < 3; ++i) {
+ point1[ i ] = point1[ i ] * mySize + origin[ i ];
+ point2[ i ] = point2[ i ] * mySize + origin[ i ];
+ }
+ myPlaneSource->SetOrigin(origin);
+ myPlaneSource->SetPoint1(point1);
+ myPlaneSource->SetPoint2(point2);
+ myPlaneSource->SetCenter(origin);
+ }
+ vtkTypeMacro(TPlane,SALOME_Actor);
+
+ protected:
+ void Init() {
+ myPlaneSource = vtkPlaneSource::New();
+ myMapper = vtkDataSetMapper::New();
+ myMapper->SetInput(myPlaneSource->GetOutput());
+ // actor methods
+ VisibilityOff();
+ PickableOff();
+ SetInfinitive(true);
+ SetOpacity(0.85);
+ SetMapper(myMapper);
+ }
+ ~TPlane() {
+ myMapper->RemoveAllInputs();
+ myMapper->Delete();
+ myPlaneSource->UnRegisterAllOutputs();
+ myPlaneSource->Delete();
+ };
+ // Not implemented.
+ TPlane(const TPlane&);
+ void operator=(const TPlane&);
+};
+
+//=======================================================================
+//function : VisuGUI_Plot3DPane
+//purpose :
+//=======================================================================
+VisuGUI_Plot3DPane::VisuGUI_Plot3DPane (QWidget* parent)
+ : QVBox(parent), myInitFromPrs(false), myPreviewActor(NULL),
+ myViewWindow(VISU::GetViewWindow()), myPrs(NULL), myPipeCopy(NULL)
+{
+ layout()->setAlignment(Qt::AlignTop);
+ setSpacing(6);
+
+ // Orientation
+
+ GBOrientation = new QButtonGroup (tr("Orientation"), this, "GBOrientation");
+ GBOrientation->setTitle(tr("ORIENTATION"));
+ GBOrientation->setColumnLayout(0, Qt::Vertical);
+ GBOrientation->layout()->setSpacing(0);
+ GBOrientation->layout()->setMargin(0);
+ QGridLayout* BGOrientationLayout = new QGridLayout (GBOrientation->layout());
+ BGOrientationLayout->setAlignment(Qt::AlignTop);
+ BGOrientationLayout->setSpacing(6);
+ BGOrientationLayout->setMargin(11);
+
+ QRadioButton *RBxy, *RByz, *RBzx;
+ RBxy = new QRadioButton (tr("// X-Y"), GBOrientation, "RBxy");
+ RByz = new QRadioButton (tr("// Y-Z"), GBOrientation, "RByz");
+ RBzx = new QRadioButton (tr("// Z-X"), GBOrientation, "RBzx");
+ BGOrientationLayout->addWidget(RBxy, 0, 0);
+ BGOrientationLayout->addWidget(RByz, 0, 1);
+ BGOrientationLayout->addWidget(RBzx, 0, 2);
+
+ // Rotation
+
+ QGroupBox* GBrot = new QGroupBox (tr("ROTATIONS"), this, "GBrot");
+ GBrot->setColumnLayout(0, Qt::Vertical);
+ GBrot->layout()->setSpacing(0);
+ GBrot->layout()->setMargin(0);
+ QGridLayout* GBrotLayout = new QGridLayout (GBrot->layout());
+ GBrotLayout->setAlignment(Qt::AlignTop);
+ GBrotLayout->setSpacing(6);
+ GBrotLayout->setMargin(11);
+ // label 1
+ LabelRot1 = new QLabel (tr("ROTATION_X"), GBrot, "LabelRot1");
+ GBrotLayout->addWidget(LabelRot1, 0, 0);
+ // spin 1
+ Rot1 = new QtxDblSpinBox (-180, 180, 5, GBrot);
+ Rot1->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed));
+ GBrotLayout->addWidget(Rot1, 0, 1);
+ // label 2
+ LabelRot2 = new QLabel (tr("ROTATION_Y"), GBrot, "LabelRot2");
+ GBrotLayout->addWidget(LabelRot2, 1, 0);
+ // spin 2
+ Rot2 = new QtxDblSpinBox (-180, 180, 5, GBrot);
+ Rot2->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed));
+ GBrotLayout->addWidget(Rot2, 1, 1);
+
+ // Position
+
+ QGroupBox* GBpos = new QGroupBox (tr("POSITION"), this, "GBpos");
+ GBpos->setColumnLayout(0, Qt::Horizontal);
+ GBpos->layout()->setSpacing(0);
+ GBpos->layout()->setMargin(0);
+ QGridLayout* GBposLayout = new QGridLayout (GBpos->layout());
+ GBposLayout->setAlignment(Qt::AlignTop);
+ GBposLayout->setSpacing(6);
+ GBposLayout->setMargin(11);
+ // value label
+ QLabel * valueLabel = new QLabel (tr("POSITION_VALUE"), GBpos, "LabelRot1");
+ GBposLayout->addWidget(valueLabel, 0, 0);
+ // value spin
+ PositionSpn = new QtxDblSpinBox (0, 1, 0.1, GBpos);
+ GBposLayout->addWidget(PositionSpn, 0, 1);
+ // Relative CheckBox
+ RelativeChkB = new QCheckBox (tr("RELATIVE"), GBpos, "RelativeChkB");
+ RelativeChkB->setChecked(true);
+ GBposLayout->addWidget(RelativeChkB, 0, 2);
+
+ // Scale, Presentation type, Nb Contours, Preview
+
+ QFrame* bottomFrame = new QFrame (this);
+ QGridLayout* bottomLayout = new QGridLayout (bottomFrame);
+ bottomLayout->setAlignment(Qt::AlignTop);
+ bottomLayout->setSpacing(11);
+ bottomLayout->setMargin(0);
+ // scale
+ QLabel* scaleLabel = new QLabel (tr("SCALE"), bottomFrame);
+ ScaleSpn = new QtxDblSpinBox (-1.e6, 1.e6, 0.1, bottomFrame);
+ // Presentation type
+ GBPrsType = new QHButtonGroup (tr("PRESENTATION_TYPE"), bottomFrame);
+ new QRadioButton (tr("SURFACE"), GBPrsType);
+ new QRadioButton (tr("CONTOUR"), GBPrsType);
+ // nb Contours
+ QLabel* nbContLabel = new QLabel (tr("NUMBER_CONTOURS"), bottomFrame);
+ NbContoursSpn = new QSpinBox (1, 999, 1, bottomFrame, "NbContoursSpn");
+ // Preview
+ PreviewChkB = new QCheckBox (tr("PREVIEW"), bottomFrame);
+ PreviewChkB->setChecked(false);
+
+ bottomLayout->addWidget(scaleLabel, 0, 0);
+ bottomLayout->addWidget(ScaleSpn, 0, 1);
+ bottomLayout->addMultiCellWidget(GBPrsType, 1, 1, 0, 1);
+ bottomLayout->addWidget(nbContLabel, 2, 0);
+ bottomLayout->addWidget(NbContoursSpn, 2, 1);
+ bottomLayout->addWidget(PreviewChkB, 3, 0);
+
+ // signals and slots connections
+ connect(GBOrientation, SIGNAL(clicked(int)), this, SLOT(orientationChanged(int)));
+ connect(Rot1, SIGNAL(valueChanged(double)), this, SLOT(updatePreview()));
+ connect(Rot2, SIGNAL(valueChanged(double)), this, SLOT(updatePreview()));
+ connect(PositionSpn, SIGNAL(valueChanged(double)), this, SLOT(onPositionSpn()));
+ connect(RelativeChkB, SIGNAL(toggled(bool)), this, SLOT(onRelativePos(bool)));
+ connect(GBPrsType, SIGNAL(clicked(int)), this, SLOT(onPrsType(int)));
+ connect(PreviewChkB, SIGNAL(toggled(bool)), this, SLOT(updatePreview()));
+}
+
+//=======================================================================
+//function : destructor
+//purpose :
+//=======================================================================
+VisuGUI_Plot3DPane::~VisuGUI_Plot3DPane()
+{
+}
+
+//=======================================================================
+//function : storePrsParams
+//purpose : create a copy of Prs parameters and then store current
+// control values into the Prs
+//=======================================================================
+void VisuGUI_Plot3DPane::storePrsParams()
+{
+ if (!myPipeCopy)
+ myPipeCopy = VISU_Plot3DPL::New();
+ if (myPrs) {
+ myPipeCopy->ShallowCopy(myPrs->GetPL());
+ storeToPrsObject(myPrs);
+ }
+}
+
+//=======================================================================
+//function : restorePrsParams
+//purpose : restore Prs parameters from the copy
+//=======================================================================
+void VisuGUI_Plot3DPane::restorePrsParams()
+{
+ if (!myPipeCopy)
+ myPipeCopy = VISU_Plot3DPL::New();
+ if (myPrs)
+ myPrs->GetPL()->ShallowCopy(myPipeCopy);
+}
+
+//=======================================================================
+//function : onPositionSpn
+//purpose : update absolute position range
+//=======================================================================
+void VisuGUI_Plot3DPane::onPositionSpn()
+{
+ if (myPrs && !RelativeChkB->isChecked()) {
+ float minPos, maxPos;
+ storePrsParams();
+ myPrs->GetPlot3DPL()->GetMinMaxPosition(minPos, maxPos);
+ restorePrsParams();
+ if (minPos > PositionSpn->value())
+ minPos = PositionSpn->value();
+ if (maxPos < PositionSpn->value())
+ maxPos = PositionSpn->value();
+ PositionSpn->setRange(minPos, maxPos);
+ }
+ updatePreview();
+}
+
+//=======================================================================
+//function : orientationChanged
+//purpose : update rotation labels and preview
+//=======================================================================
+void VisuGUI_Plot3DPane::orientationChanged(int Id)
+{
+ if (Id == 0) { // RBxy->isChecked()
+ LabelRot1->setText(tr("ROTATION_X"));
+ LabelRot2->setText(tr("ROTATION_Y"));
+ } else if (Id == 1) { // RByz->isChecked()
+ LabelRot1->setText(tr("ROTATION_Y"));
+ LabelRot2->setText(tr("ROTATION_Z"));
+ } else {
+ LabelRot1->setText(tr("ROTATION_Z"));
+ LabelRot2->setText(tr("ROTATION_X"));
+ }
+ updatePreview();
+}
+
+//=======================================================================
+//function : onRelativePos
+//purpose : update position value and range
+//=======================================================================
+void VisuGUI_Plot3DPane::onRelativePos(bool isRelativePos)
+{
+ float minPos = 0., maxPos = 1., pos = PositionSpn->value();
+ if (myPrs) {
+ storePrsParams();
+ myPrs->GetPlot3DPL()->GetMinMaxPosition(minPos, maxPos);
+ restorePrsParams();
+ if (isRelativePos) // absolute -> relative
+ pos = (pos - minPos) / (maxPos - minPos);
+ else // relative -> absolute
+ pos = minPos * (1. - pos) + maxPos * pos;
+ }
+ if (isRelativePos) {
+ minPos = 0.;
+ maxPos = 1.;
+ }
+ PositionSpn->setMinValue(minPos);
+ PositionSpn->setMaxValue(maxPos);
+ PositionSpn->setLineStep((maxPos - minPos) / 10.);
+ PositionSpn->setValue(pos);
+}
+
+//=======================================================================
+//function : onPrsType
+//purpose :
+//=======================================================================
+void VisuGUI_Plot3DPane::onPrsType(int id)
+{
+ NbContoursSpn->setEnabled(id == CONTOUR_PRS_ID);
+}
+
+//=======================================================================
+//function : updatePreview
+//purpose :
+//=======================================================================
+void VisuGUI_Plot3DPane::updatePreview()
+{
+ if (myInitFromPrs || !myPrs || !myViewWindow)
+ return;
+ bool fitall = false;
+ if (PreviewChkB->isChecked()) // place preview plane
+ {
+ // get plane preview actor
+ TPlane* planePreview = (TPlane*) myPreviewActor;
+ if (!planePreview) {
+ myPreviewActor = planePreview = new TPlane(myPrs->GetInput()->GetLength());
+ myViewWindow->AddActor(planePreview);
+ fitall = !VISU::GetActor(myPrs, myViewWindow);
+ }
+ // set plane parameters corresponding to control values
+ storePrsParams();
+ float normal[3], origin[3];
+ myPrs->GetPlot3DPL()->GetBasePlane(origin, normal, true);
+ planePreview->Set(origin, normal);
+ restorePrsParams();
+ }
+ if (myPreviewActor)
+ myPreviewActor->SetVisibility(PreviewChkB->isChecked());
+
+ renderViewFrame(myViewWindow);
+
+ if (fitall) {
+ myPreviewActor->SetInfinitive(false);
+ myViewWindow->onFitAll();
+ myPreviewActor->SetInfinitive(true);
+ }
+}
+
+//=======================================================================
+//function : initFromPrsObject
+//purpose :
+//=======================================================================
+void VisuGUI_Plot3DPane::initFromPrsObject(VISU::Plot3D_i* thePrs)
+{
+ myInitFromPrs = true;
+ myPrs = thePrs;
+
+ // orientation
+ int id;
+ switch (thePrs->GetOrientationType()) {
+ case VISU::Plot3D::XY: id = 0; break;
+ case VISU::Plot3D::YZ: id = 1; break;
+ default: id = 2;
+ }
+ GBOrientation->setButton(id);
+ orientationChanged(id);
+
+ // rotation
+ Rot1->setValue(thePrs->GetRotateX() * 180./PI);
+ Rot2->setValue(thePrs->GetRotateY() * 180./PI);
+
+ // position
+ RelativeChkB->setChecked(thePrs->IsPositionRelative());
+ onRelativePos(thePrs->IsPositionRelative()); // update range
+ PositionSpn->setValue(thePrs->GetPlanePosition());
+
+ // scale
+ ScaleSpn->setValue(thePrs->GetScaleFactor());
+
+ // prs type
+ id = thePrs->GetIsContourPrs() ? CONTOUR_PRS_ID : SURFACE_PRS_ID;
+ GBPrsType->setButton(id);
+ onPrsType(id);
+
+ // nb contours
+ NbContoursSpn->setValue(thePrs->GetNbOfContours());
+
+ // disable cutting plane controls if the mesh is planar
+
+ if (thePrs->GetPL()->IsPlanarInput())
+ {
+ GBOrientation->setEnabled(false);
+ Rot1 ->setEnabled(false);
+ Rot2 ->setEnabled(false);
+ PositionSpn ->setEnabled(false);
+ RelativeChkB ->setEnabled(false);
+ PreviewChkB ->setEnabled(false);
+ }
+
+ myInitFromPrs = false;
+ updatePreview();
+}
+
+//=======================================================================
+//function : storeToPrsObject
+//purpose :
+//=======================================================================
+int VisuGUI_Plot3DPane::storeToPrsObject(VISU::Plot3D_i* thePrs)
+{
+ if (myInitFromPrs)
+ return 0;
+ // orientation
+ int id = GBOrientation->id (GBOrientation->selected());
+ VISU::Plot3D::Orientation ori;
+ switch (id) {
+ case 0 : ori = VISU::Plot3D::XY; break;
+ case 1 : ori = VISU::Plot3D::YZ; break;
+ default: ori = VISU::Plot3D::ZX;
+ }
+ // rotation
+ thePrs->SetOrientation(ori, Rot1->value()*PI/180., Rot2->value()*PI/180.);
+
+ // position
+ thePrs->SetPlanePosition(PositionSpn->value(), RelativeChkB->isChecked());
+
+ // scale
+ thePrs->SetScaleFactor(ScaleSpn->value());
+
+ // prs type
+ id = GBPrsType->id (GBPrsType->selected());
+ thePrs->SetContourPrs(id == CONTOUR_PRS_ID);
+
+ // nb contours
+ thePrs->SetNbOfContours(NbContoursSpn->value());
+
+ return 1;
+}
+
+//=======================================================================
+//function : check
+//purpose :
+//=======================================================================
+bool VisuGUI_Plot3DPane::check()
+{
+ if (myPreviewActor && myViewWindow) // erase preview
+ {
+ myPreviewActor->SetVisibility(false);
+ myViewWindow->RemoveActor(myPreviewActor);
+ myPreviewActor->Delete();
+ myPreviewActor = 0;
+ }
+
+ return true;
+}
+
+//=======================================================================
+//function : Constructor
+//purpose :
+//=======================================================================
+VisuGUI_Plot3DDlg::VisuGUI_Plot3DDlg(QWidget* parent)
+ : QDialog(parent, "VisuGUI_Plot3DDlg", false, WStyle_Customize |
+ WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu)
+{
+ setCaption(tr("TITLE"));
+ setSizeGripEnabled(TRUE);
+
+ QVBoxLayout* TopLayout = new QVBoxLayout(this);
+ TopLayout->setSpacing(6);
+ TopLayout->setMargin(11);
+
+ QTabWidget* aTabBox = new QTabWidget (this);
+ myIsoPane = new VisuGUI_Plot3DPane (this);
+ myIsoPane->setMargin(5);
+ aTabBox->addTab(myIsoPane, tr("PLOT3D_TAB_TITLE"));
+ myScalarPane = new VisuGUI_ScalarBarPane (this, false);
+ myScalarPane->setMargin(5);
+ aTabBox->addTab(myScalarPane, tr("SCALAR_BAR_TAB_TITLE"));
+
+ TopLayout->addWidget(aTabBox);
+
+ QGroupBox* GroupButtons = new QGroupBox (this, "GroupButtons");
+ GroupButtons->setGeometry(QRect(10, 10, 281, 48));
+ GroupButtons->setColumnLayout(0, Qt::Vertical);
+ GroupButtons->layout()->setSpacing(0);
+ GroupButtons->layout()->setMargin(0);
+ QGridLayout* GroupButtonsLayout = new QGridLayout (GroupButtons->layout());
+ GroupButtonsLayout->setAlignment(Qt::AlignTop);
+ GroupButtonsLayout->setSpacing(6);
+ GroupButtonsLayout->setMargin(11);
+
+ QPushButton* buttonOk = new QPushButton (tr("&OK"), GroupButtons, "buttonOk");
+ buttonOk->setAutoDefault(TRUE);
+ buttonOk->setDefault(TRUE);
+ GroupButtonsLayout->addWidget(buttonOk, 0, 0);
+ GroupButtonsLayout->addItem(new QSpacerItem (5, 5, QSizePolicy::Expanding, QSizePolicy::Minimum), 0, 1);
+ QPushButton* buttonCancel = new QPushButton (tr("&Cancel") , GroupButtons, "buttonCancel");
+ buttonCancel->setAutoDefault(TRUE);
+ GroupButtonsLayout->addWidget(buttonCancel, 0, 2);
+
+ TopLayout->addWidget(GroupButtons);
+
+ // signals and slots connections
+ connect(buttonOk, SIGNAL(clicked()), this, SLOT(accept()));
+ connect(buttonCancel, SIGNAL(clicked()), this, SLOT(reject()));
+}
+
+//=======================================================================
+//function : accept
+//purpose :
+//=======================================================================
+void VisuGUI_Plot3DDlg::accept()
+{
+/*if (!VISU::CheckActiveStudyLock()) {
+ return;
+ }
+ if (myIsoPane->check() && myScalarPane->check()) {
+ if (!isModal()) {
+ VISU::Plot3D_i* prs = myIsoPane->GetPrs();
+ bool isCreation = !VISU::GetActor(prs, myViewWindow);
+ if (storeToPrsObject(prs)) {
+ if (isCreation) { // creation
+ if (myViewWindow) {
+ try {
+ VISU::CreateActor(prs);
+ }
+ catch (...) {
+ reject();
+ return;
+ }
+ myViewWindow->onFitAll();
+ }
+ } else { // edition
+ VISU::RecreateActor(prs);
+ renderViewFrame(myViewWindow);
+ }
+ } else {
+ if (isCreation) {
+ prs->RemoveFromStudy();
+ //study->updateObjBrowser();
+ }
+ }
+}*/
+ QDialog::accept();
+//}
+}
+
+//=======================================================================
+//function : reject
+//purpose :
+//=======================================================================
+void VisuGUI_Plot3DDlg::reject()
+{
+ myIsoPane->check(); // hide preview
+
+/*if (!isModal() && myIsoPane->GetPrs() &&
+ !VISU::GetActor(myIsoPane->GetPrs(), myViewWindow)) {
+ _PTR(Study) aStudy = VISU::GetCStudy(VISU::GetAppStudy(myModule));
+ if (!aStudy->GetProperties()->IsLocked()) {
+ myIsoPane->GetPrs()->RemoveFromStudy();
+ myIsoPane->GetStudyFrame()->getStudy()->updateObjBrowser();
+ }
+}*/
+ QDialog::reject();
+}
--- /dev/null
+// VISU VISUGUI : GUI of VISU component
+//
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//
+// File : VisuGUI_Plot3DDlg.h
+// Author : Laurent CORNABE & Hubert ROLLAND
+// Module : VISU
+// $Header$
+
+#ifndef VISUGUI_PLOT3D_H
+#define VISUGUI_PLOT3D_H
+
+#include "VisuGUI_ScalarBarDlg.h"
+
+#include "VISU_Plot3D_i.hh"
+
+#include <qhbuttongroup.h>
+
+namespace VISU {
+ class Plot3D_i;
+};
+
+class VISU_Plot3DPL;
+class SVTK_ViewWindow;
+class SALOME_Actor;
+class QtxDblSpinBox;
+
+class VisuGUI_Plot3DPane : public QVBox
+{
+ Q_OBJECT
+
+ public:
+ VisuGUI_Plot3DPane(QWidget* parent);
+ ~VisuGUI_Plot3DPane();
+
+ void initFromPrsObject (VISU::Plot3D_i* thePrs);
+ int storeToPrsObject (VISU::Plot3D_i* thePrs);
+
+ bool check();
+
+ VISU::Plot3D_i* GetPrs() { return myPrs; }
+
+ private:
+ bool myInitFromPrs;
+ SALOME_Actor* myPreviewActor;
+ SVTK_ViewWindow* myViewWindow;
+ VISU::Plot3D_i* myPrs;
+ VISU_Plot3DPL* myPipeCopy;
+
+ void storePrsParams();
+ void restorePrsParams();
+
+ QButtonGroup * GBOrientation;
+ QLabel * LabelRot1;
+ QLabel * LabelRot2;
+ QtxDblSpinBox * Rot1;
+ QtxDblSpinBox * Rot2;
+ QtxDblSpinBox * PositionSpn;
+ QCheckBox * RelativeChkB;
+ QtxDblSpinBox * ScaleSpn;
+ QHButtonGroup * GBPrsType;
+ QSpinBox * NbContoursSpn;
+ QCheckBox * PreviewChkB;
+
+ private slots:
+
+ void orientationChanged( int );
+ void onRelativePos( bool );
+ void onPrsType( int );
+ void onPositionSpn();
+ void updatePreview();
+};
+
+
+class VisuGUI_Plot3DDlg : public QDialog
+{
+ Q_OBJECT
+
+ public:
+ VisuGUI_Plot3DDlg (QWidget* parent);
+ ~VisuGUI_Plot3DDlg() {};
+
+ void initFromPrsObject (VISU::Plot3D_i* thePrs)
+ { myScalarPane->initFromPrsObject(thePrs); myIsoPane->initFromPrsObject(thePrs); }
+
+ int storeToPrsObject (VISU::Plot3D_i* thePrs)
+ { return myScalarPane->storeToPrsObject(thePrs) && myIsoPane->storeToPrsObject(thePrs); }
+
+ protected slots:
+ void accept();
+ void reject();
+
+ private:
+ VisuGUI_Plot3DPane* myIsoPane;
+ VisuGUI_ScalarBarPane* myScalarPane;
+};
+
+#endif // VISUGUI_PLOT3D_H
ENUM2STRING( aTypeStr, VISU::TCUTLINES )
ENUM2STRING( aTypeStr, VISU::TVECTORS )
ENUM2STRING( aTypeStr, VISU::TSTREAMLINES )
+ ENUM2STRING( aTypeStr, VISU::TPLOT3D )
+ ENUM2STRING( aTypeStr, VISU::TANIMATION )
}
}
else{
#include "VisuGUI_StreamLinesDlg.h"
#include "VisuGUI.h"
-//#include "VisuGUI_Selection.h"
#include "VISU_Mesh_i.hh"
#include "VISU_Gen_i.hh"
if (CORBA::is_nil(aResult)) {
SUIT_MessageBox::warn1(VisuGUI::application()->desktop(), tr("VISU_WARNING"),
tr("WRN_NO_AVAILABLE_DATA"),
- tr("VISU_BUT_OK"));
+ tr("BUT_OK"));
return VISU::Mesh::_nil();
}
SALOMEDSClient_ChildIterator* aIter = VisuGUI::GetStudyDocument()->NewChildIterator( mySelectionObj );
}catch(...){
SUIT_MessageBox::warn1 ( VisuGUI::application()->desktop(), tr("VISU_WARNING"),
tr("ERR_CANT_CREATE_ACTOR"),
- tr("VISU_BUT_OK") );
+ tr("BUT_OK") );
}
}
} else {
SUIT_MessageBox::warn1(VisuGUI::application()->desktop(), tr("VISU_WARNING"),
tr("ERR_CANT_BUILD_PRESENTATION"),
- tr("VISU_BUT_OK"));
+ tr("BUT_OK"));
}
return aMesh._retn();
*/
#include "VISU_Vectors_i.hh"
#include "VISU_StreamLines_i.hh"
+#include "VISU_ViewManager_i.hh"
+
#include "VISU_ScalarBarActor.hxx"
+#include "VISU_Actor.h"
+#include "SalomeApp_Study.h"
#include "SalomeApp_Application.h"
+#include "SVTK_ViewWindow.h"
+
#include "SUIT_OverrideCursor.h"
#include "SUIT_MessageBox.h"
#include "SUIT_Desktop.h"
#include "SUIT_FileDlg.h"
-#include <qlayout.h>
+#include <vtkRenderer.h>
+
#include <qhbox.h>
-#include <qhgroupbox.h>
+#include <qgrid.h>
+#include <qlayout.h>
+#include <qslider.h>
+#include <qthread.h>
+#include <qlistbox.h>
#include <qwt_wheel.h>
+#include <qhgroupbox.h>
#include <qlcdnumber.h>
-#include <qlistbox.h>
#include <qvgroupbox.h>
-#include <qthread.h>
-//static double MAXVALUE = 1.0E+300;
+#define MAXVAL 1e10
+
+
+ArrangeDlg::ArrangeDlg(QWidget* theParent, VISU_TimeAnimation* theAnimator)
+ : QDialog(theParent, "ArrangeDlg", true, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu),
+ myAnimator(theAnimator), myViewWindow(0)
+{
+ myCurrent = 0;
+ init();
+ QStringList aFieldNames;
+ // Find names of fields
+ for (int i = 0; i < theAnimator->getNbFields(); i++) {
+ aFieldNames.append(VISU::getValue(theAnimator->getFieldData(i).myField, "myName"));
+ Offset aOffs;
+ aOffs.myOffset[0] = myAnimator->getFieldData(i).myOffset[0];
+ aOffs.myOffset[1] = myAnimator->getFieldData(i).myOffset[1];
+ aOffs.myOffset[2] = myAnimator->getFieldData(i).myOffset[2];
+ myOffsets.append(aOffs);
+ }
+ myFieldLst->insertStringList(aFieldNames);
+ myFieldLst->setSelected(0, true);
+}
+ArrangeDlg::ArrangeDlg(QWidget* theParent, SVTK_ViewWindow* theViewWindow)
+ : QDialog(theParent, "ArrangeDlg", true, WStyle_Customize |
+ WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu),
+ myAnimator(0), myViewWindow(theViewWindow)
+{
+ myCurrent = 0;
+ init();
+ QStringList aPrsNames;
+ vtkActor* anActor;
+ vtkActorCollection *anActColl = myViewWindow->getRenderer()->GetActors();
+ for (anActColl->InitTraversal(); (anActor = anActColl->GetNextActor()) != NULL;) {
+ VISU_Actor* anVISUActor = dynamic_cast<VISU_Actor*>(anActor);
+ if (anVISUActor)
+ if (anVISUActor->GetVisibility() != 0) {
+ VISU::Prs3d_i* aPrs = anVISUActor->GetParent()->GetPrs3d();
+ if (aPrs) {
+ if (!myPrsMap.contains(aPrs)) {
+ SALOMEDS::SObject_var aSObject = aPrs->GetSObject();
+ if(!aSObject->_is_nil()){
+ SALOMEDS::GenericAttribute_var anAttr;
+ if (aSObject->FindAttribute(anAttr, "AttributeName")) {
+ SALOMEDS::AttributeName_var aName = SALOMEDS::AttributeName::_narrow(anAttr);
+ string aNam = aName->Value();
+ QString strIn(aNam.c_str());
+ aPrsNames.append(strIn);
+ myPrsMap[aPrs] = myOffsets.count();
+ Offset aOffs;
+ anVISUActor->GetPosition(aOffs.myOffset);
+ myOffsets.append(aOffs);
+ }
+ }
+ }
+ }
+ }
+ }
+ myFieldLst->insertStringList(aPrsNames);
+ myFieldLst->setSelected(0, true);
+}
+
+void ArrangeDlg::init()
+{
+ setCaption("Arrange Presentations");
+ setSizeGripEnabled( TRUE );
+
+ QVBoxLayout* aMainLayout = new QVBoxLayout(this, 7, 6);
+ aMainLayout->setSpacing(5);
+
+ QButtonGroup* aBtnGrp = new QButtonGroup(2, Qt::Horizontal, this);
+ aBtnGrp->setExclusive(true);
+ aMainLayout->addWidget(aBtnGrp);
+
+ QRadioButton* aAutoBtn = new QRadioButton("Auto", aBtnGrp);
+ aBtnGrp->insert(aAutoBtn, AutoMode);
+
+ QRadioButton* aManualBtn = new QRadioButton("Manual", aBtnGrp);
+ aBtnGrp->insert(aManualBtn, ManualMode);
+ aBtnGrp->setButton(AutoMode);
+
+ myStackWgt = new QWidgetStack(this);
+ aMainLayout->addWidget(myStackWgt);
+
+ // AUTO Pane
+ QVBox* aAutoPane = new QVBox(myStackWgt);
+ aAutoPane->setSpacing(5);
+ // Axis Group
+ myAxisGrp = new QButtonGroup(3, Qt::Horizontal,"Axis", aAutoPane);
+
+ QRadioButton* aXBtn = new QRadioButton("X",myAxisGrp );
+ myAxisGrp->insert(aXBtn, XAxis);
+
+ QRadioButton* aYBtn = new QRadioButton("Y",myAxisGrp );
+ myAxisGrp->insert(aYBtn, YAxis);
+
+ QRadioButton* aZBtn = new QRadioButton("Z",myAxisGrp );
+ myAxisGrp->insert(aZBtn, ZAxis);
+
+ myAxisGrp->setButton(XAxis);
+
+ //Distance Input
+ QHBox* aDistPane = new QHBox(aAutoPane);
+ aDistPane->setSpacing(5);
+ new QLabel("Relative Distance", aDistPane);
+ myDistVal = new QtxDblSpinBox (-10,10, 0.5, aDistPane);
+ myDistVal->setValue(1);
+
+ myStackWgt->addWidget(aAutoPane, AutoMode);
+
+ // Manual Pane
+ QHBox* aManualPane = new QHBox(myStackWgt);
+ aManualPane->setSpacing(10);
+
+ myFieldLst = new QListBox(aManualPane);
+ connect( myFieldLst, SIGNAL( highlighted(int) ),
+ this, SLOT( onFieldChange(int) ) );
+
+ QGrid* aCoordPane = new QGrid(2, aManualPane);
+ aCoordPane->setSpacing(5);
+
+ new QLabel("X", aCoordPane);
+ myCoord[0] = new QtxDblSpinBox(aCoordPane);
+ myCoord[0]->setRange(-MAXVAL, MAXVAL);
+
+ new QLabel("Y", aCoordPane);
+ myCoord[1] = new QtxDblSpinBox(aCoordPane);
+ myCoord[1]->setRange(-MAXVAL, MAXVAL);
+
+ new QLabel("Z", aCoordPane);
+ myCoord[2] = new QtxDblSpinBox(aCoordPane);
+ myCoord[2]->setRange(-MAXVAL, MAXVAL);
+
+ myStackWgt->addWidget(aManualPane, ManualMode);
+
+ myStackWgt->raiseWidget(AutoMode);
+
+ connect(aBtnGrp, SIGNAL(clicked(int)), myStackWgt, SLOT(raiseWidget(int)) );
+
+ SUIT_Study* aSUITStudy = myViewWindow->getViewManager()->study();
+ SalomeApp_Study* anAppStudy = dynamic_cast<SalomeApp_Study*>(aSUITStudy);
+ _PTR(Study) aCStudy = VISU::GetCStudy(anAppStudy);
+ if (!myAnimator && !aCStudy->GetProperties()->IsLocked()) {
+ mySaveChk = new QCheckBox ("Save to presentation", this);
+ mySaveChk->setChecked(false);
+ aMainLayout->addWidget(mySaveChk);
+ } else {
+ mySaveChk = 0;
+ }
+
+ // Common buttons ===========================================================
+ QGroupBox* GroupButtons = new QGroupBox( this, "GroupButtons" );
+ GroupButtons->setColumnLayout(0, Qt::Vertical );
+ GroupButtons->layout()->setSpacing( 0 );
+ GroupButtons->layout()->setMargin( 0 );
+ QGridLayout* GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
+ GroupButtonsLayout->setAlignment( Qt::AlignTop );
+ GroupButtonsLayout->setSpacing( 6 );
+ GroupButtonsLayout->setMargin( 11 );
+
+ QPushButton* buttonOk = new QPushButton( tr( "&OK" ), GroupButtons, "buttonOk" );
+ buttonOk->setAutoDefault( TRUE );
+ buttonOk->setDefault( TRUE );
+ GroupButtonsLayout->addWidget( buttonOk, 0, 0 );
+ GroupButtonsLayout->addItem( new QSpacerItem( 5, 5, QSizePolicy::Expanding, QSizePolicy::Minimum ), 0, 1 );
+
+ QPushButton* buttonCancel = new QPushButton( tr( "&Cancel" ) , GroupButtons, "buttonCancel" );
+ buttonCancel->setAutoDefault( TRUE );
+ GroupButtonsLayout->addWidget( buttonCancel, 0, 2 );
+
+ aMainLayout->addWidget( GroupButtons );
+
+ connect( buttonOk, SIGNAL( clicked() ), this, SLOT( accept() ) );
+ connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( reject() ) );
+}
+void ArrangeDlg::accept()
+{
+ if (myAnimator) {
+ acceptAnimation();
+ } else {
+ acceptViewWindow();
+ }
+ QDialog::accept();
+}
+
+void ArrangeDlg::onFieldChange(int theCurrent)
+{
+ if (myCurrent != theCurrent) {
+ Offset& aOffs = myOffsets[myCurrent];
+ aOffs.myOffset[0] = myCoord[0]->value();
+ aOffs.myOffset[1] = myCoord[1]->value();
+ aOffs.myOffset[2] = myCoord[2]->value();
+ }
+ myCurrent = theCurrent;
+ const Offset& aNewOffs = myOffsets[myCurrent];
+ myCoord[0]->setValue(aNewOffs.myOffset[0]);
+ myCoord[1]->setValue(aNewOffs.myOffset[1]);
+ myCoord[2]->setValue(aNewOffs.myOffset[2]);
+}
+
+void ArrangeDlg::acceptAnimation()
+{
+ if (getMode() == ManualMode) {
+ // Save from GUI
+ Offset& aOffs = myOffsets[myCurrent];
+ aOffs.myOffset[0] = myCoord[0]->value();
+ aOffs.myOffset[1] = myCoord[1]->value();
+ aOffs.myOffset[2] = myCoord[2]->value();
+
+ for (int i = 0; i < myAnimator->getNbFields(); i++) {
+ Offset aOffs = myOffsets[i];
+ myAnimator->getFieldData(i).myOffset[0] = aOffs.myOffset[0];
+ myAnimator->getFieldData(i).myOffset[1] = aOffs.myOffset[1];
+ myAnimator->getFieldData(i).myOffset[2] = aOffs.myOffset[2];
+ }
+ } else {
+ QApplication::setOverrideCursor( Qt::waitCursor );
+ FieldData& aData = myAnimator->getFieldData(0);
+ if (aData.myPrs.empty())
+ myAnimator->generatePresentations(0);
+ VISU_Actor* aActor = aActor = aData.myPrs[0]->CreateActor();
+ float aBounds[6];
+ aActor->GetBounds(aBounds);
+ aActor->Delete();
+ float aDist = 0;
+ int aAxis = getAxis();
+ switch (aAxis) {
+ case XAxis:
+ aDist = fabs(aBounds[1] - aBounds[0]);
+ break;
+ case YAxis:
+ aDist = fabs(aBounds[3] - aBounds[2]);
+ break;
+ case ZAxis:
+ aDist = fabs(aBounds[5] - aBounds[4]);
+ }
+ aDist = aDist*getDistance();
+ for (int i = 0; i < myAnimator->getNbFields(); i++) {
+ myAnimator->getFieldData(i).myOffset[0] = 0;
+ myAnimator->getFieldData(i).myOffset[1] = 0;
+ myAnimator->getFieldData(i).myOffset[2] = 0;
+ myAnimator->getFieldData(i).myOffset[aAxis] = aDist * i;
+ }
+
+ QApplication::restoreOverrideCursor();
+ }
+}
+
+void ArrangeDlg::acceptViewWindow()
+{
+ if (getMode() == ManualMode) {
+ // Save from GUI
+ Offset& aOffs = myOffsets[myCurrent];
+ aOffs.myOffset[0] = myCoord[0]->value();
+ aOffs.myOffset[1] = myCoord[1]->value();
+ aOffs.myOffset[2] = myCoord[2]->value();
+
+ QMap<VISU::Prs3d_i*, int>::Iterator it;
+ for (it = myPrsMap.begin(); it != myPrsMap.end(); ++it) {
+ VISU::Prs3d_i* aPrs = it.key();
+ Offset& aOffs = myOffsets[it.data()];
+ if (VISU_Actor* anActor = VISU::GetActor(aPrs, myViewWindow)) anActor->SetPosition(aOffs.myOffset);
+ if (mySaveChk)
+ if (mySaveChk->isChecked())
+ aPrs->SetOffset(aOffs.myOffset);
+ }
+ } else {
+ float aDist = 0;
+ float aShift = 0;
+ float aPrevDist = 0;
+ // bool aInit = true;
+ int i;
+ QMap<VISU::Prs3d_i*, int>::Iterator it;
+ for (it = myPrsMap.begin(), i = 0; it != myPrsMap.end(); ++it, i++) {
+ VISU::Prs3d_i* aPrs = it.key();
+ if (VISU_Actor* aActor = VISU::GetActor(aPrs, myViewWindow)){
+ int aAxis = getAxis();
+ // if (aInit) {
+ float aBounds[6];
+ aActor->GetBounds(aBounds);
+ switch (aAxis) {
+ case XAxis:
+ aDist = fabs(aBounds[1] - aBounds[0]);
+ break;
+ case YAxis:
+ aDist = fabs(aBounds[3] - aBounds[2]);
+ break;
+ case ZAxis:
+ aDist = fabs(aBounds[5] - aBounds[4]);
+ }
+ // aInit = false;
+ // }
+ float aOffset[3];
+ aOffset[0] = aOffset[1] = aOffset[2] = 0;
+
+ aShift = (i == 0)? 0 : aShift + (aDist + aPrevDist) * getDistance() / 2;
+
+ aOffset[aAxis] = aShift;
+ aActor->SetPosition(aOffset);
+ if (mySaveChk)
+ if (mySaveChk->isChecked())
+ aPrs->SetOffset(aOffset);
+ aPrevDist = aDist;
+ }
+ }
+ }
+ myViewWindow->getRenderer()->ResetCameraClippingRange();
+ myViewWindow->Repaint();
+}
+
+
+//*****************************************************************************************************
+//*****************************************************************************************************
+//*****************************************************************************************************
SetupDlg::SetupDlg (QWidget* theParent, VISU_TimeAnimation* theAnimator)
: QDialog(theParent, "SetupDlg", true, WStyle_Customize |
WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu)
this, SLOT( onFieldChange(int) ) );
- QVGroupBox* aPropBox = new QVGroupBox("Properties", aPropFrame);
+ QVBox* aSetupBox = new QVBox(aPropFrame);
+ aSetupBox->setSpacing(5);
+
+ QVGroupBox* aPropBox = new QVGroupBox("Properties", aSetupBox);
+ //QVGroupBox* aPropBox = new QVGroupBox("Properties", aPropFrame);
myTypeCombo = new QComboBox(aPropBox);
connect( myTypeCombo, SIGNAL( activated(int) ),
this, SLOT( onTypeChanged(int) ) );
connect( myPropBtn, SIGNAL( clicked() ),
this, SLOT( onPreferencesDlg() ) );
+ if (myAnimator->getNbFields() > 1) {
+ myArrangeBtn = new QPushButton("Arrange...", aSetupBox);
+ connect( myArrangeBtn, SIGNAL( clicked() ), this, SLOT( onArrangeDlg() ) );
+ }
onFieldChange(0);
aMainLayout->addWidget(aPropFrame);
}
+
+//************************************************************************
+void SetupDlg::onArrangeDlg()
+{
+ ArrangeDlg aDlg(this, myAnimator);
+ aDlg.exec();
+}
+
//************************************************************************
void SetupDlg::onRangeCheck (bool theCheck)
{
static QPixmap MYpausePixmap(pauseIco);
-VisuGUI_TimeAnimationDlg::VisuGUI_TimeAnimationDlg (QWidget* parent, _PTR(Study) theStudy)
- : QDialog(parent, "VisuGUI_TimeAnimationDlg", false, WStyle_Customize |
+//VisuGUI_TimeAnimationDlg::VisuGUI_TimeAnimationDlg (QWidget* parent, _PTR(Study) theStudy)
+// : QDialog(parent, "VisuGUI_TimeAnimationDlg", false, WStyle_Customize |
+VisuGUI_TimeAnimationDlg::VisuGUI_TimeAnimationDlg (VisuGUI* theModule, _PTR(Study) theStudy)
+ : QDialog(VISU::GetDesktop(theModule), "VisuGUI_TimeAnimationDlg", false, WStyle_Customize |
WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | WDestructiveClose)
{
setCaption("Animation");
setSizeGripEnabled( TRUE );
+ myModule = theModule;
myStudy = theStudy;
isClosing = false;
aMainLayout->addWidget(myPlayFrame);
+ QHBox* aPublishBox = new QHBox(this);
+ aPublishBox->setSpacing(5);
+
+ myPublishBtn = new QPushButton("Publish to study", aPublishBox);
+ connect(myPublishBtn, SIGNAL(clicked()), this, SLOT(publishToStudy()));
+
+ mySaveBtn = new QPushButton("Save Animation", aPublishBox);
+ mySaveBtn->setEnabled(myAnimator->isSavedInStudy());
+ connect(mySaveBtn, SIGNAL(clicked()), this, SLOT(saveToStudy()));
+
+ aMainLayout->addWidget(aPublishBox);
+
+
QHBox* aBtnBox = new QHBox(this);
QHBoxLayout* aBtnLayout = new QHBoxLayout(aBtnBox->layout());
aBtnLayout->addStretch();
void VisuGUI_TimeAnimationDlg::closeEvent (QCloseEvent* theEvent)
{
myAnimator->stopAnimation();
+ myAnimator->wait(500);
if (myAnimator->running() && (! myAnimator->finished())) {
isClosing = true;
myEvent = theEvent;
myGenBtn->setEnabled(true);
}
}
+
+//************************************************************************
+void VisuGUI_TimeAnimationDlg::saveToStudy()
+{
+ myAnimator->saveAnimation();
+ myModule->updateObjBrowser( true );
+}
+
+//************************************************************************
+void VisuGUI_TimeAnimationDlg::publishToStudy()
+{
+ myAnimator->publishInStudy();
+ myModule->updateObjBrowser( true );
+ mySaveBtn->setEnabled(myAnimator->isSavedInStudy());
+}
+
+//************************************************************************
+void VisuGUI_TimeAnimationDlg::restoreFromStudy(SALOMEDS::SObject_var theAnimation)
+{
+ myAnimator->restoreFromStudy(theAnimation);
+ mySaveBtn->setEnabled(myAnimator->isSavedInStudy());
+}
#ifndef VISUGUI_TIMEANIMATION_H
#define VISUGUI_TIMEANIMATION_H
-#include <qdialog.h>
-#include <qslider.h>
-#include <qcombobox.h>
-#include <qtoolbutton.h>
-#include <qevent.h>
+#include "QtxDblSpinBox.h"
+
+#include "SALOMEDSClient_Study.hxx"
-#include "VisuGUI_ScalarBarDlg.h"
+#include "SALOMEconfig.h"
+#include CORBA_SERVER_HEADER(SALOMEDS)
-//#include "SALOMEconfig.h"
-//#include CORBA_SERVER_HEADER(SALOMEDS)
-//#include CORBA_SERVER_HEADER(SALOMEDS_Attributes)
-//#include CORBA_CLIENT_HEADER(VISU_Gen)
+#include <qdialog.h>
+#include <qbuttongroup.h>
+#include <qwidgetstack.h>
+class VisuGUI;
class VISU_TimeAnimation;
-/**
+namespace VISU {
+ class Prs3d_i;
+}
+
+class SVTK_ViewWindow;
+
+class QtxDblSpinBox;
+
+class QLabel;
+class QSlider;
+class QListBox;
+class QCheckBox;
+class QComboBox;
+class QToolButton;
+
+/*!
* Auxilliary class for presentations definition
*/
+class ArrangeDlg: public QDialog
+{
+ Q_OBJECT
+ public:
+ enum { AutoMode, ManualMode };
+ enum { XAxis, YAxis, ZAxis };
+
+ ArrangeDlg(QWidget* theParent, VISU_TimeAnimation* theAnimator);
+ ArrangeDlg(QWidget* theParent, SVTK_ViewWindow* theViewWindow);
+ ~ArrangeDlg() {};
+
+ int getMode() const { return myStackWgt->id(myStackWgt->visibleWidget()); }
+ double getDistance() const { return myDistVal->value(); }
+ int getAxis() const { return myAxisGrp->id(myAxisGrp->selected()); }
+
+ protected slots:
+ virtual void accept();
+ void onFieldChange(int);
+
+ private:
+ struct Offset {
+ float myOffset[3];
+ };
+
+
+ void init();
+ void acceptAnimation();
+ void acceptViewWindow();
+
+ VISU_TimeAnimation* myAnimator;
+ SVTK_ViewWindow * myViewWindow;
+
+ QWidgetStack* myStackWgt;
+ QButtonGroup* myAxisGrp;
+ QtxDblSpinBox* myDistVal;
+ QListBox* myFieldLst;
+ QtxDblSpinBox* myCoord[3];
+ QValueList<Offset> myOffsets;
+
+ QCheckBox* mySaveChk;
+
+ int myCurrent;
+ QMap<VISU::Prs3d_i*, int> myPrsMap;
+};
+
+
class SetupDlg: public QDialog {
Q_OBJECT
-public:
+ public:
SetupDlg(QWidget* theParent, VISU_TimeAnimation* theAnimator);
~SetupDlg() {};
-private slots:
+ private slots:
void onFieldChange(int theIndex);
void onTypeChanged(int theIndex);
// void onScalarBarDlg();
void onRangeCheck(bool theCheck);
void onMinValue(double theVal);
void onMaxValue(double theVal);
+ void onArrangeDlg();
-private:
+ private:
VISU_TimeAnimation* myAnimator;
QListBox* myFieldLst;
QComboBox* myTypeCombo;
QPushButton* myPropBtn;
+ QPushButton* myArrangeBtn;
QCheckBox* myUseRangeChk;
QtxDblSpinBox* myMinVal;
QtxDblSpinBox* myMaxVal;
};
-//class SALOMEDSClient_Study;
-//class SALOMEDSClient_SObject;
-
-
class VisuGUI_TimeAnimationDlg: public QDialog
{
Q_OBJECT
public:
- VisuGUI_TimeAnimationDlg(QWidget* parent, _PTR(Study) theStudy);
+ //VisuGUI_TimeAnimationDlg(QWidget* parent, _PTR(Study) theStudy);
+ VisuGUI_TimeAnimationDlg(VisuGUI* theModule, _PTR(Study) theStudy);
~VisuGUI_TimeAnimationDlg();
void addField(_PTR(SObject) theField);
void clearView();
+ void restoreFromStudy(SALOMEDS::SObject_var theAnimation);
+
protected:
virtual void closeEvent(QCloseEvent* theEvent);
void stopAnimation();
void onExecution(long theNewFrame, double theTime);
void onBrowse();
void onStop();
+ void saveToStudy();
+ void publishToStudy();
private:
QSlider* mySlider;
QFrame* myPlayFrame;
_PTR(Study) myStudy;
+ VisuGUI* myModule;
VISU_TimeAnimation* myAnimator;
QCheckBox* mySaveCheck;
QLineEdit* myPathEdit;
bool isClosing;
QCloseEvent* myEvent;
+
+ QPushButton* myPublishBtn;
+ QPushButton* mySaveBtn;
};
+
#endif //VISUGUI_TIMEANIMATION_H
#include "VISU_Prs3d_i.hh"
#include "VISU_Result_i.hh"
#include "VISU_Table_i.hh"
+#include "VISU_Mesh_i.hh"
#include "VISU_ViewManager_i.hh"
+
#include "VISU_Actor.h"
#include "SalomeApp_Module.h"
return aGen;
}
+ VISU::Storable::TRestoringMap
+ getMapOfValue(SALOMEDS::SObject_var theSObject)
+ {
+ VISU::Storable::TRestoringMap aMap;
+ if(!theSObject->_is_nil()){
+ SALOMEDS::GenericAttribute_var anAttr;
+ if (theSObject->FindAttribute(anAttr, "AttributeComment")) {
+ SALOMEDS::AttributeComment_var aComment = SALOMEDS::AttributeComment::_narrow(anAttr);
+ CORBA::String_var aValue = aComment->Value();
+ QString aString(aValue.in());
+ VISU::Storable::StrToMap(aString,aMap);
+ }
+ }
+ return aMap;
+ }
+
+ QString
+ getValue(SALOMEDS::SObject_var theSObject,
+ QString theKey)
+ {
+ QString aStr("");
+ VISU::Storable::TRestoringMap aMap = getMapOfValue(theSObject);
+ if(!aMap.empty())
+ aStr = VISU::Storable::FindValue(aMap,theKey.latin1());
+ return aStr;
+ }
+
+ VISU::Storable::TRestoringMap getMapOfValue (_PTR(SObject) theSObject)
+ {
+ VISU::Storable::TRestoringMap aMap;
+ if (theSObject) {
+ _PTR(GenericAttribute) anAttr;
+ if (theSObject->FindAttribute(anAttr, "AttributeComment")) {
+ _PTR(AttributeComment) aComment (anAttr);
+ std::string aValue = aComment->Value();
+ QString aString (aValue.c_str());
+ VISU::Storable::StrToMap(aString, aMap);
+ }
+ }
+ return aMap;
+ }
+
+ QString getValue (_PTR(SObject) theSObject, QString theKey)
+ {
+ QString aStr("");
+ VISU::Storable::TRestoringMap aMap = getMapOfValue(theSObject);
+ if (!aMap.empty())
+ aStr = VISU::Storable::FindValue(aMap, theKey.latin1());
+ return aStr;
+ }
+
+ //************************************************************
+ // Selection
CORBA::Object_var
GetSelectedObj(const SalomeApp_Study* theStudy,
const QString& theEntry,
return CORBA::Object::_nil();
}
- VISU::Storable::TRestoringMap
- getMapOfValue(SALOMEDS::SObject_var theSObject)
+ void
+ Add(SalomeApp_SelectionMgr* theSelectionMgr,
+ const Handle(SALOME_InteractiveObject)& theIO)
{
- VISU::Storable::TRestoringMap aMap;
- if(!theSObject->_is_nil()){
- SALOMEDS::GenericAttribute_var anAttr;
- if (theSObject->FindAttribute(anAttr, "AttributeComment")) {
- SALOMEDS::AttributeComment_var aComment = SALOMEDS::AttributeComment::_narrow(anAttr);
- CORBA::String_var aValue = aComment->Value();
- QString aString(aValue.in());
- VISU::Storable::StrToMap(aString,aMap);
+ SALOME_ListIO aListIO;
+ theSelectionMgr->selectedObjects(aListIO);
+ aListIO.Append(theIO);
+ theSelectionMgr->setSelectedObjects(aListIO);
+ }
+
+ void
+ Remove(SalomeApp_SelectionMgr* theSelectionMgr,
+ const Handle(SALOME_InteractiveObject)& theIO)
+ {
+ if (theIO.IsNull()) return;
+ SALOME_ListIO aListIO, aNewListIO;
+ theSelectionMgr->selectedObjects(aListIO);
+ SALOME_ListIteratorOfListIO anIter (aListIO);
+ for (; anIter.More(); anIter.Next()) {
+ Handle(SALOME_InteractiveObject) anIO = anIter.Value();
+ if (!anIO->isSame(theIO)) {
+ aNewListIO.Append(theIO);
}
}
- return aMap;
+ theSelectionMgr->setSelectedObjects(aNewListIO);
}
- QString
- getValue(SALOMEDS::SObject_var theSObject,
- QString theKey)
+ bool
+ IsRemovableSelected (const SalomeApp_Module* theModule)
{
- QString aStr("");
- VISU::Storable::TRestoringMap aMap = getMapOfValue(theSObject);
- if(!aMap.empty())
- aStr = VISU::Storable::FindValue(aMap,theKey.latin1());
- return aStr;
+ SalomeApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(theModule);
+ SALOME_ListIO aListIO;
+ aSelectionMgr->selectedObjects(aListIO);
+
+ if (aListIO.Extent() < 1)
+ return false;
+
+ SALOME_ListIteratorOfListIO anIter (aListIO);
+ for (; anIter.More(); anIter.Next()) {
+ Handle(SALOME_InteractiveObject) anIO = anIter.Value();
+ if (anIO->hasEntry()) {
+ _PTR(Study) aStudy = GetCStudy(GetAppStudy(theModule));
+ _PTR(SObject) aSObject = aStudy->FindObjectID(anIO->getEntry());
+ VISU::Storable::TRestoringMap pMap;
+ if (aSObject) {
+ CORBA::Object_var aCORBAObject = VISU::ClientSObjectToObject(aSObject);
+ if (!CORBA::is_nil(aCORBAObject)) {
+ VISU::RemovableObject_var aRemovableObj = VISU::RemovableObject::_narrow(aCORBAObject);
+ if (CORBA::is_nil(aRemovableObj)) {
+ // Not removable CORBA object
+ return false;
+ }
+ } else {
+ // Can be removed, if lays directly under VISU
+ // (first sub-level) or is a child of such an object
+ string aNAME, aVisuNAME = GetVisuGen(theModule)->ComponentDataType();
+ _PTR(GenericAttribute) anAttr;
+ _PTR(AttributeComment) aComment;
+
+ bool isUnderVISU = false;
+ _PTR(SObject) aFatherSObject = aSObject->GetFather();
+ if (aFatherSObject->FindAttribute(anAttr, "AttributeComment")) {
+ _PTR(AttributeComment) aComment (anAttr);
+ aNAME = aComment->Value();
+ if (aNAME == aVisuNAME) {
+ isUnderVISU = true;
+ }
+ }
+ if (!isUnderVISU) {
+ // Not directly under VISU component, check father
+ aCORBAObject = VISU::ClientSObjectToObject(aFatherSObject);
+ if (!CORBA::is_nil(aCORBAObject)) {
+ // Father has IOR
+ return false;
+ }
+
+ isUnderVISU = false;
+ aFatherSObject = aFatherSObject->GetFather();
+ if (aFatherSObject->FindAttribute(anAttr, "AttributeComment")) {
+ _PTR(AttributeComment) aComment (anAttr);
+ aNAME = aComment->Value();
+ if (aNAME == aVisuNAME) {
+ isUnderVISU = true;
+ }
+ }
+ if (!isUnderVISU) {
+ // Father is not directly under VISU component
+ return false;
+ }
+ }
+ }
+ }
+ }
+ }
+ return true;
}
- VISU::Storable::TRestoringMap getMapOfValue (_PTR(SObject) theSObject)
+ //************************************************************
+ // Display/Erase
+
+ void
+ ErasePrs (const SalomeApp_Module* theModule,
+ CORBA::Object_ptr theObject, bool theUpdate)
{
- VISU::Storable::TRestoringMap aMap;
- if (theSObject) {
- _PTR(GenericAttribute) anAttr;
- if (theSObject->FindAttribute(anAttr, "AttributeComment")) {
- _PTR(AttributeComment) aComment (anAttr);
- std::string aValue = aComment->Value();
- QString aString (aValue.c_str());
- VISU::Storable::StrToMap(aString, aMap);
+ if (!CORBA::is_nil(theObject)) {
+ VISU::Base_var aBase = VISU::Base::_narrow(theObject);
+ if (CORBA::is_nil(aBase)) return;
+ VISU::VISUType aType = aBase->GetType();
+ switch (aType) {
+ case VISU::TCURVE:
+ {
+ if (VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aBase).in()))
+ PlotCurve(theModule, aCurve, VISU::eErase );
+ break;
+ }
+ case VISU::TCONTAINER:
+ {
+ if (VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(VISU::GetServant(aBase).in()))
+ PlotContainer(theModule, aContainer, VISU::eErase );
+ break;
+ }
+ case VISU::TTABLE:
+ {
+ if (VISU::Table_i* aTable = dynamic_cast<VISU::Table_i*>(VISU::GetServant(aBase).in()))
+ PlotTable(theModule, aTable, VISU::eErase );
+ break;
+ }
+ default:
+ {
+ if (VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(VISU::GetServant(aBase).in())) {
+ ErasePrs3d(theModule, aPrsObject);
+ if (theUpdate) {
+ if (SVTK_ViewWindow* vw = GetViewWindow(theModule))
+ vw->Repaint();
+ }
+ }
+ }
+ } // switch (aType)
+ }
+ }
+
+ void
+ DeleteSObject (SalomeApp_Module* theModule,
+ SALOMEDS::Study_ptr theStudy,
+ SALOMEDS::SObject_ptr theSObject)
+ {
+ SALOMEDS::ChildIterator_var aChildIter = theStudy->NewChildIterator(theSObject);
+ for (aChildIter->InitEx(true); aChildIter->More(); aChildIter->Next()) {
+ SALOMEDS::SObject_var aChildSObject = aChildIter->Value();
+ CORBA::Object_var aChildObj = VISU::SObjectToObject(aChildSObject);
+ ErasePrs(theModule, aChildObj);
+ }
+
+ CORBA::Object_var anObj = VISU::SObjectToObject(theSObject);
+ if (!CORBA::is_nil(anObj)) {
+ VISU::RemovableObject_var aRemovableObject = VISU::RemovableObject::_narrow(anObj);
+ if (!CORBA::is_nil(aRemovableObject)) {
+ aRemovableObject->RemoveFromStudy();
}
+ } else {
+ // Remove aSObject together with all its sub-objects
+ VISU::RemoveFromStudy(theSObject,
+ false, // remove not only IOR attribute, but Object With Children
+ false); // not Destroy() sub-objects
}
- return aMap;
}
- QString getValue (_PTR(SObject) theSObject, QString theKey)
+ void
+ DeletePrs3d(SalomeApp_Module* theModule,
+ VISU::Prs3d_i* thePrs,
+ const Handle(SALOME_InteractiveObject)& theIO)
{
- QString aStr("");
- VISU::Storable::TRestoringMap aMap = getMapOfValue(theSObject);
- if (!aMap.empty())
- aStr = VISU::Storable::FindValue(aMap, theKey.latin1());
- return aStr;
+ if(!thePrs)
+ return;
+ if(CheckLock(GetCStudy(GetAppStudy(theModule))))
+ return;
+ SALOMEDS::SObject_var aSObject = thePrs->GetSObject();
+ CORBA::String_var anEntry = aSObject->GetID();
+ SalomeApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(theModule);
+ Remove(aSelectionMgr,theIO);
+ TViewWindows aViewWindows = GetViews(theModule);
+ for(int i = 0, iEnd = aViewWindows.size(); i < iEnd; i++){
+ SVTK_ViewWindow* aView = aViewWindows[i];
+ if(VISU_Actor* anActor = FindActor(aView,anEntry.in())){
+ aView->RemoveActor(anActor);
+ anActor->Delete();
+ }
+ }
+ thePrs->RemoveFromStudy();
+ theModule->updateObjBrowser(); //update Object browser
+ }
+
+ void
+ ErasePrs3d(const SalomeApp_Module* theModule,
+ VISU::Prs3d_i* thePrs)
+ {
+ if ( SVTK_ViewWindow* vw = GetViewWindow( theModule ) ){
+ VISU_Actor* anVISUActor = FindActor( vw, thePrs );
+ if (anVISUActor) {
+ anVISUActor->VisibilityOff();
+ }
+ }
+ }
+
+ //************************************************************
+ // Presentation management
+
+ void
+ ChangeRepresentation (const SalomeApp_Module* theModule,
+ VISU::PresentationType theType)
+ {
+ SUIT_ViewWindow* aView = GetActiveView(theModule, VTKViewer_Viewer::Type());
+ if (!aView) return;
+ SVTK_ViewWindow* vw = (SVTK_ViewWindow*) aView;
+
+ Handle(SALOME_InteractiveObject) anIO;
+ CORBA::Object_var anObject = GetSelectedObj(theModule, &anIO);
+ if (CORBA::is_nil(anObject)) return;
+ PortableServer::ServantBase_var aServant = VISU::GetServant(anObject);
+ if (!aServant.in()) return;
+
+ VISU::Prs3d_i* aPrs3d = dynamic_cast<VISU::Prs3d_i*>(aServant.in());
+ if (aPrs3d) {
+ if (VISU_Actor* anActor = GetActor(aPrs3d, vw)) {
+ switch (theType) {
+ case VISU::SHRINK:
+ if (anActor->IsShrunk())
+ anActor->UnShrink();
+ else
+ anActor->SetShrink();
+ break;
+ default:
+ if (VISU::Mesh_i* aMesh = dynamic_cast<VISU::Mesh_i*>(aPrs3d)) {
+ aMesh->SetPresentationType(theType);
+ RecreateActor(theModule, aMesh);
+ } else {
+ anActor->SetRepresentation(theType);
+ }
+ }
+ vw->Repaint();
+ }
+ }
}
+ //************************************************************
+ // SObject type
bool
CheckTimeStamp(const SalomeApp_Module* theModule,
return pResult;
}
- SVTK_ViewWindow*
- GetViewWindow(const SalomeApp_Module* theModule, const bool theCreate )
- {
- if(SalomeApp_Application* anApp = theModule->getApp()){
- if(SUIT_ViewManager* aViewManager = anApp->getViewManager( SVTK_Viewer::Type(), theCreate )){
- if(SUIT_ViewWindow* aViewWindow = aViewManager->getActiveView()){
- return dynamic_cast<SVTK_ViewWindow*>(aViewWindow);
- }
- }
- }
- return NULL;
- }
-
-
//************************************************************
+ // Views
+
SUIT_ViewWindow* GetActiveView(const SalomeApp_Module* theModule, QString theType)
{
if(SalomeApp_Application* anApp = theModule->getApp()){
return 0;
}
-
//************************************************************
- SVTK_ViewWindow*
- GetViewWindow()
- {
- SalomeApp_Application* anApp = dynamic_cast<SalomeApp_Application*>
- (SUIT_Session::session()->activeApplication());
- if (anApp) {
- if (SUIT_ViewManager* aViewManager = anApp->activeViewManager()) {
- if (aViewManager->getType() == SVTK_Viewer::Type()) {
- if (SUIT_ViewWindow* aViewWindow = aViewManager->getActiveView()) {
- return dynamic_cast<SVTK_ViewWindow*>(aViewWindow);
- }
- }
- }
- }
- return NULL;
- }
+ // VTK View
TViewWindows
GetViews(const SalomeApp_Module* theModule)
return aViewWindows;
}
+ SVTK_ViewWindow*
+ GetViewWindow(const SalomeApp_Module* theModule, const bool theCreate )
+ {
+ if(SalomeApp_Application* anApp = theModule->getApp()){
+ if(SUIT_ViewManager* aViewManager = anApp->getViewManager( SVTK_Viewer::Type(), theCreate )){
+ if(SUIT_ViewWindow* aViewWindow = aViewManager->getActiveView()){
+ return dynamic_cast<SVTK_ViewWindow*>(aViewWindow);
+ }
+ }
+ }
+ return NULL;
+ }
+
+
+ SVTK_ViewWindow*
+ GetViewWindow()
+ {
+ SalomeApp_Application* anApp = dynamic_cast<SalomeApp_Application*>
+ (SUIT_Session::session()->activeApplication());
+ if (anApp) {
+ if (SUIT_ViewManager* aViewManager = anApp->activeViewManager()) {
+ if (aViewManager->getType() == SVTK_Viewer::Type()) {
+ if (SUIT_ViewWindow* aViewWindow = aViewManager->getActiveView()) {
+ return dynamic_cast<SVTK_ViewWindow*>(aViewWindow);
+ }
+ }
+ }
+ }
+ return NULL;
+ }
+
VISU_Actor*
PublishInView(const SalomeApp_Module* theModule,
VISU::Prs3d_i* thePrs)
QApplication::restoreOverrideCursor();
}
- void
- Add(SalomeApp_SelectionMgr* theSelectionMgr,
- const Handle(SALOME_InteractiveObject)& theIO)
- {
- SALOME_ListIO aListIO;
- theSelectionMgr->selectedObjects(aListIO);
- aListIO.Append(theIO);
- theSelectionMgr->setSelectedObjects(aListIO);
- }
-
- void
- Remove(SalomeApp_SelectionMgr* theSelectionMgr,
- const Handle(SALOME_InteractiveObject)& theIO)
- {
- if (theIO.IsNull()) return;
- SALOME_ListIO aListIO, aNewListIO;
- theSelectionMgr->selectedObjects(aListIO);
- SALOME_ListIteratorOfListIO anIter (aListIO);
- for (; anIter.More(); anIter.Next()) {
- Handle(SALOME_InteractiveObject) anIO = anIter.Value();
- if (!anIO->isSame(theIO)) {
- aNewListIO.Append(theIO);
- }
- }
- theSelectionMgr->setSelectedObjects(aNewListIO);
- }
-
- void
- DeletePrs3d(SalomeApp_Module* theModule,
- VISU::Prs3d_i* thePrs,
- const Handle(SALOME_InteractiveObject)& theIO)
- {
- if(!thePrs)
- return;
- if(CheckLock(GetCStudy(GetAppStudy(theModule))))
- return;
- SALOMEDS::SObject_var aSObject = thePrs->GetSObject();
- CORBA::String_var anEntry = aSObject->GetID();
- SalomeApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(theModule);
- Remove(aSelectionMgr,theIO);
- TViewWindows aViewWindows = GetViews(theModule);
- for(int i = 0, iEnd = aViewWindows.size(); i < iEnd; i++){
- SVTK_ViewWindow* aView = aViewWindows[i];
- if(VISU_Actor* anActor = FindActor(aView,anEntry.in())){
- aView->RemoveActor(anActor);
- anActor->Delete();
- }
- }
- thePrs->RemoveFromStudy();
- theModule->updateObjBrowser(); //update Object browser
- }
-
- void
- ErasePrs3d(SalomeApp_Module* theModule,
- VISU::Prs3d_i* thePrs)
- {
- if ( SVTK_ViewWindow* vw = GetViewWindow( theModule ) ){
- VISU_Actor* anVISUActor = FindActor( vw, thePrs );
- if (anVISUActor) {
- anVISUActor->VisibilityOff();
- }
- }
- }
+ //************************************************************
+ // Plot2d View
SPlot2d_Viewer*
GetPlot2dViewer(const SalomeApp_Module* theModule, const bool theCreate)
SPlot2d_Curve* tmpCurve;
for ( int i = 0; i < clist.count(); i++ ) {
tmpCurve = dynamic_cast<SPlot2d_Curve*>( clist.at( i ) );
- if ( tmpCurve && tmpCurve->hasIO() && !strcmp( tmpCurve->getIO()->getEntry(), theCurve->GetEntry() ) ) {
+ if (tmpCurve && tmpCurve->hasIO() &&
+ !strcmp(tmpCurve->getIO()->getEntry(), theCurve->GetEntry())) {
plotCurve = tmpCurve;
break;
}
aPlot->getCurves( clist );
SPlot2d_Curve* plotCurve = 0;
SPlot2d_Curve* tmpCurve;
- for ( int i = 0; i < clist.count(); i++ ) {
- tmpCurve = dynamic_cast<SPlot2d_Curve*>( clist.at( i ) );
- if ( tmpCurve && tmpCurve->hasIO() && !strcmp( tmpCurve->getIO()->getEntry(), theCurve->GetEntry() ) ) {
+ for (int i = 0; i < clist.count(); i++) {
+ tmpCurve = dynamic_cast<SPlot2d_Curve*>(clist.at(i));
+ if (tmpCurve && tmpCurve->hasIO() &&
+ !strcmp(tmpCurve->getIO()->getEntry(), theCurve->GetEntry())) {
plotCurve = tmpCurve;
- }
- else if ( theDisplaying == VISU::eDisplayOnly ) {
- aPlot->eraseCurve( clist.at( i ) );
+ } else if (theDisplaying == VISU::eDisplayOnly) {
+ aPlot->eraseCurve(clist.at(i));
}
}
- UpdateCurve( theCurve, aPlot, plotCurve, theDisplaying );
+ UpdateCurve(theCurve, aPlot, plotCurve, theDisplaying);
aPlot->Repaint();
}
for ( int k = 1; k <= nbCurves; k++ ) {
VISU::Curve_i* theCurve = container->GetCurve( k );
if ( theCurve && theCurve->IsValid() ) {
- SPlot2d_Curve* plotCurve = dynamic_cast<SPlot2d_Curve*>( aView->getCurveByIO( new SALOME_InteractiveObject( theCurve->GetEntry(), "", "" ) ) );
+ SPlot2d_Curve* plotCurve = dynamic_cast<SPlot2d_Curve*>
+ (aView->getCurveByIO(new SALOME_InteractiveObject (theCurve->GetEntry(), "", "")));
UpdateCurve( theCurve, aPlot, plotCurve, theDisplaying );
CORBA::Object_var aTable = VISU::ClientSObjectToObject(theTableSO);
CORBA::Object_var aContainer = GetVisuGen( theModule )->CreateContainer();
if ( !CORBA::is_nil( aTable ) && !CORBA::is_nil( aContainer ) ) {
- VISU::Table_i* pTable = dynamic_cast<VISU::Table_i*>( VISU::GetServant(aTable).in() );
- VISU::Container_i* pContainer = dynamic_cast<VISU::Container_i*>( VISU::GetServant(aContainer).in() );
+ VISU::Table_i* pTable = dynamic_cast<VISU::Table_i*>(VISU::GetServant(aTable).in());
+ VISU::Container_i* pContainer = dynamic_cast<VISU::Container_i*>(VISU::GetServant(aContainer).in());
if ( pContainer && pTable ) {
for ( int i = 2; i <= pTable->GetNbRows(); i++ ) {
}
}
}
+
+ //************************************************************
+ // Others
+
+ void CreateMesh (const SalomeApp_Module* theModule,
+ const Handle(SALOME_InteractiveObject)& theIO)
+ {
+ _PTR(Study) aStudy = GetCStudy(GetAppStudy(theModule));
+ //if (CheckLock(aStudy))
+ // return;
+
+ SALOMEDS::SObject_var aResultSObj =
+ GetDSStudy(aStudy)->FindObjectID(theIO->getEntry());
+
+ // Get VISU::Result
+ VISU::Result_var aResult;
+ VISU::Result_i* pResult = CheckResult(theModule, aResultSObj, aResult);
+ if (pResult == NULL)
+ return;
+
+ Storable::TRestoringMap aMap = getMapOfValue(aResultSObj);
+ bool isExist;
+ string aComment = Storable::FindValue(aMap,"myComment",&isExist).latin1();
+ if (!isExist)
+ return;
+
+ CORBA::Object_var aMesh;
+ string aMeshName = Storable::FindValue(aMap,"myMeshName").latin1();
+#ifdef CHECKTIME
+ Utils_Timer timer;
+ timer.Start();
+#endif
+ if (aComment == "ENTITY") {
+ VISU::Entity anEntity = (VISU::Entity)Storable::FindValue(aMap,"myId").toInt();
+ if (VISU::Mesh_i::IsPossible(pResult,aMeshName.c_str(),anEntity))
+ aMesh = GetVisuGen(theModule)->MeshOnEntity(aResult,aMeshName.c_str(),anEntity);
+ } else if (aComment == "FAMILY") {
+ VISU::Entity anEntity = (VISU::Entity)Storable::FindValue(aMap,"myEntityId").toInt();
+ string aFamilyName = Storable::FindValue(aMap,"myName").latin1();
+ if (VISU::Mesh_i::IsPossible(pResult,aMeshName.c_str(),anEntity,aFamilyName.c_str()))
+ aMesh = GetVisuGen(theModule)->FamilyMeshOnEntity
+ (aResult,aMeshName.c_str(),anEntity,aFamilyName.c_str());
+ } else if (aComment == "GROUP") {
+ string aGroupName = Storable::FindValue(aMap,"myName").latin1();
+ if (VISU::Mesh_i::IsPossible(pResult,aMeshName.c_str(),aGroupName.c_str()))
+ aMesh = GetVisuGen(theModule)->GroupMesh(aResult,aMeshName.c_str(),aGroupName.c_str());
+ }
+#ifdef CHECKTIME
+ timer.Stop();
+ MESSAGE("VisuGUI::CreateMesh() - CREATE MESH");
+ timer.Show();
+#endif
+
+ QApplication::restoreOverrideCursor();
+ VISU::Mesh_i* pPresent = NULL;
+ if (!CORBA::is_nil(aMesh))
+ pPresent = dynamic_cast<VISU::Mesh_i*>(VISU::GetServant(aMesh).in());
+ if (pPresent == NULL) {
+ SUIT_MessageBox::warn1 (GetDesktop(theModule),
+ QObject::tr("WRN_VISU"),
+ QObject::tr("ERR_CANT_BUILD_PRESENTATION"),
+ QObject::tr("BUT_OK"));
+ return;
+ }
+
+ if (SVTK_ViewWindow* aView = GetViewWindow(theModule)) {
+ try {
+#ifdef CHECKTIME
+ Utils_Timer timer;
+ timer.Start();
+#endif
+ PublishInView(theModule, pPresent);
+ aView->onFitAll();
+#ifdef CHECKTIME
+ timer.Stop();
+ MESSAGE("VisuGUI::CreateMesh() - DISPLAY MESH");
+ timer.Show();
+#endif
+ theModule->application()->putInfo(QObject::tr("INF_DONE"));
+ } catch (std::runtime_error& exc) {
+ INFOS(exc.what());
+ SUIT_MessageBox::warn1 (GetDesktop(theModule),
+ QObject::tr("WRN_VISU"),
+ QObject::tr("ERR_CANT_CREATE_ACTOR") + " " + QObject::tr(exc.what()),
+ QObject::tr("BUT_OK"));
+ }
+ }
+ }
+
+ // ========================================================================================
+ // GetPrs3dList: find list of presentations for the given object
+ // ========================================================================================
+ std::vector<VISU::Prs3d_i*> GetPrs3dList (const SalomeApp_Module* theModule,
+ const Handle(SALOME_InteractiveObject)& theIO)
+ {
+ std::vector<VISU::Prs3d_i*> aList;
+ if (!theIO.IsNull() && theIO->hasEntry()) {
+ _PTR(Study) aCStudy = GetCStudy(GetAppStudy(theModule));
+ SALOMEDS::Study_var aStudy = GetDSStudy(aCStudy);
+ SALOMEDS::SObject_var aSObject = aStudy->FindObjectID(theIO->getEntry());
+ aList = GetPrs3dList(theModule, aSObject);
+ }
+ return aList;
+ }
+
+ std::vector<VISU::Prs3d_i*> GetPrs3dList (const SalomeApp_Module* theModule,
+ SALOMEDS::SObject_ptr theObject)
+ {
+ _PTR(Study) aCStudy = GetCStudy(GetAppStudy(theModule));
+ SALOMEDS::Study_var aStudy = GetDSStudy(aCStudy);
+
+ std::vector<VISU::Prs3d_i*> aList; int k = 0;
+ if (!theObject->_is_nil()) {
+ CORBA::Object_var aCORBAObject = VISU::SObjectToObject(theObject);
+ if (!CORBA::is_nil(aCORBAObject)) {
+ VISU::Base_var aVisuObj = VISU::Base::_narrow(aCORBAObject);
+ if (!CORBA::is_nil(aVisuObj)) {
+ VISU::VISUType aType = aVisuObj->GetType();
+ switch (aType) {
+ case VISU::TSCALARMAP:
+ case VISU::TISOSURFACE:
+ case VISU::TDEFORMEDSHAPE:
+ case VISU::TCUTPLANES:
+ case VISU::TCUTLINES:
+ case VISU::TVECTORS:
+ case VISU::TSTREAMLINES:
+ case VISU::TPLOT3D:
+ {
+ PortableServer::ServantBase_var aServant = VISU::GetServant(aCORBAObject);
+ if (aServant.in()) {
+ VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(aServant.in());
+ aList.resize(k+1); aList[k] = aPrsObject; k++;
+ }
+ }
+ break;
+ case VISU::TFIELD:
+ {
+ SALOMEDS::ChildIterator_var anIter = aStudy->NewChildIterator(theObject);
+ SALOMEDS::SObject_var aTimeStamp;
+ anIter->Next(); // First is reference on support
+ for(;anIter->More();anIter->Next()) {
+ aTimeStamp = anIter->Value();
+ if (aTimeStamp->_is_nil()) continue;
+ std::vector<VISU::Prs3d_i*> aSubList = GetPrs3dList(theModule, aTimeStamp);
+ if (!aSubList.empty()) {
+ int n = aSubList.size();
+ aList.resize(k+n);
+ for (int i = 0; i < n; i++)
+ { aList[k] = aSubList[i]; k++; }
+ }
+ }
+ }
+ break;
+ }
+ }
+ } else {
+ SALOMEDS::GenericAttribute_var anAttr;
+ if (theObject->FindAttribute(anAttr, "AttributeComment")) {
+ SALOMEDS::AttributeComment_var aComment =
+ SALOMEDS::AttributeComment::_narrow(anAttr);
+ string aComm = aComment->Value();
+ QString strIn( aComm.c_str() );
+ VISU::Storable::TRestoringMap pMap;
+ VISU::Storable::StrToMap( strIn, pMap );
+ bool isExist;
+ VISU::VISUType aType = (VISU::VISUType)VISU::Storable::FindValue(pMap,"myType",&isExist).toInt();
+ if (isExist) {
+ switch (aType) {
+ case VISU::TFIELD:
+ {
+ SALOMEDS::ChildIterator_var anIter = aStudy->NewChildIterator(theObject);
+ SALOMEDS::SObject_var aTimeStamp;
+ anIter->Next(); // First is reference on support
+ for (;anIter->More();anIter->Next()) {
+ aTimeStamp = anIter->Value();
+ if (aTimeStamp->_is_nil()) continue;
+ std::vector<VISU::Prs3d_i*> aSubList = GetPrs3dList(theModule, aTimeStamp);
+ if (!aSubList.empty()) {
+ int n = aSubList.size();
+ aList.resize(k+n);
+ for (int i = 0; i < n; i++)
+ { aList[k] = aSubList[i]; k++; }
+ }
+ }
+ }
+ break;
+ case VISU::TTIMESTAMP:
+ {
+ SALOMEDS::ChildIterator_var anIter = aStudy->NewChildIterator(theObject);
+ SALOMEDS::SObject_var aPrs;
+ for (;anIter->More();anIter->Next()) {
+ aPrs = anIter->Value();
+ if (aPrs->_is_nil()) continue;
+ std::vector<VISU::Prs3d_i*> aSubList = GetPrs3dList(theModule, aPrs);
+ if (!aSubList.empty()) {
+ int n = aSubList.size();
+ aList.resize(k+n);
+ for (int i = 0; i < n; i++)
+ { aList[k] = aSubList[i]; k++; }
+ }
+ }
+ }
+ break;
+ }
+ }
+ }
+ }
+ }
+ return aList;
+ }
}
// VISU VISUGUI : GUI of VISU component
//
// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
//
//
//
// File : VisuGUI_Tools.h
-// Author : Sergey Anikin
+// Author : Sergey Anikin
// Module : VISU
#ifndef VisuGUI_Tools_HeaderFile
class SalomeApp_SelectionMgr;
class SalomeApp_Study;
-namespace VISU{
+namespace VISU {
class Prs3d_i;
class Result_i;
class Table_i;
typedef std::vector<SVTK_ViewWindow*> TViewWindows;
SUIT_Desktop* GetDesktop(const CAM_Module* theModule);
- SalomeApp_SelectionMgr* GetSelectionMgr(const SalomeApp_Module* theModule);
SalomeApp_Study* GetAppStudy(const CAM_Module* theModule);
_PTR(Study) GetCStudy(const SalomeApp_Study* theStudy);
+ SALOMEDS::StudyManager_var GetStudyManager();
+
bool IsStudyLocked( _PTR(Study) theStudy );
bool CheckLock( _PTR(Study) theStudy );
+
+ VISU_Gen_i* GetVisuGen(const CAM_Module* theModule);
+ SALOME_MED::MED_Gen_var GetMEDEngine();
+
VISU::Storable::TRestoringMap getMapOfValue(SALOMEDS::SObject_var theSObject);
VISU::Storable::TRestoringMap getMapOfValue(_PTR(SObject) theSObject);
QString getValue(SALOMEDS::SObject_var theSObject, QString theKey);
QString getValue(_PTR(SObject) theSObject, QString theKey);
- SVTK_ViewWindow* GetViewWindow(const SalomeApp_Module* theModule, const bool theCreate = false );
+ // Selection
+ SalomeApp_SelectionMgr* GetSelectionMgr(const SalomeApp_Module* theModule);
+ CORBA::Object_var GetSelectedObj(const SalomeApp_Study* theStudy,
+ const QString& theEntry,
+ VISU::Storable::TRestoringMap* theMap = NULL);
+ CORBA::Object_var GetSelectedObj(const SalomeApp_Module* theModule,
+ Handle(SALOME_InteractiveObject)* theIO = NULL,
+ VISU::Storable::TRestoringMap* theMap = NULL);
+
+ void Add(SalomeApp_SelectionMgr* theSelectionMgr,
+ const Handle(SALOME_InteractiveObject)& theIO);
+ void Remove(SalomeApp_SelectionMgr* theSelectionMgr,
+ const Handle(SALOME_InteractiveObject)& theIO);
+
+ bool IsRemovableSelected(const SalomeApp_Module* theModule);
+
+ // Display/Erase
+ void ErasePrs(const SalomeApp_Module* theModule,
+ CORBA::Object_ptr theObject,
+ bool theUpdate = true);
+ void DeleteSObject(SalomeApp_Module* theModule,
+ SALOMEDS::Study_ptr theStudy,
+ SALOMEDS::SObject_ptr theSObject);
+ void DeletePrs3d(SalomeApp_Module* theModule,
+ VISU::Prs3d_i* thePrs,
+ const Handle(SALOME_InteractiveObject)& theIO);
+ void ErasePrs3d(const SalomeApp_Module* theModule,
+ VISU::Prs3d_i* thePrs);
+
+ // Presentation management
+ void ChangeRepresentation (const SalomeApp_Module* theModule,
+ VISU::PresentationType theType);
+
+ // SObject type
+ bool CheckTimeStamp(const SalomeApp_Module* theModule,
+ SALOMEDS::SObject_var& theSObject,
+ Handle(SALOME_InteractiveObject)* theIO = NULL);
+ VISU::Result_i* CheckResult(const SalomeApp_Module* theModule,
+ SALOMEDS::SObject_var theSource,
+ VISU::Result_var& theResult);
+ inline bool IsSObjectTable(_PTR(SObject) theSObject);
+
+ // Views
+ SUIT_ViewWindow* GetActiveView(const SalomeApp_Module* theModule,
+ QString theType = QString::null);
+
+ // VTK View
+ TViewWindows GetViews(const SalomeApp_Module* theModule);
+ SVTK_ViewWindow* GetViewWindow(const SalomeApp_Module* theModule,
+ const bool theCreate = false );
SVTK_ViewWindow* GetViewWindow();
- SUIT_ViewWindow* GetActiveView(const SalomeApp_Module* theModule, QString theType = QString::null);
VISU_Actor* PublishInView(const SalomeApp_Module* theModule,
VISU::Prs3d_i* thePrs);
VISU_Actor* UpdateViewer(const SalomeApp_Module* theModule,
- VISU::Prs3d_i* thePrs,
+ VISU::Prs3d_i* thePrs,
bool theDispOnly = false);
VISU_Actor* FindActor(SVTK_ViewWindow* theViewWindow,
void RecreateActor(const SalomeApp_Module* theModule,
VISU::Prs3d_i* thePrs);
- void Add(SalomeApp_SelectionMgr* theSelectionMgr,
- const Handle(SALOME_InteractiveObject)& theIO);
- void Remove(SalomeApp_SelectionMgr* theSelectionMgr,
- const Handle(SALOME_InteractiveObject)& theIO);
-
- SALOMEDS::StudyManager_var GetStudyManager();
- VISU_Gen_i* GetVisuGen(const CAM_Module* theModule);
- SALOME_MED::MED_Gen_var GetMEDEngine();
- CORBA::Object_var GetSelectedObj(const SalomeApp_Study* theStudy,
- const QString& theEntry,
- VISU::Storable::TRestoringMap* theMap = NULL);
- CORBA::Object_var GetSelectedObj(const SalomeApp_Module* theModule,
- Handle(SALOME_InteractiveObject)* theIO = NULL,
- VISU::Storable::TRestoringMap* theMap = NULL);
- bool CheckTimeStamp(const SalomeApp_Module* theModule,
- SALOMEDS::SObject_var& theSObject,
- Handle(SALOME_InteractiveObject)* theIO = NULL);
- inline bool IsSObjectTable(_PTR(SObject) theSObject);
- VISU::Result_i* CheckResult(const SalomeApp_Module* theModule,
- SALOMEDS::SObject_var theSource,
- VISU::Result_var& theResult);
- TViewWindows GetViews(const SalomeApp_Module* theModule);
- void DeletePrs3d(SalomeApp_Module* theModule,
- VISU::Prs3d_i* thePrs,
- const Handle(SALOME_InteractiveObject)& theIO);
- void ErasePrs3d(SalomeApp_Module* theModule,
- VISU::Prs3d_i* thePrs);
-
- SPlot2d_Viewer* GetPlot2dViewer(const SalomeApp_Module* theModule, const bool theCreate = false);
- void PlotTable( const SalomeApp_Module* theModule,
- VISU::Table_i* table,
+ // Plot2d View
+ SPlot2d_Viewer* GetPlot2dViewer(const SalomeApp_Module* theModule,
+ const bool theCreate = false);
+ void PlotTable( const SalomeApp_Module* theModule,
+ VISU::Table_i* table,
int theDisplaying );
- void PlotCurve( const SalomeApp_Module* theModule,
- VISU::Curve_i* curve,
+ void PlotCurve( const SalomeApp_Module* theModule,
+ VISU::Curve_i* curve,
int theDisplaying );
- void PlotContainer( const SalomeApp_Module* theModule,
- VISU::Container_i* container,
+ void PlotContainer( const SalomeApp_Module* theModule,
+ VISU::Container_i* container,
int theDisplaying );
void CreatePlot( SalomeApp_Module* theModule,
_PTR(SObject) theSobj );
+
+ // Others
+ void CreateMesh (const SalomeApp_Module* theModule,
+ const Handle(SALOME_InteractiveObject)& theIO);
+
+ std::vector<VISU::Prs3d_i*> GetPrs3dList (const SalomeApp_Module* theModule,
+ const Handle(SALOME_InteractiveObject)& theIO);
+ std::vector<VISU::Prs3d_i*> GetPrs3dList (const SalomeApp_Module* theModule,
+ SALOMEDS::SObject_ptr theObject);
}
bool VISU::IsSObjectTable( _PTR(SObject) theSObject )
{
- if( theSObject ) {
+ if ( theSObject ) {
_PTR(GenericAttribute) anAttr;
- if(theSObject->FindAttribute( anAttr, "AttributeTableOfInteger" ))
+ if (theSObject->FindAttribute( anAttr, "AttributeTableOfInteger" ))
return true;
- if(theSObject->FindAttribute( anAttr, "AttributeTableOfReal" ))
+ if (theSObject->FindAttribute( anAttr, "AttributeTableOfReal" ))
return true;
- }
+ }
return false;
}
VISU_Result_i.cc VISU_PrsObject_i.cc VISU_Table_i.cc \
VISU_Prs3d_i.cc VISU_Mesh_i.cc VISU_ScalarMap_i.cc \
VISU_IsoSurfaces_i.cc VISU_DeformedShape_i.cc \
- VISU_CutPlanes_i.cc VISU_CutLines_i.cc \
+ VISU_Plot3D_i.cc VISU_CutPlanes_i.cc VISU_CutLines_i.cc \
VISU_Vectors_i.cc VISU_StreamLines_i.cc \
VISU_ViewManager_i.cc VISU_View_i.cc \
VISU_TimeAnimation.cxx VISU_CorbaMedConvertor.cxx \
VISU_Result_i.hh VISU_PrsObject_i.hh VISU_Table_i.hh \
VISU_Prs3d_i.hh VISU_Mesh_i.hh VISU_ScalarMap_i.hh \
VISU_IsoSurfaces_i.hh VISU_DeformedShape_i.hh \
- VISU_CutPlanes_i.hh VISU_CutLines_i.hh \
+ VISU_Plot3D_i.hh VISU_CutPlanes_i.hh VISU_CutLines_i.hh \
VISU_Vectors_i.hh VISU_StreamLines_i.hh \
VISU_ViewManager_i.hh VISU_View_i.hh \
VISU_TimeAnimation.h
// VISU OBJECT : interactive object for VISU entities implementation
//
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
//
//
// File : VISUConfig.hh
#include <map>
#include <string>
-#include <qstring.h>
-#include <qthread.h>
+#include <qstring.h>
+#include <qthread.h>
#include <qfileinfo.h>
#include <qapplication.h>
std::string ToString();
virtual const char* GetComment() const = 0;
typedef std::map<std::string,QString> TRestoringMap;
- typedef Storable* (*TStorableEngine)(SALOMEDS::SObject_ptr theSObject,
+ typedef Storable* (*TStorableEngine)(SALOMEDS::SObject_ptr theSObject,
const std::string& thePrefix, const TRestoringMap& theMap);
typedef std::map<std::string,TStorableEngine> TCallbackMap;
static void Registry(const char* theComment, TStorableEngine theEngine);
- static Storable* Create(SALOMEDS::SObject_ptr, const std::string& thePrefix, const std::string& theString);
+ static Storable* Create(SALOMEDS::SObject_ptr, const std::string& thePrefix, const std::string& theString);
static QString FindValue(const TRestoringMap& theMap, const std::string& theArg, bool* isFind = NULL);
static void StrToMap(const QString& theStr, VISU::Storable::TRestoringMap& theMap);
static SALOMEDS::SObject_ptr GetResultSO(SALOMEDS::SObject_ptr theSObject);
static void DataToStream(std::ostringstream& theStr, const QString& theName, const double theVal);
};
+ //===========================================================================
+ class RemovableObject_i : public virtual POA_VISU::RemovableObject,
+ public virtual Storable
+ {
+ public:
+ virtual void RemoveFromStudy() = 0;
+ };
//===========================================================================
const CORBA::Boolean IsMultifile();
_PTR(SComponent) ClientFindOrCreateVisuComponent(_PTR(Study) theStudyDocument);
SALOMEDS::SComponent_var FindOrCreateVisuComponent(SALOMEDS::Study_ptr theStudyDocument);
- std::string CreateAttributes(SALOMEDS::Study_ptr theStudyDocument,
+ std::string CreateAttributes(SALOMEDS::Study_ptr theStudyDocument,
const char* theFatherEntry, const char* theRefFatherEntry,
- const char* theIOR, const char* theName,
+ const char* theIOR, const char* theName,
const char* thePersistentRef, const char* theComment,
CORBA::Boolean theCreateNew = true);
- std::string CreateAttributes(_PTR(Study) theStudyDocument,
+ std::string CreateAttributes(_PTR(Study) theStudyDocument,
const char* theFatherEntry, const char* theRefFatherEntry,
- const char* theIOR, const char* theName,
+ const char* theIOR, const char* theName,
const char* thePersistentRef, const char* theComment,
CORBA::Boolean theCreateNew = true);
std::string FindEntryWithComment(SALOMEDS::Study_ptr theStudyDocument, const char* theStartEntry,
const char* theComment, int IsAllLevels = true);
-
+
SALOMEDS::SObject_var GetSObject( _PTR(SObject) );
_PTR(SObject) GetClientSObject( SALOMEDS::SObject_var, _PTR(Study) );
SALOMEDS::Study_var GetDSStudy( _PTR(Study) );
}
-
#endif
-
// VISU OBJECT : interactive object for VISU entities implementation
//
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
//
//
// File : VISU_PrsObject_i.hxx
VISU_CutLinesPL *myCutLinesPL;
public:
- static int IsPossible(Result_i* theResult, const char* theMeshName, VISU::Entity theEntity,
+ static int IsPossible(Result_i* theResult, const char* theMeshName, VISU::Entity theEntity,
const char* theFieldName, int theIteration, int isMemoryCheck = true);
- virtual Storable* Create(const char* theMeshName, VISU::Entity theEntity,
+ virtual Storable* Create(const char* theMeshName, VISU::Entity theEntity,
const char* theFieldName, int theIteration);
virtual void ToStream(std::ostringstream& theStr);
void BuildTableOfReal(SALOMEDS::SObject_ptr theSObject);
- static const string myComment;
+ static const std::string myComment;
virtual const char* GetComment() const;
virtual QString GenerateName();
};
}
+
#endif
// VISU OBJECT : interactive object for VISU entities implementation
//
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
//
//
// File : VISU_PrsObject_i.hxx
virtual VISU::CutPlanes::Orientation GetOrientationType();
virtual CORBA::Double GetRotateX();
virtual CORBA::Double GetRotateY();
-
+
virtual void SetDisplacement(CORBA::Double theDisp);
virtual CORBA::Double GetDisplacement();
virtual void SetNbPlanes(CORBA::Long theNb);
virtual CORBA::Long GetNbPlanes();
-
+
typedef VISU::CutPlanes TInterface;
VISU_CutPlanesPL* GetCutPlanesPL(){ return myCutPlanesPL;}
VISU_CutPlanesPL *myCutPlanesPL;
public:
- static int IsPossible(Result_i* theResult, const char* theMeshName, VISU::Entity theEntity,
+ static int IsPossible(Result_i* theResult, const char* theMeshName, VISU::Entity theEntity,
const char* theFieldName, int theIteration, int isMemoryCheck = true);
- virtual Storable* Create(const char* theMeshName, VISU::Entity theEntity,
+ virtual Storable* Create(const char* theMeshName, VISU::Entity theEntity,
const char* theFieldName, int theIteration);
-
+
virtual void ToStream(std::ostringstream& theStr);
-
+
virtual Storable* Restore(const Storable::TRestoringMap& theMap);
-
- static const string myComment;
+
+ static const std::string myComment;
virtual const char* GetComment() const;
virtual QString GenerateName();
};
}
-
#endif
-
-
// VISU OBJECT : interactive object for VISU entities implementation
//
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
//
//
// File : VISU_PrsObject_i.hxx
bool myIsColored;
public:
- static int IsPossible(Result_i* theResult, const char* theMeshName, VISU::Entity theEntity,
+ static int IsPossible(Result_i* theResult, const char* theMeshName, VISU::Entity theEntity,
const char* theFieldName, int theIteration, int isMemoryCheck = true);
- virtual Storable* Create(const char* theMeshName, VISU::Entity theEntity,
+ virtual Storable* Create(const char* theMeshName, VISU::Entity theEntity,
const char* theFieldName, int theIteration);
- static const string myComment;
+ static const std::string myComment;
virtual const char* GetComment() const;
virtual QString GenerateName();
// VISU OBJECT : interactive object for VISU entities implementation
//
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
//
//
// File : VISU_DumpPython.cc
#include "VISU_CutLines_i.hh"
#include "VISU_Vectors_i.hh"
#include "VISU_StreamLines_i.hh"
+#include "VISU_Plot3D_i.hh"
#include "VISU_Table_i.hh"
#include "utilities.h"
-#include <cctype>
-#include <strstream>
-#include <functional>
+#include <cctype>
+#include <strstream>
+#include <functional>
#include <qstring.h>
#include <qfileinfo.h>
typedef std::map<std::string,std::string> TEntry2NameMap;
inline
- std::string
- GenerateName(std::string theName,
+ std::string
+ GenerateName(std::string theName,
SALOMEDS::SObject_ptr theSObject,
TName2EntryMap& theName2EntryMap,
TEntry2NameMap& theEntry2NameMap,
};
inline
- std::string
+ std::string
GetName(SALOMEDS::SObject_ptr theSObject)
{
CORBA::String_var aString = theSObject->GetName();
}
inline
- std::string
+ std::string
GenerateName(SALOMEDS::SObject_ptr theSObject,
TName2EntryMap& theName2EntryMap,
TEntry2NameMap& theEntry2NameMap)
//===========================================================================
std::string
ScalarMapToPython(SALOMEDS::SObject_ptr theSObject,
- VISU::ScalarMap_i* theServant,
+ VISU::ScalarMap_i* theServant,
std::ostream& theStr,
std::string& theName,
const std::string& theConstructorName,
theStr<<thePrefix<<"aName2ObjectMap['"<<theName<<"'] = "<<theName<<endl;
theStr<<thePrefix<<theName<<".SetScalarMode("<<theServant->GetScalarMode()<<")"<<endl;
-
+
switch(theServant->GetScaling()){
case LINEAR:
aParam = "VISU.LINEAR";
}
theStr<<thePrefix<<theName<<".SetScaling("<<aParam<<")"<<endl;
theStr<<thePrefix<<theName<<".SetRange("<<theServant->GetMin()<<","<<theServant->GetMax()<<")"<<endl;
-
+
switch(theServant->GetBarOrientation()){
case ScalarMap::HORIZONTAL:
aParam = "VISU.ScalarMap.HORIZONTAL";
break;
}
theStr<<thePrefix<<theName<<".SetBarOrientation("<<aParam<<")"<<endl;
-
+
theStr<<thePrefix<<theName<<".SetPosition("<<theServant->GetPosX()<<","<<theServant->GetPosY()<<")"<<endl;
theStr<<thePrefix<<theName<<".SetSize("<<theServant->GetWidth()<<","<<theServant->GetHeight()<<")"<<endl;
theStr<<thePrefix<<theName<<".SetNbColors("<<theServant->GetNbColors()<<")"<<endl;
//===========================================================================
std::string
DeformedShapeToPython(SALOMEDS::SObject_ptr theSObject,
- VISU::DeformedShape_i* theServant,
+ VISU::DeformedShape_i* theServant,
std::ostream& theStr,
std::string& theName,
const std::string& theConstructorName,
TEntry2NameMap& theEntry2NameMap,
std::string theArgumentName,
std::string thePrefix);
-
+
//===========================================================================
template<class TTableAttr>
void
std::string theArgumentName,
std::string thePrefix)
{
- SALOMEDS::GenericAttribute_var anAttr;
+ SALOMEDS::GenericAttribute_var anAttr;
SALOMEDS::SObject_var aFatherSObject = theSObject->GetFather();
if(aFatherSObject->FindAttribute(anAttr,"AttributeComment")){
- SALOMEDS::AttributeComment_var aComment =
+ SALOMEDS::AttributeComment_var aComment =
SALOMEDS::AttributeComment::_narrow(anAttr);
CORBA::String_var aValue = aComment->Value();
- Storable::TRestoringMap aMap;
+ Storable::TRestoringMap aMap;
Storable::StrToMap(aValue.in(),aMap);
bool anIsExist;
QString aMethodName = VISU::Storable::FindValue(aMap,"myComment",&anIsExist);
theStr<<thePrefix<<"anID = "<<aSObjectName<<".GetID()"<<endl;
theStr<<thePrefix<<aName<<" = aVisu.CreateTable(anID)"<<endl;
theArgumentName = aName;
-
+
theStr<<thePrefix<<"if "<<aName<<":"<<endl;
std::string aPrefix2 = thePrefix + PREFIX;
{
SALOMEDS::GenericAttribute_var anAttr;
if(theSObject->FindAttribute(anAttr,"AttributeTableOfInteger")){
- SALOMEDS::AttributeTableOfInteger_var aTableAttr =
+ SALOMEDS::AttributeTableOfInteger_var aTableAttr =
SALOMEDS::AttributeTableOfInteger::_narrow(anAttr);
-
+
TableAttrToPython(theStudy,
theIsPublished,
theIsValidScript,
theEntry2NameMap,
theArgumentName,
thePrefix);
-
+
}else if(theSObject->FindAttribute(anAttr,"AttributeTableOfReal")){
- SALOMEDS::AttributeTableOfReal_var aTableAttr =
+ SALOMEDS::AttributeTableOfReal_var aTableAttr =
SALOMEDS::AttributeTableOfReal::_narrow(anAttr);
-
+
TableAttrToPython(theStudy,
theIsPublished,
theIsValidScript,
case Result_i::eImportFile:
theStr<<thePrefix<<aName<<" = aVisu.ImportFile('"<<aFileName<<"')"<<endl;
break;
- case Result_i::eCopyAndImportFile:
+ case Result_i::eCopyAndImportFile:
theStr<<thePrefix<<aName<<" = aVisu.CopyAndImportFile('"<<aFileName<<"')"<<endl;
break;
}
theStr<<thePrefix<<"if "<<aName<<":"<<endl;
thePrefix += PREFIX;
-
+
theArgumentName = aName;
DumpChildrenToPython(theStudy,
theIsPublished,
theEntry2NameMap,
theArgumentName,
thePrefix);
-
+
theStr<<thePrefix<<"pass"<<endl<<endl;
}else{
SALOMEDS::SObject_var aRefSObj;
thePrefix += PREFIX;
switch(anId){
- case Result_i::eImportMed:
+ case Result_i::eImportMed:
theStr<<thePrefix<<aName<<" = aVisu.ImportMed(aSObject)"<<endl;
break;
case Result_i::eImportMedField:
theStr<<thePrefix<<"if "<<aName<<":"<<endl;
std::string aPrefix2 = thePrefix;
thePrefix += PREFIX;
-
+
theArgumentName = aName;
DumpChildrenToPython(theStudy,
theIsPublished,
theEntry2NameMap,
theArgumentName,
thePrefix);
-
+
theStr<<thePrefix<<"pass"<<endl<<endl;
theStr<<aPrefix2<<"pass"<<endl<<endl;
theStr<<aPrefix1<<"pass"<<endl<<endl;
aParam = "VISU.CELL";
break;
}
-
+
if(aSubMeshName == "")
theStr<<thePrefix<<aName<<" = aVisu.MeshOnEntity("<<theArgumentName<<
",'"<<aServant->GetMeshName()<<"'"<<
",'"<<aServant->GetMeshName()<<"'"<<
",'"<<aSubMeshName<<"'"<<
")"<<endl;
-
+
theStr<<thePrefix<<"if "<<aName<<":"<<endl;
thePrefix += PREFIX;
aColor = aServant->GetCellColor();
theStr<<thePrefix<<aName<<".SetCellColor(SALOMEDS.Color("<<
aColor.R<<","<<aColor.G<<","<<aColor.B<<"))"<<endl;
-
+
aColor = aServant->GetNodeColor();
theStr<<thePrefix<<aName<<".SetNodeColor(SALOMEDS.Color("<<
aColor.R<<","<<aColor.G<<","<<aColor.B<<"))"<<endl;
-
+
aColor = aServant->GetLinkColor();
theStr<<thePrefix<<aName<<".SetLinkColor(SALOMEDS.Color("<<
aColor.R<<","<<aColor.G<<","<<aColor.B<<"))"<<endl;
-
+
std::string aParam;
switch(aServant->GetPresentationType()){
case POINT:
theEntry2NameMap,
theArgumentName,
thePrefix);
-
+
theStr<<thePrefix<<"pass"<<endl<<endl;
return;
}
case VISU::TSTREAMLINES:
if(StreamLines_i* aServant = dynamic_cast<StreamLines_i*>(GetServant(anObj).in())){
thePrefix = DeformedShapeToPython(theSObject,aServant,theStr,aName,"StreamLinesOnField",theArgumentName,thePrefix);
-
+
std::string aParam;
switch(aServant->GetDirection()){
case StreamLines::FORWARD:
theStr<<thePrefix<<"aPrs3d = aName2ObjectMap['"<<anArg<<"']"<<endl;
}
}
-
+
theStr<<thePrefix<<aName<<".SetParams("<<
aServant->GetIntegrationStep()<<","<<
aServant->GetPropagationTime()<<","<<
case VISU::TVECTORS:
if(Vectors_i* aServant = dynamic_cast<Vectors_i*>(GetServant(anObj).in())){
thePrefix = DeformedShapeToPython(theSObject,aServant,theStr,aName,"VectorsOnField",theArgumentName,thePrefix);
-
+
theStr<<thePrefix<<aName<<".SetLineWidth("<<aServant->GetLineWidth()<<")"<<endl;
-
+
std::string aParam;
switch(aServant->GetGlyphType()){
case Vectors::ARROW:
break;
}
theStr<<thePrefix<<aName<<".SetGlyphType("<<aParam<<")"<<endl;
-
+
switch(aServant->GetGlyphPos()){
case Vectors::CENTER:
aParam = "VISU.Vectors.CENTER";
case VISU::TCUTPLANES:
if(CutPlanes_i* aServant = dynamic_cast<CutPlanes_i*>(GetServant(anObj).in())){
thePrefix = ScalarMapToPython(theSObject,aServant,theStr,aName,"CutPlanesOnField",theArgumentName,thePrefix);
-
+
std::string aParam;
switch(aServant->GetOrientationType()){
case CutPlanes::XY:
break;
}
theStr<<thePrefix<<aName<<".SetOrientation("<<aParam<<","<<aServant->GetRotateX()<<","<<aServant->GetRotateY()<<")"<<endl;
-
+
theStr<<thePrefix<<aName<<".SetDisplacement("<<aServant->GetDisplacement()<<")"<<endl;
CORBA::Long aNbPlanes = aServant->GetNbPlanes();
theStr<<thePrefix<<aName<<".SetNbPlanes("<<aNbPlanes<<")"<<endl;
-
+
for(CORBA::Long anId = 0; anId < aNbPlanes; anId++){
if(!aServant->IsDefault(anId))
theStr<<thePrefix<<aName<<".SetPlanePosition("<<anId<<","<<aServant->GetPlanePosition(anId)<<")"<<endl;
case VISU::TCUTLINES:
if(CutLines_i* aServant = dynamic_cast<CutLines_i*>(GetServant(anObj).in())){
thePrefix = ScalarMapToPython(theSObject,aServant,theStr,aName,"CutLinesOnField",theArgumentName,thePrefix);
-
+
std::string aParam;
switch(aServant->GetOrientationType()){
case CutPlanes::XY:
break;
}
theStr<<thePrefix<<aName<<".SetOrientation("<<aParam<<","<<aServant->GetRotateX()<<","<<aServant->GetRotateY()<<")"<<endl;
-
+
switch(aServant->GetOrientationType2()){
case CutPlanes::XY:
aParam = "VISU.CutPlanes.XY";
break;
}
theStr<<thePrefix<<aName<<".SetOrientation2("<<aParam<<","<<aServant->GetRotateX2()<<","<<aServant->GetRotateY2()<<")"<<endl;
-
+
theStr<<thePrefix<<aName<<".SetDisplacement("<<aServant->GetDisplacement()<<")"<<endl;
theStr<<thePrefix<<aName<<".SetDisplacement2("<<aServant->GetDisplacement2()<<")"<<endl;
-
+
if(!aServant->IsDefault())
theStr<<thePrefix<<aName<<".SetBasePlanePosition("<<aServant->GetBasePlanePosition()<<")"<<endl;
-
+
CORBA::Long aNbLines = aServant->GetNbLines();
theStr<<thePrefix<<aName<<".SetNbLines("<<aNbLines<<")"<<endl;
for(CORBA::Long anId = 0; anId < aNbLines; anId++){
theStr<<thePrefix<<"pass"<<endl<<endl;
}
return;
+ case VISU::TPLOT3D:
+ if (Plot3D_i* aServant = dynamic_cast<Plot3D_i*>(GetServant(anObj).in())) {
+ // jfa: TODO
+ /*thePrefix = ScalarMapToPython(theSObject, aServant, theStr, aName,
+ "Plot3DOnField", theArgumentName, thePrefix);
+
+ std::string aParam;
+ switch(aServant->GetOrientationType()){
+ case CutPlanes::XY:
+ aParam = "VISU.CutPlanes.XY";
+ break;
+ case CutPlanes::YZ:
+ aParam = "VISU.CutPlanes.YZ";
+ break;
+ case CutPlanes::ZX:
+ aParam = "VISU.CutPlanes.ZX";
+ break;
+ }
+ theStr<<thePrefix<<aName<<".SetOrientation("<<aParam<<","<<aServant->GetRotateX()<<","<<aServant->GetRotateY()<<")"<<endl;
+
+ theStr<<thePrefix<<aName<<".SetDisplacement("<<aServant->GetDisplacement()<<")"<<endl;
+ CORBA::Long aNbPlanes = aServant->GetNbPlanes();
+ theStr<<thePrefix<<aName<<".SetNbPlanes("<<aNbPlanes<<")"<<endl;
+
+ for(CORBA::Long anId = 0; anId < aNbPlanes; anId++){
+ if(!aServant->IsDefault(anId))
+ theStr<<thePrefix<<aName<<".SetPlanePosition("<<anId<<","<<aServant->GetPlanePosition(anId)<<")"<<endl;
+ }
+
+ theStr<<thePrefix<<"pass"<<endl<<endl;*/
+ }
+ return;
case VISU::TCURVE:
if(Curve_i* aServant = dynamic_cast<Curve_i*>(GetServant(anObj).in()))
{
SALOMEDS::Color aColor = aServant->GetColor();
theStr << ",SALOMEDS.Color("<<
aColor.R<<","<<aColor.G<<","<<aColor.B<<")"; // color
-
+
std::string aParam;
switch(aServant->GetMarker()){
case Curve::NONE: aParam = "VISU.Curve.NONE"; break;
using namespace SALOMEDS;
AttributeComment_var aComment = AttributeComment::_narrow(anAttr);
CORBA::String_var aValue = aComment->Value();
- Storable::TRestoringMap aMap;
+ Storable::TRestoringMap aMap;
Storable::StrToMap(aValue.in(),aMap);
bool anIsExist;
QString aSourceId = VISU::Storable::FindValue(aMap,"mySourceId",&anIsExist);
theStr<<thePrefix<<"anID = aSObject.GetID()"<<endl;
theStr<<thePrefix<<aName<<" = aVisu.CreateTable(anID)"<<endl;
theStr<<endl;
-
+
theArgumentName = aName;
DumpChildrenToPython(theStudy,
theIsPublished,
theEntry2NameMap,
theArgumentName,
thePrefix);
-
+
theStr<<thePrefix<<"pass"<<endl<<endl;
theStr<<aPrefix<<"pass"<<endl<<endl;
}else if(strcmp(aSourceId.latin1(),"TableFile") == 0){
theStr<<thePrefix<<"anIsFound, aSObject = "<<theArgumentName<<".FindSubObject("<<aTag<<")"<<endl;
theStr<<thePrefix<<"if anIsFound:"<<endl;
thePrefix += PREFIX;
-
+
theStr<<thePrefix<<"anID = aSObject.GetID()"<<endl;
theStr<<thePrefix<<aName<<" = aVisu.CreateTable(anID)"<<endl;
theStr<<endl;
theEntry2NameMap,
theArgumentName,
thePrefix);
-
+
theStr<<thePrefix<<"pass"<<endl<<endl;
}else if(strcmp(aSourceId.latin1(),"TableAttr") == 0){
theArgumentName = aName;
}else{
SALOMEDS::GenericAttribute_var anAttr;
if(theSObject->FindAttribute(anAttr,"AttributeComment")){
- SALOMEDS::AttributeComment_var aComment =
+ SALOMEDS::AttributeComment_var aComment =
SALOMEDS::AttributeComment::_narrow(anAttr);
CORBA::String_var aValue = aComment->Value();
- Storable::TRestoringMap aMap;
+ Storable::TRestoringMap aMap;
Storable::StrToMap(aValue.in(),aMap);
bool anIsExist;
QString aTypeName = VISU::Storable::FindValue(aMap,"myComment",&anIsExist);
theEntry2NameMap,
theArgumentName,
thePrefix);
-
+
theStr<<thePrefix<<"pass"<<endl<<endl;
return;
}
SALOMEDS::SObject_var aTargetRefSObj;
if(theSObject->ReferencedObject(aTargetRefSObj)){
CORBA::Object_var anObj = SObjectToObject(aTargetRefSObj);
- if(CORBA::is_nil(anObj))
+ if(CORBA::is_nil(anObj))
return;
-
+
VISU::Base_var aBase = VISU::Base::_narrow(anObj);
- if(CORBA::is_nil(aBase))
+ if(CORBA::is_nil(aBase))
return;
-
+
if(aBase->GetType() == VISU::TCURVE){
CORBA::String_var anID = aTargetRefSObj->GetID();
std::string anArg = theEntry2NameMap[anID.in()];
for(aChildItet->InitEx(false); aChildItet->More(); aChildItet->Next()){
SALOMEDS::SObject_var aSObject = aChildItet->Value();
CORBA::Object_var anObj = SObjectToObject(aSObject);
- if(CORBA::is_nil(anObj))
+ if(CORBA::is_nil(anObj))
continue;
VISU::Base_var aBase = VISU::Base::_narrow(anObj);
- if(CORBA::is_nil(aBase))
+ if(CORBA::is_nil(aBase))
continue;
if(aBase->GetType() == VISU::TCONTAINER){
//===========================================================================
- Engines::TMPFile*
+ Engines::TMPFile*
VISU_Gen_i::
DumpPython(CORBA::Object_ptr theStudy,
CORBA::Boolean theIsPublished,
CORBA::Boolean& theIsValidScript)
{
SALOMEDS::Study_var aStudy = SALOMEDS::Study::_narrow(theStudy);
- if(CORBA::is_nil(aStudy))
+ if(CORBA::is_nil(aStudy))
return new Engines::TMPFile(0);
TName2EntryMap aName2EntryMap;
#ifndef COUT
ostringstream aStr;
#else
-#define aStr cout
+#define aStr cout
#endif
std::string aPrefix(PREFIX);
CORBA::ULong aSize = aResult.size() + 1;
char* aBuffer = new char[aSize];
strcpy(aBuffer,&aResult[0]);
- return new Engines::TMPFile(aSize,aSize,(CORBA::Octet*)aBuffer,1);
+ return new Engines::TMPFile(aSize,aSize,(CORBA::Octet*)aBuffer,1);
#else
#undef aStr
return new Engines::TMPFile(0);
#endif
}
-
}
#include "VISU_CutLines_i.hh"
#include "VISU_Vectors_i.hh"
#include "VISU_StreamLines_i.hh"
+#include "VISU_Plot3D_i.hh"
#include "VISU_Table_i.hh"
#include "VISU_TimeAnimation.h"
Storable::Registry(CutLines_i::myComment.c_str(),&(Restore<CutLines_i>));
Storable::Registry(IsoSurfaces_i::myComment.c_str(),&(Restore<IsoSurfaces_i>));
Storable::Registry(StreamLines_i::myComment.c_str(),&(Restore<StreamLines_i>));
+ Storable::Registry(Plot3D_i::myComment.c_str(),&(Restore<Plot3D_i>));
Storable::Registry(Vectors_i::myComment.c_str(),&(Restore<Vectors_i>));
Storable::Registry(Table_i::myComment.c_str(),&(Table_i::Restore));
Storable::Registry(Curve_i::myComment.c_str(),&(Curve_i::Restore));
void VISU_Gen_i::SetCurrentStudy (SALOMEDS::Study_ptr theStudy)
{
- class TEvent: public SALOME_Event {
+ class TEvent: public SALOME_Event {
std::string myStudyName;
public:
- TEvent(const std::string theStudyName):myStudyName(theStudyName)
- {}
+ TEvent(const std::string theStudyName):myStudyName(theStudyName)
+ {}
virtual void Execute()
{
bool isActive = false;
}
}
};
-
+
if (!CORBA::is_nil(theStudy))
{
CORBA::String_var aName = theStudy->Name();
MESSAGE("StudyId = " << theStudy->StudyId() << "; Name = '" << aName.in() << "'");
myStudyDocument = SALOMEDS::Study::_duplicate(theStudy);
- ProcessVoidEvent(new TEvent(aStudyName));
+ ProcessVoidEvent(new TEvent(aStudyName));
} else {
MESSAGE("CORBA::is_nil(theStudy)");
}
return Prs3dOnField<VISU::StreamLines_i>(theResult,theMeshName,theEntity,theFieldName,theIteration)._retn();
}
+ Plot3D_ptr VISU_Gen_i::Plot3DOnField(Result_ptr theResult,
+ const char* theMeshName,
+ VISU::Entity theEntity,
+ const char* theFieldName,
+ CORBA::Double theIteration)
+ {
+ return Prs3dOnField<VISU::Plot3D_i>(theResult,theMeshName,theEntity,theFieldName,theIteration)._retn();
+ }
+
CutPlanes_ptr VISU_Gen_i::CutPlanesOnField(Result_ptr theResult,
const char* theMeshName,
VISU::Entity theEntity,
return VISU::Animation::_nil();
}
- void DeletePrs3d (Prs3d_ptr thePrs3d)
- {
- Prs3d_i* aPrs3d = dynamic_cast<Prs3d_i*>(GetServant(thePrs3d).in());
- if (!aPrs3d)
- return;
-
- // 1. Find appropriate application (code like in VISU_ViewManager_i.cxx)
- SALOMEDS::Study_var myStudyDocument = aPrs3d->GetStudyDocument();
- SalomeApp_Application* anApp = NULL;
- CORBA::String_var studyName = myStudyDocument->Name();
- std::string aStudyName = studyName.in();
- SUIT_Session* aSession = SUIT_Session::session();
- QPtrList<SUIT_Application> anApplications = aSession->applications();
- QPtrListIterator<SUIT_Application> anIter (anApplications);
- while (SUIT_Application* aSUITApp = anIter.current()) {
- ++anIter;
- if (SUIT_Study* aSStudy = aSUITApp->activeStudy()) {
- if (SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>(aSStudy)) {
- if (_PTR(Study) aCStudy = aStudy->studyDS()) {
- if (aStudyName == aCStudy->Name()) {
- anApp = dynamic_cast<SalomeApp_Application*>(aSUITApp);
- break;
- }
- }
- }
- }
- }
- if (!anApp)
- return;
-
- // 2. Remove corresponding IO from selection
- SALOMEDS::SObject_var aSObject = aPrs3d->GetSObject();
- CORBA::String_var anEntry = aSObject->GetID();
-
- SalomeApp_SelectionMgr* aSelectionMgr = anApp->selectionMgr();
- SALOME_ListIO aListIO, aNewListIO;
- aSelectionMgr->selectedObjects(aListIO);
-
- for (SALOME_ListIteratorOfListIO it (aListIO); it.More(); it.Next()) {
- if (it.Value()->hasEntry()) {
- std::string aCurEntry (it.Value()->getEntry());
- if (aCurEntry != std::string( anEntry.in() ) ) {
- aNewListIO.Append(it.Value());
- }
- }
- }
-
- aSelectionMgr->setSelectedObjects(aNewListIO);
-
- // 3. Remove Actors
- ViewManagerList aViewManagerList;
- anApp->viewManagers(SVTK_Viewer::Type(), aViewManagerList);
- QPtrListIterator<SUIT_ViewManager> anVMIter (aViewManagerList);
- for (; anVMIter.current(); ++anVMIter) {
- SUIT_ViewManager* aViewManager = anVMIter.current();
- QPtrVector<SUIT_ViewWindow> aViews = aViewManager->getViews();
- for (int i = 0, iEnd = aViews.size(); i < iEnd; i++) {
- if (SUIT_ViewWindow* aViewWindow = aViews.at(i)) {
- if (SVTK_ViewWindow* vw = dynamic_cast<SVTK_ViewWindow*>(aViewWindow)) {
- //VISU_Actor* anActor = aVISUViewManager->GetActor(aPrs3d, vw);
- VISU_Actor* anActor = NULL;
- vtkActorCollection *anActColl = vw->getRenderer()->GetActors();
- anActColl->InitTraversal();
- vtkActor *aVTKActor = anActColl->GetNextActor();
- for (; !anActor && aVTKActor; aVTKActor = anActColl->GetNextActor()) {
- if (VISU_Actor* anVISUActor = dynamic_cast<VISU_Actor*>(aVTKActor)) {
- if (aPrs3d == anVISUActor->GetPrs3d()) {
- anActor = anVISUActor->GetParent();
- }
- }
- }
- if (anActor) {
- vw->RemoveActor(anActor);
- anActor->Delete();
- }
- }
- }
- }
- }
-
- aPrs3d->RemoveFromStudy();
- aPrs3d->Destroy();
-
- //jfa tmp:theModule->updateObjBrowser(); //update Object browser
- }
-
void VISU_Gen_i::DeleteResult (Result_ptr theResult)
{
class TEvent: public SALOME_Event {
Result_ptr myResult;
public:
TEvent(Result_ptr theResult): myResult(theResult) {}
- virtual void Execute(){
+ virtual void Execute()
+ {
if (Result_i* aResult = dynamic_cast<Result_i*>(GetServant(myResult).in())) {
SALOMEDS::SObject_var aSObject = aResult->GetSObject();
- SALOMEDS::Study_var aStudyDocument = aSObject->GetStudy();
- SALOMEDS::ChildIterator_var aChildIter = aStudyDocument->NewChildIterator(aSObject);
- for(aChildIter->InitEx(true); aChildIter->More(); aChildIter->Next()){
- SALOMEDS::SObject_var aChildSObject = aChildIter->Value();
- CORBA::Object_var aChildObj = VISU::SObjectToObject(aChildSObject);
- if(CORBA::is_nil(aChildObj)) continue;
- VISU::Prs3d_var aPrs3d = VISU::Prs3d::_narrow(aChildObj);
- if(CORBA::is_nil(aPrs3d)) continue;
- VISU::DeletePrs3d(aPrs3d);
- }
-
- aResult->RemoveFromStudy();
- aResult->Destroy();
+ VISU::RemoveFromStudy(aSObject,
+ false, // not only attribute
+ true); // destroy sub-objects
//jfa tmp:if (QAD_Desktop* aDesktop = QAD_Application::getDesktop())
//jfa tmp: if (QAD_Study* aStudy = aDesktop->findStudy(aStudyDocument))
//jfa tmp: aStudy->updateObjBrowser(); //update Object browser
}
+
+ myResult->Destroy();
}
};
public:
TEvent(Prs3d_ptr thePrs3d): myPrs3d(thePrs3d) {}
virtual void Execute() {
- VISU::DeletePrs3d(myPrs3d);
+ myPrs3d->RemoveFromStudy();
+
+ //update Object browser
+ /*jfa tmp:if (QAD_Desktop* aDesktop = QAD_Application::getDesktop()) {
+ if (Prs3d_i* aPrs3d = dynamic_cast<Prs3d_i*>(GetServant(myPrs3d).in())) {
+ SALOMEDS::SObject_var aSObject = aPrs3d->GetSObject();
+ SALOMEDS::Study_var aStudyDocument = aSObject->GetStudy();
+ if (QAD_Study* aStudy = aDesktop->findStudy(aStudyDocument))
+ aStudy->updateObjBrowser();
+ }
+ }*/
+
+ myPrs3d->Destroy();
}
};
virtual StreamLines_ptr StreamLinesOnField(Result_ptr theResult,
const char* theMeshName, VISU::Entity theEntity,
const char* theFieldName, CORBA::Double theIteration);
+ virtual Plot3D_ptr Plot3DOnField(Result_ptr theResult,
+ const char* theMeshName, VISU::Entity theEntity,
+ const char* theFieldName, CORBA::Double theIteration);
//Create Digital Presentation
virtual Table_ptr CreateTable(const char* theTableEntry);
virtual Curve_ptr CreateCurve(Table_ptr theTable, CORBA::Long theHRow, CORBA::Long theVRow);
// VISU OBJECT : interactive object for VISU entities implementation
//
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
//
//
// File : VISU_PrsObject_i.hxx
VISU_IsoSurfacesPL* myIsoSurfacesPL;
public:
- static int IsPossible(Result_i* theResult, const char* theMeshName, VISU::Entity theEntity,
+ static int IsPossible(Result_i* theResult, const char* theMeshName, VISU::Entity theEntity,
const char* theFieldName, int theIteration, int isMemoryCheck = true);
- virtual Storable* Create(const char* theMeshName, VISU::Entity theEntity,
+ virtual Storable* Create(const char* theMeshName, VISU::Entity theEntity,
const char* theFieldName, int theIteration);
- static const string myComment;
+ static const std::string myComment;
virtual const char* GetComment() const;
virtual QString GenerateName();
// Author : Alexey PETROV
// Module : VISU
-#include "VISU_MeshPL.hxx"
-#include "VISU_Result_i.hh"
#include "VISU_Mesh_i.hh"
+
+#include "VISU_Result_i.hh"
+#include "VISU_ViewManager_i.hh"
+
+#include "VISU_MeshPL.hxx"
#include "VISU_MeshAct.h"
using namespace VISU;
}
-void VISU::Mesh_i::RemoveFromStudy(){
+void VISU::Mesh_i::RemoveFromStudy()
+{
+ VISU::DeleteActors(this);
VISU::RemoveFromStudy(mySObject);
}
VISU_MeshPL* myMeshPL;
- string myMeshName;
- //jfa IPAL9284:TEntity myEntity;
- int myEntity;//jfa IPAL9284
- string mySubMeshName;
+ // std::string myMeshName; move it to Prs3d_i
+ int myEntity;//jfa IPAL9284: TEntity myEntity;
+ std::string mySubMeshName;
VISU::VISUType myType;
VISU::PresentationType myPresentType;
struct SALOMEDS::Color myCellColor, myNodeColor, myLinkColor;
public:
- static int IsPossible(Result_i* theResult, const char* theMeshName, Entity theEntity, const char* theFamilyName = "");
+ static int IsPossible(Result_i* theResult, const char* theMeshName,
+ Entity theEntity, const char* theFamilyName = "");
virtual Storable* Create(const char* theMeshName, Entity theEntity, const char* theFamilyName = "");
static int IsPossible(Result_i* theResult, const char* theMeshName, const char* theGroupName);
virtual void ToStream(std::ostringstream& theStr);
virtual const char* GetComment() const;
- static const string myComment;
+ static const std::string myComment;
virtual QString GenerateName();
virtual Storable* Restore(const Storable::TRestoringMap& theMap);
}
#endif
-
-
--- /dev/null
+
+#include "VISU_Plot3D_i.hh"
+
+#include "VISU_Result_i.hh"
+
+#include "VISU_Plot3DPL.hxx"
+
+#include "VISU_Actor.h"
+
+using namespace VISU;
+using namespace std;
+
+#ifdef _DEBUG_
+static int MYDEBUG = 0;
+#else
+static int MYDEBUG = 0;
+#endif
+
+int VISU::Plot3D_i::IsPossible(Result_i* theResult, const char* theMeshName, VISU::Entity theEntity,
+ const char* theFieldName, int theIteration, int isMemoryCheck)
+{
+ return VISU::ScalarMap_i::IsPossible
+ (theResult,theMeshName,theEntity,theFieldName,theIteration,isMemoryCheck);
+}
+
+int VISU::Plot3D_i::myNbPresent = 0;
+QString VISU::Plot3D_i::GenerateName() { return VISU::GenerateName("Plot3D",myNbPresent++); }
+
+const string VISU::Plot3D_i::myComment = "PLOT3D";
+const char* VISU::Plot3D_i::GetComment() const { return myComment.c_str(); }
+
+VISU::Plot3D_i::Plot3D_i (Result_i* theResult, bool theAddToStudy)
+ : PrsObject_i(theResult->GetStudyDocument()),
+ Prs3d_i(theResult,theAddToStudy),
+ ScalarMap_i(theResult,theAddToStudy),
+ myPlot3DPL(NULL)
+{
+}
+
+VISU::Plot3D_i::Plot3D_i (Result_i* theResult, SALOMEDS::SObject_ptr theSObject)
+ : PrsObject_i(theResult->GetStudyDocument()),
+ Prs3d_i(theResult,theSObject),
+ ScalarMap_i(theResult,theSObject),
+ myPlot3DPL(NULL)
+{
+}
+
+void VISU::Plot3D_i::SameAs (const Plot3D_i* theOrigin)
+{
+ VISU::ScalarMap_i::SameAs(theOrigin);
+}
+
+VISU::Storable* VISU::Plot3D_i::Create (const char* theMeshName, VISU::Entity theEntity,
+ const char* theFieldName, int theIteration)
+{
+ return ScalarMap_i::Create(theMeshName,theEntity,theFieldName,theIteration);
+}
+
+VISU::Storable* VISU::Plot3D_i::Restore (const Storable::TRestoringMap& theMap)
+{
+ DoHook();
+ SetOrientation(VISU::Plot3D::Orientation(VISU::Storable::FindValue(theMap,"myBasePlane").toInt()),
+ Storable::FindValue(theMap,"aRot[0]").toDouble(),
+ Storable::FindValue(theMap,"aRot[1]").toDouble());
+ SetPlanePosition(VISU::Storable::FindValue(theMap,"myPlanePosition").toDouble(),
+ VISU::Storable::FindValue(theMap,"myPlaneCondition").toInt());
+ SetScaleFactor(VISU::Storable::FindValue(theMap,"myScaleFactor").toDouble());
+ SetContourPrs(VISU::Storable::FindValue(theMap,"myContourPrs").toInt());
+ SetNbOfContours(VISU::Storable::FindValue(theMap,"myNbOfContours").toInt());
+
+ return ScalarMap_i::Restore(theMap);
+}
+
+void VISU::Plot3D_i::ToStream (std::ostringstream& theStr)
+{
+ ScalarMap_i::ToStream(theStr);
+
+ Storable::DataToStream(theStr, "myBasePlane", int(GetOrientationType()));
+ Storable::DataToStream(theStr, "aRot[0]", GetRotateX());
+ Storable::DataToStream(theStr, "aRot[1]", GetRotateY());
+ Storable::DataToStream(theStr, "myPlanePosition", GetPlanePosition());
+ Storable::DataToStream(theStr, "myPlaneCondition", int(IsPositionRelative()));
+ Storable::DataToStream(theStr, "myScaleFactor", GetScaleFactor());
+ Storable::DataToStream(theStr, "myContourPrs", int(GetIsContourPrs()));
+ Storable::DataToStream(theStr, "myNbOfContours", int(GetNbOfContours()));
+}
+
+VISU::Plot3D_i::~Plot3D_i(){
+ if(MYDEBUG) MESSAGE("Plot3D_i::~Plot3D_i()");
+}
+
+void VISU::Plot3D_i::SetOrientation (VISU::Plot3D::Orientation theOrient,
+ CORBA::Double theXAngle, CORBA::Double theYAngle)
+{
+ myPlot3DPL->SetOrientation(VISU_CutPlanesPL::PlaneOrientation(theOrient),
+ theXAngle,theYAngle);
+}
+
+VISU::Plot3D::Orientation VISU::Plot3D_i::GetOrientationType()
+{
+ return VISU::Plot3D::Orientation(myPlot3DPL->GetPlaneOrientation());
+}
+
+CORBA::Double VISU::Plot3D_i::GetRotateX()
+{
+ return myPlot3DPL->GetRotateX();
+}
+
+CORBA::Double VISU::Plot3D_i::GetRotateY()
+{
+ return myPlot3DPL->GetRotateY();
+}
+
+void VISU::Plot3D_i::SetPlanePosition (CORBA::Double thePlanePosition,
+ CORBA::Boolean theIsRelative)
+{
+ myPlot3DPL->SetPlanePosition(thePlanePosition, theIsRelative);
+}
+
+CORBA::Double VISU::Plot3D_i::GetPlanePosition()
+{
+ return myPlot3DPL->GetPlanePosition();
+}
+
+CORBA::Boolean VISU::Plot3D_i::IsPositionRelative()
+{
+ return myPlot3DPL->IsPositionRelative();
+}
+
+void VISU::Plot3D_i::SetScaleFactor (CORBA::Double theScaleFactor)
+{
+ myPlot3DPL->SetScaleFactor(theScaleFactor);
+}
+
+CORBA::Double VISU::Plot3D_i::GetScaleFactor()
+{
+ return myPlot3DPL->GetScaleFactor();
+}
+
+void VISU::Plot3D_i::SetNbOfContours (CORBA::Long theNb)
+{
+ myPlot3DPL->SetNumberOfContours(theNb);
+}
+
+CORBA::Long VISU::Plot3D_i::GetNbOfContours()
+{
+ return myPlot3DPL->GetNumberOfContours();
+}
+
+void VISU::Plot3D_i::SetContourPrs (CORBA::Boolean theIsContourPrs )
+{
+ myPlot3DPL->SetContourPrs( theIsContourPrs );
+}
+
+CORBA::Boolean VISU::Plot3D_i::GetIsContourPrs()
+{
+ return myPlot3DPL->GetIsContourPrs();
+}
+
+void VISU::Plot3D_i::DoHook()
+{
+ if (!myPipeLine) myPipeLine = VISU_Plot3DPL::New();
+ myPlot3DPL = dynamic_cast<VISU_Plot3DPL*>(myPipeLine);
+
+ ScalarMap_i::DoHook();
+}
+
+void VISU::Plot3D_i::SetMapScale(double theMapScale)
+{
+ myPlot3DPL->SetMapScale(theMapScale);
+}
--- /dev/null
+
+#ifndef VISU_Plot3D_i_HeaderFile
+#define VISU_Plot3D_i_HeaderFile
+
+#include "VISU_ScalarMap_i.hh"
+
+class VISU_Plot3DPL;
+
+namespace VISU {
+ class Plot3D_i : public virtual POA_VISU::Plot3D,
+ public virtual ScalarMap_i
+ {
+ static int myNbPresent;
+ Plot3D_i();
+ Plot3D_i(const Plot3D_i&);
+
+ public:
+ explicit
+ Plot3D_i (Result_i* theResult, bool theAddToStudy = true);
+ explicit
+ Plot3D_i (Result_i* theResult, SALOMEDS::SObject_ptr theSObject);
+
+ virtual void SameAs (const Plot3D_i* theOrigin);
+ virtual ~Plot3D_i();
+
+ virtual VISU::VISUType GetType() { return VISU::TPLOT3D; };
+
+ virtual void SetOrientation (VISU::Plot3D::Orientation theOrient,
+ CORBA::Double theXAngle, CORBA::Double theYAngle);
+
+ virtual VISU::Plot3D::Orientation GetOrientationType();
+
+ virtual CORBA::Double GetRotateX();
+ virtual CORBA::Double GetRotateY();
+
+ virtual void SetPlanePosition (CORBA::Double thePlanePosition,
+ CORBA::Boolean theIsRelative);
+ virtual CORBA::Double GetPlanePosition();
+ virtual CORBA::Boolean IsPositionRelative();
+
+ virtual void SetScaleFactor (CORBA::Double theScaleFactor);
+ virtual CORBA::Double GetScaleFactor();
+
+ virtual void SetContourPrs (CORBA::Boolean theIsContourPrs );
+ CORBA::Boolean GetIsContourPrs();
+
+ virtual void SetNbOfContours (CORBA::Long theNb);
+ virtual CORBA::Long GetNbOfContours();
+
+ typedef VISU::Plot3D TInterface;
+ VISU_Plot3DPL* GetPlot3DPL() { return myPlot3DPL; }
+
+ void SetMapScale(double theMapScale);
+
+ protected:
+ virtual void DoHook();
+
+ VISU_Plot3DPL *myPlot3DPL;
+
+ public:
+ static int IsPossible (Result_i* theResult, const char* theMeshName, VISU::Entity theEntity,
+ const char* theFieldName, int theIteration, int isMemoryCheck = true);
+
+ virtual Storable* Create (const char* theMeshName, VISU::Entity theEntity,
+ const char* theFieldName, int theIteration);
+
+ virtual void ToStream (std::ostringstream& theStr);
+
+ virtual Storable* Restore (const Storable::TRestoringMap& theMap);
+
+ static const std::string myComment;
+ virtual const char* GetComment() const;
+ virtual QString GenerateName();
+ };
+}
+
+#endif
// VISU OBJECT : interactive object for VISU entities implementation
//
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
//
//
// File : VISU_Prs3d_i.cc
#endif
VISU::Prs3d_i::
-Prs3d_i(Result_i* theResult,
- SALOMEDS::SObject_ptr theSObject) :
- PrsObject_i(theResult->GetStudyDocument()),
+Prs3d_i(Result_i* theResult,
+ SALOMEDS::SObject_ptr theSObject) :
+ PrsObject_i(theResult->GetStudyDocument()),
myResult(theResult),
mySObject(SALOMEDS::SObject::_duplicate(theSObject)),
myAddToStudy(true),
myPipeLine(NULL)
{
+ myOffset[0] = myOffset[1] = myOffset[2] = 0;
myResult->Register();
}
VISU::Prs3d_i::
-Prs3d_i(Result_i* theResult,
- bool theAddToStudy) :
- PrsObject_i(theResult->GetStudyDocument()),
+Prs3d_i(Result_i* theResult,
+ bool theAddToStudy) :
+ PrsObject_i(theResult->GetStudyDocument()),
myResult(theResult),
mySObject(SALOMEDS::SObject::_nil()),
myAddToStudy(theAddToStudy),
myPipeLine(NULL)
{
+ myOffset[0] = myOffset[1] = myOffset[2] = 0;
myResult->Register();
}
void VISU::Prs3d_i::SameAs(const Prs3d_i* theOrigin)
{
- Prs3d_i* aOrigin = const_cast<Prs3d_i*>(theOrigin);
- myPipeLine->ShallowCopy(aOrigin->GetPL());
+ if (Prs3d_i* aOrigin = const_cast<Prs3d_i*>(theOrigin)) {
+ myPipeLine->SameAs(aOrigin->GetPL());
+ aOrigin->GetOffset(myOffset);
+ }
}
VISU::Prs3d_i::~Prs3d_i() {
- if(MYDEBUG) MESSAGE("~Prs3d_i() - this = "<<this<<"; GetReferenceCount() = "<<myPipeLine->GetReferenceCount());
+ if(MYDEBUG) MESSAGE("~Prs3d_i() - this = "<<this
+ <<"; GetReferenceCount() = "<<myPipeLine->GetReferenceCount());
myPipeLine->Delete();
myResult->Destroy();
}
Handle(SALOME_InteractiveObject) anIO = theIO;
if(anIO.IsNull() && (!mySObject->_is_nil())){
anIO = new SALOME_InteractiveObject(mySObject->GetID(),"VISU",GetName());
- theActor->setIO(anIO);
+ theActor->setIO(anIO);
}
// }
theActor->SetPipeLine(GetPipeLine());
theActor->SetPrs3d(this);
+ theActor->SetPosition(myOffset);
}catch(std::bad_alloc& ex){
throw std::runtime_error("CreateActor >> No enough memory");
throw ex;
throw ex;
}catch(...) {
throw std::runtime_error("CreateActor >> unexpected exception was caught!!!");
- }
+ }
}
void VISU::Prs3d_i::UpdateActor(VISU_Actor* theActor) {
if(MYDEBUG) MESSAGE("Prs3d_i::UpdateActor() - this = "<<this);
theActor->GetMapper()->ShallowCopy(myPipeLine->GetMapper());
+ theActor->SetPosition(myOffset);
theActor->Modified();
}
VISU::Storable* VISU::Prs3d_i::Restore(const Storable::TRestoringMap& theMap)
{
myName = VISU::Storable::FindValue(theMap,"myName").latin1();
+ myOffset[0] = VISU::Storable::FindValue(theMap,"myOffset[0]").toFloat();
+ myOffset[1] = VISU::Storable::FindValue(theMap,"myOffset[1]").toFloat();
+ myOffset[2] = VISU::Storable::FindValue(theMap,"myOffset[2]").toFloat();
return this;
}
void VISU::Prs3d_i::ToStream(std::ostringstream& theStr){
Storable::DataToStream( theStr, "myName", myName.c_str() );
+ Storable::DataToStream( theStr, "myOffset[0]", myOffset[0] );
+ Storable::DataToStream( theStr, "myOffset[1]", myOffset[1] );
+ Storable::DataToStream( theStr, "myOffset[2]", myOffset[2] );
}
void VISU::Prs3d_i::Update() {
return myPipeLine;
}
+vtkUnstructuredGrid* VISU::Prs3d_i::GetInput(){
+ return myPipeLine->GetInput();
+}
+
SALOMEDS::SObject_var VISU::Prs3d_i::GetSObject(){
+ if (CORBA::is_nil(mySObject.in())) {
+ const SALOMEDS::Study_var& aStudy = myResult->GetStudyDocument();
+ CORBA::String_var anIOR = GetID();
+ mySObject = aStudy->FindObjectIOR(anIOR);
+ }
return mySObject;
}
myPipeLine->GetMapper()->GetBounds(aBounds);
}
+// Clipping planes
+
+void VISU::Prs3d_i::RemoveAllClippingPlanes(){
+ myPipeLine->RemoveAllClippingPlanes();
+}
+
+vtkIdType VISU::Prs3d_i::GetNumberOfClippingPlanes() const{
+ return myPipeLine->GetNumberOfClippingPlanes();
+}
+
+void VISU::Prs3d_i::AddClippingPlane(vtkPlane* thePlane){
+ myPipeLine->AddClippingPlane(thePlane);
+}
+
+vtkPlane* VISU::Prs3d_i::GetClippingPlane(vtkIdType theID) const{
+ return myPipeLine->GetClippingPlane(theID);
+}
+
+void VISU::Prs3d_i::SetPlaneParam (float theDir[3], float theDist, vtkPlane* thePlane) {
+ myPipeLine->SetPlaneParam(theDir, theDist, thePlane);
+}
+
VISU::Result_i* VISU::GetResult(SALOMEDS::SObject_ptr theSObject){
VISU::Result_var aResult = FindResult(theSObject);
if(!aResult->_is_nil())
return dynamic_cast<VISU::Result_i*>(VISU::GetServant(aResult.in()).in());
return NULL;
}
+
+void VISU::Prs3d_i::SetOffset(const float* theOffsets)
+{
+ myOffset[0] = theOffsets[0];
+ myOffset[1] = theOffsets[1];
+ myOffset[2] = theOffsets[2];
+}
+
+void VISU::Prs3d_i::SetOffset(float theDx, float theDy, float theDz)
+{
+ myOffset[0] = theDx;
+ myOffset[1] = theDy;
+ myOffset[2] = theDz;
+}
+
+void VISU::Prs3d_i::GetOffset(float* theOffsets)
+{
+ theOffsets[0] = myOffset[0];
+ theOffsets[1] = myOffset[1];
+ theOffsets[2] = myOffset[2];
+}
+void VISU::Prs3d_i::GetOffset(float& theDx, float& theDy, float& theDz)
+{
+ theDx = myOffset[0];
+ theDy = myOffset[1];
+ theDz = myOffset[2];
+}
// VISU OBJECT : interactive object for VISU entities implementation
//
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
//
//
// File : VISU_PrsObject_i.hxx
#include "Handle_SALOME_InteractiveObject.hxx"
#include "VISU_Convertor.hxx"
+#include <vtkPlaneSource.h>
+
class VISU_PipeLine;
class VISU_Actor;
+class vtkPlane;
+class vtkUnstructuredGrid;
+
namespace VISU{
class Result_i;
- class Prs3d_i :
+
+ class Prs3d_i :
public virtual POA_VISU::Prs3d,
public virtual SALOME::GenericObj_i,
public virtual PrsObject_i
-
+
{
Prs3d_i();
Prs3d_i(const Prs3d_i&);
public:
explicit
- Prs3d_i(Result_i* theResult,
+ Prs3d_i(Result_i* theResult,
bool theAddToStudy);
explicit
- Prs3d_i(Result_i* theResult,
+ Prs3d_i(Result_i* theResult,
SALOMEDS::SObject_ptr theSObject);
virtual void SameAs(const Prs3d_i* theOrigin);
virtual ~Prs3d_i();
- virtual void RemoveFromStudy() = 0;
protected:
bool myAddToStudy;
+ float myOffset[3];
Result_i *myResult;
VISU_PipeLine *myPipeLine;
SALOMEDS::SObject_var mySObject;
+ std::string myMeshName;
void CreateActor(VISU_Actor* theActor, const Handle(SALOME_InteractiveObject)& theIO = NULL);
virtual VISU_PipeLine* GetPipeLine();
virtual void Update() ;
VISU_PipeLine* GetPL();
+ vtkUnstructuredGrid* GetInput();
+
void GetBounds(float aBounds[6]);
+ void SetOffset(const float* theOffsets);
+ virtual void SetOffset(float theDx, float theDy, float theDz);
+
+ void GetOffset(float* theOffsets);
+ virtual void GetOffset(float& theDx, float& theDy, float& theDz);
+
virtual const char* GetComment() const = 0;
virtual QString GenerateName() = 0;
Result_i* GetResult() const { return myResult;}
virtual SALOMEDS::SObject_var GetSObject();
+ const std::string& GetMeshName() const { return myMeshName; }
+
+ // Clipping planes
+ void RemoveAllClippingPlanes();
+ vtkIdType GetNumberOfClippingPlanes() const;
+ void AddClippingPlane(vtkPlane* thePlane);
+ vtkPlane* GetClippingPlane(vtkIdType theID) const;
+
+ void SetPlaneParam(float theDir[3], float theDist, vtkPlane* thePlane);
};
+
Result_i* GetResult(SALOMEDS::SObject_ptr theSObject);
+
template<class TPrs3d>
- Storable* Restore(SALOMEDS::SObject_ptr theSObject,
- const string& thePrefix, const Storable::TRestoringMap& theMap)
+ Storable* Restore(SALOMEDS::SObject_ptr theSObject,
+ const std::string& thePrefix,
+ const Storable::TRestoringMap& theMap)
{
VISU::Result_i* pResult = GetResult(theSObject);
if(pResult != NULL){
// VISU OBJECT : interactive object for VISU entities implementation
//
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
//
//
// File : VISU_PrsObject_i.hxx
namespace VISU{
class PrsObject_i : public virtual POA_VISU::PrsObject,
- public virtual Storable
+ public virtual RemovableObject_i
{
PrsObject_i(const PrsObject_i&);
}
#endif
-
-
// VISU OBJECT : interactive object for VISU entities implementation
//
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
//
//
// File : VISU_Result_i.cc
// Module : VISU
#include "VISU_Result_i.hh"
+
+#include "VISU_Prs3d_i.hh"
+#include "VISU_ViewManager_i.hh"
+
#include "VISU_Convertor_impl.hxx"
#include "VISU_CorbaMedConvertor.hxx"
#include "VISU_PipeLine.hxx"
+#include "VISU_Actor.h"
+
+//#include "SVTK_ViewWindow.h"
+
+//#include "QAD_Desktop.h"
+//#include "QAD_Application.h"
+//#include "QAD_Study.h"
+//#include "QAD_StudyFrame.h"
+//#include "QAD_RightFrame.h"
#include "SUIT_ResourceMgr.h"
#include "SALOMEDS_Tool.hxx"
#include <qfileinfo.h>
#include <memory>
-#include <fstream>
+#include <fstream>
+//#include <set>
#include <vtkUnstructuredGridReader.h>
#include <vtkUnstructuredGridWriter.h>
+#include <vtkCell.h>
+
+#include <gp_Pnt.hxx>
+#include <gp_Vec.hxx>
+#include <Bnd_Box.hxx>
using namespace VISU;
using namespace std;
return aResult;
}
-void VISU::RemoveFromStudy(SALOMEDS::SObject_ptr theSObject, int theIsAttrOnly){
- if(!theSObject->_is_nil()){
- SALOMEDS::Study_var aStudy = theSObject->GetStudy();
- SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder();
- if(theIsAttrOnly)
- aStudyBuilder->RemoveAttribute(theSObject,"AttributeIOR");
- else
- aStudyBuilder->RemoveObjectWithChildren(theSObject);
+void VISU::RemoveFromStudy (SALOMEDS::SObject_ptr theSObject,
+ bool theIsAttrOnly,
+ bool theDestroySubObjects)
+{
+ if (theSObject->_is_nil()) return;
+
+ SALOMEDS::Study_var aStudyDocument = theSObject->GetStudy();
+ SALOMEDS::StudyBuilder_var aStudyBuilder = aStudyDocument->NewBuilder();
+ if (theIsAttrOnly) {
+ aStudyBuilder->RemoveAttribute(theSObject,"AttributeIOR");
+ return;
+ }
+
+ // Remove possible sub-objects
+ SALOMEDS::ChildIterator_var aChildIter = aStudyDocument->NewChildIterator(theSObject);
+ for (aChildIter->InitEx(true); aChildIter->More(); aChildIter->Next()) {
+ SALOMEDS::SObject_var aChildSObject = aChildIter->Value();
+ CORBA::Object_var aChildObj = VISU::SObjectToObject(aChildSObject);
+ if (CORBA::is_nil(aChildObj)) continue;
+
+ VISU::RemovableObject_var aRemovableObject = VISU::RemovableObject::_narrow(aChildObj);
+ if (CORBA::is_nil(aRemovableObject)) continue;
+
+ aRemovableObject->RemoveFromStudy();
+
+ // Destroy
+ if (theDestroySubObjects) {
+ VISU::Prs3d_var aPrs3d = VISU::Prs3d::_narrow(aRemovableObject);
+ if (CORBA::is_nil(aPrs3d)) continue;
+ aPrs3d->Destroy();
+ }
}
+
+ // Remove the SObject itself
+ aStudyBuilder->RemoveObjectWithChildren(theSObject);
}
QString GenerateName(const char* theName){
return aName.latin1();
}
-void CreateReference(SALOMEDS::Study_ptr theStudyDocument,
+void CreateReference(SALOMEDS::Study_ptr theStudyDocument,
const string& theFatherEntry, const string& theRefEntry)
{
SALOMEDS::StudyBuilder_var aStudyBuilder = theStudyDocument->NewBuilder();
const string VISU::Result_i::myComment = "RESULT";
const char* VISU::Result_i::GetComment() const { return myComment.c_str();}
-VISU::Result_i::Result_i(SALOMEDS::Study_ptr theStudy,
+VISU::Result_i::Result_i(SALOMEDS::Study_ptr theStudy,
const ESourceId& theSourceId,
const ECreationId& theCreationId):
myStudyDocument(SALOMEDS::Study::_duplicate(theStudy)),
}
-void VISU::Result_i::RemoveFromStudy(){
+void VISU::Result_i::RemoveFromStudy()
+{
+ // Remove the result with all presentations and other possible sub-objects
VISU::RemoveFromStudy(mySObject,false);
}
-int
+int
VISU::Result_i::
IsPossible()
{
}
-CORBA::Boolean
+CORBA::Boolean
VISU::Result_i::
BuildAll()
{
}
-VISU::Storable*
+VISU::Storable*
VISU::Result_i::
-Build(SALOMEDS::SObject_ptr theSObject)
+Build(SALOMEDS::SObject_ptr theSObject)
{
SALOMEDS::StudyBuilder_var aStudyBuilder = myStudyDocument->NewBuilder();
aStudyBuilder->NewCommand(); // There is a transaction
if(MYDEBUG) MESSAGE("Result_i::Build");
try{
const TMeshMap& aMeshMap = myInput->GetMeshMap();
- if(aMeshMap.empty())
+ if(aMeshMap.empty())
throw std::runtime_error("Build - There is no any mesh information in the file !!!");
mySComponent = FindOrCreateVisuComponent(myStudyDocument);
CORBA::String_var aSComponentEntry = mySComponent->GetID(), anIOR(GetID());
GetComment(),
VISU::TRESULT,
myFileInfo.filePath().latin1(),
- myInitFileName.c_str()); // Restoring of Python dump
- string aResultEntry =
+ myInitFileName.c_str()); // Restoring of Python dump
+ string aResultEntry =
CreateAttributes(myStudyDocument,
aSComponentEntry,
aRefFatherEntry.c_str(),
aMeshName.c_str(),
anEntity,
aFamilyName.c_str());
- aComment2EntryMap[aComment.latin1()] =
+ aComment2EntryMap[aComment.latin1()] =
CreateAttributes(myStudyDocument,
aEntity2EntryMap[anEntity].c_str(),
aRefFatherEntry.c_str(),
if(aGroupMap.size() > 0){
aComment.sprintf("myComment=GROUPS;myMeshName=%s",
aMeshName.c_str());
- string aGroupsEntry =
+ string aGroupsEntry =
CreateAttributes(myStudyDocument,
aMeshEntry.c_str(),
aRefFatherEntry.c_str(),
if(!isFieldEntryCreated){
aComment.sprintf("myComment=FIELDS;myMeshName=%s",
aMeshName.c_str());
- aFieldsEntry =
+ aFieldsEntry =
CreateAttributes(myStudyDocument,
aMeshEntry.c_str(),
aRefFatherEntry.c_str(),
}
-VISU::Storable*
+VISU::Storable*
VISU::Result_i::
Create(const char* theFileName)
{
myFileInfo.setFile(QString(aTmpDir.c_str()) + myFileInfo.fileName());
}
myInput = CreateConvertor(myFileInfo.absFilePath().latin1());
- if(!myInput)
+ if(!myInput)
throw std::runtime_error("Create - Cannot create a Convertor for this file!!!"); return Build();
}catch(std::exception& exc){
INFOS("Follow exception was occured :\n"<<exc.what());
}
-VISU::Storable*
+VISU::Storable*
VISU::Result_i::
Create(SALOMEDS::SObject_ptr theMedSObject)
{
if(MYDEBUG) MESSAGE("Result_i::Create MedObject from SALOMEDS::SObject_ptr");
try{
myInput = CreateMEDConvertor(theMedSObject);
- if(myInput == NULL)
+ if(myInput == NULL)
return NULL;
string aCompDataType = GetComponentDataType(theMedSObject);
return NULL;
}
-VISU::Storable*
+VISU::Storable*
VISU::Result_i::
Create(SALOME_MED::FIELD_ptr theField)
{
if(MYDEBUG) MESSAGE("Result_i::Create MedObject from SALOME_MED::FIELD_ptr");
try{
myInput = CreateMEDFieldConvertor(theField);
- if(myInput == NULL)
+ if(myInput == NULL)
return NULL;
string aCompDataType = "MED";
}
-VISU::Storable*
+VISU::Storable*
VISU::Result_i::
-Restore(SALOMEDS::SObject_ptr theSObject,
- const Storable::TRestoringMap& theMap,
+Restore(SALOMEDS::SObject_ptr theSObject,
+ const Storable::TRestoringMap& theMap,
const string& thePrefix)
{
if(MYDEBUG) MESSAGE("Result_i::Restore - "<<thePrefix);
myFileInfo.setFile(aDataType.in());
if(MYDEBUG) MESSAGE("Result_i::GetInput - aDataType = "<<aDataType);
Engines::Component_var aEngComp = Base_i::myEnginesLifeCycle->FindOrLoad_Component("FactoryServer", aDataType.in());
- if (CORBA::is_nil(aEngComp))
+ if (CORBA::is_nil(aEngComp))
throw std::runtime_error("Restore - There is no aEngComp for the aDataType !!!");
SALOMEDS::StudyBuilder_var aStudyBuilder = myStudyDocument->NewBuilder();
SALOMEDS::Driver_var aDriver = SALOMEDS::Driver::_narrow(aEngComp);
string aFileName = thePrefix + aStudyPrefix + "_" + myName;
myFileInfo.setFile(aFileName.c_str());
}
- if(MYDEBUG)
+ if(MYDEBUG)
MESSAGE("Result_i::Restore - aFileName = "<<myFileInfo.filePath()<<"; "<<myFileInfo.isFile());
if (HDFascii::isASCII(myFileInfo.filePath().latin1())) {
mySourceId = eRestoredFile;
delete(aResultPath);
delete(aHDFFileName);
- } else if (!IsMultifile())
+ } else if (!IsMultifile())
mySourceId = eRestoredFile;
- else
+ else
mySourceId = eFile;
if(MYDEBUG) MESSAGE("VISU::Result_i::Restore - mySourceId = "<<mySourceId);
myInput = CreateConvertor(myFileInfo.filePath().latin1());
QString aComment;
aComment.sprintf("myComment=%s;myType=%d;myFileName=%s;myInitFileName=%s",
GetComment(),VISU::TRESULT,myFileInfo.filePath().latin1(),
- myInitFileName.c_str()); // Restoring of Python dump
+ myInitFileName.c_str()); // Restoring of Python dump
SALOMEDS::GenericAttribute_var anAttr;
if(!theSObject->FindAttribute(anAttr, "AttributeComment"))
throw std::runtime_error("Build - There is no AttributeComment for the SObject !!!");
aCmnt->SetValue(aComment.latin1());
}
QString aIsBuild = VISU::GetResourceMgr()->stringValue("Visu:BuildResult");
- if(aIsBuild.isEmpty()? 0 : aIsBuild.toInt())
+ if(aIsBuild.isEmpty()? 0 : aIsBuild.toInt())
BuildAll();
return this;
}catch(std::exception& exc){
return NULL;
}
-VISU::Result_i::TInput* VISU::Result_i::GetInput() {
+VISU::Result_i::TInput* VISU::Result_i::GetInput() {
return myInput;
}
Storable::DataToStream(theStr,"myCreationId",myCreationId);
}
-VISU::Storable*
-VISU::Result_i::Restore(SALOMEDS::SObject_ptr theSObject,
- const string& thePrefix,
+VISU::Storable*
+VISU::Result_i::Restore(SALOMEDS::SObject_ptr theSObject,
+ const string& thePrefix,
const Storable::TRestoringMap& theMap)
{
SALOMEDS::Study_var aStudy = theSObject->GetStudy();
aSourceId = eRestoredComponent;
VISU::Result_i* pResult = new VISU::Result_i(aStudy,aSourceId,aCreationId);
- if(pResult == NULL)
+ if(pResult == NULL)
return NULL;
return pResult->Restore(theSObject,theMap,thePrefix);
}
-
-string VISU::Result_i::GetRefFatherEntry() {
+
+string VISU::Result_i::GetRefFatherEntry() {
//return QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->entry();
return "";
}
-string VISU::Result_i::GetEntry(){
+string VISU::Result_i::GetEntry(){
CORBA::String_var anEntry = mySObject->GetID();
return string(anEntry);
}
const SALOMEDS::SObject_var& VISU::Result_i::GetSObject() const { return mySObject;}
const SALOMEDS::Study_var& VISU::Result_i::GetStudyDocument() const { return myStudyDocument;}
const SALOMEDS::SComponent_var& VISU::Result_i::GetSComponent() const { return mySComponent;}
-std::string VISU::Result_i::GetEntry(const std::string& theComment)
-{
+std::string VISU::Result_i::GetEntry(const std::string& theComment)
+{
return FindEntryWithComment(myStudyDocument,GetEntry().c_str(),theComment.c_str());
}
VISU::Result_i::~Result_i() {
MESSAGE("Result_i::~Result_i() - this = "<<this);
- if(mySourceId == eRestoredFile){
+ if(mySourceId == eRestoredFile){
static QString aCommand;
aCommand.sprintf("rm %s",myFileInfo.filePath().latin1());
MESSAGE("Result_i::~Result_i - system("<<aCommand<<") = "<<system(aCommand));
}
if(myInput) delete myInput;
}
+
+//=======================================================================
+//function : GetAxisInfo
+//purpose :
+//=======================================================================
+const vector< float >* Result_i::GetAxisInfo(const string& theMeshName,
+ TAxis theAxis,
+ gp_Dir& thePlaneNormal)
+{
+ const vector< float >* components = NULL;
+
+ if ( theAxis < AXIS_X || theAxis > AXIS_Z ) {
+ MESSAGE(" Bad axis index " << theAxis );
+ return components;
+ }
+
+ map< string, TGridInfo >::iterator name_info;
+ name_info = myMeshName2GridInfoMap.find( theMeshName );
+ TGridInfo * gInfo = 0;
+
+ if ( name_info != myMeshName2GridInfoMap.end() )
+ {
+ gInfo = & name_info->second;
+ }
+ else if ( myInput && IsPossible() && theAxis >= AXIS_X && theAxis <= AXIS_Z )
+ {
+ // check presence of theMeshName
+ const VISU::TMeshMap& meshMap = myInput->GetMeshMap();
+ if ( meshMap.find( theMeshName ) == meshMap.end() ) {
+ MESSAGE("No mesh named " << theMeshName );
+ return components;
+ }
+ VISU_Convertor::TOutput* vtkMesh = myInput->GetMeshOnEntity (theMeshName,
+ CELL_ENTITY);
+ if ( !vtkMesh || vtkMesh->GetNumberOfCells() == 0 ) {
+ MESSAGE( "No cells in the mesh: " << theMeshName );
+ return components;
+ }
+
+ // define axis directions and min cell size in each direction
+ const int nbAxes = 3;
+ int iAx;
+ gp_Vec axDirs[ nbAxes ];
+ float minSize[3] = { FLT_MAX, FLT_MAX, FLT_MAX };
+ bool axesComputed = false;
+ for ( vtkIdType iCell = 0; iCell < vtkMesh->GetNumberOfCells(); ++iCell )
+ {
+ vtkCell* cell = vtkMesh->GetCell( iCell );
+ int nbPnt = cell->GetNumberOfPoints();
+ if ( nbPnt != 8 )
+ continue;
+ vtkPoints * points = cell->GetPoints();
+ float* coords[ 4 ];
+ coords[0] = points->GetPoint( 0 );
+ coords[1] = points->GetPoint( 1 );
+ coords[2] = points->GetPoint( 3 );
+ coords[3] = points->GetPoint( 4 );
+ gp_Pnt p0( coords[0][0], coords[0][1], coords[0][2] );
+ for ( iAx = 0; iAx < nbAxes; ++iAx )
+ {
+ float* coo = coords[ iAx + 1 ];
+ gp_Pnt p( coo[0], coo[1], coo[2] );
+ // min size
+ float size = p0.SquareDistance( p );
+ if ( size > FLT_MIN && size < minSize[ iAx ] )
+ minSize[ iAx ] = size;
+ // axis direction
+ if ( !axesComputed ) {
+ gp_Vec dir( p0, p );
+ if ( dir.SquareMagnitude() <= DBL_MIN )
+ break;
+ axDirs[ iAx ] = dir;
+ }
+ }
+ if ( iAx == nbAxes )
+ axesComputed = true;
+ }
+ if ( !axesComputed ) {
+ MESSAGE("No good hexahedrons in the mesh: " << theMeshName );
+ return components;
+ }
+
+ // compute axes dirs
+ gInfo = & myMeshName2GridInfoMap[ theMeshName ];
+ for ( iAx = 0; iAx < nbAxes; ++iAx )
+ {
+ int iPrev = ( iAx == 0 ) ? 2 : iAx - 1;
+ int iNext = ( iAx == 2 ) ? 0 : iAx + 1;
+ gInfo->myAxis[ iAx ] = axDirs[ iPrev ] ^ axDirs[ iNext ];
+ }
+
+ // get and sort intermediate component values - projections of nodes
+ // on axis direction; define bnd box
+ set< float > comps[ 3 ];
+ Bnd_Box box;
+ vtkPoints * points = vtkMesh->GetPoints();
+ vtkIdType iP, nbP = vtkMesh->GetNumberOfPoints();
+ for ( iP = 0; iP < nbP; ++iP )
+ {
+ float* coo = points->GetPoint( iP );
+ gp_Pnt p( coo[0], coo[1], coo[2] );
+ box.Add( p );
+ for ( iAx = 0; iAx < nbAxes; ++iAx ) {
+ const gp_Dir& dir = gInfo->myAxis[ iAx ];
+ float dot = dir.XYZ() * p.XYZ();
+ comps[ iAx ].insert( dot );
+ }
+ }
+
+ // find a range of projections of bnd box corners on each axis
+ float range[3], firstValue[3];
+ double x[2],y[2],z[2];
+ box.Get(x[0],y[0],z[0],x[1],y[1],z[1]);
+ for ( iAx = 0; iAx < nbAxes; ++iAx ) {
+ set< float > bndComps;
+ const gp_Dir& dir = gInfo->myAxis[ iAx ];
+ for ( int iX = 0; iX < 2; ++iX ) {
+ for ( int iY = 0; iY < 2; ++iY ) {
+ for ( int iZ = 0; iZ < 2; ++iZ ) {
+ gp_Pnt p( x[ iX ], y[ iY ], z[ iZ ] );
+ float dot = dir.XYZ() * p.XYZ();
+ bndComps.insert( dot );
+ }
+ }
+ }
+ firstValue[ iAx ] = *bndComps.begin();
+ range[ iAx ] = *bndComps.rbegin() - *bndComps.begin();
+ }
+
+ // compute component values
+ for ( iAx = 0; iAx < nbAxes; ++iAx )
+ {
+ list< float > values;
+ int nbVals = 0;
+ set< float >& comp = comps[ iAx ];
+ set< float >::iterator val = comp.begin();
+ float bnd = -1., rng = range[ iAx ], first = firstValue[ iAx ];
+ float tol = 0.1 * sqrt( minSize[ iAx ]) / rng;
+ for ( ; val != comp.end(); ++val ) {
+ float value = ( *val - first ) / rng;
+ if ( value > bnd ) {
+ values.push_back( value );
+ bnd = value + tol;
+ nbVals++;
+ }
+ }
+ // store values in gInfo
+ vector< float >& myComp = gInfo->myComponets[ iAx ];
+ myComp.resize( nbVals );
+ list< float >::iterator v = values.begin();
+ for ( int i = 0; v != values.end(); ++v )
+ myComp[ i++ ] = *v;
+ }
+ }
+
+ // set return values
+ if ( gInfo )
+ {
+ thePlaneNormal = gInfo->myAxis[ theAxis ];
+ components = & gInfo->myComponets[ theAxis ];
+ }
+
+ return components;
+}
// VISU OBJECT : interactive object for VISU entities implementation
//
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
//
//
// File : VISU_Result_i.hh
#include "VISUConfig.hh"
#include "SALOME_GenericObj_i.hh"
+#include <gp_Dir.hxx>
+
+#include <vector>
+
class VISU_Convertor;
namespace VISU{
class Result_i : public virtual POA_VISU::Result,
- public virtual Storable,
+ public virtual RemovableObject_i,
public virtual SALOME::GenericObj_i
{
Result_i();
enum ESourceId {eRestoredComponent = -2, eRestoredFile = -1, eFile = 1, eComponent = 2};
enum ECreationId {eImportFile, eCopyAndImportFile, eImportMed, eImportMedField};
- Result_i(SALOMEDS::Study_ptr theStudy,
+ Result_i(SALOMEDS::Study_ptr theStudy,
const ESourceId& theSourceId,
const ECreationId& theCreationId);
virtual Storable* Create(SALOMEDS::SObject_ptr theMedSObject);
virtual Storable* Create(SALOME_MED::FIELD_ptr theField);
- virtual Storable* Restore(SALOMEDS::SObject_ptr theSObject,
- const Storable::TRestoringMap& theMap,
+ virtual Storable* Restore(SALOMEDS::SObject_ptr theSObject,
+ const Storable::TRestoringMap& theMap,
const std::string& thePrefix);
- static Storable* Restore(SALOMEDS::SObject_ptr theSObject,
- const std::string& thePrefix,
+ static Storable* Restore(SALOMEDS::SObject_ptr theSObject,
+ const std::string& thePrefix,
const Storable::TRestoringMap& theMap);
virtual void ToStream(std::ostringstream& theStr);
SALOMEDS::SObject_var mySObject;
SALOMEDS::Study_var myStudyDocument;
SALOMEDS::SComponent_var mySComponent;
-
+
public:
std::string GetRefFatherEntry();
std::string GetEntry();
const SALOMEDS::SComponent_var& GetSComponent() const;
std::string GetEntry(const std::string& theComment);
+ // Info on structured mesh contained in TInput
+ public:
+ typedef enum { AXIS_X = 0, AXIS_Y, AXIS_Z } TAxis;
+ const std::vector< float >* GetAxisInfo(const std::string& theMeshName,
+ TAxis theAxis,
+ gp_Dir& thePlaneNormal);
+ // Return i,j or k values and cutting plane normal for theAxis.
+ // In the case of any problems, return NULL pointer
+ private:
+ struct TGridInfo {
+ std::vector< float > myComponets[ 3 ];
+ gp_Dir myAxis [ 3 ];
+ };
+ map< string, TGridInfo > myMeshName2GridInfoMap;
};
Result_var FindResult(SALOMEDS::SObject_ptr theSObject);
- void RemoveFromStudy(SALOMEDS::SObject_ptr theSObject, int theIsAttrOnly = true);
+ void RemoveFromStudy(SALOMEDS::SObject_ptr theSObject,
+ bool theIsAttrOnly = true,
+ bool theDestroySubObjects = false);
}
-
#endif
// VISU OBJECT : interactive object for VISU entities implementation
//
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
//
//
// File : VISU_PrsObject_i.cxx
// Author : Alexey PETROV
// Module : VISU
-#include "VISU_ScalarMapPL.hxx"
-#include "VISU_Result_i.hh"
#include "VISU_ScalarMap_i.hh"
+
+#include "VISU_Result_i.hh"
+#include "VISU_ViewManager_i.hh"
+
+#include "VISU_ScalarMapPL.hxx"
#include "VISU_ScalarMapAct.h"
+
#include "SUIT_ResourceMgr.h"
#include <vtkDataSetMapper.h>
static int INCMEMORY = 4;
-int VISU::ScalarMap_i::IsPossible(Result_i* theResult, const char* theMeshName, VISU::Entity theEntity,
+int VISU::ScalarMap_i::IsPossible(Result_i* theResult, const char* theMeshName, VISU::Entity theEntity,
const char* theFieldName, int theIteration, int isMemoryCheck)
{
try{
const string VISU::ScalarMap_i::myComment = "SCALARMAP";
const char* VISU::ScalarMap_i::GetComment() const { return myComment.c_str();}
VISU::ScalarMap_i::
-ScalarMap_i(Result_i* theResult,
- bool theAddToStudy) :
- PrsObject_i(theResult->GetStudyDocument()),
+ScalarMap_i(Result_i* theResult,
+ bool theAddToStudy) :
+ PrsObject_i(theResult->GetStudyDocument()),
Prs3d_i(theResult,theAddToStudy),
myScalarMapPL(NULL)
{
VISU::ScalarMap_i::
-ScalarMap_i(Result_i* theResult,
- SALOMEDS::SObject_ptr theSObject) :
- PrsObject_i(theResult->GetStudyDocument()),
+ScalarMap_i(Result_i* theResult,
+ SALOMEDS::SObject_ptr theSObject) :
+ PrsObject_i(theResult->GetStudyDocument()),
Prs3d_i(theResult,theSObject),
myScalarMapPL(NULL)
{
}
-void VISU::ScalarMap_i::RemoveFromStudy(){
+void VISU::ScalarMap_i::RemoveFromStudy()
+{
+ VISU::DeleteActors(this);
VISU::RemoveFromStudy(mySObject,false);
}
/**
* Creates Scalar Map and initialises it from resources
*/
-VISU::Storable* VISU::ScalarMap_i::Create(const char* theMeshName, VISU::Entity theEntity,
+VISU::Storable* VISU::ScalarMap_i::Create(const char* theMeshName, VISU::Entity theEntity,
const char* theFieldName, int theIteration)
{
DoHook();
// Orientation
QString aOrient = VISU::GetResourceMgr()->stringValue("Visu:SBOrientation");
- if ( !aOrient.isEmpty() )
+ if ( !aOrient.isEmpty() )
myOrientation = (VISU::ScalarMap::Orientation) aOrient.toInt();
else
myOrientation = VISU::ScalarMap::VERTICAL;
myPosition[0] = 0.2;
}
}
-
+
QString aYorigin = VISU::GetResourceMgr()->stringValue("Visu:SBYorigin");
if ( !aYorigin.isEmpty() )
myPosition[1] = aYorigin.toFloat();
// Nb of Colors
QString aColors = VISU::GetResourceMgr()->stringValue("Visu:SBNumberOfColors");
int aNumberOfColors = (aColors.isEmpty())? 64 : aColors.toInt();
- if (aNumberOfColors > 64)
+ if (aNumberOfColors > 64)
aNumberOfColors = 64;
SetNbColors(aNumberOfColors);
// Nb of Labels
QString aLabels = VISU::GetResourceMgr()->stringValue("Visu:SBNumberOfLabels");
myNumberOfLabels = (aLabels.isEmpty())? 5 : aLabels.toInt();
- if (myNumberOfLabels > 65)
+ if (myNumberOfLabels > 65)
myNumberOfLabels = 65;
-
+
// Scalar Range
QString aFixRange = VISU::GetResourceMgr()->stringValue("Visu:SBImposeRange");
myIsFixedRange = (aFixRange.compare("true") == 0);
}
QString aScaling = VISU::GetResourceMgr()->stringValue("Visu:SBScaling");
- if(aScaling.compare("LOGARITHMIC") == 0)
+ if(aScaling.compare("LOGARITHMIC") == 0)
SetScaling(VISU::LOGARITHMIC);
- else
+ else
SetScaling(VISU::LINEAR);
// Fonts properties definition
myTitleColor[0] = (aRTitColor.isEmpty())? 1 : aRTitColor.toFloat();
if (myTitleColor[0] > 1) myTitleColor[0] = 1;
if (myTitleColor[0] < 0) myTitleColor[0] = 0;
-
+
QString aGTitColor = VISU::GetResourceMgr()->stringValue("Visu:TitleColorG");
myTitleColor[1] = (aGTitColor.isEmpty())? 1 : aGTitColor.toFloat();
if (myTitleColor[1] > 1) myTitleColor[1] = 1;
if (myTitleColor[1] < 0) myTitleColor[1] = 0;
-
+
QString aBTitColor = VISU::GetResourceMgr()->stringValue("Visu:TitleColorB");
myTitleColor[2] = (aBTitColor.isEmpty())? 1 : aBTitColor.toFloat();
if (myTitleColor[2] > 1) myTitleColor[2] = 1;
if (myTitleColor[2] < 0) myTitleColor[2] = 0;
-
+
///
QString aIsBoldLabel = VISU::GetResourceMgr()->stringValue("Visu:IsBoldLabel");
myLabelColor[0] = (aRLblColor.isEmpty())? 1 : aRLblColor.toFloat();
if (myLabelColor[0] > 1) myLabelColor[0] = 1;
if (myLabelColor[0] < 0) myLabelColor[0] = 0;
-
+
QString aGLblColor = VISU::GetResourceMgr()->stringValue("Visu:LabelColorG");
myLabelColor[1] = (aGLblColor.isEmpty())? 1 : aGLblColor.toFloat();
if (myLabelColor[1] > 1) myLabelColor[1] = 1;
if (myLabelColor[1] < 0) myLabelColor[1] = 0;
-
+
QString aBLblColor = VISU::GetResourceMgr()->stringValue("Visu:LabelColorB");
myLabelColor[2] = (aBLblColor.isEmpty())? 1 : aBLblColor.toFloat();
if (myLabelColor[2] > 1) myLabelColor[2] = 1;
if (myLabelColor[2] < 0) myLabelColor[2] = 0;
-
+
myMeshName = theMeshName;
myEntity = (VISU::TEntity)theEntity;
}
-CORBA::Long VISU::ScalarMap_i::GetScalarMode(){
+CORBA::Long VISU::ScalarMap_i::GetScalarMode(){
return myScalarMapPL->GetScalarMode();
}
-void VISU::ScalarMap_i::SetScalarMode(CORBA::Long theScalarMode) {
+void VISU::ScalarMap_i::SetScalarMode(CORBA::Long theScalarMode) {
myScalarMapPL->SetScalarMode(theScalarMode);
}
}
-void VISU::ScalarMap_i::SetRange(CORBA::Double theMin, CORBA::Double theMax){
+void VISU::ScalarMap_i::SetRange(CORBA::Double theMin, CORBA::Double theMax){
if(theMin > theMax) return;
float aScalarRange[2] = {theMin, theMax};
myScalarMapPL->SetScalarRange(aScalarRange);
return myScalarMapPL->GetScalarRange()[1];
}
-
+
void VISU::ScalarMap_i::SetNbColors(CORBA::Long theNbColors){
myScalarMapPL->SetNbColors(theNbColors);
}
VISU::Storable* VISU::ScalarMap_i::Build(int theRestoring){
- if(MYDEBUG)
+ if(MYDEBUG)
MESSAGE("ScalarMap_i::Build - "<<myFieldName<<"; theRestoring = "<<theRestoring);
SALOMEDS::StudyBuilder_var aStudyBuilder = myStudy->NewBuilder();
if(myAddToStudy) aStudyBuilder->NewCommand(); // There is a transaction
try{
- if(myResult->GetInput() == NULL)
+ if(myResult->GetInput() == NULL)
throw std::runtime_error("Mesh_i::Build - myResult->GetInput() == NULL !!!");
myField = myResult->GetInput()->GetField(myMeshName,myEntity,myFieldName);
if(myField == NULL) throw std::runtime_error("There is no Field with the parameters !!!");
- VISU_Convertor::TOutput *anOutput =
+ VISU_Convertor::TOutput *anOutput =
myResult->GetInput()->GetTimeStampOnMesh(myMeshName,myEntity,myFieldName,myIteration);
if(anOutput == NULL) throw std::runtime_error("There is no TimeStamp with the parameters !!!");
myScalarMapPL->SetInput(anOutput);
UpdateActor(anActor);
}catch(...) {
anActor->Delete();
- throw std::runtime_error("CreateActor error");
+ throw std::runtime_error("CreateActor error");
}
return anActor;
}
aScalarBar->SetWidth(myWidth);
aScalarBar->SetHeight(myHeight);
aScalarBar->SetNumberOfLabels(myNumberOfLabels);
-
+
vtkTextProperty* aTitleProp = aScalarBar->GetTitleTextProperty();
aTitleProp->SetFontFamily(myTitFontType);
aTitleProp->SetColor(myTitleColor);
(myIsBoldTitle)? aTitleProp->BoldOn() : aTitleProp->BoldOff();
(myIsItalicTitle)? aTitleProp->ItalicOn() : aTitleProp->ItalicOff();
(myIsShadowTitle)? aTitleProp->ShadowOn() : aTitleProp->ShadowOff();
-
+
vtkTextProperty* aLabelProp = aScalarBar->GetLabelTextProperty();
aLabelProp->SetFontFamily(myLblFontType);
aLabelProp->SetColor(myLabelColor);
(myIsBoldLabel)? aLabelProp->BoldOn() : aLabelProp->BoldOff();
(myIsItalicLabel)? aLabelProp->ItalicOn() : aLabelProp->ItalicOff();
(myIsShadowLabel)? aLabelProp->ShadowOn() : aLabelProp->ShadowOff();
-
+
aScalarBar->Modified();
}
}
// VISU OBJECT : interactive object for VISU entities implementation
//
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
//
//
// File : VISU_PrsObject_i.hxx
virtual void SetNbColors(CORBA::Long theNbColors);
virtual CORBA::Long GetNbColors();
- virtual void SetBarOrientation(VISU::ScalarMap::Orientation theOrientation){
+ virtual void SetBarOrientation(VISU::ScalarMap::Orientation theOrientation){
myOrientation = theOrientation;
}
virtual VISU::ScalarMap::Orientation GetBarOrientation() { return myOrientation;}
virtual void SetPosition(CORBA::Double X, CORBA::Double Y) { myPosition[0] = X; myPosition[1] = Y;}
- virtual CORBA::Double GetPosX() { return myPosition[0];}
+ virtual CORBA::Double GetPosX() { return myPosition[0];}
virtual CORBA::Double GetPosY() { return myPosition[1];}
-
- virtual void SetSize(CORBA::Double theWidth, CORBA::Double theHeight) {
+
+ virtual void SetSize(CORBA::Double theWidth, CORBA::Double theHeight) {
myWidth = theWidth; myHeight = theHeight;
}
- virtual CORBA::Double GetWidth() { return myWidth;}
+ virtual CORBA::Double GetWidth() { return myWidth;}
virtual CORBA::Double GetHeight() { return myHeight;}
virtual void SetLabels(CORBA::Long theNbLabels) { myNumberOfLabels = theNbLabels;}
virtual CORBA::Long GetLabels() { return myNumberOfLabels;}
-
+
virtual void SetTitle(const char* theName) { myTitle = theName;}
virtual char* GetTitle() { return CORBA::string_dup(myTitle.c_str());}
virtual int GetTitFontType() { return myTitFontType;}
virtual void SetTitFontType(int theType) { myTitFontType = theType;}
- virtual void GetTitleColor(float* theR, float* theG, float* theB)
+ virtual void GetTitleColor(float* theR, float* theG, float* theB)
{*theR = myTitleColor[0]; *theG = myTitleColor[1]; *theB = myTitleColor[2];}
- virtual void SetTitleColor(float theR, float theG, float theB)
+ virtual void SetTitleColor(float theR, float theG, float theB)
{myTitleColor[0] = theR; myTitleColor[1] = theG; myTitleColor[2] = theB; }
/////
virtual int GetLblFontType() { return myLblFontType;}
virtual void SetLblFontType(int theType) { myLblFontType = theType;}
- virtual void GetLabelColor(float* theR, float* theG, float* theB)
+ virtual void GetLabelColor(float* theR, float* theG, float* theB)
{*theR = myLabelColor[0]; *theG = myLabelColor[1]; *theB = myLabelColor[2];}
- virtual void SetLabelColor(float theR, float theG, float theB)
+ virtual void SetLabelColor(float theR, float theG, float theB)
{myLabelColor[0] = theR; myLabelColor[1] = theG; myLabelColor[2] = theB; }
typedef VISU::ScalarMap TInterface;
VISU_ScalarMapPL* myScalarMapPL;
PField myField;
- string myMeshName;
+ // std::string myMeshName; move it to Prs3d_i
TEntity myEntity;
- string myFieldName;
+ std::string myFieldName;
int myIteration;
bool myIsFixedRange;
-
+
std::string myTitle;
int myNumberOfLabels;
float myPosition[2], myWidth, myHeight;
float myLabelColor[3];
public:
- static int IsPossible(Result_i* theResult, const char* theMeshName, VISU::Entity theEntity,
+ static int IsPossible(Result_i* theResult, const char* theMeshName, VISU::Entity theEntity,
const char* theFieldName, int theIteration, int isMemoryCheck = true);
- virtual Storable* Create(const char* theMeshName, VISU::Entity theEntity,
+ virtual Storable* Create(const char* theMeshName, VISU::Entity theEntity,
const char* theFieldName, int theIteration);
const std::string& GetMeshName() const { return myMeshName;}
VISU::Entity GetEntity() const { return VISU::Entity(myEntity);}
const string& GetFieldName() const { return myFieldName;}
int GetIteration() const { return myIteration;}
-
+
virtual void ToStream(std::ostringstream& theStr);
- static const string myComment;
+ static const std::string myComment;
virtual const char* GetComment() const;
virtual QString GenerateName();
virtual Storable* Restore(const Storable::TRestoringMap& theMap);
- static Storable* Restore(SALOMEDS::SObject_ptr theSObject,
- const string& thePrefix, const Storable::TRestoringMap& theMap);
+ static Storable* Restore(SALOMEDS::SObject_ptr theSObject,
+ const std::string& thePrefix, const Storable::TRestoringMap& theMap);
virtual void Update() ;
virtual void SetMapScale(double theMapScale = 1.0);
// VISU OBJECT : interactive object for VISU entities implementation
//
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
//
//
// File : VISU_PrsObject_i.hxx
virtual CORBA::Boolean SetParams(CORBA::Double theIntStep,
CORBA::Double thePropogationTime,
CORBA::Double theStepLength,
- VISU::Prs3d_ptr thePrs3d,
+ VISU::Prs3d_ptr thePrs3d,
CORBA::Double thePercents,
VISU::StreamLines::Direction theDirection);
virtual CORBA::Double GetIntegrationStep();
VISU_StreamLinesPL* myStreamLinesPL;
vtkAppendFilter* myAppendFilter;
- string mySourceEntry;
+ std::string mySourceEntry;
public:
- static int IsPossible(Result_i* theResult, const char* theMeshName, VISU::Entity theEntity,
+ static int IsPossible(Result_i* theResult, const char* theMeshName, VISU::Entity theEntity,
const char* theFieldName, int theIteration, int isMemoryCheck = true);
- virtual Storable* Create(const char* theMeshName, VISU::Entity theEntity,
+ virtual Storable* Create(const char* theMeshName, VISU::Entity theEntity,
const char* theFieldName, int theIteration);
virtual void ToStream(std::ostringstream& theStr);
- static const string myComment;
+ static const std::string myComment;
virtual const char* GetComment() const;
virtual QString GenerateName();
-
+
virtual Storable* Restore(const Storable::TRestoringMap& theMap);
-
- virtual void Update() ;
+
+ virtual void Update();
virtual VISU_Actor* CreateActor(const Handle(SALOME_InteractiveObject)& theIO = NULL);
virtual QString GetSourceEntry() { return QString(mySourceEntry.c_str()); }
};
}
+
#endif
// VISU OBJECT : interactive object for VISU entities implementation
//
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
//
//
// File : VISU_Table_i.cc
#include "VISU_CutLines_i.hh"
#include "VISU_Result_i.hh"
+#include "VISU_ViewManager_i.hh"
#include "SPlot2d_Curve.h"
-#include <memory>
-#include <fstream>
+#include <memory>
+#include <fstream>
#include <strstream>
#include <qfileinfo.h>
//----------------------------------------------------------------
int VISU::Table_i::myNbPresent = 0;
const string VISU::Table_i::myComment = "TABLE";
-/*!
+/*!
Generate unique name
*/
-const char* VISU::Table_i::GenerateName()
-{
- return VISU::GenerateName( "Table", ++myNbPresent );
+const char* VISU::Table_i::GenerateName()
+{
+ return VISU::GenerateName( "Table", ++myNbPresent );
}
/*!
Gets comment string
*/
-const char* VISU::Table_i::GetComment() const
-{
- return myComment.c_str();
+const char* VISU::Table_i::GetComment() const
+{
+ return myComment.c_str();
}
/*!
Constructor
*/
VISU::Storable* VISU::Table_i::Create()
{
- // generate name ...
- myName = GetTableTitle();
+ // generate name ...
+ myName = GetTableTitle();
// mpv (PAL 5357): if name attribute already exist at this label, use it as name of table
if ( myName == "" )
/*!
Builds presentation of table
*/
-VISU::Storable* VISU::Table_i::Build( int theRestoring )
+VISU::Storable* VISU::Table_i::Build( int theRestoring )
{
-
+
// look for reference SObject with table attribute
SALOMEDS::SObject_var SO = mySObj;
aComment.sprintf("myComment=%s;myType=%d;mySourceId=TableAttr",GetComment(),VISU::TTABLE);
SALOMEDS::SObject_var aFatherSObject = SO->GetFather();
if(aFatherSObject->FindAttribute(anAttr,"AttributeComment")){
- SALOMEDS::AttributeComment_var aCommentAttr =
+ SALOMEDS::AttributeComment_var aCommentAttr =
SALOMEDS::AttributeComment::_narrow(anAttr);
CORBA::String_var aValue = aCommentAttr->Value();
- Storable::TRestoringMap aMap;
+ Storable::TRestoringMap aMap;
Storable::StrToMap(aValue.in(),aMap);
bool anIsExist;
QString aMethodName = VISU::Storable::FindValue(aMap,"myComment",&anIsExist);
}
}
- string anEntry = CreateAttributes( myStudy,
+ string anEntry = CreateAttributes( myStudy,
SO->GetID(),//SComponent->GetID(),
"",
GetID(),
GetName(),
"",
- aComment.latin1(),
+ aComment.latin1(),
pCutLines );
// create SObject referenced to real table object
mySObj = SALOMEDS::SObject::_duplicate(myStudy->FindObjectID( anEntry.c_str() ));
/*!
Called from engine to restore table from the file
*/
-VISU::Storable* VISU::Table_i::Restore(SALOMEDS::SObject_ptr theSObject,
+VISU::Storable* VISU::Table_i::Restore(SALOMEDS::SObject_ptr theSObject,
const string& thePrefix, const Storable::TRestoringMap& theMap)
{
SALOMEDS::Study_var aStudy = theSObject->GetStudy();
SALOMEDS::GenericAttribute_var anAttr;
SALOMEDS::AttributeTableOfInteger_var anInt;
SALOMEDS::AttributeTableOfReal_var aReal;
- if ( !SO->_is_nil() ) {
+ if ( !SO->_is_nil() ) {
if ( Builder->FindAttribute( SO, anAttr, "AttributeTableOfInteger" ) ) {
anInt = SALOMEDS::AttributeTableOfInteger::_narrow( anAttr );
return anInt->GetTitle();
return aReal->GetTitle();
}
}
- return "";
+ return "";
}
-void VISU::Table_i::RemoveFromStudy(){
+void VISU::Table_i::RemoveFromStudy()
+{
+ // Remove the table with all curves
VISU::RemoveFromStudy(mySObj,false);
}
int VISU::Curve_i::myNbPresent = 0;
const string VISU::Curve_i::myComment = "CURVE";
-/*!
+/*!
Generate unique name
*/
-const char* VISU::Curve_i::GenerateName()
-{
- return VISU::GenerateName( "Curve", ++myNbPresent );
+const char* VISU::Curve_i::GenerateName()
+{
+ return VISU::GenerateName( "Curve", ++myNbPresent );
}
/*!
Gets comment string
*/
-const char* VISU::Curve_i::GetComment() const
-{
- return myComment.c_str();
+const char* VISU::Curve_i::GetComment() const
+{
+ return myComment.c_str();
}
/*!
Constructor
*/
VISU::Storable* VISU::Curve_i::Create()
{
- // generate name ...
- myName = GetVerTitle();
+ // generate name ...
+ myName = GetVerTitle();
if ( myName == "" )
myName = GenerateName();
// ... and build the object
/*!
Builds presentation of curve
*/
-VISU::Storable* VISU::Curve_i::Build(int theRestoring )
+VISU::Storable* VISU::Curve_i::Build(int theRestoring )
{
if ( myTable != NULL ) {
// getting table SObject by it's entry
// create SObject and set attributes
QString aComment;
aComment.sprintf("myComment=%s;myType=%d",GetComment(),VISU::TCURVE);
- string anEntry = CreateAttributes( myStudy,
+ string anEntry = CreateAttributes( myStudy,
myTable->GetObjectEntry(),
"",
GetID(),
SALOMEDS::GenericAttribute_var anAttr;
SALOMEDS::AttributeTableOfInteger_var anInt;
SALOMEDS::AttributeTableOfReal_var aReal;
- if ( !SO->_is_nil() ) {
+ if ( !SO->_is_nil() ) {
if ( Builder->FindAttribute( SO, anAttr, "AttributeTableOfInteger" ) ) {
anInt = SALOMEDS::AttributeTableOfInteger::_narrow( anAttr );
if ( myHRow > 0 && myHRow <= anInt->GetNbRows() && myVRow > 0 && myVRow <= anInt->GetNbRows() ) {
SALOMEDS::GenericAttribute_var anAttr;
SALOMEDS::AttributeTableOfInteger_var anInt;
SALOMEDS::AttributeTableOfReal_var aReal;
- if ( !SO->_is_nil() ) {
+ if ( !SO->_is_nil() ) {
if ( Builder->FindAttribute( SO, anAttr, "AttributeTableOfInteger" ) ) {
anInt = SALOMEDS::AttributeTableOfInteger::_narrow( anAttr );
SALOMEDS::StringSeq_var rowTitles = anInt->GetRowTitles();
SALOMEDS::GenericAttribute_var anAttr;
SALOMEDS::AttributeTableOfInteger_var anInt;
SALOMEDS::AttributeTableOfReal_var aReal;
- if ( !SO->_is_nil() ) {
+ if ( !SO->_is_nil() ) {
if ( Builder->FindAttribute( SO, anAttr, "AttributeTableOfInteger" ) ) {
anInt = SALOMEDS::AttributeTableOfInteger::_narrow( anAttr );
SALOMEDS::StringSeq_var rowTitles = anInt->GetRowTitles();
SALOMEDS::GenericAttribute_var anAttr;
SALOMEDS::AttributeTableOfInteger_var anInt;
SALOMEDS::AttributeTableOfReal_var aReal;
- if ( !SO->_is_nil() ) {
+ if ( !SO->_is_nil() ) {
if ( Builder->FindAttribute( SO, anAttr, "AttributeTableOfInteger" ) ) {
anInt = SALOMEDS::AttributeTableOfInteger::_narrow( anAttr );
SALOMEDS::StringSeq_var rowUnits = anInt->GetRowUnits();
SALOMEDS::GenericAttribute_var anAttr;
SALOMEDS::AttributeTableOfInteger_var anInt;
SALOMEDS::AttributeTableOfReal_var aReal;
- if ( !SO->_is_nil() ) {
+ if ( !SO->_is_nil() ) {
if ( Builder->FindAttribute( SO, anAttr, "AttributeTableOfInteger" ) ) {
anInt = SALOMEDS::AttributeTableOfInteger::_narrow( anAttr );
SALOMEDS::StringSeq_var rowUnits = anInt->GetRowUnits();
SALOMEDS::GenericAttribute_var anAttr;
SALOMEDS::AttributeTableOfInteger_var anInt;
SALOMEDS::AttributeTableOfReal_var aReal;
- if ( !SO->_is_nil() ) {
+ if ( !SO->_is_nil() ) {
if ( Builder->FindAttribute( SO, anAttr, "AttributeTableOfInteger" ) ) {
anInt = SALOMEDS::AttributeTableOfInteger::_narrow( anAttr );
- int nbCols = anInt->GetNbColumns() ;
+ int nbCols = anInt->GetNbColumns() ;
if ( nbCols > 0 && myHRow > 0 && myHRow <= anInt->GetNbRows() && myVRow > 0 && myVRow <= anInt->GetNbRows() ) {
int nbPoints = 0;
for ( int j = 1; j <= nbCols; j++ ) {
}
else if ( Builder->FindAttribute( SO, anAttr, "AttributeTableOfReal" ) ) {
aReal = SALOMEDS::AttributeTableOfReal::_narrow( anAttr );
- int nbCols = aReal->GetNbColumns() ;
+ int nbCols = aReal->GetNbColumns() ;
if ( nbCols > 0 && myHRow > 0 && myHRow <= aReal->GetNbRows() && myVRow > 0 && myVRow <= aReal->GetNbRows() ) {
int nbPoints = 0;
for ( int j = 1; j <= nbCols; j++ ) {
{
SPlot2d_Curve* crv = new SPlot2d_Curve();
crv->setHorTitle( GetHorTitle().c_str() );
- string tlt = GetTitle();
+ string tlt = GetTitle();
if ( tlt.length() <= 0 )
tlt = GetVerTitle();
//crv->setVerTitle( strdup( GetVerTitle().c_str() ) );
// cout << i<<"\t"<<xList[i] << "\t"<< yList[i] << endl;
//}
crv->setLine( (Plot2d_Curve::LineType)GetLine(), GetLineWidth() );
- crv->setMarker( (Plot2d_Curve::MarkerType)GetMarker() );
+ crv->setMarker( (Plot2d_Curve::MarkerType)GetMarker() );
SALOMEDS::Color color = GetColor();
crv->setColor( QColor( (int)(color.R*255.), (int)(color.G*255.), (int)(color.B*255.) ) );
crv->setAutoAssign( IsAuto() );
/*!
Gets reference table's entry
*/
-const char* VISU::Curve_i::GetTableID() {
+const char* VISU::Curve_i::GetTableID() {
return myTable->GetObjectEntry();
}
/*!
Called from engine to restore curve from the file
*/
-VISU::Storable* VISU::Curve_i::Restore(SALOMEDS::SObject_ptr theSObject,
+VISU::Storable* VISU::Curve_i::Restore(SALOMEDS::SObject_ptr theSObject,
const string& thePrefix, const Storable::TRestoringMap& theMap)
{
SALOMEDS::Study_var aStudy = theSObject->GetStudy();
return NULL;
}
-void VISU::Curve_i::RemoveFromStudy(){
+void VISU::Curve_i::RemoveFromStudy()
+{
+ VISU::DeleteActors(this);
VISU::RemoveFromStudy(mySObj,false);
}
+SALOMEDS::SObject_var VISU::Curve_i::GetSObject()
+{
+ return mySObj;
+}
+
//----------------------------------------------------------------
// Container Object
//----------------------------------------------------------------
int VISU::Container_i::myNbPresent = 0;
const string VISU::Container_i::myComment = "CONTAINER";
-/*!
+/*!
Generate unique name
*/
-const char* VISU::Container_i::GenerateName()
-{
- return VISU::GenerateName( "Plot2DView", ++myNbPresent );
+const char* VISU::Container_i::GenerateName()
+{
+ return VISU::GenerateName( "Plot2DView", ++myNbPresent );
}
/*!
Gets comment string
*/
-const char* VISU::Container_i::GetComment() const
-{
- return myComment.c_str();
+const char* VISU::Container_i::GetComment() const
+{
+ return myComment.c_str();
}
/*!
Constructor
*/
VISU::Storable* VISU::Container_i::Create()
{
- // generate name ...
+ // generate name ...
myName = GenerateName();
// ... and build the object
return Build( false );
/*!
Builds presentation of container
*/
-VISU::Storable* VISU::Container_i::Build( int theRestoring )
+VISU::Storable* VISU::Container_i::Build( int theRestoring )
{
if ( !theRestoring ) {
// looking for component
// create SObject and set attributes
QString aComment;
aComment.sprintf("myComment=%s;myType=%d",GetComment(),VISU::TCONTAINER);
- string anEntry = CreateAttributes( myStudy,
+ string anEntry = CreateAttributes( myStudy,
SComponent->GetID(),
"",
GetID(),
for ( i = 0; i < myCurves.count(); i++ ) {
SALOMEDS::SObject_var SO = myStudy->FindObjectID( myCurves[i].latin1() );
if ( !SO->_is_nil() && Builder->FindAttribute( SO, anAttr, "AttributeIOR" ) ) {
- // if real Curve Object still exists
+ // if real Curve Object still exists
SALOMEDS::ChildIterator_var CI = myStudy->NewChildIterator( mySO );
bool bFound = false;
for ( ; CI->More(); CI->Next() ) {
toDelete.append( myCurves[i] );
}
}
- for ( i = 0; i < toDelete.count(); i++ ) {
+ for ( i = 0; i < toDelete.count(); i++ ) {
myCurves.remove( toDelete[i] );
}
toDelete.clear();
toDelete.append( childSO->GetID() );
}
}
- for ( i = 0; i < toDelete.count(); i++ ) {
+ for ( i = 0; i < toDelete.count(); i++ ) {
SALOMEDS::ChildIterator_var CI = myStudy->NewChildIterator( mySO );
for ( ; CI->More(); CI->Next() ) {
SALOMEDS::SObject_var childSO = CI->Value();
SALOMEDS::SObject_var SO = myStudy->FindObjectID( myCurves[ theIndex-1 ].latin1() );
CORBA::Object_var anObject = VISU::SObjectToObject( SO );
if( !CORBA::is_nil( anObject ) ) {
- // if real Curve Object exists
+ // if real Curve Object exists
CORBA::Object_ptr aCurve = VISU::Curve::_narrow( anObject );
if( !CORBA::is_nil( aCurve ) )
return dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aCurve).in());
{
if(MYDEBUG) MESSAGE(GetComment());
mySObj = SALOMEDS::SObject::_duplicate(SO);
- myName = VISU::Storable::FindValue( theMap, "myName" ).latin1();
+ myName = VISU::Storable::FindValue( theMap, "myName" ).latin1();
QString val = VISU::Storable::FindValue( theMap, "myCurves" );
myCurves = QStringList::split( QString( "*" ), val, false );
return Build( true );
/*!
Called from engine to restore container from the file
*/
-VISU::Storable* VISU::Container_i::Restore(SALOMEDS::SObject_ptr theSObject,
+VISU::Storable* VISU::Container_i::Restore(SALOMEDS::SObject_ptr theSObject,
const string& thePrefix, const Storable::TRestoringMap& theMap)
{
SALOMEDS::Study_var aStudy = theSObject->GetStudy();
return pResent->Restore( theMap, theSObject );
}
-void VISU::Container_i::RemoveFromStudy(){
+void VISU::Container_i::RemoveFromStudy()
+{
VISU::RemoveFromStudy(mySObj,false);
}
if(myColumnUnits.size() != iEnd) myColumnUnits.resize(iEnd);
int jEnd = myRows.size();
for(int j = 0; j < jEnd; j++)
- if(myRows[j].myValues.size() != iEnd)
+ if(myRows[j].myValues.size() != iEnd)
return 0;
return 1;
}
}
// if data is not empty, try to process it
else {
- TRow aRow;
+ TRow aRow;
if(MYDEBUG) cout << "...New row is found: " << endl;
if ( !cmt.isEmpty() ) {
aRow.myTitle = cmt.latin1();
SALOMEDS::StudyBuilder_var aStudyBuilder = theStudy->NewBuilder();
SALOMEDS::SComponent_var theSComponent = VISU::FindOrCreateVisuComponent(theStudy);
SALOMEDS::SObject_var aFileObject = aStudyBuilder->NewObject(theSComponent);
- SALOMEDS::GenericAttribute_var anAttr =
+ SALOMEDS::GenericAttribute_var anAttr =
aStudyBuilder->FindOrCreateAttribute(aFileObject, "AttributeName");
SALOMEDS::AttributeName_var aName = SALOMEDS::AttributeName::_narrow(anAttr);
QFileInfo aFileInfo(theFileName);
return aFileObject;
}
-template<class TTableAttr> bool ExportTableToFile(const TTableAttr& aTabAttr,
+template<class TTableAttr> bool ExportTableToFile(const TTableAttr& aTabAttr,
const char* theFileName)
{
if (!CORBA::is_nil(aTabAttr)) {
- QFile aFile(theFileName);
- aFile.open(IO_WriteOnly);
+ QFile aFile(theFileName);
+ aFile.open(IO_WriteOnly);
+
+ /* extract the tabe info and write it into file */
+
+ QString aTitle(aTabAttr->GetTitle()); /*Table title*/
+ int aRowsNb = aTabAttr->GetNbRows();
+ int aColNb = aTabAttr->GetNbColumns();
- /* extract the tabe info and write it into file */
-
- QString aTitle(aTabAttr->GetTitle()); /*Table title*/
- int aRowsNb = aTabAttr->GetNbRows();
- int aColNb = aTabAttr->GetNbColumns();
-
- SALOMEDS::StringSeq_var aRowTitles = aTabAttr->GetRowTitles();
- QString anAbscissTitle(aRowTitles[0]); /*Absciss row title (X coord)*/
- anAbscissTitle.stripWhiteSpace();
+ SALOMEDS::StringSeq_var aRowTitles = aTabAttr->GetRowTitles();
+ QString anAbscissTitle(aRowTitles[0]); /*Absciss row title (X coord)*/
+ anAbscissTitle.stripWhiteSpace();
- SALOMEDS::StringSeq_var aRowUnits = aTabAttr->GetRowUnits();
- QString anAbscissUnit(aRowUnits[0]);
- anAbscissUnit.stripWhiteSpace();
-
- SALOMEDS::StringSeq_var aColumnTitles = aTabAttr->GetColumnTitles();
+ SALOMEDS::StringSeq_var aRowUnits = aTabAttr->GetRowUnits();
+ QString anAbscissUnit(aRowUnits[0]);
+ anAbscissUnit.stripWhiteSpace();
+
+ SALOMEDS::StringSeq_var aColumnTitles = aTabAttr->GetColumnTitles();
if (aRowsNb > 2 && aTitle.length() ) aTitle = aTitle + " - ";
- QString aLine;
- for (int i = 2; i <= aRowsNb; i++ )
- {
- /* TITLE */
- QString anOrdinate(aRowTitles[i-1]), aTail;
- anOrdinate.stripWhiteSpace();
+ QString aLine;
+ for (int i = 2; i <= aRowsNb; i++ )
+ {
+ /* TITLE */
+ QString anOrdinate(aRowTitles[i-1]), aTail;
+ anOrdinate.stripWhiteSpace();
+
+ aLine = "#TITLE: " + aTitle +
+ ((anOrdinate.length())? anOrdinate :
+ (aRowsNb>2)? aTail.sprintf("%d",i-1) : aTail.sprintf("") ) + "\n";
+ aFile.writeBlock(aLine, aLine.length() );
- aLine = "#TITLE: " + aTitle +
- ((anOrdinate.length())? anOrdinate :
- (aRowsNb>2)? aTail.sprintf("%d",i-1) : aTail.sprintf("") ) + "\n";
- aFile.writeBlock(aLine, aLine.length() );
-
- /* COLUMN_TITLES */
- if ( anAbscissTitle.length() || anOrdinate.length() ) {
- aLine = "#COLUMN_TITLES: " + anAbscissTitle + " | " + anOrdinate + "\n";
- aFile.writeBlock(aLine, aLine.length() );
- }
+ /* COLUMN_TITLES */
+ if ( anAbscissTitle.length() || anOrdinate.length() ) {
+ aLine = "#COLUMN_TITLES: " + anAbscissTitle + " | " + anOrdinate + "\n";
+ aFile.writeBlock(aLine, aLine.length() );
+ }
- /* COLUMN_UNITS */
- aLine = anAbscissUnit + " " +aRowUnits[i-1];
- if (!aLine.stripWhiteSpace().isEmpty()) {
- aLine = "#COLUMN_UNITS: " + aLine + "\n";
- aFile.writeBlock(aLine, aLine.length() );
- }
+ /* COLUMN_UNITS */
+ aLine = anAbscissUnit + " " +aRowUnits[i-1];
+ if (!aLine.stripWhiteSpace().isEmpty()) {
+ aLine = "#COLUMN_UNITS: " + aLine + "\n";
+ aFile.writeBlock(aLine, aLine.length() );
+ }
- /* CURVE COORDINATES */
- for (int j = 1; j <= aColNb; j++)
- {
- if ( aTabAttr -> HasValue(i,j) && aTabAttr -> HasValue(1, j)) {
- aLine = aLine.sprintf("%.16g %.16g",
- (double)(aTabAttr->GetValue(1,j)),
- (double)(aTabAttr->GetValue(i,j))); /* aTabAttr->GetValue(1,j) - X coord */
- if ( !aLine.stripWhiteSpace().isEmpty() ) {
- QString aColTitle(aColumnTitles[j-1]);
- if ( !aColTitle.stripWhiteSpace().isEmpty() )
- aLine = aLine + " #TITLE: " + aColTitle ;
- aFile.writeBlock(aLine + "\n", aLine.length() + 1);
- }
- }
- }
- aFile.writeBlock("\n", 1);
- }
- aFile.close();
- return true;
- }
+ /* CURVE COORDINATES */
+ for (int j = 1; j <= aColNb; j++)
+ {
+ if ( aTabAttr -> HasValue(i,j) && aTabAttr -> HasValue(1, j)) {
+ aLine = aLine.sprintf("%.16g %.16g",
+ (double)(aTabAttr->GetValue(1,j)),
+ (double)(aTabAttr->GetValue(i,j))); /* aTabAttr->GetValue(1,j) - X coord */
+ if ( !aLine.stripWhiteSpace().isEmpty() ) {
+ QString aColTitle(aColumnTitles[j-1]);
+ if ( !aColTitle.stripWhiteSpace().isEmpty() )
+ aLine = aLine + " #TITLE: " + aColTitle ;
+ aFile.writeBlock(aLine + "\n", aLine.length() + 1);
+ }
+ }
+ }
+ aFile.writeBlock("\n", 1);
+ }
+ aFile.close();
+ return true;
+ }
return false;
}
-
+
bool VISU::ExportTableToFile(SALOMEDS::SObject_ptr theTable, const char* theFileName)
{
//Find table
SALOMEDS::GenericAttribute_var anAttr ;
if (theTable->FindAttribute(anAttr, "AttributeTableOfReal"))
{
- SALOMEDS::AttributeTableOfReal_var aTabAttr = SALOMEDS::AttributeTableOfReal ::_narrow(anAttr);
+ SALOMEDS::AttributeTableOfReal_var aTabAttr = SALOMEDS::AttributeTableOfReal ::_narrow(anAttr);
return ExportTableToFile ( aTabAttr , theFileName);
-
+
}
else if (theTable->FindAttribute(anAttr, "AttributeTableOfInteger")) {
- SALOMEDS::AttributeTableOfInteger_var aTabAttr = SALOMEDS::AttributeTableOfInteger ::_narrow(anAttr);
+ SALOMEDS::AttributeTableOfInteger_var aTabAttr = SALOMEDS::AttributeTableOfInteger ::_narrow(anAttr);
return ExportTableToFile ( aTabAttr , theFileName);
-
+
}
return false;
}
// VISU OBJECT : interactive object for VISU entities implementation
//
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
//
//
// File : VISU_Table_i.hh
SALOMEDS::SObject_var GetSObject() const { return mySObj;}
virtual Storable* Restore( const Storable::TRestoringMap& theMap, SALOMEDS::SObject_ptr SO);
- static Storable* Restore(SALOMEDS::SObject_ptr theSObject,
- const std::string& thePrefix,
+ static Storable* Restore(SALOMEDS::SObject_ptr theSObject,
+ const std::string& thePrefix,
const Storable::TRestoringMap& theMap);
virtual void ToStream( std::ostringstream& theStr );
static const std::string myComment;
virtual void SetColor( const SALOMEDS::Color& theColor ) { myColor = theColor; myAuto = false; }
virtual SALOMEDS::Color GetColor() { return myColor; }
-
+
virtual void SetMarker( VISU::Curve::MarkerType theType ) { myMarker = theType; myAuto = false; }
virtual VISU::Curve::MarkerType GetMarker() { return myMarker; }
- virtual void SetLine( VISU::Curve::LineType theType, CORBA::Long theWidth )
+ virtual void SetLine( VISU::Curve::LineType theType, CORBA::Long theWidth )
{ myLine = theType; myLineWidth = theWidth; myAuto = false; }
virtual VISU::Curve::LineType GetLine() { return myLine; }
virtual CORBA::Long GetLineWidth() { return myLineWidth; }
virtual void RemoveFromStudy();
+ virtual SALOMEDS::SObject_var GetSObject();
+
protected:
Storable* Build(int theRestoring);
virtual Storable* Restore( const Storable::TRestoringMap& theMap, SALOMEDS::SObject_ptr theSO);
- static Storable* Restore(SALOMEDS::SObject_ptr theSObject,
- const std::string& thePrefix,
+ static Storable* Restore(SALOMEDS::SObject_ptr theSObject,
+ const std::string& thePrefix,
const Storable::TRestoringMap& theMap);
virtual void ToStream( std::ostringstream& theStr );
protected:
Storable* Build(int theRestoring);
-
+
protected:
QStringList myCurves;
SALOMEDS::SObject_var mySObj;
-
+
public:
virtual Storable* Create();
virtual Storable* Restore( const Storable::TRestoringMap& theMap, SALOMEDS::SObject_ptr SO );
- static Storable* Restore(SALOMEDS::SObject_ptr theSObject,
- const std::string& thePrefix,
+ static Storable* Restore(SALOMEDS::SObject_ptr theSObject,
+ const std::string& thePrefix,
const Storable::TRestoringMap& theMap);
virtual void ToStream( std::ostringstream& theStr );
};
}
-#endif
-
+#endif
myTimeMax = 0;
myLastError = "";
myCycling = false;
+
+ myAnimEntry = "";
}
//************************************************************************
-//void VISU_TimeAnimation::addField (SALOMEDS::SObject_ptr theField)
void VISU_TimeAnimation::addField (_PTR(SObject) theField)
{
FieldData aNewData;
- //aNewData.myField = SALOMEDS::SObject::_duplicate(theField);
aNewData.myField = theField;
aNewData.myNbFrames = 0;
aNewData.myPrsType = VISU::TSCALARMAP;
+ aNewData.myOffset[0] = aNewData.myOffset[1] = aNewData.myOffset[2] = 0;
VISU::Storable::TRestoringMap aMap = getMapOfValue(aNewData.myField);
aNewData.myNbTimes = VISU::Storable::FindValue(aMap,"myNbTimeStamps").toLong();
myFieldsLst.append(aNewData);
void VISU_TimeAnimation::addField (SALOMEDS::SObject_ptr theField)
{
FieldData aNewData;
- //aNewData.myField = SALOMEDS::SObject::_duplicate(theField);
_PTR(SObject) aField = VISU::GetClientSObject(theField, myStudy);
aNewData.myField = aField;
aNewData.myNbFrames = 0;
aData.myNbFrames = i;
QString aFixRange = VISU::GetResourceMgr()->stringValue("Visu:SBImposeRange");
if (aFixRange.compare("true") != 0) {
- for (i = 0; i < aData.myNbFrames; i++)
+ for (i = 0; i < aData.myNbFrames; i++) {
aData.myPrs[i]->SetRange(aMin, aMax);
- if(aData.myPrsType == VISU::TISOSURFACE)
+ aData.myPrs[i]->SetOffset(aData.myOffset);
+ }
+ if (aData.myPrsType == VISU::TISOSURFACE)
for (i = 0; i < aData.myNbFrames; i++)
- if(VISU::IsoSurfaces_i* aPrs = dynamic_cast<VISU::IsoSurfaces_i*>(aData.myPrs[i]))
+ if (VISU::IsoSurfaces_i* aPrs = dynamic_cast<VISU::IsoSurfaces_i*>(aData.myPrs[i]))
aPrs->SetSubRange(aMin, aMax);
}
}
for (long j = 0; j < aData.myNbFrames; j++) {
VISU_Actor* aActor = NULL;
try{
+ aData.myPrs[j]->SetOffset(aData.myOffset);
aActor = aData.myPrs[j]->CreateActor();
myView->AddActor(aActor);
if(j == 0)
}
//************************************************************************
-//VISU::Result_i* VISU_TimeAnimation::createPresent (SALOMEDS::SObject_var theField)
VISU::Result_i* VISU_TimeAnimation::createPresent (_PTR(SObject) theField)
{
- //SALOMEDS::SObject_var aSObj = theField->GetFather();
_PTR(SObject) aSObj = theField->GetFather();
aSObj = aSObj->GetFather();
aSObj = aSObj->GetFather();
}
//************************************************************************
-//VISU::Storable::TRestoringMap VISU_TimeAnimation::getMapOfValue (SALOMEDS::SObject_var theSObject)
VISU::Storable::TRestoringMap VISU_TimeAnimation::getMapOfValue (_PTR(SObject) theSObject)
{
VISU::Storable::TRestoringMap aMap;
- //if (!theSObject->_is_nil()) {
if (theSObject) {
- //SALOMEDS::GenericAttribute_var anAttr;
_PTR(GenericAttribute) anAttr;
if (theSObject->FindAttribute(anAttr, "AttributeComment")) {
- //SALOMEDS::AttributeComment_var aComment = SALOMEDS::AttributeComment::_narrow(anAttr);
_PTR(AttributeComment) aComment (anAttr);
- //CORBA::String_var aString = aComment->Value();
std::string aString = aComment->Value();
- //QString strIn (aString.in());
QString strIn (aString.c_str());
VISU::Storable::StrToMap(strIn, aMap);
}
}
//************************************************************************
-//double VISU_TimeAnimation::getTimeValue (SALOMEDS::SObject_var theTimeStamp)
double VISU_TimeAnimation::getTimeValue (_PTR(SObject) theTimeStamp)
{
- //SALOMEDS::GenericAttribute_var anAttr;
_PTR(GenericAttribute) anAttr;
if (theTimeStamp->FindAttribute(anAttr, "AttributeName")) {
- //SALOMEDS::AttributeName_var aName = SALOMEDS::AttributeName::_narrow(anAttr);
_PTR(AttributeName) aName (anAttr);
- //QString aNameString (aName->Value());
QString aNameString (aName->Value().c_str());
return aNameString.toDouble();
}
mySpeed = (theSpeed<1)? 1 : theSpeed;
}
+//************************************************************************
+int VISU_TimeAnimation::myNBAnimations = 0;
+QString VISU_TimeAnimation::GenerateName()
+{
+ return VISU::GenerateName("Animation", myNBAnimations++);
+}
+
+//************************************************************************
+SALOMEDS::SObject_ptr VISU_TimeAnimation::publishInStudy()
+{
+ if (myStudy->GetProperties()->IsLocked())
+ return SALOMEDS::SObject::_nil();
+
+ _PTR(StudyBuilder) aStudyBuilder = myStudy->NewBuilder();
+ aStudyBuilder->NewCommand(); // There is a transaction
+ _PTR(SComponent) aSComponent = VISU::ClientFindOrCreateVisuComponent(myStudy);
+ std::string aSComponentEntry = aSComponent->GetID();
+
+ QString aComment;
+ aComment.sprintf("myComment=ANIMATION;myType=%d;myMinVal=%g;myMaxVal=%g",
+ VISU::TANIMATION,myMinVal,myMaxVal);
+
+ string anEntry = VISU::CreateAttributes(myStudy,aSComponentEntry.c_str(),"","",
+ GenerateName(),"",aComment,true);
+ myAnimEntry = anEntry.c_str();
+ _PTR(SObject) aAnimSObject = myStudy->FindObjectID(anEntry.c_str());
+
+ for (int i = 0; i < getNbFields(); i++) {
+ FieldData& aData = myFieldsLst[i];
+ _PTR(SObject) newObj = aStudyBuilder->NewObject(aAnimSObject);
+ aStudyBuilder->Addreference(newObj, aData.myField);
+ if (!aData.myPrs.empty()) {
+ ostringstream strOut;
+ aData.myPrs[0]->ToStream(strOut);
+ string aPrsComment = strOut.str();
+ VISU::CreateAttributes(myStudy, newObj->GetID().c_str(),"","",
+ aData.myPrs[0]->GetComment(),"",aPrsComment.c_str(),true);
+ }
+ }
+ aStudyBuilder->CommitCommand();
+
+ return VISU::GetSObject(aAnimSObject);
+}
+
+//************************************************************************
+void VISU_TimeAnimation::saveAnimation()
+{
+ if (myStudy->GetProperties()->IsLocked()) return;
+ if (myAnimEntry.isEmpty()) return;
+
+ _PTR(SObject) aAnimSObject = myStudy->FindObjectID(myAnimEntry);
+ if (!aAnimSObject) return;
+
+ _PTR(StudyBuilder) aStudyBuilder = myStudy->NewBuilder();
+ aStudyBuilder->NewCommand(); // There is a transaction
+ _PTR(SComponent) aSComponent = VISU::ClientFindOrCreateVisuComponent(myStudy);
+ std::string aSComponentEntry = aSComponent->GetID();
+
+ QString aComment;
+ aComment.sprintf("myComment=ANIMATION;myType=%d;myMinVal=%g;myMaxVal=%g",
+ VISU::TANIMATION,myMinVal,myMaxVal);
+
+ _PTR(GenericAttribute) anAttr;
+ anAttr = aStudyBuilder->FindOrCreateAttribute(aAnimSObject, "AttributeComment");
+ _PTR(AttributeComment) aCmnt (anAttr);
+ aCmnt->SetValue(aComment);
+
+ _PTR(ChildIterator) anIter = myStudy->NewChildIterator(aAnimSObject);
+ int i;
+ for (i = 0, anIter->Init(); anIter->More(); anIter->Next(), i++) {
+ _PTR(SObject) aRefObj = anIter->Value();
+ _PTR(ChildIterator) anPrsIter = myStudy->NewChildIterator(aRefObj);
+ anPrsIter->Init();
+ if (!anPrsIter->More()) continue;
+ FieldData& aData = myFieldsLst[i];
+ if (aData.myPrs.empty()) continue;
+
+ _PTR(SObject) aPrsObj = anPrsIter->Value();
+ ostringstream strOut;
+ aData.myPrs[0]->ToStream(strOut);
+ string aPrsComment = strOut.str();
+ anAttr = aStudyBuilder->FindOrCreateAttribute(aPrsObj, "AttributeComment");
+ aCmnt = _PTR(AttributeComment)(anAttr);
+ aCmnt->SetValue(aPrsComment.c_str());
+
+ anAttr = aStudyBuilder->FindOrCreateAttribute(aPrsObj, "AttributeName");
+ _PTR(AttributeName) aPrsName (anAttr);
+ aPrsName->SetValue(aData.myPrs[0]->GetComment());
+ }
+ aStudyBuilder->CommitCommand();
+}
+
+//************************************************************************
+void VISU_TimeAnimation::restoreFromStudy(SALOMEDS::SObject_ptr theField)
+{
+ //SALOMEDS::SObject_var aAnimSObject = SALOMEDS::SObject::_duplicate(theField);
+ _PTR(SObject) aAnimSObject = VISU::GetClientSObject(theField, myStudy);
+
+ VISU::Storable::TRestoringMap aMap;
+ _PTR(GenericAttribute) anAttr;
+ if (!aAnimSObject->FindAttribute(anAttr, "AttributeComment")) return;
+
+ _PTR(AttributeComment) aComment (anAttr);
+ string aComm = aComment->Value();
+ QString strIn (aComm.c_str());
+ VISU::Storable::StrToMap(strIn,aMap);
+ bool isExist;
+
+ myMinVal = VISU::Storable::FindValue(aMap,"myMinVal",&isExist).toDouble();
+ myMaxVal = VISU::Storable::FindValue(aMap,"myMaxVal",&isExist).toDouble();
+
+ _PTR(ChildIterator) anIter = myStudy->NewChildIterator(aAnimSObject);
+ for (anIter->Init(); anIter->More(); anIter->Next()) {
+ _PTR(SObject) aRefObj = anIter->Value();
+ _PTR(SObject) aFieldObj;
+ if (!aRefObj->ReferencedObject(aFieldObj) ) continue;
+ addField(aFieldObj);
+ FieldData& aData = getFieldData(getNbFields()-1);
+
+ // Get Presentation object
+ _PTR(ChildIterator) anPrsIter = myStudy->NewChildIterator(aRefObj);
+ anPrsIter->Init();
+ if (!anPrsIter->More()) continue;
+ _PTR(SObject) aPrsObj = anPrsIter->Value();
+ if (!aPrsObj->FindAttribute(anAttr, "AttributeName")) continue;
+ _PTR(AttributeName) aName (anAttr);
+ string aStr = aName->Value();
+ QString strName (aStr.c_str());
+
+ if (strName == VISU::ScalarMap_i::myComment.c_str())
+ aData.myPrsType = VISU::TSCALARMAP;
+ else if (strName == VISU::IsoSurfaces_i::myComment.c_str())
+ aData.myPrsType = VISU::TISOSURFACE;
+ else if (strName == VISU::CutPlanes_i::myComment.c_str())
+ aData.myPrsType = VISU::TCUTPLANES;
+ else if (strName == VISU::DeformedShape_i::myComment.c_str())
+ aData.myPrsType = VISU::TDEFORMEDSHAPE;
+ else if (strName == VISU::Vectors_i::myComment.c_str())
+ aData.myPrsType = VISU::TVECTORS;
+ else if (strName == VISU::StreamLines_i::myComment.c_str())
+ aData.myPrsType = VISU::TSTREAMLINES;
+ else
+ continue;
+ generatePresentations(getNbFields()-1);
+
+ if (!aPrsObj->FindAttribute(anAttr, "AttributeComment")) return;
+ _PTR(AttributeComment) aPrsComment (anAttr);
+ string aPrsComm = aPrsComment->Value();
+ QString strPrsIn(aPrsComm.c_str());
+ VISU::Storable::TRestoringMap aPrsMap;
+ VISU::Storable::StrToMap(strPrsIn,aPrsMap);
+
+ aData.myPrs[0]->Restore(aPrsMap);
+ aData.myPrs[0]->GetOffset(aData.myOffset);
+ for (int i = 1; i < aData.myNbFrames; i++) {
+ aData.myPrs[i]->SameAs(aData.myPrs[0]);
+ }
+ }
+ string aStr = aAnimSObject->GetID();
+ myAnimEntry = aStr.c_str();
+}
+
+//========================================================================
+//========================================================================
//========================================================================
VISU_TimeAnimation_i::VISU_TimeAnimation_i (SALOMEDS::Study_ptr theStudy,
VISU::View3D_ptr theView3D)
{
myAnim->setCycling(theCycle);
}
+
+SALOMEDS::SObject_ptr VISU_TimeAnimation_i::publishInStudy()
+{
+ return myAnim->publishInStudy();
+}
+
+void VISU_TimeAnimation_i::restoreFromStudy(SALOMEDS::SObject_ptr theObj)
+{
+ myAnim->restoreFromStudy(theObj);
+}
+
+CORBA::Boolean VISU_TimeAnimation_i::isSavedInStudy()
+{
+ return myAnim->isSavedInStudy();
+}
+
+void VISU_TimeAnimation_i::saveAnimation()
+{
+ myAnim->saveAnimation();
+}
struct FieldData
{
- VISU::VISUType myPrsType;
- //SALOMEDS::SObject_var myField; // field label
+ VISU::VISUType myPrsType;
_PTR(SObject) myField; // field label
- long myNbTimes; // number of Timestamps
- long myNbFrames; // number of created Frames
- std::vector<VISU::ScalarMap_i*> myPrs; // Presentations
+ long myNbTimes; // number of Timestamps
+ long myNbFrames; // number of created Frames
+ std::vector<VISU::ScalarMap_i*> myPrs; // Presentations
std::vector<VISU_Actor*> myActors; // Actors
std::vector<double> myTiming; // time values
+ float myOffset[3];
};
//static VISU::Result_i* createPresent (SALOMEDS::SObject_var theField);
//static VISU::Storable::TRestoringMap getMapOfValue (SALOMEDS::SObject_var theSObject);
//static double getTimeValue (SALOMEDS::SObject_var theTimestamp);
-
+
static VISU::Result_i* createPresent (_PTR(SObject) theField);
static VISU::Storable::TRestoringMap getMapOfValue (_PTR(SObject) theSObject);
static double getTimeValue (_PTR(SObject) theTimestamp);
-
- //VISU_TimeAnimation(SALOMEDS::Study_ptr theStudy,
+
VISU_TimeAnimation(_PTR(Study) theStudy,
VISU::View3D_ptr theView3D = VISU::View3D::_nil());
~VISU_TimeAnimation();
-
+
virtual VISU::VISUType GetType() { return VISU::TNONE;};
-
+
void addField (_PTR(SObject) theField);
void addField (SALOMEDS::SObject_ptr theField);
FieldData& getFieldData (int theNum) { return myFieldsLst[theNum]; }
VISU::ScalarMap_ptr getPresentation(CORBA::Long theField, CORBA::Long theFrame);
- void setPresentationType(CORBA::Long theFieldNum, VISU::VISUType theType) { myFieldsLst[theFieldNum].myPrsType = theType; }
- VISU::VISUType getPresentationType(CORBA::Long theFieldNum) { return myFieldsLst[theFieldNum].myPrsType; }
+ void setPresentationType(CORBA::Long theFieldNum, VISU::VISUType theType)
+ { myFieldsLst[theFieldNum].myPrsType = theType; }
+ VISU::VISUType getPresentationType(CORBA::Long theFieldNum)
+ { return myFieldsLst[theFieldNum].myPrsType; }
void setSpeed(CORBA::Long theSpeed);
CORBA::Long getSpeed() { return mySpeed; }
{ myMaxVal = theMax; myMinVal = theMin; }
CORBA::Double getMinRange() { return myMinVal; }
- CORBA::Double getMaxRange() { return myMaxVal; }
+ CORBA::Double getMaxRange() { return myMaxVal; }
CORBA::Boolean isRangeDefined() { return !((myMaxVal==0) && (myMinVal == myMaxVal)); }
void dumpTo(const char* thePath) { myDumpPath = thePath; }
void setProportional(CORBA::Boolean theProp) { myProportional = theProp; }
void setCycling(CORBA::Boolean theCycle) { myCycling = theCycle; }
+ SALOMEDS::SObject_ptr publishInStudy();
+ void restoreFromStudy(SALOMEDS::SObject_ptr theField);
+ void saveAnimation();
+ bool isSavedInStudy() const { return !myAnimEntry.isEmpty(); }
+
public slots:
void setProportionalSlot(bool theProp) { myProportional = theProp; }
void setCyclingSlot(bool theCycle) { myCycling = theCycle; }
protected:
void run();
+ QString GenerateName();
private:
QString myLastError;
int mySpeed;
bool myProportional;
bool myCycling;
- //SALOMEDS::Study_var myStudy;
_PTR(Study) myStudy;
double myMaxVal, myMinVal;
double myTimeMin, myTimeMax;
QString myDumpPath;
SVTK_ViewWindow* myView;
+
+ QString myAnimEntry;
+
+ static int myNBAnimations;
};
{
VISU_TimeAnimation* myAnim;
public:
- VISU_TimeAnimation_i(SALOMEDS::Study_ptr theStudy,
+ VISU_TimeAnimation_i(SALOMEDS::Study_ptr theStudy,
VISU::View3D_ptr theView3D = VISU::View3D::_nil());
~VISU_TimeAnimation_i();
- virtual VISU::VISUType GetType(){ return VISU::TNONE;}
+ virtual VISU::VISUType GetType() { return VISU::TANIMATION; }
+ //virtual VISU::VISUType GetType() { return VISU::TNONE; }
virtual void addField(SALOMEDS::SObject_ptr theField);
virtual CORBA::Boolean generateFrames();
virtual void generatePresentations(CORBA::Long theFieldNum);
-
+
virtual void clearView();
virtual void stopAnimation();
virtual void setProportional(CORBA::Boolean theProp);
virtual void setCycling(CORBA::Boolean theCycle);
-};
+ virtual SALOMEDS::SObject_ptr publishInStudy();
+ virtual void restoreFromStudy(SALOMEDS::SObject_ptr theField);
+ virtual CORBA::Boolean isSavedInStudy();
+ virtual void saveAnimation();
+};
#endif //VISU_TIMEANIMATION_H
// VISU OBJECT : interactive object for VISU entities implementation
//
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
//
//
// File : VISU_PrsObject_i.hxx
virtual void SetGlyphType(VISU::Vectors::GlyphType theType);
virtual VISU::Vectors::GlyphType GetGlyphType();
-
+
virtual void SetGlyphPos(VISU::Vectors::GlyphPos thePos);
virtual VISU::Vectors::GlyphPos GetGlyphPos();
float myLineWidth;
public:
- static int IsPossible(Result_i* theResult, const char* theMeshName, VISU::Entity theEntity,
+ static int IsPossible(Result_i* theResult, const char* theMeshName, VISU::Entity theEntity,
const char* theFieldName, int theIteration, int isMemoryCheck = true);
- virtual Storable* Create(const char* theMeshName, VISU::Entity theEntity,
+ virtual Storable* Create(const char* theMeshName, VISU::Entity theEntity,
const char* theFieldName, int theIteration);
virtual void ToStream(std::ostringstream& theStr);
virtual Storable* Restore(const Storable::TRestoringMap& theMap);
- static const string myComment;
+ static const std::string myComment;
virtual const char* GetComment() const;
virtual QString GenerateName();
virtual void UpdateActor(VISU_Actor* theActor) ;
};
}
+
#endif
#include "SVTK_ViewModel.h"
#include "SPlot2d_Curve.h"
#include "Plot2d_ViewFrame.h"
+#include "Plot2d_ViewWindow.h"
#include "Plot2d_ViewModel.h"
#include "SalomeApp_Study.h"
#include "SalomeApp_Application.h"
+#include "SalomeApp_SelectionMgr.h"
#include "SALOME_Event.hxx"
+#include "SALOME_ListIO.hxx"
+#include "SALOME_ListIteratorOfListIO.hxx"
#include <vtkCamera.h>
#include <vtkRenderer.h>
struct TNewViewManagerEvent: public SALOME_Event
{
- //std::string myStudyName;
int myStudyId;
typedef SalomeApp_Application* TResult;
TResult myResult;
- //TNewViewManagerEvent (const char* theStudyName):
- // myStudyName(theStudyName),
TNewViewManagerEvent (const int theStudyId):
myStudyId(theStudyId),
myResult(NULL)
void
Execute()
{
- //MESSAGE("Find application for study : " << myStudyName);
MESSAGE("Find application for study with id = : " << myStudyId);
SUIT_Session* aSession = SUIT_Session::session();
QPtrList<SUIT_Application> anApplications = aSession->applications();
return anVISUActor->GetParent();
return NULL;
}
+
+ struct TDeleteActorsEvent: public SALOME_Event
+ {
+ VISU::Curve_i* myPrs;
+
+ TDeleteActorsEvent (VISU::Curve_i* thePrs):
+ myPrs(thePrs)
+ {}
+
+ virtual
+ void
+ Execute()
+ {
+ if (!myPrs) return;
+
+ // 1. Find appropriate application (code like in TNewViewManagerEvent::Execute())
+ SALOMEDS::Study_var myStudyDocument = myPrs->GetStudyDocument();
+ SalomeApp_Application* anApp = NULL;
+ CORBA::String_var studyName = myStudyDocument->Name();
+ std::string aStudyName = studyName.in();
+ SUIT_Session* aSession = SUIT_Session::session();
+ QPtrList<SUIT_Application> anApplications = aSession->applications();
+ QPtrListIterator<SUIT_Application> anIter (anApplications);
+ while (SUIT_Application* aSUITApp = anIter.current()) {
+ ++anIter;
+ if (SUIT_Study* aSStudy = aSUITApp->activeStudy()) {
+ if (SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>(aSStudy)) {
+ if (_PTR(Study) aCStudy = aStudy->studyDS()) {
+ if (aStudyName == aCStudy->Name()) {
+ anApp = dynamic_cast<SalomeApp_Application*>(aSUITApp);
+ break;
+ }
+ }
+ }
+ }
+ }
+ if (!anApp)
+ return;
+
+ // 2. Remove corresponding IO from selection
+ SALOMEDS::SObject_var aSObject = myPrs->GetSObject();
+ CORBA::String_var anEntry = aSObject->GetID();
+
+ SalomeApp_SelectionMgr* aSelectionMgr = anApp->selectionMgr();
+ SALOME_ListIO aListIO, aNewListIO;
+ aSelectionMgr->selectedObjects(aListIO);
+
+ for (SALOME_ListIteratorOfListIO it (aListIO); it.More(); it.Next()) {
+ if (it.Value()->hasEntry()) {
+ std::string aCurEntry (it.Value()->getEntry());
+ if (aCurEntry != std::string( anEntry.in() ) ) {
+ aNewListIO.Append(it.Value());
+ }
+ }
+ }
+
+ aSelectionMgr->setSelectedObjects(aNewListIO);
+
+ // 3. Remove Actors
+ ViewManagerList aViewManagerList;
+ anApp->viewManagers(SVTK_Viewer::Type(), aViewManagerList);
+ QPtrListIterator<SUIT_ViewManager> anVMIter (aViewManagerList);
+ for (; anVMIter.current(); ++anVMIter) {
+ SUIT_ViewManager* aViewManager = anVMIter.current();
+ QPtrVector<SUIT_ViewWindow> aViews = aViewManager->getViews();
+ for (int i = 0, iEnd = aViews.size(); i < iEnd; i++) {
+ if (SUIT_ViewWindow* aViewWindow = aViews.at(i)) {
+ if (Plot2d_ViewWindow* vw = dynamic_cast<Plot2d_ViewWindow*>(aViewWindow)) {
+ Plot2d_ViewFrame* vf = vw->getViewFrame();
+ QList<Plot2d_Curve> clist;
+ vf->getCurves(clist);
+ for (int i = 0; i < clist.count(); i++) {
+ if (SPlot2d_Curve* cu = dynamic_cast<SPlot2d_Curve*>(clist.at(i))) {
+ if (cu->hasIO() &&
+ strcmp(cu->getIO()->getEntry(), myPrs->GetEntry()) == 0) {
+ vf->eraseCurve(cu);
+ }
+ }
+ }
+ vf->Repaint();
+ //jfa tmp:aViewFrame->unHighlightAll();
+ }
+ }
+ }
+ }
+ }
+ };
+
+ void DeleteActors (VISU::Curve_i* thePrs)
+ {
+ if (!thePrs) return;
+ ProcessVoidEvent(new TDeleteActorsEvent (thePrs));
+
+/* // 1. Find appropriate application (code like in TNewViewManagerEvent::Execute())
+ SALOMEDS::Study_var myStudyDocument = thePrs->GetStudyDocument();
+ SalomeApp_Application* anApp = NULL;
+ CORBA::String_var studyName = myStudyDocument->Name();
+ std::string aStudyName = studyName.in();
+ SUIT_Session* aSession = SUIT_Session::session();
+ QPtrList<SUIT_Application> anApplications = aSession->applications();
+ QPtrListIterator<SUIT_Application> anIter (anApplications);
+ while (SUIT_Application* aSUITApp = anIter.current()) {
+ ++anIter;
+ if (SUIT_Study* aSStudy = aSUITApp->activeStudy()) {
+ if (SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>(aSStudy)) {
+ if (_PTR(Study) aCStudy = aStudy->studyDS()) {
+ if (aStudyName == aCStudy->Name()) {
+ anApp = dynamic_cast<SalomeApp_Application*>(aSUITApp);
+ break;
+ }
+ }
+ }
+ }
+ }
+ if (!anApp)
+ return;
+
+ // 2. Remove corresponding IO from selection
+ SALOMEDS::SObject_var aSObject = thePrs->GetSObject();
+ CORBA::String_var anEntry = aSObject->GetID();
+
+ SalomeApp_SelectionMgr* aSelectionMgr = anApp->selectionMgr();
+ SALOME_ListIO aListIO, aNewListIO;
+ aSelectionMgr->selectedObjects(aListIO);
+
+ for (SALOME_ListIteratorOfListIO it (aListIO); it.More(); it.Next()) {
+ if (it.Value()->hasEntry()) {
+ std::string aCurEntry (it.Value()->getEntry());
+ if (aCurEntry != std::string( anEntry.in() ) ) {
+ aNewListIO.Append(it.Value());
+ }
+ }
+ }
+
+ aSelectionMgr->setSelectedObjects(aNewListIO);
+
+ // 3. Remove Actors
+ ViewManagerList aViewManagerList;
+ anApp->viewManagers(SVTK_Viewer::Type(), aViewManagerList);
+ QPtrListIterator<SUIT_ViewManager> anVMIter (aViewManagerList);
+ for (; anVMIter.current(); ++anVMIter) {
+ SUIT_ViewManager* aViewManager = anVMIter.current();
+ QPtrVector<SUIT_ViewWindow> aViews = aViewManager->getViews();
+ for (int i = 0, iEnd = aViews.size(); i < iEnd; i++) {
+ if (SUIT_ViewWindow* aViewWindow = aViews.at(i)) {
+ if (Plot2d_ViewWindow* vw = dynamic_cast<Plot2d_ViewWindow*>(aViewWindow)) {
+ Plot2d_ViewFrame* vf = vw->getViewFrame();
+ QList<Plot2d_Curve> clist;
+ vf->getCurves(clist);
+ for (int i = 0; i < clist.count(); i++) {
+ if (SPlot2d_Curve* cu = dynamic_cast<SPlot2d_Curve*>(clist.at(i))) {
+ if (cu->hasIO() &&
+ strcmp(cu->getIO()->getEntry(), thePrs->GetEntry()) == 0) {
+ vf->eraseCurve(cu);
+ }
+ }
+ }
+ vf->Repaint();
+ //jfa tmp:aViewFrame->unHighlightAll();
+ }
+ }
+ }
+}*/
+ }
+
+ void DeleteActors (VISU::Prs3d_i* thePrs)
+ {
+ if (!thePrs) return;
+
+ // 1. Find appropriate application (code like in TNewViewManagerEvent::Execute())
+ SALOMEDS::Study_var myStudyDocument = thePrs->GetStudyDocument();
+ SalomeApp_Application* anApp = NULL;
+ CORBA::String_var studyName = myStudyDocument->Name();
+ std::string aStudyName = studyName.in();
+ SUIT_Session* aSession = SUIT_Session::session();
+ QPtrList<SUIT_Application> anApplications = aSession->applications();
+ QPtrListIterator<SUIT_Application> anIter (anApplications);
+ while (SUIT_Application* aSUITApp = anIter.current()) {
+ ++anIter;
+ if (SUIT_Study* aSStudy = aSUITApp->activeStudy()) {
+ if (SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>(aSStudy)) {
+ if (_PTR(Study) aCStudy = aStudy->studyDS()) {
+ if (aStudyName == aCStudy->Name()) {
+ anApp = dynamic_cast<SalomeApp_Application*>(aSUITApp);
+ break;
+ }
+ }
+ }
+ }
+ }
+ if (!anApp)
+ return;
+
+ // 2. Remove corresponding IO from selection
+ SALOMEDS::SObject_var aSObject = thePrs->GetSObject();
+ CORBA::String_var anEntry = aSObject->GetID();
+
+ SalomeApp_SelectionMgr* aSelectionMgr = anApp->selectionMgr();
+ SALOME_ListIO aListIO, aNewListIO;
+ aSelectionMgr->selectedObjects(aListIO);
+
+ for (SALOME_ListIteratorOfListIO it (aListIO); it.More(); it.Next()) {
+ if (it.Value()->hasEntry()) {
+ std::string aCurEntry (it.Value()->getEntry());
+ if (aCurEntry != std::string( anEntry.in() ) ) {
+ aNewListIO.Append(it.Value());
+ }
+ }
+ }
+
+ aSelectionMgr->setSelectedObjects(aNewListIO);
+
+ // 3. Remove Actors
+ ViewManagerList aViewManagerList;
+ anApp->viewManagers(SVTK_Viewer::Type(), aViewManagerList);
+ QPtrListIterator<SUIT_ViewManager> anVMIter (aViewManagerList);
+ for (; anVMIter.current(); ++anVMIter) {
+ SUIT_ViewManager* aViewManager = anVMIter.current();
+ QPtrVector<SUIT_ViewWindow> aViews = aViewManager->getViews();
+ for (int i = 0, iEnd = aViews.size(); i < iEnd; i++) {
+ if (SUIT_ViewWindow* aViewWindow = aViews.at(i)) {
+ if (SVTK_ViewWindow* vw = dynamic_cast<SVTK_ViewWindow*>(aViewWindow)) {
+ VISU_Actor* anActor = NULL;
+ vtkActorCollection *anActColl = vw->getRenderer()->GetActors();
+ anActColl->InitTraversal();
+ vtkActor *aVTKActor = anActColl->GetNextActor();
+ for (; !anActor && aVTKActor; aVTKActor = anActColl->GetNextActor()) {
+ if (VISU_Actor* anVISUActor = dynamic_cast<VISU_Actor*>(aVTKActor)) {
+ if (thePrs == anVISUActor->GetPrs3d()) {
+ anActor = anVISUActor->GetParent();
+ }
+ }
+ }
+ if (anActor) {
+ vw->RemoveActor(anActor);
+ anActor->Delete();
+ }
+ }
+ }
+ }
+ }
+ }
}
void UpdatePlot2d (Plot2d_ViewFrame *theView, int theDisplaying, Curve_i* theCurve);
VISU_Actor* GetActor (VISU::Prs3d_i* thePrs, SVTK_ViewWindow* theViewWindow);
+
+ void DeleteActors (VISU::Prs3d_i* thePrs);
+ void DeleteActors (VISU::Curve_i* thePrs);
}
#endif
theView.SavePicture(aPictureName)
aVISUObjList.append(aPrsObj)
+ if HasValue(thePrsTypeList,VISU.TPLOT3D) :
+ print " Creating Plot3DOnField",
+ aPrsObj = theVisu.Plot3DOnField(theResult,aMeshName,anEntity,
+ aFieldName,aTimeStampId)
+ if aPrsObj is None : print "Error"
+ else : print ",OK"
+ #aPrsObj.SetOrientation(VISU.CutPlanes.ZX,
+ # aPrsObj.GetRotateX(),
+ # aPrsObj.GetRotateY())
+ theView.DisplayOnly(aPrsObj)
+ theView.FitAll()
+ aPictureName = thePictureDir + aMeshNamePic + "_" + anEntityId +
+ "_" + aFieldName + "_" + str(aTimeStampId) +
+ "_TPLOT3D." + thePictureExt
+ aPictureName = re.sub("\s+","_", aPictureName)
+ theView.SavePicture(aPictureName)
+ aVISUObjList.append(aPrsObj)
+
aNumComponent = atoi(aMap["myNumComponent"])
if aNumComponent > 1 :
if HasValue(thePrsTypeList,VISU.TDEFORMEDSHAPE) :