+// searches theType shape that contains theConnectionType sub-shapes in each shape from the List,
+// so, implements the neighbours searching
+/*
+const TopoDS_Shape findCommonShapeByNB(const TopAbs_ShapeEnum theType,
+ const TopAbs_ShapeEnum theConnectionType, const TopTools_ListOfShape& theList)
+{
+TopTools_MapOfShape aCheckedShapes; // already checked shapes of type theType
+ TopoDS_Shape aResult; // theType result shape
+ for(TopTools_ListIteratorOfListOfShape anIt(theList); anIt.More(); anIt.Next()) { // iterate all
+ for(TopExp_Explorer anExp(anIt.ChangeValue(), theType); anExp.More(); anExp.Next()) {
+ if (aCheckedShapes.Contains(anExp.Current()))
+ continue; // already checked
+ aCheckedShapes.Add(anExp.Current());
+ TopTools_MapOfShape aConnectors; // all connectors of the checked theType shape
+ for(TopExp_Explorer aCExp(anExp.Current(), theConnectionType); aCExp.More(); aCExp.Next()) {
+ aConnectors.Add(aCExp.Current());
+ }
+ // check that all shapes from the List contain the connector sub-shapes
+ bool aFound = true;
+ for(TopTools_ListIteratorOfListOfShape anIt2(theList); anIt2.More() && aFound; anIt2.Next()) {
+ if (anIt2.Value().IsSame(anIt.Value()))
+ continue;
+ aFound = false;
+ for(TopExp_Explorer anE(anIt2.ChangeValue(), theConnectionType); anE.More(); anE.Next()) {
+ if (aConnectors.Contains(anE.Current())) {
+ aFound = true;
+ break;
+ }
+ }
+ }
+ if (aFound) {
+ if (!aResult.IsNull()) // more than one result
+ return TopoDS_Shape();
+ aResult = anExp.Current();
+ }
+ }
+ }
+ return aResult;
+}*/
+
+std::string Model_SelectionNaming::vertexNameByEdges(TopoDS_Shape theContext, TopoDS_Shape theSub,
+ std::shared_ptr<Model_Document> theDoc, ResultPtr& theContextRes, const bool theAnotherDoc)
+{
+ std::string aResult;
+ TopTools_IndexedDataMapOfShapeListOfShape aMap;
+ TopExp::MapShapesAndAncestors(theContext, TopAbs_VERTEX, TopAbs_EDGE, aMap);
+ const TopTools_ListOfShape& aList22 = aMap.FindFromKey(theSub);
+ if(aList22.Extent() >= 2) { // regular solution
+ TopTools_MapOfShape aFMap;
+ TopTools_ListOfShape aListE;
+ TopTools_ListIteratorOfListOfShape itl2(aList22);
+ for (int i = 1;itl2.More();itl2.Next(),i++) {
+ if(aFMap.Add(itl2.Value()))
+ aListE.Append(itl2.Value());
+ }
+ TopTools_ListIteratorOfListOfShape itl(aListE);
+ for (int i = 1;itl.More();itl.Next(),i++) {
+ const TopoDS_Shape& anEdge = itl.Value();
+ std::string anEdgeName = getShapeName(theDoc, anEdge, theContextRes, theAnotherDoc, false);
+ if (anEdgeName.empty()) { // edge is not in DS
+ aResult.clear();
+ return aResult;
+ }
+ if(i == 1)
+ aResult = anEdgeName;
+ else
+ aResult += "&" + anEdgeName;
+ }
+ }
+ return aResult;
+}
+