terra-draw 0.0.1-alpha.3 → 0.0.1-alpha.31
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 +323 -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 +85 -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 +91 -99
- package/dist/extend-types.d.ts +4 -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 +8 -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 +47 -30
- package/dist/modes/circle/circle.mode.d.ts +48 -27
- package/dist/modes/click-bounding-box.behavior.d.ts +7 -7
- package/dist/modes/freehand/freehand.mode.d.ts +54 -29
- package/dist/modes/great-circle-snapping.behavior.d.ts +13 -0
- package/dist/modes/greatcircle/great-circle.mode.d.ts +57 -0
- package/dist/modes/linestring/linestring.mode.d.ts +60 -34
- package/dist/modes/pixel-distance.behavior.d.ts +7 -7
- package/dist/modes/point/point.mode.d.ts +38 -18
- package/dist/modes/polygon/behaviors/closing-points.behavior.d.ts +19 -0
- package/dist/modes/polygon/polygon.mode.d.ts +63 -37
- package/dist/modes/rectangle/rectangle.mode.d.ts +49 -0
- package/dist/modes/render/render.mode.d.ts +36 -0
- package/dist/modes/select/behaviors/drag-coordinate.behavior.d.ts +13 -13
- package/dist/modes/select/behaviors/drag-feature.behavior.d.ts +17 -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 +89 -62
- package/dist/modes/snapping.behavior.d.ts +13 -13
- package/dist/modes/static/static.mode.d.ts +31 -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.d.ts +50 -48
- package/dist/terra-draw.cjs +1 -1
- package/dist/terra-draw.cjs.map +1 -1
- package/dist/terra-draw.d.ts +141 -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 +211 -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
|
@@ -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,8 @@
|
|
|
1
|
-
import { Feature, Polygon, Position } from "geojson";
|
|
2
|
-
export declare function destination(origin: Position, distance: number, bearing: number): Position;
|
|
3
|
-
export declare function circle(options: {
|
|
4
|
-
center: Position;
|
|
5
|
-
radiusKilometers: number;
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { Feature, Polygon, Position } from "geojson";
|
|
2
|
+
export declare function destination(origin: Position, distance: number, bearing: number): Position;
|
|
3
|
+
export declare function circle(options: {
|
|
4
|
+
center: Position;
|
|
5
|
+
radiusKilometers: number;
|
|
6
|
+
coordinatePrecision: number;
|
|
7
|
+
steps?: number;
|
|
8
|
+
}): 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,47 @@
|
|
|
1
|
-
import { BehaviorConfig, TerraDrawModeBehavior } from "./base.behavior";
|
|
2
|
-
import { TerraDrawAdapterStyling, TerraDrawModeRegisterConfig, TerraDrawModeState } from "../common";
|
|
3
|
-
import { GeoJSONStore } from "../store/store";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
get state(): TerraDrawModeState;
|
|
8
|
-
set state(_: TerraDrawModeState);
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
protected
|
|
13
|
-
protected
|
|
14
|
-
protected
|
|
15
|
-
protected
|
|
16
|
-
protected
|
|
17
|
-
protected
|
|
18
|
-
protected
|
|
19
|
-
protected
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
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 abstract class TerraDrawBaseDrawMode<T extends CustomStyling> {
|
|
6
|
+
protected _state: TerraDrawModeState;
|
|
7
|
+
get state(): TerraDrawModeState;
|
|
8
|
+
set state(_: TerraDrawModeState);
|
|
9
|
+
protected _styles: Partial<T>;
|
|
10
|
+
get styles(): Partial<T>;
|
|
11
|
+
set styles(styling: Partial<T>);
|
|
12
|
+
protected behaviors: TerraDrawModeBehavior[];
|
|
13
|
+
protected pointerDistance: number;
|
|
14
|
+
protected coordinatePrecision: number;
|
|
15
|
+
protected onStyleChange: StoreChangeHandler;
|
|
16
|
+
protected store: GeoJSONStore;
|
|
17
|
+
protected setDoubleClickToZoom: TerraDrawModeRegisterConfig["setDoubleClickToZoom"];
|
|
18
|
+
protected unproject: TerraDrawModeRegisterConfig["unproject"];
|
|
19
|
+
protected project: TerraDrawModeRegisterConfig["project"];
|
|
20
|
+
protected setCursor: TerraDrawModeRegisterConfig["setCursor"];
|
|
21
|
+
protected registerBehaviors(behaviorConfig: BehaviorConfig): void;
|
|
22
|
+
constructor(options?: {
|
|
23
|
+
styles?: Partial<T>;
|
|
24
|
+
pointerDistance?: number;
|
|
25
|
+
coordinatePrecision?: number;
|
|
26
|
+
});
|
|
27
|
+
mode: string;
|
|
28
|
+
protected setDrawing(): void;
|
|
29
|
+
protected setStarted(): void;
|
|
30
|
+
protected setStopped(): void;
|
|
31
|
+
register(config: TerraDrawModeRegisterConfig): void;
|
|
32
|
+
abstract start(): void;
|
|
33
|
+
abstract stop(): void;
|
|
34
|
+
abstract cleanUp(): void;
|
|
35
|
+
abstract styleFeature(feature: GeoJSONStoreFeatures): TerraDrawAdapterStyling;
|
|
36
|
+
onFinish(finishedId: string): void;
|
|
37
|
+
onDeselect(deselectedId: string): void;
|
|
38
|
+
onSelect(selectedId: string): void;
|
|
39
|
+
onKeyDown(event: TerraDrawKeyboardEvent): void;
|
|
40
|
+
onKeyUp(event: TerraDrawKeyboardEvent): void;
|
|
41
|
+
onMouseMove(event: TerraDrawMouseEvent): void;
|
|
42
|
+
onClick(event: TerraDrawMouseEvent): void;
|
|
43
|
+
onDragStart(event: TerraDrawMouseEvent, setMapDraggability: (enabled: boolean) => void): void;
|
|
44
|
+
onDrag(event: TerraDrawMouseEvent): void;
|
|
45
|
+
onDragEnd(event: TerraDrawMouseEvent, setMapDraggability: (enabled: boolean) => void): void;
|
|
46
|
+
}
|
|
47
|
+
export {};
|
|
@@ -1,27 +1,48 @@
|
|
|
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
|
+
}
|
|
48
|
+
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
|
+
}
|
|
@@ -1,29 +1,54 @@
|
|
|
1
|
-
import { TerraDrawMouseEvent, TerraDrawAdapterStyling, TerraDrawKeyboardEvent } from "../../common";
|
|
2
|
-
import { TerraDrawBaseDrawMode } from "../base.mode";
|
|
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
|
-
|
|
1
|
+
import { TerraDrawMouseEvent, TerraDrawAdapterStyling, TerraDrawKeyboardEvent, HexColor } from "../../common";
|
|
2
|
+
import { TerraDrawBaseDrawMode } from "../base.mode";
|
|
3
|
+
import { GeoJSONStoreFeatures } from "../../store/store";
|
|
4
|
+
type TerraDrawFreehandModeKeyEvents = {
|
|
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
|
+
closingPointColor: HexColor;
|
|
14
|
+
closingPointWidth: number;
|
|
15
|
+
closingPointOutlineColor: HexColor;
|
|
16
|
+
closingPointOutlineWidth: number;
|
|
17
|
+
};
|
|
18
|
+
export declare class TerraDrawFreehandMode extends TerraDrawBaseDrawMode<FreehandPolygonStyling> {
|
|
19
|
+
mode: string;
|
|
20
|
+
private startingClick;
|
|
21
|
+
private currentId;
|
|
22
|
+
private closingPointId;
|
|
23
|
+
private minDistance;
|
|
24
|
+
private keyEvents;
|
|
25
|
+
constructor(options?: {
|
|
26
|
+
styles?: Partial<FreehandPolygonStyling>;
|
|
27
|
+
minDistance?: number;
|
|
28
|
+
keyEvents?: TerraDrawFreehandModeKeyEvents | null;
|
|
29
|
+
});
|
|
30
|
+
private close;
|
|
31
|
+
/** @internal */
|
|
32
|
+
start(): void;
|
|
33
|
+
/** @internal */
|
|
34
|
+
stop(): void;
|
|
35
|
+
/** @internal */
|
|
36
|
+
onMouseMove(event: TerraDrawMouseEvent): void;
|
|
37
|
+
/** @internal */
|
|
38
|
+
onClick(event: TerraDrawMouseEvent): void;
|
|
39
|
+
/** @internal */
|
|
40
|
+
onKeyDown(): void;
|
|
41
|
+
/** @internal */
|
|
42
|
+
onKeyUp(event: TerraDrawKeyboardEvent): void;
|
|
43
|
+
/** @internal */
|
|
44
|
+
onDragStart(): void;
|
|
45
|
+
/** @internal */
|
|
46
|
+
onDrag(): void;
|
|
47
|
+
/** @internal */
|
|
48
|
+
onDragEnd(): void;
|
|
49
|
+
/** @internal */
|
|
50
|
+
cleanUp(): void;
|
|
51
|
+
/** @internal */
|
|
52
|
+
styleFeature(feature: GeoJSONStoreFeatures): TerraDrawAdapterStyling;
|
|
53
|
+
}
|
|
54
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { BehaviorConfig, TerraDrawModeBehavior } from "./base.behavior";
|
|
2
|
+
import { TerraDrawMouseEvent } from "../common";
|
|
3
|
+
import { Position } from "geojson";
|
|
4
|
+
import { ClickBoundingBoxBehavior } from "./click-bounding-box.behavior";
|
|
5
|
+
import { PixelDistanceBehavior } from "./pixel-distance.behavior";
|
|
6
|
+
export declare class GreatCircleSnappingBehavior extends TerraDrawModeBehavior {
|
|
7
|
+
readonly config: BehaviorConfig;
|
|
8
|
+
private readonly pixelDistance;
|
|
9
|
+
private readonly clickBoundingBox;
|
|
10
|
+
constructor(config: BehaviorConfig, pixelDistance: PixelDistanceBehavior, clickBoundingBox: ClickBoundingBoxBehavior);
|
|
11
|
+
getSnappableCoordinate: (event: TerraDrawMouseEvent, currentFeatureId?: string) => Position | undefined;
|
|
12
|
+
private getSnappableEnds;
|
|
13
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { TerraDrawMouseEvent, TerraDrawAdapterStyling, TerraDrawKeyboardEvent, HexColor } from "../../common";
|
|
2
|
+
import { TerraDrawBaseDrawMode } from "../base.mode";
|
|
3
|
+
import { BehaviorConfig } from "../base.behavior";
|
|
4
|
+
import { GeoJSONStoreFeatures } from "../../store/store";
|
|
5
|
+
type TerraDrawGreateCircleModeKeyEvents = {
|
|
6
|
+
cancel: KeyboardEvent["key"] | null;
|
|
7
|
+
finish: KeyboardEvent["key"] | null;
|
|
8
|
+
};
|
|
9
|
+
type GreateCircleStyling = {
|
|
10
|
+
lineStringWidth: number;
|
|
11
|
+
lineStringColor: HexColor;
|
|
12
|
+
closingPointColor: HexColor;
|
|
13
|
+
closingPointWidth: number;
|
|
14
|
+
closingPointOutlineColor: HexColor;
|
|
15
|
+
closingPointOutlineWidth: number;
|
|
16
|
+
};
|
|
17
|
+
export declare class TerraDrawGreatCircleMode extends TerraDrawBaseDrawMode<GreateCircleStyling> {
|
|
18
|
+
mode: string;
|
|
19
|
+
private currentCoordinate;
|
|
20
|
+
private currentId;
|
|
21
|
+
private closingPointId;
|
|
22
|
+
private keyEvents;
|
|
23
|
+
private snappingEnabled;
|
|
24
|
+
private snapping;
|
|
25
|
+
constructor(options?: {
|
|
26
|
+
snapping?: boolean;
|
|
27
|
+
pointerDistance?: number;
|
|
28
|
+
styles?: Partial<GreateCircleStyling>;
|
|
29
|
+
keyEvents?: TerraDrawGreateCircleModeKeyEvents | null;
|
|
30
|
+
});
|
|
31
|
+
private close;
|
|
32
|
+
/** @internal */
|
|
33
|
+
registerBehaviors(config: BehaviorConfig): void;
|
|
34
|
+
/** @internal */
|
|
35
|
+
start(): void;
|
|
36
|
+
/** @internal */
|
|
37
|
+
stop(): void;
|
|
38
|
+
/** @internal */
|
|
39
|
+
onMouseMove(event: TerraDrawMouseEvent): void;
|
|
40
|
+
/** @internal */
|
|
41
|
+
onClick(event: TerraDrawMouseEvent): void;
|
|
42
|
+
/** @internal */
|
|
43
|
+
onKeyDown(): void;
|
|
44
|
+
/** @internal */
|
|
45
|
+
onKeyUp(event: TerraDrawKeyboardEvent): void;
|
|
46
|
+
/** @internal */
|
|
47
|
+
onDragStart(): void;
|
|
48
|
+
/** @internal */
|
|
49
|
+
onDrag(): void;
|
|
50
|
+
/** @internal */
|
|
51
|
+
onDragEnd(): void;
|
|
52
|
+
/** @internal */
|
|
53
|
+
cleanUp(): void;
|
|
54
|
+
/** @internal */
|
|
55
|
+
styleFeature(feature: GeoJSONStoreFeatures): TerraDrawAdapterStyling;
|
|
56
|
+
}
|
|
57
|
+
export {};
|
|
@@ -1,34 +1,60 @@
|
|
|
1
|
-
import { TerraDrawMouseEvent, TerraDrawAdapterStyling, TerraDrawKeyboardEvent } from "../../common";
|
|
2
|
-
import { TerraDrawBaseDrawMode } from "../base.mode";
|
|
3
|
-
import { BehaviorConfig } from "../base.behavior";
|
|
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
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}
|
|
34
|
-
|
|
1
|
+
import { TerraDrawMouseEvent, TerraDrawAdapterStyling, TerraDrawKeyboardEvent, HexColor } from "../../common";
|
|
2
|
+
import { TerraDrawBaseDrawMode } from "../base.mode";
|
|
3
|
+
import { BehaviorConfig } from "../base.behavior";
|
|
4
|
+
import { GeoJSONStoreFeatures } from "../../store/store";
|
|
5
|
+
type TerraDrawLineStringModeKeyEvents = {
|
|
6
|
+
cancel: KeyboardEvent["key"] | null;
|
|
7
|
+
finish: KeyboardEvent["key"] | null;
|
|
8
|
+
};
|
|
9
|
+
type LineStringStyling = {
|
|
10
|
+
lineStringWidth: number;
|
|
11
|
+
lineStringColor: HexColor;
|
|
12
|
+
closingPointColor: HexColor;
|
|
13
|
+
closingPointWidth: number;
|
|
14
|
+
closingPointOutlineColor: HexColor;
|
|
15
|
+
closingPointOutlineWidth: number;
|
|
16
|
+
};
|
|
17
|
+
export declare class TerraDrawLineStringMode extends TerraDrawBaseDrawMode<LineStringStyling> {
|
|
18
|
+
mode: string;
|
|
19
|
+
private currentCoordinate;
|
|
20
|
+
private currentId;
|
|
21
|
+
private closingPointId;
|
|
22
|
+
private allowSelfIntersections;
|
|
23
|
+
private keyEvents;
|
|
24
|
+
private snappingEnabled;
|
|
25
|
+
private mouseMove;
|
|
26
|
+
private snapping;
|
|
27
|
+
constructor(options?: {
|
|
28
|
+
snapping?: boolean;
|
|
29
|
+
allowSelfIntersections?: boolean;
|
|
30
|
+
pointerDistance?: number;
|
|
31
|
+
styles?: Partial<LineStringStyling>;
|
|
32
|
+
keyEvents?: TerraDrawLineStringModeKeyEvents | null;
|
|
33
|
+
});
|
|
34
|
+
private close;
|
|
35
|
+
/** @internal */
|
|
36
|
+
registerBehaviors(config: BehaviorConfig): void;
|
|
37
|
+
/** @internal */
|
|
38
|
+
start(): void;
|
|
39
|
+
/** @internal */
|
|
40
|
+
stop(): void;
|
|
41
|
+
/** @internal */
|
|
42
|
+
onMouseMove(event: TerraDrawMouseEvent): void;
|
|
43
|
+
/** @internal */
|
|
44
|
+
onClick(event: TerraDrawMouseEvent): void;
|
|
45
|
+
/** @internal */
|
|
46
|
+
onKeyDown(): void;
|
|
47
|
+
/** @internal */
|
|
48
|
+
onKeyUp(event: TerraDrawKeyboardEvent): void;
|
|
49
|
+
/** @internal */
|
|
50
|
+
onDragStart(): void;
|
|
51
|
+
/** @internal */
|
|
52
|
+
onDrag(): void;
|
|
53
|
+
/** @internal */
|
|
54
|
+
onDragEnd(): void;
|
|
55
|
+
/** @internal */
|
|
56
|
+
cleanUp(): void;
|
|
57
|
+
/** @internal */
|
|
58
|
+
styleFeature(feature: GeoJSONStoreFeatures): TerraDrawAdapterStyling;
|
|
59
|
+
}
|
|
60
|
+
export {};
|