UNPKG

leaflet-polydraw

Version:

Advanced polygon drawing and editing plugin for Leaflet with drag-and-drop, smart merging, and comprehensive editing tools

59 lines 2.28 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; } 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; /** * 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; /** * Helper method to get polygon center */ private getPolygonCenter; /** * Helper method to get bounding box from polygon */ private getBoundingBox; } //# sourceMappingURL=polygon-geometry-manager.d.ts.map