terra-draw 1.0.0-beta.9 → 1.0.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 (135) hide show
  1. package/.versionrc.cjs +9 -0
  2. package/README.md +4 -47
  3. package/dist/common/adapter-listener.spec.d.ts +1 -0
  4. package/dist/{adapters/common → common}/base.adapter.d.ts +1 -1
  5. package/dist/common.d.ts +7 -5
  6. package/dist/extend.d.ts +4 -3
  7. package/dist/geometry/boolean/is-valid-coordinate.spec.d.ts +1 -0
  8. package/dist/geometry/boolean/point-in-polygon.spec.d.ts +1 -0
  9. package/dist/geometry/boolean/self-intersects.spec.d.ts +1 -0
  10. package/dist/geometry/calculate-relative-angle.d.ts +2 -10
  11. package/dist/geometry/calculate-relative-angle.spec.d.ts +1 -0
  12. package/dist/geometry/centroid.spec.d.ts +1 -0
  13. package/dist/geometry/clockwise.d.ts +2 -10
  14. package/dist/geometry/clockwise.spec.d.ts +1 -0
  15. package/dist/geometry/coordinates-identical.spec.d.ts +1 -0
  16. package/dist/geometry/determine-halfplane.d.ts +2 -10
  17. package/dist/geometry/determine-halfplane.spec.d.ts +1 -0
  18. package/dist/geometry/get-coordinates-as-points.spec.d.ts +1 -0
  19. package/dist/geometry/get-midpoint.spec.d.ts +1 -0
  20. package/dist/geometry/limit-decimal-precision.spec.d.ts +1 -0
  21. package/dist/geometry/measure/bearing.d.ts +2 -7
  22. package/dist/geometry/measure/bearing.spec.d.ts +1 -0
  23. package/dist/geometry/measure/desination.spec.d.ts +1 -0
  24. package/dist/geometry/measure/destination.d.ts +2 -7
  25. package/dist/geometry/measure/haversine-distance.spec.d.ts +1 -0
  26. package/dist/geometry/measure/pixel-distance-to-line.d.ts +2 -10
  27. package/dist/geometry/measure/pixel-distance-to-line.spec.d.ts +1 -0
  28. package/dist/geometry/measure/pixel-distance.d.ts +2 -7
  29. package/dist/geometry/measure/pixel-distance.spec.d.ts +1 -0
  30. package/dist/geometry/measure/rhumb-bearing.spec.d.ts +1 -0
  31. package/dist/geometry/measure/rhumb-destination.spec.d.ts +1 -0
  32. package/dist/geometry/measure/rhumb-distance.spec.d.ts +1 -0
  33. package/dist/geometry/point-on-line.d.ts +5 -0
  34. package/dist/geometry/point-on-line.spec.d.ts +1 -0
  35. package/dist/geometry/project/web-mercator.d.ts +2 -4
  36. package/dist/geometry/project/web-mercator.spec.d.ts +1 -0
  37. package/dist/geometry/shape/create-bbox.spec.d.ts +1 -0
  38. package/dist/geometry/shape/create-circle.spec.d.ts +1 -0
  39. package/dist/geometry/shape/great-circle-coordinates.spec.d.ts +1 -0
  40. package/dist/geometry/shape/web-mercator-distortion.spec.d.ts +1 -0
  41. package/dist/geometry/transform/rotate.spec.d.ts +1 -0
  42. package/dist/geometry/transform/scale.spec.d.ts +1 -0
  43. package/dist/geometry/web-mercator-centroid.d.ts +2 -4
  44. package/dist/geometry/web-mercator-centroid.spec.d.ts +1 -0
  45. package/dist/geometry/web-mercator-point-on-line.d.ts +11 -0
  46. package/dist/geometry/web-mercator-point-on-line.spec.d.ts +1 -0
  47. package/dist/modes/angled-rectangle/angled-rectangle.mode.d.ts +0 -1
  48. package/dist/modes/angled-rectangle/angled-rectangle.mode.spec.d.ts +1 -0
  49. package/dist/modes/circle/circle.mode.spec.d.ts +1 -0
  50. package/dist/modes/click-bounding-box.behavior.spec.d.ts +1 -0
  51. package/dist/modes/coordinate-snapping.behavior.d.ts +16 -0
  52. package/dist/modes/coordinate-snapping.behavior.spec.d.ts +1 -0
  53. package/dist/modes/freehand/freehand.mode.spec.d.ts +1 -0
  54. package/dist/modes/insert-coordinates.behavior.spec.d.ts +1 -0
  55. package/dist/modes/{snapping.behavior.d.ts → line-snapping.behavior.d.ts} +1 -1
  56. package/dist/modes/line-snapping.behavior.spec.d.ts +1 -0
  57. package/dist/modes/linestring/linestring.mode.d.ts +14 -3
  58. package/dist/modes/linestring/linestring.mode.spec.d.ts +1 -0
  59. package/dist/modes/pixel-distance.behavior.spec.d.ts +1 -0
  60. package/dist/modes/point/point.mode.spec.d.ts +1 -0
  61. package/dist/modes/polygon/behaviors/closing-points.behavior.spec.d.ts +1 -0
  62. package/dist/modes/polygon/polygon.mode.d.ts +15 -2
  63. package/dist/modes/polygon/polygon.mode.spec.d.ts +1 -0
  64. package/dist/modes/rectangle/rectangle.mode.spec.d.ts +1 -0
  65. package/dist/modes/render/render.mode.spec.d.ts +1 -0
  66. package/dist/modes/sector/sector.mode.spec.d.ts +1 -0
  67. package/dist/modes/select/behaviors/drag-coordinate-resize.behavior.spec.d.ts +1 -0
  68. package/dist/modes/select/behaviors/drag-coordinate.behavior.spec.d.ts +1 -0
  69. package/dist/modes/select/behaviors/drag-feature.behavior.spec.d.ts +1 -0
  70. package/dist/modes/select/behaviors/feature-at-pointer-event.behavior.spec.d.ts +1 -0
  71. package/dist/modes/select/behaviors/midpoint.behavior.spec.d.ts +1 -0
  72. package/dist/modes/select/behaviors/rotate-feature.behavior.spec.d.ts +1 -0
  73. package/dist/modes/select/behaviors/scale-feature.behavior.spec.d.ts +1 -0
  74. package/dist/modes/select/behaviors/selection-point.behavior.spec.d.ts +1 -0
  75. package/dist/modes/select/select.mode.spec.d.ts +1 -0
  76. package/dist/modes/sensor/sensor.mode.spec.d.ts +1 -0
  77. package/dist/modes/static/static.mode.spec.d.ts +1 -0
  78. package/dist/store/spatial-index/quickselect.spec.d.ts +1 -0
  79. package/dist/store/spatial-index/rbush.spec.d.ts +1 -0
  80. package/dist/store/spatial-index/spatial-index.spec.d.ts +1 -0
  81. package/dist/store/store-validation.spec.d.ts +1 -0
  82. package/dist/store/store.spec.d.ts +1 -0
  83. package/dist/terra-draw.cjs +1 -1
  84. package/dist/terra-draw.cjs.map +1 -1
  85. package/dist/terra-draw.d.ts +6 -8
  86. package/dist/terra-draw.extensions.spec.d.ts +28 -0
  87. package/dist/terra-draw.modern.js +1 -1
  88. package/dist/terra-draw.modern.js.map +1 -1
  89. package/dist/terra-draw.module.js +1 -1
  90. package/dist/terra-draw.module.js.map +1 -1
  91. package/dist/terra-draw.spec.d.ts +1 -0
  92. package/dist/terra-draw.umd.js +1 -1
  93. package/dist/terra-draw.umd.js.map +1 -1
  94. package/dist/test/create-store-features.d.ts +6 -0
  95. package/dist/test/jest.matchers.d.ts +1 -0
  96. package/dist/test/mock-behavior-config.d.ts +2 -0
  97. package/dist/test/mock-callbacks.d.ts +2 -0
  98. package/dist/test/mock-cursor-event.d.ts +6 -0
  99. package/dist/test/mock-features.d.ts +4 -0
  100. package/dist/test/mock-keyboard-event.d.ts +5 -0
  101. package/dist/test/mock-mode-config.d.ts +21 -0
  102. package/dist/test/mock-pointer-event.d.ts +1 -0
  103. package/dist/util/geom.spec.d.ts +1 -0
  104. package/dist/util/id.spec.d.ts +1 -0
  105. package/dist/util/styling.spec.d.ts +1 -0
  106. package/dist/validations/linestring.validation.spec.d.ts +1 -0
  107. package/dist/validations/max-size.validation.spec.d.ts +1 -0
  108. package/dist/validations/min-size.validation.spec.d.ts +1 -0
  109. package/dist/validations/not-self-intersecting.validation.spec.d.ts +1 -0
  110. package/dist/validations/point.validation.spec.d.ts +1 -0
  111. package/dist/validations/polygon.validation.spec.d.ts +1 -0
  112. package/jest.nocheck.config.ts +5 -14
  113. package/package.json +8 -119
  114. package/tsconfig.json +6 -25
  115. package/.devcontainer/Dockerfile +0 -8
  116. package/.devcontainer/devcontainer.json +0 -27
  117. package/.devcontainer/post-create.sh +0 -16
  118. package/LICENSE +0 -8
  119. package/dist/adapters/arcgis-maps-sdk.adapter.d.ts +0 -106
  120. package/dist/adapters/google-maps.adapter.d.ts +0 -90
  121. package/dist/adapters/leaflet.adapter.d.ts +0 -99
  122. package/dist/adapters/mapbox-gl.adapter.d.ts +0 -90
  123. package/dist/adapters/maplibre-gl.adapter.d.ts +0 -72
  124. package/dist/adapters/openlayers.adapter.d.ts +0 -121
  125. package/e2e/README.md +0 -29
  126. package/e2e/package-lock.json +0 -4275
  127. package/e2e/package.json +0 -26
  128. package/e2e/playwright.config.ts +0 -77
  129. package/e2e/public/favicon.ico +0 -0
  130. package/e2e/public/index.html +0 -55
  131. package/e2e/tests/leaflet.spec.ts +0 -1040
  132. package/e2e/tests/setup.ts +0 -208
  133. package/e2e/webpack.config.js +0 -36
  134. package/eslint.config.js +0 -31
  135. /package/dist/{adapters/common → common}/adapter-listener.d.ts +0 -0
