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

Function geometry

docs/tests/v2/es6/js/sanddance.js:80398–80441  ·  view source on GitHub ↗
(o)

Source from the content-addressed store, hash-verified

80396 }
80397
80398 function geometry(o) {
80399 var type = o.type,
80400 coordinates;
80401
80402 switch (type) {
80403 case "GeometryCollection":
80404 return {
80405 type: type,
80406 geometries: o.geometries.map(geometry)
80407 };
80408
80409 case "Point":
80410 coordinates = point(o.coordinates);
80411 break;
80412
80413 case "MultiPoint":
80414 coordinates = o.coordinates.map(point);
80415 break;
80416
80417 case "LineString":
80418 coordinates = line(o.arcs);
80419 break;
80420
80421 case "MultiLineString":
80422 coordinates = o.arcs.map(line);
80423 break;
80424
80425 case "Polygon":
80426 coordinates = polygon(o.arcs);
80427 break;
80428
80429 case "MultiPolygon":
80430 coordinates = o.arcs.map(polygon);
80431 break;
80432
80433 default:
80434 return null;
80435 }
80436
80437 return {
80438 type: type,
80439 coordinates: coordinates
80440 };
80441 }
80442
80443 return geometry(o);
80444}

Callers 2

objectFunction · 0.70
extractArcsFunction · 0.70

Calls 8

pointFunction · 0.70
lineFunction · 0.70
polygonFunction · 0.70
extract1Function · 0.70
extract2Function · 0.70
extract3Function · 0.70
extractFunction · 0.70
forEachMethod · 0.45

Tested by

no test coverage detected