From 4725705ad2cca332b2fe88979b0875826df8016b Mon Sep 17 00:00:00 2001
From: zhaoxing <zhaoxing@shsening.com>
Date: 星期四, 20 十月 2022 16:28:51 +0800
Subject: [PATCH] 增加排除整个上海范围外的汽车&撒点颜色和轨迹颜色不同问题

---
 js/function_1004.js |   18 ++++++++++++++----
 1 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/js/function_1004.js b/js/function_1004.js
index 8bbace7..8ef63ca 100644
--- a/js/function_1004.js
+++ b/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]

--
Gitblit v1.9.1