Version: 9.16.0
SMESH::SelectionProxy Class Reference

Provide operations over the selected object. More...

#include <SMESHGUI_SelectionProxy.h>

Public Types

enum  Type {
  Unknown , Mesh , Submesh , Group ,
  GroupStd , GroupGeom , GroupFilter
}
 

Public Member Functions

 SelectionProxy ()
 Default constructor. More...
 
 SelectionProxy (const Handle(SALOME_InteractiveObject)&)
 Constructor. More...
 
 SelectionProxy (SMESH::SMESH_IDSource_ptr)
 Constructor. More...
 
 SelectionProxy (const SelectionProxy &)
 Copy constructor. More...
 
SelectionProxyoperator= (const SelectionProxy &)
 Assignment operator. More...
 
bool operator== (const SelectionProxy &)
 Equality comparison operator. More...
 
void refresh ()
 Re-initialize proxy. More...
 
bool isNull () const
 Check if proxy is null. More...
 
 operator bool () const
 Boolean conversion operator. More...
 
SMESH::SMESH_IDSource_ptr object () const
 
const Handle (SALOME_InteractiveObject) &io() const
 
SMESH_Actoractor () const
 
bool isValid () const
 
void load ()
 
QString name () const
 Get name. More...
 
Type type () const
 Get type. More...
 
MeshInfo meshInfo () const
 Get mesh information. More...
 
SelectionProxy mesh () const
 Get parent mesh. More...
 
bool hasShapeToMesh () const
 Check if parent mesh has shape to mesh. More...
 
GEOM::GEOM_Object_ptr shape () const
 Get referenced GEOM object. More...
 
QString shapeName () const
 Get name of referenced GEOM object. More...
 
int shapeType () const
 Get type of referenced GEOM object. More...
 
bool isMeshLoaded () const
 Check if mesh has been loaded from study file. More...
 
bool hasNode (int)
 Check if node with given ID is present in the mesh. More...
 
bool nodeCoordinates (int, XYZ &)
 Get node coordinates. More...
 
bool nodeConnectivity (int, Connectivity &)
 Get node connectivity. More...
 
bool nodePosition (int, Position &)
 Get node position on a shape. More...
 
QList< SelectionProxynodeGroups (int) const
 Get groups given node belongs to. More...
 
bool hasElement (int)
 Check if element with given ID is present in the mesh. More...
 
SMESH::ElementType elementType (int) const
 Get type of given mesh element. More...
 
int elementEntityType (int) const
 Get entity type of given mesh element. More...
 
bool elementConnectivity (SMESH::smIdType, Connectivity &)
 Get element connectivity. More...
 
bool perFaceConnectivity (int, Connectivity &, int &)
 Get volume element connectivity. More...
 
bool elementPosition (int, Position &)
 Get element position on a shape. More...
 
bool elementGravityCenter (int, XYZ &)
 Get gravity center of given element. More...
 
bool elementNormal (int, XYZ &)
 Get normal vector to given element (face). More...
 
bool elementControl (int, int, double, double &) const
 Get quality control's value for given element. More...
 
QList< SelectionProxyelementGroups (int) const
 Get groups given element belongs to. More...
 
MedInfo medFileInfo () const
 Get MED file information. More...
 
QList< SelectionProxysubmeshes () const
 Get child sub-meshes. More...
 
QList< SelectionProxygroups () const
 Get child groups. More...
 
SMESH::ElementType groupElementType () const
 Get element type (for group). More...
 
QColor color () const
 Get color (for group). More...
 
SMESH::smIdType size (bool=false) const
 Get size (for group). More...
 
SMESH::smIdType nbNodes (bool=false) const
 Get number of underlying nodes (for group of elements). More...
 
QSet< uint > ids () const
 Get list of nodes / elements IDs for the mesh group. More...
 

Private Member Functions

 Handle (SALOME_InteractiveObject) myIO
 
void init ()
 Perform internal initialization. More...
 

Private Attributes

SMESH::SMESH_IDSource_var myObject
 
SMESH_ActormyActor
 
bool myDirty
 

Detailed Description

Provide operations over the selected object.

