mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2024-12-25 17:00:34 +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_FileValidator.h \
|
||||
SMESHGUI_CopyMeshDlg.h \
|
||||
SMESHGUI_PreviewDlg.h \
|
||||
SMESH_SMESHGUI.hxx
|
||||
|
||||
# Libraries targets
|
||||
@ -169,7 +170,8 @@ dist_libSMESH_la_SOURCES = \
|
||||
SMESHGUI_MeshOrderDlg.cxx \
|
||||
SMESHGUI_MeshOrderOp.cxx \
|
||||
SMESHGUI_CopyMeshDlg.cxx \
|
||||
SMESHGUI_FileValidator.cxx
|
||||
SMESHGUI_FileValidator.cxx \
|
||||
SMESHGUI_PreviewDlg.cxx
|
||||
|
||||
MOC_FILES = \
|
||||
SMESHGUI_moc.cxx \
|
||||
@ -227,7 +229,8 @@ MOC_FILES = \
|
||||
SMESHGUI_FindElemByPointDlg_moc.cxx \
|
||||
SMESHGUI_MeshOrderDlg_moc.cxx \
|
||||
SMESHGUI_CopyMeshDlg_moc.cxx \
|
||||
SMESHGUI_MeshOrderOp_moc.cxx
|
||||
SMESHGUI_MeshOrderOp_moc.cxx \
|
||||
SMESHGUI_PreviewDlg_moc.cxx
|
||||
|
||||
nodist_libSMESH_la_SOURCES= \
|
||||
$(MOC_FILES)
|
||||
|
@ -34,6 +34,7 @@
|
||||
#include "SMESHGUI_SpinBox.h"
|
||||
#include "SMESHGUI_IdValidator.h"
|
||||
#include "SMESHGUI_FilterDlg.h"
|
||||
#include "SMESHGUI_MeshEditPreview.h"
|
||||
|
||||
#include <SMESH_Actor.h>
|
||||
#include <SMESH_TypeFilter.hxx>
|
||||
@ -109,8 +110,7 @@ private:
|
||||
// purpose : constructor
|
||||
//=================================================================================
|
||||
SMESHGUI_ExtrusionAlongPathDlg::SMESHGUI_ExtrusionAlongPathDlg( SMESHGUI* theModule )
|
||||
: QDialog( SMESH::GetDesktop( theModule ) ),
|
||||
mySMESHGUI( theModule ),
|
||||
: SMESHGUI_PreviewDlg( theModule ),
|
||||
mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ),
|
||||
myFilterDlg( 0 )
|
||||
{
|
||||
@ -262,6 +262,9 @@ SMESHGUI_ExtrusionAlongPathDlg::SMESHGUI_ExtrusionAlongPathDlg( SMESHGUI* theMod
|
||||
MakeGroupsCheck = new QCheckBox(tr("SMESH_MAKE_GROUPS"), GroupArguments);
|
||||
MakeGroupsCheck->setChecked(true);
|
||||
|
||||
//Preview check box
|
||||
myPreviewCheckBox = new QCheckBox(tr("PREVIEW"), GroupArguments);
|
||||
|
||||
// layouting
|
||||
GroupArgumentsLayout->addWidget(ElementsLab, 0, 0);
|
||||
GroupArgumentsLayout->addWidget(SelectElementsButton, 0, 1);
|
||||
@ -271,7 +274,8 @@ SMESHGUI_ExtrusionAlongPathDlg::SMESHGUI_ExtrusionAlongPathDlg( SMESHGUI* theMod
|
||||
GroupArgumentsLayout->addWidget(PathGrp, 2, 0, 1, 4);
|
||||
GroupArgumentsLayout->addWidget(BasePointGrp, 3, 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
|
||||
@ -362,6 +366,17 @@ SMESHGUI_ExtrusionAlongPathDlg::SMESHGUI_ExtrusionAlongPathDlg( SMESHGUI* theMod
|
||||
|
||||
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);
|
||||
ElementsLineEdit->installEventFilter(this);
|
||||
StartPointLineEdit->installEventFilter(this);
|
||||
@ -410,6 +425,8 @@ void SMESHGUI_ExtrusionAlongPathDlg::Init (bool ResetControls)
|
||||
MeshCheck->setChecked(false);
|
||||
ConstructorsClicked(0);
|
||||
onSelectMesh();
|
||||
myPreviewCheckBox->setChecked(false);
|
||||
onDisplaySimulation(false);
|
||||
}
|
||||
SetEditCurrentArgument(0);
|
||||
}
|
||||
@ -424,6 +441,8 @@ void SMESHGUI_ExtrusionAlongPathDlg::ConstructorsClicked (int type)
|
||||
|
||||
disconnect(mySelectionMgr, 0, this, 0);
|
||||
|
||||
hidePreview();
|
||||
|
||||
if (type == 0)
|
||||
GroupArguments->setTitle(tr("EXTRUSION_1D"));
|
||||
else if (type == 1)
|
||||
@ -480,46 +499,12 @@ bool SMESHGUI_ExtrusionAlongPathDlg::ClickOnApply()
|
||||
if (!isValid())
|
||||
return false;
|
||||
|
||||
SMESH::long_array_var anElementsId = new SMESH::long_array;
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
SMESH::long_array_var anElementsId = getSelectedElements();
|
||||
|
||||
if (StartPointLineEdit->text().trimmed().isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool bOk;
|
||||
long aNodeStart = StartPointLineEdit->text().toLong(&bOk);
|
||||
if (!bOk) {
|
||||
@ -527,19 +512,13 @@ bool SMESHGUI_ExtrusionAlongPathDlg::ClickOnApply()
|
||||
}
|
||||
|
||||
QStringList aParameters;
|
||||
|
||||
//get angles
|
||||
SMESH::double_array_var anAngles = getAngles();
|
||||
|
||||
for (int i = 0; i < myAnglesList.count(); i++)
|
||||
aParameters << AnglesList->item(i)->text();
|
||||
|
||||
// get angles
|
||||
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;
|
||||
aParameters << AnglesList->item(i)->text();
|
||||
}
|
||||
anAngles->length(j);
|
||||
}
|
||||
|
||||
// get base point
|
||||
SMESH::PointStruct aBasePoint;
|
||||
@ -973,6 +952,7 @@ void SMESHGUI_ExtrusionAlongPathDlg::SelectionIntoArgument()
|
||||
YSpin->SetValue(n->Y());
|
||||
ZSpin->SetValue(n->Z());
|
||||
}
|
||||
onDisplaySimulation(true);
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
@ -1286,3 +1266,155 @@ void SMESHGUI_ExtrusionAlongPathDlg::updateLinearAngles()
|
||||
LinearAnglesCheck->setChecked( false );
|
||||
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
|
||||
#include "SMESH_SMESHGUI.hxx"
|
||||
|
||||
// Qt includes
|
||||
#include <QDialog>
|
||||
#include "SMESHGUI_PreviewDlg.h"
|
||||
|
||||
// IDL includes
|
||||
#include <SALOMEconfig.h>
|
||||
@ -60,7 +58,7 @@ class SUIT_SelectionFilter;
|
||||
// class : SMESHGUI_ExtrusionAlongPathDlg
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
class SMESHGUI_EXPORT SMESHGUI_ExtrusionAlongPathDlg : public QDialog
|
||||
class SMESHGUI_EXPORT SMESHGUI_ExtrusionAlongPathDlg : public SMESHGUI_PreviewDlg
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@ -81,10 +79,13 @@ private:
|
||||
void SetEditCurrentArgument( QToolButton* );
|
||||
|
||||
bool isValid();
|
||||
bool isValuesValid();
|
||||
|
||||
SMESH::long_array_var getSelectedElements();
|
||||
SMESH::double_array_var getAngles();
|
||||
|
||||
void updateLinearAngles();
|
||||
|
||||
SMESHGUI* mySMESHGUI; /* Current SMESHGUI object */
|
||||
SMESHGUI_IdValidator* myIdValidator;
|
||||
LightApp_SelectionMgr* mySelectionMgr; /* User shape selection */
|
||||
SVTK_Selector* mySelector;
|
||||
@ -147,6 +148,7 @@ private:
|
||||
|
||||
protected slots:
|
||||
void reject();
|
||||
virtual void onDisplaySimulation( bool );
|
||||
|
||||
private slots:
|
||||
void ConstructorsClicked( int );
|
||||
|
@ -34,6 +34,7 @@
|
||||
#include "SMESHGUI_SpinBox.h"
|
||||
#include "SMESHGUI_IdValidator.h"
|
||||
#include "SMESHGUI_FilterDlg.h"
|
||||
#include "SMESHGUI_MeshEditPreview.h"
|
||||
|
||||
#include <SMESH_Actor.h>
|
||||
#include <SMESH_TypeFilter.hxx>
|
||||
@ -88,8 +89,7 @@
|
||||
// purpose : constructor
|
||||
//=================================================================================
|
||||
SMESHGUI_ExtrusionDlg::SMESHGUI_ExtrusionDlg (SMESHGUI* theModule)
|
||||
: QDialog( SMESH::GetDesktop( theModule ) ),
|
||||
mySMESHGUI( theModule ),
|
||||
: SMESHGUI_PreviewDlg( theModule ),
|
||||
mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ),
|
||||
myFilterDlg( 0 ),
|
||||
mySelectedObject(SMESH::SMESH_IDSource::_nil())
|
||||
@ -215,6 +215,9 @@ SMESHGUI_ExtrusionDlg::SMESHGUI_ExtrusionDlg (SMESHGUI* theModule)
|
||||
// CheckBox for groups generation
|
||||
MakeGroupsCheck = new QCheckBox(tr("SMESH_MAKE_GROUPS"), GroupArguments);
|
||||
|
||||
//Preview check box
|
||||
myPreviewCheckBox = new QCheckBox(tr("PREVIEW"), GroupArguments);
|
||||
|
||||
GroupArgumentsLayout->addWidget(TextLabelElements, 0, 0);
|
||||
GroupArgumentsLayout->addWidget(SelectElementsButton, 0, 1);
|
||||
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(TextLabelNbSteps, 6, 0, 1, 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);
|
||||
|
||||
|
||||
@ -313,6 +317,18 @@ SMESHGUI_ExtrusionDlg::SMESHGUI_ExtrusionDlg (SMESHGUI* theModule)
|
||||
connect(LineEditElements, SIGNAL(textChanged(const QString&)), SLOT(onTextChange(const QString&)));
|
||||
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);
|
||||
@ -359,6 +375,8 @@ void SMESHGUI_ExtrusionDlg::Init (bool ResetControls)
|
||||
|
||||
CheckBoxMesh->setChecked(false);
|
||||
onSelectMesh(false);
|
||||
myPreviewCheckBox->setChecked(false);
|
||||
onDisplaySimulation(false);
|
||||
}
|
||||
|
||||
CheckIsEnable();
|
||||
@ -369,8 +387,19 @@ void SMESHGUI_ExtrusionDlg::Init (bool ResetControls)
|
||||
// purpose : Check whether the Ok and Apply buttons should be enabled or not
|
||||
//=================================================================================
|
||||
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() ) {
|
||||
aX = SpinBox_Dx->GetValue();
|
||||
aY = SpinBox_Dy->GetValue();
|
||||
@ -382,11 +411,7 @@ void SMESHGUI_ExtrusionDlg::CheckIsEnable()
|
||||
aZ = SpinBox_Vz->GetValue();
|
||||
aModule = sqrt(aX*aX + aY*aY + aZ*aZ);
|
||||
}
|
||||
|
||||
bool anIsEnable = myNbOkElements > 0 && aModule > 1.0E-38;
|
||||
|
||||
buttonOk->setEnabled(anIsEnable);
|
||||
buttonApply->setEnabled(anIsEnable);
|
||||
return aModule > 1.0E-38;
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
@ -397,6 +422,8 @@ void SMESHGUI_ExtrusionDlg::ConstructorsClicked (int constructorId)
|
||||
{
|
||||
disconnect(mySelectionMgr, 0, this, 0);
|
||||
|
||||
hidePreview();
|
||||
|
||||
switch (constructorId) {
|
||||
case 0:
|
||||
{
|
||||
@ -478,6 +505,7 @@ void SMESHGUI_ExtrusionDlg::ClickOnRadio()
|
||||
SpinBox_VDist->show();
|
||||
SelectVectorButton->show();
|
||||
}
|
||||
onDisplaySimulation(true);
|
||||
// AdjustSize
|
||||
qApp->processEvents();
|
||||
updateGeometry();
|
||||
@ -499,29 +527,14 @@ bool SMESHGUI_ExtrusionDlg::ClickOnApply()
|
||||
if (myNbOkElements) {
|
||||
|
||||
SMESH::DirStruct aVector;
|
||||
getExtrusionVector(aVector);
|
||||
|
||||
QStringList aParameters;
|
||||
|
||||
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_Dy->text();
|
||||
aParameters << SpinBox_Dz->text();
|
||||
} 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_Vy->text();
|
||||
aParameters << SpinBox_Vz->text();
|
||||
@ -676,6 +689,8 @@ void SMESHGUI_ExtrusionDlg::onTextChange (const QString& theNewText)
|
||||
|
||||
CheckIsEnable();
|
||||
|
||||
onDisplaySimulation(true);
|
||||
|
||||
myBusy = false;
|
||||
}
|
||||
|
||||
@ -786,6 +801,8 @@ void SMESHGUI_ExtrusionDlg::SelectionIntoArgument()
|
||||
|
||||
}
|
||||
|
||||
onDisplaySimulation(true);
|
||||
|
||||
// OK
|
||||
CheckIsEnable();
|
||||
}
|
||||
@ -1036,3 +1053,66 @@ bool SMESHGUI_ExtrusionDlg::isValid()
|
||||
}
|
||||
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
|
||||
#include "SMESH_SMESHGUI.hxx"
|
||||
#include "SMESHGUI_PreviewDlg.h"
|
||||
|
||||
// SALOME GUI includes
|
||||
#include <SALOME_InteractiveObject.hxx>
|
||||
|
||||
// Qt includes
|
||||
#include <QDialog>
|
||||
|
||||
// IDL includes
|
||||
#include <SALOMEconfig.h>
|
||||
#include CORBA_SERVER_HEADER(SMESH_Mesh)
|
||||
@ -62,7 +60,7 @@ class SalomeApp_IntSpinBox;
|
||||
// class : SMESHGUI_ExtrusionDlg
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
class SMESHGUI_EXPORT SMESHGUI_ExtrusionDlg : public QDialog
|
||||
class SMESHGUI_EXPORT SMESHGUI_ExtrusionDlg : public SMESHGUI_PreviewDlg
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@ -78,10 +76,11 @@ private:
|
||||
void closeEvent( QCloseEvent* );
|
||||
void keyPressEvent( QKeyEvent* );
|
||||
int GetConstructorId();
|
||||
|
||||
bool isValid();
|
||||
void getExtrusionVector(SMESH::DirStruct& aVector);
|
||||
|
||||
bool isValid();
|
||||
bool isValuesValid();
|
||||
|
||||
SMESHGUI* mySMESHGUI; /* Current SMESHGUI object */
|
||||
SMESHGUI_IdValidator* myIdValidator;
|
||||
LightApp_SelectionMgr* mySelectionMgr; /* User shape selection */
|
||||
QWidget* myEditCurrentArgument; /* Current argument editor */
|
||||
@ -143,6 +142,9 @@ private:
|
||||
|
||||
QPushButton* myFilterBtn;
|
||||
SMESHGUI_FilterDlg* myFilterDlg;
|
||||
|
||||
protected slots:
|
||||
virtual void onDisplaySimulation( bool );
|
||||
|
||||
private slots:
|
||||
void ConstructorsClicked( int );
|
||||
|
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 :
|
||||
//=================================================================================
|
||||
SMESHGUI_RevolutionDlg::SMESHGUI_RevolutionDlg( SMESHGUI* theModule )
|
||||
: QDialog( SMESH::GetDesktop( theModule ) ),
|
||||
mySMESHGUI( theModule ),
|
||||
: SMESHGUI_PreviewDlg( theModule ),
|
||||
mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ),
|
||||
myVectorDefinition(NONE_SELECT),
|
||||
myFilterDlg( 0 ),
|
||||
@ -232,7 +231,7 @@ SMESHGUI_RevolutionDlg::SMESHGUI_RevolutionDlg( SMESHGUI* theModule )
|
||||
SpinBox_Tolerance = new SMESHGUI_SpinBox(GroupArguments);
|
||||
|
||||
// Control for mesh preview
|
||||
CheckBoxPreview = new QCheckBox(tr("PREVIEW"), GroupArguments);
|
||||
myPreviewCheckBox = new QCheckBox(tr("PREVIEW"), GroupArguments);
|
||||
|
||||
// CheckBox for groups generation
|
||||
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(TextLabelTolerance, 4, 0, 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);
|
||||
|
||||
/***************************************************************/
|
||||
@ -352,7 +351,9 @@ SMESHGUI_RevolutionDlg::SMESHGUI_RevolutionDlg( SMESHGUI* theModule )
|
||||
connect(SpinBox_Angle, SIGNAL(valueChanged(double)), this, SLOT(toDisplaySimulation()));
|
||||
connect(SpinBox_NbSteps, SIGNAL(valueChanged(int)), 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&)));
|
||||
|
||||
@ -405,7 +406,7 @@ void SMESHGUI_RevolutionDlg::Init (bool ResetControls)
|
||||
|
||||
CheckBoxMesh->setChecked(false);
|
||||
onSelectMesh(false);
|
||||
CheckBoxPreview->setChecked(false);
|
||||
myPreviewCheckBox->setChecked(false);
|
||||
onDisplaySimulation(false);
|
||||
}
|
||||
}
|
||||
@ -707,7 +708,7 @@ void SMESHGUI_RevolutionDlg::SelectionIntoArgument()
|
||||
const SALOME_ListIO& aList = mySelector->StoredIObjects();
|
||||
|
||||
int nbSel = aList.Extent();
|
||||
if (nbSel != 1)
|
||||
if (nbSel != 1)
|
||||
return;
|
||||
|
||||
Handle(SALOME_InteractiveObject) IO = aList.First();
|
||||
@ -1033,22 +1034,13 @@ void SMESHGUI_RevolutionDlg::keyPressEvent( QKeyEvent* e )
|
||||
}
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : toDisplaySimulation()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void SMESHGUI_RevolutionDlg::toDisplaySimulation()
|
||||
{
|
||||
onDisplaySimulation(true);
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : onDisplaySimulation()
|
||||
// purpose :
|
||||
// purpose : Show/Hide preview
|
||||
//=================================================================================
|
||||
void SMESHGUI_RevolutionDlg::onDisplaySimulation(bool toDisplayPreview)
|
||||
{
|
||||
if (CheckBoxPreview->isChecked() && toDisplayPreview)
|
||||
if (myPreviewCheckBox->isChecked() && toDisplayPreview)
|
||||
{
|
||||
//display preview
|
||||
if (myNbOkElements && IsAxisOk())
|
||||
|
@ -29,12 +29,12 @@
|
||||
|
||||
// SMESH includes
|
||||
#include "SMESH_SMESHGUI.hxx"
|
||||
#include "SMESHGUI_PreviewDlg.h"
|
||||
|
||||
// SALOME GUI includes
|
||||
#include <SALOME_InteractiveObject.hxx>
|
||||
|
||||
// Qt includes
|
||||
#include <QDialog>
|
||||
#include <QMap>
|
||||
|
||||
// IDL includes
|
||||
@ -66,7 +66,7 @@ class QAction;
|
||||
// class : SMESHGUI_RevolutionDlg
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
class SMESHGUI_EXPORT SMESHGUI_RevolutionDlg : public QDialog
|
||||
class SMESHGUI_EXPORT SMESHGUI_RevolutionDlg : public SMESHGUI_PreviewDlg
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@ -88,7 +88,6 @@ private:
|
||||
|
||||
bool isValid();
|
||||
|
||||
SMESHGUI* mySMESHGUI; /* Current SMESHGUI object */
|
||||
SMESHGUI_IdValidator* myIdValidator;
|
||||
LightApp_SelectionMgr* mySelectionMgr; /* User shape selection */
|
||||
int myNbOkElements; /* to check when elements are defined */
|
||||
@ -126,7 +125,6 @@ private:
|
||||
QButtonGroup* GroupAngle;
|
||||
QRadioButton* RadioButton3;
|
||||
QRadioButton* RadioButton4;
|
||||
QCheckBox* CheckBoxPreview;
|
||||
|
||||
QLabel* TextLabelPoint;
|
||||
QPushButton* SelectPointButton;
|
||||
@ -162,6 +160,9 @@ private:
|
||||
|
||||
QPushButton* myFilterBtn;
|
||||
SMESHGUI_FilterDlg* myFilterDlg;
|
||||
|
||||
protected slots:
|
||||
virtual void onDisplaySimulation( bool );
|
||||
|
||||
private slots:
|
||||
void ConstructorsClicked( int );
|
||||
@ -177,8 +178,6 @@ private slots:
|
||||
void onAngleTextChange( const QString& );
|
||||
void onSelectMesh( bool );
|
||||
void onVectorChanged();
|
||||
void toDisplaySimulation();
|
||||
void onDisplaySimulation( bool );
|
||||
void onSelectVectorMenu( QAction* );
|
||||
void onSelectVectorButton();
|
||||
void setFilters();
|
||||
|
@ -33,6 +33,7 @@
|
||||
#include "SMESHGUI_MeshUtils.h"
|
||||
#include "SMESHGUI_IdValidator.h"
|
||||
#include "SMESHGUI_FilterDlg.h"
|
||||
#include "SMESHGUI_MeshEditPreview.h"
|
||||
|
||||
#include <SMESH_Actor.h>
|
||||
#include <SMESH_TypeFilter.hxx>
|
||||
@ -91,9 +92,8 @@ enum { MOVE_ELEMS_BUTTON = 0, COPY_ELEMS_BUTTON, MAKE_MESH_BUTTON }; //!< action
|
||||
// class : SMESHGUI_RotationDlg()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
SMESHGUI_RotationDlg::SMESHGUI_RotationDlg( SMESHGUI* theModule )
|
||||
: QDialog( SMESH::GetDesktop( theModule ) ),
|
||||
mySMESHGUI( theModule ),
|
||||
SMESHGUI_RotationDlg::SMESHGUI_RotationDlg( SMESHGUI* theModule ) :
|
||||
SMESHGUI_PreviewDlg( theModule ),
|
||||
mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ),
|
||||
myFilterDlg(0),
|
||||
mySelectedObject(SMESH::SMESH_IDSource::_nil())
|
||||
@ -217,6 +217,10 @@ SMESHGUI_RotationDlg::SMESHGUI_RotationDlg( SMESHGUI* theModule )
|
||||
// Name of a mesh to create
|
||||
LineEditNewMesh = new QLineEdit(GroupArguments);
|
||||
|
||||
|
||||
//Preview check box
|
||||
myPreviewCheckBox = new QCheckBox(tr("PREVIEW"), GroupArguments);
|
||||
|
||||
GroupArgumentsLayout->addWidget(TextLabelElements, 0, 0);
|
||||
GroupArgumentsLayout->addWidget(SelectElementsButton, 0, 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(MakeGroupsCheck, 5, 3);
|
||||
GroupArgumentsLayout->addWidget(LineEditNewMesh, 6, 3);
|
||||
GroupArgumentsLayout->addWidget(myPreviewCheckBox, 7, 0);
|
||||
|
||||
|
||||
/***************************************************************/
|
||||
GroupButtons = new QGroupBox(this);
|
||||
@ -312,6 +318,17 @@ SMESHGUI_RotationDlg::SMESHGUI_RotationDlg( SMESHGUI* theModule )
|
||||
connect(CheckBoxMesh, SIGNAL(toggled(bool)), SLOT(onSelectMesh(bool)));
|
||||
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);
|
||||
}
|
||||
|
||||
@ -359,6 +376,9 @@ void SMESHGUI_RotationDlg::Init (bool ResetControls)
|
||||
|
||||
ActionGroup->button( MOVE_ELEMS_BUTTON )->setChecked(true);
|
||||
CheckBoxMesh->setChecked(false);
|
||||
myPreviewCheckBox->setChecked(false);
|
||||
onDisplaySimulation(false);
|
||||
|
||||
// MakeGroupsCheck->setChecked(false);
|
||||
// MakeGroupsCheck->setEnabled(false);
|
||||
// onSelectMesh(false);
|
||||
@ -737,6 +757,7 @@ void SMESHGUI_RotationDlg::SelectionIntoArgument()
|
||||
buttonOk->setEnabled(true);
|
||||
buttonApply->setEnabled(true);
|
||||
}
|
||||
onDisplaySimulation(true);
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
@ -883,6 +904,7 @@ void SMESHGUI_RotationDlg::onSelectMesh (bool toSelectMesh)
|
||||
LineEditElements->setReadOnly(false);
|
||||
LineEditElements->setValidator(myIdValidator);
|
||||
onTextChange(LineEditElements->text());
|
||||
hidePreview();
|
||||
}
|
||||
|
||||
SelectionIntoArgument();
|
||||
@ -1033,3 +1055,51 @@ bool SMESHGUI_RotationDlg::isValid()
|
||||
}
|
||||
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
|
||||
#include "SMESH_SMESHGUI.hxx"
|
||||
#include "SMESHGUI_PreviewDlg.h"
|
||||
|
||||
// Qt includes
|
||||
#include <QDialog>
|
||||
|
||||
// IDL includes
|
||||
#include <SALOMEconfig.h>
|
||||
@ -57,7 +56,7 @@ class SMESH_LogicalFilter;
|
||||
// class : SMESHGUI_RotationDlg
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
class SMESHGUI_EXPORT SMESHGUI_RotationDlg : public QDialog
|
||||
class SMESHGUI_EXPORT SMESHGUI_RotationDlg : public SMESHGUI_PreviewDlg
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@ -76,7 +75,6 @@ private:
|
||||
|
||||
bool isValid();
|
||||
|
||||
SMESHGUI* mySMESHGUI; /* Current SMESHGUI object */
|
||||
SMESHGUI_IdValidator* myIdValidator;
|
||||
LightApp_SelectionMgr* mySelectionMgr; /* User shape selection */
|
||||
int myNbOkElements; /* to check when elements are defined */
|
||||
@ -135,6 +133,9 @@ private:
|
||||
QPushButton* myFilterBtn;
|
||||
SMESHGUI_FilterDlg* myFilterDlg;
|
||||
|
||||
protected slots:
|
||||
virtual void onDisplaySimulation( bool );
|
||||
|
||||
private slots:
|
||||
void ClickOnOk();
|
||||
void ClickOnCancel();
|
||||
|
@ -30,6 +30,7 @@
|
||||
#include "SMESHGUI_MeshUtils.h"
|
||||
#include "SMESHGUI_IdValidator.h"
|
||||
#include "SMESHGUI_FilterDlg.h"
|
||||
#include "SMESHGUI_MeshEditPreview.h"
|
||||
|
||||
#include <SMESH_Actor.h>
|
||||
#include <SMESH_TypeFilter.hxx>
|
||||
@ -106,9 +107,8 @@ private:
|
||||
// class : SMESHGUI_ScaleDlg()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
SMESHGUI_ScaleDlg::SMESHGUI_ScaleDlg( SMESHGUI* theModule )
|
||||
: QDialog( SMESH::GetDesktop( theModule ) ),
|
||||
mySMESHGUI( theModule ),
|
||||
SMESHGUI_ScaleDlg::SMESHGUI_ScaleDlg( SMESHGUI* theModule ) :
|
||||
SMESHGUI_PreviewDlg( theModule ),
|
||||
mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ),
|
||||
myFilterDlg(0),
|
||||
mySelectedObject(SMESH::SMESH_IDSource::_nil())
|
||||
@ -211,6 +211,9 @@ SMESHGUI_ScaleDlg::SMESHGUI_ScaleDlg( SMESHGUI* theModule )
|
||||
// Name of a mesh to create
|
||||
LineEditNewMesh = new QLineEdit(GroupArguments);
|
||||
|
||||
//Preview check box
|
||||
myPreviewCheckBox = new QCheckBox(tr("PREVIEW"), GroupArguments);
|
||||
|
||||
// layout
|
||||
GroupArgumentsLayout->addWidget(TextLabelElements, 0, 0);
|
||||
GroupArgumentsLayout->addWidget(SelectElementsButton, 0, 1);
|
||||
@ -234,6 +237,7 @@ SMESHGUI_ScaleDlg::SMESHGUI_ScaleDlg( SMESHGUI* theModule )
|
||||
GroupArgumentsLayout->addWidget(ActionBox, 7, 0, 3, 4);
|
||||
GroupArgumentsLayout->addWidget(MakeGroupsCheck, 7, 5, 1, 4);
|
||||
GroupArgumentsLayout->addWidget(LineEditNewMesh, 8, 5, 1, 4);
|
||||
GroupArgumentsLayout->addWidget(myPreviewCheckBox, 10, 0);
|
||||
|
||||
/***************************************************************/
|
||||
GroupButtons = new QGroupBox(this);
|
||||
@ -314,6 +318,17 @@ SMESHGUI_ScaleDlg::SMESHGUI_ScaleDlg( SMESHGUI* theModule )
|
||||
connect(CheckBoxMesh, SIGNAL(toggled(bool)), SLOT(onSelectMesh(bool)));
|
||||
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);
|
||||
SelectionIntoArgument();
|
||||
onActionClicked(MOVE_ELEMS_BUTTON);
|
||||
@ -358,6 +373,8 @@ void SMESHGUI_ScaleDlg::Init (bool ResetControls)
|
||||
SpinBox_FX->SetValue(1.0);
|
||||
SpinBox_FY->SetValue(1.0);
|
||||
SpinBox_FZ->SetValue(1.0);
|
||||
myPreviewCheckBox->setChecked(false);
|
||||
onDisplaySimulation(false);
|
||||
|
||||
ActionGroup->button( MOVE_ELEMS_BUTTON )->setChecked(true);
|
||||
CheckBoxMesh->setChecked(false);
|
||||
@ -436,20 +453,8 @@ bool SMESHGUI_ScaleDlg::ClickOnApply()
|
||||
anElementsId[i] = aListElementsId[i].toInt();
|
||||
|
||||
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;
|
||||
aScaleFact->length(3);
|
||||
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();
|
||||
}
|
||||
getScale(aPoint, aScaleFact);
|
||||
|
||||
QStringList aParameters;
|
||||
aParameters << SpinBox1_1->text();
|
||||
@ -785,6 +790,8 @@ void SMESHGUI_ScaleDlg::SelectionIntoArgument()
|
||||
buttonOk->setEnabled(true);
|
||||
buttonApply->setEnabled(true);
|
||||
}
|
||||
|
||||
onDisplaySimulation(true);
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
@ -921,6 +928,7 @@ void SMESHGUI_ScaleDlg::onSelectMesh (bool toSelectMesh)
|
||||
LineEditElements->setReadOnly(false);
|
||||
LineEditElements->setValidator(myIdValidator);
|
||||
onTextChange(LineEditElements->text());
|
||||
hidePreview();
|
||||
}
|
||||
|
||||
SelectionIntoArgument();
|
||||
@ -1054,3 +1062,68 @@ bool SMESHGUI_ScaleDlg::isValid()
|
||||
}
|
||||
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
|
||||
#include "SMESH_SMESHGUI.hxx"
|
||||
|
||||
// Qt includes
|
||||
#include <QDialog>
|
||||
#include "SMESHGUI_PreviewDlg.h"
|
||||
|
||||
// IDL includes
|
||||
#include <SALOMEconfig.h>
|
||||
@ -54,7 +52,7 @@ class SMESH_LogicalFilter;
|
||||
// class : SMESHGUI_ScaleDlg
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
class SMESHGUI_EXPORT SMESHGUI_ScaleDlg : public QDialog
|
||||
class SMESHGUI_EXPORT SMESHGUI_ScaleDlg : public SMESHGUI_PreviewDlg
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@ -72,8 +70,9 @@ private:
|
||||
void setNewMeshName();
|
||||
|
||||
bool isValid();
|
||||
void getScale( SMESH::PointStruct& thePoint,
|
||||
SMESH::double_array_var& theScaleFact);
|
||||
|
||||
SMESHGUI* mySMESHGUI; /* Current SMESHGUI object */
|
||||
SMESHGUI_IdValidator* myIdValidator;
|
||||
LightApp_SelectionMgr* mySelectionMgr; /* User shape selection */
|
||||
QString myElementsId;
|
||||
@ -127,6 +126,10 @@ private:
|
||||
|
||||
QPushButton* myFilterBtn;
|
||||
SMESHGUI_FilterDlg* myFilterDlg;
|
||||
|
||||
|
||||
protected slots:
|
||||
virtual void onDisplaySimulation( bool );
|
||||
|
||||
private slots:
|
||||
void ConstructorsClicked( int );
|
||||
|
@ -33,6 +33,7 @@
|
||||
#include "SMESHGUI_MeshUtils.h"
|
||||
#include "SMESHGUI_IdValidator.h"
|
||||
#include "SMESHGUI_FilterDlg.h"
|
||||
#include "SMESHGUI_MeshEditPreview.h"
|
||||
|
||||
#include <SMESH_Actor.h>
|
||||
#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 )
|
||||
: QDialog( SMESH::GetDesktop( theModule ) ),
|
||||
mySMESHGUI( theModule ),
|
||||
: SMESHGUI_PreviewDlg( theModule ),
|
||||
mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ),
|
||||
myFilterDlg(0),
|
||||
mySelectedObject(SMESH::SMESH_IDSource::_nil())
|
||||
@ -225,6 +225,10 @@ SMESHGUI_SymmetryDlg::SMESHGUI_SymmetryDlg( SMESHGUI* theModule )
|
||||
// Name of a mesh to create
|
||||
LineEditNewMesh = new QLineEdit(GroupArguments);
|
||||
|
||||
|
||||
//Preview check box
|
||||
myPreviewCheckBox = new QCheckBox(tr("PREVIEW"), GroupArguments);
|
||||
|
||||
// layout
|
||||
GroupArgumentsLayout->addWidget(TextLabelElements, 0, 0);
|
||||
GroupArgumentsLayout->addWidget(SelectElementsButton, 0, 1);
|
||||
@ -235,6 +239,7 @@ SMESHGUI_SymmetryDlg::SMESHGUI_SymmetryDlg( SMESHGUI* theModule )
|
||||
GroupArgumentsLayout->addWidget(ActionBox, 3, 0, 3, 3);
|
||||
GroupArgumentsLayout->addWidget(MakeGroupsCheck, 4, 3);
|
||||
GroupArgumentsLayout->addWidget(LineEditNewMesh, 5, 3);
|
||||
GroupArgumentsLayout->addWidget(myPreviewCheckBox, 6, 0);
|
||||
|
||||
/***************************************************************/
|
||||
GroupButtons = new QGroupBox(this);
|
||||
@ -317,6 +322,16 @@ SMESHGUI_SymmetryDlg::SMESHGUI_SymmetryDlg( SMESHGUI* theModule )
|
||||
connect(CheckBoxMesh, SIGNAL(toggled(bool)), SLOT(onSelectMesh(bool)));
|
||||
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);
|
||||
SelectionIntoArgument();
|
||||
onActionClicked(MOVE_ELEMS_BUTTON);
|
||||
@ -363,6 +378,9 @@ void SMESHGUI_SymmetryDlg::Init (bool ResetControls)
|
||||
|
||||
ActionGroup->button( MOVE_ELEMS_BUTTON )->setChecked(true);
|
||||
CheckBoxMesh->setChecked(false);
|
||||
myPreviewCheckBox->setChecked(false);
|
||||
onDisplaySimulation(false);
|
||||
|
||||
// MakeGroupsCheck->setChecked(false);
|
||||
// MakeGroupsCheck->setEnabled(false);
|
||||
onSelectMesh(false);
|
||||
@ -434,6 +452,8 @@ void SMESHGUI_SymmetryDlg::ConstructorsClicked (int constructorId)
|
||||
|
||||
connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
|
||||
|
||||
onDisplaySimulation(true);
|
||||
|
||||
QApplication::instance()->processEvents();
|
||||
updateGeometry();
|
||||
resize(100,100);
|
||||
@ -461,17 +481,8 @@ bool SMESHGUI_SymmetryDlg::ClickOnApply()
|
||||
anElementsId[i] = aListElementsId[i].toInt();
|
||||
|
||||
SMESH::AxisStruct aMirror;
|
||||
|
||||
aMirror.x = SpinBox_X->GetValue();
|
||||
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();
|
||||
}
|
||||
SMESH::SMESH_MeshEditor::MirrorType aMirrorType;
|
||||
getMirror(aMirror,aMirrorType);
|
||||
|
||||
QStringList aParameters;
|
||||
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_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();
|
||||
bool makeGroups = ( MakeGroupsCheck->isEnabled() && MakeGroupsCheck->isChecked() );
|
||||
|
||||
@ -825,6 +827,7 @@ void SMESHGUI_SymmetryDlg::SelectionIntoArgument()
|
||||
buttonOk->setEnabled(true);
|
||||
buttonApply->setEnabled(true);
|
||||
}
|
||||
onDisplaySimulation(true);
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
@ -965,6 +968,7 @@ void SMESHGUI_SymmetryDlg::onSelectMesh (bool toSelectMesh)
|
||||
LineEditElements->setReadOnly(false);
|
||||
LineEditElements->setValidator(myIdValidator);
|
||||
onTextChange(LineEditElements->text());
|
||||
hidePreview();
|
||||
}
|
||||
|
||||
SelectionIntoArgument();
|
||||
@ -1129,3 +1133,67 @@ bool SMESHGUI_SymmetryDlg::isValid()
|
||||
}
|
||||
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
|
||||
#include "SMESH_SMESHGUI.hxx"
|
||||
|
||||
// Qt includes
|
||||
#include <QDialog>
|
||||
#include "SMESHGUI_PreviewDlg.h"
|
||||
|
||||
// IDL includes
|
||||
#include <SALOMEconfig.h>
|
||||
#include CORBA_SERVER_HEADER(SMESH_Mesh)
|
||||
#include CORBA_SERVER_HEADER(SMESH_MeshEditor)
|
||||
|
||||
class QButtonGroup;
|
||||
class QGroupBox;
|
||||
@ -57,7 +56,7 @@ class SMESH_LogicalFilter;
|
||||
// class : SMESHGUI_SymmetryDlg
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
class SMESHGUI_EXPORT SMESHGUI_SymmetryDlg : public QDialog
|
||||
class SMESHGUI_EXPORT SMESHGUI_SymmetryDlg : public SMESHGUI_PreviewDlg
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@ -75,9 +74,10 @@ private:
|
||||
bool IsMirrorOk();
|
||||
void setNewMeshName();
|
||||
|
||||
void getMirror(SMESH::AxisStruct& theMirror, SMESH::SMESH_MeshEditor::MirrorType& aMirrorType);
|
||||
|
||||
bool isValid();
|
||||
|
||||
SMESHGUI* mySMESHGUI; /* Current SMESHGUI object */
|
||||
SMESHGUI_IdValidator* myIdValidator;
|
||||
LightApp_SelectionMgr* mySelectionMgr; /* User shape selection */
|
||||
int myNbOkElements; /* to check when elements are defined */
|
||||
@ -136,6 +136,9 @@ private:
|
||||
|
||||
QPushButton* myFilterBtn;
|
||||
SMESHGUI_FilterDlg* myFilterDlg;
|
||||
|
||||
protected slots:
|
||||
virtual void onDisplaySimulation( bool );
|
||||
|
||||
private slots:
|
||||
void ConstructorsClicked( int );
|
||||
|
@ -33,6 +33,7 @@
|
||||
#include "SMESHGUI_MeshUtils.h"
|
||||
#include "SMESHGUI_IdValidator.h"
|
||||
#include "SMESHGUI_FilterDlg.h"
|
||||
#include "SMESHGUI_MeshEditPreview.h"
|
||||
|
||||
#include <SMESH_Actor.h>
|
||||
#include <SMESH_TypeFilter.hxx>
|
||||
@ -109,12 +110,11 @@ private:
|
||||
// class : SMESHGUI_TranslationDlg()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
SMESHGUI_TranslationDlg::SMESHGUI_TranslationDlg( SMESHGUI* theModule )
|
||||
: QDialog( SMESH::GetDesktop( theModule ) ),
|
||||
mySMESHGUI( theModule ),
|
||||
mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ),
|
||||
myFilterDlg(0),
|
||||
mySelectedObject(SMESH::SMESH_IDSource::_nil())
|
||||
SMESHGUI_TranslationDlg::SMESHGUI_TranslationDlg( SMESHGUI* theModule ) :
|
||||
SMESHGUI_PreviewDlg( theModule ),
|
||||
mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ),
|
||||
myFilterDlg(0),
|
||||
mySelectedObject(SMESH::SMESH_IDSource::_nil())
|
||||
{
|
||||
QPixmap image0 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_SMESH_TRANSLATION_POINTS")));
|
||||
QPixmap image1 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_SMESH_TRANSLATION_VECTOR")));
|
||||
@ -215,6 +215,9 @@ SMESHGUI_TranslationDlg::SMESHGUI_TranslationDlg( SMESHGUI* theModule )
|
||||
// Name of a mesh to create
|
||||
LineEditNewMesh = new QLineEdit(GroupArguments);
|
||||
|
||||
//Preview check box
|
||||
myPreviewCheckBox = new QCheckBox(tr("PREVIEW"), GroupArguments);
|
||||
|
||||
// layout
|
||||
GroupArgumentsLayout->addWidget(TextLabelElements, 0, 0);
|
||||
GroupArgumentsLayout->addWidget(SelectElementsButton, 0, 1);
|
||||
@ -240,6 +243,7 @@ SMESHGUI_TranslationDlg::SMESHGUI_TranslationDlg( SMESHGUI* theModule )
|
||||
GroupArgumentsLayout->addWidget(ActionBox, 4, 0, 3, 4);
|
||||
GroupArgumentsLayout->addWidget(MakeGroupsCheck, 5, 5, 1, 4);
|
||||
GroupArgumentsLayout->addWidget(LineEditNewMesh, 6, 5, 1, 4);
|
||||
GroupArgumentsLayout->addWidget(myPreviewCheckBox, 7, 0);
|
||||
|
||||
/***************************************************************/
|
||||
GroupButtons = new QGroupBox(this);
|
||||
@ -318,6 +322,19 @@ SMESHGUI_TranslationDlg::SMESHGUI_TranslationDlg( SMESHGUI* theModule )
|
||||
connect(CheckBoxMesh, SIGNAL(toggled(bool)), SLOT(onSelectMesh(bool)));
|
||||
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);
|
||||
SelectionIntoArgument();
|
||||
onActionClicked(MOVE_ELEMS_BUTTON);
|
||||
@ -367,6 +384,8 @@ void SMESHGUI_TranslationDlg::Init (bool ResetControls)
|
||||
CheckBoxMesh->setChecked(false);
|
||||
// MakeGroupsCheck->setChecked(false);
|
||||
// MakeGroupsCheck->setEnabled(false);
|
||||
myPreviewCheckBox->setChecked(false);
|
||||
onDisplaySimulation(false);
|
||||
onSelectMesh(false);
|
||||
}
|
||||
}
|
||||
@ -433,6 +452,8 @@ void SMESHGUI_TranslationDlg::ConstructorsClicked (int constructorId)
|
||||
|
||||
connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
|
||||
|
||||
onDisplaySimulation(true);
|
||||
|
||||
QApplication::instance()->processEvents();
|
||||
updateGeometry();
|
||||
resize(100,100);
|
||||
@ -805,6 +826,7 @@ void SMESHGUI_TranslationDlg::SelectionIntoArgument()
|
||||
buttonOk->setEnabled(true);
|
||||
buttonApply->setEnabled(true);
|
||||
}
|
||||
onDisplaySimulation(true);
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
@ -818,7 +840,7 @@ void SMESHGUI_TranslationDlg::SetEditCurrentArgument()
|
||||
disconnect(mySelectionMgr, 0, this, 0);
|
||||
mySelectionMgr->clearSelected();
|
||||
mySelectionMgr->clearFilters();
|
||||
|
||||
|
||||
if (send == SelectElementsButton) {
|
||||
myEditCurrentArgument = (QWidget*)LineEditElements;
|
||||
SMESH::SetPointRepresentation(false);
|
||||
@ -947,6 +969,7 @@ void SMESHGUI_TranslationDlg::onSelectMesh (bool toSelectMesh)
|
||||
LineEditElements->setReadOnly(false);
|
||||
LineEditElements->setValidator(myIdValidator);
|
||||
onTextChange(LineEditElements->text());
|
||||
hidePreview();
|
||||
}
|
||||
|
||||
SelectionIntoArgument();
|
||||
@ -1080,3 +1103,53 @@ bool SMESHGUI_TranslationDlg::isValid()
|
||||
}
|
||||
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
|
||||
#include "SMESH_SMESHGUI.hxx"
|
||||
|
||||
// Qt includes
|
||||
#include <QDialog>
|
||||
#include "SMESHGUI_PreviewDlg.h"
|
||||
|
||||
// IDL includes
|
||||
#include <SALOMEconfig.h>
|
||||
@ -57,7 +55,7 @@ class SMESH_LogicalFilter;
|
||||
// class : SMESHGUI_TranslationDlg
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
class SMESHGUI_EXPORT SMESHGUI_TranslationDlg : public QDialog
|
||||
class SMESHGUI_EXPORT SMESHGUI_TranslationDlg : public SMESHGUI_PreviewDlg
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@ -76,7 +74,6 @@ private:
|
||||
|
||||
bool isValid();
|
||||
|
||||
SMESHGUI* mySMESHGUI; /* Current SMESHGUI object */
|
||||
SMESHGUI_IdValidator* myIdValidator;
|
||||
LightApp_SelectionMgr* mySelectionMgr; /* User shape selection */
|
||||
QString myElementsId;
|
||||
@ -133,6 +130,9 @@ private:
|
||||
|
||||
QPushButton* myFilterBtn;
|
||||
SMESHGUI_FilterDlg* myFilterDlg;
|
||||
|
||||
protected slots:
|
||||
virtual void onDisplaySimulation( bool );
|
||||
|
||||
private slots:
|
||||
void ConstructorsClicked( int );
|
||||
|
@ -1808,16 +1808,30 @@ SMESH_MeshEditor_i::extrusionSweep(const SMESH::long_array & theIDsOfElements,
|
||||
#ifdef NO_CAS_CATCH
|
||||
OCC_CATCH_SIGNALS;
|
||||
#endif
|
||||
TIDSortedElemSet elements;
|
||||
TIDSortedElemSet elements, copyElements;
|
||||
arrayToSet(theIDsOfElements, GetMeshDS(), elements, theElementType);
|
||||
|
||||
const SMESH::PointStruct * P = &theStepVector.PS;
|
||||
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;
|
||||
::SMESH_MeshEditor anEditor( myMesh );
|
||||
::SMESH_MeshEditor anEditor( mesh );
|
||||
::SMESH_MeshEditor::PGroupIDs groupIds =
|
||||
anEditor.ExtrusionSweep (elements, stepVec, theNbOfSteps, aHystory, theMakeGroups);
|
||||
anEditor.ExtrusionSweep (*workElements, stepVec, theNbOfSteps, aHystory, theMakeGroups);
|
||||
|
||||
myMesh->GetMeshDS()->Modified();
|
||||
storeResult(anEditor);
|
||||
@ -2214,10 +2228,26 @@ SMESH_MeshEditor_i::extrusionAlongPathX(const SMESH::long_array & IDsOfElements
|
||||
return EmptyGr;
|
||||
}
|
||||
|
||||
TIDSortedElemSet elements;
|
||||
TIDSortedElemSet elements, copyElements;
|
||||
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_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;
|
||||
return EmptyGr;
|
||||
}
|
||||
error = anEditor.ExtrusionAlongTrack( elements, &(aMeshImp->GetImpl()), aNodeStart,
|
||||
error = anEditor.ExtrusionAlongTrack( *workElements, &(aMeshImp->GetImpl()), aNodeStart,
|
||||
HasAngles, angles, LinearVariation,
|
||||
HasRefPoint, refPnt, MakeGroups );
|
||||
myMesh->GetMeshDS()->Modified();
|
||||
@ -2248,7 +2278,7 @@ SMESH_MeshEditor_i::extrusionAlongPathX(const SMESH::long_array & IDsOfElements
|
||||
}
|
||||
SMESH_subMesh* aSubMesh =
|
||||
aMeshImp->GetImpl().GetSubMeshContaining(aSubMeshImp->GetId());
|
||||
error = anEditor.ExtrusionAlongTrack( elements, aSubMesh, aNodeStart,
|
||||
error = anEditor.ExtrusionAlongTrack( *workElements, aSubMesh, aNodeStart,
|
||||
HasAngles, angles, LinearVariation,
|
||||
HasRefPoint, refPnt, MakeGroups );
|
||||
myMesh->GetMeshDS()->Modified();
|
||||
@ -2881,11 +2911,28 @@ SMESH_MeshEditor_i::mirror(TIDSortedElemSet & theElements,
|
||||
aTrsf.SetMirror( gp_Ax2( P, V ));
|
||||
}
|
||||
|
||||
::SMESH_MeshEditor anEditor( myMesh );
|
||||
::SMESH_MeshEditor::PGroupIDs groupIds =
|
||||
anEditor.Transform (theElements, aTrsf, theCopy, theMakeGroups, theTargetMesh);
|
||||
TIDSortedElemSet copyElements;
|
||||
TPreviewMesh tmpMesh;
|
||||
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);
|
||||
else
|
||||
{
|
||||
@ -2940,7 +2987,10 @@ void SMESH_MeshEditor_i::MirrorObject(SMESH::SMESH_IDSource_ptr theObj
|
||||
<< theCopy << " )";
|
||||
}
|
||||
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);
|
||||
}
|
||||
|
||||
@ -3112,11 +3162,28 @@ SMESH_MeshEditor_i::translate(TIDSortedElemSet & theElements,
|
||||
const SMESH::PointStruct * P = &theVector.PS;
|
||||
aTrsf.SetTranslation( gp_Vec( P->x, P->y, P->z ));
|
||||
|
||||
::SMESH_MeshEditor anEditor( myMesh );
|
||||
::SMESH_MeshEditor::PGroupIDs groupIds =
|
||||
anEditor.Transform (theElements, aTrsf, theCopy, theMakeGroups, theTargetMesh);
|
||||
TIDSortedElemSet copyElements;
|
||||
TPreviewMesh tmpMesh;
|
||||
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);
|
||||
else
|
||||
{
|
||||
@ -3165,7 +3232,10 @@ void SMESH_MeshEditor_i::TranslateObject(SMESH::SMESH_IDSource_ptr theObject,
|
||||
<< theCopy << " )";
|
||||
}
|
||||
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);
|
||||
}
|
||||
|
||||
@ -3330,11 +3400,27 @@ SMESH_MeshEditor_i::rotate(TIDSortedElemSet & theElements,
|
||||
gp_Trsf aTrsf;
|
||||
aTrsf.SetRotation( gp_Ax1( P, V ), theAngle);
|
||||
|
||||
::SMESH_MeshEditor anEditor( myMesh );
|
||||
::SMESH_MeshEditor::PGroupIDs groupIds =
|
||||
anEditor.Transform (theElements, aTrsf, theCopy, theMakeGroups, theTargetMesh);
|
||||
TIDSortedElemSet copyElements;
|
||||
TPreviewMesh tmpMesh;
|
||||
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);
|
||||
else
|
||||
{
|
||||
@ -3388,7 +3474,8 @@ void SMESH_MeshEditor_i::RotateObject(SMESH::SMESH_IDSource_ptr theObject,
|
||||
<< theCopy << " )";
|
||||
}
|
||||
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);
|
||||
}
|
||||
|
||||
@ -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);
|
||||
|
||||
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;
|
||||
|
||||
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, 0, S[2], thePoint.z * (1-S[2]), tol, tol);
|
||||
|
||||
::SMESH_MeshEditor anEditor( myMesh );
|
||||
::SMESH_MeshEditor::PGroupIDs groupIds =
|
||||
anEditor.Transform (elements, aTrsf, theCopy, theMakeGroups, theTargetMesh);
|
||||
TIDSortedElemSet copyElements;
|
||||
TPreviewMesh tmpMesh;
|
||||
TIDSortedElemSet* workElements = 0;
|
||||
SMESH_Mesh* mesh = 0;
|
||||
|
||||
if ( myPreviewMode )
|
||||
{
|
||||
tmpMesh.Copy( elements, copyElements);
|
||||
mesh = &tmpMesh;
|
||||
workElements = & copyElements;
|
||||
}
|
||||
else
|
||||
{
|
||||
mesh = myMesh;
|
||||
workElements = & elements;
|
||||
}
|
||||
|
||||
if(theCopy)
|
||||
::SMESH_MeshEditor anEditor( mesh );
|
||||
::SMESH_MeshEditor::PGroupIDs groupIds =
|
||||
anEditor.Transform (*workElements, aTrsf, theCopy, theMakeGroups, theTargetMesh);
|
||||
|
||||
if(theCopy || myPreviewMode )
|
||||
storeResult(anEditor);
|
||||
else
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user