<template>
|
<div class="roam" id="roam">
|
<div class="tool-title">
|
<!-- <img src="@/assets/img/right/head.png" /> -->
|
<label>漫游</label>
|
</div>
|
<hr />
|
<div class="roamTools">
|
<div
|
:class="isOpen['pathRoaming'] ? 'roamTool active' : 'roamTool'"
|
@click="pathRoaming"
|
>
|
<el-button>
|
<img src="@/assets/img/right/my/ljmy1.png" />
|
<label>路径漫游</label>
|
</el-button>
|
</div>
|
<div
|
:class="isOpen['pointFly'] ? 'roamTool active' : 'roamTool'"
|
@click="pointFly"
|
>
|
<el-button>
|
<img src="@/assets/img/right/my/ddrf1.png" />
|
<label>定点绕飞</label>
|
</el-button>
|
</div>
|
<div
|
:class="isOpen['digitalCity'] ? 'roamTool active' : 'roamTool'"
|
@click="digitalCityHandle"
|
>
|
<el-button>
|
<img src="@/assets/img/right/my/ddrf1.png" />
|
<label>数字城市</label>
|
</el-button>
|
</div>
|
</div>
|
<!-- <div class="closeTool" title="收缩" @click="close">
|
<el-button>
|
<img src="@/assets/img/right/ss.png" />
|
</el-button>
|
</div> -->
|
</div>
|
</template>
|
|
<style scoped>
|
.el-button:focus,
|
.el-button:hover {
|
background: transparent;
|
}
|
|
.roam {
|
width: 270px;
|
height: 160px;
|
}
|
|
.roamTool {
|
padding: 5px 0;
|
padding-left: 35px;
|
}
|
|
.roamTool:hover {
|
background: rgba(0, 168, 255, 0.16);
|
}
|
|
hr {
|
margin: 10px 0;
|
width: 111%;
|
margin-left: -15px;
|
}
|
|
.tool-title {
|
margin: 1px 10px;
|
}
|
|
.tool-title label {
|
vertical-align: top;
|
}
|
|
.roam label {
|
margin-left: 10px;
|
font-size: 17px;
|
font-family: Microsoft YaHei;
|
font-weight: 400;
|
/* color: #3d3d3d; */
|
color: white;
|
}
|
|
.el-button {
|
padding: 0 !important;
|
font-size: 24px;
|
border: unset;
|
float: unset;
|
display: block;
|
background: rgba(0, 0, 0, 0);
|
}
|
|
.el-button label {
|
font-size: 14px;
|
}
|
|
.closeTool {
|
position: absolute;
|
bottom: 0;
|
left: 0;
|
}
|
|
.active {
|
background: rgba(0, 168, 255, 0.16);
|
}
|
</style>
|
|
<script>
|
window.PathAnimationData = {
|
isFly: false
|
};
|
export default {
|
name: "roam",
|
data() {
|
return {
|
status: false,
|
isOpen: {
|
pathRoaming: false,
|
pointFly: false,
|
digitalCity: false
|
}
|
};
|
},
|
mounted() {
|
window.closeRoamHighLight = this.closeroam;
|
},
|
methods: {
|
closeroam() {
|
this.isOpen.pathRoaming = false;
|
},
|
// 清除高亮的样式
|
clearActive() {
|
this.isOpen.pathRoaming = false;
|
this.isOpen.pointFly = false;
|
this.isOpen.digitalCity = false;
|
},
|
close() {
|
this.$parent.isShowRoam = false;
|
},
|
|
//数字城市
|
digitalCityHandle() {
|
if (window.dCtiy) {
|
window.dCtiy.layers && window.dCtiy.layers.deleteObject();
|
window.dCtiy.tiltModel && window.dCtiy.tiltModel.deleteObject();
|
window.dCtiy.pathLayer && window.dCtiy.pathLayer.deleteObject();
|
window.dCtiy.waterLayer && window.dCtiy.waterLayer.deleteObject();
|
|
window.dCtiy = null;
|
|
if (window.sceneObj) {
|
this.setEffectVisibility(false);
|
}
|
|
return;
|
}
|
window.corePos = {
|
lon: 116.51296,
|
lat: 39.80143
|
};
|
window.dCtiy = {};
|
|
window.dCtiy.tiltModel = sgworld.Creator.create3DTilesets(
|
"",
|
window.GIS_IP + "/gisserver/c3dserver/YZ_BM/tileset.json",
|
{},
|
{
|
effects: true,
|
effectsMaxHeight: 60,
|
colors: "rgba(0,127,255,1)"
|
},
|
"0",
|
true,
|
data => {
|
Viewer.zoomTo(data.item);
|
}
|
);
|
|
// 流光线图层
|
window.dCtiy.pathLayer = sgworld.Creator.createPathLayer({
|
url: "./static/hebing.json",
|
color: "#0033FF", //线的颜色
|
width: 4.0, //线的宽度
|
pointColor: "#FFFFFF", //移动点的颜色
|
speed: 8,
|
far: 200000
|
});
|
|
//水面
|
window.dCtiy.waterLayer = sgworld.Creator.createWaterPolygonLayer({
|
url: "./static/water.json",
|
speed: 5
|
});
|
|
// window.dCtiy.layers = sgworld.Creator.createUrlTemplateImageryProvider('tms服务', {
|
// url: Cesium.buildModuleUrl(window.GIS_IP + "/gisserver/tmsserver/lanearth/{z}/{x}/{reverseY}.png"),
|
// }, '0', undefined, true,)
|
|
window.dCtiy.layers = sgworld.Creator.createImageryProvider(
|
"",
|
"tms",
|
{
|
url: window.GIS_IP + "/gisserver/tmsserver/lanearth",
|
fileExtension: "png",
|
enablePickFeatures: false,
|
level: "0,26",
|
tilingScheme: new Cesium.GeographicTilingScheme(),
|
alpha: 1
|
},
|
"0",
|
undefined,
|
true,
|
""
|
);
|
if (window.sceneObj) {
|
this.setEffectVisibility(true);
|
} else {
|
window.sceneObj = [];
|
window.KEYPOIS.forEach(item => {
|
this.addDRW(item);
|
});
|
|
|
this.addFlyingLine();
|
this.addTrailLinePath();
|
this.addEffectCylinder();
|
this.addTetrahedron();
|
this.addCircle();
|
}
|
},
|
setEffectVisibility(show) {
|
for (let i = 0; i < window.sceneObj.length; i++) {
|
try {
|
window.sceneObj[i].setVisibility(show);
|
} catch (e) {}
|
}
|
},
|
addTetrahedron() {
|
let Tetrahedrod = sgworld.Creator.addTetrahedron({
|
position: {
|
lon: window.corePos.lon,
|
lat: window.corePos.lat,
|
height: 180
|
},
|
multiple: 2.0,
|
scale: new Cesium.Cartesian3(30, 30, 30)
|
});
|
window.sceneObj.push(Tetrahedrod);
|
},
|
addFlyingLine() {
|
// 垂直飞线
|
let bounds = {
|
west: 116.48379,
|
south: 39.74328,
|
east: 116.58084,
|
north: 39.81983
|
};
|
let max = 800;
|
let min = 500;
|
let positions = [];
|
for (let i = 0; i < 50; i++) {
|
let x = Math.random() * (bounds.east - bounds.west) + bounds.west;
|
let y = Math.random() * (bounds.north - bounds.south) + bounds.south;
|
let z = Math.random() * (max - min) + min;
|
positions.push({ lon: x, lat: y, height: z });
|
}
|
let effect = sgworld.Creator.createFlyingLine(positions, {
|
time: 2500,
|
color: "#ffff00",
|
far: 20000
|
});
|
window.sceneObj.push(effect);
|
},
|
addCircle() {
|
// 特效圆-旋转
|
var circle = sgworld.Creator.addRotateEffectCircle({
|
position: {
|
lon: window.corePos.lon,
|
lat: window.corePos.lat,
|
height: 10
|
},
|
radius: 1300
|
});
|
window.sceneObj.push(circle);
|
},
|
addTrailLinePath() {
|
// 流动路径 , 39.80143
|
var center = {
|
lon: window.corePos.lon,
|
lat: window.corePos.lat,
|
height: 180
|
};
|
var cities = [
|
{ lon: 116.47861, lat: 39.80373 },
|
{ lon: 116.51465, lat: 39.8188 },
|
{ lon: 116.55359, lat: 39.82387 },
|
{ lon: 116.56913, lat: 39.81324 },
|
{ lon: 116.58114, lat: 39.80237 },
|
{ lon: 116.59732, lat: 39.78358 },
|
{ lon: 116.55501, lat: 39.77515 },
|
{ lon: 116.49845, lat: 39.75524 },
|
{ lon: 116.4882, lat: 39.78245 }
|
];
|
let effect = sgworld.Creator.createTrailLinePath(center, cities, {
|
width: 3, //线宽(可选)
|
height: 1600, //抛物线高度(可选)
|
color: "#00ffff", //线颜色(可选),
|
LightSpot: true, //是否使用光点效果(可选)
|
LightSpotColor: "#ffffff", //光点颜色(可选)
|
far: 40000
|
});
|
window.sceneObj.push(effect);
|
|
cities.forEach(item => {
|
this.addDRW(item);
|
});
|
},
|
addDRW(item) {
|
let color = ["#f00", "#ff0", "#80ccff"][parseInt(Math.random() * 3)];
|
let _obj = {};
|
// 特效圆-动态辐射波
|
_obj.circle = sgworld.Creator.addDRWEffectCircle({
|
position: {
|
lon: item.lon,
|
lat: item.lat,
|
height: 1
|
},
|
color: color
|
});
|
|
// 特效圆锥
|
_obj.cone = sgworld.Creator.addEffectCone({
|
position: {
|
lon: item.lon,
|
lat: item.lat,
|
height: 1
|
},
|
color: color,
|
radius: 6,
|
length: 300
|
});
|
|
var position = { X: item.lon, Y: item.lat, Altitude: 310 };
|
_obj.label = sgworld.Creator.CreateLabel(
|
position,
|
item.name,
|
"",
|
{
|
FontName: `16px SimSun`,
|
IconColor: "#FFFFFF",
|
MaxViewingHeight: 118500
|
},
|
0,
|
""
|
);
|
window.sceneObj.push(_obj);
|
},
|
addEffectCylinder() {
|
let effect = sgworld.Creator.addEffectCylinder({
|
position: {
|
lon: window.corePos.lon,
|
lat: window.corePos.lat,
|
height: 0
|
},
|
radius: 1300,
|
length: 200,
|
multiple: 1.5
|
});
|
window.sceneObj.push(effect);
|
},
|
//路径漫游
|
pathRoaming() {
|
this.$parent.$parent.$parent.closeAllHighLight("roam");
|
if (this.isOpen["pathRoaming"]) {
|
this.isOpen["pathRoaming"] = false;
|
layuiLayer.close(SmartEarthPopupData.layerProp);
|
sgworld.drawObj &&
|
(sgworld.drawObj.drawHandler && sgworld.drawObj.drawHandler.destroy(),
|
sgworld.drawObj.end && sgworld.drawObj.end("cancel"));
|
return;
|
}
|
// 清除所有的高亮样式
|
this.clearActive();
|
// this.$parent.closeAll();
|
this.$parent.$parent.$parent.closeAll();
|
//结束上一次操作
|
layuiLayer.close(SmartEarthPopupData.layerProp);
|
sgworld.drawObj &&
|
(sgworld.drawObj.drawHandler && sgworld.drawObj.drawHandler.destroy(),
|
sgworld.drawObj.end && sgworld.drawObj.end());
|
|
this.isOpen["pathRoaming"] = true;
|
|
sgworld.drawObj = sgworld.Command.execute(2, 3, "", data => {
|
if (!PathAnimationData.isFly) {
|
data.showPoint = false;
|
data.showLine = true;
|
data.mode = 1;
|
PathAnimationData.selectRouteData = data;
|
PathAnimationData.isFly = true;
|
layerOpen("路径漫游", {
|
width: 352,
|
height: 700,
|
offset: ["60%", "10px"],
|
url: "./static/html/PathAnimationSec.html",
|
fn: {
|
end: () => {
|
PathAnimationData.isFly = false;
|
Viewer.scene.globe.depthTestAgainstTerrain =
|
PathAnimationData.depthTest;
|
|
PathAnimationData.fly && PathAnimationData.fly.exit();
|
layuiLayer.close(PathAnimationData.win_index);
|
PathAnimationData = {
|
isFly: false
|
};
|
this.isOpen.pathRoaming = false;
|
},
|
success: function(layero, index) {
|
PathAnimationData.win_index = index;
|
}
|
}
|
});
|
}
|
});
|
},
|
//定点绕飞
|
pointFly() {
|
this.$parent.$parent.$parent.closeAllHighLight("roam");
|
if (this.isOpen["pointFly"]) {
|
this.isOpen["pointFly"] = false;
|
sgworld.drawObj &&
|
(sgworld.drawObj.drawHandler && sgworld.drawObj.drawHandler.destroy(),
|
sgworld.drawObj.end && sgworld.drawObj.end("cancel"));
|
return;
|
}
|
this.clearActive();
|
this.$parent.$parent.$parent.closeAll();
|
|
layuiLayer.close(SmartEarthPopupData.layerProp);
|
sgworld.drawObj &&
|
(sgworld.drawObj.drawHandler && sgworld.drawObj.drawHandler.destroy(),
|
sgworld.drawObj.end && sgworld.drawObj.end());
|
|
this.isOpen["pointFly"] = true;
|
sgworld.drawObj = sgworld.Analysis.setPointFly({
|
end: () => {
|
this.isOpen["pointFly"] = false;
|
}
|
});
|
}
|
}
|
};
|
</script>
|