@wenle_2523097/agri-map 1.0.2 → 1.0.4

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.
Files changed (99) hide show
  1. package/dist/components/ConfigProvider/index.d.ts +15 -0
  2. package/dist/components/DualScaleControl/index.d.ts +10 -0
  3. package/dist/components/Icons/SelectIcon.d.ts +68 -0
  4. package/dist/components/Icons/index.d.ts +43 -0
  5. package/dist/components/Irrigation/index.d.ts +8 -0
  6. package/dist/components/Irrigation/toolbar.d.ts +6 -0
  7. package/dist/components/Loading/index.d.ts +40 -0
  8. package/dist/components/MapContent/index.d.ts +17 -0
  9. package/dist/components/MapSizeHandler/index.d.ts +24 -0
  10. package/dist/components/Marker/ClusterView.d.ts +29 -0
  11. package/dist/components/Marker/MapClickHandler.d.ts +25 -0
  12. package/dist/components/Marker/index.d.ts +61 -0
  13. package/dist/components/Marker/parseClusterConfig.d.ts +25 -0
  14. package/dist/components/Marker/toolbar.d.ts +6 -0
  15. package/dist/components/Marker/useEditHandlers.d.ts +44 -0
  16. package/dist/components/Marker/useIconConfig.d.ts +23 -0
  17. package/dist/components/Marker/useMarkerCommands.d.ts +30 -0
  18. package/dist/components/Measurement/toolbar.d.ts +20 -0
  19. package/dist/components/MiniMap/index.d.ts +16 -0
  20. package/dist/components/Notification/index.d.ts +12 -0
  21. package/dist/components/PlotGroupLayer/index.d.ts +8 -0
  22. package/dist/components/PlotLayer/index.d.ts +7 -0
  23. package/dist/components/PlotLayer/label.d.ts +12 -0
  24. package/dist/components/PlotLayer/leaflet-types.d.ts +59 -0
  25. package/dist/components/PlotLayer/parseConfig.d.ts +15 -0
  26. package/dist/components/PlotLayer/toolbar.d.ts +6 -0
  27. package/dist/components/PlotLayer/types.d.ts +10 -0
  28. package/dist/components/PlotLayer/usePlotCommands.d.ts +33 -0
  29. package/dist/components/PlotLayer/usePlotData.d.ts +32 -0
  30. package/dist/components/PlotLayer/usePlotEditMode.d.ts +92 -0
  31. package/dist/components/Road/index.d.ts +8 -0
  32. package/dist/components/Road/toolbar.d.ts +6 -0
  33. package/dist/components/TianDiTuLayer/index.d.ts +15 -0
  34. package/dist/components/Track/ClusterView.d.ts +20 -0
  35. package/dist/components/Track/TrackView.d.ts +24 -0
  36. package/dist/components/Track/commands.d.ts +53 -0
  37. package/dist/components/Track/constants.d.ts +34 -0
  38. package/dist/components/Track/index.d.ts +54 -0
  39. package/dist/components/Track/parseConfig.d.ts +40 -0
  40. package/dist/components/Track/types.d.ts +38 -0
  41. package/dist/components/Track/useMarkerIcon.d.ts +14 -0
  42. package/dist/components/Track/useTrackCommands.d.ts +56 -0
  43. package/dist/components/shared/BaseEditToolbar.d.ts +100 -0
  44. package/dist/components/shared/ToolbarButton.d.ts +49 -0
  45. package/dist/components/shared/index.d.ts +5 -0
  46. package/dist/constants/device.d.ts +14 -0
  47. package/dist/constants/index.d.ts +20 -0
  48. package/dist/constants/map.d.ts +13 -0
  49. package/dist/constants/plot.d.ts +33 -0
  50. package/dist/constants/road.d.ts +12 -0
  51. package/dist/constants/styles.d.ts +57 -0
  52. package/dist/constants/theme.d.ts +47 -0
  53. package/dist/constants/unit.d.ts +11 -0
  54. package/dist/hooks/index.d.ts +8 -0
  55. package/dist/hooks/useEditMode.d.ts +75 -0
  56. package/dist/hooks/useLatestRef.d.ts +17 -0
  57. package/dist/hooks/usePolylineEditor.d.ts +65 -0
  58. package/dist/hooks/usePolylineRenderer.d.ts +34 -0
  59. package/dist/hooks/useTheme.d.ts +13 -0
  60. package/dist/index.d.ts +312 -0
  61. package/dist/index.esm.js +30 -0
  62. package/dist/index.esm.js.map +1 -1
  63. package/dist/index.js +30 -0
  64. package/dist/index.js.map +1 -1
  65. package/dist/index.umd.js +30 -0
  66. package/dist/index.umd.js.map +1 -1
  67. package/dist/types/basic.d.ts +57 -0
  68. package/dist/types/components.d.ts +56 -0
  69. package/dist/types/config.d.ts +112 -0
  70. package/dist/types/decorator.d.ts +26 -0
  71. package/dist/types/icon.d.ts +52 -0
  72. package/dist/types/index.d.ts +20 -0
  73. package/dist/types/irrigation.d.ts +315 -0
  74. package/dist/types/layer.d.ts +40 -0
  75. package/dist/types/loading.d.ts +62 -0
  76. package/dist/types/marker.d.ts +299 -0
  77. package/dist/types/measurement.d.ts +121 -0
  78. package/dist/types/notification.d.ts +50 -0
  79. package/dist/types/plot.d.ts +479 -0
  80. package/dist/types/road.d.ts +382 -0
  81. package/dist/types/toolbar.d.ts +176 -0
  82. package/dist/types/track.d.ts +386 -0
  83. package/dist/utils/area.d.ts +57 -0
  84. package/dist/utils/clusterIcon.d.ts +16 -0
  85. package/dist/utils/createAntPath.d.ts +13 -0
  86. package/dist/utils/geometry.d.ts +41 -0
  87. package/dist/utils/iconCache.d.ts +49 -0
  88. package/dist/utils/iconUtils.d.ts +46 -0
  89. package/dist/utils/index.d.ts +11 -0
  90. package/dist/utils/leafletIcons.d.ts +40 -0
  91. package/dist/utils/mapAnimation.d.ts +14 -0
  92. package/dist/utils/markerSvg.d.ts +19 -0
  93. package/dist/utils/pulseIcon.d.ts +28 -0
  94. package/dist/utils/spatialIndex.d.ts +56 -0
  95. package/dist/utils/toggleItemState.d.ts +15 -0
  96. package/dist/utils/trackSimplify.d.ts +23 -0
  97. package/package.json +7 -3
  98. package/dist/index.css +0 -4635
  99. package/dist/index.css.map +0 -1
