mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2024-12-26 17:30:35 +05:00
Start implementation of the "21177: EDF 1563 SMESH: Preview of mesh during a modification" issue.
This commit is contained in:
parent
b3a725059c
commit
512a892301
@ -95,6 +95,7 @@ salomeinclude_HEADERS = \
|
|||||||
SMESHGUI_MeshOrderOp.h \
|
SMESHGUI_MeshOrderOp.h \
|
||||||
SMESHGUI_FileValidator.h \
|
SMESHGUI_FileValidator.h \
|
||||||
SMESHGUI_CopyMeshDlg.h \
|
SMESHGUI_CopyMeshDlg.h \
|
||||||
|
SMESHGUI_PreviewDlg.h \
|
||||||
SMESH_SMESHGUI.hxx
|
SMESH_SMESHGUI.hxx
|
||||||
|
|
||||||
# Libraries targets
|
# Libraries targets
|
||||||
@ -169,7 +170,8 @@ dist_libSMESH_la_SOURCES = \
|
|||||||
SMESHGUI_MeshOrderDlg.cxx \
|
SMESHGUI_MeshOrderDlg.cxx \
|
||||||
SMESHGUI_MeshOrderOp.cxx \
|
SMESHGUI_MeshOrderOp.cxx \
|
||||||
SMESHGUI_CopyMeshDlg.cxx \
|
SMESHGUI_CopyMeshDlg.cxx \
|
||||||
SMESHGUI_FileValidator.cxx
|
SMESHGUI_FileValidator.cxx \
|
||||||
|
SMESHGUI_PreviewDlg.cxx
|
||||||
|
|
||||||
MOC_FILES = \
|
MOC_FILES = \
|
||||||
SMESHGUI_moc.cxx \
|
SMESHGUI_moc.cxx \
|
||||||
@ -227,7 +229,8 @@ MOC_FILES = \
|
|||||||
SMESHGUI_FindElemByPointDlg_moc.cxx \
|
SMESHGUI_FindElemByPointDlg_moc.cxx \
|
||||||
SMESHGUI_MeshOrderDlg_moc.cxx \
|
SMESHGUI_MeshOrderDlg_moc.cxx \
|
||||||
SMESHGUI_CopyMeshDlg_moc.cxx \
|
SMESHGUI_CopyMeshDlg_moc.cxx \
|
||||||
SMESHGUI_MeshOrderOp_moc.cxx
|
SMESHGUI_MeshOrderOp_moc.cxx \
|
||||||
|
SMESHGUI_PreviewDlg_moc.cxx
|
||||||
|
|
||||||
nodist_libSMESH_la_SOURCES= \
|
nodist_libSMESH_la_SOURCES= \
|
||||||
$(MOC_FILES)
|
$(MOC_FILES)
|
||||||
|
@ -34,6 +34,7 @@
|
|||||||
#include "SMESHGUI_SpinBox.h"
|
#include "SMESHGUI_SpinBox.h"
|
||||||
#include "SMESHGUI_IdValidator.h"
|
#include "SMESHGUI_IdValidator.h"
|
||||||
#include "SMESHGUI_FilterDlg.h"
|
#include "SMESHGUI_FilterDlg.h"
|
||||||
|
#include "SMESHGUI_MeshEditPreview.h"
|
||||||
|
|
||||||
#include <SMESH_Actor.h>
|
#include <SMESH_Actor.h>
|
||||||
#include <SMESH_TypeFilter.hxx>
|
#include <SMESH_TypeFilter.hxx>
|
||||||
@ -109,8 +110,7 @@ private:
|
|||||||
// purpose : constructor
|
// purpose : constructor
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
SMESHGUI_ExtrusionAlongPathDlg::SMESHGUI_ExtrusionAlongPathDlg( SMESHGUI* theModule )
|
SMESHGUI_ExtrusionAlongPathDlg::SMESHGUI_ExtrusionAlongPathDlg( SMESHGUI* theModule )
|
||||||
: QDialog( SMESH::GetDesktop( theModule ) ),
|
: SMESHGUI_PreviewDlg( theModule ),
|
||||||
mySMESHGUI( theModule ),
|
|
||||||
mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ),
|
mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ),
|
||||||
myFilterDlg( 0 )
|
myFilterDlg( 0 )
|
||||||
{
|
{
|
||||||
@ -262,6 +262,9 @@ SMESHGUI_ExtrusionAlongPathDlg::SMESHGUI_ExtrusionAlongPathDlg( SMESHGUI* theMod
|
|||||||
MakeGroupsCheck = new QCheckBox(tr("SMESH_MAKE_GROUPS"), GroupArguments);
|
MakeGroupsCheck = new QCheckBox(tr("SMESH_MAKE_GROUPS"), GroupArguments);
|
||||||
MakeGroupsCheck->setChecked(true);
|
MakeGroupsCheck->setChecked(true);
|
||||||
|
|
||||||
|
//Preview check box
|
||||||
|
myPreviewCheckBox = new QCheckBox(tr("PREVIEW"), GroupArguments);
|
||||||
|
|
||||||
// layouting
|
// layouting
|
||||||
GroupArgumentsLayout->addWidget(ElementsLab, 0, 0);
|
GroupArgumentsLayout->addWidget(ElementsLab, 0, 0);
|
||||||
GroupArgumentsLayout->addWidget(SelectElementsButton, 0, 1);
|
GroupArgumentsLayout->addWidget(SelectElementsButton, 0, 1);
|
||||||
@ -271,7 +274,8 @@ SMESHGUI_ExtrusionAlongPathDlg::SMESHGUI_ExtrusionAlongPathDlg( SMESHGUI* theMod
|
|||||||
GroupArgumentsLayout->addWidget(PathGrp, 2, 0, 1, 4);
|
GroupArgumentsLayout->addWidget(PathGrp, 2, 0, 1, 4);
|
||||||
GroupArgumentsLayout->addWidget(BasePointGrp, 3, 0, 1, 4);
|
GroupArgumentsLayout->addWidget(BasePointGrp, 3, 0, 1, 4);
|
||||||
GroupArgumentsLayout->addWidget(AnglesGrp, 4, 0, 1, 4);
|
GroupArgumentsLayout->addWidget(AnglesGrp, 4, 0, 1, 4);
|
||||||
GroupArgumentsLayout->addWidget(MakeGroupsCheck, 5, 0, 1, 4);
|
GroupArgumentsLayout->addWidget(myPreviewCheckBox, 5, 0, 1, 4);
|
||||||
|
GroupArgumentsLayout->addWidget(MakeGroupsCheck, 6, 0, 1, 4);
|
||||||
|
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
// common buttons group box
|
// common buttons group box
|
||||||
@ -362,6 +366,17 @@ SMESHGUI_ExtrusionAlongPathDlg::SMESHGUI_ExtrusionAlongPathDlg( SMESHGUI* theMod
|
|||||||
|
|
||||||
connect(MeshCheck, SIGNAL(toggled(bool)), SLOT(onSelectMesh()));
|
connect(MeshCheck, SIGNAL(toggled(bool)), SLOT(onSelectMesh()));
|
||||||
|
|
||||||
|
connect(XSpin, SIGNAL(valueChanged(double)), this, SLOT(toDisplaySimulation()));
|
||||||
|
connect(YSpin, SIGNAL(valueChanged(double)), this, SLOT(toDisplaySimulation()));
|
||||||
|
connect(ZSpin, SIGNAL(valueChanged(double)), this, SLOT(toDisplaySimulation()));
|
||||||
|
connect(AddAngleButton, SIGNAL(clicked()), this, SLOT(toDisplaySimulation()));
|
||||||
|
connect(RemoveAngleButton, SIGNAL(clicked()), this, SLOT(toDisplaySimulation()));
|
||||||
|
connect(LinearAnglesCheck, SIGNAL(toggled(bool)), SLOT(onSelectMesh()));
|
||||||
|
|
||||||
|
|
||||||
|
//To Connect preview check box
|
||||||
|
connectPreviewControl();
|
||||||
|
|
||||||
AnglesList->installEventFilter(this);
|
AnglesList->installEventFilter(this);
|
||||||
ElementsLineEdit->installEventFilter(this);
|
ElementsLineEdit->installEventFilter(this);
|
||||||
StartPointLineEdit->installEventFilter(this);
|
StartPointLineEdit->installEventFilter(this);
|
||||||
@ -410,6 +425,8 @@ void SMESHGUI_ExtrusionAlongPathDlg::Init (bool ResetControls)
|
|||||||
MeshCheck->setChecked(false);
|
MeshCheck->setChecked(false);
|
||||||
ConstructorsClicked(0);
|
ConstructorsClicked(0);
|
||||||
onSelectMesh();
|
onSelectMesh();
|
||||||
|
myPreviewCheckBox->setChecked(false);
|
||||||
|
onDisplaySimulation(false);
|
||||||
}
|
}
|
||||||
SetEditCurrentArgument(0);
|
SetEditCurrentArgument(0);
|
||||||
}
|
}
|
||||||
@ -424,6 +441,8 @@ void SMESHGUI_ExtrusionAlongPathDlg::ConstructorsClicked (int type)
|
|||||||
|
|
||||||
disconnect(mySelectionMgr, 0, this, 0);
|
disconnect(mySelectionMgr, 0, this, 0);
|
||||||
|
|
||||||
|
hidePreview();
|
||||||
|
|
||||||
if (type == 0)
|
if (type == 0)
|
||||||
GroupArguments->setTitle(tr("EXTRUSION_1D"));
|
GroupArguments->setTitle(tr("EXTRUSION_1D"));
|
||||||
else if (type == 1)
|
else if (type == 1)
|
||||||
@ -480,41 +499,7 @@ bool SMESHGUI_ExtrusionAlongPathDlg::ClickOnApply()
|
|||||||
if (!isValid())
|
if (!isValid())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
SMESH::long_array_var anElementsId = new SMESH::long_array;
|
SMESH::long_array_var anElementsId = getSelectedElements();
|
||||||
|
|
||||||
if (!MeshCheck->isChecked()) {
|
|
||||||
// If "Select whole mesh, submesh or group" check box is off ->
|
|
||||||
// use only elements of given type selected by user
|
|
||||||
|
|
||||||
SMDS_Mesh* aMesh;
|
|
||||||
if ( myMeshActor )
|
|
||||||
aMesh = myMeshActor->GetObject()->GetMesh();
|
|
||||||
|
|
||||||
if (aMesh) {
|
|
||||||
QStringList aListElementsId = ElementsLineEdit->text().split(" ", QString::SkipEmptyParts);
|
|
||||||
anElementsId = new SMESH::long_array;
|
|
||||||
anElementsId->length(aListElementsId.count());
|
|
||||||
bool bOk;
|
|
||||||
int j = 0;
|
|
||||||
for (int i = 0; i < aListElementsId.count(); i++) {
|
|
||||||
long ind = aListElementsId[ i ].toLong(&bOk);
|
|
||||||
if (bOk) {
|
|
||||||
const SMDS_MeshElement* e = aMesh->FindElement(ind);
|
|
||||||
if (e) {
|
|
||||||
bool typeMatch = Elements1dRB->isChecked() && e->GetType() == SMDSAbs_Edge ||
|
|
||||||
Elements2dRB->isChecked() && e->GetType() == SMDSAbs_Face;
|
|
||||||
if (typeMatch)
|
|
||||||
anElementsId[ j++ ] = ind;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
anElementsId->length(j);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (anElementsId->length() <= 0) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (StartPointLineEdit->text().trimmed().isEmpty()) {
|
if (StartPointLineEdit->text().trimmed().isEmpty()) {
|
||||||
return false;
|
return false;
|
||||||
@ -528,18 +513,12 @@ bool SMESHGUI_ExtrusionAlongPathDlg::ClickOnApply()
|
|||||||
|
|
||||||
QStringList aParameters;
|
QStringList aParameters;
|
||||||
|
|
||||||
// get angles
|
//get angles
|
||||||
SMESH::double_array_var anAngles = new SMESH::double_array;
|
SMESH::double_array_var anAngles = getAngles();
|
||||||
if (AnglesGrp->isChecked()) {
|
|
||||||
anAngles->length(myAnglesList.count());
|
for (int i = 0; i < myAnglesList.count(); i++)
|
||||||
int j = 0;
|
|
||||||
for (int i = 0; i < myAnglesList.count(); i++) {
|
|
||||||
double angle = myAnglesList[i];
|
|
||||||
anAngles[ j++ ] = angle*PI/180;
|
|
||||||
aParameters << AnglesList->item(i)->text();
|
aParameters << AnglesList->item(i)->text();
|
||||||
}
|
|
||||||
anAngles->length(j);
|
|
||||||
}
|
|
||||||
|
|
||||||
// get base point
|
// get base point
|
||||||
SMESH::PointStruct aBasePoint;
|
SMESH::PointStruct aBasePoint;
|
||||||
@ -973,6 +952,7 @@ void SMESHGUI_ExtrusionAlongPathDlg::SelectionIntoArgument()
|
|||||||
YSpin->SetValue(n->Y());
|
YSpin->SetValue(n->Y());
|
||||||
ZSpin->SetValue(n->Z());
|
ZSpin->SetValue(n->Z());
|
||||||
}
|
}
|
||||||
|
onDisplaySimulation(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
@ -1286,3 +1266,155 @@ void SMESHGUI_ExtrusionAlongPathDlg::updateLinearAngles()
|
|||||||
LinearAnglesCheck->setChecked( false );
|
LinearAnglesCheck->setChecked( false );
|
||||||
LinearAnglesCheck->setEnabled( enableLinear );
|
LinearAnglesCheck->setEnabled( enableLinear );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=================================================================================
|
||||||
|
// function : isValuesValid()
|
||||||
|
// purpose : Return true in case if values entered into dialog are valid
|
||||||
|
//=================================================================================
|
||||||
|
bool SMESHGUI_ExtrusionAlongPathDlg::isValuesValid() {
|
||||||
|
|
||||||
|
if ( MeshCheck->isChecked() && myIDSource->_is_nil() ||
|
||||||
|
myMesh->_is_nil() ||
|
||||||
|
myPath->_is_nil() )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if(!MeshCheck->isChecked()) {
|
||||||
|
QStringList aListElementsId = ElementsLineEdit->text().split(" ", QString::SkipEmptyParts);
|
||||||
|
if(aListElementsId.count() <= 0)
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool bOk;
|
||||||
|
StartPointLineEdit->text().toLong(&bOk);
|
||||||
|
if (!bOk) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//=================================================================================
|
||||||
|
// function : onDisplaySimulation
|
||||||
|
// purpose : Show/Hide preview
|
||||||
|
//=================================================================================
|
||||||
|
void SMESHGUI_ExtrusionAlongPathDlg::onDisplaySimulation( bool toDisplayPreview ) {
|
||||||
|
if (myPreviewCheckBox->isChecked() && toDisplayPreview) {
|
||||||
|
if(isValid() && isValuesValid()) {
|
||||||
|
|
||||||
|
//Get selected elements:
|
||||||
|
SMESH::long_array_var anElementsId = getSelectedElements();
|
||||||
|
|
||||||
|
// get angles
|
||||||
|
SMESH::double_array_var anAngles = getAngles();
|
||||||
|
|
||||||
|
// get base point
|
||||||
|
SMESH::PointStruct aBasePoint;
|
||||||
|
if (BasePointGrp->isChecked()) {
|
||||||
|
aBasePoint.x = XSpin->GetValue();
|
||||||
|
aBasePoint.y = YSpin->GetValue();
|
||||||
|
aBasePoint.z = ZSpin->GetValue();
|
||||||
|
}
|
||||||
|
bool bOk;
|
||||||
|
long aNodeStart = StartPointLineEdit->text().toLong(&bOk);
|
||||||
|
if (bOk) {
|
||||||
|
|
||||||
|
try {
|
||||||
|
SUIT_OverrideCursor wc;
|
||||||
|
|
||||||
|
SMESH::SMESH_MeshEditor::Extrusion_Error retVal;
|
||||||
|
SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditPreviewer();
|
||||||
|
bool NeedGroups = false;
|
||||||
|
SMESH::ElementType ElemType = SMESH::FACE;
|
||||||
|
if( GetConstructorId() == 0 )
|
||||||
|
ElemType = SMESH::EDGE;
|
||||||
|
if( !MeshCheck->isChecked() ) {
|
||||||
|
aMeshEditor->ExtrusionAlongPathX(anElementsId, myPath, aNodeStart, AnglesGrp->isChecked(),
|
||||||
|
anAngles, LinearAnglesCheck->isChecked(),
|
||||||
|
BasePointGrp->isChecked(), aBasePoint,
|
||||||
|
NeedGroups, ElemType, retVal);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
SMESH::ListOfGroups_var groups =
|
||||||
|
aMeshEditor->ExtrusionAlongPathObjX(myIDSource, myPath, aNodeStart, AnglesGrp->isChecked(),
|
||||||
|
anAngles, LinearAnglesCheck->isChecked(),
|
||||||
|
BasePointGrp->isChecked(), aBasePoint,
|
||||||
|
NeedGroups, ElemType, retVal);
|
||||||
|
}
|
||||||
|
|
||||||
|
wc.suspend();
|
||||||
|
if( retVal == SMESH::SMESH_MeshEditor::EXTR_OK ) {
|
||||||
|
SMESH::MeshPreviewStruct_var aMeshPreviewStruct = aMeshEditor->GetPreviewData();
|
||||||
|
mySimulation->SetData(aMeshPreviewStruct._retn());
|
||||||
|
} else {
|
||||||
|
hidePreview();
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (...) {
|
||||||
|
hidePreview();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
hidePreview();
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
hidePreview();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
hidePreview();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//=================================================================================
|
||||||
|
// function : getSelectedElements
|
||||||
|
// purpose : return list of the selected elements
|
||||||
|
//=================================================================================
|
||||||
|
SMESH::long_array_var SMESHGUI_ExtrusionAlongPathDlg::getSelectedElements() {
|
||||||
|
|
||||||
|
// If "Select whole mesh, submesh or group" check box is off ->
|
||||||
|
// use only elements of given type selected by user
|
||||||
|
SMESH::long_array_var anElementsId = new SMESH::long_array;
|
||||||
|
if (!MeshCheck->isChecked()) {
|
||||||
|
|
||||||
|
SMDS_Mesh* aMesh;
|
||||||
|
if ( myMeshActor )
|
||||||
|
aMesh = myMeshActor->GetObject()->GetMesh();
|
||||||
|
|
||||||
|
if (aMesh) {
|
||||||
|
QStringList aListElementsId = ElementsLineEdit->text().split(" ", QString::SkipEmptyParts);
|
||||||
|
anElementsId = new SMESH::long_array;
|
||||||
|
anElementsId->length(aListElementsId.count());
|
||||||
|
bool bOk;
|
||||||
|
int j = 0;
|
||||||
|
for (int i = 0; i < aListElementsId.count(); i++) {
|
||||||
|
long ind = aListElementsId[ i ].toLong(&bOk);
|
||||||
|
if (bOk) {
|
||||||
|
const SMDS_MeshElement* e = aMesh->FindElement(ind);
|
||||||
|
if (e) {
|
||||||
|
bool typeMatch = Elements1dRB->isChecked() && e->GetType() == SMDSAbs_Edge ||
|
||||||
|
Elements2dRB->isChecked() && e->GetType() == SMDSAbs_Face;
|
||||||
|
if (typeMatch)
|
||||||
|
anElementsId[ j++ ] = ind;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
anElementsId->length(j);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return anElementsId;
|
||||||
|
}
|
||||||
|
|
||||||
|
SMESH::double_array_var SMESHGUI_ExtrusionAlongPathDlg::getAngles() {
|
||||||
|
SMESH::double_array_var anAngles = new SMESH::double_array;
|
||||||
|
if (AnglesGrp->isChecked()) {
|
||||||
|
anAngles->length(myAnglesList.count());
|
||||||
|
int j = 0;
|
||||||
|
for (int i = 0; i < myAnglesList.count(); i++) {
|
||||||
|
double angle = myAnglesList[i];
|
||||||
|
anAngles[ j++ ] = angle*PI/180;
|
||||||
|
}
|
||||||
|
anAngles->length(j);
|
||||||
|
}
|
||||||
|
return anAngles;
|
||||||
|
}
|
||||||
|
@ -29,9 +29,7 @@
|
|||||||
|
|
||||||
// SMESH includes
|
// SMESH includes
|
||||||
#include "SMESH_SMESHGUI.hxx"
|
#include "SMESH_SMESHGUI.hxx"
|
||||||
|
#include "SMESHGUI_PreviewDlg.h"
|
||||||
// Qt includes
|
|
||||||
#include <QDialog>
|
|
||||||
|
|
||||||
// IDL includes
|
// IDL includes
|
||||||
#include <SALOMEconfig.h>
|
#include <SALOMEconfig.h>
|
||||||
@ -60,7 +58,7 @@ class SUIT_SelectionFilter;
|
|||||||
// class : SMESHGUI_ExtrusionAlongPathDlg
|
// class : SMESHGUI_ExtrusionAlongPathDlg
|
||||||
// purpose :
|
// purpose :
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
class SMESHGUI_EXPORT SMESHGUI_ExtrusionAlongPathDlg : public QDialog
|
class SMESHGUI_EXPORT SMESHGUI_ExtrusionAlongPathDlg : public SMESHGUI_PreviewDlg
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
@ -81,10 +79,13 @@ private:
|
|||||||
void SetEditCurrentArgument( QToolButton* );
|
void SetEditCurrentArgument( QToolButton* );
|
||||||
|
|
||||||
bool isValid();
|
bool isValid();
|
||||||
|
bool isValuesValid();
|
||||||
|
|
||||||
|
SMESH::long_array_var getSelectedElements();
|
||||||
|
SMESH::double_array_var getAngles();
|
||||||
|
|
||||||
void updateLinearAngles();
|
void updateLinearAngles();
|
||||||
|
|
||||||
SMESHGUI* mySMESHGUI; /* Current SMESHGUI object */
|
|
||||||
SMESHGUI_IdValidator* myIdValidator;
|
SMESHGUI_IdValidator* myIdValidator;
|
||||||
LightApp_SelectionMgr* mySelectionMgr; /* User shape selection */
|
LightApp_SelectionMgr* mySelectionMgr; /* User shape selection */
|
||||||
SVTK_Selector* mySelector;
|
SVTK_Selector* mySelector;
|
||||||
@ -147,6 +148,7 @@ private:
|
|||||||
|
|
||||||
protected slots:
|
protected slots:
|
||||||
void reject();
|
void reject();
|
||||||
|
virtual void onDisplaySimulation( bool );
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void ConstructorsClicked( int );
|
void ConstructorsClicked( int );
|
||||||
|
@ -34,6 +34,7 @@
|
|||||||
#include "SMESHGUI_SpinBox.h"
|
#include "SMESHGUI_SpinBox.h"
|
||||||
#include "SMESHGUI_IdValidator.h"
|
#include "SMESHGUI_IdValidator.h"
|
||||||
#include "SMESHGUI_FilterDlg.h"
|
#include "SMESHGUI_FilterDlg.h"
|
||||||
|
#include "SMESHGUI_MeshEditPreview.h"
|
||||||
|
|
||||||
#include <SMESH_Actor.h>
|
#include <SMESH_Actor.h>
|
||||||
#include <SMESH_TypeFilter.hxx>
|
#include <SMESH_TypeFilter.hxx>
|
||||||
@ -88,8 +89,7 @@
|
|||||||
// purpose : constructor
|
// purpose : constructor
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
SMESHGUI_ExtrusionDlg::SMESHGUI_ExtrusionDlg (SMESHGUI* theModule)
|
SMESHGUI_ExtrusionDlg::SMESHGUI_ExtrusionDlg (SMESHGUI* theModule)
|
||||||
: QDialog( SMESH::GetDesktop( theModule ) ),
|
: SMESHGUI_PreviewDlg( theModule ),
|
||||||
mySMESHGUI( theModule ),
|
|
||||||
mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ),
|
mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ),
|
||||||
myFilterDlg( 0 ),
|
myFilterDlg( 0 ),
|
||||||
mySelectedObject(SMESH::SMESH_IDSource::_nil())
|
mySelectedObject(SMESH::SMESH_IDSource::_nil())
|
||||||
@ -215,6 +215,9 @@ SMESHGUI_ExtrusionDlg::SMESHGUI_ExtrusionDlg (SMESHGUI* theModule)
|
|||||||
// CheckBox for groups generation
|
// CheckBox for groups generation
|
||||||
MakeGroupsCheck = new QCheckBox(tr("SMESH_MAKE_GROUPS"), GroupArguments);
|
MakeGroupsCheck = new QCheckBox(tr("SMESH_MAKE_GROUPS"), GroupArguments);
|
||||||
|
|
||||||
|
//Preview check box
|
||||||
|
myPreviewCheckBox = new QCheckBox(tr("PREVIEW"), GroupArguments);
|
||||||
|
|
||||||
GroupArgumentsLayout->addWidget(TextLabelElements, 0, 0);
|
GroupArgumentsLayout->addWidget(TextLabelElements, 0, 0);
|
||||||
GroupArgumentsLayout->addWidget(SelectElementsButton, 0, 1);
|
GroupArgumentsLayout->addWidget(SelectElementsButton, 0, 1);
|
||||||
GroupArgumentsLayout->addWidget(LineEditElements, 0, 2, 1, 5);
|
GroupArgumentsLayout->addWidget(LineEditElements, 0, 2, 1, 5);
|
||||||
@ -241,7 +244,8 @@ SMESHGUI_ExtrusionDlg::SMESHGUI_ExtrusionDlg (SMESHGUI* theModule)
|
|||||||
GroupArgumentsLayout->addWidget(SpinBox_VDist, 5, 3);
|
GroupArgumentsLayout->addWidget(SpinBox_VDist, 5, 3);
|
||||||
GroupArgumentsLayout->addWidget(TextLabelNbSteps, 6, 0, 1, 3);
|
GroupArgumentsLayout->addWidget(TextLabelNbSteps, 6, 0, 1, 3);
|
||||||
GroupArgumentsLayout->addWidget(SpinBox_NbSteps, 6, 3);
|
GroupArgumentsLayout->addWidget(SpinBox_NbSteps, 6, 3);
|
||||||
GroupArgumentsLayout->addWidget(MakeGroupsCheck, 7, 0, 1, 8);
|
GroupArgumentsLayout->addWidget(myPreviewCheckBox, 7, 0, 1, 8);
|
||||||
|
GroupArgumentsLayout->addWidget(MakeGroupsCheck, 8, 0, 1, 8);
|
||||||
GroupArgumentsLayout->addItem(new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding), 8, 0);
|
GroupArgumentsLayout->addItem(new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding), 8, 0);
|
||||||
|
|
||||||
|
|
||||||
@ -313,6 +317,18 @@ SMESHGUI_ExtrusionDlg::SMESHGUI_ExtrusionDlg (SMESHGUI* theModule)
|
|||||||
connect(LineEditElements, SIGNAL(textChanged(const QString&)), SLOT(onTextChange(const QString&)));
|
connect(LineEditElements, SIGNAL(textChanged(const QString&)), SLOT(onTextChange(const QString&)));
|
||||||
connect(CheckBoxMesh, SIGNAL(toggled(bool)), SLOT(onSelectMesh(bool)));
|
connect(CheckBoxMesh, SIGNAL(toggled(bool)), SLOT(onSelectMesh(bool)));
|
||||||
|
|
||||||
|
connect(SpinBox_Dx, SIGNAL(valueChanged(double)), this, SLOT(toDisplaySimulation()));
|
||||||
|
connect(SpinBox_Dy, SIGNAL(valueChanged(double)), this, SLOT(toDisplaySimulation()));
|
||||||
|
connect(SpinBox_Dz, SIGNAL(valueChanged(double)), this, SLOT(toDisplaySimulation()));
|
||||||
|
connect(SpinBox_Vx, SIGNAL(valueChanged(double)), this, SLOT(toDisplaySimulation()));
|
||||||
|
connect(SpinBox_Vy, SIGNAL(valueChanged(double)), this, SLOT(toDisplaySimulation()));
|
||||||
|
connect(SpinBox_Vz, SIGNAL(valueChanged(double)), this, SLOT(toDisplaySimulation()));
|
||||||
|
connect(SpinBox_VDist, SIGNAL(valueChanged(double)), this, SLOT(toDisplaySimulation()));
|
||||||
|
connect(SpinBox_NbSteps, SIGNAL(valueChanged(int)), this, SLOT(toDisplaySimulation()));
|
||||||
|
|
||||||
|
//To Connect preview check box
|
||||||
|
connectPreviewControl();
|
||||||
|
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
|
|
||||||
ConstructorsClicked(0);
|
ConstructorsClicked(0);
|
||||||
@ -359,6 +375,8 @@ void SMESHGUI_ExtrusionDlg::Init (bool ResetControls)
|
|||||||
|
|
||||||
CheckBoxMesh->setChecked(false);
|
CheckBoxMesh->setChecked(false);
|
||||||
onSelectMesh(false);
|
onSelectMesh(false);
|
||||||
|
myPreviewCheckBox->setChecked(false);
|
||||||
|
onDisplaySimulation(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
CheckIsEnable();
|
CheckIsEnable();
|
||||||
@ -370,7 +388,18 @@ void SMESHGUI_ExtrusionDlg::Init (bool ResetControls)
|
|||||||
//=================================================================================
|
//=================================================================================
|
||||||
void SMESHGUI_ExtrusionDlg::CheckIsEnable()
|
void SMESHGUI_ExtrusionDlg::CheckIsEnable()
|
||||||
{
|
{
|
||||||
double aX, aY, aZ, aModule;
|
bool anIsEnable = myNbOkElements > 0 && isValuesValid();
|
||||||
|
|
||||||
|
buttonOk->setEnabled(anIsEnable);
|
||||||
|
buttonApply->setEnabled(anIsEnable);
|
||||||
|
}
|
||||||
|
|
||||||
|
//=================================================================================
|
||||||
|
// function : isValuesValid()
|
||||||
|
// purpose : Return true in case if values entered into dialog are valid
|
||||||
|
//=================================================================================
|
||||||
|
bool SMESHGUI_ExtrusionDlg::isValuesValid() {
|
||||||
|
double aX, aY, aZ, aModule = 0;
|
||||||
if ( RadioButton3->isChecked() ) {
|
if ( RadioButton3->isChecked() ) {
|
||||||
aX = SpinBox_Dx->GetValue();
|
aX = SpinBox_Dx->GetValue();
|
||||||
aY = SpinBox_Dy->GetValue();
|
aY = SpinBox_Dy->GetValue();
|
||||||
@ -382,11 +411,7 @@ void SMESHGUI_ExtrusionDlg::CheckIsEnable()
|
|||||||
aZ = SpinBox_Vz->GetValue();
|
aZ = SpinBox_Vz->GetValue();
|
||||||
aModule = sqrt(aX*aX + aY*aY + aZ*aZ);
|
aModule = sqrt(aX*aX + aY*aY + aZ*aZ);
|
||||||
}
|
}
|
||||||
|
return aModule > 1.0E-38;
|
||||||
bool anIsEnable = myNbOkElements > 0 && aModule > 1.0E-38;
|
|
||||||
|
|
||||||
buttonOk->setEnabled(anIsEnable);
|
|
||||||
buttonApply->setEnabled(anIsEnable);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
@ -397,6 +422,8 @@ void SMESHGUI_ExtrusionDlg::ConstructorsClicked (int constructorId)
|
|||||||
{
|
{
|
||||||
disconnect(mySelectionMgr, 0, this, 0);
|
disconnect(mySelectionMgr, 0, this, 0);
|
||||||
|
|
||||||
|
hidePreview();
|
||||||
|
|
||||||
switch (constructorId) {
|
switch (constructorId) {
|
||||||
case 0:
|
case 0:
|
||||||
{
|
{
|
||||||
@ -478,6 +505,7 @@ void SMESHGUI_ExtrusionDlg::ClickOnRadio()
|
|||||||
SpinBox_VDist->show();
|
SpinBox_VDist->show();
|
||||||
SelectVectorButton->show();
|
SelectVectorButton->show();
|
||||||
}
|
}
|
||||||
|
onDisplaySimulation(true);
|
||||||
// AdjustSize
|
// AdjustSize
|
||||||
qApp->processEvents();
|
qApp->processEvents();
|
||||||
updateGeometry();
|
updateGeometry();
|
||||||
@ -499,29 +527,14 @@ bool SMESHGUI_ExtrusionDlg::ClickOnApply()
|
|||||||
if (myNbOkElements) {
|
if (myNbOkElements) {
|
||||||
|
|
||||||
SMESH::DirStruct aVector;
|
SMESH::DirStruct aVector;
|
||||||
|
getExtrusionVector(aVector);
|
||||||
|
|
||||||
QStringList aParameters;
|
QStringList aParameters;
|
||||||
|
|
||||||
if ( RadioButton3->isChecked() ) {
|
if ( RadioButton3->isChecked() ) {
|
||||||
aVector.PS.x = SpinBox_Dx->GetValue();
|
|
||||||
aVector.PS.y = SpinBox_Dy->GetValue();
|
|
||||||
aVector.PS.z = SpinBox_Dz->GetValue();
|
|
||||||
|
|
||||||
aParameters << SpinBox_Dx->text();
|
aParameters << SpinBox_Dx->text();
|
||||||
aParameters << SpinBox_Dy->text();
|
aParameters << SpinBox_Dy->text();
|
||||||
aParameters << SpinBox_Dz->text();
|
aParameters << SpinBox_Dz->text();
|
||||||
} else if ( RadioButton4->isChecked() ) {
|
} else if ( RadioButton4->isChecked() ) {
|
||||||
gp_XYZ aNormale(SpinBox_Vx->GetValue(),
|
|
||||||
SpinBox_Vy->GetValue(),
|
|
||||||
SpinBox_Vz->GetValue());
|
|
||||||
|
|
||||||
|
|
||||||
aNormale /= aNormale.Modulus();
|
|
||||||
long aVDist = (long)SpinBox_VDist->value();
|
|
||||||
|
|
||||||
aVector.PS.x = aNormale.X()*aVDist;
|
|
||||||
aVector.PS.y = aNormale.Y()*aVDist;
|
|
||||||
aVector.PS.z = aNormale.Z()*aVDist;
|
|
||||||
|
|
||||||
aParameters << SpinBox_Vx->text();
|
aParameters << SpinBox_Vx->text();
|
||||||
aParameters << SpinBox_Vy->text();
|
aParameters << SpinBox_Vy->text();
|
||||||
aParameters << SpinBox_Vz->text();
|
aParameters << SpinBox_Vz->text();
|
||||||
@ -676,6 +689,8 @@ void SMESHGUI_ExtrusionDlg::onTextChange (const QString& theNewText)
|
|||||||
|
|
||||||
CheckIsEnable();
|
CheckIsEnable();
|
||||||
|
|
||||||
|
onDisplaySimulation(true);
|
||||||
|
|
||||||
myBusy = false;
|
myBusy = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -786,6 +801,8 @@ void SMESHGUI_ExtrusionDlg::SelectionIntoArgument()
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onDisplaySimulation(true);
|
||||||
|
|
||||||
// OK
|
// OK
|
||||||
CheckIsEnable();
|
CheckIsEnable();
|
||||||
}
|
}
|
||||||
@ -1036,3 +1053,66 @@ bool SMESHGUI_ExtrusionDlg::isValid()
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=================================================================================
|
||||||
|
// function : onDisplaySimulation
|
||||||
|
// purpose : Show/Hide preview
|
||||||
|
//=================================================================================
|
||||||
|
void SMESHGUI_ExtrusionDlg::onDisplaySimulation( bool toDisplayPreview ) {
|
||||||
|
if (myPreviewCheckBox->isChecked() && toDisplayPreview) {
|
||||||
|
if (myNbOkElements && isValid() && isValuesValid()) {
|
||||||
|
//Get input vector
|
||||||
|
SMESH::DirStruct aVector;
|
||||||
|
getExtrusionVector(aVector);
|
||||||
|
|
||||||
|
//Get Number of the steps
|
||||||
|
long aNbSteps = (long)SpinBox_NbSteps->value();
|
||||||
|
|
||||||
|
try {
|
||||||
|
SUIT_OverrideCursor aWaitCursor;
|
||||||
|
SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditPreviewer();
|
||||||
|
if( CheckBoxMesh->isChecked() ) {
|
||||||
|
if( GetConstructorId() == 0 )
|
||||||
|
aMeshEditor->ExtrusionSweepObject1D(mySelectedObject, aVector, aNbSteps);
|
||||||
|
else
|
||||||
|
aMeshEditor->ExtrusionSweepObject2D(mySelectedObject, aVector, aNbSteps);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
aMeshEditor->ExtrusionSweep(myElementsId.inout(), aVector, aNbSteps);
|
||||||
|
|
||||||
|
SMESH::MeshPreviewStruct_var aMeshPreviewStruct = aMeshEditor->GetPreviewData();
|
||||||
|
mySimulation->SetData(aMeshPreviewStruct._retn());
|
||||||
|
} catch (...) {
|
||||||
|
hidePreview();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
hidePreview();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
hidePreview();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//=================================================================================
|
||||||
|
// function : getExtrusionVector()
|
||||||
|
// purpose : get direction of the extrusion
|
||||||
|
//=================================================================================
|
||||||
|
void SMESHGUI_ExtrusionDlg::getExtrusionVector(SMESH::DirStruct& aVector) {
|
||||||
|
if ( RadioButton3->isChecked() ) {
|
||||||
|
aVector.PS.x = SpinBox_Dx->GetValue();
|
||||||
|
aVector.PS.y = SpinBox_Dy->GetValue();
|
||||||
|
aVector.PS.z = SpinBox_Dz->GetValue();
|
||||||
|
} else if ( RadioButton4->isChecked() ) {
|
||||||
|
gp_XYZ aNormale(SpinBox_Vx->GetValue(),
|
||||||
|
SpinBox_Vy->GetValue(),
|
||||||
|
SpinBox_Vz->GetValue());
|
||||||
|
|
||||||
|
|
||||||
|
aNormale /= aNormale.Modulus();
|
||||||
|
long aVDist = (long)SpinBox_VDist->value();
|
||||||
|
|
||||||
|
aVector.PS.x = aNormale.X()*aVDist;
|
||||||
|
aVector.PS.y = aNormale.Y()*aVDist;
|
||||||
|
aVector.PS.z = aNormale.Z()*aVDist;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -29,13 +29,11 @@
|
|||||||
|
|
||||||
// SMESH includes
|
// SMESH includes
|
||||||
#include "SMESH_SMESHGUI.hxx"
|
#include "SMESH_SMESHGUI.hxx"
|
||||||
|
#include "SMESHGUI_PreviewDlg.h"
|
||||||
|
|
||||||
// SALOME GUI includes
|
// SALOME GUI includes
|
||||||
#include <SALOME_InteractiveObject.hxx>
|
#include <SALOME_InteractiveObject.hxx>
|
||||||
|
|
||||||
// Qt includes
|
|
||||||
#include <QDialog>
|
|
||||||
|
|
||||||
// IDL includes
|
// IDL includes
|
||||||
#include <SALOMEconfig.h>
|
#include <SALOMEconfig.h>
|
||||||
#include CORBA_SERVER_HEADER(SMESH_Mesh)
|
#include CORBA_SERVER_HEADER(SMESH_Mesh)
|
||||||
@ -62,7 +60,7 @@ class SalomeApp_IntSpinBox;
|
|||||||
// class : SMESHGUI_ExtrusionDlg
|
// class : SMESHGUI_ExtrusionDlg
|
||||||
// purpose :
|
// purpose :
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
class SMESHGUI_EXPORT SMESHGUI_ExtrusionDlg : public QDialog
|
class SMESHGUI_EXPORT SMESHGUI_ExtrusionDlg : public SMESHGUI_PreviewDlg
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
@ -78,10 +76,11 @@ private:
|
|||||||
void closeEvent( QCloseEvent* );
|
void closeEvent( QCloseEvent* );
|
||||||
void keyPressEvent( QKeyEvent* );
|
void keyPressEvent( QKeyEvent* );
|
||||||
int GetConstructorId();
|
int GetConstructorId();
|
||||||
|
void getExtrusionVector(SMESH::DirStruct& aVector);
|
||||||
|
|
||||||
bool isValid();
|
bool isValid();
|
||||||
|
bool isValuesValid();
|
||||||
|
|
||||||
SMESHGUI* mySMESHGUI; /* Current SMESHGUI object */
|
|
||||||
SMESHGUI_IdValidator* myIdValidator;
|
SMESHGUI_IdValidator* myIdValidator;
|
||||||
LightApp_SelectionMgr* mySelectionMgr; /* User shape selection */
|
LightApp_SelectionMgr* mySelectionMgr; /* User shape selection */
|
||||||
QWidget* myEditCurrentArgument; /* Current argument editor */
|
QWidget* myEditCurrentArgument; /* Current argument editor */
|
||||||
@ -144,6 +143,9 @@ private:
|
|||||||
QPushButton* myFilterBtn;
|
QPushButton* myFilterBtn;
|
||||||
SMESHGUI_FilterDlg* myFilterDlg;
|
SMESHGUI_FilterDlg* myFilterDlg;
|
||||||
|
|
||||||
|
protected slots:
|
||||||
|
virtual void onDisplaySimulation( bool );
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void ConstructorsClicked( int );
|
void ConstructorsClicked( int );
|
||||||
void CheckIsEnable();
|
void CheckIsEnable();
|
||||||
|
103
src/SMESHGUI/SMESHGUI_PreviewDlg.cxx
Normal file
103
src/SMESHGUI/SMESHGUI_PreviewDlg.cxx
Normal file
@ -0,0 +1,103 @@
|
|||||||
|
// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE
|
||||||
|
//
|
||||||
|
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
||||||
|
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
||||||
|
//
|
||||||
|
// This library is free software; you can redistribute it and/or
|
||||||
|
// modify it under the terms of the GNU Lesser General Public
|
||||||
|
// License as published by the Free Software Foundation; either
|
||||||
|
// version 2.1 of the License.
|
||||||
|
//
|
||||||
|
// This library is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
// Lesser General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU Lesser General Public
|
||||||
|
// License along with this library; if not, write to the Free Software
|
||||||
|
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
//
|
||||||
|
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||||
|
//
|
||||||
|
|
||||||
|
// SMESH SMESHGUI : GUI for SMESH component
|
||||||
|
// File : SMESHGUI_PreviewDlg.cxx
|
||||||
|
// Author : Roman NIKOLAEV, Open CASCADE S.A.S.
|
||||||
|
// SMESH includes
|
||||||
|
//
|
||||||
|
|
||||||
|
//SMESH includes
|
||||||
|
#include "SMESHGUI.h"
|
||||||
|
#include "SMESHGUI_PreviewDlg.h"
|
||||||
|
#include "SMESHGUI_MeshEditPreview.h"
|
||||||
|
#include "SMESHGUI_VTKUtils.h"
|
||||||
|
#include "SMESHGUI_Utils.h"
|
||||||
|
|
||||||
|
//GUI includes
|
||||||
|
#include <SUIT_Desktop.h>
|
||||||
|
|
||||||
|
//QT includes
|
||||||
|
#include <QCheckBox>
|
||||||
|
|
||||||
|
|
||||||
|
//=================================================================================
|
||||||
|
// class : SMESHGUI_SMESHGUI_PreviewDlg()
|
||||||
|
// purpose :
|
||||||
|
//=================================================================================
|
||||||
|
SMESHGUI_PreviewDlg::SMESHGUI_PreviewDlg(SMESHGUI* theModule) :
|
||||||
|
mySMESHGUI(theModule),
|
||||||
|
QDialog(SMESH::GetDesktop( theModule )) {
|
||||||
|
mySimulation = new SMESHGUI_MeshEditPreview(SMESH::GetViewWindow( mySMESHGUI ));
|
||||||
|
}
|
||||||
|
|
||||||
|
//=================================================================================
|
||||||
|
// function : ~SMESHGUI_PreviewDlg()
|
||||||
|
// purpose : Destroys the object and frees any allocated resources
|
||||||
|
//=================================================================================
|
||||||
|
SMESHGUI_PreviewDlg::~SMESHGUI_PreviewDlg()
|
||||||
|
{
|
||||||
|
delete mySimulation;
|
||||||
|
}
|
||||||
|
|
||||||
|
//=================================================================================
|
||||||
|
// function : showPreview
|
||||||
|
// purpose : Show preview in the viewer
|
||||||
|
//=================================================================================
|
||||||
|
void SMESHGUI_PreviewDlg::showPreview(){
|
||||||
|
if(mySimulation)
|
||||||
|
mySimulation->SetVisibility(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
//=================================================================================
|
||||||
|
// function : hidePreview
|
||||||
|
// purpose : Hide preview in the viewer
|
||||||
|
//=================================================================================
|
||||||
|
void SMESHGUI_PreviewDlg::hidePreview(){
|
||||||
|
if(mySimulation)
|
||||||
|
mySimulation->SetVisibility(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
//=================================================================================
|
||||||
|
// function : connectPreviewControl
|
||||||
|
// purpose : Connect the preview check box
|
||||||
|
//=================================================================================
|
||||||
|
void SMESHGUI_PreviewDlg::connectPreviewControl(){
|
||||||
|
connect(myPreviewCheckBox, SIGNAL(toggled(bool)), this, SLOT(onDisplaySimulation(bool)));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//=================================================================================
|
||||||
|
// function : toDisplaySimulation
|
||||||
|
// purpose :
|
||||||
|
//=================================================================================
|
||||||
|
void SMESHGUI_PreviewDlg::toDisplaySimulation() {
|
||||||
|
onDisplaySimulation(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
//=================================================================================
|
||||||
|
// function : onDisplaySimulation
|
||||||
|
// purpose :
|
||||||
|
//=================================================================================
|
||||||
|
void SMESHGUI_PreviewDlg::onDisplaySimulation(bool toDisplayPreview) {
|
||||||
|
//Empty implementation here
|
||||||
|
}
|
63
src/SMESHGUI/SMESHGUI_PreviewDlg.h
Normal file
63
src/SMESHGUI/SMESHGUI_PreviewDlg.h
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE
|
||||||
|
//
|
||||||
|
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
||||||
|
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
||||||
|
//
|
||||||
|
// This library is free software; you can redistribute it and/or
|
||||||
|
// modify it under the terms of the GNU Lesser General Public
|
||||||
|
// License as published by the Free Software Foundation; either
|
||||||
|
// version 2.1 of the License.
|
||||||
|
//
|
||||||
|
// This library is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
// Lesser General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU Lesser General Public
|
||||||
|
// License along with this library; if not, write to the Free Software
|
||||||
|
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
//
|
||||||
|
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||||
|
//
|
||||||
|
|
||||||
|
// SMESH SMESHGUI : GUI for SMESH component
|
||||||
|
// File : SMESHGUI_RotationDlg.h
|
||||||
|
// Author : Roman NIKOLAEV, Open CASCADE S.A.S.
|
||||||
|
//
|
||||||
|
#ifndef SMESHGUI_PREVIEWDLG_H
|
||||||
|
#define SMESHGUI_PREVIEWDLG_H
|
||||||
|
|
||||||
|
// SMESH includes
|
||||||
|
#include "SMESH_SMESHGUI.hxx"
|
||||||
|
|
||||||
|
// Qt includes
|
||||||
|
#include <QDialog>
|
||||||
|
|
||||||
|
class SMESHGUI;
|
||||||
|
class SMESHGUI_MeshEditPreview;
|
||||||
|
class QCheckBox;
|
||||||
|
|
||||||
|
class SMESHGUI_EXPORT SMESHGUI_PreviewDlg : public QDialog {
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
SMESHGUI_PreviewDlg( SMESHGUI* );
|
||||||
|
~SMESHGUI_PreviewDlg();
|
||||||
|
|
||||||
|
void showPreview();
|
||||||
|
void hidePreview();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void connectPreviewControl();
|
||||||
|
|
||||||
|
protected slots:
|
||||||
|
void toDisplaySimulation();
|
||||||
|
virtual void onDisplaySimulation( bool );
|
||||||
|
|
||||||
|
|
||||||
|
protected:
|
||||||
|
SMESHGUI* mySMESHGUI; /* Current SMESHGUI object */
|
||||||
|
SMESHGUI_MeshEditPreview* mySimulation;
|
||||||
|
QCheckBox* myPreviewCheckBox;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
@ -89,8 +89,7 @@
|
|||||||
// purpose :
|
// purpose :
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
SMESHGUI_RevolutionDlg::SMESHGUI_RevolutionDlg( SMESHGUI* theModule )
|
SMESHGUI_RevolutionDlg::SMESHGUI_RevolutionDlg( SMESHGUI* theModule )
|
||||||
: QDialog( SMESH::GetDesktop( theModule ) ),
|
: SMESHGUI_PreviewDlg( theModule ),
|
||||||
mySMESHGUI( theModule ),
|
|
||||||
mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ),
|
mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ),
|
||||||
myVectorDefinition(NONE_SELECT),
|
myVectorDefinition(NONE_SELECT),
|
||||||
myFilterDlg( 0 ),
|
myFilterDlg( 0 ),
|
||||||
@ -232,7 +231,7 @@ SMESHGUI_RevolutionDlg::SMESHGUI_RevolutionDlg( SMESHGUI* theModule )
|
|||||||
SpinBox_Tolerance = new SMESHGUI_SpinBox(GroupArguments);
|
SpinBox_Tolerance = new SMESHGUI_SpinBox(GroupArguments);
|
||||||
|
|
||||||
// Control for mesh preview
|
// Control for mesh preview
|
||||||
CheckBoxPreview = new QCheckBox(tr("PREVIEW"), GroupArguments);
|
myPreviewCheckBox = new QCheckBox(tr("PREVIEW"), GroupArguments);
|
||||||
|
|
||||||
// CheckBox for groups generation
|
// CheckBox for groups generation
|
||||||
MakeGroupsCheck = new QCheckBox(tr("SMESH_MAKE_GROUPS"), GroupArguments);
|
MakeGroupsCheck = new QCheckBox(tr("SMESH_MAKE_GROUPS"), GroupArguments);
|
||||||
@ -247,7 +246,7 @@ SMESHGUI_RevolutionDlg::SMESHGUI_RevolutionDlg( SMESHGUI* theModule )
|
|||||||
GroupArgumentsLayout->addWidget(GroupAngleBox, 3, 0, 1, 4);
|
GroupArgumentsLayout->addWidget(GroupAngleBox, 3, 0, 1, 4);
|
||||||
GroupArgumentsLayout->addWidget(TextLabelTolerance, 4, 0, 1, 2);
|
GroupArgumentsLayout->addWidget(TextLabelTolerance, 4, 0, 1, 2);
|
||||||
GroupArgumentsLayout->addWidget(SpinBox_Tolerance, 4, 2, 1, 2);
|
GroupArgumentsLayout->addWidget(SpinBox_Tolerance, 4, 2, 1, 2);
|
||||||
GroupArgumentsLayout->addWidget(CheckBoxPreview, 5, 0, 1, 4);
|
GroupArgumentsLayout->addWidget(myPreviewCheckBox, 5, 0, 1, 4);
|
||||||
GroupArgumentsLayout->addWidget(MakeGroupsCheck, 6, 0, 1, 4);
|
GroupArgumentsLayout->addWidget(MakeGroupsCheck, 6, 0, 1, 4);
|
||||||
|
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
@ -352,7 +351,9 @@ SMESHGUI_RevolutionDlg::SMESHGUI_RevolutionDlg( SMESHGUI* theModule )
|
|||||||
connect(SpinBox_Angle, SIGNAL(valueChanged(double)), this, SLOT(toDisplaySimulation()));
|
connect(SpinBox_Angle, SIGNAL(valueChanged(double)), this, SLOT(toDisplaySimulation()));
|
||||||
connect(SpinBox_NbSteps, SIGNAL(valueChanged(int)), this, SLOT(toDisplaySimulation()));
|
connect(SpinBox_NbSteps, SIGNAL(valueChanged(int)), this, SLOT(toDisplaySimulation()));
|
||||||
connect(SpinBox_Tolerance, SIGNAL(valueChanged(double)), this, SLOT(toDisplaySimulation()));
|
connect(SpinBox_Tolerance, SIGNAL(valueChanged(double)), this, SLOT(toDisplaySimulation()));
|
||||||
connect(CheckBoxPreview, SIGNAL(toggled(bool)), this, SLOT(onDisplaySimulation(bool)));
|
|
||||||
|
//To Connect preview check box
|
||||||
|
connectPreviewControl();
|
||||||
|
|
||||||
connect(SpinBox_Angle, SIGNAL(textChanged(const QString&)), this, SLOT(onAngleTextChange(const QString&)));
|
connect(SpinBox_Angle, SIGNAL(textChanged(const QString&)), this, SLOT(onAngleTextChange(const QString&)));
|
||||||
|
|
||||||
@ -405,7 +406,7 @@ void SMESHGUI_RevolutionDlg::Init (bool ResetControls)
|
|||||||
|
|
||||||
CheckBoxMesh->setChecked(false);
|
CheckBoxMesh->setChecked(false);
|
||||||
onSelectMesh(false);
|
onSelectMesh(false);
|
||||||
CheckBoxPreview->setChecked(false);
|
myPreviewCheckBox->setChecked(false);
|
||||||
onDisplaySimulation(false);
|
onDisplaySimulation(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1033,22 +1034,13 @@ void SMESHGUI_RevolutionDlg::keyPressEvent( QKeyEvent* e )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//=================================================================================
|
|
||||||
// function : toDisplaySimulation()
|
|
||||||
// purpose :
|
|
||||||
//=================================================================================
|
|
||||||
void SMESHGUI_RevolutionDlg::toDisplaySimulation()
|
|
||||||
{
|
|
||||||
onDisplaySimulation(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : onDisplaySimulation()
|
// function : onDisplaySimulation()
|
||||||
// purpose :
|
// purpose : Show/Hide preview
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
void SMESHGUI_RevolutionDlg::onDisplaySimulation(bool toDisplayPreview)
|
void SMESHGUI_RevolutionDlg::onDisplaySimulation(bool toDisplayPreview)
|
||||||
{
|
{
|
||||||
if (CheckBoxPreview->isChecked() && toDisplayPreview)
|
if (myPreviewCheckBox->isChecked() && toDisplayPreview)
|
||||||
{
|
{
|
||||||
//display preview
|
//display preview
|
||||||
if (myNbOkElements && IsAxisOk())
|
if (myNbOkElements && IsAxisOk())
|
||||||
|
@ -29,12 +29,12 @@
|
|||||||
|
|
||||||
// SMESH includes
|
// SMESH includes
|
||||||
#include "SMESH_SMESHGUI.hxx"
|
#include "SMESH_SMESHGUI.hxx"
|
||||||
|
#include "SMESHGUI_PreviewDlg.h"
|
||||||
|
|
||||||
// SALOME GUI includes
|
// SALOME GUI includes
|
||||||
#include <SALOME_InteractiveObject.hxx>
|
#include <SALOME_InteractiveObject.hxx>
|
||||||
|
|
||||||
// Qt includes
|
// Qt includes
|
||||||
#include <QDialog>
|
|
||||||
#include <QMap>
|
#include <QMap>
|
||||||
|
|
||||||
// IDL includes
|
// IDL includes
|
||||||
@ -66,7 +66,7 @@ class QAction;
|
|||||||
// class : SMESHGUI_RevolutionDlg
|
// class : SMESHGUI_RevolutionDlg
|
||||||
// purpose :
|
// purpose :
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
class SMESHGUI_EXPORT SMESHGUI_RevolutionDlg : public QDialog
|
class SMESHGUI_EXPORT SMESHGUI_RevolutionDlg : public SMESHGUI_PreviewDlg
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
@ -88,7 +88,6 @@ private:
|
|||||||
|
|
||||||
bool isValid();
|
bool isValid();
|
||||||
|
|
||||||
SMESHGUI* mySMESHGUI; /* Current SMESHGUI object */
|
|
||||||
SMESHGUI_IdValidator* myIdValidator;
|
SMESHGUI_IdValidator* myIdValidator;
|
||||||
LightApp_SelectionMgr* mySelectionMgr; /* User shape selection */
|
LightApp_SelectionMgr* mySelectionMgr; /* User shape selection */
|
||||||
int myNbOkElements; /* to check when elements are defined */
|
int myNbOkElements; /* to check when elements are defined */
|
||||||
@ -126,7 +125,6 @@ private:
|
|||||||
QButtonGroup* GroupAngle;
|
QButtonGroup* GroupAngle;
|
||||||
QRadioButton* RadioButton3;
|
QRadioButton* RadioButton3;
|
||||||
QRadioButton* RadioButton4;
|
QRadioButton* RadioButton4;
|
||||||
QCheckBox* CheckBoxPreview;
|
|
||||||
|
|
||||||
QLabel* TextLabelPoint;
|
QLabel* TextLabelPoint;
|
||||||
QPushButton* SelectPointButton;
|
QPushButton* SelectPointButton;
|
||||||
@ -163,6 +161,9 @@ private:
|
|||||||
QPushButton* myFilterBtn;
|
QPushButton* myFilterBtn;
|
||||||
SMESHGUI_FilterDlg* myFilterDlg;
|
SMESHGUI_FilterDlg* myFilterDlg;
|
||||||
|
|
||||||
|
protected slots:
|
||||||
|
virtual void onDisplaySimulation( bool );
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void ConstructorsClicked( int );
|
void ConstructorsClicked( int );
|
||||||
void ClickOnOk();
|
void ClickOnOk();
|
||||||
@ -177,8 +178,6 @@ private slots:
|
|||||||
void onAngleTextChange( const QString& );
|
void onAngleTextChange( const QString& );
|
||||||
void onSelectMesh( bool );
|
void onSelectMesh( bool );
|
||||||
void onVectorChanged();
|
void onVectorChanged();
|
||||||
void toDisplaySimulation();
|
|
||||||
void onDisplaySimulation( bool );
|
|
||||||
void onSelectVectorMenu( QAction* );
|
void onSelectVectorMenu( QAction* );
|
||||||
void onSelectVectorButton();
|
void onSelectVectorButton();
|
||||||
void setFilters();
|
void setFilters();
|
||||||
|
@ -33,6 +33,7 @@
|
|||||||
#include "SMESHGUI_MeshUtils.h"
|
#include "SMESHGUI_MeshUtils.h"
|
||||||
#include "SMESHGUI_IdValidator.h"
|
#include "SMESHGUI_IdValidator.h"
|
||||||
#include "SMESHGUI_FilterDlg.h"
|
#include "SMESHGUI_FilterDlg.h"
|
||||||
|
#include "SMESHGUI_MeshEditPreview.h"
|
||||||
|
|
||||||
#include <SMESH_Actor.h>
|
#include <SMESH_Actor.h>
|
||||||
#include <SMESH_TypeFilter.hxx>
|
#include <SMESH_TypeFilter.hxx>
|
||||||
@ -91,9 +92,8 @@ enum { MOVE_ELEMS_BUTTON = 0, COPY_ELEMS_BUTTON, MAKE_MESH_BUTTON }; //!< action
|
|||||||
// class : SMESHGUI_RotationDlg()
|
// class : SMESHGUI_RotationDlg()
|
||||||
// purpose :
|
// purpose :
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
SMESHGUI_RotationDlg::SMESHGUI_RotationDlg( SMESHGUI* theModule )
|
SMESHGUI_RotationDlg::SMESHGUI_RotationDlg( SMESHGUI* theModule ) :
|
||||||
: QDialog( SMESH::GetDesktop( theModule ) ),
|
SMESHGUI_PreviewDlg( theModule ),
|
||||||
mySMESHGUI( theModule ),
|
|
||||||
mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ),
|
mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ),
|
||||||
myFilterDlg(0),
|
myFilterDlg(0),
|
||||||
mySelectedObject(SMESH::SMESH_IDSource::_nil())
|
mySelectedObject(SMESH::SMESH_IDSource::_nil())
|
||||||
@ -217,6 +217,10 @@ SMESHGUI_RotationDlg::SMESHGUI_RotationDlg( SMESHGUI* theModule )
|
|||||||
// Name of a mesh to create
|
// Name of a mesh to create
|
||||||
LineEditNewMesh = new QLineEdit(GroupArguments);
|
LineEditNewMesh = new QLineEdit(GroupArguments);
|
||||||
|
|
||||||
|
|
||||||
|
//Preview check box
|
||||||
|
myPreviewCheckBox = new QCheckBox(tr("PREVIEW"), GroupArguments);
|
||||||
|
|
||||||
GroupArgumentsLayout->addWidget(TextLabelElements, 0, 0);
|
GroupArgumentsLayout->addWidget(TextLabelElements, 0, 0);
|
||||||
GroupArgumentsLayout->addWidget(SelectElementsButton, 0, 1);
|
GroupArgumentsLayout->addWidget(SelectElementsButton, 0, 1);
|
||||||
GroupArgumentsLayout->addWidget(LineEditElements, 0, 2, 1, 1);
|
GroupArgumentsLayout->addWidget(LineEditElements, 0, 2, 1, 1);
|
||||||
@ -228,6 +232,8 @@ SMESHGUI_RotationDlg::SMESHGUI_RotationDlg( SMESHGUI* theModule )
|
|||||||
GroupArgumentsLayout->addWidget(ActionBox, 4, 0, 3, 3);
|
GroupArgumentsLayout->addWidget(ActionBox, 4, 0, 3, 3);
|
||||||
GroupArgumentsLayout->addWidget(MakeGroupsCheck, 5, 3);
|
GroupArgumentsLayout->addWidget(MakeGroupsCheck, 5, 3);
|
||||||
GroupArgumentsLayout->addWidget(LineEditNewMesh, 6, 3);
|
GroupArgumentsLayout->addWidget(LineEditNewMesh, 6, 3);
|
||||||
|
GroupArgumentsLayout->addWidget(myPreviewCheckBox, 7, 0);
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
GroupButtons = new QGroupBox(this);
|
GroupButtons = new QGroupBox(this);
|
||||||
@ -312,6 +318,17 @@ SMESHGUI_RotationDlg::SMESHGUI_RotationDlg( SMESHGUI* theModule )
|
|||||||
connect(CheckBoxMesh, SIGNAL(toggled(bool)), SLOT(onSelectMesh(bool)));
|
connect(CheckBoxMesh, SIGNAL(toggled(bool)), SLOT(onSelectMesh(bool)));
|
||||||
connect(ActionGroup, SIGNAL(buttonClicked(int)), SLOT(onActionClicked(int)));
|
connect(ActionGroup, SIGNAL(buttonClicked(int)), SLOT(onActionClicked(int)));
|
||||||
|
|
||||||
|
connect(SpinBox_X, SIGNAL(valueChanged(double)), this, SLOT(toDisplaySimulation()));
|
||||||
|
connect(SpinBox_Y, SIGNAL(valueChanged(double)), this, SLOT(toDisplaySimulation()));
|
||||||
|
connect(SpinBox_Z, SIGNAL(valueChanged(double)), this, SLOT(toDisplaySimulation()));
|
||||||
|
connect(SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(toDisplaySimulation()));
|
||||||
|
connect(SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(toDisplaySimulation()));
|
||||||
|
connect(SpinBox_DZ, SIGNAL(valueChanged(double)), this, SLOT(toDisplaySimulation()));
|
||||||
|
connect(SpinBox_Angle, SIGNAL(valueChanged(double)), this, SLOT(toDisplaySimulation()));
|
||||||
|
|
||||||
|
//To Connect preview check box
|
||||||
|
connectPreviewControl();
|
||||||
|
|
||||||
onActionClicked(MOVE_ELEMS_BUTTON);
|
onActionClicked(MOVE_ELEMS_BUTTON);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -359,6 +376,9 @@ void SMESHGUI_RotationDlg::Init (bool ResetControls)
|
|||||||
|
|
||||||
ActionGroup->button( MOVE_ELEMS_BUTTON )->setChecked(true);
|
ActionGroup->button( MOVE_ELEMS_BUTTON )->setChecked(true);
|
||||||
CheckBoxMesh->setChecked(false);
|
CheckBoxMesh->setChecked(false);
|
||||||
|
myPreviewCheckBox->setChecked(false);
|
||||||
|
onDisplaySimulation(false);
|
||||||
|
|
||||||
// MakeGroupsCheck->setChecked(false);
|
// MakeGroupsCheck->setChecked(false);
|
||||||
// MakeGroupsCheck->setEnabled(false);
|
// MakeGroupsCheck->setEnabled(false);
|
||||||
// onSelectMesh(false);
|
// onSelectMesh(false);
|
||||||
@ -737,6 +757,7 @@ void SMESHGUI_RotationDlg::SelectionIntoArgument()
|
|||||||
buttonOk->setEnabled(true);
|
buttonOk->setEnabled(true);
|
||||||
buttonApply->setEnabled(true);
|
buttonApply->setEnabled(true);
|
||||||
}
|
}
|
||||||
|
onDisplaySimulation(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
@ -883,6 +904,7 @@ void SMESHGUI_RotationDlg::onSelectMesh (bool toSelectMesh)
|
|||||||
LineEditElements->setReadOnly(false);
|
LineEditElements->setReadOnly(false);
|
||||||
LineEditElements->setValidator(myIdValidator);
|
LineEditElements->setValidator(myIdValidator);
|
||||||
onTextChange(LineEditElements->text());
|
onTextChange(LineEditElements->text());
|
||||||
|
hidePreview();
|
||||||
}
|
}
|
||||||
|
|
||||||
SelectionIntoArgument();
|
SelectionIntoArgument();
|
||||||
@ -1033,3 +1055,51 @@ bool SMESHGUI_RotationDlg::isValid()
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//=================================================================================
|
||||||
|
// function : onDisplaySimulation
|
||||||
|
// purpose : Show/Hide preview
|
||||||
|
//=================================================================================
|
||||||
|
void SMESHGUI_RotationDlg::onDisplaySimulation( bool toDisplayPreview ) {
|
||||||
|
if (myPreviewCheckBox->isChecked() && toDisplayPreview) {
|
||||||
|
if(myNbOkElements && isValid() && IsAxisOk()) {
|
||||||
|
QStringList aListElementsId = myElementsId.split(" ", QString::SkipEmptyParts);
|
||||||
|
SMESH::long_array_var anElementsId = new SMESH::long_array;
|
||||||
|
|
||||||
|
anElementsId->length(aListElementsId.count());
|
||||||
|
for (int i = 0; i < aListElementsId.count(); i++)
|
||||||
|
anElementsId[i] = aListElementsId[i].toInt();
|
||||||
|
|
||||||
|
SMESH::AxisStruct anAxis;
|
||||||
|
|
||||||
|
anAxis.x = SpinBox_X->GetValue();
|
||||||
|
anAxis.y = SpinBox_Y->GetValue();
|
||||||
|
anAxis.z = SpinBox_Z->GetValue();;
|
||||||
|
anAxis.vx = SpinBox_DX->GetValue();
|
||||||
|
anAxis.vy = SpinBox_DY->GetValue();
|
||||||
|
anAxis.vz = SpinBox_DZ->GetValue();
|
||||||
|
double anAngle = (SpinBox_Angle->GetValue())*PI/180;
|
||||||
|
|
||||||
|
try {
|
||||||
|
SUIT_OverrideCursor aWaitCursor;
|
||||||
|
bool copy = ActionGroup->checkedId() == COPY_ELEMS_BUTTON;
|
||||||
|
SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditPreviewer();
|
||||||
|
if(CheckBoxMesh->isChecked())
|
||||||
|
aMeshEditor->RotateObject(mySelectedObject, anAxis, anAngle, copy);
|
||||||
|
else
|
||||||
|
aMeshEditor->Rotate(anElementsId, anAxis, anAngle, copy);
|
||||||
|
|
||||||
|
SMESH::MeshPreviewStruct_var aMeshPreviewStruct = aMeshEditor->GetPreviewData();
|
||||||
|
mySimulation->SetData(aMeshPreviewStruct._retn());
|
||||||
|
} catch (...) {
|
||||||
|
hidePreview();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
hidePreview();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
hidePreview();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -29,9 +29,8 @@
|
|||||||
|
|
||||||
// SMESH includes
|
// SMESH includes
|
||||||
#include "SMESH_SMESHGUI.hxx"
|
#include "SMESH_SMESHGUI.hxx"
|
||||||
|
#include "SMESHGUI_PreviewDlg.h"
|
||||||
|
|
||||||
// Qt includes
|
|
||||||
#include <QDialog>
|
|
||||||
|
|
||||||
// IDL includes
|
// IDL includes
|
||||||
#include <SALOMEconfig.h>
|
#include <SALOMEconfig.h>
|
||||||
@ -57,7 +56,7 @@ class SMESH_LogicalFilter;
|
|||||||
// class : SMESHGUI_RotationDlg
|
// class : SMESHGUI_RotationDlg
|
||||||
// purpose :
|
// purpose :
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
class SMESHGUI_EXPORT SMESHGUI_RotationDlg : public QDialog
|
class SMESHGUI_EXPORT SMESHGUI_RotationDlg : public SMESHGUI_PreviewDlg
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
@ -76,7 +75,6 @@ private:
|
|||||||
|
|
||||||
bool isValid();
|
bool isValid();
|
||||||
|
|
||||||
SMESHGUI* mySMESHGUI; /* Current SMESHGUI object */
|
|
||||||
SMESHGUI_IdValidator* myIdValidator;
|
SMESHGUI_IdValidator* myIdValidator;
|
||||||
LightApp_SelectionMgr* mySelectionMgr; /* User shape selection */
|
LightApp_SelectionMgr* mySelectionMgr; /* User shape selection */
|
||||||
int myNbOkElements; /* to check when elements are defined */
|
int myNbOkElements; /* to check when elements are defined */
|
||||||
@ -135,6 +133,9 @@ private:
|
|||||||
QPushButton* myFilterBtn;
|
QPushButton* myFilterBtn;
|
||||||
SMESHGUI_FilterDlg* myFilterDlg;
|
SMESHGUI_FilterDlg* myFilterDlg;
|
||||||
|
|
||||||
|
protected slots:
|
||||||
|
virtual void onDisplaySimulation( bool );
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void ClickOnOk();
|
void ClickOnOk();
|
||||||
void ClickOnCancel();
|
void ClickOnCancel();
|
||||||
|
@ -30,6 +30,7 @@
|
|||||||
#include "SMESHGUI_MeshUtils.h"
|
#include "SMESHGUI_MeshUtils.h"
|
||||||
#include "SMESHGUI_IdValidator.h"
|
#include "SMESHGUI_IdValidator.h"
|
||||||
#include "SMESHGUI_FilterDlg.h"
|
#include "SMESHGUI_FilterDlg.h"
|
||||||
|
#include "SMESHGUI_MeshEditPreview.h"
|
||||||
|
|
||||||
#include <SMESH_Actor.h>
|
#include <SMESH_Actor.h>
|
||||||
#include <SMESH_TypeFilter.hxx>
|
#include <SMESH_TypeFilter.hxx>
|
||||||
@ -106,9 +107,8 @@ private:
|
|||||||
// class : SMESHGUI_ScaleDlg()
|
// class : SMESHGUI_ScaleDlg()
|
||||||
// purpose :
|
// purpose :
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
SMESHGUI_ScaleDlg::SMESHGUI_ScaleDlg( SMESHGUI* theModule )
|
SMESHGUI_ScaleDlg::SMESHGUI_ScaleDlg( SMESHGUI* theModule ) :
|
||||||
: QDialog( SMESH::GetDesktop( theModule ) ),
|
SMESHGUI_PreviewDlg( theModule ),
|
||||||
mySMESHGUI( theModule ),
|
|
||||||
mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ),
|
mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ),
|
||||||
myFilterDlg(0),
|
myFilterDlg(0),
|
||||||
mySelectedObject(SMESH::SMESH_IDSource::_nil())
|
mySelectedObject(SMESH::SMESH_IDSource::_nil())
|
||||||
@ -211,6 +211,9 @@ SMESHGUI_ScaleDlg::SMESHGUI_ScaleDlg( SMESHGUI* theModule )
|
|||||||
// Name of a mesh to create
|
// Name of a mesh to create
|
||||||
LineEditNewMesh = new QLineEdit(GroupArguments);
|
LineEditNewMesh = new QLineEdit(GroupArguments);
|
||||||
|
|
||||||
|
//Preview check box
|
||||||
|
myPreviewCheckBox = new QCheckBox(tr("PREVIEW"), GroupArguments);
|
||||||
|
|
||||||
// layout
|
// layout
|
||||||
GroupArgumentsLayout->addWidget(TextLabelElements, 0, 0);
|
GroupArgumentsLayout->addWidget(TextLabelElements, 0, 0);
|
||||||
GroupArgumentsLayout->addWidget(SelectElementsButton, 0, 1);
|
GroupArgumentsLayout->addWidget(SelectElementsButton, 0, 1);
|
||||||
@ -234,6 +237,7 @@ SMESHGUI_ScaleDlg::SMESHGUI_ScaleDlg( SMESHGUI* theModule )
|
|||||||
GroupArgumentsLayout->addWidget(ActionBox, 7, 0, 3, 4);
|
GroupArgumentsLayout->addWidget(ActionBox, 7, 0, 3, 4);
|
||||||
GroupArgumentsLayout->addWidget(MakeGroupsCheck, 7, 5, 1, 4);
|
GroupArgumentsLayout->addWidget(MakeGroupsCheck, 7, 5, 1, 4);
|
||||||
GroupArgumentsLayout->addWidget(LineEditNewMesh, 8, 5, 1, 4);
|
GroupArgumentsLayout->addWidget(LineEditNewMesh, 8, 5, 1, 4);
|
||||||
|
GroupArgumentsLayout->addWidget(myPreviewCheckBox, 10, 0);
|
||||||
|
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
GroupButtons = new QGroupBox(this);
|
GroupButtons = new QGroupBox(this);
|
||||||
@ -314,6 +318,17 @@ SMESHGUI_ScaleDlg::SMESHGUI_ScaleDlg( SMESHGUI* theModule )
|
|||||||
connect(CheckBoxMesh, SIGNAL(toggled(bool)), SLOT(onSelectMesh(bool)));
|
connect(CheckBoxMesh, SIGNAL(toggled(bool)), SLOT(onSelectMesh(bool)));
|
||||||
connect(ActionGroup, SIGNAL(buttonClicked(int)), SLOT(onActionClicked(int)));
|
connect(ActionGroup, SIGNAL(buttonClicked(int)), SLOT(onActionClicked(int)));
|
||||||
|
|
||||||
|
connect(SpinBox1_1, SIGNAL(valueChanged(double)), this, SLOT(toDisplaySimulation()));
|
||||||
|
connect(SpinBox1_2, SIGNAL(valueChanged(double)), this, SLOT(toDisplaySimulation()));
|
||||||
|
connect(SpinBox1_3, SIGNAL(valueChanged(double)), this, SLOT(toDisplaySimulation()));
|
||||||
|
|
||||||
|
connect(SpinBox_FX, SIGNAL(valueChanged(double)), this, SLOT(toDisplaySimulation()));
|
||||||
|
connect(SpinBox_FY, SIGNAL(valueChanged(double)), this, SLOT(toDisplaySimulation()));
|
||||||
|
connect(SpinBox_FZ, SIGNAL(valueChanged(double)), this, SLOT(toDisplaySimulation()));
|
||||||
|
|
||||||
|
//To Connect preview check box
|
||||||
|
connectPreviewControl();
|
||||||
|
|
||||||
ConstructorsClicked(0);
|
ConstructorsClicked(0);
|
||||||
SelectionIntoArgument();
|
SelectionIntoArgument();
|
||||||
onActionClicked(MOVE_ELEMS_BUTTON);
|
onActionClicked(MOVE_ELEMS_BUTTON);
|
||||||
@ -358,6 +373,8 @@ void SMESHGUI_ScaleDlg::Init (bool ResetControls)
|
|||||||
SpinBox_FX->SetValue(1.0);
|
SpinBox_FX->SetValue(1.0);
|
||||||
SpinBox_FY->SetValue(1.0);
|
SpinBox_FY->SetValue(1.0);
|
||||||
SpinBox_FZ->SetValue(1.0);
|
SpinBox_FZ->SetValue(1.0);
|
||||||
|
myPreviewCheckBox->setChecked(false);
|
||||||
|
onDisplaySimulation(false);
|
||||||
|
|
||||||
ActionGroup->button( MOVE_ELEMS_BUTTON )->setChecked(true);
|
ActionGroup->button( MOVE_ELEMS_BUTTON )->setChecked(true);
|
||||||
CheckBoxMesh->setChecked(false);
|
CheckBoxMesh->setChecked(false);
|
||||||
@ -436,20 +453,8 @@ bool SMESHGUI_ScaleDlg::ClickOnApply()
|
|||||||
anElementsId[i] = aListElementsId[i].toInt();
|
anElementsId[i] = aListElementsId[i].toInt();
|
||||||
|
|
||||||
SMESH::PointStruct aPoint;
|
SMESH::PointStruct aPoint;
|
||||||
aPoint.x = SpinBox1_1->GetValue();
|
|
||||||
aPoint.y = SpinBox1_2->GetValue();
|
|
||||||
aPoint.z = SpinBox1_3->GetValue();
|
|
||||||
SMESH::double_array_var aScaleFact = new SMESH::double_array;
|
SMESH::double_array_var aScaleFact = new SMESH::double_array;
|
||||||
aScaleFact->length(3);
|
getScale(aPoint, aScaleFact);
|
||||||
aScaleFact[0] = SpinBox_FX->GetValue();
|
|
||||||
if (GetConstructorId() == 0) {
|
|
||||||
aScaleFact[1] = SpinBox_FX->GetValue();
|
|
||||||
aScaleFact[2] = SpinBox_FX->GetValue();
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
aScaleFact[1] = SpinBox_FY->GetValue();
|
|
||||||
aScaleFact[2] = SpinBox_FZ->GetValue();
|
|
||||||
}
|
|
||||||
|
|
||||||
QStringList aParameters;
|
QStringList aParameters;
|
||||||
aParameters << SpinBox1_1->text();
|
aParameters << SpinBox1_1->text();
|
||||||
@ -785,6 +790,8 @@ void SMESHGUI_ScaleDlg::SelectionIntoArgument()
|
|||||||
buttonOk->setEnabled(true);
|
buttonOk->setEnabled(true);
|
||||||
buttonApply->setEnabled(true);
|
buttonApply->setEnabled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onDisplaySimulation(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
@ -921,6 +928,7 @@ void SMESHGUI_ScaleDlg::onSelectMesh (bool toSelectMesh)
|
|||||||
LineEditElements->setReadOnly(false);
|
LineEditElements->setReadOnly(false);
|
||||||
LineEditElements->setValidator(myIdValidator);
|
LineEditElements->setValidator(myIdValidator);
|
||||||
onTextChange(LineEditElements->text());
|
onTextChange(LineEditElements->text());
|
||||||
|
hidePreview();
|
||||||
}
|
}
|
||||||
|
|
||||||
SelectionIntoArgument();
|
SelectionIntoArgument();
|
||||||
@ -1054,3 +1062,68 @@ bool SMESHGUI_ScaleDlg::isValid()
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=================================================================================
|
||||||
|
// function : onDisplaySimulation
|
||||||
|
// purpose : Show/Hide preview
|
||||||
|
//=================================================================================
|
||||||
|
void SMESHGUI_ScaleDlg::onDisplaySimulation( bool toDisplayPreview ) {
|
||||||
|
if (myPreviewCheckBox->isChecked() && toDisplayPreview) {
|
||||||
|
if ( myNbOkElements && isValid() ) {
|
||||||
|
QStringList aListElementsId = myElementsId.split(" ", QString::SkipEmptyParts);
|
||||||
|
|
||||||
|
SMESH::long_array_var anElementsId = new SMESH::long_array;
|
||||||
|
|
||||||
|
anElementsId->length(aListElementsId.count());
|
||||||
|
for (int i = 0; i < aListElementsId.count(); i++)
|
||||||
|
anElementsId[i] = aListElementsId[i].toInt();
|
||||||
|
|
||||||
|
SMESH::PointStruct aPoint;
|
||||||
|
SMESH::double_array_var aScaleFact = new SMESH::double_array;
|
||||||
|
getScale(aPoint, aScaleFact);
|
||||||
|
|
||||||
|
try {
|
||||||
|
bool copy = ActionGroup->checkedId() == COPY_ELEMS_BUTTON;
|
||||||
|
SUIT_OverrideCursor aWaitCursor;
|
||||||
|
SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditPreviewer();
|
||||||
|
SMESH::SMESH_IDSource_var obj;
|
||||||
|
if ( CheckBoxMesh->isChecked() )
|
||||||
|
obj = mySelectedObject;
|
||||||
|
else
|
||||||
|
obj = aMeshEditor->MakeIDSource(anElementsId, SMESH::ALL);
|
||||||
|
aMeshEditor->Scale(obj, aPoint, aScaleFact, copy);
|
||||||
|
|
||||||
|
SMESH::MeshPreviewStruct_var aMeshPreviewStruct = aMeshEditor->GetPreviewData();
|
||||||
|
mySimulation->SetData(aMeshPreviewStruct._retn());
|
||||||
|
|
||||||
|
} catch (...) {
|
||||||
|
hidePreview();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
hidePreview();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
hidePreview();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//=================================================================================
|
||||||
|
// function : getScale
|
||||||
|
// purpose : get scale parameters
|
||||||
|
//=================================================================================
|
||||||
|
void SMESHGUI_ScaleDlg::getScale( SMESH::PointStruct& thePoint , SMESH::double_array_var& theScaleFact) {
|
||||||
|
thePoint.x = SpinBox1_1->GetValue();
|
||||||
|
thePoint.y = SpinBox1_2->GetValue();
|
||||||
|
thePoint.z = SpinBox1_3->GetValue();
|
||||||
|
|
||||||
|
theScaleFact->length(3);
|
||||||
|
theScaleFact[0] = SpinBox_FX->GetValue();
|
||||||
|
if (GetConstructorId() == 0) {
|
||||||
|
theScaleFact[1] = SpinBox_FX->GetValue();
|
||||||
|
theScaleFact[2] = SpinBox_FX->GetValue();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
theScaleFact[1] = SpinBox_FY->GetValue();
|
||||||
|
theScaleFact[2] = SpinBox_FZ->GetValue();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -26,9 +26,7 @@
|
|||||||
|
|
||||||
// SMESH includes
|
// SMESH includes
|
||||||
#include "SMESH_SMESHGUI.hxx"
|
#include "SMESH_SMESHGUI.hxx"
|
||||||
|
#include "SMESHGUI_PreviewDlg.h"
|
||||||
// Qt includes
|
|
||||||
#include <QDialog>
|
|
||||||
|
|
||||||
// IDL includes
|
// IDL includes
|
||||||
#include <SALOMEconfig.h>
|
#include <SALOMEconfig.h>
|
||||||
@ -54,7 +52,7 @@ class SMESH_LogicalFilter;
|
|||||||
// class : SMESHGUI_ScaleDlg
|
// class : SMESHGUI_ScaleDlg
|
||||||
// purpose :
|
// purpose :
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
class SMESHGUI_EXPORT SMESHGUI_ScaleDlg : public QDialog
|
class SMESHGUI_EXPORT SMESHGUI_ScaleDlg : public SMESHGUI_PreviewDlg
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
@ -72,8 +70,9 @@ private:
|
|||||||
void setNewMeshName();
|
void setNewMeshName();
|
||||||
|
|
||||||
bool isValid();
|
bool isValid();
|
||||||
|
void getScale( SMESH::PointStruct& thePoint,
|
||||||
|
SMESH::double_array_var& theScaleFact);
|
||||||
|
|
||||||
SMESHGUI* mySMESHGUI; /* Current SMESHGUI object */
|
|
||||||
SMESHGUI_IdValidator* myIdValidator;
|
SMESHGUI_IdValidator* myIdValidator;
|
||||||
LightApp_SelectionMgr* mySelectionMgr; /* User shape selection */
|
LightApp_SelectionMgr* mySelectionMgr; /* User shape selection */
|
||||||
QString myElementsId;
|
QString myElementsId;
|
||||||
@ -128,6 +127,10 @@ private:
|
|||||||
QPushButton* myFilterBtn;
|
QPushButton* myFilterBtn;
|
||||||
SMESHGUI_FilterDlg* myFilterDlg;
|
SMESHGUI_FilterDlg* myFilterDlg;
|
||||||
|
|
||||||
|
|
||||||
|
protected slots:
|
||||||
|
virtual void onDisplaySimulation( bool );
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void ConstructorsClicked( int );
|
void ConstructorsClicked( int );
|
||||||
void ClickOnOk();
|
void ClickOnOk();
|
||||||
|
@ -33,6 +33,7 @@
|
|||||||
#include "SMESHGUI_MeshUtils.h"
|
#include "SMESHGUI_MeshUtils.h"
|
||||||
#include "SMESHGUI_IdValidator.h"
|
#include "SMESHGUI_IdValidator.h"
|
||||||
#include "SMESHGUI_FilterDlg.h"
|
#include "SMESHGUI_FilterDlg.h"
|
||||||
|
#include "SMESHGUI_MeshEditPreview.h"
|
||||||
|
|
||||||
#include <SMESH_Actor.h>
|
#include <SMESH_Actor.h>
|
||||||
#include <SMESH_TypeFilter.hxx>
|
#include <SMESH_TypeFilter.hxx>
|
||||||
@ -93,8 +94,7 @@ enum { MOVE_ELEMS_BUTTON = 0, COPY_ELEMS_BUTTON, MAKE_MESH_BUTTON }; //!< action
|
|||||||
//=================================================================================
|
//=================================================================================
|
||||||
|
|
||||||
SMESHGUI_SymmetryDlg::SMESHGUI_SymmetryDlg( SMESHGUI* theModule )
|
SMESHGUI_SymmetryDlg::SMESHGUI_SymmetryDlg( SMESHGUI* theModule )
|
||||||
: QDialog( SMESH::GetDesktop( theModule ) ),
|
: SMESHGUI_PreviewDlg( theModule ),
|
||||||
mySMESHGUI( theModule ),
|
|
||||||
mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ),
|
mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ),
|
||||||
myFilterDlg(0),
|
myFilterDlg(0),
|
||||||
mySelectedObject(SMESH::SMESH_IDSource::_nil())
|
mySelectedObject(SMESH::SMESH_IDSource::_nil())
|
||||||
@ -225,6 +225,10 @@ SMESHGUI_SymmetryDlg::SMESHGUI_SymmetryDlg( SMESHGUI* theModule )
|
|||||||
// Name of a mesh to create
|
// Name of a mesh to create
|
||||||
LineEditNewMesh = new QLineEdit(GroupArguments);
|
LineEditNewMesh = new QLineEdit(GroupArguments);
|
||||||
|
|
||||||
|
|
||||||
|
//Preview check box
|
||||||
|
myPreviewCheckBox = new QCheckBox(tr("PREVIEW"), GroupArguments);
|
||||||
|
|
||||||
// layout
|
// layout
|
||||||
GroupArgumentsLayout->addWidget(TextLabelElements, 0, 0);
|
GroupArgumentsLayout->addWidget(TextLabelElements, 0, 0);
|
||||||
GroupArgumentsLayout->addWidget(SelectElementsButton, 0, 1);
|
GroupArgumentsLayout->addWidget(SelectElementsButton, 0, 1);
|
||||||
@ -235,6 +239,7 @@ SMESHGUI_SymmetryDlg::SMESHGUI_SymmetryDlg( SMESHGUI* theModule )
|
|||||||
GroupArgumentsLayout->addWidget(ActionBox, 3, 0, 3, 3);
|
GroupArgumentsLayout->addWidget(ActionBox, 3, 0, 3, 3);
|
||||||
GroupArgumentsLayout->addWidget(MakeGroupsCheck, 4, 3);
|
GroupArgumentsLayout->addWidget(MakeGroupsCheck, 4, 3);
|
||||||
GroupArgumentsLayout->addWidget(LineEditNewMesh, 5, 3);
|
GroupArgumentsLayout->addWidget(LineEditNewMesh, 5, 3);
|
||||||
|
GroupArgumentsLayout->addWidget(myPreviewCheckBox, 6, 0);
|
||||||
|
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
GroupButtons = new QGroupBox(this);
|
GroupButtons = new QGroupBox(this);
|
||||||
@ -317,6 +322,16 @@ SMESHGUI_SymmetryDlg::SMESHGUI_SymmetryDlg( SMESHGUI* theModule )
|
|||||||
connect(CheckBoxMesh, SIGNAL(toggled(bool)), SLOT(onSelectMesh(bool)));
|
connect(CheckBoxMesh, SIGNAL(toggled(bool)), SLOT(onSelectMesh(bool)));
|
||||||
connect(ActionGroup, SIGNAL(buttonClicked(int)), SLOT(onActionClicked(int)));
|
connect(ActionGroup, SIGNAL(buttonClicked(int)), SLOT(onActionClicked(int)));
|
||||||
|
|
||||||
|
connect(SpinBox_X, SIGNAL(valueChanged(double)), this, SLOT(toDisplaySimulation()));
|
||||||
|
connect(SpinBox_Y, SIGNAL(valueChanged(double)), this, SLOT(toDisplaySimulation()));
|
||||||
|
connect(SpinBox_Z, SIGNAL(valueChanged(double)), this, SLOT(toDisplaySimulation()));
|
||||||
|
connect(SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(toDisplaySimulation()));
|
||||||
|
connect(SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(toDisplaySimulation()));
|
||||||
|
connect(SpinBox_DZ, SIGNAL(valueChanged(double)), this, SLOT(toDisplaySimulation()));
|
||||||
|
|
||||||
|
//To Connect preview check box
|
||||||
|
connectPreviewControl();
|
||||||
|
|
||||||
ConstructorsClicked(0);
|
ConstructorsClicked(0);
|
||||||
SelectionIntoArgument();
|
SelectionIntoArgument();
|
||||||
onActionClicked(MOVE_ELEMS_BUTTON);
|
onActionClicked(MOVE_ELEMS_BUTTON);
|
||||||
@ -363,6 +378,9 @@ void SMESHGUI_SymmetryDlg::Init (bool ResetControls)
|
|||||||
|
|
||||||
ActionGroup->button( MOVE_ELEMS_BUTTON )->setChecked(true);
|
ActionGroup->button( MOVE_ELEMS_BUTTON )->setChecked(true);
|
||||||
CheckBoxMesh->setChecked(false);
|
CheckBoxMesh->setChecked(false);
|
||||||
|
myPreviewCheckBox->setChecked(false);
|
||||||
|
onDisplaySimulation(false);
|
||||||
|
|
||||||
// MakeGroupsCheck->setChecked(false);
|
// MakeGroupsCheck->setChecked(false);
|
||||||
// MakeGroupsCheck->setEnabled(false);
|
// MakeGroupsCheck->setEnabled(false);
|
||||||
onSelectMesh(false);
|
onSelectMesh(false);
|
||||||
@ -434,6 +452,8 @@ void SMESHGUI_SymmetryDlg::ConstructorsClicked (int constructorId)
|
|||||||
|
|
||||||
connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
|
connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
|
||||||
|
|
||||||
|
onDisplaySimulation(true);
|
||||||
|
|
||||||
QApplication::instance()->processEvents();
|
QApplication::instance()->processEvents();
|
||||||
updateGeometry();
|
updateGeometry();
|
||||||
resize(100,100);
|
resize(100,100);
|
||||||
@ -461,17 +481,8 @@ bool SMESHGUI_SymmetryDlg::ClickOnApply()
|
|||||||
anElementsId[i] = aListElementsId[i].toInt();
|
anElementsId[i] = aListElementsId[i].toInt();
|
||||||
|
|
||||||
SMESH::AxisStruct aMirror;
|
SMESH::AxisStruct aMirror;
|
||||||
|
SMESH::SMESH_MeshEditor::MirrorType aMirrorType;
|
||||||
aMirror.x = SpinBox_X->GetValue();
|
getMirror(aMirror,aMirrorType);
|
||||||
aMirror.y = SpinBox_Y->GetValue();
|
|
||||||
aMirror.z = SpinBox_Z->GetValue();
|
|
||||||
if (GetConstructorId() == 0) {
|
|
||||||
aMirror.vx = aMirror.vy = aMirror.vz = 0;
|
|
||||||
} else {
|
|
||||||
aMirror.vx = SpinBox_DX->GetValue();
|
|
||||||
aMirror.vy = SpinBox_DY->GetValue();
|
|
||||||
aMirror.vz = SpinBox_DZ->GetValue();
|
|
||||||
}
|
|
||||||
|
|
||||||
QStringList aParameters;
|
QStringList aParameters;
|
||||||
aParameters << SpinBox_X->text();
|
aParameters << SpinBox_X->text();
|
||||||
@ -481,15 +492,6 @@ bool SMESHGUI_SymmetryDlg::ClickOnApply()
|
|||||||
aParameters << ( GetConstructorId() == 0 ? QString::number(0) : SpinBox_DY->text() );
|
aParameters << ( GetConstructorId() == 0 ? QString::number(0) : SpinBox_DY->text() );
|
||||||
aParameters << ( GetConstructorId() == 0 ? QString::number(0) : SpinBox_DZ->text() );
|
aParameters << ( GetConstructorId() == 0 ? QString::number(0) : SpinBox_DZ->text() );
|
||||||
|
|
||||||
SMESH::SMESH_MeshEditor::MirrorType aMirrorType;
|
|
||||||
|
|
||||||
if (GetConstructorId() == 0)
|
|
||||||
aMirrorType = SMESH::SMESH_MeshEditor::POINT;
|
|
||||||
if (GetConstructorId() == 1)
|
|
||||||
aMirrorType = SMESH::SMESH_MeshEditor::AXIS;
|
|
||||||
if (GetConstructorId() == 2)
|
|
||||||
aMirrorType = SMESH::SMESH_MeshEditor::PLANE;
|
|
||||||
|
|
||||||
int actionButton = ActionGroup->checkedId();
|
int actionButton = ActionGroup->checkedId();
|
||||||
bool makeGroups = ( MakeGroupsCheck->isEnabled() && MakeGroupsCheck->isChecked() );
|
bool makeGroups = ( MakeGroupsCheck->isEnabled() && MakeGroupsCheck->isChecked() );
|
||||||
|
|
||||||
@ -825,6 +827,7 @@ void SMESHGUI_SymmetryDlg::SelectionIntoArgument()
|
|||||||
buttonOk->setEnabled(true);
|
buttonOk->setEnabled(true);
|
||||||
buttonApply->setEnabled(true);
|
buttonApply->setEnabled(true);
|
||||||
}
|
}
|
||||||
|
onDisplaySimulation(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
@ -965,6 +968,7 @@ void SMESHGUI_SymmetryDlg::onSelectMesh (bool toSelectMesh)
|
|||||||
LineEditElements->setReadOnly(false);
|
LineEditElements->setReadOnly(false);
|
||||||
LineEditElements->setValidator(myIdValidator);
|
LineEditElements->setValidator(myIdValidator);
|
||||||
onTextChange(LineEditElements->text());
|
onTextChange(LineEditElements->text());
|
||||||
|
hidePreview();
|
||||||
}
|
}
|
||||||
|
|
||||||
SelectionIntoArgument();
|
SelectionIntoArgument();
|
||||||
@ -1129,3 +1133,67 @@ bool SMESHGUI_SymmetryDlg::isValid()
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=================================================================================
|
||||||
|
// function : onDisplaySimulation
|
||||||
|
// purpose : Show/Hide preview
|
||||||
|
//=================================================================================
|
||||||
|
void SMESHGUI_SymmetryDlg::onDisplaySimulation( bool toDisplayPreview ) {
|
||||||
|
if (myPreviewCheckBox->isChecked() && toDisplayPreview) {
|
||||||
|
if ( myNbOkElements && isValid() && IsMirrorOk() ) {
|
||||||
|
QStringList aListElementsId = myElementsId.split(" ", QString::SkipEmptyParts);
|
||||||
|
SMESH::long_array_var anElementsId = new SMESH::long_array;
|
||||||
|
|
||||||
|
anElementsId->length(aListElementsId.count());
|
||||||
|
for (int i = 0; i < aListElementsId.count(); i++)
|
||||||
|
anElementsId[i] = aListElementsId[i].toInt();
|
||||||
|
|
||||||
|
SMESH::AxisStruct aMirror;
|
||||||
|
SMESH::SMESH_MeshEditor::MirrorType aMirrorType;
|
||||||
|
|
||||||
|
getMirror(aMirror,aMirrorType);
|
||||||
|
|
||||||
|
try {
|
||||||
|
bool copy = ActionGroup->checkedId() == COPY_ELEMS_BUTTON;
|
||||||
|
SUIT_OverrideCursor aWaitCursor;
|
||||||
|
SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditPreviewer();
|
||||||
|
if(CheckBoxMesh->isChecked())
|
||||||
|
aMeshEditor->MirrorObject(mySelectedObject, aMirror, aMirrorType, copy );
|
||||||
|
else
|
||||||
|
aMeshEditor->Mirror(anElementsId, aMirror, aMirrorType, copy );
|
||||||
|
|
||||||
|
SMESH::MeshPreviewStruct_var aMeshPreviewStruct = aMeshEditor->GetPreviewData();
|
||||||
|
mySimulation->SetData(aMeshPreviewStruct._retn());
|
||||||
|
} catch (...) {
|
||||||
|
hidePreview();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
hidePreview();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
hidePreview();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//=================================================================================
|
||||||
|
// function : getMirror
|
||||||
|
// purpose : return mirror parameters
|
||||||
|
//=================================================================================
|
||||||
|
void SMESHGUI_SymmetryDlg::getMirror(SMESH::AxisStruct& theMirror, SMESH::SMESH_MeshEditor::MirrorType& theMirrorType) {
|
||||||
|
theMirror.x = SpinBox_X->GetValue();
|
||||||
|
theMirror.y = SpinBox_Y->GetValue();
|
||||||
|
theMirror.z = SpinBox_Z->GetValue();
|
||||||
|
if (GetConstructorId() == 0) {
|
||||||
|
theMirror.vx = theMirror.vy = theMirror.vz = 0;
|
||||||
|
} else {
|
||||||
|
theMirror.vx = SpinBox_DX->GetValue();
|
||||||
|
theMirror.vy = SpinBox_DY->GetValue();
|
||||||
|
theMirror.vz = SpinBox_DZ->GetValue();
|
||||||
|
}
|
||||||
|
if (GetConstructorId() == 0)
|
||||||
|
theMirrorType = SMESH::SMESH_MeshEditor::POINT;
|
||||||
|
if (GetConstructorId() == 1)
|
||||||
|
theMirrorType = SMESH::SMESH_MeshEditor::AXIS;
|
||||||
|
if (GetConstructorId() == 2)
|
||||||
|
theMirrorType = SMESH::SMESH_MeshEditor::PLANE;
|
||||||
|
}
|
||||||
|
@ -29,13 +29,12 @@
|
|||||||
|
|
||||||
// SMESH includes
|
// SMESH includes
|
||||||
#include "SMESH_SMESHGUI.hxx"
|
#include "SMESH_SMESHGUI.hxx"
|
||||||
|
#include "SMESHGUI_PreviewDlg.h"
|
||||||
// Qt includes
|
|
||||||
#include <QDialog>
|
|
||||||
|
|
||||||
// IDL includes
|
// IDL includes
|
||||||
#include <SALOMEconfig.h>
|
#include <SALOMEconfig.h>
|
||||||
#include CORBA_SERVER_HEADER(SMESH_Mesh)
|
#include CORBA_SERVER_HEADER(SMESH_Mesh)
|
||||||
|
#include CORBA_SERVER_HEADER(SMESH_MeshEditor)
|
||||||
|
|
||||||
class QButtonGroup;
|
class QButtonGroup;
|
||||||
class QGroupBox;
|
class QGroupBox;
|
||||||
@ -57,7 +56,7 @@ class SMESH_LogicalFilter;
|
|||||||
// class : SMESHGUI_SymmetryDlg
|
// class : SMESHGUI_SymmetryDlg
|
||||||
// purpose :
|
// purpose :
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
class SMESHGUI_EXPORT SMESHGUI_SymmetryDlg : public QDialog
|
class SMESHGUI_EXPORT SMESHGUI_SymmetryDlg : public SMESHGUI_PreviewDlg
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
@ -75,9 +74,10 @@ private:
|
|||||||
bool IsMirrorOk();
|
bool IsMirrorOk();
|
||||||
void setNewMeshName();
|
void setNewMeshName();
|
||||||
|
|
||||||
|
void getMirror(SMESH::AxisStruct& theMirror, SMESH::SMESH_MeshEditor::MirrorType& aMirrorType);
|
||||||
|
|
||||||
bool isValid();
|
bool isValid();
|
||||||
|
|
||||||
SMESHGUI* mySMESHGUI; /* Current SMESHGUI object */
|
|
||||||
SMESHGUI_IdValidator* myIdValidator;
|
SMESHGUI_IdValidator* myIdValidator;
|
||||||
LightApp_SelectionMgr* mySelectionMgr; /* User shape selection */
|
LightApp_SelectionMgr* mySelectionMgr; /* User shape selection */
|
||||||
int myNbOkElements; /* to check when elements are defined */
|
int myNbOkElements; /* to check when elements are defined */
|
||||||
@ -137,6 +137,9 @@ private:
|
|||||||
QPushButton* myFilterBtn;
|
QPushButton* myFilterBtn;
|
||||||
SMESHGUI_FilterDlg* myFilterDlg;
|
SMESHGUI_FilterDlg* myFilterDlg;
|
||||||
|
|
||||||
|
protected slots:
|
||||||
|
virtual void onDisplaySimulation( bool );
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void ConstructorsClicked( int );
|
void ConstructorsClicked( int );
|
||||||
void ClickOnOk();
|
void ClickOnOk();
|
||||||
|
@ -33,6 +33,7 @@
|
|||||||
#include "SMESHGUI_MeshUtils.h"
|
#include "SMESHGUI_MeshUtils.h"
|
||||||
#include "SMESHGUI_IdValidator.h"
|
#include "SMESHGUI_IdValidator.h"
|
||||||
#include "SMESHGUI_FilterDlg.h"
|
#include "SMESHGUI_FilterDlg.h"
|
||||||
|
#include "SMESHGUI_MeshEditPreview.h"
|
||||||
|
|
||||||
#include <SMESH_Actor.h>
|
#include <SMESH_Actor.h>
|
||||||
#include <SMESH_TypeFilter.hxx>
|
#include <SMESH_TypeFilter.hxx>
|
||||||
@ -109,9 +110,8 @@ private:
|
|||||||
// class : SMESHGUI_TranslationDlg()
|
// class : SMESHGUI_TranslationDlg()
|
||||||
// purpose :
|
// purpose :
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
SMESHGUI_TranslationDlg::SMESHGUI_TranslationDlg( SMESHGUI* theModule )
|
SMESHGUI_TranslationDlg::SMESHGUI_TranslationDlg( SMESHGUI* theModule ) :
|
||||||
: QDialog( SMESH::GetDesktop( theModule ) ),
|
SMESHGUI_PreviewDlg( theModule ),
|
||||||
mySMESHGUI( theModule ),
|
|
||||||
mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ),
|
mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ),
|
||||||
myFilterDlg(0),
|
myFilterDlg(0),
|
||||||
mySelectedObject(SMESH::SMESH_IDSource::_nil())
|
mySelectedObject(SMESH::SMESH_IDSource::_nil())
|
||||||
@ -215,6 +215,9 @@ SMESHGUI_TranslationDlg::SMESHGUI_TranslationDlg( SMESHGUI* theModule )
|
|||||||
// Name of a mesh to create
|
// Name of a mesh to create
|
||||||
LineEditNewMesh = new QLineEdit(GroupArguments);
|
LineEditNewMesh = new QLineEdit(GroupArguments);
|
||||||
|
|
||||||
|
//Preview check box
|
||||||
|
myPreviewCheckBox = new QCheckBox(tr("PREVIEW"), GroupArguments);
|
||||||
|
|
||||||
// layout
|
// layout
|
||||||
GroupArgumentsLayout->addWidget(TextLabelElements, 0, 0);
|
GroupArgumentsLayout->addWidget(TextLabelElements, 0, 0);
|
||||||
GroupArgumentsLayout->addWidget(SelectElementsButton, 0, 1);
|
GroupArgumentsLayout->addWidget(SelectElementsButton, 0, 1);
|
||||||
@ -240,6 +243,7 @@ SMESHGUI_TranslationDlg::SMESHGUI_TranslationDlg( SMESHGUI* theModule )
|
|||||||
GroupArgumentsLayout->addWidget(ActionBox, 4, 0, 3, 4);
|
GroupArgumentsLayout->addWidget(ActionBox, 4, 0, 3, 4);
|
||||||
GroupArgumentsLayout->addWidget(MakeGroupsCheck, 5, 5, 1, 4);
|
GroupArgumentsLayout->addWidget(MakeGroupsCheck, 5, 5, 1, 4);
|
||||||
GroupArgumentsLayout->addWidget(LineEditNewMesh, 6, 5, 1, 4);
|
GroupArgumentsLayout->addWidget(LineEditNewMesh, 6, 5, 1, 4);
|
||||||
|
GroupArgumentsLayout->addWidget(myPreviewCheckBox, 7, 0);
|
||||||
|
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
GroupButtons = new QGroupBox(this);
|
GroupButtons = new QGroupBox(this);
|
||||||
@ -318,6 +322,19 @@ SMESHGUI_TranslationDlg::SMESHGUI_TranslationDlg( SMESHGUI* theModule )
|
|||||||
connect(CheckBoxMesh, SIGNAL(toggled(bool)), SLOT(onSelectMesh(bool)));
|
connect(CheckBoxMesh, SIGNAL(toggled(bool)), SLOT(onSelectMesh(bool)));
|
||||||
connect(ActionGroup, SIGNAL(buttonClicked(int)), SLOT(onActionClicked(int)));
|
connect(ActionGroup, SIGNAL(buttonClicked(int)), SLOT(onActionClicked(int)));
|
||||||
|
|
||||||
|
connect(SpinBox1_1, SIGNAL(valueChanged(double)), this, SLOT(toDisplaySimulation()));
|
||||||
|
connect(SpinBox1_2, SIGNAL(valueChanged(double)), this, SLOT(toDisplaySimulation()));
|
||||||
|
connect(SpinBox1_3, SIGNAL(valueChanged(double)), this, SLOT(toDisplaySimulation()));
|
||||||
|
|
||||||
|
connect(SpinBox2_1, SIGNAL(valueChanged(double)), this, SLOT(toDisplaySimulation()));
|
||||||
|
connect(SpinBox2_2, SIGNAL(valueChanged(double)), this, SLOT(toDisplaySimulation()));
|
||||||
|
connect(SpinBox2_3, SIGNAL(valueChanged(double)), this, SLOT(toDisplaySimulation()));
|
||||||
|
connect(SpinBox2_3, SIGNAL(valueChanged(double)), this, SLOT(toDisplaySimulation()));
|
||||||
|
|
||||||
|
|
||||||
|
//To Connect preview check box
|
||||||
|
connectPreviewControl();
|
||||||
|
|
||||||
ConstructorsClicked(0);
|
ConstructorsClicked(0);
|
||||||
SelectionIntoArgument();
|
SelectionIntoArgument();
|
||||||
onActionClicked(MOVE_ELEMS_BUTTON);
|
onActionClicked(MOVE_ELEMS_BUTTON);
|
||||||
@ -367,6 +384,8 @@ void SMESHGUI_TranslationDlg::Init (bool ResetControls)
|
|||||||
CheckBoxMesh->setChecked(false);
|
CheckBoxMesh->setChecked(false);
|
||||||
// MakeGroupsCheck->setChecked(false);
|
// MakeGroupsCheck->setChecked(false);
|
||||||
// MakeGroupsCheck->setEnabled(false);
|
// MakeGroupsCheck->setEnabled(false);
|
||||||
|
myPreviewCheckBox->setChecked(false);
|
||||||
|
onDisplaySimulation(false);
|
||||||
onSelectMesh(false);
|
onSelectMesh(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -433,6 +452,8 @@ void SMESHGUI_TranslationDlg::ConstructorsClicked (int constructorId)
|
|||||||
|
|
||||||
connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
|
connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
|
||||||
|
|
||||||
|
onDisplaySimulation(true);
|
||||||
|
|
||||||
QApplication::instance()->processEvents();
|
QApplication::instance()->processEvents();
|
||||||
updateGeometry();
|
updateGeometry();
|
||||||
resize(100,100);
|
resize(100,100);
|
||||||
@ -805,6 +826,7 @@ void SMESHGUI_TranslationDlg::SelectionIntoArgument()
|
|||||||
buttonOk->setEnabled(true);
|
buttonOk->setEnabled(true);
|
||||||
buttonApply->setEnabled(true);
|
buttonApply->setEnabled(true);
|
||||||
}
|
}
|
||||||
|
onDisplaySimulation(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
@ -947,6 +969,7 @@ void SMESHGUI_TranslationDlg::onSelectMesh (bool toSelectMesh)
|
|||||||
LineEditElements->setReadOnly(false);
|
LineEditElements->setReadOnly(false);
|
||||||
LineEditElements->setValidator(myIdValidator);
|
LineEditElements->setValidator(myIdValidator);
|
||||||
onTextChange(LineEditElements->text());
|
onTextChange(LineEditElements->text());
|
||||||
|
hidePreview();
|
||||||
}
|
}
|
||||||
|
|
||||||
SelectionIntoArgument();
|
SelectionIntoArgument();
|
||||||
@ -1080,3 +1103,53 @@ bool SMESHGUI_TranslationDlg::isValid()
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=================================================================================
|
||||||
|
// function : onDisplaySimulation
|
||||||
|
// purpose : Show/Hide preview
|
||||||
|
//=================================================================================
|
||||||
|
void SMESHGUI_TranslationDlg::onDisplaySimulation( bool toDisplayPreview ) {
|
||||||
|
if (myPreviewCheckBox->isChecked() && toDisplayPreview) {
|
||||||
|
|
||||||
|
if (isValid() && myNbOkElements) {
|
||||||
|
QStringList aListElementsId = myElementsId.split(" ", QString::SkipEmptyParts);
|
||||||
|
|
||||||
|
SMESH::long_array_var anElementsId = new SMESH::long_array;
|
||||||
|
|
||||||
|
anElementsId->length(aListElementsId.count());
|
||||||
|
for (int i = 0; i < aListElementsId.count(); i++)
|
||||||
|
anElementsId[i] = aListElementsId[i].toInt();
|
||||||
|
|
||||||
|
SMESH::DirStruct aVector;
|
||||||
|
if (GetConstructorId() == 0) {
|
||||||
|
aVector.PS.x = SpinBox2_1->GetValue() - SpinBox1_1->GetValue();
|
||||||
|
aVector.PS.y = SpinBox2_2->GetValue() - SpinBox1_2->GetValue();
|
||||||
|
aVector.PS.z = SpinBox2_3->GetValue() - SpinBox1_3->GetValue();
|
||||||
|
} else if (GetConstructorId() == 1) {
|
||||||
|
aVector.PS.x = SpinBox1_1->GetValue();
|
||||||
|
aVector.PS.y = SpinBox1_2->GetValue();
|
||||||
|
aVector.PS.z = SpinBox1_3->GetValue();
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
bool copy = ActionGroup->checkedId() == COPY_ELEMS_BUTTON;
|
||||||
|
SUIT_OverrideCursor aWaitCursor;
|
||||||
|
SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditPreviewer();
|
||||||
|
if(CheckBoxMesh->isChecked())
|
||||||
|
aMeshEditor->TranslateObject(mySelectedObject, aVector, copy);
|
||||||
|
else
|
||||||
|
aMeshEditor->Translate(anElementsId, aVector, copy);
|
||||||
|
|
||||||
|
SMESH::MeshPreviewStruct_var aMeshPreviewStruct = aMeshEditor->GetPreviewData();
|
||||||
|
mySimulation->SetData(aMeshPreviewStruct._retn());
|
||||||
|
} catch (...) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
hidePreview();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
hidePreview();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -29,9 +29,7 @@
|
|||||||
|
|
||||||
// SMESH includes
|
// SMESH includes
|
||||||
#include "SMESH_SMESHGUI.hxx"
|
#include "SMESH_SMESHGUI.hxx"
|
||||||
|
#include "SMESHGUI_PreviewDlg.h"
|
||||||
// Qt includes
|
|
||||||
#include <QDialog>
|
|
||||||
|
|
||||||
// IDL includes
|
// IDL includes
|
||||||
#include <SALOMEconfig.h>
|
#include <SALOMEconfig.h>
|
||||||
@ -57,7 +55,7 @@ class SMESH_LogicalFilter;
|
|||||||
// class : SMESHGUI_TranslationDlg
|
// class : SMESHGUI_TranslationDlg
|
||||||
// purpose :
|
// purpose :
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
class SMESHGUI_EXPORT SMESHGUI_TranslationDlg : public QDialog
|
class SMESHGUI_EXPORT SMESHGUI_TranslationDlg : public SMESHGUI_PreviewDlg
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
@ -76,7 +74,6 @@ private:
|
|||||||
|
|
||||||
bool isValid();
|
bool isValid();
|
||||||
|
|
||||||
SMESHGUI* mySMESHGUI; /* Current SMESHGUI object */
|
|
||||||
SMESHGUI_IdValidator* myIdValidator;
|
SMESHGUI_IdValidator* myIdValidator;
|
||||||
LightApp_SelectionMgr* mySelectionMgr; /* User shape selection */
|
LightApp_SelectionMgr* mySelectionMgr; /* User shape selection */
|
||||||
QString myElementsId;
|
QString myElementsId;
|
||||||
@ -134,6 +131,9 @@ private:
|
|||||||
QPushButton* myFilterBtn;
|
QPushButton* myFilterBtn;
|
||||||
SMESHGUI_FilterDlg* myFilterDlg;
|
SMESHGUI_FilterDlg* myFilterDlg;
|
||||||
|
|
||||||
|
protected slots:
|
||||||
|
virtual void onDisplaySimulation( bool );
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void ConstructorsClicked( int );
|
void ConstructorsClicked( int );
|
||||||
void ClickOnOk();
|
void ClickOnOk();
|
||||||
|
@ -1808,16 +1808,30 @@ SMESH_MeshEditor_i::extrusionSweep(const SMESH::long_array & theIDsOfElements,
|
|||||||
#ifdef NO_CAS_CATCH
|
#ifdef NO_CAS_CATCH
|
||||||
OCC_CATCH_SIGNALS;
|
OCC_CATCH_SIGNALS;
|
||||||
#endif
|
#endif
|
||||||
TIDSortedElemSet elements;
|
TIDSortedElemSet elements, copyElements;
|
||||||
arrayToSet(theIDsOfElements, GetMeshDS(), elements, theElementType);
|
arrayToSet(theIDsOfElements, GetMeshDS(), elements, theElementType);
|
||||||
|
|
||||||
const SMESH::PointStruct * P = &theStepVector.PS;
|
const SMESH::PointStruct * P = &theStepVector.PS;
|
||||||
gp_Vec stepVec( P->x, P->y, P->z );
|
gp_Vec stepVec( P->x, P->y, P->z );
|
||||||
|
|
||||||
|
TIDSortedElemSet* workElements = & elements;
|
||||||
|
TPreviewMesh tmpMesh( SMDSAbs_Face );
|
||||||
|
SMESH_Mesh* mesh = 0;
|
||||||
|
|
||||||
|
if ( myPreviewMode ) {
|
||||||
|
SMDSAbs_ElementType select = SMDSAbs_All, avoid = SMDSAbs_Volume;
|
||||||
|
tmpMesh.Copy( elements, copyElements, select, avoid );
|
||||||
|
mesh = &tmpMesh;
|
||||||
|
workElements = & copyElements;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
mesh = myMesh;
|
||||||
|
}
|
||||||
|
|
||||||
TElemOfElemListMap aHystory;
|
TElemOfElemListMap aHystory;
|
||||||
::SMESH_MeshEditor anEditor( myMesh );
|
::SMESH_MeshEditor anEditor( mesh );
|
||||||
::SMESH_MeshEditor::PGroupIDs groupIds =
|
::SMESH_MeshEditor::PGroupIDs groupIds =
|
||||||
anEditor.ExtrusionSweep (elements, stepVec, theNbOfSteps, aHystory, theMakeGroups);
|
anEditor.ExtrusionSweep (*workElements, stepVec, theNbOfSteps, aHystory, theMakeGroups);
|
||||||
|
|
||||||
myMesh->GetMeshDS()->Modified();
|
myMesh->GetMeshDS()->Modified();
|
||||||
storeResult(anEditor);
|
storeResult(anEditor);
|
||||||
@ -2214,10 +2228,26 @@ SMESH_MeshEditor_i::extrusionAlongPathX(const SMESH::long_array & IDsOfElements
|
|||||||
return EmptyGr;
|
return EmptyGr;
|
||||||
}
|
}
|
||||||
|
|
||||||
TIDSortedElemSet elements;
|
TIDSortedElemSet elements, copyElements;
|
||||||
arrayToSet(IDsOfElements, GetMeshDS(), elements, ElementType);
|
arrayToSet(IDsOfElements, GetMeshDS(), elements, ElementType);
|
||||||
|
|
||||||
::SMESH_MeshEditor anEditor( myMesh );
|
TIDSortedElemSet* workElements = &elements;
|
||||||
|
TPreviewMesh tmpMesh( SMDSAbs_Face );
|
||||||
|
SMESH_Mesh* mesh = 0;
|
||||||
|
|
||||||
|
if ( myPreviewMode )
|
||||||
|
{
|
||||||
|
SMDSAbs_ElementType select = SMDSAbs_All, avoid = SMDSAbs_Volume;
|
||||||
|
tmpMesh.Copy( elements, copyElements, select, avoid );
|
||||||
|
mesh = &tmpMesh;
|
||||||
|
workElements = & copyElements;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mesh = myMesh;
|
||||||
|
}
|
||||||
|
|
||||||
|
::SMESH_MeshEditor anEditor( mesh );
|
||||||
::SMESH_MeshEditor::Extrusion_Error error;
|
::SMESH_MeshEditor::Extrusion_Error error;
|
||||||
|
|
||||||
SMESH_Mesh_i* aMeshImp = SMESH::DownCast<SMESH_Mesh_i*>( Path );
|
SMESH_Mesh_i* aMeshImp = SMESH::DownCast<SMESH_Mesh_i*>( Path );
|
||||||
@ -2229,7 +2259,7 @@ SMESH_MeshEditor_i::extrusionAlongPathX(const SMESH::long_array & IDsOfElements
|
|||||||
Error = SMESH::SMESH_MeshEditor::EXTR_BAD_STARTING_NODE;
|
Error = SMESH::SMESH_MeshEditor::EXTR_BAD_STARTING_NODE;
|
||||||
return EmptyGr;
|
return EmptyGr;
|
||||||
}
|
}
|
||||||
error = anEditor.ExtrusionAlongTrack( elements, &(aMeshImp->GetImpl()), aNodeStart,
|
error = anEditor.ExtrusionAlongTrack( *workElements, &(aMeshImp->GetImpl()), aNodeStart,
|
||||||
HasAngles, angles, LinearVariation,
|
HasAngles, angles, LinearVariation,
|
||||||
HasRefPoint, refPnt, MakeGroups );
|
HasRefPoint, refPnt, MakeGroups );
|
||||||
myMesh->GetMeshDS()->Modified();
|
myMesh->GetMeshDS()->Modified();
|
||||||
@ -2248,7 +2278,7 @@ SMESH_MeshEditor_i::extrusionAlongPathX(const SMESH::long_array & IDsOfElements
|
|||||||
}
|
}
|
||||||
SMESH_subMesh* aSubMesh =
|
SMESH_subMesh* aSubMesh =
|
||||||
aMeshImp->GetImpl().GetSubMeshContaining(aSubMeshImp->GetId());
|
aMeshImp->GetImpl().GetSubMeshContaining(aSubMeshImp->GetId());
|
||||||
error = anEditor.ExtrusionAlongTrack( elements, aSubMesh, aNodeStart,
|
error = anEditor.ExtrusionAlongTrack( *workElements, aSubMesh, aNodeStart,
|
||||||
HasAngles, angles, LinearVariation,
|
HasAngles, angles, LinearVariation,
|
||||||
HasRefPoint, refPnt, MakeGroups );
|
HasRefPoint, refPnt, MakeGroups );
|
||||||
myMesh->GetMeshDS()->Modified();
|
myMesh->GetMeshDS()->Modified();
|
||||||
@ -2881,11 +2911,28 @@ SMESH_MeshEditor_i::mirror(TIDSortedElemSet & theElements,
|
|||||||
aTrsf.SetMirror( gp_Ax2( P, V ));
|
aTrsf.SetMirror( gp_Ax2( P, V ));
|
||||||
}
|
}
|
||||||
|
|
||||||
::SMESH_MeshEditor anEditor( myMesh );
|
TIDSortedElemSet copyElements;
|
||||||
::SMESH_MeshEditor::PGroupIDs groupIds =
|
TPreviewMesh tmpMesh;
|
||||||
anEditor.Transform (theElements, aTrsf, theCopy, theMakeGroups, theTargetMesh);
|
TIDSortedElemSet* workElements = 0;
|
||||||
|
SMESH_Mesh* mesh = 0;
|
||||||
|
|
||||||
if(theCopy)
|
if ( myPreviewMode )
|
||||||
|
{
|
||||||
|
tmpMesh.Copy( theElements, copyElements);
|
||||||
|
mesh = &tmpMesh;
|
||||||
|
workElements = & copyElements;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mesh = myMesh;
|
||||||
|
workElements = & theElements;
|
||||||
|
}
|
||||||
|
|
||||||
|
::SMESH_MeshEditor anEditor( mesh );
|
||||||
|
::SMESH_MeshEditor::PGroupIDs groupIds =
|
||||||
|
anEditor.Transform (*workElements, aTrsf, theCopy, theMakeGroups, theTargetMesh);
|
||||||
|
|
||||||
|
if(theCopy || myPreviewMode)
|
||||||
storeResult(anEditor);
|
storeResult(anEditor);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -2940,7 +2987,10 @@ void SMESH_MeshEditor_i::MirrorObject(SMESH::SMESH_IDSource_ptr theObj
|
|||||||
<< theCopy << " )";
|
<< theCopy << " )";
|
||||||
}
|
}
|
||||||
TIDSortedElemSet elements;
|
TIDSortedElemSet elements;
|
||||||
if (idSourceToSet(theObject, GetMeshDS(), elements, SMDSAbs_All, /*emptyIfIsMesh=*/1))
|
|
||||||
|
bool emptyIfIsMesh = myPreviewMode ? false : true;
|
||||||
|
|
||||||
|
if (idSourceToSet(theObject, GetMeshDS(), elements, SMDSAbs_All, emptyIfIsMesh))
|
||||||
mirror(elements, theAxis, theMirrorType, theCopy, false);
|
mirror(elements, theAxis, theMirrorType, theCopy, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3112,11 +3162,28 @@ SMESH_MeshEditor_i::translate(TIDSortedElemSet & theElements,
|
|||||||
const SMESH::PointStruct * P = &theVector.PS;
|
const SMESH::PointStruct * P = &theVector.PS;
|
||||||
aTrsf.SetTranslation( gp_Vec( P->x, P->y, P->z ));
|
aTrsf.SetTranslation( gp_Vec( P->x, P->y, P->z ));
|
||||||
|
|
||||||
::SMESH_MeshEditor anEditor( myMesh );
|
TIDSortedElemSet copyElements;
|
||||||
::SMESH_MeshEditor::PGroupIDs groupIds =
|
TPreviewMesh tmpMesh;
|
||||||
anEditor.Transform (theElements, aTrsf, theCopy, theMakeGroups, theTargetMesh);
|
TIDSortedElemSet* workElements = 0;
|
||||||
|
SMESH_Mesh* mesh = 0;
|
||||||
|
|
||||||
if(theCopy)
|
if ( myPreviewMode )
|
||||||
|
{
|
||||||
|
tmpMesh.Copy( theElements, copyElements);
|
||||||
|
mesh = &tmpMesh;
|
||||||
|
workElements = & copyElements;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mesh = myMesh;
|
||||||
|
workElements = & theElements;
|
||||||
|
}
|
||||||
|
|
||||||
|
::SMESH_MeshEditor anEditor( mesh );
|
||||||
|
::SMESH_MeshEditor::PGroupIDs groupIds =
|
||||||
|
anEditor.Transform (*workElements, aTrsf, theCopy, theMakeGroups, theTargetMesh);
|
||||||
|
|
||||||
|
if(theCopy || myPreviewMode)
|
||||||
storeResult(anEditor);
|
storeResult(anEditor);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -3165,7 +3232,10 @@ void SMESH_MeshEditor_i::TranslateObject(SMESH::SMESH_IDSource_ptr theObject,
|
|||||||
<< theCopy << " )";
|
<< theCopy << " )";
|
||||||
}
|
}
|
||||||
TIDSortedElemSet elements;
|
TIDSortedElemSet elements;
|
||||||
if (idSourceToSet(theObject, GetMeshDS(), elements, SMDSAbs_All, /*emptyIfIsMesh=*/1))
|
|
||||||
|
bool emptyIfIsMesh = myPreviewMode ? false : true;
|
||||||
|
|
||||||
|
if (idSourceToSet(theObject, GetMeshDS(), elements, SMDSAbs_All, emptyIfIsMesh))
|
||||||
translate(elements, theVector, theCopy, false);
|
translate(elements, theVector, theCopy, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3330,11 +3400,27 @@ SMESH_MeshEditor_i::rotate(TIDSortedElemSet & theElements,
|
|||||||
gp_Trsf aTrsf;
|
gp_Trsf aTrsf;
|
||||||
aTrsf.SetRotation( gp_Ax1( P, V ), theAngle);
|
aTrsf.SetRotation( gp_Ax1( P, V ), theAngle);
|
||||||
|
|
||||||
::SMESH_MeshEditor anEditor( myMesh );
|
TIDSortedElemSet copyElements;
|
||||||
::SMESH_MeshEditor::PGroupIDs groupIds =
|
TPreviewMesh tmpMesh;
|
||||||
anEditor.Transform (theElements, aTrsf, theCopy, theMakeGroups, theTargetMesh);
|
TIDSortedElemSet* workElements = 0;
|
||||||
|
SMESH_Mesh* mesh = 0;
|
||||||
|
|
||||||
if(theCopy)
|
if ( myPreviewMode ) {
|
||||||
|
tmpMesh.Copy( theElements, copyElements );
|
||||||
|
mesh = &tmpMesh;
|
||||||
|
workElements = ©Elements;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mesh = myMesh;
|
||||||
|
workElements=&theElements;
|
||||||
|
}
|
||||||
|
|
||||||
|
::SMESH_MeshEditor anEditor( mesh );
|
||||||
|
::SMESH_MeshEditor::PGroupIDs groupIds =
|
||||||
|
anEditor.Transform (*workElements, aTrsf, theCopy, theMakeGroups, theTargetMesh);
|
||||||
|
|
||||||
|
if(theCopy || myPreviewMode)
|
||||||
storeResult(anEditor);
|
storeResult(anEditor);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -3388,7 +3474,8 @@ void SMESH_MeshEditor_i::RotateObject(SMESH::SMESH_IDSource_ptr theObject,
|
|||||||
<< theCopy << " )";
|
<< theCopy << " )";
|
||||||
}
|
}
|
||||||
TIDSortedElemSet elements;
|
TIDSortedElemSet elements;
|
||||||
if (idSourceToSet(theObject, GetMeshDS(), elements, SMDSAbs_All, /*emptyIfIsMesh=*/1))
|
bool emptyIfIsMesh = myPreviewMode ? false : true;
|
||||||
|
if (idSourceToSet(theObject, GetMeshDS(), elements, SMDSAbs_All, emptyIfIsMesh))
|
||||||
rotate(elements,theAxis,theAngle,theCopy,false);
|
rotate(elements,theAxis,theAngle,theCopy,false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3563,7 +3650,8 @@ SMESH_MeshEditor_i::scale(SMESH::SMESH_IDSource_ptr theObject,
|
|||||||
THROW_SALOME_CORBA_EXCEPTION("Invalid nb of scale factors : 2", SALOME::BAD_PARAM);
|
THROW_SALOME_CORBA_EXCEPTION("Invalid nb of scale factors : 2", SALOME::BAD_PARAM);
|
||||||
|
|
||||||
TIDSortedElemSet elements;
|
TIDSortedElemSet elements;
|
||||||
if ( !idSourceToSet(theObject, GetMeshDS(), elements, SMDSAbs_All, /*emptyIfIsMesh=*/true))
|
bool emptyIfIsMesh = myPreviewMode ? false : true;
|
||||||
|
if ( !idSourceToSet(theObject, GetMeshDS(), elements, SMDSAbs_All, emptyIfIsMesh))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
vector<double> S(3);
|
vector<double> S(3);
|
||||||
@ -3576,11 +3664,28 @@ SMESH_MeshEditor_i::scale(SMESH::SMESH_IDSource_ptr theObject,
|
|||||||
0, S[1], 0, thePoint.y * (1-S[1]),
|
0, S[1], 0, thePoint.y * (1-S[1]),
|
||||||
0, 0, S[2], thePoint.z * (1-S[2]), tol, tol);
|
0, 0, S[2], thePoint.z * (1-S[2]), tol, tol);
|
||||||
|
|
||||||
::SMESH_MeshEditor anEditor( myMesh );
|
TIDSortedElemSet copyElements;
|
||||||
::SMESH_MeshEditor::PGroupIDs groupIds =
|
TPreviewMesh tmpMesh;
|
||||||
anEditor.Transform (elements, aTrsf, theCopy, theMakeGroups, theTargetMesh);
|
TIDSortedElemSet* workElements = 0;
|
||||||
|
SMESH_Mesh* mesh = 0;
|
||||||
|
|
||||||
if(theCopy)
|
if ( myPreviewMode )
|
||||||
|
{
|
||||||
|
tmpMesh.Copy( elements, copyElements);
|
||||||
|
mesh = &tmpMesh;
|
||||||
|
workElements = & copyElements;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mesh = myMesh;
|
||||||
|
workElements = & elements;
|
||||||
|
}
|
||||||
|
|
||||||
|
::SMESH_MeshEditor anEditor( mesh );
|
||||||
|
::SMESH_MeshEditor::PGroupIDs groupIds =
|
||||||
|
anEditor.Transform (*workElements, aTrsf, theCopy, theMakeGroups, theTargetMesh);
|
||||||
|
|
||||||
|
if(theCopy || myPreviewMode )
|
||||||
storeResult(anEditor);
|
storeResult(anEditor);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user