smesh/src/SMESHGUI/SMESHGUI_MultiEditDlg.cxx

1164 lines
37 KiB
C++
Raw Normal View History

2004-12-01 15:48:31 +05:00
// SMESH SMESHGUI : GUI for SMESH component
//
// Copyright (C) 2003 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
2004-12-01 15:48:31 +05:00
//
//
//
// File : SMESHGUI_MultiEditDlg.cxx
// Author : Sergey LITONIN
// Module : SMESH
#include "SMESHGUI_MultiEditDlg.h"
#include "SMESHGUI_FilterDlg.h"
#include "SMESHGUI_Filter.h"
#include "SMESHGUI.h"
#include "SMESHGUI_Utils.h"
#include "SMESHGUI_VTKUtils.h"
#include "SMESHGUI_MeshUtils.h"
#include "SMESH_Actor.h"
#include "SMESH_TypeFilter.hxx"
2004-12-01 15:48:31 +05:00
#include "SMDS_Mesh.hxx"
#include "SMDS_MeshElement.hxx"
#include "SUIT_ResourceMgr.h"
#include "SUIT_Desktop.h"
#include "SalomeApp_SelectionMgr.h"
#include "SALOME_ListIO.hxx"
2004-12-01 15:48:31 +05:00
#include "SALOME_ListIteratorOfListIO.hxx"
#include "SVTK_Selector.h"
#include "SVTK_ViewModel.h"
#include "SVTK_ViewWindow.h"
#include "SVTK_InteractorStyle.h"
// OCCT Includes
#include <Precision.hxx>
#include <TColStd_IndexedMapOfInteger.hxx>
#include <TColStd_DataMapOfIntegerInteger.hxx>
#include <TColStd_MapIteratorOfMapOfInteger.hxx>
// VTK Includes
#include <vtkCell3D.h>
#include <vtkQuad.h>
#include <vtkTriangle.h>
#include <vtkPolygon.h>
#include <vtkConvexPointSet.h>
2004-12-01 15:48:31 +05:00
#include <vtkIdList.h>
#include <vtkIntArray.h>
#include <vtkCellArray.h>
#include <vtkUnsignedCharArray.h>
#include <vtkUnstructuredGrid.h>
#include <vtkDataSetMapper.h>
// QT Includes
2004-12-01 15:48:31 +05:00
#include <qcheckbox.h>
#include <qframe.h>
#include <qgroupbox.h>
#include <qlabel.h>
#include <qlayout.h>
#include <qlineedit.h>
#include <qlistbox.h>
#include <qpushbutton.h>
#include <qapplication.h>
#include <qhbuttongroup.h>
#include <qradiobutton.h>
2004-12-01 15:48:31 +05:00
2005-01-20 11:25:54 +05:00
// IDL Headers
#include "SALOMEconfig.h"
#include CORBA_SERVER_HEADER(SMESH_Group)
2004-12-01 15:48:31 +05:00
#define SPACING 5
#define MARGIN 10
/*!
* Class : SMESHGUI_MultiEditDlg
* Description : Description : Inversion of the diagonal of a pseudo-quadrangle formed by
* 2 neighboring triangles with 1 common edge
*/
2004-12-01 15:48:31 +05:00
//=======================================================================
// name : SMESHGUI_MultiEditDlg::SMESHGUI_MultiEditDlg
// Purpose : Constructor
//=======================================================================
SMESHGUI_MultiEditDlg
::SMESHGUI_MultiEditDlg(SMESHGUI* theModule,
const int theMode,
const bool the3d2d,
const char* theName):
QDialog(SMESH::GetDesktop(theModule),
theName,
false,
WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | WDestructiveClose),
mySelector(SMESH::GetViewWindow(theModule)->GetSelector()),
mySelectionMgr(SMESH::GetSelectionMgr(theModule)),
mySMESHGUI(theModule)
2004-12-01 15:48:31 +05:00
{
myFilterDlg = 0;
myEntityType = 0;
2004-12-01 15:48:31 +05:00
myFilterType = theMode;
QVBoxLayout* aDlgLay = new QVBoxLayout(this, MARGIN, SPACING);
2004-12-01 15:48:31 +05:00
QFrame* aMainFrame = createMainFrame (this, the3d2d);
QFrame* aBtnFrame = createButtonFrame(this);
2004-12-01 15:48:31 +05:00
aDlgLay->addWidget(aMainFrame);
aDlgLay->addWidget(aBtnFrame);
2004-12-01 15:48:31 +05:00
aDlgLay->setStretchFactor(aMainFrame, 1);
aDlgLay->setStretchFactor(aBtnFrame, 0);
Init();
2004-12-01 15:48:31 +05:00
}
//=======================================================================
// name : SMESHGUI_MultiEditDlg::createMainFrame
// Purpose : Create frame containing dialog's input fields
//=======================================================================
QFrame* SMESHGUI_MultiEditDlg::createMainFrame (QWidget* theParent, const bool the3d2d)
2004-12-01 15:48:31 +05:00
{
QGroupBox* aMainGrp = new QGroupBox(1, Qt::Horizontal, theParent);
aMainGrp->setFrameStyle(QFrame::NoFrame);
aMainGrp->setInsideMargin(0);
2005-06-08 16:45:19 +06:00
QPixmap aPix (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_SELECT")));
2004-12-01 15:48:31 +05:00
// "Selected cells" group
mySelGrp = new QGroupBox(1, Qt::Horizontal, aMainGrp);
myEntityTypeGrp = 0;
if (the3d2d) {
myEntityTypeGrp = new QHButtonGroup(tr("SMESH_ELEMENTS_TYPE"), mySelGrp);
(new QRadioButton(tr("SMESH_FACE"), myEntityTypeGrp))->setChecked(true);
(new QRadioButton(tr("SMESH_VOLUME"), myEntityTypeGrp));
myEntityType = myEntityTypeGrp->id(myEntityTypeGrp->selected());
}
QFrame* aFrame = new QFrame(mySelGrp);
myListBox = new QListBox(aFrame);
myListBox->setSelectionMode(QListBox::Extended);
myListBox->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding));
// myListBox->setColumnMode(QListBox::FitToHeight);
myListBox->installEventFilter(this);
myFilterBtn = new QPushButton(tr("FILTER") , aFrame);
myAddBtn = new QPushButton(tr("ADD") , aFrame);
myRemoveBtn = new QPushButton(tr("REMOVE") , aFrame);
mySortBtn = new QPushButton(tr("SORT_LIST"), aFrame);
QGridLayout* aLay = new QGridLayout(aFrame, 5, 2, 0, 5);
aLay->addMultiCellWidget(myListBox, 0, 4, 0, 0);
aLay->addWidget(myFilterBtn, 0, 1);
aLay->addWidget(myAddBtn, 1, 1);
aLay->addWidget(myRemoveBtn, 2, 1);
aLay->addWidget(mySortBtn, 3, 1);
QSpacerItem* aSpacer = new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding);
aLay->addItem(aSpacer, 4, 1);
myToAllChk = new QCheckBox(tr("TO_ALL"), mySelGrp);
2004-12-01 15:48:31 +05:00
// "Select from" group
QGroupBox* aGrp = new QGroupBox(3, Qt::Horizontal, tr("SELECT_FROM"), aMainGrp);
mySubmeshChk = new QCheckBox(tr("SMESH_SUBMESH"), aGrp);
mySubmeshBtn = new QPushButton(aGrp);
mySubmesh = new QLineEdit(aGrp);
mySubmesh->setReadOnly(true);
mySubmeshBtn->setPixmap(aPix);
myGroupChk = new QCheckBox(tr("GROUP"), aGrp);
myGroupBtn = new QPushButton(aGrp);
myGroup = new QLineEdit(aGrp);
myGroup->setReadOnly(true);
myGroupBtn->setPixmap(aPix);
2004-12-01 15:48:31 +05:00
return aMainGrp;
}
//=======================================================================
// name : SMESHGUI_MultiEditDlg::createButtonFrame
// Purpose : Create frame containing buttons
//=======================================================================
QFrame* SMESHGUI_MultiEditDlg::createButtonFrame (QWidget* theParent)
2004-12-01 15:48:31 +05:00
{
QFrame* aFrame = new QFrame (theParent);
aFrame->setFrameStyle(QFrame::Box | QFrame::Sunken);
2004-12-01 15:48:31 +05:00
myOkBtn = new QPushButton (tr("SMESH_BUT_OK" ), aFrame);
myApplyBtn = new QPushButton (tr("SMESH_BUT_APPLY"), aFrame);
myCloseBtn = new QPushButton (tr("SMESH_BUT_CLOSE"), aFrame);
2004-12-01 15:48:31 +05:00
QSpacerItem* aSpacer = new QSpacerItem (0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum);
2004-12-01 15:48:31 +05:00
QHBoxLayout* aLay = new QHBoxLayout (aFrame, MARGIN, SPACING);
2004-12-01 15:48:31 +05:00
aLay->addWidget(myOkBtn);
aLay->addWidget(myApplyBtn);
aLay->addItem(aSpacer);
aLay->addWidget(myCloseBtn);
2004-12-01 15:48:31 +05:00
return aFrame;
}
//=======================================================================
// name : SMESHGUI_MultiEditDlg::isValid
// Purpose : Verify validity of input data
//=======================================================================
bool SMESHGUI_MultiEditDlg::isValid (const bool /*theMess*/) const
2004-12-01 15:48:31 +05:00
{
return (!myMesh->_is_nil() &&
2005-02-03 17:31:13 +05:00
(myListBox->count() > 0 || (myToAllChk->isChecked() && myActor)));
2004-12-01 15:48:31 +05:00
}
//=======================================================================
// name : SMESHGUI_MultiEditDlg::~SMESHGUI_MultiEditDlg
// Purpose : Destructor
//=======================================================================
SMESHGUI_MultiEditDlg::~SMESHGUI_MultiEditDlg()
{
if (myFilterDlg != 0)
2004-12-01 15:48:31 +05:00
{
myFilterDlg->reparent(0, QPoint());
2004-12-01 15:48:31 +05:00
delete myFilterDlg;
}
}
2005-02-01 19:55:30 +05:00
//=======================================================================
// name : SMESHGUI_MultiEditDlg::eventFilter
// Purpose : event filter
//=======================================================================
bool SMESHGUI_MultiEditDlg::eventFilter (QObject* object, QEvent* event)
2005-02-01 19:55:30 +05:00
{
if (object == myListBox && event->type() == QEvent::KeyPress) {
2005-02-01 19:55:30 +05:00
QKeyEvent* ke = (QKeyEvent*)event;
if (ke->key() == Key_Delete)
2005-02-01 19:55:30 +05:00
onRemoveBtn();
}
return QDialog::eventFilter(object, event);
2005-02-01 19:55:30 +05:00
}
2004-12-01 15:48:31 +05:00
//=======================================================================
// name : SMESHGUI_MultiEditDlg::Init
// Purpose : Init dialog fields, connect signals and slots, show dialog
//=======================================================================
void SMESHGUI_MultiEditDlg::Init()
2004-12-01 15:48:31 +05:00
{
mySMESHGUI->SetActiveDialogBox((QDialog*)this);
2004-12-01 15:48:31 +05:00
myListBox->clear();
myIds.Clear();
myBusy = false;
myActor = 0;
emit ListContensChanged();
// main buttons
connect(myOkBtn, SIGNAL(clicked()), SLOT(onOk()));
connect(myCloseBtn, SIGNAL(clicked()), SLOT(onClose()));
connect(myApplyBtn, SIGNAL(clicked()), SLOT(onApply()));
2004-12-01 15:48:31 +05:00
// selection and SMESHGUI
connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), SLOT(onSelectionDone()));
connect(mySMESHGUI, SIGNAL(SignalDeactivateActiveDialog()), SLOT(onDeactivate()));
connect(mySMESHGUI, SIGNAL(SignalCloseAllDialogs()), SLOT(onClose()));
2004-12-01 15:48:31 +05:00
// dialog controls
connect(myFilterBtn, SIGNAL(clicked()), SLOT(onFilterBtn() ));
connect(myAddBtn , SIGNAL(clicked()), SLOT(onAddBtn() ));
connect(myRemoveBtn, SIGNAL(clicked()), SLOT(onRemoveBtn() ));
connect(mySortBtn , SIGNAL(clicked()), SLOT(onSortListBtn()));
2004-12-01 15:48:31 +05:00
connect(mySubmeshChk, SIGNAL(stateChanged(int)), SLOT(onSubmeshChk()));
connect(myGroupChk , SIGNAL(stateChanged(int)), SLOT(onGroupChk() ));
connect(myToAllChk , SIGNAL(stateChanged(int)), SLOT(onToAllChk() ));
if (myEntityTypeGrp)
connect(myEntityTypeGrp, SIGNAL(clicked(int)), SLOT(on3d2dChanged(int)));
connect(myListBox, SIGNAL(selectionChanged()), SLOT(onListSelectionChanged()));
2004-12-01 15:48:31 +05:00
2005-02-03 17:31:13 +05:00
onSelectionDone();
2004-12-01 15:48:31 +05:00
// set selection mode
setSelectionMode();
updateButtons();
}
//=======================================================================
// name : SMESHGUI_MultiEditDlg::onOk
// Purpose : SLOT called when "Ok" button pressed.
2004-12-01 15:48:31 +05:00
// Assign filters VTK viewer and close dialog
//=======================================================================
void SMESHGUI_MultiEditDlg::onOk()
{
if (onApply())
2004-12-01 15:48:31 +05:00
onClose();
}
//=======================================================================
// name : SMESHGUI_MultiEditDlg::getIds
// Purpose : Retrive identifiers from list box
//=======================================================================
SMESH::long_array_var SMESHGUI_MultiEditDlg::getIds()
{
SMESH::long_array_var anIds = new SMESH::long_array;
if (myToAllChk->isChecked())
2004-12-01 15:48:31 +05:00
{
myIds.Clear();
SMESH_Actor * anActor = SMESH::FindActorByObject(myMesh);
if (!anActor)
2005-02-03 17:31:13 +05:00
anActor = myActor;
if (anActor != 0)
2004-12-01 15:48:31 +05:00
{
2005-02-03 17:31:13 +05:00
TVisualObjPtr aVisualObj = anActor->GetObject();
2004-12-01 15:48:31 +05:00
vtkUnstructuredGrid* aGrid = aVisualObj->GetUnstructuredGrid();
if (aGrid != 0) {
for (int i = 0, n = aGrid->GetNumberOfCells(); i < n; i++) {
vtkCell* aCell = aGrid->GetCell(i);
if (aCell != 0) {
vtkTriangle* aTri = vtkTriangle::SafeDownCast(aCell);
vtkQuad* aQua = vtkQuad::SafeDownCast(aCell);
vtkPolygon* aPG = vtkPolygon::SafeDownCast(aCell);
vtkCell3D* a3d = vtkCell3D::SafeDownCast(aCell);
vtkConvexPointSet* aPH = vtkConvexPointSet::SafeDownCast(aCell);
if (aTri && myFilterType == SMESHGUI_TriaFilter ||
aQua && myFilterType == SMESHGUI_QuadFilter ||
(aTri || aQua || aPG) && myFilterType == SMESHGUI_FaceFilter ||
(a3d || aPH) && myFilterType == SMESHGUI_VolumeFilter) {
int anObjId = aVisualObj->GetElemObjId(i);
myIds.Add(anObjId);
2004-12-01 15:48:31 +05:00
}
}
}
}
}
}
anIds->length(myIds.Extent());
TColStd_MapIteratorOfMapOfInteger anIter(myIds);
for (int i = 0; anIter.More(); anIter.Next() )
2004-12-01 15:48:31 +05:00
{
anIds[ i++ ] = anIter.Key();
}
return anIds._retn();
}
//=======================================================================
// name : SMESHGUI_MultiEditDlg::onClose
// Purpose : SLOT called when "Close" button pressed. Close dialog
//=======================================================================
void SMESHGUI_MultiEditDlg::onClose()
{
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
aViewWindow->SetSelectionMode(ActorSelection);
disconnect(mySelectionMgr, 0, this, 0);
disconnect(mySMESHGUI, 0, this, 0);
mySMESHGUI->ResetState();
2005-02-03 17:31:13 +05:00
SMESH::RemoveFilters();
2004-12-01 15:48:31 +05:00
SMESH::SetPickable();
mySelectionMgr->clearSelected();
mySelectionMgr->clearFilters();
2004-12-01 15:48:31 +05:00
reject();
}
//=======================================================================
// name : SMESHGUI_MultiEditDlg::onSelectionDone
// Purpose : SLOT called when selection changed
//=======================================================================
void SMESHGUI_MultiEditDlg::onSelectionDone()
{
if (myBusy || !isEnabled()) return;
2004-12-01 15:48:31 +05:00
myBusy = true;
const SALOME_ListIO& aList = mySelector->StoredIObjects();
int nbSel = aList.Extent();
2004-12-01 15:48:31 +05:00
myListBox->clearSelection();
if (mySubmeshChk->isChecked() || myGroupChk->isChecked()) {
2004-12-01 15:48:31 +05:00
QLineEdit* aNameEdit = mySubmeshChk->isChecked() ? mySubmesh : myGroup;
if (nbSel == 1) {
Handle(SALOME_InteractiveObject) anIO = aList.First();
anIO.IsNull() ? aNameEdit->clear() : aNameEdit->setText(anIO->getName());
2004-12-01 15:48:31 +05:00
if (mySubmeshChk->isChecked()) {
2004-12-01 15:48:31 +05:00
SMESH::SMESH_subMesh_var aSubMesh =
SMESH::IObjectToInterface<SMESH::SMESH_subMesh>(anIO);
if (!aSubMesh->_is_nil())
2004-12-01 15:48:31 +05:00
myMesh = aSubMesh->GetFather();
} else {
2004-12-01 15:48:31 +05:00
SMESH::SMESH_GroupBase_var aGroup =
SMESH::IObjectToInterface<SMESH::SMESH_GroupBase>(anIO);
if (!aGroup->_is_nil())
2004-12-01 15:48:31 +05:00
myMesh = aGroup->GetMesh();
}
} else if (nbSel > 1) {
QString aStr = mySubmeshChk->isChecked() ?
tr("SMESH_SUBMESH_SELECTED") : tr("SMESH_GROUP_SELECTED");
aNameEdit->setText(aStr.arg(nbSel));
} else {
2004-12-01 15:48:31 +05:00
aNameEdit->clear();
}
} else if (nbSel == 1) {
2004-12-01 15:48:31 +05:00
QString aListStr = "";
Handle(SALOME_InteractiveObject) anIO = aList.First();
int aNbItems = SMESH::GetNameOfSelectedElements(mySelector,anIO,aListStr);
if (aNbItems > 0) {
2004-12-01 15:48:31 +05:00
QStringList anElements = QStringList::split(" ", aListStr);
QListBoxItem* anItem = 0;
for (QStringList::iterator it = anElements.begin(); it != anElements.end(); ++it) {
anItem = myListBox->findItem(*it, Qt::ExactMatch);
if (anItem) myListBox->setSelected(anItem, true);
2004-12-01 15:48:31 +05:00
}
}
myMesh = SMESH::GetMeshByIO(anIO);
2004-12-01 15:48:31 +05:00
}
if (nbSel == 1) {
myActor = SMESH::FindActorByEntry(aList.First()->getEntry());
2005-02-03 17:31:13 +05:00
if (!myActor)
myActor = SMESH::FindActorByObject(myMesh);
SVTK_InteractorStyle* aStyle = SMESH::GetInteractorStyle();
Handle(VTKViewer_Filter) aFilter = aStyle->GetFilter(myFilterType);
if (!aFilter.IsNull())
aFilter->SetActor(myActor);
2004-12-01 15:48:31 +05:00
}
myBusy = false;
updateButtons();
}
//=======================================================================
// name : SMESHGUI_MultiEditDlg::onDeactivate
// Purpose : SLOT called when dialog must be deativated
//=======================================================================
void SMESHGUI_MultiEditDlg::onDeactivate()
{
setEnabled(false);
2004-12-01 15:48:31 +05:00
}
//=======================================================================
// name : SMESHGUI_MultiEditDlg::enterEvent
// Purpose : Event filter
//=======================================================================
void SMESHGUI_MultiEditDlg::enterEvent (QEvent*)
2004-12-01 15:48:31 +05:00
{
if (!isEnabled()) {
mySMESHGUI->EmitSignalDeactivateDialog();
setEnabled(true);
2004-12-01 15:48:31 +05:00
setSelectionMode();
}
}
//=======================================================================
// name : SMESHGUI_MultiEditDlg::closeEvent
// Purpose :
//=======================================================================
void SMESHGUI_MultiEditDlg::closeEvent (QCloseEvent*)
2004-12-01 15:48:31 +05:00
{
onClose();
2004-12-01 15:48:31 +05:00
}
//=======================================================================
// name : SMESHGUI_MultiEditDlg::hideEvent
// Purpose : caused by ESC key
2004-12-01 15:48:31 +05:00
//=======================================================================
void SMESHGUI_MultiEditDlg::hideEvent (QHideEvent*)
2004-12-01 15:48:31 +05:00
{
if (!isMinimized())
2004-12-01 15:48:31 +05:00
onClose();
}
//=======================================================================
// name : SMESHGUI_MultiEditDlg::onFilterBtn
// Purpose : SLOT. Called when "Filter" button pressed.
// Start "Selection filters" dialog
//=======================================================================
void SMESHGUI_MultiEditDlg::onFilterBtn()
{
if (myFilterDlg == 0) {
myFilterDlg = new SMESHGUI_FilterDlg( mySMESHGUI, entityType() ? SMESH::VOLUME : SMESH::FACE);
connect(myFilterDlg, SIGNAL(Accepted()), SLOT(onFilterAccepted()));
} else {
myFilterDlg->Init(entityType() ? SMESH::VOLUME : SMESH::FACE);
2004-12-01 15:48:31 +05:00
}
myFilterDlg->SetSelection();
myFilterDlg->SetMesh(myMesh);
myFilterDlg->SetSourceWg(myListBox);
2004-12-01 15:48:31 +05:00
myFilterDlg->show();
}
//=======================================================================
// name : onFilterAccepted()
// Purpose : SLOT. Called when Filter dlg closed with OK button.
2004-12-01 15:48:31 +05:00
// Uncheck "Select submesh" and "Select group" checkboxes
//=======================================================================
2004-12-01 15:48:31 +05:00
void SMESHGUI_MultiEditDlg::onFilterAccepted()
{
myIds.Clear();
for (int i = 0, n = myListBox->count(); i < n; i++)
myIds.Add(myListBox->text(i).toInt());
2004-12-01 15:48:31 +05:00
emit ListContensChanged();
if (mySubmeshChk->isChecked() || myGroupChk->isChecked()) {
mySubmeshChk->blockSignals(true);
myGroupChk->blockSignals(true);
mySubmeshChk->setChecked(false);
myGroupChk->setChecked(false);
mySubmeshChk->blockSignals(false);
myGroupChk->blockSignals(false);
2004-12-01 15:48:31 +05:00
}
updateButtons();
}
//=======================================================================
// name : SMESHGUI_MultiEditDlg::isIdValid
2004-12-01 15:48:31 +05:00
// Purpose : Verify whether Id of element satisfies to filters from viewer
//=======================================================================
bool SMESHGUI_MultiEditDlg::isIdValid (const int theId) const
2004-12-01 15:48:31 +05:00
{
SVTK_InteractorStyle* aStyle = SMESH::GetInteractorStyle();
Handle(SMESHGUI_Filter) aFilter =
Handle(SMESHGUI_Filter)::DownCast(aStyle->GetFilter(myFilterType));
2005-02-03 17:31:13 +05:00
return (!aFilter.IsNull() && aFilter->IsObjValid(theId));
2004-12-01 15:48:31 +05:00
}
//=======================================================================
// name : SMESHGUI_MultiEditDlg::onAddBtn
// Purpose : SLOT. Called when "Add" button pressed.
// Add selected in viewer entities in list box
//=======================================================================
void SMESHGUI_MultiEditDlg::onAddBtn()
{
const SALOME_ListIO& aList = mySelector->StoredIObjects();
int nbSelected = aList.Extent();
if (nbSelected == 0)
2004-12-01 15:48:31 +05:00
return;
TColStd_IndexedMapOfInteger toBeAdded;
if (!mySubmeshChk->isChecked() && !myGroupChk->isChecked()) {
if (nbSelected == 1)
mySelector->GetIndex(aList.First(),toBeAdded);
} else if (mySubmeshChk->isChecked()) {
SALOME_ListIteratorOfListIO anIter(aList);
for (; anIter.More(); anIter.Next()) {
SMESH::SMESH_subMesh_var aSubMesh =
SMESH::IObjectToInterface<SMESH::SMESH_subMesh>(anIter.Value());
if (!aSubMesh->_is_nil()) {
if (aSubMesh->GetFather()->GetId() == myMesh->GetId()) {
2004-12-01 15:48:31 +05:00
SMESH::long_array_var anIds = aSubMesh->GetElementsId();
for (int i = 0, n = anIds->length(); i < n; i++) {
if (isIdValid(anIds[ i ]))
toBeAdded.Add(anIds[ i ]);
2004-12-01 15:48:31 +05:00
}
}
}
}
} else if (myGroupChk->isChecked()) {
SALOME_ListIteratorOfListIO anIter(aList);
for (; anIter.More(); anIter.Next()) {
2004-12-01 15:48:31 +05:00
SMESH::SMESH_GroupBase_var aGroup =
SMESH::IObjectToInterface<SMESH::SMESH_GroupBase>(anIter.Value());
if (!aGroup->_is_nil() && (aGroup->GetType() == SMESH::FACE &&
entityType() == 0 || aGroup->GetType() == SMESH::VOLUME &&
entityType() == 1)) {
if (aGroup->GetMesh()->GetId() == myMesh->GetId()) {
2004-12-01 15:48:31 +05:00
SMESH::long_array_var anIds = aGroup->GetListOfID();
for (int i = 0, n = anIds->length(); i < n; i++) {
if (isIdValid(anIds[ i ]))
toBeAdded.Add(anIds[ i ]);
2004-12-01 15:48:31 +05:00
}
}
}
}
} else {
2004-12-01 15:48:31 +05:00
}
myBusy = true;
bool isGroupOrSubmesh = (mySubmeshChk->isChecked() || myGroupChk->isChecked());
mySubmeshChk->setChecked(false);
myGroupChk->setChecked(false);
for(int i = 1; i <= toBeAdded.Extent(); i++)
if (myIds.Add(toBeAdded(i))) {
QListBoxItem * item = new QListBoxText(QString("%1").arg(toBeAdded(i)));
myListBox->insertItem(item);
myListBox->setSelected(item, true);
2004-12-01 15:48:31 +05:00
}
myBusy = false;
emit ListContensChanged();
2004-12-01 15:48:31 +05:00
if (isGroupOrSubmesh)
2004-12-01 15:48:31 +05:00
onListSelectionChanged();
updateButtons();
}
//=======================================================================
// name : SMESHGUI_MultiEditDlg::updateButtons
// Purpose : Enable/disable buttons of dialog in accordance with current state
//=======================================================================
void SMESHGUI_MultiEditDlg::updateButtons()
{
bool isOk = isValid(false);
myOkBtn->setEnabled(isOk);
myApplyBtn->setEnabled(isOk);
2004-12-01 15:48:31 +05:00
bool isListBoxNonEmpty = myListBox->count() > 0;
bool isToAll = myToAllChk->isChecked();
myFilterBtn->setEnabled(!isToAll);
myRemoveBtn->setEnabled(isListBoxNonEmpty && !isToAll);
mySortBtn->setEnabled(isListBoxNonEmpty &&!isToAll);
const SALOME_ListIO& aList = mySelector->StoredIObjects();
if (isToAll ||
myMesh->_is_nil() ||
aList.Extent() != 1 ||
(SMESH::IObjectToInterface<SMESH::SMESH_subMesh>(aList.First())->_is_nil() &&
SMESH::IObjectToInterface<SMESH::SMESH_GroupBase>(aList.First())->_is_nil() &&
SMESH::IObjectToInterface<SMESH::SMESH_Mesh>(aList.First())->_is_nil()))
myAddBtn->setEnabled(false);
2004-12-01 15:48:31 +05:00
else
myAddBtn->setEnabled(true);
mySubmeshChk->setEnabled(!isToAll);
mySubmeshBtn->setEnabled(mySubmeshChk->isChecked());
mySubmesh->setEnabled(mySubmeshChk->isChecked());
myGroupChk->setEnabled(!isToAll);
myGroupBtn->setEnabled(myGroupChk->isChecked());
myGroup->setEnabled(myGroupChk->isChecked());
if (!mySubmeshChk->isChecked())
2004-12-01 15:48:31 +05:00
mySubmesh->clear();
if (!myGroupChk->isChecked())
2004-12-01 15:48:31 +05:00
myGroup->clear();
2004-12-01 15:48:31 +05:00
}
//=======================================================================
// name : SMESHGUI_MultiEditDlg::onRemoveBtn
// Purpose : SLOT. Called when "Remove" button pressed.
// Remove selected in list box entities
//=======================================================================
void SMESHGUI_MultiEditDlg::onRemoveBtn()
{
myBusy = true;
for (int i = 0, n = myListBox->count(); i < n; i++)
2004-12-01 15:48:31 +05:00
{
for (int i = myListBox->count(); i > 0; i--) {
if (myListBox->isSelected(i - 1))
2004-12-01 15:48:31 +05:00
{
int anId = myListBox->text(i - 1).toInt();
myIds.Remove(anId);
myIds.Remove(anId);
myListBox->removeItem(i-1);
2004-12-01 15:48:31 +05:00
}
}
2004-12-01 15:48:31 +05:00
}
myBusy = false;
emit ListContensChanged();
2004-12-01 15:48:31 +05:00
updateButtons();
}
//=======================================================================
// name : SMESHGUI_MultiEditDlg::onSortListBtn
// Purpose : SLOT. Called when "Sort list" button pressed.
// Sort entities of list box
//=======================================================================
void SMESHGUI_MultiEditDlg::onSortListBtn()
{
myBusy = true;
int i, k = myListBox->count();
if (k > 0)
2004-12-01 15:48:31 +05:00
{
QStringList aSelected;
std::vector<int> anArray(k);
2004-12-01 15:48:31 +05:00
QListBoxItem* anItem;
for (anItem = myListBox->firstItem(), i = 0; anItem != 0; anItem = anItem->next(), i++)
2004-12-01 15:48:31 +05:00
{
anArray[ i ] = anItem->text().toInt();
if (anItem->isSelected())
aSelected.append(anItem->text());
2004-12-01 15:48:31 +05:00
}
std::sort(anArray.begin(), anArray.end());
2004-12-01 15:48:31 +05:00
myListBox->clear();
for (i = 0; i < k; i++)
myListBox->insertItem(QString::number(anArray[ i ]));
2004-12-01 15:48:31 +05:00
for (QStringList::iterator it = aSelected.begin(); it != aSelected.end(); ++it)
2004-12-01 15:48:31 +05:00
{
anItem = myListBox->findItem(*it, Qt::ExactMatch);
if (anItem)
myListBox->setSelected(anItem, true);
2004-12-01 15:48:31 +05:00
}
}
myBusy = false;
}
//=======================================================================
// name : SMESHGUI_MultiEditDlg::onListSelectionChanged
// Purpose : SLOT. Called when selection in list box changed.
// Highlight in selected entities
//=======================================================================
void SMESHGUI_MultiEditDlg::onListSelectionChanged()
{
if (myActor == 0 || myBusy)
2004-12-01 15:48:31 +05:00
return;
if (mySubmeshChk->isChecked() || myGroupChk->isChecked())
2004-12-01 15:48:31 +05:00
return;
SMESH_Actor * anActor = SMESH::FindActorByObject(myMesh);
if (!anActor)
2004-12-01 15:48:31 +05:00
anActor = myActor;
TVisualObjPtr anObj = anActor->GetObject();
TColStd_MapOfInteger anIndexes;
for (QListBoxItem* anItem = myListBox->firstItem(); anItem != 0; anItem = anItem->next())
2004-12-01 15:48:31 +05:00
{
if (anItem->isSelected())
2004-12-01 15:48:31 +05:00
{
int anId = anItem->text().toInt();
if (anObj->GetElemVTKId(anId) >= 0) // avoid exception in hilight
2004-12-01 15:48:31 +05:00
anIndexes.Add(anId);
}
}
mySelector->AddOrRemoveIndex(anActor->getIO(),anIndexes,false);
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
aViewWindow->highlight(anActor->getIO(),true,true);
2004-12-01 15:48:31 +05:00
}
//=======================================================================
// name : SMESHGUI_MultiEditDlg::onSubmeshChk
// Purpose : SLOT. Called when state of "SubMesh" check box changed.
// Activate/deactivate selection of submeshes
//=======================================================================
void SMESHGUI_MultiEditDlg::onSubmeshChk()
{
bool isChecked = mySubmeshChk->isChecked();
mySubmeshBtn->setEnabled(isChecked);
mySubmesh->setEnabled(isChecked);
if (!isChecked)
2004-12-01 15:48:31 +05:00
mySubmesh->clear();
if (isChecked && myGroupChk->isChecked())
myGroupChk->setChecked(false);
setSelectionMode();
2004-12-01 15:48:31 +05:00
}
//=======================================================================
// name : SMESHGUI_MultiEditDlg::onGroupChk
// Purpose : SLOT. Called when state of "Group" check box changed.
// Activate/deactivate selection of groupes
//=======================================================================
void SMESHGUI_MultiEditDlg::onGroupChk()
{
bool isChecked = myGroupChk->isChecked();
myGroupBtn->setEnabled(isChecked);
myGroup->setEnabled(isChecked);
if (!isChecked)
2004-12-01 15:48:31 +05:00
myGroup->clear();
if (isChecked && mySubmeshChk->isChecked())
mySubmeshChk->setChecked(false);
2004-12-01 15:48:31 +05:00
setSelectionMode();
}
//=======================================================================
// name : SMESHGUI_MultiEditDlg::onToAllChk
// Purpose : SLOT. Called when state of "Apply to all" check box changed.
// Activate/deactivate selection
2004-12-01 15:48:31 +05:00
//=======================================================================
void SMESHGUI_MultiEditDlg::onToAllChk()
{
bool isChecked = myToAllChk->isChecked();
if (isChecked)
2004-12-01 15:48:31 +05:00
myListBox->clear();
myIds.Clear();
emit ListContensChanged();
2005-02-03 17:31:13 +05:00
updateButtons();
2004-12-01 15:48:31 +05:00
setSelectionMode();
}
//=======================================================================
// name : SMESHGUI_MultiEditDlg::setSelectionMode
// Purpose : Set selection mode
//=======================================================================
void SMESHGUI_MultiEditDlg::setSelectionMode()
{
2005-02-03 17:31:13 +05:00
SMESH::RemoveFilters();
mySelectionMgr->clearSelected();
mySelectionMgr->clearFilters();
if (mySubmeshChk->isChecked()) {
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
aViewWindow->SetSelectionMode(ActorSelection);
mySelectionMgr->installFilter(new SMESH_TypeFilter(SUBMESH));
2004-12-01 15:48:31 +05:00
}
else if (myGroupChk->isChecked()) {
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
aViewWindow->SetSelectionMode(ActorSelection);
mySelectionMgr->installFilter(new SMESH_TypeFilter(GROUP));
}
if (entityType()) {
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
aViewWindow->SetSelectionMode(VolumeSelection);
SMESH::SetFilter(new SMESHGUI_VolumesFilter());
} else {
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
aViewWindow->SetSelectionMode(FaceSelection);
if (myFilterType == SMESHGUI_TriaFilter)
SMESH::SetFilter(new SMESHGUI_TriangleFilter());
else if (myFilterType == SMESHGUI_QuadFilter)
SMESH::SetFilter(new SMESHGUI_QuadrangleFilter());
else
SMESH::SetFilter(new SMESHGUI_FacesFilter());
2004-12-01 15:48:31 +05:00
}
}
//=======================================================================
// name : SMESHGUI_MultiEditDlg::onApply
// Purpose : SLOT. Called when "Apply" button clicked.
2004-12-01 15:48:31 +05:00
//=======================================================================
bool SMESHGUI_MultiEditDlg::onApply()
{
if (mySMESHGUI->isActiveStudyLocked())
2004-12-01 15:48:31 +05:00
return false;
if (!isValid(true))
2004-12-01 15:48:31 +05:00
return false;
SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
if (aMeshEditor->_is_nil())
2004-12-01 15:48:31 +05:00
return false;
myBusy = true;
2004-12-01 15:48:31 +05:00
SMESH::long_array_var anIds = getIds();
bool aResult = process(aMeshEditor, anIds.inout());
if (aResult) {
if (myActor) {
2004-12-01 15:48:31 +05:00
SMESH::UpdateView();
}
myListBox->clear();
myIds.Clear();
emit ListContensChanged();
updateButtons();
}
myBusy = false;
2004-12-01 15:48:31 +05:00
return aResult;
}
//=======================================================================
// name : SMESHGUI_MultiEditDlg::on3d2dChanged
// Purpose :
//=======================================================================
void SMESHGUI_MultiEditDlg::on3d2dChanged (int type)
{
if (myEntityType != type) {
myEntityType = type;
myListBox->clear();
myIds.Clear();
emit ListContensChanged();
if (type)
myFilterType = SMESHGUI_VolumeFilter;
else
myFilterType = SMESHGUI_FaceFilter;
2005-02-01 19:55:30 +05:00
updateButtons();
2005-02-03 17:31:13 +05:00
setSelectionMode();
}
}
//=======================================================================
// name : SMESHGUI_MultiEditDlg::entityType
// Purpose :
//=======================================================================
int SMESHGUI_MultiEditDlg::entityType()
{
return myEntityType;
}
2004-12-01 15:48:31 +05:00
/*
* Class : SMESHGUI_ChangeOrientationDlg
* Description : Modification of orientation of faces
*/
SMESHGUI_ChangeOrientationDlg
::SMESHGUI_ChangeOrientationDlg(SMESHGUI* theModule,
const char* theName):
SMESHGUI_MultiEditDlg(theModule, SMESHGUI_FaceFilter, true, theName)
2004-12-01 15:48:31 +05:00
{
setCaption(tr("CAPTION"));
2004-12-01 15:48:31 +05:00
}
SMESHGUI_ChangeOrientationDlg::~SMESHGUI_ChangeOrientationDlg()
{
}
bool SMESHGUI_ChangeOrientationDlg::process (SMESH::SMESH_MeshEditor_ptr theEditor,
const SMESH::long_array& theIds)
2004-12-01 15:48:31 +05:00
{
return theEditor->Reorient(theIds);
2004-12-01 15:48:31 +05:00
}
/*!
* Class : SMESHGUI_UnionOfTrianglesDlg
* Description : Construction of quadrangles by automatic association of triangles
*/
SMESHGUI_UnionOfTrianglesDlg
::SMESHGUI_UnionOfTrianglesDlg(SMESHGUI* theModule,
const char* theName):
SMESHGUI_MultiEditDlg(theModule, SMESHGUI_TriaFilter, false, theName)
2004-12-01 15:48:31 +05:00
{
setCaption(tr("CAPTION"));
2004-12-01 15:48:31 +05:00
}
SMESHGUI_UnionOfTrianglesDlg::~SMESHGUI_UnionOfTrianglesDlg()
{
}
bool SMESHGUI_UnionOfTrianglesDlg::process (SMESH::SMESH_MeshEditor_ptr theEditor,
const SMESH::long_array& theIds)
2004-12-01 15:48:31 +05:00
{
return theEditor->TriToQuad(theIds, SMESH::NumericalFunctor::_nil(), 1.);
2004-12-01 15:48:31 +05:00
}
/*!
* Class : SMESHGUI_CuttingOfQuadsDlg
* Description : Construction of quadrangles by automatic association of triangles
*/
2004-12-01 15:48:31 +05:00
SMESHGUI_CuttingOfQuadsDlg
::SMESHGUI_CuttingOfQuadsDlg(SMESHGUI* theModule,
const char* theName):
SMESHGUI_MultiEditDlg(theModule, SMESHGUI_QuadFilter, false, theName)
{
setCaption(tr("CAPTION"));
2004-12-01 15:48:31 +05:00
myPreviewActor = 0;
myUseDiagChk = new QCheckBox (tr("USE_DIAGONAL_2_4"), mySelGrp);
myPreviewChk = new QCheckBox (tr("PREVIEW"), mySelGrp);
2004-12-01 15:48:31 +05:00
connect(myPreviewChk, SIGNAL(stateChanged(int)), this, SLOT(onPreviewChk()));
connect(myUseDiagChk, SIGNAL(stateChanged(int)), this, SLOT(onPreviewChk()));
connect(this, SIGNAL(ListContensChanged()), this, SLOT(onPreviewChk()));
2004-12-01 15:48:31 +05:00
}
SMESHGUI_CuttingOfQuadsDlg::~SMESHGUI_CuttingOfQuadsDlg()
{
}
void SMESHGUI_CuttingOfQuadsDlg::onClose()
{
erasePreview();
SMESHGUI_MultiEditDlg::onClose();
}
bool SMESHGUI_CuttingOfQuadsDlg::process (SMESH::SMESH_MeshEditor_ptr theEditor,
const SMESH::long_array& theIds)
2004-12-01 15:48:31 +05:00
{
return theEditor->SplitQuad(theIds, !myUseDiagChk->isChecked());
2004-12-01 15:48:31 +05:00
}
void SMESHGUI_CuttingOfQuadsDlg::onPreviewChk()
{
myPreviewChk->isChecked() ? displayPreview() : erasePreview();
}
void SMESHGUI_CuttingOfQuadsDlg::erasePreview()
{
if (myPreviewActor == 0)
2004-12-01 15:48:31 +05:00
return;
if (SVTK_ViewWindow* vf = SMESH::GetCurrentVtkView()) {
2004-12-01 15:48:31 +05:00
vf->RemoveActor(myPreviewActor);
vf->Repaint();
}
myPreviewActor->Delete();
myPreviewActor = 0;
}
void SMESHGUI_CuttingOfQuadsDlg::displayPreview()
{
if (myActor == 0)
2004-12-01 15:48:31 +05:00
return;
if (myPreviewActor != 0)
2004-12-01 15:48:31 +05:00
erasePreview();
// get Ids of elements
SMESH::long_array_var anElemIds = getIds();
if (getIds()->length() == 0)
2004-12-01 15:48:31 +05:00
return;
SMDS_Mesh* aMesh = myActor->GetObject()->GetMesh();
if (aMesh == 0)
2004-12-01 15:48:31 +05:00
return;
bool isDiag24 = myUseDiagChk->isChecked();
//Create grid
vtkUnstructuredGrid* aGrid = vtkUnstructuredGrid::New();
2004-12-01 15:48:31 +05:00
vtkIdType aNbCells = anElemIds->length() * 2;
vtkIdType aCellsSize = 4 * aNbCells;
vtkCellArray* aConnectivity = vtkCellArray::New();
aConnectivity->Allocate(aCellsSize, 0);
2004-12-01 15:48:31 +05:00
vtkPoints* aPoints = vtkPoints::New();
aPoints->SetNumberOfPoints(anElemIds->length() * 4);
2004-12-01 15:48:31 +05:00
vtkUnsignedCharArray* aCellTypesArray = vtkUnsignedCharArray::New();
aCellTypesArray->SetNumberOfComponents(1);
aCellTypesArray->Allocate(aNbCells * aCellTypesArray->GetNumberOfComponents());
2004-12-01 15:48:31 +05:00
vtkIdList *anIdList = vtkIdList::New();
anIdList->SetNumberOfIds(3);
2004-12-01 15:48:31 +05:00
TColStd_DataMapOfIntegerInteger anIdToVtk;
int aNodes[ 4 ];
int nbPoints = -1;
for (int i = 0, n = anElemIds->length(); i < n; i++)
2004-12-01 15:48:31 +05:00
{
const SMDS_MeshElement* anElem = aMesh->FindElement(anElemIds[ i ]);
if (anElem == 0 || anElem->NbNodes() != 4)
2004-12-01 15:48:31 +05:00
continue;
2004-12-01 15:48:31 +05:00
SMDS_ElemIteratorPtr anIter = anElem->nodesIterator();
int k = 0;
while(anIter->more())
if (const SMDS_MeshNode* aNode = (SMDS_MeshNode*)anIter->next())
2004-12-01 15:48:31 +05:00
{
if (!anIdToVtk.IsBound(aNode->GetID()))
2004-12-01 15:48:31 +05:00
{
aPoints->SetPoint(++nbPoints, aNode->X(), aNode->Y(), aNode->Z());
anIdToVtk.Bind(aNode->GetID(), nbPoints);
2004-12-01 15:48:31 +05:00
}
2004-12-01 15:48:31 +05:00
aNodes[ k++ ] = aNode->GetID();
}
if (k != 4)
2004-12-01 15:48:31 +05:00
continue;
if (!isDiag24)
2004-12-01 15:48:31 +05:00
{
anIdList->SetId(0, anIdToVtk(aNodes[ 0 ]));
anIdList->SetId(1, anIdToVtk(aNodes[ 1 ]));
anIdList->SetId(2, anIdToVtk(aNodes[ 2 ]));
aConnectivity->InsertNextCell(anIdList);
aCellTypesArray->InsertNextValue(VTK_TRIANGLE);
anIdList->SetId(0, anIdToVtk(aNodes[ 2 ]));
anIdList->SetId(1, anIdToVtk(aNodes[ 3 ]));
anIdList->SetId(2, anIdToVtk(aNodes[ 0 ]));
aConnectivity->InsertNextCell(anIdList);
aCellTypesArray->InsertNextValue(VTK_TRIANGLE);
2004-12-01 15:48:31 +05:00
}
else
{
anIdList->SetId(0, anIdToVtk(aNodes[ 1 ]));
anIdList->SetId(1, anIdToVtk(aNodes[ 2 ]));
anIdList->SetId(2, anIdToVtk(aNodes[ 3 ]));
aConnectivity->InsertNextCell(anIdList);
aCellTypesArray->InsertNextValue(VTK_TRIANGLE);
anIdList->SetId(0, anIdToVtk(aNodes[ 3 ]));
anIdList->SetId(1, anIdToVtk(aNodes[ 0 ]));
anIdList->SetId(2, anIdToVtk(aNodes[ 1 ]));
aConnectivity->InsertNextCell(anIdList);
aCellTypesArray->InsertNextValue(VTK_TRIANGLE);
2004-12-01 15:48:31 +05:00
}
}
vtkIntArray* aCellLocationsArray = vtkIntArray::New();
aCellLocationsArray->SetNumberOfComponents(1);
aCellLocationsArray->SetNumberOfTuples(aNbCells);
2004-12-01 15:48:31 +05:00
aConnectivity->InitTraversal();
for(vtkIdType idType = 0, *pts, npts; aConnectivity->GetNextCell(npts, pts); idType++)
aCellLocationsArray->SetValue(idType, aConnectivity->GetTraversalLocation(npts));
2004-12-01 15:48:31 +05:00
aGrid->SetPoints(aPoints);
aGrid->SetCells(aCellTypesArray, aCellLocationsArray,aConnectivity);
2004-12-01 15:48:31 +05:00
// Create and display actor
vtkDataSetMapper* aMapper = vtkDataSetMapper::New();
aMapper->SetInput(aGrid);
2004-12-01 15:48:31 +05:00
myPreviewActor = SALOME_Actor::New();
myPreviewActor->PickableOff();
myPreviewActor->SetMapper(aMapper);
2004-12-01 15:48:31 +05:00
vtkProperty* aProp = vtkProperty::New();
aProp->SetRepresentationToWireframe();
aProp->SetColor(250, 0, 250);
aProp->SetLineWidth(myActor->GetLineWidth() + 1);
myPreviewActor->SetProperty(aProp);
2004-12-01 15:48:31 +05:00
SMESH::GetCurrentVtkView()->AddActor(myPreviewActor);
2004-12-01 15:48:31 +05:00
SMESH::GetCurrentVtkView()->Repaint();
aProp->Delete();
aPoints->Delete();
aConnectivity->Delete();
aGrid->Delete();
aMapper->Delete();
anIdList->Delete();
aCellTypesArray->Delete();
aCellLocationsArray->Delete();
}