0021459: EDF 1495 SMESH: Manipulation of discrete elements with attributes

This commit is contained in:
eap 2012-07-19 13:26:17 +00:00
parent 392aa8c6a1
commit 1d17e561d7
27 changed files with 1191 additions and 449 deletions

View File

@ -436,25 +436,98 @@
}
}
}
// Warn the user about presence of not supported elements
QString format;
std::vector< SMESH::EntityType > notSupportedElemTypes, presentNotSupported;
if ( isDAT )
{
format = "DAT";
notSupportedElemTypes.push_back( SMESH::Entity_Quad_Quadrangle );
notSupportedElemTypes.push_back( SMESH::Entity_BiQuad_Quadrangle );
notSupportedElemTypes.push_back( SMESH::Entity_Polygon );
notSupportedElemTypes.push_back( SMESH::Entity_Quad_Polygon );
notSupportedElemTypes.push_back( SMESH::Entity_Tetra );
notSupportedElemTypes.push_back( SMESH::Entity_Quad_Tetra );
notSupportedElemTypes.push_back( SMESH::Entity_Pyramid );
notSupportedElemTypes.push_back( SMESH::Entity_Quad_Pyramid );
notSupportedElemTypes.push_back( SMESH::Entity_Quad_Hexa );
notSupportedElemTypes.push_back( SMESH::Entity_TriQuad_Hexa );
notSupportedElemTypes.push_back( SMESH::Entity_Penta );
notSupportedElemTypes.push_back( SMESH::Entity_Quad_Penta );
notSupportedElemTypes.push_back( SMESH::Entity_Hexagonal_Prism );
notSupportedElemTypes.push_back( SMESH::Entity_Polyhedra );
notSupportedElemTypes.push_back( SMESH::Entity_0D );
notSupportedElemTypes.push_back( SMESH::Entity_Ball );
}
else if ( isUNV )
{
// warn the user about presence of not supported elements
format = "UNV";
notSupportedElemTypes.push_back( SMESH::Entity_Polygon );
notSupportedElemTypes.push_back( SMESH::Entity_Quad_Polygon );
notSupportedElemTypes.push_back( SMESH::Entity_Polyhedra );
notSupportedElemTypes.push_back( SMESH::Entity_Quad_Polyhedra );
notSupportedElemTypes.push_back( SMESH::Entity_Pyramid );
notSupportedElemTypes.push_back( SMESH::Entity_Hexagonal_Prism );
notSupportedElemTypes.push_back( SMESH::Entity_0D );
notSupportedElemTypes.push_back( SMESH::Entity_Ball );
}
else if ( isSTL )
{
format = "STL";
notSupportedElemTypes.push_back( SMESH::Entity_Edge );
notSupportedElemTypes.push_back( SMESH::Entity_Quad_Edge );
notSupportedElemTypes.push_back( SMESH::Entity_0D );
notSupportedElemTypes.push_back( SMESH::Entity_Ball );
}
else if ( isCGNS )
{
format = "CGNS";
notSupportedElemTypes.push_back( SMESH::Entity_Ball );
}
else if ( isSAUV )
{
format = "SAUV";
notSupportedElemTypes.push_back( SMESH::Entity_Ball );
notSupportedElemTypes.push_back( SMESH::Entity_BiQuad_Quadrangle );
notSupportedElemTypes.push_back( SMESH::Entity_TriQuad_Hexa );
notSupportedElemTypes.push_back( SMESH::Entity_Hexagonal_Prism );
notSupportedElemTypes.push_back( SMESH::Entity_Polygon );
notSupportedElemTypes.push_back( SMESH::Entity_Polyhedra );
}
if ( ! notSupportedElemTypes.empty() )
{
SMESH::long_array_var nbElems = aMeshOrGroup->GetMeshInfo();
int nbNotSupported = ( nbElems[ SMESH::Entity_Pyramid ] +
nbElems[ SMESH::Entity_Quad_Pyramid ] +
nbElems[ SMESH::Entity_Hexagonal_Prism ] +
nbElems[ SMESH::Entity_Polygon ] +
nbElems[ SMESH::Entity_Polyhedra ] );
if ( nbNotSupported > 0 ) {
int aRet = SUIT_MessageBox::warning
(SMESHGUI::desktop(),
QObject::tr("SMESH_WRN_WARNING"),
QObject::tr("SMESH_EXPORT_UNV").arg(aMeshName),
QObject::tr("SMESH_BUT_YES"),
QObject::tr("SMESH_BUT_NO"), 0, 1);
if (aRet != 0)
return;
for ( size_t iType = 0; iType < notSupportedElemTypes.size(); ++iType )
if ( nbElems[ notSupportedElemTypes[ iType ]] > 0 )
presentNotSupported.push_back( notSupportedElemTypes[ iType ]);
}
if ( !presentNotSupported.empty() )
{
QString typeNames;
const char* typeMsg[SMESH::Entity_Last] = { "SMESH_NODES",
"SMESH_ELEMS0D","SMESH_EDGES","SMESH_QUADRATIC_EDGES","SMESH_TRIANGLES",
"SMESH_QUADRATIC_TRIANGLES","SMESH_QUADRANGLES","SMESH_QUADRATIC_QUADRANGLES",
"SMESH_BIQUADRATIC_QUADRANGLES","SMESH_POLYGONS","SMESH_QUADRATIC_POLYGONS",
"SMESH_TETRAHEDRA","SMESH_QUADRATIC_TETRAHEDRONS","SMESH_PYRAMIDS",
"SMESH_QUADRATIC_PYRAMIDS","SMESH_HEXAHEDRA","SMESH_QUADRATIC_HEXAHEDRONS",
"SMESH_TRIQUADRATIC_HEXAHEDRONS","SMESH_PENTAHEDRA","SMESH_QUADRATIC_PENTAHEDRONS",
"SMESH_OCTAHEDRA","SMESH_POLYEDRONS","SMESH_QUADRATIC_POLYEDRONS","SMESH_BALLS"
};
QString andStr = " " + QObject::tr("SMESH_AND") + " ", comma(", ");
for ( size_t iType = 0; iType < presentNotSupported.size(); ++iType ) {
typeNames += QObject::tr( typeMsg[ presentNotSupported[ iType ]]);
if ( iType != presentNotSupported.size() - 1 )
typeNames += ( iType == presentNotSupported.size() - 2 ) ? andStr : comma;
}
int aRet = SUIT_MessageBox::warning
(SMESHGUI::desktop(),
QObject::tr("SMESH_WRN_WARNING"),
QObject::tr("EXPORT_NOT_SUPPORTED").arg(aMeshName).arg(format).arg(typeNames),
QObject::tr("SMESH_BUT_YES"),
QObject::tr("SMESH_BUT_NO"), 0, 1);
if (aRet != 0)
return;
}
// Get parameters of export operation
@ -663,7 +736,7 @@
// bool Renumber = false;
// // PAL 14172 : Check of we have to renumber or not from the preferences before export
// if (resMgr)
// Renumber= resMgr->booleanValue("SMESH","renumbering");
// Renumber= resMgr->booleanValue("renumbering");
// if (Renumber){
// SMESH::SMESH_MeshEditor_var aMeshEditor = aMesh->GetMeshEditor();
// aMeshEditor->RenumberNodes();
@ -763,6 +836,9 @@
if(SMESH_Actor *anActor = SMESH::FindActorByEntry(IObject->getEntry())){
unsigned int aMode = anActor->GetEntityMode();
switch(theCommandID){
case 222:
InverseEntityMode(aMode,SMESH_Actor::eBallElem);
break;
case 216:
InverseEntityMode(aMode,SMESH_Actor::e0DElements);
break;
@ -820,13 +896,16 @@
_PTR(SObject) aGroupSObject = SMESH::FindSObject(aGroupObject);
if (aGroupSObject) {
if(SMESH_Actor *anActor = SMESH::FindActorByEntry(aGroupSObject->GetID().c_str())) {
if( aGroupObject->GetType() == SMESH::NODE )
anActor->SetNodeColor( aColor.R, aColor.G, aColor.B );
else if( aGroupObject->GetType() == SMESH::EDGE )
anActor->SetEdgeColor( aColor.R, aColor.G, aColor.B );
else if( aGroupObject->GetType() == SMESH::ELEM0D )
anActor->Set0DColor( aColor.R, aColor.G, aColor.B );
else {
switch ( aGroupObject->GetType ()) {
case SMESH::NODE:
anActor->SetNodeColor( aColor.R, aColor.G, aColor.B ); break;
case SMESH::EDGE:
anActor->SetEdgeColor( aColor.R, aColor.G, aColor.B ); break;
case SMESH::ELEM0D:
anActor->Set0DColor( aColor.R, aColor.G, aColor.B ); break;
case SMESH::BALL:
anActor->SetBallColor( aColor.R, aColor.G, aColor.B ); break;
default:
QColor c;
int delta;
SMESH::GetColor("SMESH", "fill_color", c, delta, "0,170,255|-100");
@ -1047,7 +1126,8 @@
}
}
void SetDisplayMode(int theCommandID, SMESHGUI_StudyId2MarkerMap& theMarkerMap){
void SetDisplayMode(int theCommandID, SMESHGUI_StudyId2MarkerMap& theMarkerMap)
{
SALOME_ListIO selected;
SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() );
if( !app )
@ -1079,9 +1159,9 @@
return;
}
case 1132:{
QColor c, e, b, n, c0D, o, outl, selection, preselection;
QColor c, e, b, n, c0D, cBall, o, outl, selection, preselection;
int delta;
int size0D = 0;
int size0D = 0, ballSize = 0;
int Edgewidth = 0;
vtkFloatingPointType Shrink = 0.0;
vtkFloatingPointType faces_orientation_scale = 0.0;
@ -1124,6 +1204,13 @@
c2 = int (color0D[2] * 255);
c0D.setRgb(c0, c1, c2);
vtkFloatingPointType ballcolor[3];
anActor->GetBallColor(ballcolor[0], ballcolor[1], ballcolor[2]);
c0 = int (ballcolor[0] * 255);
c1 = int (ballcolor[1] * 255);
c2 = int (ballcolor[2] * 255);
cBall.setRgb(c0, c1, c2);
vtkFloatingPointType outlineColor[3];
anActor->GetOutlineColor(outlineColor[0], outlineColor[1], outlineColor[2]);
c0 = int (outlineColor[0] * 255);
@ -1148,6 +1235,9 @@
size0D = (int)anActor->Get0DSize();
if(size0D == 0)
size0D = 1;
ballSize = (int)anActor->GetBallSize();
if(ballSize == 0)
ballSize = 1;
Edgewidth = (int)anActor->GetLineWidth();
if(Edgewidth == 0)
Edgewidth = 1;
@ -1176,20 +1266,22 @@
SMESHGUI_Preferences_ColorDlg *aDlg =
new SMESHGUI_Preferences_ColorDlg( SMESHGUI::GetSMESHGUI() );
aDlg->SetBooleanValue(1, faces_orientation_3dvectors);
aDlg->SetColor(1, c);
aDlg->SetColor(2, e);
aDlg->SetColor(3, n);
aDlg->SetColor(4, outl);
aDlg->SetDeltaBrightness(delta);
aDlg->SetColor(5, c0D);
aDlg->SetColor(6, o);
aDlg->SetColor(6, cBall);
aDlg->SetColor(7, o);
aDlg->SetColor(8, selection);
aDlg->SetColor(9, preselection);
aDlg->SetDeltaBrightness(delta);
aDlg->SetDoubleValue(1, faces_orientation_scale);
aDlg->SetIntValue(1, Edgewidth);
aDlg->SetIntValue(2, int(Shrink*100.));
aDlg->SetIntValue(3, size0D);
aDlg->SetDoubleValue(1, faces_orientation_scale);
aDlg->SetBooleanValue(1, faces_orientation_3dvectors);
aDlg->SetColor(7, selection);
aDlg->SetColor(8, preselection);
aDlg->SetIntValue(4, ballSize);
aDlg->setCustomMarkerMap( theMarkerMap[ aStudy->StudyId() ] );
@ -1199,14 +1291,15 @@
aDlg->setCustomMarker( aMarkerTextureCurrent );
if(aDlg->exec()){
QColor color = aDlg->GetColor(1);
QColor edgecolor = aDlg->GetColor(2);
QColor nodecolor = aDlg->GetColor(3);
QColor outlinecolor = aDlg->GetColor(4);
QColor color0D = aDlg->GetColor(5);
QColor faces_orientation_color = aDlg->GetColor(6);
QColor selectioncolor = aDlg->GetColor(7);
QColor preSelectioncolor = aDlg->GetColor(8);
QColor color = aDlg->GetColor(1);
QColor edgecolor = aDlg->GetColor(2);
QColor nodecolor = aDlg->GetColor(3);
QColor outlinecolor = aDlg->GetColor(4);
QColor color0D = aDlg->GetColor(5);
QColor ballcolor = aDlg->GetColor(6);
QColor faces_orientation_color = aDlg->GetColor(7);
QColor selectioncolor = aDlg->GetColor(8);
QColor preSelectioncolor = aDlg->GetColor(9);
int delta = aDlg->GetDeltaBrightness();
/* Point marker */
@ -1256,6 +1349,12 @@
vtkFloatingPointType (color0D.blue()) / 255.);
anActor->Set0DSize(aDlg->GetIntValue(3));
/* Ball elements */
anActor->SetBallColor(vtkFloatingPointType (ballcolor.red()) / 255.,
vtkFloatingPointType (ballcolor.green()) / 255.,
vtkFloatingPointType (ballcolor.blue()) / 255.);
anActor->SetBallSize(aDlg->GetIntValue(4));
/* Faces orientation */
vtkFloatingPointType c[3] = {vtkFloatingPointType(faces_orientation_color.redF()),
vtkFloatingPointType(faces_orientation_color.greenF()),
@ -2187,6 +2286,7 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
case 218: // Faces
case 219: // Volumes
case 220: // All Entity
case 222: // Balls
::SetDisplayEntity(theCommandID);
break;
@ -2830,6 +2930,7 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
break;
}
case 4008: // BALL
case 4009: // ELEM0D
case 4010: // EDGE
case 4021: // TRIANGLE
@ -2846,24 +2947,16 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
EmitSignalDeactivateDialog();
SMDSAbs_EntityType type = SMDSEntity_Edge;
switch (theCommandID) {
case 4009:
type = SMDSEntity_0D; break;
case 4021:
type = SMDSEntity_Triangle; break;
case 4022:
type = SMDSEntity_Quadrangle; break;
case 4031:
type = SMDSEntity_Tetra; break;
case 4023:
type = SMDSEntity_Polygon; break;
case 4032:
type = SMDSEntity_Hexa; break;
case 4133:
type = SMDSEntity_Penta; break;
case 4134:
type = SMDSEntity_Pyramid; break;
case 4135:
type = SMDSEntity_Hexagonal_Prism; break;
case 4008: type = SMDSEntity_Ball; break;
case 4009: type = SMDSEntity_0D; break;
case 4021: type = SMDSEntity_Triangle; break;
case 4022: type = SMDSEntity_Quadrangle; break;
case 4031: type = SMDSEntity_Tetra; break;
case 4023: type = SMDSEntity_Polygon; break;
case 4032: type = SMDSEntity_Hexa; break;
case 4133: type = SMDSEntity_Penta; break;
case 4134: type = SMDSEntity_Pyramid; break;
case 4135: type = SMDSEntity_Hexagonal_Prism; break;
default:;
}
( new SMESHGUI_AddMeshElementDlg( this, type ) )->show();
@ -3491,6 +3584,7 @@ void SMESHGUI::initialize( CAM_Application* app )
createSMESHAction( 6009, "VOLUME_3D", "ICON_VOLUME_3D", 0, true );
createSMESHAction( 4000, "NODE", "ICON_DLG_NODE" );
createSMESHAction( 4009, "ELEM0D", "ICON_DLG_ELEM0D" );
createSMESHAction( 4008, "BALL", "ICON_DLG_BALL" );
createSMESHAction( 4010, "EDGE", "ICON_DLG_EDGE" );
createSMESHAction( 4021, "TRIANGLE", "ICON_DLG_TRIANGLE" );
createSMESHAction( 4022, "QUAD", "ICON_DLG_QUADRANGLE" );
@ -3551,6 +3645,7 @@ void SMESHGUI::initialize( CAM_Application* app )
createSMESHAction( 213, "SHRINK", "ICON_SHRINK", 0, true );
createSMESHAction( 214, "UPDATE", "ICON_UPDATE" );
createSMESHAction( 215, "NODES", "ICON_POINTS", 0, true );
createSMESHAction( 222, "BALLS", "ICON_DLG_BALL", 0, true );
createSMESHAction( 216, "ELEMS0D", "ICON_DLG_ELEM0D", 0, true );
createSMESHAction( 217, "EDGES", "ICON_DLG_EDGE", 0, true );
createSMESHAction( 218, "FACES", "ICON_DLG_TRIANGLE", 0, true );
@ -3684,6 +3779,7 @@ void SMESHGUI::initialize( CAM_Application* app )
createMenu( 4000, addId, -1 );
createMenu( 4009, addId, -1 );
createMenu( 4008, addId, -1 );
createMenu( 4010, addId, -1 );
createMenu( 4021, addId, -1 );
createMenu( 4022, addId, -1 );
@ -3808,6 +3904,7 @@ void SMESHGUI::initialize( CAM_Application* app )
createTool( 4000, addRemTb );
createTool( 4009, addRemTb );
createTool( 4008, addRemTb );
createTool( 4010, addRemTb );
createTool( 4021, addRemTb );
createTool( 4022, addRemTb );
@ -3898,6 +3995,7 @@ void SMESHGUI::initialize( CAM_Application* app )
hasNodes("(numberOfNodes > 0 )"),//&& isVisible)"),
hasElems("(count( elemTypes ) > 0)"),
hasDifferentElems("(count( elemTypes ) > 1)"),
hasBalls("({'BallElem'} in elemTypes)"),
hasElems0d("({'Elem0d'} in elemTypes)"),
hasEdges("({'Edge'} in elemTypes)"),
hasFaces("({'Face'} in elemTypes)"),
@ -4034,6 +4132,10 @@ void SMESHGUI::initialize( CAM_Application* app )
popupMgr()->setRule( action( 219 ), aDiffElemsInVTK + "&& isVisible &&" + hasVolumes, QtxPopupMgr::VisibleRule );
popupMgr()->setRule( action( 219 ), "{'Volume'} in entityMode", QtxPopupMgr::ToggleRule );
popupMgr()->insert( action( 222 ), anId, -1 ); // BALLS
popupMgr()->setRule( action( 222 ), aDiffElemsInVTK + "&& isVisible &&" + hasBalls, QtxPopupMgr::VisibleRule );
popupMgr()->setRule( action( 222 ), "{'BallElem'} in entityMode", QtxPopupMgr::ToggleRule );
popupMgr()->insert( separator(), anId, -1 );
popupMgr()->insert( action( 220 ), anId, -1 ); // ALL
@ -4663,7 +4765,7 @@ void SMESHGUI::createPreferences()
int ColorId = addPreference( tr( "PREF_FILL" ), elemGroup, LightApp_Preferences::BiColor, "SMESH", "fill_color" );
addPreference( tr( "PREF_COLOR_0D" ), elemGroup, LightApp_Preferences::Color, "SMESH", "elem0d_color" );
addPreference( tr( "PREF_BALL_COLOR" ), elemGroup, LightApp_Preferences::Color, "SMESH", "ball_elem_color" );
addPreference( tr( "PREF_OUTLINE" ), elemGroup, LightApp_Preferences::Color, "SMESH", "outline_color" );
addPreference( tr( "PREF_WIREFRAME" ), elemGroup, LightApp_Preferences::Color, "SMESH", "wireframe_color" );
@ -4676,6 +4778,8 @@ void SMESHGUI::createPreferences()
int size0d = addPreference(tr("PREF_SIZE_0D"), elemGroup,
LightApp_Preferences::IntSpin, "SMESH", "elem0d_size");
int ballSize = addPreference(tr("PREF_BALL_SIZE"), elemGroup,
LightApp_Preferences::IntSpin, "SMESH", "ball_elem_size");
int elemW = addPreference(tr("PREF_WIDTH"), elemGroup,
LightApp_Preferences::IntSpin, "SMESH", "element_width");
int shrink = addPreference(tr("PREF_SHRINK_COEFF"), elemGroup,
@ -4684,6 +4788,9 @@ void SMESHGUI::createPreferences()
setPreferenceProperty( size0d, "min", 1 );
setPreferenceProperty( size0d, "max", 10 );
setPreferenceProperty( ballSize, "min", 1 );
setPreferenceProperty( ballSize, "max", 10 );
setPreferenceProperty( elemW, "min", 1 );
setPreferenceProperty( elemW, "max", 5 );

View File

@ -28,11 +28,12 @@
#include "SMESHGUI_AddMeshElementDlg.h"
#include "SMESHGUI.h"
#include "SMESHGUI_Utils.h"
#include "SMESHGUI_VTKUtils.h"
#include "SMESHGUI_MeshUtils.h"
#include "SMESHGUI_GroupUtils.h"
#include "SMESHGUI_IdValidator.h"
#include "SMESHGUI_MeshUtils.h"
#include "SMESHGUI_SpinBox.h"
#include "SMESHGUI_Utils.h"
#include "SMESHGUI_VTKUtils.h"
#include <SMESH_Actor.h>
#include <SMESH_ActorUtils.h>
@ -241,6 +242,12 @@ SMESHGUI_AddMeshElementDlg::SMESHGUI_AddMeshElementDlg( SMESHGUI* theMo
elemName = "ELEM0D";
myHelpFileName = "adding_nodes_and_elements_page.html#adding_0delems_anchor";
break;
case SMDSEntity_Ball:
myNbNodes = 1;
myElementType = SMDSAbs_Ball;
elemName = "BALL";
myHelpFileName = "adding_nodes_and_elements_page.html#adding_ball_anchor";
break;
case SMDSEntity_Edge:
myNbNodes = 2;
myElementType = SMDSAbs_Edge;
@ -312,7 +319,7 @@ SMESHGUI_AddMeshElementDlg::SMESHGUI_AddMeshElementDlg( SMESHGUI* theMo
aTopLayout->setSpacing(SPACING);
aTopLayout->setMargin(MARGIN);
/***************************************************************/
/* Constructor *************************************************/
GroupConstructors = new QGroupBox(buttonGrTitle, this);
QButtonGroup* ButtonGroup = new QButtonGroup(this);
QHBoxLayout* GroupConstructorsLayout = new QHBoxLayout(GroupConstructors);
@ -326,7 +333,7 @@ SMESHGUI_AddMeshElementDlg::SMESHGUI_AddMeshElementDlg( SMESHGUI* theMo
GroupConstructorsLayout->addWidget(Constructor1);
ButtonGroup->addButton( Constructor1, 0 );
/***************************************************************/
/* Nodes & Reverse *********************************************/
GroupC1 = new QGroupBox(grBoxTitle, this);
QGridLayout* GroupC1Layout = new QGridLayout(GroupC1);
GroupC1Layout->setSpacing(SPACING);
@ -340,12 +347,23 @@ SMESHGUI_AddMeshElementDlg::SMESHGUI_AddMeshElementDlg( SMESHGUI* theMo
Reverse = (myElementType == SMDSAbs_Face || myElementType == SMDSAbs_Volume ) ? new QCheckBox(tr("SMESH_REVERSE"), GroupC1) : 0;
DiameterSpinBox = ( myGeomType == SMDSEntity_Ball ) ? new SMESHGUI_SpinBox(GroupC1) : 0;
QLabel* diameterLabel = DiameterSpinBox ? new QLabel( tr("BALL_DIAMETER"),GroupC1) : 0;
GroupC1Layout->addWidget(TextLabelC1A1, 0, 0);
GroupC1Layout->addWidget(SelectButtonC1A1, 0, 1);
GroupC1Layout->addWidget(LineEditC1A1, 0, 2);
if ( Reverse ) GroupC1Layout->addWidget(Reverse, 1, 0, 1, 3);
if ( Reverse ) {
GroupC1Layout->addWidget(Reverse, 1, 0, 1, 3);
}
if ( DiameterSpinBox ) {
GroupC1Layout->addWidget(diameterLabel, 1, 0);
GroupC1Layout->addWidget(DiameterSpinBox, 1, 1, 1, 2);
/***************************************************************/
DiameterSpinBox->RangeStepAndValidator( 1e-7, 1e+9, 0.1 );
DiameterSpinBox->SetValue( 1. );
}
/* Add to group ************************************************/
GroupGroups = new QGroupBox( tr( "SMESH_ADD_TO_GROUP" ), this );
GroupGroups->setCheckable( true );
QHBoxLayout* GroupGroupsLayout = new QHBoxLayout(GroupGroups);
@ -360,7 +378,7 @@ SMESHGUI_AddMeshElementDlg::SMESHGUI_AddMeshElementDlg( SMESHGUI* theMo
GroupGroupsLayout->addWidget( TextLabel_GroupName );
GroupGroupsLayout->addWidget( ComboBox_GroupName, 1 );
/***************************************************************/
/* Apply etc ***************************************************/
GroupButtons = new QGroupBox(this);
QHBoxLayout* GroupButtonsLayout = new QHBoxLayout(GroupButtons);
GroupButtonsLayout->setSpacing(SPACING);
@ -415,7 +433,7 @@ void SMESHGUI_AddMeshElementDlg::Init()
/* reset "Add to group" control */
GroupGroups->setChecked( false );
GroupGroups->setVisible( myElementType != SMDSAbs_0DElement );
//GroupGroups->setVisible( myElementType != SMDSAbs_0DElement );
myNbOkNodes = 0;
myActor = 0;
@ -502,6 +520,10 @@ void SMESHGUI_AddMeshElementDlg::ClickOnApply()
switch (myElementType) {
case SMDSAbs_0DElement:
anElemId = aMeshEditor->Add0DElement(anArrayOfIndices[0]); break;
case SMDSAbs_Ball:
if ( myGeomType == SMDSEntity_Ball )
anElemId = aMeshEditor->AddBall(anArrayOfIndices[0],
DiameterSpinBox->GetValue()); break;
case SMDSAbs_Edge:
anElemId = aMeshEditor->AddEdge(anArrayOfIndices.inout()); break;
case SMDSAbs_Face:

View File

@ -50,6 +50,7 @@ class SMESHGUI;
class SMESH_Actor;
class SVTK_Selector;
class LightApp_SelectionMgr;
class SMESHGUI_SpinBox;
namespace SMESH
{
@ -114,6 +115,7 @@ private:
QPushButton* SelectButtonC1A1;
QLineEdit* LineEditC1A1;
QCheckBox* Reverse;
SMESHGUI_SpinBox* DiameterSpinBox;
QString myHelpFileName;

View File

@ -23,8 +23,9 @@
// SMESH SMESHGUI : GUI for SMESH component
// File : SMESHGUI_FilterDlg.cxx
// Author : Sergey LITONIN, Open CASCADE S.A.S.
// SMESH includes
//
// SMESH includes
#include "SMESHGUI_FilterDlg.h"
#include "SMESHGUI.h"
@ -1628,6 +1629,14 @@ static QList<int> geomTypes( const int theType )
typeIds.append( SMESH::Geom_HEXAGONAL_PRISM );
typeIds.append( SMESH::Geom_POLYHEDRA );
}
if ( theType == SMESH::ALL || theType == SMESH::ELEM0D )
{
typeIds.append( SMESH::Geom_POINT );
}
if ( theType == SMESH::ALL || theType == SMESH::BALL )
{
typeIds.append( SMESH::Geom_BALL );
}
return typeIds;
}
@ -1961,6 +1970,7 @@ const QMap<int, QString>& SMESHGUI_FilterTable::getSupportedTypes() const
if (aTypes.isEmpty())
{
aTypes[ SMESH::NODE ] = tr("NODES");
aTypes[ SMESH::BALL ] = tr("BALLS");
aTypes[ SMESH::EDGE ] = tr("EDGES");
aTypes[ SMESH::FACE ] = tr("FACES");
aTypes[ SMESH::VOLUME ] = tr("VOLUMES");
@ -2067,6 +2077,35 @@ const QMap<int, QString>& SMESHGUI_FilterTable::getCriteria (const int theType)
}
return aCriteria;
}
else if (theType == SMESH::ELEM0D)
{
static QMap<int, QString> aCriteria;
if (aCriteria.isEmpty())
{
aCriteria[ SMESH::FT_RangeOfIds ] = tr("RANGE_OF_IDS");
aCriteria[ SMESH::FT_BelongToGeom ] = tr("BELONG_TO_GEOM");
aCriteria[ SMESH::FT_BelongToPlane ] = tr("BELONG_TO_PLANE");
aCriteria[ SMESH::FT_BelongToCylinder ] = tr("BELONG_TO_CYLINDER");
aCriteria[ SMESH::FT_BelongToGenSurface ] = tr("BELONG_TO_GENSURFACE");
aCriteria[ SMESH::FT_GroupColor ] = tr("GROUP_COLOR");
}
return aCriteria;
}
else if (theType == SMESH::BALL)
{
static QMap<int, QString> aCriteria;
if (aCriteria.isEmpty())
{
aCriteria[ SMESH::FT_BallDiameter ] = tr("BALL_DIAMETER");
aCriteria[ SMESH::FT_RangeOfIds ] = tr("RANGE_OF_IDS");
aCriteria[ SMESH::FT_BelongToGeom ] = tr("BELONG_TO_GEOM");
aCriteria[ SMESH::FT_BelongToPlane ] = tr("BELONG_TO_PLANE");
aCriteria[ SMESH::FT_BelongToCylinder ] = tr("BELONG_TO_CYLINDER");
aCriteria[ SMESH::FT_BelongToGenSurface ] = tr("BELONG_TO_GENSURFACE");
aCriteria[ SMESH::FT_GroupColor ] = tr("GROUP_COLOR");
}
return aCriteria;
}
else // SMESH::ALL
{
static QMap<int, QString> aCriteria;

View File

@ -19,8 +19,9 @@
// File : SMESHGUI_FindElemByPointDlg.cxx
// Author : Edward AGAPOV, Open CASCADE S.A.S.
// SMESH includes
//
// SMESH includes
#include "SMESHGUI_FindElemByPointDlg.h"
#include "SMESHGUI.h"
@ -124,6 +125,10 @@ void SMESHGUI_FindElemByPointDlg::setTypes(SMESH::array_of_ElementType_var & typ
myElemTypeCombo->addItem( tr( "MEN_ELEM0D" ));
myElemTypeCombo->setId( nbTypes++, int( SMESH::ELEM0D ));
break;
case SMESH::BALL:
myElemTypeCombo->addItem( tr( "MEN_BALL" ));
myElemTypeCombo->setId( nbTypes++, int( SMESH::BALL ));
break;
default:;
}
}

View File

@ -103,14 +103,15 @@
enum grpSelectionMode {
grpNoSelection = -1,
grpNodeSelection = 0,
grpEdgeSelection = 1,
grpFaceSelection = 2,
grpVolumeSelection = 3,
grpSubMeshSelection = 4,
grpGroupSelection = 5,
grpMeshSelection = 6,
grpGeomSelection = 7,
grpAllSelection = 8,
grpBallSelection = 1,
grpEdgeSelection = 2,
grpFaceSelection = 3,
grpVolumeSelection = 4,
grpSubMeshSelection = 5,
grpGroupSelection = 6,
grpMeshSelection = 7,
grpGeomSelection = 8,
grpAllSelection = 9,
};
//=================================================================================
@ -213,6 +214,7 @@ void SMESHGUI_GroupDlg::initDialog( bool create)
QStringList types;
types.append( tr( "MESH_NODE" ) );
types.append( tr( "SMESH_BALL_ELEM" ) );
types.append( tr( "SMESH_EDGE" ) );
types.append( tr( "SMESH_FACE" ) );
types.append( tr( "SMESH_VOLUME" ) );
@ -257,22 +259,22 @@ void SMESHGUI_GroupDlg::initDialog( bool create)
QWidget* wg3 = new QWidget( myWGStack );
/***************************************************************/
QGroupBox* aContentBox = new QGroupBox( tr( "SMESH_CONTENT" ), wg1 );
QGroupBox* aContentBox = new QGroupBox( tr( "SMESH_CONTENT" ), wg1 );
QGridLayout* aContentBoxLayout = new QGridLayout( aContentBox );
aContentBoxLayout->setMargin( MARGIN );
aContentBoxLayout->setSpacing( SPACING );
mySelectAll = new QCheckBox( tr( "SELECT_ALL" ), aContentBox );
mySelectAll = new QCheckBox( tr( "SELECT_ALL" ), aContentBox );
myAllowElemsModif = new QCheckBox( tr( "ALLOW_ELEM_LIST_MODIF" ), aContentBox );
myElementsLab = new QLabel( tr( "SMESH_ID_ELEMENTS" ), aContentBox );
myElements = new QListWidget( aContentBox );
myElements = new QListWidget( aContentBox );
myElements->setSelectionMode( QListWidget::ExtendedSelection );
myFilterBtn = new QPushButton( tr( "SMESH_BUT_FILTER" ), aContentBox );
myAddBtn = new QPushButton( tr( "SMESH_BUT_ADD" ), aContentBox );
myAddBtn = new QPushButton( tr( "SMESH_BUT_ADD" ), aContentBox );
myRemoveBtn = new QPushButton( tr( "SMESH_BUT_REMOVE" ), aContentBox );
mySortBtn = new QPushButton( tr( "SMESH_BUT_SORT" ), aContentBox );
mySortBtn = new QPushButton( tr( "SMESH_BUT_SORT" ), aContentBox );
aContentBoxLayout->addWidget( mySelectAll, 0, 0 );
aContentBoxLayout->addWidget( myAllowElemsModif, 1, 0 );
@ -416,7 +418,7 @@ void SMESHGUI_GroupDlg::initDialog( bool create)
connect(myName, SIGNAL(textChanged(const QString&)), this, SLOT(onNameChanged(const QString&)));
connect(myElements, SIGNAL(itemSelectionChanged()), this, SLOT(onListSelectionChanged()));
connect(myFilterBtn, SIGNAL(clicked()), this, SLOT(setFilters()));
connect(myFilterBtn, SIGNAL(clicked()), this, SLOT(setFilters()));
connect(aFilter2, SIGNAL(clicked()), this, SLOT(setFilters()));
connect(mySelectAll, SIGNAL(toggled(bool)), this, SLOT(onSelectAll()));
connect(myAllowElemsModif,SIGNAL(toggled(bool)), this, SLOT(onSelectAll()));
@ -562,7 +564,7 @@ void SMESHGUI_GroupDlg::init (SMESH::SMESH_Mesh_ptr theMesh)
// purpose :
//=================================================================================
void SMESHGUI_GroupDlg::init (SMESH::SMESH_GroupBase_ptr theGroup,
const bool theIsConvert)
const bool theIsConvert)
{
restoreShowEntityMode();
myMesh = theGroup->GetMesh();
@ -581,17 +583,18 @@ void SMESHGUI_GroupDlg::init (SMESH::SMESH_GroupBase_ptr theGroup,
int aType = 0;
switch(theGroup->GetType()) {
case SMESH::NODE: aType= 0; break;
case SMESH::EDGE: aType = 1; break;
case SMESH::FACE: aType = 2; break;
case SMESH::VOLUME: aType = 3; break;
case SMESH::NODE: aType = 0; break;
case SMESH::BALL: aType = 1; break;
case SMESH::EDGE: aType = 2; break;
case SMESH::FACE: aType = 3; break;
case SMESH::VOLUME: aType = 4; break;
}
myTypeGroup->button(aType)->setChecked(true);
myGroup = SMESH::SMESH_Group::_narrow( theGroup );
myGroupOnGeom = SMESH::SMESH_GroupOnGeom::_narrow( theGroup );
myGroup = SMESH::SMESH_Group::_narrow( theGroup );
myGroupOnGeom = SMESH::SMESH_GroupOnGeom::_narrow( theGroup );
myGroupOnFilter = SMESH::SMESH_GroupOnFilter::_narrow( theGroup );
myFilter = SMESH::Filter::_nil();
myFilter = SMESH::Filter::_nil();
if (myGroup->_is_nil() && myGroupOnGeom->_is_nil() && myGroupOnFilter->_is_nil() )
return;
@ -801,6 +804,9 @@ void SMESHGUI_GroupDlg::setSelectionMode (int theMode)
case grpEdgeSelection:
if ( aViewWindow ) aViewWindow->SetSelectionMode(isSelectAll ? ActorSelection : EdgeSelection);
break;
case grpBallSelection:
//if ( aViewWindow ) aViewWindow->SetSelectionMode(isSelectAll ? ActorSelection : BallSelection);
break;
case grpFaceSelection:
if ( aViewWindow ) aViewWindow->SetSelectionMode(isSelectAll ? ActorSelection : FaceSelection);
break;
@ -811,11 +817,11 @@ void SMESHGUI_GroupDlg::setSelectionMode (int theMode)
SMESH_TypeFilter* f = 0;
switch (myTypeId) {
case 0: f = new SMESH_TypeFilter(SUBMESH); break;
case 1: f = new SMESH_TypeFilter(SUBMESH_EDGE); break;
case 2: f = new SMESH_TypeFilter(SUBMESH_FACE); break;
case 3: f = new SMESH_TypeFilter(SUBMESH_SOLID); break;
default:f = new SMESH_TypeFilter(SUBMESH);
case grpNodeSelection: f = new SMESH_TypeFilter(SUBMESH); break;
case grpEdgeSelection: f = new SMESH_TypeFilter(SUBMESH_EDGE); break;
case grpFaceSelection: f = new SMESH_TypeFilter(SUBMESH_FACE); break;
case grpVolumeSelection: f = new SMESH_TypeFilter(SUBMESH_SOLID); break;
default: f = new SMESH_TypeFilter(SUBMESH);
}
QList<SUIT_SelectionFilter*> filtList;
filtList.append( f );
@ -831,11 +837,12 @@ void SMESHGUI_GroupDlg::setSelectionMode (int theMode)
SMESH_TypeFilter* f = 0;
switch (myTypeId) {
case 0: f = new SMESH_TypeFilter(GROUP_NODE); break;
case 1: f = new SMESH_TypeFilter(GROUP_EDGE); break;
case 2: f = new SMESH_TypeFilter(GROUP_FACE); break;
case 3: f = new SMESH_TypeFilter(GROUP_VOLUME); break;
default:f = new SMESH_TypeFilter(GROUP);
case grpNodeSelection: f = new SMESH_TypeFilter(GROUP_NODE); break;
case grpBallSelection: f = new SMESH_TypeFilter(GROUP_BALL); break;
case grpEdgeSelection: f = new SMESH_TypeFilter(GROUP_EDGE); break;
case grpFaceSelection: f = new SMESH_TypeFilter(GROUP_FACE); break;
case grpVolumeSelection: f = new SMESH_TypeFilter(GROUP_VOLUME); break;
default: f = new SMESH_TypeFilter(GROUP);
}
QList<SUIT_SelectionFilter*> filtList;
filtList.append( f );
@ -876,10 +883,11 @@ bool SMESHGUI_GroupDlg::onApply()
SMESH::ElementType aType = SMESH::ALL;
switch (myTypeId) {
case 0: aType = SMESH::NODE; break;
case 1: aType = SMESH::EDGE; break;
case 2: aType = SMESH::FACE; break;
case 3: aType = SMESH::VOLUME; break;
case grpNodeSelection: aType = SMESH::NODE; break;
case grpBallSelection: aType = SMESH::BALL; break;
case grpEdgeSelection: aType = SMESH::EDGE; break;
case grpFaceSelection: aType = SMESH::FACE; break;
case grpVolumeSelection: aType = SMESH::VOLUME; break;
}
bool anIsOk = false;
@ -1119,16 +1127,16 @@ bool SMESHGUI_GroupDlg::onApply()
if(SMESH_Actor *anActor = SMESH::FindActorByEntry(aMeshGroupSO->GetID().c_str())) {
anActor->setName(myName->text().toLatin1().data());
switch ( myTypeId ) {
case 0: anActor->SetNodeColor( aColor.R, aColor.G, aColor.B ); break;
case 1: anActor->SetEdgeColor( aColor.R, aColor.G, aColor.B ); break;
case 2:
case 3:
{
case grpNodeSelection: anActor->SetNodeColor( aColor.R, aColor.G, aColor.B ); break;
case grpBallSelection: anActor->SetBallColor( aColor.R, aColor.G, aColor.B ); break;
case grpEdgeSelection: anActor->SetEdgeColor( aColor.R, aColor.G, aColor.B ); break;
case grpFaceSelection:
case grpVolumeSelection:
default:
QColor c;
int delta;
SMESH::GetColor("SMESH", "fill_color", c , delta, "0,170,255|-100");
anActor->SetSufaceColor( aColor.R, aColor.G, aColor.B, delta ); break;
}
}
}
}
@ -1344,21 +1352,17 @@ void SMESHGUI_GroupDlg::onObjectSelectionChanged()
else
aGroupMainShape = GEOM::GEOM_Object::_duplicate(aGeomGroup);
_PTR(SObject) aGroupMainShapeSO =
//aStudy->FindObjectIOR(aStudy->ConvertObjectToIOR(aGroupMainShape));
aStudy->FindObjectID(aGroupMainShape->GetStudyEntry());
_PTR(SObject) anObj, aRef;
bool isRefOrSubShape = false;
if (aMeshSO->FindSubObject(1, anObj) && anObj->ReferencedObject(aRef)) {
//if (strcmp(aRef->GetID(), aGroupMainShapeSO->GetID()) == 0) {
if (aRef->GetID() == aGroupMainShapeSO->GetID()) {
isRefOrSubShape = true;
} else {
_PTR(SObject) aFather = aGroupMainShapeSO->GetFather();
_PTR(SComponent) aComponent = aGroupMainShapeSO->GetFatherComponent();
//while (!isRefOrSubShape && strcmp(aFather->GetID(), aComponent->GetID()) != 0) {
while (!isRefOrSubShape && aFather->GetID() != aComponent->GetID()) {
//if (strcmp(aRef->GetID(), aFather->GetID()) == 0)
if (aRef->GetID() == aFather->GetID())
isRefOrSubShape = true;
else
@ -1665,11 +1669,12 @@ void SMESHGUI_GroupDlg::setFilters()
SMESH::ElementType aType = SMESH::ALL;
switch ( myTypeId )
{
case 0 : aType = SMESH::NODE; break;
case 1 : aType = SMESH::EDGE; break;
case 2 : aType = SMESH::FACE; break;
case 3 : aType = SMESH::VOLUME; break;
default: return;
case grpNodeSelection: aType = SMESH::NODE; break;
case grpBallSelection: aType = SMESH::BALL; break;
case grpEdgeSelection: aType = SMESH::EDGE; break;
case grpFaceSelection: aType = SMESH::FACE; break;
case grpVolumeSelection: aType = SMESH::VOLUME; break;
default: return;
}
if ( myFilterDlg == 0 )
@ -1748,19 +1753,23 @@ void SMESHGUI_GroupDlg::onAdd()
SMESH::ElementType aType = SMESH::ALL;
switch(myTypeId) {
case 0:
case grpNodeSelection:
aType = SMESH::NODE;
mySelector->SetSelectionMode(NodeSelection);
break;
case 1:
case grpBallSelection:
aType = SMESH::BALL;
//mySelector->SetSelectionMode(BallSelection);
break;
case grpEdgeSelection:
aType = SMESH::EDGE;
mySelector->SetSelectionMode(EdgeSelection);
break;
case 2:
case grpFaceSelection:
aType = SMESH::FACE;
mySelector->SetSelectionMode(FaceSelection);
break;
case 3:
case grpVolumeSelection:
aType = SMESH::VOLUME;
mySelector->SetSelectionMode(VolumeSelection);
break;
@ -1911,10 +1920,10 @@ void SMESHGUI_GroupDlg::onAdd()
SMESH::ElementType aGroupType = SMESH::ALL;
switch(aGroupOp->GetType(myGeomObjects[0])) {
case 7: aGroupType = SMESH::NODE; break;
case 6: aGroupType = SMESH::EDGE; break;
case 4: aGroupType = SMESH::FACE; break;
case 2: aGroupType = SMESH::VOLUME; break;
case TopAbs_VERTEX: aGroupType = SMESH::NODE; break;
case TopAbs_EDGE: aGroupType = SMESH::EDGE; break;
case TopAbs_FACE: aGroupType = SMESH::FACE; break;
case TopAbs_SOLID: aGroupType = SMESH::VOLUME; break;
default: myIsBusy = false; return;
}
@ -1991,10 +2000,11 @@ void SMESHGUI_GroupDlg::onRemove()
SMESH::ElementType aType = SMESH::ALL;
switch(myTypeId) {
case 0: aType = SMESH::NODE; break;
case 1: aType = SMESH::EDGE; break;
case 2: aType = SMESH::FACE; break;
case 3: aType = SMESH::VOLUME; break;
case grpNodeSelection: aType = SMESH::NODE; break;
case grpBallSelection: aType = SMESH::BALL; break;
case grpEdgeSelection: aType = SMESH::EDGE; break;
case grpFaceSelection: aType = SMESH::FACE; break;
case grpVolumeSelection: aType = SMESH::VOLUME; break;
}
if (myCurrentLineEdit == mySubMeshLine) {
@ -2551,10 +2561,11 @@ void SMESHGUI_GroupDlg::setShowEntityMode()
if (!myStoredShownEntity)
myStoredShownEntity = actor->GetEntityMode();
switch ( myTypeId ) {
case 0: restoreShowEntityMode(); break;
case 1: actor->SetEntityMode( SMESH_Actor::eEdges ); break;
case 2: actor->SetEntityMode( SMESH_Actor::eFaces ); break;
case 3: actor->SetEntityMode( SMESH_Actor::eVolumes ); break;
case grpNodeSelection: restoreShowEntityMode(); break;
case grpBallSelection: actor->SetEntityMode( SMESH_Actor::eBallElem ); break;
case grpEdgeSelection: actor->SetEntityMode( SMESH_Actor::eEdges ); break;
case grpFaceSelection: actor->SetEntityMode( SMESH_Actor::eFaces ); break;
case grpVolumeSelection: actor->SetEntityMode( SMESH_Actor::eVolumes ); break;
}
}
}

View File

@ -31,6 +31,9 @@
#include "SMESHGUI_VTKUtils.h"
#include "SMDSAbs_ElementType.hxx"
#include "SMDS_Mesh.hxx"
#include "SMDS_BallElement.hxx"
#include "SMDS_EdgePosition.hxx"
#include "SMDS_FacePosition.hxx"
#include <LightApp_SelectionMgr.h>
#include <SUIT_OverrideCursor.h>
@ -133,6 +136,8 @@ SMESHGUI_MeshInfo::SMESHGUI_MeshInfo( QWidget* parent )
l->setMargin( MARGIN );
l->setSpacing( SPACING );
int index = 0;
// object
QLabel* aNameLab = new QLabel( tr( "NAME_LAB" ), this );
QLabel* aName = createField();
@ -140,15 +145,15 @@ SMESHGUI_MeshInfo::SMESHGUI_MeshInfo( QWidget* parent )
QLabel* aObjLab = new QLabel( tr( "OBJECT_LAB" ), this );
QLabel* aObj = createField();
aObj->setMinimumWidth( 150 );
myWidgets[0] << aNameLab << aName;
myWidgets[1] << aObjLab << aObj;
myWidgets[ index++ ] << aNameLab << aName;
myWidgets[ index++ ] << aObjLab << aObj;
// nodes
QWidget* aNodesLine = createLine();
QLabel* aNodesLab = new QLabel( tr( "NODES_LAB" ), this );
QLabel* aNodes = createField();
myWidgets[2] << aNodesLine;
myWidgets[3] << aNodesLab << aNodes;
myWidgets[ index++ ] << aNodesLine;
myWidgets[ index++ ] << aNodesLab << aNodes;
// elements
QWidget* aElemLine = createLine();
@ -156,15 +161,22 @@ SMESHGUI_MeshInfo::SMESHGUI_MeshInfo( QWidget* parent )
QLabel* aElemTotal = new QLabel( tr( "TOTAL_LAB" ), this );
QLabel* aElemLin = new QLabel( tr( "LINEAR_LAB" ), this );
QLabel* aElemQuad = new QLabel( tr( "QUADRATIC_LAB" ), this );
myWidgets[4] << aElemLine;
myWidgets[5] << aElemLab << aElemTotal << aElemLin << aElemQuad;
myWidgets[ index++ ] << aElemLine;
myWidgets[ index++ ] << aElemLab << aElemTotal << aElemLin << aElemQuad;
// ... 0D elements
QWidget* a0DLine = createLine();
QLabel* a0DLab = new QLabel( tr( "0D_LAB" ), this );
QLabel* a0DTotal = createField();
myWidgets[6] << a0DLine;
myWidgets[7] << a0DLab << a0DTotal;
myWidgets[ index++ ] << a0DLine;
myWidgets[ index++ ] << a0DLab << a0DTotal;
// ... Ball elements
QWidget* aBallLine = createLine();
QLabel* aBallLab = new QLabel( tr( "BALL_LAB" ), this );
QLabel* aBallTotal = createField();
myWidgets[ index++ ] << aBallLine;
myWidgets[ index++ ] << aBallLab << aBallTotal;
// ... 1D elements
QWidget* a1DLine = createLine();
@ -172,8 +184,8 @@ SMESHGUI_MeshInfo::SMESHGUI_MeshInfo( QWidget* parent )
QLabel* a1DTotal = createField();
QLabel* a1DLin = createField();
QLabel* a1DQuad = createField();
myWidgets[8] << a1DLine;
myWidgets[9] << a1DLab << a1DTotal << a1DLin << a1DQuad;
myWidgets[ index++ ] << a1DLine;
myWidgets[ index++ ] << a1DLab << a1DTotal << a1DLin << a1DQuad;
// ... 2D elements
QWidget* a2DLine = createLine();
@ -191,11 +203,11 @@ SMESHGUI_MeshInfo::SMESHGUI_MeshInfo( QWidget* parent )
QLabel* a2DQuaQuad = createField();
QLabel* a2DPolLab = new QLabel( tr( "POLYGONS_LAB" ), this );
QLabel* a2DPolTotal = createField();
myWidgets[10] << a2DLine;
myWidgets[11] << a2DLab << a2DTotal << a2DLin << a2DQuad;
myWidgets[12] << a2DTriLab << a2DTriTotal << a2DTriLin << a2DTriQuad;
myWidgets[13] << a2DQuaLab << a2DQuaTotal << a2DQuaLin << a2DQuaQuad;
myWidgets[14] << a2DPolLab << a2DPolTotal;
myWidgets[ index++ ] << a2DLine;
myWidgets[ index++ ] << a2DLab << a2DTotal << a2DLin << a2DQuad;
myWidgets[ index++ ] << a2DTriLab << a2DTriTotal << a2DTriLin << a2DTriQuad;
myWidgets[ index++ ] << a2DQuaLab << a2DQuaTotal << a2DQuaLin << a2DQuaQuad;
myWidgets[ index++ ] << a2DPolLab << a2DPolTotal;
// ... 3D elements
QWidget* a3DLine = createLine();
@ -223,14 +235,14 @@ SMESHGUI_MeshInfo::SMESHGUI_MeshInfo( QWidget* parent )
QLabel* a3DHexPriTotal = createField();
QLabel* a3DPolLab = new QLabel( tr( "POLYHEDRONS_LAB" ), this );
QLabel* a3DPolTotal = createField();
myWidgets[15] << a3DLine;
myWidgets[16] << a3DLab << a3DTotal << a3DLin << a3DQuad;
myWidgets[17] << a3DTetLab << a3DTetTotal << a3DTetLin << a3DTetQuad;
myWidgets[18] << a3DHexLab << a3DHexTotal << a3DHexLin << a3DHexQuad;
myWidgets[19] << a3DPyrLab << a3DPyrTotal << a3DPyrLin << a3DPyrQuad;
myWidgets[20] << a3DPriLab << a3DPriTotal << a3DPriLin << a3DPriQuad;
myWidgets[21] << a3DHexPriLab << a3DHexPriTotal;
myWidgets[22] << a3DPolLab << a3DPolTotal;
myWidgets[ index++ ] << a3DLine;
myWidgets[ index++ ] << a3DLab << a3DTotal << a3DLin << a3DQuad;
myWidgets[ index++ ] << a3DTetLab << a3DTetTotal << a3DTetLin << a3DTetQuad;
myWidgets[ index++ ] << a3DHexLab << a3DHexTotal << a3DHexLin << a3DHexQuad;
myWidgets[ index++ ] << a3DPyrLab << a3DPyrTotal << a3DPyrLin << a3DPyrQuad;
myWidgets[ index++ ] << a3DPriLab << a3DPriTotal << a3DPriLin << a3DPriQuad;
myWidgets[ index++ ] << a3DHexPriLab << a3DHexPriTotal;
myWidgets[ index++ ] << a3DPolLab << a3DPolTotal;
myLoadBtn = new QPushButton( tr( "BUT_LOAD_MESH" ), this );
myLoadBtn->setAutoDefault( true );
@ -244,6 +256,7 @@ SMESHGUI_MeshInfo::SMESHGUI_MeshInfo( QWidget* parent )
setFontAttributes( aElemLin, Italic );
setFontAttributes( aElemQuad, Italic );
setFontAttributes( a0DLab, Bold );
setFontAttributes( aBallLab, Bold );
setFontAttributes( a1DLab, Bold );
setFontAttributes( a2DLab, Bold );
setFontAttributes( a3DLab, Bold );
@ -263,52 +276,55 @@ SMESHGUI_MeshInfo::SMESHGUI_MeshInfo( QWidget* parent )
l->addWidget( a0DLine, 6, 1, 1, 3 );
l->addWidget( a0DLab, 7, 0 );
l->addWidget( a0DTotal, 7, 1 );
l->addWidget( a1DLine, 8, 1, 1, 3 );
l->addWidget( a1DLab, 9, 0 );
l->addWidget( a1DTotal, 9, 1 );
l->addWidget( a1DLin, 9, 2 );
l->addWidget( a1DQuad, 9, 3 );
l->addWidget( a2DLine, 10, 1, 1, 3 );
l->addWidget( a2DLab, 11, 0 );
l->addWidget( a2DTotal, 11, 1 );
l->addWidget( a2DLin, 11, 2 );
l->addWidget( a2DQuad, 11, 3 );
l->addWidget( a2DTriLab, 12, 0 );
l->addWidget( a2DTriTotal, 12, 1 );
l->addWidget( a2DTriLin, 12, 2 );
l->addWidget( a2DTriQuad, 12, 3 );
l->addWidget( a2DQuaLab, 13, 0 );
l->addWidget( a2DQuaTotal, 13, 1 );
l->addWidget( a2DQuaLin, 13, 2 );
l->addWidget( a2DQuaQuad, 13, 3 );
l->addWidget( a2DPolLab, 14, 0 );
l->addWidget( a2DPolTotal, 14, 1 );
l->addWidget( a3DLine, 15, 1, 1, 3 );
l->addWidget( a3DLab, 16, 0 );
l->addWidget( a3DTotal, 16, 1 );
l->addWidget( a3DLin, 16, 2 );
l->addWidget( a3DQuad, 16, 3 );
l->addWidget( a3DTetLab, 17, 0 );
l->addWidget( a3DTetTotal, 17, 1 );
l->addWidget( a3DTetLin, 17, 2 );
l->addWidget( a3DTetQuad, 17, 3 );
l->addWidget( a3DHexLab, 18, 0 );
l->addWidget( a3DHexTotal, 18, 1 );
l->addWidget( a3DHexLin, 18, 2 );
l->addWidget( a3DHexQuad, 18, 3 );
l->addWidget( a3DPyrLab, 19, 0 );
l->addWidget( a3DPyrTotal, 19, 1 );
l->addWidget( a3DPyrLin, 19, 2 );
l->addWidget( a3DPyrQuad, 19, 3 );
l->addWidget( a3DPriLab, 20, 0 );
l->addWidget( a3DPriTotal, 20, 1 );
l->addWidget( a3DPriLin, 20, 2 );
l->addWidget( a3DPriQuad, 20, 3 );
l->addWidget( a3DHexPriLab, 21, 0 );
l->addWidget( a3DHexPriTotal, 21, 1 );
l->addWidget( a3DPolLab, 22, 0 );
l->addWidget( a3DPolTotal, 22, 1 );
l->addWidget( myLoadBtn, 23, 1, 1, 3 );
l->addWidget( aBallLine, 8, 1, 1, 3 );
l->addWidget( aBallLab, 9, 0 );
l->addWidget( aBallTotal, 9, 1 );
l->addWidget( a1DLine, 10, 1, 1, 3 );
l->addWidget( a1DLab, 11, 0 );
l->addWidget( a1DTotal, 11, 1 );
l->addWidget( a1DLin, 11, 2 );
l->addWidget( a1DQuad, 11, 3 );
l->addWidget( a2DLine, 12, 1, 1, 3 );
l->addWidget( a2DLab, 13, 0 );
l->addWidget( a2DTotal, 13, 1 );
l->addWidget( a2DLin, 13, 2 );
l->addWidget( a2DQuad, 13, 3 );
l->addWidget( a2DTriLab, 14, 0 );
l->addWidget( a2DTriTotal, 14, 1 );
l->addWidget( a2DTriLin, 14, 2 );
l->addWidget( a2DTriQuad, 14, 3 );
l->addWidget( a2DQuaLab, 15, 0 );
l->addWidget( a2DQuaTotal, 15, 1 );
l->addWidget( a2DQuaLin, 15, 2 );
l->addWidget( a2DQuaQuad, 15, 3 );
l->addWidget( a2DPolLab, 16, 0 );
l->addWidget( a2DPolTotal, 16, 1 );
l->addWidget( a3DLine, 17, 1, 1, 3 );
l->addWidget( a3DLab, 18, 0 );
l->addWidget( a3DTotal, 18, 1 );
l->addWidget( a3DLin, 18, 2 );
l->addWidget( a3DQuad, 18, 3 );
l->addWidget( a3DTetLab, 19, 0 );
l->addWidget( a3DTetTotal, 19, 1 );
l->addWidget( a3DTetLin, 19, 2 );
l->addWidget( a3DTetQuad, 19, 3 );
l->addWidget( a3DHexLab, 20, 0 );
l->addWidget( a3DHexTotal, 20, 1 );
l->addWidget( a3DHexLin, 20, 2 );
l->addWidget( a3DHexQuad, 20, 3 );
l->addWidget( a3DPyrLab, 21, 0 );
l->addWidget( a3DPyrTotal, 21, 1 );
l->addWidget( a3DPyrLin, 21, 2 );
l->addWidget( a3DPyrQuad, 21, 3 );
l->addWidget( a3DPriLab, 22, 0 );
l->addWidget( a3DPriTotal, 22, 1 );
l->addWidget( a3DPriLin, 22, 2 );
l->addWidget( a3DPriQuad, 22, 3 );
l->addWidget( a3DHexPriLab, 23, 0 );
l->addWidget( a3DHexPriTotal, 23, 1 );
l->addWidget( a3DPolLab, 24, 0 );
l->addWidget( a3DPolTotal, 24, 1 );
l->addWidget( myLoadBtn, 25, 1, 1, 3 );
l->setColumnStretch( 0, 0 );
l->setColumnStretch( 1, 5 );
l->setColumnStretch( 2, 5 );
@ -363,6 +379,9 @@ void SMESHGUI_MeshInfo::showInfo( SMESH::SMESH_IDSource_ptr obj )
case SMESH::ELEM0D:
objType = tr( "OBJECT_GROUP_0DELEMS" );
break;
case SMESH::BALL:
objType = tr( "OBJECT_GROUP_BALLS" );
break;
default:
objType = tr( "OBJECT_GROUP" );
break;
@ -372,6 +391,7 @@ void SMESHGUI_MeshInfo::showInfo( SMESH::SMESH_IDSource_ptr obj )
SMESH::long_array_var info = obj->GetMeshInfo();
myWidgets[iNodes][iTotal] ->setProperty( "text", QString::number( info[SMDSEntity_Node] ) );
myWidgets[i0D][iTotal] ->setProperty( "text", QString::number( info[SMDSEntity_0D] ) );
myWidgets[iBalls][iTotal] ->setProperty( "text", QString::number( info[SMDSEntity_Ball] ) );
long nbEdges = info[SMDSEntity_Edge] + info[SMDSEntity_Quad_Edge];
myWidgets[i1D][iTotal] ->setProperty( "text", QString::number( nbEdges ) );
myWidgets[i1D][iLinear] ->setProperty( "text", QString::number( info[SMDSEntity_Edge] ) );
@ -464,6 +484,7 @@ void SMESHGUI_MeshInfo::showInfo( SMESH::SMESH_IDSource_ptr obj )
{
myWidgets[iNodes][iTotal] ->setProperty( "text", "?" );
myWidgets[i0D][iTotal] ->setProperty( "text", "?" );
myWidgets[iBalls][iTotal] ->setProperty( "text", "?" );
myWidgets[i1D][iTotal] ->setProperty( "text", "?" );
myWidgets[i1D][iLinear] ->setProperty( "text", "?" );
myWidgets[i1D][iQuadratic] ->setProperty( "text", "?" );
@ -528,40 +549,41 @@ void SMESHGUI_MeshInfo::loadMesh()
*/
void SMESHGUI_MeshInfo::clear()
{
myWidgets[iName][iSingle]->setProperty( "text", QString() );
myWidgets[iObject][iSingle]->setProperty( "text", QString() );
myWidgets[iNodes][iTotal]->setProperty( "text", QString::number( 0 ) );
myWidgets[i0D][iTotal]->setProperty( "text", QString::number( 0 ) );
myWidgets[i1D][iTotal]->setProperty( "text", QString::number( 0 ) );
myWidgets[i1D][iLinear]->setProperty( "text", QString::number( 0 ) );
myWidgets[i1D][iQuadratic]->setProperty( "text", QString::number( 0 ) );
myWidgets[i2D][iTotal]->setProperty( "text", QString::number( 0 ) );
myWidgets[i2D][iLinear]->setProperty( "text", QString::number( 0 ) );
myWidgets[i2D][iQuadratic]->setProperty( "text", QString::number( 0 ) );
myWidgets[i2DTriangles][iTotal]->setProperty( "text", QString::number( 0 ) );
myWidgets[i2DTriangles][iLinear]->setProperty( "text", QString::number( 0 ) );
myWidgets[i2DTriangles][iQuadratic]->setProperty( "text", QString::number( 0 ) );
myWidgets[i2DQuadrangles][iTotal]->setProperty( "text", QString::number( 0 ) );
myWidgets[i2DQuadrangles][iLinear]->setProperty( "text", QString::number( 0 ) );
myWidgets[i2DQuadrangles][iQuadratic]->setProperty( "text", QString::number( 0 ) );
myWidgets[i2DPolygons][iTotal]->setProperty( "text", QString::number( 0 ) );
myWidgets[i3D][iTotal]->setProperty( "text", QString::number( 0 ) );
myWidgets[i3D][iLinear]->setProperty( "text", QString::number( 0 ) );
myWidgets[i3D][iQuadratic]->setProperty( "text", QString::number( 0 ) );
myWidgets[i3DTetrahedrons][iTotal]->setProperty( "text", QString::number( 0 ) );
myWidgets[i3DTetrahedrons][iLinear]->setProperty( "text", QString::number( 0 ) );
myWidgets[iName][iSingle] ->setProperty( "text", QString() );
myWidgets[iObject][iSingle] ->setProperty( "text", QString() );
myWidgets[iNodes][iTotal] ->setProperty( "text", QString::number( 0 ) );
myWidgets[i0D][iTotal] ->setProperty( "text", QString::number( 0 ) );
myWidgets[iBalls][iTotal] ->setProperty( "text", QString::number( 0 ) );
myWidgets[i1D][iTotal] ->setProperty( "text", QString::number( 0 ) );
myWidgets[i1D][iLinear] ->setProperty( "text", QString::number( 0 ) );
myWidgets[i1D][iQuadratic] ->setProperty( "text", QString::number( 0 ) );
myWidgets[i2D][iTotal] ->setProperty( "text", QString::number( 0 ) );
myWidgets[i2D][iLinear] ->setProperty( "text", QString::number( 0 ) );
myWidgets[i2D][iQuadratic] ->setProperty( "text", QString::number( 0 ) );
myWidgets[i2DTriangles][iTotal] ->setProperty( "text", QString::number( 0 ) );
myWidgets[i2DTriangles][iLinear] ->setProperty( "text", QString::number( 0 ) );
myWidgets[i2DTriangles][iQuadratic] ->setProperty( "text", QString::number( 0 ) );
myWidgets[i2DQuadrangles][iTotal] ->setProperty( "text", QString::number( 0 ) );
myWidgets[i2DQuadrangles][iLinear] ->setProperty( "text", QString::number( 0 ) );
myWidgets[i2DQuadrangles][iQuadratic] ->setProperty( "text", QString::number( 0 ) );
myWidgets[i2DPolygons][iTotal] ->setProperty( "text", QString::number( 0 ) );
myWidgets[i3D][iTotal] ->setProperty( "text", QString::number( 0 ) );
myWidgets[i3D][iLinear] ->setProperty( "text", QString::number( 0 ) );
myWidgets[i3D][iQuadratic] ->setProperty( "text", QString::number( 0 ) );
myWidgets[i3DTetrahedrons][iTotal] ->setProperty( "text", QString::number( 0 ) );
myWidgets[i3DTetrahedrons][iLinear] ->setProperty( "text", QString::number( 0 ) );
myWidgets[i3DTetrahedrons][iQuadratic]->setProperty( "text", QString::number( 0 ) );
myWidgets[i3DHexahedrons][iTotal]->setProperty( "text", QString::number( 0 ) );
myWidgets[i3DHexahedrons][iLinear]->setProperty( "text", QString::number( 0 ) );
myWidgets[i3DHexahedrons][iQuadratic]->setProperty( "text", QString::number( 0 ) );
myWidgets[i3DPyramids][iTotal]->setProperty( "text", QString::number( 0 ) );
myWidgets[i3DPyramids][iLinear]->setProperty( "text", QString::number( 0 ) );
myWidgets[i3DPyramids][iQuadratic]->setProperty( "text", QString::number( 0 ) );
myWidgets[i3DPrisms][iTotal]->setProperty( "text", QString::number( 0 ) );
myWidgets[i3DPrisms][iLinear]->setProperty( "text", QString::number( 0 ) );
myWidgets[i3DPrisms][iQuadratic]->setProperty( "text", QString::number( 0 ) );
myWidgets[i3DHexaPrisms][iTotal]->setProperty( "text", QString::number( 0 ) );
myWidgets[i3DPolyhedrons][iTotal]->setProperty( "text", QString::number( 0 ) );
myWidgets[i3DHexahedrons][iTotal] ->setProperty( "text", QString::number( 0 ) );
myWidgets[i3DHexahedrons][iLinear] ->setProperty( "text", QString::number( 0 ) );
myWidgets[i3DHexahedrons][iQuadratic] ->setProperty( "text", QString::number( 0 ) );
myWidgets[i3DPyramids][iTotal] ->setProperty( "text", QString::number( 0 ) );
myWidgets[i3DPyramids][iLinear] ->setProperty( "text", QString::number( 0 ) );
myWidgets[i3DPyramids][iQuadratic] ->setProperty( "text", QString::number( 0 ) );
myWidgets[i3DPrisms][iTotal] ->setProperty( "text", QString::number( 0 ) );
myWidgets[i3DPrisms][iLinear] ->setProperty( "text", QString::number( 0 ) );
myWidgets[i3DPrisms][iQuadratic] ->setProperty( "text", QString::number( 0 ) );
myWidgets[i3DHexaPrisms][iTotal] ->setProperty( "text", QString::number( 0 ) );
myWidgets[i3DPolyhedrons][iTotal] ->setProperty( "text", QString::number( 0 ) );
}
/*!
@ -869,10 +891,9 @@ void SMESHGUI_SimpleElemInfo::information( const QList<long>& ids )
//
// show node info
//
const SMDS_MeshElement* e = actor()->GetObject()->GetMesh()->FindNode( id );
if ( !e ) return;
const SMDS_MeshNode* node = static_cast<const SMDS_MeshNode*>( e );
const SMDS_MeshNode* node = actor()->GetObject()->GetMesh()->FindNode( id );
if ( !node ) return;
// node ID
myInfo->append( QString( "<b>%1 #%2</b>" ).arg( tr( "NODE" ) ).arg( id ) );
// separator
@ -894,6 +915,9 @@ void SMESHGUI_SimpleElemInfo::information( const QList<long>& ids )
con = formatConnectivity( connectivity, SMDSAbs_Edge );
if ( !con.isEmpty() )
myInfo->append( QString( "- <b>%1:</b> %2" ).arg( tr( "EDGES" ) ).arg( con ) );
con = formatConnectivity( connectivity, SMDSAbs_Ball );
if ( !con.isEmpty() )
myInfo->append( QString( "- <b>%1:</b> %2" ).arg( tr( "BALL_ELEMENTS" ) ).arg( con ) );
con = formatConnectivity( connectivity, SMDSAbs_Face );
if ( !con.isEmpty() )
myInfo->append( QString( "- <b>%1:</b> %2" ).arg( tr( "FACES" ) ).arg( con ) );
@ -917,6 +941,8 @@ void SMESHGUI_SimpleElemInfo::information( const QList<long>& ids )
switch( e->GetType() ) {
case SMDSAbs_0DElement:
stype = tr( "0D ELEMENT" ); break;
case SMDSAbs_Ball:
stype = tr( "BALL" ); break;
case SMDSAbs_Edge:
stype = tr( "EDGE" ); break;
case SMDSAbs_Face:
@ -967,7 +993,7 @@ void SMESHGUI_SimpleElemInfo::information( const QList<long>& ids )
if ( !gtype.isEmpty() )
myInfo->append( QString( "<b>%1:</b> %2" ).arg( tr( "TYPE" ) ).arg( gtype ) );
// quadratic flag and gravity center (any element except 0D)
if ( e->GetEntityType() > SMDSEntity_0D && e->GetEntityType() < SMDSEntity_Last ) {
if ( e->GetEntityType() > SMDSEntity_0D && e->GetEntityType() < SMDSEntity_Ball ) {
// quadratic flag
myInfo->append( QString( "<b>%1?</b> %2" ).arg( tr( "QUADRATIC" ) ).arg( e->IsQuadratic() ? tr( "YES" ) : tr( "NO" ) ) );
// separator
@ -976,6 +1002,10 @@ void SMESHGUI_SimpleElemInfo::information( const QList<long>& ids )
XYZ gc = gravityCenter( e );
myInfo->append( QString( "<b>%1:</b> (%2, %3, %4)" ).arg( tr( "GRAVITY_CENTER" ) ).arg( gc.x() ).arg( gc.y() ).arg( gc.z() ) );
}
if ( const SMDS_BallElement* ball = dynamic_cast<const SMDS_BallElement*>( e )) {
// ball diameter
myInfo->append( QString( "<b>%1:</b> %2" ).arg( tr( "BALL_DIAMETER" ) ).arg( ball->GetDiameter() ));
}
// separator
myInfo->append( "" );
// connectivity
@ -1129,6 +1159,12 @@ void SMESHGUI_TreeElemInfo::information( const QList<long>& ids )
i->setText( 0, tr( "0D_ELEMENTS" ) );
i->setText( 1, con );
}
con = formatConnectivity( connectivity, SMDSAbs_Ball );
if ( !con.isEmpty() ) {
QTreeWidgetItem* i = createItem( conItem );
i->setText( 0, tr( "BALL_ELEMENTS" ) );
i->setText( 1, con );
}
con = formatConnectivity( connectivity, SMDSAbs_Edge );
if ( !con.isEmpty() ) {
QTreeWidgetItem* i = createItem( conItem );
@ -1151,6 +1187,39 @@ void SMESHGUI_TreeElemInfo::information( const QList<long>& ids )
else {
conItem->setText( 1, tr( "FREE_NODE" ) );
}
// 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 = tr( "EDGE" );
u = static_cast<SMDS_EdgePosition*>( pos )->GetUParameter();
break;
case SMDS_TOP_FACE: shapeType = tr( "FACE" );
u = static_cast<SMDS_FacePosition*>( pos )->GetUParameter();
v = static_cast<SMDS_FacePosition*>( pos )->GetVParameter();
break;
case SMDS_TOP_VERTEX: shapeType = tr( "VERTEX" ); break;
default: shapeType = tr( "SOLID" );
}
QTreeWidgetItem* posItem = createItem( nodeItem, Bold );
posItem->setText( 0, tr("NODE_POSITION") );
posItem->setText( 1, (shapeType + " #%1").arg( shapeID ));
if ( posType == SMDS_TOP_EDGE || posType == SMDS_TOP_FACE ) {
QTreeWidgetItem* uItem = createItem( posItem );
uItem->setText( 0, tr("U_POSITION") );
uItem->setText( 1, QString::number( u, precision > 0 ? 'f' : 'g', qAbs( precision )));
if ( posType == SMDS_TOP_FACE ) {
QTreeWidgetItem* vItem = createItem( posItem );
vItem->setText( 0, tr("V_POSITION") );
vItem->setText( 1, QString::number( v, precision > 0 ? 'f' : 'g', qAbs( precision )));
}
}
}
}
else {
//
@ -1164,6 +1233,8 @@ void SMESHGUI_TreeElemInfo::information( const QList<long>& ids )
switch( e->GetType() ) {
case SMDSAbs_0DElement:
stype = tr( "0D ELEMENT" ); break;
case SMDSAbs_Ball:
stype = tr( "BALL" ); break;
case SMDSAbs_Edge:
stype = tr( "EDGE" ); break;
case SMDSAbs_Face:
@ -1217,7 +1288,7 @@ void SMESHGUI_TreeElemInfo::information( const QList<long>& ids )
typeItem->setText( 1, gtype );
}
// quadratic flag and gravity center (any element except 0D)
if ( e->GetEntityType() > SMDSEntity_0D && e->GetEntityType() < SMDSEntity_Last ) {
if ( e->GetEntityType() > SMDSEntity_0D && e->GetEntityType() < SMDSEntity_Ball ) {
// quadratic flag
QTreeWidgetItem* quadItem = createItem( elemItem, Bold );
quadItem->setText( 0, tr( "QUADRATIC" ) );
@ -1236,6 +1307,12 @@ void SMESHGUI_TreeElemInfo::information( const QList<long>& ids )
zItem->setText( 0, "Z" );
zItem->setText( 1, QString::number( gc.z(), precision > 0 ? 'f' : 'g', qAbs( precision ) ) );
}
if ( const SMDS_BallElement* ball = dynamic_cast<const SMDS_BallElement*>( e )) {
// ball diameter
QTreeWidgetItem* diamItem = createItem( elemItem, Bold );
diamItem->setText( 0, tr( "BALL_DIAMETER" ) );
diamItem->setText( 1, QString( "%1" ).arg( ball->GetDiameter() ));
}
// connectivity
QTreeWidgetItem* conItem = createItem( elemItem, Bold );
conItem->setText( 0, tr( "CONNECTIVITY" ) );
@ -1276,6 +1353,12 @@ void SMESHGUI_TreeElemInfo::information( const QList<long>& ids )
i->setText( 0, tr( "EDGES" ) );
i->setText( 1, con );
}
con = formatConnectivity( connectivity, SMDSAbs_Ball );
if ( !con.isEmpty() ) {
QTreeWidgetItem* i = createItem( nconItem );
i->setText( 0, tr( "BALL_ELEMENTS" ) );
i->setText( 1, con );
}
con = formatConnectivity( connectivity, SMDSAbs_Face );
if ( !con.isEmpty() ) {
QTreeWidgetItem* i = createItem( nconItem );
@ -1580,6 +1663,9 @@ void SMESHGUI_AddInfo::groupInfo( SMESH::SMESH_GroupBase_ptr grp, QTreeWidgetIte
case SMESH::ELEM0D:
etype = tr( "0DELEM" );
break;
case SMESH::BALL:
etype = tr( "BALL" );
break;
default:
break;
}
@ -1638,7 +1724,7 @@ void SMESHGUI_AddInfo::showGroups()
itemGroups = parent->child( i );
ExtraWidget* extra = dynamic_cast<ExtraWidget*>( itemWidget( itemGroups, 1 ) );
if ( extra )
extra->updateControls( myGroups->length(), idx );
extra->updateControls( myGroups->length(), idx );
while ( itemGroups->childCount() ) delete itemGroups->child( 0 ); // clear child items
}
}
@ -1660,11 +1746,11 @@ void SMESHGUI_AddInfo::showGroups()
// total number of groups > 10, show extra widgets for info browsing
if ( myGroups->length() > MAXITEMS ) {
ExtraWidget* extra = new ExtraWidget( this, true );
connect( extra->prev, SIGNAL( clicked() ), this, SLOT( showPreviousGroups() ) );
connect( extra->next, SIGNAL( clicked() ), this, SLOT( showNextGroups() ) );
setItemWidget( itemGroups, 1, extra );
extra->updateControls( myGroups->length(), idx );
ExtraWidget* extra = new ExtraWidget( this, true );
connect( extra->prev, SIGNAL( clicked() ), this, SLOT( showPreviousGroups() ) );
connect( extra->next, SIGNAL( clicked() ), this, SLOT( showNextGroups() ) );
setItemWidget( itemGroups, 1, extra );
extra->updateControls( myGroups->length(), idx );
}
}
@ -1696,7 +1782,7 @@ void SMESHGUI_AddInfo::showSubMeshes()
itemSubMeshes = parent->child( i );
ExtraWidget* extra = dynamic_cast<ExtraWidget*>( itemWidget( itemSubMeshes, 1 ) );
if ( extra )
extra->updateControls( mySubMeshes->length(), idx );
extra->updateControls( mySubMeshes->length(), idx );
while ( itemSubMeshes->childCount() ) delete itemSubMeshes->child( 0 ); // clear child items
}
}
@ -1721,11 +1807,11 @@ void SMESHGUI_AddInfo::showSubMeshes()
// total number of sub-meshes > 10, show extra widgets for info browsing
if ( mySubMeshes->length() > MAXITEMS ) {
ExtraWidget* extra = new ExtraWidget( this, true );
connect( extra->prev, SIGNAL( clicked() ), this, SLOT( showPreviousSubMeshes() ) );
connect( extra->next, SIGNAL( clicked() ), this, SLOT( showNextSubMeshes() ) );
setItemWidget( itemSubMeshes, 1, extra );
extra->updateControls( mySubMeshes->length(), idx );
ExtraWidget* extra = new ExtraWidget( this, true );
connect( extra->prev, SIGNAL( clicked() ), this, SLOT( showPreviousSubMeshes() ) );
connect( extra->next, SIGNAL( clicked() ), this, SLOT( showNextSubMeshes() ) );
setItemWidget( itemSubMeshes, 1, extra );
extra->updateControls( mySubMeshes->length(), idx );
}
}

View File

@ -67,7 +67,10 @@ class SMESHGUI_EXPORT SMESHGUI_MeshInfo : public QFrame
i0DStart,
i0D,
i0DEnd,
i1DStart = i0DEnd,
iBallsStart = i0DEnd,
iBalls,
iBallsEnd,
i1DStart = iBallsEnd,
i1D,
i1DEnd,
i2DStart = i1DEnd,

View File

@ -102,6 +102,17 @@ SMESHGUI_Preferences_ColorDlg::SMESHGUI_Preferences_ColorDlg( SMESHGUI* theModul
SpinBox_0DElements_Size->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
SpinBox_0DElements_Size->setButtonSymbols( QSpinBox::PlusMinus );
QLabel* TextLabel_BallElem_Color = new QLabel( tr( "0D_ELEMENTS_COLOR_LBL" ), ButtonGroup1 );
btnBallElemColor = new QtxColorButton( ButtonGroup1 );
QLabel* TextLabel_BallElem_Size = new QLabel( tr( "BALLELEM_SIZE_LBL" ), ButtonGroup1 );
SpinBox_BallElem_Size = new SalomeApp_IntSpinBox( ButtonGroup1 );
SpinBox_BallElem_Size->setAcceptNames( false ); // No Notebook variables allowed
SpinBox_BallElem_Size->setRange( 1, 10 );
SpinBox_BallElem_Size->setSingleStep( 1 );
SpinBox_BallElem_Size->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
SpinBox_BallElem_Size->setButtonSymbols( QSpinBox::PlusMinus );
QLabel* TextLabel_Width = new QLabel( tr( "LINE_WIDTH_LBL" ), ButtonGroup1 );
SpinBox_Width = new SalomeApp_IntSpinBox( ButtonGroup1 );
SpinBox_Width->setAcceptNames( false ); // No Notebook variables allowed
@ -132,6 +143,12 @@ SMESHGUI_Preferences_ColorDlg::SMESHGUI_Preferences_ColorDlg( SMESHGUI* theModul
ButtonGroup1Layout->addWidget( TextLabel_0DElements_Size, 2, 2 );
ButtonGroup1Layout->addWidget( SpinBox_0DElements_Size, 2, 3 );
ButtonGroup1Layout->addWidget( TextLabel_BallElem_Color, 2, 0 );
ButtonGroup1Layout->addWidget( btnBallElemColor, 2, 1 );
ButtonGroup1Layout->addWidget( TextLabel_BallElem_Size, 2, 2 );
ButtonGroup1Layout->addWidget( SpinBox_BallElem_Size, 2, 3 );
ButtonGroup1Layout->addWidget( TextLabel_Width, 3, 0 );
ButtonGroup1Layout->addWidget( SpinBox_Width, 3, 1 );
ButtonGroup1Layout->addWidget( TextLabel_ShrinkCoeff, 3, 2 );
@ -340,9 +357,10 @@ void SMESHGUI_Preferences_ColorDlg::SetColor( int type, const QColor& color )
case 3 : btnNodeColor->setColor( color ); break; // node
case 4 : btnOutlineColor->setColor( color ); break; // outline
case 5 : btn0DElementsColor->setColor( color ); break; // 0d elements
case 6 : btnOrientationColor->setColor( color ); break; // orientation of faces
case 7 : btnSelectionColor->setColor( color ); break; // selection color
case 8 : btnPreselectionColor->setColor( color ); break; // pre-selection color
case 6 : btnBallElemColor->setColor( color ); break; // ball elements
case 7 : btnOrientationColor->setColor( color ); break; // orientation of faces
case 8 : btnSelectionColor->setColor( color ); break; // selection color
case 9 : btnPreselectionColor->setColor( color ); break; // pre-selection color
default: break;
}
}
@ -360,9 +378,10 @@ QColor SMESHGUI_Preferences_ColorDlg::GetColor( int type )
case 3 : color = btnNodeColor->color(); break; // node
case 4 : color = btnOutlineColor->color(); break; // node
case 5 : color = btn0DElementsColor->color(); break; // 0d elements
case 6 : color = btnOrientationColor->color(); break; // orientation of faces
case 7 : color = btnSelectionColor->color(); break; // selection color
case 8 : color = btnPreselectionColor->color(); break; // pre-selection color
case 6 : color = btnBallElemColor->color(); break; // 0d elements
case 7 : color = btnOrientationColor->color(); break; // orientation of faces
case 8 : color = btnSelectionColor->color(); break; // selection color
case 9 : color = btnPreselectionColor->color(); break; // pre-selection color
default: break;
}
@ -379,6 +398,7 @@ void SMESHGUI_Preferences_ColorDlg::SetIntValue( int type, int value )
case 1 : SpinBox_Width->setValue( value ); break; // width
case 2 : SpinBox_Shrink->setValue( value ); break; // shrink coeff
case 3 : SpinBox_0DElements_Size->setValue( value ); break; // 0d elements
case 4 : SpinBox_BallElem_Size->setValue( value ); break; // 0d elements
default: break;
}
}
@ -394,6 +414,7 @@ int SMESHGUI_Preferences_ColorDlg::GetIntValue( int type )
case 1 : res = SpinBox_Width->value(); break; // width
case 2 : res = SpinBox_Shrink->value(); break; // shrink coeff
case 3 : res = SpinBox_0DElements_Size->value(); break; // 0d elements
case 4 : res = SpinBox_BallElem_Size->value(); break; // 0d elements
default: break;
}
return res;

View File

@ -91,7 +91,9 @@ private:
QtxColorButton* btnWireframeColor;
QtxColorButton* btnOutlineColor;
QtxColorButton* btn0DElementsColor;
QtxColorButton* btnBallElemColor;
SalomeApp_IntSpinBox* SpinBox_0DElements_Size;
SalomeApp_IntSpinBox* SpinBox_BallElem_Size;
SalomeApp_IntSpinBox* SpinBox_Width;
SalomeApp_IntSpinBox* SpinBox_Shrink;
QtxColorButton* btnNodeColor;

View File

@ -23,8 +23,9 @@
// SMESH SMESHGUI_Selection
// File : SMESHGUI_Selection.cxx
// Author : Alexander SOLOVYOV, Open CASCADE S.A.S.
// SMESH includes
//
// SMESH includes
#include "SMESHGUI_Selection.h"
#include "SMESHGUI_Utils.h"
@ -148,7 +149,7 @@ SMESH_Actor* SMESHGUI_Selection::getActor( int ind ) const
//=======================================================================
//function : elemTypes
//purpose : may return {'Elem0d' 'Edge' 'Face' 'Volume'} at most
//purpose : may return {'Elem0d' 'Edge' 'Face' 'Volume' 'BallElem'} at most
//=======================================================================
QList<QVariant> SMESHGUI_Selection::elemTypes( int ind ) const
@ -159,6 +160,7 @@ QList<QVariant> SMESHGUI_Selection::elemTypes( int ind ) const
TVisualObjPtr object = actor->GetObject();
if ( object ) {
if ( object->GetNbEntities( SMDSAbs_0DElement )) types.append( "Elem0d" );
if ( object->GetNbEntities( SMDSAbs_Ball )) types.append( "BallElem" );
if ( object->GetNbEntities( SMDSAbs_Edge )) types.append( "Edge" );
if ( object->GetNbEntities( SMDSAbs_Face )) types.append( "Face" );
if ( object->GetNbEntities( SMDSAbs_Volume )) types.append( "Volume" );
@ -248,7 +250,7 @@ QString SMESHGUI_Selection::shrinkMode( int ind ) const
//=======================================================================
//function : entityMode
//purpose : may return {'Elem0d' 'Edge' 'Face' 'Volume'} at most
//purpose : may return {'Elem0d' 'Edge' 'Face' 'Volume' 'BallElem' } at most
//=======================================================================
QList<QVariant> SMESHGUI_Selection::entityMode( int ind ) const
@ -261,6 +263,7 @@ QList<QVariant> SMESHGUI_Selection::entityMode( int ind ) const
if ( aMode & SMESH_Actor::eFaces ) types.append( "Face" );
if ( aMode & SMESH_Actor::eEdges ) types.append( "Edge" );
if ( aMode & SMESH_Actor::e0DElements ) types.append( "Elem0d" );
if ( aMode & SMESH_Actor::eBallElem ) types.append( "BallElem" );
}
return types;
}
@ -428,6 +431,7 @@ int SMESHGUI_Selection::dim( int ind ) const
case SMESH::FACE : dim = std::max( dim, 2 ); break;
case SMESH::VOLUME: dim = std::max( dim, 3 ); break;
case SMESH::ELEM0D: dim = std::max( dim, 0 ); break;
case SMESH::BALL : dim = std::max( dim, 0 ); break;
default:;
}
}

View File

@ -626,6 +626,8 @@ namespace SMESH
anActor->SetEdgeColor( aColor.R, aColor.G, aColor.B );
else if( aGroup->GetType() == SMESH::ELEM0D )
anActor->Set0DColor( aColor.R, aColor.G, aColor.B );
else if( aGroup->GetType() == SMESH::BALL )
anActor->SetBallColor( aColor.R, aColor.G, aColor.B );
else
anActor->SetSufaceColor( aColor.R, aColor.G, aColor.B, delta );
}
@ -897,10 +899,12 @@ namespace SMESH
aPreColor = mgr->colorValue( "SMESH", "highlight_color", Qt::cyan );
int aElem0DSize = mgr->integerValue("SMESH", "elem0d_size", 5);
int aBallSize = mgr->integerValue("SMESH", "ball_elem_size", 5);
int aLineWidth = mgr->integerValue("SMESH", "element_width", 1);
int maxSize = aElem0DSize;
if (aElem0DSize > maxSize) maxSize = aElem0DSize;
if (aLineWidth > maxSize) maxSize = aLineWidth;
if (aBallSize > maxSize) maxSize = aBallSize;
double SP1 = mgr->doubleValue( "SMESH", "selection_precision_node", 0.025 ),
SP2 = mgr->doubleValue( "SMESH", "selection_precision_element", 0.001 ),

View File

@ -95,6 +95,14 @@
<source>ICON_DLG_COPY_MESH</source>
<translation>copy_mesh.png</translation>
</message>
<message>
<source>ICON_DLG_BALL</source>
<translation>mesh_ball.png</translation>
</message>
<message>
<source>ICON_DLG_BALL_ELEMENT</source>
<translation>mesh_ball.png</translation>
</message>
<message>
<source>ICON_DLG_ELEM0D</source>
<translation>mesh_vertex.png</translation>

View File

@ -43,6 +43,10 @@
<source>ALL_FILES_FILTER</source>
<translation>All files</translation>
</message>
<message>
<source>SMESH_AND</source>
<translation>and</translation>
</message>
<message>
<source>AREA_ELEMENTS</source>
<translation>Area</translation>
@ -55,6 +59,18 @@
<source>ASPECTRATIO_ELEMENTS</source>
<translation>Aspect Ratio</translation>
</message>
<message>
<source>NODE_POSITION</source>
<translation>Position</translation>
</message>
<message>
<source>U_POSITION</source>
<translation>U</translation>
</message>
<message>
<source>V_POSITION</source>
<translation>V</translation>
</message>
<message>
<source>COL_ALGO_HEADER</source>
<translation>Algorithm</translation>
@ -331,6 +347,14 @@
<source>MEN_ELEMS0D</source>
<translation>0D Elements</translation>
</message>
<message>
<source>MEN_BALL</source>
<translation>Ball</translation>
</message>
<message>
<source>MEN_BALLS</source>
<translation>Balls</translation>
</message>
<message>
<source>MEN_EDGE</source>
<translation>Edge</translation>
@ -1047,6 +1071,14 @@ Please enter correct values and try again</translation>
<source>SMESH_ADD_ELEM0D_TITLE</source>
<translation>Add 0D Element</translation>
</message>
<message>
<source>SMESH_ADD_BALL</source>
<translation>Add Ball Element</translation>
</message>
<message>
<source>SMESH_ADD_BALL_TITLE</source>
<translation>Add Ball Element</translation>
</message>
<message>
<source>SMESH_ADD_EDGE</source>
<translation>Add Edge</translation>
@ -1423,10 +1455,30 @@ so that the application may crash. Do you wish to continue visualization?</trans
<source>SMESH_ELEM0D</source>
<translation>0D Element</translation>
</message>
<message>
<source>SMESH_ELEMS0D</source>
<translation>0D Elements</translation>
</message>
<message>
<source>SMESH_BALL_ELEM</source>
<translation>Ball</translation>
</message>
<message>
<source>SMESH_BALL</source>
<translation>Ball</translation>
</message>
<message>
<source>SMESH_BALLS</source>
<translation>Balls</translation>
</message>
<message>
<source>SMESH_EDGE</source>
<translation>Edge</translation>
</message>
<message>
<source>SMESH_EDGES</source>
<translation>Edges</translation>
</message>
<message>
<source>SMESH_EDGES_CONNECTIVITY_TITLE</source>
<translation>Edges Connectivity</translation>
@ -1511,17 +1563,10 @@ The result file may be incorrect.
Overwrite the file?</translation>
</message>
<message>
<source>SMESH_EXPORT_STL1</source>
<translation>Mesh - &quot;%1&quot; does not contain triangles</translation>
</message>
<message>
<source>SMESH_EXPORT_STL2</source>
<translation>Mesh - &quot;%1&quot; contains another than triangles elements, they are ignored during writing to STL</translation>
</message>
<message>
<source>SMESH_EXPORT_UNV</source>
<translation>During export mesh with name &quot;%1&quot; to UNV
pyramids, hexagonal prisms, polygons and polyhedra elements will be missed</translation>
<source>EXPORT_NOT_SUPPORTED</source>
<translation>During export mesh with name &quot;%1&quot; to %2
%3 will be missed.
Do you want to continue ?</translation>
</message>
<message>
<source>SMESH_EXTRUSION</source>
@ -1617,6 +1662,10 @@ add the exported data to its contents?</translation>
<source>SMESH_HEXAS</source>
<translation>Hexahedron</translation>
</message>
<message>
<source>SMESH_HEXAHEDRA</source>
<translation>Hexahedrons</translation>
</message>
<message>
<source>SMESH_HILIGHT_COLOR</source>
<translation>Highlight Color</translation>
@ -1994,6 +2043,10 @@ Check algorithm documentation for supported geometry</translation>
<source>SMESH_OCTA</source>
<translation>Hexagonal prism</translation>
</message>
<message>
<source>SMESH_OCTAHEDRA</source>
<translation>Hexagonal prisms</translation>
</message>
<message>
<source>TOP_OCTA</source>
<translation>Hexagonal prism</translation>
@ -2026,6 +2079,10 @@ Check algorithm documentation for supported geometry</translation>
<source>SMESH_PENTA</source>
<translation>Pentahedron</translation>
</message>
<message>
<source>SMESH_PENTAHEDRA</source>
<translation>Pentahedrons</translation>
</message>
<message>
<source>TOP_PENTA</source>
<translation>Pentahedron</translation>
@ -2066,10 +2123,34 @@ Check algorithm documentation for supported geometry</translation>
<source>SMESH_POLYEDRON</source>
<translation>Polyhedron</translation>
</message>
<message>
<source>SMESH_POLYEDRONS</source>
<translation>Polyhedrons</translation>
</message>
<message>
<source>SMESH_QUADRATIC_POLYEDRON</source>
<translation>Quadratic Polyhedron</translation>
</message>
<message>
<source>SMESH_QUADRATIC_POLYEDRONS</source>
<translation>Quadratic Polyhedrons</translation>
</message>
<message>
<source>SMESH_POLYGON</source>
<translation>Polygon</translation>
</message>
<message>
<source>SMESH_POLYGONS</source>
<translation>Polygons</translation>
</message>
<message>
<source>SMESH_QUADRATIC_POLYGON</source>
<translation>Quadratic Polygon</translation>
</message>
<message>
<source>SMESH_QUADRATIC_POLYGONS</source>
<translation>Quadratic Polygons</translation>
</message>
<message>
<source>SMESH_POSITION_SIZE_SCALARBAR</source>
<translation>Origin &amp;&amp; Size</translation>
@ -2110,6 +2191,10 @@ Check algorithm documentation for supported geometry</translation>
<source>SMESH_PYRAMID</source>
<translation>Pyramid</translation>
</message>
<message>
<source>SMESH_PYRAMIDS</source>
<translation>Pyramids</translation>
</message>
<message>
<source>MEN_PYRAMID</source>
<translation>Pyramid</translation>
@ -2126,18 +2211,34 @@ Check algorithm documentation for supported geometry</translation>
<source>SMESH_QUADRANGLE</source>
<translation>Quadrangle</translation>
</message>
<message>
<source>SMESH_QUADRANGLES</source>
<translation>Quadrangles</translation>
</message>
<message>
<source>SMESH_QUADRATIC_EDGE</source>
<translation>Quadratic Edge</translation>
</message>
<message>
<source>SMESH_QUADRATIC_EDGES</source>
<translation>Quadratic Edges</translation>
</message>
<message>
<source>SMESH_QUADRATIC_HEXAHEDRON</source>
<translation>Quadratic Hexahedron</translation>
</message>
<message>
<source>SMESH_QUADRATIC_HEXAHEDRONS</source>
<translation>Quadratic Hexahedrons</translation>
</message>
<message>
<source>SMESH_TRIQUADRATIC_HEXAHEDRON</source>
<translation>TriQuadratic Hexahedron</translation>
</message>
<message>
<source>SMESH_TRIQUADRATIC_HEXAHEDRONS</source>
<translation>TriQuadratic Hexahedrons</translation>
</message>
<message>
<source>TOP_TRIQUADRATIC_HEXAHEDRON</source>
<translation>TriQuadratic Hexahedron</translation>
@ -2154,18 +2255,34 @@ Check algorithm documentation for supported geometry</translation>
<source>SMESH_QUADRATIC_PENTAHEDRON</source>
<translation>Quadratic Pentahedron</translation>
</message>
<message>
<source>SMESH_QUADRATIC_PENTAHEDRONS</source>
<translation>Quadratic Pentahedrons</translation>
</message>
<message>
<source>SMESH_QUADRATIC_PYRAMID</source>
<translation>Quadratic Pyramid</translation>
</message>
<message>
<source>SMESH_QUADRATIC_PYRAMIDS</source>
<translation>Quadratic Pyramids</translation>
</message>
<message>
<source>SMESH_QUADRATIC_QUADRANGLE</source>
<translation>Quadratic Quadrangle</translation>
</message>
<message>
<source>SMESH_QUADRATIC_QUADRANGLES</source>
<translation>Quadratic Quadrangles</translation>
</message>
<message>
<source>SMESH_BIQUADRATIC_QUADRANGLE</source>
<translation>BiQuadratic Quadrangle</translation>
</message>
<message>
<source>SMESH_BIQUADRATIC_QUADRANGLES</source>
<translation>BiQuadratic Quadrangles</translation>
</message>
<message>
<source>MEN_BIQUADRATIC_QUADRANGLE</source>
<translation>BiQuadratic Quadrangle</translation>
@ -2182,10 +2299,18 @@ Check algorithm documentation for supported geometry</translation>
<source>SMESH_QUADRATIC_TETRAHEDRON</source>
<translation>Quadratic Tetrahedron</translation>
</message>
<message>
<source>SMESH_QUADRATIC_TETRAHEDRONS</source>
<translation>Quadratic Tetrahedrons</translation>
</message>
<message>
<source>SMESH_QUADRATIC_TRIANGLE</source>
<translation>Quadratic Triangle</translation>
</message>
<message>
<source>SMESH_QUADRATIC_TRIANGLES</source>
<translation>Quadratic Triangles</translation>
</message>
<message>
<source>SMESH_RANGE_MAX</source>
<translation>Max value:</translation>
@ -2299,6 +2424,10 @@ Check algorithm documentation for supported geometry</translation>
<source>SMESH_TETRAS</source>
<translation>Tetrahedron</translation>
</message>
<message>
<source>SMESH_TETRAHEDRA</source>
<translation>Tetrahedrons</translation>
</message>
<message>
<source>SMESH_TITLE</source>
<translation>Title:</translation>
@ -2355,6 +2484,10 @@ Check algorithm documentation for supported geometry</translation>
<source>SMESH_TRIANGLE</source>
<translation>Triangle</translation>
</message>
<message>
<source>SMESH_TRIANGLES</source>
<translation>Triangles</translation>
</message>
<message>
<source>SMESH_UPDATEVIEW</source>
<translation>Update View</translation>
@ -2655,6 +2788,14 @@ Please check preferences of Mesh module.
<source>STB_ELEMS0D</source>
<translation>0D Elements</translation>
</message>
<message>
<source>STB_BALLS</source>
<translation>Ball Elements</translation>
</message>
<message>
<source>STB_BALL</source>
<translation>Ball Element</translation>
</message>
<message>
<source>STB_EDGE</source>
<translation>Edge</translation>
@ -3247,6 +3388,14 @@ Please check preferences of Mesh module.
<source>TOP_ELEMS0D</source>
<translation>0D Elements</translation>
</message>
<message>
<source>TOP_BALL</source>
<translation>Ball</translation>
</message>
<message>
<source>TOP_BALLS</source>
<translation>Balls</translation>
</message>
<message>
<source>TOP_EDGE</source>
<translation>Edge</translation>
@ -3785,6 +3934,14 @@ Input value precision can be adjusted using
<source>MESH_LOADING_MSG_FINISHED</source>
<translation>Mesh %0 loading done</translation>
</message>
<message>
<source>BALL_DIAMETER</source>
<translation>Diameter</translation>
</message>
<message>
<source>BALL_ELEMENT</source>
<translation>Ball</translation>
</message>
<message>
<source>DEP_OBJECT</source>
<translation>Selected object has been used to create another one.
@ -4073,6 +4230,14 @@ Please, create VTK viewer and try again</translation>
<source>PREF_SIZE_0D</source>
<translation>Size of 0D elements</translation>
</message>
<message>
<source>PREF_BALL_COLOR</source>
<translation>Balls</translation>
</message>
<message>
<source>PREF_BALL_SIZE</source>
<translation>Size of ball elements</translation>
</message>
<message>
<source>PREF_WIDTH</source>
<translation>Width</translation>
@ -4849,6 +5014,10 @@ Please check input data and try again</translation>
<source>CRITERION</source>
<translation>Criterion</translation>
</message>
<message>
<source>BALLS</source>
<translation>Balls</translation>
</message>
<message>
<source>EDGES</source>
<translation>Edges</translation>
@ -5052,6 +5221,10 @@ Please enter correct value and try again</translation>
<source>GEOM_TYPE_10</source>
<translation>Polyhedra</translation>
</message>
<message>
<source>GEOM_TYPE_11</source>
<translation>Ball</translation>
</message>
</context>
<context>
<name>SMESHGUI_GroupOpDlg</name>
@ -6093,6 +6266,10 @@ as they are of improper type:
<source>0D_LAB</source>
<translation>0D:</translation>
</message>
<message>
<source>BALL_LAB</source>
<translation>Balls:</translation>
</message>
<message>
<source>1D_LAB</source>
<translation>1D (edges):</translation>
@ -6173,6 +6350,10 @@ as they are of improper type:
<source>OBJECT_GROUP_0DELEMS</source>
<translation>Group of 0D elements</translation>
</message>
<message>
<source>OBJECT_GROUP_BALLS</source>
<translation>Group of balls</translation>
</message>
<message>
<source>BUT_LOAD_MESH</source>
<translation>Load mesh from server</translation>
@ -6235,6 +6416,14 @@ as they are of improper type:
<source>0D_ELEMENTS</source>
<translation>0D ELEMENTS</translation>
</message>
<message>
<source>BALL_ELEMENT</source>
<translation>BALL ELEMENT</translation>
</message>
<message>
<source>BALL_ELEMENTS</source>
<translation>BALL ELEMENTS</translation>
</message>
<message>
<source>EDGE</source>
<translation>EDGE</translation>
@ -6354,6 +6543,10 @@ as they are of improper type:
<source>GROUPS_5</source>
<translation>0D elements</translation>
</message>
<message>
<source>GROUPS_6</source>
<translation>Ball elements</translation>
</message>
<message>
<source>PARENT_MESH</source>
<translation>Parent mesh</translation>
@ -6398,6 +6591,10 @@ as they are of improper type:
<source>0DELEM</source>
<translation>0D element</translation>
</message>
<message>
<source>BALL_ELEMENT</source>
<translation>ball</translation>
</message>
<message>
<source>UNKNOWN</source>
<translation>Unknown</translation>
@ -6631,6 +6828,14 @@ as they are of improper type:
<source>0D_ELEMENTS_SIZE_LBL</source>
<translation>Size of 0D elements</translation>
</message>
<message>
<source>BALL_ELEMENTS_COLOR_LBL</source>
<translation>Ball elements</translation>
</message>
<message>
<source>BALL_ELEMENTS_SIZE_LBL</source>
<translation>Size of balls</translation>
</message>
<message>
<source>LINE_WIDTH_LBL</source>
<translation>Line width</translation>

View File

@ -20,7 +20,6 @@
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses
// File : SMESH_2smeshpy.cxx
// Created : Fri Nov 18 13:20:10 2005
// Author : Edward AGAPOV (eap)
@ -228,6 +227,11 @@ namespace {
// - FT_EqualEdges = 15
// - FT_EqualFaces = 16
// - FT_EqualVolumes = 17
// v 6.6.0: FT_Undefined == 44, new items:
// - FT_BallDiameter = 37
//
// It's necessary to continue recording this history and to fill
// undef2newItems (see below) accordingly.
typedef map< int, vector< int > > TUndef2newItems;
static TUndef2newItems undef2newItems;
@ -242,6 +246,8 @@ namespace {
undef2newItems[ 39 ].assign( items, items+6 ); }
{ int items[] = { 14, 15, 16, 17 };
undef2newItems[ 43 ].assign( items, items+4 ); }
{ int items[] = { 37 };
undef2newItems[ 44 ].assign( items, items+1 ); }
}
int iType = Type.IntegerValue();
@ -651,10 +657,10 @@ Handle(_pyCommand) _pyGen::AddCommand( const TCollection_AsciiString& theCommand
if ( Type == "SMESH.FT_ElemGeomType" && Threshold.IsIntegerValue() )
{
// set SMESH.GeometryType instead of a numerical Threshold
const char* types[SMESH::Geom_POLYHEDRA+1] = {
const char* types[SMESH::Geom_BALL+1] = {
"Geom_POINT", "Geom_EDGE", "Geom_TRIANGLE", "Geom_QUADRANGLE", "Geom_POLYGON",
"Geom_TETRA", "Geom_PYRAMID", "Geom_HEXA", "Geom_PENTA", "Geom_HEXAGONAL_PRISM",
"Geom_POLYHEDRA"
"Geom_POLYHEDRA", "Geom_BALL"
};
int iGeom = Threshold.IntegerValue();
if ( -1 < iGeom && iGeom < SMESH::Geom_POLYHEDRA+1 )
@ -1908,7 +1914,7 @@ void _pyMeshEditor::Process( const Handle(_pyCommand)& theCommand)
static TStringSet sameMethods;
if ( sameMethods.empty() ) {
const char * names[] = {
"RemoveElements","RemoveNodes","RemoveOrphanNodes","AddNode","Add0DElement","AddEdge","AddFace","AddPolygonalFace",
"RemoveElements","RemoveNodes","RemoveOrphanNodes","AddNode","Add0DElement","AddEdge","AddFace","AddPolygonalFace","AddBall",
"AddVolume","AddPolyhedralVolume","AddPolyhedralVolumeByFaces","MoveNode", "MoveClosestNodeToPoint",
"InverseDiag","DeleteDiag","Reorient","ReorientObject","TriToQuad","SplitQuad","SplitQuadObject",
"BestSplit","Smooth","SmoothObject","SmoothParametric","SmoothParametricObject",

View File

@ -163,13 +163,14 @@ namespace SMESH
{
myStream<<"SMESH.";
switch(theArg){
case ALL: myStream<<"ALL";break;
case NODE: myStream<<"NODE";break;
case EDGE: myStream<<"EDGE";break;
case FACE: myStream<<"FACE";break;
case VOLUME:myStream<<"VOLUME";break;
case ELEM0D:myStream<<"ELEM0D";break;
default: myStream<<"__UNKNOWN__ElementType: " << theArg;
case ALL: myStream<<"ALL"; break;
case NODE: myStream<<"NODE"; break;
case EDGE: myStream<<"EDGE"; break;
case FACE: myStream<<"FACE"; break;
case VOLUME: myStream<<"VOLUME"; break;
case ELEM0D: myStream<<"ELEM0D"; break;
case BALL: myStream<<"BALL"; break;
default: myStream<<"__UNKNOWN__ElementType: " << theArg;
}
return *this;
}
@ -190,6 +191,7 @@ namespace SMESH
case Geom_HEXA: myStream<<"Geom_HEXA"; break;
case Geom_PENTA: myStream<<"Geom_PENTA"; break;
case Geom_POLYHEDRA: myStream<<"Geom_POLYHEDRA"; break;
case Geom_BALL: myStream<<"Geom_BALL"; break;
default: myStream<<"__UNKNOWN__GeometryType: " << theArg;
}
return *this;

View File

@ -848,6 +848,21 @@ FunctorType MultiConnection_i::GetFunctorType()
return SMESH::FT_MultiConnection;
}
/*
Class : BallDiameter_i
Description : Functor returning diameter of a ball element
*/
BallDiameter_i::BallDiameter_i()
{
myNumericalFunctorPtr.reset( new Controls::BallDiameter() );
myFunctorPtr = myNumericalFunctorPtr;
}
FunctorType BallDiameter_i::GetFunctorType()
{
return SMESH::FT_BallDiameter;
}
/*
Class : MultiConnection2D_i
Description : Functor for calculating number of faces conneted to the edge
@ -2058,6 +2073,14 @@ MultiConnection2D_ptr FilterManager_i::CreateMultiConnection2D()
return anObj._retn();
}
BallDiameter_ptr FilterManager_i::CreateBallDiameter()
{
SMESH::BallDiameter_i* aServant = new SMESH::BallDiameter_i();
SMESH::BallDiameter_var anObj = aServant->_this();
TPythonDump()<<aServant<<" = "<<this<<".CreateBallDiameter()";
return anObj._retn();
}
BelongToGeom_ptr FilterManager_i::CreateBelongToGeom()
{
SMESH::BelongToGeom_i* aServant = new SMESH::BelongToGeom_i();
@ -2893,6 +2916,9 @@ CORBA::Boolean Filter_i::SetCriteria( const SMESH::Filter::Criteria& theCriteria
case SMESH::FT_MaxElementLength3D:
aFunctor = aFilterMgr->CreateMaxElementLength3D();
break;
case SMESH::FT_BallDiameter:
aFunctor = aFilterMgr->CreateBallDiameter();
break;
// Predicates
@ -3840,17 +3866,51 @@ static const char** getFunctNames()
static const char* functName[ SMESH::FT_Undefined + 1 ] = {
// IT's necessary to update this array according to enum FunctorType (SMESH_Filter.idl)
// The order is IMPORTANT !!!
"FT_AspectRatio", "FT_AspectRatio3D", "FT_Warping", "FT_MinimumAngle",
"FT_Taper", "FT_Skew", "FT_Area", "FT_Volume3D", "FT_MaxElementLength2D",
"FT_MaxElementLength3D", "FT_FreeBorders", "FT_FreeEdges", "FT_FreeNodes",
"FT_FreeFaces","FT_EqualNodes","FT_EqualEdges","FT_EqualFaces","FT_EqualVolumes",
"FT_MultiConnection", "FT_MultiConnection2D", "FT_Length",
"FT_Length2D", "FT_BelongToGeom", "FT_BelongToPlane", "FT_BelongToCylinder",
"FT_BelongToGenSurface", "FT_LyingOnGeom", "FT_RangeOfIds", "FT_BadOrientedVolume",
"FT_BareBorderVolume", "FT_BareBorderFace", "FT_OverConstrainedVolume",
"FT_OverConstrainedFace", "FT_LinearOrQuadratic", "FT_GroupColor", "FT_ElemGeomType",
"FT_CoplanarFaces", "FT_LessThan", "FT_MoreThan", "FT_EqualTo", "FT_LogicalNOT",
"FT_LogicalAND", "FT_LogicalOR", "FT_Undefined" };
"FT_AspectRatio",
"FT_AspectRatio3D",
"FT_Warping",
"FT_MinimumAngle",
"FT_Taper",
"FT_Skew",
"FT_Area",
"FT_Volume3D",
"FT_MaxElementLength2D",
"FT_MaxElementLength3D",
"FT_FreeBorders",
"FT_FreeEdges",
"FT_FreeNodes",
"FT_FreeFaces",
"FT_EqualNodes",
"FT_EqualEdges",
"FT_EqualFaces",
"FT_EqualVolumes",
"FT_MultiConnection",
"FT_MultiConnection2D",
"FT_Length",
"FT_Length2D",
"FT_BelongToGeom",
"FT_BelongToPlane",
"FT_BelongToCylinder",
"FT_BelongToGenSurface",
"FT_LyingOnGeom",
"FT_RangeOfIds",
"FT_BadOrientedVolume",
"FT_BareBorderVolume",
"FT_BareBorderFace",
"FT_OverConstrainedVolume",
"FT_OverConstrainedFace",
"FT_LinearOrQuadratic",
"FT_GroupColor",
"FT_ElemGeomType",
"FT_CoplanarFaces",
"FT_BallDiameter",
"FT_LessThan",
"FT_MoreThan",
"FT_EqualTo",
"FT_LogicalNOT",
"FT_LogicalAND",
"FT_LogicalOR",
"FT_Undefined" };
return functName;
}

View File

@ -139,7 +139,7 @@ namespace SMESH
Description : An abstact class for all functors
*/
class SMESH_I_EXPORT Functor_i: public virtual POA_SMESH::Functor,
public virtual SALOME::GenericObj_i
public virtual SALOME::GenericObj_i
{
public:
void SetMesh( SMESH_Mesh_ptr theMesh );
@ -158,7 +158,7 @@ namespace SMESH
Description : Base class for numerical functors
*/
class SMESH_I_EXPORT NumericalFunctor_i: public virtual POA_SMESH::NumericalFunctor,
public virtual Functor_i
public virtual Functor_i
{
public:
CORBA::Double GetValue( CORBA::Long theElementId );
@ -177,7 +177,7 @@ namespace SMESH
Description : Functor for calculation of minimum angle
*/
class SMESH_I_EXPORT MinimumAngle_i: public virtual POA_SMESH::MinimumAngle,
public virtual NumericalFunctor_i
public virtual NumericalFunctor_i
{
public:
MinimumAngle_i();
@ -190,7 +190,7 @@ namespace SMESH
Description : Functor for calculating aspect ratio
*/
class SMESH_I_EXPORT AspectRatio_i: public virtual POA_SMESH::AspectRatio,
public virtual NumericalFunctor_i
public virtual NumericalFunctor_i
{
public:
AspectRatio_i();
@ -203,7 +203,7 @@ namespace SMESH
Description : Functor for calculating aspect ratio for 3D
*/
class SMESH_I_EXPORT AspectRatio3D_i: public virtual POA_SMESH::AspectRatio3D,
public virtual NumericalFunctor_i
public virtual NumericalFunctor_i
{
public:
AspectRatio3D_i();
@ -216,7 +216,7 @@ namespace SMESH
Description : Functor for calculating warping
*/
class SMESH_I_EXPORT Warping_i: public virtual POA_SMESH::Warping,
public virtual NumericalFunctor_i
public virtual NumericalFunctor_i
{
public:
Warping_i();
@ -229,7 +229,7 @@ namespace SMESH
Description : Functor for calculating taper
*/
class SMESH_I_EXPORT Taper_i: public virtual POA_SMESH::Taper,
public virtual NumericalFunctor_i
public virtual NumericalFunctor_i
{
public:
Taper_i();
@ -242,7 +242,7 @@ namespace SMESH
Description : Functor for calculating skew in degrees
*/
class SMESH_I_EXPORT Skew_i: public virtual POA_SMESH::Skew,
public virtual NumericalFunctor_i
public virtual NumericalFunctor_i
{
public:
Skew_i();
@ -255,7 +255,7 @@ namespace SMESH
Description : Functor for calculating area
*/
class SMESH_I_EXPORT Area_i: public virtual POA_SMESH::Area,
public virtual NumericalFunctor_i
public virtual NumericalFunctor_i
{
public:
Area_i();
@ -268,7 +268,7 @@ namespace SMESH
Description : Functor for calculating volume of 3D element
*/
class SMESH_I_EXPORT Volume3D_i: public virtual POA_SMESH::Volume3D,
public virtual NumericalFunctor_i
public virtual NumericalFunctor_i
{
public:
Volume3D_i();
@ -307,7 +307,7 @@ namespace SMESH
Description : Functor for calculating length of edge
*/
class SMESH_I_EXPORT Length_i: public virtual POA_SMESH::Length,
public virtual NumericalFunctor_i
public virtual NumericalFunctor_i
{
public:
Length_i();
@ -319,7 +319,7 @@ namespace SMESH
Description : Functor for calculating length of edge
*/
class SMESH_I_EXPORT Length2D_i: public virtual POA_SMESH::Length2D,
public virtual NumericalFunctor_i
public virtual NumericalFunctor_i
{
public:
Length2D_i();
@ -336,7 +336,7 @@ namespace SMESH
Description : Functor for calculating number of faces conneted to the edge
*/
class SMESH_I_EXPORT MultiConnection_i: public virtual POA_SMESH::MultiConnection,
public virtual NumericalFunctor_i
public virtual NumericalFunctor_i
{
public:
MultiConnection_i();
@ -348,7 +348,7 @@ namespace SMESH
Description : Functor for calculating number of faces conneted to the edge
*/
class SMESH_I_EXPORT MultiConnection2D_i: public virtual POA_SMESH::MultiConnection2D,
public virtual NumericalFunctor_i
public virtual NumericalFunctor_i
{
public:
MultiConnection2D_i();
@ -359,6 +359,18 @@ namespace SMESH
Controls::MultiConnection2DPtr myMulticonnection2DPtr;
};
/*
Class : BallDiameter_i
Description : Functor returning diameter of a ball element
*/
class SMESH_I_EXPORT BallDiameter_i: public virtual POA_SMESH::BallDiameter,
public virtual NumericalFunctor_i
{
public:
BallDiameter_i();
FunctorType GetFunctorType();
};
/*
PREDICATES
@ -368,7 +380,7 @@ namespace SMESH
Description : Base class for all predicates
*/
class SMESH_I_EXPORT Predicate_i: public virtual POA_SMESH::Predicate,
public virtual Functor_i
public virtual Functor_i
{
public:
CORBA::Boolean IsSatisfy( CORBA::Long theElementId );
@ -385,7 +397,7 @@ namespace SMESH
the point of view of MED convention
*/
class SMESH_I_EXPORT BadOrientedVolume_i: public virtual POA_SMESH::BadOrientedVolume,
public virtual Predicate_i
public virtual Predicate_i
{
public:
BadOrientedVolume_i();
@ -409,7 +421,7 @@ namespace SMESH
Description : Verify whether a mesh face has a free border without an edge on it
*/
class SMESH_I_EXPORT BareBorderFace_i: public virtual POA_SMESH::BareBorderFace,
public virtual Predicate_i
public virtual Predicate_i
{
public:
BareBorderFace_i();
@ -421,7 +433,7 @@ namespace SMESH
Description : Verify whether a mesh volume has only one facet shared with other volumes
*/
class SMESH_I_EXPORT OverConstrainedVolume_i: public virtual POA_SMESH::OverConstrainedVolume,
public virtual Predicate_i
public virtual Predicate_i
{
public:
OverConstrainedVolume_i();
@ -433,7 +445,7 @@ namespace SMESH
Description : Verify whether a mesh face has only one border shared with other faces
*/
class SMESH_I_EXPORT OverConstrainedFace_i: public virtual POA_SMESH::OverConstrainedFace,
public virtual Predicate_i
public virtual Predicate_i
{
public:
OverConstrainedFace_i();
@ -445,7 +457,7 @@ namespace SMESH
Description : Predicate for selection on geometrical support
*/
class SMESH_I_EXPORT BelongToGeom_i: public virtual POA_SMESH::BelongToGeom,
public virtual Predicate_i
public virtual Predicate_i
{
public:
BelongToGeom_i();
@ -476,7 +488,7 @@ namespace SMESH
Description : Verify whether mesh element lie in pointed Geom planar object
*/
class SMESH_I_EXPORT BelongToSurface_i: public virtual POA_SMESH::BelongToSurface,
public virtual Predicate_i
public virtual Predicate_i
{
public:
BelongToSurface_i( const Handle(Standard_Type)& );
@ -507,7 +519,7 @@ namespace SMESH
Description : Verify whether mesh element lie in pointed Geom planar object
*/
class SMESH_I_EXPORT BelongToPlane_i: public virtual POA_SMESH::BelongToPlane,
public virtual BelongToSurface_i
public virtual BelongToSurface_i
{
public:
BelongToPlane_i();
@ -520,7 +532,7 @@ namespace SMESH
Description : Verify whether mesh element lie in pointed Geom cylindrical object
*/
class SMESH_I_EXPORT BelongToCylinder_i: public virtual POA_SMESH::BelongToCylinder,
public virtual BelongToSurface_i
public virtual BelongToSurface_i
{
public:
BelongToCylinder_i();
@ -546,7 +558,7 @@ namespace SMESH
Description : Predicate for selection on geometrical support(lying or partially lying)
*/
class SMESH_I_EXPORT LyingOnGeom_i: public virtual POA_SMESH::LyingOnGeom,
public virtual Predicate_i
public virtual Predicate_i
{
public:
LyingOnGeom_i();
@ -577,7 +589,7 @@ namespace SMESH
Description : Predicate for free borders
*/
class SMESH_I_EXPORT FreeBorders_i: public virtual POA_SMESH::FreeBorders,
public virtual Predicate_i
public virtual Predicate_i
{
public:
FreeBorders_i();
@ -590,7 +602,7 @@ namespace SMESH
Description : Predicate for free edges
*/
class SMESH_I_EXPORT FreeEdges_i: public virtual POA_SMESH::FreeEdges,
public virtual Predicate_i
public virtual Predicate_i
{
public:
FreeEdges_i();
@ -607,7 +619,7 @@ namespace SMESH
Description : Predicate for free faces
*/
class SMESH_I_EXPORT FreeFaces_i: public virtual POA_SMESH::FreeFaces,
public virtual Predicate_i
public virtual Predicate_i
{
public:
FreeFaces_i();
@ -620,7 +632,7 @@ namespace SMESH
Description : Predicate for free nodes
*/
class SMESH_I_EXPORT FreeNodes_i: public virtual POA_SMESH::FreeNodes,
public virtual Predicate_i
public virtual Predicate_i
{
public:
FreeNodes_i();
@ -684,7 +696,7 @@ namespace SMESH
Description : Predicate for Range of Ids
*/
class SMESH_I_EXPORT RangeOfIds_i: public virtual POA_SMESH::RangeOfIds,
public virtual Predicate_i
public virtual Predicate_i
{
public:
RangeOfIds_i();
@ -704,7 +716,7 @@ namespace SMESH
Description : Verify whether a mesh element is linear
*/
class SMESH_I_EXPORT LinearOrQuadratic_i: public virtual POA_SMESH::LinearOrQuadratic,
public virtual Predicate_i
public virtual Predicate_i
{
public:
LinearOrQuadratic_i();
@ -720,7 +732,7 @@ namespace SMESH
Description : Functor for check color of group to whic mesh element belongs to
*/
class SMESH_I_EXPORT GroupColor_i: public virtual POA_SMESH::GroupColor,
public virtual Predicate_i
public virtual Predicate_i
{
public:
GroupColor_i();
@ -739,7 +751,7 @@ namespace SMESH
Description : Functor for check element geometry type
*/
class SMESH_I_EXPORT ElemGeomType_i: public virtual POA_SMESH::ElemGeomType,
public virtual Predicate_i
public virtual Predicate_i
{
public:
ElemGeomType_i();
@ -758,7 +770,7 @@ namespace SMESH
Description : Returns true if a mesh face is a coplanar neighbour to a given one
*/
class SMESH_I_EXPORT CoplanarFaces_i: public virtual POA_SMESH::CoplanarFaces,
public virtual Predicate_i
public virtual Predicate_i
{
public:
CoplanarFaces_i();
@ -778,7 +790,7 @@ namespace SMESH
Description : Base class for comparators
*/
class SMESH_I_EXPORT Comparator_i: public virtual POA_SMESH::Comparator,
public virtual Predicate_i
public virtual Predicate_i
{
public:
virtual ~Comparator_i();
@ -803,7 +815,7 @@ namespace SMESH
Description : Comparator "<"
*/
class SMESH_I_EXPORT LessThan_i: public virtual POA_SMESH::LessThan,
public virtual Comparator_i
public virtual Comparator_i
{
public:
LessThan_i();
@ -816,7 +828,7 @@ namespace SMESH
Description : Comparator ">"
*/
class SMESH_I_EXPORT MoreThan_i: public virtual POA_SMESH::MoreThan,
public virtual Comparator_i
public virtual Comparator_i
{
public:
MoreThan_i();
@ -829,7 +841,7 @@ namespace SMESH
Description : Comparator "="
*/
class SMESH_I_EXPORT EqualTo_i: public virtual POA_SMESH::EqualTo,
public virtual Comparator_i
public virtual Comparator_i
{
public:
EqualTo_i();
@ -847,7 +859,7 @@ namespace SMESH
Description : Logical NOT predicate
*/
class SMESH_I_EXPORT LogicalNOT_i: public virtual POA_SMESH::LogicalNOT,
public virtual Predicate_i
public virtual Predicate_i
{
public:
LogicalNOT_i();
@ -868,7 +880,7 @@ namespace SMESH
Description : Base class for binary logical predicate
*/
class SMESH_I_EXPORT LogicalBinary_i: public virtual POA_SMESH::LogicalBinary,
public virtual Predicate_i
public virtual Predicate_i
{
public:
virtual ~LogicalBinary_i();
@ -894,7 +906,7 @@ namespace SMESH
Description : Logical AND
*/
class SMESH_I_EXPORT LogicalAND_i: public virtual POA_SMESH::LogicalAND,
public virtual LogicalBinary_i
public virtual LogicalBinary_i
{
public:
LogicalAND_i();
@ -907,7 +919,7 @@ namespace SMESH
Description : Logical OR
*/
class SMESH_I_EXPORT LogicalOR_i: public virtual POA_SMESH::LogicalOR,
public virtual LogicalBinary_i
public virtual LogicalBinary_i
{
public:
LogicalOR_i();
@ -1036,7 +1048,7 @@ namespace SMESH
*/
class SMESH_I_EXPORT FilterManager_i: public virtual POA_SMESH::FilterManager,
public virtual SALOME::GenericObj_i
public virtual SALOME::GenericObj_i
{
public:
FilterManager_i();
@ -1056,6 +1068,7 @@ namespace SMESH
Length2D_ptr CreateLength2D();
MultiConnection_ptr CreateMultiConnection();
MultiConnection2D_ptr CreateMultiConnection2D();
BallDiameter_ptr CreateBallDiameter();
BelongToGeom_ptr CreateBelongToGeom();
BelongToPlane_ptr CreateBelongToPlane();

View File

@ -2186,17 +2186,20 @@ SMESH_Gen_i::ConcatenateCommon(const SMESH::mesh_array& theMeshesArray,
int anNbEdges = 0;
int anNbFaces = 0;
int anNbVolumes = 0;
int aNbBalls = 0;
SMESH::long_array_var anIDsNodes = new SMESH::long_array();
SMESH::long_array_var anIDsEdges = new SMESH::long_array();
SMESH::long_array_var anIDsFaces = new SMESH::long_array();
SMESH::long_array_var anIDsVolumes = new SMESH::long_array();
SMESH::long_array_var anIDsBalls = new SMESH::long_array();
if( theCommonGroups ) {
anIDsNodes->length( anInitMeshDS->NbNodes() );
anIDsEdges->length( anInitMeshDS->NbEdges() );
anIDsFaces->length( anInitMeshDS->NbFaces() );
anIDsVolumes->length( anInitMeshDS->NbVolumes() );
anIDsBalls->length( anInitMeshDS->NbBalls() );
}
for ( int j = 0; itElems->more(); j++) {
@ -2224,32 +2227,45 @@ SMESH_Gen_i::ConcatenateCommon(const SMESH::mesh_array& theMeshesArray,
}//nodes loop
// creates a corresponding element on existent nodes in new mesh
if ( anElem->IsPoly() && anElemType == SMDSAbs_Volume )
switch ( anElem->GetEntityType() ) {
case SMDSEntity_Polyhedra:
if ( const SMDS_VtkVolume* aVolume =
dynamic_cast<const SMDS_VtkVolume*> (anElem))
{
const SMDS_VtkVolume* aVolume =
dynamic_cast<const SMDS_VtkVolume*> (anElem);
if ( aVolume ) {
aNewElem = aNewMeshDS->AddPolyhedralVolume(aNodesArray,
aVolume->GetQuantities());
elemsMap.insert(make_pair(anElem->GetID(), aNewElem->GetID()));
if( theCommonGroups )
aNewElem = aNewMeshDS->AddPolyhedralVolume(aNodesArray,
aVolume->GetQuantities());
elemsMap.insert(make_pair(anElem->GetID(), aNewElem->GetID()));
if( theCommonGroups )
anIDsVolumes[anNbVolumes++] = aNewElem->GetID();
}
break;
case SMDSEntity_Ball:
if ( const SMDS_BallElement* aBall =
dynamic_cast<const SMDS_BallElement*> (anElem))
{
aNewElem = aNewEditor.AddElement(aNodesArray, SMDSAbs_Ball,
/*isPoly=*/false, /*id=*/0,
aBall->GetDiameter() );
elemsMap.insert(make_pair(anElem->GetID(), aNewElem->GetID()));
if( theCommonGroups )
anIDsBalls[aNbBalls++] = aNewElem->GetID();
}
break;
default:
{
aNewElem = aNewEditor.AddElement(aNodesArray,
anElemType,
anElem->IsPoly());
elemsMap.insert(make_pair(anElem->GetID(), aNewElem->GetID()));
if( theCommonGroups ) {
if( anElemType == SMDSAbs_Edge )
anIDsEdges[anNbEdges++] = aNewElem->GetID();
else if( anElemType == SMDSAbs_Face )
anIDsFaces[anNbFaces++] = aNewElem->GetID();
else if( anElemType == SMDSAbs_Volume )
anIDsVolumes[anNbVolumes++] = aNewElem->GetID();
}
}
else {
aNewElem = aNewEditor.AddElement(aNodesArray,
anElemType,
anElem->IsPoly());
elemsMap.insert(make_pair(anElem->GetID(), aNewElem->GetID()));
if( theCommonGroups ) {
if( anElemType == SMDSAbs_Edge )
anIDsEdges[anNbEdges++] = aNewElem->GetID();
else if( anElemType == SMDSAbs_Face )
anIDsFaces[anNbFaces++] = aNewElem->GetID();
else if( anElemType == SMDSAbs_Volume )
anIDsVolumes[anNbVolumes++] = aNewElem->GetID();
}
}
}//elems loop
@ -2280,7 +2296,7 @@ SMESH_Gen_i::ConcatenateCommon(const SMESH::mesh_array& theMeshesArray,
SMESH::ElementType aGroupType;
CORBA::String_var aGroupName;
if ( theCommonGroups ) {
for(aGroupType=SMESH::NODE;aGroupType<=SMESH::VOLUME;aGroupType=(SMESH::ElementType)(aGroupType+1)) {
for(aGroupType=SMESH::NODE;aGroupType<=SMESH::BALL;aGroupType=(SMESH::ElementType)(aGroupType+1)) {
string str = "Gr";
SALOMEDS::SObject_var aMeshSObj = ObjectToSObject( myCurrentStudy, anInitMesh );
if(aMeshSObj)
@ -2310,6 +2326,11 @@ SMESH_Gen_i::ConcatenateCommon(const SMESH::mesh_array& theMeshesArray,
anIDsVolumes->length(anNbVolumes);
anLen = anNbVolumes;
break;
case SMESH::BALL:
str += "Balls";
anIDsBalls->length(aNbBalls);
anLen = aNbBalls;
break;
default:
break;
}
@ -2333,6 +2354,9 @@ SMESH_Gen_i::ConcatenateCommon(const SMESH::mesh_array& theMeshesArray,
case SMESH::VOLUME:
aNewGroup->Add( anIDsVolumes );
break;
case SMESH::BALL:
aNewGroup->Add( anIDsBalls );
break;
default:
break;
}
@ -2442,13 +2466,8 @@ SMESH_Gen_i::ConcatenateCommon(const SMESH::mesh_array& theMeshesArray,
// IPAL21468 Change icon of compound because it need not be computed.
SALOMEDS::SObject_var aMeshSObj = ObjectToSObject( myCurrentStudy, aNewMesh );
if( !aMeshSObj->_is_nil() ) {
SALOMEDS::GenericAttribute_var anAttr;
SALOMEDS::StudyBuilder_var aBuilder = myCurrentStudy->NewBuilder();
anAttr = aBuilder->FindOrCreateAttribute( aMeshSObj,"AttributePixMap" );
SALOMEDS::AttributePixMap_var aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr);
aPixmap->SetPixMap("ICON_SMESH_TREE_MESH");
}
SetPixMap( aMeshSObj, "ICON_SMESH_TREE_MESH" );
if (aNewMeshDS)
aNewMeshDS->Modified();
return aNewMesh._retn();
@ -2544,6 +2563,7 @@ SMESH::SMESH_Mesh_ptr SMESH_Gen_i::CopyMesh(SMESH::SMESH_IDSource_ptr meshPart,
while ( srcElemIt->more() )
{
const SMDS_MeshElement * elem = srcElemIt->next();
// find / add nodes
nodes.resize( elem->NbNodes());
SMDS_ElemIteratorPtr nIt = elem->nodesIterator();
if ( toKeepIDs ) {
@ -2566,22 +2586,30 @@ SMESH::SMESH_Mesh_ptr SMESH_Gen_i::CopyMesh(SMESH::SMESH_IDSource_ptr meshPart,
nodes[ iN ] = (const SMDS_MeshNode*) n2n->second;
}
}
// add elements
if ( elem->GetType() != SMDSAbs_Node )
{
int ID = toKeepIDs ? elem->GetID() : 0;
const SMDS_MeshElement * newElem;
if ( elem->GetEntityType() == SMDSEntity_Polyhedra )
switch ( elem->GetEntityType() ) {
case SMDSEntity_Polyhedra:
newElem = editor.GetMeshDS()->
AddPolyhedralVolumeWithID( nodes,
static_cast<const SMDS_VtkVolume*>(elem)->GetQuantities(),
elem->GetID());
else
ID);
break;
case SMDSEntity_Ball:
newElem = editor.AddElement( nodes, SMDSAbs_Ball, false, ID,
static_cast<const SMDS_BallElement*>(elem)->GetDiameter());
break;
default:
newElem = editor.AddElement( nodes,elem->GetType(),elem->IsPoly(),ID);
if ( toCopyGroups && !toKeepIDs )
e2eMapByType[ elem->GetType() ].insert( make_pair( elem, newElem ));
}
}
}
} // while ( srcElemIt->more() )
// 4(b). Copy free nodes
@ -3368,7 +3396,7 @@ SALOMEDS::TMPFile* SMESH_Gen_i::Save( SALOMEDS::SComponent_ptr theComponent,
// groups root sub-branch
SALOMEDS::SObject_var myGroupsBranch;
for ( int i = GetNodeGroupsTag(); i <= Get0DElementsGroupsTag(); i++ ) {
for ( int i = GetNodeGroupsTag(); i <= GetBallElementsGroupsTag(); i++ ) {
found = gotBranch->FindSubObject( i, myGroupsBranch );
if ( found ) {
char name_group[ 30 ];
@ -3382,6 +3410,8 @@ SALOMEDS::TMPFile* SMESH_Gen_i::Save( SALOMEDS::SComponent_ptr theComponent,
strcpy( name_group, "Groups of Volumes" );
else if ( i == Get0DElementsGroupsTag() )
strcpy( name_group, "Groups of 0D Elements" );
else if ( i == GetBallElementsGroupsTag() )
strcpy( name_group, "Groups of Balls" );
aGroup = new HDFgroup( name_group, aTopGroup );
aGroup->CreateOnDisk();
@ -4427,7 +4457,7 @@ bool SMESH_Gen_i::Load( SALOMEDS::SComponent_ptr theComponent,
}
// try to get GROUPS
for ( int ii = GetNodeGroupsTag(); ii <= Get0DElementsGroupsTag(); ii++ ) {
for ( int ii = GetNodeGroupsTag(); ii <= GetBallElementsGroupsTag(); ii++ ) {
char name_group[ 30 ];
if ( ii == GetNodeGroupsTag() )
strcpy( name_group, "Groups of Nodes" );
@ -4439,6 +4469,8 @@ bool SMESH_Gen_i::Load( SALOMEDS::SComponent_ptr theComponent,
strcpy( name_group, "Groups of Volumes" );
else if ( ii == Get0DElementsGroupsTag() )
strcpy( name_group, "Groups of 0D Elements" );
else if ( ii == GetBallElementsGroupsTag() )
strcpy( name_group, "Groups of Balls" );
if ( aTopGroup->ExistInternalObject( name_group ) ) {
aGroup = new HDFgroup( name_group, aTopGroup );

View File

@ -490,6 +490,7 @@ public:
static long GetFaceGroupsTag();
static long GetVolumeGroupsTag();
static long Get0DElementsGroupsTag();
static long GetBallElementsGroupsTag();
// publishing methods
SALOMEDS::SComponent_ptr PublishComponent(SALOMEDS::Study_ptr theStudy);

View File

@ -38,6 +38,7 @@
#include "Utils_ExceptHandlers.hxx"
#include <TCollection_AsciiString.hxx>
#include <TopoDS_Solid.hxx>
#ifdef _DEBUG_
static int MYDEBUG = 0;
@ -140,6 +141,11 @@ long SMESH_Gen_i::Get0DElementsGroupsTag()
return SMESH::Tag_0DElementsGroups;
}
long SMESH_Gen_i::GetBallElementsGroupsTag()
{
return SMESH::Tag_BallElementsGroups;
}
//=============================================================================
/*!
* SMESH_Gen_i::CanPublishInStudy
@ -683,16 +689,18 @@ SALOMEDS::SObject_ptr SMESH_Gen_i::PublishGroup (SALOMEDS::Study_ptr theStudy
int aType = (int)theGroup->GetType();
const char* aRootNames[] = {
"Compound Groups", "Groups of Nodes", "Groups of Edges",
"Groups of Faces", "Groups of Volumes", "Groups of 0D Elements" };
"Groups of Faces", "Groups of Volumes", "Groups of 0D Elements",
"Groups of Balls" };
// Currently, groups with heterogenous content are not supported
if ( aType != SMESH::ALL ) {
if ( aType != SMESH::ALL )
{
long aRootTag = GetNodeGroupsTag() + aType - 1;
// Find or create groups root
SALOMEDS::SObject_var aRootSO = publish (theStudy, CORBA::Object::_nil(),
aMeshSO, aRootTag, 0, false );
if ( aType < 6 )
if ( aType < sizeof(aRootNames)/sizeof(char*) )
SetName( aRootSO, aRootNames[aType] );
// Add new group to corresponding sub-tree

View File

@ -196,6 +196,7 @@ SMESH::ElementType SMESH_GroupBase_i::GetType()
case SMDSAbs_Face: aType = SMESH::FACE; break;
case SMDSAbs_Volume: aType = SMESH::VOLUME; break;
case SMDSAbs_0DElement: aType = SMESH::ELEM0D; break;
case SMDSAbs_Ball: aType = SMESH::BALL; break;
default: aType = SMESH::ALL; break;
}
return aType;
@ -464,12 +465,15 @@ SMESH::long_array* SMESH_GroupBase_i::GetListOfID()
SMESH::long_array_var aRes = new SMESH::long_array();
SMESHDS_GroupBase* aGroupDS = GetGroupDS();
if (aGroupDS) {
if (aGroupDS)
{
int aSize = aGroupDS->Extent();
aRes->length(aSize);
for (int i = 0; i < aSize; i++)
aRes[i] = aGroupDS->GetID(i+1);
return aRes._retn();
if ( 0 < aSize && aSize < 100 ) // for comfortable testing ;)
std::sort( &aRes[0], &aRes[0]+aSize );
}
MESSAGE("get list of IDs of a vague group");
return aRes._retn();

View File

@ -2848,13 +2848,14 @@ class SMESH_MeshPartDS : public SMESHDS_Mesh
public:
SMESH_MeshPartDS(SMESH::SMESH_IDSource_ptr meshPart);
virtual SMDS_NodeIteratorPtr nodesIterator (bool idInceasingOrder=false) const;
virtual SMDS_0DElementIteratorPtr elements0dIterator(bool idInceasingOrder=false) const;
virtual SMDS_EdgeIteratorPtr edgesIterator (bool idInceasingOrder=false) const;
virtual SMDS_FaceIteratorPtr facesIterator (bool idInceasingOrder=false) const;
virtual SMDS_VolumeIteratorPtr volumesIterator (bool idInceasingOrder=false) const;
virtual SMDS_NodeIteratorPtr nodesIterator (bool idInceasingOrder=false) const;
virtual SMDS_EdgeIteratorPtr edgesIterator (bool idInceasingOrder=false) const;
virtual SMDS_FaceIteratorPtr facesIterator (bool idInceasingOrder=false) const;
virtual SMDS_VolumeIteratorPtr volumesIterator (bool idInceasingOrder=false) const;
virtual SMDS_ElemIteratorPtr elementsIterator(SMDSAbs_ElementType type=SMDSAbs_All) const;
virtual SMDS_ElemIteratorPtr elementGeomIterator(SMDSAbs_GeometryType type) const;
virtual SMDS_ElemIteratorPtr elementEntityIterator(SMDSAbs_EntityType type) const;
private:
TIDSortedElemSet _elements[ SMDSAbs_NbElementTypes ];
@ -3031,7 +3032,7 @@ CORBA::Long SMESH_Mesh_i::NbElements()throw (SALOME::SALOME_Exception)
if ( _preMeshInfo )
return _preMeshInfo->NbElements();
return Nb0DElements() + NbEdges() + NbFaces() + NbVolumes();
return Nb0DElements() + NbEdges() + NbFaces() + NbVolumes() + NbBalls();
}
CORBA::Long SMESH_Mesh_i::Nb0DElements()throw (SALOME::SALOME_Exception)
@ -3043,6 +3044,15 @@ CORBA::Long SMESH_Mesh_i::Nb0DElements()throw (SALOME::SALOME_Exception)
return _impl->Nb0DElements();
}
CORBA::Long SMESH_Mesh_i::NbBalls() throw (SALOME::SALOME_Exception)
{
Unexpect aCatch(SALOME_SalomeException);
if ( _preMeshInfo )
return _preMeshInfo->NbBalls();
return _impl->NbBalls();
}
CORBA::Long SMESH_Mesh_i::NbEdges()throw(SALOME::SALOME_Exception)
{
Unexpect aCatch(SALOME_SalomeException);
@ -3997,6 +4007,23 @@ CORBA::Boolean SMESH_Mesh_i::IsQuadratic(const CORBA::Long id)
return elem->IsQuadratic();
}
//=============================================================================
/*!
* Returns diameter of ball discrete element or zero in case of an invalid \a id
*/
//=============================================================================
CORBA::Double SMESH_Mesh_i::GetBallDiameter(CORBA::Long id)
{
if ( _preMeshInfo )
_preMeshInfo->FullLoadFromFile();
if ( const SMDS_BallElement* ball =
dynamic_cast<const SMDS_BallElement*>( _impl->GetMeshDS()->FindElement( id )))
return ball->GetDiameter();
return 0;
}
//=============================================================================
/*!
@ -4253,16 +4280,13 @@ SMESH::array_of_ElementType* SMESH_Mesh_i::GetTypes()
SMESH::array_of_ElementType_var types = new SMESH::array_of_ElementType;
types->length( 4 );
types->length( 5 );
int nbTypes = 0;
if (_impl->NbEdges())
types[nbTypes++] = SMESH::EDGE;
if (_impl->NbFaces())
types[nbTypes++] = SMESH::FACE;
if (_impl->NbVolumes())
types[nbTypes++] = SMESH::VOLUME;
if (_impl->Nb0DElements())
types[nbTypes++] = SMESH::ELEM0D;
if (_impl->NbEdges()) types[nbTypes++] = SMESH::EDGE;
if (_impl->NbFaces()) types[nbTypes++] = SMESH::FACE;
if (_impl->NbVolumes()) types[nbTypes++] = SMESH::VOLUME;
if (_impl->Nb0DElements()) types[nbTypes++] = SMESH::ELEM0D;
if (_impl->NbBalls()) types[nbTypes++] = SMESH::BALL;
types->length( nbTypes );
return types._retn();
@ -4821,6 +4845,42 @@ SMESH_MeshPartDS::SMESH_MeshPartDS(SMESH::SMESH_IDSource_ptr meshPart):
}
}
// -------------------------------------------------------------------------------------
SMDS_ElemIteratorPtr SMESH_MeshPartDS::elementGeomIterator(SMDSAbs_GeometryType geomType) const
{
if ( _meshDS ) return _meshDS->elementGeomIterator( geomType );
typedef SMDS_SetIterator
<const SMDS_MeshElement*,
TIDSortedElemSet::const_iterator,
SMDS::SimpleAccessor<const SMDS_MeshElement*, TIDSortedElemSet::const_iterator>,
SMDS_MeshElement::GeomFilter
> TIter;
SMDSAbs_ElementType type = SMDS_MeshCell::toSmdsType( geomType );
return SMDS_ElemIteratorPtr( new TIter( _elements[type].begin(),
_elements[type].end(),
SMDS_MeshElement::GeomFilter( geomType )));
}
// -------------------------------------------------------------------------------------
SMDS_ElemIteratorPtr SMESH_MeshPartDS::elementEntityIterator(SMDSAbs_EntityType entity) const
{
if ( _meshDS ) return _meshDS->elementEntityIterator( entity );
typedef SMDS_SetIterator
<const SMDS_MeshElement*,
TIDSortedElemSet::const_iterator,
SMDS::SimpleAccessor<const SMDS_MeshElement*, TIDSortedElemSet::const_iterator>,
SMDS_MeshElement::EntityFilter
> TIter;
SMDSAbs_ElementType type = SMDS_MeshCell::toSmdsType( entity );
return SMDS_ElemIteratorPtr( new TIter( _elements[type].begin(),
_elements[type].end(),
SMDS_MeshElement::EntityFilter( entity )));
}
// -------------------------------------------------------------------------------------
SMDS_ElemIteratorPtr SMESH_MeshPartDS::elementsIterator(SMDSAbs_ElementType type) const
{
typedef SMDS_SetIterator<const SMDS_MeshElement*, TIDSortedElemSet::const_iterator > TIter;
@ -4849,7 +4909,6 @@ SMDS_ElemIteratorPtr SMESH_MeshPartDS::elementsIterator(SMDSAbs_ElementType type
}
// -------------------------------------------------------------------------------------
_GET_ITER_DEFINE( SMDS_NodeIteratorPtr, nodesIterator, SMDS_MeshNode, SMDSAbs_Node )
_GET_ITER_DEFINE( SMDS_0DElementIteratorPtr, elements0dIterator, SMDS_Mesh0DElement, SMDSAbs_0DElement)
_GET_ITER_DEFINE( SMDS_EdgeIteratorPtr, edgesIterator, SMDS_MeshEdge, SMDSAbs_Edge )
_GET_ITER_DEFINE( SMDS_FaceIteratorPtr, facesIterator, SMDS_MeshFace, SMDSAbs_Face )
_GET_ITER_DEFINE( SMDS_VolumeIteratorPtr, volumesIterator, SMDS_MeshVolume, SMDSAbs_Volume)

View File

@ -271,6 +271,9 @@ public:
CORBA::Long Nb0DElements()
throw (SALOME::SALOME_Exception);
CORBA::Long NbBalls()
throw (SALOME::SALOME_Exception);
CORBA::Long NbEdges()
throw (SALOME::SALOME_Exception);
@ -527,6 +530,11 @@ public:
*/
CORBA::Boolean IsQuadratic(CORBA::Long id);
/*!
* Returns diameter of ball discrete element or zero in case of an invalid \a id
*/
CORBA::Double GetBallDiameter(CORBA::Long id);
/*!
* Returns bary center for given element
*/

View File

@ -230,6 +230,17 @@ namespace
return ids;
}
//================================================================================
/*!
* \brief Return EEntiteMaillage by EGeometrieElement
*/
//================================================================================
MED::EEntiteMaillage entityByGeom(const MED::EGeometrieElement geom )
{
return geom == MED::eBALL ? MED::eSTRUCT_ELEMENT : MED::eMAILLE;
}
//================================================================================
/*!
* \brief Return a map< EGeometrieElement, SMDSAbs_EntityType >
@ -263,6 +274,7 @@ namespace
med2smeshTypes[ MED::ePOLYGONE ] = SMDSEntity_Polygon ;
med2smeshTypes[ MED::ePOLYEDRE ] = SMDSEntity_Polyhedra ;
med2smeshTypes[ MED::eNONE ] = SMDSEntity_Node ;
med2smeshTypes[ MED::eBALL ] = SMDSEntity_Ball ;
}
return med2smeshTypes;
}
@ -463,7 +475,6 @@ bool SMESH_PreMeshInfo::readPreInfoFromHDF()
const bool infoAvailable = aFile->ExistInternalObject( hdfGroupName );
if ( infoAvailable )
{
HDFgroup* infoHdfGroup = new HDFgroup( hdfGroupName, aFile );
infoHdfGroup->OpenOnDisk();
@ -530,7 +541,7 @@ bool SMESH_PreMeshInfo::readMeshInfo()
Tmed2smeshElemTypeMap::const_iterator me2smeEnd = med2smeshElemTypeMap().end();
for ( ; me2sme != me2smeEnd; ++me2sme )
{
int nbElems = aMed->GetNbCells( medMeshInfo, MED::eMAILLE, me2sme->first );
int nbElems = aMed->GetNbCells( medMeshInfo, entityByGeom(me2sme->first), me2sme->first );
if ( nbElems > 0 )
setNb( me2sme->second, nbElems );
}
@ -600,7 +611,7 @@ void SMESH_PreMeshInfo::readGroupInfo()
{
famNums.resize( NbEntities( me2sme->second ));
if ( famNums.empty() ) continue;
aMed->GetFamilies( medElemInfo, famNums.size(), MED::eMAILLE, me2sme->first );
aMed->GetFamilies( medElemInfo, famNums.size(), entityByGeom(me2sme->first), me2sme->first );
// distribute elements of a type among groups
map< int, vector< SMESH_PreMeshInfo* > >::iterator f2infos = famId2grInfo.begin();
for ( size_t i = 0; i < famNums.size(); ++i )
@ -1199,14 +1210,11 @@ SMESH::array_of_ElementType* SMESH_PreMeshInfo::GetTypes() const
types->length( 4 );
int nbTypes = 0;
if (NbEdges())
types[nbTypes++] = SMESH::EDGE;
if (NbFaces())
types[nbTypes++] = SMESH::FACE;
if (NbVolumes())
types[nbTypes++] = SMESH::VOLUME;
if (Nb0DElements())
types[nbTypes++] = SMESH::ELEM0D;
if (NbEdges()) types[nbTypes++] = SMESH::EDGE;
if (NbFaces()) types[nbTypes++] = SMESH::FACE;
if (NbVolumes()) types[nbTypes++] = SMESH::VOLUME;
if (Nb0DElements()) types[nbTypes++] = SMESH::ELEM0D;
if (NbBalls()) types[nbTypes++] = SMESH::BALL;
types->length( nbTypes );
return types._retn();

View File

@ -630,10 +630,12 @@ class smeshDC(SMESH._objref_SMESH_Gen):
if CritType in [FT_BelongToGeom, FT_BelongToPlane, FT_BelongToGenSurface,
FT_BelongToCylinder, FT_LyingOnGeom]:
# Checks the Threshold
# Checks that Threshold is GEOM object
if isinstance(aThreshold, geompyDC.GEOM._objref_GEOM_Object):
aCriterion.ThresholdStr = GetName(aThreshold)
aCriterion.ThresholdID = salome.ObjectToID(aThreshold)
aCriterion.ThresholdID = aThreshold.GetStudyEntry()
if not aCriterion.ThresholdID:
raise RuntimeError, "Threshold shape must be published"
else:
print "Error: The Threshold should be a shape."
return None
@ -642,7 +644,7 @@ class smeshDC(SMESH._objref_SMESH_Gen):
UnaryOp = FT_Undefined
pass
elif CritType == FT_RangeOfIds:
# Checks the Threshold
# Checks that Threshold is string
if isinstance(aThreshold, str):
aCriterion.ThresholdStr = aThreshold
else:
@ -651,7 +653,7 @@ class smeshDC(SMESH._objref_SMESH_Gen):
elif CritType == FT_CoplanarFaces:
# Checks the Threshold
if isinstance(aThreshold, int):
aCriterion.ThresholdID = "%s"%aThreshold
aCriterion.ThresholdID = str(aThreshold)
elif isinstance(aThreshold, str):
ID = int(aThreshold)
if ID < 1:
@ -1372,19 +1374,7 @@ class Mesh:
pass
pass
## Deprecated, used only for compatibility! Please, use ExportToMEDX() method instead.
# Exports the mesh in a file in MED format and chooses the \a version of MED format
## allowing to overwrite the file if it exists or add the exported data to its contents
# @param f the file name
# @param version values are SMESH.MED_V2_1, SMESH.MED_V2_2
# @param opt boolean parameter for creating/not creating
# the groups Group_On_All_Nodes, Group_On_All_Faces, ...
# @param overwrite boolean parameter for overwriting/not overwriting the file
# @ingroup l2_impexp
def ExportToMED(self, f, version, opt=0, overwrite=1):
self.mesh.ExportToMEDX(f, opt, version, overwrite)
## Exports the mesh in a file in MED format and chooses the \a version of MED format
## Exports the mesh in a file in MED format and chooses the \a version of MED format
## allowing to overwrite the file if it exists or add the exported data to its contents
# @param f is the file name
# @param auto_groups boolean parameter for creating/not creating
@ -1462,6 +1452,18 @@ class Mesh:
meshPart = self.mesh
self.mesh.ExportCGNS(meshPart, f, overwrite)
## Deprecated, used only for compatibility! Please, use ExportToMEDX() method instead.
# Exports the mesh in a file in MED format and chooses the \a version of MED format
## allowing to overwrite the file if it exists or add the exported data to its contents
# @param f the file name
# @param version values are SMESH.MED_V2_1, SMESH.MED_V2_2
# @param opt boolean parameter for creating/not creating
# the groups Group_On_All_Nodes, Group_On_All_Faces, ...
# @param overwrite boolean parameter for overwriting/not overwriting the file
# @ingroup l2_impexp
def ExportToMED(self, f, version, opt=0, overwrite=1):
self.mesh.ExportToMEDX(f, opt, version, overwrite)
# Operations with groups:
# ----------------------
@ -1606,26 +1608,6 @@ class Mesh:
group.AddFrom( theFilter )
return group
## Passes mesh elements through the given filter and return IDs of fitting elements
# @param theFilter SMESH_Filter
# @return a list of ids
# @ingroup l1_controls
def GetIdsFromFilter(self, theFilter):
theFilter.SetMesh( self.mesh )
return theFilter.GetIDs()
## Verifies whether a 2D mesh element has free edges (edges connected to one face only)\n
# Returns a list of special structures (borders).
# @return a list of SMESH.FreeEdges.Border structure: edge id and ids of two its nodes.
# @ingroup l1_controls
def GetFreeBorders(self):
aFilterMgr = self.smeshpyD.CreateFilterManager()
aPredicate = aFilterMgr.CreateFreeEdges()
aPredicate.SetMesh(self.mesh)
aBorders = aPredicate.GetBorders()
aFilterMgr.UnRegister()
return aBorders
## Removes a group
# @ingroup l2_grps_delete
def RemoveGroup(self, group):
@ -1821,6 +1803,12 @@ class Mesh:
def Nb0DElements(self):
return self.mesh.Nb0DElements()
## Returns the number of ball discrete elements in the mesh
# @return an integer value
# @ingroup l1_meshinfo
def NbBalls(self):
return self.mesh.NbBalls()
## Returns the number of edges in the mesh
# @return an integer value
# @ingroup l1_meshinfo
@ -2160,6 +2148,11 @@ class Mesh:
def IsQuadratic(self, id):
return self.mesh.IsQuadratic(id)
## Returns diameter of a ball discrete element or zero in case of an invalid \a id
# @ingroup l1_meshinfo
def GetBallDiameter(self, id):
return self.mesh.GetBallDiameter(id)
## Returns XYZ coordinates of the barycenter of the given element
# \n If there is no element for the given ID - returns an empty list
# @return a list of three double values
@ -2167,6 +2160,26 @@ class Mesh:
def BaryCenter(self, id):
return self.mesh.BaryCenter(id)
## Passes mesh elements through the given filter and return IDs of fitting elements
# @param theFilter SMESH_Filter
# @return a list of ids
# @ingroup l1_controls
def GetIdsFromFilter(self, theFilter):
theFilter.SetMesh( self.mesh )
return theFilter.GetIDs()
## Verifies whether a 2D mesh element has free edges (edges connected to one face only)\n
# Returns a list of special structures (borders).
# @return a list of SMESH.FreeEdges.Border structure: edge id and ids of two its nodes.
# @ingroup l1_controls
def GetFreeBorders(self):
aFilterMgr = self.smeshpyD.CreateFilterManager()
aPredicate = aFilterMgr.CreateFreeEdges()
aPredicate.SetMesh(self.mesh)
aBorders = aPredicate.GetBorders()
aFilterMgr.UnRegister()
return aBorders
# Get mesh measurements information:
# ------------------------------------
@ -2295,6 +2308,14 @@ class Mesh:
def Add0DElement(self, IDOfNode):
return self.editor.Add0DElement(IDOfNode)
## Creates a ball element on a node with given ID.
# @param IDOfNode the ID of node for creation of the element.
# @param diameter the bal diameter.
# @return the Id of the new ball element
# @ingroup l2_modif_add
def AddBall(self, IDOfNode, diameter):
return self.editor.AddBall( IDOfNode, diameter )
## Creates a linear or quadratic edge (this is determined
# by the number of given nodes).
# @param IDsOfNodes the list of node IDs for creation of the element.
@ -2481,7 +2502,7 @@ class Mesh:
# @param y the Y coordinate of a point
# @param z the Z coordinate of a point
# @param elementType type of elements to find (SMESH.ALL type
# means elements of any type excluding nodes and 0D elements)
# means elements of any type excluding nodes, discrete and 0D elements)
# @param meshPart a part of mesh (group, sub-mesh) to search within
# @return list of IDs of found elements
# @ingroup l2_modif_throughp

View File

@ -527,7 +527,8 @@ namespace VISCOUS
virtual SMDSAbs_ElementType GetType() const { return SMDSAbs_Face; }
virtual vtkIdType GetVtkType() const { return -1; }
virtual SMDSAbs_EntityType GetEntityType() const { return SMDSEntity_Last; }
virtual SMDS_ElemIteratorPtr elementsIterator(SMDSAbs_ElementType type) const
virtual SMDSAbs_GeometryType GetGeomType() const { return SMDSGeom_TRIANGLE; }
virtual SMDS_ElemIteratorPtr elementsIterator(SMDSAbs_ElementType type) const
{ return SMDS_ElemIteratorPtr( new SMDS_NodeVectorElemIterator( _nn.begin(), _nn.end()));}
};
//--------------------------------------------------------------------------------