1 // Copyright (C) 2007-2015 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, or (at your option) any later version.
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 #include "EntityGUI_PolylineDlg.h"
24 #include <CurveCreator_Curve.hxx>
25 #include <CurveCreator_Displayer.hxx>
26 #include <CurveCreator_Utils.hxx>
27 #include <CurveCreator_Widget.h>
29 #include <GeometryGUI.h>
32 #include "utilities.h"
34 #include <OCCViewer_ViewManager.h>
35 #include <LightApp_SelectionMgr.h>
36 #include <SalomeApp_Application.h>
37 #include <SUIT_ResourceMgr.h>
38 #include <SUIT_Session.h>
39 #include "utilities.h"
41 #include <BRep_Tool.hxx>
42 #include <Geom_Surface.hxx>
43 #include <GeomLib_IsPlanarSurface.hxx>
44 #include <Prs3d_LineAspect.hxx>
48 #include <QVBoxLayout>
52 //=================================================================================
53 // function : Constructor
55 //=================================================================================
56 EntityGUI_PolylineDlg::EntityGUI_PolylineDlg
57 (GeometryGUI* theGeometryGUI, QWidget* parent, bool modal, Qt::WindowFlags fl)
58 : GEOMBase_Skeleton( theGeometryGUI, parent, modal, fl ),
66 myPolylineSelButton (0),
68 myEditCurrentArgument (0),
72 QPixmap image0(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_CC_POLYLINE")));
73 QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_SELECT")));
75 setWindowTitle(tr("POLYLINE_DLG_TITLE"));
77 /***************************************************************/
78 mainFrame()->GroupConstructors->setTitle(tr("POLYLINE_TITLE"));
79 mainFrame()->RadioButton1->setIcon(image0);
80 mainFrame()->RadioButton2->setAttribute( Qt::WA_DeleteOnClose );
81 mainFrame()->RadioButton2->close();
82 mainFrame()->RadioButton3->setAttribute( Qt::WA_DeleteOnClose );
83 mainFrame()->RadioButton3->close();
85 QGroupBox *aGroupBox1 = new QGroupBox(tr("GEOM_CS"), this);
86 QGridLayout *aPlaneLayout = new QGridLayout(aGroupBox1);
88 aPlaneLayout->setSpacing(6);
89 aPlaneLayout->setMargin(11);
91 myPlnComboBox = new QComboBox(aGroupBox1);
92 aPlaneLayout->addWidget(myPlnComboBox, 0, 0, 1, 3);
94 myPlnButton = new QPushButton (aGroupBox1);
95 myPlnButton->setText( tr( "GEOM_SKETCHER_RESTORE" ) );
96 aPlaneLayout->addWidget(myPlnButton, 0, 3);
102 myPlnComboBox->setVisible( isCS );
103 myPlnButton->setVisible( isCS );
106 QLabel *aPlaneLbl = new QLabel(tr("GEOM_PLANE"), aGroupBox1);
108 myPlnSelButton = new QPushButton (aGroupBox1);
109 myPlnSelButton->setIcon(image1);
110 myWPlaneLineEdit = new QLineEdit (aGroupBox1);
111 myWPlaneLineEdit->setReadOnly(true);
114 QLabel *aPolylineLbl = new QLabel(tr("POLYLINE_IMPORT"), aGroupBox1);
116 myPolylineSelButton = new QPushButton (aGroupBox1);
117 myPolylineSelButton->setIcon(image1);
118 myPolylineSelButton->setCheckable(true);
119 myPolylineEdit = new QLineEdit (aGroupBox1);
120 myPolylineEdit->setReadOnly(true);
123 aPlaneLayout->addWidget(aPlaneLbl, 1, 0);
124 aPlaneLayout->addWidget(myPlnSelButton, 1, 1);
125 aPlaneLayout->addWidget(myWPlaneLineEdit, 1, 2, 1, 2);
127 aPlaneLayout->addWidget(aPolylineLbl, 2, 0);
128 aPlaneLayout->addWidget(myPolylineSelButton, 2, 1);
129 aPlaneLayout->addWidget(myPolylineEdit, 2, 2, 1, 2);
131 aPlaneLayout->setColumnStretch(2, 1);
133 myCurve = new CurveCreator_Curve( CurveCreator::Dim2d );
134 myEditorWidget = new CurveCreator_Widget (centralWidget(), myCurve);
135 myAddElementBox = new QGroupBox (tr("POLYLINE_ADD_SECTION"), centralWidget());
137 QBoxLayout* anAddElementLayout = new QVBoxLayout( myAddElementBox );
139 anAddElementLayout->setMargin( 0 );
140 anAddElementLayout->setSpacing( 6 );
142 QVBoxLayout* layout = new QVBoxLayout( centralWidget() );
144 layout->setMargin( 0 );
145 layout->setSpacing( 6 );
146 layout->addWidget( aGroupBox1 );
147 layout->addWidget( myEditorWidget );
148 layout->addWidget( myAddElementBox );
150 /***************************************************************/
152 setHelpFileName( "create_polyline_page.html" );
154 /* Initializations */
158 //=================================================================================
159 // function : Destructor
161 //=================================================================================
162 EntityGUI_PolylineDlg::~EntityGUI_PolylineDlg()
167 //=================================================================================
170 //=================================================================================
171 void EntityGUI_PolylineDlg::Init()
173 initName(tr("POLYLINE_NAME"));
175 SalomeApp_Application *anApp = myGeomGUI->getApp();
176 OCCViewer_ViewManager *aViewManager = dynamic_cast<OCCViewer_ViewManager*>
177 (anApp->getViewManager(OCCViewer_Viewer::Type(), true));
178 LightApp_SelectionMgr *aSelMgr = myGeomGUI->getApp()->selectionMgr();
180 myEditorWidget->setOCCViewer(aViewManager ? aViewManager->getOCCViewer() : 0);
181 setPreviewManager( aViewManager );
183 // Init the list of local coordinate system
184 gp_Pnt aPnt(0., 0., 0.);
185 gp_Dir aDirN(0., 0., 1.);
186 gp_Dir aDirX(1., 0., 0.);
187 gp_Ax3 aLCS(aPnt, aDirN, aDirX);
190 myPlnComboBox->addItem(tr("GEOM_GCS"), false);
191 myWPlaneList.push_back(GEOM::GeomObjPtr());
192 myLCSList.push_back(aLCS);
195 connect( myPlnSelButton, SIGNAL(toggled(bool)),
196 this, SLOT(SetEditCurrentArgument(bool)) );
198 connect( myPolylineSelButton, SIGNAL(toggled(bool)),
199 this, SLOT(SetEditCurrentArgument(bool)) );
200 connect( aSelMgr, SIGNAL(currentSelectionChanged()),
201 this, SLOT(SelectionIntoArgument()) );
202 connect( myEditorWidget, SIGNAL(subOperationStarted(QWidget*, bool)),
203 this, SLOT(processStartedSubOperation(QWidget*, bool)) );
204 connect( myEditorWidget, SIGNAL(subOperationFinished(QWidget*)),
205 this, SLOT(processFinishedSubOperation(QWidget*)) );
207 connect( myPlnComboBox, SIGNAL(activated(int)),
208 this, SLOT(ActivateLocalCS()) );
209 connect( myPlnButton, SIGNAL(clicked()),
210 this, SLOT(ActivateLocalCS()) );
212 connect( buttonOk(), SIGNAL(clicked()), this, SLOT(ClickOnOk()) );
213 connect( buttonApply(), SIGNAL(clicked()), this, SLOT(ClickOnApply()) );
215 myAddElementBox->hide();
217 // Processing of the selected object
218 myPolylineSelButton->setChecked( true );
219 SelectionIntoArgument( true );
222 //=================================================================================
225 //=================================================================================
226 void EntityGUI_PolylineDlg::Clear()
230 myCurve = new CurveCreator_Curve( CurveCreator::Dim2d );
231 myEditorWidget->setCurve(myCurve);
234 //=================================================================================
235 // function : GetCurveParams
237 //=================================================================================
238 void EntityGUI_PolylineDlg::GetCurveParams(GEOM::ListOfListOfDouble &theCoords,
239 GEOM::string_array &theNames,
240 GEOM::short_array &theTypes,
241 GEOM::ListOfBool &theCloseds)
243 const int aNbSec = myCurve->getNbSections();
247 theCoords.length(aNbSec);
248 theNames.length(aNbSec);
249 theTypes.length(aNbSec);
250 theCloseds.length(aNbSec);
252 for (i = 0; i < aNbSec; ++i) {
254 CurveCreator::Coordinates aCoords = myCurve->getPoints(i);
255 const int aNbPoints = aCoords.size();
257 theCoords[i].length(aNbPoints);
259 for (j = 0; j < aNbPoints; ++j) {
260 theCoords[i][j] = aCoords[j];
264 const CurveCreator::SectionType aType = myCurve->getSectionType(i);
267 case CurveCreator::Spline:
268 theTypes[i] = GEOM::Interpolation;
270 case CurveCreator::Polyline:
272 theTypes[i] = GEOM::Polyline;
276 // Set section names and closed flags.
277 theNames[i] = CORBA::string_dup(myCurve->getSectionName(i).c_str());
278 theCloseds[i] = myCurve->isClosed(i);
282 //=================================================================================
283 // function : createOperation
285 //=================================================================================
286 GEOM::GEOM_IOperations_ptr EntityGUI_PolylineDlg::createOperation()
288 return getGeomEngine()->GetICurvesOperations( getStudyId() );
291 //=================================================================================
292 // function : isValid
294 //=================================================================================
295 bool EntityGUI_PolylineDlg::isValid( QString& msg )
300 //=================================================================================
301 // function : execute
303 //=================================================================================
304 bool EntityGUI_PolylineDlg::execute( ObjectList& objects )
306 GEOM::GEOM_ICurvesOperations_var anOper =
307 GEOM::GEOM_ICurvesOperations::_narrow(getOperation());
309 // Get the polyline creation parameters.
310 GEOM::ListOfListOfDouble aCoords;
311 GEOM::string_array aNames;
312 GEOM::short_array aTypes;
313 GEOM::ListOfBool aCloseds;
315 GetCurveParams(aCoords, aNames, aTypes, aCloseds);
317 // Get Working Plane.
318 int ind = myPlnComboBox->currentIndex();
321 bool isPlane = myPlnComboBox->itemData(ind).toBool();
322 GEOM::GEOM_Object_var anObj;
326 anObj = anOper->MakePolyline2DOnPlane
327 (aCoords, aNames, aTypes, aCloseds, myWPlaneList.at(ind).get());
329 gp_Ax3 anAxis = myLCSList.at(ind);
330 GEOM::ListOfDouble aPlane;
333 aPlane[0] = anAxis.Location().X();
334 aPlane[1] = anAxis.Location().Y();
335 aPlane[2] = anAxis.Location().Z();
336 aPlane[3] = anAxis.Direction().X();
337 aPlane[4] = anAxis.Direction().Y();
338 aPlane[5] = anAxis.Direction().Z();
339 aPlane[6] = anAxis.XDirection().X();
340 aPlane[7] = anAxis.XDirection().Y();
341 aPlane[8] = anAxis.XDirection().Z();
343 anObj = anOper->MakePolyline2D
344 (aCoords, aNames, aTypes, aCloseds, aPlane);
347 if (!anObj->_is_nil()) {
348 objects.push_back(anObj._retn());
355 //=================================================================================
356 // function : ClickOnOk()
358 //=================================================================================
359 void EntityGUI_PolylineDlg::ClickOnOk()
361 setIsApplyAndClose( true );
367 //=================================================================================
368 // function : ClickOnApply()
370 //=================================================================================
371 bool EntityGUI_PolylineDlg::ClickOnApply()
379 myEditorWidget->reset();
384 //=================================================================================
385 // function : ClickOnCancel()
387 //=================================================================================
388 void EntityGUI_PolylineDlg::ClickOnCancel()
390 myEditorWidget->SetViewer2DMode(false);
391 GEOMBase_Skeleton::ClickOnCancel();
394 //=================================================================================
395 // function : processStartedSubOperation
397 //=================================================================================
398 void EntityGUI_PolylineDlg::processStartedSubOperation( QWidget* theWidget, bool theIsEdit )
400 myEditorWidget->setEnabled( false );
402 myAddElementBox->setTitle( theIsEdit ? tr( "POLYLINE_EDIT_SECTION" ) : tr( "POLYLINE_ADD_SECTION" ) );
403 QBoxLayout* anAddElementLayout = dynamic_cast<QBoxLayout*>( myAddElementBox->layout() );
404 anAddElementLayout->addWidget( theWidget );
407 myAddElementBox->show();
411 //=================================================================================
412 // function : processFinishedSubOperation
414 //=================================================================================
415 void EntityGUI_PolylineDlg::processFinishedSubOperation( QWidget* theWidget )
417 myEditorWidget->setEnabled( true );
419 QBoxLayout* anAddElementLayout = dynamic_cast<QBoxLayout*>( myAddElementBox->layout() );
420 anAddElementLayout->removeWidget( theWidget );
423 myAddElementBox->hide();
426 //=================================================================================
427 // function : deleteSelected
428 // purpose : Redirect the delete action to editor widget
429 //=================================================================================
430 void EntityGUI_PolylineDlg::deleteSelected()
432 myEditorWidget->removeSelected();
435 //=================================================================================
436 // function : deleteEnabled
437 // purpose : Checks whether there are some to delete
438 //=================================================================================
439 bool EntityGUI_PolylineDlg::deleteEnabled()
441 return myEditorWidget->removeEnabled();
444 //=================================================================================
445 // function : SelectionIntoArgument
446 // purpose : Called when selection is changed
447 //=================================================================================
448 void EntityGUI_PolylineDlg::SelectionIntoArgument( bool isForced )
450 bool isModified = isForced;
451 GEOM::GeomObjPtr aSelectedObject = getSelected(TopAbs_SHAPE);
454 if (aSelectedObject && GEOMBase::GetShape(aSelectedObject.get(), aShape) &&
457 QString aName = GEOMBase::GetName(aSelectedObject.get());
459 if ( myEditCurrentArgument == myPolylineEdit && isCheckToSelect() )
462 CurveCreator_Curve *aNewCurve =
463 new CurveCreator_Curve(CurveCreator::Dim2d);
466 if (CurveCreator_Utils::constructCurve(aShape, aNewCurve, aLocalCS)) {
467 // Change the current curve be the new one.
468 myEditorWidget->setCurve(aNewCurve);
472 myPolylineEdit->setText(aName);
474 AddLocalCS(aSelectedObject.get(), false, aLocalCS);
475 myWPlaneLineEdit->clear();
476 myPlnSelButton->setChecked(false);
478 myPolylineSelButton->setChecked(false);
480 disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
481 myGeomGUI->getApp()->selectionMgr()->clearSelected();
482 connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
483 this, SLOT(SelectionIntoArgument()));
485 // Does nothing, just clears selection.
490 else if ( myEditCurrentArgument == myWPlaneLineEdit && isCheckToSelect() )
492 // Import planar face.
493 if (aShape.ShapeType() == TopAbs_FACE) {
494 // Check if the face is planar
495 Handle(Geom_Surface) aSurf = BRep_Tool::Surface(TopoDS::Face(aShape));
496 GeomLib_IsPlanarSurface aPlanarCheck(aSurf, Precision::Confusion());
498 if (aPlanarCheck.IsPlanar()) {
499 myWPlaneLineEdit->setText(aName);
500 myPolylineEdit->clear();
501 AddLocalCS(aSelectedObject.get(), true,
502 WPlaneToLCS(aSelectedObject.get()));
504 myPlnSelButton->setChecked(false);
505 myPolylineSelButton->setChecked(false);
510 myEditCurrentArgument->setText(tr("GEOM_SKETCHER_WPLANE"));
520 myPlnSelButton->setChecked(false);
522 myPolylineSelButton->setChecked(false);
528 // Does nothing, just clears selection.
529 disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
530 myGeomGUI->getApp()->selectionMgr()->clearSelected();
531 connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
532 this, SLOT(SelectionIntoArgument()));
538 //=================================================================================
539 // function : SetEditCurrentArgument()
541 //=================================================================================
542 void EntityGUI_PolylineDlg::SetEditCurrentArgument( bool isChecked )
544 if (sender() == myPlnSelButton)
547 myEditCurrentArgument = myWPlaneLineEdit;
548 myEditCurrentArgument->setFocus();
549 myPolylineSelButton->blockSignals(true);
550 myPolylineSelButton->setChecked(false);
551 myPolylineSelButton->blockSignals(false);
554 else if (sender() == myPolylineSelButton)
556 myEditCurrentArgument = myPolylineEdit;
557 myEditCurrentArgument->setFocus();
559 myPlnSelButton->blockSignals(true);
560 myPlnSelButton->setChecked(false);
561 myPlnSelButton->blockSignals(false);
566 //=================================================================================
567 // function : ActivateThisDialog
569 //=================================================================================
570 void EntityGUI_PolylineDlg::ActivateThisDialog()
572 GEOMBase_Skeleton::ActivateThisDialog();
574 connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
575 this, SLOT(SelectionIntoArgument()));
578 //=================================================================================
579 // function : enterEvent()
581 //=================================================================================
582 void EntityGUI_PolylineDlg::enterEvent (QEvent*)
584 if (!mainFrame()->GroupConstructors->isEnabled())
585 ActivateThisDialog();
588 //=================================================================================
589 // function : ActivateLocalCS
590 // purpose : Activate & Fit Working plane
591 //=================================================================================
592 void EntityGUI_PolylineDlg::ActivateLocalCS()
594 const int ind = myPlnComboBox->currentIndex();
599 myWPlaneLineEdit->clear();
601 myPolylineEdit->clear();
602 } else if (ind > 0) { // Skip 0 as it is default
603 // Update text on line edits.
604 QString aName = GEOMBase::GetName(GetActiveWPlane().get());
605 bool isPlane = myPlnComboBox->itemData(ind).toBool();
609 myWPlaneLineEdit->setText(aName);
611 myPolylineEdit->clear();
613 myPolylineEdit->setText(aName);
615 myWPlaneLineEdit->clear();
620 gp_Ax3 anAxis = GetActiveLocalCS();
622 myGeomGUI->SetWorkingPlane(anAxis);
623 myGeomGUI->ActiveWorkingPlane();
626 //=================================================================================
627 // function : GetActiveLocalCS
628 // purpose : Get Working plane
629 //=================================================================================
630 gp_Ax3 EntityGUI_PolylineDlg::GetActiveLocalCS()
632 const int ind = myPlnComboBox->currentIndex();
634 return ind >= 0 ? myLCSList.at(ind) : myGeomGUI->GetWorkingPlane();
637 //=================================================================================
638 // function : GetActiveWPlane
639 // purpose : Get Working plane
640 //=================================================================================
641 GEOM::GeomObjPtr EntityGUI_PolylineDlg::GetActiveWPlane()
643 const int ind = myPlnComboBox->currentIndex();
645 return ind >= 0 ? myWPlaneList.at(ind) : GEOM::GeomObjPtr();
648 //=================================================================================
649 // function : AddLocalCS()
650 // purpose : Add All Coordinates systems in study
651 //=================================================================================
652 void EntityGUI_PolylineDlg::AddLocalCS(GEOM::GeomObjPtr theSelectedObject,
654 const gp_Ax3 &theLCS)
656 QString aName = GEOMBase::GetName(theSelectedObject.get());
658 int index = myPlnComboBox->findText(aName, Qt::MatchExactly);
660 if (index == -1) { // If the working plane hasn't been added yet
661 myWPlaneList.push_back(theSelectedObject);
662 myLCSList.push_back(theLCS);
663 myPlnComboBox->addItem(aName, QVariant(IsPlane));
664 index = myPlnComboBox->count();
665 myPlnComboBox->setCurrentIndex(index - 1);
667 myPlnComboBox->setCurrentIndex(index);
672 //=================================================================================
673 // function : WPlaneToLCS ( aWPlane )
675 //=================================================================================
676 gp_Ax3 EntityGUI_PolylineDlg::WPlaneToLCS(GEOM::GeomObjPtr theGeomObj)
678 TopoDS_Shape aShape =
679 GEOM_Client::get_client().GetShape(GeometryGUI::GetGeomGen(), theGeomObj.get());
682 if (theGeomObj || aShape.IsNull()) {
683 MESSAGE("CORBA::is_nil(theGeomObj) || aShape.IsNull()")
686 aLCS.Transform(aShape.Location().Transformation());
688 if (aShape.ShapeType() == TopAbs_FACE) {
689 GEOM::GEOM_IMeasureOperations_ptr aMeasureOp =
690 myGeomGUI->GetGeomGen()->GetIMeasureOperations(getStudyId());
691 double Ox, Oy, Oz, Zx, Zy, Zz, Xx, Xy, Xz;
693 aMeasureOp->GetPosition(theGeomObj.get(), Ox, Oy, Oz, Zx, Zy, Zz, Xx, Xy, Xz);
695 if (aMeasureOp->IsDone()) {
696 gp_Pnt aPnt (Ox, Oy, Oz);
697 gp_Dir aDirN (Zx, Zy, Zz);
698 gp_Dir aDirX (Xx, Xy, Xz);
699 aLCS = gp_Ax3(aPnt, aDirN, aDirX);
706 //=================================================================================
707 // function : getSourceObjects
708 // purpose : virtual method to get source objects
709 //=================================================================================
710 QList<GEOM::GeomObjPtr> EntityGUI_PolylineDlg::getSourceObjects()
715 //=================================================================================
716 // function : setPreviewManager ( OCCViewer_ViewManager )
717 // purpose : Sets view manager to control the displayed objects.
718 //=================================================================================
719 void EntityGUI_PolylineDlg::setPreviewManager( OCCViewer_ViewManager* theManager )
721 myPreviewManager = theManager;
723 if ( getPreviewManager() )
725 if( OCCViewer_Viewer* aViewer = getPreviewManager()->getOCCViewer() )
727 Handle(AIS_InteractiveContext) aCtx = aViewer->getAISContext();
730 // Add Z layer to show temporary objects
732 aViewer->getViewer3d()->AddZLayer( aZLayer );
733 setPreviewZLayer( aZLayer );
739 //=================================================================================
740 // function : getPreviewManager()
742 //=================================================================================
743 OCCViewer_ViewManager* EntityGUI_PolylineDlg::getPreviewManager()
745 return myPreviewManager;
748 //=================================================================================
749 // function : setPreviewZLayer( theZLayer )
750 // purpose : Sets Z layer to show temporary objects.
751 //=================================================================================
752 void EntityGUI_PolylineDlg::setPreviewZLayer( int theZLayer )
754 if ( theZLayer != myPreviewZLayer )
755 myPreviewZLayer = theZLayer;
758 //=================================================================================
759 // function : getPreviewZLayer()
761 //=================================================================================
762 int EntityGUI_PolylineDlg::getPreviewZLayer() const
764 return myPreviewZLayer;
767 //=================================================================================
768 // function : displayPreview()
770 //=================================================================================
771 void EntityGUI_PolylineDlg::displayPreview()
773 if ( getPreviewManager() )
775 if ( OCCViewer_Viewer* aViewer = getPreviewManager()->getOCCViewer() )
777 // Disable changing of OCCViewer's selection to use vertex of curve selection
778 disconnect(getPreviewManager(), SIGNAL(mouseRelease(SUIT_ViewWindow*, QMouseEvent*)),
779 aViewer, SLOT(onMouseRelease(SUIT_ViewWindow*, QMouseEvent*)));
781 Handle(AIS_InteractiveContext) aCtx = aViewer->getAISContext();
782 if ( !aCtx.IsNull() )
784 CurveCreator_Displayer* aDisplayer = new CurveCreator_Displayer( aCtx, getPreviewZLayer() );
785 myCurve->setDisplayer( aDisplayer );
787 Handle(AIS_InteractiveObject) anAISObj = myCurve->getAISObject( true );
788 aDisplayer->display( anAISObj, true );
790 // Set color for temporary AIS_InteractiveObject
791 anAISObj->Attributes()->WireAspect()->SetColor( Quantity_NOC_VIOLET );
797 //=================================================================================
798 // function : erasePreview()
800 //=================================================================================
801 void EntityGUI_PolylineDlg::erasePreview()
803 CurveCreator_Displayer* aDisplayer = myCurve ? myCurve->getDisplayer() : 0;
804 if( getPreviewManager() )
806 if( OCCViewer_Viewer* aViewer = getPreviewManager()->getOCCViewer() )
808 Handle(AIS_InteractiveContext) aCtx = aViewer->getAISContext();
809 if( !aCtx.IsNull() && aDisplayer )
810 aDisplayer->eraseAll( true );
812 // Enable changing of OCCViewer's selection
813 connect(getPreviewManager(), SIGNAL(mouseRelease(SUIT_ViewWindow*, QMouseEvent*)),
814 aViewer, SLOT(onMouseRelease(SUIT_ViewWindow*, QMouseEvent*)));
818 setPreviewManager( NULL );
826 //=================================================================================
827 // function : isCheckToSelect()
829 //=================================================================================
830 bool EntityGUI_PolylineDlg::isCheckToSelect()
833 return myPlnSelButton->isChecked();
835 return myPolylineSelButton->isChecked();