zhaoxing
2022-10-20 4725705ad2cca332b2fe88979b0875826df8016b
js/function_1004.js
@@ -227,10 +227,20 @@
      var tmpPositionProperty = new Cesium.SampledPositionProperty();
      if(regionCode == 0){
        for (var i = 0, len = result.data.result.length; i < len; i++) {
          let item = result.data.result[i];
          tmpPositionProperty.addSample(Cesium.JulianDate.fromDate(new Date(item["datatime"])), Cesium.Cartesian3.fromDegrees(item["lon"], item["lat"], 0.2))
        }
        $.getJSON("./data/shanghai.json", (result2) => {
          polygon_Points = result2.features[0].geometry.coordinates[0][0]
          console.log(polygon_Points,"上海边界")
          for (var i = 0, len = result.data.result.length; i < len; i++) {
            let item = result.data.result[i];
            console.log(item.lon,item.lat,polygon_Points)
            let isIn = isInPolygon([item.lon,item.lat],polygon_Points)
            if(isIn){
              console.log("进来了")
                tmpPositionProperty.addSample(Cesium.JulianDate.fromDate(new Date(item["datatime"])), Cesium.Cartesian3.fromDegrees(item["lon"], item["lat"], 0.2))
              }
          }
        })
      }else{
        $.getJSON("./data/"+regionCode+".geojson", (result2) => {
          polygon_Points = result2.features[0].geometry.coordinates[0][0]