|
@@ -1,6 +1,6 @@
|
|
|
//DGE 是自主研发数字孪生框架
|
|
|
//DGE 作者:tianhongguo
|
|
|
-let map = new DGE.Map('cesiumContainer', {
|
|
|
+let map = new DGE.Map('container', {
|
|
|
animation:false, //左下角的动画仪表盘
|
|
|
baseLayerPicker:false, //右上角的图层选择按钮
|
|
|
geocoder:false, //搜索框
|
|
@@ -16,7 +16,7 @@ let map = new DGE.Map('cesiumContainer', {
|
|
|
baseUrl:"./Source/"
|
|
|
});
|
|
|
|
|
|
-map.viewer._cesiumWidget._creditContainer.style.display = "none";
|
|
|
+
|
|
|
let tileset=map.data.threeDTiles.load({
|
|
|
url:"https://testgis.4dage.com/liangqichaoshuju/tileset.json",
|
|
|
height:10,
|
|
@@ -54,7 +54,7 @@ map.viewer.camera.setView({
|
|
|
options.enableDistanceLegend= false;
|
|
|
// 用于启用或禁用指南针外环。true是启用,false是禁用。默认值为true。如果将选项设置为false,则该环将可见但无效。
|
|
|
options.enableCompassOuterRing= true;
|
|
|
- DGE.CesiumNavigation(map.viewer, options);
|
|
|
+ DGE.MapNavigation(map.viewer, options);
|
|
|
|
|
|
let route =new DGE.FlyRoute("测试路线","FlyRouteId");
|
|
|
line.map(({
|
|
@@ -104,11 +104,11 @@ function addLabels(){
|
|
|
}
|
|
|
});
|
|
|
})
|
|
|
- intervalFun();
|
|
|
}
|
|
|
|
|
|
function intervalFun(){
|
|
|
- var j=0;
|
|
|
+ var j=0;//同一个时间段重复运行
|
|
|
+ interval&&clearInterval(interval)
|
|
|
interval=setInterval(()=>{
|
|
|
if(flyShow){
|
|
|
let ens=map.viewer.entities.values;
|
|
@@ -124,9 +124,7 @@ function intervalFun(){
|
|
|
})
|
|
|
}
|
|
|
}
|
|
|
- if(index==0&&j==0){
|
|
|
- addStr(line[index].str)
|
|
|
- }
|
|
|
+
|
|
|
if(index!=map.flyManager.activeStepIndex){
|
|
|
j=0;
|
|
|
index=map.flyManager.activeStepIndex;
|
|
@@ -134,9 +132,18 @@ function intervalFun(){
|
|
|
addStr(line[index].str)
|
|
|
}
|
|
|
}
|
|
|
+ if(index==0&&j==0){
|
|
|
+ addStr(line[index].str)
|
|
|
+ }
|
|
|
+
|
|
|
+ if(index==line.length-2){
|
|
|
+ clear()
|
|
|
+ }
|
|
|
+
|
|
|
j++;
|
|
|
}
|
|
|
},1000);
|
|
|
+ console.log("interval",interval)
|
|
|
}
|
|
|
function addStr(str){
|
|
|
var txtdiv=document.getElementById("font");
|
|
@@ -149,13 +156,15 @@ function addStr(str){
|
|
|
txtdiv.appendChild(txt);
|
|
|
}
|
|
|
var width=(window.innerWidth-txtdiv.clientWidth)/2;
|
|
|
- txtdiv.style.left=width;
|
|
|
- let styleStr="position: absolute;z-index: 100;bottom: 10%;background-color:rgba(157,96,34,0.5);color:white;left:"+width+"px;"
|
|
|
+
|
|
|
+ var left=(width/window.innerWidth)*100+"%";
|
|
|
+ let styleStr="position: absolute;z-index: 100;bottom: 10%;background-color:rgba(157,96,34,0.5);color:white;left:"+left
|
|
|
txtdiv.setAttribute('style',styleStr);
|
|
|
}
|
|
|
//清除
|
|
|
function clear(){
|
|
|
clearInterval(interval);
|
|
|
+ console.log("interval",interval)
|
|
|
var txtdiv=document.getElementById("font");
|
|
|
while(txtdiv.hasChildNodes())
|
|
|
{
|