// save the previous selection
std::list<AttributePtr> aSelectedAttributes;
- getCurrentSelection(aSketchFeature, myCurrentSketch, aWorkshop, aSelectedAttributes);
+ std::list<ResultPtr> aSelectedResults;
+ getCurrentSelection(aSketchFeature, myCurrentSketch, aWorkshop, aSelectedAttributes,
+ aSelectedResults);
// save the previous selection: end
aSketchFeature->move(dX, dY);
// 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
}
void PartSet_SketcherMgr::getCurrentSelection(const ObjectPtr& theObject,
const FeaturePtr& theSketch,
ModuleBase_IWorkshop* theWorkshop,
- std::list<AttributePtr>& theSelectedAttributes)
+ std::list<AttributePtr>& theSelectedAttributes,
+ std::list<ResultPtr>& theSelectedResults)
{
FeaturePtr aFeature = ModelAPI_Feature::feature(theObject);
if (aFeature.get() == NULL)
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<ResultPtr> aResults = aFeature->results();
+ std::list<ResultPtr>::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<Handle(AIS_InteractiveObject)>();
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();
if (aPntAttr.get() != NULL)
theSelectedAttributes.push_back(aPntAttr);
}
+ else if (aShapeType == TopAbs_EDGE) {
+ theSelectedResults.push_back(aResult);
+ }
}
}
}
const FeaturePtr& theSketch,
ModuleBase_IWorkshop* theWorkshop,
const std::list<AttributePtr>& theSelectedAttributes,
+ const std::list<ResultPtr>& theSelectedResults,
SelectMgr_IndexedMapOfOwner& anOwnersToSelect)
{
FeaturePtr aFeature = ModelAPI_Feature::feature(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) {
#include <ModelAPI_Feature.h>
#include <ModelAPI_Attribute.h>
#include <ModelAPI_CompositeFeature.h>
+#include <ModelAPI_Result.h>
#include <ModuleBase_ViewerFilters.h>
#include <ModuleBase_Definitions.h>
/// \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<AttributePtr>& theSelectedAttributes);
+ std::list<AttributePtr>& theSelectedAttributes,
+ std::list<ResultPtr>& 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
const FeaturePtr& theSketch,
ModuleBase_IWorkshop* theWorkshop,
const std::list<AttributePtr>& theSelectedAttributes,
+ const std::list<ResultPtr>& theSelectedResults,
SelectMgr_IndexedMapOfOwner& anOwnersToSelect);
private: