1 // SMESH SMESHGUI : GUI for SMESH component
3 // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
24 // File : SMESHGUI_MultiEditDlg.cxx
25 // Author : Sergey LITONIN
28 #include "SMESHGUI_MultiEditDlg.h"
31 #include "SMESHGUI_Filter.h"
32 #include "SMESHGUI_FilterDlg.h"
33 #include "SMESHGUI_Utils.h"
34 #include "SMESHGUI_VTKUtils.h"
35 #include "SMESHGUI_MeshUtils.h"
36 #include "SMESHGUI_FilterUtils.h"
37 #include "SMESHGUI_SpinBox.h"
39 #include "SMESH_Actor.h"
40 #include "SMESH_TypeFilter.hxx"
41 #include "SMDS_Mesh.hxx"
42 #include "SMDS_MeshElement.hxx"
44 #include "SUIT_ResourceMgr.h"
45 #include "SUIT_Desktop.h"
46 #include "SUIT_Session.h"
47 #include "SUIT_MessageBox.h"
49 #include "LightApp_SelectionMgr.h"
50 #include "LightApp_Application.h"
51 #include "SALOME_ListIO.hxx"
52 #include "SALOME_ListIteratorOfListIO.hxx"
54 #include "SVTK_Selector.h"
55 #include "SVTK_ViewModel.h"
56 #include "SVTK_ViewWindow.h"
57 #include "VTKViewer_CellLocationsArray.h"
60 #include <Precision.hxx>
61 #include <TColStd_IndexedMapOfInteger.hxx>
62 #include <TColStd_DataMapOfIntegerInteger.hxx>
63 #include <TColStd_MapIteratorOfMapOfInteger.hxx>
66 #include <vtkCell3D.h>
68 #include <vtkTriangle.h>
69 #include <vtkPolygon.h>
70 #include <vtkConvexPointSet.h>
71 #include <vtkIdList.h>
72 #include <vtkCellArray.h>
73 #include <vtkUnsignedCharArray.h>
74 #include <vtkUnstructuredGrid.h>
75 #include <vtkDataSetMapper.h>
76 #include <vtkProperty.h>
83 #include <qcheckbox.h>
84 #include <qcombobox.h>
85 #include <qgroupbox.h>
86 #include <qlineedit.h>
87 #include <qpushbutton.h>
88 #include <qapplication.h>
89 #include <qradiobutton.h>
90 #include <qhbuttongroup.h>
93 #include "SALOMEconfig.h"
94 #include CORBA_SERVER_HEADER(SMESH_Group)
100 * Class : SMESHGUI_MultiEditDlg
101 * Description : Description : Inversion of the diagonal of a pseudo-quadrangle formed by
102 * 2 neighboring triangles with 1 common edge
105 //=======================================================================
106 // name : SMESHGUI_MultiEditDlg::SMESHGUI_MultiEditDlg
107 // Purpose : Constructor
108 //=======================================================================
109 SMESHGUI_MultiEditDlg
110 ::SMESHGUI_MultiEditDlg(SMESHGUI* theModule,
113 const char* theName):
114 QDialog(SMESH::GetDesktop(theModule),
117 WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | WDestructiveClose),
118 mySelector(SMESH::GetViewWindow(theModule)->GetSelector()),
119 mySelectionMgr(SMESH::GetSelectionMgr(theModule)),
120 mySMESHGUI(theModule)
125 myFilterType = theMode;
126 QVBoxLayout* aDlgLay = new QVBoxLayout(this, MARGIN, SPACING);
128 QFrame* aMainFrame = createMainFrame (this, the3d2d);
129 QFrame* aBtnFrame = createButtonFrame(this);
131 aDlgLay->addWidget(aMainFrame);
132 aDlgLay->addWidget(aBtnFrame);
134 aDlgLay->setStretchFactor(aMainFrame, 1);
135 aDlgLay->setStretchFactor(aBtnFrame, 0);
139 //=======================================================================
140 // name : SMESHGUI_MultiEditDlg::createMainFrame
141 // Purpose : Create frame containing dialog's input fields
142 //=======================================================================
143 QFrame* SMESHGUI_MultiEditDlg::createMainFrame (QWidget* theParent, const bool the3d2d)
145 QGroupBox* aMainGrp = new QGroupBox(1, Qt::Horizontal, theParent);
146 aMainGrp->setFrameStyle(QFrame::NoFrame);
147 aMainGrp->setInsideMargin(0);
149 QPixmap aPix (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_SELECT")));
151 // "Selected cells" group
152 mySelGrp = new QGroupBox(1, Qt::Horizontal, aMainGrp);
156 myEntityTypeGrp = new QHButtonGroup(tr("SMESH_ELEMENTS_TYPE"), mySelGrp);
157 (new QRadioButton(tr("SMESH_FACE"), myEntityTypeGrp))->setChecked(true);
158 (new QRadioButton(tr("SMESH_VOLUME"), myEntityTypeGrp));
159 myEntityType = myEntityTypeGrp->id(myEntityTypeGrp->selected());
162 QFrame* aFrame = new QFrame(mySelGrp);
164 myListBox = new QListBox(aFrame);
165 myListBox->setSelectionMode(QListBox::Extended);
166 myListBox->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding));
167 myListBox->installEventFilter(this);
169 myFilterBtn = new QPushButton(tr("FILTER") , aFrame);
170 myAddBtn = new QPushButton(tr("ADD") , aFrame);
171 myRemoveBtn = new QPushButton(tr("REMOVE") , aFrame);
172 mySortBtn = new QPushButton(tr("SORT_LIST"), aFrame);
174 QGridLayout* aLay = new QGridLayout(aFrame, 5, 2, 0, 5);
175 aLay->addMultiCellWidget(myListBox, 0, 4, 0, 0);
176 aLay->addWidget(myFilterBtn, 0, 1);
177 aLay->addWidget(myAddBtn, 1, 1);
178 aLay->addWidget(myRemoveBtn, 2, 1);
179 aLay->addWidget(mySortBtn, 3, 1);
181 QSpacerItem* aSpacer = new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding);
182 aLay->addItem(aSpacer, 4, 1);
184 myToAllChk = new QCheckBox(tr("TO_ALL"), mySelGrp);
186 // Split/Join criterion group
187 myCriterionGrp = new QGroupBox(3, Qt::Vertical, tr("SPLIT_JOIN_CRITERION"), aMainGrp);
189 myGroupChoice = new QButtonGroup(3, Qt::Vertical, myCriterionGrp);
190 myGroupChoice->setInsideMargin(0);
191 myGroupChoice->setFrameStyle(QFrame::NoFrame);
192 (new QRadioButton(tr("USE_DIAGONAL_1_3"), myGroupChoice))->setChecked(true);
193 (new QRadioButton(tr("USE_DIAGONAL_2_4"), myGroupChoice));
194 (new QRadioButton(tr("USE_NUMERIC_FUNC"), myGroupChoice));
196 myComboBoxFunctor = new QComboBox(myCriterionGrp);
197 myComboBoxFunctor->insertItem(tr("ASPECTRATIO_ELEMENTS"));
198 myComboBoxFunctor->insertItem(tr("MINIMUMANGLE_ELEMENTS"));
199 myComboBoxFunctor->insertItem(tr("SKEW_ELEMENTS"));
200 myComboBoxFunctor->insertItem(tr("AREA_ELEMENTS"));
201 //myComboBoxFunctor->insertItem(tr("LENGTH2D_EDGES")); // for existing elements only
202 //myComboBoxFunctor->insertItem(tr("MULTI2D_BORDERS")); // for existing elements only
203 myComboBoxFunctor->setCurrentItem(0);
205 myCriterionGrp->hide();
206 myGroupChoice->hide();
207 myComboBoxFunctor->setEnabled(false);
209 // "Select from" group
210 QGroupBox* aGrp = new QGroupBox(3, Qt::Horizontal, tr("SELECT_FROM"), aMainGrp);
212 mySubmeshChk = new QCheckBox(tr("SMESH_SUBMESH"), aGrp);
213 mySubmeshBtn = new QPushButton(aGrp);
214 mySubmesh = new QLineEdit(aGrp);
215 mySubmesh->setReadOnly(true);
216 mySubmeshBtn->setPixmap(aPix);
218 myGroupChk = new QCheckBox(tr("SMESH_GROUP"), aGrp);
219 myGroupBtn = new QPushButton(aGrp);
220 myGroup = new QLineEdit(aGrp);
221 myGroup->setReadOnly(true);
222 myGroupBtn->setPixmap(aPix);
227 //=======================================================================
228 // name : SMESHGUI_MultiEditDlg::createButtonFrame
229 // Purpose : Create frame containing buttons
230 //=======================================================================
231 QFrame* SMESHGUI_MultiEditDlg::createButtonFrame (QWidget* theParent)
233 QFrame* aFrame = new QFrame (theParent);
234 aFrame->setFrameStyle(QFrame::Box | QFrame::Sunken);
236 myOkBtn = new QPushButton (tr("SMESH_BUT_OK" ), aFrame);
237 myApplyBtn = new QPushButton (tr("SMESH_BUT_APPLY"), aFrame);
238 myCloseBtn = new QPushButton (tr("SMESH_BUT_CLOSE"), aFrame);
239 myHelpBtn = new QPushButton (tr("SMESH_BUT_HELP"), aFrame);
241 QSpacerItem* aSpacer = new QSpacerItem (0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum);
243 QHBoxLayout* aLay = new QHBoxLayout (aFrame, MARGIN, SPACING);
245 aLay->addWidget(myOkBtn);
246 aLay->addWidget(myApplyBtn);
247 aLay->addItem(aSpacer);
248 aLay->addWidget(myCloseBtn);
249 aLay->addWidget(myHelpBtn);
254 //=======================================================================
255 // name : SMESHGUI_MultiEditDlg::isValid
256 // Purpose : Verify validity of input data
257 //=======================================================================
258 bool SMESHGUI_MultiEditDlg::isValid (const bool /*theMess*/) const
260 return (!myMesh->_is_nil() &&
261 (myListBox->count() > 0 || (myToAllChk->isChecked() && myActor)));
264 //=======================================================================
265 // name : SMESHGUI_MultiEditDlg::~SMESHGUI_MultiEditDlg
266 // Purpose : Destructor
267 //=======================================================================
268 SMESHGUI_MultiEditDlg::~SMESHGUI_MultiEditDlg()
270 if (myFilterDlg != 0)
272 myFilterDlg->reparent(0, QPoint());
277 //=======================================================================
278 // name : SMESHGUI_MultiEditDlg::eventFilter
279 // Purpose : event filter
280 //=======================================================================
281 bool SMESHGUI_MultiEditDlg::eventFilter (QObject* object, QEvent* event)
283 if (object == myListBox && event->type() == QEvent::KeyPress) {
284 QKeyEvent* ke = (QKeyEvent*)event;
285 if (ke->key() == Key_Delete)
288 return QDialog::eventFilter(object, event);
291 //=======================================================================
292 // name : SMESHGUI_MultiEditDlg::getNumericalFunctor
294 //=======================================================================
295 SMESH::NumericalFunctor_ptr SMESHGUI_MultiEditDlg::getNumericalFunctor()
297 SMESH::NumericalFunctor_var aNF = SMESH::NumericalFunctor::_nil();
299 SMESH::FilterManager_var aFilterMgr = SMESH::GetFilterManager();
300 if (aFilterMgr->_is_nil())
303 if (myComboBoxFunctor->currentText() == tr("ASPECTRATIO_ELEMENTS"))
304 aNF = aFilterMgr->CreateAspectRatio();
305 else if (myComboBoxFunctor->currentText() == tr("WARP_ELEMENTS"))
306 aNF = aFilterMgr->CreateWarping();
307 else if (myComboBoxFunctor->currentText() == tr("MINIMUMANGLE_ELEMENTS"))
308 aNF = aFilterMgr->CreateMinimumAngle();
309 else if (myComboBoxFunctor->currentText() == tr("TAPER_ELEMENTS"))
310 aNF = aFilterMgr->CreateTaper();
311 else if (myComboBoxFunctor->currentText() == tr("SKEW_ELEMENTS"))
312 aNF = aFilterMgr->CreateSkew();
313 else if (myComboBoxFunctor->currentText() == tr("AREA_ELEMENTS"))
314 aNF = aFilterMgr->CreateArea();
315 else if (myComboBoxFunctor->currentText() == tr("LENGTH2D_EDGES"))
316 aNF = aFilterMgr->CreateLength2D();
317 else if (myComboBoxFunctor->currentText() == tr("MULTI2D_BORDERS"))
318 aNF = aFilterMgr->CreateMultiConnection2D();
324 //=======================================================================
325 // name : SMESHGUI_MultiEditDlg::Init
326 // Purpose : Init dialog fields, connect signals and slots, show dialog
327 //=======================================================================
328 void SMESHGUI_MultiEditDlg::Init()
330 mySMESHGUI->SetActiveDialogBox((QDialog*)this);
335 emit ListContensChanged();
338 connect(myOkBtn, SIGNAL(clicked()), SLOT(onOk()));
339 connect(myCloseBtn, SIGNAL(clicked()), SLOT(onClose()));
340 connect(myApplyBtn, SIGNAL(clicked()), SLOT(onApply()));
341 connect(myHelpBtn, SIGNAL(clicked()), SLOT(onHelp()));
343 // selection and SMESHGUI
344 connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), SLOT(onSelectionDone()));
345 connect(mySMESHGUI, SIGNAL(SignalDeactivateActiveDialog()), SLOT(onDeactivate()));
346 connect(mySMESHGUI, SIGNAL(SignalCloseAllDialogs()), SLOT(onClose()));
349 connect(myFilterBtn, SIGNAL(clicked()), SLOT(onFilterBtn() ));
350 connect(myAddBtn , SIGNAL(clicked()), SLOT(onAddBtn() ));
351 connect(myRemoveBtn, SIGNAL(clicked()), SLOT(onRemoveBtn() ));
352 connect(mySortBtn , SIGNAL(clicked()), SLOT(onSortListBtn()));
354 connect(mySubmeshChk, SIGNAL(stateChanged(int)), SLOT(onSubmeshChk()));
355 connect(myGroupChk , SIGNAL(stateChanged(int)), SLOT(onGroupChk() ));
356 connect(myToAllChk , SIGNAL(stateChanged(int)), SLOT(onToAllChk() ));
359 connect(myEntityTypeGrp, SIGNAL(clicked(int)), SLOT(on3d2dChanged(int)));
361 connect(myListBox, SIGNAL(selectionChanged()), SLOT(onListSelectionChanged()));
365 // set selection mode
370 //=======================================================================
371 // name : SMESHGUI_MultiEditDlg::onOk
372 // Purpose : SLOT called when "Ok" button pressed.
373 // Assign filters VTK viewer and close dialog
374 //=======================================================================
375 void SMESHGUI_MultiEditDlg::onOk()
381 //=======================================================================
382 // name : SMESHGUI_MultiEditDlg::getIds
383 // Purpose : Retrive identifiers from list box
384 //=======================================================================
385 SMESH::long_array_var SMESHGUI_MultiEditDlg::getIds()
387 SMESH::long_array_var anIds = new SMESH::long_array;
389 if (myToAllChk->isChecked())
392 SMESH_Actor * anActor = SMESH::FindActorByObject(myMesh);
398 SMDS_Mesh* aMesh = myActor->GetObject()->GetMesh();
399 if( myFilterType == SMESHGUI_TriaFilter ||
400 myFilterType == SMESHGUI_QuadFilter ||
401 myFilterType == SMESHGUI_FaceFilter ) {
402 SMDS_FaceIteratorPtr it = aMesh->facesIterator();
404 const SMDS_MeshFace* f = it->next();
405 if(myFilterType == SMESHGUI_FaceFilter) {
406 myIds.Add(f->GetID());
408 else if( myFilterType==SMESHGUI_TriaFilter &&
409 ( f->NbNodes()==3 || f->NbNodes()==6 ) ) {
410 myIds.Add(f->GetID());
412 else if( myFilterType==SMESHGUI_QuadFilter &&
413 ( f->NbNodes()==4 || f->NbNodes()==8 ) ) {
414 myIds.Add(f->GetID());
418 else if(myFilterType == SMESHGUI_VolumeFilter) {
419 SMDS_VolumeIteratorPtr it = aMesh->volumesIterator();
421 const SMDS_MeshVolume* f = it->next();
422 myIds.Add(f->GetID());
425 /* commented by skl 07.02.2006
426 TVisualObjPtr aVisualObj = anActor->GetObject();
427 vtkUnstructuredGrid* aGrid = aVisualObj->GetUnstructuredGrid();
429 for (int i = 0, n = aGrid->GetNumberOfCells(); i < n; i++) {
430 vtkCell* aCell = aGrid->GetCell(i);
432 vtkTriangle* aTri = vtkTriangle::SafeDownCast(aCell);
433 vtkQuad* aQua = vtkQuad::SafeDownCast(aCell);
434 vtkPolygon* aPG = vtkPolygon::SafeDownCast(aCell);
436 vtkCell3D* a3d = vtkCell3D::SafeDownCast(aCell);
437 vtkConvexPointSet* aPH = vtkConvexPointSet::SafeDownCast(aCell);
439 if (aTri && myFilterType == SMESHGUI_TriaFilter ||
440 aQua && myFilterType == SMESHGUI_QuadFilter ||
441 (aTri || aQua || aPG) && myFilterType == SMESHGUI_FaceFilter ||
442 (a3d || aPH) && myFilterType == SMESHGUI_VolumeFilter) {
443 int anObjId = aVisualObj->GetElemObjId(i);
453 anIds->length(myIds.Extent());
454 TColStd_MapIteratorOfMapOfInteger anIter(myIds);
455 for (int i = 0; anIter.More(); anIter.Next() )
457 anIds[ i++ ] = anIter.Key();
459 return anIds._retn();
462 //=======================================================================
463 // name : SMESHGUI_MultiEditDlg::onClose
464 // Purpose : SLOT called when "Close" button pressed. Close dialog
465 //=======================================================================
466 void SMESHGUI_MultiEditDlg::onClose()
468 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
469 aViewWindow->SetSelectionMode(ActorSelection);
470 disconnect(mySelectionMgr, 0, this, 0);
471 disconnect(mySMESHGUI, 0, this, 0);
472 mySMESHGUI->ResetState();
474 SMESH::RemoveFilters();
475 SMESH::SetPickable();
477 //mySelectionMgr->clearSelected();
478 mySelectionMgr->clearFilters();
483 //=================================================================================
484 // function : onHelp()
486 //=================================================================================
487 void SMESHGUI_MultiEditDlg::onHelp()
489 LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication());
491 app->onHelpContextModule(mySMESHGUI ? app->moduleName(mySMESHGUI->moduleName()) : QString(""), myHelpFileName);
493 SUIT_MessageBox::warn1(0, QObject::tr("WRN_WARNING"),
494 QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
495 arg(app->resourceMgr()->stringValue("ExternalBrowser", "application")).arg(myHelpFileName),
496 QObject::tr("BUT_OK"));
500 //=======================================================================
501 // name : SMESHGUI_MultiEditDlg::onSelectionDone
502 // Purpose : SLOT called when selection changed
503 //=======================================================================
504 void SMESHGUI_MultiEditDlg::onSelectionDone()
506 if (myBusy || !isEnabled()) return;
509 const SALOME_ListIO& aList = mySelector->StoredIObjects();
511 int nbSel = aList.Extent();
512 myListBox->clearSelection();
514 if (mySubmeshChk->isChecked() || myGroupChk->isChecked()) {
515 QLineEdit* aNameEdit = mySubmeshChk->isChecked() ? mySubmesh : myGroup;
517 Handle(SALOME_InteractiveObject) anIO = aList.First();
519 SMESH::GetNameOfSelectedIObjects(mySelectionMgr, aName);
520 anIO.IsNull() ? aNameEdit->clear() : aNameEdit->setText(aName);
522 if (mySubmeshChk->isChecked()) {
523 SMESH::SMESH_subMesh_var aSubMesh =
524 SMESH::IObjectToInterface<SMESH::SMESH_subMesh>(anIO);
525 if (!aSubMesh->_is_nil())
526 myMesh = aSubMesh->GetFather();
528 SMESH::SMESH_GroupBase_var aGroup =
529 SMESH::IObjectToInterface<SMESH::SMESH_GroupBase>(anIO);
530 if (!aGroup->_is_nil())
531 myMesh = aGroup->GetMesh();
533 } else if (nbSel > 1) {
534 QString aStr = mySubmeshChk->isChecked() ?
535 tr("SMESH_SUBMESH_SELECTED") : tr("SMESH_GROUP_SELECTED");
536 aNameEdit->setText(aStr.arg(nbSel));
540 } else if (nbSel == 1) {
541 QString aListStr = "";
542 Handle(SALOME_InteractiveObject) anIO = aList.First();
543 int aNbItems = SMESH::GetNameOfSelectedElements(mySelector,anIO,aListStr);
545 QStringList anElements = QStringList::split(" ", aListStr);
546 QListBoxItem* anItem = 0;
547 for (QStringList::iterator it = anElements.begin(); it != anElements.end(); ++it) {
548 anItem = myListBox->findItem(*it, Qt::ExactMatch);
549 if (anItem) myListBox->setSelected(anItem, true);
553 myMesh = SMESH::GetMeshByIO(anIO);
557 myActor = SMESH::FindActorByEntry(aList.First()->getEntry());
559 myActor = SMESH::FindActorByObject(myMesh);
560 SVTK_Selector* aSelector = SMESH::GetSelector();
561 Handle(VTKViewer_Filter) aFilter = aSelector->GetFilter(myFilterType);
562 if (!aFilter.IsNull())
563 aFilter->SetActor(myActor);
570 //=======================================================================
571 // name : SMESHGUI_MultiEditDlg::onDeactivate
572 // Purpose : SLOT called when dialog must be deativated
573 //=======================================================================
574 void SMESHGUI_MultiEditDlg::onDeactivate()
579 //=======================================================================
580 // name : SMESHGUI_MultiEditDlg::enterEvent
581 // Purpose : Event filter
582 //=======================================================================
583 void SMESHGUI_MultiEditDlg::enterEvent (QEvent*)
586 mySMESHGUI->EmitSignalDeactivateDialog();
592 //=======================================================================
593 // name : SMESHGUI_MultiEditDlg::closeEvent
595 //=======================================================================
596 void SMESHGUI_MultiEditDlg::closeEvent (QCloseEvent*)
600 //=======================================================================
601 // name : SMESHGUI_MultiEditDlg::hideEvent
602 // Purpose : caused by ESC key
603 //=======================================================================
604 void SMESHGUI_MultiEditDlg::hideEvent (QHideEvent*)
610 //=======================================================================
611 // name : SMESHGUI_MultiEditDlg::onFilterBtn
612 // Purpose : SLOT. Called when "Filter" button pressed.
613 // Start "Selection filters" dialog
614 //=======================================================================
615 void SMESHGUI_MultiEditDlg::onFilterBtn()
617 if (myFilterDlg == 0) {
618 myFilterDlg = new SMESHGUI_FilterDlg( mySMESHGUI, entityType() ? SMESH::VOLUME : SMESH::FACE);
619 connect(myFilterDlg, SIGNAL(Accepted()), SLOT(onFilterAccepted()));
621 myFilterDlg->Init(entityType() ? SMESH::VOLUME : SMESH::FACE);
624 myFilterDlg->SetSelection();
625 myFilterDlg->SetMesh(myMesh);
626 myFilterDlg->SetSourceWg(myListBox);
631 //=======================================================================
632 // name : onFilterAccepted()
633 // Purpose : SLOT. Called when Filter dlg closed with OK button.
634 // Uncheck "Select submesh" and "Select group" checkboxes
635 //=======================================================================
636 void SMESHGUI_MultiEditDlg::onFilterAccepted()
639 for (int i = 0, n = myListBox->count(); i < n; i++)
640 myIds.Add(myListBox->text(i).toInt());
642 emit ListContensChanged();
644 if (mySubmeshChk->isChecked() || myGroupChk->isChecked()) {
645 mySubmeshChk->blockSignals(true);
646 myGroupChk->blockSignals(true);
647 mySubmeshChk->setChecked(false);
648 myGroupChk->setChecked(false);
649 mySubmeshChk->blockSignals(false);
650 myGroupChk->blockSignals(false);
655 //=======================================================================
656 // name : SMESHGUI_MultiEditDlg::isIdValid
657 // Purpose : Verify whether Id of element satisfies to filters from viewer
658 //=======================================================================
659 bool SMESHGUI_MultiEditDlg::isIdValid (const int theId) const
661 SVTK_Selector* aSelector = SMESH::GetSelector();
662 Handle(SMESHGUI_Filter) aFilter =
663 Handle(SMESHGUI_Filter)::DownCast(aSelector->GetFilter(myFilterType));
665 return (!aFilter.IsNull() && aFilter->IsObjValid(theId));
668 //=======================================================================
669 // name : SMESHGUI_MultiEditDlg::onAddBtn
670 // Purpose : SLOT. Called when "Add" button pressed.
671 // Add selected in viewer entities in list box
672 //=======================================================================
673 void SMESHGUI_MultiEditDlg::onAddBtn()
675 const SALOME_ListIO& aList = mySelector->StoredIObjects();
677 int nbSelected = aList.Extent();
681 TColStd_IndexedMapOfInteger toBeAdded;
683 if (!mySubmeshChk->isChecked() && !myGroupChk->isChecked()) {
685 mySelector->GetIndex(aList.First(),toBeAdded);
686 } else if (mySubmeshChk->isChecked()) {
687 SALOME_ListIteratorOfListIO anIter(aList);
688 for (; anIter.More(); anIter.Next()) {
689 SMESH::SMESH_subMesh_var aSubMesh =
690 SMESH::IObjectToInterface<SMESH::SMESH_subMesh>(anIter.Value());
691 if (!aSubMesh->_is_nil()) {
692 if (aSubMesh->GetFather()->GetId() == myMesh->GetId()) {
693 SMESH::long_array_var anIds = aSubMesh->GetElementsId();
694 for (int i = 0, n = anIds->length(); i < n; i++) {
695 if (isIdValid(anIds[ i ]))
696 toBeAdded.Add(anIds[ i ]);
701 } else if (myGroupChk->isChecked()) {
702 SALOME_ListIteratorOfListIO anIter(aList);
703 for (; anIter.More(); anIter.Next()) {
704 SMESH::SMESH_GroupBase_var aGroup =
705 SMESH::IObjectToInterface<SMESH::SMESH_GroupBase>(anIter.Value());
706 if (!aGroup->_is_nil() && (aGroup->GetType() == SMESH::FACE &&
707 entityType() == 0 || aGroup->GetType() == SMESH::VOLUME &&
708 entityType() == 1)) {
709 if (aGroup->GetMesh()->GetId() == myMesh->GetId()) {
710 SMESH::long_array_var anIds = aGroup->GetListOfID();
711 for (int i = 0, n = anIds->length(); i < n; i++) {
712 if (isIdValid(anIds[ i ]))
713 toBeAdded.Add(anIds[ i ]);
722 bool isGroupOrSubmesh = (mySubmeshChk->isChecked() || myGroupChk->isChecked());
723 mySubmeshChk->setChecked(false);
724 myGroupChk->setChecked(false);
725 for(int i = 1; i <= toBeAdded.Extent(); i++)
726 if (myIds.Add(toBeAdded(i))) {
727 QListBoxItem * item = new QListBoxText(QString("%1").arg(toBeAdded(i)));
728 myListBox->insertItem(item);
729 myListBox->setSelected(item, true);
733 emit ListContensChanged();
735 if (isGroupOrSubmesh)
736 onListSelectionChanged();
741 //=======================================================================
742 // name : SMESHGUI_MultiEditDlg::updateButtons
743 // Purpose : Enable/disable buttons of dialog in accordance with current state
744 //=======================================================================
745 void SMESHGUI_MultiEditDlg::updateButtons()
747 bool isOk = isValid(false);
748 myOkBtn->setEnabled(isOk);
749 myApplyBtn->setEnabled(isOk);
751 bool isListBoxNonEmpty = myListBox->count() > 0;
752 bool isToAll = myToAllChk->isChecked();
753 myFilterBtn->setEnabled(!isToAll);
754 myRemoveBtn->setEnabled(isListBoxNonEmpty && !isToAll);
755 mySortBtn->setEnabled(isListBoxNonEmpty &&!isToAll);
757 const SALOME_ListIO& aList = mySelector->StoredIObjects();
761 aList.Extent() != 1 ||
762 (SMESH::IObjectToInterface<SMESH::SMESH_subMesh>(aList.First())->_is_nil() &&
763 SMESH::IObjectToInterface<SMESH::SMESH_GroupBase>(aList.First())->_is_nil() &&
764 SMESH::IObjectToInterface<SMESH::SMESH_Mesh>(aList.First())->_is_nil()))
765 myAddBtn->setEnabled(false);
767 myAddBtn->setEnabled(true);
769 mySubmeshChk->setEnabled(!isToAll);
770 mySubmeshBtn->setEnabled(mySubmeshChk->isChecked());
771 mySubmesh->setEnabled(mySubmeshChk->isChecked());
773 myGroupChk->setEnabled(!isToAll);
774 myGroupBtn->setEnabled(myGroupChk->isChecked());
775 myGroup->setEnabled(myGroupChk->isChecked());
777 if (!mySubmeshChk->isChecked())
779 if (!myGroupChk->isChecked())
784 //=======================================================================
785 // name : SMESHGUI_MultiEditDlg::onRemoveBtn
786 // Purpose : SLOT. Called when "Remove" button pressed.
787 // Remove selected in list box entities
788 //=======================================================================
789 void SMESHGUI_MultiEditDlg::onRemoveBtn()
793 for (int i = 0, n = myListBox->count(); i < n; i++)
795 for (int i = myListBox->count(); i > 0; i--) {
796 if (myListBox->isSelected(i - 1))
798 int anId = myListBox->text(i - 1).toInt();
801 myListBox->removeItem(i-1);
807 emit ListContensChanged();
811 //=======================================================================
812 // name : SMESHGUI_MultiEditDlg::onSortListBtn
813 // Purpose : SLOT. Called when "Sort list" button pressed.
814 // Sort entities of list box
815 //=======================================================================
816 void SMESHGUI_MultiEditDlg::onSortListBtn()
820 int i, k = myListBox->count();
823 QStringList aSelected;
824 std::vector<int> anArray(k);
825 QListBoxItem* anItem;
826 for (anItem = myListBox->firstItem(), i = 0; anItem != 0; anItem = anItem->next(), i++)
828 anArray[ i ] = anItem->text().toInt();
829 if (anItem->isSelected())
830 aSelected.append(anItem->text());
833 std::sort(anArray.begin(), anArray.end());
835 for (i = 0; i < k; i++)
836 myListBox->insertItem(QString::number(anArray[ i ]));
838 for (QStringList::iterator it = aSelected.begin(); it != aSelected.end(); ++it)
840 anItem = myListBox->findItem(*it, Qt::ExactMatch);
842 myListBox->setSelected(anItem, true);
848 //=======================================================================
849 // name : SMESHGUI_MultiEditDlg::onListSelectionChanged
850 // Purpose : SLOT. Called when selection in list box changed.
851 // Highlight in selected entities
852 //=======================================================================
853 void SMESHGUI_MultiEditDlg::onListSelectionChanged()
855 if (myActor == 0 || myBusy)
858 if (mySubmeshChk->isChecked() || myGroupChk->isChecked())
861 SMESH_Actor * anActor = SMESH::FindActorByObject(myMesh);
864 TVisualObjPtr anObj = anActor->GetObject();
866 TColStd_MapOfInteger anIndexes;
867 for (QListBoxItem* anItem = myListBox->firstItem(); anItem != 0; anItem = anItem->next())
869 if (anItem->isSelected())
871 int anId = anItem->text().toInt();
872 if (anObj->GetElemVTKId(anId) >= 0) // avoid exception in hilight
877 mySelector->AddOrRemoveIndex(anActor->getIO(),anIndexes,false);
878 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
879 aViewWindow->highlight(anActor->getIO(),true,true);
882 //=======================================================================
883 // name : SMESHGUI_MultiEditDlg::onSubmeshChk
884 // Purpose : SLOT. Called when state of "SubMesh" check box changed.
885 // Activate/deactivate selection of submeshes
886 //=======================================================================
887 void SMESHGUI_MultiEditDlg::onSubmeshChk()
889 bool isChecked = mySubmeshChk->isChecked();
890 mySubmeshBtn->setEnabled(isChecked);
891 mySubmesh->setEnabled(isChecked);
894 if (isChecked && myGroupChk->isChecked())
895 myGroupChk->setChecked(false);
900 //=======================================================================
901 // name : SMESHGUI_MultiEditDlg::onGroupChk
902 // Purpose : SLOT. Called when state of "Group" check box changed.
903 // Activate/deactivate selection of groupes
904 //=======================================================================
905 void SMESHGUI_MultiEditDlg::onGroupChk()
907 bool isChecked = myGroupChk->isChecked();
908 myGroupBtn->setEnabled(isChecked);
909 myGroup->setEnabled(isChecked);
912 if (isChecked && mySubmeshChk->isChecked())
913 mySubmeshChk->setChecked(false);
918 //=======================================================================
919 // name : SMESHGUI_MultiEditDlg::onToAllChk
920 // Purpose : SLOT. Called when state of "Apply to all" check box changed.
921 // Activate/deactivate selection
922 //=======================================================================
923 void SMESHGUI_MultiEditDlg::onToAllChk()
925 bool isChecked = myToAllChk->isChecked();
932 emit ListContensChanged();
938 //=======================================================================
939 // name : SMESHGUI_MultiEditDlg::setSelectionMode
940 // Purpose : Set selection mode
941 //=======================================================================
942 void SMESHGUI_MultiEditDlg::setSelectionMode()
944 SMESH::RemoveFilters();
946 mySelectionMgr->clearSelected();
947 mySelectionMgr->clearFilters();
949 if (mySubmeshChk->isChecked()) {
950 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
951 aViewWindow->SetSelectionMode(ActorSelection);
952 mySelectionMgr->installFilter(new SMESH_TypeFilter(SUBMESH));
954 else if (myGroupChk->isChecked()) {
955 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
956 aViewWindow->SetSelectionMode(ActorSelection);
957 mySelectionMgr->installFilter(new SMESH_TypeFilter(GROUP));
961 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
962 aViewWindow->SetSelectionMode(VolumeSelection);
963 SMESH::SetFilter(new SMESHGUI_VolumesFilter());
965 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
966 aViewWindow->SetSelectionMode(FaceSelection);
967 if (myFilterType == SMESHGUI_TriaFilter)
968 SMESH::SetFilter(new SMESHGUI_TriangleFilter());
969 else if (myFilterType == SMESHGUI_QuadFilter)
970 SMESH::SetFilter(new SMESHGUI_QuadrangleFilter());
972 SMESH::SetFilter(new SMESHGUI_FacesFilter());
976 //=======================================================================
977 // name : SMESHGUI_MultiEditDlg::onApply
978 // Purpose : SLOT. Called when "Apply" button clicked.
979 //=======================================================================
980 bool SMESHGUI_MultiEditDlg::onApply()
982 if (mySMESHGUI->isActiveStudyLocked())
987 SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
988 if (aMeshEditor->_is_nil())
993 SMESH::long_array_var anIds = getIds();
995 bool aResult = process(aMeshEditor, anIds.inout());
999 mySelectionMgr->selectedObjects( sel );
1000 mySelector->ClearIndex();
1001 mySelectionMgr->setSelectedObjects( sel );
1002 SMESH::UpdateView();
1007 emit ListContensChanged();
1016 //=======================================================================
1017 // name : SMESHGUI_MultiEditDlg::on3d2dChanged
1019 //=======================================================================
1020 void SMESHGUI_MultiEditDlg::on3d2dChanged (int type)
1022 if (myEntityType != type) {
1023 myEntityType = type;
1028 emit ListContensChanged();
1031 myFilterType = SMESHGUI_VolumeFilter;
1033 myFilterType = SMESHGUI_FaceFilter;
1040 //=======================================================================
1041 // name : SMESHGUI_MultiEditDlg::entityType
1043 //=======================================================================
1044 int SMESHGUI_MultiEditDlg::entityType()
1046 return myEntityType;
1050 * Class : SMESHGUI_ChangeOrientationDlg
1051 * Description : Modification of orientation of faces
1054 SMESHGUI_ChangeOrientationDlg
1055 ::SMESHGUI_ChangeOrientationDlg(SMESHGUI* theModule,
1056 const char* theName):
1057 SMESHGUI_MultiEditDlg(theModule, SMESHGUI_FaceFilter, true, theName)
1059 setCaption(tr("CAPTION"));
1060 myHelpFileName = "/files/changing_orientation_of_elements.htm";
1063 SMESHGUI_ChangeOrientationDlg::~SMESHGUI_ChangeOrientationDlg()
1067 bool SMESHGUI_ChangeOrientationDlg::process (SMESH::SMESH_MeshEditor_ptr theEditor,
1068 const SMESH::long_array& theIds)
1070 return theEditor->Reorient(theIds);
1074 * Class : SMESHGUI_UnionOfTrianglesDlg
1075 * Description : Construction of quadrangles by automatic association of triangles
1078 SMESHGUI_UnionOfTrianglesDlg
1079 ::SMESHGUI_UnionOfTrianglesDlg(SMESHGUI* theModule,
1080 const char* theName):
1081 SMESHGUI_MultiEditDlg(theModule, SMESHGUI_TriaFilter, false, theName)
1083 setCaption(tr("CAPTION"));
1085 myComboBoxFunctor->setEnabled(true);
1086 myComboBoxFunctor->insertItem(tr("WARP_ELEMENTS")); // for quadrangles only
1087 myComboBoxFunctor->insertItem(tr("TAPER_ELEMENTS")); // for quadrangles only
1090 QGroupBox* aMaxAngleGrp = new QGroupBox (2, Qt::Horizontal, myCriterionGrp);
1091 aMaxAngleGrp->setInsideMargin(0);
1092 aMaxAngleGrp->setFrameStyle(QFrame::NoFrame);
1093 new QLabel (tr("MAXIMUM_ANGLE"), aMaxAngleGrp);
1094 myMaxAngleSpin = new SMESHGUI_SpinBox (aMaxAngleGrp);
1095 myMaxAngleSpin->RangeStepAndValidator(0, 180.0, 1.0, 3);
1096 myMaxAngleSpin->SetValue(30.0);
1098 myCriterionGrp->show();
1100 myHelpFileName = "/files/uniting_a_set_of_triangles.htm";
1103 SMESHGUI_UnionOfTrianglesDlg::~SMESHGUI_UnionOfTrianglesDlg()
1107 bool SMESHGUI_UnionOfTrianglesDlg::process (SMESH::SMESH_MeshEditor_ptr theEditor,
1108 const SMESH::long_array& theIds)
1110 SMESH::NumericalFunctor_var aCriterion = getNumericalFunctor();
1111 double aMaxAngle = myMaxAngleSpin->GetValue() * PI / 180.0;
1112 return theEditor->TriToQuad(theIds, aCriterion, aMaxAngle);
1117 * Class : SMESHGUI_CuttingOfQuadsDlg
1118 * Description : Automatic splitting of quadrangles into triangles
1121 SMESHGUI_CuttingOfQuadsDlg
1122 ::SMESHGUI_CuttingOfQuadsDlg(SMESHGUI* theModule,
1123 const char* theName):
1124 SMESHGUI_MultiEditDlg(theModule, SMESHGUI_QuadFilter, false, theName)
1126 setCaption(tr("CAPTION"));
1129 myPreviewChk = new QCheckBox (tr("PREVIEW"), mySelGrp);
1131 myCriterionGrp->show();
1132 myGroupChoice->show();
1133 myComboBoxFunctor->setEnabled(false);
1135 connect(myPreviewChk , SIGNAL(stateChanged(int)) , this, SLOT(onPreviewChk()));
1136 connect(myGroupChoice , SIGNAL(clicked(int)) , this, SLOT(onCriterionRB()));
1137 connect(myComboBoxFunctor, SIGNAL(activated(int)) , this, SLOT(onPreviewChk()));
1138 connect(this , SIGNAL(ListContensChanged()), this, SLOT(onPreviewChk()));
1140 myHelpFileName = "/files/cutting_quadrangles.htm";
1143 SMESHGUI_CuttingOfQuadsDlg::~SMESHGUI_CuttingOfQuadsDlg()
1147 void SMESHGUI_CuttingOfQuadsDlg::onClose()
1150 SMESHGUI_MultiEditDlg::onClose();
1153 bool SMESHGUI_CuttingOfQuadsDlg::process (SMESH::SMESH_MeshEditor_ptr theEditor,
1154 const SMESH::long_array& theIds)
1156 switch (myGroupChoice->id(myGroupChoice->selected())) {
1157 case 0: // use diagonal 1-3
1158 return theEditor->SplitQuad(theIds, true);
1159 case 1: // use diagonal 2-4
1160 return theEditor->SplitQuad(theIds, false);
1161 default: // use numeric functor
1165 SMESH::NumericalFunctor_var aCriterion = getNumericalFunctor();
1166 return theEditor->QuadToTri(theIds, aCriterion);
1169 void SMESHGUI_CuttingOfQuadsDlg::onCriterionRB()
1171 if (myGroupChoice->id(myGroupChoice->selected()) == 2) // Use numeric functor
1172 myComboBoxFunctor->setEnabled(true);
1174 myComboBoxFunctor->setEnabled(false);
1179 void SMESHGUI_CuttingOfQuadsDlg::onPreviewChk()
1181 myPreviewChk->isChecked() ? displayPreview() : erasePreview();
1184 void SMESHGUI_CuttingOfQuadsDlg::erasePreview()
1186 if (myPreviewActor == 0)
1189 if (SVTK_ViewWindow* vf = SMESH::GetCurrentVtkView()) {
1190 vf->RemoveActor(myPreviewActor);
1193 myPreviewActor->Delete();
1197 void SMESHGUI_CuttingOfQuadsDlg::displayPreview()
1202 if (myPreviewActor != 0)
1205 // get Ids of elements
1206 SMESH::long_array_var anElemIds = getIds();
1207 if (getIds()->length() == 0)
1210 SMDS_Mesh* aMesh = myActor->GetObject()->GetMesh();
1214 // 0 - use diagonal 1-3, 1 - use diagonal 2-4, 2 - use numerical functor
1215 int aChoice = myGroupChoice->id(myGroupChoice->selected());
1216 SMESH::NumericalFunctor_var aCriterion = SMESH::NumericalFunctor::_nil();
1217 SMESH::SMESH_MeshEditor_var aMeshEditor = SMESH::SMESH_MeshEditor::_nil();
1219 aCriterion = getNumericalFunctor();
1220 aMeshEditor = myMesh->GetMeshEditor();
1221 if (aMeshEditor->_is_nil())
1226 vtkUnstructuredGrid* aGrid = vtkUnstructuredGrid::New();
1228 vtkIdType aNbCells = anElemIds->length() * 2;
1229 vtkIdType aCellsSize = 4 * aNbCells;
1230 vtkCellArray* aConnectivity = vtkCellArray::New();
1231 aConnectivity->Allocate(aCellsSize, 0);
1233 vtkPoints* aPoints = vtkPoints::New();
1234 aPoints->SetNumberOfPoints(anElemIds->length() * 4);
1236 vtkUnsignedCharArray* aCellTypesArray = vtkUnsignedCharArray::New();
1237 aCellTypesArray->SetNumberOfComponents(1);
1238 aCellTypesArray->Allocate(aNbCells * aCellTypesArray->GetNumberOfComponents());
1240 vtkIdList *anIdList = vtkIdList::New();
1241 anIdList->SetNumberOfIds(3);
1243 TColStd_DataMapOfIntegerInteger anIdToVtk;
1247 for (int i = 0, n = anElemIds->length(); i < n; i++)
1249 const SMDS_MeshElement* anElem = aMesh->FindElement(anElemIds[ i ]);
1250 if (anElem == 0 || anElem->NbNodes() != 4)
1253 SMDS_ElemIteratorPtr anIter = anElem->nodesIterator();
1255 while (anIter->more()) {
1256 const SMDS_MeshNode* aNode = static_cast<const SMDS_MeshNode*>(anIter->next());
1259 if (!anIdToVtk.IsBound(aNode->GetID()))
1261 aPoints->SetPoint(++nbPoints, aNode->X(), aNode->Y(), aNode->Z());
1262 anIdToVtk.Bind(aNode->GetID(), nbPoints);
1265 aNodes[ k++ ] = aNode->GetID();
1272 bool isDiag13 = true;
1273 if (aChoice == 0) // use diagonal 1-3
1277 else if (aChoice == 1) // use diagonal 2-4
1281 else // use numerical functor
1283 // compare two sets of possible triangles
1284 int diag = aMeshEditor->BestSplit(anElemIds[i], aCriterion);
1285 if (diag == 1) // 1-3
1287 else if (diag == 2) // 2-4
1295 anIdList->SetId(0, anIdToVtk(aNodes[ 0 ]));
1296 anIdList->SetId(1, anIdToVtk(aNodes[ 1 ]));
1297 anIdList->SetId(2, anIdToVtk(aNodes[ 2 ]));
1298 aConnectivity->InsertNextCell(anIdList);
1299 aCellTypesArray->InsertNextValue(VTK_TRIANGLE);
1301 anIdList->SetId(0, anIdToVtk(aNodes[ 2 ]));
1302 anIdList->SetId(1, anIdToVtk(aNodes[ 3 ]));
1303 anIdList->SetId(2, anIdToVtk(aNodes[ 0 ]));
1304 aConnectivity->InsertNextCell(anIdList);
1305 aCellTypesArray->InsertNextValue(VTK_TRIANGLE);
1309 anIdList->SetId(0, anIdToVtk(aNodes[ 1 ]));
1310 anIdList->SetId(1, anIdToVtk(aNodes[ 2 ]));
1311 anIdList->SetId(2, anIdToVtk(aNodes[ 3 ]));
1312 aConnectivity->InsertNextCell(anIdList);
1313 aCellTypesArray->InsertNextValue(VTK_TRIANGLE);
1315 anIdList->SetId(0, anIdToVtk(aNodes[ 3 ]));
1316 anIdList->SetId(1, anIdToVtk(aNodes[ 0 ]));
1317 anIdList->SetId(2, anIdToVtk(aNodes[ 1 ]));
1318 aConnectivity->InsertNextCell(anIdList);
1319 aCellTypesArray->InsertNextValue(VTK_TRIANGLE);
1323 VTKViewer_CellLocationsArray* aCellLocationsArray = VTKViewer_CellLocationsArray::New();
1324 aCellLocationsArray->SetNumberOfComponents(1);
1325 aCellLocationsArray->SetNumberOfTuples(aNbCells);
1327 aConnectivity->InitTraversal();
1328 for(vtkIdType idType = 0, *pts, npts; aConnectivity->GetNextCell(npts, pts); idType++)
1329 aCellLocationsArray->SetValue(idType, aConnectivity->GetTraversalLocation(npts));
1331 aGrid->SetPoints(aPoints);
1332 aGrid->SetCells(aCellTypesArray, aCellLocationsArray,aConnectivity);
1334 // Create and display actor
1335 vtkDataSetMapper* aMapper = vtkDataSetMapper::New();
1336 aMapper->SetInput(aGrid);
1338 myPreviewActor = SALOME_Actor::New();
1339 myPreviewActor->PickableOff();
1340 myPreviewActor->SetMapper(aMapper);
1342 vtkProperty* aProp = vtkProperty::New();
1343 aProp->SetRepresentationToWireframe();
1344 aProp->SetColor(250, 0, 250);
1345 aProp->SetLineWidth(myActor->GetLineWidth() + 1);
1346 myPreviewActor->SetProperty(aProp);
1348 SMESH::GetCurrentVtkView()->AddActor(myPreviewActor);
1349 SMESH::GetCurrentVtkView()->Repaint();
1353 aConnectivity->Delete();
1357 aCellTypesArray->Delete();
1358 aCellLocationsArray->Delete();