UNPKG

leaflet-polydraw

Version:

Advanced Leaflet plugin for freehand polygon drawing, with smart merging and powerful editing tools. Compatible with both Leaflet v1.x and v2.x.

55 lines 2.22 kB
import { TurfHelper } from '../turf-helper'; import type { Feature, Polygon, MultiPolygon } from 'geojson'; import type { PolydrawConfig } from '../types/polydraw-interfaces'; export interface GeometryOperationResult { success: boolean; result?: Feature<Polygon | MultiPolygon>; results?: Feature<Polygon | MultiPolygon>[]; error?: string; allowMerge?: boolean; simplify?: boolean; metadata?: Record<string, unknown>; } export interface PolygonGeometryManagerDependencies { turfHelper: TurfHelper; config: PolydrawConfig; } /** * PolygonGeometryManager handles pure geometric calculations without any direct map interaction. * This includes merging, subtracting, simplifying, and other geometric operations on polygons. */ export declare class PolygonGeometryManager { private turfHelper; private config; constructor(dependencies: PolygonGeometryManagerDependencies); /** * Check if two polygons intersect using multiple detection methods */ checkPolygonIntersection(polygon1: Feature<Polygon | MultiPolygon>, polygon2: Feature<Polygon | MultiPolygon>): boolean; private isPolygonInsideHole; /** * Perform union operation on multiple polygons */ unionPolygons(polygons: Feature<Polygon | MultiPolygon>[], newPolygon: Feature<Polygon | MultiPolygon>): GeometryOperationResult; /** * Perform subtraction operation */ subtractPolygon(existingPolygon: Feature<Polygon | MultiPolygon>, subtractPolygon: Feature<Polygon | MultiPolygon>): GeometryOperationResult; /** * Simplify a polygon by removing every other point */ simplifyPolygon(polygon: Feature<Polygon | MultiPolygon>): GeometryOperationResult; /** * Convert polygon to bounding box */ convertToBoundingBox(polygon: Feature<Polygon | MultiPolygon>): GeometryOperationResult; /** * Apply bezier curve to polygon */ bezierifyPolygon(polygon: Feature<Polygon | MultiPolygon>): GeometryOperationResult; /** * Double the elbows of a polygon */ doubleElbowsPolygon(polygon: Feature<Polygon | MultiPolygon>): GeometryOperationResult; } //# sourceMappingURL=polygon-geometry-manager.d.ts.map