Fix crash of SALOME_TESTS/Grids/smesh/bugs_13/N9

(SMDS_VolumeTool.cxx)

Add "Show IDs" check box to Mesh Information dlg

Avoid warning in Choose Entity dialog when no entities are selected,
disable [OK] button instead
This commit is contained in:
eap 2017-02-10 21:20:38 +03:00
parent e8d46310d3
commit 913aaa14de
16 changed files with 202 additions and 66 deletions

BIN
doc/salome/gui/SMESH/images/eleminfo1.png Executable file → Normal file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 20 KiB

BIN
doc/salome/gui/SMESH/images/eleminfo2.png Executable file → Normal file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 31 KiB

After

Width:  |  Height:  |  Size: 29 KiB

View File

@ -78,6 +78,9 @@ The user can either input the ID of a node or element he wants to
analyze directly in the dialog box or select the node(s) or element(s) in analyze directly in the dialog box or select the node(s) or element(s) in
the 3D viewer. the 3D viewer.
If <b>Show IDs</b> is activated, IDs of selected nodes or elements are
displayed in the 3D viewer.
\note The information about the groups, to which the node or element belongs, \note The information about the groups, to which the node or element belongs,
can be shown in a short or in a detailed form. By default, for performance can be shown in a short or in a detailed form. By default, for performance
reasons, this information is shown in a short form (group names reasons, this information is shown in a short form (group names

View File

@ -425,11 +425,13 @@ struct SMDS_VolumeTool::SaveFacet
SaveFacet( SMDS_VolumeTool::Facet& facet ): myToRestore( facet ) SaveFacet( SMDS_VolumeTool::Facet& facet ): myToRestore( facet )
{ {
mySaved = facet; mySaved = facet;
mySaved.myNodes.swap( facet.myNodes );
} }
~SaveFacet() ~SaveFacet()
{ {
if ( myToRestore.myIndex != mySaved.myIndex ) if ( myToRestore.myIndex != mySaved.myIndex )
myToRestore = mySaved; myToRestore = mySaved;
myToRestore.myNodes.swap( mySaved.myNodes );
} }
}; };

View File

@ -4383,6 +4383,7 @@ void SMESHGUI::initialize( CAM_Application* app )
hasNodes("(numberOfNodes > 0 ) && hasActor"), hasNodes("(numberOfNodes > 0 ) && hasActor"),
hasElems("(count( elemTypes ) > 0)"), hasElems("(count( elemTypes ) > 0)"),
hasDifferentElems("(count( elemTypes ) > 1)"), hasDifferentElems("(count( elemTypes ) > 1)"),
hasDifferentObjElems("(count( objElemTypes ) > 1)"),
hasBalls("({'BallElem'} in elemTypes)"), hasBalls("({'BallElem'} in elemTypes)"),
hasElems0d("({'Elem0d'} in elemTypes)"), hasElems0d("({'Elem0d'} in elemTypes)"),
hasEdges("({'Edge'} in elemTypes)"), hasEdges("({'Edge'} in elemTypes)"),
@ -4532,7 +4533,7 @@ void SMESHGUI::initialize( CAM_Application* app )
popupMgr()->insert( separator(), anId, -1 ); popupMgr()->insert( separator(), anId, -1 );
popupMgr()->insert( action( SMESHOp::OpDEChoose ), anId, -1 ); popupMgr()->insert( action( SMESHOp::OpDEChoose ), anId, -1 );
popupMgr()->setRule( action( SMESHOp::OpDEChoose ), aClient + "&& $type in {" + mesh + "} &&" + hasDifferentElems, QtxPopupMgr::VisibleRule ); popupMgr()->setRule( action( SMESHOp::OpDEChoose ), aClient + "&& $type in {" + mesh + "} &&" + hasDifferentObjElems, QtxPopupMgr::VisibleRule );
popupMgr()->insert( separator(), anId, -1 ); popupMgr()->insert( separator(), anId, -1 );

View File

