Esempio n. 1
0
        /// <summary>
        /// 播放历史轨迹信息
        /// </summary>
        /// <param name="aHistory"></param>
        public void PlayHistory(JsonHistoryPosition aHistory)
        {
            mHistory.Clear();
            var sortLst = aHistory.Items.OrderBy(x => x.GpsTime);

            mHistoryVehicle = sortLst.FirstOrDefault();
            mHistory.AddRange(sortLst);
            List <Coordinate> points = new List <Coordinate>(aHistory.Count);

            foreach (var history in sortLst)
            {
                Coordinate tmpPoint = new Coordinate(history.BdLongitude, history.BdLatitude);
                points.Add(tmpPoint);
            }
            this.wbMap.ShowRoute(points);
            this.btnPlay.Visible = true;
            this.btnStop.Visible = true;
            this.btnPlay.Checked = true;
            this.mPlayIndex      = 0;
            this.tmrPlay.Start();
        }
Esempio n. 2
0
        /// <summary>
        /// 轨迹播放定时器
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void tmrPlay_Tick(object sender, EventArgs e)
        {
            if (this.mPlayIndex < 0 || this.mHistory == null ||
                this.mHistory.Count < 1 || this.mHistoryVehicle == null)
            {
                return;
            }

            if (this.mPlayIndex >= this.mHistory.Count)
            {
                // 播放完毕时的情况
                this.btnPlay.Checked = false;
                this.tmrPlay.Stop();
                return;
            }

            JsonHistoryItem history = this.mHistory[mPlayIndex++];

            // 根据情况创建不同方向的小车图层
            this.wbMap.LocatedHistory(new object[] { this.mHistoryVehicle.LicensePlate,
                                                     history.BdLongitude, history.BdLatitude,
                                                     history.Direction, MapHelper.NORMAL_COLOR });
        }