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

---
 widgetsTS/taxiRouteReplay/widget.js |   56 ++++++++++++++++++++++++++++++++++++--------------------
 1 files changed, 36 insertions(+), 20 deletions(-)

diff --git a/widgetsTS/taxiRouteReplay/widget.js b/widgetsTS/taxiRouteReplay/widget.js
index e7661f3..2784a61 100644
--- a/widgetsTS/taxiRouteReplay/widget.js
+++ b/widgetsTS/taxiRouteReplay/widget.js
@@ -75,6 +75,7 @@
           position2 = Cesium.Cartesian3.fromDegrees(lng2, lat2);
         }
         item = changeNullAndundefinedToEmpty(item)
+        console.log(item,"璺嚎item",item[this.qindex])
       let graphic = new mars3d.graphic.PolylineEntity({
         positions: [position,position2],
         style: {
@@ -108,27 +109,42 @@
  
     addTaxiPointInfoGraphic() {
         var Pointsdata = mars3d.global_variables.singleTaxiReplayData;
-        for (var i = 0, len = Pointsdata.length; i < len; i++) {
+        for (var i = 0, len = Pointsdata.length; i < len-1; i++) {
+          // var item = Pointsdata[i];
+          // // var lng = Number(item["lon"]); //缁忓害
+          // // var lat = Number(item["lat"]); //绾害
+          // // var position = null;
+          // // if (lng && lat) {
+          // //   position = Cesium.Cartesian3.fromDegrees(lng, lat);
+          // // }
+          // let keys = ["lon","lat"]
+          // let array = []
+          // Pointsdata.map(item => {
+          //   array.push(keys.reduce((result, key) => ({ ...result, [key]: item[key] }), {}))
+          // })
+          // let points = []
+          // array.map(item => {
+          //   points.push(Object.values(item))
+          // })
+          // item = changeNullAndundefinedToEmpty(item)
           var item = Pointsdata[i];
-          // var lng = Number(item["lon"]); //缁忓害
-          // var lat = Number(item["lat"]); //绾害
-          // var position = null;
-          // if (lng && lat) {
-          //   position = Cesium.Cartesian3.fromDegrees(lng, lat);
-          // }
-          let keys = ["lon","lat"]
-          let array = []
-          Pointsdata.map(item => {
-            array.push(keys.reduce((result, key) => ({ ...result, [key]: item[key] }), {}))
-          })
-          let points = []
-          array.map(item => {
-            points.push(Object.values(item))
-          })
+          var item2 = Pointsdata[i+1];
+          var lng = Number(item["lon"]); //缁忓害
+          var lat = Number(item["lat"]); //绾害
+          var lng2 = Number(item2["lon"]); //缁忓害
+          var lat2 = Number(item2["lat"]); //绾害
+          var position = null;
+          var position2 = null;
+          if (lng && lat&&lng2&&lat2) {
+            position = Cesium.Cartesian3.fromDegrees(lng, lat);
+            position2 = Cesium.Cartesian3.fromDegrees(lng2, lat2);
+          }
           item = changeNullAndundefinedToEmpty(item)
+          let color_value = this.viewWindow.getLayerPointColorByQindexandValue(1004,this.qindex, item[this.qindex]);
+          console.log(item,"璺嚎item",item[this.qindex],this.viewWindow.getLayerPointColorByQindexandValue(1004,this.qindex, item[this.qindex]))
           //points[Pointsdata.length] = [lon,lat]
-          var CorridorPrimitive = new mars3d.graphic.CorridorPrimitive({
-            positions: points,
+          var CorridorPrimitive = new mars3d.graphic.CorridorEntity({
+            positions: [position,position2],
             style: {
               // length: 60.0,
 		      width: 10.0,
@@ -136,8 +152,8 @@
 		      cornerType: Cesium.CornerType.BEVELED,
               // radius: 8.0,
               diffHeight: this.qindex == "co" ? 300 * item[this.qindex] :  item[this.qindex]  || item[this.qindex] == "/" ? 500 : item[this.qindex], //楂樺害
-              color:this.viewWindow.getLayerPointColorByQindexandValue(1004,this.qindex, item[this.qindex]),
-              opacity: 0.6,
+              color:color_value,
+              opacity: 1,
               // rotationDegree: 45,
               highlight: {
                opacity: 1

--
Gitblit v1.9.1