The selection proxy class is aimed to use in dialogs to access mesh object data either from actor or directly from CORBA reference, depending on what of them is accessible. This is useful in situations when some information is needed, but an actor was not created yet.

Selection proxy can be constructed in two ways:

  • From interactive object: this performs full proxy initialization including pick-up of an actor from the current viewer if it exists.
  • From mesh source object (CORBA reference); for performance reasons in this case full initialization is not immediately done and performed only when needed.

Member Enumeration Documentation

◆ Type

Enumerator
Unknown 
Mesh 
Submesh 
Group 
GroupStd 
GroupGeom 
GroupFilter 

Constructor & Destructor Documentation

◆ SelectionProxy() [1/4]

SMESH::SelectionProxy::SelectionProxy ( )

Default constructor.

Creates null proxy.

◆ SelectionProxy() [2/4]

SMESH::SelectionProxy::SelectionProxy ( const Handle(SALOME_InteractiveObject)&  io)

Constructor.

Parameters
ioInteractive object.

References init(), and myObject.

◆ SelectionProxy() [3/4]

SMESH::SelectionProxy::SelectionProxy ( SMESH::SMESH_IDSource_ptr  object)

Constructor.

Parameters
objectMesh source.

References myObject.

◆ SelectionProxy() [4/4]

SMESH::SelectionProxy::SelectionProxy ( const SelectionProxy other)

Copy constructor.

Parameters
otherProxy being copied.

References myActor, myDirty, and myObject.

Member Function Documentation

◆ actor()

SMESH_Actor * SMESH::SelectionProxy::actor ( ) const

◆ color()

QColor SMESH::SelectionProxy::color ( ) const

Get color (for group).

For other mesh objects result is undefined.

Returns
Group's color.

Referenced by SMESHGUI_AddInfo::groupInfo(), and SMESHGUI_ElemInfo::writeInfo().

◆ elementConnectivity()

bool SMESH::SelectionProxy::elementConnectivity ( SMESH::smIdType  id,
Connectivity connectivity 
)

Get element connectivity.

Parameters
idMesh element ID.
connectivityReturn element connectivity.
Returns
true if result is valid; false otherwise.

References SMDS_Mesh::FindElement(), SMDS_MeshElement::GetID(), SMDS_MeshElement::GetMesh(), SMDS_MeshElement::nodeIterator(), and SMDSAbs_Node.

Referenced by SMESHGUI_ElemInfo::writeInfo().

◆ elementControl()

bool SMESH::SelectionProxy::elementControl ( int  id,
int  control,
double  precision,
double &  value 
) const

Get quality control's value for given element.

Parameters
idMesh element ID.
controlQuality control type.
precisionPrecision for control's value.
valueReturned quality control's value.
Returns
true if result is valid; false otherwise.

References SMDS_Mesh::FindElement(), SMESH::FT_Area, SMESH::FT_AspectRatio, SMESH::FT_AspectRatio3D, SMESH::FT_BallDiameter, SMESH::FT_Length, SMESH::FT_Length2D, SMESH::FT_Length3D, SMESH::FT_MaxElementLength2D, SMESH::FT_MaxElementLength3D, SMESH::FT_MinimumAngle, SMESH::FT_ScaledJacobian, SMESH::FT_Skew, SMESH::FT_Taper, SMESH::FT_Volume3D, SMESH::FT_Warping, SMESH::FT_Warping3D, SMDS_MeshElement::GetMesh(), SMESHGUI::GetSMESHGen(), and SMDS_MeshElement::GetType().

◆ elementEntityType()

int SMESH::SelectionProxy::elementEntityType ( int  id) const

Get entity type of given mesh element.

Parameters
idMesh element ID.
Returns
Entity type.

References SMESH::Entity_Last, SMDS_Mesh::FindElement(), SMDS_MeshElement::GetEntityType(), and SMDS_MeshElement::GetMesh().

Referenced by SMESHGUI_ElemInfo::writeInfo().

◆ elementGravityCenter()

bool SMESH::SelectionProxy::elementGravityCenter ( int  id,
SMESH::XYZ xyz 
)

Get gravity center of given element.

Parameters
idMesh element ID.
xyzReturned gravity center.
Returns
true if result is valid; false otherwise.

