mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2024-12-28 18:30:35 +05:00
Imp: show element position in a mesh information dialog box
This commit is contained in:
parent
2af758c692
commit
1e288edaa1
@ -110,6 +110,14 @@ module SMESH
|
|||||||
double_array params; // [U] on EDGE, [U,V] on FACE, [] on the rest shapes
|
double_array params; // [U] on EDGE, [U,V] on FACE, [] on the rest shapes
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* Element location on a shape
|
||||||
|
*/
|
||||||
|
struct ElementPosition {
|
||||||
|
long shapeID;
|
||||||
|
GEOM::shape_type shapeType;
|
||||||
|
};
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Enumeration for element type, like in SMDS
|
* Enumeration for element type, like in SMDS
|
||||||
*/
|
*/
|
||||||
@ -836,6 +844,11 @@ module SMESH
|
|||||||
*/
|
*/
|
||||||
NodePosition GetNodePosition(in long NodeID);
|
NodePosition GetNodePosition(in long NodeID);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Return position of an element on shape
|
||||||
|
*/
|
||||||
|
ElementPosition GetElementPosition(in long ElemID);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* If given element is node returns IDs of shape from position
|
* If given element is node returns IDs of shape from position
|
||||||
* If there is not node for given ID - returns -1
|
* If there is not node for given ID - returns -1
|
||||||
|
@ -34,6 +34,7 @@
|
|||||||
#include "SMDS_BallElement.hxx"
|
#include "SMDS_BallElement.hxx"
|
||||||
#include "SMDS_EdgePosition.hxx"
|
#include "SMDS_EdgePosition.hxx"
|
||||||
#include "SMDS_FacePosition.hxx"
|
#include "SMDS_FacePosition.hxx"
|
||||||
|
#include "SMESHDS_Mesh.hxx"
|
||||||
#include "SMESH_ControlsDef.hxx"
|
#include "SMESH_ControlsDef.hxx"
|
||||||
|
|
||||||
#include <LightApp_SelectionMgr.h>
|
#include <LightApp_SelectionMgr.h>
|
||||||
@ -1102,6 +1103,39 @@ void SMESHGUI_SimpleElemInfo::information( const QList<long>& ids )
|
|||||||
else {
|
else {
|
||||||
myInfo->append( QString( "<b>%1</b>" ).arg( SMESHGUI_ElemInfo::tr( "FREE_NODE" ) ).arg( id ) );
|
myInfo->append( QString( "<b>%1</b>" ).arg( SMESHGUI_ElemInfo::tr( "FREE_NODE" ) ).arg( id ) );
|
||||||
}
|
}
|
||||||
|
// node position
|
||||||
|
int shapeID = node->getshapeId();
|
||||||
|
if ( shapeID > 0 )
|
||||||
|
{
|
||||||
|
SMDS_PositionPtr pos = node->GetPosition();
|
||||||
|
SMDS_TypeOfPosition posType = pos->GetTypeOfPosition();
|
||||||
|
QString shapeType;
|
||||||
|
double u,v;
|
||||||
|
switch ( posType ) {
|
||||||
|
case SMDS_TOP_EDGE: shapeType = SMESHGUI_ElemInfo::tr( "GEOM_EDGE" );
|
||||||
|
u = static_cast<SMDS_EdgePosition*>( pos )->GetUParameter();
|
||||||
|
break;
|
||||||
|
case SMDS_TOP_FACE: shapeType = SMESHGUI_ElemInfo::tr( "GEOM_FACE" );
|
||||||
|
u = static_cast<SMDS_FacePosition*>( pos )->GetUParameter();
|
||||||
|
v = static_cast<SMDS_FacePosition*>( pos )->GetVParameter();
|
||||||
|
break;
|
||||||
|
case SMDS_TOP_VERTEX: shapeType = SMESHGUI_ElemInfo::tr( "GEOM_VERTEX" );
|
||||||
|
break;
|
||||||
|
default: shapeType = SMESHGUI_ElemInfo::tr( "GEOM_SOLID" );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
// separator
|
||||||
|
myInfo->append( "" );
|
||||||
|
myInfo->append( QString( "<b>%1: #%2</b>" ).arg( SMESHGUI_ElemInfo::tr( "POSITION" ) ).arg( shapeID ) );
|
||||||
|
if ( posType == SMDS_TOP_EDGE || posType == SMDS_TOP_FACE ) {
|
||||||
|
myInfo->append( QString( "- <b>%1: #%2</b>" ).arg( SMESHGUI_ElemInfo::tr( "U_POSITION" ) ).
|
||||||
|
arg( QString::number( u, precision > 0 ? 'f' : 'g', qAbs( precision )) ) );
|
||||||
|
if ( posType == SMDS_TOP_FACE ) {
|
||||||
|
myInfo->append( QString( "- <b>%1: #%2</b>" ).arg( SMESHGUI_ElemInfo::tr( "V_POSITION" ) ).
|
||||||
|
arg( QString::number( v, precision > 0 ? 'f' : 'g', qAbs( precision )) ) );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
//
|
//
|
||||||
@ -1275,24 +1309,27 @@ void SMESHGUI_SimpleElemInfo::information( const QList<long>& ids )
|
|||||||
afunctor->SetMesh( actor()->GetObject()->GetMesh() );
|
afunctor->SetMesh( actor()->GetObject()->GetMesh() );
|
||||||
myInfo->append( QString( "- <b>%1:</b> %2" ).arg( tr( "MAX_ELEMENT_LENGTH_3D" ) ).arg( afunctor->GetValue( id ) ) );
|
myInfo->append( QString( "- <b>%1:</b> %2" ).arg( tr( "MAX_ELEMENT_LENGTH_3D" ) ).arg( afunctor->GetValue( id ) ) );
|
||||||
}
|
}
|
||||||
/*
|
// position (only in collocate mode)
|
||||||
if( e->GetType() >= SMDSAbs_Edge && e->GetType() <= SMDSAbs_Volume ) {
|
if ( e->GetType() >= SMDSAbs_Edge && e->GetType() <= SMDSAbs_Volume ) {
|
||||||
// separator
|
SMESHDS_Mesh* aMesh = dynamic_cast<SMESHDS_Mesh*>( actor()->GetObject()->GetMesh() );
|
||||||
myInfo->append( "" );
|
int shapeID = e->getshapeId();
|
||||||
//shapeID
|
if ( aMesh && shapeID > 0 ) {
|
||||||
int shapeID = e->getshapeId();
|
const TopoDS_Shape& aShape = aMesh->IndexToShape( shapeID );
|
||||||
if ( shapeID > 0 ) {
|
if ( !aShape.IsNull() ) {
|
||||||
QString shapeType;
|
myInfo->append( "" ); // separator
|
||||||
switch ( actor()->GetObject()->GetMesh()->FindElement( shapeID )->GetType() ) {
|
QString shapeType;
|
||||||
case SMDS_TOP_EDGE: shapeType = SMESHGUI_ElemInfo::tr( "GEOM_EDGE" ); break;
|
switch ( aShape.ShapeType() ) {
|
||||||
case SMDS_TOP_FACE: shapeType = SMESHGUI_ElemInfo::tr( "GEOM_FACE" ); break;
|
case TopAbs_EDGE: shapeType = SMESHGUI_ElemInfo::tr( "GEOM_EDGE" ); break;
|
||||||
case SMDS_TOP_VERTEX: shapeType = SMESHGUI_ElemInfo::tr( "GEOM_VERTEX" ); break;
|
case TopAbs_FACE: shapeType = SMESHGUI_ElemInfo::tr( "GEOM_FACE" ); break;
|
||||||
default: shapeType = SMESHGUI_ElemInfo::tr( "GEOM_SOLID" );
|
case TopAbs_VERTEX: shapeType = SMESHGUI_ElemInfo::tr( "GEOM_VERTEX" ); break;
|
||||||
}
|
case TopAbs_SOLID: shapeType = SMESHGUI_ElemInfo::tr( "GEOM_SOLID" ); break;
|
||||||
myInfo->append( QString( "<b>%1:</b> %2 #%3" ).arg( SMESHGUI_ElemInfo::tr( "POSITION" ) ).arg( shapeType ).arg( shapeID ) );
|
case TopAbs_SHELL: shapeType = SMESHGUI_ElemInfo::tr( "GEOM_SHELL" ); break;
|
||||||
}
|
default: shapeType = SMESHGUI_ElemInfo::tr( "GEOM_SHAPE" ); break;
|
||||||
}
|
}
|
||||||
*/
|
myInfo->append( QString( "<b>%1:</b> %2 #%3" ).arg( SMESHGUI_ElemInfo::tr( "POSITION" ) ).arg( shapeType ).arg( shapeID ) );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// separator
|
// separator
|
||||||
if ( ids.count() > 1 ) {
|
if ( ids.count() > 1 ) {
|
||||||
@ -1480,7 +1517,7 @@ void SMESHGUI_TreeElemInfo::information( const QList<long>& ids )
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
QTreeWidgetItem* posItem = createItem( nodeItem, Bold );
|
QTreeWidgetItem* posItem = createItem( nodeItem, Bold );
|
||||||
posItem->setText( 0, SMESHGUI_ElemInfo::tr("NODE_POSITION") );
|
posItem->setText( 0, SMESHGUI_ElemInfo::tr("POSITION") );
|
||||||
posItem->setText( 1, (shapeType + " #%1").arg( shapeID ));
|
posItem->setText( 1, (shapeType + " #%1").arg( shapeID ));
|
||||||
if ( posType == SMDS_TOP_EDGE || posType == SMDS_TOP_FACE ) {
|
if ( posType == SMDS_TOP_EDGE || posType == SMDS_TOP_FACE ) {
|
||||||
QTreeWidgetItem* uItem = createItem( posItem );
|
QTreeWidgetItem* uItem = createItem( posItem );
|
||||||
@ -1734,24 +1771,28 @@ void SMESHGUI_TreeElemInfo::information( const QList<long>& ids )
|
|||||||
diam3Item->setText( 0, tr( "MAX_ELEMENT_LENGTH_3D" ) );
|
diam3Item->setText( 0, tr( "MAX_ELEMENT_LENGTH_3D" ) );
|
||||||
diam3Item->setText( 1, QString( "%1" ).arg( afunctor->GetValue( id ) ) );
|
diam3Item->setText( 1, QString( "%1" ).arg( afunctor->GetValue( id ) ) );
|
||||||
}
|
}
|
||||||
/*
|
// position (only in collocate mode)
|
||||||
if( e->GetType() >= SMDSAbs_Edge && e->GetType() <= SMDSAbs_Volume ) {
|
if ( e->GetType() >= SMDSAbs_Edge && e->GetType() <= SMDSAbs_Volume ) {
|
||||||
//shapeID
|
SMESHDS_Mesh* aMesh = dynamic_cast<SMESHDS_Mesh*>( actor()->GetObject()->GetMesh() );
|
||||||
int shapeID = e->getshapeId();
|
int shapeID = e->getshapeId();
|
||||||
if ( shapeID > 0 ) {
|
if ( aMesh && shapeID > 0 ) {
|
||||||
QTreeWidgetItem* shItem = createItem( elemItem, Bold );
|
const TopoDS_Shape& aShape = aMesh->IndexToShape( shapeID );
|
||||||
QString shapeType;
|
if ( !aShape.IsNull() ) {
|
||||||
switch ( actor()->GetObject()->GetMesh()->FindElement( shapeID )->GetType() ) {
|
QTreeWidgetItem* shItem = createItem( elemItem, Bold );
|
||||||
case SMDS_TOP_EDGE: shapeType = SMESHGUI_ElemInfo::tr( "GEOM_EDGE" ); break;
|
QString shapeType;
|
||||||
case SMDS_TOP_FACE: shapeType = SMESHGUI_ElemInfo::tr( "GEOM_FACE" ); break;
|
switch ( aShape.ShapeType() ) {
|
||||||
case SMDS_TOP_VERTEX: shapeType = SMESHGUI_ElemInfo::tr( "GEOM_VERTEX" ); break;
|
case TopAbs_EDGE: shapeType = SMESHGUI_ElemInfo::tr( "GEOM_EDGE" ); break;
|
||||||
default: shapeType = SMESHGUI_ElemInfo::tr( "GEOM_SOLID" );
|
case TopAbs_FACE: shapeType = SMESHGUI_ElemInfo::tr( "GEOM_FACE" ); break;
|
||||||
}
|
case TopAbs_VERTEX: shapeType = SMESHGUI_ElemInfo::tr( "GEOM_VERTEX" ); break;
|
||||||
shItem->setText( 0, SMESHGUI_ElemInfo::tr( "POSITION" ) );
|
case TopAbs_SOLID: shapeType = SMESHGUI_ElemInfo::tr( "GEOM_SOLID" ); break;
|
||||||
shItem->setText( 1, QString( "%1 #%2" ).arg(shapeType).arg( shapeID ) );
|
case TopAbs_SHELL: shapeType = SMESHGUI_ElemInfo::tr( "GEOM_SHELL" ); break;
|
||||||
}
|
default: shapeType = SMESHGUI_ElemInfo::tr( "GEOM_SHAPE" ); break;
|
||||||
}
|
}
|
||||||
*/
|
shItem->setText( 0, SMESHGUI_ElemInfo::tr( "POSITION" ) );
|
||||||
|
shItem->setText( 1, QString( "%1 #%2" ).arg( shapeType ).arg( shapeID ) );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6755,7 +6755,15 @@ as they are of improper type:
|
|||||||
<translation>Solid</translation>
|
<translation>Solid</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>NODE_POSITION</source>
|
<source>GEOM_SHELL</source>
|
||||||
|
<translation>Shell</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>GEOM_SHAPE</source>
|
||||||
|
<translation>Shape</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>POSITION</source>
|
||||||
<translation>Position</translation>
|
<translation>Position</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
|
@ -6626,7 +6626,15 @@ en raison de leurs types incompatibles:
|
|||||||
<translation>Solide</translation>
|
<translation>Solide</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>NODE_POSITION</source>
|
<source>GEOM_SHELL</source>
|
||||||
|
<translation>Coque</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>GEOM_SHAPE</source>
|
||||||
|
<translation>Forme</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>POSITION</source>
|
||||||
<translation>Position</translation>
|
<translation>Position</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
|
@ -3709,6 +3709,46 @@ SMESH::NodePosition* SMESH_Mesh_i::GetNodePosition(CORBA::Long NodeID)
|
|||||||
return aNodePosition;
|
return aNodePosition;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SMESH::ElementPosition SMESH_Mesh_i::GetElementPosition(CORBA::Long ElemID)
|
||||||
|
{
|
||||||
|
if ( _preMeshInfo )
|
||||||
|
_preMeshInfo->FullLoadFromFile();
|
||||||
|
|
||||||
|
SMESH::ElementPosition anElementPosition;
|
||||||
|
anElementPosition.shapeID = 0;
|
||||||
|
anElementPosition.shapeType = GEOM::SHAPE;
|
||||||
|
|
||||||
|
SMESHDS_Mesh* mesh = _impl->GetMeshDS();
|
||||||
|
if ( !mesh ) return anElementPosition;
|
||||||
|
|
||||||
|
if ( const SMDS_MeshElement* anElem = mesh->FindElement( ElemID ) )
|
||||||
|
{
|
||||||
|
anElementPosition.shapeID = anElem->getshapeId();
|
||||||
|
const TopoDS_Shape& aSp = mesh->IndexToShape( anElem->getshapeId() );
|
||||||
|
if ( !aSp.IsNull() ) {
|
||||||
|
switch ( aSp.ShapeType() ) {
|
||||||
|
case TopAbs_EDGE:
|
||||||
|
anElementPosition.shapeType = GEOM::EDGE;
|
||||||
|
break;
|
||||||
|
case TopAbs_FACE:
|
||||||
|
anElementPosition.shapeType = GEOM::FACE;
|
||||||
|
break;
|
||||||
|
case TopAbs_VERTEX:
|
||||||
|
anElementPosition.shapeType = GEOM::VERTEX;
|
||||||
|
break;
|
||||||
|
case TopAbs_SOLID:
|
||||||
|
anElementPosition.shapeType = GEOM::SOLID;
|
||||||
|
break;
|
||||||
|
case TopAbs_SHELL:
|
||||||
|
anElementPosition.shapeType = GEOM::SHELL;
|
||||||
|
break;
|
||||||
|
default:;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return anElementPosition;
|
||||||
|
}
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
/*!
|
/*!
|
||||||
* If given element is node returns IDs of shape from position
|
* If given element is node returns IDs of shape from position
|
||||||
|
@ -459,6 +459,11 @@ public:
|
|||||||
*/
|
*/
|
||||||
SMESH::NodePosition* GetNodePosition(CORBA::Long NodeID);
|
SMESH::NodePosition* GetNodePosition(CORBA::Long NodeID);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Return position of an element on shape
|
||||||
|
*/
|
||||||
|
SMESH::ElementPosition GetElementPosition(CORBA::Long ElemID);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* If given element is node returns IDs of shape from position
|
* If given element is node returns IDs of shape from position
|
||||||
* If there is not node for given ID - returns -1
|
* If there is not node for given ID - returns -1
|
||||||
|
@ -2118,6 +2118,12 @@ class Mesh:
|
|||||||
def GetNodePosition(self,NodeID):
|
def GetNodePosition(self,NodeID):
|
||||||
return self.mesh.GetNodePosition(NodeID)
|
return self.mesh.GetNodePosition(NodeID)
|
||||||
|
|
||||||
|
## @brief Returns the position of an element on the shape
|
||||||
|
# @return SMESH::ElementPosition
|
||||||
|
# @ingroup l1_meshinfo
|
||||||
|
def GetElementPosition(self,ElemID):
|
||||||
|
return self.mesh.GetElementPosition(ElemID)
|
||||||
|
|
||||||
## If the given element is a node, returns the ID of shape
|
## If the given element is a node, returns the ID of shape
|
||||||
# \n If there is no node for the given ID - returns -1
|
# \n If there is no node for the given ID - returns -1
|
||||||
# @return an integer value
|
# @return an integer value
|
||||||
|
Loading…
Reference in New Issue
Block a user