MCPcopy
hub / github.com/microsoft/SandDance / extractArcs

Function extractArcs

docs/app/js/sanddance-app.js:109560–109602  ·  view source on GitHub ↗
(topology, object, filter)

Source from the content-addressed store, hash-verified

109558 };
109559}
109560function extractArcs(topology, object, filter) {
109561 var arcs1 = [], geomsByArc = [], geom;
109562 function extract0(i) {
109563 var j = i < 0 ? ~i : i;
109564 (geomsByArc[j] || (geomsByArc[j] = [])).push({
109565 i: i,
109566 g: geom
109567 });
109568 }
109569 function extract1(arcs) {
109570 arcs.forEach(extract0);
109571 }
109572 function extract2(arcs) {
109573 arcs.forEach(extract1);
109574 }
109575 function extract3(arcs) {
109576 arcs.forEach(extract2);
109577 }
109578 function geometry(o) {
109579 switch(geom = o, o.type){
109580 case "GeometryCollection":
109581 o.geometries.forEach(geometry);
109582 break;
109583 case "LineString":
109584 extract1(o.arcs);
109585 break;
109586 case "MultiLineString":
109587 case "Polygon":
109588 extract2(o.arcs);
109589 break;
109590 case "MultiPolygon":
109591 extract3(o.arcs);
109592 break;
109593 }
109594 }
109595 geometry(object);
109596 geomsByArc.forEach(filter == null ? function(geoms) {
109597 arcs1.push(geoms[0].i);
109598 } : function(geoms) {
109599 if (filter(geoms[0].g, geoms[geoms.length - 1].g)) arcs1.push(geoms[0].i);
109600 });
109601 return arcs1;
109602}
109603
109604},{"./feature.js":"92SRL","./stitch.js":"kAWIL","@parcel/transformer-js/src/esmodule-helpers.js":"jA2du"}],"kAWIL":[function(require,module,exports) {
109605var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js");

Callers 1

meshArcsFunction · 0.70

Calls 3

geometryFunction · 0.70
filterFunction · 0.70
forEachMethod · 0.45

Tested by

no test coverage detected