| 130 | } |
| 131 | |
| 132 | void BRepOffsetAPI_MakeOffsetFix::MakeWire(TopoDS_Shape& wire) |
| 133 | { |
| 134 | // get the edges of the wire and check which of the stored edges |
| 135 | // serve as input of the wire |
| 136 | TopTools_MapOfShape aMap; |
| 137 | TopExp_Explorer xp(wire, TopAbs_EDGE); |
| 138 | while (xp.More()) { |
| 139 | aMap.Add(xp.Current()); |
| 140 | xp.Next(); |
| 141 | } |
| 142 | |
| 143 | std::list<TopoDS_Edge> edgeList; |
| 144 | for (const auto& itLoc : myLocations) { |
| 145 | TopTools_ListOfShape newShapes = mkOffset.Generated(itLoc.first); |
| 146 | // Check generated shapes for the vertexes, too |
| 147 | TopExp_Explorer xpv(itLoc.first, TopAbs_VERTEX); |
| 148 | while (xpv.More()) { |
| 149 | TopTools_ListOfShape newEdge = mkOffset.Generated(xpv.Current()); |
| 150 | if (!newEdge.IsEmpty()) { |
| 151 | newShapes.Append(newEdge); |
| 152 | } |
| 153 | xpv.Next(); |
| 154 | } |
| 155 | for (TopTools_ListIteratorOfListOfShape it(newShapes); it.More(); it.Next()) { |
| 156 | TopoDS_Shape newShape = it.Value(); |
| 157 | |
| 158 | if (aMap.Contains(newShape)) { |
| 159 | newShape.Move(itLoc.second); |
| 160 | edgeList.push_back(TopoDS::Edge(newShape)); |
| 161 | } |
| 162 | } |
| 163 | } |
| 164 | |
| 165 | if (!edgeList.empty()) { |
| 166 | BRepBuilderAPI_MakeWire mkWire; |
| 167 | mkWire.Add(edgeList.front()); |
| 168 | edgeList.pop_front(); |
| 169 | wire = mkWire.Wire(); |
| 170 | |
| 171 | bool found = false; |
| 172 | do { |
| 173 | found = false; |
| 174 | for (std::list<TopoDS_Edge>::iterator pE = edgeList.begin(); pE != edgeList.end(); ++pE) { |
| 175 | mkWire.Add(*pE); |
| 176 | if (mkWire.Error() != BRepBuilderAPI_DisconnectedWire) { |
| 177 | // edge added ==> remove it from list |
| 178 | found = true; |
| 179 | edgeList.erase(pE); |
| 180 | wire = mkWire.Wire(); |
| 181 | break; |
| 182 | } |
| 183 | } |
| 184 | } while (found); |
| 185 | } |
| 186 | } |
| 187 | |
| 188 | const TopoDS_Shape& BRepOffsetAPI_MakeOffsetFix::Shape() |
| 189 | { |
no test coverage detected