@ -97,6 +97,7 @@ SMESHGUI_DisplayEntitiesDlg::SMESHGUI_DisplayEntitiesDlg( QWidget* parent )
hl->addWidget( nb0DElemsLab, 0, 1 ); hl->addWidget( nb0DElemsLab, 0, 1 );
my0DElemsTB->setEnabled( nbElements ); my0DElemsTB->setEnabled( nbElements );
nb0DElemsLab->setEnabled( nbElements ); nb0DElemsLab->setEnabled( nbElements );
myNbTypes += ( nbElements > 0 );
// Edges // Edges
nbElements = myActor ? myActor->GetObject()->GetNbEntities( SMDSAbs_Edge ) : aMesh->NbEdges(); nbElements = myActor ? myActor->GetObject()->GetNbEntities( SMDSAbs_Edge ) : aMesh->NbEdges();
@ -112,6 +113,7 @@ SMESHGUI_DisplayEntitiesDlg::SMESHGUI_DisplayEntitiesDlg( QWidget* parent )
hl->addWidget( nbEdgesLab, 1, 1 ); hl->addWidget( nbEdgesLab, 1, 1 );
myEdgesTB->setEnabled( nbElements ); myEdgesTB->setEnabled( nbElements );
nbEdgesLab->setEnabled( nbElements ); nbEdgesLab->setEnabled( nbElements );
myNbTypes += ( nbElements > 0 );
// Faces // Faces
nbElements = myActor ? myActor->GetObject()->GetNbEntities( SMDSAbs_Face ) : aMesh->NbFaces(); nbElements = myActor ? myActor->GetObject()->GetNbEntities( SMDSAbs_Face ) : aMesh->NbFaces();
@ -127,6 +129,7 @@ SMESHGUI_DisplayEntitiesDlg::SMESHGUI_DisplayEntitiesDlg( QWidget* parent )
hl->addWidget( nbFacesLab, 2, 1 ); hl->addWidget( nbFacesLab, 2, 1 );
myFacesTB->setEnabled( nbElements ); myFacesTB->setEnabled( nbElements );
nbFacesLab->setEnabled( nbElements ); nbFacesLab->setEnabled( nbElements );
myNbTypes += ( nbElements > 0 );
// Volumes // Volumes
nbElements = myActor ? myActor->GetObject()->GetNbEntities( SMDSAbs_Volume ) : aMesh->NbVolumes(); nbElements = myActor ? myActor->GetObject()->GetNbEntities( SMDSAbs_Volume ) : aMesh->NbVolumes();
@ -142,6 +145,7 @@ SMESHGUI_DisplayEntitiesDlg::SMESHGUI_DisplayEntitiesDlg( QWidget* parent )
hl->addWidget( nbVolumesLab, 3, 1 ); hl->addWidget( nbVolumesLab, 3, 1 );
myVolumesTB->setEnabled( nbElements ); myVolumesTB->setEnabled( nbElements );
nbVolumesLab->setEnabled( nbElements ); nbVolumesLab->setEnabled( nbElements );
myNbTypes += ( nbElements > 0 );
// Balls // Balls
nbElements = myActor ? myActor->GetObject()->GetNbEntities( SMDSAbs_Ball ) : aMesh->NbBalls(); nbElements = myActor ? myActor->GetObject()->GetNbEntities( SMDSAbs_Ball ) : aMesh->NbBalls();
@ -157,6 +161,7 @@ SMESHGUI_DisplayEntitiesDlg::SMESHGUI_DisplayEntitiesDlg( QWidget* parent )
hl->addWidget( nbBallsLab, 4, 1 ); hl->addWidget( nbBallsLab, 4, 1 );
myBallsTB->setEnabled( nbElements ); myBallsTB->setEnabled( nbElements );
nbBallsLab->setEnabled( nbElements ); nbBallsLab->setEnabled( nbElements );
myNbTypes += ( nbElements > 0 );
QVBoxLayout* aDlgLay = new QVBoxLayout( mainFrame() ); QVBoxLayout* aDlgLay = new QVBoxLayout( mainFrame() );
aDlgLay->setMargin( 0 ); aDlgLay->setMargin( 0 );
@ -165,8 +170,10 @@ SMESHGUI_DisplayEntitiesDlg::SMESHGUI_DisplayEntitiesDlg( QWidget* parent )
button( OK )->setText( tr( "SMESH_BUT_OK" ) ); button( OK )->setText( tr( "SMESH_BUT_OK" ) );
connect( this, SIGNAL( dlgHelp() ), this, SLOT( onHelp() ) ); connect( this, SIGNAL( dlgHelp() ), this, SLOT( onHelp() ));
connect( this, SIGNAL( dlgOk() ), this, SLOT( onOk() ) ); connect( this, SIGNAL( dlgOk() ), this, SLOT( onOk() ));
updateButtons();
} }
/* /*
@ -192,14 +199,6 @@ void SMESHGUI_DisplayEntitiesDlg::InverseEntityMode(unsigned int& theOutputMode,
void SMESHGUI_DisplayEntitiesDlg::onChangeEntityMode( bool isChecked ) void SMESHGUI_DisplayEntitiesDlg::onChangeEntityMode( bool isChecked )
{ {
QCheckBox* aSender = (QCheckBox*)sender(); QCheckBox* aSender = (QCheckBox*)sender();
if ( myNbCheckedButtons == 1 && !isChecked ) {
SUIT_MessageBox::warning(this, tr("SMESH_WRN_WARNING"),
tr("WRN_AT_LEAST_ONE"));
disconnect( aSender, SIGNAL(toggled(bool)), this, SLOT(onChangeEntityMode(bool)) );
aSender->setChecked( true );
connect( aSender, SIGNAL(toggled(bool)), this, SLOT(onChangeEntityMode(bool)) );
return;
}
if ( my0DElemsTB == aSender ) if ( my0DElemsTB == aSender )
InverseEntityMode( myEntityMode, SMESH_Actor::e0DElements ); InverseEntityMode( myEntityMode, SMESH_Actor::e0DElements );
else if ( myEdgesTB == aSender ) else if ( myEdgesTB == aSender )
@ -212,7 +211,7 @@ void SMESHGUI_DisplayEntitiesDlg::onChangeEntityMode( bool isChecked )
InverseEntityMode( myEntityMode, SMESH_Actor::eBallElem ); InverseEntityMode( myEntityMode, SMESH_Actor::eBallElem );
isChecked ? myNbCheckedButtons++ : myNbCheckedButtons--; isChecked ? myNbCheckedButtons++ : myNbCheckedButtons--;
updateButtons();
} }
/*! /*!
@ -248,3 +247,11 @@ void SMESHGUI_DisplayEntitiesDlg::onOk()
SMESH::UpdateView( wnd, SMESH::eDisplay, entry ); SMESH::UpdateView( wnd, SMESH::eDisplay, entry );
} }
} }
/*!
* \brief Enable/disable OK button depending on nb of selected entities
*/
void SMESHGUI_DisplayEntitiesDlg::updateButtons()
{
setButtonEnabled( myNbCheckedButtons > 0 || myNbTypes == 0, OK );
}

