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("");
291 // activate selection and connect selection manager
292 ConstructorsClicked(getConstructorId());
296 //=================================================================================
297 // function : SelectionIntoArgument()
298 // purpose : Called when selection is changed or on dialog initialization or activation
299 //=================================================================================
300 void TransformationGUI_TranslationDlg::SelectionIntoArgument()
303 myEditCurrentArgument->setText("");
305 if (myEditCurrentArgument == GroupPoints->LineEdit1)
307 else if (myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 1)
308 myPoint1 = GEOM::GEOM_Object::_nil();
309 else if (myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 2)
310 myVector = GEOM::GEOM_Object::_nil();
311 else if (myEditCurrentArgument == GroupPoints->LineEdit3)
312 myPoint2 = GEOM::GEOM_Object::_nil();
314 LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
315 SALOME_ListIO aSelList;
316 aSelMgr->selectedObjects(aSelList);
320 if (myEditCurrentArgument == GroupPoints->LineEdit1) {
321 int aNbSel = GEOMBase::GetNameOfSelectedIObjects(aSelList, aName);
325 GEOMBase::ConvertListOfIOInListOfGO(aSelList, myObjects);
326 if (!myObjects.length())
329 myEditCurrentArgument->setText(aName);
331 // here we do not switch to the next field, because multiple objects can be selected
333 if (getConstructorId() == 1) {
334 if (myPoint1->_is_nil())
335 GroupPoints->PushButton2->click();
337 else if (getConstructorId() == 2) {
338 if (myVector->_is_nil())
339 GroupPoints->PushButton2->click();
345 if (aSelList.Extent() != 1)
349 Standard_Boolean testResult = Standard_False;
350 GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), testResult);
352 if (!testResult || CORBA::is_nil(aSelectedObject))
355 aName = GEOMBase::GetName(aSelectedObject);
357 // Get Selected object if selected subshape
359 if (GEOMBase::GetShape(aSelectedObject, aShape, TopAbs_SHAPE) && !aShape.IsNull())
361 TopAbs_ShapeEnum aNeedType = TopAbs_VERTEX;
362 if (myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 2)
363 aNeedType = TopAbs_EDGE;
365 TColStd_IndexedMapOfInteger aMap;
366 aSelMgr->GetIndexes(aSelList.First(), aMap);
367 if (aMap.Extent() == 1)
369 int anIndex = aMap(1);
370 if (aNeedType == TopAbs_EDGE)
371 aName += QString(":edge_%1").arg(anIndex);
373 aName += QString(":vertex_%1").arg(anIndex);
375 //Find SubShape Object in Father
376 GEOM::GEOM_Object_var aFindedObject = findObjectInFather(aSelectedObject, aName);
378 if (aFindedObject->_is_nil()) { // Object not found in study
379 GEOM::GEOM_IShapesOperations_var aShapesOp =
380 getGeomEngine()->GetIShapesOperations(getStudyId());
381 aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
384 aSelectedObject = aFindedObject;
387 else // Global Selection
389 if (aShape.ShapeType() != aNeedType) {
390 aSelectedObject = GEOM::GEOM_Object::_nil();
396 myEditCurrentArgument->setText(aName);
398 if (myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 1) {
399 myPoint1 = aSelectedObject;
400 if (!myPoint1->_is_nil() && myPoint2->_is_nil())
401 GroupPoints->PushButton3->click();
403 else if (myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 2) {
404 myVector = aSelectedObject;
405 if (!myVector->_is_nil() && !myObjects.length())
406 GroupPoints->PushButton1->click();
408 else if (myEditCurrentArgument == GroupPoints->LineEdit3) {
409 myPoint2 = aSelectedObject;
410 if (!myPoint2->_is_nil() && !myObjects.length())
411 GroupPoints->PushButton1->click();
416 /* disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
417 myGeomGUI->getApp()->selectionMgr()->clearSelected();
418 connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
419 this, SLOT(SelectionIntoArgument()));*/
420 // here commented, because multiple objects can be selected IPAL 21437
425 //=================================================================================
426 // function : SetEditCurrentArgument()
428 //=================================================================================
429 void TransformationGUI_TranslationDlg::SetEditCurrentArgument()
431 QPushButton* send = (QPushButton*)sender();
433 disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
436 if (send == GroupPoints->PushButton1) {
437 myEditCurrentArgument = GroupPoints->LineEdit1;
439 GroupPoints->PushButton2->setDown(false);
440 GroupPoints->PushButton3->setDown(false);
441 GroupPoints->LineEdit2->setEnabled(false);
442 GroupPoints->LineEdit3->setEnabled(false);
444 else if (send == GroupPoints->PushButton2) {
445 myEditCurrentArgument = GroupPoints->LineEdit2;
447 GroupPoints->PushButton1->setDown(false);
448 GroupPoints->PushButton3->setDown(false);
449 GroupPoints->LineEdit1->setEnabled(false);
450 GroupPoints->LineEdit3->setEnabled(false);
452 if (getConstructorId() == 1)
453 localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX);
455 localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE);
457 else if (send == GroupPoints->PushButton3) {
458 myEditCurrentArgument = GroupPoints->LineEdit3;
460 GroupPoints->PushButton1->setDown(false);
461 GroupPoints->PushButton2->setDown(false);
462 GroupPoints->LineEdit1->setEnabled(false);
463 GroupPoints->LineEdit2->setEnabled(false);
465 localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX);
467 connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
468 this, SLOT(SelectionIntoArgument()));
471 myEditCurrentArgument->setEnabled(true);
472 myEditCurrentArgument->setFocus();
473 // after setFocus(), because it will be setDown(false) when loses focus
476 // seems we need it only to avoid preview disappearing, caused by selection mode change
480 //=================================================================================
481 // function : LineEditReturnPressed()
483 //=================================================================================
484 void TransformationGUI_TranslationDlg::LineEditReturnPressed()
486 QLineEdit* send = (QLineEdit*)sender();
487 if (send == GroupPoints->LineEdit1) {
488 myEditCurrentArgument = send;
489 GEOMBase_Skeleton::LineEditReturnPressed();
493 //=================================================================================
494 // function : ActivateThisDialog()
496 //=================================================================================
497 void TransformationGUI_TranslationDlg::ActivateThisDialog()
499 GEOMBase_Skeleton::ActivateThisDialog();
500 connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ),
501 this, SLOT( SelectionIntoArgument() ) );
503 ConstructorsClicked( getConstructorId() );
506 //=================================================================================
507 // function : enterEvent()
509 //=================================================================================
510 void TransformationGUI_TranslationDlg::enterEvent (QEvent*)
512 if (!mainFrame()->GroupConstructors->isEnabled())
513 ActivateThisDialog();
516 //=================================================================================
517 // function : ValueChangedInSpinBox()
519 //=================================================================================
520 void TransformationGUI_TranslationDlg::ValueChangedInSpinBox()
525 //=================================================================================
526 // function : createOperation
528 //=================================================================================
529 GEOM::GEOM_IOperations_ptr TransformationGUI_TranslationDlg::createOperation()
531 return getGeomEngine()->GetITransformOperations(getStudyId());
534 //=================================================================================
535 // function : isValid
537 //=================================================================================
538 bool TransformationGUI_TranslationDlg::isValid (QString& msg)
540 int aConstructorId = getConstructorId();
542 switch (aConstructorId) {
546 ok = GroupPoints->SpinBox1->isValid( msg, !IsPreview() ) && ok;
547 ok = GroupPoints->SpinBox2->isValid( msg, !IsPreview() ) && ok;
548 ok = GroupPoints->SpinBox3->isValid( msg, !IsPreview() ) && ok;
549 return myObjects.length() > 0 && ok;
552 return myObjects.length() > 0 && !(myPoint1->_is_nil() || myPoint2->_is_nil());
555 bool ok = GroupPoints->SpinBox3->isValid( msg, !IsPreview() );
556 return myObjects.length() > 0 && !(myVector->_is_nil()) && ok;
564 //=================================================================================
565 // function : execute
567 //=================================================================================
568 bool TransformationGUI_TranslationDlg::execute (ObjectList& objects)
571 bool toCreateCopy = IsPreview() || GroupPoints->CheckBox2->isChecked();
573 GEOM::GEOM_Object_var anObj;
575 GEOM::GEOM_ITransformOperations_var anOper = GEOM::GEOM_ITransformOperations::_narrow(getOperation());
577 switch (getConstructorId()) {
580 double dx = GroupPoints->SpinBox1->value();
581 double dy = GroupPoints->SpinBox2->value();
582 double dz = GroupPoints->SpinBox3->value();
584 QStringList aParameters;
585 aParameters<<GroupPoints->SpinBox1->text();
586 aParameters<<GroupPoints->SpinBox2->text();
587 aParameters<<GroupPoints->SpinBox3->text();
590 for (int i = 0; i < myObjects.length(); i++) {
591 myCurrObject = myObjects[i];
592 anObj = anOper->TranslateDXDYDZCopy(myObjects[i], dx, dy, dz);
593 if (!anObj->_is_nil()) {
595 anObj->SetParameters(aParameters.join(":").toLatin1().constData());
596 objects.push_back(anObj._retn());
601 for (int i = 0; i < myObjects.length(); i++) {
602 myCurrObject = myObjects[i];
603 anObj = anOper->TranslateDXDYDZ(myObjects[i], dx, dy, dz);
604 if (!anObj->_is_nil()) {
606 anObj->SetParameters(aParameters.join(":").toLatin1().constData());
607 updateAttributes(anObj, aParameters);
609 objects.push_back(anObj._retn());
619 for (int i = 0; i < myObjects.length(); i++) {
620 myCurrObject = myObjects[i];
621 anObj = anOper->TranslateTwoPointsCopy(myObjects[i], myPoint1, myPoint2);
622 if (!anObj->_is_nil())
623 objects.push_back(anObj._retn());
627 for (int i = 0; i < myObjects.length(); i++) {
628 myCurrObject = myObjects[i];
629 anObj = anOper->TranslateTwoPoints(myObjects[i], myPoint1, myPoint2);
630 if (!anObj->_is_nil())
631 objects.push_back(anObj._retn());
639 QStringList aParameters;
640 aParameters<<GroupPoints->SpinBox3->text();
641 bool byDistance = GroupPoints->CheckBox1->isChecked();
642 createPathPreview( myVector );
645 double aDistance = GroupPoints->SpinBox3->value();
646 for (int i = 0; i < myObjects.length(); i++) {
647 myCurrObject = myObjects[i];
648 anObj = anOper->TranslateVectorDistance(myObjects[i], myVector, aDistance, toCreateCopy);
649 if (!anObj->_is_nil()) {
651 anObj->SetParameters(aParameters.join(":").toLatin1().constData());
653 updateAttributes(anObj, aParameters);
655 objects.push_back(anObj._retn());
661 for (int i = 0; i < myObjects.length(); i++) {
662 myCurrObject = myObjects[i];
663 anObj = anOper->TranslateVectorCopy(myObjects[i], myVector);
664 if (!anObj->_is_nil())
665 objects.push_back(anObj._retn());
669 for (int i = 0; i < myObjects.length(); i++) {
670 myCurrObject = myObjects[i];
671 anObj = anOper->TranslateVector(myObjects[i], myVector);
672 if (!anObj->_is_nil())
673 objects.push_back(anObj._retn());
684 //=================================================================================
685 // function : restoreSubShapes
687 //=================================================================================
688 void TransformationGUI_TranslationDlg::restoreSubShapes (SALOMEDS::Study_ptr theStudy,
689 SALOMEDS::SObject_ptr theSObject)
691 if (mainFrame()->CheckBoxRestoreSS->isChecked()) {
692 // we pass here the first operation argument (object) through the list of arguments
693 // because the rotation operation place its arguments in the data structure in another order,
694 // and we need to point the first argument directly
695 GEOM::ListOfGO_var anArgs = new GEOM::ListOfGO;
697 anArgs[0] = myCurrObject;
698 getGeomEngine()->RestoreSubShapesSO(theStudy, theSObject, anArgs,
699 /*theFindMethod=*/GEOM::FSM_Transformed,
700 /*theInheritFirstArg=*/true,
701 mainFrame()->CheckBoxAddPrefix->isChecked());
705 //=================================================================================
706 // function : CreateCopyModeChanged()
708 //=================================================================================
709 void TransformationGUI_TranslationDlg::CreateCopyModeChanged (bool isCreateCopy)
711 mainFrame()->GroupBoxName->setEnabled(isCreateCopy);
714 //=================================================================================
715 // function : ActivateDistanceChanged()
717 //=================================================================================
718 void TransformationGUI_TranslationDlg::ActivateDistanceChanged (bool theEnable)
720 GroupPoints->SpinBox3->setEnabled(theEnable);
724 //=================================================================================
725 // function : addSubshapeToStudy
726 // purpose : virtual method to add new SubObjects if local selection
727 //=================================================================================
728 void TransformationGUI_TranslationDlg::addSubshapesToStudy()
730 bool toCreateCopy = IsPreview() || GroupPoints->CheckBox2->isChecked();
732 QMap<QString, GEOM::GEOM_Object_var> objMap;
734 switch (getConstructorId()) {
738 objMap[GroupPoints->LineEdit2->text()] = myPoint1;
739 objMap[GroupPoints->LineEdit3->text()] = myPoint2;
742 objMap[GroupPoints->LineEdit2->text()] = myVector;
745 addSubshapesToFather(objMap);
749 //=================================================================================
750 // function : createPathPreview
752 //=================================================================================
753 void TransformationGUI_TranslationDlg::createPathPreview ( GEOM::GEOM_Object_var thePath )
757 GEOMBase::GetShape( thePath, aShape, TopAbs_SHAPE );
758 TopoDS_Edge anEdge = TopoDS::Edge( aShape );
759 ShapeAnalysis_Edge aShapeAnal;
760 TopoDS_Vertex aFirst = aShapeAnal.FirstVertex( anEdge );
761 TopoDS_Vertex aLast = aShapeAnal.LastVertex( anEdge );
762 TopoDS_Shape aVector = BRepBuilderAPI_MakeEdge(BRep_Tool::Pnt(aFirst), BRep_Tool::Pnt(aLast)).Shape();
763 const char* aName = "tmpVector";
764 Handle(GEOM_AISVector) anIO = new GEOM_AISVector( aVector, aName );
766 // add Prs to preview
767 SUIT_ViewWindow* vw = SUIT_Session::session()->activeApplication()->desktop()->activeWindow();
768 SOCC_Prs* aPrs = dynamic_cast<SOCC_Prs*>(((SOCC_Viewer*)(vw->getViewManager()->getViewModel()))->CreatePrs(0));
770 aPrs->AddObject(anIO);
771 GEOMBase_Helper::displayPreview( aPrs, false, true );