mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2025-04-25 04:02:03 +05:00
Fix problems with quadratic elements preview in 'Add Quadriatic element' dialog box.
This commit is contained in:
parent
e48a1779f1
commit
3506ddb84a
@ -316,6 +316,54 @@ static int FirstHexahedronIds[] = {0,1,2,3,4,5,6,7,0,1,2,3};
|
|||||||
static int LastHexahedronIds[] = {1,2,3,0,5,6,7,4,4,5,6,7};
|
static int LastHexahedronIds[] = {1,2,3,0,5,6,7,4,4,5,6,7};
|
||||||
|
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\class BusyLocker
|
||||||
|
\brief Simple 'busy state' flag locker.
|
||||||
|
\internal
|
||||||
|
*/
|
||||||
|
|
||||||
|
class BusyLocker
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
//! Constructor. Sets passed boolean flag to \c true.
|
||||||
|
BusyLocker( bool& busy ) : myBusy( busy ) { myBusy = true; }
|
||||||
|
//! Destructor. Clear external boolean flag passed as parameter to the constructor to \c false.
|
||||||
|
~BusyLocker() { myBusy = false; }
|
||||||
|
private:
|
||||||
|
bool& myBusy; //! External 'busy state' boolean flag
|
||||||
|
};
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\class IdEditItem
|
||||||
|
\brief Simple editable table item.
|
||||||
|
\internal
|
||||||
|
*/
|
||||||
|
|
||||||
|
class IdEditItem: public QTableItem
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
IdEditItem(QTable*, EditType, const QString& );
|
||||||
|
~IdEditItem();
|
||||||
|
|
||||||
|
QWidget* createEditor() const;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
IdEditItem::IdEditItem(QTable* table, EditType et, const QString& text )
|
||||||
|
: QTableItem( table, et, text )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
IdEditItem::~IdEditItem()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
QWidget* IdEditItem::createEditor() const
|
||||||
|
{
|
||||||
|
QLineEdit *aLineEdit = new QLineEdit(text(), table()->viewport());
|
||||||
|
aLineEdit->setValidator( new SMESHGUI_IdValidator(table()->viewport(), "validator", 1) );
|
||||||
|
return aLineEdit;
|
||||||
|
}
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : SMESHGUI_AddQuadraticElementDlg()
|
// function : SMESHGUI_AddQuadraticElementDlg()
|
||||||
@ -329,7 +377,8 @@ SMESHGUI_AddQuadraticElementDlg::SMESHGUI_AddQuadraticElementDlg( SMESHGUI* theM
|
|||||||
WStyle_Title | WStyle_SysMenu | Qt::WDestructiveClose),
|
WStyle_Title | WStyle_SysMenu | Qt::WDestructiveClose),
|
||||||
mySMESHGUI( theModule ),
|
mySMESHGUI( theModule ),
|
||||||
mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ),
|
mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ),
|
||||||
myType( theType )
|
myType( theType ),
|
||||||
|
myBusy( false )
|
||||||
{
|
{
|
||||||
SalomeApp_Application* anApp = dynamic_cast<SalomeApp_Application*>
|
SalomeApp_Application* anApp = dynamic_cast<SalomeApp_Application*>
|
||||||
(SUIT_Session::session()->activeApplication());
|
(SUIT_Session::session()->activeApplication());
|
||||||
@ -487,7 +536,6 @@ void SMESHGUI_AddQuadraticElementDlg::Init()
|
|||||||
{
|
{
|
||||||
GroupArguments->show();
|
GroupArguments->show();
|
||||||
myRadioButton1->setChecked(TRUE);
|
myRadioButton1->setChecked(TRUE);
|
||||||
myIsEditCorners = true;
|
|
||||||
mySMESHGUI->SetActiveDialogBox((QDialog*)this);
|
mySMESHGUI->SetActiveDialogBox((QDialog*)this);
|
||||||
|
|
||||||
myActor = 0;
|
myActor = 0;
|
||||||
@ -554,8 +602,8 @@ void SMESHGUI_AddQuadraticElementDlg::Init()
|
|||||||
|
|
||||||
for ( int row = 0; row < myTable->numRows(); row++ )
|
for ( int row = 0; row < myTable->numRows(); row++ )
|
||||||
{
|
{
|
||||||
SMESHGUI_IdEditItem* anEditItem = new SMESHGUI_IdEditItem( myTable, QTableItem::OnTyping, "" );
|
IdEditItem* anEditItem = new IdEditItem( myTable, QTableItem::OnTyping, "" );
|
||||||
anEditItem->setReplaceable(false);
|
anEditItem->setReplaceable(true);
|
||||||
myTable->setItem(row, 1, anEditItem);
|
myTable->setItem(row, 1, anEditItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -583,8 +631,6 @@ void SMESHGUI_AddQuadraticElementDlg::Init()
|
|||||||
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
|
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
|
||||||
aViewWindow->SetSelectionMode( NodeSelection );
|
aViewWindow->SetSelectionMode( NodeSelection );
|
||||||
|
|
||||||
myBusy = false;
|
|
||||||
|
|
||||||
SetEditCorners();
|
SetEditCorners();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -594,8 +640,10 @@ void SMESHGUI_AddQuadraticElementDlg::Init()
|
|||||||
//=================================================================================
|
//=================================================================================
|
||||||
void SMESHGUI_AddQuadraticElementDlg::ClickOnApply()
|
void SMESHGUI_AddQuadraticElementDlg::ClickOnApply()
|
||||||
{
|
{
|
||||||
if (IsValid() && !mySMESHGUI->isActiveStudyLocked()) {
|
if ( mySMESHGUI->isActiveStudyLocked() || myBusy || !IsValid() )
|
||||||
myBusy = true;
|
return;
|
||||||
|
|
||||||
|
BusyLocker lock( myBusy );
|
||||||
|
|
||||||
vector<int> anIds;
|
vector<int> anIds;
|
||||||
|
|
||||||
@ -645,17 +693,13 @@ void SMESHGUI_AddQuadraticElementDlg::ClickOnApply()
|
|||||||
mySelector->ClearIndex();
|
mySelector->ClearIndex();
|
||||||
mySelectionMgr->setSelectedObjects( aList, false );
|
mySelectionMgr->setSelectedObjects( aList, false );
|
||||||
|
|
||||||
SMESH::UpdateView();
|
|
||||||
mySimulation->SetVisibility(false);
|
mySimulation->SetVisibility(false);
|
||||||
|
SMESH::UpdateView();
|
||||||
buttonOk->setEnabled(false);
|
|
||||||
buttonApply->setEnabled(false);
|
|
||||||
|
|
||||||
UpdateTable();
|
UpdateTable();
|
||||||
SetEditCorners();
|
SetEditCorners();
|
||||||
|
|
||||||
myBusy = false;
|
updateButtons();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
@ -666,7 +710,6 @@ void SMESHGUI_AddQuadraticElementDlg::ClickOnOk()
|
|||||||
{
|
{
|
||||||
ClickOnApply();
|
ClickOnApply();
|
||||||
ClickOnCancel();
|
ClickOnCancel();
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
@ -683,7 +726,6 @@ void SMESHGUI_AddQuadraticElementDlg::ClickOnCancel()
|
|||||||
disconnect(mySelectionMgr, 0, this, 0);
|
disconnect(mySelectionMgr, 0, this, 0);
|
||||||
mySMESHGUI->ResetState();
|
mySMESHGUI->ResetState();
|
||||||
reject();
|
reject();
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
@ -702,7 +744,7 @@ void SMESHGUI_AddQuadraticElementDlg::ClickOnHelp()
|
|||||||
#else
|
#else
|
||||||
platform = "application";
|
platform = "application";
|
||||||
#endif
|
#endif
|
||||||
SUIT_MessageBox::warn1(0, QObject::tr("WRN_WARNING"),
|
SUIT_MessageBox::warn1(this, QObject::tr("WRN_WARNING"),
|
||||||
QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
|
QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
|
||||||
arg(app->resourceMgr()->stringValue("ExternalBrowser", platform)).arg(myHelpFileName),
|
arg(app->resourceMgr()->stringValue("ExternalBrowser", platform)).arg(myHelpFileName),
|
||||||
QObject::tr("BUT_OK"));
|
QObject::tr("BUT_OK"));
|
||||||
@ -716,10 +758,7 @@ void SMESHGUI_AddQuadraticElementDlg::ClickOnHelp()
|
|||||||
void SMESHGUI_AddQuadraticElementDlg::onTextChange (const QString& theNewText)
|
void SMESHGUI_AddQuadraticElementDlg::onTextChange (const QString& theNewText)
|
||||||
{
|
{
|
||||||
if (myBusy) return;
|
if (myBusy) return;
|
||||||
myBusy = true;
|
BusyLocker lock( myBusy );
|
||||||
|
|
||||||
buttonOk->setEnabled(false);
|
|
||||||
buttonApply->setEnabled(false);
|
|
||||||
|
|
||||||
mySimulation->SetVisibility(false);
|
mySimulation->SetVisibility(false);
|
||||||
|
|
||||||
@ -735,7 +774,9 @@ void SMESHGUI_AddQuadraticElementDlg::onTextChange (const QString& theNewText)
|
|||||||
bool allOk = true;
|
bool allOk = true;
|
||||||
for (int i = 0; i < aListId.count(); i++) {
|
for (int i = 0; i < aListId.count(); i++) {
|
||||||
if ( const SMDS_MeshNode * n = aMesh->FindNode( aListId[ i ].toInt() ) )
|
if ( const SMDS_MeshNode * n = aMesh->FindNode( aListId[ i ].toInt() ) )
|
||||||
|
{
|
||||||
newIndices.Add( n->GetID() );
|
newIndices.Add( n->GetID() );
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
allOk = false;
|
allOk = false;
|
||||||
@ -751,15 +792,8 @@ void SMESHGUI_AddQuadraticElementDlg::onTextChange (const QString& theNewText)
|
|||||||
UpdateTable( allOk );
|
UpdateTable( allOk );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( IsValid() ) {
|
updateButtons();
|
||||||
buttonOk->setEnabled(true);
|
|
||||||
buttonApply->setEnabled(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( sender() == myTable )
|
|
||||||
displaySimulation();
|
displaySimulation();
|
||||||
|
|
||||||
myBusy = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
@ -769,22 +803,18 @@ void SMESHGUI_AddQuadraticElementDlg::onTextChange (const QString& theNewText)
|
|||||||
void SMESHGUI_AddQuadraticElementDlg::SelectionIntoArgument()
|
void SMESHGUI_AddQuadraticElementDlg::SelectionIntoArgument()
|
||||||
{
|
{
|
||||||
if (myBusy) return;
|
if (myBusy) return;
|
||||||
|
BusyLocker lock( myBusy );
|
||||||
|
|
||||||
if ( myIsEditCorners )
|
if ( myIsEditCorners )
|
||||||
{
|
{
|
||||||
// clear
|
// clear
|
||||||
myActor = 0;
|
myActor = 0;
|
||||||
|
|
||||||
myBusy = true;
|
|
||||||
myCornerNodes->setText("");
|
myCornerNodes->setText("");
|
||||||
myBusy = false;
|
|
||||||
|
|
||||||
if (!GroupButtons->isEnabled()) // inactive
|
if (!GroupButtons->isEnabled()) // inactive
|
||||||
return;
|
return;
|
||||||
|
|
||||||
buttonOk->setEnabled(false);
|
|
||||||
buttonApply->setEnabled(false);
|
|
||||||
|
|
||||||
mySimulation->SetVisibility(false);
|
mySimulation->SetVisibility(false);
|
||||||
|
|
||||||
// get selected mesh
|
// get selected mesh
|
||||||
@ -794,20 +824,25 @@ void SMESHGUI_AddQuadraticElementDlg::SelectionIntoArgument()
|
|||||||
if (aList.Extent() != 1)
|
if (aList.Extent() != 1)
|
||||||
{
|
{
|
||||||
UpdateTable();
|
UpdateTable();
|
||||||
|
updateButtons();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Handle(SALOME_InteractiveObject) anIO = aList.First();
|
Handle(SALOME_InteractiveObject) anIO = aList.First();
|
||||||
myMesh = SMESH::GetMeshByIO(anIO);
|
myMesh = SMESH::GetMeshByIO(anIO);
|
||||||
if (myMesh->_is_nil())
|
if (myMesh->_is_nil()) {
|
||||||
|
updateButtons();
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
myActor = SMESH::FindActorByEntry(anIO->getEntry());
|
myActor = SMESH::FindActorByEntry(anIO->getEntry());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!myActor)
|
if (!myActor) {
|
||||||
|
updateButtons();
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// get selected nodes
|
// get selected nodes
|
||||||
QString aString = "";
|
QString aString = "";
|
||||||
@ -815,27 +850,18 @@ void SMESHGUI_AddQuadraticElementDlg::SelectionIntoArgument()
|
|||||||
|
|
||||||
if ( myIsEditCorners )
|
if ( myIsEditCorners )
|
||||||
{
|
{
|
||||||
myBusy = true;
|
|
||||||
myCornerNodes->setText(aString);
|
myCornerNodes->setText(aString);
|
||||||
myBusy = false;
|
|
||||||
|
|
||||||
UpdateTable();
|
UpdateTable();
|
||||||
}
|
}
|
||||||
else if ( myTable->isEnabled() && nbNodes == 1 )
|
else if ( myTable->isEnabled() && nbNodes == 1 )
|
||||||
{
|
{
|
||||||
myBusy = true;
|
|
||||||
int theRow = myTable->currentRow(), theCol = myTable->currentColumn();
|
int theRow = myTable->currentRow(), theCol = myTable->currentColumn();
|
||||||
if ( theCol == 1 )
|
if ( theCol == 1 )
|
||||||
myTable->setText(theRow, 1, aString);
|
myTable->setText(theRow, 1, aString);
|
||||||
myBusy = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( IsValid() )
|
|
||||||
{
|
|
||||||
buttonOk->setEnabled( true );
|
|
||||||
buttonApply->setEnabled( true );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
updateButtons();
|
||||||
displaySimulation();
|
displaySimulation();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -845,7 +871,8 @@ void SMESHGUI_AddQuadraticElementDlg::SelectionIntoArgument()
|
|||||||
//=================================================================================
|
//=================================================================================
|
||||||
void SMESHGUI_AddQuadraticElementDlg::displaySimulation()
|
void SMESHGUI_AddQuadraticElementDlg::displaySimulation()
|
||||||
{
|
{
|
||||||
if (!myIsEditCorners) {
|
if ( IsValid() )
|
||||||
|
{
|
||||||
SMESH::TElementSimulation::TVTKIds anIds;
|
SMESH::TElementSimulation::TVTKIds anIds;
|
||||||
|
|
||||||
// Collect ids from the dialog
|
// Collect ids from the dialog
|
||||||
@ -879,8 +906,12 @@ void SMESHGUI_AddQuadraticElementDlg::displaySimulation()
|
|||||||
}
|
}
|
||||||
|
|
||||||
mySimulation->SetPosition(myActor,myType,anIds,aDisplayMode,myReverseCB->isChecked());
|
mySimulation->SetPosition(myActor,myType,anIds,aDisplayMode,myReverseCB->isChecked());
|
||||||
SMESH::UpdateView();
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mySimulation->SetVisibility(false);
|
||||||
|
}
|
||||||
|
SMESH::UpdateView();
|
||||||
}
|
}
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
@ -891,8 +922,8 @@ void SMESHGUI_AddQuadraticElementDlg::SetEditCorners()
|
|||||||
{
|
{
|
||||||
myCornerNodes->setFocus();
|
myCornerNodes->setFocus();
|
||||||
myIsEditCorners = true;
|
myIsEditCorners = true;
|
||||||
|
|
||||||
SelectionIntoArgument();
|
SelectionIntoArgument();
|
||||||
|
updateButtons();
|
||||||
}
|
}
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
@ -940,7 +971,6 @@ void SMESHGUI_AddQuadraticElementDlg::enterEvent (QEvent*)
|
|||||||
if (GroupConstructors->isEnabled())
|
if (GroupConstructors->isEnabled())
|
||||||
return;
|
return;
|
||||||
ActivateThisDialog();
|
ActivateThisDialog();
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
@ -951,7 +981,6 @@ void SMESHGUI_AddQuadraticElementDlg::closeEvent (QCloseEvent*)
|
|||||||
{
|
{
|
||||||
/* same than click on cancel button */
|
/* same than click on cancel button */
|
||||||
ClickOnCancel();
|
ClickOnCancel();
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
@ -970,13 +999,9 @@ void SMESHGUI_AddQuadraticElementDlg::hideEvent (QHideEvent*)
|
|||||||
//=================================================================================
|
//=================================================================================
|
||||||
void SMESHGUI_AddQuadraticElementDlg::onReverse (int state)
|
void SMESHGUI_AddQuadraticElementDlg::onReverse (int state)
|
||||||
{
|
{
|
||||||
if (!IsValid())
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (state >= 0) {
|
|
||||||
mySimulation->SetVisibility(false);
|
mySimulation->SetVisibility(false);
|
||||||
displaySimulation();
|
displaySimulation();
|
||||||
}
|
updateButtons();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1083,11 +1108,9 @@ void SMESHGUI_AddQuadraticElementDlg::UpdateTable( bool theConersValidity )
|
|||||||
//=================================================================================
|
//=================================================================================
|
||||||
void SMESHGUI_AddQuadraticElementDlg::onCellDoubleClicked( int theRow, int theCol, int theButton, const QPoint& theMousePos )
|
void SMESHGUI_AddQuadraticElementDlg::onCellDoubleClicked( int theRow, int theCol, int theButton, const QPoint& theMousePos )
|
||||||
{
|
{
|
||||||
if ( theButton == 1 && theCol == 1 )
|
|
||||||
myIsEditCorners = false;
|
myIsEditCorners = false;
|
||||||
|
|
||||||
displaySimulation();
|
displaySimulation();
|
||||||
return;
|
updateButtons();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1097,17 +1120,12 @@ void SMESHGUI_AddQuadraticElementDlg::onCellDoubleClicked( int theRow, int theCo
|
|||||||
//=================================================================================
|
//=================================================================================
|
||||||
void SMESHGUI_AddQuadraticElementDlg::onCellTextChange(int theRow, int theCol)
|
void SMESHGUI_AddQuadraticElementDlg::onCellTextChange(int theRow, int theCol)
|
||||||
{
|
{
|
||||||
onTextChange( myTable->text(theRow, theCol) );
|
myIsEditCorners = false;
|
||||||
|
displaySimulation();
|
||||||
|
updateButtons();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QWidget* SMESHGUI_IdEditItem::createEditor() const
|
|
||||||
{
|
|
||||||
QLineEdit *aLineEdit = new QLineEdit(text(), table()->viewport());
|
|
||||||
aLineEdit->setValidator( new SMESHGUI_IdValidator(table()->viewport(), "validator", 1) );
|
|
||||||
return aLineEdit;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : keyPressEvent()
|
// function : keyPressEvent()
|
||||||
// purpose :
|
// purpose :
|
||||||
@ -1124,3 +1142,10 @@ void SMESHGUI_AddQuadraticElementDlg::keyPressEvent( QKeyEvent* e )
|
|||||||
ClickOnHelp();
|
ClickOnHelp();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SMESHGUI_AddQuadraticElementDlg::updateButtons()
|
||||||
|
{
|
||||||
|
bool valid = IsValid();
|
||||||
|
buttonOk->setEnabled( valid );
|
||||||
|
buttonApply->setEnabled( valid );
|
||||||
|
}
|
||||||
|
@ -71,6 +71,7 @@ private:
|
|||||||
void displaySimulation();
|
void displaySimulation();
|
||||||
void UpdateTable( bool theConersValidity = true );
|
void UpdateTable( bool theConersValidity = true );
|
||||||
bool IsValid();
|
bool IsValid();
|
||||||
|
void updateButtons();
|
||||||
|
|
||||||
SMESHGUI* mySMESHGUI; /* Current SMESHGUI object */
|
SMESHGUI* mySMESHGUI; /* Current SMESHGUI object */
|
||||||
LightApp_SelectionMgr* mySelectionMgr; /* User shape selection */
|
LightApp_SelectionMgr* mySelectionMgr; /* User shape selection */
|
||||||
@ -119,15 +120,4 @@ private slots:
|
|||||||
void ActivateThisDialog() ;
|
void ActivateThisDialog() ;
|
||||||
};
|
};
|
||||||
|
|
||||||
class SMESHGUI_IdEditItem: public QTableItem
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
SMESHGUI_IdEditItem(QTable* table, EditType et, const QString& text ):
|
|
||||||
QTableItem(table, et, text) {};
|
|
||||||
~SMESHGUI_IdEditItem() {};
|
|
||||||
|
|
||||||
QWidget* createEditor() const;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
#endif // DIALOGBOX_ADD_QUADRATIC_ELEMENT_H
|
#endif // DIALOGBOX_ADD_QUADRATIC_ELEMENT_H
|
||||||
|
Loading…
x
Reference in New Issue
Block a user