References SMESH::XYZ::add(), SMESH::XYZ::divide(), SMDS_Mesh::FindElement(), SMDS_MeshElement::GetMesh(), SMDS_MeshElement::NbNodes(), SMDS_MeshElement::nodesIterator(), SMDS_MeshNode::X(), SMDS_MeshNode::Y(), and SMDS_MeshNode::Z().

Referenced by SMESHGUI_MeshInfoDlg::idChanged(), and SMESHGUI_ElemInfo::writeInfo().

◆ elementGroups()

QList< SMESH::SelectionProxy > SMESH::SelectionProxy::elementGroups ( int  id) const

Get groups given element belongs to.

Parameters
idMesh element ID.
Returns
List of groups containing element.

References SMESH::NODE.

Referenced by SMESHGUI_ElemInfo::writeInfo().

◆ elementNormal()

bool SMESH::SelectionProxy::elementNormal ( int  id,
SMESH::XYZ xyz 
)

Get normal vector to given element (face).

Parameters
idMesh element ID.
xyzReturned normal vector.
Returns
true if result is valid; false otherwise.

References SMDS_Mesh::FindElement(), SMDS_MeshElement::GetMesh(), SMESH::getNormale(), SMDS_MeshElement::GetType(), and SMDSAbs_Face.

Referenced by SMESHGUI_ElemInfo::writeInfo().

◆ elementPosition()

bool SMESH::SelectionProxy::elementPosition ( int  id,
Position position 
)

Get element position on a shape.

Parameters
idMesh element ID.
positionReturned element position.
Returns
true if result is valid; false otherwise.

References SMESH::Position::setShapeId(), and SMESH::Position::setShapeType().

Referenced by SMESHGUI_ElemInfo::writeInfo().

◆ elementType()

SMESH::ElementType SMESH::SelectionProxy::elementType ( int  id) const

Get type of given mesh element.

Parameters
idMesh element ID.
Returns
Element type.

References SMESH::ALL, SMDS_Mesh::FindElement(), SMDS_MeshElement::GetMesh(), and SMDS_MeshElement::GetType().

Referenced by SMESHGUI_ElemInfo::writeInfo().

◆ groupElementType()

SMESH::ElementType SMESH::SelectionProxy::groupElementType ( ) const

Get element type (for group).

For other mesh objects result is undefined.

Returns
Group's element type.

References SMESH::ALL.

Referenced by SMESHGUI_AddInfo::groupInfo(), SMESHGUI_AddInfo::showGroups(), SMESHGUI_BaseInfo::showInfo(), and SMESHGUI_ElemInfo::showInfo().

◆ groups()

QList< SMESH::SelectionProxy > SMESH::SelectionProxy::groups ( ) const

Get child groups.

Returns
List of groups for mesh object; empty list for other types.

Referenced by SMESHGUI_AddInfo::meshInfo(), and GroupCombo::setSource().

◆ Handle() [1/2]

const SMESH::SelectionProxy::Handle ( SALOME_InteractiveObject  ) const &

◆ Handle() [2/2]

SMESH::SelectionProxy::Handle ( SALOME_InteractiveObject  )
private

◆ hasElement()

bool SMESH::SelectionProxy::hasElement ( int  id)

Check if element with given ID is present in the mesh.

Parameters
idMesh element ID.
Returns
true if mesh contains element; false otherwise.

References SMDS_Mesh::FindElement(), and SMDS_MeshElement::GetMesh().

Referenced by SMESHGUI_MeshInfoDlg::idChanged().

◆ hasNode()

bool SMESH::SelectionProxy::hasNode ( int  id)

Check if node with given ID is present in the mesh.

Parameters
idMesh node ID.
Returns
true if mesh contains node; false otherwise.

References SMDS_Mesh::FindNode(), and SMDS_MeshElement::GetMesh().

Referenced by SMESHGUI_MeshInfoDlg::idChanged().

◆ hasShapeToMesh()

bool SMESH::SelectionProxy::hasShapeToMesh ( ) const

Check if parent mesh has shape to mesh.

Returns
true if Parent mesh is built on a shape; false otherwise.
Note
For group or submesh, this method checks that parent mesh has a shape.

◆ ids()

QSet< uint > SMESH::SelectionProxy::ids ( ) const

