mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2024-12-26 09:20:34 +05:00
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:
parent
e8d46310d3
commit
913aaa14de
BIN
doc/salome/gui/SMESH/images/eleminfo1.png
Executable file → Normal file
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
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 |
@ -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
|
||||
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,
|
||||
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
|
||||
|
@ -425,11 +425,13 @@ struct SMDS_VolumeTool::SaveFacet
|
||||
SaveFacet( SMDS_VolumeTool::Facet& facet ): myToRestore( facet )
|
||||
{
|
||||
mySaved = facet;
|
||||
mySaved.myNodes.swap( facet.myNodes );
|
||||
}
|
||||
~SaveFacet()
|
||||
{
|
||||
if ( myToRestore.myIndex != mySaved.myIndex )
|
||||
myToRestore = mySaved;
|
||||
myToRestore.myNodes.swap( mySaved.myNodes );
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -4383,6 +4383,7 @@ void SMESHGUI::initialize( CAM_Application* app )
|
||||
hasNodes("(numberOfNodes > 0 ) && hasActor"),
|
||||
hasElems("(count( elemTypes ) > 0)"),
|
||||
hasDifferentElems("(count( elemTypes ) > 1)"),
|
||||
hasDifferentObjElems("(count( objElemTypes ) > 1)"),
|
||||
hasBalls("({'BallElem'} in elemTypes)"),
|
||||
hasElems0d("({'Elem0d'} in elemTypes)"),
|
||||
hasEdges("({'Edge'} in elemTypes)"),
|
||||
@ -4532,7 +4533,7 @@ void SMESHGUI::initialize( CAM_Application* app )
|
||||
popupMgr()->insert( separator(), 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 );
|
||||
|
||||
|
@ -97,6 +97,7 @@ SMESHGUI_DisplayEntitiesDlg::SMESHGUI_DisplayEntitiesDlg( QWidget* parent )
|
||||
hl->addWidget( nb0DElemsLab, 0, 1 );
|
||||
my0DElemsTB->setEnabled( nbElements );
|
||||
nb0DElemsLab->setEnabled( nbElements );
|
||||
myNbTypes += ( nbElements > 0 );
|
||||
|
||||
// Edges
|
||||
nbElements = myActor ? myActor->GetObject()->GetNbEntities( SMDSAbs_Edge ) : aMesh->NbEdges();
|
||||
@ -112,6 +113,7 @@ SMESHGUI_DisplayEntitiesDlg::SMESHGUI_DisplayEntitiesDlg( QWidget* parent )
|
||||
hl->addWidget( nbEdgesLab, 1, 1 );
|
||||
myEdgesTB->setEnabled( nbElements );
|
||||
nbEdgesLab->setEnabled( nbElements );
|
||||
myNbTypes += ( nbElements > 0 );
|
||||
|
||||
// Faces
|
||||
nbElements = myActor ? myActor->GetObject()->GetNbEntities( SMDSAbs_Face ) : aMesh->NbFaces();
|
||||
@ -127,6 +129,7 @@ SMESHGUI_DisplayEntitiesDlg::SMESHGUI_DisplayEntitiesDlg( QWidget* parent )
|
||||
hl->addWidget( nbFacesLab, 2, 1 );
|
||||
myFacesTB->setEnabled( nbElements );
|
||||
nbFacesLab->setEnabled( nbElements );
|
||||
myNbTypes += ( nbElements > 0 );
|
||||
|
||||
// Volumes
|
||||
nbElements = myActor ? myActor->GetObject()->GetNbEntities( SMDSAbs_Volume ) : aMesh->NbVolumes();
|
||||
@ -142,6 +145,7 @@ SMESHGUI_DisplayEntitiesDlg::SMESHGUI_DisplayEntitiesDlg( QWidget* parent )
|
||||
hl->addWidget( nbVolumesLab, 3, 1 );
|
||||
myVolumesTB->setEnabled( nbElements );
|
||||
nbVolumesLab->setEnabled( nbElements );
|
||||
myNbTypes += ( nbElements > 0 );
|
||||
|
||||
// Balls
|
||||
nbElements = myActor ? myActor->GetObject()->GetNbEntities( SMDSAbs_Ball ) : aMesh->NbBalls();
|
||||
@ -157,6 +161,7 @@ SMESHGUI_DisplayEntitiesDlg::SMESHGUI_DisplayEntitiesDlg( QWidget* parent )
|
||||
hl->addWidget( nbBallsLab, 4, 1 );
|
||||
myBallsTB->setEnabled( nbElements );
|
||||
nbBallsLab->setEnabled( nbElements );
|
||||
myNbTypes += ( nbElements > 0 );
|
||||
|
||||
QVBoxLayout* aDlgLay = new QVBoxLayout( mainFrame() );
|
||||
aDlgLay->setMargin( 0 );
|
||||
@ -165,8 +170,10 @@ SMESHGUI_DisplayEntitiesDlg::SMESHGUI_DisplayEntitiesDlg( QWidget* parent )
|
||||
|
||||
button( OK )->setText( tr( "SMESH_BUT_OK" ) );
|
||||
|
||||
connect( this, SIGNAL( dlgHelp() ), this, SLOT( onHelp() ) );
|
||||
connect( this, SIGNAL( dlgOk() ), this, SLOT( onOk() ) );
|
||||
connect( this, SIGNAL( dlgHelp() ), this, SLOT( onHelp() ));
|
||||
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 )
|
||||
{
|
||||
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 )
|
||||
InverseEntityMode( myEntityMode, SMESH_Actor::e0DElements );
|
||||
else if ( myEdgesTB == aSender )
|
||||
@ -212,7 +211,7 @@ void SMESHGUI_DisplayEntitiesDlg::onChangeEntityMode( bool isChecked )
|
||||
InverseEntityMode( myEntityMode, SMESH_Actor::eBallElem );
|
||||
|
||||
isChecked ? myNbCheckedButtons++ : myNbCheckedButtons--;
|
||||
|
||||
updateButtons();
|
||||
}
|
||||
|
||||
/*!
|
||||
@ -248,3 +247,11 @@ void SMESHGUI_DisplayEntitiesDlg::onOk()
|
||||
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 );
|
||||
}
|
||||
|
@ -40,6 +40,7 @@ public:
|
||||
private:
|
||||
void InverseEntityMode( unsigned int& theOutputMode,
|
||||
unsigned int theMode );
|
||||
void updateButtons();
|
||||
|
||||
private slots:
|
||||
void onOk();
|
||||
@ -51,6 +52,7 @@ private:
|
||||
unsigned int myEntityMode;
|
||||
SMESH_Actor *myActor;
|
||||
int myNbCheckedButtons;
|
||||
int myNbTypes;
|
||||
QCheckBox* my0DElemsTB;
|
||||
QCheckBox* myEdgesTB;
|
||||
QCheckBox* myFacesTB;
|
||||
|
@ -55,6 +55,14 @@ public:
|
||||
void SetPointsData( SMDS_Mesh* theMesh, const TColStd_MapOfInteger & theNodesIdMap );
|
||||
void SetElemsData ( const std::vector<int> & theElemsIdMap,
|
||||
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 AddToRender ( vtkRenderer* theRenderer );
|
||||
|
@ -33,6 +33,7 @@
|
||||
#include "SMESHDS_Mesh.hxx"
|
||||
#include "SMESHGUI.h"
|
||||
#include "SMESHGUI_FilterUtils.h"
|
||||
#include "SMESHGUI_IdPreview.h"
|
||||
#include "SMESHGUI_IdValidator.h"
|
||||
#include "SMESHGUI_SpinBox.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
|
||||
*/
|
||||
SMESHGUI_MeshInfoDlg::SMESHGUI_MeshInfoDlg( QWidget* parent, int page )
|
||||
: QDialog( parent ), myActor( 0 )
|
||||
: QDialog( parent ), myActor( 0 )
|
||||
{
|
||||
setModal( false );
|
||||
setAttribute( Qt::WA_DeleteOnClose, true );
|
||||
@ -2850,6 +2851,8 @@ SMESHGUI_MeshInfoDlg::SMESHGUI_MeshInfoDlg( QWidget* parent, int page )
|
||||
myMode->button( NodeMode )->setChecked( true );
|
||||
myID = new QLineEdit( w );
|
||||
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 );
|
||||
mode = qMin( 1, qMax( 0, mode ) );
|
||||
@ -2865,7 +2868,8 @@ SMESHGUI_MeshInfoDlg::SMESHGUI_MeshInfoDlg( QWidget* parent, int page )
|
||||
elemLayout->addWidget( myMode->button( NodeMode ), 0, 0 );
|
||||
elemLayout->addWidget( myMode->button( ElemMode ), 0, 1 );
|
||||
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" ) );
|
||||
|
||||
@ -2905,18 +2909,19 @@ SMESHGUI_MeshInfoDlg::SMESHGUI_MeshInfoDlg( QWidget* parent, int page )
|
||||
l->addWidget( myTabWidget );
|
||||
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( dumpBtn, SIGNAL( clicked() ), this, SLOT( dump() ) );
|
||||
connect( helpBtn, SIGNAL( clicked() ), this, SLOT( help() ) );
|
||||
connect( myTabWidget, SIGNAL( currentChanged( int ) ), this, SLOT( updateSelection() ) );
|
||||
connect( myMode, SIGNAL( buttonClicked( int ) ), this, SLOT( modeChanged() ) );
|
||||
connect( myID, SIGNAL( textChanged( QString ) ), this, SLOT( idChanged() ) );
|
||||
connect( SMESHGUI::GetSMESHGUI(), SIGNAL( SignalDeactivateActiveDialog() ), this, SLOT( deactivate() ) );
|
||||
connect( SMESHGUI::GetSMESHGUI(), SIGNAL( SignalCloseAllDialogs() ), this, SLOT( reject() ) );
|
||||
connect( myElemInfo, SIGNAL( itemInfo( int ) ), this, SLOT( showItemInfo( int ) ) );
|
||||
connect( myElemInfo, SIGNAL( itemInfo( QString ) ), this, SLOT( showItemInfo( QString ) ) );
|
||||
connect( okBtn, SIGNAL( clicked() ), this, SLOT( reject() ));
|
||||
connect( dumpBtn, SIGNAL( clicked() ), this, SLOT( dump() ));
|
||||
connect( helpBtn, SIGNAL( clicked() ), this, SLOT( help() ));
|
||||
connect( myTabWidget, SIGNAL( currentChanged( int ) ), this, SLOT( updateSelection() ));
|
||||
connect( myMode, SIGNAL( buttonClicked( int ) ), this, SLOT( modeChanged() ));
|
||||
connect( myID, SIGNAL( textChanged( QString ) ), this, SLOT( idChanged() ));
|
||||
connect( myIDPreviewCheck, SIGNAL( toggled(bool) ), this, SLOT( idPreviewChange(bool) ));
|
||||
connect( SMESHGUI::GetSMESHGUI(), SIGNAL( SignalDeactivateActiveDialog() ), this, SLOT( deactivate() ));
|
||||
connect( SMESHGUI::GetSMESHGUI(), SIGNAL( SignalCloseAllDialogs() ), this, SLOT( reject() ));
|
||||
connect( myElemInfo, SIGNAL( itemInfo( int ) ), this, SLOT( showItemInfo( int )));
|
||||
connect( myElemInfo, SIGNAL( itemInfo( QString ) ), this, SLOT( showItemInfo( QString )));
|
||||
|
||||
updateSelection();
|
||||
}
|
||||
@ -2926,6 +2931,7 @@ SMESHGUI_MeshInfoDlg::SMESHGUI_MeshInfoDlg( QWidget* parent, int page )
|
||||
*/
|
||||
SMESHGUI_MeshInfoDlg::~SMESHGUI_MeshInfoDlg()
|
||||
{
|
||||
delete myIDPreview;
|
||||
}
|
||||
|
||||
/*!
|
||||
@ -2983,6 +2989,7 @@ void SMESHGUI_MeshInfoDlg::reject()
|
||||
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow() )
|
||||
aViewWindow->SetSelectionMode( ActorSelection );
|
||||
QDialog::reject();
|
||||
myIDPreview->SetPointsLabeled(false);
|
||||
}
|
||||
|
||||
/*!
|
||||
@ -3016,7 +3023,9 @@ void SMESHGUI_MeshInfoDlg::updateSelection()
|
||||
disconnect( selMgr, 0, this, 0 );
|
||||
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 );
|
||||
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow() )
|
||||
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()
|
||||
{
|
||||
myIDPreview->SetPointsLabeled( false );
|
||||
|
||||
SVTK_Selector* selector = SMESH::GetSelector();
|
||||
if ( myActor && selector ) {
|
||||
Handle(SALOME_InteractiveObject) IO = myActor->getIO();
|
||||
TColStd_MapOfInteger ID;
|
||||
QSet<long> ids;
|
||||
std::vector<int> idVec;
|
||||
std::list< gp_XYZ > aGrCentersXYZ;
|
||||
QStringList idTxt = myID->text().split( " ", QString::SkipEmptyParts );
|
||||
foreach ( QString tid, idTxt ) {
|
||||
long id = tid.trimmed().toLong();
|
||||
@ -3124,10 +3137,26 @@ void SMESHGUI_MeshInfoDlg::idChanged()
|
||||
if ( e ) {
|
||||
ID.Add( id );
|
||||
ids << id;
|
||||
if ( myMode->checkedId() == ElemMode )
|
||||
{
|
||||
idVec.push_back( id );
|
||||
aGrCentersXYZ.push_back( myElemInfo->getGravityCenter( e ));
|
||||
}
|
||||
}
|
||||
}
|
||||
selector->AddOrRemoveIndex( IO, ID, false );
|
||||
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->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 )
|
||||
{
|
||||
if ( id > 0 && myActor->GetObject()->GetMesh()->FindNode( id ) ) {
|
||||
|
@ -52,17 +52,19 @@
|
||||
|
||||
class QAbstractButton;
|
||||
class QButtonGroup;
|
||||
class QCheckBox;
|
||||
class QContextMenuEvent;
|
||||
class QGridLayout;
|
||||
class QLabel;
|
||||
class QLineEdit;
|
||||
class QPushButton;
|
||||
class QTabWidget;
|
||||
class QTextBrowser;
|
||||
class QGridLayout;
|
||||
class SMESH_Actor;
|
||||
class SMDS_MeshNode;
|
||||
class SMDS_MeshElement;
|
||||
class SMDS_MeshNode;
|
||||
class SMESHGUI_IdPreview;
|
||||
class SMESHGUI_SpinBox;
|
||||
class SMESH_Actor;
|
||||
|
||||
class ExtraWidget;
|
||||
|
||||
@ -157,6 +159,8 @@ public:
|
||||
void clear();
|
||||
virtual void saveInfo( QTextStream &out ) = 0;
|
||||
|
||||
gp_XYZ getGravityCenter( const SMDS_MeshElement* e ) { return gravityCenter(e); }
|
||||
|
||||
protected:
|
||||
struct XYZ
|
||||
{
|
||||
@ -168,6 +172,7 @@ protected:
|
||||
double x() const { return myX; }
|
||||
double y() const { return myY; }
|
||||
double z() const { return myZ; }
|
||||
operator gp_XYZ() const { return gp_XYZ( myX, myY, myZ ); }
|
||||
};
|
||||
typedef QMap< int, QList<int> > Connectivity;
|
||||
|
||||
@ -382,6 +387,7 @@ private slots:
|
||||
void deactivate();
|
||||
void modeChanged();
|
||||
void idChanged();
|
||||
void idPreviewChange(bool);
|
||||
void showItemInfo( int );
|
||||
void showItemInfo( const QString& );
|
||||
void dump();
|
||||
@ -391,6 +397,8 @@ private:
|
||||
SMESHGUI_MeshInfo* myBaseInfo;
|
||||
QButtonGroup* myMode;
|
||||
QLineEdit* myID;
|
||||
QCheckBox* myIDPreviewCheck;
|
||||
SMESHGUI_IdPreview* myIDPreview;
|
||||
SMESHGUI_ElemInfo* myElemInfo;
|
||||
SMESHGUI_AddInfo* myAddInfo;
|
||||
SMESHGUI_CtrlInfo* myCtrlInfo;
|
||||
|
@ -120,7 +120,8 @@ QVariant SMESHGUI_Selection::parameter( const int ind, const QString& p ) const
|
||||
if ( p=="client" ) val = QVariant( LightApp_Selection::parameter( p ) );
|
||||
else if ( p=="type" ) val = QVariant( myTypes[ind] );
|
||||
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=="numberOfNodes" ) val = QVariant( numberOfNodes( 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
|
||||
//=======================================================================
|
||||
|
||||
QList<QVariant> SMESHGUI_Selection::elemTypes( int ind ) const
|
||||
QList<QVariant> SMESHGUI_Selection::elemTypes( int ind, bool fromObj ) const
|
||||
{
|
||||
QList<QVariant> types;
|
||||
SMESH_Actor* actor = getActor( ind );
|
||||
if ( actor ) {
|
||||
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" );
|
||||
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;
|
||||
@ -440,13 +465,10 @@ bool SMESHGUI_Selection::isAutoColor( int ind ) const
|
||||
{
|
||||
_PTR(SObject) sobj = SMESH::GetActiveStudyDocument()->FindObjectID( entry( ind ).toLatin1().data() );
|
||||
CORBA::Object_var obj = SMESH::SObjectToObject( sobj, SMESH::GetActiveStudyDocument() );
|
||||
|
||||
if ( !CORBA::is_nil( obj ) ) {
|
||||
SMESH::SMESH_Mesh_var mesh = SMESH::SMESH_Mesh::_narrow( obj );
|
||||
if ( !CORBA::is_nil( mesh ) )
|
||||
return mesh->GetAutoColor();
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -71,8 +71,8 @@ public:
|
||||
virtual int nbChildren( int ) const;
|
||||
virtual bool isContainer( int ) const;
|
||||
|
||||
// parameters got from actor return nothing if an actor is not visible
|
||||
virtual QList<QVariant> elemTypes( int ) const;
|
||||
// parameters got from actor, return nothing if an actor is not visible
|
||||
virtual QList<QVariant> elemTypes( int, bool ) const; // == objElemTypes w/o actor
|
||||
virtual QList<QVariant> labeledTypes( int ) const;
|
||||
virtual QString displayMode( int ) const;
|
||||
virtual QString shrinkMode( int ) const;
|
||||
|
@ -7422,6 +7422,10 @@ as they are of improper type:
|
||||
<source>ELEM_MODE</source>
|
||||
<translation>Element</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>SHOW_IDS</source>
|
||||
<translation>Show IDs</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>BUT_DUMP_MESH</source>
|
||||
<translation>&Dump</translation>
|
||||
|
@ -459,6 +459,7 @@ struct SMESH_ElementSearcherImpl: public SMESH_ElementSearcher
|
||||
_ebbTree[i] = NULL;
|
||||
_ebbTreeHeight[i] = -1;
|
||||
}
|
||||
_elementType = SMDSAbs_All;
|
||||
}
|
||||
virtual ~SMESH_ElementSearcherImpl()
|
||||
{
|
||||
@ -878,10 +879,10 @@ SMESH_ElementSearcherImpl::FindClosestTo( const gp_Pnt& point,
|
||||
|
||||
TopAbs_State SMESH_ElementSearcherImpl::GetPointState(const gp_Pnt& point)
|
||||
{
|
||||
double tolerance = getTolerance();
|
||||
|
||||
_elementType = SMDSAbs_Face;
|
||||
|
||||
double tolerance = getTolerance();
|
||||
|
||||
ElementBndBoxTree*& ebbTree = _ebbTree[ SMDSAbs_Face ];
|
||||
if ( !ebbTree )
|
||||
ebbTree = new ElementBndBoxTree( *_mesh, _elementType, _meshPartIt );
|
||||
|
@ -1469,7 +1469,7 @@ class Mesh:
|
||||
errText = "code %s" % -err.code
|
||||
if errText: errText += ". "
|
||||
errText += err.comment
|
||||
if allReasons != "":allReasons += "\n"
|
||||
if allReasons: allReasons += "\n"
|
||||
if ok:
|
||||
allReasons += '- "%s"%s - %s' %(err.algoName, shapeText, errText)
|
||||
else:
|
||||
@ -1507,7 +1507,7 @@ class Mesh:
|
||||
reason = ("For unknown reason. "
|
||||
"Developer, revise Mesh.Compute() implementation in smeshBuilder.py!")
|
||||
pass
|
||||
if allReasons != "":allReasons += "\n"
|
||||
if allReasons: allReasons += "\n"
|
||||
allReasons += "- " + reason
|
||||
pass
|
||||
if not ok or allReasons != "":
|
||||
|
@ -445,6 +445,7 @@ namespace VISCOUS_3D
|
||||
bool Is ( int flag ) const { return _flags & flag; }
|
||||
void Set ( int flag ) { _flags |= flag; }
|
||||
void Unset( int flag ) { _flags &= ~flag; }
|
||||
std::string DumpFlags() const; // debug
|
||||
|
||||
void SetNewLength( double len, _EdgesOnShape& eos, SMESH_MesherHelper& helper );
|
||||
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)
|
||||
{
|
||||
SMESH_MesherHelper& helper = data.GetHelper();
|
||||
|
Loading…
Reference in New Issue
Block a user