terra-draw 0.0.1-alpha.5 → 0.0.1-alpha.50
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/.devcontainer/Dockerfile +8 -0
- package/.devcontainer/devcontainer.json +21 -0
- package/.devcontainer/post-create.sh +16 -0
- package/README.md +26 -4
- package/dist/adapters/common/adapter-listener.d.ts +22 -0
- package/dist/adapters/common/base.adapter.d.ts +52 -0
- package/dist/adapters/google-maps.adapter.d.ts +91 -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 +118 -0
- package/dist/common.d.ts +100 -99
- 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-bbox.d.ts +10 -0
- 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 +58 -30
- package/dist/modes/circle/circle.mode.d.ts +54 -27
- package/dist/modes/click-bounding-box.behavior.d.ts +6 -7
- package/dist/modes/freehand/freehand.mode.d.ts +63 -29
- package/dist/modes/great-circle-snapping.behavior.d.ts +13 -0
- package/dist/modes/greatcircle/great-circle.mode.d.ts +64 -0
- package/dist/modes/linestring/linestring.mode.d.ts +67 -34
- package/dist/modes/pixel-distance.behavior.d.ts +7 -7
- package/dist/modes/point/point.mode.d.ts +44 -18
- package/dist/modes/polygon/behaviors/closing-points.behavior.d.ts +19 -0
- package/dist/modes/polygon/polygon.mode.d.ts +70 -37
- package/dist/modes/rectangle/rectangle.mode.d.ts +55 -0
- package/dist/modes/render/render.mode.d.ts +51 -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/feature-at-pointer-event.behavior.d.ts +15 -0
- 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 +110 -62
- package/dist/modes/snapping.behavior.d.ts +15 -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 +183 -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/jest.nocheck.config.ts +9 -0
- package/package.json +156 -87
- package/readme.gif +0 -0
- package/tsconfig.json +20 -12
- package/CODE_OF_CONDUCT.md +0 -36
- package/CONTRIBUTING.md +0 -17
- package/DEVELOPMENT.md +0 -77
- package/dist/bundle.js +0 -6
- package/dist/bundle.js.LICENSE.txt +0 -4
- package/dist/geometry/create-circle.d.ts +0 -6
- package/dist/geometry/get-pixel-distance-to-line.d.ts +0 -10
- package/dist/geometry/get-pixel-distance.d.ts +0 -7
- package/dist/geometry/haversine-distance.d.ts +0 -1
- package/dist/geometry/point-in-polygon.d.ts +0 -1
- package/dist/geometry/self-intersects.d.ts +0 -2
- package/dist/modes/circle.mode.d.ts +0 -18
- package/dist/modes/freehand.mode.d.ts +0 -20
- package/dist/modes/line-string.mode.d.ts +0 -21
- package/dist/modes/point.mode.d.ts +0 -14
- package/dist/modes/polygon/behaviors/start-end-point.behavior.d.ts +0 -11
- package/dist/modes/polygon.mode.d.ts +0 -21
- package/dist/modes/select.mode.d.ts +0 -21
- package/dist/modes/static.mode.d.ts +0 -10
- package/jest.config.ts +0 -27
|
@@ -1,30 +1,58 @@
|
|
|
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 { HexColor, TerraDrawAdapterStyling, TerraDrawKeyboardEvent, TerraDrawModeRegisterConfig, TerraDrawModeState, TerraDrawMouseEvent } from "../common";
|
|
3
|
+
import { GeoJSONStore, GeoJSONStoreFeatures, StoreChangeHandler } from "../store/store";
|
|
4
|
+
type CustomStyling = Record<string, string | number | ((feature: GeoJSONStoreFeatures) => HexColor) | ((feature: GeoJSONStoreFeatures) => 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
|
+
protected getHexColorStylingValue(value: HexColor | ((feature: GeoJSONStoreFeatures) => HexColor) | undefined, defaultValue: HexColor, feature: GeoJSONStoreFeatures): HexColor;
|
|
55
|
+
protected getNumericStylingValue(value: number | ((feature: GeoJSONStoreFeatures) => number) | undefined, defaultValue: number, feature: GeoJSONStoreFeatures): number;
|
|
56
|
+
private getStylingValue;
|
|
57
|
+
}
|
|
58
|
+
export {};
|
|
@@ -1,27 +1,54 @@
|
|
|
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, HexColorStyling, NumericStyling, Cursor } 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 CirclePolygonStyling = {
|
|
9
|
+
fillColor: HexColorStyling;
|
|
10
|
+
outlineColor: HexColorStyling;
|
|
11
|
+
outlineWidth: NumericStyling;
|
|
12
|
+
fillOpacity: NumericStyling;
|
|
13
|
+
};
|
|
14
|
+
interface Cursors {
|
|
15
|
+
start?: Cursor;
|
|
16
|
+
}
|
|
17
|
+
export declare class TerraDrawCircleMode extends TerraDrawBaseDrawMode<CirclePolygonStyling> {
|
|
18
|
+
mode: string;
|
|
19
|
+
private center;
|
|
20
|
+
private clickCount;
|
|
21
|
+
private currentCircleId;
|
|
22
|
+
private keyEvents;
|
|
23
|
+
private cursors;
|
|
24
|
+
constructor(options?: {
|
|
25
|
+
styles?: Partial<CirclePolygonStyling>;
|
|
26
|
+
keyEvents?: TerraDrawCircleModeKeyEvents | null;
|
|
27
|
+
cursors?: Cursors;
|
|
28
|
+
});
|
|
29
|
+
private close;
|
|
30
|
+
/** @internal */
|
|
31
|
+
start(): void;
|
|
32
|
+
/** @internal */
|
|
33
|
+
stop(): void;
|
|
34
|
+
/** @internal */
|
|
35
|
+
onClick(event: TerraDrawMouseEvent): void;
|
|
36
|
+
/** @internal */
|
|
37
|
+
onMouseMove(event: TerraDrawMouseEvent): void;
|
|
38
|
+
/** @internal */
|
|
39
|
+
onKeyDown(): void;
|
|
40
|
+
/** @internal */
|
|
41
|
+
onKeyUp(event: TerraDrawKeyboardEvent): void;
|
|
42
|
+
/** @internal */
|
|
43
|
+
onDragStart(): void;
|
|
44
|
+
/** @internal */
|
|
45
|
+
onDrag(): void;
|
|
46
|
+
/** @internal */
|
|
47
|
+
onDragEnd(): void;
|
|
48
|
+
/** @internal */
|
|
49
|
+
cleanUp(): void;
|
|
50
|
+
/** @internal */
|
|
51
|
+
styleFeature(feature: GeoJSONStoreFeatures): TerraDrawAdapterStyling;
|
|
52
|
+
validateFeature(feature: unknown): feature is GeoJSONStoreFeatures;
|
|
53
|
+
}
|
|
54
|
+
export {};
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}
|
|
1
|
+
import { BehaviorConfig, TerraDrawModeBehavior } from "./base.behavior";
|
|
2
|
+
import { TerraDrawMouseEvent } from "../common";
|
|
3
|
+
export declare class ClickBoundingBoxBehavior extends TerraDrawModeBehavior {
|
|
4
|
+
constructor(config: BehaviorConfig);
|
|
5
|
+
create(event: TerraDrawMouseEvent): import("geojson").Feature<import("geojson").Polygon, import("geojson").GeoJsonProperties>;
|
|
6
|
+
}
|
|
@@ -1,29 +1,63 @@
|
|
|
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, HexColorStyling, NumericStyling, Cursor } 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: HexColorStyling;
|
|
10
|
+
outlineColor: HexColorStyling;
|
|
11
|
+
outlineWidth: NumericStyling;
|
|
12
|
+
fillOpacity: NumericStyling;
|
|
13
|
+
closingPointColor: HexColorStyling;
|
|
14
|
+
closingPointWidth: NumericStyling;
|
|
15
|
+
closingPointOutlineColor: HexColorStyling;
|
|
16
|
+
closingPointOutlineWidth: NumericStyling;
|
|
17
|
+
};
|
|
18
|
+
interface Cursors {
|
|
19
|
+
start?: Cursor;
|
|
20
|
+
close?: Cursor;
|
|
21
|
+
}
|
|
22
|
+
export declare class TerraDrawFreehandMode extends TerraDrawBaseDrawMode<FreehandPolygonStyling> {
|
|
23
|
+
mode: string;
|
|
24
|
+
private startingClick;
|
|
25
|
+
private currentId;
|
|
26
|
+
private closingPointId;
|
|
27
|
+
private minDistance;
|
|
28
|
+
private keyEvents;
|
|
29
|
+
private cursors;
|
|
30
|
+
private preventPointsNearClose;
|
|
31
|
+
constructor(options?: {
|
|
32
|
+
styles?: Partial<FreehandPolygonStyling>;
|
|
33
|
+
minDistance?: number;
|
|
34
|
+
preventPointsNearClose?: boolean;
|
|
35
|
+
keyEvents?: TerraDrawFreehandModeKeyEvents | null;
|
|
36
|
+
cursors?: Cursors;
|
|
37
|
+
});
|
|
38
|
+
private close;
|
|
39
|
+
/** @internal */
|
|
40
|
+
start(): void;
|
|
41
|
+
/** @internal */
|
|
42
|
+
stop(): void;
|
|
43
|
+
/** @internal */
|
|
44
|
+
onMouseMove(event: TerraDrawMouseEvent): void;
|
|
45
|
+
/** @internal */
|
|
46
|
+
onClick(event: TerraDrawMouseEvent): void;
|
|
47
|
+
/** @internal */
|
|
48
|
+
onKeyDown(): void;
|
|
49
|
+
/** @internal */
|
|
50
|
+
onKeyUp(event: TerraDrawKeyboardEvent): void;
|
|
51
|
+
/** @internal */
|
|
52
|
+
onDragStart(): void;
|
|
53
|
+
/** @internal */
|
|
54
|
+
onDrag(): void;
|
|
55
|
+
/** @internal */
|
|
56
|
+
onDragEnd(): void;
|
|
57
|
+
/** @internal */
|
|
58
|
+
cleanUp(): void;
|
|
59
|
+
/** @internal */
|
|
60
|
+
styleFeature(feature: GeoJSONStoreFeatures): TerraDrawAdapterStyling;
|
|
61
|
+
validateFeature(feature: unknown): feature is GeoJSONStoreFeatures;
|
|
62
|
+
}
|
|
63
|
+
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,64 @@
|
|
|
1
|
+
import { TerraDrawMouseEvent, TerraDrawAdapterStyling, TerraDrawKeyboardEvent, HexColorStyling, NumericStyling, Cursor } 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: NumericStyling;
|
|
11
|
+
lineStringColor: HexColorStyling;
|
|
12
|
+
closingPointColor: HexColorStyling;
|
|
13
|
+
closingPointWidth: NumericStyling;
|
|
14
|
+
closingPointOutlineColor: HexColorStyling;
|
|
15
|
+
closingPointOutlineWidth: NumericStyling;
|
|
16
|
+
};
|
|
17
|
+
interface Cursors {
|
|
18
|
+
start?: Cursor;
|
|
19
|
+
close?: Cursor;
|
|
20
|
+
}
|
|
21
|
+
export declare class TerraDrawGreatCircleMode extends TerraDrawBaseDrawMode<GreateCircleStyling> {
|
|
22
|
+
mode: string;
|
|
23
|
+
private currentCoordinate;
|
|
24
|
+
private currentId;
|
|
25
|
+
private closingPointId;
|
|
26
|
+
private keyEvents;
|
|
27
|
+
private snappingEnabled;
|
|
28
|
+
private cursors;
|
|
29
|
+
private snapping;
|
|
30
|
+
constructor(options?: {
|
|
31
|
+
snapping?: boolean;
|
|
32
|
+
pointerDistance?: number;
|
|
33
|
+
styles?: Partial<GreateCircleStyling>;
|
|
34
|
+
keyEvents?: TerraDrawGreateCircleModeKeyEvents | null;
|
|
35
|
+
cursors?: Cursors;
|
|
36
|
+
});
|
|
37
|
+
private close;
|
|
38
|
+
/** @internal */
|
|
39
|
+
registerBehaviors(config: BehaviorConfig): void;
|
|
40
|
+
/** @internal */
|
|
41
|
+
start(): void;
|
|
42
|
+
/** @internal */
|
|
43
|
+
stop(): void;
|
|
44
|
+
/** @internal */
|
|
45
|
+
onMouseMove(event: TerraDrawMouseEvent): void;
|
|
46
|
+
/** @internal */
|
|
47
|
+
onClick(event: TerraDrawMouseEvent): void;
|
|
48
|
+
/** @internal */
|
|
49
|
+
onKeyDown(): void;
|
|
50
|
+
/** @internal */
|
|
51
|
+
onKeyUp(event: TerraDrawKeyboardEvent): void;
|
|
52
|
+
/** @internal */
|
|
53
|
+
onDragStart(): void;
|
|
54
|
+
/** @internal */
|
|
55
|
+
onDrag(): void;
|
|
56
|
+
/** @internal */
|
|
57
|
+
onDragEnd(): void;
|
|
58
|
+
/** @internal */
|
|
59
|
+
cleanUp(): void;
|
|
60
|
+
/** @internal */
|
|
61
|
+
styleFeature(feature: GeoJSONStoreFeatures): TerraDrawAdapterStyling;
|
|
62
|
+
validateFeature(feature: unknown): feature is GeoJSONStoreFeatures;
|
|
63
|
+
}
|
|
64
|
+
export {};
|
|
@@ -1,34 +1,67 @@
|
|
|
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, HexColorStyling, NumericStyling, Cursor } 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: NumericStyling;
|
|
11
|
+
lineStringColor: HexColorStyling;
|
|
12
|
+
closingPointColor: HexColorStyling;
|
|
13
|
+
closingPointWidth: NumericStyling;
|
|
14
|
+
closingPointOutlineColor: HexColorStyling;
|
|
15
|
+
closingPointOutlineWidth: NumericStyling;
|
|
16
|
+
};
|
|
17
|
+
interface Cursors {
|
|
18
|
+
start?: Cursor;
|
|
19
|
+
close?: Cursor;
|
|
20
|
+
}
|
|
21
|
+
export declare class TerraDrawLineStringMode extends TerraDrawBaseDrawMode<LineStringStyling> {
|
|
22
|
+
mode: string;
|
|
23
|
+
private currentCoordinate;
|
|
24
|
+
private currentId;
|
|
25
|
+
private closingPointId;
|
|
26
|
+
private allowSelfIntersections;
|
|
27
|
+
private keyEvents;
|
|
28
|
+
private snappingEnabled;
|
|
29
|
+
private cursors;
|
|
30
|
+
private mouseMove;
|
|
31
|
+
private snapping;
|
|
32
|
+
constructor(options?: {
|
|
33
|
+
snapping?: boolean;
|
|
34
|
+
allowSelfIntersections?: boolean;
|
|
35
|
+
pointerDistance?: number;
|
|
36
|
+
styles?: Partial<LineStringStyling>;
|
|
37
|
+
keyEvents?: TerraDrawLineStringModeKeyEvents | null;
|
|
38
|
+
cursors?: Cursors;
|
|
39
|
+
});
|
|
40
|
+
private close;
|
|
41
|
+
/** @internal */
|
|
42
|
+
registerBehaviors(config: BehaviorConfig): void;
|
|
43
|
+
/** @internal */
|
|
44
|
+
start(): void;
|
|
45
|
+
/** @internal */
|
|
46
|
+
stop(): void;
|
|
47
|
+
/** @internal */
|
|
48
|
+
onMouseMove(event: TerraDrawMouseEvent): void;
|
|
49
|
+
/** @internal */
|
|
50
|
+
onClick(event: TerraDrawMouseEvent): void;
|
|
51
|
+
/** @internal */
|
|
52
|
+
onKeyDown(): void;
|
|
53
|
+
/** @internal */
|
|
54
|
+
onKeyUp(event: TerraDrawKeyboardEvent): void;
|
|
55
|
+
/** @internal */
|
|
56
|
+
onDragStart(): void;
|
|
57
|
+
/** @internal */
|
|
58
|
+
onDrag(): void;
|
|
59
|
+
/** @internal */
|
|
60
|
+
onDragEnd(): void;
|
|
61
|
+
/** @internal */
|
|
62
|
+
cleanUp(): void;
|
|
63
|
+
/** @internal */
|
|
64
|
+
styleFeature(feature: GeoJSONStoreFeatures): TerraDrawAdapterStyling;
|
|
65
|
+
validateFeature(feature: unknown): feature is GeoJSONStoreFeatures;
|
|
66
|
+
}
|
|
67
|
+
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { BehaviorConfig, TerraDrawModeBehavior } from "./base.behavior";
|
|
2
|
-
import { TerraDrawMouseEvent } from "../common";
|
|
3
|
-
import { Position } from "geojson";
|
|
4
|
-
export declare class PixelDistanceBehavior extends TerraDrawModeBehavior {
|
|
5
|
-
constructor(config: BehaviorConfig);
|
|
6
|
-
measure(clickEvent: TerraDrawMouseEvent, secondCoordinate: Position): number;
|
|
7
|
-
}
|
|
1
|
+
import { BehaviorConfig, TerraDrawModeBehavior } from "./base.behavior";
|
|
2
|
+
import { TerraDrawMouseEvent } from "../common";
|
|
3
|
+
import { Position } from "geojson";
|
|
4
|
+
export declare class PixelDistanceBehavior extends TerraDrawModeBehavior {
|
|
5
|
+
constructor(config: BehaviorConfig);
|
|
6
|
+
measure(clickEvent: TerraDrawMouseEvent, secondCoordinate: Position): number;
|
|
7
|
+
}
|
|
@@ -1,18 +1,44 @@
|
|
|
1
|
-
import { TerraDrawMouseEvent, TerraDrawAdapterStyling } from "../../common";
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
1
|
+
import { TerraDrawMouseEvent, TerraDrawAdapterStyling, NumericStyling, HexColorStyling, Cursor } from "../../common";
|
|
2
|
+
import { GeoJSONStoreFeatures } from "../../store/store";
|
|
3
|
+
import { TerraDrawBaseDrawMode } from "../base.mode";
|
|
4
|
+
type PointModeStyling = {
|
|
5
|
+
pointWidth: NumericStyling;
|
|
6
|
+
pointColor: HexColorStyling;
|
|
7
|
+
pointOutlineColor: HexColorStyling;
|
|
8
|
+
pointOutlineWidth: NumericStyling;
|
|
9
|
+
};
|
|
10
|
+
interface Cursors {
|
|
11
|
+
create?: Cursor;
|
|
12
|
+
}
|
|
13
|
+
export declare class TerraDrawPointMode extends TerraDrawBaseDrawMode<PointModeStyling> {
|
|
14
|
+
mode: string;
|
|
15
|
+
private cursors;
|
|
16
|
+
constructor(options?: {
|
|
17
|
+
styles?: Partial<PointModeStyling>;
|
|
18
|
+
cursors?: Cursors;
|
|
19
|
+
});
|
|
20
|
+
/** @internal */
|
|
21
|
+
start(): void;
|
|
22
|
+
/** @internal */
|
|
23
|
+
stop(): void;
|
|
24
|
+
/** @internal */
|
|
25
|
+
onClick(event: TerraDrawMouseEvent): void;
|
|
26
|
+
/** @internal */
|
|
27
|
+
onMouseMove(): void;
|
|
28
|
+
/** @internal */
|
|
29
|
+
onKeyDown(): void;
|
|
30
|
+
/** @internal */
|
|
31
|
+
onKeyUp(): void;
|
|
32
|
+
/** @internal */
|
|
33
|
+
cleanUp(): void;
|
|
34
|
+
/** @internal */
|
|
35
|
+
onDragStart(): void;
|
|
36
|
+
/** @internal */
|
|
37
|
+
onDrag(): void;
|
|
38
|
+
/** @internal */
|
|
39
|
+
onDragEnd(): void;
|
|
40
|
+
/** @internal */
|
|
41
|
+
styleFeature(feature: GeoJSONStoreFeatures): TerraDrawAdapterStyling;
|
|
42
|
+
validateFeature(feature: unknown): feature is GeoJSONStoreFeatures;
|
|
43
|
+
}
|
|
44
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Position } from "geojson";
|
|
2
|
+
import { BehaviorConfig, TerraDrawModeBehavior } from "../../base.behavior";
|
|
3
|
+
import { TerraDrawMouseEvent } from "../../../common";
|
|
4
|
+
import { PixelDistanceBehavior } from "../../pixel-distance.behavior";
|
|
5
|
+
export declare class ClosingPointsBehavior extends TerraDrawModeBehavior {
|
|
6
|
+
readonly config: BehaviorConfig;
|
|
7
|
+
private readonly pixelDistance;
|
|
8
|
+
constructor(config: BehaviorConfig, pixelDistance: PixelDistanceBehavior);
|
|
9
|
+
private _startEndPoints;
|
|
10
|
+
get ids(): string[];
|
|
11
|
+
set ids(_: string[]);
|
|
12
|
+
create(selectedCoords: Position[], mode: string): void;
|
|
13
|
+
delete(): void;
|
|
14
|
+
update(updatedCoordinates: Position[]): void;
|
|
15
|
+
isClosingPoint(event: TerraDrawMouseEvent): {
|
|
16
|
+
isClosing: boolean;
|
|
17
|
+
isPreviousClosing: boolean;
|
|
18
|
+
};
|
|
19
|
+
}
|