UNPKG

@tuoyuan/map-adapter-lib

Version:

地图适配器库

39 lines (38 loc) 1 kB
var s = Object.defineProperty; var l = (i, t, h) => t in i ? s(i, t, { enumerable: !0, configurable: !0, writable: !0, value: h }) : i[t] = h; var e = (i, t, h) => l(i, typeof t != "symbol" ? t + "" : t, h); class g { constructor(t, h, u) { /** 经度 */ e(this, "longitude"); /** 纬度 */ e(this, "latitude"); /** 高度,三维地图使用 */ e(this, "height"); this.longitude = t, this.latitude = h, this.height = u; } toArray() { const t = []; return t.push(this.longitude, this.latitude), this.height != null && t.push(this.height), t; } toString() { return this.toArray().join(","); } toObject() { return { longitude: this.longitude, latitude: this.latitude, height: this.height }; } /** * 当前坐标与传入坐标是否相等 * @param position */ equals(t) { return this.longitude === t.longitude && this.latitude === t.latitude && this.height === t.height; } } export { g as Position };