From: nds Date: Sat, 27 Dec 2014 09:30:34 +0000 (+0300) Subject: The local selection restore for a feature vertex (it is checked on the line feature) X-Git-Tag: V_0.7.0_rc1~31 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=d695154d16059351b466d8b5fb9d26f1ce4a711f;p=modules%2Fshaper.git The local selection restore for a feature vertex (it is checked on the line feature) Save results in addition to attributes --- diff --git a/src/PartSet/PartSet_SketcherMgr.cpp b/src/PartSet/PartSet_SketcherMgr.cpp index 00688b9b8..f5abceeaa 100644 --- a/src/PartSet/PartSet_SketcherMgr.cpp +++ b/src/PartSet/PartSet_SketcherMgr.cpp @@ -281,7 +281,9 @@ void PartSet_SketcherMgr::onMouseMoved(ModuleBase_IViewWindow* theWnd, QMouseEve // save the previous selection std::list aSelectedAttributes; - getCurrentSelection(aSketchFeature, myCurrentSketch, aWorkshop, aSelectedAttributes); + std::list aSelectedResults; + getCurrentSelection(aSketchFeature, myCurrentSketch, aWorkshop, aSelectedAttributes, + aSelectedResults); // save the previous selection: end aSketchFeature->move(dX, dY); @@ -292,7 +294,7 @@ void PartSet_SketcherMgr::onMouseMoved(ModuleBase_IViewWindow* theWnd, QMouseEve // restore the previous selection SelectMgr_IndexedMapOfOwner anOwnersToSelect; getSelectionOwners(aSketchFeature, myCurrentSketch, aWorkshop, aSelectedAttributes, - anOwnersToSelect); + aSelectedResults, anOwnersToSelect); aConnector->workshop()->selector()->setSelectedOwners(anOwnersToSelect, false); // restore the previous selection } @@ -456,7 +458,8 @@ void PartSet_SketcherMgr::onPlaneSelected(const std::shared_ptr& th void PartSet_SketcherMgr::getCurrentSelection(const ObjectPtr& theObject, const FeaturePtr& theSketch, ModuleBase_IWorkshop* theWorkshop, - std::list& theSelectedAttributes) + std::list& theSelectedAttributes, + std::list& theSelectedResults) { FeaturePtr aFeature = ModelAPI_Feature::feature(theObject); if (aFeature.get() == NULL) @@ -468,22 +471,27 @@ void PartSet_SketcherMgr::getCurrentSelection(const ObjectPtr& theObject, XGUI_Displayer* aDisplayer = aConnector->workshop()->displayer(); // TODO: check all results and IPresentable feature - ResultPtr aResult = aFeature->firstResult(); - - bool isVisibleSketch = aDisplayer->isVisible(aResult); - AISObjectPtr aAISObj = aDisplayer->getAISObject(aResult); + std::list aResults = aFeature->results(); + std::list::const_iterator aIt; + for (aIt = aResults.begin(); aIt != aResults.end(); ++aIt) + { + ResultPtr aResult = *aIt; - if (aAISObj.get() != NULL) { + AISObjectPtr aAISObj = aDisplayer->getAISObject(aResult); + if (aAISObj.get() == NULL) + continue; Handle(AIS_InteractiveObject) anAISIO = aAISObj->impl(); for (aContext->InitSelected(); aContext->MoreSelected(); aContext->NextSelected()) { Handle(StdSelect_BRepOwner) aBRepOwner = Handle(StdSelect_BRepOwner)::DownCast( aContext->SelectedOwner()); - if (aBRepOwner.IsNull()) continue; + if (aBRepOwner.IsNull()) + continue; Handle(AIS_InteractiveObject) anIO = Handle(AIS_InteractiveObject)::DownCast( - aBRepOwner->Selectable()); - if (anIO != anAISIO) continue; + aBRepOwner->Selectable()); + if (anIO != anAISIO) + continue; if (aBRepOwner->HasShape()) { const TopoDS_Shape& aShape = aBRepOwner->Shape(); @@ -494,6 +502,9 @@ void PartSet_SketcherMgr::getCurrentSelection(const ObjectPtr& theObject, if (aPntAttr.get() != NULL) theSelectedAttributes.push_back(aPntAttr); } + else if (aShapeType == TopAbs_EDGE) { + theSelectedResults.push_back(aResult); + } } } } @@ -503,6 +514,7 @@ void PartSet_SketcherMgr::getSelectionOwners(const ObjectPtr& theObject, const FeaturePtr& theSketch, ModuleBase_IWorkshop* theWorkshop, const std::list& theSelectedAttributes, + const std::list& theSelectedResults, SelectMgr_IndexedMapOfOwner& anOwnersToSelect) { FeaturePtr aFeature = ModelAPI_Feature::feature(theObject); @@ -517,7 +529,6 @@ void PartSet_SketcherMgr::getSelectionOwners(const ObjectPtr& theObject, // TODO: check all results and IPresentable feature ResultPtr aResult = aFeature->firstResult(); - bool isVisibleSketch = aDisplayer->isVisible(aResult); AISObjectPtr aAISObj = aDisplayer->getAISObject(aResult); if (aAISObj.get() != NULL) { diff --git a/src/PartSet/PartSet_SketcherMgr.h b/src/PartSet/PartSet_SketcherMgr.h index 9c79ee437..183167bba 100644 --- a/src/PartSet/PartSet_SketcherMgr.h +++ b/src/PartSet/PartSet_SketcherMgr.h @@ -12,6 +12,7 @@ #include #include #include +#include #include #include @@ -77,10 +78,12 @@ private: /// \param theSketch a current sketch feature /// \param theWorkshop a workshop to have an access to AIS context and displayer /// \param theSelectedAttributes an out list of selected attributes + /// \param theSelectedAttributes an out list of selected results static void getCurrentSelection(const ObjectPtr& theObject, const FeaturePtr& theSketch, ModuleBase_IWorkshop* theWorkshop, - std::list& theSelectedAttributes); + std::list& theSelectedAttributes, + std::list& theSelectedResults); /// Applyes the current selection to the object in the workshop viewer /// It includes the selection in all modes of activation, even local context - vertexes, edges @@ -94,6 +97,7 @@ private: const FeaturePtr& theSketch, ModuleBase_IWorkshop* theWorkshop, const std::list& theSelectedAttributes, + const std::list& theSelectedResults, SelectMgr_IndexedMapOfOwner& anOwnersToSelect); private: