1 // Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 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
22 // File : SMESHGUI_SymmetryDlg.cxx
23 // Author : Michael ZORIN, Open CASCADE S.A.S.
26 #include "SMESHGUI_SymmetryDlg.h"
29 #include "SMESHGUI_SpinBox.h"
30 #include "SMESHGUI_Utils.h"
31 #include "SMESHGUI_VTKUtils.h"
32 #include "SMESHGUI_MeshUtils.h"
33 #include "SMESHGUI_IdValidator.h"
34 #include "SMESHGUI_FilterDlg.h"
35 #include "SMESHGUI_MeshEditPreview.h"
37 #include <SMESH_Actor.h>
38 #include <SMESH_TypeFilter.hxx>
39 #include <SMESH_LogicalFilter.hxx>
40 #include <SMDS_Mesh.hxx>
42 // SALOME GUI includes
43 #include <SUIT_Desktop.h>
44 #include <SUIT_ResourceMgr.h>
45 #include <SUIT_Session.h>
46 #include <SUIT_MessageBox.h>
47 #include <SUIT_OverrideCursor.h>
49 #include <LightApp_Application.h>
50 #include <LightApp_SelectionMgr.h>
52 #include <SVTK_ViewModel.h>
53 #include <SVTK_ViewWindow.h>
54 #include <SALOME_ListIO.hxx>
55 #include <SALOME_ListIteratorOfListIO.hxx>
57 // SALOME KERNEL includes
58 #include <SALOMEDSClient.hxx>
59 #include <SALOMEDSClient_SObject.hxx>
62 #include <TColStd_MapOfInteger.hxx>
65 #include <QApplication>
66 #include <QButtonGroup>
70 #include <QPushButton>
71 #include <QRadioButton>
73 #include <QHBoxLayout>
74 #include <QVBoxLayout>
75 #include <QGridLayout>
79 #include <SALOMEconfig.h>
80 #include CORBA_SERVER_HEADER(SMESH_Group)
81 #include CORBA_SERVER_HEADER(SMESH_MeshEditor)
83 enum { MOVE_ELEMS_BUTTON = 0, COPY_ELEMS_BUTTON, MAKE_MESH_BUTTON }; //!< action type
88 //To disable automatic genericobj management, the following line should be commented.
89 //Otherwise, it should be uncommented. Refer to KERNEL_SRC/src/SALOMEDSImpl/SALOMEDSImpl_AttributeIOR.cxx
90 #define WITHGENERICOBJ
92 //=================================================================================
93 // class : SMESHGUI_SymmetryDlg()
95 //=================================================================================
97 SMESHGUI_SymmetryDlg::SMESHGUI_SymmetryDlg( SMESHGUI* theModule )
98 : SMESHGUI_MultiPreviewDlg( theModule ),
99 mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ),
102 QPixmap image0 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_SMESH_SYMMETRY_POINT")));
103 QPixmap image1 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_SMESH_SYMMETRY_AXIS")));
104 QPixmap image2 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_SMESH_SYMMETRY_PLANE")));
105 QPixmap image3 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_SELECT")));
108 setAttribute(Qt::WA_DeleteOnClose, true);
109 setWindowTitle(tr("SMESH_SYMMETRY"));
110 setSizeGripEnabled(true);
112 QVBoxLayout* SMESHGUI_SymmetryDlgLayout = new QVBoxLayout(this);
113 SMESHGUI_SymmetryDlgLayout->setSpacing(SPACING);
114 SMESHGUI_SymmetryDlgLayout->setMargin(MARGIN);
116 /***************************************************************/
117 ConstructorsBox = new QGroupBox(tr("SMESH_SYMMETRY"), this);
118 GroupConstructors = new QButtonGroup(this);
119 QHBoxLayout* ConstructorsBoxLayout = new QHBoxLayout(ConstructorsBox);
120 ConstructorsBoxLayout->setSpacing(SPACING);
121 ConstructorsBoxLayout->setMargin(MARGIN);
123 RadioButton1 = new QRadioButton(ConstructorsBox);
124 RadioButton1->setIcon(image0);
125 RadioButton2 = new QRadioButton(ConstructorsBox);
126 RadioButton2->setIcon(image1);
127 RadioButton3 = new QRadioButton(ConstructorsBox);
128 RadioButton3->setIcon(image2);
130 ConstructorsBoxLayout->addWidget(RadioButton1);
131 ConstructorsBoxLayout->addWidget(RadioButton2);
132 ConstructorsBoxLayout->addWidget(RadioButton3);
133 GroupConstructors->addButton(RadioButton1, 0);
134 GroupConstructors->addButton(RadioButton2, 1);
135 GroupConstructors->addButton(RadioButton3, 2);
137 /***************************************************************/
138 GroupArguments = new QGroupBox(tr("SMESH_ARGUMENTS"), this);
139 QGridLayout* GroupArgumentsLayout = new QGridLayout(GroupArguments);
140 GroupArgumentsLayout->setSpacing(SPACING);
141 GroupArgumentsLayout->setMargin(MARGIN);
143 myIdValidator = new SMESHGUI_IdValidator(this);
145 // Controls for elements selection
146 TextLabelElements = new QLabel(tr("SMESH_ID_ELEMENTS"), GroupArguments);
147 SelectElementsButton = new QPushButton(GroupArguments);
148 SelectElementsButton->setIcon(image3);
149 LineEditElements = new QLineEdit(GroupArguments);
150 LineEditElements->setValidator(myIdValidator);
151 LineEditElements->setMaxLength(-1);
152 myFilterBtn = new QPushButton( tr( "SMESH_BUT_FILTER" ), GroupArguments );
153 connect(myFilterBtn, SIGNAL(clicked()), this, SLOT(setFilters()));
155 // Control for the whole mesh selection
156 CheckBoxMesh = new QCheckBox(tr("SMESH_SELECT_WHOLE_MESH"), GroupArguments);
158 // Controls for mirror selection
159 GroupMirror = new QGroupBox(GroupArguments);
160 QGridLayout* GroupMirrorLayout = new QGridLayout(GroupMirror);
161 GroupMirrorLayout->setSpacing(SPACING);
162 GroupMirrorLayout->setMargin(MARGIN);
164 TextLabelPoint = new QLabel(tr("SMESH_POINT"), GroupMirror);
165 SelectPointButton = new QPushButton(GroupMirror);
166 SelectPointButton->setIcon(image3);
168 TextLabelX = new QLabel(tr("SMESH_X"), GroupMirror);
169 SpinBox_X = new SMESHGUI_SpinBox(GroupMirror);
170 TextLabelY = new QLabel(tr("SMESH_Y"), GroupMirror);
171 SpinBox_Y = new SMESHGUI_SpinBox(GroupMirror);
172 TextLabelZ = new QLabel(tr("SMESH_Z"), GroupMirror);
173 SpinBox_Z = new SMESHGUI_SpinBox(GroupMirror);
175 TextLabelVector = new QLabel(GroupMirror);
176 SelectVectorButton = new QPushButton(GroupMirror);
177 SelectVectorButton->setIcon(image3);
179 TextLabelDX = new QLabel(tr("SMESH_DX"), GroupMirror);
180 SpinBox_DX = new SMESHGUI_SpinBox(GroupMirror);
181 TextLabelDY = new QLabel(tr("SMESH_DY"), GroupMirror);
182 SpinBox_DY = new SMESHGUI_SpinBox(GroupMirror);
183 TextLabelDZ = new QLabel(tr("SMESH_DZ"), GroupMirror);
184 SpinBox_DZ = new SMESHGUI_SpinBox(GroupMirror);
186 GroupMirrorLayout->addWidget(TextLabelPoint, 0, 0);
187 GroupMirrorLayout->addWidget(SelectPointButton, 0, 1);
188 GroupMirrorLayout->addWidget(TextLabelX, 0, 2);
189 GroupMirrorLayout->addWidget(SpinBox_X, 0, 3);
190 GroupMirrorLayout->addWidget(TextLabelY, 0, 4);
191 GroupMirrorLayout->addWidget(SpinBox_Y, 0, 5);
192 GroupMirrorLayout->addWidget(TextLabelZ, 0, 6);
193 GroupMirrorLayout->addWidget(SpinBox_Z, 0, 7);
194 GroupMirrorLayout->addWidget(TextLabelVector, 1, 0);
195 GroupMirrorLayout->addWidget(SelectVectorButton, 1, 1);
196 GroupMirrorLayout->addWidget(TextLabelDX, 1, 2);
197 GroupMirrorLayout->addWidget(SpinBox_DX, 1, 3);
198 GroupMirrorLayout->addWidget(TextLabelDY, 1, 4);
199 GroupMirrorLayout->addWidget(SpinBox_DY, 1, 5);
200 GroupMirrorLayout->addWidget(TextLabelDZ, 1, 6);
201 GroupMirrorLayout->addWidget(SpinBox_DZ, 1, 7);
203 // switch of action type
204 ActionBox = new QGroupBox(GroupArguments);
205 ActionGroup = new QButtonGroup(GroupArguments);
206 QVBoxLayout* ActionBoxLayout = new QVBoxLayout(ActionBox);
207 ActionBoxLayout->addSpacing(SPACING);
208 ActionBoxLayout->setMargin(MARGIN);
210 QRadioButton* aMoveElements = new QRadioButton(tr("SMESH_MOVE_ELEMENTS"), ActionBox);
211 QRadioButton* aCopyElements = new QRadioButton(tr("SMESH_COPY_ELEMENTS"), ActionBox);
212 QRadioButton* aCreateMesh = new QRadioButton(tr("SMESH_CREATE_MESH"), ActionBox);
214 ActionBoxLayout->addWidget(aMoveElements);
215 ActionBoxLayout->addWidget(aCopyElements);
216 ActionBoxLayout->addWidget(aCreateMesh);
217 ActionGroup->addButton(aMoveElements, MOVE_ELEMS_BUTTON);
218 ActionGroup->addButton(aCopyElements, COPY_ELEMS_BUTTON);
219 ActionGroup->addButton(aCreateMesh, MAKE_MESH_BUTTON);
221 // CheckBox for groups generation
222 MakeGroupsCheck = new QCheckBox(tr("SMESH_MAKE_GROUPS"), GroupArguments);
223 MakeGroupsCheck->setChecked(false);
225 // Name of a mesh to create
226 LineEditNewMesh = new QLineEdit(GroupArguments);
230 myPreviewCheckBox = new QCheckBox(tr("PREVIEW"), GroupArguments);
233 GroupArgumentsLayout->addWidget(TextLabelElements, 0, 0);
234 GroupArgumentsLayout->addWidget(SelectElementsButton, 0, 1);
235 GroupArgumentsLayout->addWidget(LineEditElements, 0, 2, 1, 1);
236 GroupArgumentsLayout->addWidget(myFilterBtn, 0, 3);
237 GroupArgumentsLayout->addWidget(CheckBoxMesh, 1, 0, 1, 4);
238 GroupArgumentsLayout->addWidget(GroupMirror, 2, 0, 1, 4);
239 GroupArgumentsLayout->addWidget(ActionBox, 3, 0, 3, 3);
240 GroupArgumentsLayout->addWidget(MakeGroupsCheck, 4, 3);
241 GroupArgumentsLayout->addWidget(LineEditNewMesh, 5, 3);
242 GroupArgumentsLayout->addWidget(myPreviewCheckBox, 6, 0);
244 /***************************************************************/
245 GroupButtons = new QGroupBox(this);
246 QHBoxLayout* GroupButtonsLayout = new QHBoxLayout(GroupButtons);
247 GroupButtonsLayout->setSpacing(SPACING);
248 GroupButtonsLayout->setMargin(MARGIN);
250 buttonOk = new QPushButton(tr("SMESH_BUT_APPLY_AND_CLOSE"), GroupButtons);
251 buttonOk->setAutoDefault(true);
252 buttonOk->setDefault(true);
253 buttonApply = new QPushButton(tr("SMESH_BUT_APPLY"), GroupButtons);
254 buttonApply->setAutoDefault(true);
255 buttonCancel = new QPushButton(tr("SMESH_BUT_CLOSE"), GroupButtons);
256 buttonCancel->setAutoDefault(true);
257 buttonHelp = new QPushButton(tr("SMESH_BUT_HELP"), GroupButtons);
258 buttonHelp->setAutoDefault(true);
260 GroupButtonsLayout->addWidget(buttonOk);
261 GroupButtonsLayout->addSpacing(10);
262 GroupButtonsLayout->addWidget(buttonApply);
263 GroupButtonsLayout->addSpacing(10);
264 GroupButtonsLayout->addStretch();
265 GroupButtonsLayout->addWidget(buttonCancel);
266 GroupButtonsLayout->addWidget(buttonHelp);
268 /***************************************************************/
269 SMESHGUI_SymmetryDlgLayout->addWidget(ConstructorsBox);
270 SMESHGUI_SymmetryDlgLayout->addWidget(GroupArguments);
271 SMESHGUI_SymmetryDlgLayout->addWidget(GroupButtons);
273 /* Initialisations */
274 SpinBox_X->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision");
275 SpinBox_Y->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision");
276 SpinBox_Z->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision");
277 SpinBox_DX->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision");
278 SpinBox_DY->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision");
279 SpinBox_DZ->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision");
281 RadioButton1->setChecked(true);
283 mySelector = (SMESH::GetViewWindow( mySMESHGUI ))->GetSelector();
285 mySMESHGUI->SetActiveDialogBox((QDialog*)this);
287 // Costruction of the logical filter
288 SMESH_TypeFilter* aMeshOrSubMeshFilter = new SMESH_TypeFilter (SMESH::MESHorSUBMESH);
289 SMESH_TypeFilter* aSmeshGroupFilter = new SMESH_TypeFilter (SMESH::GROUP);
291 QList<SUIT_SelectionFilter*> aListOfFilters;
292 if (aMeshOrSubMeshFilter) aListOfFilters.append(aMeshOrSubMeshFilter);
293 if (aSmeshGroupFilter) aListOfFilters.append(aSmeshGroupFilter);
295 myMeshOrSubMeshOrGroupFilter =
296 new SMESH_LogicalFilter (aListOfFilters, SMESH_LogicalFilter::LO_OR);
298 myHelpFileName = "symmetry_page.html";
302 /* signals and slots connections */
303 connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk()));
304 connect(buttonCancel, SIGNAL(clicked()), this, SLOT(reject()));
305 connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply()));
306 connect(buttonHelp, SIGNAL(clicked()), this, SLOT(ClickOnHelp()));
307 connect(GroupConstructors, SIGNAL(buttonClicked(int)), SLOT(ConstructorsClicked(int)));
309 connect(SelectElementsButton, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
310 connect(SelectPointButton, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
311 connect(SelectVectorButton, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
313 connect(SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(onVectorChanged()));
314 connect(SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(onVectorChanged()));
315 connect(SpinBox_DZ, SIGNAL(valueChanged(double)), this, SLOT(onVectorChanged()));
317 connect(mySMESHGUI, SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog()));
318 connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
319 /* to close dialog if study change */
320 connect(mySMESHGUI, SIGNAL(SignalCloseAllDialogs()), this, SLOT(reject()));
321 connect(LineEditElements, SIGNAL(textChanged(const QString&)), SLOT(onTextChange(const QString&)));
322 connect(CheckBoxMesh, SIGNAL(toggled(bool)), SLOT(onSelectMesh(bool)));
323 connect(ActionGroup, SIGNAL(buttonClicked(int)), SLOT(onActionClicked(int)));
325 connect(SpinBox_X, SIGNAL(valueChanged(double)), this, SLOT(toDisplaySimulation()));
326 connect(SpinBox_Y, SIGNAL(valueChanged(double)), this, SLOT(toDisplaySimulation()));
327 connect(SpinBox_Z, SIGNAL(valueChanged(double)), this, SLOT(toDisplaySimulation()));
328 connect(SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(toDisplaySimulation()));
329 connect(SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(toDisplaySimulation()));
330 connect(SpinBox_DZ, SIGNAL(valueChanged(double)), this, SLOT(toDisplaySimulation()));
332 //To Connect preview check box
333 connectPreviewControl();
335 ConstructorsClicked(0);
336 SelectionIntoArgument();
337 onActionClicked(MOVE_ELEMS_BUTTON);
340 //=================================================================================
341 // function : ~SMESHGUI_SymmetryDlg()
342 // purpose : Destroys the object and frees any allocated resources
343 //=================================================================================
344 SMESHGUI_SymmetryDlg::~SMESHGUI_SymmetryDlg()
346 if ( myFilterDlg != 0 ) {
347 myFilterDlg->setParent( 0 );
352 //=================================================================================
355 //=================================================================================
356 void SMESHGUI_SymmetryDlg::Init (bool ResetControls)
361 myObjectsNames.clear();
363 myEditCurrentArgument = 0;
364 LineEditElements->clear();
368 buttonOk->setEnabled(false);
369 buttonApply->setEnabled(false);
374 SpinBox_X->SetValue(0.0);
375 SpinBox_Y->SetValue(0.0);
376 SpinBox_Z->SetValue(0.0);
377 SpinBox_DX->SetValue(0.0);
378 SpinBox_DY->SetValue(0.0);
379 SpinBox_DZ->SetValue(0.0);
381 ActionGroup->button( MOVE_ELEMS_BUTTON )->setChecked(true);
382 CheckBoxMesh->setChecked(false);
383 myPreviewCheckBox->setChecked(false);
384 onDisplaySimulation(false);
386 // MakeGroupsCheck->setChecked(false);
387 // MakeGroupsCheck->setEnabled(false);
392 //=================================================================================
393 // function : ConstructorsClicked()
394 // purpose : Radio button management
395 //=================================================================================
396 void SMESHGUI_SymmetryDlg::ConstructorsClicked (int constructorId)
398 disconnect(mySelectionMgr, 0, this, 0);
400 if (constructorId != 0 && !TextLabelVector->isVisible()) {
401 TextLabelVector->show();
402 SelectVectorButton->show();
411 switch (constructorId) {
414 GroupMirror->setTitle(tr("SMESH_POINT"));
416 TextLabelVector->hide();
417 SelectVectorButton->hide();
428 GroupMirror->setTitle(tr("SMESH_AXIS"));
429 TextLabelVector->setText(tr("SMESH_VECTOR"));
434 GroupMirror->setTitle(tr("SMESH_PLANE"));
435 TextLabelVector->setText(tr("SMESH_NORMAL"));
440 if (myEditCurrentArgument != (QWidget*)LineEditElements) {
441 SMESH::SetPointRepresentation(false);
442 if (!CheckBoxMesh->isChecked())
444 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
445 aViewWindow->SetSelectionMode(CellSelection);
449 myEditCurrentArgument = (QWidget*)LineEditElements;
450 LineEditElements->setFocus();
452 if (CheckBoxMesh->isChecked())
455 connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
457 onDisplaySimulation(true);
459 QApplication::instance()->processEvents();
464 //=================================================================================
465 // function : ClickOnApply()
467 //=================================================================================
468 bool SMESHGUI_SymmetryDlg::ClickOnApply()
470 if (mySMESHGUI->isActiveStudyLocked())
476 if (myNbOkElements && IsMirrorOk()) {
477 QStringList aListElementsId = myElementsId.split(" ", QString::SkipEmptyParts);
479 SMESH::long_array_var anElementsId = new SMESH::long_array;
481 anElementsId->length(aListElementsId.count());
482 for (int i = 0; i < aListElementsId.count(); i++)
483 anElementsId[i] = aListElementsId[i].toInt();
485 SMESH::AxisStruct aMirror;
486 SMESH::SMESH_MeshEditor::MirrorType aMirrorType;
487 getMirror(aMirror,aMirrorType);
489 QStringList aParameters;
490 aParameters << SpinBox_X->text();
491 aParameters << SpinBox_Y->text();
492 aParameters << SpinBox_Z->text();
493 aParameters << ( GetConstructorId() == 0 ? QString::number(0) : SpinBox_DX->text() );
494 aParameters << ( GetConstructorId() == 0 ? QString::number(0) : SpinBox_DY->text() );
495 aParameters << ( GetConstructorId() == 0 ? QString::number(0) : SpinBox_DZ->text() );
497 int actionButton = ActionGroup->checkedId();
498 bool makeGroups = ( MakeGroupsCheck->isEnabled() && MakeGroupsCheck->isChecked() );
499 QStringList anEntryList;
501 SUIT_OverrideCursor aWaitCursor;
503 switch ( actionButton ) {
504 case MOVE_ELEMS_BUTTON: {
505 if(CheckBoxMesh->isChecked())
506 for ( int i = 0; i < myObjects.count(); i++ ) {
507 SMESH::SMESH_MeshEditor_var aMeshEditor = myMeshes[i]->GetMeshEditor();
508 myMeshes[i]->SetParameters(aParameters.join( ":" ).toLatin1().constData());
509 aMeshEditor->MirrorObject(myObjects[i], aMirror, aMirrorType, false );
512 SMESH::SMESH_MeshEditor_var aMeshEditor = myMeshes[0]->GetMeshEditor();
513 myMeshes[0]->SetParameters(aParameters.join( ":" ).toLatin1().constData());
514 aMeshEditor->Mirror(anElementsId, aMirror, aMirrorType, false );
518 case COPY_ELEMS_BUTTON: {
519 SMESH::ListOfGroups_var groups;
521 if(CheckBoxMesh->isChecked())
522 for ( int i = 0; i < myObjects.count(); i++ ) {
523 SMESH::SMESH_MeshEditor_var aMeshEditor = myMeshes[i]->GetMeshEditor();
524 myMeshes[i]->SetParameters(aParameters.join( ":" ).toLatin1().constData());
525 groups = aMeshEditor->MirrorObjectMakeGroups(myObjects[i], aMirror, aMirrorType);
528 SMESH::SMESH_MeshEditor_var aMeshEditor = myMeshes[0]->GetMeshEditor();
529 myMeshes[0]->SetParameters(aParameters.join( ":" ).toLatin1().constData());
530 groups = aMeshEditor->MirrorMakeGroups(anElementsId, aMirror, aMirrorType);
534 if(CheckBoxMesh->isChecked())
535 for ( int i = 0; i < myObjects.count(); i++ ) {
536 SMESH::SMESH_MeshEditor_var aMeshEditor = myMeshes[i]->GetMeshEditor();
537 myMeshes[i]->SetParameters(aParameters.join( ":" ).toLatin1().constData());
538 aMeshEditor->MirrorObject(myObjects[i], aMirror, aMirrorType, true);
541 SMESH::SMESH_MeshEditor_var aMeshEditor = myMeshes[0]->GetMeshEditor();
542 myMeshes[0]->SetParameters(aParameters.join( ":" ).toLatin1().constData());
543 aMeshEditor->Mirror(anElementsId, aMirror, aMirrorType, true);
548 case MAKE_MESH_BUTTON: {
549 SMESH::SMESH_Mesh_var mesh;
550 if (CheckBoxMesh->isChecked())
551 for ( int i = 0; i < myObjects.count(); i++ ) {
552 QString aName = SMESH::UniqueMeshName( LineEditNewMesh->text().replace( "*", myObjectsNames[i] ) );
553 SMESH::SMESH_MeshEditor_var aMeshEditor = myMeshes[i]->GetMeshEditor();
554 myMeshes[i]->SetParameters(aParameters.join( ":" ).toLatin1().constData());
555 mesh = aMeshEditor->MirrorObjectMakeMesh(myObjects[i], aMirror, aMirrorType, makeGroups,
556 aName.toLatin1().data());
557 if( _PTR(SObject) aSObject = SMESH::ObjectToSObject( mesh ) )
558 anEntryList.append( aSObject->GetID().c_str() );
559 #ifdef WITHGENERICOBJ
560 // obj has been published in study. Its refcount has been incremented.
561 // It is safe to decrement its refcount
562 // so that it will be destroyed when the entry in study will be removed
567 SMESH::SMESH_MeshEditor_var aMeshEditor = myMeshes[0]->GetMeshEditor();
568 myMeshes[0]->SetParameters(aParameters.join( ":" ).toLatin1().constData());
569 mesh = aMeshEditor->MirrorMakeMesh(anElementsId, aMirror, aMirrorType, makeGroups,
570 LineEditNewMesh->text().toLatin1().data());
571 if( _PTR(SObject) aSObject = SMESH::ObjectToSObject( mesh ) )
572 anEntryList.append( aSObject->GetID().c_str() );
573 #ifdef WITHGENERICOBJ
574 // obj has been published in study. Its refcount has been incremented.
575 // It is safe to decrement its refcount
576 // so that it will be destroyed when the entry in study will be removed
586 for ( int i = 0; i < myMeshes.count(); i++ )
587 SMESH::Update( (SMESH::FindActorByObject( myMeshes[i] ))->getIO(), true );
589 if ( ( MakeGroupsCheck->isEnabled() && MakeGroupsCheck->isChecked() ) ||
590 actionButton == MAKE_MESH_BUTTON ) {
591 mySMESHGUI->updateObjBrowser(true); // new groups may appear
592 if( LightApp_Application* anApp =
593 dynamic_cast<LightApp_Application*>( SUIT_Session::session()->activeApplication() ) )
594 anApp->browseObjects( anEntryList, isApplyAndClose() );
597 ConstructorsClicked(GetConstructorId());
598 SelectionIntoArgument();
600 SMESHGUI::Modified();
605 //=================================================================================
606 // function : ClickOnOk()
608 //=================================================================================
609 void SMESHGUI_SymmetryDlg::ClickOnOk()
611 setIsApplyAndClose( true );
616 //=================================================================================
617 // function : reject()
619 //=================================================================================
620 void SMESHGUI_SymmetryDlg::reject()
622 disconnect(mySelectionMgr, 0, this, 0);
623 mySelectionMgr->clearFilters();
624 //mySelectionMgr->clearSelected();
625 if (SMESH::GetCurrentVtkView()) {
626 SMESH::RemoveFilters(); // PAL6938 -- clean all mesh entity filters
627 SMESH::SetPointRepresentation(false);
629 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
630 aViewWindow->SetSelectionMode(ActorSelection);
631 mySMESHGUI->ResetState();
635 //=================================================================================
636 // function : ClickOnHelp()
638 //=================================================================================
639 void SMESHGUI_SymmetryDlg::ClickOnHelp()
641 LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication());
643 app->onHelpContextModule(mySMESHGUI ? app->moduleName(mySMESHGUI->moduleName()) : QString(""), myHelpFileName);
647 platform = "winapplication";
649 platform = "application";
651 SUIT_MessageBox::warning(this, tr("WRN_WARNING"),
652 tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
653 arg(app->resourceMgr()->stringValue("ExternalBrowser",
655 arg(myHelpFileName));
659 //=======================================================================
660 // function : onTextChange()
662 //=======================================================================
663 void SMESHGUI_SymmetryDlg::onTextChange (const QString& theNewText)
665 QLineEdit* send = (QLineEdit*)sender();
670 if (send == LineEditElements)
673 buttonOk->setEnabled(false);
674 buttonApply->setEnabled(false);
676 // hilight entered elements
677 SMDS_Mesh* aMesh = 0;
679 aMesh = myActor->GetObject()->GetMesh();
682 Handle(SALOME_InteractiveObject) anIO = myActor->getIO();
684 TColStd_MapOfInteger newIndices;
686 QStringList aListId = theNewText.split(" ", QString::SkipEmptyParts);
688 if (send == LineEditElements) {
689 for (int i = 0; i < aListId.count(); i++) {
690 const SMDS_MeshElement * e = aMesh->FindElement(aListId[ i ].toInt());
692 newIndices.Add(e->GetID());
696 mySelector->AddOrRemoveIndex( anIO, newIndices, false );
697 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
698 aViewWindow->highlight( anIO, true, true );
700 myElementsId = theNewText;
704 if (myNbOkElements && IsMirrorOk()) {
705 buttonOk->setEnabled(true);
706 buttonApply->setEnabled(true);
712 //=================================================================================
713 // function : SelectionIntoArgument()
714 // purpose : Called when selection as changed or other case
715 //=================================================================================
716 void SMESHGUI_SymmetryDlg::SelectionIntoArgument()
722 QString aString = "";
723 onDisplaySimulation(false);
726 if (myEditCurrentArgument == (QWidget*)LineEditElements) {
727 LineEditElements->setText(aString);
729 buttonOk->setEnabled(false);
730 buttonApply->setEnabled(false);
734 if (!GroupButtons->isEnabled()) // inactive
739 mySelectionMgr->selectedObjects(aList,SVTK_Viewer::Type());
741 int nbSel = aList.Extent();
747 if (myEditCurrentArgument == (QWidget*)LineEditElements) {
750 myObjectsNames.clear();
753 for ( SALOME_ListIteratorOfListIO it( aList ); it.More(); it.Next() ) {
754 Handle(SALOME_InteractiveObject) IO = it.Value();
756 SMESH::SMESH_Mesh_var aMesh = SMESH::GetMeshByIO( IO );
757 if( aMesh->_is_nil() )
760 myActor = SMESH::FindActorByObject( aMesh );
762 myActor = SMESH::FindActorByEntry( IO->getEntry() );
763 if ( !myActor && !CheckBoxMesh->isChecked() )
766 if ( !SMESH::IObjectToInterface<SMESH::SMESH_IDSource>( IO )->_is_nil() ) {
767 if ( _PTR(Study) aStudy = SMESH::GetActiveStudyDocument() ) {
768 _PTR(SObject) obj = aStudy->FindObjectID( qPrintable( QString( IO->getEntry() ) ) );
769 _PTR(GenericAttribute) anAttr;
770 if ( obj && obj->FindAttribute( anAttr, "AttributeName" ) ) {
771 _PTR(AttributeName) aNameAttr( anAttr );
772 myObjects << SMESH::IObjectToInterface<SMESH::SMESH_IDSource>( IO );
773 myObjectsNames << aNameAttr->Value().c_str();
780 // MakeGroups is available if there are groups and "Copy"
782 for ( int i = 0; i < myMeshes.count(); i++ )
783 aNbGroups += myMeshes[i]->NbGroups();
785 if ( aNbGroups == 0 ) {
786 MakeGroupsCheck->setChecked(false);
787 MakeGroupsCheck->setEnabled(false);
789 else if ( ActionGroup->checkedId() != MOVE_ELEMS_BUTTON ) {
790 MakeGroupsCheck->setEnabled(true);
792 if (CheckBoxMesh->isChecked()) {
793 SMESH::GetNameOfSelectedIObjects(mySelectionMgr, aString);
795 if ( myObjects.isEmpty() )
799 SMDS_Mesh* aSMDSMesh = myActor->GetObject()->GetMesh();
803 for (int i = aSMDSMesh->MinElementID(); i <= aSMDSMesh->MaxElementID(); i++) {
804 const SMDS_MeshElement * e = aSMDSMesh->FindElement(i);
806 myElementsId += QString(" %1").arg(i);
810 } else if (!SMESH::IObjectToInterface<SMESH::SMESH_subMesh>(IO)->_is_nil()) { //SUBMESH
812 SMESH::SMESH_subMesh_var aSubMesh = SMESH::IObjectToInterface<SMESH::SMESH_subMesh>(IO);
814 // get IDs from submesh
816 SMESH::long_array_var anElementsIds = new SMESH::long_array;
817 anElementsIds = aSubMesh->GetElementsId();
818 for (int i = 0; i < anElementsIds->length(); i++) {
819 myElementsId += QString(" %1").arg(anElementsIds[i]);
821 aNbUnits = anElementsIds->length();
824 SMESH::SMESH_GroupBase_var aGroup =
825 SMESH::IObjectToInterface<SMESH::SMESH_GroupBase>(IO);
826 if (aGroup->_is_nil())
829 // get IDs from smesh group
830 SMESH::long_array_var anElementsIds = new SMESH::long_array;
831 anElementsIds = aGroup->GetListOfID();
832 for (int i = 0; i < anElementsIds->length(); i++) {
833 myElementsId += QString(" %1").arg(anElementsIds[i]);
835 aNbUnits = anElementsIds->length();
839 aNbUnits = SMESH::GetNameOfSelectedElements( mySelector, aList.First(), aString);
840 myElementsId = aString;
845 myNbOkElements = true;
847 Handle(SALOME_InteractiveObject) IO = aList.First();
848 if ((SMESH::GetMeshByIO(IO))->_is_nil())
851 SMESH_Actor* anActor = SMESH::FindActorByObject(SMESH::GetMeshByIO(IO));
853 anActor = SMESH::FindActorByEntry(IO->getEntry());
854 if (!anActor && !CheckBoxMesh->isChecked())
857 aNbUnits = SMESH::GetNameOfSelectedNodes(mySelector, IO, aString);
861 SMDS_Mesh* aMesh = anActor->GetObject()->GetMesh();
865 const SMDS_MeshNode * n = aMesh->FindNode(aString.toInt());
873 if (myEditCurrentArgument == (QWidget*)SpinBox_X) {
874 SpinBox_X->SetValue(x);
875 SpinBox_Y->SetValue(y);
876 SpinBox_Z->SetValue(z);
877 } else if (myEditCurrentArgument == (QWidget*)SpinBox_DX) {
878 SpinBox_DX->SetValue(x - SpinBox_X->GetValue());
879 SpinBox_DY->SetValue(y - SpinBox_Y->GetValue());
880 SpinBox_DZ->SetValue(z - SpinBox_Z->GetValue());
885 if (myEditCurrentArgument == (QWidget*)LineEditElements) {
886 LineEditElements->setText(aString);
887 LineEditElements->repaint();
888 LineEditElements->setEnabled(false); // to update lineedit IPAL 19809
889 LineEditElements->setEnabled(true);
895 if (myNbOkElements && IsMirrorOk()) {
896 buttonOk->setEnabled(true);
897 buttonApply->setEnabled(true);
899 onDisplaySimulation(true);
902 //=================================================================================
903 // function : SetEditCurrentArgument()
905 //=================================================================================
906 void SMESHGUI_SymmetryDlg::SetEditCurrentArgument()
908 QPushButton* send = (QPushButton*)sender();
910 disconnect(mySelectionMgr, 0, this, 0);
911 mySelectionMgr->clearSelected();
912 mySelectionMgr->clearFilters();
914 if (send == SelectElementsButton) {
915 myEditCurrentArgument = (QWidget*)LineEditElements;
916 SMESH::SetPointRepresentation(false);
917 if (CheckBoxMesh->isChecked()) {
918 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
919 aViewWindow->SetSelectionMode(ActorSelection);
920 mySelectionMgr->installFilter(myMeshOrSubMeshOrGroupFilter);
922 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
923 aViewWindow->SetSelectionMode(CellSelection);
925 } else if (send == SelectPointButton) {
926 myEditCurrentArgument = (QWidget*)SpinBox_X;
927 SMESH::SetPointRepresentation(true);
928 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
929 aViewWindow->SetSelectionMode(NodeSelection);
930 } else if (send == SelectVectorButton) {
931 myEditCurrentArgument = (QWidget*)SpinBox_DX;
932 SMESH::SetPointRepresentation(true);
934 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
935 aViewWindow->SetSelectionMode(NodeSelection);
939 myEditCurrentArgument->setFocus();
940 connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
941 SelectionIntoArgument();
944 //=================================================================================
945 // function : DeactivateActiveDialog()
947 //=================================================================================
948 void SMESHGUI_SymmetryDlg::DeactivateActiveDialog()
950 if (ConstructorsBox->isEnabled()) {
951 ConstructorsBox->setEnabled(false);
952 GroupArguments->setEnabled(false);
953 GroupButtons->setEnabled(false);
954 mySMESHGUI->ResetState();
955 mySMESHGUI->SetActiveDialogBox(0);
959 //=================================================================================
960 // function : ActivateThisDialog()
962 //=================================================================================
963 void SMESHGUI_SymmetryDlg::ActivateThisDialog()
965 /* Emit a signal to deactivate the active dialog */
966 mySMESHGUI->EmitSignalDeactivateDialog();
967 ConstructorsBox->setEnabled(true);
968 GroupArguments->setEnabled(true);
969 GroupButtons->setEnabled(true);
971 mySMESHGUI->SetActiveDialogBox((QDialog*)this);
973 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
974 aViewWindow->SetSelectionMode(CellSelection);
975 SelectionIntoArgument();
978 //=================================================================================
979 // function : enterEvent()
981 //=================================================================================
982 void SMESHGUI_SymmetryDlg::enterEvent (QEvent*)
984 if (!ConstructorsBox->isEnabled())
985 ActivateThisDialog();
988 //=======================================================================
989 //function : onSelectMesh
991 //=======================================================================
992 void SMESHGUI_SymmetryDlg::onSelectMesh (bool toSelectMesh)
995 TextLabelElements->setText(tr("SMESH_NAME"));
997 TextLabelElements->setText(tr("SMESH_ID_ELEMENTS"));
998 myFilterBtn->setEnabled(!toSelectMesh);
1000 if (myEditCurrentArgument != LineEditElements) {
1001 LineEditElements->clear();
1005 mySelectionMgr->clearFilters();
1006 SMESH::SetPointRepresentation(false);
1009 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
1010 aViewWindow->SetSelectionMode(ActorSelection);
1011 mySelectionMgr->installFilter(myMeshOrSubMeshOrGroupFilter);
1012 LineEditElements->setReadOnly(true);
1013 LineEditElements->setValidator(0);
1015 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
1016 aViewWindow->SetSelectionMode(CellSelection);
1017 LineEditElements->setReadOnly(false);
1018 LineEditElements->setValidator(myIdValidator);
1019 onTextChange(LineEditElements->text());
1023 SelectionIntoArgument();
1026 //=================================================================================
1027 // function : GetConstructorId()
1029 //=================================================================================
1030 int SMESHGUI_SymmetryDlg::GetConstructorId()
1032 return GroupConstructors->checkedId();
1035 //=================================================================================
1036 // function : IsMirrorOk()
1038 //=================================================================================
1039 bool SMESHGUI_SymmetryDlg::IsMirrorOk()
1043 if (GetConstructorId() != 0)
1044 isOk = (SpinBox_DX->GetValue() != 0 ||
1045 SpinBox_DY->GetValue() != 0 ||
1046 SpinBox_DZ->GetValue() != 0);
1051 //=================================================================================
1052 // function : onVectorChanged()
1054 //=================================================================================
1055 void SMESHGUI_SymmetryDlg::onVectorChanged()
1058 buttonOk->setEnabled(true);
1059 buttonApply->setEnabled(true);
1061 buttonOk->setEnabled(false);
1062 buttonApply->setEnabled(false);
1066 //=======================================================================
1067 //function : onActionClicked
1068 //purpose : slot called when an action type changed
1069 //=======================================================================
1071 void SMESHGUI_SymmetryDlg::onActionClicked(int button)
1074 for ( int i = 0; i < myMeshes.count(); i++ )
1075 aNbGroups += myMeshes[i]->NbGroups();
1078 case MOVE_ELEMS_BUTTON:
1079 MakeGroupsCheck->setEnabled(false);
1080 LineEditNewMesh->setEnabled(false);
1082 case COPY_ELEMS_BUTTON:
1083 LineEditNewMesh->setEnabled(false);
1084 MakeGroupsCheck->setText( tr("SMESH_MAKE_GROUPS"));
1085 MakeGroupsCheck->setEnabled(myMeshes.isEmpty() || aNbGroups > 0);
1087 case MAKE_MESH_BUTTON:
1088 LineEditNewMesh->setEnabled(true);
1089 MakeGroupsCheck->setText( tr("SMESH_COPY_GROUPS"));
1090 MakeGroupsCheck->setEnabled(myMeshes.isEmpty() || aNbGroups > 0);
1094 toDisplaySimulation();
1097 //=======================================================================
1098 //function : setNewMeshName
1099 //purpose : update contents of LineEditNewMesh
1100 //=======================================================================
1102 void SMESHGUI_SymmetryDlg::setNewMeshName()
1104 LineEditNewMesh->setText("");
1105 if ( LineEditNewMesh->isEnabled() && !myMeshes.isEmpty() ) {
1107 if ( CheckBoxMesh->isChecked() ) {
1108 name = myObjects.count() > 1 ? "*" : LineEditElements->text();
1111 _PTR(SObject) meshSO = SMESH::FindSObject( myMeshes[0] );
1112 name = meshSO->GetName().c_str();
1114 if ( !name.isEmpty() )
1115 LineEditNewMesh->setText( SMESH::UniqueMeshName( name, "mirrored"));
1119 //=================================================================================
1120 // function : keyPressEvent()
1122 //=================================================================================
1123 void SMESHGUI_SymmetryDlg::keyPressEvent( QKeyEvent* e )
1125 QDialog::keyPressEvent( e );
1126 if ( e->isAccepted() )
1129 if ( e->key() == Qt::Key_F1 ) {
1135 //=================================================================================
1136 // function : setFilters()
1137 // purpose : SLOT. Called when "Filter" button pressed.
1138 //=================================================================================
1139 void SMESHGUI_SymmetryDlg::setFilters()
1141 if(myMeshes.isEmpty()) {
1142 SUIT_MessageBox::critical(this,
1144 tr("NO_MESH_SELECTED"));
1148 myFilterDlg = new SMESHGUI_FilterDlg( mySMESHGUI, SMESH::ALL );
1150 myFilterDlg->SetSelection();
1151 myFilterDlg->SetMesh( myMeshes[0] );
1152 myFilterDlg->SetSourceWg( LineEditElements );
1154 myFilterDlg->show();
1157 //=================================================================================
1158 // function : isValid
1160 //=================================================================================
1161 bool SMESHGUI_SymmetryDlg::isValid()
1166 ok = SpinBox_X->isValid( msg, true ) && ok;
1167 ok = SpinBox_Y->isValid( msg, true ) && ok;
1168 ok = SpinBox_Z->isValid( msg, true ) && ok;
1169 if (GetConstructorId() != 0) {
1170 ok = SpinBox_DX->isValid( msg, true ) && ok;
1171 ok = SpinBox_DY->isValid( msg, true ) && ok;
1172 ok = SpinBox_DZ->isValid( msg, true ) && ok;
1176 QString str( tr( "SMESH_INCORRECT_INPUT" ) );
1177 if ( !msg.isEmpty() )
1179 SUIT_MessageBox::critical( this, tr( "SMESH_ERROR" ), str );
1185 //=================================================================================
1186 // function : onDisplaySimulation
1187 // purpose : Show/Hide preview
1188 //=================================================================================
1189 void SMESHGUI_SymmetryDlg::onDisplaySimulation( bool toDisplayPreview ) {
1190 if (myPreviewCheckBox->isChecked() && toDisplayPreview) {
1191 if ( myNbOkElements && isValid() && IsMirrorOk() ) {
1192 QStringList aListElementsId = myElementsId.split(" ", QString::SkipEmptyParts);
1193 SMESH::long_array_var anElementsId = new SMESH::long_array;
1195 anElementsId->length(aListElementsId.count());
1196 for (int i = 0; i < aListElementsId.count(); i++)
1197 anElementsId[i] = aListElementsId[i].toInt();
1199 SMESH::AxisStruct aMirror;
1200 SMESH::SMESH_MeshEditor::MirrorType aMirrorType;
1202 getMirror(aMirror,aMirrorType);
1205 bool copy = ( ActionGroup->checkedId() == COPY_ELEMS_BUTTON ||
1206 ActionGroup->checkedId() == MAKE_MESH_BUTTON );
1207 SUIT_OverrideCursor aWaitCursor;
1208 QList<SMESH::MeshPreviewStruct_var> aMeshPreviewStruct;
1209 if(CheckBoxMesh->isChecked())
1210 for ( int i = 0; i < myMeshes.count(); i++ ) {
1211 SMESH::SMESH_MeshEditor_var aMeshEditor = myMeshes[i]->GetMeshEditPreviewer();
1212 aMeshEditor->MirrorObject(myObjects[i], aMirror, aMirrorType, copy );
1213 aMeshPreviewStruct << aMeshEditor->GetPreviewData();
1216 SMESH::SMESH_MeshEditor_var aMeshEditor = myMeshes[0]->GetMeshEditPreviewer();
1217 aMeshEditor->Mirror(anElementsId, aMirror, aMirrorType, copy );
1218 aMeshPreviewStruct << aMeshEditor->GetPreviewData();
1220 setSimulationPreview(aMeshPreviewStruct);
1232 //=================================================================================
1233 // function : getMirror
1234 // purpose : return mirror parameters
1235 //=================================================================================
1236 void SMESHGUI_SymmetryDlg::getMirror(SMESH::AxisStruct& theMirror, SMESH::SMESH_MeshEditor::MirrorType& theMirrorType) {
1237 theMirror.x = SpinBox_X->GetValue();
1238 theMirror.y = SpinBox_Y->GetValue();
1239 theMirror.z = SpinBox_Z->GetValue();
1240 if (GetConstructorId() == 0) {
1241 theMirror.vx = theMirror.vy = theMirror.vz = 0;
1243 theMirror.vx = SpinBox_DX->GetValue();
1244 theMirror.vy = SpinBox_DY->GetValue();
1245 theMirror.vz = SpinBox_DZ->GetValue();
1247 if (GetConstructorId() == 0)
1248 theMirrorType = SMESH::SMESH_MeshEditor::POINT;
1249 if (GetConstructorId() == 1)
1250 theMirrorType = SMESH::SMESH_MeshEditor::AXIS;
1251 if (GetConstructorId() == 2)
1252 theMirrorType = SMESH::SMESH_MeshEditor::PLANE;