mirage2d 1.1.93 → 1.1.94

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.
@@ -4,7 +4,15 @@ import { Geometry } from "ol/geom";
4
4
  import * as olExtent from 'ol/extent';
5
5
  import { GraphicLayer } from "src/Layer";
6
6
  export declare class SpatialAnalysis {
7
- static sector(origin: any, radius: any, antBearing: any, rotation: any): Feature<Geometry>;
7
+ /**
8
+ * @description: 创建给定半径和中心点的圆的一个扇形,位于(顺时针)bearing1和bearing2之间;0方位为中心点以北,顺时针正。
9
+ * @param {Feature<Geometry>} center 中心点
10
+ * @param {number} radius 圆的半径,单位km
11
+ * @param {number} antBearing 扇区第一个半径的角度,以十进制为单位
12
+ * @param {number} rotation 扇形第二半径的角度,以十进制度数表示
13
+ * @return {Feature <Geometry>}
14
+ */
15
+ static sector(center: any, radius: any, antBearing: any, rotation: any): Feature<Geometry>;
8
16
  /**
9
17
  * @description: 获取一个参考点和一个具有点几何特征的FeatureCollection,并从FeatureCollection最接近的参考点返回点。这个计算是测地线的。
10
18
  * @param {Feature<Geometry>} targetPoint
@@ -38,11 +46,18 @@ export declare class SpatialAnalysis {
38
46
  static lineOffset(line: Feature<Geometry>, unitsNum?: number): Feature<Geometry>;
39
47
  /**
40
48
  * @description: 获取一个点和一个LineString,并计算(多)LineString上最近的点。
41
- * @param {*} point
42
- * @param {*} line
49
+ * @param { Feature<Geometry>} point
50
+ * @param { Feature<Geometry>} line
43
51
  * @return {*}
44
52
  */
45
- static nearestPointOnLine(point: any, line: any): Feature<Geometry>;
53
+ static nearestPointOnLine(point: Feature<Geometry>, line: Feature<Geometry>): Feature<Geometry>;
54
+ /**
55
+ * @description: 获取一个点和一个LineString,并计算(多)LineString上最近的点。
56
+ * @param { Feature<Geometry>} point
57
+ * @param { Feature<Geometry>} line
58
+ * @return {*}
59
+ */
60
+ static nearestPointOnLines(point: any, line: any): Feature<Geometry>;
46
61
  /**
47
62
  * @description: 比较相同维度的两个几何图形,如果它们的交集集产生的几何图形与两个几何图形不同,但维度相同,则返回true
48
63
  * @param {Feature} f1
@@ -57,7 +72,6 @@ export declare class SpatialAnalysis {
57
72
  * @return {*}
58
73
  */
59
74
  static booleanPointInPolygon(f1: Feature<Geometry>, f2: Feature<Geometry>): boolean;
60
- static nearestPointOnLines(point: any, line: any): Feature<Geometry>;
61
75
  /**
62
76
  * @description: 缓冲区分析
63
77
  * @param {Feature<Geometry>} feature
@@ -86,35 +100,128 @@ export declare class SpatialAnalysis {
86
100
  * @return {*} 包含的featureList
87
101
  */
88
102
  static booleanContains(feature: any, featureList: any): any[];
103
+ /**
104
+ * @description: 创建泰森多边形
105
+ * @param {string} type 范围pointToPolygonType.voronoi tin convex
106
+ * @param {Array<Feature<Geometry>>} featureList 参与运算的点数据数组
107
+ * @param {string} strokecolor 可选 边框色
108
+ * @param {string} fillcolor 可选 填充色
109
+ * @return {*} 包含的featureList
110
+ */
89
111
  static createPolygon(type: string, featureList: Array<Feature<Geometry>>, strokecolor?: string, fillcolor?: string): any[] | Feature<Geometry>;
112
+ /**
113
+ * @description: 创建多边形网格
114
+ * @param {string} type 范围datagridType.point hex square triangle
115
+ * @param {*} option { box: [0, 0, 0, 0], cellSide: 50 } box 生成四角范围【minLng,minLat,maxLng,maxLat】 cellSide km单位 默认50
116
+ * @return {*} 要素数组
117
+ */
90
118
  static createGrid(type: any, option?: {
91
119
  box: number[];
92
120
  cellSide: number;
93
121
  }): any[];
122
+ /**
123
+ * @description: 等值面
124
+ * @param {FeatureCollection <Point>} points 点数据数组
125
+ * @param {number[]} breaks 级别数组 示例 [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
126
+ * @param {string} zProperty 分组属性字段名
127
+ * @return {*} 要素数组
128
+ */
94
129
  static isobands(points: any, breaks: any, zProperty: any): Feature<Geometry>[];
130
+ /**
131
+ * @description: 采用带有z值的点特征的网格FeatureCollection和一组断点值并生成等值线。
132
+ * @param {FeatureCollection<Point>} points 点数据数组
133
+ * @param {number[]} breaks 级别数组 示例 [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
134
+ * @param {string} zProperty 分组属性字段名
135
+ * @return {*} 要素数组
136
+ */
95
137
  static isolines(points: any, breaks: any, zProperty: any): Feature<Geometry>[];
138
+ /**
139
+ * @description: 随机面,随机节点数 最小3最大10
140
+ * @param {FeatureCollection <Point>} box 生成四角范围【minLng,minLat,maxLng,maxLat】
141
+ * @param {number} maxRadialLength 顶点可以到达多边形中心以外的纬度或经度的最大十进制度数。默认0.0111
142
+ * @param {number} maxNum 最大数量
143
+ * @return {*} 要素数组
144
+ */
96
145
  static randomPolygons(box: any, maxRadialLength?: number, maxNum?: number): any[];
146
+ /**
147
+ * @description: 随机线,随机节点数 最小3最大10
148
+ * @param {FeatureCollection <Point>} box 生成四角范围【minLng,minLat,maxLng,maxLat】
149
+ * @param {number} maxlength 是顶点可以与其前一个顶点相距的最大小数度数。默认0.0111
150
+ * @param {number} maxNum 最大数量
151
+ * @return {*} 要素数组
152
+ */
97
153
  static randomPolylines(box: any, maxlength?: number, maxNum?: number): any[];
154
+ /**
155
+ * @description: 随机点,随机节点数 最小3最大10
156
+ * @param {FeatureCollection <Point>} box 生成四角范围【minLng,minLat,maxLng,maxLat】
157
+ * @param {number} maxNum 最大数量
158
+ * @return {*} 要素数组
159
+ */
98
160
  static randomPoints(box: any, maxNum?: number): any[];
161
+ /**
162
+ * @description: 计算多边形面积
163
+ * @param {Feature<Geometry>} polygon
164
+ * @return {*} 计算后结果
165
+ */
99
166
  static formatArea(polygon: any): any;
167
+ /**
168
+ * @description: 转化范围4326to3857
169
+ * @param {Extent} box
170
+ * @return {*} 计算后结果
171
+ */
100
172
  static transTo3857(box: any): olExtent.Extent;
173
+ /**
174
+ * @description: 取区域内的随机点,默认在中国范围内
175
+ * @param {Extent} box
176
+ * @return {*} 计算后结果
177
+ */
101
178
  static randomLatLng(box: any): {
102
179
  lnglat: number[];
103
180
  box: olExtent.Extent;
104
181
  };
182
+ /**
183
+ * @description: 最短路径
184
+ * @param {Feature<Geometry>} startPoint
185
+ * @param {Feature<Geometry>} endPoint
186
+ * @param {*} options?: {
187
+ obstacles?: Feature<Geometry>[];障碍面
188
+ minDistance?: number;最短路径与障碍物之间的最小距离
189
+ units?: string; 分辨率和最小距离将以表示的单位;可以是度、弧度、英里、公里
190
+ resolution?: number;计算路径的矩阵点之间的距离
191
+ }
192
+ * @return {Feature<Geometry>} 计算后结果line
193
+ */
105
194
  static shortestPath(startPoint: Feature<Geometry>, endPoint: Feature<Geometry>, options?: {
106
195
  obstacles?: Feature<Geometry>[];
107
196
  minDistance?: number;
108
197
  units?: string;
109
198
  resolution?: number;
110
199
  }): Feature<Geometry>;
200
+ /**
201
+ * @description: 多线段合并成单线段
202
+ * @param {Feature<Geometry>[]} Features
203
+ * @param {number} distance 指定长度 默认1 单位km
204
+ * @return {Feature<Geometry>} 计算后结果line
205
+ */
111
206
  static lineMerger(Features: Feature<Geometry>[], distance?: number): {
112
207
  line: Feature<Geometry>;
113
208
  nodeData: any[];
114
209
  coordinates: any[];
115
210
  };
116
- static along(coord: any, distance: any): any[];
117
- static lineAttr(coords: any): any[];
211
+ /**
212
+ * @description: 按线坐标指定长度返回数组
213
+ * @param {Feature<Geometry>[]} 线的坐标点
214
+ * @param {number} distance 指定长度 默认1 单位km
215
+ * @return {Feature<Geometry>[]} 点数组
216
+ */
217
+ private static along;
218
+ /**
219
+ * @description: 线坐标分段距离
220
+ * @param {Feature<Geometry>[]} coords 线的坐标点
221
+ * @param {number} distance 指定长度 默认1 单位km
222
+ * @return {Feature<Geometry>[]} 点数组
223
+ */
224
+ private static lineAttr;
118
225
  static movePointContain(geoMarkerCircle: any, attr: any): {
119
226
  coordIndex: number;
120
227
  distance: number;
@@ -128,72 +235,163 @@ export declare class SpatialAnalysis {
128
235
  static arrayDup(arr: any): any[];
129
236
  /**
130
237
 
131
- * 对传入的路径集合 进行去重并分段添加虚拟点处理后返回
238
+ * @description: 对传入的路径集合 进行去重并分段添加虚拟点处理后返回
132
239
  * @param {*} path
133
240
  * @param {*} segmentLength
134
241
  * @returns
135
242
  */
136
243
  static decoratePath(path: any, segmentLength: any): any;
137
244
  /**
138
- * 线分割,按起始点分割线段
245
+ * @description:线分割,按起始点分割线段
139
246
  * @param {*} path
140
247
  * @param {*} segmentLength
141
248
  * @returns
142
249
  */
143
250
  static lineSlice(_startPoint: Feature<Geometry>, _stopPoint: Feature<Geometry>, _line: Feature<Geometry>): Feature<Geometry>;
144
251
  /**
145
- * 判断点是否在线上
146
- * @param {*} _point
147
- * @param {*} _line
148
- * @returns
149
- */
252
+ * @description:判断点是否在线上
253
+ * @param {*} _point
254
+ * @param {*} _line
255
+ * @returns
256
+ */
150
257
  static booleanPointOnLine(_point: Feature<Geometry>, _line: Feature<Geometry>): boolean;
151
258
  /**
152
- * 判断线线是否相交
259
+ * @description:判断线线是否相交
153
260
  * @param {*} _line1
154
261
  * @param {*} _line2
155
262
  * @returns
156
263
  */
157
264
  static booleanCrosses(_line1: Feature<Geometry>, _line2: Feature<Geometry>): boolean;
158
265
  /**
159
- * 获取任何LineString或PolygonGeoJSON,并返回相交点
160
- * @param {*} _line1
161
- * @param {*} _line2
162
- * @returns
163
- */
266
+ * @description:获取任何LineString或PolygonGeoJSON,并返回相交点
267
+ * @param {*} _line1
268
+ * @param {*} _line2
269
+ * @returns
270
+ */
164
271
  static lineIntersect(_line1: Feature<Geometry>, _line2: Feature<Geometry>): Feature<Geometry>[];
272
+ /**
273
+ * @description:通过另一个Feature分割一个LineString。
274
+ * @param {*} _line1
275
+ * @param {*} _feature
276
+ * @returns {Feature<Geometry>[]} 分割后的要素集合
277
+ */
165
278
  static lineSplit(_line1: Feature<Geometry>, _feature: Feature<Geometry>): Feature<Geometry>;
166
279
  /**
167
- * 线线是否相交打断
168
- * @param {*} _line1
169
- * @param {*} _line2
170
- * @returns
171
- */
280
+ * @description:线线是否相交打断
281
+ * @param {layer} layer GraphicLayer 图层
282
+ * @param {Array<Feature<Geometry>>} lineList 线数组
283
+ * @param {Function} callback 回调函数 返回 Feature, 及原properties
284
+ * @returns 不返回值 通过回调函数获取打断后数据
285
+ */
172
286
  static lineCrossesSplit(layer: GraphicLayer, lineList: Array<Feature<Geometry>>, callback: Function): void;
287
+ /**
288
+ * @description:擦除线
289
+ * @param {layer} layer GraphicLayer 图层
290
+ * @param {number[]} coordinate 擦除点位置
291
+ * @param {number} bufferExtent 点缓冲大小,以中心点辐射一个圆形,单位km
292
+ * @param {Array<Feature<Geometry>>} lineList 线数组
293
+ * @param {Function} callback 回调函数 返回 Feature, 及原properties
294
+ * @returns 不返回值 通过回调函数获取打断后数据
295
+ */
173
296
  static lineErase(layer: GraphicLayer, coordinate: number[], bufferExtent: number, lineList: Array<Feature<Geometry>>, callback: Function): void;
174
297
  /**
175
- * 转为geoJson格式
176
- * @param {Feature<Geometry>} Feature
177
- * @returns
178
- */
298
+ * @description 转为geoJson格式,不改变坐标系
299
+ * @param {Feature<Geometry>} Feature
300
+ * @returns
301
+ */
179
302
  static featureToJson(Feature: Feature<Geometry>): import("geojson").Feature<import("geojson").Geometry, {
180
303
  [name: string]: any;
181
304
  }>;
182
305
  /**
183
- * 转为geoJson格式
184
- * @param {Feature<Geometry>} Feature
185
- * @return {GeoJSONFeature} "EPSG:4326" Object.
186
- */
306
+ * @description:转为geoJson格式,元数据为3857转为4326
307
+ * @param {Feature<Geometry>} Feature
308
+ * @return {GeoJSONFeature} "EPSG:4326" Object.
309
+ */
187
310
  static featureTo4326(Feature: Feature<Geometry>): any;
188
311
  /**
189
- * 转为geoJson数组格式
190
- * @param {Feature<Geometry>[]} Feature
191
- * @return {GeoJSONFeature} "EPSG:4326" Object.
192
- */
312
+ * @description 转为geoJson数组格式,适用于数组转换
313
+ * @param {Feature<Geometry>[]} Feature
314
+ * @return {GeoJSONFeature} "EPSG:4326" Object.
315
+ */
193
316
  static featuresTo4326(Feature: Feature<Geometry>[]): import("geojson").FeatureCollection<import("geojson").Geometry, {
194
317
  [name: string]: any;
195
318
  }>;
319
+ /**
320
+ * @description 获取中心点坐标
321
+ * @param {Feature<Geometry>[]} Feature
322
+ * @return {Coordinate} "EPSG:4326" Object.
323
+ */
196
324
  static getCenter(feature: Feature<Geometry> | Geometry): import("ol/coordinate").Coordinate;
325
+ /**
326
+ * @description 转为geoJson数组格式,4326转3857
327
+ * @param {Feature<Geometry>[]} Feature
328
+ * @return {GeoJSONFeature} "EPSG:4326" Object.
329
+ */
197
330
  static to3857(Feature: any): Feature<Geometry>;
331
+ /**
332
+ * @description 转为geoJson数组格式,适用于数组转换
333
+ * @param {Feature<Geometry>[]} Feature
334
+ * @return {GeoJSONFeature} "EPSG:4326" Object.
335
+ */
198
336
  static to3857_featureList(Features: any): Feature<Geometry>[];
337
+ static lineClipPolygon(clipLine: Feature<Geometry>, polygonList: Feature<Geometry>[], callback: Function, errCallback: Function): void;
338
+ /**
339
+ * geoJson数据处理模块(需要引入turf.js)
340
+ * 输入输出数据均为标准geoJson格式
341
+ */
342
+ static geoUtil: {
343
+ /**
344
+ * 合并多边形
345
+ */
346
+ unionPolygon: (polygons: any) => any;
347
+ /**
348
+ * 线分割面
349
+ * 面类型只能是polygon 但可以是环
350
+ * 注:线与多边形必须有两个交点
351
+ */
352
+ polygonClipByLine: (polygon: any, clipLine: any) => any;
353
+ _singlePolygonClip: (polyLine: any, clipLine: any) => turf.helpers.FeatureCollection<turf.helpers.Polygon, {
354
+ [name: string]: any;
355
+ }>;
356
+ _multiPolygonClip: (polyLine: any, clipLine: any) => turf.helpers.FeatureCollection<turf.helpers.Polygon, {
357
+ [name: string]: any;
358
+ }>;
359
+ /**
360
+ * 连接两条线
361
+ * 方法会将两条线段最近的一段直接连接
362
+ */
363
+ connectLine: (line1: any, line2: any) => turf.helpers.Feature<turf.helpers.LineString, {
364
+ [name: string]: any;
365
+ }>;
366
+ /**
367
+ * 判断点是否在线里面
368
+ * 注:线组成的坐标对比
369
+ */
370
+ isOnLine: (point: any, line: any) => boolean;
371
+ /**
372
+ * 获得两条线交点
373
+ */
374
+ getIntersectPoints: (line1: any, line2: any) => turf.helpers.FeatureCollection<turf.helpers.Point, {
375
+ [name: string]: any;
376
+ }>;
377
+ /**
378
+ * multiPolygon转polygons,不涉及属性
379
+ */
380
+ multiPolygon2polygons: (multiPolygon: any) => any[];
381
+ /**
382
+ * polygons转multiPolygon,不涉及属性,只输出属性为{}
383
+ * 考虑polygons中就存在多面的情况
384
+ */
385
+ polygons2MultiPolygon: (geoJson: any) => {
386
+ type: string;
387
+ features: {
388
+ geometry: {
389
+ coordinates: any[];
390
+ type: string;
391
+ };
392
+ type: string;
393
+ properties: {};
394
+ }[];
395
+ };
396
+ };
199
397
  }