View File

@ -40,6 +40,7 @@ public:
private: private:
void InverseEntityMode( unsigned int& theOutputMode, void InverseEntityMode( unsigned int& theOutputMode,
unsigned int theMode ); unsigned int theMode );
void updateButtons();
private slots: private slots:
void onOk(); void onOk();
@ -51,6 +52,7 @@ private:
unsigned int myEntityMode; unsigned int myEntityMode;
SMESH_Actor *myActor; SMESH_Actor *myActor;
int myNbCheckedButtons; int myNbCheckedButtons;
int myNbTypes;
QCheckBox* my0DElemsTB; QCheckBox* my0DElemsTB;
QCheckBox* myEdgesTB; QCheckBox* myEdgesTB;
QCheckBox* myFacesTB; QCheckBox* myFacesTB;

View File

@ -55,6 +55,14 @@ public:
void SetPointsData( SMDS_Mesh* theMesh, const TColStd_MapOfInteger & theNodesIdMap ); void SetPointsData( SMDS_Mesh* theMesh, const TColStd_MapOfInteger & theNodesIdMap );
void SetElemsData ( const std::vector<int> & theElemsIdMap, void SetElemsData ( const std::vector<int> & theElemsIdMap,
const std::list<gp_XYZ> & theGrCentersXYZ ); const std::list<gp_XYZ> & theGrCentersXYZ );
template< class INT_ITER, class XYZ_ITER >
void SetElemsData ( INT_ITER theElemsBegin, INT_ITER theElemsEnd,
XYZ_ITER theGrCentersBegin, XYZ_ITER theGrCentersEnd )
{
std::vector<int> elemsIds( theElemsBegin, theElemsEnd );
std::list<gp_XYZ> gcXYZ( theGrCentersBegin, theGrCentersEnd );
SetElemsData( elemsIds, gcXYZ );
}
void SetPointsLabeled( bool theIsPointsLabeled, bool theIsActorVisible = true ); void SetPointsLabeled( bool theIsPointsLabeled, bool theIsActorVisible = true );
void AddToRender ( vtkRenderer* theRenderer ); void AddToRender ( vtkRenderer* theRenderer );

View File

