Skip to content

Commit 556ec81

Browse files
author
潘卓然ParnDeedlit
committed
Merge branch 'master' into dev
2 parents bb7cb2c + 3f7daae commit 556ec81

File tree

8 files changed

+245
-9
lines changed

8 files changed

+245
-9
lines changed

src/cesiumjs/manager/PopupController.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,10 @@ export default class PopupController extends BaseLayer {
8686
const randID = CommonFuncManager.generateRandom();
8787
const rootContentDiv = document.createElement('div');
8888
rootContentDiv.setAttribute('id', `popup_${randID}`);
89-
rootContentDiv.setAttribute('class', 'cesium-popup');
89+
rootContentDiv.setAttribute('class', 'mapgis-popup');
9090
rootContentDiv.setAttribute('style', 'top:5px;left:0;');
9191
const closeDiv = document.createElement('a');
92-
closeDiv.setAttribute('class', 'cesium-popup-close-button');
92+
closeDiv.setAttribute('class', 'mapgis-popup-close-button');
9393
// closeDiv.setAttribute('href', '#');
9494
closeDiv.innerHTML = '×';
9595
const webControl = this;
@@ -101,18 +101,18 @@ export default class PopupController extends BaseLayer {
101101
rootContentDiv.appendChild(closeDiv);
102102

103103
const contentDiv = document.createElement('div');
104-
contentDiv.setAttribute('class', 'cesium-popup-content-wrapper');
104+
contentDiv.setAttribute('class', 'mapgis-popup-content-wrapper');
105105
const contentLinkDiv = document.createElement('div');
106-
contentLinkDiv.setAttribute('class', 'cesium-popup-content');
106+
contentLinkDiv.setAttribute('class', 'mapgis-popup-content');
107107
contentLinkDiv.setAttribute('style', 'max-width: 300px;');
108108
contentLinkDiv.innerHTML = content;
109109
contentDiv.appendChild(contentLinkDiv);
110110
rootContentDiv.appendChild(contentDiv);
111111

112112
const tipContainDiv = document.createElement('div');
113-
tipContainDiv.setAttribute('class', 'cesium-popup-tip-container');
113+
tipContainDiv.setAttribute('class', 'mapgis-popup-tip-container');
114114
const tipDiv = document.createElement('div');
115-
tipDiv.setAttribute('class', 'cesium-popup-tip');
115+
tipDiv.setAttribute('class', 'mapgis-popup-tip');
116116
tipContainDiv.appendChild(tipDiv);
117117
rootContentDiv.appendChild(tipContainDiv);
118118

@@ -274,15 +274,15 @@ export default class PopupController extends BaseLayer {
274274
if (removeDiv && popDiv.parentNode !== null) {
275275
popDiv.parentNode.removeChild(popDiv);
276276
}
277-
if (owner.popupContain !== null && owner.popupContain.length > 0) {
277+
if (Cesium.defined(owner.popupContain) && owner.popupContain.length > 0) {
278278
for (let i = 0, n = 0; i < owner.popupContain.length; i += 1) {
279279
if (owner.popupContain[i].id !== popID) {
280280
owner.popupContain[(n += 1)] = owner.popupContain[i];
281281
}
282282
}
283283
owner.popupContain.length -= 1;
284284
}
285-
if (owner.popupContain.length <= 0) {
285+
if (Cesium.defined(owner.popupContain) && owner.popupContain.length <= 0) {
286286
owner.viewer.camera.percentageChanged = 0.5;
287287
owner.viewer.camera.changed.removeEventListener(this.updatePopups, this);
288288
}

src/cesiumjs/manager/SceneManager.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,8 @@ export default class SceneManager {
137137
longitudeString = Cesium.Math.toDegrees(cartographic.longitude);
138138
latitudeString = Cesium.Math.toDegrees(cartographic.latitude);
139139
cameraHeight = Math.ceil(that.viewer.camera.positionCartographic.height);
140-
height = Math.max(that.viewer.scene.globe.getHeight(cartographic), cartographic.height);
140+
// height = Math.max(that.viewer.scene.globe.getHeight(cartographic), cartographic.height);
141+
height = cartographic.height;
141142
longlatHeight = `经度:${longitudeString.toFixed(4)}°,纬度:${latitudeString.toFixed(4)}°,海拔高度:${height.toFixed(0)}米,相机视角高度:${cameraHeight.toFixed(0)}米`;
142143
}
143144
let strHpr = '';

website/public/static/demo/config/config-vue-mapboxgl.json

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,30 @@
147147
}
148148
]
149149
},
150+
{
151+
"name": "Vue-矢量瓦片",
152+
"iconfont": "iconraster",
153+
"folder": "vue-vectortile",
154+
"leaffolder": true,
155+
"childs": [
156+
{
157+
"name": "整体样式MVT",
158+
"file": "mvtstyle",
159+
"diffcult": "2",
160+
"detail": "",
161+
"icon": "mvtstyle.png",
162+
"update": "最后更新时间:2021-06-07"
163+
},
164+
{
165+
"name": "单图层",
166+
"file": "layer",
167+
"diffcult": "2",
168+
"detail": "",
169+
"icon": "layer.png",
170+
"update": "最后更新时间:2021-06-07"
171+
}
172+
]
173+
},
150174
{
151175
"name": "Vue-OGC",
152176
"iconfont": "icon_ogc",
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
<!DOCTYPE html>
2+
<html xmlns="http://www.w3.org/1999/xhtml">
3+
<head>
4+
<meta charset="utf-8" />
5+
<meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no" />
6+
<title>Vue-FPS</title>
7+
<!--引入第三方的jquery脚本库-->
8+
<script include="vue,antd,v-contextmenu" exclude="plugin" src="./static/libs/include-mapboxgl-local.js"></script>
9+
<style type="text/css">
10+
#app {
11+
margin: 0 0;
12+
width: 100%;
13+
height: 100vh;
14+
}
15+
#map {
16+
height: 100vh;
17+
width: 100%;
18+
}
19+
</style>
20+
</head>
21+
22+
<body>
23+
<div id="app">
24+
<mapgis-web-map id="map" :map-style="mapStyle" :zoom="mapZoom" :center="outerCenter" :crs="mapCrs" v-on:load="handleMapLoad">
25+
<mapgis-arcgis-map-layer
26+
layer-id="ArcGIS地图图层"
27+
base-url="http://map.geoq.cn/arcgis/rest/services/ChinaOnlineStreetPurplishBlue/MapServer">
28+
</mapgis-arcgis-map-layer>
29+
<mapgis-arcgis-tile-layer
30+
layer-id="ArcGIS瓦片图层"
31+
base-url="http://map.geoq.cn/ArcGIS/rest/services/ChinaOnlineCommunity/MapServer" >
32+
</mapgis-arcgis-map-layer>
33+
<mapgis-document>
34+
</mapgis-document>
35+
</mapgis-web-map>
36+
</div>
37+
<script>
38+
new Vue({
39+
el: '#app',
40+
data() {
41+
return {
42+
mapStyle: {
43+
//设置版本号,一定要设置
44+
version: 8,
45+
//添加来源
46+
sources: {},
47+
//设置加载并显示来源的图层信息
48+
layers: []
49+
}, // 地图样式
50+
mapZoom: 3, // 地图初始化级数
51+
outerCenter: [116.39, 40.2], // 地图显示中心
52+
mapCrs: 'EPSG:3857'
53+
};
54+
},
55+
methods: {
56+
handleMapLoad(payload) {
57+
this.map = payload.map;
58+
}
59+
}
60+
});
61+
</script>
62+
</body>
63+
</html>
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
<!DOCTYPE html>
2+
<html xmlns="http://www.w3.org/1999/xhtml">
3+
<head>
4+
<meta charset="utf-8" />
5+
<meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no" />
6+
<title>Vue-点</title>
7+
<script include="vue" exclude="plugin,mapboxgl" src="./static/libs/include-mapboxgl-local.js"></script>
8+
<style type="text/css">
9+
#main {
10+
margin: 0 0;
11+
width: 100%;
12+
height: 100vh;
13+
}
14+
#map {
15+
height: 100vh;
16+
width: 100%;
17+
}
18+
</style>
19+
</head>
20+
21+
<body>
22+
<div id="app">
23+
<mapgis-web-map id="map"
24+
:map-style="mapStyle"
25+
:zoom="mapZoom"
26+
:center="outerCenter"
27+
:crs="mapCrs"
28+
v-on:load="handleMapLoad"
29+
>
30+
<mapgis-vector-layer
31+
:layer="layerVector"
32+
:layer-id="layerVectorId"
33+
:source="sourceVector"
34+
:source-id="sourceVectorId">
35+
</mapgis-vector-layer>
36+
</mapgis-web-map>
37+
</div>
38+
<script>
39+
new Vue({
40+
el: '#app',
41+
data() {
42+
return {
43+
mapStyle: {
44+
version: 8, //设置版本号,一定要设置
45+
sources: {}, //添加来源
46+
layers: [], //设置加载并显示来源的图层信息
47+
//特别注意,这里是字体库,下面的sprite才是样式库
48+
glyphs: 'http://develop.smaryun.com:6163/igs/rest/mrms/vtiles/fonts/{fontstack}/{range}.pbf',
49+
//特别注意,这里是真正的图片样式库
50+
sprite: 'http://develop.smaryun.com:6163/igs/rest/mrms/vtiles/sprite'
51+
}, // 地图样式
52+
mapZoom: 3, // 地图初始化级数
53+
outerCenter: [114.39960479736327, 30.495722001885323], // 地图显示中心
54+
mapCrs: 'EPSG:4326',
55+
56+
sourceVectorId: 'vector_source_id',
57+
layerVectorId: 'china_bound_id',
58+
sourceVector: {
59+
type: 'geojson',
60+
data: 'http://develop.smaryun.com/static/data/geojson/china.geojson'
61+
},
62+
layerVector: {
63+
type: 'fill',
64+
source: 'vector_source_id', //必须和上面的layerVectorId一致
65+
paint: {
66+
'fill-antialias': true, //抗锯齿,true表示针对边界缝隙进行填充
67+
'fill-color': '#000000', //颜色
68+
'fill-opacity': 1.0, //透明度
69+
'fill-outline-color': '#FF0000' //边线颜色,没错,确实没有边线宽度这个选项
70+
}
71+
}
72+
};
73+
},
74+
methods: {
75+
handleMapLoad(payload) {
76+
let map = payload.map;
77+
}
78+
}
79+
});
80+
</script>
81+
</body>
82+
</html>
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
<!DOCTYPE html>
2+
<html xmlns="http://www.w3.org/1999/xhtml">
3+
<head>
4+
<meta charset="utf-8" />
5+
<meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no" />
6+
<title>Vue-点</title>
7+
<script include="vue" exclude="plugin,mapboxgl" src="./static/libs/include-mapboxgl-local.js"></script>
8+
<style type="text/css">
9+
#main {
10+
margin: 0 0;
11+
width: 100%;
12+
height: 100vh;
13+
}
14+
#map {
15+
height: 100vh;
16+
width: 100%;
17+
}
18+
</style>
19+
</head>
20+
21+
<body>
22+
<div id="app">
23+
<mapgis-web-map id="map"
24+
:map-style="mapStyle"
25+
:zoom="mapZoom"
26+
:center="outerCenter"
27+
:crs="mapCrs"
28+
v-on:load="handleMapLoad"
29+
>
30+
<mapgis-mvt-style-layer
31+
:mvt-style="styleUrl"
32+
:mode="styleMode"
33+
>
34+
</mapgis-mvt-style-layer>
35+
</mapgis-web-map>
36+
</div>
37+
<script>
38+
new Vue({
39+
el: '#app',
40+
data() {
41+
return {
42+
mapStyle: {
43+
version: 8, //设置版本号,一定要设置
44+
sources: {}, //添加来源
45+
layers: [], //设置加载并显示来源的图层信息
46+
//特别注意,这里是字体库,下面的sprite才是样式库
47+
glyphs: 'http://develop.smaryun.com:6163/igs/rest/mrms/vtiles/fonts/{fontstack}/{range}.pbf',
48+
//特别注意,这里是真正的图片样式库
49+
sprite: 'http://develop.smaryun.com:6163/igs/rest/mrms/vtiles/sprite'
50+
}, // 地图样式
51+
mapZoom: 3, // 地图初始化级数
52+
outerCenter: [114.39960479736327, 30.495722001885323], // 地图显示中心
53+
mapCrs: 'EPSG:4326',
54+
styleUrl: 'http://develop.smaryun.com:6163/igs/rest/mrms/vtiles/styles/OSM全中国经纬度.json',
55+
styleMode: 'add', // add set
56+
};
57+
},
58+
methods: {
59+
handleMapLoad(payload) {
60+
let map = payload.map;
61+
}
62+
}
63+
});
64+
</script>
65+
</body>
66+
</html>
18.9 KB
Loading
91.8 KB
Loading

0 commit comments

Comments
 (0)