- case TopAbs_VERTEX:
- // name structure (Monifold Topology):
- // 1) F1 | F2 | F3 - intersection of 3 faces defines a vertex - trivial case.
- // 2) F1 | F2 | F3 [|F4 [|Fn]] - redundant definition, but it should be kept as is to obtain safe recomputation
- // 2) F1 | F2 - intersection of 2 faces definses a vertex - applicable for case
- // when 1 faces is cylindrical, conical, spherical or revolution and etc.
- // 3) E1 | E2 | E3 - intersection of 3 edges defines a vertex - when we have case of a shell
- // or compound of 2 open faces.
- // 4) E1 | E2 - intesection of 2 edges defines a vertex - when we have a case of
- // two independent edges (wire or compound)
- // implemented 2 first cases
- {
- TopTools_IndexedDataMapOfShapeListOfShape aMap;
- TopExp::MapShapesAndAncestors(aContext, TopAbs_VERTEX, TopAbs_FACE, aMap);
- const TopTools_ListOfShape& aList2 = aMap.FindFromKey(aSubShape);
- TopTools_ListOfShape aList;
- TopTools_MapOfShape aFMap;
-#ifdef FIX_BUG1
- //int n = aList2.Extent(); //bug! duplication
- // fix is below
- TopTools_ListIteratorOfListOfShape itl2(aList2);
- for (int i = 1;itl2.More();itl2.Next(),i++) {
- if(aFMap.Add(itl2.Value()))
- aList.Append(itl2.Value());
- }
- //n = aList.Extent();
-#endif
- int n = aList.Extent();
- if(n < 3) { // open topology case or Compound case => via edges
- TopTools_IndexedDataMapOfShapeListOfShape aMap;
- TopExp::MapShapesAndAncestors(aContext, TopAbs_VERTEX, TopAbs_EDGE, aMap);
- const TopTools_ListOfShape& aList22 = aMap.FindFromKey(aSubShape);
- if(aList22.Extent() >= 2) { // regular solution
-#ifdef FIX_BUG1
-
- // bug! duplication; fix is below
- aFMap.Clear();
- 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());
- }
- n = aListE.Extent();
-#endif
- TopTools_ListIteratorOfListOfShape itl(aListE);
- for (int i = 1;itl.More();itl.Next(),i++) {
- const TopoDS_Shape& anEdge = itl.Value();
- std::string anEdgeName = GetShapeName(aDoc, anEdge, selectionLabel());
- if(i == 1)
- aName = anEdgeName;
- else
- aName += "|" + anEdgeName;
- }
- }//reg
- else { // dangle vertex: if(aList22.Extent() == 1)
- //it should be already in DF
- }
- }
- else {
- TopTools_ListIteratorOfListOfShape itl(aList);
- for (int i = 1;itl.More();itl.Next(),i++) {
- const TopoDS_Shape& aFace = itl.Value();
- std::string aFaceName = GetShapeName(aDoc, aFace, selectionLabel());
- if(i == 1)
- aName = aFaceName;
- else
- aName += "|" + aFaceName;
- }
- }
- }
- break;
- }
- // register name
- // aDoc->addNamingName(selectionLabel(), aName);
- // the selected sub-shape will not be shared and as result it will not require registration
- }
- return aName;
-}
-
-TopAbs_ShapeEnum translateType (const std::string& theType)
-{
- // map from the textual shape types to OCCT enumeration
- static std::map<std::string, TopAbs_ShapeEnum> MyShapeTypes;
- if (MyShapeTypes.size() == 0) {
- MyShapeTypes["face"] = TopAbs_FACE;
- MyShapeTypes["faces"] = TopAbs_FACE;
- MyShapeTypes["vertex"] = TopAbs_VERTEX;
- MyShapeTypes["vertices"] = TopAbs_VERTEX;
- MyShapeTypes["wire"] = TopAbs_WIRE;
- MyShapeTypes["edge"] = TopAbs_EDGE;
- MyShapeTypes["edges"] = TopAbs_EDGE;
- MyShapeTypes["shell"] = TopAbs_SHELL;
- MyShapeTypes["solid"] = TopAbs_SOLID;
- MyShapeTypes["solids"] = TopAbs_SOLID;
- MyShapeTypes["FACE"] = TopAbs_FACE;
- MyShapeTypes["FACES"] = TopAbs_FACE;
- MyShapeTypes["VERTEX"] = TopAbs_VERTEX;
- MyShapeTypes["VERTICES"] = TopAbs_VERTEX;
- MyShapeTypes["WIRE"] = TopAbs_WIRE;
- MyShapeTypes["EDGE"] = TopAbs_EDGE;
- MyShapeTypes["EDGES"] = TopAbs_EDGE;
- MyShapeTypes["SHELL"] = TopAbs_SHELL;
- MyShapeTypes["SOLID"] = TopAbs_SOLID;
- MyShapeTypes["SOLIDS"] = TopAbs_SOLID;
- }
- if (MyShapeTypes.find(theType) != MyShapeTypes.end())
- return MyShapeTypes[theType];
- Events_Error::send("Shape type defined in XML is not implemented!");
- return TopAbs_SHAPE;