leaflet-polydraw 0.8.5
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/LICENCE +21 -0
- package/README.md +1006 -0
- package/dist/icons/icon-activate.svg +1 -0
- package/dist/icons/icon-add-elbow.svg +128 -0
- package/dist/icons/icon-bbox.svg +47 -0
- package/dist/icons/icon-bezier.svg +132 -0
- package/dist/icons/icon-draw.svg +1 -0
- package/dist/icons/icon-erase.svg +3 -0
- package/dist/icons/icon-info-white.svg +25 -0
- package/dist/icons/icon-settings-white.svg +15 -0
- package/dist/icons/icon-simplify.svg +61 -0
- package/dist/icons/icon-simplify2.svg +46 -0
- package/dist/icons/icon-subtract.svg +1 -0
- package/dist/icons/icon-trash-hover-white.svg +16 -0
- package/dist/icons/icon-trash-white.svg +16 -0
- package/dist/leaflet-polydraw.css +1 -0
- package/dist/polydraw.es.js +20688 -0
- package/dist/polydraw.es.js.map +1 -0
- package/dist/polydraw.umd.min.js +2 -0
- package/dist/polydraw.umd.min.js.map +1 -0
- package/dist/styles/polydraw.css +419 -0
- package/dist/types/buttons.d.ts +14 -0
- package/dist/types/buttons.d.ts.map +1 -0
- package/dist/types/coordinate-utils.d.ts +21 -0
- package/dist/types/coordinate-utils.d.ts.map +1 -0
- package/dist/types/enums.d.ts +27 -0
- package/dist/types/enums.d.ts.map +1 -0
- package/dist/types/geometry-utils.d.ts +24 -0
- package/dist/types/geometry-utils.d.ts.map +1 -0
- package/dist/types/icon-factory.d.ts +13 -0
- package/dist/types/icon-factory.d.ts.map +1 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/managers/mode-manager.d.ts +91 -0
- package/dist/types/managers/mode-manager.d.ts.map +1 -0
- package/dist/types/managers/polygon-draw-manager.d.ts +88 -0
- package/dist/types/managers/polygon-draw-manager.d.ts.map +1 -0
- package/dist/types/managers/polygon-geometry-manager.d.ts +75 -0
- package/dist/types/managers/polygon-geometry-manager.d.ts.map +1 -0
- package/dist/types/managers/polygon-interaction-manager.d.ts +116 -0
- package/dist/types/managers/polygon-interaction-manager.d.ts.map +1 -0
- package/dist/types/managers/polygon-mutation-manager.d.ts +163 -0
- package/dist/types/managers/polygon-mutation-manager.d.ts.map +1 -0
- package/dist/types/map-state.d.ts +22 -0
- package/dist/types/map-state.d.ts.map +1 -0
- package/dist/types/polydraw.d.ts +87 -0
- package/dist/types/polydraw.d.ts.map +1 -0
- package/dist/types/polygon-helpers.d.ts +35 -0
- package/dist/types/polygon-helpers.d.ts.map +1 -0
- package/dist/types/polygon-information.service.d.ts +27 -0
- package/dist/types/polygon-information.service.d.ts.map +1 -0
- package/dist/types/polygon.util.d.ts +32 -0
- package/dist/types/polygon.util.d.ts.map +1 -0
- package/dist/types/turf-helper.d.ts +141 -0
- package/dist/types/turf-helper.d.ts.map +1 -0
- package/dist/types/types/polydraw-interfaces.d.ts +351 -0
- package/dist/types/types/polydraw-interfaces.d.ts.map +1 -0
- package/dist/types/utils.d.ts +57 -0
- package/dist/types/utils.d.ts.map +1 -0
- package/package.json +79 -0
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import * as L from 'leaflet';
|
|
2
|
+
/**
|
|
3
|
+
* Utility class for polygon calculations.
|
|
4
|
+
*/
|
|
5
|
+
export declare class PolygonUtil {
|
|
6
|
+
private static turfHelper;
|
|
7
|
+
/**
|
|
8
|
+
* Calculates the center of the polygon.
|
|
9
|
+
* @param polygon Array of LatLng points.
|
|
10
|
+
* @returns The center LatLng.
|
|
11
|
+
*/
|
|
12
|
+
static getCenter(polygon: L.LatLngLiteral[]): L.LatLngLiteral;
|
|
13
|
+
/**
|
|
14
|
+
* Gets the southwest point of the polygon bounds.
|
|
15
|
+
* @param polygon Array of LatLng points.
|
|
16
|
+
* @returns The southwest LatLng.
|
|
17
|
+
*/
|
|
18
|
+
static getSouthWest(polygon: L.LatLngLiteral[]): L.LatLngLiteral;
|
|
19
|
+
static getNorthEast(polygon: L.LatLngLiteral[]): L.LatLngLiteral;
|
|
20
|
+
static getNorthWest(polygon: L.LatLngLiteral[]): L.LatLngLiteral;
|
|
21
|
+
static getSouthEast(polygon: L.LatLngLiteral[]): L.LatLngLiteral;
|
|
22
|
+
static getNorth(polygon: L.LatLngLiteral[]): number;
|
|
23
|
+
static getSouth(polygon: L.LatLngLiteral[]): number;
|
|
24
|
+
static getWest(polygon: L.LatLngLiteral[]): number;
|
|
25
|
+
static getEast(polygon: L.LatLngLiteral[]): number;
|
|
26
|
+
static getSqmArea(polygon: L.LatLngLiteral[]): number;
|
|
27
|
+
static getPerimeter(polygon: L.LatLngLiteral[]): number;
|
|
28
|
+
static getPolygonChecksum(polygon: L.LatLngLiteral[]): number;
|
|
29
|
+
static getMidPoint(point1: L.LatLngLiteral, point2: L.LatLngLiteral): L.LatLngLiteral;
|
|
30
|
+
static getBounds(polygon: L.LatLngLiteral[]): L.LatLngBounds;
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=polygon.util.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"polygon.util.d.ts","sourceRoot":"","sources":["../../src/polygon.util.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAC;AAI7B;;GAEG;AACH,qBAAa,WAAW;IACtB,OAAO,CAAC,MAAM,CAAC,UAAU,CAAiC;IAE1D;;;;OAIG;IACH,MAAM,CAAC,SAAS,CAAC,OAAO,EAAE,CAAC,CAAC,aAAa,EAAE;IAyB3C;;;;OAIG;IACH,MAAM,CAAC,YAAY,CAAC,OAAO,EAAE,CAAC,CAAC,aAAa,EAAE,GAAG,CAAC,CAAC,aAAa;IAIhE,MAAM,CAAC,YAAY,CAAC,OAAO,EAAE,CAAC,CAAC,aAAa,EAAE,GAAG,CAAC,CAAC,aAAa;IAIhE,MAAM,CAAC,YAAY,CAAC,OAAO,EAAE,CAAC,CAAC,aAAa,EAAE,GAAG,CAAC,CAAC,aAAa;IAIhE,MAAM,CAAC,YAAY,CAAC,OAAO,EAAE,CAAC,CAAC,aAAa,EAAE,GAAG,CAAC,CAAC,aAAa;IAIhE,MAAM,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAC,aAAa,EAAE,GAAG,MAAM;IAInD,MAAM,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAC,aAAa,EAAE,GAAG,MAAM;IAInD,MAAM,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC,aAAa,EAAE,GAAG,MAAM;IAIlD,MAAM,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC,aAAa,EAAE,GAAG,MAAM;IAIlD,MAAM,CAAC,UAAU,CAAC,OAAO,EAAE,CAAC,CAAC,aAAa,EAAE,GAAG,MAAM;IAQrD,MAAM,CAAC,YAAY,CAAC,OAAO,EAAE,CAAC,CAAC,aAAa,EAAE,GAAG,MAAM;IAQvD,MAAM,CAAC,kBAAkB,CAAC,OAAO,EAAE,CAAC,CAAC,aAAa,EAAE,GAAG,MAAM;IAU7D,MAAM,CAAC,WAAW,CAAC,MAAM,EAAE,CAAC,CAAC,aAAa,EAAE,MAAM,EAAE,CAAC,CAAC,aAAa,GAAG,CAAC,CAAC,aAAa;IAUrF,MAAM,CAAC,SAAS,CAAC,OAAO,EAAE,CAAC,CAAC,aAAa,EAAE,GAAG,CAAC,CAAC,YAAY;CAe7D"}
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import * as turf from '@turf/turf';
|
|
2
|
+
import type { Feature, Polygon, MultiPolygon, Position } from 'geojson';
|
|
3
|
+
import * as L from 'leaflet';
|
|
4
|
+
export declare class TurfHelper {
|
|
5
|
+
private config;
|
|
6
|
+
constructor(config: object);
|
|
7
|
+
union(poly1: Feature<Polygon | MultiPolygon>, poly2: Feature<Polygon | MultiPolygon>): Feature<Polygon | MultiPolygon>;
|
|
8
|
+
/**
|
|
9
|
+
* Create polygon from drawing trace using configured method
|
|
10
|
+
*/
|
|
11
|
+
createPolygonFromTrace(feature: Feature<any>): Feature<Polygon | MultiPolygon>;
|
|
12
|
+
/**
|
|
13
|
+
* Original concaveman implementation
|
|
14
|
+
*/
|
|
15
|
+
turfConcaveman(feature: Feature<Polygon | MultiPolygon>): Feature<Polygon | MultiPolygon>;
|
|
16
|
+
/**
|
|
17
|
+
* Create convex hull polygon (simplest, fewest edges)
|
|
18
|
+
*/
|
|
19
|
+
private createConvexPolygon;
|
|
20
|
+
/**
|
|
21
|
+
* Create polygon directly from line coordinates (moderate edge count)
|
|
22
|
+
*/
|
|
23
|
+
private createDirectPolygon;
|
|
24
|
+
/**
|
|
25
|
+
* Create polygon using buffer method (smooth curves)
|
|
26
|
+
*/
|
|
27
|
+
private createBufferedPolygon;
|
|
28
|
+
getSimplified(polygon: Feature<Polygon | MultiPolygon>, dynamicTolerance?: boolean): Feature<Polygon | MultiPolygon>;
|
|
29
|
+
getTurfPolygon(polygon: Feature<Polygon | MultiPolygon>): Feature<Polygon | MultiPolygon>;
|
|
30
|
+
getMultiPolygon(polygonArray: Position[][][]): Feature<Polygon | MultiPolygon>;
|
|
31
|
+
getKinks(feature: Feature<Polygon | MultiPolygon>): any[];
|
|
32
|
+
getCoords(feature: Feature<Polygon | MultiPolygon>): any[];
|
|
33
|
+
hasKinks(feature: Feature<Polygon | MultiPolygon>): boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Get the convex hull of a polygon
|
|
36
|
+
*/
|
|
37
|
+
getConvexHull(polygon: Feature<Polygon | MultiPolygon>): Feature<Polygon> | null;
|
|
38
|
+
/**
|
|
39
|
+
* Calculate midpoint between two LatLngLiteral points
|
|
40
|
+
*/
|
|
41
|
+
getMidpoint(point1: L.LatLngLiteral, point2: L.LatLngLiteral): L.LatLngLiteral;
|
|
42
|
+
polygonIntersect(polygon: Feature<Polygon | MultiPolygon>, latlngs: Feature<Polygon | MultiPolygon>): boolean;
|
|
43
|
+
getIntersection(poly1: Feature<Polygon | MultiPolygon>, poly2: Feature<Polygon | MultiPolygon>): Feature<Polygon | MultiPolygon> | null;
|
|
44
|
+
getDistance(point1: any, point2: any): number;
|
|
45
|
+
isWithin(polygon1: Position[], polygon2: Position[]): boolean;
|
|
46
|
+
/**
|
|
47
|
+
* Check if one polygon is completely within another polygon
|
|
48
|
+
*/
|
|
49
|
+
isPolygonCompletelyWithin(innerPolygon: Feature<Polygon | MultiPolygon>, outerPolygon: Feature<Polygon | MultiPolygon>): boolean;
|
|
50
|
+
/**
|
|
51
|
+
* Checks if two polygons are equal.
|
|
52
|
+
* @param polygon1 First polygon.
|
|
53
|
+
* @param polygon2 Second polygon.
|
|
54
|
+
*/
|
|
55
|
+
equalPolygons(polygon1: Feature<Polygon | MultiPolygon>, polygon2: Feature<Polygon | MultiPolygon>): void;
|
|
56
|
+
convertToBoundingBoxPolygon(polygon: Feature<Polygon | MultiPolygon>): Feature<Polygon>;
|
|
57
|
+
polygonToMultiPolygon(poly: Feature<Polygon>): Feature<MultiPolygon>;
|
|
58
|
+
injectPointToPolygon(polygon: any, point: any): any;
|
|
59
|
+
private distanceToLineSegment;
|
|
60
|
+
polygonDifference(polygon1: Feature<Polygon | MultiPolygon>, polygon2: Feature<Polygon | MultiPolygon>): Feature<Polygon | MultiPolygon>;
|
|
61
|
+
getBoundingBoxCompassPosition(polygon: any, MarkerPosition: any, useOffset: any, offsetDirection: any): any;
|
|
62
|
+
getNearestPointIndex(targetPoint: turf.Coord, points: any): number;
|
|
63
|
+
/**
|
|
64
|
+
* Convert LatLngLiteral object to Turf.js coordinate array format.
|
|
65
|
+
*
|
|
66
|
+
* This method serves as a semantic interface for coordinate conversion,
|
|
67
|
+
* ensuring consistent lng/lat order when interfacing with Turf.js functions.
|
|
68
|
+
* While simple, it provides a clear contract and future-proofing for any
|
|
69
|
+
* coordinate validation or transformation that might be needed later.
|
|
70
|
+
*
|
|
71
|
+
* @param point - LatLngLiteral object with lat/lng properties
|
|
72
|
+
* @returns Turf.js coordinate array in [lng, lat] format
|
|
73
|
+
*/
|
|
74
|
+
getCoord(point: L.LatLngLiteral): turf.Coord;
|
|
75
|
+
getFeaturePointCollection(points: L.LatLngLiteral[]): any;
|
|
76
|
+
getPolygonArea(poly: Feature<Polygon | MultiPolygon>): number;
|
|
77
|
+
getPolygonPerimeter(poly: Feature<Polygon | MultiPolygon>): number;
|
|
78
|
+
getDoubleElbowLatLngs(points: L.LatLngLiteral[]): L.LatLngLiteral[];
|
|
79
|
+
getBezierMultiPolygon(polygonArray: Position[][][]): Feature<Polygon | MultiPolygon>;
|
|
80
|
+
/**
|
|
81
|
+
* Check if a polygon has holes (more than one ring)
|
|
82
|
+
*/
|
|
83
|
+
private polygonHasHoles;
|
|
84
|
+
/**
|
|
85
|
+
* Handle kinks in polygons with holes while preserving hole structure
|
|
86
|
+
*/
|
|
87
|
+
private getKinksWithHolePreservation;
|
|
88
|
+
/**
|
|
89
|
+
* Check if the drag line goes completely through a hole (like cutting cake)
|
|
90
|
+
*/
|
|
91
|
+
private checkIfDragCompletelyThroughHole;
|
|
92
|
+
/**
|
|
93
|
+
* Find the line created by self-intersection in the outer ring
|
|
94
|
+
*/
|
|
95
|
+
private findSelfIntersectionLine;
|
|
96
|
+
/**
|
|
97
|
+
* Check if a line completely traverses a hole
|
|
98
|
+
*/
|
|
99
|
+
private lineCompletelyTraversesHole;
|
|
100
|
+
/**
|
|
101
|
+
* Check if a hole is cut by the kinks in the outer ring
|
|
102
|
+
*/
|
|
103
|
+
private holeIsCutByKinks;
|
|
104
|
+
/**
|
|
105
|
+
* Find duplicate points in a ring (excluding first/last which should be the same)
|
|
106
|
+
*/
|
|
107
|
+
private findDuplicatePoints;
|
|
108
|
+
/**
|
|
109
|
+
* Check if outer ring intersects with holes (fallback detection for hole traversal)
|
|
110
|
+
*/
|
|
111
|
+
private checkOuterRingHoleIntersection;
|
|
112
|
+
/**
|
|
113
|
+
* Handle complete hole traversal - create solid polygons (cake cutting)
|
|
114
|
+
*/
|
|
115
|
+
private handleCompleteHoleTraversal;
|
|
116
|
+
/**
|
|
117
|
+
* Assign holes to a polygon based on containment and intersection analysis
|
|
118
|
+
*/
|
|
119
|
+
private assignHolesToPolygon;
|
|
120
|
+
/**
|
|
121
|
+
* Analyze the relationship between a hole and a polygon
|
|
122
|
+
*/
|
|
123
|
+
private analyzeHolePolygonRelationship;
|
|
124
|
+
/**
|
|
125
|
+
* Subtract intersecting holes from a polygon to create proper "bite" shapes
|
|
126
|
+
*/
|
|
127
|
+
private subtractIntersectingHoles;
|
|
128
|
+
/**
|
|
129
|
+
* Calculate the area of a ring using the shoelace formula
|
|
130
|
+
*/
|
|
131
|
+
private calculateRingArea;
|
|
132
|
+
/**
|
|
133
|
+
* Remove duplicate vertices from a polygon to prevent turf errors
|
|
134
|
+
*/
|
|
135
|
+
removeDuplicateVertices(feature: Feature<Polygon | MultiPolygon>): Feature<Polygon | MultiPolygon>;
|
|
136
|
+
/**
|
|
137
|
+
* Create a "bite" by subtracting the intersected part of the hole from the polygon
|
|
138
|
+
*/
|
|
139
|
+
private createBiteFromHoleIntersection;
|
|
140
|
+
}
|
|
141
|
+
//# sourceMappingURL=turf-helper.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"turf-helper.d.ts","sourceRoot":"","sources":["../../src/turf-helper.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,YAAY,CAAC;AAEnC,OAAO,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACxE,OAAO,KAAK,CAAC,MAAM,SAAS,CAAC;AAU7B,qBAAa,UAAU;IACrB,OAAO,CAAC,MAAM,CAA8B;gBAEhC,MAAM,EAAE,MAAM;IAI1B,KAAK,CACH,KAAK,EAAE,OAAO,CAAC,OAAO,GAAG,YAAY,CAAC,EACtC,KAAK,EAAE,OAAO,CAAC,OAAO,GAAG,YAAY,CAAC,GACrC,OAAO,CAAC,OAAO,GAAG,YAAY,CAAC;IAWlC;;OAEG;IACH,sBAAsB,CAAC,OAAO,EAA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0,0 +1,351 @@
|
|
|
1
|
+
import * as L from 'leaflet';
|
|
2
|
+
import { DrawMode, MarkerPosition } from '../enums';
|
|
3
|
+
import type { Feature, Polygon, MultiPolygon } from 'geojson';
|
|
4
|
+
/**
|
|
5
|
+
* Bounding box data structure compatible with Leaflet's LatLngBounds
|
|
6
|
+
* Uses Leaflet's naming convention: south/north for latitude, west/east for longitude
|
|
7
|
+
*/
|
|
8
|
+
export type BoundsLiteral = {
|
|
9
|
+
south: number;
|
|
10
|
+
north: number;
|
|
11
|
+
west: number;
|
|
12
|
+
east: number;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Configuration interface for auto-polygon options
|
|
16
|
+
*/
|
|
17
|
+
export interface AutoPolygonOptions {
|
|
18
|
+
visualOptimizationLevel?: number;
|
|
19
|
+
mergeOnAdd?: boolean;
|
|
20
|
+
simplifyOnAdd?: boolean;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Marker configuration interface
|
|
24
|
+
*/
|
|
25
|
+
export interface MarkerConfig {
|
|
26
|
+
type: 'standard' | 'menu' | 'delete' | 'info' | 'hole';
|
|
27
|
+
position: L.LatLngLiteral;
|
|
28
|
+
draggable: boolean;
|
|
29
|
+
zIndex: number;
|
|
30
|
+
styleClasses: string;
|
|
31
|
+
title?: string;
|
|
32
|
+
visible?: boolean;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Marker options for different marker types
|
|
36
|
+
*/
|
|
37
|
+
export interface MarkerOptions {
|
|
38
|
+
markerIcon: {
|
|
39
|
+
styleClasses: string | string[];
|
|
40
|
+
zIndexOffset?: number;
|
|
41
|
+
};
|
|
42
|
+
markerMenuIcon: {
|
|
43
|
+
styleClasses: string | string[];
|
|
44
|
+
position: MarkerPosition;
|
|
45
|
+
zIndexOffset?: number;
|
|
46
|
+
};
|
|
47
|
+
markerDeleteIcon: {
|
|
48
|
+
styleClasses: string | string[];
|
|
49
|
+
position: MarkerPosition;
|
|
50
|
+
zIndexOffset?: number;
|
|
51
|
+
};
|
|
52
|
+
markerInfoIcon: {
|
|
53
|
+
styleClasses: string | string[];
|
|
54
|
+
position: MarkerPosition;
|
|
55
|
+
zIndexOffset?: number;
|
|
56
|
+
useMetrics: boolean;
|
|
57
|
+
areaLabel: string;
|
|
58
|
+
perimeterLabel: string;
|
|
59
|
+
};
|
|
60
|
+
holeIcon: {
|
|
61
|
+
styleClasses: string | string[];
|
|
62
|
+
zIndexOffset?: number;
|
|
63
|
+
};
|
|
64
|
+
zIndexOffset: number;
|
|
65
|
+
coordsTitle: boolean;
|
|
66
|
+
menuMarker: boolean;
|
|
67
|
+
deleteMarker: boolean;
|
|
68
|
+
infoMarker: boolean;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Polygon style options interface
|
|
72
|
+
*/
|
|
73
|
+
export interface PolygonStyleOptions {
|
|
74
|
+
color: string;
|
|
75
|
+
weight: number;
|
|
76
|
+
opacity: number;
|
|
77
|
+
fillColor: string;
|
|
78
|
+
fillOpacity: number;
|
|
79
|
+
dashArray?: string;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Hole style options interface
|
|
83
|
+
*/
|
|
84
|
+
export interface HoleStyleOptions {
|
|
85
|
+
color: string;
|
|
86
|
+
weight: number;
|
|
87
|
+
opacity: number;
|
|
88
|
+
dashArray?: string;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Polyline style options interface
|
|
92
|
+
*/
|
|
93
|
+
export interface PolylineStyleOptions {
|
|
94
|
+
color: string;
|
|
95
|
+
weight: number;
|
|
96
|
+
opacity: number;
|
|
97
|
+
dashArray?: string;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Mode configuration interface
|
|
101
|
+
*/
|
|
102
|
+
export interface ModeConfig {
|
|
103
|
+
draw: boolean;
|
|
104
|
+
subtract: boolean;
|
|
105
|
+
deleteAll: boolean;
|
|
106
|
+
p2p: boolean;
|
|
107
|
+
dragElbow: boolean;
|
|
108
|
+
dragPolygons: boolean;
|
|
109
|
+
attachElbow: boolean;
|
|
110
|
+
edgeDeletion: boolean;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Drag polygon configuration interface
|
|
114
|
+
*/
|
|
115
|
+
export interface DragPolygonConfig {
|
|
116
|
+
enabled: boolean;
|
|
117
|
+
opacity: number;
|
|
118
|
+
hoverCursor: string;
|
|
119
|
+
dragCursor: string;
|
|
120
|
+
markerBehavior: 'hide' | 'show' | 'fade';
|
|
121
|
+
markerAnimationDuration: number;
|
|
122
|
+
autoMergeOnIntersect: boolean;
|
|
123
|
+
autoHoleOnContained: boolean;
|
|
124
|
+
modifierSubtract: {
|
|
125
|
+
enabled: boolean;
|
|
126
|
+
subtractColor: string;
|
|
127
|
+
hideMarkersOnDrag: boolean;
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Edge deletion configuration interface
|
|
132
|
+
*/
|
|
133
|
+
export interface EdgeDeletionConfig {
|
|
134
|
+
enabled: boolean;
|
|
135
|
+
modifierKey: 'ctrl' | 'cmd' | 'auto';
|
|
136
|
+
hoverColor: string;
|
|
137
|
+
confirmDeletion: boolean;
|
|
138
|
+
minVertices: number;
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Complete Polydraw configuration interface
|
|
142
|
+
*/
|
|
143
|
+
export interface PolydrawConfig {
|
|
144
|
+
kinks: boolean;
|
|
145
|
+
mergePolygons: boolean;
|
|
146
|
+
visualOptimizationLevel: number;
|
|
147
|
+
polygonOptions: PolygonStyleOptions;
|
|
148
|
+
holeOptions: HoleStyleOptions;
|
|
149
|
+
polyLineOptions: PolylineStyleOptions;
|
|
150
|
+
markers: MarkerOptions;
|
|
151
|
+
modes: ModeConfig;
|
|
152
|
+
dragPolygons: DragPolygonConfig;
|
|
153
|
+
edgeDeletion: EdgeDeletionConfig;
|
|
154
|
+
units: {
|
|
155
|
+
metric: boolean;
|
|
156
|
+
imperial: boolean;
|
|
157
|
+
};
|
|
158
|
+
precision: {
|
|
159
|
+
area: number;
|
|
160
|
+
perimeter: number;
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Event handler function types
|
|
165
|
+
*/
|
|
166
|
+
export type DrawModeChangeHandler = (mode: DrawMode) => void;
|
|
167
|
+
export type MouseEventHandler = (event: L.LeafletMouseEvent) => void;
|
|
168
|
+
export type TouchEventHandler = (event: TouchEvent) => void;
|
|
169
|
+
export type MarkerEventHandler = (event: L.LeafletEvent) => void;
|
|
170
|
+
export type PolygonEventHandler = (event: L.LeafletEvent) => void;
|
|
171
|
+
/**
|
|
172
|
+
* Polygon information interface
|
|
173
|
+
*/
|
|
174
|
+
export interface PolygonInfo {
|
|
175
|
+
id: string;
|
|
176
|
+
polygon: L.LatLngLiteral[][];
|
|
177
|
+
area: number;
|
|
178
|
+
perimeter: number;
|
|
179
|
+
hasHoles: boolean;
|
|
180
|
+
holeCount: number;
|
|
181
|
+
centroid: L.LatLngLiteral;
|
|
182
|
+
bounds: BoundsLiteral;
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Validation result interface
|
|
186
|
+
*/
|
|
187
|
+
export interface ValidationResult {
|
|
188
|
+
isValid: boolean;
|
|
189
|
+
errors: string[];
|
|
190
|
+
warnings: string[];
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* Geometric operation result interface
|
|
194
|
+
*/
|
|
195
|
+
export interface GeometricOperationResult {
|
|
196
|
+
success: boolean;
|
|
197
|
+
result?: Feature<Polygon | MultiPolygon>;
|
|
198
|
+
error?: string;
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* Marker visibility calculation result
|
|
202
|
+
*/
|
|
203
|
+
export interface MarkerVisibilityResult {
|
|
204
|
+
visibleMarkers: number[];
|
|
205
|
+
hiddenMarkers: number[];
|
|
206
|
+
optimizationLevel: number;
|
|
207
|
+
totalMarkers: number;
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* Polygon intersection analysis result
|
|
211
|
+
*/
|
|
212
|
+
export interface IntersectionAnalysis {
|
|
213
|
+
hasIntersection: boolean;
|
|
214
|
+
intersectionType: 'none' | 'partial' | 'complete' | 'contains' | 'contained';
|
|
215
|
+
intersectionArea?: number;
|
|
216
|
+
shouldMerge: boolean;
|
|
217
|
+
shouldCreateHole: boolean;
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* Drag operation state interface
|
|
221
|
+
*/
|
|
222
|
+
export interface DragState {
|
|
223
|
+
isDragging: boolean;
|
|
224
|
+
startPosition: L.LatLngLiteral | null;
|
|
225
|
+
currentPosition: L.LatLngLiteral | null;
|
|
226
|
+
draggedPolygon: L.Polygon | null;
|
|
227
|
+
modifierKeyHeld: boolean;
|
|
228
|
+
dragMode: 'move' | 'subtract';
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* Feature group with metadata interface
|
|
232
|
+
*/
|
|
233
|
+
export interface PolydrawFeatureGroup extends L.FeatureGroup {
|
|
234
|
+
_polydrawMetadata?: {
|
|
235
|
+
id: string;
|
|
236
|
+
optimizationLevel: number;
|
|
237
|
+
hasHoles: boolean;
|
|
238
|
+
createdAt: Date;
|
|
239
|
+
lastModified: Date;
|
|
240
|
+
};
|
|
241
|
+
}
|
|
242
|
+
/**
|
|
243
|
+
* Enhanced polygon with metadata interface
|
|
244
|
+
*/
|
|
245
|
+
export interface PolydrawPolygon extends L.Polygon {
|
|
246
|
+
_polydrawOptimizationLevel?: number;
|
|
247
|
+
_polydrawHasHoles?: boolean;
|
|
248
|
+
_polydrawFeatureGroup?: PolydrawFeatureGroup;
|
|
249
|
+
_polydrawLatLngs?: Feature<Polygon | MultiPolygon>;
|
|
250
|
+
_polydrawDragData?: {
|
|
251
|
+
isDragging: boolean;
|
|
252
|
+
startPosition: L.LatLngLiteral | null;
|
|
253
|
+
startLatLngs: any;
|
|
254
|
+
};
|
|
255
|
+
}
|
|
256
|
+
/**
|
|
257
|
+
* Enhanced marker with metadata interface
|
|
258
|
+
*/
|
|
259
|
+
export interface PolydrawMarker extends L.Marker {
|
|
260
|
+
_polydrawType?: 'standard' | 'menu' | 'delete' | 'info' | 'hole';
|
|
261
|
+
_polydrawVisible?: boolean;
|
|
262
|
+
_polydrawImportance?: number;
|
|
263
|
+
}
|
|
264
|
+
/**
|
|
265
|
+
* Enhanced polyline with edge metadata interface
|
|
266
|
+
*/
|
|
267
|
+
export interface PolydrawEdgePolyline extends L.Polyline {
|
|
268
|
+
_polydrawEdgeInfo?: {
|
|
269
|
+
ringIndex: number;
|
|
270
|
+
edgeIndex: number;
|
|
271
|
+
startPoint: L.LatLngLiteral;
|
|
272
|
+
endPoint: L.LatLngLiteral;
|
|
273
|
+
parentPolygon: L.Polygon;
|
|
274
|
+
parentFeatureGroup: L.FeatureGroup;
|
|
275
|
+
};
|
|
276
|
+
}
|
|
277
|
+
/**
|
|
278
|
+
* Compass direction interface
|
|
279
|
+
*/
|
|
280
|
+
export interface CompassDirection {
|
|
281
|
+
lat: number;
|
|
282
|
+
lng: number;
|
|
283
|
+
direction: string;
|
|
284
|
+
}
|
|
285
|
+
/**
|
|
286
|
+
* Area calculation result interface
|
|
287
|
+
*/
|
|
288
|
+
export interface AreaResult {
|
|
289
|
+
sqm: number;
|
|
290
|
+
sqft: number;
|
|
291
|
+
hectares: number;
|
|
292
|
+
acres: number;
|
|
293
|
+
metricArea: string;
|
|
294
|
+
imperialArea: string;
|
|
295
|
+
metricUnit: string;
|
|
296
|
+
imperialUnit: string;
|
|
297
|
+
}
|
|
298
|
+
/**
|
|
299
|
+
* Perimeter calculation result interface
|
|
300
|
+
*/
|
|
301
|
+
export interface PerimeterResult {
|
|
302
|
+
meters: number;
|
|
303
|
+
feet: number;
|
|
304
|
+
kilometers: number;
|
|
305
|
+
miles: number;
|
|
306
|
+
metricLength: string;
|
|
307
|
+
imperialLength: string;
|
|
308
|
+
metricUnit: string;
|
|
309
|
+
imperialUnit: string;
|
|
310
|
+
}
|
|
311
|
+
/**
|
|
312
|
+
* Point importance calculation result
|
|
313
|
+
*/
|
|
314
|
+
export interface PointImportance {
|
|
315
|
+
index: number;
|
|
316
|
+
importance: number;
|
|
317
|
+
angularDeviation: number;
|
|
318
|
+
distanceFromLine: number;
|
|
319
|
+
isExtreme: boolean;
|
|
320
|
+
distanceFromCentroid: number;
|
|
321
|
+
}
|
|
322
|
+
/**
|
|
323
|
+
* Simplification options interface
|
|
324
|
+
*/
|
|
325
|
+
export interface SimplificationOptions {
|
|
326
|
+
tolerance: number;
|
|
327
|
+
highQuality: boolean;
|
|
328
|
+
dynamicTolerance: boolean;
|
|
329
|
+
}
|
|
330
|
+
/**
|
|
331
|
+
* Bezier curve options interface
|
|
332
|
+
*/
|
|
333
|
+
export interface BezierOptions {
|
|
334
|
+
resolution: number;
|
|
335
|
+
sharpness: number;
|
|
336
|
+
}
|
|
337
|
+
/**
|
|
338
|
+
* Union operation options interface
|
|
339
|
+
*/
|
|
340
|
+
export interface UnionOptions {
|
|
341
|
+
tolerance: number;
|
|
342
|
+
preserveHoles: boolean;
|
|
343
|
+
}
|
|
344
|
+
/**
|
|
345
|
+
* Difference operation options interface
|
|
346
|
+
*/
|
|
347
|
+
export interface DifferenceOptions {
|
|
348
|
+
tolerance: number;
|
|
349
|
+
createHoles: boolean;
|
|
350
|
+
}
|
|
351
|
+
//# sourceMappingURL=polydraw-interfaces.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"polydraw-interfaces.d.ts","sourceRoot":"","sources":["../../../src/types/polydraw-interfaces.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAC;AAC7B,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AACpD,OAAO,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE9D;;;GAGG;AACH,MAAM,MAAM,aAAa,GAA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,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,gBAAgB,EAAE,MAAM,CAAC;IACzB,gBAAgB,EAAE,MAAM,CAAC;IACzB,SAAS,EAAE,OAAO,CAAC;IACnB,oBAAoB,EAAE,MAAM,CAAC;CAC9B;AAED;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,OAAO,CAAC;IACrB,gBAAgB,EAAE,OAAO,CAAC;CAC3B;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,OAAO,CAAC;CACxB;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,OAAO,CAAC;CACtB"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { MarkerPosition } from './enums';
|
|
2
|
+
import * as L from 'leaflet';
|
|
3
|
+
import defaultConfig from './config.json';
|
|
4
|
+
/**
|
|
5
|
+
* Utility for polygon bounds.
|
|
6
|
+
*/
|
|
7
|
+
type ICompass = {
|
|
8
|
+
East: L.LatLngLiteral;
|
|
9
|
+
North: L.LatLngLiteral;
|
|
10
|
+
NorthEast: L.LatLngLiteral;
|
|
11
|
+
NorthWest: L.LatLngLiteral;
|
|
12
|
+
South: L.LatLngLiteral;
|
|
13
|
+
SouthEast: L.LatLngLiteral;
|
|
14
|
+
SouthWest: L.LatLngLiteral;
|
|
15
|
+
West: L.LatLngLiteral;
|
|
16
|
+
};
|
|
17
|
+
export declare class PolyDrawUtil {
|
|
18
|
+
/**
|
|
19
|
+
* Gets the bounds of the polygon with optional padding.
|
|
20
|
+
* @param polygon Array of LatLng points.
|
|
21
|
+
* @param padding Padding factor.
|
|
22
|
+
* @returns The LatLngBounds.
|
|
23
|
+
*/
|
|
24
|
+
static getBounds(polygon: L.LatLngLiteral[], padding?: number): L.LatLngBounds;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Class for compass directions based on bounds.
|
|
28
|
+
*/
|
|
29
|
+
export declare class Compass {
|
|
30
|
+
direction: ICompass;
|
|
31
|
+
constructor(minLat?: number, minLng?: number, maxLat?: number, maxLng?: number);
|
|
32
|
+
getDirection(direction: MarkerPosition): L.LatLngLiteral;
|
|
33
|
+
getPositions(startPosition?: MarkerPosition, clockwise?: boolean, addClosingNode?: boolean): number[][];
|
|
34
|
+
private getPositionAsArray;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Class for calculating perimeter in different units.
|
|
38
|
+
*/
|
|
39
|
+
export declare class Perimeter {
|
|
40
|
+
metricLength: string;
|
|
41
|
+
metricUnit: string;
|
|
42
|
+
imperialLength: string;
|
|
43
|
+
imperialUnit: string;
|
|
44
|
+
constructor(length: number, config: typeof defaultConfig);
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Class for calculating area in different units.
|
|
48
|
+
*/
|
|
49
|
+
export declare class Area {
|
|
50
|
+
metricArea: string;
|
|
51
|
+
metricUnit: string;
|
|
52
|
+
imperialArea: string;
|
|
53
|
+
imperialUnit: string;
|
|
54
|
+
constructor(sqrMeterArea: number, config: typeof defaultConfig);
|
|
55
|
+
}
|
|
56
|
+
export {};
|
|
57
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,KAAK,CAAC,MAAM,SAAS,CAAC;AAC7B,OAAO,aAAa,MAAM,eAAe,CAAC;AAE1C;;GAEG;AAGH,KAAK,QAAQ,GAAG;IACd,IAAI,EAAE,C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