mirage2d 1.1.99 → 1.2.2

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.
@@ -1,5 +1,22 @@
1
- import { baseGraphicLayer } from "../../base/baseGraphicLayer";
2
1
  import { IArcGisFeatureOption } from "../../base/baseOptionType";
3
- export declare class ArcGisFeatureServiceLayer extends baseGraphicLayer {
2
+ import { GraphicLayer } from './GraphicLayer';
3
+ export declare class ArcGisFeatureServiceLayer extends GraphicLayer {
4
+ queryParams: any;
5
+ isLoading: boolean;
6
+ defaultExtent: any;
4
7
  constructor(layerid: string, options?: IArcGisFeatureOption);
8
+ private queryData;
9
+ /**
10
+ * @description: 查询arcgis server的参数,根据arcgis server要求传递
11
+ * @example
12
+ {
13
+ where: '1=1', // 过滤条件
14
+ outFields: '*', // 需要输出的字段
15
+ feature:feature// 绘制的要素与extent 2选1 同时存在时extent生效
16
+ extent: [x1, y1, x2,y2], //范围,不传递则默认当前视图范围
17
+ extentWkid: "102100" //范围坐标系 默认102100 可选4326
18
+
19
+ }
20
+ */
21
+ query(queryParams?: {}): void;
5
22
  }
@@ -1,12 +1,62 @@
1
- import { baseGraphicLayer } from "../../base/baseGraphicLayer";
2
- import { IGraphicLayerOption } from "../../base/baseOptionType";
3
- export declare class WfsLayer extends baseGraphicLayer {
1
+ import { IWFSFeatureOption } from "../../base/baseOptionType";
2
+ import { GraphicLayer } from "./GraphicLayer";
3
+ export declare class WfsLayer extends GraphicLayer {
4
4
  geoserverData: {
5
5
  wsName: string;
6
6
  uri: string;
7
7
  wfsURL: string;
8
8
  layer: string;
9
9
  };
10
- constructor(layerid: string, options?: IGraphicLayerOption);
10
+ queryParams: {
11
+ service: string;
12
+ request: string;
13
+ version: string;
14
+ outputFormat: string;
15
+ maxFeatures: string;
16
+ typeName: string;
17
+ } | any;
18
+ defaultExtent: any;
19
+ isLoading: boolean;
20
+ /**
21
+ * @description:设置要素属性
22
+ * @param {string} classname 分类名
23
+ * @param {IWFSFeatureOption} attribute 要素属性数组
24
+ * @example IWFSFeatureOption 中queryParams默认属性
25
+ * queryParams = {
26
+ service: "WFS",
27
+ request: "GetFeature",
28
+ version: "1.0.0",
29
+ outputFormat: "application/json",
30
+ maxFeatures: "1000",
31
+ typeName: "mars:hfjy",
32
+ bbox: "", // 范围,不传递时默认当前视图范围
33
+ filter: "", // 空间查询条件,当传递feature时系统自动生成 也可以自行配置GML格式
34
+ queryField: "", //属性查询字段
35
+ querykeyword: "",//属性查询字段关键字
36
+ autoShowFeature: false//自动显示,默认关闭,打开时会根据视图变化自动加载数据
37
+ }
38
+ */
39
+ constructor(layerid: string, options?: IWFSFeatureOption);
40
+ private queryData;
41
+ /**
42
+ * @description:查询数据方法
43
+ * @param {any} queryParams 可根据wfs查询参数自定义配置
44
+ * @example 默认属性
45
+ * queryParams = {
46
+ service: "WFS",
47
+ request: "GetFeature",
48
+ version: "1.0.0",
49
+ outputFormat: "application/json",
50
+ maxFeatures: "1000",
51
+ typeName: "mars:hfjy",
52
+ feature: //地图上绘制的feature:
53
+ bbox: "", // 范围,不传递时默认当前视图范围
54
+ filter: "", // 空间查询条件,当传递feature时系统自动生成 也可以自行配置GML格式
55
+ queryField: "", //属性查询字段
56
+ querykeyword: "",//属性查询字段关键字
57
+ autoShowFeature: false//自动显示,默认关闭,打开时会根据视图变化自动加载数据
58
+ }
59
+ */
60
+ query(queryParams?: {}): void;
11
61
  loadData(): void;
12
62
  }
@@ -163,7 +163,7 @@ export declare class SpatialAnalysis {
163
163
  * @param {Feature<Geometry>} polygon
164
164
  * @return {*} 计算后结果
165
165
  */
166
- static formatArea(polygon: any): any;
166
+ static formatArea(polygon: any, returnNumber?: boolean): any;
167
167
  /**
168
168
  * @description: 转化范围4326to3857
169
169
  * @param {Extent} box
@@ -347,6 +347,7 @@ export declare class SpatialAnalysis {
347
347
  */
348
348
  static to3857_featureList(Features: any): Feature<Geometry>[];
349
349
  static lineClipPolygon(clipLine: Feature<Geometry>, polygonList: Feature<Geometry>[], callback: Function, errCallback: Function): void;
350
+ static formatJsonTo3857(GeoJson: any): any;
350
351
  /**
351
352
  * geoJson数据处理模块(需要引入turf.js)
352
353
  * 输入输出数据均为标准geoJson格式
@@ -4,6 +4,7 @@ export declare enum XMapEventType {
4
4
  onMapMove = "onMapMove",
5
5
  onMapMoveEnd = "onMapMoveEnd",
6
6
  onZoomChange = "onZoomChange",
7
+ onCenterChange = "onCenterChange",
7
8
  onRemoveLayer = "onRemoveLayer",
8
9
  onChangeBaseLayer = "onChangeBaseLayer"
9
10
  }
@@ -24,8 +24,28 @@ export declare class baseGraphicLayer extends baseLayer {
24
24
  unbindContextmenu(): void;
25
25
  appendContextmenu(menu: any): void;
26
26
  protected _setFeatureContextmenu(feature: any, contextmenu: any): void;
27
- showTitle(dataType: string, isShow: boolean): void;
28
- showTitleByClassname(classname: string, isShow: boolean): void;
27
+ /**
28
+ * @description: 显示tile
29
+ * @param {string} dataType dataType字段属性
30
+ * @param {boolean} isShow 显示/关闭
31
+ * @param {string} showFieldName name 显示字段名 默认name
32
+ */
33
+ showTitle(dataType: string, isShow: boolean, showFieldName?: string): void;
34
+ /**
35
+ * @description: 显示tile
36
+ * @param {string} classname classname字段属性
37
+ * @param {boolean} isShow 显示/关闭
38
+ * @param {string} showFieldName name 显示字段名 默认name
39
+ */
40
+ showTitleByClassname(classname: string, isShow: boolean, showFieldName?: string): void;
41
+ /**
42
+ * @description: 显示tile
43
+ * @param {string} fieldname 字段名
44
+ * @param {string} fieldval 字段值
45
+ * @param {boolean} isShow 显示/关闭
46
+ * @param {string} showFieldName name 显示字段名 默认name
47
+ */
48
+ showTitleByField(fieldname: string, fieldval: string, isShow: boolean, showFieldName?: string): void;
29
49
  _bindPoupEvent(): void;
30
50
  bindPopup(popupInfo?: Array<ITooltipInfo> | string, option?: {
31
51
  offset: number[];
@@ -49,7 +69,16 @@ export declare class baseGraphicLayer extends baseLayer {
49
69
  * @param {any} GeoJson 标准GeoJson格式
50
70
  */
51
71
  addGeoJson(classname: string, GeoJson: any): void;
72
+ /**
73
+ * @description: 添加GeoJSON数据,多边形将转为点格式
74
+ * @param {string} classname 图层编号
75
+ * @param {any} GeoJson 标准GeoJson格式
76
+ */
52
77
  addGeoJsonPoint(classname: string, GeoJson: any): void;
78
+ /**
79
+ * @description: 转换geojson到Features
80
+ * @param {any} GeoJson 标准GeoJson格式
81
+ */
53
82
  convertGeoJsontoFeatures(GeoJson: any): any;
54
83
  /**
55
84
  * @description:设置要素属性
@@ -58,7 +87,7 @@ export declare class baseGraphicLayer extends baseLayer {
58
87
  * @param {Array<IFeatureAttribute>} attribute 要素属性数组
59
88
  */
60
89
  addFeatures(classname: string, featuresList: Array<Feature<Geometry>>, attribute?: IFeatureAttribute | any, callback?: Function): void;
61
- _getFeatureAttribute(classname?: string): IFeatureAttribute;
90
+ private _getFeatureAttribute;
62
91
  /**
63
92
  * @description:设置要素属性
64
93
  * @param {string} classname 分类名
@@ -118,23 +147,158 @@ export declare class baseGraphicLayer extends baseLayer {
118
147
  * @param {any} json
119
148
  */
120
149
  removeFeaturesByJson(json: any): void;
150
+ /**
151
+ * @description:替换{}字段
152
+ */
153
+ private replaceField;
154
+ /** 设置所有要素样式
155
+ * @description:
156
+ * @param {any} styleOptions
157
+ * @param {function} callback 回调函数,可选 回调会返回每个feature的getProperties()属性,根据属性使用回调函数设置每个要素的styleOptions样式
158
+ * @example styleOptions 内容
159
+ * {
160
+ Font: "12px Microsoft YaHei",
161
+ FontColor: "#8B4513",
162
+ FontStrokeColor: "#fff",
163
+ FontStrokeWidth: 2,
164
+ FontoffsetX: 0,
165
+ FontoffsetY: -10,
166
+ fillcolor: "rgba(0, 153, 255,1)",
167
+ strokecolor: "rgba(255, 255, 255,1)", // 通过要素拿到具体的值
168
+ strokewidth: 1,
169
+ radius: 10,
170
+ scale: 1,
171
+ text: "标注示例" //可以用{字段名}格式化显示字段
172
+ }
173
+ */
121
174
  setSymbol(styleOptions: any, callback?: Function): void;
175
+ /**
176
+ * @description:设置要素分级颜色样式,按字段名及字段值匹配设置
177
+ * @param {any} levelOption json参数
178
+ * @param {string} classname 参与分级的要素分组 classname
179
+ * @param {string} attributeName 参与分级的要素字段名
180
+ * @param {boolean} autolevel 是否自动分级,自动分级时默认5级颜色
181
+ * @param {Array<IlevelColor>} levelColor 分级设置
182
+ * @example
183
+ * levelColor:[
184
+ {
185
+ maxnum: 0, // 分级最大值
186
+ fillcolor: "rgba(255,255,255,0.1)",
187
+ strokecolor: "rgba(255, 255, 255,1)",
188
+ strokewidth: 1
189
+ },
190
+ {
191
+ maxnum: 1, // 分级最大值
192
+ fillcolor: "rgba(255,255,255,0.1)",
193
+ strokecolor: "rgba(255, 255, 255,1)",
194
+ strokewidth: 1
195
+ }
196
+ ]
197
+ */
122
198
  setSymbolLevelColor(levelOption: {
123
199
  classname: string;
124
200
  attributeName: string;
125
201
  autolevel?: boolean;
126
202
  levelColor?: Array<IlevelColor>;
127
203
  }): IlevelColor[];
204
+ /**
205
+ * @description:根据classname字段设置所有要素样式,按字段名及字段值匹配设置
206
+ * @param {string} classname
207
+ * @param {any[]} styleOptions
208
+ * @param {function} callback 回调函数,可选 回调会返回每个feature的getProperties()属性,根据属性使用回调函数设置每个要素的styleOptions样式
209
+ * @example styleOptions 是一个json结构
210
+ * {
211
+ Font: "12px Microsoft YaHei",
212
+ FontColor: "#8B4513",
213
+ FontStrokeColor: "#fff",
214
+ FontStrokeWidth: 2,
215
+ FontoffsetX: 0,
216
+ FontoffsetY: -10,
217
+ fillcolor: "rgba(0,0,0,0.5)",
218
+ strokecolor: "rgba(255,255,0,1)",
219
+ strokewidth: 1,
220
+ scale: 1,
221
+ radius: 10,
222
+ text: ""//可以用{字段名}格式化显示字段
223
+ }
224
+ */
128
225
  setSymbolByClassname(classname: any, styleOptions: any, callback?: Function): void;
226
+ /** 根据features设置所有要素样式,按字段名及字段值匹配设置
227
+ * @description:
228
+ * @param {any[]} styleClassOptions
229
+ * @param {function} callback 回调函数,可选 回调会返回每个feature的getProperties()属性,根据属性使用回调函数设置每个要素的styleOptions样式
230
+ * @example styleOptions 是一个json结构
231
+ * {
232
+ Font: "12px Microsoft YaHei",
233
+ FontColor: "#8B4513",
234
+ FontStrokeColor: "#fff",
235
+ FontStrokeWidth: 2,
236
+ FontoffsetX: 0,
237
+ FontoffsetY: -10,
238
+ fillcolor: "rgba(0,0,0,0.5)",
239
+ strokecolor: "rgba(255,255,0,1)",
240
+ strokewidth: 1,
241
+ scale: 1,
242
+ radius: 10,
243
+ text: ""//可以用{字段名}格式化显示字段
244
+ }
245
+ */
129
246
  setSymbolByFeatures(features: any, styleOptions: any, callback?: Function): void;
247
+ /** 设置所有要素样式,按字段名及字段值匹配设置
248
+ * @description:
249
+ * @param {any[]} styleClassOptions
250
+ * @example styleClassOptions 是一个数组结构
251
+ * [{
252
+ className: "字段名",
253
+ classValue: "字段值",
254
+ style: {
255
+ Font: "12px Microsoft YaHei",
256
+ FontColor: "#8B4513",
257
+ FontStrokeColor: "#fff",
258
+ FontStrokeWidth: 2,
259
+ FontoffsetX: 0,
260
+ FontoffsetY: -10,
261
+ fillcolor: "rgba(0,0,0,0.5)",
262
+ strokecolor: "rgba(255,255,0,1)",
263
+ strokewidth: 1,
264
+ scale: 1,
265
+ radius: 10,
266
+ text: ""//可以用{字段名}格式化显示字段
267
+ }
268
+ }]
269
+ */
130
270
  setSymbolByStyleClass(styleClassOptions: any): void;
131
- setClassSymbol(classname: any, styleClassOptions: any): void;
132
- /**设置标签启用
271
+ /** 设置所有要素样式,根据classname字段设置
133
272
  * @description:
134
273
  * @param {string} classname
274
+ * @param {any[]} styleClassOptions
275
+ * @example styleClassOptions 是一个数组结构
276
+ * [{ style 内是可选参数,根据需要设置
277
+ className: "字段名",
278
+ classValue: "字段值",
279
+ style: {
280
+ Font: "12px Microsoft YaHei",
281
+ FontColor: "#8B4513",
282
+ FontStrokeColor: "#fff",
283
+ FontStrokeWidth: 2,
284
+ FontoffsetX: 0,
285
+ FontoffsetY: -10,
286
+ fillcolor: "rgba(255, 221, 0, 1)",
287
+ strokecolor: "rgba(255, 255, 255,1)", //通过要素拿到具体的值
288
+ strokewidth: 1,
289
+ radius: 3,
290
+ scale: 1,
291
+ text: ""//可以用{字段名}格式化显示字段
292
+ },
293
+ }]
294
+ */
295
+ setClassSymbol(classname: any, styleClassOptions: any): void;
296
+ /**设置标签启用
297
+ * @description: 按dataType字段配置属性
298
+ * @param {string} dataTypeVal 属性中必须包含dataType字段
135
299
  * @param {boolean} isShow
136
300
  */
137
- setFeaturesTileByJson(classname: any, isShow: any): void;
301
+ setFeaturesTileByJson(dataTypeVal: any, isShow: any): void;
138
302
  clear(): void;
139
303
  /**
140
304
  * @description: 绘制图形
@@ -87,11 +87,33 @@ export interface IGraphicLayerOption extends ILayerOption {
87
87
  hashEdit?: boolean;
88
88
  hashMove?: boolean;
89
89
  hashSelect?: boolean;
90
+ declutter?: boolean;
90
91
  }
91
92
  export interface IArcGisFeatureOption extends IGraphicLayerOption {
92
- where?: string;
93
- outFields?: string;
94
- extent?: Array<number>;
93
+ queryParams: {
94
+ where?: string;
95
+ outFields?: string;
96
+ extent?: Array<number>;
97
+ extentWkid?: string;
98
+ onlyField?: string;
99
+ autoShowFeature?: boolean;
100
+ };
101
+ }
102
+ export interface IWFSFeatureOption extends IGraphicLayerOption {
103
+ queryParams: {
104
+ service?: string;
105
+ request?: string;
106
+ version?: string;
107
+ outputFormat?: string;
108
+ maxFeatures?: string;
109
+ typeName?: string;
110
+ bbox?: string;
111
+ filter?: string;
112
+ onlyField?: string;
113
+ queryField?: string;
114
+ querykeyword?: string;
115
+ autoShowFeature?: boolean;
116
+ };
95
117
  }
96
118
  export interface IImageCanvasLayerOption extends ILayerOption {
97
119
  line1Style?: string;