ts-maps 0.2.6 → 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.
Files changed (225) hide show
  1. package/LICENSE.md +21 -0
  2. package/README.md +202 -141
  3. package/dist/core-map/assets/embedded-icons.d.ts +8 -0
  4. package/dist/core-map/control/AttributionControl.d.ts +12 -0
  5. package/dist/core-map/control/Control.d.ts +14 -0
  6. package/dist/core-map/control/LayersControl.d.ts +38 -0
  7. package/dist/core-map/control/ScaleControl.d.ts +14 -0
  8. package/dist/core-map/control/ZoomControl.d.ts +14 -0
  9. package/dist/core-map/control/index.d.ts +5 -0
  10. package/dist/core-map/core/Browser.d.ts +24 -0
  11. package/dist/core-map/core/Class.d.ts +12 -0
  12. package/dist/core-map/core/Events.d.ts +31 -0
  13. package/dist/core-map/core/Handler.d.ts +12 -0
  14. package/dist/core-map/core/Util.d.ts +24 -0
  15. package/dist/core-map/core/index.d.ts +7 -0
  16. package/dist/core-map/dom/Animation.d.ts +50 -0
  17. package/dist/core-map/dom/DomEvent.DoubleTap.d.ts +6 -0
  18. package/dist/core-map/dom/DomEvent.PointerEvents.d.ts +4 -0
  19. package/dist/core-map/dom/DomEvent.d.ts +15 -0
  20. package/dist/core-map/dom/DomUtil.d.ts +22 -0
  21. package/dist/core-map/dom/Draggable.d.ts +26 -0
  22. package/dist/core-map/dom/PosAnimation.d.ts +19 -0
  23. package/dist/core-map/dom/easing.d.ts +41 -0
  24. package/dist/core-map/dom/index.d.ts +8 -0
  25. package/dist/core-map/geo/LatLng.d.ts +18 -0
  26. package/dist/core-map/geo/LatLngBounds.d.ts +27 -0
  27. package/dist/core-map/geo/TerrainSource.d.ts +35 -0
  28. package/dist/core-map/geo/crs/CRS.d.ts +23 -0
  29. package/dist/core-map/geo/crs/EPSG3395.d.ts +7 -0
  30. package/dist/core-map/geo/crs/EPSG3857.d.ts +10 -0
  31. package/dist/core-map/geo/crs/EPSG4326.d.ts +7 -0
  32. package/dist/core-map/geo/crs/EarthCRS.d.ts +7 -0
  33. package/dist/core-map/geo/crs/SimpleCRS.d.ts +11 -0
  34. package/dist/core-map/geo/crs/index.d.ts +6 -0
  35. package/dist/core-map/geo/elevation.d.ts +23 -0
  36. package/dist/core-map/geo/index.d.ts +13 -0
  37. package/dist/core-map/geo/index.js +1204 -0
  38. package/dist/core-map/geo/projection/Projection.Globe.d.ts +30 -0
  39. package/dist/core-map/geo/projection/Projection.LonLat.d.ts +11 -0
  40. package/dist/core-map/geo/projection/Projection.Mercator.d.ts +6 -0
  41. package/dist/core-map/geo/projection/Projection.SphericalMercator.d.ts +6 -0
  42. package/dist/core-map/geo/projection/index.d.ts +5 -0
  43. package/dist/core-map/geo/terrainMesh.d.ts +21 -0
  44. package/dist/core-map/geometry/Bounds.d.ts +23 -0
  45. package/dist/core-map/geometry/LineUtil.d.ts +13 -0
  46. package/dist/core-map/geometry/Point.d.ts +35 -0
  47. package/dist/core-map/geometry/PolyUtil.d.ts +6 -0
  48. package/dist/core-map/geometry/RTree.d.ts +35 -0
  49. package/dist/core-map/geometry/Transformation.d.ts +12 -0
  50. package/dist/core-map/geometry/earcut.d.ts +17 -0
  51. package/dist/core-map/geometry/index.d.ts +10 -0
  52. package/dist/core-map/geometry/index.js +1586 -0
  53. package/dist/core-map/index.d.ts +59 -0
  54. package/dist/core-map/layer/BlanketOverlay.d.ts +24 -0
  55. package/dist/core-map/layer/DivOverlay.d.ts +40 -0
  56. package/dist/core-map/layer/FeatureGroup.d.ts +11 -0
  57. package/dist/core-map/layer/GeoJSON.d.ts +17 -0
  58. package/dist/core-map/layer/GeoJSONClusterSource.d.ts +54 -0
  59. package/dist/core-map/layer/HeatmapLayer.d.ts +40 -0
  60. package/dist/core-map/layer/ImageOverlay.d.ts +27 -0
  61. package/dist/core-map/layer/Layer.d.ts +18 -0
  62. package/dist/core-map/layer/LayerGroup.d.ts +16 -0
  63. package/dist/core-map/layer/Popup.d.ts +18 -0
  64. package/dist/core-map/layer/SVGOverlay.d.ts +4 -0
  65. package/dist/core-map/layer/Tooltip.d.ts +15 -0
  66. package/dist/core-map/layer/VideoOverlay.d.ts +4 -0
  67. package/dist/core-map/layer/index.d.ts +18 -0
  68. package/dist/core-map/layer/marker/DefaultIcon.d.ts +7 -0
  69. package/dist/core-map/layer/marker/DivIcon.d.ts +5 -0
  70. package/dist/core-map/layer/marker/Icon.d.ts +10 -0
  71. package/dist/core-map/layer/marker/Marker.Drag.d.ts +17 -0
  72. package/dist/core-map/layer/marker/Marker.d.ts +37 -0
  73. package/dist/core-map/layer/marker/index.d.ts +5 -0
  74. package/dist/core-map/layer/tile/GridLayer.d.ts +88 -0
  75. package/dist/core-map/layer/tile/RasterDEMLayer.d.ts +46 -0
  76. package/dist/core-map/layer/tile/TileLayer.d.ts +22 -0
  77. package/dist/core-map/layer/tile/VectorTileMapLayer.d.ts +145 -0
  78. package/dist/core-map/layer/tile/WMSTileLayer.d.ts +12 -0
  79. package/dist/core-map/layer/tile/index.d.ts +15 -0
  80. package/dist/core-map/layer/tile/urlTemplate.d.ts +17 -0
  81. package/dist/core-map/layer/vector/Canvas.d.ts +52 -0
  82. package/dist/core-map/layer/vector/Circle.d.ts +7 -0
  83. package/dist/core-map/layer/vector/CircleMarker.d.ts +22 -0
  84. package/dist/core-map/layer/vector/Path.d.ts +20 -0
  85. package/dist/core-map/layer/vector/Polygon.d.ts +13 -0
  86. package/dist/core-map/layer/vector/Polyline.d.ts +30 -0
  87. package/dist/core-map/layer/vector/Rectangle.d.ts +6 -0
  88. package/dist/core-map/layer/vector/Renderer.d.ts +12 -0
  89. package/dist/core-map/layer/vector/Renderer.getRenderer.d.ts +1 -0
  90. package/dist/core-map/layer/vector/SVG.d.ts +21 -0
  91. package/dist/core-map/layer/vector/index.d.ts +10 -0
  92. package/dist/core-map/map/Map.d.ts +353 -0
  93. package/dist/core-map/map/Style.d.ts +29 -0
  94. package/dist/core-map/map/handler/BoxZoomHandler.d.ts +23 -0
  95. package/dist/core-map/map/handler/DoubleClickZoomHandler.d.ts +6 -0
  96. package/dist/core-map/map/handler/DragHandler.d.ts +27 -0
  97. package/dist/core-map/map/handler/KeyboardHandler.d.ts +18 -0
  98. package/dist/core-map/map/handler/PinchZoomHandler.d.ts +20 -0
  99. package/dist/core-map/map/handler/ScrollWheelZoomHandler.d.ts +12 -0
  100. package/dist/core-map/map/handler/TapHoldHandler.d.ts +15 -0
  101. package/dist/core-map/map/handler/TwoFingerPitchHandler.d.ts +21 -0
  102. package/dist/core-map/map/handler/TwoFingerRotateHandler.d.ts +17 -0
  103. package/dist/core-map/map/index.d.ts +11 -0
  104. package/dist/core-map/mvt/VectorTile.d.ts +9 -0
  105. package/dist/core-map/mvt/VectorTileFeature.d.ts +59 -0
  106. package/dist/core-map/mvt/VectorTileLayer.d.ts +13 -0
  107. package/dist/core-map/proto/Pbf.d.ts +84 -0
  108. package/dist/core-map/renderer/webgl/GLContext.d.ts +22 -0
  109. package/dist/core-map/renderer/webgl/WebGLTileRenderer.d.ts +86 -0
  110. package/dist/core-map/renderer/webgl/index.d.ts +9 -0
  111. package/dist/core-map/renderer/webgl/mat4.d.ts +14 -0
  112. package/dist/core-map/services/index.d.ts +26 -0
  113. package/dist/core-map/services/index.js +1230 -0
  114. package/dist/core-map/services/providers/Google.d.ts +16 -0
  115. package/dist/core-map/services/providers/Mapbox.d.ts +26 -0
  116. package/dist/core-map/services/providers/Maptiler.d.ts +11 -0
  117. package/dist/core-map/services/providers/Nominatim.d.ts +11 -0
  118. package/dist/core-map/services/providers/OSRM.d.ts +20 -0
  119. package/dist/core-map/services/providers/Photon.d.ts +10 -0
  120. package/dist/core-map/services/providers/Valhalla.d.ts +20 -0
  121. package/dist/core-map/services/types.d.ts +84 -0
  122. package/dist/core-map/storage/TileCache.d.ts +40 -0
  123. package/dist/core-map/storage/cachedFetch.d.ts +13 -0
  124. package/dist/core-map/storage/defaultCache.d.ts +3 -0
  125. package/dist/core-map/storage/index.d.ts +13 -0
  126. package/dist/core-map/storage/index.js +283 -0
  127. package/dist/core-map/storage/offlineRegion.d.ts +26 -0
  128. package/dist/core-map/style-spec/diff.d.ts +17 -0
  129. package/dist/core-map/style-spec/expressions/Color.d.ts +16 -0
  130. package/dist/core-map/style-spec/expressions/compile.d.ts +4 -0
  131. package/dist/core-map/style-spec/expressions/errors.d.ts +8 -0
  132. package/dist/core-map/style-spec/expressions/index.d.ts +16 -0
  133. package/dist/core-map/style-spec/expressions/legacyFilter.d.ts +6 -0
  134. package/dist/core-map/style-spec/expressions/operators/conversion.d.ts +1 -0
  135. package/dist/core-map/style-spec/expressions/operators/interpolate.d.ts +14 -0
  136. package/dist/core-map/style-spec/expressions/operators/logical.d.ts +1 -0
  137. package/dist/core-map/style-spec/expressions/operators/lookup.d.ts +1 -0
  138. package/dist/core-map/style-spec/expressions/operators/math.d.ts +1 -0
  139. package/dist/core-map/style-spec/expressions/operators/string.d.ts +1 -0
  140. package/dist/core-map/style-spec/expressions/registry.d.ts +29 -0
  141. package/dist/core-map/style-spec/expressions/types.d.ts +48 -0
  142. package/dist/core-map/style-spec/expressions/validate.d.ts +13 -0
  143. package/dist/core-map/style-spec/index.d.ts +68 -0
  144. package/dist/core-map/style-spec/index.js +2529 -0
  145. package/dist/core-map/style-spec/schema.d.ts +381 -0
  146. package/dist/core-map/style-spec/types.d.ts +375 -0
  147. package/dist/core-map/style-spec/validate.d.ts +14 -0
  148. package/dist/core-map/symbols/CollisionIndex.d.ts +21 -0
  149. package/dist/core-map/symbols/GlyphAtlas.d.ts +38 -0
  150. package/dist/core-map/symbols/IconAtlas.d.ts +18 -0
  151. package/dist/core-map/symbols/index.d.ts +6 -0
  152. package/dist/core-map/symbols/index.js +501 -0
  153. package/dist/index.d.ts +2 -4
  154. package/dist/index.js +18414 -1857
  155. package/package.json +50 -58
  156. package/src/core-map/ts-maps.css +725 -0
  157. package/dist/components/base.d.ts +0 -17
  158. package/dist/components/concerns/interactable.d.ts +0 -1
  159. package/dist/components/line.d.ts +0 -29
  160. package/dist/components/marker.d.ts +0 -50
  161. package/dist/components/region.d.ts +0 -46
  162. package/dist/components/tooltip.d.ts +0 -22
  163. package/dist/core/apply-transform.d.ts +0 -7
  164. package/dist/core/coords-to-point.d.ts +0 -12
  165. package/dist/core/create-lines.d.ts +0 -2
  166. package/dist/core/create-markers.d.ts +0 -2
  167. package/dist/core/create-regions.d.ts +0 -2
  168. package/dist/core/create-series.d.ts +0 -3
  169. package/dist/core/get-inset-for-point.d.ts +0 -13
  170. package/dist/core/get-marker-position.d.ts +0 -6
  171. package/dist/core/index.d.ts +0 -1
  172. package/dist/core/reposition-labels.d.ts +0 -2
  173. package/dist/core/reposition-lines.d.ts +0 -2
  174. package/dist/core/reposition-markers.d.ts +0 -2
  175. package/dist/core/resize.d.ts +0 -3
  176. package/dist/core/set-focus.d.ts +0 -2
  177. package/dist/core/set-scale.d.ts +0 -2
  178. package/dist/core/setup-container-events.d.ts +0 -2
  179. package/dist/core/setup-container-touch-events.d.ts +0 -2
  180. package/dist/core/setup-element-events.d.ts +0 -2
  181. package/dist/core/setup-zoom-buttons.d.ts +0 -2
  182. package/dist/core/update-size.d.ts +0 -2
  183. package/dist/data-visualization.d.ts +0 -17
  184. package/dist/defaults/events.d.ts +0 -1
  185. package/dist/defaults/options.d.ts +0 -1
  186. package/dist/event-handler.d.ts +0 -1
  187. package/dist/legend.d.ts +0 -17
  188. package/dist/map.d.ts +0 -81
  189. package/dist/maps/brasil.d.ts +0 -2
  190. package/dist/maps/brasil.js +0 -7
  191. package/dist/maps/canada.d.ts +0 -2
  192. package/dist/maps/canada.js +0 -7
  193. package/dist/maps/iraq.d.ts +0 -2
  194. package/dist/maps/iraq.js +0 -84
  195. package/dist/maps/italy.d.ts +0 -2
  196. package/dist/maps/italy.js +0 -7
  197. package/dist/maps/russia.d.ts +0 -2
  198. package/dist/maps/russia.js +0 -366
  199. package/dist/maps/spain.d.ts +0 -2
  200. package/dist/maps/spain.js +0 -7
  201. package/dist/maps/us-aea-en.d.ts +0 -2
  202. package/dist/maps/us-aea-en.js +0 -7
  203. package/dist/maps/us-lcc-en.d.ts +0 -2
  204. package/dist/maps/us-lcc-en.js +0 -7
  205. package/dist/maps/us-merc-en.d.ts +0 -2
  206. package/dist/maps/us-merc-en.js +0 -7
  207. package/dist/maps/us-mill-en.d.ts +0 -2
  208. package/dist/maps/us-mill-en.js +0 -7
  209. package/dist/maps/world-merc.d.ts +0 -2
  210. package/dist/maps/world-merc.js +0 -7
  211. package/dist/maps/world.d.ts +0 -2
  212. package/dist/maps/world.js +0 -7
  213. package/dist/projection.d.ts +0 -1
  214. package/dist/scales/ordinal-scale.d.ts +0 -12
  215. package/dist/series.d.ts +0 -14
  216. package/dist/svg/base-element.d.ts +0 -19
  217. package/dist/svg/canvas-element.d.ts +0 -21
  218. package/dist/svg/image-element.d.ts +0 -12
  219. package/dist/svg/shape-element.d.ts +0 -19
  220. package/dist/svg/text-element.d.ts +0 -7
  221. package/dist/types.d.ts +0 -418
  222. package/dist/util/deep-merge.d.ts +0 -2
  223. package/dist/util/index.d.ts +0 -18
  224. package/dist/utils.d.ts +0 -87
  225. package/dist/vector-map.d.ts +0 -5
