1 // Copyright (C) 2007-2010 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
23 // GEOM GEOMGUI : GUI for Geometry component
24 // File : TransformationGUI_TranslationDlg.cxx
25 // Author : Lucien PIGNOLONI, Open CASCADE S.A.S.
27 #include "TransformationGUI_TranslationDlg.h"
30 #include <GeometryGUI.h>
33 #include <SUIT_Session.h>
34 #include <SUIT_ResourceMgr.h>
35 #include <SUIT_Desktop.h>
36 #include <SUIT_ViewWindow.h>
37 #include <SUIT_ViewManager.h>
38 #include <SalomeApp_Application.h>
39 #include <LightApp_SelectionMgr.h>
40 #include <GEOM_AISVector.hxx>
42 #include <SOCC_ViewModel.h>
45 #include <TopoDS_Shape.hxx>
46 #include <TopoDS_Edge.hxx>
47 #include <TopoDS_Vertex.hxx>
50 #include <TColStd_IndexedMapOfInteger.hxx>
51 #include <TopTools_IndexedMapOfShape.hxx>
52 #include <ShapeAnalysis_Edge.hxx>
53 #include <BRep_Tool.hxx>
54 #include <BRepBuilderAPI_MakeEdge.hxx>
55 #include <BRep_Builder.hxx>
57 #include <GEOMImpl_Types.hxx>
59 //=================================================================================
60 // class : TransformationGUI_TranslationDlg()
61 // purpose : Constructs a TransformationGUI_TranslationDlg which is a child of 'parent', with the
62 // name 'name' and widget flags set to 'f'.
63 // The dialog will by default be modeless, unless you set 'modal' to
64 // TRUE to construct a modal dialog.
65 //=================================================================================
66 TransformationGUI_TranslationDlg::TransformationGUI_TranslationDlg
67 (GeometryGUI* theGeometryGUI, QWidget* parent, bool modal, Qt::WindowFlags fl)
68 : GEOMBase_Skeleton(theGeometryGUI, parent, modal, fl),
71 SUIT_ResourceMgr* aResMgr = myGeomGUI->getApp()->resourceMgr();
72 QPixmap image0 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_TRANSLATION_DXYZ")));
73 QPixmap image1 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_TRANSLATION_POINTS")));
74 QPixmap image2 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_TRANSLATION_VECTOR")));
75 QPixmap image3 (aResMgr->loadPixmap("GEOM", tr("ICON_SELECT")));
77 setWindowTitle(tr("GEOM_TRANSLATION_TITLE"));
79 /***************************************************************/
80 mainFrame()->GroupConstructors->setTitle(tr("GEOM_TRANSLATION"));
81 mainFrame()->RadioButton1->setIcon(image0);
82 mainFrame()->RadioButton2->setIcon(image1);
83 mainFrame()->RadioButton3->setIcon(image2);
84 mainFrame()->RadioButton1->setChecked(true);
86 GroupPoints = new DlgRef_3Sel3Spin2Check(centralWidget());
87 GroupPoints->GroupBox1->setTitle(tr("GEOM_ARGUMENTS"));
88 GroupPoints->TextLabel1->setText(tr("GEOM_OBJECTS"));
89 GroupPoints->TextLabel3->setText(tr("GEOM_POINT_I").arg(2));
90 GroupPoints->TextLabel4->setText(tr("GEOM_DX"));
91 GroupPoints->TextLabel5->setText(tr("GEOM_DY"));
92 GroupPoints->TextLabel6->setText(tr("GEOM_DZ"));
93 GroupPoints->PushButton1->setIcon(image3);
94 GroupPoints->PushButton2->setIcon(image3);
95 GroupPoints->PushButton3->setIcon(image3);
96 GroupPoints->CheckBox1->setText(tr("Activate Distance"));
97 GroupPoints->CheckBox2->setText(tr("GEOM_CREATE_COPY"));
99 QVBoxLayout* layout = new QVBoxLayout(centralWidget());
100 layout->setMargin(0); layout->setSpacing(6);
101 layout->addWidget(GroupPoints);
102 /***************************************************************/
104 setHelpFileName("translation_operation_page.html");
106 // Activate Create a Copy mode
107 GroupPoints->CheckBox2->setChecked(true);
108 CreateCopyModeChanged(true);
113 //=================================================================================
114 // function : ~TransformationGUI_TranslationDlg()
115 // purpose : Destroys the object and frees any allocated resources
116 //=================================================================================
117 TransformationGUI_TranslationDlg::~TransformationGUI_TranslationDlg()
119 // no need to delete child widgets, Qt does it all for us
122 //=================================================================================
125 //=================================================================================
126 void TransformationGUI_TranslationDlg::Init()
128 // Get setting of step value from file configuration
129 SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
130 double step = resMgr->doubleValue("Geometry", "SettingsGeomStep", 100);
132 // min, max, step and decimals for spin boxes & initial values
133 initSpinBox(GroupPoints->SpinBox1, COORD_MIN, COORD_MAX, step, "length_precision" );
134 initSpinBox(GroupPoints->SpinBox2, COORD_MIN, COORD_MAX, step, "length_precision" );
135 initSpinBox(GroupPoints->SpinBox3, COORD_MIN, COORD_MAX, step, "length_precision" );
137 GroupPoints->SpinBox1->setValue(0.0);
138 GroupPoints->SpinBox2->setValue(0.0);
139 GroupPoints->SpinBox3->setValue(0.0);
142 GroupPoints->LineEdit1->setReadOnly(true);
143 GroupPoints->LineEdit2->setReadOnly(true);
144 GroupPoints->LineEdit3->setReadOnly(true);
146 GroupPoints->LineEdit1->setText("");
147 GroupPoints->LineEdit2->setText("");
148 GroupPoints->LineEdit3->setText("");
150 myVector = myPoint1 = myPoint2 = GEOM::GEOM_Object::_nil();
152 mainFrame()->GroupBoxPublish->show();
154 // signals and slots connections
155 connect(buttonOk(), SIGNAL(clicked()), this, SLOT(ClickOnOk()));
156 connect(buttonApply(), SIGNAL(clicked()), this, SLOT(ClickOnApply()));
158 connect(this, SIGNAL(constructorsClicked(int)), this, SLOT(ConstructorsClicked(int)));
160 connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
161 connect(GroupPoints->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
162 connect(GroupPoints->PushButton3, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
164 connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); //@ Delete ?
166 connect(GroupPoints->SpinBox1, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox()));
167 connect(GroupPoints->SpinBox2, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox()));
168 connect(GroupPoints->SpinBox3, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox()));
170 connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), this, SLOT(SetDoubleSpinBoxStep(double)));
172 connect(GroupPoints->CheckBox1, SIGNAL(toggled(bool)), this, SLOT(ActivateDistanceChanged(bool)));
173 connect(GroupPoints->CheckBox2, SIGNAL(toggled(bool)), this, SLOT(CreateCopyModeChanged(bool)));
175 initName(tr("GEOM_TRANSLATION"));
177 ConstructorsClicked(0);
180 //=================================================================================
181 // function : SetDoubleSpinBoxStep()
182 // purpose : Double spin box management
183 //=================================================================================
184 void TransformationGUI_TranslationDlg::SetDoubleSpinBoxStep (double step)
186 GroupPoints->SpinBox1->setSingleStep(step);
187 GroupPoints->SpinBox2->setSingleStep(step);
188 GroupPoints->SpinBox3->setSingleStep(step);
191 //=================================================================================
192 // function : ConstructorsClicked()
193 // purpose : Radio button management
194 //=================================================================================
195 void TransformationGUI_TranslationDlg::ConstructorsClicked (int constructorId)
197 disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
199 switch (constructorId) {
200 case 0: // translation an object by dx, dy, dz
202 GroupPoints->ShowRows(1, 2, false);
203 GroupPoints->ShowRows(3, 5, true);
205 GroupPoints->TextLabel6->setText(tr("GEOM_DZ"));
206 GroupPoints->SpinBox3->setEnabled(true);
208 GroupPoints->CheckBox1->hide();
210 GroupPoints->PushButton1->click();
213 case 1: // translation an object by 2 points
215 GroupPoints->ShowRows(3, 5, false);
216 GroupPoints->ShowRows(0, 2, true);
218 GroupPoints->TextLabel6->setText(tr("GEOM_DZ"));
219 GroupPoints->TextLabel2->setText(tr("GEOM_POINT_I").arg(1));
220 GroupPoints->LineEdit2->clear();
221 GroupPoints->LineEdit3->clear();
222 GroupPoints->SpinBox3->setEnabled(true);
224 GroupPoints->CheckBox1->hide();
226 myPoint1 = myPoint2 = GEOM::GEOM_Object::_nil();
228 GroupPoints->PushButton1->click();
231 case 2: // translation an object by vector
233 GroupPoints->ShowRows(0, 1, true);
234 GroupPoints->ShowRows(2, 4, false);
235 GroupPoints->ShowRows(5, 5, true);
237 GroupPoints->TextLabel6->setText(tr("GEOM_DISTANCE"));
238 GroupPoints->SpinBox3->setValue(0.0);
239 GroupPoints->SpinBox3->setEnabled(false);
240 GroupPoints->TextLabel2->setText(tr("GEOM_VECTOR"));
241 GroupPoints->LineEdit2->clear();
243 GroupPoints->CheckBox1->show();
245 myVector = GEOM::GEOM_Object::_nil();
246 ActivateDistanceChanged(GroupPoints->CheckBox1->isChecked());
248 GroupPoints->PushButton1->click();
253 qApp->processEvents();
255 resize(minimumSizeHint());
259 SelectionIntoArgument();
266 //=================================================================================
267 // function : ClickOnOk()
269 //=================================================================================
270 void TransformationGUI_TranslationDlg::ClickOnOk()
276 //=================================================================================
277 // function : ClickOnApply()
279 //=================================================================================
280 bool TransformationGUI_TranslationDlg::ClickOnApply()
282 if (!onAccept(GroupPoints->CheckBox2->isChecked()))
288 myEditCurrentArgument = GroupPoints->LineEdit1;
289 myEditCurrentArgument->setText("");
290 myGeomGUI->getApp()->selectionMgr()->clearSelected();
292 // activate selection and connect selection manager
293 ConstructorsClicked(getConstructorId());
297 //=================================================================================
298 // function : SelectionIntoArgument()
299 // purpose : Called when selection is changed or on dialog initialization or activation
300 //=================================================================================
301 void TransformationGUI_TranslationDlg::SelectionIntoArgument()
304 myEditCurrentArgument->setText("");
306 if (myEditCurrentArgument == GroupPoints->LineEdit1)
308 else if (myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 1)
309 myPoint1 = GEOM::GEOM_Object::_nil();
310 else if (myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 2)
311 myVector = GEOM::GEOM_Object::_nil();
312 else if (myEditCurrentArgument == GroupPoints->LineEdit3)
313 myPoint2 = GEOM::GEOM_Object::_nil();
315 LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
316 SALOME_ListIO aSelList;
317 aSelMgr->selectedObjects(aSelList);
321 if (myEditCurrentArgument == GroupPoints->LineEdit1) {
322 int aNbSel = GEOMBase::GetNameOfSelectedIObjects(aSelList, aName);
326 GEOMBase::ConvertListOfIOInListOfGO(aSelList, myObjects);
327 if (!myObjects.length())
330 myEditCurrentArgument->setText(aName);
332 // here we do not switch to the next field, because multiple objects can be selected
334 if (getConstructorId() == 1) {
335 if (myPoint1->_is_nil())
336 GroupPoints->PushButton2->click();
338 else if (getConstructorId() == 2) {
339 if (myVector->_is_nil())
340 GroupPoints->PushButton2->click();
346 if (aSelList.Extent() != 1)
350 Standard_Boolean testResult = Standard_False;
351 GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), testResult);
353 if (!testResult || CORBA::is_nil(aSelectedObject))
356 aName = GEOMBase::GetName(aSelectedObject);
358 // Get Selected object if selected subshape
360 if (GEOMBase::GetShape(aSelectedObject, aShape, TopAbs_SHAPE) && !aShape.IsNull())
362 TopAbs_ShapeEnum aNeedType = TopAbs_VERTEX;
363 if (myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 2)
364 aNeedType = TopAbs_EDGE;
366 TColStd_IndexedMapOfInteger aMap;
367 aSelMgr->GetIndexes(aSelList.First(), aMap);
368 if (aMap.Extent() == 1)
370 int anIndex = aMap(1);
371 if (aNeedType == TopAbs_EDGE)
372 aName += QString(":edge_%1").arg(anIndex);
374 aName += QString(":vertex_%1").arg(anIndex);
376 //Find SubShape Object in Father
377 GEOM::GEOM_Object_var aFindedObject = findObjectInFather(aSelectedObject, aName);
379 if (aFindedObject->_is_nil()) { // Object not found in study
380 GEOM::GEOM_IShapesOperations_var aShapesOp =
381 getGeomEngine()->GetIShapesOperations(getStudyId());
382 aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
385 aSelectedObject = aFindedObject;
388 else // Global Selection
390 if (aShape.ShapeType() != aNeedType) {
391 aSelectedObject = GEOM::GEOM_Object::_nil();
397 myEditCurrentArgument->setText(aName);
399 if (myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 1) {
400 myPoint1 = aSelectedObject;
401 if (!myPoint1->_is_nil() && myPoint2->_is_nil())
402 GroupPoints->PushButton3->click();
404 else if (myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 2) {
405 myVector = aSelectedObject;
406 if (!myVector->_is_nil() && !myObjects.length())
407 GroupPoints->PushButton1->click();
409 else if (myEditCurrentArgument == GroupPoints->LineEdit3) {
410 myPoint2 = aSelectedObject;
411 if (!myPoint2->_is_nil() && !myObjects.length())
412 GroupPoints->PushButton1->click();
417 /* disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
418 myGeomGUI->getApp()->selectionMgr()->clearSelected();
419 connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
420 this, SLOT(SelectionIntoArgument()));*/
421 // here commented, because multiple objects can be selected IPAL 21437
426 //=================================================================================
427 // function : SetEditCurrentArgument()
429 //=================================================================================
430 void TransformationGUI_TranslationDlg::SetEditCurrentArgument()
432 QPushButton* send = (QPushButton*)sender();
434 disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
437 if (send == GroupPoints->PushButton1) {
438 myEditCurrentArgument = GroupPoints->LineEdit1;
440 GroupPoints->PushButton2->setDown(false);
441 GroupPoints->PushButton3->setDown(false);
442 GroupPoints->LineEdit2->setEnabled(false);
443 GroupPoints->LineEdit3->setEnabled(false);
445 else if (send == GroupPoints->PushButton2) {
446 myEditCurrentArgument = GroupPoints->LineEdit2;
448 GroupPoints->PushButton1->setDown(false);
449 GroupPoints->PushButton3->setDown(false);
450 GroupPoints->LineEdit1->setEnabled(false);
451 GroupPoints->LineEdit3->setEnabled(false);
453 if (getConstructorId() == 1)
454 localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX);
456 localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE);
458 else if (send == GroupPoints->PushButton3) {
459 myEditCurrentArgument = GroupPoints->LineEdit3;
461 GroupPoints->PushButton1->setDown(false);
462 GroupPoints->PushButton2->setDown(false);
463 GroupPoints->LineEdit1->setEnabled(false);
464 GroupPoints->LineEdit2->setEnabled(false);
466 localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX);
468 connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
469 this, SLOT(SelectionIntoArgument()));
472 myEditCurrentArgument->setEnabled(true);
473 myEditCurrentArgument->setFocus();
474 // after setFocus(), because it will be setDown(false) when loses focus
477 // seems we need it only to avoid preview disappearing, caused by selection mode change
481 //=================================================================================
482 // function : LineEditReturnPressed()
484 //=================================================================================
485 void TransformationGUI_TranslationDlg::LineEditReturnPressed()
487 QLineEdit* send = (QLineEdit*)sender();
488 if (send == GroupPoints->LineEdit1) {
489 myEditCurrentArgument = send;
490 GEOMBase_Skeleton::LineEditReturnPressed();
494 //=================================================================================
495 // function : ActivateThisDialog()
497 //=================================================================================
498 void TransformationGUI_TranslationDlg::ActivateThisDialog()
500 GEOMBase_Skeleton::ActivateThisDialog();
501 connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ),
502 this, SLOT( SelectionIntoArgument() ) );
504 ConstructorsClicked( getConstructorId() );
507 //=================================================================================
508 // function : enterEvent()
510 //=================================================================================
511 void TransformationGUI_TranslationDlg::enterEvent (QEvent*)
513 if (!mainFrame()->GroupConstructors->isEnabled())
514 ActivateThisDialog();
517 //=================================================================================
518 // function : ValueChangedInSpinBox()
520 //=================================================================================
521 void TransformationGUI_TranslationDlg::ValueChangedInSpinBox()
526 //=================================================================================
527 // function : createOperation
529 //=================================================================================
530 GEOM::GEOM_IOperations_ptr TransformationGUI_TranslationDlg::createOperation()
532 return getGeomEngine()->GetITransformOperations(getStudyId());
535 //=================================================================================
536 // function : isValid
538 //=================================================================================
539 bool TransformationGUI_TranslationDlg::isValid (QString& msg)
541 int aConstructorId = getConstructorId();
543 switch (aConstructorId) {
547 ok = GroupPoints->SpinBox1->isValid( msg, !IsPreview() ) && ok;
548 ok = GroupPoints->SpinBox2->isValid( msg, !IsPreview() ) && ok;
549 ok = GroupPoints->SpinBox3->isValid( msg, !IsPreview() ) && ok;
550 return myObjects.length() > 0 && ok;
553 return myObjects.length() > 0 && !(myPoint1->_is_nil() || myPoint2->_is_nil());
556 bool ok = GroupPoints->SpinBox3->isValid( msg, !IsPreview() );
557 return myObjects.length() > 0 && !(myVector->_is_nil()) && ok;
565 //=================================================================================
566 // function : execute
568 //=================================================================================
569 bool TransformationGUI_TranslationDlg::execute (ObjectList& objects)
572 bool toCreateCopy = IsPreview() || GroupPoints->CheckBox2->isChecked();
574 GEOM::GEOM_Object_var anObj;
576 GEOM::GEOM_ITransformOperations_var anOper = GEOM::GEOM_ITransformOperations::_narrow(getOperation());
578 switch (getConstructorId()) {
581 double dx = GroupPoints->SpinBox1->value();
582 double dy = GroupPoints->SpinBox2->value();
583 double dz = GroupPoints->SpinBox3->value();
585 QStringList aParameters;
586 aParameters<<GroupPoints->SpinBox1->text();
587 aParameters<<GroupPoints->SpinBox2->text();
588 aParameters<<GroupPoints->SpinBox3->text();
591 for (int i = 0; i < myObjects.length(); i++) {
592 myCurrObject = myObjects[i];
593 anObj = anOper->TranslateDXDYDZCopy(myObjects[i], dx, dy, dz);
594 if (!anObj->_is_nil()) {
596 anObj->SetParameters(aParameters.join(":").toLatin1().constData());
597 objects.push_back(anObj._retn());
602 for (int i = 0; i < myObjects.length(); i++) {
603 myCurrObject = myObjects[i];
604 anObj = anOper->TranslateDXDYDZ(myObjects[i], dx, dy, dz);
605 if (!anObj->_is_nil()) {
607 anObj->SetParameters(aParameters.join(":").toLatin1().constData());
608 updateAttributes(anObj, aParameters);
610 objects.push_back(anObj._retn());
620 for (int i = 0; i < myObjects.length(); i++) {
621 myCurrObject = myObjects[i];
622 anObj = anOper->TranslateTwoPointsCopy(myObjects[i], myPoint1, myPoint2);
623 if (!anObj->_is_nil())
624 objects.push_back(anObj._retn());
628 for (int i = 0; i < myObjects.length(); i++) {
629 myCurrObject = myObjects[i];
630 anObj = anOper->TranslateTwoPoints(myObjects[i], myPoint1, myPoint2);
631 if (!anObj->_is_nil())
632 objects.push_back(anObj._retn());
640 QStringList aParameters;
641 aParameters<<GroupPoints->SpinBox3->text();
642 bool byDistance = GroupPoints->CheckBox1->isChecked();
643 createPathPreview( myVector );
646 double aDistance = GroupPoints->SpinBox3->value();
647 for (int i = 0; i < myObjects.length(); i++) {
648 myCurrObject = myObjects[i];
649 anObj = anOper->TranslateVectorDistance(myObjects[i], myVector, aDistance, toCreateCopy);
650 if (!anObj->_is_nil()) {
652 anObj->SetParameters(aParameters.join(":").toLatin1().constData());
654 updateAttributes(anObj, aParameters);
656 objects.push_back(anObj._retn());
662 for (int i = 0; i < myObjects.length(); i++) {
663 myCurrObject = myObjects[i];
664 anObj = anOper->TranslateVectorCopy(myObjects[i], myVector);
665 if (!anObj->_is_nil())
666 objects.push_back(anObj._retn());
670 for (int i = 0; i < myObjects.length(); i++) {
671 myCurrObject = myObjects[i];
672 anObj = anOper->TranslateVector(myObjects[i], myVector);
673 if (!anObj->_is_nil())
674 objects.push_back(anObj._retn());
685 //=================================================================================
686 // function : restoreSubShapes
688 //=================================================================================
689 void TransformationGUI_TranslationDlg::restoreSubShapes (SALOMEDS::Study_ptr theStudy,
690 SALOMEDS::SObject_ptr theSObject)
692 if (mainFrame()->CheckBoxRestoreSS->isChecked()) {
693 // we pass here the first operation argument (object) through the list of arguments
694 // because the rotation operation place its arguments in the data structure in another order,
695 // and we need to point the first argument directly
696 GEOM::ListOfGO_var anArgs = new GEOM::ListOfGO;
698 anArgs[0] = myCurrObject;
699 getGeomEngine()->RestoreSubShapesSO(theStudy, theSObject, anArgs,
700 /*theFindMethod=*/GEOM::FSM_Transformed,
701 /*theInheritFirstArg=*/true,
702 mainFrame()->CheckBoxAddPrefix->isChecked());
706 //=================================================================================
707 // function : CreateCopyModeChanged()
709 //=================================================================================
710 void TransformationGUI_TranslationDlg::CreateCopyModeChanged (bool isCreateCopy)
712 mainFrame()->GroupBoxName->setEnabled(isCreateCopy);
715 //=================================================================================
716 // function : ActivateDistanceChanged()
718 //=================================================================================
719 void TransformationGUI_TranslationDlg::ActivateDistanceChanged (bool theEnable)
721 GroupPoints->SpinBox3->setEnabled(theEnable);
725 //=================================================================================
726 // function : addSubshapeToStudy
727 // purpose : virtual method to add new SubObjects if local selection
728 //=================================================================================
729 void TransformationGUI_TranslationDlg::addSubshapesToStudy()
731 bool toCreateCopy = IsPreview() || GroupPoints->CheckBox2->isChecked();
733 QMap<QString, GEOM::GEOM_Object_var> objMap;
735 switch (getConstructorId()) {
739 objMap[GroupPoints->LineEdit2->text()] = myPoint1;
740 objMap[GroupPoints->LineEdit3->text()] = myPoint2;
743 objMap[GroupPoints->LineEdit2->text()] = myVector;
746 addSubshapesToFather(objMap);
750 //=================================================================================
751 // function : createPathPreview
753 //=================================================================================
754 void TransformationGUI_TranslationDlg::createPathPreview ( GEOM::GEOM_Object_var thePath )
758 GEOMBase::GetShape( thePath, aShape, TopAbs_SHAPE );
759 TopoDS_Edge anEdge = TopoDS::Edge( aShape );
760 ShapeAnalysis_Edge aShapeAnal;
761 TopoDS_Vertex aFirst = aShapeAnal.FirstVertex( anEdge );
762 TopoDS_Vertex aLast = aShapeAnal.LastVertex( anEdge );
763 TopoDS_Shape aVector = BRepBuilderAPI_MakeEdge(BRep_Tool::Pnt(aFirst), BRep_Tool::Pnt(aLast)).Shape();
764 const char* aName = "tmpVector";
765 Handle(GEOM_AISVector) anIO = new GEOM_AISVector( aVector, aName );
767 // add Prs to preview
768 SUIT_ViewWindow* vw = SUIT_Session::session()->activeApplication()->desktop()->activeWindow();
769 SOCC_Prs* aPrs = dynamic_cast<SOCC_Prs*>(((SOCC_Viewer*)(vw->getViewManager()->getViewModel()))->CreatePrs(0));
771 aPrs->AddObject(anIO);
772 GEOMBase_Helper::displayPreview( aPrs, false, true );