UNPKG

vue-cesium

Version:
35 lines (31 loc) 1.36 kB
'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); "use strict"; function prettifyCoordinates(longitude, latitude, options) { const result = { latitude: "", longitude: "", elevation: "" }; const { defaultValue, defined } = Cesium; const optionsDefaulted = defaultValue(options, {}); const decimal = defaultValue(optionsDefaulted.decimal, 5); if (optionsDefaulted.rangeType === 0) { result.latitude = Math.abs(latitude).toFixed(decimal) + "\xB0" + (latitude < 0 ? "S" : "N"); result.longitude = Math.abs(longitude).toFixed(decimal) + "\xB0" + (longitude < 0 ? "W" : "E"); } else if (optionsDefaulted.rangeType === 1) { result.latitude = latitude.toFixed(decimal) + "\xB0"; result.longitude = longitude.toFixed(decimal) + "\xB0"; } else if (optionsDefaulted.rangeType === 2) { result.latitude = latitude.toFixed(decimal) + "\xB0"; result.longitude = (longitude < 0 ? 360 + longitude : longitude).toFixed(decimal) + "\xB0"; } if (defined(optionsDefaulted.height)) { result.elevation = Math.round(optionsDefaulted.height) + (defined(optionsDefaulted.errorBar) ? "\xB1" + Math.round(optionsDefaulted.errorBar) : "") + "m"; } else { result.elevation = ""; } return result; } exports["default"] = prettifyCoordinates; //# sourceMappingURL=prettifyCoordinates.js.map