@@ -0,0 +1,6 @@
1
+ import { Position } from "geojson";
2
+ import { BehaviorConfig } from "../modes/base.behavior";
3
+ export declare const createStoreMidPoint: (config: BehaviorConfig, coordinates?: Position) => import("../extend").FeatureId;
4
+ export declare const createStorePoint: (config: BehaviorConfig, coordinates?: Position, selected?: boolean) => import("../extend").FeatureId;
5
+ export declare const createStorePolygon: (config: BehaviorConfig, coordinates?: Position[][], selected?: boolean, mode?: string) => import("../extend").FeatureId;
6
+ export declare const createStoreLineString: (config: BehaviorConfig, coordinates?: Position[], selected?: boolean) => import("../extend").FeatureId;
@@ -0,0 +1 @@
1
+ declare const uuidRegExp: RegExp;
@@ -0,0 +1,2 @@
1
+ import { BehaviorConfig } from "../modes/base.behavior";
2
+ export declare const MockBehaviorConfig: (mode: string, projection?: "web-mercator" | "globe") => BehaviorConfig;
@@ -0,0 +1,2 @@
1
+ import { TerraDrawCallbacks } from "../common";
2
+ export declare const MockCallbacks: (overrides?: Partial<TerraDrawCallbacks>) => TerraDrawCallbacks;
@@ -0,0 +1,6 @@
1
+ import { TerraDrawMouseEvent } from "../common";
2
+ export declare const MockCursorEvent: ({ lng, lat, button, }: {
3
+ lng: TerraDrawMouseEvent["lng"];
4
+ lat: TerraDrawMouseEvent["lat"];
5
+ button?: TerraDrawMouseEvent["button"];
6
+ }) => TerraDrawMouseEvent;
@@ -0,0 +1,4 @@
1
+ import { Feature, LineString, Point, Polygon } from "geojson";
2
+ export declare function MockPolygonSquare(id?: string, squareStart?: number, squareEnd?: number): Feature<Polygon>;
3
+ export declare function MockPoint(id?: string, lng?: number, lat?: number): Feature<Point>;
4
+ export declare function MockLineString(id?: string): Feature<LineString>;
@@ -0,0 +1,5 @@
1
+ import { TerraDrawKeyboardEvent } from "../common";
2
+ export declare const MockKeyboardEvent: ({ key, heldKeys, }: {
3
+ key: TerraDrawKeyboardEvent["key"];
4
+ heldKeys?: TerraDrawKeyboardEvent["heldKeys"];
5
+ }) => TerraDrawKeyboardEvent;
@@ -0,0 +1,21 @@
1
+ import { GeoJSONStore } from "../store/store";
2
+ export declare function MockModeConfig(mode: string): {
3
+ mode: string;
4
+ store: GeoJSONStore<import("../store/store").FeatureId>;
5
+ setCursor: jest.Mock<any, any, any>;
6
+ onChange: jest.Mock<any, any, any>;
7
+ onSelect: jest.Mock<any, any, any>;
8
+ onDeselect: jest.Mock<any, any, any>;
9
+ project: jest.Mock<{
10
+ x: number;
11
+ y: number;
12
+ }, [lng: any, lat: any], any>;
13
+ unproject: jest.Mock<{
14
+ lng: number;
15
+ lat: number;
16
+ }, [x: any, y: any], any>;
17
+ setDoubleClickToZoom: jest.Mock<any, any, any>;
18
+ onFinish: jest.Mock<any, any, any>;
19
+ coordinatePrecision: number;
20
+ projection: string;
21
+ };
@@ -0,0 +1 @@
1
+ export declare const MockPointerEvent: () => PointerEvent;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -1,17 +1,8 @@
1
- console.log("===== Using @swc/jest ======");
1
+ const noCheckConfig = require("../../jest.nocheck.config");
2
2
 
