2 次代碼提交 dc73c064ea ... 056d389eff

作者 SHA1 備註 提交日期
  周壕 056d389eff Merge remote-tracking branch 'origin/master' 10 月之前
  周壕 6cdac19640 地图定位sql 10 月之前
共有 1 個文件被更改,包括 15 次插入6 次删除
  1. 15 6
      src/main/resources/static/a4gis/index.html

+ 15 - 6
src/main/resources/static/a4gis/index.html

@@ -763,6 +763,13 @@
         app.graLayer.clear();
         pgs = {};
         pointObjects = {};
+        //筛选x,y坐标不能为空
+        console.log("setSymbols", "points length:"+points.length);
+        points = points.filter((it)=>{
+          return it.x != null && it.x != undefined && it.y != null && it.y != undefined;
+        });
+        if(points.length==0) return;
+        console.log("setSymbols", "points filter length:"+points.length);
 
         require(["esri/geometry/Point", "esri/graphic", "esri/Color", "esri/symbols/SimpleMarkerSymbol", "esri/InfoTemplate"],
                 function (Point, Graphic, Color, SimpleMarkerSymbol, InfoTemplate) {
@@ -772,8 +779,7 @@
                   //显示所有标注
                   for (let i = 0; i < points.length; i++) {
                     let obj = points[i];
-                    if (obj.x == null || obj.x == undefined) continue;
-                    if (obj.y == null || obj.y == undefined) continue;
+
                     obj.x = obj.x * 1;
                     obj.y = obj.y * 1;
 
@@ -814,10 +820,13 @@
     }
 
     function zoomToCenter(obj, isCenter){
-      if(obj.x==null || obj.x==undefined) return;
-      if(obj.y==null || obj.y==undefined) return;
-      obj.x = obj.x *1;
-      obj.y = obj.y *1;
+      if(obj.x==null || obj.x==undefined || obj.y==null || obj.y==undefined){
+        console.log("zoomToCenter", " x("+obj.x+") or y("+obj.y+") is null");
+        return;
+      }
+
+      obj.x = obj.x * 1;
+      obj.y = obj.y * 1;
 
       if(pointObjects[obj.well_id]) {
         console.log("zoomToCenter",pointObjects[obj.well_id]);