@@ -0,0 +1,30 @@
1
+ import { LatLng } from '../LatLng';
2
+ import type { ProjectionLike } from './Projection.LonLat';
3
+ export declare const Globe: GlobeProjection;
4
+ /**
5
+ * Globe projection — renders tiles on a sphere at low zoom, transitioning
6
+ * to flat Mercator around zoom 5.5 to match the common convention.
7
+ *
8
+ * The 2D `project`/`unproject` pair returns the Mercator projection for
9
+ * compatibility with the rest of the pipeline (tile loading, pixel math).
10
+ * The sphere warp is a vertex-shader effect and lives in the renderer —
11
+ * this module exposes the helpers that shader needs: projection to 3D
12
+ * world coords on the unit sphere, and a `globeToMercatorMix(zoom)`
13
+ * easing that selects how much to warp.
14
+ *
15
+ * Keep everything zero-dep and pure-math so it composes with the WebGL
16
+ * renderer without having to import DOM types.
17
+ */
18
+ export declare interface GlobeVec3 {
19
+ x: number
20
+ y: number
21
+ z: number
22
+ }
23
+ export declare interface GlobeProjection extends ProjectionLike {
24
+ R: number
25
+ GLOBE_START_ZOOM: number
26
+ GLOBE_END_ZOOM: number
27
+ toSphere: (latlng: any) => GlobeVec3
28
+ fromSphere: (v: GlobeVec3) => LatLng
29
+ globeToMercatorMix: (zoom: number) => number
30
+ }
@@ -0,0 +1,11 @@
1
+ import { Bounds } from '../../geometry/Bounds';
2
+ import { LatLng } from '../LatLng';
3
+ import { Point } from '../../geometry/Point';
4
+ // Equirectangular (Plate Carree) projection.
5
+ export declare const LonLat: ProjectionLike;
6
+ export declare interface ProjectionLike {
7
+ bounds: Bounds
8
+ project: (latlng: any) => Point
9
+ unproject: (point: any) => LatLng
10
+ [k: string]: any
11
+ }
@@ -0,0 +1,6 @@
1
+ // Elliptical Mercator projection (EPSG:3395).
2
+ export declare const Mercator: MercatorProjection;
3
+ declare interface MercatorProjection extends ProjectionLike {
4
+ R: number
5
+ R_MINOR: number
6
+ }
@@ -0,0 +1,6 @@
1
+ // Spherical Mercator projection — the most common for online maps (EPSG:3857).
2
+ export declare const SphericalMercator: SphericalMercatorProjection;
3
+ declare interface SphericalMercatorProjection extends ProjectionLike {
4
+ R: number
5
+ MAX_LATITUDE: number
6
+ }
@@ -0,0 +1,5 @@
1
+ export type { GlobeProjection, GlobeVec3 } from './Projection.Globe';
2
+ export { Globe } from './Projection.Globe';
3
+ export { LonLat } from './Projection.LonLat';
4
+ export { Mercator } from './Projection.Mercator';
5
+ export { SphericalMercator } from './Projection.SphericalMercator';
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Builds a terrain mesh for a single DEM tile. Pure function — no DOM /
3
+ * WebGL calls. Returns typed arrays ready to feed to
4
+ * `WebGLTileRenderer.drawTerrain`.
5
+ */
6
+ export declare function buildTerrainMesh(opts: TerrainMeshOptions): TerrainMesh;
7
+ export declare interface TerrainMeshOptions {
8
+ elevation: Float32Array
9
+ demSize: number
10
+ tileSize?: number
11
+ resolution?: number
12
+ exaggeration?: number
13
+ unitsPerMeter?: number
14
+ }
15
+ export declare interface TerrainMesh {
16
+ positions: Float32Array
17
+ indices: Uint32Array
18
+ vertexCount: number
19
+ indexCount: number
20
+ resolution: number
21
+ }
@@ -0,0 +1,23 @@
1
+ import { Point } from './Point';
2
+ import type { PointLike } from './Point';
3
+ export declare function toBounds(a?: BoundsLike | PointLike, b?: PointLike): Bounds;
4
+ export type BoundsLike = Bounds | [PointLike, PointLike] | Point[] | PointLike[];
5
+ // Represents a rectangular area in pixel coordinates.
6
+ export declare class Bounds {
7
+ min: Point;
8
+ max: Point;
9
+ constructor(a?: BoundsLike | PointLike, b?: PointLike);
10
+ extend(obj: any): this;
11
+ getCenter(round?: boolean): Point;
12
+ getBottomLeft(): Point;
13
+ getTopRight(): Point;
14
+ getTopLeft(): Point;
15
+ getBottomRight(): Point;
16
+ getSize(): Point;
17
+ contains(obj: any): boolean;
18
+ intersects(bounds: BoundsLike | PointLike): boolean;
19
+ overlaps(bounds: BoundsLike | PointLike): boolean;
20
+ isValid(): boolean;
21
+ pad(bufferRatio: number): Bounds;
22
+ equals(bounds: BoundsLike | PointLike | null | undefined): boolean;
23
+ }
@@ -0,0 +1,13 @@
1
+ import { LatLng } from '../geo/LatLng';
2
+ import { Point } from './Point';
3
+ import type { Bounds } from './Bounds';
4
+ export declare function simplify(points: Point[], tolerance: number): Point[];
5
+ export declare function pointToSegmentDistance(p: Point, p1: Point, p2: Point): number;
6
+ export declare function closestPointOnSegment(p: Point, p1: Point, p2: Point): Point;
7
+ // Cohen-Sutherland segment clipping.
8
+ export declare function clipSegment(a: Point, b: Point, bounds: Bounds, useLastCode?: boolean, round?: boolean): [Point, Point] | false;
9
+ export declare function _getEdgeIntersection(a: Point, b: Point, code: number, bounds: Bounds, round?: boolean): Point;
10
+ export declare function _getBitCode(p: Point, bounds: Bounds): number;
11
+ export declare function _sqClosestPointOnSegment(p: Point, p1: Point, p2: Point, sqDist?: boolean): Point | number;
12
+ export declare function isFlat(latlngs: any[]): boolean;
13
+ export declare function polylineCenter(latlngs: any[], crs: any): LatLng;
@@ -0,0 +1,35 @@
1
+ // Helper that normalizes any accepted input to a Point. Useful for public API methods
2
+ // that accept coordinate pairs in multiple forms.
3
+ export declare function toPoint(x: PointLike | number[] | null | undefined, y?: number, round?: boolean): Point;
4
+ export type PointTuple = [number, number];
5
+ export type PointLike = Point | PointTuple | { x: number, y: number } | number;
6
+ // Represents a point with `x` and `y` coordinates in pixels.
7
+ export declare class Point {
8
+ x: number;
9
+ y: number;
10
+ constructor(x: PointLike | number[], y?: number, round?: boolean);
11
+ static validate(x: any, y?: any): boolean;
12
+ clone(): Point;
13
+ add(point: PointLike | number[]): Point;
14
+ _add(point: Point): this;
15
+ subtract(point: PointLike | number[]): Point;
16
+ _subtract(point: Point): this;
17
+ divideBy(num: number): Point;
18
+ _divideBy(num: number): this;
19
+ multiplyBy(num: number): Point;
20
+ _multiplyBy(num: number): this;
21
+ scaleBy(point: Point): Point;
22
+ unscaleBy(point: Point): Point;
23
+ round(): Point;
24
+ _round(): this;
25
+ floor(): Point;
26
+ _floor(): this;
27
+ ceil(): Point;
28
+ _ceil(): this;
29
+ trunc(): Point;
30
+ _trunc(): this;
31
+ distanceTo(point: PointLike | number[]): number;
32
+ equals(point: PointLike | number[]): boolean;
33
+ contains(point: PointLike | number[]): boolean;
34
+ toString(): string;
35
+ }
@@ -0,0 +1,6 @@
1
+ import { LatLng } from '../geo/LatLng';
2
+ import { Point } from './Point';
3
+ import type { Bounds } from './Bounds';
4
+ export declare function clipPolygon(points: Array<Point & { _code?: number }>, bounds: Bounds, round?: boolean): Point[];
5
+ export declare function polygonCenter(latlngs: any[], crs: any): LatLng;
6
+ export declare function centroid(coords: any[]): LatLng;
@@ -0,0 +1,35 @@
1
+ export declare interface RTreeNode<T> {
2
+ bbox: BBox
3
+ children?: Array<RTreeNode<T>>
4
+ leaf?: boolean
5
+ data?: T
6
+ }
7
+ export declare interface RTreeEntry<T> {
8
+ bbox: BBox
9
+ data: T
10
+ }
11
+ // Zero-dep R-tree with incremental insertion, bulk-loading (STR), removal, and
12
+ // bbox/point search. Inspired by the public-domain algorithms popularized by
13
+ // rbush (MIT) — this implementation is written fresh in TypeScript and does
14
+ // not reuse any of its code.
15
+ //
16
+ // The tree stores axis-aligned bounding boxes associated with arbitrary data.
17
+ // Non-leaf nodes keep a union bbox over their children; leaf nodes hold the
18
+ // user-provided `data`. Keeping the separation explicit (via `leaf: true`)
19
+ // lets us walk the tree without instanceof checks and keeps the structure
20
+ // compatible with `isolatedDeclarations`.
21
+ export type BBox = [minX: number, minY: number, maxX: number, maxY: number];
22
+ // ---------------------------------------------------------------------------
23
+ // R-tree
24
+ // ---------------------------------------------------------------------------
25
+ export declare class RTree<T> {
26
+ constructor(opts?: { maxEntries?: number, minEntries?: number });
27
+ size(): number;
28
+ clear(): this;
29
+ insert(bbox: BBox, data: T): this;
30
+ remove(bbox: BBox, data: T, equalsFn?: (a: T, b: T) => boolean): this;
31
+ search(bbox: BBox): Array<RTreeEntry<T>>;
32
+ searchPoint(x: number, y: number): Array<RTreeEntry<T>>;
33
+ all(): Array<RTreeEntry<T>>;
34
+ load(items: Array<RTreeEntry<T>>): this;
35
+ }
@@ -0,0 +1,12 @@
1
+ import { Point } from './Point';
2
+ export declare function toTransformation(a: number | number[], b?: number, c?: number, d?: number): Transformation;
3
+ export declare class Transformation {
4
+ _a: number;
5
+ _b: number;
6
+ _c: number;
7
+ _d: number;
8
+ constructor(a: number | number[], b?: number, c?: number, d?: number);
9
+ transform(point: Point, scale?: number): Point;
10
+ _transform(point: Point, scale?: number): Point;
11
+ untransform(point: Point, scale?: number): Point;
12
+ }
@@ -0,0 +1,17 @@
1
+ // ---------------------------------------------------------------------------
2
+ // Public API
3
+ // ---------------------------------------------------------------------------
4
+ export declare function earcut(vertices: ArrayLike<number>, holes?: number[], dim?: number): number[];
5
+ // Compute the deviation between the polygon area and the total area of the
6
+ // produced triangulation. `0` means a perfect triangulation; small positive
7
+ // numbers indicate rounding error or degenerate geometry.
8
+ export declare function deviation(data: ArrayLike<number>, holes: number[] | undefined, dim: number, triangles: number[]): number;
9
+ // Flatten a GeoJSON-style polygon (array of rings, each an array of points
10
+ // with `x`/`y`) into the flat buffers earcut consumes. Accepts the legacy
11
+ // `[x, y][][]` encoding as well. Hole indices are start-of-ring offsets
12
+ // expressed in vertex counts (not coordinate counts).
13
+ export declare function flatten(data: number[][][] | Array<Array<{ x: number, y: number }>>): {
14
+ vertices: number[]
15
+ holes: number[]
16
+ dimensions: number
17
+ };
@@ -0,0 +1,10 @@
1
+ import * as LineUtil from './LineUtil';
2
+ import * as PolyUtil from './PolyUtil';
3
+ export type { BoundsLike } from './Bounds';
4
+ export type { PointLike, PointTuple } from './Point';
5
+ export type { BBox, RTreeEntry, RTreeNode } from './RTree';
6
+ export { Bounds, toBounds } from './Bounds';
7
+ export { Point, toPoint } from './Point';
8
+ export { RTree } from './RTree';
9
+ export { Transformation, toTransformation } from './Transformation';
10
+ export { LineUtil, PolyUtil };