@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,356 @@
|
|
|
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 { Unit } from "@supermapgis/iclient-common/REST";
|
|
6
|
+
import {Util} from "../../core/Util";
|
|
7
|
+
import BaseObject from 'ol/Object';
|
|
8
|
+
import * as olProj from 'ol/proj';
|
|
9
|
+
|
|
10
|
+
const emptyFunc = () => false;
|
|
11
|
+
const CSS_TRANSFORM = (function () {
|
|
12
|
+
let div = document.createElement('div');
|
|
13
|
+
let props = [
|
|
14
|
+
'transform',
|
|
15
|
+
'WebkitTransform',
|
|
16
|
+
'MozTransform',
|
|
17
|
+
'OTransform',
|
|
18
|
+
'msTransform'
|
|
19
|
+
];
|
|
20
|
+
|
|
21
|
+
for (let i = 0; i < props.length; i++) {
|
|
22
|
+
let prop = props[i];
|
|
23
|
+
if (div.style[prop] !== undefined) {
|
|
24
|
+
return prop;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
return props[0];
|
|
28
|
+
})();
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* @private
|
|
32
|
+
* @class GraphicWebGLRenderer
|
|
33
|
+
* @classdesc 高效率点图层 webgl 渲染器。
|
|
34
|
+
* @category Visualization Graphic
|
|
35
|
+
* @extends {ol.Object}
|
|
36
|
+
* @param {ol.source.Graphic} layer - 高效率点图层。
|
|
37
|
+
* @param {Object} options - 图层参数。
|
|
38
|
+
* @param {number} options.width - 地图宽度。
|
|
39
|
+
* @param {number} options.height - 地图高度。
|
|
40
|
+
* @param {HTMLElement} options.container - 放置渲染器的父元素。
|
|
41
|
+
* @param {Array.<number>} [options.color=[0, 0, 0, 255]] - 颜色,目前只支持 rgba 数组。
|
|
42
|
+
* @param {number} [options.radius=10] - 半径。
|
|
43
|
+
* @param {number} [options.opacity=0.8] - 不透明度。
|
|
44
|
+
* @param {Array} [options.highlightColor] - 高亮颜色,目前只支持 rgba 数组。
|
|
45
|
+
* @param {number} [options.radiusScale = 1] - 点放大倍数。
|
|
46
|
+
* @param {number} [options.radiusMinPixels = 0] - 半径最小值(像素)。
|
|
47
|
+
* @param {number} [options.radiusMaxPixels = Number.MAX_SAFE_INTEGER] - 半径最大值(像素)。
|
|
48
|
+
* @param {number} [options.strokeWidth = 1] - 边框大小。
|
|
49
|
+
* @param {boolean} [options.outline = false] - 是否显示边框。
|
|
50
|
+
* @param {function} [options.onClick] - 点击事件。
|
|
51
|
+
* @param {function} [options.onHover] - 悬停事件。
|
|
52
|
+
*/
|
|
53
|
+
export class GraphicWebGLRenderer extends BaseObject {
|
|
54
|
+
constructor(layer, options) {
|
|
55
|
+
super();
|
|
56
|
+
this.layer = layer;
|
|
57
|
+
this.map = layer.map;
|
|
58
|
+
let opt = options || {};
|
|
59
|
+
CommonUtil.extend(this, opt);
|
|
60
|
+
|
|
61
|
+
let pixelRatio = this.pixelRatio = window ? window.devicePixelRatio : 1;
|
|
62
|
+
|
|
63
|
+
this.width = this.map.getSize()[0] * pixelRatio;
|
|
64
|
+
this.height = this.map.getSize()[1] * pixelRatio;
|
|
65
|
+
this.center = this.map.getView().getCenter();
|
|
66
|
+
this._initContainer();
|
|
67
|
+
this._registerEvents();
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
_registerEvents() {
|
|
71
|
+
let map = this.map;
|
|
72
|
+
let view = map.getView();
|
|
73
|
+
map.on('change:size', this._resizeEvent.bind(this), this);
|
|
74
|
+
view.on('change:resolution', this._moveEndEvent.bind(this), this);
|
|
75
|
+
view.on('change:center', this._moveEvent.bind(this), this);
|
|
76
|
+
view.on('change:rotation', this._moveEndEvent.bind(this), this);
|
|
77
|
+
map.on('moveend', this._moveEndEvent.bind(this), this)
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
_resizeEvent() {
|
|
81
|
+
this._resize();
|
|
82
|
+
this._clearAndRedraw();
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
_moveEvent() {
|
|
86
|
+
|
|
87
|
+
let oldCenterPixel = this.map.getPixelFromCoordinate(this.center);
|
|
88
|
+
let newCenterPixel = this.map.getPixelFromCoordinate(this.map.getView().getCenter());
|
|
89
|
+
|
|
90
|
+
let offset = [oldCenterPixel[0] - newCenterPixel[0], oldCenterPixel[1] - newCenterPixel[1]];
|
|
91
|
+
this._canvas.style[CSS_TRANSFORM] = 'translate(' + Math.round(offset[0]) + 'px,' + Math.round(offset[1]) + 'px)';
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
_moveEndEvent() {
|
|
95
|
+
this._canvas.style[CSS_TRANSFORM] = 'translate(0,0)';
|
|
96
|
+
this.center = this.map.getView().getCenter();
|
|
97
|
+
this._clearAndRedraw();
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
_clearAndRedraw() {
|
|
101
|
+
this._clearBuffer();
|
|
102
|
+
this.layer.changed();
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
_resize() {
|
|
106
|
+
const size = this.map.getSize();
|
|
107
|
+
const width = size[0] * this.pixelRatio;
|
|
108
|
+
const height = size[1] * this.pixelRatio;
|
|
109
|
+
this._canvas.width = width;
|
|
110
|
+
this._canvas.height = height;
|
|
111
|
+
this._canvas.style.width = width + 'px';
|
|
112
|
+
this._canvas.style.height = height + 'px';
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
_clearBuffer() {
|
|
116
|
+
if (!this.deckGL) {
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
let lm = this.deckGL.layerManager;
|
|
120
|
+
lm && lm.context.gl.clear(lm.context.gl.COLOR_BUFFER_BIT);
|
|
121
|
+
return this;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* @private
|
|
126
|
+
* @function GraphicWebGLRenderer.prototype.getCanvas
|
|
127
|
+
* @description 返回画布。
|
|
128
|
+
* @returns {HTMLCanvasElement} canvas 对象。
|
|
129
|
+
*/
|
|
130
|
+
getCanvas() {
|
|
131
|
+
return this._canvas;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* @private
|
|
136
|
+
* @function GraphicWebGLRenderer.prototype.update
|
|
137
|
+
* @description 更新图层,数据或者样式改变后调用。
|
|
138
|
+
*/
|
|
139
|
+
update(graphics) {
|
|
140
|
+
if (graphics && graphics.length > -1) {
|
|
141
|
+
this._data = graphics;
|
|
142
|
+
}
|
|
143
|
+
if (!this._renderLayer) {
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
this._renderLayer.setChangeFlags({
|
|
147
|
+
dataChanged: true,
|
|
148
|
+
propsChanged: true,
|
|
149
|
+
viewportChanged: true,
|
|
150
|
+
updateTriggersChanged: true
|
|
151
|
+
});
|
|
152
|
+
|
|
153
|
+
this._refreshData();
|
|
154
|
+
let state = this._getLayerState();
|
|
155
|
+
state.data = this._data || [];
|
|
156
|
+
this._renderLayer.setNeedsRedraw(true);
|
|
157
|
+
this._renderLayer.setState(state);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* @private
|
|
162
|
+
* @function GraphicWebGLRenderer.prototype.drawGraphics
|
|
163
|
+
* @description 绘制点要素。
|
|
164
|
+
*/
|
|
165
|
+
drawGraphics(graphics) {
|
|
166
|
+
this._data = graphics ? graphics : this._data ? this._data : [];
|
|
167
|
+
if (!this._renderLayer) {
|
|
168
|
+
this._createInnerRender();
|
|
169
|
+
}
|
|
170
|
+
this._clearBuffer();
|
|
171
|
+
this._draw();
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
_initContainer() {
|
|
175
|
+
this._canvas = this._createCanvas(this.width, this.height);
|
|
176
|
+
this._layerContainer = this.container;
|
|
177
|
+
this._wrapper = document.createElement('div');
|
|
178
|
+
this._wrapper.className = "deck-wrapper";
|
|
179
|
+
this._wrapper.style.position = "absolute";
|
|
180
|
+
this._wrapper.style.top = "0";
|
|
181
|
+
this._wrapper.style.left = "0";
|
|
182
|
+
this._wrapper.appendChild(this._canvas);
|
|
183
|
+
this._layerContainer && this._layerContainer.appendChild(this._wrapper);
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
_createCanvas(width, height) {
|
|
187
|
+
|
|
188
|
+
let canvas = document.createElement('canvas');
|
|
189
|
+
canvas.oncontextmenu = emptyFunc;
|
|
190
|
+
canvas.width = width;
|
|
191
|
+
canvas.height = height;
|
|
192
|
+
canvas.style.width = width + "px";
|
|
193
|
+
canvas.style.height = height + "px";
|
|
194
|
+
return canvas;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
_createInnerRender() {
|
|
198
|
+
let me = this;
|
|
199
|
+
let state = this._getLayerState();
|
|
200
|
+
let {
|
|
201
|
+
color,
|
|
202
|
+
radius,
|
|
203
|
+
opacity,
|
|
204
|
+
highlightColor,
|
|
205
|
+
radiusScale,
|
|
206
|
+
radiusMinPixels,
|
|
207
|
+
radiusMaxPixels,
|
|
208
|
+
strokeWidth,
|
|
209
|
+
outline
|
|
210
|
+
} = state;
|
|
211
|
+
radius = this._pixelToMeter(radius);
|
|
212
|
+
let innerLayerOptions = {
|
|
213
|
+
id: 'scatter-plot',
|
|
214
|
+
data: [],
|
|
215
|
+
pickable: Boolean(this.onClick) || Boolean(this.onHover),
|
|
216
|
+
autoHighlight: true,
|
|
217
|
+
color: color,
|
|
218
|
+
opacity: opacity,
|
|
219
|
+
radius: radius,
|
|
220
|
+
radiusScale: radiusScale,
|
|
221
|
+
highlightColor: highlightColor,
|
|
222
|
+
radiusMinPixels: radiusMinPixels,
|
|
223
|
+
radiusMaxPixels: radiusMaxPixels,
|
|
224
|
+
strokeWidth: strokeWidth,
|
|
225
|
+
outline: outline,
|
|
226
|
+
getPosition(point) {
|
|
227
|
+
if (!point) {
|
|
228
|
+
return [0, 0, 0];
|
|
229
|
+
}
|
|
230
|
+
let geometry = point.getGeometry();
|
|
231
|
+
let coordinates = geometry && geometry.getCoordinates();
|
|
232
|
+
coordinates = me._project(coordinates);
|
|
233
|
+
return coordinates && [coordinates[0], coordinates[1], 0];
|
|
234
|
+
},
|
|
235
|
+
getColor(point) {
|
|
236
|
+
let defaultStyle = me._getLayerDefaultStyle();
|
|
237
|
+
let style = point && point.getStyle();
|
|
238
|
+
return style && style.getColor && style.getColor() || defaultStyle.color
|
|
239
|
+
},
|
|
240
|
+
getRadius(point) {
|
|
241
|
+
let defaultStyle = me._getLayerDefaultStyle();
|
|
242
|
+
let style = point && point.getStyle();
|
|
243
|
+
return style && style.getRadius && style.getRadius() || defaultStyle.radius
|
|
244
|
+
},
|
|
245
|
+
updateTriggers: {
|
|
246
|
+
getColor: [color],
|
|
247
|
+
getRadius: [radius]
|
|
248
|
+
}
|
|
249
|
+
};
|
|
250
|
+
me._renderLayer = new window.DeckGL.ScatterplotLayer(innerLayerOptions);
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
_getLayerDefaultStyle() {
|
|
254
|
+
let {
|
|
255
|
+
color,
|
|
256
|
+
opacity,
|
|
257
|
+
radius,
|
|
258
|
+
radiusScale,
|
|
259
|
+
radiusMinPixels,
|
|
260
|
+
radiusMaxPixels,
|
|
261
|
+
strokeWidth,
|
|
262
|
+
outline
|
|
263
|
+
} = this._getLayerState();
|
|
264
|
+
radius = this._pixelToMeter(radius);
|
|
265
|
+
return {
|
|
266
|
+
color,
|
|
267
|
+
opacity,
|
|
268
|
+
radius,
|
|
269
|
+
radiusScale,
|
|
270
|
+
radiusMinPixels,
|
|
271
|
+
radiusMaxPixels,
|
|
272
|
+
strokeWidth,
|
|
273
|
+
outline
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
_getLayerState() {
|
|
279
|
+
let state = this.layer.getLayerState();
|
|
280
|
+
let view = this.map.getView();
|
|
281
|
+
let projection = view.getProjection().getCode();
|
|
282
|
+
let center = olProj.transform([state.longitude, state.latitude], projection, 'EPSG:4326')
|
|
283
|
+
state.longitude = center[0];
|
|
284
|
+
state.latitude = center[1];
|
|
285
|
+
state.zoom = state.zoom - 1;
|
|
286
|
+
return state;
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
_draw() {
|
|
290
|
+
this._refreshData();
|
|
291
|
+
let state = this._getLayerState();
|
|
292
|
+
state.data = this._data || [];
|
|
293
|
+
let deckOptions = {};
|
|
294
|
+
|
|
295
|
+
for (let key in state) {
|
|
296
|
+
deckOptions[key] = state[key];
|
|
297
|
+
}
|
|
298
|
+
this._renderLayer.setNeedsRedraw(true);
|
|
299
|
+
deckOptions.layers = [this._renderLayer];
|
|
300
|
+
deckOptions.canvas = this._canvas;
|
|
301
|
+
if (this.onBeforeRender) {
|
|
302
|
+
deckOptions.onBeforeRender = this.onBeforeRender.bind(this);
|
|
303
|
+
}
|
|
304
|
+
if (this.onAfterRender) {
|
|
305
|
+
deckOptions.onAfterRender = this.onAfterRender.bind(this);
|
|
306
|
+
}
|
|
307
|
+
if (!this.deckGL) {
|
|
308
|
+
this.deckGL = new window.DeckGL.experimental.DeckGLJS(deckOptions);
|
|
309
|
+
} else {
|
|
310
|
+
this.deckGL.setProps(deckOptions);
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
_refreshData() {
|
|
315
|
+
let graphics = this._data || [];
|
|
316
|
+
let sGraphics = !Util.isArray(graphics) ? [graphics] : [].concat(graphics);
|
|
317
|
+
//this.layer.props.data不能被重新赋值,只能在原数组上进行操作
|
|
318
|
+
if (!this._renderLayer.props.data) {
|
|
319
|
+
this._renderLayer.props.data = [];
|
|
320
|
+
}
|
|
321
|
+
this._renderLayer.props.data.length = 0;
|
|
322
|
+
for (let j = 0; j < sGraphics.length; j++) {
|
|
323
|
+
this._renderLayer.props.data.push(sGraphics[j]);
|
|
324
|
+
}
|
|
325
|
+
this._data = this._renderLayer.props.data;
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
_project(coordinates) {
|
|
329
|
+
let view = this.map.getView();
|
|
330
|
+
let projection = view.getProjection().getCode();
|
|
331
|
+
if ("EPSG:4326" === projection) {
|
|
332
|
+
return coordinates;
|
|
333
|
+
}
|
|
334
|
+
return olProj.transform(coordinates, projection, 'EPSG:4326');
|
|
335
|
+
}
|
|
336
|
+
_pixelToMeter(pixel) {
|
|
337
|
+
let view = this.map.getView();
|
|
338
|
+
let projection = view.getProjection();
|
|
339
|
+
|
|
340
|
+
let unit = projection.getUnits() || 'degrees';
|
|
341
|
+
if (unit === 'degrees') {
|
|
342
|
+
unit = Unit.DEGREE;
|
|
343
|
+
}
|
|
344
|
+
if (unit === 'm') {
|
|
345
|
+
unit = Unit.METER;
|
|
346
|
+
}
|
|
347
|
+
const res = view.getResolution();
|
|
348
|
+
if (unit === Unit.DEGREE) {
|
|
349
|
+
let meterRes= res*(Math.PI * 6378137 / 180);
|
|
350
|
+
return pixel * meterRes;
|
|
351
|
+
}else{
|
|
352
|
+
return pixel * res;
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
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 {Graphic as OverlayGraphic} from './Graphic';
|
|
5
|
+
export {CloverShape} from './CloverShape';
|
|
6
|
+
export {HitCloverShape} from './HitCloverShape';
|
|
7
|
+
|
|
8
|
+
export {GraphicCanvasRenderer} from './CanvasRenderer';
|
|
9
|
+
export {GraphicWebGLRenderer} from './WebGLRenderer';
|
package/overlay/index.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
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 {DataFlow} from './DataFlow';
|
|
5
|
+
export {Graph} from './Graph';
|
|
6
|
+
export {Graphic} from './Graphic';
|
|
7
|
+
export {Label} from './Label';
|
|
8
|
+
export {Mapv} from './Mapv';
|
|
9
|
+
export {Range} from './Range';
|
|
10
|
+
export {RankSymbol} from './RankSymbol';
|
|
11
|
+
export {Turf} from './Turf';
|
|
12
|
+
export {Unique} from './Unique';
|
|
13
|
+
export {VectorTileSuperMapRest} from './VectorTileSuperMapRest';
|
|
14
|
+
export {HeatMap} from './HeatMap';
|
|
15
|
+
export {FGB} from './FGB';
|
|
16
|
+
export {GraphMap} from './GraphMap';
|
|
17
|
+
|
|
18
|
+
export * from './graphic/index';
|
|
19
|
+
export * from './mapv/index';
|
|
20
|
+
export * from './theme';
|
|
21
|
+
export * from './vectortile';
|
|
@@ -0,0 +1,104 @@
|
|
|
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
|
+
* @class MapvCanvasLayer
|
|
6
|
+
* @classdesc Mapv 渲染器。
|
|
7
|
+
* @private
|
|
8
|
+
* @param {Object} options - 参数。
|
|
9
|
+
* @param {number} options.width - 画布宽。
|
|
10
|
+
* @param {number} options.height - 画布高。
|
|
11
|
+
* @param {string} [options.paneName='mapPane'] - 窗口名。
|
|
12
|
+
* @param {string} [options.context='2d'] - 内容。
|
|
13
|
+
* @param {number} [options.zIndex=2] - 层级。
|
|
14
|
+
* @param {string} [options.mixBlendMode] - 最小混合模式。
|
|
15
|
+
*/
|
|
16
|
+
export class MapvCanvasLayer {
|
|
17
|
+
|
|
18
|
+
constructor(options) {
|
|
19
|
+
this.options = options || {};
|
|
20
|
+
this.enableMassClear = this.options.enableMassClear;
|
|
21
|
+
this._map = options.map;
|
|
22
|
+
this.paneName = this.options.paneName || 'mapPane';
|
|
23
|
+
this.context = this.options.context || '2d';
|
|
24
|
+
this.zIndex = this.options.zIndex || 2;
|
|
25
|
+
this.mixBlendMode = this.options.mixBlendMode || null;
|
|
26
|
+
this.width = options.width;
|
|
27
|
+
this.height = options.height;
|
|
28
|
+
this.initialize();
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
initialize() {
|
|
32
|
+
var canvas = this.canvas = document.createElement("canvas");
|
|
33
|
+
canvas.style.cssText = "position:absolute;" + "left:0;" + "top:0;" + "z-index:" + this.zIndex + ";user-select:none;";
|
|
34
|
+
canvas.style.mixBlendMode = this.mixBlendMode;
|
|
35
|
+
canvas.className = "mapvClass";
|
|
36
|
+
var global$2 = typeof window === 'undefined' ? {} : window;
|
|
37
|
+
var devicePixelRatio = this.devicePixelRatio = global$2.devicePixelRatio || 1;
|
|
38
|
+
canvas.width = parseInt(this.width) * devicePixelRatio;
|
|
39
|
+
canvas.height = parseInt(this.height) * devicePixelRatio;
|
|
40
|
+
if (this.context === '2d') {
|
|
41
|
+
canvas.getContext(this.context).scale(devicePixelRatio, devicePixelRatio);
|
|
42
|
+
}
|
|
43
|
+
canvas.style.width = this.width + "px";
|
|
44
|
+
canvas.style.height = this.height + "px";
|
|
45
|
+
if (this.context === 'webgl') {
|
|
46
|
+
this.canvas.getContext(this.context).viewport(0, 0, canvas.width, canvas.height)
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* @function MapvCanvasLayer.prototype.draw
|
|
52
|
+
* @description 生成地图。
|
|
53
|
+
*/
|
|
54
|
+
draw() {
|
|
55
|
+
this.options.update && this.options.update.call(this);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* @function MapvCanvasLayer.prototype.resize
|
|
60
|
+
* @param {number} mapWidth - 地图宽度。
|
|
61
|
+
* @param {number} mapHeight - 地图高度。
|
|
62
|
+
* @description 调整地图大小。
|
|
63
|
+
*/
|
|
64
|
+
resize(mapWidth, mapHeight) {
|
|
65
|
+
var global$2 = typeof window === 'undefined' ? {} : window;
|
|
66
|
+
var devicePixelRatio = this.devicePixelRatio = global$2.devicePixelRatio || 1;
|
|
67
|
+
this.canvas.width = mapWidth * devicePixelRatio;
|
|
68
|
+
this.canvas.height = mapHeight * devicePixelRatio;
|
|
69
|
+
if (this.context === '2d') {
|
|
70
|
+
this.canvas.getContext('2d').scale(devicePixelRatio, devicePixelRatio);
|
|
71
|
+
}
|
|
72
|
+
this.canvas.style.width = mapWidth + "px";
|
|
73
|
+
this.canvas.style.height = mapHeight + "px";
|
|
74
|
+
if (this.context === 'webgl') {
|
|
75
|
+
this.canvas.getContext(this.context).viewport(0, 0, this.canvas.width, this.canvas.height)
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* @function MapvCanvasLayer.prototype.getContainer
|
|
81
|
+
* @description 获取容器。
|
|
82
|
+
* @returns {HTMLElement} 包含 Mapv 图层的 DOM 对象。
|
|
83
|
+
*/
|
|
84
|
+
getContainer() {
|
|
85
|
+
return this.canvas;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* @function MapvCanvasLayer.prototype.setZIndex
|
|
90
|
+
* @param {number} zIndex - 层级参数。
|
|
91
|
+
* @description 设置图层层级。
|
|
92
|
+
*/
|
|
93
|
+
setZIndex(zIndex) {
|
|
94
|
+
this.canvas.style.zIndex = zIndex;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* @function MapvCanvasLayer.prototype.getZIndex
|
|
99
|
+
* @description 获取图层层级。
|
|
100
|
+
*/
|
|
101
|
+
getZIndex() {
|
|
102
|
+
return this.zIndex;
|
|
103
|
+
}
|
|
104
|
+
}
|