Преглед изворни кода

直接提供距离坐标,内部进行坐标转换

HuangKai пре 6 дана
родитељ
комит
344f04fed8
3 измењених фајлова са 9 додато и 2 уклоњено
  1. 2 1
      src/view/App.js
  2. 1 1
      src/view/common/MoveableMarker.js
  3. 6 0
      src/view/utils/historyTrackControl.js

+ 2 - 1
src/view/App.js

@@ -301,7 +301,8 @@ export default class App {
 	moveMarker(data) {
 		if (data.type === "card") {
 			let cards = data.data.map(card => {
-				return new LocationCard(card.lat, card.lng, card.loc_time, card.milli_time, card.card_id, card.info, card.src);
+				let latlng = MapUtil.moveLatLng(App.center, card.x, card.y);
+				return new LocationCard(latlng.lat, latlng.lng, card.loc_time, card.milli_time, card.card_id, card.info, card.src);
 			});
 			PubSub.publish('body.data.update', cards);
 		}

+ 1 - 1
src/view/common/MoveableMarker.js

@@ -8,7 +8,7 @@ class MoveableMarker extends Component{
         for (let i = 0; i < data.length; i++) { 
             const element = data[i];
             if(element !== ','){
-                infos.push(<span>{element}</span>);
+                infos.push(<span key={data[i]}>{element}</span>);
             }else{
                 infos.push(<br/>);
             }

+ 6 - 0
src/view/utils/historyTrackControl.js

@@ -1,5 +1,7 @@
 import PubSub from "pubsub-js";
 import HistoryTrack from "../layers/HistoryTrack";
+import App from "../App";
+import MapUtil from "./MapUtil";
 
 export default class HistoryTrackControl{
     /** 
@@ -56,6 +58,10 @@ export default class HistoryTrackControl{
      */
     setHistoryPath(path, src, multi = 1){
         setTimeout(() => {
+            path = path.map(point => {                
+				let latlng = MapUtil.moveLatLng(App.center, point.x, point.y);
+                return {lat: latlng.lat, lng: latlng.lng, time: point.time};
+            });
             PubSub.publish("map.his.set", {path: path, src: src, speedMultiply: multi});
         }, 50);
     }