3
3
  module.exports = {
4
- transform: {
5
- "^.+\\.(t|j)sx?$": "@swc/jest",
6
- },
7
- testPathIgnorePatterns: [
8
- "<rootDir>/node_modules/",
9
- "<rootDir>/e2e/",
10
- "<rootDir>/docs/",
11
- "<rootDir>/coverage/",
12
- "<rootDir>/scripts/",
13
- "<rootDir>/guides/",
14
- ],
15
- coveragePathIgnorePatterns: ["<rootDir>/src/test/", "<rootDir>/e2e/"],
16
- setupFilesAfterEnv: ["<rootDir>/src/test/jest.matchers.ts"],
4
+ ...noCheckConfig,
5
+ testPathIgnorePatterns: ["<rootDir>/dist"],
6
+ coveragePathIgnorePatterns: ["<rootDir>/src/test/", "<rootDir>/dist"],
7
+ collectCoverageFrom: ["./src/**"],
17
8
  };
package/package.json CHANGED
@@ -1,13 +1,10 @@
1
1
  {
2
2
  "name": "terra-draw",
3
- "version": "1.0.0-beta.9",
3
+ "version": "1.0.0",
4
4
  "description": "Frictionless map drawing across mapping provider",
5
5
  "scripts": {
6
- "docs": "typedoc",
7
- "docs:serve": "serve ./docs",
8
- "release:beta:increment": "standard-version --prerelease beta",
9
- "release:beta:changelog": "tsx ./scripts/changelog-valid.ts",
10
- "release:beta:next": "tsx ./scripts/next-beta-version.ts",
6
+ "release": "commit-and-tag-version .versionrc.cjs",
7
+ "release:dryrun": "commit-and-tag-version .versionrc.cjs -t terra-draw@ --dry-run",
11
8
  "build": "microbundle",
12
9
  "watch": "microbundle --watch --format modern",
13
10
  "unused": "knip",
@@ -20,8 +17,7 @@
20
17
  "lint:fix": "eslint --fix src/",
21
18
  "lint:fix:quiet": "eslint --fix --quiet src/",
22
19
  "format": "prettier --ignore-path .gitignore --write \"**/*.+(js|ts|json)\"",
23
- "format:quiet": "prettier --ignore-path .gitignore --write \"**/*.+(js|ts|json)\" --log-level=silent",
24
- "prepare": "husky install"
20
+ "format:quiet": "prettier --ignore-path .gitignore --write \"**/*.+(js|ts|json)\" --log-level=silent"
25
21
  },
26
22
  "type": "module",
27
23
  "source": "src/terra-draw.ts",
@@ -43,118 +39,11 @@
43
39
  "draw",
44
40
  "map drawing",
45
41
  "geometry",
42
+ "arcgis",
46
43
  "leaflet",
47
- "leafletjs",
48
- "mapbox",
49
- "mapboxgl",
50
- "google maps",
44
+ "maplibre",
51
45
  "openlayers",
52
- "maplibre"
46
+ "mapbox"
53
47
  ],
