terra-draw 0.0.1-alpha.41 → 0.0.1-alpha.43
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 +165 -200
- package/dist/adapters/common/base-adapter.d.ts +31 -0
- package/dist/bundle.js +6 -0
- package/dist/bundle.js.LICENSE.txt +4 -0
- package/dist/common.d.ts +2 -0
- package/dist/extend-types.d.ts +4 -0
- package/dist/geometry/create-circle.d.ts +6 -0
- package/dist/geometry/get-pixel-distance-to-line.d.ts +10 -0
- package/dist/geometry/get-pixel-distance.d.ts +7 -0
- package/dist/geometry/haversine-distance.d.ts +1 -0
- package/dist/geometry/point-in-polygon.d.ts +1 -0
- package/dist/geometry/self-intersects.d.ts +2 -0
- package/dist/modes/base.mode.d.ts +5 -2
- package/dist/modes/circle/circle.mode.d.ts +5 -5
- package/dist/modes/circle.mode.d.ts +18 -0
- package/dist/modes/freehand/freehand.mode.d.ts +9 -9
- package/dist/modes/freehand.mode.d.ts +20 -0
- package/dist/modes/greatcircle/great-circle.mode.d.ts +7 -7
- package/dist/modes/line-string.mode.d.ts +21 -0
- package/dist/modes/linestring/linestring.mode.d.ts +7 -7
- package/dist/modes/point/point.mode.d.ts +5 -5
- package/dist/modes/point.mode.d.ts +14 -0
- package/dist/modes/polygon/behaviors/start-end-point.behavior.d.ts +11 -0
- package/dist/modes/polygon/polygon.mode.d.ts +9 -9
- package/dist/modes/polygon.mode.d.ts +21 -0
- package/dist/modes/rectangle/rectangle.mode.d.ts +5 -5
- package/dist/modes/render/render.mode.d.ts +16 -5
- package/dist/modes/select/select.mode.d.ts +19 -19
- package/dist/modes/select.mode.d.ts +21 -0
- package/dist/modes/static.mode.d.ts +10 -0
- package/dist/terra-draw.cjs +1 -1
- package/dist/terra-draw.cjs.map +1 -1
- 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/guides/GETTING_STARTED.md +40 -0
- package/package.json +1 -1
- package/scratch/release.sh +5 -0
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { Project, Unproject, TerraDrawCallbacks, TerraDrawChanges, TerraDrawMouseEvent, SetCursor, TerraDrawStylingFunction } from "../../common";
|
|
2
|
+
import { AdapterListener } from "./adapter-listener";
|
|
3
|
+
export declare abstract class TerraDrawAdapterBase {
|
|
4
|
+
constructor(config: {
|
|
5
|
+
coordinatePrecision?: number;
|
|
6
|
+
minPixelDragDistance?: number;
|
|
7
|
+
});
|
|
8
|
+
protected dragConter: number;
|
|
9
|
+
protected _minPixelDragDistance: number;
|
|
10
|
+
protected _lastDrawEvent: TerraDrawMouseEvent | undefined;
|
|
11
|
+
protected _coordinatePrecision: number;
|
|
12
|
+
protected _heldKeys: Set<string>;
|
|
13
|
+
protected listeners: AdapterListener[];
|
|
14
|
+
protected dragState: "not-dragging" | "pre-dragging" | "dragging";
|
|
15
|
+
protected currentModeCallbacks: TerraDrawCallbacks | undefined;
|
|
16
|
+
protected getButton(event: PointerEvent): "neither" | "left" | "middle" | "right";
|
|
17
|
+
protected getDrawEventFromPointerEvent(event: PointerEvent): TerraDrawMouseEvent;
|
|
18
|
+
abstract project(...args: Parameters<Project>): ReturnType<Project>;
|
|
19
|
+
abstract unproject(...args: Parameters<Unproject>): ReturnType<Unproject>;
|
|
20
|
+
abstract setCursor(...args: Parameters<SetCursor>): ReturnType<SetCursor>;
|
|
21
|
+
abstract getLngLatFromPointerEvent(event: PointerEvent): {
|
|
22
|
+
lng: number;
|
|
23
|
+
lat: number;
|
|
24
|
+
};
|
|
25
|
+
abstract setDraggability(enabled: boolean): void;
|
|
26
|
+
abstract setDoubleClickToZoom(enabled: boolean): void;
|
|
27
|
+
abstract getMapContainer(): HTMLElement;
|
|
28
|
+
abstract register(callbacks: TerraDrawCallbacks): void;
|
|
29
|
+
abstract unregister(): void;
|
|
30
|
+
abstract render(changes: TerraDrawChanges, styling: TerraDrawStylingFunction): void;
|
|
31
|
+
}
|
package/dist/bundle.js
ADDED
package/dist/common.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { StoreChangeHandler, GeoJSONStore, GeoJSONStoreFeatures } from "./store/store";
|
|
2
2
|
export type HexColor = `#${string}`;
|
|
3
|
+
export type HexColorStyling = HexColor | ((feature: GeoJSONStoreFeatures) => HexColor);
|
|
4
|
+
export type NumericStyling = number | ((feature: GeoJSONStoreFeatures) => number);
|
|
3
5
|
export interface TerraDrawAdapterStyling {
|
|
4
6
|
pointColor: HexColor;
|
|
5
7
|
pointWidth: number;
|
|
@@ -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 @@
|
|
|
1
|
+
export declare function haversineDistanceKilometers(pointOne: [lng: number, lat: number], pointTwo: [lng: number, lat: number]): number;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function pointInPolygon(point: [number, number], rings: [number, number][][]): boolean;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { BehaviorConfig, TerraDrawModeBehavior } from "./base.behavior";
|
|
2
|
-
import { TerraDrawAdapterStyling, TerraDrawKeyboardEvent, TerraDrawModeRegisterConfig, TerraDrawModeState, TerraDrawMouseEvent } from "../common";
|
|
2
|
+
import { HexColor, TerraDrawAdapterStyling, TerraDrawKeyboardEvent, TerraDrawModeRegisterConfig, TerraDrawModeState, TerraDrawMouseEvent } from "../common";
|
|
3
3
|
import { GeoJSONStore, GeoJSONStoreFeatures, StoreChangeHandler } from "../store/store";
|
|
4
|
-
type CustomStyling = Record<string, string | number>;
|
|
4
|
+
type CustomStyling = Record<string, string | number | ((feature: GeoJSONStoreFeatures) => HexColor) | ((feature: GeoJSONStoreFeatures) => number)>;
|
|
5
5
|
export declare enum ModeTypes {
|
|
6
6
|
Drawing = "drawing",
|
|
7
7
|
Select = "select",
|
|
@@ -51,5 +51,8 @@ export declare abstract class TerraDrawBaseDrawMode<T extends CustomStyling> {
|
|
|
51
51
|
onDragStart(event: TerraDrawMouseEvent, setMapDraggability: (enabled: boolean) => void): void;
|
|
52
52
|
onDrag(event: TerraDrawMouseEvent, setMapDraggability: (enabled: boolean) => void): void;
|
|
53
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;
|
|
54
57
|
}
|
|
55
58
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TerraDrawMouseEvent, TerraDrawAdapterStyling, TerraDrawKeyboardEvent,
|
|
1
|
+
import { TerraDrawMouseEvent, TerraDrawAdapterStyling, TerraDrawKeyboardEvent, HexColorStyling, NumericStyling } from "../../common";
|
|
2
2
|
import { GeoJSONStoreFeatures } from "../../store/store";
|
|
3
3
|
import { TerraDrawBaseDrawMode } from "../base.mode";
|
|
4
4
|
type TerraDrawCircleModeKeyEvents = {
|
|
@@ -6,10 +6,10 @@ type TerraDrawCircleModeKeyEvents = {
|
|
|
6
6
|
finish: KeyboardEvent["key"] | null;
|
|
7
7
|
};
|
|
8
8
|
type FreehandPolygonStyling = {
|
|
9
|
-
fillColor:
|
|
10
|
-
outlineColor:
|
|
11
|
-
outlineWidth:
|
|
12
|
-
fillOpacity:
|
|
9
|
+
fillColor: HexColorStyling;
|
|
10
|
+
outlineColor: HexColorStyling;
|
|
11
|
+
outlineWidth: NumericStyling;
|
|
12
|
+
fillOpacity: NumericStyling;
|
|
13
13
|
};
|
|
14
14
|
export declare class TerraDrawCircleMode extends TerraDrawBaseDrawMode<FreehandPolygonStyling> {
|
|
15
15
|
mode: string;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { TerraDrawMouseEvent, TerraDrawMode, TerraDrawModeRegisterConfig, TerraDrawAdapterStyling, TerraDrawKeyboardEvent } from "../common";
|
|
2
|
+
export declare class TerraDrawCircleMode implements TerraDrawMode {
|
|
3
|
+
mode: string;
|
|
4
|
+
private store;
|
|
5
|
+
private project;
|
|
6
|
+
private center;
|
|
7
|
+
private clickCount;
|
|
8
|
+
private currentCircleId;
|
|
9
|
+
constructor(options?: {
|
|
10
|
+
styling?: Partial<TerraDrawAdapterStyling>;
|
|
11
|
+
});
|
|
12
|
+
styling: TerraDrawAdapterStyling;
|
|
13
|
+
register(config: TerraDrawModeRegisterConfig): void;
|
|
14
|
+
onClick(event: TerraDrawMouseEvent): void;
|
|
15
|
+
onMouseMove(event: TerraDrawMouseEvent): void;
|
|
16
|
+
onKeyPress(event: TerraDrawKeyboardEvent): void;
|
|
17
|
+
cleanUp(): void;
|
|
18
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TerraDrawMouseEvent, TerraDrawAdapterStyling, TerraDrawKeyboardEvent,
|
|
1
|
+
import { TerraDrawMouseEvent, TerraDrawAdapterStyling, TerraDrawKeyboardEvent, HexColorStyling, NumericStyling } from "../../common";
|
|
2
2
|
import { TerraDrawBaseDrawMode } from "../base.mode";
|
|
3
3
|
import { GeoJSONStoreFeatures } from "../../store/store";
|
|
4
4
|
type TerraDrawFreehandModeKeyEvents = {
|
|
@@ -6,14 +6,14 @@ type TerraDrawFreehandModeKeyEvents = {
|
|
|
6
6
|
finish: KeyboardEvent["key"] | null;
|
|
7
7
|
};
|
|
8
8
|
type FreehandPolygonStyling = {
|
|
9
|
-
fillColor:
|
|
10
|
-
outlineColor:
|
|
11
|
-
outlineWidth:
|
|
12
|
-
fillOpacity:
|
|
13
|
-
closingPointColor:
|
|
14
|
-
closingPointWidth:
|
|
15
|
-
closingPointOutlineColor:
|
|
16
|
-
closingPointOutlineWidth:
|
|
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
17
|
};
|
|
18
18
|
export declare class TerraDrawFreehandMode extends TerraDrawBaseDrawMode<FreehandPolygonStyling> {
|
|
19
19
|
mode: string;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { TerraDrawMouseEvent, TerraDrawMode, TerraDrawModeRegisterConfig, TerraDrawAdapterStyling, TerraDrawKeyboardEvent } from "../common";
|
|
2
|
+
export declare class TerraDrawFreehandMode implements TerraDrawMode {
|
|
3
|
+
mode: string;
|
|
4
|
+
private store;
|
|
5
|
+
private project;
|
|
6
|
+
private startingClick;
|
|
7
|
+
private currentId;
|
|
8
|
+
private skip;
|
|
9
|
+
private everyNthMouseEvent;
|
|
10
|
+
constructor(options?: {
|
|
11
|
+
styling?: Partial<TerraDrawAdapterStyling>;
|
|
12
|
+
everyNthMouseEvent?: number;
|
|
13
|
+
});
|
|
14
|
+
styling: TerraDrawAdapterStyling;
|
|
15
|
+
register(config: TerraDrawModeRegisterConfig): void;
|
|
16
|
+
onMouseMove(event: TerraDrawMouseEvent): void;
|
|
17
|
+
onClick(event: TerraDrawMouseEvent): void;
|
|
18
|
+
onKeyPress(event: TerraDrawKeyboardEvent): void;
|
|
19
|
+
cleanUp(): void;
|
|
20
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TerraDrawMouseEvent, TerraDrawAdapterStyling, TerraDrawKeyboardEvent,
|
|
1
|
+
import { TerraDrawMouseEvent, TerraDrawAdapterStyling, TerraDrawKeyboardEvent, HexColorStyling, NumericStyling } from "../../common";
|
|
2
2
|
import { TerraDrawBaseDrawMode } from "../base.mode";
|
|
3
3
|
import { BehaviorConfig } from "../base.behavior";
|
|
4
4
|
import { GeoJSONStoreFeatures } from "../../store/store";
|
|
@@ -7,12 +7,12 @@ type TerraDrawGreateCircleModeKeyEvents = {
|
|
|
7
7
|
finish: KeyboardEvent["key"] | null;
|
|
8
8
|
};
|
|
9
9
|
type GreateCircleStyling = {
|
|
10
|
-
lineStringWidth:
|
|
11
|
-
lineStringColor:
|
|
12
|
-
closingPointColor:
|
|
13
|
-
closingPointWidth:
|
|
14
|
-
closingPointOutlineColor:
|
|
15
|
-
closingPointOutlineWidth:
|
|
10
|
+
lineStringWidth: NumericStyling;
|
|
11
|
+
lineStringColor: HexColorStyling;
|
|
12
|
+
closingPointColor: HexColorStyling;
|
|
13
|
+
closingPointWidth: NumericStyling;
|
|
14
|
+
closingPointOutlineColor: HexColorStyling;
|
|
15
|
+
closingPointOutlineWidth: NumericStyling;
|
|
16
16
|
};
|
|
17
17
|
export declare class TerraDrawGreatCircleMode extends TerraDrawBaseDrawMode<GreateCircleStyling> {
|
|
18
18
|
mode: string;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { TerraDrawMouseEvent, TerraDrawMode, TerraDrawModeRegisterConfig, TerraDrawAdapterStyling, TerraDrawKeyboardEvent } from "../common";
|
|
2
|
+
export declare class TerraDrawLineStringMode implements TerraDrawMode {
|
|
3
|
+
mode: string;
|
|
4
|
+
private store;
|
|
5
|
+
private project;
|
|
6
|
+
private pointerDistance;
|
|
7
|
+
private currentCoordinate;
|
|
8
|
+
private currentId;
|
|
9
|
+
private allowSelfIntersections;
|
|
10
|
+
constructor(options?: {
|
|
11
|
+
allowSelfIntersections?: boolean;
|
|
12
|
+
styling?: Partial<TerraDrawAdapterStyling>;
|
|
13
|
+
pointerDistance?: number;
|
|
14
|
+
});
|
|
15
|
+
styling: TerraDrawAdapterStyling;
|
|
16
|
+
register(config: TerraDrawModeRegisterConfig): void;
|
|
17
|
+
onMouseMove(event: TerraDrawMouseEvent): void;
|
|
18
|
+
onClick(event: TerraDrawMouseEvent): void;
|
|
19
|
+
onKeyPress(event: TerraDrawKeyboardEvent): void;
|
|
20
|
+
cleanUp(): void;
|
|
21
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TerraDrawMouseEvent, TerraDrawAdapterStyling, TerraDrawKeyboardEvent,
|
|
1
|
+
import { TerraDrawMouseEvent, TerraDrawAdapterStyling, TerraDrawKeyboardEvent, HexColorStyling, NumericStyling } from "../../common";
|
|
2
2
|
import { TerraDrawBaseDrawMode } from "../base.mode";
|
|
3
3
|
import { BehaviorConfig } from "../base.behavior";
|
|
4
4
|
import { GeoJSONStoreFeatures } from "../../store/store";
|
|
@@ -7,12 +7,12 @@ type TerraDrawLineStringModeKeyEvents = {
|
|
|
7
7
|
finish: KeyboardEvent["key"] | null;
|
|
8
8
|
};
|
|
9
9
|
type LineStringStyling = {
|
|
10
|
-
lineStringWidth:
|
|
11
|
-
lineStringColor:
|
|
12
|
-
closingPointColor:
|
|
13
|
-
closingPointWidth:
|
|
14
|
-
closingPointOutlineColor:
|
|
15
|
-
closingPointOutlineWidth:
|
|
10
|
+
lineStringWidth: NumericStyling;
|
|
11
|
+
lineStringColor: HexColorStyling;
|
|
12
|
+
closingPointColor: HexColorStyling;
|
|
13
|
+
closingPointWidth: NumericStyling;
|
|
14
|
+
closingPointOutlineColor: HexColorStyling;
|
|
15
|
+
closingPointOutlineWidth: NumericStyling;
|
|
16
16
|
};
|
|
17
17
|
export declare class TerraDrawLineStringMode extends TerraDrawBaseDrawMode<LineStringStyling> {
|
|
18
18
|
mode: string;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { TerraDrawMouseEvent, TerraDrawAdapterStyling,
|
|
1
|
+
import { TerraDrawMouseEvent, TerraDrawAdapterStyling, NumericStyling, HexColorStyling } from "../../common";
|
|
2
2
|
import { GeoJSONStoreFeatures } from "../../store/store";
|
|
3
3
|
import { TerraDrawBaseDrawMode } from "../base.mode";
|
|
4
4
|
type PointModeStyling = {
|
|
5
|
-
pointWidth:
|
|
6
|
-
pointColor:
|
|
7
|
-
pointOutlineColor:
|
|
8
|
-
pointOutlineWidth:
|
|
5
|
+
pointWidth: NumericStyling;
|
|
6
|
+
pointColor: HexColorStyling;
|
|
7
|
+
pointOutlineColor: HexColorStyling;
|
|
8
|
+
pointOutlineWidth: NumericStyling;
|
|
9
9
|
};
|
|
10
10
|
export declare class TerraDrawPointMode extends TerraDrawBaseDrawMode<PointModeStyling> {
|
|
11
11
|
mode: string;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { TerraDrawMouseEvent, TerraDrawMode, TerraDrawModeRegisterConfig, TerraDrawAdapterStyling } from "../common";
|
|
2
|
+
export declare class TerraDrawPointMode implements TerraDrawMode {
|
|
3
|
+
mode: string;
|
|
4
|
+
private store;
|
|
5
|
+
constructor(options?: {
|
|
6
|
+
styling?: Partial<TerraDrawAdapterStyling>;
|
|
7
|
+
});
|
|
8
|
+
styling: TerraDrawAdapterStyling;
|
|
9
|
+
register(config: TerraDrawModeRegisterConfig): void;
|
|
10
|
+
onClick(event: TerraDrawMouseEvent): void;
|
|
11
|
+
onMouseMove(): void;
|
|
12
|
+
onKeyPress(): void;
|
|
13
|
+
cleanUp(): void;
|
|
14
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Position } from "geojson";
|
|
2
|
+
import { BehaviorConfig, TerraDrawModeBehavior } from "../../base.behavior";
|
|
3
|
+
export declare class StartEndPointBehavior extends TerraDrawModeBehavior {
|
|
4
|
+
constructor(config: BehaviorConfig);
|
|
5
|
+
private _startEndPoints;
|
|
6
|
+
get ids(): string[];
|
|
7
|
+
set ids(_: string[]);
|
|
8
|
+
create(selectedCoords: Position[], mode: string): void;
|
|
9
|
+
delete(): void;
|
|
10
|
+
update(updatedCoordinates: Position[]): void;
|
|
11
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TerraDrawMouseEvent, TerraDrawAdapterStyling, TerraDrawKeyboardEvent,
|
|
1
|
+
import { TerraDrawMouseEvent, TerraDrawAdapterStyling, TerraDrawKeyboardEvent, HexColorStyling, NumericStyling } from "../../common";
|
|
2
2
|
import { TerraDrawBaseDrawMode } from "../base.mode";
|
|
3
3
|
import { BehaviorConfig } from "../base.behavior";
|
|
4
4
|
import { GeoJSONStoreFeatures } from "../../store/store";
|
|
@@ -7,14 +7,14 @@ type TerraDrawPolygonModeKeyEvents = {
|
|
|
7
7
|
finish?: KeyboardEvent["key"] | null;
|
|
8
8
|
};
|
|
9
9
|
type PolygonStyling = {
|
|
10
|
-
fillColor:
|
|
11
|
-
outlineColor:
|
|
12
|
-
outlineWidth:
|
|
13
|
-
fillOpacity:
|
|
14
|
-
closingPointWidth:
|
|
15
|
-
closingPointColor:
|
|
16
|
-
closingPointOutlineWidth:
|
|
17
|
-
closingPointOutlineColor:
|
|
10
|
+
fillColor: HexColorStyling;
|
|
11
|
+
outlineColor: HexColorStyling;
|
|
12
|
+
outlineWidth: NumericStyling;
|
|
13
|
+
fillOpacity: NumericStyling;
|
|
14
|
+
closingPointWidth: NumericStyling;
|
|
15
|
+
closingPointColor: HexColorStyling;
|
|
16
|
+
closingPointOutlineWidth: NumericStyling;
|
|
17
|
+
closingPointOutlineColor: HexColorStyling;
|
|
18
18
|
};
|
|
19
19
|
export declare class TerraDrawPolygonMode extends TerraDrawBaseDrawMode<PolygonStyling> {
|
|
20
20
|
mode: string;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { TerraDrawMouseEvent, TerraDrawMode, TerraDrawModeRegisterConfig, TerraDrawAdapterStyling, TerraDrawKeyboardEvent } from "../common";
|
|
2
|
+
export declare class TerraDrawPolygonMode implements TerraDrawMode {
|
|
3
|
+
mode: string;
|
|
4
|
+
private store;
|
|
5
|
+
private project;
|
|
6
|
+
private currentCoordinate;
|
|
7
|
+
private currentId;
|
|
8
|
+
private allowSelfIntersections;
|
|
9
|
+
private pointerDistance;
|
|
10
|
+
constructor(options?: {
|
|
11
|
+
allowSelfIntersections?: boolean;
|
|
12
|
+
styling?: Partial<TerraDrawAdapterStyling>;
|
|
13
|
+
pointerDistance?: number;
|
|
14
|
+
});
|
|
15
|
+
styling: TerraDrawAdapterStyling;
|
|
16
|
+
register(config: TerraDrawModeRegisterConfig): void;
|
|
17
|
+
onMouseMove(event: TerraDrawMouseEvent): void;
|
|
18
|
+
onClick(event: TerraDrawMouseEvent): void;
|
|
19
|
+
onKeyPress(event: TerraDrawKeyboardEvent): void;
|
|
20
|
+
cleanUp(): void;
|
|
21
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TerraDrawMouseEvent, TerraDrawAdapterStyling, TerraDrawKeyboardEvent,
|
|
1
|
+
import { TerraDrawMouseEvent, TerraDrawAdapterStyling, TerraDrawKeyboardEvent, HexColorStyling, NumericStyling } from "../../common";
|
|
2
2
|
import { GeoJSONStoreFeatures } from "../../store/store";
|
|
3
3
|
import { TerraDrawBaseDrawMode } from "../base.mode";
|
|
4
4
|
type TerraDrawRectangleModeKeyEvents = {
|
|
@@ -6,10 +6,10 @@ type TerraDrawRectangleModeKeyEvents = {
|
|
|
6
6
|
finish: KeyboardEvent["key"] | null;
|
|
7
7
|
};
|
|
8
8
|
type RectanglePolygonStyling = {
|
|
9
|
-
fillColor:
|
|
10
|
-
outlineColor:
|
|
11
|
-
outlineWidth:
|
|
12
|
-
fillOpacity:
|
|
9
|
+
fillColor: HexColorStyling;
|
|
10
|
+
outlineColor: HexColorStyling;
|
|
11
|
+
outlineWidth: NumericStyling;
|
|
12
|
+
fillOpacity: NumericStyling;
|
|
13
13
|
};
|
|
14
14
|
export declare class TerraDrawRectangleMode extends TerraDrawBaseDrawMode<RectanglePolygonStyling> {
|
|
15
15
|
mode: string;
|
|
@@ -1,14 +1,25 @@
|
|
|
1
|
-
import { TerraDrawAdapterStyling } from "../../common";
|
|
1
|
+
import { HexColorStyling, NumericStyling, TerraDrawAdapterStyling } from "../../common";
|
|
2
2
|
import { ModeTypes, TerraDrawBaseDrawMode } from "../base.mode";
|
|
3
3
|
import { BehaviorConfig } from "../base.behavior";
|
|
4
4
|
import { GeoJSONStoreFeatures } from "../../terra-draw";
|
|
5
|
-
type
|
|
6
|
-
|
|
5
|
+
type RenderModeStyling = {
|
|
6
|
+
pointColor: HexColorStyling;
|
|
7
|
+
pointWidth: NumericStyling;
|
|
8
|
+
pointOutlineColor: HexColorStyling;
|
|
9
|
+
pointOutlineWidth: NumericStyling;
|
|
10
|
+
polygonFillColor: HexColorStyling;
|
|
11
|
+
polygonFillOpacity: NumericStyling;
|
|
12
|
+
polygonOutlineColor: HexColorStyling;
|
|
13
|
+
polygonOutlineWidth: NumericStyling;
|
|
14
|
+
lineStringWidth: NumericStyling;
|
|
15
|
+
lineStringColor: HexColorStyling;
|
|
16
|
+
zIndex: NumericStyling;
|
|
17
|
+
};
|
|
7
18
|
export declare class TerraDrawRenderMode extends TerraDrawBaseDrawMode<RenderModeStyling> {
|
|
8
19
|
type: ModeTypes;
|
|
9
20
|
mode: string;
|
|
10
21
|
constructor(options: {
|
|
11
|
-
styles: Partial<
|
|
22
|
+
styles: Partial<RenderModeStyling>;
|
|
12
23
|
});
|
|
13
24
|
/** @internal */
|
|
14
25
|
registerBehaviors(behaviorConfig: BehaviorConfig): void;
|
|
@@ -33,7 +44,7 @@ export declare class TerraDrawRenderMode extends TerraDrawBaseDrawMode<RenderMod
|
|
|
33
44
|
/** @internal */
|
|
34
45
|
cleanUp(): void;
|
|
35
46
|
/** @internal */
|
|
36
|
-
styleFeature(): TerraDrawAdapterStyling;
|
|
47
|
+
styleFeature(feature: GeoJSONStoreFeatures): TerraDrawAdapterStyling;
|
|
37
48
|
validateFeature(feature: unknown): feature is GeoJSONStoreFeatures;
|
|
38
49
|
}
|
|
39
50
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TerraDrawMouseEvent, TerraDrawKeyboardEvent,
|
|
1
|
+
import { TerraDrawMouseEvent, TerraDrawKeyboardEvent, TerraDrawAdapterStyling, HexColorStyling, NumericStyling } from "../../common";
|
|
2
2
|
import { ModeTypes, TerraDrawBaseDrawMode } from "../base.mode";
|
|
3
3
|
import { BehaviorConfig } from "../base.behavior";
|
|
4
4
|
import { GeoJSONStoreFeatures } from "../../store/store";
|
|
@@ -21,24 +21,24 @@ type ModeFlags = {
|
|
|
21
21
|
};
|
|
22
22
|
};
|
|
23
23
|
type SelectionStyling = {
|
|
24
|
-
selectedPointColor:
|
|
25
|
-
selectedPointWidth:
|
|
26
|
-
selectedPointOutlineColor:
|
|
27
|
-
selectedPointOutlineWidth:
|
|
28
|
-
selectedLineStringColor:
|
|
29
|
-
selectedLineStringWidth:
|
|
30
|
-
selectedPolygonColor:
|
|
31
|
-
selectedPolygonFillOpacity:
|
|
32
|
-
selectedPolygonOutlineColor:
|
|
33
|
-
selectedPolygonOutlineWidth:
|
|
34
|
-
selectionPointWidth:
|
|
35
|
-
selectionPointColor:
|
|
36
|
-
selectionPointOutlineColor:
|
|
37
|
-
selectionPointOutlineWidth:
|
|
38
|
-
midPointColor:
|
|
39
|
-
midPointOutlineColor:
|
|
40
|
-
midPointWidth:
|
|
41
|
-
midPointOutlineWidth:
|
|
24
|
+
selectedPointColor: HexColorStyling;
|
|
25
|
+
selectedPointWidth: NumericStyling;
|
|
26
|
+
selectedPointOutlineColor: HexColorStyling;
|
|
27
|
+
selectedPointOutlineWidth: NumericStyling;
|
|
28
|
+
selectedLineStringColor: HexColorStyling;
|
|
29
|
+
selectedLineStringWidth: NumericStyling;
|
|
30
|
+
selectedPolygonColor: HexColorStyling;
|
|
31
|
+
selectedPolygonFillOpacity: NumericStyling;
|
|
32
|
+
selectedPolygonOutlineColor: HexColorStyling;
|
|
33
|
+
selectedPolygonOutlineWidth: NumericStyling;
|
|
34
|
+
selectionPointWidth: NumericStyling;
|
|
35
|
+
selectionPointColor: HexColorStyling;
|
|
36
|
+
selectionPointOutlineColor: HexColorStyling;
|
|
37
|
+
selectionPointOutlineWidth: NumericStyling;
|
|
38
|
+
midPointColor: HexColorStyling;
|
|
39
|
+
midPointOutlineColor: HexColorStyling;
|
|
40
|
+
midPointWidth: NumericStyling;
|
|
41
|
+
midPointOutlineWidth: NumericStyling;
|
|
42
42
|
};
|
|
43
43
|
export declare class TerraDrawSelectMode extends TerraDrawBaseDrawMode<SelectionStyling> {
|
|
44
44
|
type: ModeTypes;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { TerraDrawMouseEvent, TerraDrawMode, TerraDrawModeRegisterConfig, TerraDrawKeyboardEvent, TerraDrawAdapterStyling } from "../common";
|
|
2
|
+
export declare class TerraDrawSelectMode implements TerraDrawMode {
|
|
3
|
+
mode: string;
|
|
4
|
+
private store;
|
|
5
|
+
private project;
|
|
6
|
+
private selected;
|
|
7
|
+
private pointerDistance;
|
|
8
|
+
private selectionPoints;
|
|
9
|
+
constructor(options?: {
|
|
10
|
+
styling?: Partial<TerraDrawAdapterStyling>;
|
|
11
|
+
pointerDistance?: number;
|
|
12
|
+
});
|
|
13
|
+
styling: TerraDrawAdapterStyling;
|
|
14
|
+
onClick(event: TerraDrawMouseEvent): void;
|
|
15
|
+
onKeyPress(event: TerraDrawKeyboardEvent): void;
|
|
16
|
+
cleanUp(): void;
|
|
17
|
+
onMouseMove(): void;
|
|
18
|
+
register(config: TerraDrawModeRegisterConfig): void;
|
|
19
|
+
onDeselect(deselectedId: string): void;
|
|
20
|
+
onSelect(selectedId: string): void;
|
|
21
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { TerraDrawAdapterStyling, TerraDrawMode } from "../common";
|
|
2
|
+
export declare class TerraDrawStaticMode implements TerraDrawMode {
|
|
3
|
+
mode: string;
|
|
4
|
+
styling: TerraDrawAdapterStyling;
|
|
5
|
+
register(): void;
|
|
6
|
+
onKeyPress(): void;
|
|
7
|
+
onClick(): void;
|
|
8
|
+
onMouseMove(): void;
|
|
9
|
+
cleanUp(): void;
|
|
10
|
+
}
|