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.salome-platform.org/ or email : webmaster.salome@opencascade.com
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 myApplyBtn = new QPushButton (tr("SMESH_BUT_APPLY"), aFrame);
237 myCloseBtn = new QPushButton (tr("SMESH_BUT_CLOSE"), aFrame);
238 myOkBtn = new QPushButton (tr("SMESH_BUT_APPLY_AND_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(myApplyBtn);
246 aLay->addWidget(myCloseBtn);
247 aLay->addWidget(myOkBtn);
248 aLay->addItem(aSpacer);
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);
495 platform = "winapplication";
497 platform = "application";
499 SUIT_MessageBox::warn1(0, QObject::tr("WRN_WARNING"),
500 QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
501 arg(app->resourceMgr()->stringValue("ExternalBrowser", platform)).arg(myHelpFileName),
502 QObject::tr("BUT_OK"));
506 //=======================================================================
507 // name : SMESHGUI_MultiEditDlg::onSelectionDone
508 // Purpose : SLOT called when selection changed
509 //=======================================================================
510 void SMESHGUI_MultiEditDlg::onSelectionDone()
512 if (myBusy || !isEnabled()) return;
515 const SALOME_ListIO& aList = mySelector->StoredIObjects();
517 int nbSel = aList.Extent();
518 myListBox->clearSelection();
520 if (mySubmeshChk->isChecked() || myGroupChk->isChecked()) {
521 QLineEdit* aNameEdit = mySubmeshChk->isChecked() ? mySubmesh : myGroup;
523 Handle(SALOME_InteractiveObject) anIO = aList.First();
525 SMESH::GetNameOfSelectedIObjects(mySelectionMgr, aName);
526 anIO.IsNull() ? aNameEdit->clear() : aNameEdit->setText(aName);
528 if (mySubmeshChk->isChecked()) {
529 SMESH::SMESH_subMesh_var aSubMesh =
530 SMESH::IObjectToInterface<SMESH::SMESH_subMesh>(anIO);
531 if (!aSubMesh->_is_nil())
532 myMesh = aSubMesh->GetFather();
534 SMESH::SMESH_GroupBase_var aGroup =
535 SMESH::IObjectToInterface<SMESH::SMESH_GroupBase>(anIO);
536 if (!aGroup->_is_nil())
537 myMesh = aGroup->GetMesh();
539 } else if (nbSel > 1) {
540 QString aStr = mySubmeshChk->isChecked() ?
541 tr("SMESH_SUBMESH_SELECTED") : tr("SMESH_GROUP_SELECTED");
542 aNameEdit->setText(aStr.arg(nbSel));
546 } else if (nbSel == 1) {
547 QString aListStr = "";
548 Handle(SALOME_InteractiveObject) anIO = aList.First();
549 int aNbItems = SMESH::GetNameOfSelectedElements(mySelector,anIO,aListStr);
551 QStringList anElements = QStringList::split(" ", aListStr);
552 QListBoxItem* anItem = 0;
553 for (QStringList::iterator it = anElements.begin(); it != anElements.end(); ++it) {
554 anItem = myListBox->findItem(*it, Qt::ExactMatch);
555 if (anItem) myListBox->setSelected(anItem, true);
559 myMesh = SMESH::GetMeshByIO(anIO);
563 myActor = SMESH::FindActorByEntry(aList.First()->getEntry());
565 myActor = SMESH::FindActorByObject(myMesh);
566 SVTK_Selector* aSelector = SMESH::GetSelector();
567 Handle(VTKViewer_Filter) aFilter = aSelector->GetFilter(myFilterType);
568 if (!aFilter.IsNull())
569 aFilter->SetActor(myActor);
576 //=======================================================================
577 // name : SMESHGUI_MultiEditDlg::onDeactivate
578 // Purpose : SLOT called when dialog must be deativated
579 //=======================================================================
580 void SMESHGUI_MultiEditDlg::onDeactivate()
585 //=======================================================================
586 // name : SMESHGUI_MultiEditDlg::enterEvent
587 // Purpose : Event filter
588 //=======================================================================
589 void SMESHGUI_MultiEditDlg::enterEvent (QEvent*)
592 mySMESHGUI->EmitSignalDeactivateDialog();
598 //=======================================================================
599 // name : SMESHGUI_MultiEditDlg::closeEvent
601 //=======================================================================
602 void SMESHGUI_MultiEditDlg::closeEvent (QCloseEvent*)
606 //=======================================================================
607 // name : SMESHGUI_MultiEditDlg::hideEvent
608 // Purpose : caused by ESC key
609 //=======================================================================
610 void SMESHGUI_MultiEditDlg::hideEvent (QHideEvent*)
616 //=======================================================================
617 // name : SMESHGUI_MultiEditDlg::onFilterBtn
618 // Purpose : SLOT. Called when "Filter" button pressed.
619 // Start "Selection filters" dialog
620 //=======================================================================
621 void SMESHGUI_MultiEditDlg::onFilterBtn()
623 if (myFilterDlg == 0) {
624 myFilterDlg = new SMESHGUI_FilterDlg( mySMESHGUI, entityType() ? SMESH::VOLUME : SMESH::FACE);
625 connect(myFilterDlg, SIGNAL(Accepted()), SLOT(onFilterAccepted()));
627 myFilterDlg->Init(entityType() ? SMESH::VOLUME : SMESH::FACE);
630 myFilterDlg->SetSelection();
631 myFilterDlg->SetMesh(myMesh);
632 myFilterDlg->SetSourceWg(myListBox);
637 //=======================================================================
638 // name : onFilterAccepted()
639 // Purpose : SLOT. Called when Filter dlg closed with OK button.
640 // Uncheck "Select submesh" and "Select group" checkboxes
641 //=======================================================================
642 void SMESHGUI_MultiEditDlg::onFilterAccepted()
645 for (int i = 0, n = myListBox->count(); i < n; i++)
646 myIds.Add(myListBox->text(i).toInt());
648 emit ListContensChanged();
650 if (mySubmeshChk->isChecked() || myGroupChk->isChecked()) {
651 mySubmeshChk->blockSignals(true);
652 myGroupChk->blockSignals(true);
653 mySubmeshChk->setChecked(false);
654 myGroupChk->setChecked(false);
655 mySubmeshChk->blockSignals(false);
656 myGroupChk->blockSignals(false);
661 //=======================================================================
662 // name : SMESHGUI_MultiEditDlg::isIdValid
663 // Purpose : Verify whether Id of element satisfies to filters from viewer
664 //=======================================================================
665 bool SMESHGUI_MultiEditDlg::isIdValid (const int theId) const
667 SVTK_Selector* aSelector = SMESH::GetSelector();
668 Handle(SMESHGUI_Filter) aFilter =
669 Handle(SMESHGUI_Filter)::DownCast(aSelector->GetFilter(myFilterType));
671 return (!aFilter.IsNull() && aFilter->IsObjValid(theId));
674 //=======================================================================
675 // name : SMESHGUI_MultiEditDlg::onAddBtn
676 // Purpose : SLOT. Called when "Add" button pressed.
677 // Add selected in viewer entities in list box
678 //=======================================================================
679 void SMESHGUI_MultiEditDlg::onAddBtn()
681 const SALOME_ListIO& aList = mySelector->StoredIObjects();
683 int nbSelected = aList.Extent();
687 TColStd_IndexedMapOfInteger toBeAdded;
689 if (!mySubmeshChk->isChecked() && !myGroupChk->isChecked()) {
691 mySelector->GetIndex(aList.First(),toBeAdded);
692 } else if (mySubmeshChk->isChecked()) {
693 SALOME_ListIteratorOfListIO anIter(aList);
694 for (; anIter.More(); anIter.Next()) {
695 SMESH::SMESH_subMesh_var aSubMesh =
696 SMESH::IObjectToInterface<SMESH::SMESH_subMesh>(anIter.Value());
697 if (!aSubMesh->_is_nil()) {
698 if (aSubMesh->GetFather()->GetId() == myMesh->GetId()) {
699 SMESH::long_array_var anIds = aSubMesh->GetElementsId();
700 for (int i = 0, n = anIds->length(); i < n; i++) {
701 if (isIdValid(anIds[ i ]))
702 toBeAdded.Add(anIds[ i ]);
707 } else if (myGroupChk->isChecked()) {
708 SALOME_ListIteratorOfListIO anIter(aList);
709 for (; anIter.More(); anIter.Next()) {
710 SMESH::SMESH_GroupBase_var aGroup =
711 SMESH::IObjectToInterface<SMESH::SMESH_GroupBase>(anIter.Value());
712 if (!aGroup->_is_nil() && (aGroup->GetType() == SMESH::FACE &&
713 entityType() == 0 || aGroup->GetType() == SMESH::VOLUME &&
714 entityType() == 1)) {
715 if (aGroup->GetMesh()->GetId() == myMesh->GetId()) {
716 SMESH::long_array_var anIds = aGroup->GetListOfID();
717 for (int i = 0, n = anIds->length(); i < n; i++) {
718 if (isIdValid(anIds[ i ]))
719 toBeAdded.Add(anIds[ i ]);
728 bool isGroupOrSubmesh = (mySubmeshChk->isChecked() || myGroupChk->isChecked());
729 mySubmeshChk->setChecked(false);
730 myGroupChk->setChecked(false);
731 for(int i = 1; i <= toBeAdded.Extent(); i++)
732 if (myIds.Add(toBeAdded(i))) {
733 QListBoxItem * item = new QListBoxText(QString("%1").arg(toBeAdded(i)));
734 myListBox->insertItem(item);
735 myListBox->setSelected(item, true);
739 emit ListContensChanged();
741 if (isGroupOrSubmesh)
742 onListSelectionChanged();
747 //=======================================================================
748 // name : SMESHGUI_MultiEditDlg::updateButtons
749 // Purpose : Enable/disable buttons of dialog in accordance with current state
750 //=======================================================================
751 void SMESHGUI_MultiEditDlg::updateButtons()
753 bool isOk = isValid(false);
754 myOkBtn->setEnabled(isOk);
755 myApplyBtn->setEnabled(isOk);
757 bool isListBoxNonEmpty = myListBox->count() > 0;
758 bool isToAll = myToAllChk->isChecked();
759 myFilterBtn->setEnabled(!isToAll);
760 myRemoveBtn->setEnabled(isListBoxNonEmpty && !isToAll);
761 mySortBtn->setEnabled(isListBoxNonEmpty &&!isToAll);
763 const SALOME_ListIO& aList = mySelector->StoredIObjects();
767 aList.Extent() != 1 ||
768 (SMESH::IObjectToInterface<SMESH::SMESH_subMesh>(aList.First())->_is_nil() &&
769 SMESH::IObjectToInterface<SMESH::SMESH_GroupBase>(aList.First())->_is_nil() &&
770 SMESH::IObjectToInterface<SMESH::SMESH_Mesh>(aList.First())->_is_nil()))
771 myAddBtn->setEnabled(false);
773 myAddBtn->setEnabled(true);
775 mySubmeshChk->setEnabled(!isToAll);
776 mySubmeshBtn->setEnabled(mySubmeshChk->isChecked());
777 mySubmesh->setEnabled(mySubmeshChk->isChecked());
779 myGroupChk->setEnabled(!isToAll);
780 myGroupBtn->setEnabled(myGroupChk->isChecked());
781 myGroup->setEnabled(myGroupChk->isChecked());
783 if (!mySubmeshChk->isChecked())
785 if (!myGroupChk->isChecked())
790 //=======================================================================
791 // name : SMESHGUI_MultiEditDlg::onRemoveBtn
792 // Purpose : SLOT. Called when "Remove" button pressed.
793 // Remove selected in list box entities
794 //=======================================================================
795 void SMESHGUI_MultiEditDlg::onRemoveBtn()
799 for (int i = 0, n = myListBox->count(); i < n; i++)
801 for (int i = myListBox->count(); i > 0; i--) {
802 if (myListBox->isSelected(i - 1))
804 int anId = myListBox->text(i - 1).toInt();
807 myListBox->removeItem(i-1);
813 emit ListContensChanged();
817 //=======================================================================
818 // name : SMESHGUI_MultiEditDlg::onSortListBtn
819 // Purpose : SLOT. Called when "Sort list" button pressed.
820 // Sort entities of list box
821 //=======================================================================
822 void SMESHGUI_MultiEditDlg::onSortListBtn()
826 int i, k = myListBox->count();
829 QStringList aSelected;
830 std::vector<int> anArray(k);
831 QListBoxItem* anItem;
832 for (anItem = myListBox->firstItem(), i = 0; anItem != 0; anItem = anItem->next(), i++)
834 anArray[ i ] = anItem->text().toInt();
835 if (anItem->isSelected())
836 aSelected.append(anItem->text());
839 std::sort(anArray.begin(), anArray.end());
841 for (i = 0; i < k; i++)
842 myListBox->insertItem(QString::number(anArray[ i ]));
844 for (QStringList::iterator it = aSelected.begin(); it != aSelected.end(); ++it)
846 anItem = myListBox->findItem(*it, Qt::ExactMatch);
848 myListBox->setSelected(anItem, true);
854 //=======================================================================
855 // name : SMESHGUI_MultiEditDlg::onListSelectionChanged
856 // Purpose : SLOT. Called when selection in list box changed.
857 // Highlight in selected entities
858 //=======================================================================
859 void SMESHGUI_MultiEditDlg::onListSelectionChanged()
861 if (myActor == 0 || myBusy)
864 if (mySubmeshChk->isChecked() || myGroupChk->isChecked())
867 SMESH_Actor * anActor = SMESH::FindActorByObject(myMesh);
870 TVisualObjPtr anObj = anActor->GetObject();
872 TColStd_MapOfInteger anIndexes;
873 for (QListBoxItem* anItem = myListBox->firstItem(); anItem != 0; anItem = anItem->next())
875 if (anItem->isSelected())
877 int anId = anItem->text().toInt();
878 if (anObj->GetElemVTKId(anId) >= 0) // avoid exception in hilight
883 mySelector->AddOrRemoveIndex(anActor->getIO(),anIndexes,false);
884 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
885 aViewWindow->highlight(anActor->getIO(),true,true);
888 //=======================================================================
889 // name : SMESHGUI_MultiEditDlg::onSubmeshChk
890 // Purpose : SLOT. Called when state of "SubMesh" check box changed.
891 // Activate/deactivate selection of submeshes
892 //=======================================================================
893 void SMESHGUI_MultiEditDlg::onSubmeshChk()
895 bool isChecked = mySubmeshChk->isChecked();
896 mySubmeshBtn->setEnabled(isChecked);
897 mySubmesh->setEnabled(isChecked);
900 if (isChecked && myGroupChk->isChecked())
901 myGroupChk->setChecked(false);
906 //=======================================================================
907 // name : SMESHGUI_MultiEditDlg::onGroupChk
908 // Purpose : SLOT. Called when state of "Group" check box changed.
909 // Activate/deactivate selection of groupes
910 //=======================================================================
911 void SMESHGUI_MultiEditDlg::onGroupChk()
913 bool isChecked = myGroupChk->isChecked();
914 myGroupBtn->setEnabled(isChecked);
915 myGroup->setEnabled(isChecked);
918 if (isChecked && mySubmeshChk->isChecked())
919 mySubmeshChk->setChecked(false);
924 //=======================================================================
925 // name : SMESHGUI_MultiEditDlg::onToAllChk
926 // Purpose : SLOT. Called when state of "Apply to all" check box changed.
927 // Activate/deactivate selection
928 //=======================================================================
929 void SMESHGUI_MultiEditDlg::onToAllChk()
931 bool isChecked = myToAllChk->isChecked();
938 emit ListContensChanged();
944 //=======================================================================
945 // name : SMESHGUI_MultiEditDlg::setSelectionMode
946 // Purpose : Set selection mode
947 //=======================================================================
948 void SMESHGUI_MultiEditDlg::setSelectionMode()
950 SMESH::RemoveFilters();
952 mySelectionMgr->clearSelected();
953 mySelectionMgr->clearFilters();
955 if (mySubmeshChk->isChecked()) {
956 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
957 aViewWindow->SetSelectionMode(ActorSelection);
958 mySelectionMgr->installFilter(new SMESH_TypeFilter(SUBMESH));
960 else if (myGroupChk->isChecked()) {
961 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
962 aViewWindow->SetSelectionMode(ActorSelection);
963 mySelectionMgr->installFilter(new SMESH_TypeFilter(GROUP));
967 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
968 aViewWindow->SetSelectionMode(VolumeSelection);
969 SMESH::SetFilter(new SMESHGUI_VolumesFilter());
971 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
972 aViewWindow->SetSelectionMode(FaceSelection);
973 if (myFilterType == SMESHGUI_TriaFilter)
974 SMESH::SetFilter(new SMESHGUI_TriangleFilter());
975 else if (myFilterType == SMESHGUI_QuadFilter)
976 SMESH::SetFilter(new SMESHGUI_QuadrangleFilter());
978 SMESH::SetFilter(new SMESHGUI_FacesFilter());
982 //=======================================================================
983 // name : SMESHGUI_MultiEditDlg::onApply
984 // Purpose : SLOT. Called when "Apply" button clicked.
985 //=======================================================================
986 bool SMESHGUI_MultiEditDlg::onApply()
988 if (mySMESHGUI->isActiveStudyLocked())
993 SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
994 if (aMeshEditor->_is_nil())
999 SMESH::long_array_var anIds = getIds();
1001 bool aResult = process(aMeshEditor, anIds.inout());
1005 mySelectionMgr->selectedObjects( sel );
1006 mySelector->ClearIndex();
1007 mySelectionMgr->setSelectedObjects( sel );
1008 SMESH::UpdateView();
1013 emit ListContensChanged();
1022 //=======================================================================
1023 // name : SMESHGUI_MultiEditDlg::on3d2dChanged
1025 //=======================================================================
1026 void SMESHGUI_MultiEditDlg::on3d2dChanged (int type)
1028 if (myEntityType != type) {
1029 myEntityType = type;
1034 emit ListContensChanged();
1037 myFilterType = SMESHGUI_VolumeFilter;
1039 myFilterType = SMESHGUI_FaceFilter;
1046 //=======================================================================
1047 // name : SMESHGUI_MultiEditDlg::entityType
1049 //=======================================================================
1050 int SMESHGUI_MultiEditDlg::entityType()
1052 return myEntityType;
1055 //=================================================================================
1056 // function : keyPressEvent()
1058 //=================================================================================
1059 void SMESHGUI_MultiEditDlg::keyPressEvent( QKeyEvent* e )
1061 QDialog::keyPressEvent( e );
1062 if ( e->isAccepted() )
1065 if ( e->key() == Key_F1 )
1073 * Class : SMESHGUI_ChangeOrientationDlg
1074 * Description : Modification of orientation of faces
1077 SMESHGUI_ChangeOrientationDlg
1078 ::SMESHGUI_ChangeOrientationDlg(SMESHGUI* theModule,
1079 const char* theName):
1080 SMESHGUI_MultiEditDlg(theModule, SMESHGUI_FaceFilter, true, theName)
1082 setCaption(tr("CAPTION"));
1083 myHelpFileName = "changing_orientation_of_elements_page.html";
1086 SMESHGUI_ChangeOrientationDlg::~SMESHGUI_ChangeOrientationDlg()
1090 bool SMESHGUI_ChangeOrientationDlg::process (SMESH::SMESH_MeshEditor_ptr theEditor,
1091 const SMESH::long_array& theIds)
1093 return theEditor->Reorient(theIds);
1097 * Class : SMESHGUI_UnionOfTrianglesDlg
1098 * Description : Construction of quadrangles by automatic association of triangles
1101 SMESHGUI_UnionOfTrianglesDlg
1102 ::SMESHGUI_UnionOfTrianglesDlg(SMESHGUI* theModule,
1103 const char* theName):
1104 SMESHGUI_MultiEditDlg(theModule, SMESHGUI_TriaFilter, false, theName)
1106 setCaption(tr("CAPTION"));
1108 myComboBoxFunctor->setEnabled(true);
1109 myComboBoxFunctor->insertItem(tr("WARP_ELEMENTS")); // for quadrangles only
1110 myComboBoxFunctor->insertItem(tr("TAPER_ELEMENTS")); // for quadrangles only
1113 QGroupBox* aMaxAngleGrp = new QGroupBox (2, Qt::Horizontal, myCriterionGrp);
1114 aMaxAngleGrp->setInsideMargin(0);
1115 aMaxAngleGrp->setFrameStyle(QFrame::NoFrame);
1116 new QLabel (tr("MAXIMUM_ANGLE"), aMaxAngleGrp);
1117 myMaxAngleSpin = new SMESHGUI_SpinBox (aMaxAngleGrp);
1118 myMaxAngleSpin->RangeStepAndValidator(0, 180.0, 1.0, 3);
1119 myMaxAngleSpin->SetValue(30.0);
1121 myCriterionGrp->show();
1123 myHelpFileName = "uniting_set_of_triangles_page.html";
1126 SMESHGUI_UnionOfTrianglesDlg::~SMESHGUI_UnionOfTrianglesDlg()
1130 bool SMESHGUI_UnionOfTrianglesDlg::process (SMESH::SMESH_MeshEditor_ptr theEditor,
1131 const SMESH::long_array& theIds)
1133 SMESH::NumericalFunctor_var aCriterion = getNumericalFunctor();
1134 double aMaxAngle = myMaxAngleSpin->GetValue() * PI / 180.0;
1135 return theEditor->TriToQuad(theIds, aCriterion, aMaxAngle);
1140 * Class : SMESHGUI_CuttingOfQuadsDlg
1141 * Description : Automatic splitting of quadrangles into triangles
1144 SMESHGUI_CuttingOfQuadsDlg
1145 ::SMESHGUI_CuttingOfQuadsDlg(SMESHGUI* theModule,
1146 const char* theName):
1147 SMESHGUI_MultiEditDlg(theModule, SMESHGUI_QuadFilter, false, theName)
1149 setCaption(tr("CAPTION"));
1152 myPreviewChk = new QCheckBox (tr("PREVIEW"), mySelGrp);
1154 myCriterionGrp->show();
1155 myGroupChoice->show();
1156 myComboBoxFunctor->setEnabled(false);
1158 connect(myPreviewChk , SIGNAL(stateChanged(int)) , this, SLOT(onPreviewChk()));
1159 connect(myGroupChoice , SIGNAL(clicked(int)) , this, SLOT(onCriterionRB()));
1160 connect(myComboBoxFunctor, SIGNAL(activated(int)) , this, SLOT(onPreviewChk()));
1161 connect(this , SIGNAL(ListContensChanged()), this, SLOT(onPreviewChk()));
1163 myHelpFileName = "cutting_quadrangles_page.html";
1166 SMESHGUI_CuttingOfQuadsDlg::~SMESHGUI_CuttingOfQuadsDlg()
1170 void SMESHGUI_CuttingOfQuadsDlg::onClose()
1173 SMESHGUI_MultiEditDlg::onClose();
1176 bool SMESHGUI_CuttingOfQuadsDlg::process (SMESH::SMESH_MeshEditor_ptr theEditor,
1177 const SMESH::long_array& theIds)
1179 switch (myGroupChoice->id(myGroupChoice->selected())) {
1180 case 0: // use diagonal 1-3
1181 return theEditor->SplitQuad(theIds, true);
1182 case 1: // use diagonal 2-4
1183 return theEditor->SplitQuad(theIds, false);
1184 default: // use numeric functor
1188 SMESH::NumericalFunctor_var aCriterion = getNumericalFunctor();
1189 return theEditor->QuadToTri(theIds, aCriterion);
1192 void SMESHGUI_CuttingOfQuadsDlg::onCriterionRB()
1194 if (myGroupChoice->id(myGroupChoice->selected()) == 2) // Use numeric functor
1195 myComboBoxFunctor->setEnabled(true);
1197 myComboBoxFunctor->setEnabled(false);
1202 void SMESHGUI_CuttingOfQuadsDlg::onPreviewChk()
1204 myPreviewChk->isChecked() ? displayPreview() : erasePreview();
1207 void SMESHGUI_CuttingOfQuadsDlg::erasePreview()
1209 if (myPreviewActor == 0)
1212 if (SVTK_ViewWindow* vf = SMESH::GetCurrentVtkView()) {
1213 vf->RemoveActor(myPreviewActor);
1216 myPreviewActor->Delete();
1220 void SMESHGUI_CuttingOfQuadsDlg::displayPreview()
1225 if (myPreviewActor != 0)
1228 // get Ids of elements
1229 SMESH::long_array_var anElemIds = getIds();
1230 if (getIds()->length() == 0)
1233 SMDS_Mesh* aMesh = myActor->GetObject()->GetMesh();
1237 // 0 - use diagonal 1-3, 1 - use diagonal 2-4, 2 - use numerical functor
1238 int aChoice = myGroupChoice->id(myGroupChoice->selected());
1239 SMESH::NumericalFunctor_var aCriterion = SMESH::NumericalFunctor::_nil();
1240 SMESH::SMESH_MeshEditor_var aMeshEditor = SMESH::SMESH_MeshEditor::_nil();
1242 aCriterion = getNumericalFunctor();
1243 aMeshEditor = myMesh->GetMeshEditor();
1244 if (aMeshEditor->_is_nil())
1249 vtkUnstructuredGrid* aGrid = vtkUnstructuredGrid::New();
1251 vtkIdType aNbCells = anElemIds->length() * 2;
1252 vtkIdType aCellsSize = 4 * aNbCells;
1253 vtkCellArray* aConnectivity = vtkCellArray::New();
1254 aConnectivity->Allocate(aCellsSize, 0);
1256 vtkPoints* aPoints = vtkPoints::New();
1257 aPoints->SetNumberOfPoints(anElemIds->length() * 4);
1259 vtkUnsignedCharArray* aCellTypesArray = vtkUnsignedCharArray::New();
1260 aCellTypesArray->SetNumberOfComponents(1);
1261 aCellTypesArray->Allocate(aNbCells * aCellTypesArray->GetNumberOfComponents());
1263 vtkIdList *anIdList = vtkIdList::New();
1264 anIdList->SetNumberOfIds(3);
1266 TColStd_DataMapOfIntegerInteger anIdToVtk;
1270 for (int i = 0, n = anElemIds->length(); i < n; i++)
1272 const SMDS_MeshElement* anElem = aMesh->FindElement(anElemIds[ i ]);
1273 if (anElem == 0 || anElem->NbNodes() != 4)
1276 SMDS_ElemIteratorPtr anIter = anElem->nodesIterator();
1278 while (anIter->more()) {
1279 const SMDS_MeshNode* aNode = static_cast<const SMDS_MeshNode*>(anIter->next());
1282 if (!anIdToVtk.IsBound(aNode->GetID()))
1284 aPoints->SetPoint(++nbPoints, aNode->X(), aNode->Y(), aNode->Z());
1285 anIdToVtk.Bind(aNode->GetID(), nbPoints);
1288 aNodes[ k++ ] = aNode->GetID();
1295 bool isDiag13 = true;
1296 if (aChoice == 0) // use diagonal 1-3
1300 else if (aChoice == 1) // use diagonal 2-4
1304 else // use numerical functor
1306 // compare two sets of possible triangles
1307 int diag = aMeshEditor->BestSplit(anElemIds[i], aCriterion);
1308 if (diag == 1) // 1-3
1310 else if (diag == 2) // 2-4
1318 anIdList->SetId(0, anIdToVtk(aNodes[ 0 ]));
1319 anIdList->SetId(1, anIdToVtk(aNodes[ 1 ]));
1320 anIdList->SetId(2, anIdToVtk(aNodes[ 2 ]));
1321 aConnectivity->InsertNextCell(anIdList);
1322 aCellTypesArray->InsertNextValue(VTK_TRIANGLE);
1324 anIdList->SetId(0, anIdToVtk(aNodes[ 2 ]));
1325 anIdList->SetId(1, anIdToVtk(aNodes[ 3 ]));
1326 anIdList->SetId(2, anIdToVtk(aNodes[ 0 ]));
1327 aConnectivity->InsertNextCell(anIdList);
1328 aCellTypesArray->InsertNextValue(VTK_TRIANGLE);
1332 anIdList->SetId(0, anIdToVtk(aNodes[ 1 ]));
1333 anIdList->SetId(1, anIdToVtk(aNodes[ 2 ]));
1334 anIdList->SetId(2, anIdToVtk(aNodes[ 3 ]));
1335 aConnectivity->InsertNextCell(anIdList);
1336 aCellTypesArray->InsertNextValue(VTK_TRIANGLE);
1338 anIdList->SetId(0, anIdToVtk(aNodes[ 3 ]));
1339 anIdList->SetId(1, anIdToVtk(aNodes[ 0 ]));
1340 anIdList->SetId(2, anIdToVtk(aNodes[ 1 ]));
1341 aConnectivity->InsertNextCell(anIdList);
1342 aCellTypesArray->InsertNextValue(VTK_TRIANGLE);
1346 VTKViewer_CellLocationsArray* aCellLocationsArray = VTKViewer_CellLocationsArray::New();
1347 aCellLocationsArray->SetNumberOfComponents(1);
1348 aCellLocationsArray->SetNumberOfTuples(aNbCells);
1350 aConnectivity->InitTraversal();
1351 for(vtkIdType idType = 0, *pts, npts; aConnectivity->GetNextCell(npts, pts); idType++)
1352 aCellLocationsArray->SetValue(idType, aConnectivity->GetTraversalLocation(npts));
1354 aGrid->SetPoints(aPoints);
1355 aGrid->SetCells(aCellTypesArray, aCellLocationsArray,aConnectivity);
1357 // Create and display actor
1358 vtkDataSetMapper* aMapper = vtkDataSetMapper::New();
1359 aMapper->SetInput(aGrid);
1361 myPreviewActor = SALOME_Actor::New();
1362 myPreviewActor->PickableOff();
1363 myPreviewActor->SetMapper(aMapper);
1365 vtkProperty* aProp = vtkProperty::New();
1366 aProp->SetRepresentationToWireframe();
1367 aProp->SetColor(250, 0, 250);
1368 aProp->SetLineWidth(myActor->GetLineWidth() + 1);
1369 myPreviewActor->SetProperty(aProp);
1371 SMESH::GetCurrentVtkView()->AddActor(myPreviewActor);
1372 SMESH::GetCurrentVtkView()->Repaint();
1376 aConnectivity->Delete();
1380 aCellTypesArray->Delete();
1381 aCellLocationsArray->Delete();