}
// map of vertices to know if the wire is open
- TopTools_MapOfShape vmap;
+ TopTools_IndexedMapOfShape vmap;
// map of infinite edges
TopTools_MapOfShape anInfEmap;
// add or remove in the vertex map
V1.Orientation(TopAbs_FORWARD);
- if (!vmap.Add(V1))
- vmap.Remove(V1);
+ Standard_Integer currsize = vmap.Extent(),
+ ind = vmap.Add(V1);
+ if (currsize >= ind)
+ {
+ vmap.RemoveKey(V1);
+ }
}
if (!V2.IsNull())
{
V2.Orientation(TopAbs_REVERSED);
- if (!vmap.Add(V2))
- vmap.Remove(V2);
+ Standard_Integer currsize = vmap.Extent(),
+ ind = vmap.Add(V2);
+ if (currsize >= ind)
+ {
+ vmap.RemoveKey(V2);
+ }
}
if (V1.IsNull() || V2.IsNull())
// if vmap is not empty the wire is open, let us find the first vertex
if (!vmap.IsEmpty()) {
- TopTools_MapIteratorOfMapOfShape itt(vmap);
- while (itt.Key().Orientation() != TopAbs_FORWARD) {
- itt.Next();
- if (!itt.More()) break;
+ //TopTools_MapIteratorOfMapOfShape itt(vmap);
+ //while (itt.Key().Orientation() != TopAbs_FORWARD) {
+ // itt.Next();
+ // if (!itt.More()) break;
+ //}
+ //if (itt.More()) V1 = TopoDS::Vertex(itt.Key());
+ Standard_Integer ind = 0;
+ for (ind = 1; ind <= vmap.Extent(); ++ind)
+ {
+ if (vmap(ind).Orientation() == TopAbs_FORWARD)
+ {
+ V1 = TopoDS::Vertex(vmap(ind));
+ break;
+ }
}
- if (itt.More()) V1 = TopoDS::Vertex(itt.Key());
}
else {
// The wire is infinite Try to find the first vertex. It may be NULL.
--- /dev/null
+puts "========="
+puts "0030422: Modeling Data - Random behaviour of BRepAdaptor_CompCurve"
+puts "========="
+puts ""
+
+vertex vf1 0 0 0
+vertex vf2 1 0 0
+vertex vf3 2 0 0
+vertex vf4 3 0 0
+vertex vf5 4 0 0
+##
+edge ef1 vf1 vf2
+edge ef2 vf2 vf3
+edge ef3 vf3 vf4
+edge ef4 vf5 vf4
+##
+shape wf w
+add ef1 wf
+add ef2 wf
+add ef3 wf
+add ef4 wf
+##
+wexplo wf
+#
+if {![isdraw WEDGE_3] } {
+ puts "Error: wire explorer failed"
+} else {
+ unset WEDGE_1
+ unset WEDGE_2
+ unset WEDGE_3
+}
+##
+vertex vs5 4 0 0
+vertex vs2 1 0 0
+vertex vs3 2 0 0
+vertex vs4 3 0 0
+vertex vs1 0 0 0
+##
+edge es1 vs1 vs2
+edge es2 vs2 vs3
+edge es3 vs3 vs4
+edge es4 vs5 vs4
+##
+shape ws w
+add es1 ws
+add es4 ws
+add es3 ws
+add es2 ws
+##
+wexplo ws
+#
+if {![isdraw WEDGE_3] } {
+ puts "Error: wire explorer failed"
+}
+
+