@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
|
@@ -0,0 +1,164 @@
|
|
|
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
|
+
|
|
5
|
+
import Scale from 'ol/control/ScaleLine';
|
|
6
|
+
import * as olProj from 'ol/proj';
|
|
7
|
+
import AssertionError from 'ol/AssertionError';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* @class ScaleLine
|
|
11
|
+
* @aliasclass control.ScaleLine
|
|
12
|
+
* @category Control
|
|
13
|
+
* @version 9.1.2
|
|
14
|
+
* @classdesc 比例尺控件。
|
|
15
|
+
* <div style="padding: 20px;border: 1px solid #eee;border-left-width: 5px;border-radius: 3px;border-left-color: #ce4844;">
|
|
16
|
+
* <p style="color: #ce4844">Notice</p>
|
|
17
|
+
* <p style="font-size: 13px">该功能继承 {@link ol.control.ScaleLine },与 {@link ol.control.ScaleLine } 功能完全相同。仅为修复 `openlayers` v4.6.5 版本中 WGS84 等地理坐标系比例尺数值错误的问题。
|
|
18
|
+
* </div>
|
|
19
|
+
* @modulecategory Control
|
|
20
|
+
* @extends {ol.control.ScaleLine}
|
|
21
|
+
* @param {Object} options -参数。
|
|
22
|
+
* @param {string} [options.className='ol-scale-line'] - CSS Class name.。
|
|
23
|
+
* @param {number} [options.minWidth=64] - 最小像素宽度。
|
|
24
|
+
* @param {(HTMLElement|string) } [options.target] - 指定比例尺控件目标容器。
|
|
25
|
+
* @param {(ol.control.ScaleLine.Units|string)} [options.units='metric'] - 上一个版本的按钮布局。
|
|
26
|
+
* @example
|
|
27
|
+
* var control = new ScaleLine();
|
|
28
|
+
* map.addControl(control)
|
|
29
|
+
* @usage
|
|
30
|
+
*/
|
|
31
|
+
export class ScaleLine extends Scale {
|
|
32
|
+
constructor(options) {
|
|
33
|
+
options = options || {};
|
|
34
|
+
//需在super之前定义render,真正的调用是在初始化完成后
|
|
35
|
+
options.render = function (mapEvent) {
|
|
36
|
+
var frameState = mapEvent.frameState;
|
|
37
|
+
if (!frameState) {
|
|
38
|
+
this.viewState_ = null; //NOSONAR
|
|
39
|
+
} else {
|
|
40
|
+
this.viewState_ = frameState.viewState; //NOSONAR
|
|
41
|
+
}
|
|
42
|
+
this.updateElementRepair(); //NOSONAR
|
|
43
|
+
};
|
|
44
|
+
super(options); //NOSONAR
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
updateElementRepair() {
|
|
48
|
+
const viewState = this.viewState_ || this.o || this.Om;
|
|
49
|
+
|
|
50
|
+
if (!viewState) {
|
|
51
|
+
this.renderedVisible_ = this.renderedVisible_ || this.j || this.yn;
|
|
52
|
+
if (this.renderedVisible_) {
|
|
53
|
+
this.element_ = this.element_ || this.c;
|
|
54
|
+
this.element.style.display = 'none';
|
|
55
|
+
this.renderedVisible_ = false;
|
|
56
|
+
}
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
const center = viewState.center;
|
|
61
|
+
const projection = viewState.projection;
|
|
62
|
+
const units = this.getUnits();
|
|
63
|
+
const pointResolutionUnits = units == "degrees" ?
|
|
64
|
+
"degrees" :
|
|
65
|
+
"m";
|
|
66
|
+
let pointResolution =
|
|
67
|
+
olProj.getPointResolution(projection, viewState.resolution, center, pointResolutionUnits);
|
|
68
|
+
this.minWidth_ = this.minWidth_ || this.v || this.Em;
|
|
69
|
+
let nominalCount = this.minWidth_ * pointResolution;
|
|
70
|
+
let suffix = '';
|
|
71
|
+
if (units == "degrees") {
|
|
72
|
+
const metersPerDegree = olProj.METERS_PER_UNIT["degrees"];
|
|
73
|
+
nominalCount *= metersPerDegree;
|
|
74
|
+
if (nominalCount < metersPerDegree / 60) {
|
|
75
|
+
suffix = '\u2033'; // seconds
|
|
76
|
+
pointResolution *= 3600;
|
|
77
|
+
} else if (nominalCount < metersPerDegree) {
|
|
78
|
+
suffix = '\u2032'; // minutes
|
|
79
|
+
pointResolution *= 60;
|
|
80
|
+
} else {
|
|
81
|
+
suffix = '\u00b0'; // degrees
|
|
82
|
+
}
|
|
83
|
+
} else if (units == "imperial") {
|
|
84
|
+
if (nominalCount < 0.9144) {
|
|
85
|
+
suffix = 'in';
|
|
86
|
+
pointResolution /= 0.0254;
|
|
87
|
+
} else if (nominalCount < 1609.344) {
|
|
88
|
+
suffix = 'ft';
|
|
89
|
+
pointResolution /= 0.3048;
|
|
90
|
+
} else {
|
|
91
|
+
suffix = 'mi';
|
|
92
|
+
pointResolution /= 1609.344;
|
|
93
|
+
}
|
|
94
|
+
} else if (units == "nautical") {
|
|
95
|
+
pointResolution /= 1852;
|
|
96
|
+
suffix = 'nm';
|
|
97
|
+
} else if (units == "metric") {
|
|
98
|
+
if (nominalCount < 0.001) {
|
|
99
|
+
suffix = 'μm';
|
|
100
|
+
pointResolution *= 1000000;
|
|
101
|
+
} else if (nominalCount < 1) {
|
|
102
|
+
suffix = 'mm';
|
|
103
|
+
pointResolution *= 1000;
|
|
104
|
+
} else if (nominalCount < 1000) {
|
|
105
|
+
suffix = 'm';
|
|
106
|
+
} else {
|
|
107
|
+
suffix = 'km';
|
|
108
|
+
pointResolution /= 1000;
|
|
109
|
+
}
|
|
110
|
+
} else if (units == "us") {
|
|
111
|
+
if (nominalCount < 0.9144) {
|
|
112
|
+
suffix = 'in';
|
|
113
|
+
pointResolution *= 39.37;
|
|
114
|
+
} else if (nominalCount < 1609.344) {
|
|
115
|
+
suffix = 'ft';
|
|
116
|
+
pointResolution /= 0.30480061;
|
|
117
|
+
} else {
|
|
118
|
+
suffix = 'mi';
|
|
119
|
+
pointResolution /= 1609.3472;
|
|
120
|
+
}
|
|
121
|
+
} else {
|
|
122
|
+
throw new AssertionError(33); // Invalid units
|
|
123
|
+
}
|
|
124
|
+
var DIGITS = [1, 2, 5];
|
|
125
|
+
let i = 3 * Math.floor(
|
|
126
|
+
Math.log(this.minWidth_ * pointResolution) / Math.log(10));
|
|
127
|
+
let count, width, decimalCount;
|
|
128
|
+
while (true) { //eslint-disable-line no-constant-condition
|
|
129
|
+
decimalCount = Math.floor(i / 3);
|
|
130
|
+
const decimal = Math.pow(10, decimalCount);
|
|
131
|
+
count = DIGITS[((i % 3) + 3) % 3] * decimal;
|
|
132
|
+
width = Math.round(count / pointResolution);
|
|
133
|
+
if (isNaN(width)) {
|
|
134
|
+
this.element.style.display = 'none';
|
|
135
|
+
this.renderedVisible_ = false;
|
|
136
|
+
return;
|
|
137
|
+
} else if (width >= this.minWidth_) {
|
|
138
|
+
break;
|
|
139
|
+
}
|
|
140
|
+
++i;
|
|
141
|
+
}
|
|
142
|
+
this.renderedHTML_ = this.renderedHTML_ || this.D || this.am;
|
|
143
|
+
this.innerElement_ = this.innerElement_ || this.l || this.Tm;
|
|
144
|
+
this.renderedWidth_ = this.renderedWidth_ || this.B || this.Am;
|
|
145
|
+
this.renderedVisible_ = this.renderedVisible_ || this.j || this.yn;
|
|
146
|
+
this.element_ = this.element_ || this.c;
|
|
147
|
+
let html= count.toFixed(decimalCount < 0 ? -decimalCount : 0) + ' ' + suffix;
|
|
148
|
+
if (this.renderedHTML_ != html) {
|
|
149
|
+
this.innerElement_.innerHTML = html;
|
|
150
|
+
this.renderedHTML_ = html;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
if (this.renderedWidth_ != width) {
|
|
154
|
+
this.innerElement_.style.width = width + 'px';
|
|
155
|
+
this.renderedWidth_ = width;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
if (!this.renderedVisible_) {
|
|
159
|
+
this.element.style.display = '';
|
|
160
|
+
this.renderedVisible_ = true;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
}
|
|
164
|
+
}
|
package/control/index.js
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
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
|
+
export {ChangeTileVersion} from './ChangeTileVersion';
|
|
5
|
+
export {ScaleLine} from './ScaleLine';
|
|
6
|
+
export {Logo} from './Logo';
|
|
@@ -0,0 +1,49 @@
|
|
|
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 olMap from 'ol/Map';
|
|
5
|
+
import LayerGroup from 'ol/layer/Group';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @function MapExtend
|
|
9
|
+
* @description 扩展 OpenLayers 的一些原始方法。
|
|
10
|
+
* @private
|
|
11
|
+
*/
|
|
12
|
+
export var MapExtend = function () {
|
|
13
|
+
const fun = function (layer, coordinate, resolution, callback, pixel, e) {
|
|
14
|
+
if (layer instanceof LayerGroup) {
|
|
15
|
+
layer.getLayers().forEach(function (subLayer) {
|
|
16
|
+
fun(subLayer, coordinate, resolution, callback, pixel, e)
|
|
17
|
+
});
|
|
18
|
+
} else {
|
|
19
|
+
//当前高效率点图层满足筛选条件/并且可视时,可被选中:
|
|
20
|
+
if (layer.getSource()._forEachFeatureAtCoordinate) {
|
|
21
|
+
layer.getSource()._forEachFeatureAtCoordinate(coordinate, resolution, (feature) => {
|
|
22
|
+
callback(feature, layer)
|
|
23
|
+
}, pixel, e);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
olMap.prototype.forEachFeatureAtPixelDefault = olMap.prototype.forEachFeatureAtPixel;
|
|
28
|
+
|
|
29
|
+
olMap.prototype.forEachFeatureAtPixel = olMap.prototype.Tc = function (pixel, callback, opt_options, e) {
|
|
30
|
+
|
|
31
|
+
//如果满足高效率图层选取要求优先返回高效率图层选中结果
|
|
32
|
+
const layerFilter = (opt_options && opt_options.layerFilter) ? opt_options.layerFilter : () => {
|
|
33
|
+
return true;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
const layers = this.getLayers().getArray();
|
|
37
|
+
const resolution = this.getView().getResolution();
|
|
38
|
+
const coordinate = this.getCoordinateFromPixel(pixel);
|
|
39
|
+
|
|
40
|
+
for (let i = 0; i < layers.length; i++) {
|
|
41
|
+
const layer = layers[i];
|
|
42
|
+
if (layer.getVisible() && layerFilter.call(null, layer)) {
|
|
43
|
+
fun(layer, coordinate, resolution, callback, pixel, e)
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
}
|
|
47
|
+
return this.forEachFeatureAtPixelDefault(pixel, callback, opt_options);
|
|
48
|
+
}
|
|
49
|
+
}();
|