- QList<AttributePtr> anAttributes;
- if (theFeature2AttributeMap.contains(aFeature)) {
- anAttributes = theFeature2AttributeMap[aFeature];
- }
- AttributePtr anAttr;
- TopoDS_Shape aShape = aPrs.shape();
- if (!aShape.IsNull()) {
- if (aShape.ShapeType() == TopAbs_VERTEX) {
- anAttr = PartSet_Tools::findAttributeBy2dPoint(aFeature, aShape, theSketch);
- if (anAttr.get() != NULL && !anAttributes.contains(anAttr))
- anAttributes.push_back(anAttr);
- }
+/// Fills attribute and result lists by the selected owner. In case if the attribute is found,
+/// by the owner shape, it is put to the list. Otherwise if type of owner shape is edge, put the function
+/// result as is to the list of results.
+/// \param theOwner a viewer selected owner
+/// \param theFeature a feature, where the attribute is searched
+/// \param theSketch a current sketch
+/// \param theSelectedAttribute an output list of attributes
+/// \param theSelectedResults an output list of edge results
+void getAttributesOrResults(const Handle(SelectMgr_EntityOwner)& theOwner,
+ const FeaturePtr& theFeature, const FeaturePtr& theSketch,
+ const ResultPtr& theResult,
+ std::set<AttributePtr>& aSelectedAttributes,
+ std::set<ResultPtr>& aSelectedResults)
+{
+ Handle(StdSelect_BRepOwner) aBRepOwner = Handle(StdSelect_BRepOwner)::DownCast(theOwner);
+ if (aBRepOwner.IsNull())
+ return;
+ Handle(AIS_InteractiveObject) anIO = Handle(AIS_InteractiveObject)::DownCast(
+ aBRepOwner->Selectable());
+ if (aBRepOwner->HasShape()) {
+ const TopoDS_Shape& aShape = aBRepOwner->Shape();
+ TopAbs_ShapeEnum aShapeType = aShape.ShapeType();
+ if (aShapeType == TopAbs_VERTEX) {
+ AttributePtr aPntAttr = PartSet_Tools::findAttributeBy2dPoint(theFeature,
+ aShape, theSketch);
+ if (aPntAttr.get() != NULL)
+ aSelectedAttributes.insert(aPntAttr);
+ }
+ else if (aShapeType == TopAbs_EDGE &&
+ aSelectedResults.find(theResult) == aSelectedResults.end()) {
+ aSelectedResults.insert(theResult);