@ -33,6 +33,7 @@
#include "SMESHDS_Mesh.hxx" #include "SMESHDS_Mesh.hxx"
#include "SMESHGUI.h" #include "SMESHGUI.h"
#include "SMESHGUI_FilterUtils.h" #include "SMESHGUI_FilterUtils.h"
#include "SMESHGUI_IdPreview.h"
#include "SMESHGUI_IdValidator.h" #include "SMESHGUI_IdValidator.h"
#include "SMESHGUI_SpinBox.h" #include "SMESHGUI_SpinBox.h"
#include "SMESHGUI_Utils.h" #include "SMESHGUI_Utils.h"
@ -2826,7 +2827,7 @@ void SMESHGUI_AddInfo::saveInfo( QTextStream &out )
\param page specifies the dialog page to be shown at the start-up \param page specifies the dialog page to be shown at the start-up
*/ */
SMESHGUI_MeshInfoDlg::SMESHGUI_MeshInfoDlg( QWidget* parent, int page ) SMESHGUI_MeshInfoDlg::SMESHGUI_MeshInfoDlg( QWidget* parent, int page )
: QDialog( parent ), myActor( 0 ) : QDialog( parent ), myActor( 0 )
{ {
setModal( false ); setModal( false );
setAttribute( Qt::WA_DeleteOnClose, true ); setAttribute( Qt::WA_DeleteOnClose, true );
@ -2850,6 +2851,8 @@ SMESHGUI_MeshInfoDlg::SMESHGUI_MeshInfoDlg( QWidget* parent, int page )
myMode->button( NodeMode )->setChecked( true ); myMode->button( NodeMode )->setChecked( true );
myID = new QLineEdit( w ); myID = new QLineEdit( w );
myID->setValidator( new SMESHGUI_IdValidator( this ) ); myID->setValidator( new SMESHGUI_IdValidator( this ) );
myIDPreviewCheck = new QCheckBox( tr( "SHOW_IDS" ), w );
myIDPreview = new SMESHGUI_IdPreview( SMESH::GetViewWindow( SMESHGUI::GetSMESHGUI() ));
int mode = SMESHGUI::resourceMgr()->integerValue( "SMESH", "mesh_elem_info", 1 ); int mode = SMESHGUI::resourceMgr()->integerValue( "SMESH", "mesh_elem_info", 1 );
mode = qMin( 1, qMax( 0, mode ) ); mode = qMin( 1, qMax( 0, mode ) );
@ -2864,8 +2867,9 @@ SMESHGUI_MeshInfoDlg::SMESHGUI_MeshInfoDlg( QWidget* parent, int page )
elemLayout->setSpacing( SPACING ); elemLayout->setSpacing( SPACING );
elemLayout->addWidget( myMode->button( NodeMode ), 0, 0 ); elemLayout->addWidget( myMode->button( NodeMode ), 0, 0 );
elemLayout->addWidget( myMode->button( ElemMode ), 0, 1 ); elemLayout->addWidget( myMode->button( ElemMode ), 0, 1 );
elemLayout->addWidget( myID, 0, 2 ); elemLayout->addWidget( myID, 0, 2 );
elemLayout->addWidget( myElemInfo, 1, 0, 1, 3 ); elemLayout->addWidget( myIDPreviewCheck, 1, 0, 1, 2 );
elemLayout->addWidget( myElemInfo, 2, 0, 1, 3 );
myTabWidget->addTab( w, tr( "ELEM_INFO" ) ); myTabWidget->addTab( w, tr( "ELEM_INFO" ) );
@ -2905,18 +2909,19 @@ SMESHGUI_MeshInfoDlg::SMESHGUI_MeshInfoDlg( QWidget* parent, int page )
l->addWidget( myTabWidget ); l->addWidget( myTabWidget );
l->addLayout( btnLayout ); l->addLayout( btnLayout );
myTabWidget->setCurrentIndex( qMax( (int)BaseInfo, qMin( (int)ElemInfo, page ) ) ); myTabWidget->setCurrentIndex( qMax( (int)BaseInfo, qMin( (int)ElemInfo, page )));
connect( okBtn, SIGNAL( clicked() ), this, SLOT( reject() ) ); connect( okBtn, SIGNAL( clicked() ), this, SLOT( reject() ));
connect( dumpBtn, SIGNAL( clicked() ), this, SLOT( dump() ) ); connect( dumpBtn, SIGNAL( clicked() ), this, SLOT( dump() ));
connect( helpBtn, SIGNAL( clicked() ), this, SLOT( help() ) ); connect( helpBtn, SIGNAL( clicked() ), this, SLOT( help() ));
connect( myTabWidget, SIGNAL( currentChanged( int ) ), this, SLOT( updateSelection() ) ); connect( myTabWidget, SIGNAL( currentChanged( int ) ), this, SLOT( updateSelection() ));
connect( myMode, SIGNAL( buttonClicked( int ) ), this, SLOT( modeChanged() ) ); connect( myMode, SIGNAL( buttonClicked( int ) ), this, SLOT( modeChanged() ));
connect( myID, SIGNAL( textChanged( QString ) ), this, SLOT( idChanged() ) ); connect( myID, SIGNAL( textChanged( QString ) ), this, SLOT( idChanged() ));
connect( SMESHGUI::GetSMESHGUI(), SIGNAL( SignalDeactivateActiveDialog() ), this, SLOT( deactivate() ) ); connect( myIDPreviewCheck, SIGNAL( toggled(bool) ), this, SLOT( idPreviewChange(bool) ));
connect( SMESHGUI::GetSMESHGUI(), SIGNAL( SignalCloseAllDialogs() ), this, SLOT( reject() ) ); connect( SMESHGUI::GetSMESHGUI(), SIGNAL( SignalDeactivateActiveDialog() ), this, SLOT( deactivate() ));
connect( myElemInfo, SIGNAL( itemInfo( int ) ), this, SLOT( showItemInfo( int ) ) ); connect( SMESHGUI::GetSMESHGUI(), SIGNAL( SignalCloseAllDialogs() ), this, SLOT( reject() ));
connect( myElemInfo, SIGNAL( itemInfo( QString ) ), this, SLOT( showItemInfo( QString ) ) ); connect( myElemInfo, SIGNAL( itemInfo( int ) ), this, SLOT( showItemInfo( int )));
connect( myElemInfo, SIGNAL( itemInfo( QString ) ), this, SLOT( showItemInfo( QString )));
updateSelection(); updateSelection();
} }
@ -2926,6 +2931,7 @@ SMESHGUI_MeshInfoDlg::SMESHGUI_MeshInfoDlg( QWidget* parent, int page )
*/ */
SMESHGUI_MeshInfoDlg::~SMESHGUI_MeshInfoDlg() SMESHGUI_MeshInfoDlg::~SMESHGUI_MeshInfoDlg()
{ {
delete myIDPreview;
} }
/*! /*!
@ -2983,6 +2989,7 @@ void SMESHGUI_MeshInfoDlg::reject()
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow() ) if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow() )
aViewWindow->SetSelectionMode( ActorSelection ); aViewWindow->SetSelectionMode( ActorSelection );
QDialog::reject(); QDialog::reject();
myIDPreview->SetPointsLabeled(false);
} }
/*! /*!
@ -3016,7 +3023,9 @@ void SMESHGUI_MeshInfoDlg::updateSelection()
disconnect( selMgr, 0, this, 0 ); disconnect( selMgr, 0, this, 0 );
selMgr->clearFilters(); selMgr->clearFilters();
if ( myTabWidget->currentIndex() == BaseInfo || myTabWidget->currentIndex() == AddInfo || myTabWidget->currentIndex() == CtrlInfo ) { if ( myTabWidget->currentIndex() == BaseInfo ||
myTabWidget->currentIndex() == AddInfo ||
myTabWidget->currentIndex() == CtrlInfo ) {
SMESH::SetPointRepresentation( false ); SMESH::SetPointRepresentation( false );
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow() ) if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow() )
aViewWindow->SetSelectionMode( ActorSelection ); aViewWindow->SetSelectionMode( ActorSelection );
@ -3106,15 +3115,19 @@ void SMESHGUI_MeshInfoDlg::modeChanged()
} }
/*! /*!
\brief Caled when users prints mesh element ID in the corresponding field. \brief Called when users prints mesh element ID in the corresponding field.
*/ */
void SMESHGUI_MeshInfoDlg::idChanged() void SMESHGUI_MeshInfoDlg::idChanged()
{ {
myIDPreview->SetPointsLabeled( false );
SVTK_Selector* selector = SMESH::GetSelector(); SVTK_Selector* selector = SMESH::GetSelector();
if ( myActor && selector ) { if ( myActor && selector ) {
Handle(SALOME_InteractiveObject) IO = myActor->getIO(); Handle(SALOME_InteractiveObject) IO = myActor->getIO();
TColStd_MapOfInteger ID; TColStd_MapOfInteger ID;
QSet<long> ids; QSet<long> ids;
std::vector<int> idVec;
std::list< gp_XYZ > aGrCentersXYZ;
QStringList idTxt = myID->text().split( " ", QString::SkipEmptyParts ); QStringList idTxt = myID->text().split( " ", QString::SkipEmptyParts );
foreach ( QString tid, idTxt ) { foreach ( QString tid, idTxt ) {
long id = tid.trimmed().toLong(); long id = tid.trimmed().toLong();
@ -3124,10 +3137,26 @@ void SMESHGUI_MeshInfoDlg::idChanged()
if ( e ) { if ( e ) {
ID.Add( id ); ID.Add( id );
ids << id; ids << id;
if ( myMode->checkedId() == ElemMode )
{
idVec.push_back( id );
aGrCentersXYZ.push_back( myElemInfo->getGravityCenter( e ));
}
} }
} }
selector->AddOrRemoveIndex( IO, ID, false ); selector->AddOrRemoveIndex( IO, ID, false );
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow() ) { if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow() ) {
if ( myMode->checkedId() == NodeMode )
myIDPreview->SetPointsData( myActor->GetObject()->GetMesh(), ID );
else
myIDPreview->SetElemsData( idVec, aGrCentersXYZ );
bool showIDs = ( !ID.IsEmpty() &&
myIDPreviewCheck->isChecked() &&
myTabWidget->currentIndex() == ElemInfo );
myIDPreview->SetPointsLabeled( showIDs, myActor->GetVisibility() );
aViewWindow->highlight( IO, true, true ); aViewWindow->highlight( IO, true, true );
aViewWindow->Repaint(); aViewWindow->Repaint();
} }
@ -3135,6 +3164,16 @@ void SMESHGUI_MeshInfoDlg::idChanged()
} }
} }
/*!
* \brief Show IDs clicked
*/
void SMESHGUI_MeshInfoDlg::idPreviewChange( bool isOn )
{
myIDPreview->SetPointsLabeled( isOn && !myID->text().simplified().isEmpty() );
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow() )
aViewWindow->Repaint();
}
void SMESHGUI_MeshInfoDlg::showItemInfo( int id ) void SMESHGUI_MeshInfoDlg::showItemInfo( int id )
{ {
if ( id > 0 && myActor->GetObject()->GetMesh()->FindNode( id ) ) { if ( id > 0 && myActor->GetObject()->GetMesh()->FindNode( id ) ) {

View File

@ -52,17 +52,19 @@
class QAbstractButton; class QAbstractButton;
class QButtonGroup; class QButtonGroup;
class QCheckBox;
class QContextMenuEvent; class QContextMenuEvent;
class QGridLayout;
class QLabel; class QLabel;
class QLineEdit; class QLineEdit;
class QPushButton; class QPushButton;
class QTabWidget; class QTabWidget;
class QTextBrowser; class QTextBrowser;
class QGridLayout;
class SMESH_Actor;
class SMDS_MeshNode;
class SMDS_MeshElement; class SMDS_MeshElement;
class SMDS_MeshNode;
class SMESHGUI_IdPreview;
class SMESHGUI_SpinBox; class SMESHGUI_SpinBox;
class SMESH_Actor;
class ExtraWidget; class ExtraWidget;
@ -157,6 +159,8 @@ public:
void clear(); void clear();
virtual void saveInfo( QTextStream &out ) = 0; virtual void saveInfo( QTextStream &out ) = 0;
gp_XYZ getGravityCenter( const SMDS_MeshElement* e ) { return gravityCenter(e); }
protected: protected:
struct XYZ struct XYZ
{ {
@ -168,6 +172,7 @@ protected:
double x() const { return myX; } double x() const { return myX; }
double y() const { return myY; } double y() const { return myY; }
double z() const { return myZ; } double z() const { return myZ; }
operator gp_XYZ() const { return gp_XYZ( myX, myY, myZ ); }
}; };
typedef QMap< int, QList<int> > Connectivity; typedef QMap< int, QList<int> > Connectivity;
@ -382,19 +387,22 @@ private slots:
void deactivate(); void deactivate();
void modeChanged(); void modeChanged();
void idChanged(); void idChanged();
void idPreviewChange(bool);
void showItemInfo( int ); void showItemInfo( int );
void showItemInfo( const QString& ); void showItemInfo( const QString& );
void dump(); void dump();
private: private:
QTabWidget* myTabWidget; QTabWidget* myTabWidget;
SMESHGUI_MeshInfo* myBaseInfo; SMESHGUI_MeshInfo* myBaseInfo;
QButtonGroup* myMode; QButtonGroup* myMode;
QLineEdit* myID; QLineEdit* myID;
SMESHGUI_ElemInfo* myElemInfo; QCheckBox* myIDPreviewCheck;
SMESHGUI_AddInfo* myAddInfo; SMESHGUI_IdPreview* myIDPreview;
SMESHGUI_CtrlInfo* myCtrlInfo; SMESHGUI_ElemInfo* myElemInfo;
SMESH_Actor* myActor; SMESHGUI_AddInfo* myAddInfo;
SMESHGUI_CtrlInfo* myCtrlInfo;
SMESH_Actor* myActor;
Handle(SALOME_InteractiveObject) myIO; Handle(SALOME_InteractiveObject) myIO;
}; };

View File

@ -120,7 +120,8 @@ QVariant SMESHGUI_Selection::parameter( const int ind, const QString& p ) const
if ( p=="client" ) val = QVariant( LightApp_Selection::parameter( p ) ); if ( p=="client" ) val = QVariant( LightApp_Selection::parameter( p ) );
else if ( p=="type" ) val = QVariant( myTypes[ind] ); else if ( p=="type" ) val = QVariant( myTypes[ind] );
else if ( p=="hasActor" ) val = QVariant( getActor( ind ) != 0 ); else if ( p=="hasActor" ) val = QVariant( getActor( ind ) != 0 );
else if ( p=="elemTypes" ) val = QVariant( elemTypes( ind ) ); else if ( p=="elemTypes" ) val = QVariant( elemTypes( ind, false ) );
else if ( p=="objElemTypes" ) val = QVariant( elemTypes( ind, true ) );
else if ( p=="isAutoColor" ) val = QVariant( isAutoColor( ind ) ); else if ( p=="isAutoColor" ) val = QVariant( isAutoColor( ind ) );
else if ( p=="numberOfNodes" ) val = QVariant( numberOfNodes( ind ) ); else if ( p=="numberOfNodes" ) val = QVariant( numberOfNodes( ind ) );
else if ( p=="dim" ) val = QVariant( dim( ind ) ); else if ( p=="dim" ) val = QVariant( dim( ind ) );
@ -184,18 +185,42 @@ SMESH_Actor* SMESHGUI_Selection::getActor( int ind ) const
//purpose : may return {'Elem0d' 'Edge' 'Face' 'Volume' 'BallElem'} at most //purpose : may return {'Elem0d' 'Edge' 'Face' 'Volume' 'BallElem'} at most
//======================================================================= //=======================================================================
QList<QVariant> SMESHGUI_Selection::elemTypes( int ind ) const QList<QVariant> SMESHGUI_Selection::elemTypes( int ind, bool fromObj ) const
{ {
QList<QVariant> types; QList<QVariant> types;
SMESH_Actor* actor = getActor( ind ); SMESH_Actor* actor = getActor( ind );
if ( actor ) { if ( actor ) {
TVisualObjPtr object = actor->GetObject(); TVisualObjPtr object = actor->GetObject();
if ( object ) { 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_Edge )) types.append( "Edge" );
if ( object->GetNbEntities( SMDSAbs_Face )) types.append( "Face" ); if ( object->GetNbEntities( SMDSAbs_Face )) types.append( "Face" );
if ( object->GetNbEntities( SMDSAbs_Volume )) types.append( "Volume" ); if ( object->GetNbEntities( SMDSAbs_Volume )) types.append( "Volume" );
if ( object->GetNbEntities( SMDSAbs_0DElement )) types.append( "Elem0d" );
if ( object->GetNbEntities( SMDSAbs_Ball )) types.append( "BallElem" );
}
}
else if ( fromObj )
{
if ( ind >= 0 && ind < myTypes.count() && myTypes[ind] != "Unknown" )
{
_PTR(SObject) sobj = SMESH::GetActiveStudyDocument()->FindObjectID( entry( ind ).toLatin1().data() );
CORBA::Object_var obj = SMESH::SObjectToObject( sobj, SMESH::GetActiveStudyDocument() );
SMESH::SMESH_IDSource_var idSrc = SMESH::SMESH_IDSource::_narrow( obj );
if ( !CORBA::is_nil( idSrc ) )
{
SMESH::array_of_ElementType_var typeVar = idSrc->GetTypes();
for ( CORBA::ULong i = 0; i < typeVar->length(); ++i )
switch ( typeVar[i] ) {
case SMESH::EDGE: types.append( "Edge" ); break;
case SMESH::FACE: types.append( "Face" ); break;
case SMESH::VOLUME: types.append( "Volume" ); break;
case SMESH::ELEM0D: types.append( "Elem0d" ); break;
case SMESH::BALL: types.append( "BallElem" ); break;
case SMESH::ALL:
case SMESH::NODE:
case SMESH::NB_ELEMENT_TYPES: break;
}
}
} }
} }
return types; return types;
@ -439,13 +464,10 @@ bool SMESHGUI_Selection::isAutoColor( int ind ) const
if ( ind >= 0 && ind < myTypes.count() && myTypes[ind] != "Unknown" ) if ( ind >= 0 && ind < myTypes.count() && myTypes[ind] != "Unknown" )
{ {
_PTR(SObject) sobj = SMESH::GetActiveStudyDocument()->FindObjectID( entry( ind ).toLatin1().data() ); _PTR(SObject) sobj = SMESH::GetActiveStudyDocument()->FindObjectID( entry( ind ).toLatin1().data() );
CORBA::Object_var obj = SMESH::SObjectToObject( sobj, SMESH::GetActiveStudyDocument() ); CORBA::Object_var obj = SMESH::SObjectToObject( sobj, SMESH::GetActiveStudyDocument() );
SMESH::SMESH_Mesh_var mesh = SMESH::SMESH_Mesh::_narrow( obj );
if ( !CORBA::is_nil( obj ) ) { if ( !CORBA::is_nil( mesh ) )
SMESH::SMESH_Mesh_var mesh = SMESH::SMESH_Mesh::_narrow( obj ); return mesh->GetAutoColor();
if ( !CORBA::is_nil( mesh ) )
return mesh->GetAutoColor();
}
} }
return false; return false;
} }

View File

@ -71,8 +71,8 @@ public:
virtual int nbChildren( int ) const; virtual int nbChildren( int ) const;
virtual bool isContainer( int ) const; virtual bool isContainer( int ) const;
// parameters got from actor return nothing if an actor is not visible // parameters got from actor, return nothing if an actor is not visible
virtual QList<QVariant> elemTypes( int ) const; virtual QList<QVariant> elemTypes( int, bool ) const; // == objElemTypes w/o actor
virtual QList<QVariant> labeledTypes( int ) const; virtual QList<QVariant> labeledTypes( int ) const;
virtual QString displayMode( int ) const; virtual QString displayMode( int ) const;
virtual QString shrinkMode( int ) const; virtual QString shrinkMode( int ) const;

View File

@ -7422,6 +7422,10 @@ as they are of improper type:
<source>ELEM_MODE</source> <source>ELEM_MODE</source>
<translation>Element</translation> <translation>Element</translation>
</message> </message>
<message>
<source>SHOW_IDS</source>
<translation>Show IDs</translation>
</message>
<message> <message>
<source>BUT_DUMP_MESH</source> <source>BUT_DUMP_MESH</source>
<translation>&amp;Dump</translation> <translation>&amp;Dump</translation>

View File

@ -459,6 +459,7 @@ struct SMESH_ElementSearcherImpl: public SMESH_ElementSearcher
_ebbTree[i] = NULL; _ebbTree[i] = NULL;
_ebbTreeHeight[i] = -1; _ebbTreeHeight[i] = -1;
} }
_elementType = SMDSAbs_All;
} }
virtual ~SMESH_ElementSearcherImpl() virtual ~SMESH_ElementSearcherImpl()
{ {
@ -878,10 +879,10 @@ SMESH_ElementSearcherImpl::FindClosestTo( const gp_Pnt& point,
TopAbs_State SMESH_ElementSearcherImpl::GetPointState(const gp_Pnt& point) TopAbs_State SMESH_ElementSearcherImpl::GetPointState(const gp_Pnt& point)
{ {
double tolerance = getTolerance();
_elementType = SMDSAbs_Face; _elementType = SMDSAbs_Face;
double tolerance = getTolerance();
ElementBndBoxTree*& ebbTree = _ebbTree[ SMDSAbs_Face ]; ElementBndBoxTree*& ebbTree = _ebbTree[ SMDSAbs_Face ];
if ( !ebbTree ) if ( !ebbTree )
ebbTree = new ElementBndBoxTree( *_mesh, _elementType, _meshPartIt ); ebbTree = new ElementBndBoxTree( *_mesh, _elementType, _meshPartIt );

View File

@ -1469,7 +1469,7 @@ class Mesh:
errText = "code %s" % -err.code errText = "code %s" % -err.code
if errText: errText += ". " if errText: errText += ". "
errText += err.comment errText += err.comment
if allReasons != "":allReasons += "\n" if allReasons: allReasons += "\n"
if ok: if ok:
allReasons += '- "%s"%s - %s' %(err.algoName, shapeText, errText) allReasons += '- "%s"%s - %s' %(err.algoName, shapeText, errText)
else: else:
@ -1507,7 +1507,7 @@ class Mesh:
reason = ("For unknown reason. " reason = ("For unknown reason. "
"Developer, revise Mesh.Compute() implementation in smeshBuilder.py!") "Developer, revise Mesh.Compute() implementation in smeshBuilder.py!")
pass pass
if allReasons != "":allReasons += "\n" if allReasons: allReasons += "\n"
allReasons += "- " + reason allReasons += "- " + reason
pass pass
if not ok or allReasons != "": if not ok or allReasons != "":

View File

@ -445,6 +445,7 @@ namespace VISCOUS_3D
bool Is ( int flag ) const { return _flags & flag; } bool Is ( int flag ) const { return _flags & flag; }
void Set ( int flag ) { _flags |= flag; } void Set ( int flag ) { _flags |= flag; }
void Unset( int flag ) { _flags &= ~flag; } void Unset( int flag ) { _flags &= ~flag; }
std::string DumpFlags() const; // debug
void SetNewLength( double len, _EdgesOnShape& eos, SMESH_MesherHelper& helper ); void SetNewLength( double len, _EdgesOnShape& eos, SMESH_MesherHelper& helper );
bool SetNewLength2d( Handle(Geom_Surface)& surface, bool SetNewLength2d( Handle(Geom_Surface)& surface,
@ -9199,10 +9200,48 @@ void _LayerEdge::SmoothPos( const vector< double >& segLen, const double tol )
//================================================================================ //================================================================================
/*! /*!
* \brief Create layers of prisms * \brief Print flags
*/ */
//================================================================================ //================================================================================
std::string _LayerEdge::DumpFlags() const
{
SMESH_Comment dump;
for ( int flag = 1; flag < 0x1000000; flag *= 2 )
if ( _flags & flag )
{
EFlags f = (EFlags) flag;
switch ( f ) {
case TO_SMOOTH: dump << "TO_SMOOTH"; break;
case MOVED: dump << "MOVED"; break;
case SMOOTHED: dump << "SMOOTHED"; break;
case DIFFICULT: dump << "DIFFICULT"; break;
case ON_CONCAVE_FACE: dump << "ON_CONCAVE_FACE"; break;
case BLOCKED: dump << "BLOCKED"; break;
case INTERSECTED: dump << "INTERSECTED"; break;
case NORMAL_UPDATED: dump << "NORMAL_UPDATED"; break;
case MARKED: dump << "MARKED"; break;
case MULTI_NORMAL: dump << "MULTI_NORMAL"; break;
case NEAR_BOUNDARY: dump << "NEAR_BOUNDARY"; break;
case SMOOTHED_C1: dump << "SMOOTHED_C1"; break;
case DISTORTED: dump << "DISTORTED"; break;
case RISKY_SWOL: dump << "RISKY_SWOL"; break;
case SHRUNK: dump << "SHRUNK"; break;
case UNUSED_FLAG: dump << "UNUSED_FLAG"; break;
}
dump << " ";
}
cout << dump << endl;
return dump;
}
//================================================================================
/*!
case brief:
default:
*/
//================================================================================
bool _ViscousBuilder::refine(_SolidData& data) bool _ViscousBuilder::refine(_SolidData& data)
{ {
SMESH_MesherHelper& helper = data.GetHelper(); SMESH_MesherHelper& helper = data.GetHelper();