vue-tianditu2
Version:
50 lines (49 loc) • 1.29 kB
JavaScript
import { useInit as s } from "../overlay/marker/use/init.mjs";
const L = (n) => {
const [t, r] = n;
return new T.LngLat(t, r);
}, l = (n) => n.map((t) => {
const [r, e] = t;
return new T.LngLat(r, e);
}), g = (n) => {
const [[t, r], [e, o]] = n;
return new T.LngLatBounds(new T.LngLat(t, r), new T.LngLat(e, o));
}, c = (n) => {
const [t, r] = n;
return new T.Point(t, r);
}, i = (n) => {
const t = {};
return Object.keys(n).forEach((r) => {
n[r] !== void 0 && (t[r] = n[r]);
}), t;
}, a = (n) => {
if (typeof n == "string")
return new T.Icon({ iconUrl: n });
{
const { iconUrl: t, iconSize: r, iconAnchor: e } = n, o = {
iconUrl: t,
iconSize: r && c(r),
iconAnchor: e && c(e)
};
return new T.Icon(i(o));
}
}, w = (n) => {
const t = s(n);
return n.icon && t.setIcon(a(n.icon)), t.extData = n.extData, t;
}, f = (n) => {
let t = [];
if (n.includes(" ") ? t = n.split(" ").map(Number) : n.includes(",") && (t = n.split(",").map(Number)), t.length != 2)
throw new Error("unknown lonlat format: " + n);
return t;
};
export {
i as objectFilter,
g as toBounds,
a as toIcon,
L as toLngLat,
l as toLngLats,
f as toLonLatNumberArray,
w as toMarker,
c as toPoint
};
//# sourceMappingURL=converter.mjs.map