@@ -0,0 +1,19 @@
1
+ /**
2
+ * 彩色标记 SVG 生成器
3
+ * @description 生成水滴形地图标记 SVG,替代 CSS 绘制方案
4
+ */
5
+ import type { PresetIconName } from '../types/icon';
6
+ /**
7
+ * 获取 SVG 标记的锚点(针尖位置)
8
+ * @description viewBox 0 0 1024 1024 中针尖约在 (512, 829)
9
+ */
10
+ export declare function getMarkerAnchor(width: number, height: number): [number, number];
11
+ /**
12
+ * 生成彩色标记 SVG
13
+ * @param iconType - 标记类型(marker-red/blue/green/orange/yellow)
14
+ * @param width - SVG 宽度
15
+ * @param height - SVG 高度
16
+ * @param animated - 是否启用脉冲动画
17
+ * @returns SVG HTML 字符串,非标记类型返回空字符串
18
+ */
19
+ export declare function generateMarkerSvg(iconType: PresetIconName, width: number, height: number, animated: boolean): string;
@@ -0,0 +1,28 @@
1
+ /**
2
+ * 同心圆脉冲图标 SVG 生成器
3
+ * @description 生成带扩散/收缩脉冲动画的同心圆地图标记 SVG
4
+ */
5
+ import type { PresetIconName } from '../types/icon';
6
+ /**
7
+ * 生成同心圆脉冲图标 SVG
8
+ * @param iconType - 标记类型(pulse-blue/green/red/orange/purple/arrow)
9
+ * @param width - SVG 宽度
10
+ * @param height - SVG 高度
11
+ * @param animated - 是否启用脉冲动画
12
+ * @returns SVG HTML 字符串,非脉冲图标返回空字符串
13
+ */
14
+ export declare function generatePulseSvg(iconType: PresetIconName, width: number, height: number, animated: boolean): string;
15
+ /** 所有脉冲图标名称列表 */
16
+ export declare const PULSE_ICONS: PresetIconName[];
17
+ /**
18
+ * 生成 Loading Spinner 图标 SVG
19
+ * @description 旋转圆环加载动画
20
+ */
21
+ export declare function generateLoadingSpinnerSvg(width: number, height: number, animated: boolean): string;
22
+ /**
23
+ * 生成 Loading Dots 图标 SVG
24
+ * @description 跳动圆点加载动画
25
+ */
26
+ export declare function generateLoadingDotsSvg(width: number, height: number, animated: boolean): string;
27
+ /** 所有 Loading 图标名称列表 */
28
+ export declare const LOADING_ICONS: PresetIconName[];
@@ -0,0 +1,56 @@
1
+ /**
2
+ * 空间索引工具
3
+ * @description 提供简单的网格空间索引,用于高效过滤视口内的地块
4
+ */
5
+ import type { PlotData, Coordinate } from '../types';
6
+ /** 边界框 [minLat, minLng, maxLat, maxLng] */
7
+ export type BBox = [number, number, number, number];
8
+ /** 带边界框的数据项 */
9
+ export interface BoundedItem {
10
+ id: string | number;
11
+ bounds?: BBox;
12
+ boundaries: Coordinate[];
13
+ }
14
+ /**
15
+ * 网格空间索引
16
+ * @description 将空间划分为网格单元格,快速查找与视口相交的元素
17
+ */
18
+ export declare class GridSpatialIndex<T extends BoundedItem> {
19
+ private grid;
20
+ private cellSize;
21
+ private items;
22
+ /**
23
+ * @param cellSize 网格单元格大小(经纬度单位),默认 0.01 约 1km
24
+ */
25
+ constructor(cellSize?: number);
26
+ /**
27
+ * 获取边界框覆盖的所有网格键
28
+ */
29
+ private getCellKeys;
30
+ /**
31
+ * 批量添加数据项
32
+ */
33
+ addAll(items: T[]): void;
34
+ /**
35
+ * 查询与边界框相交的所有项
36
+ */
37
+ query(bounds: BBox): T[];
38
+ /**
39
+ * 检查两个边界框是否相交
40
+ */
41
+ private intersects;
42
+ /**
43
+ * 清空索引
44
+ */
45
+ clear(): void;
46
+ /**
47
+ * 获取所有项
48
+ */
49
+ getAll(): T[];
50
+ }
51
+ /**
52
+ * 从 PlotData 数组创建索引项
53
+ * positions 始终为三维数组 [[[lat,lng],...], [孔洞], ...]
54
+ */
55
+ export declare function createBoundedItems(plots: PlotData[]): BoundedItem[];
56
+ export default GridSpatialIndex;
@@ -0,0 +1,15 @@
1
+ /**
2
+ * 切换 ID 集合中的元素
3
+ * 用于控制距离标签、蚁行动画等功能的显示/隐藏
4
+ */
5
+ /**
6
+ * 注册所有已知 ID(在组件初始化时调用)
7
+ */
8
+ export declare const registerAllIds: (ids: (string | number)[]) => void;
9
+ /**
10
+ * @param setter - React state setter
11
+ * @param itemId - 目标 ID(省略时操作全部)
12
+ * @param action - 'show' 添加到集合,'hide' 从集合移除
13
+ * @param allIds - 可选,所有已知 ID 列表(用于处理 null 状态转换)
14
+ */
15
+ export declare const toggleItemState: (setter: React.Dispatch<React.SetStateAction<Set<string | number | null>>>, itemId?: string | number, action?: "show" | "hide", allIds?: (string | number)[]) => void;
@@ -0,0 +1,23 @@
1
+ /**
2
+ * @fileoverview 轨迹简化与去重工具函数
3
+ * @description 提供 Douglas-Peucker 轨迹简化算法和连续冗余点过滤
4
+ * @module utils/trackSimplify
5
+ */
6
+ /**
7
+ * Douglas-Peucker 轨迹简化算法
8
+ * @param points - 轨迹点坐标数组 [[lat, lng], ...]
9
+ * @param tolerance - 简化容差(米),距离小于此值的中间点将被剔除
10
+ */
11
+ export declare function simplifyTrack(points: [number, number][], tolerance: number): [number, number][];
12
+ /**
13
+ * 计算点到线段的垂直距离(米)
14
+ */
15
+ export declare function pointToLineDistance(p: [number, number], a: [number, number], b: [number, number]): number;
16
+ /**
17
+ * 过滤距离过近的连续冗余点(保留首尾点)
18
+ * @param points - 原始轨迹点(保留完整对象信息,需包含 position: [lat, lng])
19
+ * @param tolerance - 最小点间距(米),距离小于此值的连续点将被剔除
20
+ */
21
+ export declare function filterDuplicatePoints<T extends {
22
+ position: [number, number];
23
+ }>(points: T[], tolerance: number): T[];
package/package.json CHANGED
@@ -1,17 +1,21 @@
1
1
  {
2
2
  "name": "@wenle_2523097/agri-map",
3
- "version": "1.0.2",
3
+ "version": "1.0.4",
4
4
  "description": "农业地图组件库 - 基于React-Leaflet的农业专用地图组件",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.esm.js",
7
7
  "browser": "dist/index.umd.js",
8
8
  "types": "dist/index.d.ts",
9
+ "sideEffects": [
10
+ "*.css",
11
+ "*.scss"
12
+ ],
9
13
  "files": [
10
14
  "dist"
11
15
  ],
12
16
  "scripts": {
13
- "build": "tsc && rollup -c",
14
- "build:watch": "tsc && rollup -c -w",
17
+ "build": "rollup -c && tsc --emitDeclarationOnly --outDir dist",
18
+ "build:watch": "rollup -c -w",
15
19
  "dev": "vite",
16
20
  "preview": "vite preview",
17
21
  "type-check": "tsc --noEmit",