Beispiel #1
0
        private void Grid_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            Grid       g   = sender as Grid;
            MapElement obj = g.DataContext as MapElement;

            if (obj == null)
            {
                return;
            }

            if (!obj.X.HasValue && !obj.Y.HasValue)
            {
                ContainerManager.ToastTip.Text     = "暂无定位数据";
                ContainerManager.ToastTip.IsOpened = true;
                return;
            }

            MarkerMapElement carMapElement = _currentMarkerMapElementList.FirstOrDefault(m => m.ID == obj.ID);

            if (carMapElement == null)
            {
                MarkerMapElement element = new MarkerMapElement(obj.ID, obj.MapElementCategoryID, obj.ReservedField1, new Point((double)obj.X, (double)obj.Y), 0, ContainerManager.Map, LayerManager.ElementLayer);
                element.AddToMap();
                element.Select();
                _currentMarkerMapElementList.Add(element);
            }
            else
            {
                carMapElement.Select();
            }

            ContainerManager.ToastTip.Text     = "正在定位..";
            ContainerManager.ToastTip.IsOpened = true;
            ContainerManager.Map.PanTo(new ESRI.ArcGIS.Client.Geometry.Envelope((double)obj.X, (double)obj.Y, (double)obj.X, (double)obj.Y));
        }
Beispiel #2
0
        private void GetAllRound(double radius, string categoriesID, MapElement entity, string value)
        {
            ContainerManager.ToastTip.Text     = "正在加载..";
            ContainerManager.ToastTip.IsOpened = true;

            WebAPIHelper dt = new WebAPIHelper();

            dt.GetDataCompleted += (s, args) =>
            {
                List <MapElement> currentList = args.DataResult as List <MapElement>;

                //   listWindow.DataSource = currentList;

                foreach (MapElement obj in currentList)
                {
                    MarkerMapElement element = new MarkerMapElement(obj.ID, obj.MapElementCategoryID, obj.ReservedField1, new Point((double)obj.X, (double)obj.Y), 0, ContainerManager.Map, LayerManager.ElementLayer);
                    element.AddToMap();
                    _currentMarkerMapElementList.Add(element);
                }

                //ContainerManager.Map.Extent = Helper.GpsHelper.MapExtent4Road(currentList);
            };

            Dictionary <string, object> dic = new Dictionary <string, object>();

            dic.Add("MapElementCategoryIDArr", categoriesID);
            string url = String.Format(@"api/MapElementCoord/GetNearList?x={0}&y={1}&radius={2}", (double)entity.X, (double)entity.Y, radius);

            dt.GetDataAsync <List <MapElement> >(url, dic);
        }
Beispiel #3
0
        private void GetAllPersons(string value)
        {
            ContainerManager.ToastTip.Text     = "正在加载..";
            ContainerManager.ToastTip.IsOpened = true;

            WebAPIHelper dt = new WebAPIHelper();

            dt.GetDataCompleted += (s, args) =>
            {
                List <MapElement> _currentList  = args.DataResult as List <MapElement>;
                List <MapElement> _positionList = _currentList.Where(m => m.X != null).ToList();
                //var list = _positionList.Where(m => m.MapElementCategoryID == _mapElementCategoryID).Distinct(new SchoolComparer()).ToList();
                //List<Image> img = getImage(_mapElementCategoryID);
                Dictionary <int, Image> imglist = GetIconUrl(_mapElementCategoryID);
                foreach (MapElement obj in _positionList)
                {
                    if (obj.X == null)
                    {
                        continue;
                    }
                    //MarkerMapElement element = new MarkerMapElement(obj, 0, ContainerManager.Map, LayerManager.ElementLayer);
                    MarkerMapElement element = new MarkerMapElement(obj, 0, ContainerManager.Map, LayerManager.ElementLayer, imglist);
                    element.AddToMap();
                    _currentMapElementList.Add(element);
                }

                //ContainerManager.Map.Extent = GpsHelper.MapExtent4Road(_currentList);
            };

            _results["ReservedField1"] = value;
            string url = "api/MapElement/Query";

            dt.GetDataAsync <List <MapElement> >(url, _results);
        }