@supermapgis/iclient-ol 11.2.0
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 +97 -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 +500 -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 +124963 -0
- package/dist/iclient-openlayers-es6.min.js +8 -0
- package/dist/iclient-openlayers.css +668 -0
- package/dist/iclient-openlayers.js +142946 -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 +150 -0
- package/mapping/SuperMapCloud.js +56 -0
- package/mapping/Tianditu.js +152 -0
- package/mapping/TileSuperMapRest.js +374 -0
- package/mapping/WebMap.js +5485 -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 +100 -0
- package/overlay/Graph.js +439 -0
- package/overlay/GraphMap.js +140 -0
- package/overlay/Graphic.js +588 -0
- package/overlay/HeatMap.js +450 -0
- package/overlay/Label.js +966 -0
- package/overlay/Mapv.js +149 -0
- package/overlay/Range.js +129 -0
- package/overlay/RankSymbol.js +94 -0
- package/overlay/Turf.js +299 -0
- package/overlay/Unique.js +124 -0
- package/overlay/VectorTileSuperMapRest.js +501 -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 +64 -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 +413 -0
- package/overlay/mapv/index.js +5 -0
- package/overlay/theme/GeoFeature.js +275 -0
- package/overlay/theme/Theme.js +587 -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 +377 -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 +30 -0
- package/services/AddressMatchService.js +60 -0
- package/services/ChartService.js +97 -0
- package/services/DataFlowService.js +119 -0
- package/services/DatasetService.js +104 -0
- package/services/DatasourceService.js +76 -0
- package/services/FeatureService.js +260 -0
- package/services/FieldService.js +53 -0
- package/services/GeoprocessingService.js +157 -0
- package/services/GridCellInfosService.js +53 -0
- package/services/ImageCollectionService.js +93 -0
- package/services/ImageService.js +70 -0
- package/services/KnowledgeGraphService.js +96 -0
- package/services/LayerInfoService.js +85 -0
- package/services/MapService.js +85 -0
- package/services/MeasureService.js +77 -0
- package/services/NetworkAnalyst3DService.js +93 -0
- package/services/NetworkAnalystService.js +268 -0
- package/services/ProcessingService.js +507 -0
- package/services/QueryService.js +116 -0
- package/services/ServiceBase.js +26 -0
- package/services/SpatialAnalystService.js +466 -0
- package/services/ThemeService.js +50 -0
- package/services/TrafficTransferAnalystService.js +93 -0
- package/services/WebPrintingJobService.js +112 -0
- package/services/index.js +27 -0
|
@@ -0,0 +1,382 @@
|
|
|
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 } from '../../core/Util';
|
|
5
|
+
import LineString from 'ol/geom/LineString';
|
|
6
|
+
|
|
7
|
+
export var olExtends = function(targetMap) {
|
|
8
|
+
//解决olms.js插件,在使用ol.js时沿线标注不显示的问题,因为ol.geom.LineString.getFlatMidpoint未非公开方法
|
|
9
|
+
if (!LineString.prototype.getFlatMidpoint) {
|
|
10
|
+
LineString.prototype.getFlatMidpoint = function() {
|
|
11
|
+
return this.getCoordinateAt(0.5);
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
if (Util.getOlVersion() === '4' && window && window.ol && window.ol.geom.flat) {
|
|
16
|
+
// for ol4-debug
|
|
17
|
+
window.targetMapCache = targetMap;
|
|
18
|
+
let ol = window.ol;
|
|
19
|
+
//解决 new ol.format.MVT({featureClass: ol.Feature})时,非3857显示异常的问题。ol即将发布的5.0版本已解决。
|
|
20
|
+
// eslint-disable-next-line no-unused-vars
|
|
21
|
+
ol.format.MVT.prototype.readProjection = function(source) {
|
|
22
|
+
return new ol.proj.Projection({
|
|
23
|
+
code: '',
|
|
24
|
+
units: ol.proj.Units.TILE_PIXELS
|
|
25
|
+
});
|
|
26
|
+
};
|
|
27
|
+
//解决 new ol.format.MVT({featureClass: ol.Feature})时,非3857显示异常的问题。ol即将发布的5.0版本已解决。
|
|
28
|
+
// eslint-disable-next-line no-unused-vars
|
|
29
|
+
ol.format.MVT.prototype.readProjection = function(source) {
|
|
30
|
+
return new ol.proj.Projection({
|
|
31
|
+
code: '',
|
|
32
|
+
units: ol.proj.Units.TILE_PIXELS
|
|
33
|
+
});
|
|
34
|
+
};
|
|
35
|
+
//解决面填充时不能整版填充的问题。ol即将发布的5.0版本已解决。
|
|
36
|
+
// eslint-disable-next-line no-unused-vars
|
|
37
|
+
ol.render.canvas.Replay.prototype.applyFill = function(state, geometry) {
|
|
38
|
+
var fillStyle = state.fillStyle;
|
|
39
|
+
var fillInstruction = [ol.render.canvas.Instruction.SET_FILL_STYLE, fillStyle];
|
|
40
|
+
if (typeof fillStyle !== 'string') {
|
|
41
|
+
var viewExtent = window.targetMapCache
|
|
42
|
+
.getView()
|
|
43
|
+
.getProjection()
|
|
44
|
+
.getExtent();
|
|
45
|
+
fillInstruction.push([viewExtent[0], viewExtent[3]]);
|
|
46
|
+
}
|
|
47
|
+
this.instructions.push(fillInstruction);
|
|
48
|
+
};
|
|
49
|
+
//解决面填充时不能整版填充的问题。ol即将发布的5.0版本已解决。
|
|
50
|
+
// eslint-disable-next-line no-unused-vars
|
|
51
|
+
ol.render.canvas.Replay.prototype.applyFill = function(state, geometry) {
|
|
52
|
+
var fillStyle = state.fillStyle;
|
|
53
|
+
var fillInstruction = [ol.render.canvas.Instruction.SET_FILL_STYLE, fillStyle];
|
|
54
|
+
if (typeof fillStyle !== 'string') {
|
|
55
|
+
var viewExtent = window.targetMapCache
|
|
56
|
+
.getView()
|
|
57
|
+
.getProjection()
|
|
58
|
+
.getExtent();
|
|
59
|
+
fillInstruction.push([viewExtent[0], viewExtent[3]]);
|
|
60
|
+
}
|
|
61
|
+
this.instructions.push(fillInstruction);
|
|
62
|
+
};
|
|
63
|
+
//解决在多面时,第一个面是逆时针时无法显示的问题。该问题由组件修复。
|
|
64
|
+
ol.format.MVT.prototype.createFeature_ = function(pbf, rawFeature, opt_options) {
|
|
65
|
+
var type = rawFeature.type;
|
|
66
|
+
if (type === 0) {
|
|
67
|
+
return null;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
var feature;
|
|
71
|
+
var id = rawFeature.id;
|
|
72
|
+
var values = rawFeature.properties;
|
|
73
|
+
values[this.layerName_] = rawFeature.layer.name;
|
|
74
|
+
|
|
75
|
+
var flatCoordinates = [];
|
|
76
|
+
var ends = [];
|
|
77
|
+
ol.format.MVT.readRawGeometry_(pbf, rawFeature, flatCoordinates, ends);
|
|
78
|
+
|
|
79
|
+
var geometryType = ol.format.MVT.getGeometryType_(type, ends.length);
|
|
80
|
+
|
|
81
|
+
if (this.featureClass_ === ol.render.Feature) {
|
|
82
|
+
feature = new this.featureClass_(geometryType, flatCoordinates, ends, values, id);
|
|
83
|
+
} else {
|
|
84
|
+
var geom;
|
|
85
|
+
if (geometryType == ol.geom.GeometryType.POLYGON) {
|
|
86
|
+
var endss = [];
|
|
87
|
+
var offset = 0;
|
|
88
|
+
var prevEndIndex = 0;
|
|
89
|
+
for (var i = 0, ii = ends.length; i < ii; ++i) {
|
|
90
|
+
var end = ends[i];
|
|
91
|
+
if (!ol.geom.flat.orient.linearRingIsClockwise(flatCoordinates, offset, end, 2)) {
|
|
92
|
+
endss.push(ends.slice(prevEndIndex, i + 1));
|
|
93
|
+
prevEndIndex = i + 1;
|
|
94
|
+
}
|
|
95
|
+
offset = end;
|
|
96
|
+
}
|
|
97
|
+
if (endss.length > 1) {
|
|
98
|
+
ends = endss;
|
|
99
|
+
geom = new ol.geom.MultiPolygon(null);
|
|
100
|
+
} else {
|
|
101
|
+
geom = new ol.geom.Polygon(null);
|
|
102
|
+
}
|
|
103
|
+
} else {
|
|
104
|
+
geom =
|
|
105
|
+
geometryType === ol.geom.GeometryType.POINT
|
|
106
|
+
? new ol.geom.Point(null)
|
|
107
|
+
: geometryType === ol.geom.GeometryType.LINE_STRING
|
|
108
|
+
? new ol.geom.LineString(null)
|
|
109
|
+
: geometryType === ol.geom.GeometryType.POLYGON
|
|
110
|
+
? new ol.geom.Polygon(null)
|
|
111
|
+
: geometryType === ol.geom.GeometryType.MULTI_POINT
|
|
112
|
+
? new ol.geom.MultiPoint(null)
|
|
113
|
+
: geometryType === ol.geom.GeometryType.MULTI_LINE_STRING
|
|
114
|
+
? new ol.geom.MultiLineString(null)
|
|
115
|
+
: null;
|
|
116
|
+
}
|
|
117
|
+
if (geom) {
|
|
118
|
+
geom.setFlatCoordinates(ol.geom.GeometryLayout.XY, flatCoordinates, ends);
|
|
119
|
+
feature = new this.featureClass_();
|
|
120
|
+
if (this.geometryName_) {
|
|
121
|
+
feature.setGeometryName(this.geometryName_);
|
|
122
|
+
}
|
|
123
|
+
var geometry = ol.format.Feature.transformWithOptions(geom, false, this.adaptOptions(opt_options));
|
|
124
|
+
feature.setGeometry(geometry);
|
|
125
|
+
feature.setId(id);
|
|
126
|
+
feature.setProperties(values);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
return feature;
|
|
131
|
+
};
|
|
132
|
+
//解决中文沿线表述显示不符合中文阅读习惯的问题
|
|
133
|
+
ol.geom.flat.textpath.lineString = function(
|
|
134
|
+
flatCoordinates,
|
|
135
|
+
offset,
|
|
136
|
+
end,
|
|
137
|
+
stride,
|
|
138
|
+
text,
|
|
139
|
+
measure,
|
|
140
|
+
startM,
|
|
141
|
+
maxAngle
|
|
142
|
+
) {
|
|
143
|
+
var result = [];
|
|
144
|
+
|
|
145
|
+
// Keep text upright
|
|
146
|
+
var anglereverse = Math.atan2(
|
|
147
|
+
flatCoordinates[end - stride + 1] - flatCoordinates[offset + 1],
|
|
148
|
+
flatCoordinates[end - stride] - flatCoordinates[offset]
|
|
149
|
+
);
|
|
150
|
+
var reverse = anglereverse < -0.785 || anglereverse > 2.356; //0.785//2.356
|
|
151
|
+
var isRotateUp =
|
|
152
|
+
(anglereverse < -0.785 && anglereverse > -2.356) || (anglereverse > 0.785 && anglereverse < 2.356);
|
|
153
|
+
|
|
154
|
+
var numChars = text.length;
|
|
155
|
+
|
|
156
|
+
var x1 = flatCoordinates[offset];
|
|
157
|
+
var y1 = flatCoordinates[offset + 1];
|
|
158
|
+
offset += stride;
|
|
159
|
+
var x2 = flatCoordinates[offset];
|
|
160
|
+
var y2 = flatCoordinates[offset + 1];
|
|
161
|
+
var segmentM = 0;
|
|
162
|
+
var segmentLength = Math.sqrt(Math.pow(x2 - x1, 2) + Math.pow(y2 - y1, 2));
|
|
163
|
+
|
|
164
|
+
while (offset < end - stride && segmentM + segmentLength < startM) {
|
|
165
|
+
x1 = x2;
|
|
166
|
+
y1 = y2;
|
|
167
|
+
offset += stride;
|
|
168
|
+
x2 = flatCoordinates[offset];
|
|
169
|
+
y2 = flatCoordinates[offset + 1];
|
|
170
|
+
segmentM += segmentLength;
|
|
171
|
+
segmentLength = Math.sqrt(Math.pow(x2 - x1, 2) + Math.pow(y2 - y1, 2));
|
|
172
|
+
}
|
|
173
|
+
var interpolate = (startM - segmentM) / segmentLength;
|
|
174
|
+
var x0 = ol.math.lerp(x1, x2, interpolate); //起始点
|
|
175
|
+
var y0 = ol.math.lerp(y1, y2, interpolate); //起始点
|
|
176
|
+
|
|
177
|
+
var chunk = '';
|
|
178
|
+
var chunkLength = 0;
|
|
179
|
+
var data, index, previousAngle, previousLang;
|
|
180
|
+
for (var i = 0; i < numChars; ++i) {
|
|
181
|
+
index = reverse ? numChars - i - 1 : i;
|
|
182
|
+
var char = text.charAt(index);
|
|
183
|
+
var charcode = char.charCodeAt(0);
|
|
184
|
+
var ischinese = charcode >= 19968 && charcode <= 40907;
|
|
185
|
+
chunk = reverse ? char + chunk : chunk + char;
|
|
186
|
+
var charLength = measure(chunk) - chunkLength;
|
|
187
|
+
chunkLength += charLength;
|
|
188
|
+
//var charM = startM + charLength / 2;
|
|
189
|
+
while (
|
|
190
|
+
offset < end - stride &&
|
|
191
|
+
Math.sqrt(Math.pow(x2 - x0, 2) + Math.pow(y2 - y0, 2)) < charLength / 2
|
|
192
|
+
) {
|
|
193
|
+
x1 = x2;
|
|
194
|
+
y1 = y2;
|
|
195
|
+
offset += stride;
|
|
196
|
+
x2 = flatCoordinates[offset];
|
|
197
|
+
y2 = flatCoordinates[offset + 1];
|
|
198
|
+
}
|
|
199
|
+
var a = Math.pow(x2 - x1, 2) + Math.pow(y2 - y1, 2);
|
|
200
|
+
var b = 2 * (x2 - x1) * (x1 - x0) + 2 * (y2 - y1) * (y1 - y0);
|
|
201
|
+
var c = Math.pow(x1 - x0, 2) + Math.pow(y1 - y0, 2) - Math.pow(charLength / 2, 2);
|
|
202
|
+
var scale1 = (-b + Math.sqrt(b * b - 4 * a * c)) / (2 * a);
|
|
203
|
+
var scale2 = (-b - Math.sqrt(b * b - 4 * a * c)) / (2 * a);
|
|
204
|
+
interpolate =
|
|
205
|
+
scale1 < 0 || scale1 > 1
|
|
206
|
+
? scale2
|
|
207
|
+
: scale2 < 0 || scale2 > 1
|
|
208
|
+
? scale1
|
|
209
|
+
: scale1 < scale2
|
|
210
|
+
? scale2
|
|
211
|
+
: scale1;
|
|
212
|
+
var x = ol.math.lerp(x1, x2, interpolate);
|
|
213
|
+
var y = ol.math.lerp(y1, y2, interpolate);
|
|
214
|
+
|
|
215
|
+
while (offset < end - stride && Math.sqrt(Math.pow(x2 - x, 2) + Math.pow(y2 - y, 2)) < charLength / 2) {
|
|
216
|
+
x1 = x2;
|
|
217
|
+
y1 = y2;
|
|
218
|
+
offset += stride;
|
|
219
|
+
x2 = flatCoordinates[offset];
|
|
220
|
+
y2 = flatCoordinates[offset + 1];
|
|
221
|
+
}
|
|
222
|
+
a = Math.pow(x2 - x1, 2) + Math.pow(y2 - y1, 2);
|
|
223
|
+
b = 2 * (x2 - x1) * (x1 - x) + 2 * (y2 - y1) * (y1 - y);
|
|
224
|
+
c = Math.pow(x1 - x, 2) + Math.pow(y1 - y, 2) - Math.pow(charLength / 2, 2);
|
|
225
|
+
scale1 = (-b + Math.sqrt(b * b - 4 * a * c)) / (2 * a);
|
|
226
|
+
scale2 = (-b - Math.sqrt(b * b - 4 * a * c)) / (2 * a);
|
|
227
|
+
interpolate =
|
|
228
|
+
scale1 < 0 || scale1 > 1
|
|
229
|
+
? scale2
|
|
230
|
+
: scale2 < 0 || scale2 > 1
|
|
231
|
+
? scale1
|
|
232
|
+
: scale1 < scale2
|
|
233
|
+
? scale2
|
|
234
|
+
: scale1;
|
|
235
|
+
var x3 = ol.math.lerp(x1, x2, interpolate);
|
|
236
|
+
var y3 = ol.math.lerp(y1, y2, interpolate);
|
|
237
|
+
var angle = Math.atan2(y3 - y0, x3 - x0);
|
|
238
|
+
|
|
239
|
+
if (reverse) {
|
|
240
|
+
angle += angle > 0 ? -Math.PI : Math.PI;
|
|
241
|
+
}
|
|
242
|
+
if (ischinese && isRotateUp) {
|
|
243
|
+
angle += angle > 0 ? -Math.PI / 2 : Math.PI / 2;
|
|
244
|
+
}
|
|
245
|
+
if (previousAngle !== undefined) {
|
|
246
|
+
var delta = angle - previousAngle;
|
|
247
|
+
delta += delta > Math.PI ? -2 * Math.PI : delta < -Math.PI ? 2 * Math.PI : 0;
|
|
248
|
+
if (
|
|
249
|
+
ischinese === previousLang
|
|
250
|
+
? Math.abs(delta) > maxAngle
|
|
251
|
+
: Math.abs(delta) > maxAngle + Math.PI / 2
|
|
252
|
+
) {
|
|
253
|
+
return null;
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
if (previousAngle == angle && !isRotateUp) {
|
|
258
|
+
if (reverse) {
|
|
259
|
+
data[0] = x;
|
|
260
|
+
data[1] = y;
|
|
261
|
+
data[2] = charLength / 2;
|
|
262
|
+
}
|
|
263
|
+
data[4] = chunk;
|
|
264
|
+
} else {
|
|
265
|
+
chunk = char;
|
|
266
|
+
chunkLength = charLength;
|
|
267
|
+
data = [x, y, charLength / 2, angle, chunk];
|
|
268
|
+
if (reverse) {
|
|
269
|
+
result.unshift(data);
|
|
270
|
+
} else {
|
|
271
|
+
result.push(data);
|
|
272
|
+
}
|
|
273
|
+
previousAngle = angle;
|
|
274
|
+
previousLang = ischinese;
|
|
275
|
+
}
|
|
276
|
+
x0 = x3;
|
|
277
|
+
y0 = y3;
|
|
278
|
+
startM += charLength;
|
|
279
|
+
}
|
|
280
|
+
return result;
|
|
281
|
+
};
|
|
282
|
+
//以下两个方法解决在大数据量图斑时,内存疯长的问题。该改法引发新问题:无法点选要素
|
|
283
|
+
ol.layer.VectorTile.prototype.setFastRender = function(fastRender) {
|
|
284
|
+
return (this.fastRender = fastRender);
|
|
285
|
+
};
|
|
286
|
+
ol.renderer.canvas.VectorTileLayer.prototype.postCompose = function(context, frameState, layerState) {
|
|
287
|
+
var layer = this.getLayer();
|
|
288
|
+
var declutterReplays = layer.getDeclutter() ? {} : null;
|
|
289
|
+
var source = /** @type {ol.source.VectorTile} */ (layer.getSource());
|
|
290
|
+
var renderMode = layer.getRenderMode();
|
|
291
|
+
var replayTypes = ol.renderer.canvas.VectorTileLayer.VECTOR_REPLAYS[renderMode];
|
|
292
|
+
var pixelRatio = frameState.pixelRatio;
|
|
293
|
+
var rotation = frameState.viewState.rotation;
|
|
294
|
+
var size = frameState.size;
|
|
295
|
+
var offsetX, offsetY;
|
|
296
|
+
if (rotation) {
|
|
297
|
+
offsetX = Math.round((pixelRatio * size[0]) / 2);
|
|
298
|
+
offsetY = Math.round((pixelRatio * size[1]) / 2);
|
|
299
|
+
ol.render.canvas.rotateAtOffset(context, -rotation, offsetX, offsetY);
|
|
300
|
+
}
|
|
301
|
+
if (declutterReplays) {
|
|
302
|
+
this.declutterTree_.clear();
|
|
303
|
+
}
|
|
304
|
+
var tiles = this.renderedTiles;
|
|
305
|
+
var tileGrid = source.getTileGridForProjection(frameState.viewState.projection);
|
|
306
|
+
var clips = [];
|
|
307
|
+
var zs = [];
|
|
308
|
+
for (var i = tiles.length - 1; i >= 0; --i) {
|
|
309
|
+
var tile = /** @type {ol.VectorImageTile} */ (tiles[i]);
|
|
310
|
+
if (tile.getState() == ol.TileState.ABORT) {
|
|
311
|
+
continue;
|
|
312
|
+
}
|
|
313
|
+
var tileCoord = tile.tileCoord;
|
|
314
|
+
var worldOffset =
|
|
315
|
+
tileGrid.getTileCoordExtent(tileCoord)[0] - tileGrid.getTileCoordExtent(tile.wrappedTileCoord)[0];
|
|
316
|
+
var transform = undefined;
|
|
317
|
+
for (var t = 0, tt = tile.tileKeys.length; t < tt; ++t) {
|
|
318
|
+
var sourceTile = tile.getTile(tile.tileKeys[t]);
|
|
319
|
+
if (sourceTile.getState() == ol.TileState.ERROR) {
|
|
320
|
+
continue;
|
|
321
|
+
}
|
|
322
|
+
var replayGroup = sourceTile.getReplayGroup(layer, tileCoord.toString());
|
|
323
|
+
if (
|
|
324
|
+
renderMode != ol.layer.VectorTileRenderType.VECTOR &&
|
|
325
|
+
(!replayGroup || !replayGroup.hasReplays(replayTypes))
|
|
326
|
+
) {
|
|
327
|
+
if (layer.fastRender === true) {
|
|
328
|
+
sourceTile.replayGroups_ = {};
|
|
329
|
+
sourceTile.features_ = [];
|
|
330
|
+
}
|
|
331
|
+
continue;
|
|
332
|
+
}
|
|
333
|
+
if (!transform) {
|
|
334
|
+
transform = this.getTransform(frameState, worldOffset);
|
|
335
|
+
}
|
|
336
|
+
var currentZ = sourceTile.tileCoord[0];
|
|
337
|
+
var currentClip = replayGroup.getClipCoords(transform);
|
|
338
|
+
context.save();
|
|
339
|
+
context.globalAlpha = layerState.opacity;
|
|
340
|
+
// Create a clip mask for regions in this low resolution tile that are
|
|
341
|
+
// already filled by a higher resolution tile
|
|
342
|
+
for (var j = 0, jj = clips.length; j < jj; ++j) {
|
|
343
|
+
var clip = clips[j];
|
|
344
|
+
if (currentZ < zs[j]) {
|
|
345
|
+
context.beginPath();
|
|
346
|
+
// counter-clockwise (outer ring) for current tile
|
|
347
|
+
context.moveTo(currentClip[0], currentClip[1]);
|
|
348
|
+
context.lineTo(currentClip[2], currentClip[3]);
|
|
349
|
+
context.lineTo(currentClip[4], currentClip[5]);
|
|
350
|
+
context.lineTo(currentClip[6], currentClip[7]);
|
|
351
|
+
// clockwise (inner ring) for higher resolution tile
|
|
352
|
+
context.moveTo(clip[6], clip[7]);
|
|
353
|
+
context.lineTo(clip[4], clip[5]);
|
|
354
|
+
context.lineTo(clip[2], clip[3]);
|
|
355
|
+
context.lineTo(clip[0], clip[1]);
|
|
356
|
+
context.clip();
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
replayGroup.replay(context, transform, rotation, {}, replayTypes, declutterReplays);
|
|
360
|
+
context.restore();
|
|
361
|
+
clips.push(currentClip);
|
|
362
|
+
zs.push(currentZ);
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
if (declutterReplays) {
|
|
366
|
+
ol.render.canvas.ReplayGroup.replayDeclutter(declutterReplays, context, rotation);
|
|
367
|
+
}
|
|
368
|
+
if (rotation) {
|
|
369
|
+
ol.render.canvas.rotateAtOffset(
|
|
370
|
+
context,
|
|
371
|
+
rotation,
|
|
372
|
+
/** @type {number} */
|
|
373
|
+
(offsetX),
|
|
374
|
+
/** @type {number} */ (offsetY)
|
|
375
|
+
);
|
|
376
|
+
}
|
|
377
|
+
ol.renderer.canvas.TileLayer.prototype.postCompose.apply(this, arguments);
|
|
378
|
+
};
|
|
379
|
+
}
|
|
380
|
+
};
|
|
381
|
+
window.olExtends = olExtends;
|
|
382
|
+
|
package/package.json
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@supermapgis/iclient-ol",
|
|
3
|
+
"description": "",
|
|
4
|
+
"version": "11.2.0",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"SuperMap",
|
|
7
|
+
"OpenLayers"
|
|
8
|
+
],
|
|
9
|
+
"main": "namespace.js",
|
|
10
|
+
"homepage": "https://iclient.supermap.io",
|
|
11
|
+
"repository": {
|
|
12
|
+
"type": "git",
|
|
13
|
+
"url": "https://github.com/SuperMap/iClient-JavaScript.git"
|
|
14
|
+
},
|
|
15
|
+
"author": "SuperMap",
|
|
16
|
+
"license": "Apache-2.0",
|
|
17
|
+
"dependencies": {
|
|
18
|
+
"@supermapgis/iclient-common": "11.2.0",
|
|
19
|
+
"@supermapgis/tile-decryptor": "^1.0.0",
|
|
20
|
+
"@turf/turf": "6.5.0",
|
|
21
|
+
"mapv": "2.0.62",
|
|
22
|
+
"ol": "7.5.2",
|
|
23
|
+
"proj4": "2.11.0",
|
|
24
|
+
"canvg": "3.0.10",
|
|
25
|
+
"lodash.remove": "^4.7.0",
|
|
26
|
+
"lodash.difference": "^4.5.0",
|
|
27
|
+
"flatgeobuf": "3.31.1",
|
|
28
|
+
"rbush": "^2.0.2"
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
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 {ServiceBase} from './ServiceBase';
|
|
5
|
+
import { AddressMatchService as CommonAddressMatchService } from '@supermapgis/iclient-common/iServer/AddressMatchService';
|
|
6
|
+
import { Util as CommonUtil } from '@supermapgis/iclient-common/commontypes/Util';
|
|
7
|
+
/**
|
|
8
|
+
* @class AddressMatchService
|
|
9
|
+
* @category iServer AddressMatch
|
|
10
|
+
* @classdesc 地址匹配服务类。此类提供了地址的正向匹配和反向匹配功能,正向匹配即通过地点名称关键词查找地址位置,反向匹配即根据位置坐标查询地点。
|
|
11
|
+
* @modulecategory Services
|
|
12
|
+
* @example
|
|
13
|
+
* new AddressMatchService(url,options)
|
|
14
|
+
* .code(function(result){
|
|
15
|
+
* //doSomething
|
|
16
|
+
* })
|
|
17
|
+
* @param {string} url - 服务地址。
|
|
18
|
+
* @param {Object} options - 参数。
|
|
19
|
+
* @param {string} [options.proxy] - 服务代理地址。
|
|
20
|
+
* @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
|
|
21
|
+
* @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
|
|
22
|
+
* @param {Object} [options.headers] - 请求头。
|
|
23
|
+
* @extends {ServiceBase}
|
|
24
|
+
* @usage
|
|
25
|
+
*/
|
|
26
|
+
export class AddressMatchService extends ServiceBase {
|
|
27
|
+
|
|
28
|
+
constructor(url, options) {
|
|
29
|
+
super(url, options);
|
|
30
|
+
this._addressMatchService = new CommonAddressMatchService(this.url, {
|
|
31
|
+
proxy: this.options.proxy,
|
|
32
|
+
withCredentials: this.options.withCredentials,
|
|
33
|
+
crossOrigin: this.options.crossOrigin,
|
|
34
|
+
headers: this.options.headers
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* @function AddressMatchService.prototype.code
|
|
40
|
+
* @description 获取正向地址匹配结果。
|
|
41
|
+
* @param {GeoCodingParameter} params - 正向匹配参数。
|
|
42
|
+
* @param {RequestCallback} [callback] 回调函数,该参数未传时可通过返回的 promise 获取结果。
|
|
43
|
+
* @returns {Promise} Promise 对象。
|
|
44
|
+
*/
|
|
45
|
+
code(params, callback) {
|
|
46
|
+
return this._addressMatchService.code(CommonUtil.urlPathAppend(this.url, 'geocoding'), params, callback);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* @function AddressMatchService.prototype.decode
|
|
51
|
+
* @description 获取反向地址匹配结果。
|
|
52
|
+
* @param {GeoDecodingParameter} params - 反向匹配参数。
|
|
53
|
+
* @param {RequestCallback} [callback] 回调函数,该参数未传时可通过返回的 promise 获取结果。
|
|
54
|
+
* @returns {Promise} Promise 对象。
|
|
55
|
+
*/
|
|
56
|
+
decode(params, callback) {
|
|
57
|
+
return this._addressMatchService.decode(CommonUtil.urlPathAppend(this.url, 'geodecoding'), params, callback);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
}
|
|
@@ -0,0 +1,97 @@
|
|
|
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} from '../core/Util';
|
|
5
|
+
import { Bounds } from '@supermapgis/iclient-common/commontypes/Bounds';
|
|
6
|
+
import { DataFormat } from '@supermapgis/iclient-common/REST';
|
|
7
|
+
import {ServiceBase} from './ServiceBase';
|
|
8
|
+
import { ChartService as CommonChartService } from '@supermapgis/iclient-common/iServer/ChartService';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* @class ChartService
|
|
12
|
+
* @category iServer Map Chart
|
|
13
|
+
* @classdesc 海图服务类。海图是一种以海洋水域及沿岸地物为主要绘制对象的地图,为航海的安全性提供必备的数据基础。<br>
|
|
14
|
+
* 此类提供方法:获取海图物标信息、查询海图服务。海图物标信息指的是描述各产品规范的物标的基本信息,包括物标的名称、类型及与该物标相关的属性等。
|
|
15
|
+
* @modulecategory Services
|
|
16
|
+
* @extends {ServiceBase}
|
|
17
|
+
* @example
|
|
18
|
+
* new ChartService(url,{
|
|
19
|
+
* fieldNameFormatter: function(fieldName){
|
|
20
|
+
* return fieldName + 'test'
|
|
21
|
+
* }
|
|
22
|
+
* }).queryChart(param,function(result){
|
|
23
|
+
* //doSomething
|
|
24
|
+
* })
|
|
25
|
+
* @param {string} url - 服务地址。
|
|
26
|
+
* @param {Object} options - 参数。
|
|
27
|
+
* @param {string} [options.proxy] - 服务代理地址。
|
|
28
|
+
* @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
|
|
29
|
+
* @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
|
|
30
|
+
* @param {Object} [options.headers] - 请求头。
|
|
31
|
+
* @param {function} [options.fieldNameFormatter] - 对查询返回结果的字段名进行自定义。
|
|
32
|
+
* @usage
|
|
33
|
+
*/
|
|
34
|
+
export class ChartService extends ServiceBase {
|
|
35
|
+
|
|
36
|
+
constructor(url, options) {
|
|
37
|
+
super(url, options);
|
|
38
|
+
this._chartService = new CommonChartService(url, options);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* @function ChartService.prototype.queryChart
|
|
43
|
+
* @description 查询海图服务。
|
|
44
|
+
* @param {ChartQueryParameters} params - 海图查询所需参数类。
|
|
45
|
+
* @param {RequestCallback} [callback] 回调函数,该参数未传时可通过返回的 promise 获取结果。
|
|
46
|
+
* @param {DataFormat} resultFormat - 返回结果类型。
|
|
47
|
+
* @returns {Promise} Promise 对象。
|
|
48
|
+
*/
|
|
49
|
+
queryChart(params, callback, resultFormat) {
|
|
50
|
+
params = this._processParams(params);
|
|
51
|
+
return this._chartService.queryChart(params, callback, resultFormat);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* @function ChartService.prototype.getChartFeatureInfo
|
|
56
|
+
* @description 获取海图物标信息服务。
|
|
57
|
+
* @param {RequestCallback} [callback] 回调函数,该参数未传时可通过返回的 promise 获取结果。
|
|
58
|
+
* @returns {Promise} Promise 对象。
|
|
59
|
+
*/
|
|
60
|
+
getChartFeatureInfo(callback) {
|
|
61
|
+
return this._chartService.getChartFeatureInfo(callback);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* @function ChartService.prototype.getChartAcronymClassify
|
|
66
|
+
* @version 11.2.0
|
|
67
|
+
* @description 获取海图产品规范物标分组信息服务。
|
|
68
|
+
* @param {RequestCallback} [callback] 回调函数,该参数未传时可通过返回的promise 获取结果。
|
|
69
|
+
* @returns {Promise} Promise 对象。
|
|
70
|
+
*/
|
|
71
|
+
getChartAcronymClassify(callback) {
|
|
72
|
+
return this._chartService.getChartAcronymClassify(callback);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
_processFormat(resultFormat) {
|
|
76
|
+
return resultFormat ? resultFormat : DataFormat.GEOJSON;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
_processParams(params) {
|
|
80
|
+
if (!params) {
|
|
81
|
+
return {};
|
|
82
|
+
}
|
|
83
|
+
params.returnContent = (params.returnContent == null) ? true : params.returnContent;
|
|
84
|
+
if (params.filter) {
|
|
85
|
+
params.chartQueryFilterParameters = Util.isArray(params.filter) ? params.filter : [params.filter];
|
|
86
|
+
}
|
|
87
|
+
if (params.bounds) {
|
|
88
|
+
params.bounds = new Bounds(
|
|
89
|
+
params.bounds[0],
|
|
90
|
+
params.bounds[1],
|
|
91
|
+
params.bounds[2],
|
|
92
|
+
params.bounds[3]
|
|
93
|
+
);
|
|
94
|
+
}
|
|
95
|
+
return params;
|
|
96
|
+
}
|
|
97
|
+
}
|