terra-draw 0.0.1-alpha.4 → 0.0.1-alpha.40
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/CHANGELOG.md +425 -0
- package/README.md +25 -4
- package/dist/adapters/common/adapter-listener.d.ts +22 -0
- package/dist/adapters/common/base-adapter.d.ts +31 -0
- package/dist/adapters/common/base.adapter.d.ts +47 -0
- package/dist/adapters/google-maps.adapter.d.ts +87 -38
- package/dist/adapters/leaflet.adapter.d.ts +98 -35
- package/dist/adapters/mapbox-gl.adapter.d.ts +89 -36
- package/dist/adapters/maplibre-gl.adapter.d.ts +72 -0
- package/dist/adapters/openlayers.adapter.d.ts +117 -0
- package/dist/common.d.ts +93 -99
- package/dist/extend-types.d.ts +4 -0
- package/dist/geometry/boolean/is-valid-coordinate.d.ts +4 -0
- package/dist/geometry/boolean/is-valid-linestring-feature.d.ts +2 -0
- package/dist/geometry/boolean/is-valid-point.d.ts +2 -0
- package/dist/geometry/boolean/is-valid-polygon-feature.d.ts +3 -0
- package/dist/geometry/boolean/point-in-polygon.d.ts +2 -2
- package/dist/geometry/boolean/self-intersects.d.ts +2 -2
- package/dist/geometry/centroid.d.ts +2 -2
- package/dist/geometry/coordinates-identical.d.ts +2 -2
- package/dist/geometry/get-coordinates-as-points.d.ts +6 -6
- package/dist/geometry/get-midpoints.d.ts +8 -7
- package/dist/geometry/helpers.d.ts +4 -4
- package/dist/geometry/limit-decimal-precision.d.ts +1 -1
- package/dist/geometry/measure/haversine-distance.d.ts +2 -2
- package/dist/geometry/measure/pixel-distance-to-line.d.ts +10 -10
- package/dist/geometry/measure/pixel-distance.d.ts +7 -7
- package/dist/geometry/measure/rhumb-bearing.d.ts +2 -2
- package/dist/geometry/measure/rhumb-destination.d.ts +2 -2
- package/dist/geometry/measure/rhumb-distance.d.ts +2 -2
- package/dist/geometry/midpoint-coordinate.d.ts +3 -2
- package/dist/geometry/shape/create-circle.d.ts +7 -7
- package/dist/geometry/shape/great-circle-line.d.ts +12 -0
- package/dist/geometry/transform/rotate.d.ts +2 -2
- package/dist/geometry/transform/scale.d.ts +2 -2
- package/dist/modes/base.behavior.d.ts +19 -19
- package/dist/modes/base.mode.d.ts +55 -30
- package/dist/modes/circle/circle.mode.d.ts +49 -27
- package/dist/modes/click-bounding-box.behavior.d.ts +7 -7
- package/dist/modes/freehand/freehand.mode.d.ts +55 -29
- package/dist/modes/great-circle-snapping.behavior.d.ts +13 -0
- package/dist/modes/greatcircle/great-circle.mode.d.ts +58 -0
- package/dist/modes/linestring/linestring.mode.d.ts +61 -34
- package/dist/modes/pixel-distance.behavior.d.ts +7 -7
- package/dist/modes/point/point.mode.d.ts +39 -18
- package/dist/modes/polygon/behaviors/closing-points.behavior.d.ts +19 -0
- package/dist/modes/polygon/polygon.mode.d.ts +64 -37
- package/dist/modes/rectangle/rectangle.mode.d.ts +50 -0
- package/dist/modes/render/render.mode.d.ts +39 -0
- package/dist/modes/select/behaviors/drag-coordinate.behavior.d.ts +19 -13
- package/dist/modes/select/behaviors/drag-feature.behavior.d.ts +19 -17
- package/dist/modes/select/behaviors/features-at-mouse-event.behavior.d.ts +15 -15
- package/dist/modes/select/behaviors/midpoint.behavior.d.ts +18 -18
- package/dist/modes/select/behaviors/rotate-feature.behavior.d.ts +13 -13
- package/dist/modes/select/behaviors/scale-feature.behavior.d.ts +13 -13
- package/dist/modes/select/behaviors/selection-point.behavior.d.ts +18 -18
- package/dist/modes/select/select.mode.d.ts +100 -62
- package/dist/modes/snapping.behavior.d.ts +13 -13
- package/dist/modes/static/static.mode.d.ts +32 -13
- package/dist/store/spatial-index/quickselect.d.ts +2 -2
- package/dist/store/spatial-index/rbush.d.ts +35 -35
- package/dist/store/spatial-index/spatial-index.d.ts +18 -18
- package/dist/store/store-feature-validation.d.ts +15 -0
- package/dist/store/store.d.ts +48 -48
- package/dist/terra-draw.cjs +1 -1
- package/dist/terra-draw.cjs.map +1 -1
- package/dist/terra-draw.d.ts +159 -47
- package/dist/terra-draw.modern.js +1 -1
- package/dist/terra-draw.modern.js.map +1 -1
- package/dist/terra-draw.module.js +1 -1
- package/dist/terra-draw.module.js.map +1 -1
- package/dist/terra-draw.umd.js +1 -1
- package/dist/terra-draw.umd.js.map +1 -1
- package/dist/util/geoms.d.ts +3 -3
- package/dist/util/id.d.ts +1 -1
- package/dist/util/styling.d.ts +2 -2
- package/{CONTRIBUTING.md → guides/CONTRIBUTING.md} +7 -7
- package/guides/DEVELOPMENT.md +156 -0
- package/guides/GETTING_STARTED.md +292 -0
- package/jest.config.ts +22 -22
- package/logo.png +0 -0
- package/package.json +151 -87
- package/readme.gif +0 -0
- package/scratch/release.sh +6 -0
- package/tsconfig.json +20 -12
- package/DEVELOPMENT.md +0 -77
- /package/{CODE_OF_CONDUCT.md → guides/CODE_OF_CONDUCT.md} +0 -0
package/dist/common.d.ts
CHANGED
|
@@ -1,99 +1,93 @@
|
|
|
1
|
-
import { StoreChangeHandler, GeoJSONStore, GeoJSONStoreFeatures } from "./store/store";
|
|
2
|
-
export
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
export
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
export
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
};
|
|
38
|
-
export
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
};
|
|
42
|
-
export interface TerraDrawModeRegisterConfig {
|
|
43
|
-
mode: string;
|
|
44
|
-
store: GeoJSONStore;
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
}
|
|
94
|
-
export declare const SELECT_PROPERTIES: {
|
|
95
|
-
readonly SELECTED: "selected";
|
|
96
|
-
readonly MID_POINT: "midPoint";
|
|
97
|
-
readonly SELECTION_POINT: "selectionPoint";
|
|
98
|
-
};
|
|
99
|
-
export {};
|
|
1
|
+
import { StoreChangeHandler, GeoJSONStore, GeoJSONStoreFeatures } from "./store/store";
|
|
2
|
+
export type HexColor = `#${string}`;
|
|
3
|
+
export interface TerraDrawAdapterStyling {
|
|
4
|
+
pointColor: HexColor;
|
|
5
|
+
pointWidth: number;
|
|
6
|
+
pointOutlineColor: HexColor;
|
|
7
|
+
pointOutlineWidth: number;
|
|
8
|
+
polygonFillColor: HexColor;
|
|
9
|
+
polygonFillOpacity: number;
|
|
10
|
+
polygonOutlineColor: HexColor;
|
|
11
|
+
polygonOutlineWidth: number;
|
|
12
|
+
lineStringWidth: number;
|
|
13
|
+
lineStringColor: HexColor;
|
|
14
|
+
zIndex: number;
|
|
15
|
+
}
|
|
16
|
+
export interface TerraDrawMouseEvent {
|
|
17
|
+
lng: number;
|
|
18
|
+
lat: number;
|
|
19
|
+
containerX: number;
|
|
20
|
+
containerY: number;
|
|
21
|
+
button: "neither" | "left" | "middle" | "right";
|
|
22
|
+
heldKeys: string[];
|
|
23
|
+
}
|
|
24
|
+
export interface TerraDrawKeyboardEvent {
|
|
25
|
+
key: string;
|
|
26
|
+
heldKeys: string[];
|
|
27
|
+
preventDefault: () => void;
|
|
28
|
+
}
|
|
29
|
+
export type SetCursor = (cursor: "unset" | "grab" | "grabbing" | "crosshair" | "pointer" | "wait") => void;
|
|
30
|
+
export type Project = (lng: number, lat: number) => {
|
|
31
|
+
x: number;
|
|
32
|
+
y: number;
|
|
33
|
+
};
|
|
34
|
+
export type Unproject = (x: number, y: number) => {
|
|
35
|
+
lat: number;
|
|
36
|
+
lng: number;
|
|
37
|
+
};
|
|
38
|
+
export type GetLngLatFromEvent = (event: PointerEvent | MouseEvent) => {
|
|
39
|
+
lng: number;
|
|
40
|
+
lat: number;
|
|
41
|
+
} | null;
|
|
42
|
+
export interface TerraDrawModeRegisterConfig {
|
|
43
|
+
mode: string;
|
|
44
|
+
store: GeoJSONStore;
|
|
45
|
+
setDoubleClickToZoom: (enabled: boolean) => void;
|
|
46
|
+
setCursor: SetCursor;
|
|
47
|
+
onChange: StoreChangeHandler;
|
|
48
|
+
onSelect: (selectedId: string) => void;
|
|
49
|
+
onDeselect: (deselectedId: string) => void;
|
|
50
|
+
onFinish: (finishedId: string) => void;
|
|
51
|
+
project: Project;
|
|
52
|
+
unproject: Unproject;
|
|
53
|
+
}
|
|
54
|
+
export type TerraDrawModeState = "unregistered" | "registered" | "started" | "drawing" | "selected" | "stopped";
|
|
55
|
+
export interface TerraDrawCallbacks {
|
|
56
|
+
getState: () => TerraDrawModeState;
|
|
57
|
+
onKeyUp: (event: TerraDrawKeyboardEvent) => void;
|
|
58
|
+
onKeyDown: (event: TerraDrawKeyboardEvent) => void;
|
|
59
|
+
onClick: (event: TerraDrawMouseEvent) => void;
|
|
60
|
+
onMouseMove: (event: TerraDrawMouseEvent) => void;
|
|
61
|
+
onDragStart: (event: TerraDrawMouseEvent, setMapDraggability: (enabled: boolean) => void) => void;
|
|
62
|
+
onDrag: (event: TerraDrawMouseEvent, setMapDraggability: (enabled: boolean) => void) => void;
|
|
63
|
+
onDragEnd: (event: TerraDrawMouseEvent, setMapDraggability: (enabled: boolean) => void) => void;
|
|
64
|
+
onClear: () => void;
|
|
65
|
+
}
|
|
66
|
+
export interface TerraDrawChanges {
|
|
67
|
+
created: GeoJSONStoreFeatures[];
|
|
68
|
+
updated: GeoJSONStoreFeatures[];
|
|
69
|
+
unchanged: GeoJSONStoreFeatures[];
|
|
70
|
+
deletedIds: string[];
|
|
71
|
+
}
|
|
72
|
+
export type TerraDrawStylingFunction = {
|
|
73
|
+
[mode: string]: (feature: GeoJSONStoreFeatures) => TerraDrawAdapterStyling;
|
|
74
|
+
};
|
|
75
|
+
export interface TerraDrawAdapter {
|
|
76
|
+
project: Project;
|
|
77
|
+
unproject: Unproject;
|
|
78
|
+
setCursor: SetCursor;
|
|
79
|
+
setDoubleClickToZoom: (enabled: boolean) => void;
|
|
80
|
+
getMapContainer: () => HTMLElement;
|
|
81
|
+
register(callbacks: TerraDrawCallbacks): void;
|
|
82
|
+
unregister(): void;
|
|
83
|
+
render(changes: TerraDrawChanges, styling: TerraDrawStylingFunction): void;
|
|
84
|
+
clear(): void;
|
|
85
|
+
}
|
|
86
|
+
export declare const SELECT_PROPERTIES: {
|
|
87
|
+
readonly SELECTED: "selected";
|
|
88
|
+
readonly MID_POINT: "midPoint";
|
|
89
|
+
readonly SELECTION_POINT: "selectionPoint";
|
|
90
|
+
};
|
|
91
|
+
export declare const POLYGON_PROPERTIES: {
|
|
92
|
+
CLOSING_POINT: string;
|
|
93
|
+
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { GetLngLatFromEvent, Project, SetCursor, TerraDrawChanges, TerraDrawStylingFunction, Unproject } from "./common";
|
|
2
|
+
import { BehaviorConfig } from "./modes/base.behavior";
|
|
3
|
+
import { GeoJSONStoreFeatures } from "./store/store";
|
|
4
|
+
export { BehaviorConfig, GeoJSONStoreFeatures, TerraDrawChanges, TerraDrawStylingFunction, Project, Unproject, SetCursor, GetLngLatFromEvent, };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare function validLatitude(lat: number): boolean;
|
|
2
|
+
export declare function validLongitude(lng: number): boolean;
|
|
3
|
+
export declare function coordinateIsValid(coordinate: unknown[], coordinatePrecision: number): boolean;
|
|
4
|
+
export declare function getDecimalPlaces(value: number): number;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { GeoJSONStoreFeatures } from "../../terra-draw";
|
|
2
|
+
export declare function isValidPolygonFeature(feature: GeoJSONStoreFeatures, coordinatePrecision: number): boolean;
|
|
3
|
+
export declare function isValidNonIntersectingPolygonFeature(feature: GeoJSONStoreFeatures, coordinatePrecision: number): boolean;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { Position } from "geojson";
|
|
2
|
-
export declare function pointInPolygon(point: Position, rings: Position[][]): boolean;
|
|
1
|
+
import { Position } from "geojson";
|
|
2
|
+
export declare function pointInPolygon(point: Position, rings: Position[][]): boolean;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { Feature, LineString, Polygon } from "geojson";
|
|
2
|
-
export declare function selfIntersects(feature: Feature<Polygon> | Feature<LineString>): boolean;
|
|
1
|
+
import { Feature, LineString, Polygon } from "geojson";
|
|
2
|
+
export declare function selfIntersects(feature: Feature<Polygon> | Feature<LineString>): boolean;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { Feature, LineString, Polygon, Position } from "geojson";
|
|
2
|
-
export declare function centroid(geojson: Feature<Polygon | LineString>): Position;
|
|
1
|
+
import { Feature, LineString, Polygon, Position } from "geojson";
|
|
2
|
+
export declare function centroid(geojson: Feature<Polygon | LineString>): Position;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { Position } from "geojson";
|
|
2
|
-
export declare function coordinatesIdentical(coordinate: Position, coordinateTwo: Position): boolean;
|
|
1
|
+
import { Position } from "geojson";
|
|
2
|
+
export declare function coordinatesIdentical(coordinate: Position, coordinateTwo: Position): boolean;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Point, Position } from "geojson";
|
|
2
|
-
import { JSONObject } from "../store/store";
|
|
3
|
-
export declare function getCoordinatesAsPoints(selectedCoords: Position[], geometryType: "Polygon" | "LineString", properties: (index: number) => JSONObject): {
|
|
4
|
-
geometry: Point;
|
|
5
|
-
properties: JSONObject;
|
|
6
|
-
}[];
|
|
1
|
+
import { Point, Position } from "geojson";
|
|
2
|
+
import { JSONObject } from "../store/store";
|
|
3
|
+
export declare function getCoordinatesAsPoints(selectedCoords: Position[], geometryType: "Polygon" | "LineString", properties: (index: number) => JSONObject): {
|
|
4
|
+
geometry: Point;
|
|
5
|
+
properties: JSONObject;
|
|
6
|
+
}[];
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { Point, Position } from "geojson";
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
export declare function
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { Point, Position } from "geojson";
|
|
2
|
+
import { Project, Unproject } from "../common";
|
|
3
|
+
import { JSONObject } from "../store/store";
|
|
4
|
+
export declare function getMidPointCoordinates(featureCoords: Position[], precision: number, project: Project, unproject: Unproject): Position[];
|
|
5
|
+
export declare function getMidPoints(selectedCoords: Position[], properties: (index: number) => JSONObject, precision: number, project: Project, unproject: Unproject): {
|
|
6
|
+
geometry: Point;
|
|
7
|
+
properties: JSONObject;
|
|
8
|
+
}[];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const earthRadius = 6371008.8;
|
|
2
|
-
export declare function degreesToRadians(degrees: number): number;
|
|
3
|
-
export declare function lengthToRadians(distance: number): number;
|
|
4
|
-
export declare function radiansToDegrees(radians: number): number;
|
|
1
|
+
export declare const earthRadius = 6371008.8;
|
|
2
|
+
export declare function degreesToRadians(degrees: number): number;
|
|
3
|
+
export declare function lengthToRadians(distance: number): number;
|
|
4
|
+
export declare function radiansToDegrees(radians: number): number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function limitPrecision(num: number, decimalLimit?: number): number;
|
|
1
|
+
export declare function limitPrecision(num: number, decimalLimit?: number): number;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { Position } from "geojson";
|
|
2
|
-
export declare function haversineDistanceKilometers(pointOne: Position, pointTwo: Position): number;
|
|
1
|
+
import { Position } from "geojson";
|
|
2
|
+
export declare function haversineDistanceKilometers(pointOne: Position, pointTwo: Position): number;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
export declare const pixelDistanceToLine: (point: {
|
|
2
|
-
x: number;
|
|
3
|
-
y: number;
|
|
4
|
-
}, linePointOne: {
|
|
5
|
-
x: number;
|
|
6
|
-
y: number;
|
|
7
|
-
}, linePointTwo: {
|
|
8
|
-
x: number;
|
|
9
|
-
y: number;
|
|
10
|
-
}) => number;
|
|
1
|
+
export declare const pixelDistanceToLine: (point: {
|
|
2
|
+
x: number;
|
|
3
|
+
y: number;
|
|
4
|
+
}, linePointOne: {
|
|
5
|
+
x: number;
|
|
6
|
+
y: number;
|
|
7
|
+
}, linePointTwo: {
|
|
8
|
+
x: number;
|
|
9
|
+
y: number;
|
|
10
|
+
}) => number;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export declare const pixelDistance: (pointOne: {
|
|
2
|
-
x: number;
|
|
3
|
-
y: number;
|
|
4
|
-
}, pointTwo: {
|
|
5
|
-
x: number;
|
|
6
|
-
y: number;
|
|
7
|
-
}) => number;
|
|
1
|
+
export declare const pixelDistance: (pointOne: {
|
|
2
|
+
x: number;
|
|
3
|
+
y: number;
|
|
4
|
+
}, pointTwo: {
|
|
5
|
+
x: number;
|
|
6
|
+
y: number;
|
|
7
|
+
}) => number;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { Position } from "geojson";
|
|
2
|
-
export declare function rhumbBearing(start: Position, end: Position): number;
|
|
1
|
+
import { Position } from "geojson";
|
|
2
|
+
export declare function rhumbBearing(start: Position, end: Position): number;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { Position } from "geojson";
|
|
2
|
-
export declare function rhumbDestination(origin: Position, distanceMeters: number, bearing: number): Position;
|
|
1
|
+
import { Position } from "geojson";
|
|
2
|
+
export declare function rhumbDestination(origin: Position, distanceMeters: number, bearing: number): Position;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { Position } from "geojson";
|
|
2
|
-
export declare function rhumbDistance(destination: Position, origin: Position): number;
|
|
1
|
+
import { Position } from "geojson";
|
|
2
|
+
export declare function rhumbDistance(destination: Position, origin: Position): number;
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
import { Position } from "geojson";
|
|
2
|
-
|
|
1
|
+
import { Position } from "geojson";
|
|
2
|
+
import { Project, Unproject } from "../common";
|
|
3
|
+
export declare function midpointCoordinate(coordinates1: Position, coordinates2: Position, precision: number, project: Project, unproject: Unproject): number[];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Feature, Polygon, Position } from "geojson";
|
|
2
|
-
export declare function
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
steps?: number;
|
|
7
|
-
}): Feature<Polygon>;
|
|
1
|
+
import { Feature, Polygon, Position } from "geojson";
|
|
2
|
+
export declare function circle(options: {
|
|
3
|
+
center: Position;
|
|
4
|
+
radiusKilometers: number;
|
|
5
|
+
coordinatePrecision: number;
|
|
6
|
+
steps?: number;
|
|
7
|
+
}): Feature<Polygon>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Feature, LineString, Position } from "geojson";
|
|
2
|
+
import { JSONObject } from "../../store/store";
|
|
3
|
+
export declare function greatCircleLine<Properties extends JSONObject>({ start, end, options, }: {
|
|
4
|
+
start: Position;
|
|
5
|
+
end: Position;
|
|
6
|
+
options?: {
|
|
7
|
+
numberOfPoints?: number;
|
|
8
|
+
offset?: number;
|
|
9
|
+
properties?: Properties;
|
|
10
|
+
coordinatePrecision?: number;
|
|
11
|
+
};
|
|
12
|
+
}): Feature<LineString, import("geojson").GeoJsonProperties> | null;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { Feature, LineString, Polygon } from "geojson";
|
|
2
|
-
export declare function transformRotate(geojson: Feature<Polygon | LineString>, angle: number): Feature<Polygon | LineString, import("geojson").GeoJsonProperties>;
|
|
1
|
+
import { Feature, LineString, Polygon } from "geojson";
|
|
2
|
+
export declare function transformRotate(geojson: Feature<Polygon | LineString>, angle: number): Feature<Polygon | LineString, import("geojson").GeoJsonProperties>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { Feature, LineString, Polygon } from "geojson";
|
|
2
|
-
export declare function transformScale(feature: Feature<Polygon | LineString>, factor: number): Feature<Polygon | LineString, import("geojson").GeoJsonProperties>;
|
|
1
|
+
import { Feature, LineString, Polygon } from "geojson";
|
|
2
|
+
export declare function transformScale(feature: Feature<Polygon | LineString>, factor: number): Feature<Polygon | LineString, import("geojson").GeoJsonProperties>;
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import { Project, Unproject } from "../common";
|
|
2
|
-
import { GeoJSONStore } from "../store/store";
|
|
3
|
-
export
|
|
4
|
-
store: GeoJSONStore;
|
|
5
|
-
mode: string;
|
|
6
|
-
project: Project;
|
|
7
|
-
unproject: Unproject;
|
|
8
|
-
pointerDistance: number;
|
|
9
|
-
coordinatePrecision: number;
|
|
10
|
-
};
|
|
11
|
-
export declare class TerraDrawModeBehavior {
|
|
12
|
-
protected store: GeoJSONStore;
|
|
13
|
-
protected mode: string;
|
|
14
|
-
protected project: Project;
|
|
15
|
-
protected unproject: Unproject;
|
|
16
|
-
protected pointerDistance: number;
|
|
17
|
-
protected coordinatePrecision: number;
|
|
18
|
-
constructor({ store, mode, project, unproject, pointerDistance, coordinatePrecision, }: BehaviorConfig);
|
|
19
|
-
}
|
|
1
|
+
import { Project, Unproject } from "../common";
|
|
2
|
+
import { GeoJSONStore } from "../store/store";
|
|
3
|
+
export type BehaviorConfig = {
|
|
4
|
+
store: GeoJSONStore;
|
|
5
|
+
mode: string;
|
|
6
|
+
project: Project;
|
|
7
|
+
unproject: Unproject;
|
|
8
|
+
pointerDistance: number;
|
|
9
|
+
coordinatePrecision: number;
|
|
10
|
+
};
|
|
11
|
+
export declare class TerraDrawModeBehavior {
|
|
12
|
+
protected store: GeoJSONStore;
|
|
13
|
+
protected mode: string;
|
|
14
|
+
protected project: Project;
|
|
15
|
+
protected unproject: Unproject;
|
|
16
|
+
protected pointerDistance: number;
|
|
17
|
+
protected coordinatePrecision: number;
|
|
18
|
+
constructor({ store, mode, project, unproject, pointerDistance, coordinatePrecision, }: BehaviorConfig);
|
|
19
|
+
}
|
|
@@ -1,30 +1,55 @@
|
|
|
1
|
-
import { BehaviorConfig, TerraDrawModeBehavior } from "./base.behavior";
|
|
2
|
-
import { TerraDrawAdapterStyling, TerraDrawModeRegisterConfig, TerraDrawModeState } from "../common";
|
|
3
|
-
import { GeoJSONStore } from "../store/store";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
protected
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
protected
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
protected
|
|
19
|
-
protected
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
protected
|
|
26
|
-
protected
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
1
|
+
import { BehaviorConfig, TerraDrawModeBehavior } from "./base.behavior";
|
|
2
|
+
import { TerraDrawAdapterStyling, TerraDrawKeyboardEvent, TerraDrawModeRegisterConfig, TerraDrawModeState, TerraDrawMouseEvent } from "../common";
|
|
3
|
+
import { GeoJSONStore, GeoJSONStoreFeatures, StoreChangeHandler } from "../store/store";
|
|
4
|
+
type CustomStyling = Record<string, string | number>;
|
|
5
|
+
export declare enum ModeTypes {
|
|
6
|
+
Drawing = "drawing",
|
|
7
|
+
Select = "select",
|
|
8
|
+
Static = "static",
|
|
9
|
+
Render = "render"
|
|
10
|
+
}
|
|
11
|
+
export declare abstract class TerraDrawBaseDrawMode<T extends CustomStyling> {
|
|
12
|
+
protected _state: TerraDrawModeState;
|
|
13
|
+
get state(): TerraDrawModeState;
|
|
14
|
+
set state(_: TerraDrawModeState);
|
|
15
|
+
protected _styles: Partial<T>;
|
|
16
|
+
get styles(): Partial<T>;
|
|
17
|
+
set styles(styling: Partial<T>);
|
|
18
|
+
protected behaviors: TerraDrawModeBehavior[];
|
|
19
|
+
protected pointerDistance: number;
|
|
20
|
+
protected coordinatePrecision: number;
|
|
21
|
+
protected onStyleChange: StoreChangeHandler;
|
|
22
|
+
protected store: GeoJSONStore;
|
|
23
|
+
protected setDoubleClickToZoom: TerraDrawModeRegisterConfig["setDoubleClickToZoom"];
|
|
24
|
+
protected unproject: TerraDrawModeRegisterConfig["unproject"];
|
|
25
|
+
protected project: TerraDrawModeRegisterConfig["project"];
|
|
26
|
+
protected setCursor: TerraDrawModeRegisterConfig["setCursor"];
|
|
27
|
+
protected registerBehaviors(behaviorConfig: BehaviorConfig): void;
|
|
28
|
+
constructor(options?: {
|
|
29
|
+
styles?: Partial<T>;
|
|
30
|
+
pointerDistance?: number;
|
|
31
|
+
coordinatePrecision?: number;
|
|
32
|
+
});
|
|
33
|
+
type: ModeTypes;
|
|
34
|
+
mode: string;
|
|
35
|
+
protected setDrawing(): void;
|
|
36
|
+
protected setStarted(): void;
|
|
37
|
+
protected setStopped(): void;
|
|
38
|
+
register(config: TerraDrawModeRegisterConfig): void;
|
|
39
|
+
validateFeature(feature: unknown): feature is GeoJSONStoreFeatures;
|
|
40
|
+
abstract start(): void;
|
|
41
|
+
abstract stop(): void;
|
|
42
|
+
abstract cleanUp(): void;
|
|
43
|
+
abstract styleFeature(feature: GeoJSONStoreFeatures): TerraDrawAdapterStyling;
|
|
44
|
+
onFinish(finishedId: string): void;
|
|
45
|
+
onDeselect(deselectedId: string): void;
|
|
46
|
+
onSelect(selectedId: string): void;
|
|
47
|
+
onKeyDown(event: TerraDrawKeyboardEvent): void;
|
|
48
|
+
onKeyUp(event: TerraDrawKeyboardEvent): void;
|
|
49
|
+
onMouseMove(event: TerraDrawMouseEvent): void;
|
|
50
|
+
onClick(event: TerraDrawMouseEvent): void;
|
|
51
|
+
onDragStart(event: TerraDrawMouseEvent, setMapDraggability: (enabled: boolean) => void): void;
|
|
52
|
+
onDrag(event: TerraDrawMouseEvent, setMapDraggability: (enabled: boolean) => void): void;
|
|
53
|
+
onDragEnd(event: TerraDrawMouseEvent, setMapDraggability: (enabled: boolean) => void): void;
|
|
54
|
+
}
|
|
55
|
+
export {};
|
|
@@ -1,27 +1,49 @@
|
|
|
1
|
-
import { TerraDrawMouseEvent, TerraDrawAdapterStyling, TerraDrawKeyboardEvent } from "../../common";
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
1
|
+
import { TerraDrawMouseEvent, TerraDrawAdapterStyling, TerraDrawKeyboardEvent, HexColor } from "../../common";
|
|
2
|
+
import { GeoJSONStoreFeatures } from "../../store/store";
|
|
3
|
+
import { TerraDrawBaseDrawMode } from "../base.mode";
|
|
4
|
+
type TerraDrawCircleModeKeyEvents = {
|
|
5
|
+
cancel: KeyboardEvent["key"] | null;
|
|
6
|
+
finish: KeyboardEvent["key"] | null;
|
|
7
|
+
};
|
|
8
|
+
type FreehandPolygonStyling = {
|
|
9
|
+
fillColor: HexColor;
|
|
10
|
+
outlineColor: HexColor;
|
|
11
|
+
outlineWidth: number;
|
|
12
|
+
fillOpacity: number;
|
|
13
|
+
};
|
|
14
|
+
export declare class TerraDrawCircleMode extends TerraDrawBaseDrawMode<FreehandPolygonStyling> {
|
|
15
|
+
mode: string;
|
|
16
|
+
private center;
|
|
17
|
+
private clickCount;
|
|
18
|
+
private currentCircleId;
|
|
19
|
+
private keyEvents;
|
|
20
|
+
constructor(options?: {
|
|
21
|
+
styles?: Partial<FreehandPolygonStyling>;
|
|
22
|
+
keyEvents?: TerraDrawCircleModeKeyEvents | null;
|
|
23
|
+
});
|
|
24
|
+
private close;
|
|
25
|
+
/** @internal */
|
|
26
|
+
start(): void;
|
|
27
|
+
/** @internal */
|
|
28
|
+
stop(): void;
|
|
29
|
+
/** @internal */
|
|
30
|
+
onClick(event: TerraDrawMouseEvent): void;
|
|
31
|
+
/** @internal */
|
|
32
|
+
onMouseMove(event: TerraDrawMouseEvent): void;
|
|
33
|
+
/** @internal */
|
|
34
|
+
onKeyDown(): void;
|
|
35
|
+
/** @internal */
|
|
36
|
+
onKeyUp(event: TerraDrawKeyboardEvent): void;
|
|
37
|
+
/** @internal */
|
|
38
|
+
onDragStart(): void;
|
|
39
|
+
/** @internal */
|
|
40
|
+
onDrag(): void;
|
|
41
|
+
/** @internal */
|
|
42
|
+
onDragEnd(): void;
|
|
43
|
+
/** @internal */
|
|
44
|
+
cleanUp(): void;
|
|
45
|
+
/** @internal */
|
|
46
|
+
styleFeature(feature: GeoJSONStoreFeatures): TerraDrawAdapterStyling;
|
|
47
|
+
validateFeature(feature: unknown): feature is GeoJSONStoreFeatures;
|
|
48
|
+
}
|
|
49
|
+
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Feature, Polygon } from "geojson";
|
|
2
|
-
import { BehaviorConfig, TerraDrawModeBehavior } from "./base.behavior";
|
|
3
|
-
import { TerraDrawMouseEvent } from "../common";
|
|
4
|
-
export declare class ClickBoundingBoxBehavior extends TerraDrawModeBehavior {
|
|
5
|
-
constructor(config: BehaviorConfig);
|
|
6
|
-
create(event: TerraDrawMouseEvent): Feature<Polygon, import("geojson").GeoJsonProperties>;
|
|
7
|
-
}
|
|
1
|
+
import { Feature, Polygon } from "geojson";
|
|
2
|
+
import { BehaviorConfig, TerraDrawModeBehavior } from "./base.behavior";
|
|
3
|
+
import { TerraDrawMouseEvent } from "../common";
|
|
4
|
+
export declare class ClickBoundingBoxBehavior extends TerraDrawModeBehavior {
|
|
5
|
+
constructor(config: BehaviorConfig);
|
|
6
|
+
create(event: TerraDrawMouseEvent): Feature<Polygon, import("geojson").GeoJsonProperties>;
|
|
7
|
+
}
|