SMESHGUI_MeshOrderOp.h \
SMESHGUI_FileValidator.h \
SMESHGUI_CopyMeshDlg.h \
+ SMESHGUI_PreviewDlg.h \
SMESH_SMESHGUI.hxx
# Libraries targets
SMESHGUI_MeshOrderDlg.cxx \
SMESHGUI_MeshOrderOp.cxx \
SMESHGUI_CopyMeshDlg.cxx \
- SMESHGUI_FileValidator.cxx
+ SMESHGUI_FileValidator.cxx \
+ SMESHGUI_PreviewDlg.cxx
MOC_FILES = \
SMESHGUI_moc.cxx \
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)
#include "SMESHGUI_SpinBox.h"
#include "SMESHGUI_IdValidator.h"
#include "SMESHGUI_FilterDlg.h"
+#include "SMESHGUI_MeshEditPreview.h"
#include <SMESH_Actor.h>
#include <SMESH_TypeFilter.hxx>
// purpose : constructor
//=================================================================================
SMESHGUI_ExtrusionAlongPathDlg::SMESHGUI_ExtrusionAlongPathDlg( SMESHGUI* theModule )
- : QDialog( SMESH::GetDesktop( theModule ) ),
- mySMESHGUI( theModule ),
+ : SMESHGUI_PreviewDlg( theModule ),
mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ),
myFilterDlg( 0 )
{
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);
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
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);
MeshCheck->setChecked(false);
ConstructorsClicked(0);
onSelectMesh();
+ myPreviewCheckBox->setChecked(false);
+ onDisplaySimulation(false);
}
SetEditCurrentArgument(0);
}
disconnect(mySelectionMgr, 0, this, 0);
+ hidePreview();
+
if (type == 0)
GroupArguments->setTitle(tr("EXTRUSION_1D"));
else if (type == 1)
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) {
}
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;
YSpin->SetValue(n->Y());
ZSpin->SetValue(n->Z());
}
+ onDisplaySimulation(true);
}
//=================================================================================
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;
+}
// SMESH includes
#include "SMESH_SMESHGUI.hxx"
-
-// Qt includes
-#include <QDialog>
+#include "SMESHGUI_PreviewDlg.h"
// IDL includes
#include <SALOMEconfig.h>
// class : SMESHGUI_ExtrusionAlongPathDlg
// purpose :
//=================================================================================
-class SMESHGUI_EXPORT SMESHGUI_ExtrusionAlongPathDlg : public QDialog
+class SMESHGUI_EXPORT SMESHGUI_ExtrusionAlongPathDlg : public SMESHGUI_PreviewDlg
{
Q_OBJECT
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;
protected slots:
void reject();
+ virtual void onDisplaySimulation( bool );
private slots:
void ConstructorsClicked( int );
#include "SMESHGUI_SpinBox.h"
#include "SMESHGUI_IdValidator.h"
#include "SMESHGUI_FilterDlg.h"
+#include "SMESHGUI_MeshEditPreview.h"
#include <SMESH_Actor.h>
#include <SMESH_TypeFilter.hxx>
// 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())
// 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);
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);
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);
CheckBoxMesh->setChecked(false);
onSelectMesh(false);
+ myPreviewCheckBox->setChecked(false);
+ onDisplaySimulation(false);
}
CheckIsEnable();
// 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();
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;
}
//=================================================================================
{
disconnect(mySelectionMgr, 0, this, 0);
+ hidePreview();
+
switch (constructorId) {
case 0:
{
SpinBox_VDist->show();
SelectVectorButton->show();
}
+ onDisplaySimulation(true);
// AdjustSize
qApp->processEvents();
updateGeometry();
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();
CheckIsEnable();
+ onDisplaySimulation(true);
+
myBusy = false;
}
}
+ onDisplaySimulation(true);
+
// OK
CheckIsEnable();
}
}
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;
+ }
+}
// 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)
// class : SMESHGUI_ExtrusionDlg
// purpose :
//=================================================================================
-class SMESHGUI_EXPORT SMESHGUI_ExtrusionDlg : public QDialog
+class SMESHGUI_EXPORT SMESHGUI_ExtrusionDlg : public SMESHGUI_PreviewDlg
{
Q_OBJECT
void closeEvent( QCloseEvent* );
void keyPressEvent( QKeyEvent* );
int GetConstructorId();
-
+ 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 */
QPushButton* myFilterBtn;
SMESHGUI_FilterDlg* myFilterDlg;
+
+protected slots:
+ virtual void onDisplaySimulation( bool );
private slots:
void ConstructorsClicked( int );
--- /dev/null
+// 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
+}
--- /dev/null
+// 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
// 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 ),
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);
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);
/***************************************************************/
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&)));
CheckBoxMesh->setChecked(false);
onSelectMesh(false);
- CheckBoxPreview->setChecked(false);
+ myPreviewCheckBox->setChecked(false);
onDisplaySimulation(false);
}
}
const SALOME_ListIO& aList = mySelector->StoredIObjects();
int nbSel = aList.Extent();
- if (nbSel != 1)
+ if (nbSel != 1)
return;
Handle(SALOME_InteractiveObject) IO = aList.First();
}
}
-//=================================================================================
-// 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())
// 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
// class : SMESHGUI_RevolutionDlg
// purpose :
//=================================================================================
-class SMESHGUI_EXPORT SMESHGUI_RevolutionDlg : public QDialog
+class SMESHGUI_EXPORT SMESHGUI_RevolutionDlg : public SMESHGUI_PreviewDlg
{
Q_OBJECT
bool isValid();
- SMESHGUI* mySMESHGUI; /* Current SMESHGUI object */
SMESHGUI_IdValidator* myIdValidator;
LightApp_SelectionMgr* mySelectionMgr; /* User shape selection */
int myNbOkElements; /* to check when elements are defined */
QButtonGroup* GroupAngle;
QRadioButton* RadioButton3;
QRadioButton* RadioButton4;
- QCheckBox* CheckBoxPreview;
QLabel* TextLabelPoint;
QPushButton* SelectPointButton;
QPushButton* myFilterBtn;
SMESHGUI_FilterDlg* myFilterDlg;
+
+protected slots:
+ virtual void onDisplaySimulation( bool );
private slots:
void ConstructorsClicked( int );
void onAngleTextChange( const QString& );
void onSelectMesh( bool );
void onVectorChanged();
- void toDisplaySimulation();
- void onDisplaySimulation( bool );
void onSelectVectorMenu( QAction* );
void onSelectVectorButton();
void setFilters();
#include "SMESHGUI_MeshUtils.h"
#include "SMESHGUI_IdValidator.h"
#include "SMESHGUI_FilterDlg.h"
+#include "SMESHGUI_MeshEditPreview.h"
#include <SMESH_Actor.h>
#include <SMESH_TypeFilter.hxx>
// 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())
// 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);
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);
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);
}
ActionGroup->button( MOVE_ELEMS_BUTTON )->setChecked(true);
CheckBoxMesh->setChecked(false);
+ myPreviewCheckBox->setChecked(false);
+ onDisplaySimulation(false);
+
// MakeGroupsCheck->setChecked(false);
// MakeGroupsCheck->setEnabled(false);
// onSelectMesh(false);
buttonOk->setEnabled(true);
buttonApply->setEnabled(true);
}
+ onDisplaySimulation(true);
}
//=================================================================================
LineEditElements->setReadOnly(false);
LineEditElements->setValidator(myIdValidator);
onTextChange(LineEditElements->text());
+ hidePreview();
}
SelectionIntoArgument();
}
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();
+ }
+}
// SMESH includes
#include "SMESH_SMESHGUI.hxx"
+#include "SMESHGUI_PreviewDlg.h"
-// Qt includes
-#include <QDialog>
// IDL includes
#include <SALOMEconfig.h>
// class : SMESHGUI_RotationDlg
// purpose :
//=================================================================================
-class SMESHGUI_EXPORT SMESHGUI_RotationDlg : public QDialog
+class SMESHGUI_EXPORT SMESHGUI_RotationDlg : public SMESHGUI_PreviewDlg
{
Q_OBJECT
bool isValid();
- SMESHGUI* mySMESHGUI; /* Current SMESHGUI object */
SMESHGUI_IdValidator* myIdValidator;
LightApp_SelectionMgr* mySelectionMgr; /* User shape selection */
int myNbOkElements; /* to check when elements are defined */
QPushButton* myFilterBtn;
SMESHGUI_FilterDlg* myFilterDlg;
+protected slots:
+ virtual void onDisplaySimulation( bool );
+
private slots:
void ClickOnOk();
void ClickOnCancel();
#include "SMESHGUI_MeshUtils.h"
#include "SMESHGUI_IdValidator.h"
#include "SMESHGUI_FilterDlg.h"
+#include "SMESHGUI_MeshEditPreview.h"
#include <SMESH_Actor.h>
#include <SMESH_TypeFilter.hxx>
// 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())
// 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);
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);
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);
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);
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();
buttonOk->setEnabled(true);
buttonApply->setEnabled(true);
}
+
+ onDisplaySimulation(true);
}
//=================================================================================
LineEditElements->setReadOnly(false);
LineEditElements->setValidator(myIdValidator);
onTextChange(LineEditElements->text());
+ hidePreview();
}
SelectionIntoArgument();
}
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();
+ }
+}
// SMESH includes
#include "SMESH_SMESHGUI.hxx"
-
-// Qt includes
-#include <QDialog>
+#include "SMESHGUI_PreviewDlg.h"
// IDL includes
#include <SALOMEconfig.h>
// class : SMESHGUI_ScaleDlg
// purpose :
//=================================================================================
-class SMESHGUI_EXPORT SMESHGUI_ScaleDlg : public QDialog
+class SMESHGUI_EXPORT SMESHGUI_ScaleDlg : public SMESHGUI_PreviewDlg
{
Q_OBJECT
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;
QPushButton* myFilterBtn;
SMESHGUI_FilterDlg* myFilterDlg;
+
+
+protected slots:
+ virtual void onDisplaySimulation( bool );
private slots:
void ConstructorsClicked( int );
#include "SMESHGUI_MeshUtils.h"
#include "SMESHGUI_IdValidator.h"
#include "SMESHGUI_FilterDlg.h"
+#include "SMESHGUI_MeshEditPreview.h"
#include <SMESH_Actor.h>
#include <SMESH_TypeFilter.hxx>
//=================================================================================
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())
// 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);
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);
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);
ActionGroup->button( MOVE_ELEMS_BUTTON )->setChecked(true);
CheckBoxMesh->setChecked(false);
+ myPreviewCheckBox->setChecked(false);
+ onDisplaySimulation(false);
+
// MakeGroupsCheck->setChecked(false);
// MakeGroupsCheck->setEnabled(false);
onSelectMesh(false);
connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
+ onDisplaySimulation(true);
+
QApplication::instance()->processEvents();
updateGeometry();
resize(100,100);
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();
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() );
buttonOk->setEnabled(true);
buttonApply->setEnabled(true);
}
+ onDisplaySimulation(true);
}
//=================================================================================
LineEditElements->setReadOnly(false);
LineEditElements->setValidator(myIdValidator);
onTextChange(LineEditElements->text());
+ hidePreview();
}
SelectionIntoArgument();
}
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;
+}
// 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;
// class : SMESHGUI_SymmetryDlg
// purpose :
//=================================================================================
-class SMESHGUI_EXPORT SMESHGUI_SymmetryDlg : public QDialog
+class SMESHGUI_EXPORT SMESHGUI_SymmetryDlg : public SMESHGUI_PreviewDlg
{
Q_OBJECT
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 */
QPushButton* myFilterBtn;
SMESHGUI_FilterDlg* myFilterDlg;
+
+protected slots:
+ virtual void onDisplaySimulation( bool );
private slots:
void ConstructorsClicked( int );
#include "SMESHGUI_MeshUtils.h"
#include "SMESHGUI_IdValidator.h"
#include "SMESHGUI_FilterDlg.h"
+#include "SMESHGUI_MeshEditPreview.h"
#include <SMESH_Actor.h>
#include <SMESH_TypeFilter.hxx>
// 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")));
// 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);
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);
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);
CheckBoxMesh->setChecked(false);
// MakeGroupsCheck->setChecked(false);
// MakeGroupsCheck->setEnabled(false);
+ myPreviewCheckBox->setChecked(false);
+ onDisplaySimulation(false);
onSelectMesh(false);
}
}
connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
+ onDisplaySimulation(true);
+
QApplication::instance()->processEvents();
updateGeometry();
resize(100,100);
buttonOk->setEnabled(true);
buttonApply->setEnabled(true);
}
+ onDisplaySimulation(true);
}
//=================================================================================
disconnect(mySelectionMgr, 0, this, 0);
mySelectionMgr->clearSelected();
mySelectionMgr->clearFilters();
-
+
if (send == SelectElementsButton) {
myEditCurrentArgument = (QWidget*)LineEditElements;
SMESH::SetPointRepresentation(false);
LineEditElements->setReadOnly(false);
LineEditElements->setValidator(myIdValidator);
onTextChange(LineEditElements->text());
+ hidePreview();
}
SelectionIntoArgument();
}
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();
+ }
+}
// SMESH includes
#include "SMESH_SMESHGUI.hxx"
-
-// Qt includes
-#include <QDialog>
+#include "SMESHGUI_PreviewDlg.h"
// IDL includes
#include <SALOMEconfig.h>
// class : SMESHGUI_TranslationDlg
// purpose :
//=================================================================================
-class SMESHGUI_EXPORT SMESHGUI_TranslationDlg : public QDialog
+class SMESHGUI_EXPORT SMESHGUI_TranslationDlg : public SMESHGUI_PreviewDlg
{
Q_OBJECT
bool isValid();
- SMESHGUI* mySMESHGUI; /* Current SMESHGUI object */
SMESHGUI_IdValidator* myIdValidator;
LightApp_SelectionMgr* mySelectionMgr; /* User shape selection */
QString myElementsId;
QPushButton* myFilterBtn;
SMESHGUI_FilterDlg* myFilterDlg;
+
+protected slots:
+ virtual void onDisplaySimulation( bool );
private slots:
void ConstructorsClicked( int );
#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);
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 );
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();
}
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();
aTrsf.SetMirror( gp_Ax2( P, V ));
}
- ::SMESH_MeshEditor anEditor( myMesh );
+ TIDSortedElemSet copyElements;
+ TPreviewMesh tmpMesh;
+ TIDSortedElemSet* workElements = 0;
+ SMESH_Mesh* mesh = 0;
+
+ 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 (theElements, aTrsf, theCopy, theMakeGroups, theTargetMesh);
+ anEditor.Transform (*workElements, aTrsf, theCopy, theMakeGroups, theTargetMesh);
- if(theCopy)
+ if(theCopy || myPreviewMode)
storeResult(anEditor);
else
{
<< 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);
}
const SMESH::PointStruct * P = &theVector.PS;
aTrsf.SetTranslation( gp_Vec( P->x, P->y, P->z ));
- ::SMESH_MeshEditor anEditor( myMesh );
+ TIDSortedElemSet copyElements;
+ TPreviewMesh tmpMesh;
+ TIDSortedElemSet* workElements = 0;
+ SMESH_Mesh* mesh = 0;
+
+ 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 (theElements, aTrsf, theCopy, theMakeGroups, theTargetMesh);
+ anEditor.Transform (*workElements, aTrsf, theCopy, theMakeGroups, theTargetMesh);
- if(theCopy)
+ if(theCopy || myPreviewMode)
storeResult(anEditor);
else
{
<< 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);
}
gp_Trsf aTrsf;
aTrsf.SetRotation( gp_Ax1( P, V ), theAngle);
- ::SMESH_MeshEditor anEditor( myMesh );
+ TIDSortedElemSet copyElements;
+ TPreviewMesh tmpMesh;
+ TIDSortedElemSet* workElements = 0;
+ SMESH_Mesh* mesh = 0;
+
+ 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 (theElements, aTrsf, theCopy, theMakeGroups, theTargetMesh);
+ anEditor.Transform (*workElements, aTrsf, theCopy, theMakeGroups, theTargetMesh);
- if(theCopy)
+ if(theCopy || myPreviewMode)
storeResult(anEditor);
else
{
<< 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);
}
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);
0, S[1], 0, thePoint.y * (1-S[1]),
0, 0, S[2], thePoint.z * (1-S[2]), tol, tol);
- ::SMESH_MeshEditor anEditor( myMesh );
+ 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;
+ }
+
+ ::SMESH_MeshEditor anEditor( mesh );
::SMESH_MeshEditor::PGroupIDs groupIds =
- anEditor.Transform (elements, aTrsf, theCopy, theMakeGroups, theTargetMesh);
+ anEditor.Transform (*workElements, aTrsf, theCopy, theMakeGroups, theTargetMesh);
- if(theCopy)
+ if(theCopy || myPreviewMode )
storeResult(anEditor);
else
{