X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FPartSet%2FPartSet_SketcherReentrantMgr.cpp;h=b0d19549b987d7aab87e7248646d2a6fd2642ef9;hb=ac6c4b849218e6f1a45c0a21e46c5fda401c38f0;hp=45547cb74dce9290bb764f571bfe10940f9588b7;hpb=13436fe425e95d712e453110038e001f93ac92f1;p=modules%2Fshaper.git diff --git a/src/PartSet/PartSet_SketcherReentrantMgr.cpp b/src/PartSet/PartSet_SketcherReentrantMgr.cpp index 45547cb74..b0d19549b 100644 --- a/src/PartSet/PartSet_SketcherReentrantMgr.cpp +++ b/src/PartSet/PartSet_SketcherReentrantMgr.cpp @@ -1,4 +1,22 @@ -// Copyright (C) 2014-20xx CEA/DEN, EDF R&D +// Copyright (C) 2014-2017 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or +// email : webmaster.salome@opencascade.com +// #include "PartSet_SketcherReentrantMgr.h" #include "PartSet_Module.h" @@ -8,10 +26,13 @@ #include "ModelAPI_Session.h" #include "ModelAPI_AttributeString.h" #include "ModelAPI_AttributeRefAttr.h" +#include "ModelAPI_AttributeReference.h" +#include "ModelAPI_EventReentrantMessage.h" #include "GeomDataAPI_Point2D.h" #include +#include #include #include #include @@ -22,12 +43,15 @@ #include #include "ModuleBase_ToolBox.h" #include "ModuleBase_ISelection.h" +#include "ModuleBase_ISelectionActivate.h" #include #include -#include +#include #include #include +#include +#include #include #include @@ -38,13 +62,14 @@ #include +//#define DEBUG_RESTART + PartSet_SketcherReentrantMgr::PartSet_SketcherReentrantMgr(ModuleBase_IWorkshop* theWorkshop) : QObject(theWorkshop), myWorkshop(theWorkshop), myRestartingMode(RM_None), myIsFlagsBlocked(false), myIsInternalEditOperation(false), - myIsValueChangedBlocked(false), myInternalActiveWidget(0), myNoMoreWidgetsAttribute("") { @@ -114,12 +139,13 @@ void PartSet_SketcherReentrantMgr::operationStarted(ModuleBase_Operation* theOpe if (!isActiveMgr()) return; - if (myPreviousFeature.get() && myRestartingMode == RM_LastFeatureUsed) { - ModuleBase_OperationFeature* aCurrentOperation = dynamic_cast( - myWorkshop->currentOperation()); - CompositeFeaturePtr aSketch = module()->sketchMgr()->activeSketch(); - copyReetntrantAttributes(myPreviousFeature, aCurrentOperation->feature(), aSketch); - } + //if (myPreviousFeature.get() && myRestartingMode == RM_LastFeatureUsed) { + //ModuleBase_OperationFeature* aCurrentOperation = dynamic_cast( + // myWorkshop->currentOperation()); + //CompositeFeaturePtr aSketch = module()->sketchMgr()->activeSketch(); + //if (myPreviousFeature.get() && myPreviousFeature->data()->isValid()) // it is not removed + //copyReetntrantAttributes(myPreviousFeature, aCurrentOperation->feature(), aSketch); + //} resetFlags(); } @@ -148,17 +174,16 @@ bool PartSet_SketcherReentrantMgr::processMouseMoved(ModuleBase_IViewWindow* the ModuleBase_IPropertyPanel* aPanel = myWorkshop->currentOperation()->propertyPanel(); FeaturePtr aCurrentFeature = aFOperation->feature(); - bool isLineFeature = false, isArcFeature = false; + bool isLineFeature = false, isReentrantArcFeature = false; std::string anAttributeOnStart; if (aCurrentFeature->getKind() == SketchPlugin_Line::ID()) { anAttributeOnStart = SketchPlugin_Line::START_ID(); isLineFeature = anActiveWidget->attributeID() == anAttributeOnStart; } else if (isTangentArc(aFOperation, module()->sketchMgr()->activeSketch())) { - anAttributeOnStart = SketchPlugin_Arc::TANGENT_POINT_ID(); - isArcFeature = anActiveWidget->attributeID() == anAttributeOnStart; + isReentrantArcFeature = true; } - bool aCanBeActivatedByMove = isLineFeature || isArcFeature; + bool aCanBeActivatedByMove = isLineFeature || isReentrantArcFeature; if (aCanBeActivatedByMove) { /// before restarting of operation we need to clear selection, as it may take part in /// new feature creation, e.g. tangent arc. But it is not necessary as it was processed @@ -170,9 +195,8 @@ bool PartSet_SketcherReentrantMgr::processMouseMoved(ModuleBase_IViewWindow* the myPreviousFeature = FeaturePtr(); anActiveWidget = module()->activeWidget(); - aCurrentFeature = anActiveWidget->feature(); aProcessed = true; - if (anActiveWidget->attributeID() == anAttributeOnStart) { + if (anActiveWidget && anActiveWidget->attributeID() == anAttributeOnStart) { // it was not deactivated by preselection processing aPanel->activateNextWidget(anActiveWidget); } @@ -194,8 +218,8 @@ bool PartSet_SketcherReentrantMgr::processMousePressed(ModuleBase_IViewWindow* / return isActiveMgr() && myIsInternalEditOperation; } -bool PartSet_SketcherReentrantMgr::processMouseReleased(ModuleBase_IViewWindow* theWnd, - QMouseEvent* theEvent) +bool PartSet_SketcherReentrantMgr::processMouseReleased(ModuleBase_IViewWindow* theWindow, + QMouseEvent* theEvent) { bool aProcessed = false; if (!isActiveMgr()) @@ -228,7 +252,24 @@ bool PartSet_SketcherReentrantMgr::processMouseReleased(ModuleBase_IViewWindow* QList aPreSelected = aSelection->getSelected(ModuleBase_ISelection::AllControls); + myClickedSketchPoint = PartSet_Tools::getPnt2d(theEvent, theWindow, + module()->sketchMgr()->activeSketch()); + if (!aPreSelected.empty()) { + ModuleBase_ViewerPrsPtr aValue = aPreSelected.first(); + module()->getGeomSelection(aValue, mySelectedObject, mySelectedAttribute); + + PartSet_WidgetPoint2D* aPointWidget = dynamic_cast(anActiveWidget); + if (aPointWidget) { + GeomShapePtr aShape; + aPointWidget->getGeomSelection_(aValue, mySelectedObject, aShape); + } + } + restartOperation(); + myClickedSketchPoint = std::shared_ptr(); + mySelectedObject = ObjectPtr(); + mySelectedAttribute = AttributePtr(); + myPreviousFeature = FeaturePtr(); aProcessed = true; @@ -246,8 +287,14 @@ bool PartSet_SketcherReentrantMgr::processMouseReleased(ModuleBase_IViewWindow* std::shared_ptr aSelectedPrs; if (!aPreSelected.empty()) aSelectedPrs = aPreSelected.front(); - aMouseProcessor->setPreSelection(aSelectedPrs, theWnd, theEvent); - //aPoint2DWdg->mouseReleased(theWnd, theEvent); + if (aSelectedPrs.get() && aSelectedPrs->object().get() + && !aSelectedPrs->object()->data()->isValid()) { + // the selected object was removed diring restart, e.g. presentable macro feature + // there are created objects to replace the object depending on created feature kind + aSelectedPrs = std::shared_ptr(); + } + aMouseProcessor->setPreSelection(aSelectedPrs, theWindow, theEvent); + //aPoint2DWdg->mouseReleased(theWindow, theEvent); //if (!aPreSelected.empty()) // aPoint2DWdg->setPreSelection(ModuleBase_ViewerPrsPtr()); } @@ -255,29 +302,51 @@ bool PartSet_SketcherReentrantMgr::processMouseReleased(ModuleBase_IViewWindow* ModuleBase_Tools::blockUpdateViewer(false); } } - return aProcessed; } -void PartSet_SketcherReentrantMgr::onWidgetActivated() +//****************************************************** +void PartSet_SketcherReentrantMgr::setReentrantPreSelection( + const std::shared_ptr& theMessage) { - if (!isActiveMgr()) - return; - if (!myIsInternalEditOperation) + ReentrantMessagePtr aReentrantMessage = + std::dynamic_pointer_cast(theMessage); + if (!aReentrantMessage.get()) return; - PartSet_Module* aModule = module(); - ModuleBase_ModelWidget* aFirstWidget = aModule->activeWidget(); - ModuleBase_IPropertyPanel* aPanel = aModule->currentOperation()->propertyPanel(); - if (aFirstWidget != aPanel->activeWidget()) { - ModuleBase_WidgetSelector* aWSelector = dynamic_cast(aFirstWidget); - if (aWSelector) - aWSelector->activateSelectionAndFilters(true); - } + // if feature has already filled the selected object, we should not overwrite it + if (!aReentrantMessage->selectedObject().get()) + aReentrantMessage->setSelectedObject(mySelectedObject); + + aReentrantMessage->setSelectedAttribute(mySelectedAttribute); + aReentrantMessage->setClickedPoint(myClickedSketchPoint); } +//void PartSet_SketcherReentrantMgr::onWidgetActivated() +//{ +// if (!isActiveMgr()) +// return; +// if (!myIsInternalEditOperation) +// return; +// +// PartSet_Module* aModule = module(); +// ModuleBase_ModelWidget* aFirstWidget = aModule->activeWidget(); +// ModuleBase_IPropertyPanel* aPanel = aModule->currentOperation()->propertyPanel(); +// if (aFirstWidget != aPanel->activeWidget()) { +// ModuleBase_WidgetSelector* aWSelector = dynamic_cast +// (aFirstWidget); +// if (aWSelector) { +// myWorkshop->selectionActivate()->updateSelectionModesAndFilters(aWSelector); +// } +// } +//} + void PartSet_SketcherReentrantMgr::onNoMoreWidgets(const std::string& thePreviousAttributeID) { +#ifdef DEBUG_RESTART + std::cout << "PartSet_SketcherReentrantMgr::onNoMoreWidgets" << std::endl; +#endif + if (!isActiveMgr()) return; @@ -296,15 +365,20 @@ void PartSet_SketcherReentrantMgr::onNoMoreWidgets(const std::string& thePreviou return; if (aFOperation && module()->sketchMgr()->isNestedSketchOperation(aFOperation)) { - bool isStarted = false; - if (!module()->sketchMgr()->sketchSolverError()) { - if (myRestartingMode != RM_Forbided) { - myRestartingMode = RM_LastFeatureUsed; - isStarted = startInternalEdit(thePreviousAttributeID); + if (aFOperation->isNeedToBeAborted()) { + aFOperation->abort(); + } + else { + bool isStarted = false; + if (!module()->sketchMgr()->sketchSolverError()) { + if (myRestartingMode != RM_Forbided) { + myRestartingMode = RM_LastFeatureUsed; + isStarted = startInternalEdit(thePreviousAttributeID); + } } + if (!isStarted) + aFOperation->commit(); } - if (!isStarted) - aFOperation->commit(); } } @@ -364,14 +438,12 @@ void PartSet_SketcherReentrantMgr::onVertexSelected() void PartSet_SketcherReentrantMgr::onAfterValuesChangedInPropertyPanel() { - // blocked flag in order to avoid circling when storeValue will be applied in - // this method to cached widget - if (myIsValueChangedBlocked) - return; if (isInternalEditActive()) { + ModuleBase_OperationFeature* aFOperation = dynamic_cast + (myWorkshop->currentOperation()); ModuleBase_ModelWidget* aWidget = (ModuleBase_ModelWidget*)sender(); - if (!aWidget->isModifiedInEdit()) + if (!aWidget->isModifiedInEdit().empty()) restartOperation(); } } @@ -389,11 +461,6 @@ bool PartSet_SketcherReentrantMgr::canBeCommittedByPreselection() return !isActiveMgr() || myRestartingMode == RM_None; } -bool PartSet_SketcherReentrantMgr::isInternalEditStarted() const -{ - return myIsInternalEditOperation; -} - bool PartSet_SketcherReentrantMgr::isActiveMgr() const { ModuleBase_Operation* aCurrentOperation = myWorkshop->currentOperation(); @@ -413,6 +480,10 @@ bool PartSet_SketcherReentrantMgr::isActiveMgr() const bool PartSet_SketcherReentrantMgr::startInternalEdit(const std::string& thePreviousAttributeID) { +#ifdef DEBUG_RESTART + std::cout << "PartSet_SketcherReentrantMgr::startInternalEdit" << std::endl; +#endif + bool isDone = false; /// this is workaround for ModuleBase_WidgetEditor, used in SALOME mode. Sometimes key enter /// event comes two times, so we should not start another internal edit operation @@ -424,6 +495,10 @@ bool PartSet_SketcherReentrantMgr::startInternalEdit(const std::string& thePrevi (myWorkshop->currentOperation()); if (aFOperation && module()->sketchMgr()->isNestedSketchOperation(aFOperation)) { + /// improvement to deselect automatically all eventual selected objects, when + // returning to the neutral point of the Sketcher or start internal edit + workshop()->selector()->clearSelection(); + aFOperation->setEditOperation(true/*, false*/); createInternalFeature(); @@ -435,7 +510,7 @@ bool PartSet_SketcherReentrantMgr::startInternalEdit(const std::string& thePrevi connect(aFOperation, SIGNAL(beforeAborted()), this, SLOT(onBeforeStopped())); // activate selection filters of the first widget in the viewer - onWidgetActivated(); + //onWidgetActivated(); // activate the last active widget in the Property Panel if (!thePreviousAttributeID.empty()) { @@ -456,6 +531,7 @@ bool PartSet_SketcherReentrantMgr::startInternalEdit(const std::string& thePrevi if (aPreviousAttributeWidget) { if (!aPreviousAttributeWidget->isViewerSelector()) { aPreviousAttributeWidget->focusTo(); + aPreviousAttributeWidget->emitFocusInWidget(); aPreviousAttributeWidget->selectContent(); } else { @@ -472,7 +548,7 @@ bool PartSet_SketcherReentrantMgr::startInternalEdit(const std::string& thePrevi QToolButton* anOkBtn = dynamic_cast(aPanel)->findButton(PROP_PANEL_OK); if (anOkBtn) - anOkBtn->setFocus(Qt::TabFocusReason); + ModuleBase_Tools::setFocus(anOkBtn, "XGUI_PropertyPanel::activateNextWidget"); } } } @@ -498,32 +574,31 @@ void PartSet_SketcherReentrantMgr::beforeStopInternalEdit() void PartSet_SketcherReentrantMgr::restartOperation() { +#ifdef DEBUG_RESTART + std::cout << "PartSet_SketcherReentrantMgr::restartOperation" << std::endl; +#endif + if (myIsInternalEditOperation) { ModuleBase_OperationFeature* aFOperation = dynamic_cast( myWorkshop->currentOperation()); if (aFOperation) { - // obtain widgets(attributes) which content should be applied to attributes of new feature - ModuleBase_IPropertyPanel* aPanel = aFOperation->propertyPanel(); - ModuleBase_ModelWidget* anActiveWidget = aPanel->activeWidget(); - const QList& aWidgets = aPanel->modelWidgets(); - QList aValueWidgets; - for (int i = 0, aSize = aWidgets.size(); i < aSize; i++) { - ModuleBase_ModelWidget* aWidget = aWidgets[i]; - if (!aWidget->isModifiedInEdit()) { - aValueWidgets.append(aWidget); - // the widget is cashed to fill feature of new operation by the current widget value - // we set empty parent to the widget in order to remove it ourselves. Reason: restart - // operation will clear property panel and delete all widgets. This widget should be - // removed only after applying value of the widget to new created feature. - aWidget->setParent(0); - } - } + ModuleBase_ISelection* aSelection = myWorkshop->selection(); + QList aPreSelected = + aSelection->getSelected(ModuleBase_ISelection::AllControls); + + if (myInternalFeature.get()) + copyReetntrantAttributes(myInternalFeature, aFOperation->feature(), + module()->sketchMgr()->activeSketch()); myNoMoreWidgetsAttribute = ""; myIsFlagsBlocked = true; - module()->launchOperation(aFOperation->id()); + /// launch has 'false' parameter to do not start new operation if the previous operation + /// is not committed. It is important for Line Sketch feature as it uses the previous + /// created feature parameter(to build coincidence), but by abort the previous is removed + module()->launchOperation(aFOperation->id(), true); myIsFlagsBlocked = false; resetFlags(); + // we should avoid processing of the signal about no more widgets attributes and // do this after the restart operaion is finished if it was called // onNoMoreWidgets depends on myIsFlagsBlocked and fill myNoMoreWidgetsAttribute @@ -532,21 +607,6 @@ void PartSet_SketcherReentrantMgr::restartOperation() onNoMoreWidgets(myNoMoreWidgetsAttribute); myNoMoreWidgetsAttribute = ""; } - - // filling new feature by the previous value of active widget - // (e.g. circle_type in macro Circle) - ModuleBase_OperationFeature* aFOperation = dynamic_cast( - myWorkshop->currentOperation()); - myIsValueChangedBlocked = true; // flag to avoid onAfterValuesChangedInPropertyPanel slot - for (int i = 0, aSize = aValueWidgets.size(); i < aSize; i++) { - ModuleBase_ModelWidget* aWidget = aValueWidgets[i]; - aWidget->setEditingMode(false); - aWidget->setFeature(aFOperation->feature()); - aWidget->storeValue(); - // we must delete this widget - delete aWidget; - } - myIsValueChangedBlocked = false; } } } @@ -562,6 +622,11 @@ void PartSet_SketcherReentrantMgr::createInternalFeature() CompositeFeaturePtr aSketch = module()->sketchMgr()->activeSketch(); myInternalFeature = aSketch->addFeature(anOperationFeature->getKind()); +#ifdef DEBUG_RESTART + std::cout << "PartSet_SketcherReentrantMgr::createInternalFeature: " + << myInternalFeature->data()->name() << std::endl; +#endif + bool isFeatureChanged = copyReetntrantAttributes(anOperationFeature, myInternalFeature, aSketch, false); XGUI_PropertyPanel* aPropertyPanel = dynamic_cast @@ -596,13 +661,12 @@ void PartSet_SketcherReentrantMgr::createInternalFeature() void PartSet_SketcherReentrantMgr::deleteInternalFeature() { - if (myInternalActiveWidget) { - ModuleBase_WidgetSelector* aWSelector = - dynamic_cast(myInternalActiveWidget); - if (aWSelector) - aWSelector->activateSelectionAndFilters(false); +#ifdef DEBUG_RESTART + std::cout << "PartSet_SketcherReentrantMgr::deleteInternalFeature: " + << myInternalFeature->data()->name() << std::endl; +#endif + if (myInternalActiveWidget) myInternalActiveWidget = 0; - } delete myInternalWidget; myInternalWidget = 0; @@ -618,21 +682,28 @@ void PartSet_SketcherReentrantMgr::resetFlags() myIsInternalEditOperation = false; updateAcceptAllAction(); myRestartingMode = RM_None; + myReentrantMessage = std::shared_ptr(); } } bool PartSet_SketcherReentrantMgr::copyReetntrantAttributes(const FeaturePtr& theSourceFeature, const FeaturePtr& theNewFeature, const CompositeFeaturePtr& theSketch, - const bool isTemporary) + const bool /*isTemporary*/) { bool aChanged = false; if (!theSourceFeature.get() || !theSourceFeature->data().get() || !theSourceFeature->data()->isValid()) return aChanged; +#ifdef DEBUG_RESTART + std::cout << "PartSet_SketcherReentrantMgr::copyReetntrantAttributes from '" + << theSourceFeature->data()->name() << "' to '" << theNewFeature->data()->name() + << "'" << std::endl; +#endif + std::string aFeatureKind = theSourceFeature->getKind(); - if (aFeatureKind == SketchPlugin_Line::ID()) { + /*if (aFeatureKind == SketchPlugin_Line::ID()) { // Initialize new line with first point equal to end of previous std::shared_ptr aSFData = theSourceFeature->data(); std::shared_ptr aSPoint = std::dynamic_pointer_cast( @@ -647,43 +718,65 @@ bool PartSet_SketcherReentrantMgr::copyReetntrantAttributes(const FeaturePtr& th aSFData->attribute(SketchPlugin_Line::END_ID())); aNPoint->setValue(aSPoint->x(), aSPoint->y()); } - else if (aFeatureKind == SketchPlugin_MacroCircle::ID()) { + else*/ if (aFeatureKind == SketchPlugin_MacroCircle::ID()) { // set circle type - std::string aTypeAttributeId = SketchPlugin_MacroCircle::CIRCLE_TYPE(); + /*std::string aTypeAttributeId = SketchPlugin_MacroCircle::CIRCLE_TYPE(); AttributeStringPtr aSourceFeatureTypeAttr = theSourceFeature->data()->string(aTypeAttributeId); AttributeStringPtr aNewFeatureTypeAttr = theNewFeature->data()->string(aTypeAttributeId); - aNewFeatureTypeAttr->setValue(aSourceFeatureTypeAttr->value()); - //ModuleBase_Tools::flushUpdated(theNewFeature); - aChanged = true; + if (aNewFeatureTypeAttr->value() != aTypeAttributeId) // do nothing if there is no changes + aNewFeatureTypeAttr->setValue(aSourceFeatureTypeAttr->value()); + //ModuleBase_Tools::flushUpdated(theNewFeature);*/ + //aChanged = true; } - else if (aFeatureKind == SketchPlugin_Arc::ID()) { + else if (aFeatureKind == SketchPlugin_MacroArc::ID()) { // set arc type - std::string aTypeAttributeId = SketchPlugin_Arc::ARC_TYPE(); + /*std::string aTypeAttributeId = SketchPlugin_MacroArc::ARC_TYPE(); AttributeStringPtr aSourceFeatureTypeAttr = theSourceFeature->data()->string(aTypeAttributeId); AttributeStringPtr aNewFeatureTypeAttr = theNewFeature->data()->string(aTypeAttributeId); - aNewFeatureTypeAttr->setValue(aSourceFeatureTypeAttr->value()); - - // if the arc is tangent, set coincidence to end point of the previous arc - std::string anArcType = aSourceFeatureTypeAttr->value(); - if (anArcType == SketchPlugin_Arc::ARC_TYPE_TANGENT()) { - // get the last point of the previuos arc feature(geom point 2d) - std::shared_ptr aSData = theSourceFeature->data(); - std::shared_ptr aSPointAttr = - std::dynamic_pointer_cast( - aSData->attribute(SketchPlugin_Arc::END_ID())); - // get point attribute on the current feature - AttributeRefAttrPtr aTangentPointAttr = theNewFeature->data()->refattr( - SketchPlugin_Arc::TANGENT_POINT_ID()); - aTangentPointAttr->setAttr(aSPointAttr); - - std::shared_ptr aNPointAttr = - std::dynamic_pointer_cast( - theNewFeature->data()->attribute(SketchPlugin_Arc::END_ID())); - aNPointAttr->setValue(aSPointAttr->x(), aSPointAttr->y()); - - } + if (aNewFeatureTypeAttr->value() != aTypeAttributeId) // do nothing if there is no changes + aNewFeatureTypeAttr->setValue(aSourceFeatureTypeAttr->value());*/ + //// if the arc is tangent, set coincidence to end point of the previous arc + //std::string anArcType = aSourceFeatureTypeAttr->value(); + //if (anArcType == SketchPlugin_Arc::ARC_TYPE_TANGENT()) { + // // get the last point of the previuos arc feature(geom point 2d) + // std::shared_ptr aSData = theSourceFeature->data(); + // std::shared_ptr aSPointAttr = + // std::dynamic_pointer_cast( + // aSData->attribute(SketchPlugin_Arc::END_ID())); + // // get point attribute on the current feature + // AttributeRefAttrPtr aTangentPointAttr = theNewFeature->data()->refattr( + // SketchPlugin_Arc::TANGENT_POINT_ID()); + // aTangentPointAttr->setAttr(aSPointAttr); + + // std::shared_ptr aNPointAttr = + // std::dynamic_pointer_cast( + // theNewFeature->data()->attribute(SketchPlugin_Arc::END_ID())); + // aNPointAttr->setValue(aSPointAttr->x(), aSPointAttr->y()); + + //} //ModuleBase_Tools::flushUpdated(theNewFeature); - aChanged = true; + //aChanged = true; + } + else if (aFeatureKind == SketchPlugin_Trim::ID() || + aFeatureKind == SketchPlugin_Split::ID()) { + std::string aPreviewObjectAttribute = aFeatureKind == SketchPlugin_Trim::ID() ? + SketchPlugin_Trim::PREVIEW_OBJECT(): SketchPlugin_Split::PREVIEW_OBJECT(); + std::string aPreviewPointAttribute = aFeatureKind == SketchPlugin_Trim::ID() ? + SketchPlugin_Trim::PREVIEW_POINT(): SketchPlugin_Split::PREVIEW_POINT(); + std::shared_ptr aRefPreviewAttr = + std::dynamic_pointer_cast( + theSourceFeature->data()->attribute(aPreviewObjectAttribute)); + std::shared_ptr aNRefPreviewAttr = + std::dynamic_pointer_cast( + theNewFeature->data()->attribute(aPreviewObjectAttribute)); + aNRefPreviewAttr->setValue(aRefPreviewAttr->value()); + std::shared_ptr aPointPreviewAttr = + std::dynamic_pointer_cast( + theSourceFeature->data()->attribute(aPreviewPointAttribute)); + std::shared_ptr aNPointPreviewAttr = + std::dynamic_pointer_cast( + theNewFeature->data()->attribute(aPreviewPointAttribute)); + aNPointPreviewAttr->setValue(aPointPreviewAttr->x(), aPointPreviewAttr->y()); } return aChanged; } @@ -696,10 +789,10 @@ bool PartSet_SketcherReentrantMgr::isTangentArc(ModuleBase_Operation* theOperati (theOperation); if (aFOperation && module()->sketchMgr()->isNestedSketchOperation(aFOperation)) { FeaturePtr aFeature = aFOperation->feature(); - if (aFeature.get() && aFeature->getKind() == SketchPlugin_Arc::ID()) { - AttributeStringPtr aTypeAttr = aFeature->data()->string(SketchPlugin_Arc::ARC_TYPE()); + if (aFeature.get() && aFeature->getKind() == SketchPlugin_MacroArc::ID()) { + AttributeStringPtr aTypeAttr = aFeature->data()->string(SketchPlugin_MacroArc::ARC_TYPE()); std::string anArcType = aTypeAttr.get() ? aTypeAttr->value() : ""; - aTangentArc = anArcType == SketchPlugin_Arc::ARC_TYPE_TANGENT(); + aTangentArc = anArcType == SketchPlugin_MacroArc::ARC_TYPE_BY_TANGENT_EDGE(); } } return aTangentArc;