@supermapgis/iclient-ol 11.1.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.
- package/README.md +56 -0
- package/control/ChangeTileVersion.js +438 -0
- package/control/Logo.js +99 -0
- package/control/ScaleLine.js +164 -0
- package/control/index.js +6 -0
- package/core/MapExtend.js +49 -0
- package/core/StyleUtils.js +1253 -0
- package/core/Util.js +478 -0
- package/core/index.js +6 -0
- package/css/ChangeTileVersion.css +347 -0
- package/css/index.js +5 -0
- package/dist/iclient-openlayers-es6.js +121806 -0
- package/dist/iclient-openlayers-es6.min.js +8 -0
- package/dist/iclient-openlayers.css +668 -0
- package/dist/iclient-openlayers.js +132335 -0
- package/dist/iclient-openlayers.min.css +8 -0
- package/dist/iclient-openlayers.min.js +8 -0
- package/index.js +9 -0
- package/mapping/BaiduMap.js +121 -0
- package/mapping/ImageSuperMapRest.js +252 -0
- package/mapping/ImageTileSuperMapRest.js +99 -0
- package/mapping/InitMap.js +125 -0
- package/mapping/SuperMapCloud.js +56 -0
- package/mapping/Tianditu.js +152 -0
- package/mapping/TileSuperMapRest.js +358 -0
- package/mapping/WebMap.js +5185 -0
- package/mapping/index.js +11 -0
- package/mapping/webmap/Util.js +176 -0
- package/mapping/webmap/config/MunicipalCenter.json +1 -0
- package/mapping/webmap/config/ProvinceCenter.json +1 -0
- package/mapping/webmap/config/SampleDataInfo.json +55 -0
- package/namespace.js +150 -0
- package/overlay/DataFlow.js +114 -0
- package/overlay/FGB.js +97 -0
- package/overlay/Graph.js +436 -0
- package/overlay/GraphMap.js +91 -0
- package/overlay/Graphic.js +587 -0
- package/overlay/HeatMap.js +444 -0
- package/overlay/Label.js +964 -0
- package/overlay/Mapv.js +146 -0
- package/overlay/Range.js +127 -0
- package/overlay/RankSymbol.js +94 -0
- package/overlay/Turf.js +298 -0
- package/overlay/Unique.js +123 -0
- package/overlay/VectorTileSuperMapRest.js +466 -0
- package/overlay/graphic/CanvasRenderer.js +177 -0
- package/overlay/graphic/CloverShape.js +133 -0
- package/overlay/graphic/Graphic.js +174 -0
- package/overlay/graphic/HitCloverShape.js +63 -0
- package/overlay/graphic/WebGLRenderer.js +356 -0
- package/overlay/graphic/index.js +9 -0
- package/overlay/index.js +21 -0
- package/overlay/mapv/MapvCanvasLayer.js +104 -0
- package/overlay/mapv/MapvLayer.js +410 -0
- package/overlay/mapv/index.js +5 -0
- package/overlay/theme/GeoFeature.js +275 -0
- package/overlay/theme/Theme.js +585 -0
- package/overlay/theme/ThemeFeature.js +46 -0
- package/overlay/theme/index.js +6 -0
- package/overlay/vectortile/DeafultCanvasStyle.js +125 -0
- package/overlay/vectortile/MapboxStyles.js +375 -0
- package/overlay/vectortile/StyleMap.js +252 -0
- package/overlay/vectortile/VectorTileStyles.js +554 -0
- package/overlay/vectortile/index.js +7 -0
- package/overlay/vectortile/olExtends.js +382 -0
- package/package.json +29 -0
- package/services/AddressMatchService.js +60 -0
- package/services/ChartService.js +74 -0
- package/services/DataFlowService.js +118 -0
- package/services/DatasetService.js +104 -0
- package/services/DatasourceService.js +76 -0
- package/services/FeatureService.js +196 -0
- package/services/FieldService.js +53 -0
- package/services/GeoprocessingService.js +156 -0
- package/services/GridCellInfosService.js +53 -0
- package/services/ImageCollectionService.js +92 -0
- package/services/ImageService.js +69 -0
- package/services/KnowledgeGraphService.js +82 -0
- package/services/LayerInfoService.js +85 -0
- package/services/MapService.js +85 -0
- package/services/MeasureService.js +77 -0
- package/services/NetworkAnalyst3DService.js +88 -0
- package/services/NetworkAnalystService.js +252 -0
- package/services/ProcessingService.js +478 -0
- package/services/QueryService.js +116 -0
- package/services/ServiceBase.js +26 -0
- package/services/SpatialAnalystService.js +432 -0
- package/services/ThemeService.js +50 -0
- package/services/TrafficTransferAnalystService.js +88 -0
- package/services/WebPrintingJobService.js +112 -0
- package/services/index.js +27 -0
package/overlay/Mapv.js
ADDED
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
/* Copyright© 2000 - 2024 SuperMap Software Co.Ltd. All rights reserved.
|
|
2
|
+
* This program are made available under the terms of the Apache License, Version 2.0
|
|
3
|
+
* which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
|
|
4
|
+
import {
|
|
5
|
+
MapvLayer
|
|
6
|
+
} from './mapv/MapvLayer';
|
|
7
|
+
import {
|
|
8
|
+
Util
|
|
9
|
+
} from '../core/Util';
|
|
10
|
+
import ImageCanvasSource from 'ol/source/ImageCanvas';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* @class Mapv
|
|
14
|
+
* @browsernamespace ol.source
|
|
15
|
+
* @category Visualization MapV
|
|
16
|
+
* @classdesc MapV 图层源。
|
|
17
|
+
* @modulecategory Overlay
|
|
18
|
+
* @param {Object} opt_options - 参数。
|
|
19
|
+
* @param {ol.Map} opt_options.map - 当前 Map 对象。
|
|
20
|
+
* @param {Mapv.DataSet} opt_options.dataSet - MapV 的数据集。
|
|
21
|
+
* @param {Object} opt_options.mapvOptions - MapV 的配置对象。
|
|
22
|
+
* @param {string} [opt_options.logo] - Logo(openLayers 5.0.0 及更高版本不再支持此参数)。
|
|
23
|
+
* @param {ol.proj.Projection} [opt_options.projection] - 投影信息。
|
|
24
|
+
* @param {number} [opt_options.ratio=1.5] - 视图比,1 表示画布是地图视口的大小,2 表示地图视口的宽度和高度的两倍,依此类推。必须是 1 或更高。
|
|
25
|
+
* @param {Array} [opt_options.resolutions] - 分辨率数组。
|
|
26
|
+
* @param {ol.source.State} [opt_options.state] - 资源状态。
|
|
27
|
+
* @param {(string|Object)} [opt_options.attributions='© 2018 百度 MapV with <span>© <a href='https://iclient.supermap.io' target='_blank'>SuperMap iClient</a></span>'] - 版权信息。
|
|
28
|
+
* @extends {ol.source.ImageCanvas}
|
|
29
|
+
* @usage
|
|
30
|
+
*/
|
|
31
|
+
export class Mapv extends ImageCanvasSource {
|
|
32
|
+
|
|
33
|
+
constructor(opt_options) {
|
|
34
|
+
var options = opt_options ? opt_options : {};
|
|
35
|
+
super({
|
|
36
|
+
attributions: options.attributions || "© 2018 百度 MapV with <span>© SuperMap iClient</span>",
|
|
37
|
+
canvasFunction: canvasFunctionInternal_,
|
|
38
|
+
logo: Util.getOlVersion() === '4' ? options.logo : null,
|
|
39
|
+
projection: options.projection,
|
|
40
|
+
ratio: options.ratio,
|
|
41
|
+
resolutions: options.resolutions,
|
|
42
|
+
state: options.state
|
|
43
|
+
});
|
|
44
|
+
this.map = opt_options.map;
|
|
45
|
+
this.dataSet = opt_options.dataSet;
|
|
46
|
+
this.mapvOptions = opt_options.mapvOptions;
|
|
47
|
+
|
|
48
|
+
function canvasFunctionInternal_(extent, resolution, pixelRatio, size, projection) { // eslint-disable-line no-unused-vars
|
|
49
|
+
var mapWidth = size[0] / pixelRatio;
|
|
50
|
+
var mapHeight = size[1] / pixelRatio;
|
|
51
|
+
var width = this.map.getSize()[0];
|
|
52
|
+
var height = this.map.getSize()[1];
|
|
53
|
+
if (!this.layer) {
|
|
54
|
+
this.layer = new MapvLayer(this.map, this.dataSet, this.mapvOptions, mapWidth, mapHeight, this);
|
|
55
|
+
}
|
|
56
|
+
this.layer.pixelRatio = pixelRatio;
|
|
57
|
+
this.layer.offset = [(mapWidth - width) / 2 , (mapHeight - height) / 2 ];
|
|
58
|
+
if (!this.rotate) {
|
|
59
|
+
this.rotate = this.map.getView().getRotation();
|
|
60
|
+
} else {
|
|
61
|
+
if (this.rotate !== this.map.getView().getRotation()) {
|
|
62
|
+
this.layer.canvasLayer.resize(mapWidth, mapHeight);
|
|
63
|
+
this.rotate = this.map.getView().getRotation()
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
var canvas = this.layer.canvasLayer.canvas;
|
|
67
|
+
if (!this.layer.isEnabledTime()) {
|
|
68
|
+
this.layer.canvasLayer.resize(mapWidth, mapHeight);
|
|
69
|
+
this.layer.canvasLayer.draw();
|
|
70
|
+
}
|
|
71
|
+
if (!this.context) {
|
|
72
|
+
this.context = Util.createCanvasContext2D(mapWidth, mapHeight);
|
|
73
|
+
}
|
|
74
|
+
var canvas2 = this.context.canvas;
|
|
75
|
+
this.context.clearRect(0, 0, canvas2.width, canvas2.height);
|
|
76
|
+
canvas2.width = size[0];
|
|
77
|
+
canvas2.height = size[1];
|
|
78
|
+
canvas2.style.width = size[0] + "px";
|
|
79
|
+
canvas2.style.height = size[1] + "px";
|
|
80
|
+
this.context.drawImage(canvas, 0, 0);
|
|
81
|
+
if (this.resolution !== resolution || JSON.stringify(this.extent) !== JSON.stringify(extent)) {
|
|
82
|
+
this.resolution = resolution;
|
|
83
|
+
this.extent = extent;
|
|
84
|
+
}
|
|
85
|
+
return this.context.canvas;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* @function Mapv.prototype.addData
|
|
91
|
+
* @description 追加数据。
|
|
92
|
+
* @param {Object} data - 要追加的数据。
|
|
93
|
+
* @param {Object} options - 要追加的值。
|
|
94
|
+
*/
|
|
95
|
+
addData(data, options) {
|
|
96
|
+
this.layer.addData(data, options);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* @function Mapv.prototype.getData
|
|
101
|
+
* @description 获取数据。
|
|
102
|
+
* @returns {Mapv.DataSet} MapV 数据集。
|
|
103
|
+
*/
|
|
104
|
+
getData() {
|
|
105
|
+
if (this.layer) {
|
|
106
|
+
this.dataSet = this.layer.getData();
|
|
107
|
+
}
|
|
108
|
+
return this.dataSet;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* @function Mapv.prototype.removeData
|
|
113
|
+
* @description 删除符合过滤条件的数据。
|
|
114
|
+
* @param {function} filter - 过滤条件。条件参数为数据项,返回值为 true,表示删除该元素;否则表示不删除。
|
|
115
|
+
* @example
|
|
116
|
+
* filter=function(data){
|
|
117
|
+
* if(data.id=="1"){
|
|
118
|
+
* return true
|
|
119
|
+
* }
|
|
120
|
+
* return false;
|
|
121
|
+
* }
|
|
122
|
+
*/
|
|
123
|
+
removeData(filter) {
|
|
124
|
+
this.layer && this.layer.removeData(filter);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* @function Mapv.prototype.clearData
|
|
129
|
+
* @description 清除数据。
|
|
130
|
+
*/
|
|
131
|
+
clearData() {
|
|
132
|
+
this.layer.clearData();
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* @function Mapv.prototype.update
|
|
138
|
+
* @description 更新数据。
|
|
139
|
+
* @param {Object} options - 待更新的数据。
|
|
140
|
+
* @param {Object} options.data - mapv 数据集。
|
|
141
|
+
*/
|
|
142
|
+
update(options) {
|
|
143
|
+
this.layer.update(options);
|
|
144
|
+
this.changed();
|
|
145
|
+
}
|
|
146
|
+
}
|
package/overlay/Range.js
ADDED
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
/* Copyright© 2000 - 2024 SuperMap Software Co.Ltd. All rights reserved.
|
|
2
|
+
* This program are made available under the terms of the Apache License, Version 2.0
|
|
3
|
+
* which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
|
|
4
|
+
import { Util as CommonUtil} from '@supermapgis/iclient-common/commontypes/Util';
|
|
5
|
+
import { ShapeFactory } from '@supermapgis/iclient-common/overlay/feature/ShapeFactory';
|
|
6
|
+
import { ThemeVector } from '@supermapgis/iclient-common/overlay/ThemeVector';
|
|
7
|
+
import {GeoFeature} from './theme/GeoFeature';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* @class Range
|
|
11
|
+
* @browsernamespace ol.source
|
|
12
|
+
* @category Visualization Theme
|
|
13
|
+
* @classdesc 分段专题图图层源。
|
|
14
|
+
* @param {string} name - 名称
|
|
15
|
+
* @param {Object} opt_options - 参数。
|
|
16
|
+
* @param {ol.Map} opt_options.map - 当前map对象。
|
|
17
|
+
* @param {string} opt_options.themeField - 指定创建专题图字段。
|
|
18
|
+
* @param {string} [opt_options.id] - 专题图层 ID。默认使用 CommonUtil.createUniqueID("themeLayer_") 创建专题图层 ID。
|
|
19
|
+
* @param {number} [opt_options.opacity = 1] - 图层透明度。
|
|
20
|
+
* @param {string} [opt_options.logo] - Logo(openLayers 5.0.0 及更高版本不再支持此参数)。
|
|
21
|
+
* @param {ol.proj.Projection} [opt_options.projection] - 投影信息。
|
|
22
|
+
* @param {number} [opt_options.ratio=1.5] - 视图比,1 表示画布是地图视口的大小,2 表示地图视口的宽度和高度的两倍,依此类推。必须是 1 或更高。
|
|
23
|
+
* @param {Array} [opt_options.resolutions] - 分辨率数组。
|
|
24
|
+
* @param {ol.source.State} [opt_options.state] - 资源状态。
|
|
25
|
+
* @param {Object} [opt_options.style] - 专题图样式。
|
|
26
|
+
* @param {Object} [opt_options.styleGroups] - 各专题类型样式组。
|
|
27
|
+
* @param {boolean} [opt_options.isHoverAble = false] - 是否开启 hover 事件。
|
|
28
|
+
* @param {Object} [opt_options.highlightStyle] - 开启 hover 事件后,触发的样式风格。
|
|
29
|
+
* @param {(string|Object)} [opt_options.attributions='Map Data <span>© <a href='http://support.supermap.com.cn/product/iServer.aspx' target='_blank'>SuperMap iServer</a></span> with <span>© <a href='https://iclient.supermap.io' target='_blank'>SuperMap iClient</a></span>'] - 版权信息。
|
|
30
|
+
* @extends {GeoFeature}
|
|
31
|
+
* @usage
|
|
32
|
+
*/
|
|
33
|
+
export class Range extends GeoFeature {
|
|
34
|
+
|
|
35
|
+
constructor(name, opt_options) {
|
|
36
|
+
super(name, opt_options);
|
|
37
|
+
this.style = opt_options.style;
|
|
38
|
+
this.isHoverAble = opt_options.isHoverAble;
|
|
39
|
+
this.highlightStyle = opt_options.highlightStyle;
|
|
40
|
+
this.themeField = opt_options.themeField;
|
|
41
|
+
this.styleGroups = opt_options.styleGroups;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* @function Range.prototype.destroy
|
|
46
|
+
* @description 释放资源,将引用资源的属性置空。
|
|
47
|
+
*/
|
|
48
|
+
destroy() {
|
|
49
|
+
this.style = null;
|
|
50
|
+
this.themeField = null;
|
|
51
|
+
this.styleGroups = null;
|
|
52
|
+
GeoFeature.prototype.destroy.apply(this, arguments);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* @private
|
|
57
|
+
* @function Range.prototype.createThematicFeature
|
|
58
|
+
* @description 创建专题图要素。
|
|
59
|
+
* @param {Object} feature - 要创建的专题图形要素。
|
|
60
|
+
*/
|
|
61
|
+
createThematicFeature(feature) {
|
|
62
|
+
//赋 style
|
|
63
|
+
var style = this.getStyleByData(feature);
|
|
64
|
+
//创建专题要素时的可选参数
|
|
65
|
+
var options = {};
|
|
66
|
+
options.nodesClipPixel = this.nodesClipPixel;
|
|
67
|
+
options.isHoverAble = this.isHoverAble;
|
|
68
|
+
options.isMultiHover = this.isMultiHover;
|
|
69
|
+
options.isClickAble = this.isClickAble;
|
|
70
|
+
options.highlightStyle = ShapeFactory.transformStyle(this.highlightStyle);
|
|
71
|
+
|
|
72
|
+
//将数据转为专题要素(ThemeVector)
|
|
73
|
+
var thematicFeature = new ThemeVector(feature, this, ShapeFactory.transformStyle(style), options);
|
|
74
|
+
|
|
75
|
+
//直接添加图形到渲染器
|
|
76
|
+
for (var m = 0; m < thematicFeature.shapes.length; m++) {
|
|
77
|
+
this.renderer.addShape(thematicFeature.shapes[m]);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
return thematicFeature;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* @private
|
|
85
|
+
* @function Range.prototype.getStyleByData
|
|
86
|
+
* @description 通过数据获取 style。
|
|
87
|
+
* @param {Object} fea - 要素数据。
|
|
88
|
+
*/
|
|
89
|
+
getStyleByData(fea) {
|
|
90
|
+
var style = {};
|
|
91
|
+
var feature = fea;
|
|
92
|
+
style = CommonUtil.copyAttributesWithClip(style, this.style);
|
|
93
|
+
if (this.themeField && this.styleGroups && this.styleGroups.length > 0 && feature.attributes) {
|
|
94
|
+
var Sf = this.themeField;
|
|
95
|
+
var Attrs = feature.attributes;
|
|
96
|
+
var Gro = this.styleGroups;
|
|
97
|
+
var isSfInAttrs = false; //指定的 themeField 是否是 feature 的属性字段之一
|
|
98
|
+
var attr = null; //属性值
|
|
99
|
+
|
|
100
|
+
for (var property in Attrs) {
|
|
101
|
+
if (Sf === property) {
|
|
102
|
+
isSfInAttrs = true;
|
|
103
|
+
attr = Attrs[property];
|
|
104
|
+
break;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
//判断属性值是否属于styleGroups的某一个范围,以便对获取分组 style
|
|
108
|
+
if (isSfInAttrs) {
|
|
109
|
+
for (var i = 0, len = Gro.length; i < len; i++) {
|
|
110
|
+
if ((attr >= Gro[i].start) && (attr < Gro[i].end)) {
|
|
111
|
+
//feature.style = Util.copyAttributes(feature.style, this.defaultStyle);
|
|
112
|
+
var sty1 = Gro[i].style;
|
|
113
|
+
style = CommonUtil.copyAttributesWithClip(style, sty1);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
if (feature.style && this.isAllowFeatureStyle === true) {
|
|
119
|
+
style = CommonUtil.copyAttributesWithClip(feature.style);
|
|
120
|
+
}
|
|
121
|
+
return style;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
canvasFunctionInternal_(extent, resolution, pixelRatio, size, projection) { // eslint-disable-line no-unused-vars
|
|
125
|
+
return GeoFeature.prototype.canvasFunctionInternal_.apply(this, arguments);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/* Copyright© 2000 - 2024 SuperMap Software Co.Ltd. All rights reserved.
|
|
2
|
+
* This program are made available under the terms of the Apache License, Version 2.0
|
|
3
|
+
* which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
|
|
4
|
+
import { Theme as FeatureTheme } from '@supermapgis/iclient-common/overlay/feature/Theme';
|
|
5
|
+
import {Graph} from './Graph';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @class RankSymbol
|
|
9
|
+
* @browsernamespace ol.source
|
|
10
|
+
* @category Visualization Theme
|
|
11
|
+
* @classdesc 等级符号专题图图层源。
|
|
12
|
+
* @modulecategory Overlay
|
|
13
|
+
* @param {string} name - 专题图层名。
|
|
14
|
+
* @param {string} symbolType - 标志类型。
|
|
15
|
+
* @param {Object} opt_options - 参数。
|
|
16
|
+
* @param {ol.Map} opt_options.map - 当前 Map 对象。
|
|
17
|
+
* @param {string} opt_options.themeFields - 指定创建专题图字段。
|
|
18
|
+
* @param {Object} opt_options.symbolSetting - 符号 Circle 配置对象 symbolSetting(<{@link SuperMap.Layer.RankSymbol}>)。
|
|
19
|
+
* @param {Array.<number>} opt_options.symbolSetting.codomain - 图表允许展示的数据值域,长度为 2 的一维数组,第一个元素表示值域下限,第二个元素表示值域上限。
|
|
20
|
+
* @param {number} [opt_options.symbolSetting.maxR] - 圆形的最大半径。
|
|
21
|
+
* @param {number} [opt_options.symbolSetting.minR] - 圆形的最小半径。
|
|
22
|
+
* @param {string} [opt_options.symbolSetting.fillColor] - 圆形的填充色,如:fillColor: "#FFB980"。
|
|
23
|
+
* @param {Object} [opt_options.symbolSetting.circleStyle] - 圆形的基础 style,此参数控制圆形基础样式,优先级低于 circleStyleByFields 和 circleStyleByCodomain。
|
|
24
|
+
* @param {number} [opt_options.symbolSetting.decimalNumber] - 数据值数组 dataValues 元素值小数位数,数据的小数位处理参数,取值范围:[0, 16]。如果不设置此参数,在取数据值时不对数据做小数位处理。
|
|
25
|
+
* @param {Object} [opt_options.symbolSetting.circleHoverStyle] - 圆形 hover 状态时的样式,circleHoverAble 为 true 时有效。
|
|
26
|
+
* @param {boolean} [opt_options.symbolSetting.circleHoverAble=true] - 是否允许圆形使用 hover 状态。同时设置 circleHoverAble 和 circleClickAble 为 false,可以直接屏蔽图形对专题图层事件的响应。
|
|
27
|
+
* @param {boolean} [opt_options.symbolSetting.circleClickAble=true] - 是否允许圆形被点击。同时设置 circleHoverAble 和 circleClickAble 为 false,可以直接屏蔽图形对专题图层事件的响应。
|
|
28
|
+
* @param {string} [opt_options.id] - 专题图层 ID。默认使用 CommonUtil.createUniqueID("themeLayer_") 创建专题图层 ID。
|
|
29
|
+
* @param {number} [opt_options.opacity=1] - 图层透明度。
|
|
30
|
+
* @param {string} [opt_options.logo] - Logo(openLayers 5.0.0 及更高版本不再支持此参数)。
|
|
31
|
+
* @param {ol.proj.Projection} [opt_options.projection] - 投影信息。
|
|
32
|
+
* @param {number} [opt_options.ratio=1.5] - 视图比,1 表示画布是地图视口的大小,2 表示地图视口的宽度和高度的两倍,依此类推。必须是 1 或更高。
|
|
33
|
+
* @param {Array} [opt_options.resolutions] - 分辨率数组。
|
|
34
|
+
* @param {ol.source.State} [opt_options.state] - 资源状态。
|
|
35
|
+
* @param {boolean} [opt_options.isOverLay=true] - 是否进行压盖处理,如果设为 true,图表绘制过程中将隐藏对已在图层中绘制的图表产生压盖的图表。
|
|
36
|
+
* @param {(string|Object)} [opt_options.attributions='Map Data <span>© <a href='http://support.supermap.com.cn/product/iServer.aspx' target='_blank'>SuperMap iServer</a></span> with <span>© <a href='https://iclient.supermap.io' target='_blank'>SuperMap iClient</a></span>'] - 版权信息。
|
|
37
|
+
* @extends {Graph}
|
|
38
|
+
* @usage
|
|
39
|
+
*/
|
|
40
|
+
export class RankSymbol extends Graph {
|
|
41
|
+
|
|
42
|
+
constructor(name, symbolType, opt_options) {
|
|
43
|
+
super(name, symbolType, opt_options);
|
|
44
|
+
this.symbolType = symbolType;
|
|
45
|
+
this.symbolSetting = opt_options.symbolSetting;
|
|
46
|
+
this.themeField = opt_options.themeField;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* @function RankSymbol.prototype.destroy
|
|
51
|
+
* @description 释放资源,将引用资源的属性置空。
|
|
52
|
+
*/
|
|
53
|
+
destroy() {
|
|
54
|
+
this.symbolType = null;
|
|
55
|
+
this.symbolSetting = null;
|
|
56
|
+
this.themeField = null;
|
|
57
|
+
Graph.prototype.destroy.apply(this, arguments);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* @function RankSymbol.prototype.setSymbolType
|
|
62
|
+
* @description 设置标志符号。
|
|
63
|
+
* @param {string} symbolType - 符号类型。
|
|
64
|
+
*/
|
|
65
|
+
setSymbolType(symbolType) {
|
|
66
|
+
this.symbolType = symbolType;
|
|
67
|
+
this.redraw();
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* @private
|
|
72
|
+
* @function RankSymbol.prototype.createThematicFeature
|
|
73
|
+
* @description 创建专题图形要素。
|
|
74
|
+
* @param {Object} feature - 要创建的专题图形要素。
|
|
75
|
+
*/
|
|
76
|
+
createThematicFeature(feature) {
|
|
77
|
+
var thematicFeature;
|
|
78
|
+
// 检查图形创建条件并创建图形
|
|
79
|
+
if (FeatureTheme[this.symbolType] && this.themeField && this.symbolSetting) {
|
|
80
|
+
thematicFeature = new FeatureTheme[this.symbolType](feature, this, [this.themeField], this.symbolSetting);
|
|
81
|
+
}
|
|
82
|
+
// thematicFeature 是否创建成功
|
|
83
|
+
if (!thematicFeature) {
|
|
84
|
+
return false;
|
|
85
|
+
}
|
|
86
|
+
// 对专题要素执行图形装载
|
|
87
|
+
thematicFeature.assembleShapes();
|
|
88
|
+
return thematicFeature;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
canvasFunctionInternal_(extent, resolution, pixelRatio, size, projection) { // eslint-disable-line no-unused-vars
|
|
92
|
+
return Graph.prototype.canvasFunctionInternal_.apply(this, arguments);
|
|
93
|
+
}
|
|
94
|
+
}
|