<template>
|
<div class="roam" id="roam">
|
<div class="roamTools">
|
<div class="roamTool" @click="pathRoaming">
|
<el-tooltip
|
class="item"
|
effect="dark"
|
content="路径漫游"
|
placement="top-start"
|
popper-class="item_tooltip"
|
>
|
<el-button> <img src="@/assets/img/right/my/ljmy1.png" /> </el-button
|
></el-tooltip>
|
</div>
|
<div class="roamTool" @click="pointFly">
|
<el-tooltip
|
class="item"
|
effect="dark"
|
content="定点绕飞"
|
placement="top-start"
|
popper-class="item_tooltip"
|
>
|
<el-button> <img src="@/assets/img/right/my/ddrf1.png" /> </el-button
|
></el-tooltip>
|
</div>
|
<!-- <div class="roamTool" @click="digitalCityHandle">
|
<el-tooltip
|
class="item"
|
effect="dark"
|
content="数字城市"
|
placement="top-start"
|
popper-class="item_tooltip"
|
>
|
<el-button> <img src="@/assets/img/left/tx/kjbj.png" /> </el-button
|
></el-tooltip>
|
</div> -->
|
<div class="roamTool" @click="setRomanFly('核心区漫游')">
|
<el-tooltip
|
class="item"
|
effect="dark"
|
content="核心区漫游"
|
placement="top-start"
|
popper-class="item_tooltip"
|
>
|
<el-button> <img src="@/assets/img/left/tx/ll.png" /> </el-button
|
></el-tooltip>
|
</div>
|
<div class="roamTool" @click="setRomanFly('景观绿地')">
|
<el-tooltip
|
class="item"
|
effect="dark"
|
content="景观绿地"
|
placement="top-start"
|
popper-class="item_tooltip"
|
>
|
<el-button> <img src="@/assets/img/left/tx/ll.png" /> </el-button
|
></el-tooltip>
|
</div>
|
<div class="roamTool" @click="setRomanFly('政务服务窗口')">
|
<el-tooltip
|
class="item"
|
effect="dark"
|
content="政务服务窗口"
|
placement="top-start"
|
popper-class="item_tooltip"
|
>
|
<el-button> <img src="@/assets/img/left/tx/ll.png" /> </el-button
|
></el-tooltip>
|
</div>
|
</div>
|
</div>
|
</template>
|
|
<style scoped>
|
.el-button:focus,
|
.el-button:hover {
|
background: transparent;
|
}
|
.roam {
|
position: absolute;
|
left: 65px;
|
bottom: 6px;
|
height: 50px;
|
/* border-radius: 30px; */
|
box-shadow: 0px 0px 10px rgba(101, 180, 253, 0.8) inset;
|
background-color: rgba(5, 39, 126, 0.7);
|
width: 300px;
|
}
|
.roamTools {
|
margin-left: 20px;
|
}
|
.roamTool {
|
border: 1px solid #999;
|
border-radius: 5px;
|
float: left;
|
width: 40px;
|
height: 40px;
|
margin: 5px;
|
}
|
.roamTool img {
|
margin: 4px;
|
}
|
.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
|
// });
|
let circle = sgworld.Creator.addDRWEffectCircle({
|
position: {
|
lon: item.lon,
|
lat: item.lat,
|
height: 1,
|
},
|
color: color,
|
});
|
window.sceneObj.push(circle);
|
|
// 特效圆锥
|
// _obj.cone = sgworld.Creator.addEffectCone({
|
// position: {
|
// lon: item.lon,
|
// lat: item.lat,
|
// height: 1
|
// },
|
// color: color,
|
// radius: 6,
|
// length: 300
|
// });
|
let cone = sgworld.Creator.addEffectCone({
|
position: {
|
lon: item.lon,
|
lat: item.lat,
|
height: 1,
|
},
|
color: color,
|
radius: 6,
|
length: 300,
|
});
|
window.sceneObj.push(cone);
|
|
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);
|
let label = sgworld.Creator.CreateLabel(
|
position,
|
item.name,
|
"",
|
{
|
FontName: `16px SimSun`,
|
IconColor: "#FFFFFF",
|
MaxViewingHeight: 118500,
|
},
|
0,
|
""
|
);
|
window.sceneObj.push(label);
|
},
|
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.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;
|
}
|
|
//结束上一次操作
|
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;
|
console.log(data);
|
PathAnimationData.isFly = true;
|
layerOpen("路径漫游", {
|
width: 334,
|
height: 445,
|
offset: ["15%", Viewer.container.offsetWidth - 360 - 200 + "px"],
|
// 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.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.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;
|
},
|
});
|
},
|
setRomanFly(params) {
|
let degreesArr = [];
|
switch (params) {
|
case "核心区漫游":
|
degreesArr = [
|
116.493479, 39.80450483, 34.01816465, 116.5138085, 39.77947026,
|
31.63330385,
|
];
|
break;
|
case "景观绿地":
|
degreesArr = [
|
116.4541689, 39.78062456, 30.4788207, 116.4618767, 39.7963431,
|
31.87381588, 116.4687937, 39.79241793, 31.19379078, 116.4742798,
|
39.78913405, 30.11803782, 116.4807703, 39.78743941, 31.48027437,
|
116.4895578, 39.77782452, 32.63986152, 116.5090257, 39.77228768,
|
30.07838461, 116.5147722, 39.76975519, 29.24082306, 116.5189657,
|
39.76649988, 28.75245888, 116.5208586, 39.76202203, 27.34821356,
|
116.5231743, 39.76039621, 27.75346174, 116.5353151, 39.76020156,
|
22.34613339, 116.5555339, 39.76965707, 30.11293431, 116.5624811,
|
39.77186726, 22.65879449, 116.5722676, 39.7769284, 27.11119094,
|
];
|
break;
|
|
case "政务服务窗口":
|
degreesArr = [
|
116.4961244, 39.80126862, 34.60044298, 116.4976219, 39.80200891,
|
34.02444896, 116.500233, 39.79879928, 36.14055497, 116.5028255,
|
39.79557196, 41.58378157, 116.5013282, 39.79495417, 35.38227236,
|
116.4963272, 39.80094707, 33.82085563,
|
];
|
break;
|
}
|
|
sgworld.Creator.getFlyData(degreesArr, (data) => {
|
data.showPoint = false;
|
data.showLine = true;
|
data.mode = 0;
|
// 弹窗数据
|
window.PathAnimationData = {
|
flyData: data,
|
};
|
window.PathAnimationData.winIndex = layer.open({
|
type: 2,
|
title: "路径动画",
|
shade: false,
|
area: ["352px", "690px"],
|
offset: "r",
|
skin: "other-class",
|
content: SmartEarthRootUrl + "Workers/path/Path.html",
|
end: function () {
|
PathAnimationData.fly && PathAnimationData.fly.exit();
|
},
|
});
|
});
|
},
|
},
|
};
|
</script>
|