1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
3 #include "PartSet_SketcherReetntrantMgr.h"
4 #include "PartSet_Module.h"
5 #include "PartSet_SketcherMgr.h"
6 #include "PartSet_WidgetPoint2d.h"
8 #include "ModelAPI_Session.h"
9 #include "ModelAPI_AttributeString.h"
10 #include "ModelAPI_AttributeRefAttr.h"
12 #include "GeomDataAPI_Point2D.h"
14 #include <ModuleBase_IPropertyPanel.h>
15 #include <ModuleBase_OperationFeature.h>
16 #include <ModuleBase_ModelWidget.h>
17 #include <ModuleBase_ViewerPrs.h>
18 #include <ModuleBase_WidgetSelector.h>
19 #include <ModuleBase_PageWidget.h>
20 #include <ModuleBase_PageBase.h>
21 #include <ModuleBase_WidgetFactory.h>
22 #include <ModuleBase_OperationDescription.h>
23 #include "ModuleBase_ToolBox.h"
24 #include "ModuleBase_ISelection.h"
26 #include <SketchPlugin_Feature.h>
27 #include <SketchPlugin_Line.h>
28 #include <SketchPlugin_Arc.h>
29 #include <SketchPlugin_Circle.h>
30 #include <SketchPlugin_Point.h>
32 #include <XGUI_Workshop.h>
33 #include <XGUI_ModuleConnector.h>
34 #include <XGUI_OperationMgr.h>
35 #include <XGUI_PropertyPanel.h>
36 #include <XGUI_ErrorMgr.h>
37 #include <XGUI_SelectionMgr.h>
39 #include <QToolButton>
41 PartSet_SketcherReetntrantMgr::PartSet_SketcherReetntrantMgr(ModuleBase_IWorkshop* theWorkshop)
42 : QObject(theWorkshop),
43 myWorkshop(theWorkshop),
44 myRestartingMode(RM_None),
45 myIsFlagsBlocked(false),
46 myIsInternalEditOperation(false),
47 myNoMoreWidgetsAttribute("")
51 PartSet_SketcherReetntrantMgr::~PartSet_SketcherReetntrantMgr()
55 ModuleBase_ModelWidget* PartSet_SketcherReetntrantMgr::internalActiveWidget() const
57 ModuleBase_ModelWidget* aWidget = 0;
61 ModuleBase_Operation* anOperation = myWorkshop->currentOperation();
63 ModuleBase_IPropertyPanel* aPanel = anOperation->propertyPanel();
64 if (aPanel) { // check for case when the operation is started but property panel is not filled
65 ModuleBase_ModelWidget* anActiveWidget = aPanel->activeWidget();
66 if (myIsInternalEditOperation && (!anActiveWidget || !anActiveWidget->isViewerSelector()))
67 aWidget = myInternalActiveWidget;
73 bool PartSet_SketcherReetntrantMgr::isInternalEditActive() const
75 return myIsInternalEditOperation;
78 void PartSet_SketcherReetntrantMgr::updateInternalEditActiveState()
80 if (myIsInternalEditOperation) {
81 ModuleBase_OperationFeature* aFOperation = dynamic_cast<ModuleBase_OperationFeature*>
82 (myWorkshop->currentOperation());
84 FeaturePtr aFeature = aFOperation->feature();
85 QString anError = myWorkshop->module()->getFeatureError(aFeature);
86 // stop started internal edit operation as soon as the operation becomes invalid
87 // it is especially important for the sketch tangent arc feature
88 if (!anError.isEmpty()) {
89 aFOperation->setEditOperation(false);
90 //workshop()->operationMgr()->updateApplyOfOperations();
91 myIsInternalEditOperation = false;
92 updateAcceptAllAction();
98 bool PartSet_SketcherReetntrantMgr::operationCommitted(ModuleBase_Operation* theOperation)
100 bool aProcessed = false;
104 aProcessed = myIsInternalEditOperation;
110 void PartSet_SketcherReetntrantMgr::operationStarted(ModuleBase_Operation* theOperation)
115 if (myPreviousFeature.get() && myRestartingMode == RM_LastFeatureUsed) {
116 ModuleBase_OperationFeature* aCurrentOperation = dynamic_cast<ModuleBase_OperationFeature*>(
117 myWorkshop->currentOperation());
118 CompositeFeaturePtr aSketch = module()->sketchMgr()->activeSketch();
119 copyReetntrantAttributes(myPreviousFeature, aCurrentOperation->feature(), aSketch);
124 void PartSet_SketcherReetntrantMgr::operationAborted(ModuleBase_Operation* theOperation)
132 bool PartSet_SketcherReetntrantMgr::processMouseMoved(ModuleBase_IViewWindow* theWnd,
133 QMouseEvent* theEvent)
135 bool aProcessed = false;
139 if (myIsInternalEditOperation) {
140 ModuleBase_OperationFeature* aFOperation = dynamic_cast<ModuleBase_OperationFeature*>
141 (myWorkshop->currentOperation());
142 FeaturePtr aLastFeature = myRestartingMode == RM_LastFeatureUsed ? aFOperation->feature()
145 ModuleBase_ModelWidget* anActiveWidget = module()->activeWidget();
146 ModuleBase_IPropertyPanel* aPanel = myWorkshop->currentOperation()->propertyPanel();
148 FeaturePtr aCurrentFeature = aFOperation->feature();
149 bool isLineFeature = false, isArcFeature = false;
150 std::string anAttributeOnStart;
151 if (aCurrentFeature->getKind() == SketchPlugin_Line::ID()) {
152 anAttributeOnStart = SketchPlugin_Line::START_ID();
153 isLineFeature = anActiveWidget->attributeID() == anAttributeOnStart;
155 else if (isTangentArc(aFOperation, module()->sketchMgr()->activeSketch())) {
156 anAttributeOnStart = SketchPlugin_Arc::TANGENT_POINT_ID();
157 isArcFeature = anActiveWidget->attributeID() == anAttributeOnStart;
159 bool aCanBeActivatedByMove = isLineFeature || isArcFeature;
160 if (aCanBeActivatedByMove) {
161 /// before restarting of operation we need to clear selection, as it may take part in
162 /// new feature creation, e.g. tangent arc. But it is not necessary as it was processed
163 /// by mouse release when the operation was restarted.
164 workshop()->selector()->clearSelection();
166 myPreviousFeature = aFOperation->feature();
168 myPreviousFeature = FeaturePtr();
170 anActiveWidget = module()->activeWidget();
171 aCurrentFeature = anActiveWidget->feature();
173 if (anActiveWidget->attributeID() == anAttributeOnStart) {
174 // it was not deactivated by preselection processing
175 aPanel->activateNextWidget(anActiveWidget);
178 // processing mouse move in active widget of restarted operation
179 ModuleBase_ModelWidget* anActiveWidget = module()->activeWidget();
180 PartSet_MouseProcessor* aProcessor = dynamic_cast<PartSet_MouseProcessor*>(anActiveWidget);
182 aProcessor->mouseMoved(theWnd, theEvent);
189 bool PartSet_SketcherReetntrantMgr::processMousePressed(ModuleBase_IViewWindow* /* theWnd*/,
190 QMouseEvent* /* theEvent*/)
192 return isActiveMgr() && myIsInternalEditOperation;
195 bool PartSet_SketcherReetntrantMgr::processMouseReleased(ModuleBase_IViewWindow* theWnd,
196 QMouseEvent* theEvent)
198 bool aProcessed = false;
202 if (myIsInternalEditOperation) {
203 ModuleBase_Operation* anOperation = myWorkshop->currentOperation();
204 ModuleBase_IPropertyPanel* aPanel = anOperation->propertyPanel();
206 ModuleBase_ModelWidget* anActiveWidget = aPanel->activeWidget();
207 if (!anActiveWidget || !anActiveWidget->isViewerSelector()) {
209 // block of viewer update
210 // we need to block update content of the viewer because of Sketch Point feature
211 // in activate() the value of the point is initialized and it can be displayed
212 // but the default value is [0, 0]. So, we block update viewer contentent until
213 // onMouseRelease happens, which correct the point position
214 ModuleBase_Tools::blockUpdateViewer(true);
216 ModuleBase_OperationFeature* aFOperation = dynamic_cast<ModuleBase_OperationFeature*>
217 (myWorkshop->currentOperation());
218 myPreviousFeature = aFOperation->feature();
220 /// selection should be obtained from workshop before ask if the operation can be started as
221 /// the canStartOperation method performs commit/abort of previous operation.
222 /// Sometimes commit/abort
223 /// may cause selection clear(Sketch operation) as a result
224 /// it will be lost and is not used for preselection.
225 ModuleBase_ISelection* aSelection = myWorkshop->selection();
226 QList<ModuleBase_ViewerPrsPtr> aPreSelected =
227 aSelection->getSelected(ModuleBase_ISelection::AllControls);
230 myPreviousFeature = FeaturePtr();
233 // fill the first widget by the mouse event point
234 // if the active widget is not the first, it means that the restarted operation is filled by
235 // the current preselection.
236 PartSet_WidgetPoint2D* aPoint2DWdg =
237 dynamic_cast<PartSet_WidgetPoint2D*>(module()->activeWidget());
238 ModuleBase_ModelWidget* aFirstWidget = aPanel->findFirstAcceptingValueWidget();
239 if (aPoint2DWdg && aPoint2DWdg == aFirstWidget) {
240 if (!aPreSelected.empty())
241 aPoint2DWdg->setPreSelection(aPreSelected.front());
242 aPoint2DWdg->mouseReleased(theWnd, theEvent);
243 if (!aPreSelected.empty())
244 aPoint2DWdg->setPreSelection(ModuleBase_ViewerPrsPtr());
246 // unblock viewer update
247 ModuleBase_Tools::blockUpdateViewer(false);
254 void PartSet_SketcherReetntrantMgr::onWidgetActivated()
258 if (!myIsInternalEditOperation)
261 PartSet_Module* aModule = module();
262 ModuleBase_ModelWidget* aFirstWidget = aModule->activeWidget();
263 ModuleBase_IPropertyPanel* aPanel = aModule->currentOperation()->propertyPanel();
264 if (aFirstWidget != aPanel->activeWidget()) {
265 ModuleBase_WidgetSelector* aWSelector = dynamic_cast<ModuleBase_WidgetSelector*>(aFirstWidget);
267 aWSelector->activateSelectionAndFilters(true);
271 void PartSet_SketcherReetntrantMgr::onNoMoreWidgets(const std::string& thePreviousAttributeID)
276 // we should avoid processing of the signal about no more widgets attributes and
277 // do this after the restart operaion is finished if it was called
278 // onNoMoreWidgets depends on myIsFlagsBlocked and fill myNoMoreWidgetsAttribute
279 // if it should be called after restart
280 if (myIsFlagsBlocked) {
281 myNoMoreWidgetsAttribute = thePreviousAttributeID;
285 ModuleBase_OperationFeature* aFOperation = dynamic_cast<ModuleBase_OperationFeature*>
286 (myWorkshop->currentOperation());
287 if (!myWorkshop->module()->getFeatureError(aFOperation->feature()).isEmpty())
290 if (aFOperation && module()->sketchMgr()->isNestedSketchOperation(aFOperation)) {
291 bool isStarted = false;
292 if (!module()->sketchMgr()->sketchSolverError()) {
293 if (myRestartingMode != RM_Forbided) {
294 myRestartingMode = RM_LastFeatureUsed;
295 isStarted = startInternalEdit(thePreviousAttributeID);
299 aFOperation->commit();
303 bool PartSet_SketcherReetntrantMgr::processEnter(const std::string& thePreviousAttributeID)
310 // empty previous attribute means that the Apply/Ok button has focus and the enter
311 // should not lead to start edition mode of the previous operation
312 if (thePreviousAttributeID.empty())
315 ModuleBase_OperationFeature* aFOperation = dynamic_cast<ModuleBase_OperationFeature*>
316 (myWorkshop->currentOperation());
317 if (!myWorkshop->module()->getFeatureError(aFOperation->feature()).isEmpty())
320 bool isSketchSolverError = module()->sketchMgr()->sketchSolverError();
322 if (!isSketchSolverError) {
323 myRestartingMode = RM_EmptyFeatureUsed;
324 isDone = startInternalEdit(thePreviousAttributeID);
330 void PartSet_SketcherReetntrantMgr::onVertexSelected()
335 ModuleBase_Operation* anOperation = myWorkshop->currentOperation();
336 std::string anOperationId = anOperation->id().toStdString();
337 if (anOperationId == SketchPlugin_Line::ID() ||
338 isTangentArc(anOperation, module()->sketchMgr()->activeSketch())) {
339 /// If last line finished on vertex the lines creation sequence has to be break
340 ModuleBase_IPropertyPanel* aPanel = anOperation->propertyPanel();
341 ModuleBase_ModelWidget* anActiveWidget = aPanel->activeWidget();
342 const QList<ModuleBase_ModelWidget*>& aWidgets = aPanel->modelWidgets();
343 QList<ModuleBase_ModelWidget*>::const_iterator anIt = aWidgets.begin(), aLast = aWidgets.end();
344 bool aFoundWidget = false;
345 bool aFoundObligatory = false;
346 for (; anIt != aLast && !aFoundObligatory; anIt++) {
348 aFoundWidget = *anIt == anActiveWidget;
350 aFoundObligatory = (*anIt)->isObligatory();
352 if (!aFoundObligatory)
353 myRestartingMode = RM_Forbided;
357 void PartSet_SketcherReetntrantMgr::onBeforeStopped()
359 if (!isActiveMgr() || !myIsInternalEditOperation)
362 beforeStopInternalEdit();
365 bool PartSet_SketcherReetntrantMgr::canBeCommittedByPreselection()
367 return !isActiveMgr() || myRestartingMode == RM_None;
370 bool PartSet_SketcherReetntrantMgr::isInternalEditStarted() const
372 return myIsInternalEditOperation;
375 bool PartSet_SketcherReetntrantMgr::isActiveMgr() const
377 ModuleBase_Operation* aCurrentOperation = myWorkshop->currentOperation();
379 bool anActive = PartSet_SketcherMgr::isSketchOperation(aCurrentOperation);
381 anActive = module()->sketchMgr()->isNestedSketchOperation(aCurrentOperation);
382 if (anActive) { // the manager is not active when the current operation is a usual Edit
383 ModuleBase_OperationFeature* aFOperation = dynamic_cast<ModuleBase_OperationFeature*>
384 (myWorkshop->currentOperation());
385 if (aFOperation->isEditOperation())
386 anActive = myIsInternalEditOperation;
392 bool PartSet_SketcherReetntrantMgr::startInternalEdit(const std::string& thePreviousAttributeID)
395 /// this is workaround for ModuleBase_WidgetEditor, used in SALOME mode. Sometimes key enter
396 /// event comes two times, so we should not start another internal edit operation
397 /// the Apply button becomes disabled becase the second additional internal feature is created
398 if (myIsInternalEditOperation)
401 ModuleBase_OperationFeature* aFOperation = dynamic_cast<ModuleBase_OperationFeature*>
402 (myWorkshop->currentOperation());
404 if (aFOperation && module()->sketchMgr()->isNestedSketchOperation(aFOperation)) {
405 aFOperation->setEditOperation(true/*, false*/);
406 createInternalFeature();
408 myIsInternalEditOperation = true;
409 updateAcceptAllAction();
412 connect(aFOperation, SIGNAL(beforeCommitted()), this, SLOT(onBeforeStopped()));
413 connect(aFOperation, SIGNAL(beforeAborted()), this, SLOT(onBeforeStopped()));
415 // activate selection filters of the first widget in the viewer
418 // activate the last active widget in the Property Panel
419 if (!thePreviousAttributeID.empty()) {
420 ModuleBase_Operation* anEditOperation = module()->currentOperation();
421 if (anEditOperation) {
422 ModuleBase_IPropertyPanel* aPanel = aFOperation->propertyPanel();
423 ModuleBase_ModelWidget* aPreviousAttributeWidget = 0;
424 QList<ModuleBase_ModelWidget*> aWidgets = aPanel->modelWidgets();
425 for (int i = 0, aNb = aWidgets.size(); i < aNb && !aPreviousAttributeWidget; i++) {
426 if (aWidgets[i]->attributeID() == thePreviousAttributeID) {
427 /// workaround for the same attributes used in different stacked widgets(attribute types)
428 if (ModuleBase_ToolBox::isOffToolBoxParent(aWidgets[i]))
430 aPreviousAttributeWidget = aWidgets[i];
433 // If the current widget is a selector, do nothing, it processes the mouse press
434 if (aPreviousAttributeWidget) {
435 if (!aPreviousAttributeWidget->isViewerSelector()) {
436 aPreviousAttributeWidget->focusTo();
437 aPreviousAttributeWidget->selectContent();
440 // in case of shape multi selector, the widget does not lose focus by filling
441 // like it is in shape selector. So, if enter is pressed, the multi shape selector
442 // control should be deactivated. The focus is moved to Apply button and there
443 // should not be active control visualized in property panel
444 if (aPreviousAttributeWidget == aPanel->activeWidget()) {
445 aPanel->activateWidget(NULL, false);
447 // if there is no the next widget to be automatically activated,
448 // the Ok button in property
449 // panel should accept the focus(example is parallel constraint on sketch lines)
450 QToolButton* anOkBtn =
451 dynamic_cast<XGUI_PropertyPanel*>(aPanel)->findButton(PROP_PANEL_OK);
453 anOkBtn->setFocus(Qt::TabFocusReason);
460 module()->sketchMgr()->clearClickedFlags();
465 void PartSet_SketcherReetntrantMgr::beforeStopInternalEdit()
467 ModuleBase_OperationFeature* aFOperation = dynamic_cast<ModuleBase_OperationFeature*>
468 (myWorkshop->currentOperation());
470 disconnect(aFOperation, SIGNAL(beforeCommitted()), this, SLOT(onBeforeStopped()));
471 disconnect(aFOperation, SIGNAL(beforeAborted()), this, SLOT(onBeforeStopped()));
474 deleteInternalFeature();
477 void PartSet_SketcherReetntrantMgr::restartOperation()
479 if (myIsInternalEditOperation) {
480 ModuleBase_OperationFeature* aFOperation = dynamic_cast<ModuleBase_OperationFeature*>(
481 myWorkshop->currentOperation());
483 myNoMoreWidgetsAttribute = "";
484 myIsFlagsBlocked = true;
485 module()->launchOperation(aFOperation->id());
486 myIsFlagsBlocked = false;
488 // we should avoid processing of the signal about no more widgets attributes and
489 // do this after the restart operaion is finished if it was called
490 // onNoMoreWidgets depends on myIsFlagsBlocked and fill myNoMoreWidgetsAttribute
491 // if it should be called after restart
492 if (!myNoMoreWidgetsAttribute.empty()) {
493 onNoMoreWidgets(myNoMoreWidgetsAttribute);
494 myNoMoreWidgetsAttribute = "";
500 void PartSet_SketcherReetntrantMgr::createInternalFeature()
502 ModuleBase_OperationFeature* aFOperation = dynamic_cast<ModuleBase_OperationFeature*>
503 (myWorkshop->currentOperation());
505 if (aFOperation && module()->sketchMgr()->isNestedSketchOperation(aFOperation)) {
506 FeaturePtr anOperationFeature = aFOperation->feature();
508 CompositeFeaturePtr aSketch = module()->sketchMgr()->activeSketch();
509 myInternalFeature = aSketch->addFeature(anOperationFeature->getKind());
511 bool isFeatureChanged = copyReetntrantAttributes(anOperationFeature, myInternalFeature,
513 XGUI_PropertyPanel* aPropertyPanel = dynamic_cast<XGUI_PropertyPanel*>
514 (aFOperation->propertyPanel());
516 myInternalWidget = new QWidget(aPropertyPanel->contentWidget()->pageWidget());
517 myInternalWidget->setVisible(false);
519 ModuleBase_PageWidget* anInternalPage = new ModuleBase_PageWidget(myInternalWidget);
521 QString aXmlRepr = aFOperation->getDescription()->xmlRepresentation();
522 ModuleBase_WidgetFactory aFactory(aXmlRepr.toStdString(), myWorkshop);
524 aFactory.createWidget(anInternalPage);
525 QList<ModuleBase_ModelWidget*> aWidgets = aFactory.getModelWidgets();
527 foreach (ModuleBase_ModelWidget* aWidget, aWidgets) {
528 bool isStoreValue = !aFOperation->isEditOperation() &&
529 !aWidget->getDefaultValue().empty() &&
530 !aWidget->isComputedDefault();
531 aWidget->setFeature(myInternalFeature, isStoreValue);
532 if (!isStoreValue && isFeatureChanged)
533 aWidget->restoreValue();
536 ModuleBase_ModelWidget* aFirstWidget = ModuleBase_IPropertyPanel::findFirstAcceptingValueWidget
539 myInternalActiveWidget = aFirstWidget;
543 void PartSet_SketcherReetntrantMgr::deleteInternalFeature()
545 if (myInternalActiveWidget) {
546 ModuleBase_WidgetSelector* aWSelector =
547 dynamic_cast<ModuleBase_WidgetSelector*>(myInternalActiveWidget);
549 aWSelector->activateSelectionAndFilters(false);
550 myInternalActiveWidget = 0;
552 delete myInternalWidget;
553 myInternalWidget = 0;
555 QObjectPtrList anObjects;
556 anObjects.append(myInternalFeature);
557 workshop()->deleteFeatures(anObjects);
558 myInternalFeature = FeaturePtr();
561 void PartSet_SketcherReetntrantMgr::resetFlags()
563 if (!myIsFlagsBlocked) {
564 myIsInternalEditOperation = false;
565 updateAcceptAllAction();
566 myRestartingMode = RM_None;
570 bool PartSet_SketcherReetntrantMgr::copyReetntrantAttributes(const FeaturePtr& theSourceFeature,
571 const FeaturePtr& theNewFeature,
572 const CompositeFeaturePtr& theSketch,
573 const bool isTemporary)
575 bool aChanged = false;
576 if (!theSourceFeature.get() || !theSourceFeature->data().get() ||
577 !theSourceFeature->data()->isValid())
580 std::string aFeatureKind = theSourceFeature->getKind();
581 if (aFeatureKind == SketchPlugin_Line::ID()) {
582 // Initialize new line with first point equal to end of previous
583 std::shared_ptr<ModelAPI_Data> aSFData = theSourceFeature->data();
584 std::shared_ptr<GeomDataAPI_Point2D> aSPoint = std::dynamic_pointer_cast<GeomDataAPI_Point2D>(
585 aSFData->attribute(SketchPlugin_Line::END_ID()));
586 std::shared_ptr<ModelAPI_Data> aNFData = theNewFeature->data();
587 std::shared_ptr<GeomDataAPI_Point2D> aNPoint = std::dynamic_pointer_cast<GeomDataAPI_Point2D>(
588 aNFData->attribute(SketchPlugin_Line::START_ID()));
589 aNPoint->setValue(aSPoint->x(), aSPoint->y());
590 PartSet_Tools::createConstraint(theSketch, aSPoint, aNPoint);
592 aNPoint = std::dynamic_pointer_cast<GeomDataAPI_Point2D>(
593 aSFData->attribute(SketchPlugin_Line::END_ID()));
594 aNPoint->setValue(aSPoint->x(), aSPoint->y());
596 else if (aFeatureKind == SketchPlugin_Circle::ID()) {
598 std::string aTypeAttributeId = SketchPlugin_Circle::CIRCLE_TYPE();
599 AttributeStringPtr aSourceFeatureTypeAttr = theSourceFeature->data()->string(aTypeAttributeId);
600 AttributeStringPtr aNewFeatureTypeAttr = theNewFeature->data()->string(aTypeAttributeId);
601 aNewFeatureTypeAttr->setValue(aSourceFeatureTypeAttr->value());
602 //ModuleBase_Tools::flushUpdated(theNewFeature);
605 else if (aFeatureKind == SketchPlugin_Arc::ID()) {
607 std::string aTypeAttributeId = SketchPlugin_Arc::ARC_TYPE();
608 AttributeStringPtr aSourceFeatureTypeAttr = theSourceFeature->data()->string(aTypeAttributeId);
609 AttributeStringPtr aNewFeatureTypeAttr = theNewFeature->data()->string(aTypeAttributeId);
610 aNewFeatureTypeAttr->setValue(aSourceFeatureTypeAttr->value());
612 // if the arc is tangent, set coincidence to end point of the previous arc
613 std::string anArcType = aSourceFeatureTypeAttr->value();
614 if (anArcType == SketchPlugin_Arc::ARC_TYPE_TANGENT()) {
615 // get the last point of the previuos arc feature(geom point 2d)
616 std::shared_ptr<ModelAPI_Data> aSData = theSourceFeature->data();
617 std::shared_ptr<GeomDataAPI_Point2D> aSPointAttr =
618 std::dynamic_pointer_cast<GeomDataAPI_Point2D>(
619 aSData->attribute(SketchPlugin_Arc::END_ID()));
620 // get point attribute on the current feature
621 AttributeRefAttrPtr aTangentPointAttr = theNewFeature->data()->refattr(
622 SketchPlugin_Arc::TANGENT_POINT_ID());
623 aTangentPointAttr->setAttr(aSPointAttr);
625 std::shared_ptr<GeomDataAPI_Point2D> aNPointAttr =
626 std::dynamic_pointer_cast<GeomDataAPI_Point2D>(
627 theNewFeature->data()->attribute(SketchPlugin_Arc::END_ID()));
628 aNPointAttr->setValue(aSPointAttr->x(), aSPointAttr->y());
631 //ModuleBase_Tools::flushUpdated(theNewFeature);
637 bool PartSet_SketcherReetntrantMgr::isTangentArc(ModuleBase_Operation* theOperation,
638 const CompositeFeaturePtr& /*theSketch*/) const
640 bool aTangentArc = false;
641 ModuleBase_OperationFeature* aFOperation = dynamic_cast<ModuleBase_OperationFeature*>
643 if (aFOperation && module()->sketchMgr()->isNestedSketchOperation(aFOperation)) {
644 FeaturePtr aFeature = aFOperation->feature();
645 if (aFeature.get() && aFeature->getKind() == SketchPlugin_Arc::ID()) {
646 AttributeStringPtr aTypeAttr = aFeature->data()->string(SketchPlugin_Arc::ARC_TYPE());
647 std::string anArcType = aTypeAttr.get() ? aTypeAttr->value() : "";
648 aTangentArc = anArcType == SketchPlugin_Arc::ARC_TYPE_TANGENT();
654 void PartSet_SketcherReetntrantMgr::updateAcceptAllAction()
656 CompositeFeaturePtr aSketch = module()->sketchMgr()->activeSketch();
658 workshop()->errorMgr()->updateAcceptAllAction(aSketch);
661 XGUI_Workshop* PartSet_SketcherReetntrantMgr::workshop() const
663 XGUI_ModuleConnector* aConnector = dynamic_cast<XGUI_ModuleConnector*>(myWorkshop);
664 return aConnector->workshop();
667 PartSet_Module* PartSet_SketcherReetntrantMgr::module() const
669 return dynamic_cast<PartSet_Module*>(myWorkshop->module());