54
- "devDependencies": {
55
- "@arcgis/core": "4.27.6",
56
- "@commitlint/cli": "17.1.2",
57
- "@commitlint/config-conventional": "17.1.0",
58
- "@googlemaps/js-api-loader": "1.14.3",
59
- "@swc/jest": "0.2.36",
60
- "@types/geojson": "7946.0.8",
61
- "@types/google.maps": "3.49.2",
62
- "@types/jest": "29.5.12",
63
- "@types/leaflet": "1.9.12",
64
- "@types/mapbox-gl": "2.7.3",
65
- "@types/rbush": "3.0.0",
66
- "@typescript-eslint/eslint-plugin": "8.17.0",
67
- "@typescript-eslint/parser": "8.17.0",
68
- "eslint": "9.1.0",
69
- "eslint-config-prettier": "9.1.0",
70
- "eslint-plugin-prettier": "5.2.1",
71
- "husky": "7.0.0",
72
- "jest": "29.7.0",
73
- "jest-environment-jsdom": "29.7.0",
74
- "knip": "^5.30.2",
75
- "leaflet": "^1.9.4",
76
- "mapbox-gl": "2.13.0",
77
- "maplibre-gl": "3.2.0",
78
- "microbundle": "0.15.0",
79
- "ol": "10.0.0",
80
- "serve": "14.1.2",
81
- "standard-version": "9.5.0",
82
- "ts-jest": "29.1.2",
83
- "ts-loader": "9.5.1",
84
- "tsx": "4.7.2",
85
- "typedoc": "0.26.11",
86
- "typescript": "5.6.3"
87
- },
88
- "commitlint": {
89
- "extends": [
90
- "@commitlint/config-conventional"
91
- ]
92
- },
93
- "prettier": {
94
- "printWidth": 80,
95
- "semi": true,
96
- "useTabs": true
97
- },
98
- "standard-version": {
99
- "types": [
100
- {
101
- "type": "feat",
102
- "section": "Features"
103
- },
104
- {
105
- "type": "fix",
106
- "section": "Bug Fixes"
107
- },
108
- {
109
- "type": "docs",
110
- "section": "Documentation"
111
- },
112
- {
113
- "type": "style",
114
- "section": "Styling"
115
- },
116
- {
117
- "type": "refactor",
118
- "section": "Refactors"
119
- },
120
- {
121
- "type": "perf",
122
- "section": "Performance"
123
- },
124
- {
125
- "type": "test",
126
- "section": "Tests"
127
- },
128
- {
129
- "type": "build",
130
- "section": "Build System"
131
- },
132
- {
133
- "type": "ci",
134
- "section": "CI"
135
- },
136
- {
137
- "type": "chore",
138
- "section": "Chore"
139
- },
140
- {
141
- "type": "revert",
142
- "section": "Reverts"
143
- }
144
- ]
145
- },
146
- "sideEffects": false,
147
- "knip": {
148
- "$schema": "https://unpkg.com/knip@5/schema.json",
149
- "entry": [
150
- "src/terra-draw.ts"
151
- ],
152
- "project": [
153
- "src/**/*.ts"
154
- ],
155
- "include": [
156
- "files",
157
- "types"
158
- ]
159
- }
48
+ "sideEffects": false
160
49
  }
