示例#1
0
        //区域选择完成事件
        private void gmapControl_OnSelectionChange(global::GMap.NET.RectLatLng Selection, bool ZoomToFit)
        {
            if (flag)
            {
                return;
            }
            if (ZoomToFit)
            {
                return;
            }
            foreach (var item in elementList)
            {
                item.HightLight(false);
            }
            elementList.Clear();
            markerList = gmapControl.Overlays[0].Markers.ToList();
            foreach (var item in markerList)
            {
                if (Selection.Contains(item.Position) && gmapControl.DisableAltForSelection) //包含在矩形内
                {
                    IMFElement element = item as IMFElement;
                    IMFElement el      = elementList.Find(o => o.ElementName == element.ElementName);
                    if (elementList.Count > -1 && element.IsHightLight && el == null)
                    {
                        continue;
                    }
                    else
                    {
                        element.HightLight(true);//让选中的目标高亮
                        if (el == null)
                        {
                            elementList.Add(element);
                        }
                    }
                }
            }

            if (CommondExecutedEvent != null)
            {
                CommondExecutedEvent(this, null);
            }
            mapLogic.Refresh();
            flag = false;
        }