Get list of nodes / elements IDs for the mesh group.

Returns
List of IDs for group object; empty list for other types.

Referenced by SMESHGUI_ElemInfo::showInfo().

◆ init()

void SMESH::SelectionProxy::init ( )
private

Perform internal initialization.

References SMESH::_PTR(), and SMESH::FindActorByEntry().

Referenced by SelectionProxy().

◆ isMeshLoaded()

bool SMESH::SelectionProxy::isMeshLoaded ( ) const

Check if mesh has been loaded from study file.

Returns
true if mesh was loaded; false otherwise.

Referenced by SMESHGUI_AddInfo::groupInfo().

◆ isNull()

bool SMESH::SelectionProxy::isNull ( ) const

Check if proxy is null.

Returns
true if proxy is null; false otherwise.

◆ isValid()

bool SMESH::SelectionProxy::isValid ( ) const

◆ load()

void SMESH::SelectionProxy::load ( )

◆ medFileInfo()

SMESH::MedInfo SMESH::SelectionProxy::medFileInfo ( ) const

Get MED file information.

Returns
MED file information.

The result contains valid data only if proxy refers to mesh object which has been imported from the MED file.

References SMESH::MedInfo::setFileName(), SMESH::MedInfo::setSize(), and SMESH::MedInfo::setVersion().

Referenced by SMESHGUI_AddInfo::meshInfo().

◆ mesh()

SMESH::SelectionProxy SMESH::SelectionProxy::mesh ( ) const

Get parent mesh.

Returns
Proxy object that stores parent mesh object.
Note
For proxy that stores a mesh, returns its copy.

Referenced by SMESHGUI_AddInfo::groupInfo(), and SMESHGUI_AddInfo::subMeshInfo().

◆ meshInfo()

SMESH::MeshInfo SMESH::SelectionProxy::meshInfo ( ) const

Get mesh information.

Returns
Statistics on stored mesh object.

References SMESH::MeshInfo::addInfo(), SMESH::Entity_Last, and SMESH::Entity_Node.

Referenced by SMESHGUI_BaseInfo::showInfo().

◆ name()

◆ nbNodes()

SMESH::smIdType SMESH::SelectionProxy::nbNodes ( bool  autoCompute = false) const

Get number of underlying nodes (for group of elements).

For other mesh objects result is undefined.

Parameters
autoComputeCompute size if it is unavailable. Defaults to false.
Returns
Number of nodes contained in group.

References SMESHGUI::resourceMgr().

Referenced by InfoComputor::compute(), and SMESHGUI_AddInfo::groupInfo().

◆ nodeConnectivity()

bool SMESH::SelectionProxy::nodeConnectivity ( int  id,
SMESH::Connectivity connectivity 
)

Get node connectivity.

Parameters
idMesh node ID.
connectivityReturned node connectivity.
Returns
true if result is valid; false otherwise.

References SMESH::ALL, SMDS_Mesh::FindNode(), SMDS_MeshElement::GetID(), SMDS_MeshNode::GetInverseElementIterator(), SMDS_MeshElement::GetMesh(), and SMDS_MeshElement::GetType().

Referenced by SMESHGUI_ElemInfo::writeInfo().

◆ nodeCoordinates()

bool SMESH::SelectionProxy::nodeCoordinates ( int  id,
SMESH::XYZ xyz 
)

Get node coordinates.

Parameters
idMesh node ID.
xyzReturned node coordinates.
Returns
true if result is valid; false otherwise.

References SMDS_Mesh::FindNode(), SMDS_MeshElement::GetMesh(), SMDS_MeshNode::X(), SMDS_MeshNode::Y(), and SMDS_MeshNode::Z().

Referenced by SMESHGUI_ElemInfo::writeInfo().

◆ nodeGroups()

QList< SMESH::SelectionProxy > SMESH::SelectionProxy::nodeGroups ( int  id) const

Get groups given node belongs to.

Parameters
idMesh node ID.
Returns
List of groups containing given node.

References SMESH::NODE.

Referenced by SMESHGUI_ElemInfo::writeInfo().

◆ nodePosition()

bool SMESH::SelectionProxy::nodePosition ( int  id,
Position position 
)

Get node position on a shape.

