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>
31 #include <XGUI_Workshop.h>
32 #include <XGUI_ModuleConnector.h>
33 #include <XGUI_OperationMgr.h>
34 #include <XGUI_PropertyPanel.h>
35 #include <XGUI_ErrorMgr.h>
37 #include <QToolButton>
39 PartSet_SketcherReetntrantMgr::PartSet_SketcherReetntrantMgr(ModuleBase_IWorkshop* theWorkshop)
40 : QObject(theWorkshop),
41 myWorkshop(theWorkshop),
42 myRestartingMode(RM_None),
43 myIsFlagsBlocked(false),
44 myIsInternalEditOperation(false),
45 myNoMoreWidgetsAttribute("")
49 PartSet_SketcherReetntrantMgr::~PartSet_SketcherReetntrantMgr()
53 ModuleBase_ModelWidget* PartSet_SketcherReetntrantMgr::internalActiveWidget() const
55 ModuleBase_ModelWidget* aWidget = 0;
59 ModuleBase_Operation* anOperation = myWorkshop->currentOperation();
61 ModuleBase_IPropertyPanel* aPanel = anOperation->propertyPanel();
62 if (aPanel) { // check for case when the operation is started but property panel is not filled
63 ModuleBase_ModelWidget* anActiveWidget = aPanel->activeWidget();
64 if (myIsInternalEditOperation && (!anActiveWidget || !anActiveWidget->isViewerSelector()))
65 aWidget = myInternalActiveWidget;
71 bool PartSet_SketcherReetntrantMgr::isInternalEditActive() const
73 return myIsInternalEditOperation;
76 void PartSet_SketcherReetntrantMgr::updateInternalEditActiveState()
78 if (myIsInternalEditOperation) {
79 ModuleBase_OperationFeature* aFOperation = dynamic_cast<ModuleBase_OperationFeature*>
80 (myWorkshop->currentOperation());
82 FeaturePtr aFeature = aFOperation->feature();
83 QString anError = myWorkshop->module()->getFeatureError(aFeature);
84 // stop started internal edit operation as soon as the operation becomes invalid
85 // it is especially important for the sketch tangent arc feature
86 if (!anError.isEmpty()) {
87 aFOperation->setEditOperation(false);
88 //workshop()->operationMgr()->updateApplyOfOperations();
89 myIsInternalEditOperation = false;
90 updateAcceptAllAction();
96 bool PartSet_SketcherReetntrantMgr::operationCommitted(ModuleBase_Operation* theOperation)
98 bool aProcessed = false;
102 aProcessed = myIsInternalEditOperation;
108 void PartSet_SketcherReetntrantMgr::operationStarted(ModuleBase_Operation* theOperation)
113 if (myPreviousFeature.get() && myRestartingMode == RM_LastFeatureUsed) {
114 ModuleBase_OperationFeature* aCurrentOperation = dynamic_cast<ModuleBase_OperationFeature*>(
115 myWorkshop->currentOperation());
116 CompositeFeaturePtr aSketch = module()->sketchMgr()->activeSketch();
117 copyReetntrantAttributes(myPreviousFeature, aCurrentOperation->feature(), aSketch);
122 void PartSet_SketcherReetntrantMgr::operationAborted(ModuleBase_Operation* theOperation)
130 bool PartSet_SketcherReetntrantMgr::processMouseMoved(ModuleBase_IViewWindow* theWnd,
131 QMouseEvent* theEvent)
133 bool aProcessed = false;
137 if (myIsInternalEditOperation) {
138 ModuleBase_OperationFeature* aFOperation = dynamic_cast<ModuleBase_OperationFeature*>
139 (myWorkshop->currentOperation());
140 FeaturePtr aLastFeature = myRestartingMode == RM_LastFeatureUsed ? aFOperation->feature()
143 ModuleBase_ModelWidget* anActiveWidget = module()->activeWidget();
144 ModuleBase_IPropertyPanel* aPanel = myWorkshop->currentOperation()->propertyPanel();
146 FeaturePtr aCurrentFeature = aFOperation->feature();
147 bool isLineFeature = false, isArcFeature = false;
148 std::string anAttributeOnStart;
149 if (aCurrentFeature->getKind() == SketchPlugin_Line::ID()) {
150 anAttributeOnStart = SketchPlugin_Line::START_ID();
151 isLineFeature = anActiveWidget->attributeID() == anAttributeOnStart;
153 else if (isTangentArc(aFOperation, module()->sketchMgr()->activeSketch())) {
154 anAttributeOnStart = SketchPlugin_Arc::TANGENT_POINT_ID();
155 isArcFeature = anActiveWidget->attributeID() == anAttributeOnStart;
157 bool aCanBeActivatedByMove = isLineFeature || isArcFeature;
158 if (aCanBeActivatedByMove) {
159 myPreviousFeature = aFOperation->feature();
161 myPreviousFeature = FeaturePtr();
163 anActiveWidget = module()->activeWidget();
164 aCurrentFeature = anActiveWidget->feature();
166 if (anActiveWidget->attributeID() == anAttributeOnStart) {
167 // it was not deactivated by preselection processing
168 aPanel->activateNextWidget(anActiveWidget);
171 // processing mouse move in active widget of restarted operation
172 ModuleBase_ModelWidget* anActiveWidget = module()->activeWidget();
173 PartSet_MouseProcessor* aProcessor = dynamic_cast<PartSet_MouseProcessor*>(anActiveWidget);
175 aProcessor->mouseMoved(theWnd, theEvent);
182 bool PartSet_SketcherReetntrantMgr::processMousePressed(ModuleBase_IViewWindow* /* theWnd*/,
183 QMouseEvent* /* theEvent*/)
185 return isActiveMgr() && myIsInternalEditOperation;
188 bool PartSet_SketcherReetntrantMgr::processMouseReleased(ModuleBase_IViewWindow* theWnd,
189 QMouseEvent* theEvent)
191 bool aProcessed = false;
195 if (myIsInternalEditOperation) {
196 ModuleBase_Operation* anOperation = myWorkshop->currentOperation();
197 ModuleBase_IPropertyPanel* aPanel = anOperation->propertyPanel();
199 ModuleBase_ModelWidget* anActiveWidget = aPanel->activeWidget();
200 if (!anActiveWidget || !anActiveWidget->isViewerSelector()) {
202 // block of viewer update
203 // we need to block update content of the viewer because of Sketch Point feature
204 // in activate() the value of the point is initialized and it can be displayed
205 // but the default value is [0, 0]. So, we block update viewer contentent until
206 // onMouseRelease happens, which correct the point position
207 ModuleBase_Tools::blockUpdateViewer(true);
209 ModuleBase_OperationFeature* aFOperation = dynamic_cast<ModuleBase_OperationFeature*>
210 (myWorkshop->currentOperation());
211 myPreviousFeature = aFOperation->feature();
213 /// selection should be obtained from workshop before ask if the operation can be started as
214 /// the canStartOperation method performs commit/abort of previous operation. Sometimes commit/abort
215 /// may cause selection clear(Sketch operation) as a result it will be lost and is not used for preselection.
216 ModuleBase_ISelection* aSelection = myWorkshop->selection();
217 QList<ModuleBase_ViewerPrsPtr> aPreSelected = aSelection->getSelected(ModuleBase_ISelection::AllControls);
220 myPreviousFeature = FeaturePtr();
223 // fill the first widget by the mouse event point
224 // if the active widget is not the first, it means that the restarted operation is filled by
225 // the current preselection.
226 PartSet_WidgetPoint2D* aPoint2DWdg = dynamic_cast<PartSet_WidgetPoint2D*>(module()->activeWidget());
227 ModuleBase_ModelWidget* aFirstWidget = aPanel->findFirstAcceptingValueWidget();
228 if (aPoint2DWdg && aPoint2DWdg == aFirstWidget) {
229 if (!aPreSelected.empty())
230 aPoint2DWdg->setPreSelection(aPreSelected.front());
231 aPoint2DWdg->mouseReleased(theWnd, theEvent);
232 if (!aPreSelected.empty())
233 aPoint2DWdg->setPreSelection(ModuleBase_ViewerPrsPtr());
235 // unblock viewer update
236 ModuleBase_Tools::blockUpdateViewer(false);
243 void PartSet_SketcherReetntrantMgr::onWidgetActivated()
247 if (!myIsInternalEditOperation)
250 PartSet_Module* aModule = module();
251 ModuleBase_ModelWidget* aFirstWidget = aModule->activeWidget();
252 ModuleBase_IPropertyPanel* aPanel = aModule->currentOperation()->propertyPanel();
253 if (aFirstWidget != aPanel->activeWidget()) {
254 ModuleBase_WidgetSelector* aWSelector = dynamic_cast<ModuleBase_WidgetSelector*>(aFirstWidget);
256 aWSelector->activateSelectionAndFilters(true);
260 void PartSet_SketcherReetntrantMgr::onNoMoreWidgets(const std::string& thePreviousAttributeID)
265 // we should avoid processing of the signal about no more widgets attributes and
266 // do this after the restart operaion is finished if it was called
267 // onNoMoreWidgets depends on myIsFlagsBlocked and fill myNoMoreWidgetsAttribute
268 // if it should be called after restart
269 if (myIsFlagsBlocked) {
270 myNoMoreWidgetsAttribute = thePreviousAttributeID;
274 ModuleBase_OperationFeature* aFOperation = dynamic_cast<ModuleBase_OperationFeature*>
275 (myWorkshop->currentOperation());
276 if (!myWorkshop->module()->getFeatureError(aFOperation->feature()).isEmpty())
279 if (aFOperation && module()->sketchMgr()->isNestedSketchOperation(aFOperation)) {
280 bool isStarted = false;
281 if (!module()->sketchMgr()->sketchSolverError()) {
282 if (myRestartingMode != RM_Forbided) {
283 myRestartingMode = RM_LastFeatureUsed;
284 isStarted = startInternalEdit(thePreviousAttributeID);
288 aFOperation->commit();
292 bool PartSet_SketcherReetntrantMgr::processEnter(const std::string& thePreviousAttributeID)
299 // empty previous attribute means that the Apply/Ok button has focus and the enter
300 // should not lead to start edition mode of the previous operation
301 if (thePreviousAttributeID.empty())
304 ModuleBase_OperationFeature* aFOperation = dynamic_cast<ModuleBase_OperationFeature*>
305 (myWorkshop->currentOperation());
306 if (!myWorkshop->module()->getFeatureError(aFOperation->feature()).isEmpty())
309 bool isSketchSolverError = module()->sketchMgr()->sketchSolverError();
311 if (!isSketchSolverError) {
312 myRestartingMode = RM_EmptyFeatureUsed;
313 isDone = startInternalEdit(thePreviousAttributeID);
319 void PartSet_SketcherReetntrantMgr::onVertexSelected()
324 ModuleBase_Operation* anOperation = myWorkshop->currentOperation();
325 std::string anOperationId = anOperation->id().toStdString();
326 if (anOperationId == SketchPlugin_Line::ID() ||
327 isTangentArc(anOperation, module()->sketchMgr()->activeSketch())) {
328 /// If last line finished on vertex the lines creation sequence has to be break
329 ModuleBase_IPropertyPanel* aPanel = anOperation->propertyPanel();
330 ModuleBase_ModelWidget* anActiveWidget = aPanel->activeWidget();
331 const QList<ModuleBase_ModelWidget*>& aWidgets = aPanel->modelWidgets();
332 QList<ModuleBase_ModelWidget*>::const_iterator anIt = aWidgets.begin(), aLast = aWidgets.end();
333 bool aFoundWidget = false;
334 bool aFoundObligatory = false;
335 for (; anIt != aLast && !aFoundObligatory; anIt++) {
337 aFoundWidget = *anIt == anActiveWidget;
339 aFoundObligatory = (*anIt)->isObligatory();
341 if (!aFoundObligatory)
342 myRestartingMode = RM_Forbided;
346 void PartSet_SketcherReetntrantMgr::onBeforeStopped()
348 if (!isActiveMgr() || !myIsInternalEditOperation)
351 beforeStopInternalEdit();
354 bool PartSet_SketcherReetntrantMgr::canBeCommittedByPreselection()
356 return !isActiveMgr() || myRestartingMode == RM_None;
359 bool PartSet_SketcherReetntrantMgr::isInternalEditStarted() const
361 return myIsInternalEditOperation;
364 bool PartSet_SketcherReetntrantMgr::isActiveMgr() const
366 ModuleBase_Operation* aCurrentOperation = myWorkshop->currentOperation();
368 bool anActive = PartSet_SketcherMgr::isSketchOperation(aCurrentOperation);
370 anActive = module()->sketchMgr()->isNestedSketchOperation(aCurrentOperation);
371 if (anActive) { // the manager is not active when the current operation is a usual Edit
372 ModuleBase_OperationFeature* aFOperation = dynamic_cast<ModuleBase_OperationFeature*>
373 (myWorkshop->currentOperation());
374 if (aFOperation->isEditOperation())
375 anActive = myIsInternalEditOperation;
381 bool PartSet_SketcherReetntrantMgr::startInternalEdit(const std::string& thePreviousAttributeID)
384 /// this is workaround for ModuleBase_WidgetEditor, used in SALOME mode. Sometimes key enter
385 /// event comes two times, so we should not start another internal edit operation
386 /// the Apply button becomes disabled becase the second additional internal feature is created
387 if (myIsInternalEditOperation)
390 ModuleBase_OperationFeature* aFOperation = dynamic_cast<ModuleBase_OperationFeature*>
391 (myWorkshop->currentOperation());
393 if (aFOperation && module()->sketchMgr()->isNestedSketchOperation(aFOperation)) {
394 aFOperation->setEditOperation(true/*, false*/);
395 createInternalFeature();
397 myIsInternalEditOperation = true;
398 updateAcceptAllAction();
401 connect(aFOperation, SIGNAL(beforeCommitted()), this, SLOT(onBeforeStopped()));
402 connect(aFOperation, SIGNAL(beforeAborted()), this, SLOT(onBeforeStopped()));
404 // activate selection filters of the first widget in the viewer
407 // activate the last active widget in the Property Panel
408 if (!thePreviousAttributeID.empty()) {
409 ModuleBase_Operation* anEditOperation = module()->currentOperation();
410 if (anEditOperation) {
411 ModuleBase_IPropertyPanel* aPanel = aFOperation->propertyPanel();
412 ModuleBase_ModelWidget* aPreviousAttributeWidget = 0;
413 QList<ModuleBase_ModelWidget*> aWidgets = aPanel->modelWidgets();
414 for (int i = 0, aNb = aWidgets.size(); i < aNb && !aPreviousAttributeWidget; i++) {
415 if (aWidgets[i]->attributeID() == thePreviousAttributeID) {
416 /// workaround for the same attributes used in different stacked widgets(attribute types)
417 if (ModuleBase_ToolBox::isOffToolBoxParent(aWidgets[i]))
419 aPreviousAttributeWidget = aWidgets[i];
422 // If the current widget is a selector, do nothing, it processes the mouse press
423 if (aPreviousAttributeWidget) {
424 if (!aPreviousAttributeWidget->isViewerSelector()) {
425 aPreviousAttributeWidget->focusTo();
426 aPreviousAttributeWidget->selectContent();
429 // in case of shape multi selector, the widget does not lose focus by filling
430 // like it is in shape selector. So, if enter is pressed, the multi shape selector
431 // control should be deactivated. The focus is moved to Apply button and there
432 // should not be active control visualized in property panel
433 if (aPreviousAttributeWidget == aPanel->activeWidget()) {
434 aPanel->activateWidget(NULL, false);
436 // if there is no the next widget to be automatically activated, the Ok button in property
437 // panel should accept the focus(example is parallel constraint on sketch lines)
438 QToolButton* anOkBtn = dynamic_cast<XGUI_PropertyPanel*>(aPanel)->findButton(PROP_PANEL_OK);
440 anOkBtn->setFocus(Qt::TabFocusReason);
447 module()->sketchMgr()->clearClickedFlags();
452 void PartSet_SketcherReetntrantMgr::beforeStopInternalEdit()
454 ModuleBase_OperationFeature* aFOperation = dynamic_cast<ModuleBase_OperationFeature*>
455 (myWorkshop->currentOperation());
457 disconnect(aFOperation, SIGNAL(beforeCommitted()), this, SLOT(onBeforeStopped()));
458 disconnect(aFOperation, SIGNAL(beforeAborted()), this, SLOT(onBeforeStopped()));
461 deleteInternalFeature();
464 void PartSet_SketcherReetntrantMgr::restartOperation()
466 if (myIsInternalEditOperation) {
467 ModuleBase_OperationFeature* aFOperation = dynamic_cast<ModuleBase_OperationFeature*>(
468 myWorkshop->currentOperation());
470 myNoMoreWidgetsAttribute = "";
471 myIsFlagsBlocked = true;
472 module()->launchOperation(aFOperation->id());
473 myIsFlagsBlocked = false;
475 // we should avoid processing of the signal about no more widgets attributes and
476 // do this after the restart operaion is finished if it was called
477 // onNoMoreWidgets depends on myIsFlagsBlocked and fill myNoMoreWidgetsAttribute
478 // if it should be called after restart
479 if (!myNoMoreWidgetsAttribute.empty()) {
480 onNoMoreWidgets(myNoMoreWidgetsAttribute);
481 myNoMoreWidgetsAttribute = "";
487 void PartSet_SketcherReetntrantMgr::createInternalFeature()
489 ModuleBase_OperationFeature* aFOperation = dynamic_cast<ModuleBase_OperationFeature*>
490 (myWorkshop->currentOperation());
492 if (aFOperation && module()->sketchMgr()->isNestedSketchOperation(aFOperation)) {
493 FeaturePtr anOperationFeature = aFOperation->feature();
495 CompositeFeaturePtr aSketch = module()->sketchMgr()->activeSketch();
496 myInternalFeature = aSketch->addFeature(anOperationFeature->getKind());
498 bool isFeatureChanged = copyReetntrantAttributes(anOperationFeature, myInternalFeature,
500 XGUI_PropertyPanel* aPropertyPanel = dynamic_cast<XGUI_PropertyPanel*>
501 (aFOperation->propertyPanel());
503 myInternalWidget = new QWidget(aPropertyPanel->contentWidget()->pageWidget());
504 myInternalWidget->setVisible(false);
506 ModuleBase_PageWidget* anInternalPage = new ModuleBase_PageWidget(myInternalWidget);
508 QString aXmlRepr = aFOperation->getDescription()->xmlRepresentation();
509 ModuleBase_WidgetFactory aFactory(aXmlRepr.toStdString(), myWorkshop);
511 aFactory.createWidget(anInternalPage);
512 QList<ModuleBase_ModelWidget*> aWidgets = aFactory.getModelWidgets();
514 foreach (ModuleBase_ModelWidget* aWidget, aWidgets) {
515 bool isStoreValue = !aFOperation->isEditOperation() &&
516 !aWidget->getDefaultValue().empty() &&
517 !aWidget->isComputedDefault();
518 aWidget->setFeature(myInternalFeature, isStoreValue);
519 if (!isStoreValue && isFeatureChanged)
520 aWidget->restoreValue();
523 ModuleBase_ModelWidget* aFirstWidget = ModuleBase_IPropertyPanel::findFirstAcceptingValueWidget
526 myInternalActiveWidget = aFirstWidget;
530 void PartSet_SketcherReetntrantMgr::deleteInternalFeature()
532 if (myInternalActiveWidget) {
533 ModuleBase_WidgetSelector* aWSelector = dynamic_cast<ModuleBase_WidgetSelector*>(myInternalActiveWidget);
535 aWSelector->activateSelectionAndFilters(false);
536 myInternalActiveWidget = 0;
538 delete myInternalWidget;
539 myInternalWidget = 0;
541 QObjectPtrList anObjects;
542 anObjects.append(myInternalFeature);
543 workshop()->deleteFeatures(anObjects);
544 myInternalFeature = FeaturePtr();
547 void PartSet_SketcherReetntrantMgr::resetFlags()
549 if (!myIsFlagsBlocked) {
550 myIsInternalEditOperation = false;
551 updateAcceptAllAction();
552 myRestartingMode = RM_None;
556 bool PartSet_SketcherReetntrantMgr::copyReetntrantAttributes(const FeaturePtr& theSourceFeature,
557 const FeaturePtr& theNewFeature,
558 const CompositeFeaturePtr& theSketch,
559 const bool isTemporary)
561 bool aChanged = false;
562 if (!theSourceFeature.get())
565 std::string aFeatureKind = theSourceFeature->getKind();
566 if (aFeatureKind == SketchPlugin_Line::ID()) {
567 // Initialize new line with first point equal to end of previous
568 std::shared_ptr<ModelAPI_Data> aSFData = theSourceFeature->data();
569 std::shared_ptr<GeomDataAPI_Point2D> aSPoint = std::dynamic_pointer_cast<GeomDataAPI_Point2D>(
570 aSFData->attribute(SketchPlugin_Line::END_ID()));
571 std::shared_ptr<ModelAPI_Data> aNFData = theNewFeature->data();
572 std::shared_ptr<GeomDataAPI_Point2D> aNPoint = std::dynamic_pointer_cast<GeomDataAPI_Point2D>(
573 aNFData->attribute(SketchPlugin_Line::START_ID()));
574 aNPoint->setValue(aSPoint->x(), aSPoint->y());
575 PartSet_Tools::createConstraint(theSketch, aSPoint, aNPoint);
577 aNPoint = std::dynamic_pointer_cast<GeomDataAPI_Point2D>(
578 aSFData->attribute(SketchPlugin_Line::END_ID()));
579 aNPoint->setValue(aSPoint->x(), aSPoint->y());
581 else if (aFeatureKind == SketchPlugin_Circle::ID()) {
583 std::string aTypeAttributeId = SketchPlugin_Circle::CIRCLE_TYPE();
584 AttributeStringPtr aSourceFeatureTypeAttr = theSourceFeature->data()->string(aTypeAttributeId);
585 AttributeStringPtr aNewFeatureTypeAttr = theNewFeature->data()->string(aTypeAttributeId);
586 aNewFeatureTypeAttr->setValue(aSourceFeatureTypeAttr->value());
587 //ModuleBase_Tools::flushUpdated(theNewFeature);
590 else if (aFeatureKind == SketchPlugin_Arc::ID()) {
592 std::string aTypeAttributeId = SketchPlugin_Arc::ARC_TYPE();
593 AttributeStringPtr aSourceFeatureTypeAttr = theSourceFeature->data()->string(aTypeAttributeId);
594 AttributeStringPtr aNewFeatureTypeAttr = theNewFeature->data()->string(aTypeAttributeId);
595 aNewFeatureTypeAttr->setValue(aSourceFeatureTypeAttr->value());
597 // if the arc is tangent, set coincidence to end point of the previous arc
598 std::string anArcType = aSourceFeatureTypeAttr->value();
599 if (anArcType == SketchPlugin_Arc::ARC_TYPE_TANGENT()) {
600 // get the last point of the previuos arc feature(geom point 2d)
601 std::shared_ptr<ModelAPI_Data> aSData = theSourceFeature->data();
602 std::shared_ptr<GeomDataAPI_Point2D> aSPointAttr =
603 std::dynamic_pointer_cast<GeomDataAPI_Point2D>(
604 aSData->attribute(SketchPlugin_Arc::END_ID()));
605 // get point attribute on the current feature
606 AttributeRefAttrPtr aTangentPointAttr = theNewFeature->data()->refattr(
607 SketchPlugin_Arc::TANGENT_POINT_ID());
608 aTangentPointAttr->setAttr(aSPointAttr);
610 std::shared_ptr<GeomDataAPI_Point2D> aNPointAttr =
611 std::dynamic_pointer_cast<GeomDataAPI_Point2D>(
612 theNewFeature->data()->attribute(SketchPlugin_Arc::END_ID()));
613 aNPointAttr->setValue(aSPointAttr->x(), aSPointAttr->y());
616 //ModuleBase_Tools::flushUpdated(theNewFeature);
622 bool PartSet_SketcherReetntrantMgr::isTangentArc(ModuleBase_Operation* theOperation,
623 const CompositeFeaturePtr& /*theSketch*/) const
625 bool aTangentArc = false;
626 ModuleBase_OperationFeature* aFOperation = dynamic_cast<ModuleBase_OperationFeature*>
628 if (aFOperation && module()->sketchMgr()->isNestedSketchOperation(aFOperation)) {
629 FeaturePtr aFeature = aFOperation->feature();
630 if (aFeature.get() && aFeature->getKind() == SketchPlugin_Arc::ID()) {
631 AttributeStringPtr aTypeAttr = aFeature->data()->string(SketchPlugin_Arc::ARC_TYPE());
632 std::string anArcType = aTypeAttr.get() ? aTypeAttr->value() : "";
633 aTangentArc = anArcType == SketchPlugin_Arc::ARC_TYPE_TANGENT();
639 void PartSet_SketcherReetntrantMgr::updateAcceptAllAction()
641 CompositeFeaturePtr aSketch = module()->sketchMgr()->activeSketch();
643 workshop()->errorMgr()->updateAcceptAllAction(aSketch);
646 XGUI_Workshop* PartSet_SketcherReetntrantMgr::workshop() const
648 XGUI_ModuleConnector* aConnector = dynamic_cast<XGUI_ModuleConnector*>(myWorkshop);
649 return aConnector->workshop();
652 PartSet_Module* PartSet_SketcherReetntrantMgr::module() const
654 return dynamic_cast<PartSet_Module*>(myWorkshop->module());