ts-maps 0.2.7 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +21 -0
- package/README.md +202 -141
- package/dist/core-map/assets/embedded-icons.d.ts +8 -0
- package/dist/core-map/control/AttributionControl.d.ts +12 -0
- package/dist/core-map/control/Control.d.ts +14 -0
- package/dist/core-map/control/LayersControl.d.ts +38 -0
- package/dist/core-map/control/ScaleControl.d.ts +14 -0
- package/dist/core-map/control/ZoomControl.d.ts +14 -0
- package/dist/core-map/control/index.d.ts +5 -0
- package/dist/core-map/core/Browser.d.ts +24 -0
- package/dist/core-map/core/Class.d.ts +12 -0
- package/dist/core-map/core/Events.d.ts +31 -0
- package/dist/core-map/core/Handler.d.ts +12 -0
- package/dist/core-map/core/Util.d.ts +24 -0
- package/dist/core-map/core/index.d.ts +7 -0
- package/dist/core-map/dom/Animation.d.ts +50 -0
- package/dist/core-map/dom/DomEvent.DoubleTap.d.ts +6 -0
- package/dist/core-map/dom/DomEvent.PointerEvents.d.ts +4 -0
- package/dist/core-map/dom/DomEvent.d.ts +15 -0
- package/dist/core-map/dom/DomUtil.d.ts +22 -0
- package/dist/core-map/dom/Draggable.d.ts +26 -0
- package/dist/core-map/dom/PosAnimation.d.ts +19 -0
- package/dist/core-map/dom/easing.d.ts +41 -0
- package/dist/core-map/dom/index.d.ts +8 -0
- package/dist/core-map/geo/LatLng.d.ts +18 -0
- package/dist/core-map/geo/LatLngBounds.d.ts +27 -0
- package/dist/core-map/geo/TerrainSource.d.ts +35 -0
- package/dist/core-map/geo/crs/CRS.d.ts +23 -0
- package/dist/core-map/geo/crs/EPSG3395.d.ts +7 -0
- package/dist/core-map/geo/crs/EPSG3857.d.ts +10 -0
- package/dist/core-map/geo/crs/EPSG4326.d.ts +7 -0
- package/dist/core-map/geo/crs/EarthCRS.d.ts +7 -0
- package/dist/core-map/geo/crs/SimpleCRS.d.ts +11 -0
- package/dist/core-map/geo/crs/index.d.ts +6 -0
- package/dist/core-map/geo/elevation.d.ts +23 -0
- package/dist/core-map/geo/index.d.ts +13 -0
- package/dist/core-map/geo/index.js +1204 -0
- package/dist/core-map/geo/projection/Projection.Globe.d.ts +30 -0
- package/dist/core-map/geo/projection/Projection.LonLat.d.ts +11 -0
- package/dist/core-map/geo/projection/Projection.Mercator.d.ts +6 -0
- package/dist/core-map/geo/projection/Projection.SphericalMercator.d.ts +6 -0
- package/dist/core-map/geo/projection/index.d.ts +5 -0
- package/dist/core-map/geo/terrainMesh.d.ts +21 -0
- package/dist/core-map/geometry/Bounds.d.ts +23 -0
- package/dist/core-map/geometry/LineUtil.d.ts +13 -0
- package/dist/core-map/geometry/Point.d.ts +35 -0
- package/dist/core-map/geometry/PolyUtil.d.ts +6 -0
- package/dist/core-map/geometry/RTree.d.ts +35 -0
- package/dist/core-map/geometry/Transformation.d.ts +12 -0
- package/dist/core-map/geometry/earcut.d.ts +17 -0
- package/dist/core-map/geometry/index.d.ts +10 -0
- package/dist/core-map/geometry/index.js +1586 -0
- package/dist/core-map/index.d.ts +59 -0
- package/dist/core-map/layer/BlanketOverlay.d.ts +24 -0
- package/dist/core-map/layer/DivOverlay.d.ts +40 -0
- package/dist/core-map/layer/FeatureGroup.d.ts +11 -0
- package/dist/core-map/layer/GeoJSON.d.ts +17 -0
- package/dist/core-map/layer/GeoJSONClusterSource.d.ts +54 -0
- package/dist/core-map/layer/HeatmapLayer.d.ts +40 -0
- package/dist/core-map/layer/ImageOverlay.d.ts +27 -0
- package/dist/core-map/layer/Layer.d.ts +18 -0
- package/dist/core-map/layer/LayerGroup.d.ts +16 -0
- package/dist/core-map/layer/Popup.d.ts +18 -0
- package/dist/core-map/layer/SVGOverlay.d.ts +4 -0
- package/dist/core-map/layer/Tooltip.d.ts +15 -0
- package/dist/core-map/layer/VideoOverlay.d.ts +4 -0
- package/dist/core-map/layer/index.d.ts +18 -0
- package/dist/core-map/layer/marker/DefaultIcon.d.ts +7 -0
- package/dist/core-map/layer/marker/DivIcon.d.ts +5 -0
- package/dist/core-map/layer/marker/Icon.d.ts +10 -0
- package/dist/core-map/layer/marker/Marker.Drag.d.ts +17 -0
- package/dist/core-map/layer/marker/Marker.d.ts +37 -0
- package/dist/core-map/layer/marker/index.d.ts +5 -0
- package/dist/core-map/layer/tile/GridLayer.d.ts +88 -0
- package/dist/core-map/layer/tile/RasterDEMLayer.d.ts +46 -0
- package/dist/core-map/layer/tile/TileLayer.d.ts +22 -0
- package/dist/core-map/layer/tile/VectorTileMapLayer.d.ts +145 -0
- package/dist/core-map/layer/tile/WMSTileLayer.d.ts +12 -0
- package/dist/core-map/layer/tile/index.d.ts +15 -0
- package/dist/core-map/layer/tile/urlTemplate.d.ts +17 -0
- package/dist/core-map/layer/vector/Canvas.d.ts +52 -0
- package/dist/core-map/layer/vector/Circle.d.ts +7 -0
- package/dist/core-map/layer/vector/CircleMarker.d.ts +22 -0
- package/dist/core-map/layer/vector/Path.d.ts +20 -0
- package/dist/core-map/layer/vector/Polygon.d.ts +13 -0
- package/dist/core-map/layer/vector/Polyline.d.ts +30 -0
- package/dist/core-map/layer/vector/Rectangle.d.ts +6 -0
- package/dist/core-map/layer/vector/Renderer.d.ts +12 -0
- package/dist/core-map/layer/vector/Renderer.getRenderer.d.ts +1 -0
- package/dist/core-map/layer/vector/SVG.d.ts +21 -0
- package/dist/core-map/layer/vector/index.d.ts +10 -0
- package/dist/core-map/map/Map.d.ts +353 -0
- package/dist/core-map/map/Style.d.ts +29 -0
- package/dist/core-map/map/handler/BoxZoomHandler.d.ts +23 -0
- package/dist/core-map/map/handler/DoubleClickZoomHandler.d.ts +6 -0
- package/dist/core-map/map/handler/DragHandler.d.ts +27 -0
- package/dist/core-map/map/handler/KeyboardHandler.d.ts +18 -0
- package/dist/core-map/map/handler/PinchZoomHandler.d.ts +20 -0
- package/dist/core-map/map/handler/ScrollWheelZoomHandler.d.ts +12 -0
- package/dist/core-map/map/handler/TapHoldHandler.d.ts +15 -0
- package/dist/core-map/map/handler/TwoFingerPitchHandler.d.ts +21 -0
- package/dist/core-map/map/handler/TwoFingerRotateHandler.d.ts +17 -0
- package/dist/core-map/map/index.d.ts +11 -0
- package/dist/core-map/mvt/VectorTile.d.ts +9 -0
- package/dist/core-map/mvt/VectorTileFeature.d.ts +59 -0
- package/dist/core-map/mvt/VectorTileLayer.d.ts +13 -0
- package/dist/core-map/proto/Pbf.d.ts +84 -0
- package/dist/core-map/renderer/webgl/GLContext.d.ts +22 -0
- package/dist/core-map/renderer/webgl/WebGLTileRenderer.d.ts +86 -0
- package/dist/core-map/renderer/webgl/index.d.ts +9 -0
- package/dist/core-map/renderer/webgl/mat4.d.ts +14 -0
- package/dist/core-map/services/index.d.ts +26 -0
- package/dist/core-map/services/index.js +1230 -0
- package/dist/core-map/services/providers/Google.d.ts +16 -0
- package/dist/core-map/services/providers/Mapbox.d.ts +26 -0
- package/dist/core-map/services/providers/Maptiler.d.ts +11 -0
- package/dist/core-map/services/providers/Nominatim.d.ts +11 -0
- package/dist/core-map/services/providers/OSRM.d.ts +20 -0
- package/dist/core-map/services/providers/Photon.d.ts +10 -0
- package/dist/core-map/services/providers/Valhalla.d.ts +20 -0
- package/dist/core-map/services/types.d.ts +84 -0
- package/dist/core-map/storage/TileCache.d.ts +40 -0
- package/dist/core-map/storage/cachedFetch.d.ts +13 -0
- package/dist/core-map/storage/defaultCache.d.ts +3 -0
- package/dist/core-map/storage/index.d.ts +13 -0
- package/dist/core-map/storage/index.js +283 -0
- package/dist/core-map/storage/offlineRegion.d.ts +26 -0
- package/dist/core-map/style-spec/diff.d.ts +17 -0
- package/dist/core-map/style-spec/expressions/Color.d.ts +16 -0
- package/dist/core-map/style-spec/expressions/compile.d.ts +4 -0
- package/dist/core-map/style-spec/expressions/errors.d.ts +8 -0
- package/dist/core-map/style-spec/expressions/index.d.ts +16 -0
- package/dist/core-map/style-spec/expressions/legacyFilter.d.ts +6 -0
- package/dist/core-map/style-spec/expressions/operators/conversion.d.ts +1 -0
- package/dist/core-map/style-spec/expressions/operators/interpolate.d.ts +14 -0
- package/dist/core-map/style-spec/expressions/operators/logical.d.ts +1 -0
- package/dist/core-map/style-spec/expressions/operators/lookup.d.ts +1 -0
- package/dist/core-map/style-spec/expressions/operators/math.d.ts +1 -0
- package/dist/core-map/style-spec/expressions/operators/string.d.ts +1 -0
- package/dist/core-map/style-spec/expressions/registry.d.ts +29 -0
- package/dist/core-map/style-spec/expressions/types.d.ts +48 -0
- package/dist/core-map/style-spec/expressions/validate.d.ts +13 -0
- package/dist/core-map/style-spec/index.d.ts +68 -0
- package/dist/core-map/style-spec/index.js +2529 -0
- package/dist/core-map/style-spec/schema.d.ts +381 -0
- package/dist/core-map/style-spec/types.d.ts +375 -0
- package/dist/core-map/style-spec/validate.d.ts +14 -0
- package/dist/core-map/symbols/CollisionIndex.d.ts +21 -0
- package/dist/core-map/symbols/GlyphAtlas.d.ts +38 -0
- package/dist/core-map/symbols/IconAtlas.d.ts +18 -0
- package/dist/core-map/symbols/index.d.ts +6 -0
- package/dist/core-map/symbols/index.js +501 -0
- package/dist/index.d.ts +2 -4
- package/dist/index.js +18414 -1857
- package/package.json +50 -58
- package/src/core-map/ts-maps.css +725 -0
- package/dist/components/base.d.ts +0 -17
- package/dist/components/concerns/interactable.d.ts +0 -1
- package/dist/components/line.d.ts +0 -29
- package/dist/components/marker.d.ts +0 -50
- package/dist/components/region.d.ts +0 -46
- package/dist/components/tooltip.d.ts +0 -22
- package/dist/core/apply-transform.d.ts +0 -7
- package/dist/core/coords-to-point.d.ts +0 -12
- package/dist/core/create-lines.d.ts +0 -2
- package/dist/core/create-markers.d.ts +0 -2
- package/dist/core/create-regions.d.ts +0 -2
- package/dist/core/create-series.d.ts +0 -3
- package/dist/core/get-inset-for-point.d.ts +0 -13
- package/dist/core/get-marker-position.d.ts +0 -6
- package/dist/core/index.d.ts +0 -1
- package/dist/core/reposition-labels.d.ts +0 -2
- package/dist/core/reposition-lines.d.ts +0 -2
- package/dist/core/reposition-markers.d.ts +0 -2
- package/dist/core/resize.d.ts +0 -3
- package/dist/core/set-focus.d.ts +0 -2
- package/dist/core/set-scale.d.ts +0 -2
- package/dist/core/setup-container-events.d.ts +0 -2
- package/dist/core/setup-container-touch-events.d.ts +0 -2
- package/dist/core/setup-element-events.d.ts +0 -2
- package/dist/core/setup-zoom-buttons.d.ts +0 -2
- package/dist/core/update-size.d.ts +0 -2
- package/dist/data-visualization.d.ts +0 -17
- package/dist/defaults/events.d.ts +0 -1
- package/dist/defaults/options.d.ts +0 -1
- package/dist/event-handler.d.ts +0 -1
- package/dist/legend.d.ts +0 -17
- package/dist/map.d.ts +0 -81
- package/dist/maps/brasil.d.ts +0 -2
- package/dist/maps/brasil.js +0 -7
- package/dist/maps/canada.d.ts +0 -2
- package/dist/maps/canada.js +0 -7
- package/dist/maps/iraq.d.ts +0 -2
- package/dist/maps/iraq.js +0 -84
- package/dist/maps/italy.d.ts +0 -2
- package/dist/maps/italy.js +0 -7
- package/dist/maps/russia.d.ts +0 -2
- package/dist/maps/russia.js +0 -366
- package/dist/maps/spain.d.ts +0 -2
- package/dist/maps/spain.js +0 -7
- package/dist/maps/us-aea-en.d.ts +0 -2
- package/dist/maps/us-aea-en.js +0 -7
- package/dist/maps/us-lcc-en.d.ts +0 -2
- package/dist/maps/us-lcc-en.js +0 -7
- package/dist/maps/us-merc-en.d.ts +0 -2
- package/dist/maps/us-merc-en.js +0 -7
- package/dist/maps/us-mill-en.d.ts +0 -2
- package/dist/maps/us-mill-en.js +0 -7
- package/dist/maps/world-merc.d.ts +0 -2
- package/dist/maps/world-merc.js +0 -7
- package/dist/maps/world.d.ts +0 -2
- package/dist/maps/world.js +0 -7
- package/dist/projection.d.ts +0 -1
- package/dist/scales/ordinal-scale.d.ts +0 -12
- package/dist/series.d.ts +0 -14
- package/dist/svg/base-element.d.ts +0 -19
- package/dist/svg/canvas-element.d.ts +0 -21
- package/dist/svg/image-element.d.ts +0 -12
- package/dist/svg/shape-element.d.ts +0 -19
- package/dist/svg/text-element.d.ts +0 -7
- package/dist/types.d.ts +0 -418
- package/dist/util/deep-merge.d.ts +0 -2
- package/dist/util/index.d.ts +0 -18
- package/dist/utils.d.ts +0 -87
- package/dist/vector-map.d.ts +0 -5
|
@@ -0,0 +1,1586 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
function __accessProp(key) {
|
|
6
|
+
return this[key];
|
|
7
|
+
}
|
|
8
|
+
var __toCommonJS = (from) => {
|
|
9
|
+
var entry = (__moduleCache ??= new WeakMap).get(from), desc;
|
|
10
|
+
if (entry)
|
|
11
|
+
return entry;
|
|
12
|
+
entry = __defProp({}, "__esModule", { value: true });
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (var key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(entry, key))
|
|
16
|
+
__defProp(entry, key, {
|
|
17
|
+
get: __accessProp.bind(from, key),
|
|
18
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
__moduleCache.set(from, entry);
|
|
22
|
+
return entry;
|
|
23
|
+
};
|
|
24
|
+
var __moduleCache;
|
|
25
|
+
var __returnValue = (v) => v;
|
|
26
|
+
function __exportSetter(name, newValue) {
|
|
27
|
+
this[name] = __returnValue.bind(null, newValue);
|
|
28
|
+
}
|
|
29
|
+
var __export = (target, all) => {
|
|
30
|
+
for (var name in all)
|
|
31
|
+
__defProp(target, name, {
|
|
32
|
+
get: all[name],
|
|
33
|
+
enumerable: true,
|
|
34
|
+
configurable: true,
|
|
35
|
+
set: __exportSetter.bind(all, name)
|
|
36
|
+
});
|
|
37
|
+
};
|
|
38
|
+
var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
|
|
39
|
+
|
|
40
|
+
// src/core-map/core/Util.ts
|
|
41
|
+
var exports_Util = {};
|
|
42
|
+
__export(exports_Util, {
|
|
43
|
+
wrapNum: () => wrapNum,
|
|
44
|
+
throttle: () => throttle,
|
|
45
|
+
template: () => template,
|
|
46
|
+
stamp: () => stamp,
|
|
47
|
+
splitWords: () => splitWords,
|
|
48
|
+
setOptions: () => setOptions,
|
|
49
|
+
setLastId: () => setLastId,
|
|
50
|
+
noop: () => noop,
|
|
51
|
+
lastId: () => lastId,
|
|
52
|
+
formatNum: () => formatNum,
|
|
53
|
+
falseFn: () => falseFn
|
|
54
|
+
});
|
|
55
|
+
function stamp(obj) {
|
|
56
|
+
if (!("_tsmap_id" in obj)) {
|
|
57
|
+
obj._tsmap_id = ++lastId;
|
|
58
|
+
}
|
|
59
|
+
return obj._tsmap_id;
|
|
60
|
+
}
|
|
61
|
+
function setLastId(id) {
|
|
62
|
+
lastId = id;
|
|
63
|
+
}
|
|
64
|
+
function throttle(fn, time, context) {
|
|
65
|
+
let lock = false;
|
|
66
|
+
let queuedArgs = false;
|
|
67
|
+
function later() {
|
|
68
|
+
lock = false;
|
|
69
|
+
if (queuedArgs) {
|
|
70
|
+
wrapperFn.apply(context, queuedArgs);
|
|
71
|
+
queuedArgs = false;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
function wrapperFn(...args) {
|
|
75
|
+
if (lock) {
|
|
76
|
+
queuedArgs = args;
|
|
77
|
+
} else {
|
|
78
|
+
fn.apply(context, args);
|
|
79
|
+
setTimeout(later, time);
|
|
80
|
+
lock = true;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
return wrapperFn;
|
|
84
|
+
}
|
|
85
|
+
function wrapNum(x, range, includeMax) {
|
|
86
|
+
const max = range[1];
|
|
87
|
+
const min = range[0];
|
|
88
|
+
const d = max - min;
|
|
89
|
+
return x === max && includeMax ? x : ((x - min) % d + d) % d + min;
|
|
90
|
+
}
|
|
91
|
+
function falseFn(..._args) {
|
|
92
|
+
return false;
|
|
93
|
+
}
|
|
94
|
+
function formatNum(num, precision) {
|
|
95
|
+
if (precision === false)
|
|
96
|
+
return num;
|
|
97
|
+
const pow = 10 ** (precision === undefined ? 6 : precision);
|
|
98
|
+
return Math.round(num * pow) / pow;
|
|
99
|
+
}
|
|
100
|
+
function splitWords(str) {
|
|
101
|
+
return str.trim().split(/\s+/);
|
|
102
|
+
}
|
|
103
|
+
function setOptions(obj, options) {
|
|
104
|
+
if (!Object.hasOwn(obj, "options")) {
|
|
105
|
+
obj.options = obj.options ? Object.create(obj.options) : {};
|
|
106
|
+
}
|
|
107
|
+
if (options) {
|
|
108
|
+
for (const i in options) {
|
|
109
|
+
if (Object.hasOwn(options, i)) {
|
|
110
|
+
obj.options[i] = options[i];
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
return obj.options;
|
|
115
|
+
}
|
|
116
|
+
function template(str, data) {
|
|
117
|
+
return str.replace(templateRe, (match, key) => {
|
|
118
|
+
const k = key.trim();
|
|
119
|
+
let value = data[k];
|
|
120
|
+
if (value === undefined)
|
|
121
|
+
throw new Error(`No value provided for variable ${match}`);
|
|
122
|
+
else if (typeof value === "function")
|
|
123
|
+
value = value(data);
|
|
124
|
+
return value;
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
function noop() {}
|
|
128
|
+
var lastId = 0, templateRe;
|
|
129
|
+
var init_Util = __esm(() => {
|
|
130
|
+
templateRe = /\{([^{}]+)\}/g;
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
// src/core-map/geometry/Point.ts
|
|
134
|
+
class Point {
|
|
135
|
+
x;
|
|
136
|
+
y;
|
|
137
|
+
constructor(x, y, round) {
|
|
138
|
+
const valid = Point.validate(x, y);
|
|
139
|
+
if (!valid) {
|
|
140
|
+
throw new Error(`Invalid Point object: (${x}, ${y})`);
|
|
141
|
+
}
|
|
142
|
+
let _x;
|
|
143
|
+
let _y;
|
|
144
|
+
if (x instanceof Point) {
|
|
145
|
+
return x;
|
|
146
|
+
} else if (Array.isArray(x)) {
|
|
147
|
+
_x = x[0];
|
|
148
|
+
_y = x[1];
|
|
149
|
+
} else if (typeof x === "object" && x !== null && "x" in x && "y" in x) {
|
|
150
|
+
_x = x.x;
|
|
151
|
+
_y = x.y;
|
|
152
|
+
} else {
|
|
153
|
+
_x = x;
|
|
154
|
+
_y = y;
|
|
155
|
+
}
|
|
156
|
+
this.x = round ? Math.round(_x) : _x;
|
|
157
|
+
this.y = round ? Math.round(_y) : _y;
|
|
158
|
+
}
|
|
159
|
+
static validate(x, y) {
|
|
160
|
+
if (x instanceof Point || Array.isArray(x))
|
|
161
|
+
return true;
|
|
162
|
+
if (x && typeof x === "object" && "x" in x && "y" in x)
|
|
163
|
+
return true;
|
|
164
|
+
if ((x || x === 0) && (y || y === 0))
|
|
165
|
+
return true;
|
|
166
|
+
return false;
|
|
167
|
+
}
|
|
168
|
+
clone() {
|
|
169
|
+
const p = new Point(0, 0);
|
|
170
|
+
p.x = this.x;
|
|
171
|
+
p.y = this.y;
|
|
172
|
+
return p;
|
|
173
|
+
}
|
|
174
|
+
add(point) {
|
|
175
|
+
return this.clone()._add(new Point(point));
|
|
176
|
+
}
|
|
177
|
+
_add(point) {
|
|
178
|
+
this.x += point.x;
|
|
179
|
+
this.y += point.y;
|
|
180
|
+
return this;
|
|
181
|
+
}
|
|
182
|
+
subtract(point) {
|
|
183
|
+
return this.clone()._subtract(new Point(point));
|
|
184
|
+
}
|
|
185
|
+
_subtract(point) {
|
|
186
|
+
this.x -= point.x;
|
|
187
|
+
this.y -= point.y;
|
|
188
|
+
return this;
|
|
189
|
+
}
|
|
190
|
+
divideBy(num) {
|
|
191
|
+
return this.clone()._divideBy(num);
|
|
192
|
+
}
|
|
193
|
+
_divideBy(num) {
|
|
194
|
+
this.x /= num;
|
|
195
|
+
this.y /= num;
|
|
196
|
+
return this;
|
|
197
|
+
}
|
|
198
|
+
multiplyBy(num) {
|
|
199
|
+
return this.clone()._multiplyBy(num);
|
|
200
|
+
}
|
|
201
|
+
_multiplyBy(num) {
|
|
202
|
+
this.x *= num;
|
|
203
|
+
this.y *= num;
|
|
204
|
+
return this;
|
|
205
|
+
}
|
|
206
|
+
scaleBy(point) {
|
|
207
|
+
return new Point(this.x * point.x, this.y * point.y);
|
|
208
|
+
}
|
|
209
|
+
unscaleBy(point) {
|
|
210
|
+
return new Point(this.x / point.x, this.y / point.y);
|
|
211
|
+
}
|
|
212
|
+
round() {
|
|
213
|
+
return this.clone()._round();
|
|
214
|
+
}
|
|
215
|
+
_round() {
|
|
216
|
+
this.x = Math.round(this.x);
|
|
217
|
+
this.y = Math.round(this.y);
|
|
218
|
+
return this;
|
|
219
|
+
}
|
|
220
|
+
floor() {
|
|
221
|
+
return this.clone()._floor();
|
|
222
|
+
}
|
|
223
|
+
_floor() {
|
|
224
|
+
this.x = Math.floor(this.x);
|
|
225
|
+
this.y = Math.floor(this.y);
|
|
226
|
+
return this;
|
|
227
|
+
}
|
|
228
|
+
ceil() {
|
|
229
|
+
return this.clone()._ceil();
|
|
230
|
+
}
|
|
231
|
+
_ceil() {
|
|
232
|
+
this.x = Math.ceil(this.x);
|
|
233
|
+
this.y = Math.ceil(this.y);
|
|
234
|
+
return this;
|
|
235
|
+
}
|
|
236
|
+
trunc() {
|
|
237
|
+
return this.clone()._trunc();
|
|
238
|
+
}
|
|
239
|
+
_trunc() {
|
|
240
|
+
this.x = Math.trunc(this.x);
|
|
241
|
+
this.y = Math.trunc(this.y);
|
|
242
|
+
return this;
|
|
243
|
+
}
|
|
244
|
+
distanceTo(point) {
|
|
245
|
+
const p = new Point(point);
|
|
246
|
+
const x = p.x - this.x;
|
|
247
|
+
const y = p.y - this.y;
|
|
248
|
+
return Math.sqrt(x * x + y * y);
|
|
249
|
+
}
|
|
250
|
+
equals(point) {
|
|
251
|
+
const p = new Point(point);
|
|
252
|
+
return p.x === this.x && p.y === this.y;
|
|
253
|
+
}
|
|
254
|
+
contains(point) {
|
|
255
|
+
const p = new Point(point);
|
|
256
|
+
return Math.abs(p.x) <= Math.abs(this.x) && Math.abs(p.y) <= Math.abs(this.y);
|
|
257
|
+
}
|
|
258
|
+
toString() {
|
|
259
|
+
return `Point(${formatNum(this.x)}, ${formatNum(this.y)})`;
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
function toPoint(x, y, round) {
|
|
263
|
+
if (x instanceof Point)
|
|
264
|
+
return x;
|
|
265
|
+
if (Array.isArray(x))
|
|
266
|
+
return new Point(x[0], x[1]);
|
|
267
|
+
if (x === undefined || x === null)
|
|
268
|
+
return x;
|
|
269
|
+
if (typeof x === "object" && "x" in x && "y" in x)
|
|
270
|
+
return new Point(x.x, x.y);
|
|
271
|
+
return new Point(x, y, round);
|
|
272
|
+
}
|
|
273
|
+
var init_Point = __esm(() => {
|
|
274
|
+
init_Util();
|
|
275
|
+
});
|
|
276
|
+
|
|
277
|
+
// src/core-map/geometry/Bounds.ts
|
|
278
|
+
class Bounds {
|
|
279
|
+
min;
|
|
280
|
+
max;
|
|
281
|
+
constructor(a, b) {
|
|
282
|
+
if (!a)
|
|
283
|
+
return;
|
|
284
|
+
if (a instanceof Bounds) {
|
|
285
|
+
return a;
|
|
286
|
+
}
|
|
287
|
+
const points = b ? [a, b] : a;
|
|
288
|
+
for (const point of points) {
|
|
289
|
+
this.extend(point);
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
extend(obj) {
|
|
293
|
+
let min2;
|
|
294
|
+
let max2;
|
|
295
|
+
if (!obj)
|
|
296
|
+
return this;
|
|
297
|
+
if (obj instanceof Point || Array.isArray(obj) && typeof obj[0] === "number" || obj && "x" in obj) {
|
|
298
|
+
min2 = max2 = toPoint(obj);
|
|
299
|
+
} else {
|
|
300
|
+
const b = new Bounds(obj);
|
|
301
|
+
min2 = b.min;
|
|
302
|
+
max2 = b.max;
|
|
303
|
+
if (!min2 || !max2)
|
|
304
|
+
return this;
|
|
305
|
+
}
|
|
306
|
+
if (!this.min && !this.max) {
|
|
307
|
+
this.min = min2.clone();
|
|
308
|
+
this.max = max2.clone();
|
|
309
|
+
} else {
|
|
310
|
+
this.min.x = Math.min(min2.x, this.min.x);
|
|
311
|
+
this.max.x = Math.max(max2.x, this.max.x);
|
|
312
|
+
this.min.y = Math.min(min2.y, this.min.y);
|
|
313
|
+
this.max.y = Math.max(max2.y, this.max.y);
|
|
314
|
+
}
|
|
315
|
+
return this;
|
|
316
|
+
}
|
|
317
|
+
getCenter(round) {
|
|
318
|
+
return new Point((this.min.x + this.max.x) / 2, (this.min.y + this.max.y) / 2, round);
|
|
319
|
+
}
|
|
320
|
+
getBottomLeft() {
|
|
321
|
+
return new Point(this.min.x, this.max.y);
|
|
322
|
+
}
|
|
323
|
+
getTopRight() {
|
|
324
|
+
return new Point(this.max.x, this.min.y);
|
|
325
|
+
}
|
|
326
|
+
getTopLeft() {
|
|
327
|
+
return this.min;
|
|
328
|
+
}
|
|
329
|
+
getBottomRight() {
|
|
330
|
+
return this.max;
|
|
331
|
+
}
|
|
332
|
+
getSize() {
|
|
333
|
+
return this.max.subtract(this.min);
|
|
334
|
+
}
|
|
335
|
+
contains(obj) {
|
|
336
|
+
let min, max;
|
|
337
|
+
let target = obj;
|
|
338
|
+
if (Array.isArray(target) && typeof target[0] === "number" || target instanceof Point) {
|
|
339
|
+
target = toPoint(target);
|
|
340
|
+
} else {
|
|
341
|
+
target = new Bounds(target);
|
|
342
|
+
}
|
|
343
|
+
if (target instanceof Bounds) {
|
|
344
|
+
min = target.min;
|
|
345
|
+
max = target.max;
|
|
346
|
+
} else {
|
|
347
|
+
min = max = target;
|
|
348
|
+
}
|
|
349
|
+
return min.x >= this.min.x && max.x <= this.max.x && min.y >= this.min.y && max.y <= this.max.y;
|
|
350
|
+
}
|
|
351
|
+
intersects(bounds) {
|
|
352
|
+
const b = new Bounds(bounds);
|
|
353
|
+
const min = this.min;
|
|
354
|
+
const max = this.max;
|
|
355
|
+
const min2 = b.min;
|
|
356
|
+
const max2 = b.max;
|
|
357
|
+
const xIntersects = max2.x >= min.x && min2.x <= max.x;
|
|
358
|
+
const yIntersects = max2.y >= min.y && min2.y <= max.y;
|
|
359
|
+
return xIntersects && yIntersects;
|
|
360
|
+
}
|
|
361
|
+
overlaps(bounds) {
|
|
362
|
+
const b = new Bounds(bounds);
|
|
363
|
+
const min = this.min;
|
|
364
|
+
const max = this.max;
|
|
365
|
+
const min2 = b.min;
|
|
366
|
+
const max2 = b.max;
|
|
367
|
+
const xOverlaps = max2.x > min.x && min2.x < max.x;
|
|
368
|
+
const yOverlaps = max2.y > min.y && min2.y < max.y;
|
|
369
|
+
return xOverlaps && yOverlaps;
|
|
370
|
+
}
|
|
371
|
+
isValid() {
|
|
372
|
+
return !!(this.min && this.max);
|
|
373
|
+
}
|
|
374
|
+
pad(bufferRatio) {
|
|
375
|
+
const min = this.min;
|
|
376
|
+
const max = this.max;
|
|
377
|
+
const heightBuffer = Math.abs(min.x - max.x) * bufferRatio;
|
|
378
|
+
const widthBuffer = Math.abs(min.y - max.y) * bufferRatio;
|
|
379
|
+
return new Bounds(new Point(min.x - heightBuffer, min.y - widthBuffer), new Point(max.x + heightBuffer, max.y + widthBuffer));
|
|
380
|
+
}
|
|
381
|
+
equals(bounds) {
|
|
382
|
+
if (!bounds)
|
|
383
|
+
return false;
|
|
384
|
+
const b = new Bounds(bounds);
|
|
385
|
+
return this.min.equals(b.getTopLeft()) && this.max.equals(b.getBottomRight());
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
function toBounds(a, b) {
|
|
389
|
+
if (!a || a instanceof Bounds)
|
|
390
|
+
return a;
|
|
391
|
+
return new Bounds(a, b);
|
|
392
|
+
}
|
|
393
|
+
var init_Bounds = __esm(() => {
|
|
394
|
+
init_Point();
|
|
395
|
+
});
|
|
396
|
+
|
|
397
|
+
// src/core-map/geometry/RTree.ts
|
|
398
|
+
function bboxArea(b) {
|
|
399
|
+
return (b[2] - b[0]) * (b[3] - b[1]);
|
|
400
|
+
}
|
|
401
|
+
function bboxMargin(b) {
|
|
402
|
+
return b[2] - b[0] + (b[3] - b[1]);
|
|
403
|
+
}
|
|
404
|
+
function enlargedArea(a, b) {
|
|
405
|
+
const w = Math.max(a[2], b[2]) - Math.min(a[0], b[0]);
|
|
406
|
+
const h = Math.max(a[3], b[3]) - Math.min(a[1], b[1]);
|
|
407
|
+
return w * h;
|
|
408
|
+
}
|
|
409
|
+
function intersectionArea(a, b) {
|
|
410
|
+
const minX = Math.max(a[0], b[0]);
|
|
411
|
+
const minY = Math.max(a[1], b[1]);
|
|
412
|
+
const maxX = Math.min(a[2], b[2]);
|
|
413
|
+
const maxY = Math.min(a[3], b[3]);
|
|
414
|
+
if (maxX < minX || maxY < minY)
|
|
415
|
+
return 0;
|
|
416
|
+
return (maxX - minX) * (maxY - minY);
|
|
417
|
+
}
|
|
418
|
+
function bboxContains(a, b) {
|
|
419
|
+
return a[0] <= b[0] && a[1] <= b[1] && a[2] >= b[2] && a[3] >= b[3];
|
|
420
|
+
}
|
|
421
|
+
function bboxIntersects(a, b) {
|
|
422
|
+
return b[0] <= a[2] && b[1] <= a[3] && b[2] >= a[0] && b[3] >= a[1];
|
|
423
|
+
}
|
|
424
|
+
function bboxContainsPoint(b, x, y) {
|
|
425
|
+
return b[0] <= x && x <= b[2] && b[1] <= y && y <= b[3];
|
|
426
|
+
}
|
|
427
|
+
function emptyBBox() {
|
|
428
|
+
return [Infinity, Infinity, -Infinity, -Infinity];
|
|
429
|
+
}
|
|
430
|
+
function extend(target, other) {
|
|
431
|
+
if (other[0] < target[0])
|
|
432
|
+
target[0] = other[0];
|
|
433
|
+
if (other[1] < target[1])
|
|
434
|
+
target[1] = other[1];
|
|
435
|
+
if (other[2] > target[2])
|
|
436
|
+
target[2] = other[2];
|
|
437
|
+
if (other[3] > target[3])
|
|
438
|
+
target[3] = other[3];
|
|
439
|
+
return target;
|
|
440
|
+
}
|
|
441
|
+
function computeBBox(node, k, p) {
|
|
442
|
+
const bbox = node.bbox;
|
|
443
|
+
bbox[0] = Infinity;
|
|
444
|
+
bbox[1] = Infinity;
|
|
445
|
+
bbox[2] = -Infinity;
|
|
446
|
+
bbox[3] = -Infinity;
|
|
447
|
+
const children = node.children;
|
|
448
|
+
for (let i = k;i < p; i++)
|
|
449
|
+
extend(bbox, children[i].bbox);
|
|
450
|
+
}
|
|
451
|
+
function createNode(children) {
|
|
452
|
+
return { bbox: emptyBBox(), children, leaf: false };
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
class RTree {
|
|
456
|
+
_maxEntries;
|
|
457
|
+
_minEntries;
|
|
458
|
+
_root;
|
|
459
|
+
_size;
|
|
460
|
+
constructor(opts) {
|
|
461
|
+
const max = Math.max(4, opts?.maxEntries ?? 9);
|
|
462
|
+
const min = Math.max(2, opts?.minEntries ?? Math.ceil(max * 0.4));
|
|
463
|
+
this._maxEntries = max;
|
|
464
|
+
this._minEntries = Math.min(min, Math.floor(max / 2));
|
|
465
|
+
this._root = { bbox: emptyBBox(), children: [], leaf: true };
|
|
466
|
+
this._size = 0;
|
|
467
|
+
}
|
|
468
|
+
size() {
|
|
469
|
+
return this._size;
|
|
470
|
+
}
|
|
471
|
+
clear() {
|
|
472
|
+
this._root = { bbox: emptyBBox(), children: [], leaf: true };
|
|
473
|
+
this._size = 0;
|
|
474
|
+
return this;
|
|
475
|
+
}
|
|
476
|
+
insert(bbox, data) {
|
|
477
|
+
const record = { bbox: [bbox[0], bbox[1], bbox[2], bbox[3]], data };
|
|
478
|
+
this._insertRecord(record);
|
|
479
|
+
this._size++;
|
|
480
|
+
return this;
|
|
481
|
+
}
|
|
482
|
+
remove(bbox, data, equalsFn) {
|
|
483
|
+
const eq = equalsFn ?? ((a, b) => a === b);
|
|
484
|
+
const path = [];
|
|
485
|
+
const removed = this._removeFrom(this._root, bbox, data, eq, path);
|
|
486
|
+
if (removed) {
|
|
487
|
+
this._size--;
|
|
488
|
+
this._condense(path);
|
|
489
|
+
}
|
|
490
|
+
return this;
|
|
491
|
+
}
|
|
492
|
+
_removeFrom(node, bbox, data, eq, path) {
|
|
493
|
+
const children = node.children;
|
|
494
|
+
if (!children)
|
|
495
|
+
return false;
|
|
496
|
+
path.push(node);
|
|
497
|
+
if (node.leaf) {
|
|
498
|
+
for (let i = 0;i < children.length; i++) {
|
|
499
|
+
const c = children[i];
|
|
500
|
+
if (c.data !== undefined && eq(c.data, data)) {
|
|
501
|
+
children.splice(i, 1);
|
|
502
|
+
return true;
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
path.pop();
|
|
506
|
+
return false;
|
|
507
|
+
}
|
|
508
|
+
for (let i = 0;i < children.length; i++) {
|
|
509
|
+
const c = children[i];
|
|
510
|
+
if (!bboxContains(c.bbox, bbox))
|
|
511
|
+
continue;
|
|
512
|
+
if (this._removeFrom(c, bbox, data, eq, path))
|
|
513
|
+
return true;
|
|
514
|
+
}
|
|
515
|
+
path.pop();
|
|
516
|
+
return false;
|
|
517
|
+
}
|
|
518
|
+
search(bbox) {
|
|
519
|
+
const out = [];
|
|
520
|
+
const root = this._root;
|
|
521
|
+
if (!bboxIntersects(root.bbox, bbox))
|
|
522
|
+
return out;
|
|
523
|
+
const stack = [root];
|
|
524
|
+
while (stack.length > 0) {
|
|
525
|
+
const node = stack.pop();
|
|
526
|
+
const children = node.children;
|
|
527
|
+
if (!children)
|
|
528
|
+
continue;
|
|
529
|
+
for (let i = 0;i < children.length; i++) {
|
|
530
|
+
const child = children[i];
|
|
531
|
+
if (!bboxIntersects(child.bbox, bbox))
|
|
532
|
+
continue;
|
|
533
|
+
if (node.leaf) {
|
|
534
|
+
out.push({ bbox: child.bbox, data: child.data });
|
|
535
|
+
} else if (bboxContains(bbox, child.bbox)) {
|
|
536
|
+
this._collectAll(child, out);
|
|
537
|
+
} else {
|
|
538
|
+
stack.push(child);
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
}
|
|
542
|
+
return out;
|
|
543
|
+
}
|
|
544
|
+
searchPoint(x, y) {
|
|
545
|
+
const out = [];
|
|
546
|
+
const root = this._root;
|
|
547
|
+
if (!bboxContainsPoint(root.bbox, x, y))
|
|
548
|
+
return out;
|
|
549
|
+
const stack = [root];
|
|
550
|
+
while (stack.length > 0) {
|
|
551
|
+
const node = stack.pop();
|
|
552
|
+
const children = node.children;
|
|
553
|
+
if (!children)
|
|
554
|
+
continue;
|
|
555
|
+
for (let i = 0;i < children.length; i++) {
|
|
556
|
+
const child = children[i];
|
|
557
|
+
if (!bboxContainsPoint(child.bbox, x, y))
|
|
558
|
+
continue;
|
|
559
|
+
if (node.leaf)
|
|
560
|
+
out.push({ bbox: child.bbox, data: child.data });
|
|
561
|
+
else
|
|
562
|
+
stack.push(child);
|
|
563
|
+
}
|
|
564
|
+
}
|
|
565
|
+
return out;
|
|
566
|
+
}
|
|
567
|
+
all() {
|
|
568
|
+
const out = [];
|
|
569
|
+
this._collectAll(this._root, out);
|
|
570
|
+
return out;
|
|
571
|
+
}
|
|
572
|
+
load(items) {
|
|
573
|
+
if (items.length === 0)
|
|
574
|
+
return this;
|
|
575
|
+
if (items.length < this._minEntries) {
|
|
576
|
+
for (const it of items)
|
|
577
|
+
this.insert(it.bbox, it.data);
|
|
578
|
+
return this;
|
|
579
|
+
}
|
|
580
|
+
const records = items.map((it) => {
|
|
581
|
+
return { bbox: [it.bbox[0], it.bbox[1], it.bbox[2], it.bbox[3]], data: it.data };
|
|
582
|
+
});
|
|
583
|
+
const built = this._buildSTR(records, 0, records.length - 1, this._chooseHeight(records.length));
|
|
584
|
+
if (this._size === 0) {
|
|
585
|
+
this._root = built;
|
|
586
|
+
this._size = items.length;
|
|
587
|
+
return this;
|
|
588
|
+
}
|
|
589
|
+
const existingHeight = this._height(this._root);
|
|
590
|
+
const builtHeight = this._height(built);
|
|
591
|
+
if (existingHeight === builtHeight) {
|
|
592
|
+
this._mergeRoots(built);
|
|
593
|
+
this._size += items.length;
|
|
594
|
+
} else if (existingHeight < builtHeight) {
|
|
595
|
+
const old = this._root;
|
|
596
|
+
this._root = built;
|
|
597
|
+
this._size = items.length;
|
|
598
|
+
const oldEntries = [];
|
|
599
|
+
this._collectAll(old, oldEntries);
|
|
600
|
+
for (const it of oldEntries)
|
|
601
|
+
this.insert(it.bbox, it.data);
|
|
602
|
+
} else {
|
|
603
|
+
const targetDepth = existingHeight - builtHeight;
|
|
604
|
+
this._insertSubtree(built, targetDepth);
|
|
605
|
+
this._size += items.length;
|
|
606
|
+
}
|
|
607
|
+
return this;
|
|
608
|
+
}
|
|
609
|
+
_collectAll(node, out) {
|
|
610
|
+
const stack = [node];
|
|
611
|
+
while (stack.length > 0) {
|
|
612
|
+
const current = stack.pop();
|
|
613
|
+
const children = current.children;
|
|
614
|
+
if (!children)
|
|
615
|
+
continue;
|
|
616
|
+
if (current.leaf) {
|
|
617
|
+
for (let i = 0;i < children.length; i++) {
|
|
618
|
+
const c = children[i];
|
|
619
|
+
out.push({ bbox: c.bbox, data: c.data });
|
|
620
|
+
}
|
|
621
|
+
} else {
|
|
622
|
+
for (let i = 0;i < children.length; i++)
|
|
623
|
+
stack.push(children[i]);
|
|
624
|
+
}
|
|
625
|
+
}
|
|
626
|
+
}
|
|
627
|
+
_height(node) {
|
|
628
|
+
let h = 0;
|
|
629
|
+
let cur = node;
|
|
630
|
+
while (!cur.leaf) {
|
|
631
|
+
h++;
|
|
632
|
+
const next = cur.children?.[0];
|
|
633
|
+
if (!next)
|
|
634
|
+
break;
|
|
635
|
+
cur = next;
|
|
636
|
+
}
|
|
637
|
+
return h;
|
|
638
|
+
}
|
|
639
|
+
_mergeRoots(other) {
|
|
640
|
+
const root = this._root;
|
|
641
|
+
if (root.leaf !== other.leaf) {
|
|
642
|
+
const entries = [];
|
|
643
|
+
this._collectAll(other, entries);
|
|
644
|
+
for (const it of entries)
|
|
645
|
+
this.insert(it.bbox, it.data);
|
|
646
|
+
return;
|
|
647
|
+
}
|
|
648
|
+
const otherChildren = other.children;
|
|
649
|
+
for (const child of otherChildren)
|
|
650
|
+
root.children.push(child);
|
|
651
|
+
computeBBox(root, 0, root.children.length);
|
|
652
|
+
if (root.children.length > this._maxEntries) {
|
|
653
|
+
const split = this._splitChildren(root);
|
|
654
|
+
const newRoot = createNode([root, split]);
|
|
655
|
+
this._root = newRoot;
|
|
656
|
+
computeBBox(newRoot, 0, 2);
|
|
657
|
+
}
|
|
658
|
+
}
|
|
659
|
+
_chooseHeight(count) {
|
|
660
|
+
if (count <= this._maxEntries)
|
|
661
|
+
return 0;
|
|
662
|
+
return Math.ceil(Math.log(count) / Math.log(this._maxEntries));
|
|
663
|
+
}
|
|
664
|
+
_buildSTR(items, left, right, height) {
|
|
665
|
+
return this._buildSTRInner(items, left, right, height, true);
|
|
666
|
+
}
|
|
667
|
+
_buildSTRInner(items, left, right, height, packingRecords) {
|
|
668
|
+
const count = right - left + 1;
|
|
669
|
+
const M = this._maxEntries;
|
|
670
|
+
if (count <= M) {
|
|
671
|
+
const slice = items.slice(left, right + 1);
|
|
672
|
+
const node = {
|
|
673
|
+
bbox: emptyBBox(),
|
|
674
|
+
children: slice,
|
|
675
|
+
leaf: packingRecords
|
|
676
|
+
};
|
|
677
|
+
computeBBox(node, 0, slice.length);
|
|
678
|
+
return node;
|
|
679
|
+
}
|
|
680
|
+
const exp = Math.max(height - 1, 0);
|
|
681
|
+
const nodeSize = Math.ceil(count / M ** exp);
|
|
682
|
+
const stripCount = Math.ceil(Math.sqrt(Math.ceil(count / nodeSize)));
|
|
683
|
+
const stripSize = nodeSize * stripCount;
|
|
684
|
+
multiSelectSort(items, left, right, stripSize, compareCentroidX);
|
|
685
|
+
const parents = [];
|
|
686
|
+
for (let i = left;i <= right; i += stripSize) {
|
|
687
|
+
const stripRight = Math.min(i + stripSize - 1, right);
|
|
688
|
+
multiSelectSort(items, i, stripRight, nodeSize, compareCentroidY);
|
|
689
|
+
for (let j = i;j <= stripRight; j += nodeSize) {
|
|
690
|
+
const groupRight = Math.min(j + nodeSize - 1, stripRight);
|
|
691
|
+
const children = items.slice(j, groupRight + 1);
|
|
692
|
+
const node = {
|
|
693
|
+
bbox: emptyBBox(),
|
|
694
|
+
children,
|
|
695
|
+
leaf: packingRecords
|
|
696
|
+
};
|
|
697
|
+
computeBBox(node, 0, children.length);
|
|
698
|
+
parents.push(node);
|
|
699
|
+
}
|
|
700
|
+
}
|
|
701
|
+
if (parents.length === 1)
|
|
702
|
+
return parents[0];
|
|
703
|
+
return this._buildSTRInner(parents, 0, parents.length - 1, height - 1, false);
|
|
704
|
+
}
|
|
705
|
+
_insertRecord(record) {
|
|
706
|
+
const path = [];
|
|
707
|
+
let node = this._root;
|
|
708
|
+
while (!node.leaf) {
|
|
709
|
+
path.push(node);
|
|
710
|
+
const children = node.children;
|
|
711
|
+
let target = children[0];
|
|
712
|
+
let minEnlargement = enlargedArea(target.bbox, record.bbox) - bboxArea(target.bbox);
|
|
713
|
+
let minArea = bboxArea(target.bbox);
|
|
714
|
+
for (let i = 1;i < children.length; i++) {
|
|
715
|
+
const c = children[i];
|
|
716
|
+
const area = bboxArea(c.bbox);
|
|
717
|
+
const enlargement = enlargedArea(c.bbox, record.bbox) - area;
|
|
718
|
+
if (enlargement < minEnlargement) {
|
|
719
|
+
minEnlargement = enlargement;
|
|
720
|
+
minArea = area;
|
|
721
|
+
target = c;
|
|
722
|
+
} else if (enlargement === minEnlargement && area < minArea) {
|
|
723
|
+
minArea = area;
|
|
724
|
+
target = c;
|
|
725
|
+
}
|
|
726
|
+
}
|
|
727
|
+
node = target;
|
|
728
|
+
}
|
|
729
|
+
path.push(node);
|
|
730
|
+
node.children.push(record);
|
|
731
|
+
extend(node.bbox, record.bbox);
|
|
732
|
+
let level = path.length - 1;
|
|
733
|
+
while (level >= 0) {
|
|
734
|
+
if (path[level].children.length > this._maxEntries) {
|
|
735
|
+
this._split(path, level);
|
|
736
|
+
} else {
|
|
737
|
+
extend(path[level].bbox, record.bbox);
|
|
738
|
+
}
|
|
739
|
+
level--;
|
|
740
|
+
}
|
|
741
|
+
}
|
|
742
|
+
_insertSubtree(sub, targetDepth) {
|
|
743
|
+
const path = [];
|
|
744
|
+
let node = this._root;
|
|
745
|
+
let depth = 0;
|
|
746
|
+
while (depth < targetDepth && !node.leaf) {
|
|
747
|
+
path.push(node);
|
|
748
|
+
const children = node.children;
|
|
749
|
+
let target = children[0];
|
|
750
|
+
let minEnlargement = enlargedArea(target.bbox, sub.bbox) - bboxArea(target.bbox);
|
|
751
|
+
let minArea = bboxArea(target.bbox);
|
|
752
|
+
for (let i = 1;i < children.length; i++) {
|
|
753
|
+
const c = children[i];
|
|
754
|
+
const area = bboxArea(c.bbox);
|
|
755
|
+
const enlargement = enlargedArea(c.bbox, sub.bbox) - area;
|
|
756
|
+
if (enlargement < minEnlargement) {
|
|
757
|
+
minEnlargement = enlargement;
|
|
758
|
+
minArea = area;
|
|
759
|
+
target = c;
|
|
760
|
+
}
|
|
761
|
+
}
|
|
762
|
+
node = target;
|
|
763
|
+
depth++;
|
|
764
|
+
}
|
|
765
|
+
path.push(node);
|
|
766
|
+
node.children.push(sub);
|
|
767
|
+
extend(node.bbox, sub.bbox);
|
|
768
|
+
let level = path.length - 1;
|
|
769
|
+
while (level >= 0) {
|
|
770
|
+
if (path[level].children.length > this._maxEntries) {
|
|
771
|
+
this._split(path, level);
|
|
772
|
+
} else {
|
|
773
|
+
extend(path[level].bbox, sub.bbox);
|
|
774
|
+
}
|
|
775
|
+
level--;
|
|
776
|
+
}
|
|
777
|
+
}
|
|
778
|
+
_split(insertPath, level) {
|
|
779
|
+
const node = insertPath[level];
|
|
780
|
+
const newNode = this._splitChildren(node);
|
|
781
|
+
if (level === 0) {
|
|
782
|
+
this._root = createNode([node, newNode]);
|
|
783
|
+
computeBBox(this._root, 0, 2);
|
|
784
|
+
} else {
|
|
785
|
+
insertPath[level - 1].children.push(newNode);
|
|
786
|
+
computeBBox(insertPath[level - 1], 0, insertPath[level - 1].children.length);
|
|
787
|
+
}
|
|
788
|
+
}
|
|
789
|
+
_splitChildren(node) {
|
|
790
|
+
const children = node.children;
|
|
791
|
+
const M = this._maxEntries;
|
|
792
|
+
const m = this._minEntries;
|
|
793
|
+
this._chooseSplitAxis(children, m, M);
|
|
794
|
+
const index = this._chooseSplitIndex(children, m, M);
|
|
795
|
+
const rightChildren = children.splice(index, children.length - index);
|
|
796
|
+
const newNode = {
|
|
797
|
+
bbox: emptyBBox(),
|
|
798
|
+
children: rightChildren,
|
|
799
|
+
leaf: node.leaf
|
|
800
|
+
};
|
|
801
|
+
computeBBox(node, 0, children.length);
|
|
802
|
+
computeBBox(newNode, 0, rightChildren.length);
|
|
803
|
+
return newNode;
|
|
804
|
+
}
|
|
805
|
+
_chooseSplitAxis(children, m, M) {
|
|
806
|
+
children.sort(compareMinX);
|
|
807
|
+
const xMargin = this._allDistMargin(children, m, M);
|
|
808
|
+
children.sort(compareMinY);
|
|
809
|
+
const yMargin = this._allDistMargin(children, m, M);
|
|
810
|
+
if (xMargin < yMargin)
|
|
811
|
+
children.sort(compareMinX);
|
|
812
|
+
}
|
|
813
|
+
_allDistMargin(children, m, M) {
|
|
814
|
+
const leftBBox = emptyBBox();
|
|
815
|
+
const rightBBox = emptyBBox();
|
|
816
|
+
for (let i = 0;i < m; i++)
|
|
817
|
+
extend(leftBBox, children[i].bbox);
|
|
818
|
+
for (let i = children.length - m;i < children.length; i++)
|
|
819
|
+
extend(rightBBox, children[i].bbox);
|
|
820
|
+
let margin = bboxMargin(leftBBox) + bboxMargin(rightBBox);
|
|
821
|
+
const total = children.length;
|
|
822
|
+
for (let i = m;i < total - m; i++) {
|
|
823
|
+
extend(leftBBox, children[i].bbox);
|
|
824
|
+
margin += bboxMargin(leftBBox);
|
|
825
|
+
}
|
|
826
|
+
for (let i = total - m - 1;i >= m; i--) {
|
|
827
|
+
extend(rightBBox, children[i].bbox);
|
|
828
|
+
margin += bboxMargin(rightBBox);
|
|
829
|
+
}
|
|
830
|
+
return margin;
|
|
831
|
+
}
|
|
832
|
+
_chooseSplitIndex(children, m, M) {
|
|
833
|
+
let index = m;
|
|
834
|
+
let minOverlap = Infinity;
|
|
835
|
+
let minArea = Infinity;
|
|
836
|
+
const total = children.length;
|
|
837
|
+
for (let i = m;i <= total - m; i++) {
|
|
838
|
+
const leftBBox = emptyBBox();
|
|
839
|
+
for (let k = 0;k < i; k++)
|
|
840
|
+
extend(leftBBox, children[k].bbox);
|
|
841
|
+
const rightBBox = emptyBBox();
|
|
842
|
+
for (let k = i;k < total; k++)
|
|
843
|
+
extend(rightBBox, children[k].bbox);
|
|
844
|
+
const overlap = intersectionArea(leftBBox, rightBBox);
|
|
845
|
+
const area = bboxArea(leftBBox) + bboxArea(rightBBox);
|
|
846
|
+
if (overlap < minOverlap) {
|
|
847
|
+
minOverlap = overlap;
|
|
848
|
+
minArea = area;
|
|
849
|
+
index = i;
|
|
850
|
+
} else if (overlap === minOverlap && area < minArea) {
|
|
851
|
+
minArea = area;
|
|
852
|
+
index = i;
|
|
853
|
+
}
|
|
854
|
+
}
|
|
855
|
+
return index;
|
|
856
|
+
}
|
|
857
|
+
_condense(path) {
|
|
858
|
+
const reinsertPool = [];
|
|
859
|
+
for (let i = path.length - 1;i >= 0; i--) {
|
|
860
|
+
const node = path[i];
|
|
861
|
+
if (node.children && node.children.length === 0) {
|
|
862
|
+
if (i > 0) {
|
|
863
|
+
const parent = path[i - 1];
|
|
864
|
+
const idx = parent.children.indexOf(node);
|
|
865
|
+
if (idx >= 0)
|
|
866
|
+
parent.children.splice(idx, 1);
|
|
867
|
+
} else {
|
|
868
|
+
this.clear();
|
|
869
|
+
return;
|
|
870
|
+
}
|
|
871
|
+
} else if (node.children && node.children.length < this._minEntries && i > 0) {
|
|
872
|
+
this._collectLeafNodes(node, reinsertPool);
|
|
873
|
+
const parent = path[i - 1];
|
|
874
|
+
const idx = parent.children.indexOf(node);
|
|
875
|
+
if (idx >= 0)
|
|
876
|
+
parent.children.splice(idx, 1);
|
|
877
|
+
} else {
|
|
878
|
+
computeBBox(node, 0, node.children?.length ?? 0);
|
|
879
|
+
}
|
|
880
|
+
}
|
|
881
|
+
if (reinsertPool.length > 0) {
|
|
882
|
+
for (const leaf of reinsertPool) {
|
|
883
|
+
const children = leaf.children;
|
|
884
|
+
if (!children)
|
|
885
|
+
continue;
|
|
886
|
+
for (const c of children) {
|
|
887
|
+
this.insert(c.bbox, c.data);
|
|
888
|
+
this._size--;
|
|
889
|
+
}
|
|
890
|
+
}
|
|
891
|
+
}
|
|
892
|
+
}
|
|
893
|
+
_collectLeafNodes(node, out) {
|
|
894
|
+
const stack = [node];
|
|
895
|
+
while (stack.length > 0) {
|
|
896
|
+
const cur = stack.pop();
|
|
897
|
+
if (cur.leaf) {
|
|
898
|
+
out.push(cur);
|
|
899
|
+
} else if (cur.children) {
|
|
900
|
+
for (const c of cur.children)
|
|
901
|
+
stack.push(c);
|
|
902
|
+
}
|
|
903
|
+
}
|
|
904
|
+
}
|
|
905
|
+
}
|
|
906
|
+
function compareMinX(a, b) {
|
|
907
|
+
return a.bbox[0] - b.bbox[0];
|
|
908
|
+
}
|
|
909
|
+
function compareMinY(a, b) {
|
|
910
|
+
return a.bbox[1] - b.bbox[1];
|
|
911
|
+
}
|
|
912
|
+
function compareCentroidX(a, b) {
|
|
913
|
+
return a.bbox[0] + a.bbox[2] - (b.bbox[0] + b.bbox[2]);
|
|
914
|
+
}
|
|
915
|
+
function compareCentroidY(a, b) {
|
|
916
|
+
return a.bbox[1] + a.bbox[3] - (b.bbox[1] + b.bbox[3]);
|
|
917
|
+
}
|
|
918
|
+
function multiSelectSort(arr, left, right, step, compare) {
|
|
919
|
+
const slice = arr.slice(left, right + 1);
|
|
920
|
+
slice.sort(compare);
|
|
921
|
+
for (let i = 0;i < slice.length; i++)
|
|
922
|
+
arr[left + i] = slice[i];
|
|
923
|
+
}
|
|
924
|
+
|
|
925
|
+
// src/core-map/geometry/Transformation.ts
|
|
926
|
+
class Transformation {
|
|
927
|
+
_a;
|
|
928
|
+
_b;
|
|
929
|
+
_c;
|
|
930
|
+
_d;
|
|
931
|
+
constructor(a, b, c, d) {
|
|
932
|
+
if (Array.isArray(a)) {
|
|
933
|
+
this._a = a[0];
|
|
934
|
+
this._b = a[1];
|
|
935
|
+
this._c = a[2];
|
|
936
|
+
this._d = a[3];
|
|
937
|
+
return;
|
|
938
|
+
}
|
|
939
|
+
this._a = a;
|
|
940
|
+
this._b = b;
|
|
941
|
+
this._c = c;
|
|
942
|
+
this._d = d;
|
|
943
|
+
}
|
|
944
|
+
transform(point, scale) {
|
|
945
|
+
return this._transform(point.clone(), scale);
|
|
946
|
+
}
|
|
947
|
+
_transform(point, scale) {
|
|
948
|
+
scale ||= 1;
|
|
949
|
+
point.x = scale * (this._a * point.x + this._b);
|
|
950
|
+
point.y = scale * (this._c * point.y + this._d);
|
|
951
|
+
return point;
|
|
952
|
+
}
|
|
953
|
+
untransform(point, scale) {
|
|
954
|
+
scale ||= 1;
|
|
955
|
+
return new Point((point.x / scale - this._b) / this._a, (point.y / scale - this._d) / this._c);
|
|
956
|
+
}
|
|
957
|
+
}
|
|
958
|
+
function toTransformation(a, b, c, d) {
|
|
959
|
+
return new Transformation(a, b, c, d);
|
|
960
|
+
}
|
|
961
|
+
var init_Transformation = __esm(() => {
|
|
962
|
+
init_Point();
|
|
963
|
+
});
|
|
964
|
+
|
|
965
|
+
// src/core-map/geo/LatLngBounds.ts
|
|
966
|
+
class LatLngBounds {
|
|
967
|
+
_southWest;
|
|
968
|
+
_northEast;
|
|
969
|
+
constructor(corner1, corner2) {
|
|
970
|
+
if (!corner1)
|
|
971
|
+
return;
|
|
972
|
+
if (corner1 instanceof LatLngBounds) {
|
|
973
|
+
return corner1;
|
|
974
|
+
}
|
|
975
|
+
const latlngs = corner2 ? [corner1, corner2] : corner1;
|
|
976
|
+
for (const latlng of latlngs)
|
|
977
|
+
this.extend(latlng);
|
|
978
|
+
}
|
|
979
|
+
extend(obj) {
|
|
980
|
+
const sw = this._southWest;
|
|
981
|
+
const ne = this._northEast;
|
|
982
|
+
let sw2, ne2;
|
|
983
|
+
if (obj instanceof LatLng) {
|
|
984
|
+
sw2 = obj;
|
|
985
|
+
ne2 = obj;
|
|
986
|
+
} else if (obj instanceof LatLngBounds) {
|
|
987
|
+
sw2 = obj._southWest;
|
|
988
|
+
ne2 = obj._northEast;
|
|
989
|
+
if (!sw2 || !ne2)
|
|
990
|
+
return this;
|
|
991
|
+
} else {
|
|
992
|
+
if (!obj)
|
|
993
|
+
return this;
|
|
994
|
+
if (LatLng.validate(obj))
|
|
995
|
+
return this.extend(new LatLng(obj));
|
|
996
|
+
return this.extend(new LatLngBounds(obj));
|
|
997
|
+
}
|
|
998
|
+
if (!sw && !ne) {
|
|
999
|
+
this._southWest = new LatLng(sw2.lat, sw2.lng);
|
|
1000
|
+
this._northEast = new LatLng(ne2.lat, ne2.lng);
|
|
1001
|
+
} else {
|
|
1002
|
+
sw.lat = Math.min(sw2.lat, sw.lat);
|
|
1003
|
+
sw.lng = Math.min(sw2.lng, sw.lng);
|
|
1004
|
+
ne.lat = Math.max(ne2.lat, ne.lat);
|
|
1005
|
+
ne.lng = Math.max(ne2.lng, ne.lng);
|
|
1006
|
+
}
|
|
1007
|
+
return this;
|
|
1008
|
+
}
|
|
1009
|
+
pad(bufferRatio) {
|
|
1010
|
+
const sw = this._southWest;
|
|
1011
|
+
const ne = this._northEast;
|
|
1012
|
+
const heightBuffer = Math.abs(sw.lat - ne.lat) * bufferRatio;
|
|
1013
|
+
const widthBuffer = Math.abs(sw.lng - ne.lng) * bufferRatio;
|
|
1014
|
+
return new LatLngBounds(new LatLng(sw.lat - heightBuffer, sw.lng - widthBuffer), new LatLng(ne.lat + heightBuffer, ne.lng + widthBuffer));
|
|
1015
|
+
}
|
|
1016
|
+
getCenter() {
|
|
1017
|
+
return new LatLng((this._southWest.lat + this._northEast.lat) / 2, (this._southWest.lng + this._northEast.lng) / 2);
|
|
1018
|
+
}
|
|
1019
|
+
getSouthWest() {
|
|
1020
|
+
return this._southWest;
|
|
1021
|
+
}
|
|
1022
|
+
getNorthEast() {
|
|
1023
|
+
return this._northEast;
|
|
1024
|
+
}
|
|
1025
|
+
getNorthWest() {
|
|
1026
|
+
return new LatLng(this.getNorth(), this.getWest());
|
|
1027
|
+
}
|
|
1028
|
+
getSouthEast() {
|
|
1029
|
+
return new LatLng(this.getSouth(), this.getEast());
|
|
1030
|
+
}
|
|
1031
|
+
getWest() {
|
|
1032
|
+
return this._southWest.lng;
|
|
1033
|
+
}
|
|
1034
|
+
getSouth() {
|
|
1035
|
+
return this._southWest.lat;
|
|
1036
|
+
}
|
|
1037
|
+
getEast() {
|
|
1038
|
+
return this._northEast.lng;
|
|
1039
|
+
}
|
|
1040
|
+
getNorth() {
|
|
1041
|
+
return this._northEast.lat;
|
|
1042
|
+
}
|
|
1043
|
+
contains(obj) {
|
|
1044
|
+
let target = obj;
|
|
1045
|
+
if (LatLng.validate(target))
|
|
1046
|
+
target = new LatLng(target);
|
|
1047
|
+
else
|
|
1048
|
+
target = new LatLngBounds(target);
|
|
1049
|
+
const sw = this._southWest;
|
|
1050
|
+
const ne = this._northEast;
|
|
1051
|
+
let sw2, ne2;
|
|
1052
|
+
if (target instanceof LatLngBounds) {
|
|
1053
|
+
sw2 = target.getSouthWest();
|
|
1054
|
+
ne2 = target.getNorthEast();
|
|
1055
|
+
} else {
|
|
1056
|
+
sw2 = ne2 = target;
|
|
1057
|
+
}
|
|
1058
|
+
return sw2.lat >= sw.lat && ne2.lat <= ne.lat && sw2.lng >= sw.lng && ne2.lng <= ne.lng;
|
|
1059
|
+
}
|
|
1060
|
+
intersects(bounds) {
|
|
1061
|
+
const b = new LatLngBounds(bounds);
|
|
1062
|
+
const sw = this._southWest;
|
|
1063
|
+
const ne = this._northEast;
|
|
1064
|
+
const sw2 = b.getSouthWest();
|
|
1065
|
+
const ne2 = b.getNorthEast();
|
|
1066
|
+
const latIntersects = ne2.lat >= sw.lat && sw2.lat <= ne.lat;
|
|
1067
|
+
const lngIntersects = ne2.lng >= sw.lng && sw2.lng <= ne.lng;
|
|
1068
|
+
return latIntersects && lngIntersects;
|
|
1069
|
+
}
|
|
1070
|
+
overlaps(bounds) {
|
|
1071
|
+
const b = new LatLngBounds(bounds);
|
|
1072
|
+
const sw = this._southWest;
|
|
1073
|
+
const ne = this._northEast;
|
|
1074
|
+
const sw2 = b.getSouthWest();
|
|
1075
|
+
const ne2 = b.getNorthEast();
|
|
1076
|
+
const latOverlaps = ne2.lat > sw.lat && sw2.lat < ne.lat;
|
|
1077
|
+
const lngOverlaps = ne2.lng > sw.lng && sw2.lng < ne.lng;
|
|
1078
|
+
return latOverlaps && lngOverlaps;
|
|
1079
|
+
}
|
|
1080
|
+
toBBoxString() {
|
|
1081
|
+
return [this.getWest(), this.getSouth(), this.getEast(), this.getNorth()].join(",");
|
|
1082
|
+
}
|
|
1083
|
+
equals(bounds, maxMargin) {
|
|
1084
|
+
if (!bounds)
|
|
1085
|
+
return false;
|
|
1086
|
+
const b = new LatLngBounds(bounds);
|
|
1087
|
+
return this._southWest.equals(b.getSouthWest(), maxMargin) && this._northEast.equals(b.getNorthEast(), maxMargin);
|
|
1088
|
+
}
|
|
1089
|
+
isValid() {
|
|
1090
|
+
return !!(this._southWest && this._northEast);
|
|
1091
|
+
}
|
|
1092
|
+
}
|
|
1093
|
+
function toLatLngBounds(a, b) {
|
|
1094
|
+
if (a instanceof LatLngBounds)
|
|
1095
|
+
return a;
|
|
1096
|
+
return new LatLngBounds(a, b);
|
|
1097
|
+
}
|
|
1098
|
+
var init_LatLngBounds = __esm(() => {
|
|
1099
|
+
init_LatLng();
|
|
1100
|
+
});
|
|
1101
|
+
|
|
1102
|
+
// src/core-map/geo/crs/CRS.ts
|
|
1103
|
+
class CRS {
|
|
1104
|
+
static projection = undefined;
|
|
1105
|
+
static transformation = undefined;
|
|
1106
|
+
static code;
|
|
1107
|
+
static wrapLng;
|
|
1108
|
+
static wrapLat;
|
|
1109
|
+
static infinite = false;
|
|
1110
|
+
static latLngToPoint(latlng, zoom) {
|
|
1111
|
+
const projectedPoint = this.projection.project(latlng);
|
|
1112
|
+
const scale = this.scale(zoom);
|
|
1113
|
+
return this.transformation._transform(projectedPoint, scale);
|
|
1114
|
+
}
|
|
1115
|
+
static pointToLatLng(point, zoom) {
|
|
1116
|
+
const scale = this.scale(zoom);
|
|
1117
|
+
const untransformedPoint = this.transformation.untransform(point, scale);
|
|
1118
|
+
return this.projection.unproject(untransformedPoint);
|
|
1119
|
+
}
|
|
1120
|
+
static project(latlng) {
|
|
1121
|
+
return this.projection.project(latlng);
|
|
1122
|
+
}
|
|
1123
|
+
static unproject(point) {
|
|
1124
|
+
return this.projection.unproject(point);
|
|
1125
|
+
}
|
|
1126
|
+
static scale(zoom) {
|
|
1127
|
+
return 256 * 2 ** zoom;
|
|
1128
|
+
}
|
|
1129
|
+
static zoom(scale) {
|
|
1130
|
+
return Math.log(scale / 256) / Math.LN2;
|
|
1131
|
+
}
|
|
1132
|
+
static getProjectedBounds(zoom) {
|
|
1133
|
+
if (this.infinite)
|
|
1134
|
+
return null;
|
|
1135
|
+
const b = this.projection.bounds;
|
|
1136
|
+
const s = this.scale(zoom);
|
|
1137
|
+
const min = this.transformation.transform(b.min, s);
|
|
1138
|
+
const max = this.transformation.transform(b.max, s);
|
|
1139
|
+
return new Bounds(min, max);
|
|
1140
|
+
}
|
|
1141
|
+
static distance(_a, _b) {
|
|
1142
|
+
return 0;
|
|
1143
|
+
}
|
|
1144
|
+
static wrapLatLng(latlng) {
|
|
1145
|
+
const ll = new LatLng(latlng);
|
|
1146
|
+
const lng = this.wrapLng ? wrapNum(ll.lng, this.wrapLng, true) : ll.lng;
|
|
1147
|
+
const lat = this.wrapLat ? wrapNum(ll.lat, this.wrapLat, true) : ll.lat;
|
|
1148
|
+
const alt = ll.alt;
|
|
1149
|
+
return new LatLng(lat, lng, alt);
|
|
1150
|
+
}
|
|
1151
|
+
static wrapLatLngBounds(bounds) {
|
|
1152
|
+
const b = new LatLngBounds(bounds);
|
|
1153
|
+
const center = b.getCenter();
|
|
1154
|
+
const newCenter = this.wrapLatLng(center);
|
|
1155
|
+
const latShift = center.lat - newCenter.lat;
|
|
1156
|
+
const lngShift = center.lng - newCenter.lng;
|
|
1157
|
+
if (latShift === 0 && lngShift === 0)
|
|
1158
|
+
return b;
|
|
1159
|
+
const sw = b.getSouthWest();
|
|
1160
|
+
const ne = b.getNorthEast();
|
|
1161
|
+
const newSw = new LatLng(sw.lat - latShift, sw.lng - lngShift);
|
|
1162
|
+
const newNe = new LatLng(ne.lat - latShift, ne.lng - lngShift);
|
|
1163
|
+
return new LatLngBounds(newSw, newNe);
|
|
1164
|
+
}
|
|
1165
|
+
}
|
|
1166
|
+
var init_CRS = __esm(() => {
|
|
1167
|
+
init_Util();
|
|
1168
|
+
init_Bounds();
|
|
1169
|
+
init_LatLng();
|
|
1170
|
+
init_LatLngBounds();
|
|
1171
|
+
});
|
|
1172
|
+
|
|
1173
|
+
// src/core-map/geo/crs/EarthCRS.ts
|
|
1174
|
+
var EarthCRS;
|
|
1175
|
+
var init_EarthCRS = __esm(() => {
|
|
1176
|
+
init_CRS();
|
|
1177
|
+
EarthCRS = class EarthCRS extends CRS {
|
|
1178
|
+
static wrapLng = [-180, 180];
|
|
1179
|
+
static R = 6371000;
|
|
1180
|
+
static distance(latlng1, latlng2) {
|
|
1181
|
+
const rad = Math.PI / 180;
|
|
1182
|
+
const lat1 = latlng1.lat * rad;
|
|
1183
|
+
const lat2 = latlng2.lat * rad;
|
|
1184
|
+
const sinDLat = Math.sin((latlng2.lat - latlng1.lat) * rad / 2);
|
|
1185
|
+
const sinDLon = Math.sin((latlng2.lng - latlng1.lng) * rad / 2);
|
|
1186
|
+
const a = sinDLat * sinDLat + Math.cos(lat1) * Math.cos(lat2) * sinDLon * sinDLon;
|
|
1187
|
+
const c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
|
|
1188
|
+
return this.R * c;
|
|
1189
|
+
}
|
|
1190
|
+
};
|
|
1191
|
+
});
|
|
1192
|
+
|
|
1193
|
+
// src/core-map/geo/LatLng.ts
|
|
1194
|
+
class LatLng {
|
|
1195
|
+
lat;
|
|
1196
|
+
lng;
|
|
1197
|
+
alt;
|
|
1198
|
+
constructor(lat, lng, alt) {
|
|
1199
|
+
const valid = LatLng.validate(lat, lng, alt);
|
|
1200
|
+
if (!valid)
|
|
1201
|
+
throw new Error(`Invalid LatLng object: (${lat}, ${lng})`);
|
|
1202
|
+
let _lat, _lng, _alt;
|
|
1203
|
+
if (lat instanceof LatLng) {
|
|
1204
|
+
return lat;
|
|
1205
|
+
} else if (Array.isArray(lat) && typeof lat[0] !== "object") {
|
|
1206
|
+
if (lat.length === 3) {
|
|
1207
|
+
_lat = lat[0];
|
|
1208
|
+
_lng = lat[1];
|
|
1209
|
+
_alt = lat[2];
|
|
1210
|
+
} else {
|
|
1211
|
+
_lat = lat[0];
|
|
1212
|
+
_lng = lat[1];
|
|
1213
|
+
}
|
|
1214
|
+
} else if (typeof lat === "object" && lat !== null && "lat" in lat) {
|
|
1215
|
+
const o = lat;
|
|
1216
|
+
_lat = o.lat;
|
|
1217
|
+
_lng = "lng" in o ? o.lng : o.lon;
|
|
1218
|
+
_alt = o.alt;
|
|
1219
|
+
} else {
|
|
1220
|
+
_lat = lat;
|
|
1221
|
+
_lng = lng;
|
|
1222
|
+
_alt = alt;
|
|
1223
|
+
}
|
|
1224
|
+
this.lat = +_lat;
|
|
1225
|
+
this.lng = +_lng;
|
|
1226
|
+
if (_alt !== undefined)
|
|
1227
|
+
this.alt = +_alt;
|
|
1228
|
+
}
|
|
1229
|
+
static validate(lat, lng, _alt) {
|
|
1230
|
+
if (lat instanceof LatLng || typeof lat === "object" && lat !== null && "lat" in lat)
|
|
1231
|
+
return true;
|
|
1232
|
+
if (lat && Array.isArray(lat) && typeof lat[0] !== "object") {
|
|
1233
|
+
if (lat.length === 3 || lat.length === 2)
|
|
1234
|
+
return true;
|
|
1235
|
+
return false;
|
|
1236
|
+
}
|
|
1237
|
+
if ((lat || lat === 0) && (lng || lng === 0))
|
|
1238
|
+
return true;
|
|
1239
|
+
return false;
|
|
1240
|
+
}
|
|
1241
|
+
equals(obj, maxMargin) {
|
|
1242
|
+
if (!obj)
|
|
1243
|
+
return false;
|
|
1244
|
+
const other = new LatLng(obj);
|
|
1245
|
+
const margin = Math.max(Math.abs(this.lat - other.lat), Math.abs(this.lng - other.lng));
|
|
1246
|
+
return margin <= (maxMargin ?? 0.000000001);
|
|
1247
|
+
}
|
|
1248
|
+
toString(precision) {
|
|
1249
|
+
return `LatLng(${formatNum(this.lat, precision)}, ${formatNum(this.lng, precision)})`;
|
|
1250
|
+
}
|
|
1251
|
+
distanceTo(other) {
|
|
1252
|
+
return EarthCRS.distance(this, new LatLng(other));
|
|
1253
|
+
}
|
|
1254
|
+
wrap() {
|
|
1255
|
+
return EarthCRS.wrapLatLng(this);
|
|
1256
|
+
}
|
|
1257
|
+
toBounds(sizeInMeters) {
|
|
1258
|
+
const latAccuracy = 180 * sizeInMeters / 40075017;
|
|
1259
|
+
const lngAccuracy = latAccuracy / Math.cos(Math.PI / 180 * this.lat);
|
|
1260
|
+
return new LatLngBounds([this.lat - latAccuracy, this.lng - lngAccuracy], [this.lat + latAccuracy, this.lng + lngAccuracy]);
|
|
1261
|
+
}
|
|
1262
|
+
clone() {
|
|
1263
|
+
const latlng = new LatLng(0, 0);
|
|
1264
|
+
latlng.lat = this.lat;
|
|
1265
|
+
latlng.lng = this.lng;
|
|
1266
|
+
latlng.alt = this.alt;
|
|
1267
|
+
return latlng;
|
|
1268
|
+
}
|
|
1269
|
+
}
|
|
1270
|
+
function toLatLng(a, b, c) {
|
|
1271
|
+
if (a instanceof LatLng)
|
|
1272
|
+
return a;
|
|
1273
|
+
if (a === null || a === undefined)
|
|
1274
|
+
return a;
|
|
1275
|
+
return new LatLng(a, b, c);
|
|
1276
|
+
}
|
|
1277
|
+
var init_LatLng = __esm(() => {
|
|
1278
|
+
init_Util();
|
|
1279
|
+
init_EarthCRS();
|
|
1280
|
+
init_LatLngBounds();
|
|
1281
|
+
});
|
|
1282
|
+
|
|
1283
|
+
// src/core-map/geometry/index.ts
|
|
1284
|
+
init_Bounds();
|
|
1285
|
+
init_Point();
|
|
1286
|
+
init_Transformation();
|
|
1287
|
+
|
|
1288
|
+
// src/core-map/geometry/LineUtil.ts
|
|
1289
|
+
init_LatLng();
|
|
1290
|
+
init_LatLngBounds();
|
|
1291
|
+
init_Point();
|
|
1292
|
+
var exports_LineUtil = {};
|
|
1293
|
+
__export(exports_LineUtil, {
|
|
1294
|
+
simplify: () => simplify,
|
|
1295
|
+
polylineCenter: () => polylineCenter,
|
|
1296
|
+
pointToSegmentDistance: () => pointToSegmentDistance,
|
|
1297
|
+
isFlat: () => isFlat,
|
|
1298
|
+
closestPointOnSegment: () => closestPointOnSegment,
|
|
1299
|
+
clipSegment: () => clipSegment,
|
|
1300
|
+
_sqClosestPointOnSegment: () => _sqClosestPointOnSegment,
|
|
1301
|
+
_getEdgeIntersection: () => _getEdgeIntersection,
|
|
1302
|
+
_getBitCode: () => _getBitCode
|
|
1303
|
+
});
|
|
1304
|
+
|
|
1305
|
+
// src/core-map/geometry/PolyUtil.ts
|
|
1306
|
+
var exports_PolyUtil = {};
|
|
1307
|
+
__export(exports_PolyUtil, {
|
|
1308
|
+
polygonCenter: () => polygonCenter,
|
|
1309
|
+
clipPolygon: () => clipPolygon,
|
|
1310
|
+
centroid: () => centroid
|
|
1311
|
+
});
|
|
1312
|
+
init_LatLng();
|
|
1313
|
+
init_LatLngBounds();
|
|
1314
|
+
init_Point();
|
|
1315
|
+
function clipPolygon(points, bounds, round) {
|
|
1316
|
+
let clippedPoints;
|
|
1317
|
+
const edges = [1, 4, 2, 8];
|
|
1318
|
+
for (let i = 0, len = points.length;i < len; i++) {
|
|
1319
|
+
points[i]._code = _getBitCode(points[i], bounds);
|
|
1320
|
+
}
|
|
1321
|
+
for (let k = 0;k < 4; k++) {
|
|
1322
|
+
const edge = edges[k];
|
|
1323
|
+
clippedPoints = [];
|
|
1324
|
+
for (let i = 0, len = points.length, j = len - 1;i < len; j = i++) {
|
|
1325
|
+
const a = points[i];
|
|
1326
|
+
const b = points[j];
|
|
1327
|
+
if (!(a._code & edge)) {
|
|
1328
|
+
if (b._code & edge) {
|
|
1329
|
+
const p = _getEdgeIntersection(b, a, edge, bounds, round);
|
|
1330
|
+
p._code = _getBitCode(p, bounds);
|
|
1331
|
+
clippedPoints.push(p);
|
|
1332
|
+
}
|
|
1333
|
+
clippedPoints.push(a);
|
|
1334
|
+
} else if (!(b._code & edge)) {
|
|
1335
|
+
const p = _getEdgeIntersection(b, a, edge, bounds, round);
|
|
1336
|
+
p._code = _getBitCode(p, bounds);
|
|
1337
|
+
clippedPoints.push(p);
|
|
1338
|
+
}
|
|
1339
|
+
}
|
|
1340
|
+
points = clippedPoints;
|
|
1341
|
+
}
|
|
1342
|
+
return points;
|
|
1343
|
+
}
|
|
1344
|
+
function polygonCenter(latlngs, crs) {
|
|
1345
|
+
if (!latlngs || latlngs.length === 0)
|
|
1346
|
+
throw new Error("latlngs not passed");
|
|
1347
|
+
if (!isFlat(latlngs)) {
|
|
1348
|
+
console.warn("latlngs are not flat! Only the first ring will be used");
|
|
1349
|
+
latlngs = latlngs[0];
|
|
1350
|
+
}
|
|
1351
|
+
let centroidLatLng = new LatLng(0, 0);
|
|
1352
|
+
const bounds = new LatLngBounds(latlngs);
|
|
1353
|
+
const areaBounds = bounds.getNorthWest().distanceTo(bounds.getSouthWest()) * bounds.getNorthEast().distanceTo(bounds.getNorthWest());
|
|
1354
|
+
if (areaBounds < 1700) {
|
|
1355
|
+
centroidLatLng = centroid(latlngs);
|
|
1356
|
+
}
|
|
1357
|
+
const len = latlngs.length;
|
|
1358
|
+
const points = [];
|
|
1359
|
+
for (let i = 0;i < len; i++) {
|
|
1360
|
+
const latlng = new LatLng(latlngs[i]);
|
|
1361
|
+
points.push(crs.project(new LatLng(latlng.lat - centroidLatLng.lat, latlng.lng - centroidLatLng.lng)));
|
|
1362
|
+
}
|
|
1363
|
+
let area = 0, x = 0, y = 0;
|
|
1364
|
+
let center;
|
|
1365
|
+
for (let i = 0, j = len - 1;i < len; j = i++) {
|
|
1366
|
+
const p1 = points[i];
|
|
1367
|
+
const p2 = points[j];
|
|
1368
|
+
const f = p1.y * p2.x - p2.y * p1.x;
|
|
1369
|
+
x += (p1.x + p2.x) * f;
|
|
1370
|
+
y += (p1.y + p2.y) * f;
|
|
1371
|
+
area += f * 3;
|
|
1372
|
+
}
|
|
1373
|
+
if (area === 0) {
|
|
1374
|
+
center = points[0];
|
|
1375
|
+
} else {
|
|
1376
|
+
center = [x / area, y / area];
|
|
1377
|
+
}
|
|
1378
|
+
const latlngCenter = crs.unproject(new Point(center));
|
|
1379
|
+
return new LatLng(latlngCenter.lat + centroidLatLng.lat, latlngCenter.lng + centroidLatLng.lng);
|
|
1380
|
+
}
|
|
1381
|
+
function centroid(coords) {
|
|
1382
|
+
let latSum = 0;
|
|
1383
|
+
let lngSum = 0;
|
|
1384
|
+
let len = 0;
|
|
1385
|
+
for (const coord of coords) {
|
|
1386
|
+
const latlng = new LatLng(coord);
|
|
1387
|
+
latSum += latlng.lat;
|
|
1388
|
+
lngSum += latlng.lng;
|
|
1389
|
+
len++;
|
|
1390
|
+
}
|
|
1391
|
+
return new LatLng(latSum / len, lngSum / len);
|
|
1392
|
+
}
|
|
1393
|
+
|
|
1394
|
+
// src/core-map/geometry/LineUtil.ts
|
|
1395
|
+
function simplify(points, tolerance) {
|
|
1396
|
+
if (!tolerance || !points.length)
|
|
1397
|
+
return points.slice();
|
|
1398
|
+
const sqTolerance = tolerance * tolerance;
|
|
1399
|
+
points = _reducePoints(points, sqTolerance);
|
|
1400
|
+
points = _simplifyDP(points, sqTolerance);
|
|
1401
|
+
return points;
|
|
1402
|
+
}
|
|
1403
|
+
function pointToSegmentDistance(p, p1, p2) {
|
|
1404
|
+
return Math.sqrt(_sqClosestPointOnSegment(p, p1, p2, true));
|
|
1405
|
+
}
|
|
1406
|
+
function closestPointOnSegment(p, p1, p2) {
|
|
1407
|
+
return _sqClosestPointOnSegment(p, p1, p2);
|
|
1408
|
+
}
|
|
1409
|
+
function _simplifyDP(points, sqTolerance) {
|
|
1410
|
+
const len = points.length;
|
|
1411
|
+
const markers = new Uint8Array(len);
|
|
1412
|
+
markers[0] = markers[len - 1] = 1;
|
|
1413
|
+
_simplifyDPStep(points, markers, sqTolerance, 0, len - 1);
|
|
1414
|
+
const newPoints = [];
|
|
1415
|
+
for (let i = 0;i < len; i++) {
|
|
1416
|
+
if (markers[i])
|
|
1417
|
+
newPoints.push(points[i]);
|
|
1418
|
+
}
|
|
1419
|
+
return newPoints;
|
|
1420
|
+
}
|
|
1421
|
+
function _simplifyDPStep(points, markers, sqTolerance, first, last) {
|
|
1422
|
+
let maxSqDist = 0;
|
|
1423
|
+
let index = 0;
|
|
1424
|
+
for (let i = first + 1;i <= last - 1; i++) {
|
|
1425
|
+
const sqDist = _sqClosestPointOnSegment(points[i], points[first], points[last], true);
|
|
1426
|
+
if (sqDist > maxSqDist) {
|
|
1427
|
+
index = i;
|
|
1428
|
+
maxSqDist = sqDist;
|
|
1429
|
+
}
|
|
1430
|
+
}
|
|
1431
|
+
if (maxSqDist > sqTolerance) {
|
|
1432
|
+
markers[index] = 1;
|
|
1433
|
+
_simplifyDPStep(points, markers, sqTolerance, first, index);
|
|
1434
|
+
_simplifyDPStep(points, markers, sqTolerance, index, last);
|
|
1435
|
+
}
|
|
1436
|
+
}
|
|
1437
|
+
function _reducePoints(points, sqTolerance) {
|
|
1438
|
+
const reducedPoints = [points[0]];
|
|
1439
|
+
let prev = 0;
|
|
1440
|
+
for (let i = 1;i < points.length; i++) {
|
|
1441
|
+
if (_sqDist(points[i], points[prev]) > sqTolerance) {
|
|
1442
|
+
reducedPoints.push(points[i]);
|
|
1443
|
+
prev = i;
|
|
1444
|
+
}
|
|
1445
|
+
}
|
|
1446
|
+
if (prev < points.length - 1)
|
|
1447
|
+
reducedPoints.push(points[points.length - 1]);
|
|
1448
|
+
return reducedPoints;
|
|
1449
|
+
}
|
|
1450
|
+
var _lastCode;
|
|
1451
|
+
function clipSegment(a, b, bounds, useLastCode, round) {
|
|
1452
|
+
let codeA = useLastCode ? _lastCode : _getBitCode(a, bounds);
|
|
1453
|
+
let codeB = _getBitCode(b, bounds);
|
|
1454
|
+
_lastCode = codeB;
|
|
1455
|
+
while (true) {
|
|
1456
|
+
if (!(codeA | codeB))
|
|
1457
|
+
return [a, b];
|
|
1458
|
+
if (codeA & codeB)
|
|
1459
|
+
return false;
|
|
1460
|
+
const codeOut = codeA || codeB;
|
|
1461
|
+
const p = _getEdgeIntersection(a, b, codeOut, bounds, round);
|
|
1462
|
+
const newCode = _getBitCode(p, bounds);
|
|
1463
|
+
if (codeOut === codeA) {
|
|
1464
|
+
a = p;
|
|
1465
|
+
codeA = newCode;
|
|
1466
|
+
} else {
|
|
1467
|
+
b = p;
|
|
1468
|
+
codeB = newCode;
|
|
1469
|
+
}
|
|
1470
|
+
}
|
|
1471
|
+
}
|
|
1472
|
+
function _getEdgeIntersection(a, b, code, bounds, round) {
|
|
1473
|
+
const dx = b.x - a.x;
|
|
1474
|
+
const dy = b.y - a.y;
|
|
1475
|
+
const min = bounds.min;
|
|
1476
|
+
const max = bounds.max;
|
|
1477
|
+
let x = 0, y = 0;
|
|
1478
|
+
if (code & 8) {
|
|
1479
|
+
x = a.x + dx * (max.y - a.y) / dy;
|
|
1480
|
+
y = max.y;
|
|
1481
|
+
} else if (code & 4) {
|
|
1482
|
+
x = a.x + dx * (min.y - a.y) / dy;
|
|
1483
|
+
y = min.y;
|
|
1484
|
+
} else if (code & 2) {
|
|
1485
|
+
x = max.x;
|
|
1486
|
+
y = a.y + dy * (max.x - a.x) / dx;
|
|
1487
|
+
} else if (code & 1) {
|
|
1488
|
+
x = min.x;
|
|
1489
|
+
y = a.y + dy * (min.x - a.x) / dx;
|
|
1490
|
+
}
|
|
1491
|
+
return new Point(x, y, round);
|
|
1492
|
+
}
|
|
1493
|
+
function _getBitCode(p, bounds) {
|
|
1494
|
+
let code = 0;
|
|
1495
|
+
if (p.x < bounds.min.x)
|
|
1496
|
+
code |= 1;
|
|
1497
|
+
else if (p.x > bounds.max.x)
|
|
1498
|
+
code |= 2;
|
|
1499
|
+
if (p.y < bounds.min.y)
|
|
1500
|
+
code |= 4;
|
|
1501
|
+
else if (p.y > bounds.max.y)
|
|
1502
|
+
code |= 8;
|
|
1503
|
+
return code;
|
|
1504
|
+
}
|
|
1505
|
+
function _sqDist(p1, p2) {
|
|
1506
|
+
const dx = p2.x - p1.x;
|
|
1507
|
+
const dy = p2.y - p1.y;
|
|
1508
|
+
return dx * dx + dy * dy;
|
|
1509
|
+
}
|
|
1510
|
+
function _sqClosestPointOnSegment(p, p1, p2, sqDist) {
|
|
1511
|
+
let { x, y } = p1;
|
|
1512
|
+
let dx = p2.x - x, dy = p2.y - y;
|
|
1513
|
+
const dot = dx * dx + dy * dy;
|
|
1514
|
+
let t;
|
|
1515
|
+
if (dot > 0) {
|
|
1516
|
+
t = ((p.x - x) * dx + (p.y - y) * dy) / dot;
|
|
1517
|
+
if (t > 1) {
|
|
1518
|
+
x = p2.x;
|
|
1519
|
+
y = p2.y;
|
|
1520
|
+
} else if (t > 0) {
|
|
1521
|
+
x += dx * t;
|
|
1522
|
+
y += dy * t;
|
|
1523
|
+
}
|
|
1524
|
+
}
|
|
1525
|
+
dx = p.x - x;
|
|
1526
|
+
dy = p.y - y;
|
|
1527
|
+
return sqDist ? dx * dx + dy * dy : new Point(x, y);
|
|
1528
|
+
}
|
|
1529
|
+
function isFlat(latlngs) {
|
|
1530
|
+
return !Array.isArray(latlngs[0]) || typeof latlngs[0][0] !== "object" && typeof latlngs[0][0] !== "undefined";
|
|
1531
|
+
}
|
|
1532
|
+
function polylineCenter(latlngs, crs) {
|
|
1533
|
+
if (!latlngs || latlngs.length === 0)
|
|
1534
|
+
throw new Error("latlngs not passed");
|
|
1535
|
+
if (!isFlat(latlngs)) {
|
|
1536
|
+
console.warn("latlngs are not flat! Only the first ring will be used");
|
|
1537
|
+
latlngs = latlngs[0];
|
|
1538
|
+
}
|
|
1539
|
+
let centroidLatLng = new LatLng(0, 0);
|
|
1540
|
+
const bounds = new LatLngBounds(latlngs);
|
|
1541
|
+
const areaBounds = bounds.getNorthWest().distanceTo(bounds.getSouthWest()) * bounds.getNorthEast().distanceTo(bounds.getNorthWest());
|
|
1542
|
+
if (areaBounds < 1700) {
|
|
1543
|
+
centroidLatLng = centroid(latlngs);
|
|
1544
|
+
}
|
|
1545
|
+
const len = latlngs.length;
|
|
1546
|
+
const points = [];
|
|
1547
|
+
for (let i = 0;i < len; i++) {
|
|
1548
|
+
const latlng = new LatLng(latlngs[i]);
|
|
1549
|
+
points.push(crs.project(new LatLng(latlng.lat - centroidLatLng.lat, latlng.lng - centroidLatLng.lng)));
|
|
1550
|
+
}
|
|
1551
|
+
let halfDist = 0;
|
|
1552
|
+
for (let i = 0;i < len - 1; i++) {
|
|
1553
|
+
halfDist += points[i].distanceTo(points[i + 1]) / 2;
|
|
1554
|
+
}
|
|
1555
|
+
let center;
|
|
1556
|
+
if (halfDist === 0) {
|
|
1557
|
+
center = points[0];
|
|
1558
|
+
} else {
|
|
1559
|
+
let dist = 0;
|
|
1560
|
+
center = points[0];
|
|
1561
|
+
for (let i = 0;i < len - 1; i++) {
|
|
1562
|
+
const p1 = points[i];
|
|
1563
|
+
const p2 = points[i + 1];
|
|
1564
|
+
const segDist = p1.distanceTo(p2);
|
|
1565
|
+
dist += segDist;
|
|
1566
|
+
if (dist > halfDist) {
|
|
1567
|
+
const ratio = (dist - halfDist) / segDist;
|
|
1568
|
+
center = [p2.x - ratio * (p2.x - p1.x), p2.y - ratio * (p2.y - p1.y)];
|
|
1569
|
+
break;
|
|
1570
|
+
}
|
|
1571
|
+
}
|
|
1572
|
+
}
|
|
1573
|
+
const latlngCenter = crs.unproject(new Point(center));
|
|
1574
|
+
return new LatLng(latlngCenter.lat + centroidLatLng.lat, latlngCenter.lng + centroidLatLng.lng);
|
|
1575
|
+
}
|
|
1576
|
+
export {
|
|
1577
|
+
toTransformation,
|
|
1578
|
+
toPoint,
|
|
1579
|
+
toBounds,
|
|
1580
|
+
Transformation,
|
|
1581
|
+
RTree,
|
|
1582
|
+
exports_PolyUtil as PolyUtil,
|
|
1583
|
+
Point,
|
|
1584
|
+
exports_LineUtil as LineUtil,
|
|
1585
|
+
Bounds
|
|
1586
|
+
};
|