Parameters
idMesh node ID.
positionReturned node position.
Returns
true if result is valid; false otherwise.

References EDGE, FACE, SMESH::Position::setShapeId(), SMESH::Position::setShapeType(), SMESH::Position::setU(), and SMESH::Position::setV().

Referenced by SMESHGUI_ElemInfo::writeInfo().

◆ object()

◆ operator bool()

SMESH::SelectionProxy::operator bool ( ) const

Boolean conversion operator.

Returns
true if proxy is not null; false otherwise.

◆ operator=()

SMESH::SelectionProxy & SMESH::SelectionProxy::operator= ( const SelectionProxy other)

Assignment operator.

Parameters
otherProxy being copied.

References myActor, myDirty, and myObject.

◆ operator==()

bool SMESH::SelectionProxy::operator== ( const SelectionProxy other)

Equality comparison operator.

Parameters
otherProxy to compare with.
Returns
true if two proxies are equal; false otherwise.

References myObject.

◆ perFaceConnectivity()

bool SMESH::SelectionProxy::perFaceConnectivity ( int  id,
Connectivity connectivity,
int &  nbNodes 
)

Get volume element connectivity.

Parameters
idMesh element ID.
connectivityReturn nodal connectivity of each facet numbered from 1
nbNodesReturn number of unique nodes.
Returns
true if result is valid; false otherwise.

References SMDS_Mesh::FindElement(), SMDS_VolumeTool::GetFaceNodes(), SMDS_MeshElement::GetID(), SMDS_MeshElement::GetMesh(), SMDS_VolumeTool::NbFaceNodes(), SMDS_VolumeTool::NbFaces(), and SMDS_VolumeTool::Set().

Referenced by SMESHGUI_ElemInfo::writeInfo().

◆ refresh()

void SMESH::SelectionProxy::refresh ( )

Re-initialize proxy.

Referenced by SMESHGUI_ElemInfo::showInfo().

◆ shape()

GEOM::GEOM_Object_ptr SMESH::SelectionProxy::shape ( ) const

Get referenced GEOM object.

Returns
GEOM object referenced by selection proxy.

The result contains valid pointer only if proxy refers to mesh, sub-mesh or group created on a geometry.

◆ shapeName()

QString SMESH::SelectionProxy::shapeName ( ) const

Get name of referenced GEOM object.

Returns
Name of GEOM object referenced by selection proxy.

The result contains non-empty name only if proxy refers to mesh, sub-mesh or group created on a geometry, and if that geometry has valid name.

References SMESH::_PTR().

Referenced by SMESHGUI_AddInfo::groupInfo(), SMESHGUI_AddInfo::meshInfo(), SMESHGUI_AddInfo::subMeshInfo(), and SMESHGUI_ElemInfo::writeInfo().

◆ shapeType()

int SMESH::SelectionProxy::shapeType ( ) const

Get type of referenced GEOM object.

Returns
Type of GEOM object referenced by selection proxy.

The result contains valid type only if proxy refers to mesh, sub-mesh or group created on a geometry.

Referenced by SMESHGUI_AddInfo::showSubMeshes().

◆ size()

SMESH::smIdType SMESH::SelectionProxy::size ( bool  autoCompute = false) const

Get size (for group).

For other mesh objects result is undefined.

Parameters
autoComputeCompute size if it is unavailable. Defaults to false.
Returns
Group's size.

Referenced by InfoComputor::compute(), SMESHGUI_AddInfo::groupInfo(), and SMESHGUI_ElemInfo::writeInfo().

◆ submeshes()

QList< SMESH::SelectionProxy > SMESH::SelectionProxy::submeshes ( ) const

Get child sub-meshes.

Returns
List of sub-meshes for mesh object; empty list for other types.

Referenced by SMESHGUI_AddInfo::meshInfo().

◆ type()

Field Documentation

◆ myActor

SMESH_Actor* SMESH::SelectionProxy::myActor
private

Referenced by operator=(), and SelectionProxy().

◆ myDirty

bool SMESH::SelectionProxy::myDirty
private

Referenced by operator=(), and SelectionProxy().

◆ myObject

SMESH::SMESH_IDSource_var SMESH::SelectionProxy::myObject
private