Пример #1
0
 /// <summary>
 /// 模拟物流配送。
 /// Simulate the logistics
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void m_timer_Tick(object sender, EventArgs e)
 {
     try
     {
         int index = m_trackingLayer.IndexOf("playPoint");
         if (index != -1)
         {
             m_trackingLayer.Remove(index);
         }
         if (m_lineM.Length != 0)
         {
             PointM   pointM = m_lineM.GetPart(0)[m_count];
             GeoPoint point  = new GeoPoint(pointM.X, pointM.Y);
             GeoStyle style  = new GeoStyle();
             style.LineColor  = Color.FromArgb(0, 255, 255);
             style.MarkerSize = new Size2D(8, 8);
             point.Style      = style;
             m_trackingLayer.Add(point, "playPoint");
             m_count++;
             if (m_count >= m_lineM.GetPart(0).Count)
             {
                 m_count = 0;
             }
         }
         m_mapControl.Map.Refresh();
     }
     catch (Exception ex)
     {
         Trace.WriteLine(ex.Message);
     }
 }
Пример #2
0
        /// <summary>
        /// 进行行驶导引。
        /// Path guide
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void m_timer_Tick(object sender, EventArgs e)
        {
            try
            {
                int index = m_trackingLayer.IndexOf("playPoint");
                if (index != -1)
                {
                    m_trackingLayer.Remove(index);
                }

                GeoLineM lineM  = m_result.Routes[0];
                PointM   pointM = lineM.GetPart(0)[m_count];

                // 构造模拟对象
                // Build simulation object
                GeoPoint point = new GeoPoint(pointM.X, pointM.Y);
                GeoStyle style = new GeoStyle();
                style.LineColor  = Color.Red;
                style.MarkerSize = new Size2D(5, 5);
                point.Style      = style;
                m_trackingLayer.Add(point, "playPoint");

                // 跟踪对象
                // Tracking object
                m_count++;
                if (m_count >= lineM.GetPart(0).Count)
                {
                    m_count = 0;
                }
                m_mapControl.Map.RefreshTrackingLayer();
            }
            catch (Exception ex)
            {
                Trace.WriteLine(ex.Message);
            }
        }