MCPcopy Create free account
hub / github.com/CoderOpen/waimai / getBoundingBox

Function getBoundingBox

front/components/u-charts/u-charts.js:3539–3567  ·  view source on GitHub ↗
(data)

Source from the content-addressed store, hash-verified

3537};
3538
3539function getBoundingBox(data) {
3540 var bounds = {}, coords;
3541 bounds.xMin = 180;
3542 bounds.xMax = 0;
3543 bounds.yMin = 90;
3544 bounds.yMax = 0
3545 for (var i = 0; i < data.length; i++) {
3546 var coorda = data[i].geometry.coordinates
3547 for (var k = 0; k < coorda.length; k++) {
3548 coords = coorda[k];
3549 if (coords.length == 1) {
3550 coords = coords[0]
3551 }
3552 for (var j = 0; j < coords.length; j++) {
3553 var longitude = coords[j][0];
3554 var latitude = coords[j][1];
3555 var point = {
3556 x: longitude,
3557 y: latitude
3558 }
3559 bounds.xMin = bounds.xMin < point.x ? bounds.xMin : point.x;
3560 bounds.xMax = bounds.xMax > point.x ? bounds.xMax : point.x;
3561 bounds.yMin = bounds.yMin < point.y ? bounds.yMin : point.y;
3562 bounds.yMax = bounds.yMax > point.y ? bounds.yMax : point.y;
3563 }
3564 }
3565 }
3566 return bounds;
3567}
3568
3569function coordinateToPoint(latitude, longitude,bounds,scale,xoffset,yoffset) {
3570 return {

Callers 1

drawMapDataPointsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected