a707c407 by chiangbt

20191207

1 parent 4b3e59ec
......@@ -28,6 +28,8 @@ SuperGlobeVue是基于vue-cli3和supermap cesium 的一款Globe地球视图。
- viewer_ming.vue 多个栅格图层面的动画效果
- viewer_changeview.vue 地图视图效果,在10000米以上不能改变角度,10000米以下能够改动视角
- viewer_3dmodel.vue 展示矢量数据白模
- viewer_underground.vue 地底开挖效果,实际上是改变某个SCP图层的局部透明度
- viewer_split.vue 地图分屏
## 2、设置
### 项目依赖库安装
......
......@@ -6315,7 +6315,8 @@
"ansi-regex": {
"version": "2.1.1",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"aproba": {
"version": "1.2.0",
......@@ -6336,12 +6337,14 @@
"balanced-match": {
"version": "1.0.0",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"brace-expansion": {
"version": "1.1.11",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"balanced-match": "^1.0.0",
"concat-map": "0.0.1"
......@@ -6356,17 +6359,20 @@
"code-point-at": {
"version": "1.1.0",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"concat-map": {
"version": "0.0.1",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"console-control-strings": {
"version": "1.1.0",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"core-util-is": {
"version": "1.0.2",
......@@ -6483,7 +6489,8 @@
"inherits": {
"version": "2.0.3",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"ini": {
"version": "1.3.5",
......@@ -6495,6 +6502,7 @@
"version": "1.0.0",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"number-is-nan": "^1.0.0"
}
......@@ -6509,6 +6517,7 @@
"version": "3.0.4",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"brace-expansion": "^1.1.7"
}
......@@ -6516,12 +6525,14 @@
"minimist": {
"version": "0.0.8",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"minipass": {
"version": "2.3.5",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"safe-buffer": "^5.1.2",
"yallist": "^3.0.0"
......@@ -6540,6 +6551,7 @@
"version": "0.5.1",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"minimist": "0.0.8"
}
......@@ -6620,7 +6632,8 @@
"number-is-nan": {
"version": "1.0.1",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"object-assign": {
"version": "4.1.1",
......@@ -6632,6 +6645,7 @@
"version": "1.4.0",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"wrappy": "1"
}
......@@ -6717,7 +6731,8 @@
"safe-buffer": {
"version": "5.1.2",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"safer-buffer": {
"version": "2.1.2",
......@@ -6753,6 +6768,7 @@
"version": "1.0.2",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"code-point-at": "^1.0.0",
"is-fullwidth-code-point": "^1.0.0",
......@@ -6772,6 +6788,7 @@
"version": "3.0.1",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"ansi-regex": "^2.0.0"
}
......@@ -6815,12 +6832,14 @@
"wrappy": {
"version": "1.0.2",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"yallist": {
"version": "3.0.3",
"bundled": true,
"dev": true
"dev": true,
"optional": true
}
}
},
......
......@@ -22,7 +22,7 @@
<script src="./js/spectrum.js"></script>
<link href="./css/pretty.css" rel="stylesheet">
<script type="text/javascript" src="./js/require.min.js" data-main="js/main"></script>
<title>superglobevue</title>
<title>超图三维地图Demo</title>
<style type="text/css">
[v-cloak] {
display: none;
......
<!--
* 1、地图分屏效果
* @Author: jiangbotao
* @Date: 2019-12-03 22:52:56
* @LastEditors: jiangbotao
* @LastEditTime: 2019-12-04 22:23:44
* @FilePath: \superglobevue\src\components\viewer.vue
-->
<template>
<div>
<div id="cesiumContainer" v-bind:style="styleObject"></div>
<div id='loadingbar' class="spinner">
<div class="spinner-container container1">
<div class="circle1"></div>
<div class="circle2"></div>
<div class="circle3"></div>
<div class="circle4"></div>
</div>
<div class="spinner-container container2">
<div class="circle1"></div>
<div class="circle2"></div>
<div class="circle3"></div>
<div class="circle4"></div>
</div>
<div class="spinner-container container3">
<div class="circle1"></div>
<div class="circle2"></div>
<div class="circle3"></div>
<div class="circle4"></div>
</div>
</div>
<div id="toolbar" class="param-container tool-bar">
<div>
<button id="search" >查询</button>
</div>
</div>
</div>
</template>
<script>
import URL_CONFIG from "./../config/urlConfig.vue";
const Cesium = window.Cesium;
export default {
data: function() {
return {
styleObject: {
width: "100%",
position: "absolute",
top: "0px",
bottom: "0px",
left: "0px",
backgroundColor: "#000000"
},
smviewer: {}
};
},
mounted: function() {
var __this = this;
__this.viewer = new Cesium.Viewer('cesiumContainer', { animation: true });
var scene = __this.viewer.scene;
var widget = __this.viewer.cesiumWidget;
// 隐藏logo
$(".cesium-widget-credits")[0].style.visibility = "hidden";
// 隐藏导航工具
// $(".cesium-viewer-navigationContainer")[0].style.visibility="hidden";
// 添加OSM地图
let osm = Cesium.createOpenStreetMapImageryProvider({
url: "https://tile-a.openstreetmap.fr/hot",
fileExtension:"png"
});
__this.viewer.imageryLayers.addImageryProvider(osm);
try {
var groundPromise = scene.addS3MTilesLayerByScp(URL_CONFIG.SCP_CBD_GROUND1, {
name: 'ground'
});
var buildPromise = scene.addS3MTilesLayerByScp(URL_CONFIG.SCP_CBD_BUILD, {
name: 'build'
});
Cesium.when([groundPromise, buildPromise], function(layers) {
scene.camera.setView({
destination : Cesium.Cartesian3.fromDegrees(116.4566, 39.9149, 5323.445971240632),
orientation : {
heading : 3.1612,
pitch : -1.5188,
roll : 6.283185307179563
}
});
var positions = null;
// 绘制面
var handlerPolygon = new Cesium.DrawHandler(__this.viewer, Cesium.DrawMode.Polygon, 0);
handlerPolygon.drawEvt.addEventListener(function(polygon){
console.log(polygon.object.positions);
return polygon.object.positions;
});
$("#search").on("click", function(){
handlerPolygon.activeEvt.addEventListener(function(isActive){
if(isActive === true){
__this.viewer.enableCursorStyle = false;
__this.viewer._element.style.cursor = '';
$('body').removeClass('drawCur').addClass('drawCur');
}else{
__this.viewer.enableCursorStyle = true;
$('body').removeClass('drawCur');
}
});
handlerPolygon && handlerPolygon.deactivate();
handlerPolygon && handlerPolygon.activate();
});
}, function() {
var title = '加载SCP失败,请检查网络连接状态或者url地址是否正确?';
widget.showErrorPanel(title, undefined, e);
});
} catch (e) {
if (widget._showRenderLoopErrors) {
var title = '渲染时发生错误,已停止渲染。';
widget.showErrorPanel(title, undefined, e);
}
}
$("#loadingbar").remove();
}
};
</script>
<style>
.sm-compass {
pointer-events: auto;
position: absolute;
right: 10px;
top: 10px;
width: 128px;
height: 128px;
overflow: hidden;
}
.sm-zoom {
top: 130px;
}
.drawCur{
cursor: url(/images/cur/draw.cur), auto;
}
</style>
<!--
* 1、地图分屏效果
* @Author: jiangbotao
* @Date: 2019-12-03 22:52:56
* @LastEditors: jiangbotao
* @LastEditTime: 2019-12-04 22:23:44
* @FilePath: \superglobevue\src\components\viewer.vue
-->
<template>
<div>
<div id="cesiumContainer" v-bind:style="styleObject"></div>
<div id='loadingbar' class="spinner">
<div class="spinner-container container1">
<div class="circle1"></div>
<div class="circle2"></div>
<div class="circle3"></div>
<div class="circle4"></div>
</div>
<div class="spinner-container container2">
<div class="circle1"></div>
<div class="circle2"></div>
<div class="circle3"></div>
<div class="circle4"></div>
</div>
<div class="spinner-container container3">
<div class="circle1"></div>
<div class="circle2"></div>
<div class="circle3"></div>
<div class="circle4"></div>
</div>
</div>
<div id="toolbar" class="param-container tool-bar">
<div>
<button id="one" >无分屏</button>
<button id="two" >水平分屏</button>
</div>
</div>
<div id="split_up" style="display: none;"></div>
<div id="split_bottom" style="display: none;"></div>
<div id="split_left" style="display: none;"></div>
<div id="split_right" style="display: none;"></div>
<div id="split_vertical_trisection_left" style="display: none;"></div>
<div id="split_vertical_trisection_right" style="display: none;"></div>
</div>
</template>
<script>
import URL_CONFIG from "./../config/urlConfig.vue";
const Cesium = window.Cesium;
export default {
data: function() {
return {
styleObject: {
width: "100%",
position: "absolute",
top: "0px",
bottom: "0px",
left: "0px",
backgroundColor: "#000000"
},
smviewer: {}
};
},
mounted: function() {
this.viewer = new Cesium.Viewer("cesiumContainer", {});
// 隐藏logo
$(".cesium-widget-credits")[0].style.visibility = "hidden";
// 隐藏导航工具
// $(".cesium-viewer-navigationContainer")[0].style.visibility="hidden";
// 添加OSM地图
let osm = Cesium.createOpenStreetMapImageryProvider({
url: "https://tile-a.openstreetmap.fr/hot",
fileExtension:"png"
});
this.viewer.imageryLayers.addImageryProvider(osm);
var scene = this.viewer.scene;
var widget = this.viewer.cesiumWidget;
try {
var groundPromise = scene.addS3MTilesLayerByScp(URL_CONFIG.SCP_CBD_GROUND1, {
name: 'ground'
});
var ground2Promise = scene.addS3MTilesLayerByScp(URL_CONFIG.SCP_CBD_GROUND2, {
name: 'ground2'
});
var buildPromise = scene.addS3MTilesLayerByScp(URL_CONFIG.SCP_CBD_BUILD, {
name: 'build'
});
// 添加倾斜摄影模型图层
Cesium.when([groundPromise, ground2Promise, buildPromise], function(layers) {
var build = scene.layers.find("build");
var ground = scene.layers.find("ground");
var ground2 = scene.layers.find("ground2");
// 图层加载完成,设置相机位置
scene.camera.setView({
destination: Cesium.Cartesian3.fromDegrees(116.4563, 39.8969, 553),
orientation: {
heading: 5.901089214916513,
pitch: -0.40668579780875524,
roll: 6.281842456812987
}
});
$("#one").on("click", function(){
$("#split_up").css("display", "none");
$("#split_bottom").css("display", "none");
$("#split_left").css("display", "none");
$("#split_right").css("display", "none");
$("#split_vertical_trisection_left").css("display", "none");
$("#split_vertical_trisection_right").css("display", "none");
$('#pannel').hide();
scene.multiViewportMode = Cesium.MultiViewportMode["NONE"];
});
$("#two").on("click", function(){
$("#split_up").css("display", "block");
$("#split_bottom").css("display", "block");
$("#split_left").css("display", "none");
$("#split_right").css("display", "none");
$("#split_vertical_trisection_left").css("display", "none");
$("#split_vertical_trisection_right").css("display", "none");
$('#pannel').show();
$('#b_one,#b_two,#g_one,#g_two').show();
$('#b_three,#g_three,#b_four,#g_four').hide();
// ground2.setVisibleInViewport(1, false);
scene.multiViewportMode = Cesium.MultiViewportMode["HORIZONTAL"];
});
}, function() {
var title = '加载SCP失败,请检查网络连接状态或者url地址是否正确?';
widget.showErrorPanel(title, undefined, e);
});
} catch (e) {
if (widget._showRenderLoopErrors) {
var title = '渲染时发生错误,已停止渲染。';
widget.showErrorPanel(title, undefined, e);
}
}
$("#loadingbar").remove();
}
};
</script>
<style>
.sm-compass {
pointer-events: auto;
position: absolute;
right: 10px;
top: 10px;
width: 128px;
height: 128px;
overflow: hidden;
}
.sm-zoom {
top: 130px;
}
label {
display: inline-block;
margin-right: 1rem;
}
label>input,
label>span {
display: inline-block;
vertical-align: middle;
}
#split_up {
position: absolute;
background-color: white;
left: 50%;
bottom: 50%;
width: 2px;
height: 50%;
-webkit-transform: translate(-50%, 0);
}
#split_bottom {
position: absolute;
background-color: white;
left: 50%;
top: 50%;
width: 2px;
height: 50%;
-webkit-transform: translate(-50%, 0);
}
#split_left {
position: absolute;
background-color: white;
right: 50%;
bottom: 50%;
height: 2px;
width: 50%;
-webkit-transform: translate(0, -50%);
}
#split_right {
position: absolute;
background-color: white;
left: 50%;
bottom: 50%;
height: 2px;
width: 50%;
-webkit-transform: translate(0, -50%);
}
#split_vertical_trisection_left {
position: absolute;
background-color: white;
left: 33.33%;
top: 0;
height: 100%;
width: 2px;
}
#split_vertical_trisection_right {
position: absolute;
background-color: white;
right: 33.33%;
top: 0;
height: 100%;
width: 2px;
}
</style>
<!--
* 矢量数据白模
* 地下管网挖掘及查看
* @Author: jiangbotao
* @Date: 2019-12-07 14:24:01
* @LastEditors: jiangbotao
......@@ -32,7 +32,8 @@
<div id="toolbar" class="param-container tool-bar">
<div>
<label style="color:#FFFFFF ">图层开挖:</label>
<button id="excavation" >进行倾斜开挖</button>
<button id="excavation" >绘制挖掘面</button>
<button id="dig" >进行倾斜开挖</button>
</div>
</div>
</div>
......@@ -52,13 +53,14 @@ export default {
left: '0px',
backgroundColor: '#000000'
},
smviewer:{}
viewer:{}
}
},
mounted: function(){
this.smviewer=new Cesium.Viewer('cesiumContainer', { animation: true });
var scene = this.smviewer.scene;
var widget = this.smviewer.cesiumWidget;
var __this = this;
__this.viewer = new Cesium.Viewer('cesiumContainer', { animation: true });
var scene = __this.viewer.scene;
var widget = __this.viewer.cesiumWidget;
var globe = scene.globe;
// 隐藏logo
$(".cesium-widget-credits")[0].style.visibility="hidden";
......@@ -66,9 +68,9 @@ export default {
// 隐藏导航工具
// $(".cesium-viewer-navigationContainer")[0].style.visibility="hidden";
this.smviewer.scene.undergroundMode = true; //设置开启地下场景
this.smviewer.scene.screenSpaceCameraController.minimumZoomDistance = -500;//设置相机最小缩放距离,距离地表-1000米
this.smviewer.scene.terrainProvider.isCreateSkirt = false; // 关闭裙边
__this.viewer.scene.undergroundMode = true; //设置开启地下场景
__this.viewer.scene.screenSpaceCameraController.minimumZoomDistance = -500;//设置相机最小缩放距离,距离地表-1000米
__this.viewer.scene.terrainProvider.isCreateSkirt = false; // 关闭裙边
var overGroundLayer = null;
try{
......@@ -86,6 +88,49 @@ export default {
roll : 6.283185307176403
}
});
var positions = null;
// 绘制面
var handlerPolygon = new Cesium.DrawHandler(__this.viewer, Cesium.DrawMode.Polygon, 0);
handlerPolygon.drawEvt.addEventListener(function(polygon){
var array = [].concat(polygon.object.positions);
positions = [];
for(var i = 0, len = array.length; i < len; i++){
var cartographic = Cesium.Cartographic.fromCartesian(array[i]);
var longitude = Cesium.Math.toDegrees(cartographic.longitude);
var latitude = Cesium.Math.toDegrees(cartographic.latitude);
var h=cartographic.height;
if(positions.indexOf(longitude)===-1&&positions.indexOf(latitude)===-1){
positions.push(longitude);
positions.push(latitude);
positions.push(h);
}
}
console.log(positions);
return positions;
});
$("#excavation").on("click", function(){
handlerPolygon.activeEvt.addEventListener(function(isActive){
if(isActive === true){
__this.viewer.enableCursorStyle = false;
__this.viewer._element.style.cursor = '';
$('body').removeClass('drawCur').addClass('drawCur');
}else{
__this.viewer.enableCursorStyle = true;
$('body').removeClass('drawCur');
}
});
handlerPolygon && handlerPolygon.deactivate();
handlerPolygon && handlerPolygon.activate();
});
$("#dig").on("click", function(){
//设置倾斜开挖参数
overGroundLayer.addExcavationRegion({
position : positions,
name : 'excavation_' + Math.random()
});
handlerPolygon.deactivate();
handlerPolygon && handlerPolygon.clear();
});
}, function(e){
if(widget._showRenderLoopErrors) {
var title = '加载SCP失败,请检查网络连接状态或者url地址是否正确?';
......@@ -98,39 +143,6 @@ export default {
widget.showErrorPanel(title, undefined, e);
}
}
var positions = null;
// 绘制面
var handlerPolygon = new Cesium.DrawHandler(this.smviewer, Cesium.DrawMode.Polygon);
handlerPolygon.drawEvt.addEventListener(function(polygon){
var array = [].concat(polygon.object.positions);
positions = [];
for(var i = 0, len = array.length; i < len; i++){
var cartographic = Cesium.Cartographic.fromCartesian(array[i]);
var longitude = Cesium.Math.toDegrees(cartographic.longitude);
var latitude = Cesium.Math.toDegrees(cartographic.latitude);
var h=cartographic.height;
if(positions.indexOf(longitude)===-1&&positions.indexOf(latitude)===-1){
positions.push(longitude);
positions.push(latitude);
positions.push(h);
}
}
console.log(positions);
return positions;
});
$("#excavation").on("click", function(){
handlerPolygon && handlerPolygon.deactivate();
handlerPolygon && handlerPolygon.activate();
//设置倾斜开挖参数
overGroundLayer.addExcavationRegion({
position : positions,
name : 'excavation_' + Math.random()
});
handlerPolygon.deactivate();
});
$('#loadingbar').remove();
}
......@@ -138,6 +150,9 @@ export default {
</script>
<style>
.drawCur{
cursor: url(/images/cur/draw.cur), auto;
}
.sm-compass {
pointer-events: auto;
position: absolute;
......
......@@ -31,6 +31,10 @@ const SCENE_WZ_QD = 'http://localhost:8090/iserver/services/3D-wz_qidu_qx/rest/r
const SCP_SRSB_WATER = "http://www.supermapol.com/realspace/services/3D-srsb/rest/realspace/datas/%E6%B0%B4%E9%9D%A2@vector/config";
const SCENE_XGPARK = "http://www.supermapol.com/realspace/services/3D-yanmofenxi/rest/realspace";
const GZ_SCENE = 'http://www.supermapol.com/realspace/services/3D-GuangZhou/rest/realspace';
const SCENE_CBD = 'http://www.supermapol.com/realspace/services/3D-CBD/rest/realspace';
const SCP_CBD_GROUND1 = 'http://www.supermapol.com/realspace/services/3D-WebGLCBD/rest/realspace/datas/Ground_1@%E6%96%B0CBD/config';//CBD 地面1 SCP
const SCP_CBD_GROUND2 = 'http://www.supermapol.com/realspace/services/3D-WebGLCBD/rest/realspace/datas/Ground_2@%E6%96%B0CBD/config';//CBD 地面2 SCP
const SCP_CBD_BUILD = 'http://www.supermapol.com/realspace/services/3D-WebGLCBD/rest/realspace/datas/Building@%E6%96%B0CBD/config';//CBD 建筑物 SCP
export default
{
TDT_IMG,
......@@ -56,6 +60,9 @@ export default
SCENE_SY,
TOKEN_TIANDITU,
SCENE_XGPARK,
GZ_SCENE
GZ_SCENE,
SCP_CBD_GROUND1,
SCP_CBD_GROUND2,
SCP_CBD_BUILD
};
</script>
......
......@@ -11,7 +11,7 @@
</template>
<script>
import viewer from "@/components/viewer_underground.vue";
import viewer from "@/components/viewer_spatialquery.vue";
export default {
name: "home",
......
......@@ -16,17 +16,5 @@ module.exports = {
port:7000,
hot: true,
openPage: 'index.html'
},
css: {
loaderOptions: {
less: {
modifyVars: {
'primary-color': '#1DA57A',
'link-color': '#1DA57A',
'border-radius-base': '2px',
},
javascriptEnabled: true
}
}
}
}
}
\ No newline at end of file
......