DR/4DAGE 4 lat temu
rodzic
commit
9d1728f942
2 zmienionych plików z 35 dodań i 10 usunięć
  1. 1 1
      public/zzdemo/main.js
  2. 34 9
      public/zzdemo/utils.js

+ 1 - 1
public/zzdemo/main.js

@@ -297,7 +297,7 @@ function onAtimeShowPause(time){
 
 function showTifAndRoadPrivate(result,i,index){
     currentDataIndex=i;
-    changeFontLocation(result[i].position[0],result[i].position[1],result[i].imgUrl,index,StyleClass)
+    changeFontLocation(result[i],index,StyleClass)
     changeImgLocation(result[i].position[0],result[i].position[1],result[i].type);
     if(result[i].type==1){
         xxgcxy.push(result[i])

+ 34 - 9
public/zzdemo/utils.js

@@ -136,26 +136,50 @@ function sortByATime(data,time){
    return arr2;
 }
 /**
- * 地图展示文字
+ * 地图展示文字 
  */
-function changeFontLocation(lon,lat,imgUrl,index,t){
+function changeFontLocation(data,index,t){
    let  dom;
+   let lon=data.position[0];
+    let lat=data.position[1];
+    let imgBool=true;
+    if(data.time=="1978.01"&&data.place=="洛阳" ){
+        imgBool=false;
+        lon-=4.5;
+        lat-=0.2
+    }
+    if(data.time=="1978.01"&&data.place=="郑州" ){
+        imgBool=false;
+        lon+=1.5;
+        lat+=0.2
+    }
+    if(data.time=="1986.06"&&data.place=="洛阳" ){
+        imgBool=false;
+        lon-=4.5;
+        lat-=0.2
+    }
+    if(data.time=="1986.06"&&data.place=="郑州" ){
+        imgBool=false;
+        lon-=0.5;
+        lat+=0.2
+    }
+
     if(t==RED){
          dom=createDiv({
-            fontImg:imgUrl,
-            proImg:"./img/red@2x.png",
+            fontImg:data.imgUrl,
+            proImg:imgBool?"./img/red@2x.png":null,
             style:RED
         })
     }else if(t==YELLOW){
          dom=createDiv({
-            fontImg:imgUrl,
-            proImg:"./img/yellow@2x.png",
+            fontImg:data.imgUrl,
+            proImg:imgBool?"./img/yellow@2x.png":null,
             style:YELLOW
         })
     } else{
         dom=createDiv({
-           fontImg:imgUrl,
-           proImg:"./img/blue@2x.png",
+           fontImg:data.imgUrl,
+           proImg:imgBool?"./img/blue@2x.png":null,
            style:BLUE
        })
    }
@@ -184,7 +208,8 @@ function changeFontLocation(lon,lat,imgUrl,index,t){
             })
           }
     root.appendChild(dom);
-   
+    
+
     let pixel= Cesium.SceneTransforms.wgs84ToWindowCoordinates(viewer.scene,Cesium.Cartesian3.fromDegrees(lon,lat)); 
      dom.style.left=pixel.x-0.4*dom.width+"px";
      dom.style.top=pixel.y-0.6*dom.height+"px";