package/tsconfig.json CHANGED
@@ -1,28 +1,9 @@
1
1
  {
2
+ "extends": "./../../tsconfig.base.json",
3
+ "include": ["src"],
2
4
  "compilerOptions": {
3
- "outDir": "./dist/",
4
- "strict": true,
5
- "module": "es6",
6
- "target": "es6",
7
- "jsx": "react",
8
- "sourceMap": true,
9
- "allowJs": true,
10
- "moduleResolution": "node",
11
- "allowSyntheticDefaultImports": true
12
- },
13
- "typedocOptions": {
14
- "entryPoints": ["src/terra-draw.ts"],
15
- "exclude": ["src/geometry/**/*.ts", "src/test/**/*.ts", "src/util/**/*.ts"],
16
- "out": "docs",
17
- "skipErrorChecking": true,
18
- "sourceLinkExternal": true
19
- },
20
- "exclude": [
21
- "node_modules/",
22
- "guides/",
23
- "docs/",
24
- "dist/",
25
- "development/dist",
26
- "development/node_modules"
27
- ]
5
+ "composite": true,
6
+ "outDir": "dist",
7
+ "rootDir": "src"
8
+ }
28
9
  }
@@ -1,8 +0,0 @@
1
- ARG NODE_MAJOR_VERSION
2
-
3
- FROM mcr.microsoft.com/devcontainers/javascript-node:${NODE_MAJOR_VERSION}
4
-
5
- ENV EDITOR="code -w" VISUAL="code -w" CHOKIDAR_USEPOLLING="1"
6
-
7
- # uncomment to install additional npm packages
8
- # RUN su node -c 'npm i -g cowsay@1.5.0'
@@ -1,27 +0,0 @@
1
- {
2
- "name": "terra-draw",
3
- "dockerFile": "Dockerfile",
4
- "build": {
5
- "args": {
6
- "NODE_MAJOR_VERSION": "20"
7
- }
8
- },
9
- "postCreateCommand": [".devcontainer/post-create.sh"],
10
- "portsAttributes": {
11
- "3000": {
12
- "label": "Docs"
13
- },
14
- "9000": {
15
- "label": "Development"
16
- }
17
- },
18
- "customizations": {
19
- "vscode": {
20
- "extensions": [
21
- "dbaeumer.vscode-eslint",
22
- "esbenp.prettier-vscode",
23
- "mikestead.dotenv"
24
- ]
25
- }
26
- }
27
- }
@@ -1,16 +0,0 @@
1
- #!/usr/bin/env bash
2
-
3
- set -eo pipefail
4
-
5
- # when in a VS Code or GitHub Codespaces devcontainer
6
- if [ -n "${REMOTE_CONTAINERS}" ] || [ -n "${CODESPACES}" ]; then
7
- this_dir=$(cd -P -- "$(dirname -- "$(command -v -- "$0")")" && pwd -P)
8
- workspace_root=$(realpath ${this_dir}/..)
9
-
10
- # perform additional one-time setup just after
11
- # the devcontainer is created
12
- npm ci --prefix "${workspace_root}" # install lib node dependencies
13
- npm ci --prefix "${workspace_root}/development" # install dev node dependencies
14
- touch "${workspace_root}/development/.env" # ensure dev .env file exists
15
-
16
- fi
package/LICENSE DELETED
@@ -1,8 +0,0 @@
1
- Copyright 2022 James Milner
2
-
3
- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
-
5
- The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6
-
7
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
8
-
@@ -1,106 +0,0 @@
1
- import { SetCursor, TerraDrawCallbacks, TerraDrawChanges, TerraDrawStylingFunction } from "../common";
2
- import { BaseAdapterConfig, TerraDrawBaseAdapter } from "./common/base.adapter";
3
- import MapView from "@arcgis/core/views/MapView";
4
- import Point from "@arcgis/core/geometry/Point";
5
- import Polyline from "@arcgis/core/geometry/Polyline";
6
- import Polygon from "@arcgis/core/geometry/Polygon";
7
- import GraphicsLayer from "@arcgis/core/layers/GraphicsLayer";
8
- import Graphic from "@arcgis/core/Graphic";
9
- import SimpleMarkerSymbol from "@arcgis/core/symbols/SimpleMarkerSymbol";
10
- import SimpleLineSymbol from "@arcgis/core/symbols/SimpleLineSymbol";
11
- import SimpleFillSymbol from "@arcgis/core/symbols/SimpleFillSymbol";
12
- import Color from "@arcgis/core/Color";
13
- type InjectableArcGISMapsSDK = {
14
- GraphicsLayer: typeof GraphicsLayer;
15
- Point: typeof Point;
16
- Polyline: typeof Polyline;
17
- Polygon: typeof Polygon;
18
- SimpleLineSymbol: typeof SimpleLineSymbol;
19
- SimpleMarkerSymbol: typeof SimpleMarkerSymbol;
20
- SimpleFillSymbol: typeof SimpleFillSymbol;
21
- Graphic: typeof Graphic;
22
- Color: typeof Color;
23
- };
24
- export declare class TerraDrawArcGISMapsSDKAdapter extends TerraDrawBaseAdapter {
25
- private readonly _lib;
26
- private readonly _mapView;
27
- private readonly _container;
28
- private readonly _featureIdAttributeName;
29
- private readonly _featureLayerName;
30
- private readonly _featureLayer;
31
- private _dragEnabled;
32
- private _zoomEnabled;
33
- private _dragHandler;
34
- private _doubleClickHandler;
35
- constructor(config: {
36
- map: MapView;
37
- lib: InjectableArcGISMapsSDK;
38
- } & BaseAdapterConfig);
39
- register(callbacks: TerraDrawCallbacks): void;
40
- unregister(): void;
41
- getCoordinatePrecision(): number;
42
- /**
43
- * Returns the longitude and latitude coordinates from a given PointerEvent on the map.
44
- * @param event The PointerEvent or MouseEvent containing the screen coordinates of the pointer.
45
- * @returns An object with 'lng' and 'lat' properties representing the longitude and latitude, or null if the conversion is not possible.
46
- */
47
- getLngLatFromEvent(event: PointerEvent | MouseEvent): {
48
- lng: number;
49
- lat: number;
50
- };
51
- /**
52
- * Retrieves the HTML element of the ArcGIS element that handles interaction events
53
- * @returns The HTMLElement representing the map container.
54
- */
55
- getMapEventElement(): HTMLElement;
56
- /**
57
- * Enables or disables the draggable functionality of the map.
58
- * @param enabled Set to true to enable map dragging, or false to disable it.
59
- */
60
- setDraggability(enabled: boolean): void;
61
- /**
62
- * Converts longitude and latitude coordinates to pixel coordinates in the map container.
63
- * @param lng The longitude coordinate to project.
64
- * @param lat The latitude coordinate to project.
65
- * @returns An object with 'x' and 'y' properties representing the pixel coordinates within the map container.
66
- */
67
- project(lng: number, lat: number): {
68
- x: number;
69
- y: number;
70
- };
71
- /**
72
- * Converts pixel coordinates in the map container to longitude and latitude coordinates.
73
- * @param x The x-coordinate in the map container to unproject.
74
- * @param y The y-coordinate in the map container to unproject.
75
- * @returns An object with 'lng' and 'lat' properties representing the longitude and latitude coordinates.
76
- */
77
- unproject(x: number, y: number): {
78
- lng: number;
79
- lat: number;
80
- };
81
- /**
82
- * Sets the cursor style for the map container.
83
- * @param cursor The CSS cursor style to apply, or 'unset' to remove any previously applied cursor style.
84
- */
85
- setCursor(cursor: Parameters<SetCursor>[0]): void;
86
- /**
87
- * Enables or disables the double-click to zoom functionality on the map.
88
- * @param enabled Set to true to enable double-click to zoom, or false to disable it.
89
- */
90
- setDoubleClickToZoom(enabled: boolean): void;
91
- /**
92
- * Renders GeoJSON features on the map using the provided styling configuration.
93
- * @param changes An object containing arrays of created, updated, and unchanged features to render.
94
- * @param styling An object mapping draw modes to feature styling functions
95
- */
96
- render(changes: TerraDrawChanges, styling: TerraDrawStylingFunction): void;
97
- /**
98
- * Clears the map and store of all rendered data layers
99
- * @returns void
100
- * */
101
- clear(): void;
102
- private removeFeatureById;
103
- private addFeature;
104
- private getColorFromHex;
105
- }
106
- export {};
@@ -1,90 +0,0 @@
1
- import { TerraDrawChanges, SetCursor, TerraDrawStylingFunction, TerraDrawCallbacks } from "../common";
2
- import { BaseAdapterConfig, TerraDrawBaseAdapter } from "./common/base.adapter";
3
- export declare class TerraDrawGoogleMapsAdapter extends TerraDrawBaseAdapter {
4
- constructor(config: {
5
- lib: typeof google.maps;
6
- map: google.maps.Map;
7
- } & BaseAdapterConfig);
8
- private _cursor;
9
- private _cursorStyleSheet;
10
- private _lib;
11
- private _map;
12
- private _overlay;
13
- private _clickEventListener;
14
- private _mouseMoveEventListener;
15
- private get _layers();
16
- /**
17
- * Generates an SVG path string for a circle with the given center coordinates and radius.
18
- * Based off this StackOverflow answer: https://stackoverflow.com/a/27905268/1363484
19
- * @param cx The x-coordinate of the circle's center.
20
- * @param cy The y-coordinate of the circle's center.
21
- * @param r The radius of the circle.
22
- * @returns The SVG path string representing the circle.
23
- */
24
- private circlePath;
25
- register(callbacks: TerraDrawCallbacks): void;
26
- unregister(): void;
27
- /**
28
- * Returns the longitude and latitude coordinates from a given PointerEvent on the map.
29
- * @param event The PointerEvent or MouseEvent containing the screen coordinates of the pointer.
30
- * @returns An object with 'lng' and 'lat' properties representing the longitude and latitude, or null if the conversion is not possible.
31
- */
32
- getLngLatFromEvent(event: PointerEvent | MouseEvent): {
33
- lng: number;
34
- lat: number;
35
- } | null;
36
- /**
37
- * Retrieves the HTML element of the Google Map element that handles interaction events
38
- * @returns The HTMLElement representing the map container.
39
- */
40
- getMapEventElement(): HTMLDivElement;
41
- /**
42
- * Converts longitude and latitude coordinates to pixel coordinates in the map container.
43
- * @param lng The longitude coordinate to project.
44
- * @param lat The latitude coordinate to project.
45
- * @returns An object with 'x' and 'y' properties representing the pixel coordinates within the map container.
46
- */
47
- project(lng: number, lat: number): {
48
- x: number;
49
- y: number;
50
- };
51
- /**
52
- * Converts pixel coordinates in the map container to longitude and latitude coordinates.
53
- * @param x The x-coordinate in the map container to unproject.
54
- * @param y The y-coordinate in the map container to unproject.
55
- * @returns An object with 'lng' and 'lat' properties representing the longitude and latitude coordinates.
56
- */
57
- unproject(x: number, y: number): {
58
- lng: number;
59
- lat: number;
60
- };
61
- /**
62
- * Sets the cursor style for the map container.
63
- * @param cursor The CSS cursor style to apply, or 'unset' to remove any previously applied cursor style.
64
- */
65
- setCursor(cursor: Parameters<SetCursor>[0]): void;
66
- /**
67
- * Enables or disables the double-click to zoom functionality on the map.
68
- * @param enabled Set to true to enable double-click to zoom, or false to disable it.
69
- */
70
- setDoubleClickToZoom(enabled: boolean): void;
71
- /**
72
- * Enables or disables the draggable functionality of the map.
73
- * @param enabled Set to true to enable map dragging, or false to disable it.
74
- */
75
- setDraggability(enabled: boolean): void;
76
- private renderedFeatureIds;
77
- /**
78
- * Renders GeoJSON features on the map using the provided styling configuration.
79
- * @param changes An object containing arrays of created, updated, and unchanged features to render.
80
- * @param styling An object mapping draw modes to feature styling functions
81
- */
82
- render(changes: TerraDrawChanges, styling: TerraDrawStylingFunction): void;
83
- private clearLayers;
84
- /**
85
- * Clears the map and store of all rendered data layers
86
- * @returns void
87
- * */
88
- clear(): void;
89
- getCoordinatePrecision(): number;
90
- }
@@ -1,99 +0,0 @@
1
- import { TerraDrawChanges, SetCursor, TerraDrawStylingFunction, TerraDrawCallbacks } from "../common";
2
- import L from "leaflet";
3
- import { BaseAdapterConfig, TerraDrawBaseAdapter } from "./common/base.adapter";
4
- export declare class TerraDrawLeafletAdapter extends TerraDrawBaseAdapter {
5
- constructor(config: {
6
- lib: typeof L;
7
- map: L.Map;
8
- } & BaseAdapterConfig);
9
- private _lib;
10
- private _map;
11
- private _panes;
12
- private _container;
13
- private _layers;
14
- /**
15
- * Creates a pane and its associated style sheet
16
- * @param pane - The pane name
17
- * @param zIndex - The zIndex value for the pane
18
- * @returns The created style element
19
- */
20
- private createPaneStyleSheet;
21
- /**
22
- * Clears the panes created by the adapter
23
- * @returns void
24
- * */
25
- private clearPanes;
26
- /**
27
- * Clears the leaflet layers created by the adapter
28
- * @returns void
29
- * */
30
- private clearLayers;
31
- /**
32
- * Styles a GeoJSON layer based on the styling function
33
- * @param styling - The styling function
34
- * */
35
- private styleGeoJSONLayer;
36
- /**
37
- * Returns the longitude and latitude coordinates from a given PointerEvent on the map.
38
- * @param event The PointerEvent or MouseEvent containing the screen coordinates of the pointer.
39
- * @returns An object with 'lng' and 'lat' properties representing the longitude and latitude, or null if the conversion is not possible.
40
- */
41
- getLngLatFromEvent(event: PointerEvent | MouseEvent): {
42
- lng: number;
43
- lat: number;
44
- } | null;
45
- /**
46
- * Retrieves the HTML element of the Leaflet element that handles interaction events
47
- * @returns The HTMLElement representing the map container.
48
- */
49
- getMapEventElement(): HTMLElement;
50
- /**
51
- * Enables or disables the draggable functionality of the map.
52
- * @param enabled Set to true to enable map dragging, or false to disable it.
53
- */
54
- setDraggability(enabled: boolean): void;
55
- /**
56
- * Converts longitude and latitude coordinates to pixel coordinates in the map container.
57
- * @param lng The longitude coordinate to project.
58
- * @param lat The latitude coordinate to project.
59
- * @returns An object with 'x' and 'y' properties representing the pixel coordinates within the map container.
60
- */
61
- project(lng: number, lat: number): {
62
- x: number;
63
- y: number;
64
- };
65
- /**
66
- * Converts pixel coordinates in the map container to longitude and latitude coordinates.
67
- * @param x The x-coordinate in the map container to unproject.
68
- * @param y The y-coordinate in the map container to unproject.
69
- * @returns An object with 'lng' and 'lat' properties representing the longitude and latitude coordinates.
70
- */
71
- unproject(x: number, y: number): {
72
- lng: number;
73
- lat: number;
74
- };
75
- /**
76
- * Sets the cursor style for the map container.
77
- * @param cursor The CSS cursor style to apply, or 'unset' to remove any previously applied cursor style.
78
- */
79
- setCursor(cursor: Parameters<SetCursor>[0]): void;
80
- /**
81
- * Enables or disables the double-click to zoom functionality on the map.
82
- * @param enabled Set to true to enable double-click to zoom, or false to disable it.
83
- */
84
- setDoubleClickToZoom(enabled: boolean): void;
85
- /**
86
- * Renders GeoJSON features on the map using the provided styling configuration.
87
- * @param changes An object containing arrays of created, updated, and unchanged features to render.
88
- * @param styling An object mapping draw modes to feature styling functions
89
- */
90
- render(changes: TerraDrawChanges, styling: TerraDrawStylingFunction): void;
91
- /**
92
- * Clears the map and store of all rendered data layers
93
- * @returns void
94
- * */
95
- clear(): void;
96
- register(callbacks: TerraDrawCallbacks): void;
97
- getCoordinatePrecision(): number;
98
- unregister(): void;
99
- }