cd-mapgis 1.1.17 → 1.1.19
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/package.json +1 -1
- package/src/InnerUtil.js +1 -1
- package/src/LayerUtil.js +1 -1
- package/src/MapView.js +1 -1
- package/src/OM.js +33 -2
- package/test-om.js +1 -1
package/package.json
CHANGED
package/src/InnerUtil.js
CHANGED
package/src/LayerUtil.js
CHANGED
|
@@ -14,7 +14,7 @@ import VectorLayer from 'ol/layer/Vector.js';
|
|
|
14
14
|
import StyleUtil from './StyleUtil.js';
|
|
15
15
|
import LineString from 'ol/geom/LineString.js';
|
|
16
16
|
import Polygon from 'ol/geom/Polygon.js';
|
|
17
|
-
import { WKT } from 'ol/format';
|
|
17
|
+
import { WKT } from 'ol/format.js';
|
|
18
18
|
|
|
19
19
|
/**
|
|
20
20
|
* 图层工具
|
package/src/MapView.js
CHANGED
|
@@ -5,7 +5,7 @@ import StyleUtil from './StyleUtil.js';
|
|
|
5
5
|
import MapDrawUtil from './MapDrawUtil.js';
|
|
6
6
|
import SwipeUtil from './SwipeUtil.js';
|
|
7
7
|
import DragPan from 'ol/interaction/DragPan.js';
|
|
8
|
-
import * as OlInteraction from 'ol/interaction';
|
|
8
|
+
import * as OlInteraction from 'ol/interaction.js';
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* ol地图显示
|
package/src/OM.js
CHANGED
|
@@ -39,9 +39,9 @@ export default class OM {
|
|
|
39
39
|
static getIp(text) {
|
|
40
40
|
const ipv4Regex = /\b(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\b/;
|
|
41
41
|
const ipv4Matches = text.match(ipv4Regex) || [];
|
|
42
|
-
if(ipv4Matches.length > 0){
|
|
42
|
+
if (ipv4Matches.length > 0) {
|
|
43
43
|
return ipv4Matches[0];
|
|
44
|
-
}else{
|
|
44
|
+
} else {
|
|
45
45
|
return '';
|
|
46
46
|
}
|
|
47
47
|
}
|
|
@@ -235,6 +235,37 @@ export default class OM {
|
|
|
235
235
|
//
|
|
236
236
|
mapView.viewLayers.push({ type: 'def', name: obj.name, layer: obj.layer });
|
|
237
237
|
}
|
|
238
|
+
//直接加载固定的geoServer图层
|
|
239
|
+
if (p.geoLayers && p.geoLayers.length > 0) {
|
|
240
|
+
postRes = await OM.getDic("geoserver");
|
|
241
|
+
if (!postRes.data) {
|
|
242
|
+
throw new Error("未配置geoserver");
|
|
243
|
+
}
|
|
244
|
+
let geoserverDic = JSON.parse(postRes.data);
|
|
245
|
+
let wmsUrl = geoserverDic.url + '/' + geoserverDic.workspace + '/wms';
|
|
246
|
+
wmsUrl = InnerUtil.getGeoServerUrl(wmsUrl, geoLayerUrl);
|
|
247
|
+
let geoParam = { workspace: geoserverDic.workspace, url: wmsUrl };
|
|
248
|
+
let _layers = [];
|
|
249
|
+
let layerNames = {};
|
|
250
|
+
for (let i = 0; i < p.geoLayers.length; i++) {
|
|
251
|
+
let l = p.geoLayers[i];
|
|
252
|
+
_layers.push(l.layerName);
|
|
253
|
+
layerNames[l.layerName] = l.title;
|
|
254
|
+
}
|
|
255
|
+
postRes = await OM.checkPushLayers({ layers: _layers });
|
|
256
|
+
let pushLayers = postRes.data ? postRes.data : [];
|
|
257
|
+
for (let k = 0; k < mapViews.length; k++) {
|
|
258
|
+
let mapView = mapViews[k];
|
|
259
|
+
let map = mapView.map;
|
|
260
|
+
for (let i = 0; i < pushLayers.length; i++) {
|
|
261
|
+
geoParam.name = pushLayers[i];
|
|
262
|
+
let layer = LayerUtil.geoServerWmsLayer(geoParam);
|
|
263
|
+
map.addLayer(layer);
|
|
264
|
+
mapView.viewLayers.push({ type: 'geoLayer', name: layerNames[geoParam.name], layer: layer });
|
|
265
|
+
mapView.geoServerLayers.push(geoParam.name);
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
}
|
|
238
269
|
//再加载geoServer接口图层
|
|
239
270
|
let param = p.param ? p.param : {};
|
|
240
271
|
let res = await OM.post("/map/getPushLayer", param);
|
package/test-om.js
CHANGED
|
@@ -6,6 +6,6 @@ console.log('OM 类型:', typeof OM);
|
|
|
6
6
|
console.log('OM 类定义:', OM);
|
|
7
7
|
|
|
8
8
|
// 测试调用静态方法(不执行实际初始化,只检查方法是否存在)
|
|
9
|
-
console.log('OM.initMap 存在:', typeof OM.
|
|
9
|
+
console.log('OM.initMap 存在:', typeof OM.initParam === 'function');
|
|
10
10
|
|
|
11
11
|
console.log('测试完成,请检查输出结果。');
|