Exemplo n.º 1
0
 /// <summary>
 /// 选中位置改变
 /// </summary>
 /// <param name="poi"></param>
 void item_PlaceSelectedChanged(BPOI poi)
 {
     //BMapControl
     foreach (Control c in flpPlaces.Controls)
     {
         if (c is BPlaceItem && (c as BPlaceItem).POI != poi)
         {
             (c as BPlaceItem).Selected = false;
         }
     }
     if (BMapControl != null)
     {
         BMapControl.SelectBPOI(poi);
     }
 }
Exemplo n.º 2
0
 /// <summary>
 /// 选中POI
 /// </summary>
 internal void SelectPlace(BPOI poi)
 {
     foreach (Control c in flpPlaces.Controls)
     {
         if (c is BPlaceItem)
         {
             BPlaceItem p = c as BPlaceItem;
             if (p.POI == poi)
             {
                 p.Selected = true;
                 flpPlaces.ScrollControlIntoView(c);
             }
             else
             {
                 p.Selected = false;
             }
         }
     }
 }
Exemplo n.º 3
0
        /// <summary>
        /// 将位置显示在列表中
        /// </summary>
        /// <param name="places"></param>
        internal void AddPlaces(JToken places)
        {
            flpPlaces.Controls.Clear();              //清空原来所有位置
            if (Parent != null && Parent is TabPage) //如果父控件是tabpage 则选中
            {
                ((Parent as TabPage).Parent as TabControl).SelectedTab = (Parent as TabPage);
            }
            if (BDirectionBoard != null) //导航控件初始化
            {
                BDirectionBoard.Clear();
            }

            //加载位置项
            int index = 0; List <BPOI> _list = new List <BPOI>();

            foreach (JObject place in places)
            {
                if (place["location"] != null && place["location"]["lng"] != null && (string)place["location"]["lng"] != "")
                {
                    LatLngPoint location = new LatLngPoint(double.Parse((string)place["location"]["lng"]), double.Parse((string)place["location"]["lat"]));
                    BPOI        poi      = new BPOI {
                        DataSource = place, Index = index, Selected = false, Location = location
                    };
                    _list.Add(poi);

                    BPlaceItem item = new BPlaceItem();
                    item.Index = index++;
                    item.POI   = poi;
                    item.SetDestinationPlace  += new SetDestinationPlaceEventHandler(item_SetDestinationPlace);
                    item.SetSourcePlace       += new SetSourcePlaceEventHandler(item_SetSourcePlace);
                    item.PlaceSelectedChanged += new PlaceSelectedChangedEventHandler(item_PlaceSelectedChanged);
                    item.Height = 104;
                    flpPlaces.Controls.Add(item);
                }
            }
            if (BMapControl != null)
            {
                BMapControl.AddPlaces(_list);
            }
        }