Exemplo n.º 1
0
        /// <summary>
        /// 获取鼠标位置的地点ID
        /// </summary>
        /// <param name="p_point"></param>
        public string GetMouseLocationPlaceID(double x, double y)
        {
            if (_placeLocation == null || _placeLocation.Count == 0)
            {
                return("");
            }
            ClientUtile clientUtile = ClientUtile.Create();

            foreach (var itm in _placeLocation)
            {
                string placeid = itm.Key;
                var    list    = ShowMap.DrawList.Where(item => item.Key.StartsWith(placeid + "-")).ToList();
                if (list != null && list.Count > 0)
                {
                    for (int i = 0; i < list.Count; i++)
                    {
                        ReturnDrawGraphicInfo info = list[i].Value as ReturnDrawGraphicInfo;
                        if (info != null)
                        {
                            if (x >= info.GraphicExtent.Xy1.X && x <= info.GraphicExtent.Xy2.X && y >= info.GraphicExtent.Xy2.Y && y <= info.GraphicExtent.Xy1.Y)
                            {
                                List <MapPointEx> points = null;

                                if (info.QueryObject is PolygonQueryBehaviorEventArgs)
                                {
                                    points = (info.QueryObject as PolygonQueryBehaviorEventArgs).Points;
                                }
                                if (info.QueryObject is CircleBehaviorEventArgs)
                                {
                                    points = (info.QueryObject as CircleBehaviorEventArgs).Points;
                                }
                                if (info.QueryObject is RectangleQueryBehaviorEventArgs)
                                {
                                    points = (info.QueryObject as RectangleQueryBehaviorEventArgs).Points;
                                }
                                if (points == null || points.Count == 0)
                                {
                                    continue;
                                }
                                List <Point> pList = new List <Point>();
                                points.ForEach(item => pList.Add(new Point(item.X, item.Y)));
                                if (clientUtile.CalcPointPolygonRelation(new Point(x, y), pList.ToArray()))
                                {
                                    return(placeid);
                                }
                            }
                        }
                    }
                }
            }
            return("");
        }
Exemplo n.º 2
0
        private void CreateAroundStationArea(string pGuid, double pDistance, Action <Point[], Point, Point> pAction)
        {
            //获得几何服务地址
            //GeometryServerUrl = RiasPortal.GetMapGeometryServerUrl();

            var obj = ShowMap.DrawList.Where(itm => itm.Key.StartsWith(_activityPlaceInfo.Guid + "-")).ToList();

            if (obj == null || obj.Count == 0)
            {
                return;
            }
            for (int i = 0; i < obj.Count; i++)//xgh  地点会存在多个图形的情况
            {
                ReturnDrawGraphicInfo info = obj[i].Value as ReturnDrawGraphicInfo;
                //info.GraphicType  类型
                List <MapPointEx> points = null;

                if (info.QueryObject is PolygonQueryBehaviorEventArgs)
                {
                    points = (info.QueryObject as PolygonQueryBehaviorEventArgs).Points;
                    //polygon.Points
                    //  polygon.QueryBehavior  类型
                }
                if (info.QueryObject is CircleBehaviorEventArgs)
                {
                    points = (info.QueryObject as CircleBehaviorEventArgs).Points;
                }
                if (info.QueryObject is RectangleQueryBehaviorEventArgs)
                {
                    points = (info.QueryObject as RectangleQueryBehaviorEventArgs).Points;
                }
                if (points != null)
                {
                    GetAroundStationArea(points, info.QueryObject.QueryBehavior, pDistance, (pCall, p1, p2) =>
                    {
                        if (pAction != null)
                        {
                            pAction(pCall, p1, p2);
                        }
                        if (pCall != null && pCall.Length > 0)     //xgh
                        {
                            DrawAroundStationArea(pGuid, pCall);
                        }
                    });
                }
            }
        }
Exemplo n.º 3
0
 private void Button_Click_1(object sender, RoutedEventArgs e)
 {
     //定位
     if (mapGis.DrawList.Count > 0)
     {
         ReturnDrawGraphicInfo R = mapGis.DrawList[0].Value as ReturnDrawGraphicInfo;
         if (R != null)
         {
             mapGis.setExtent(new AT_BC.Data.GeoPoint()
             {
                 Longitude = R.GraphicExtent.Xy1.X, Latitude = R.GraphicExtent.Xy1.Y
             }, new AT_BC.Data.GeoPoint()
             {
                 Longitude = R.GraphicExtent.Xy2.X, Latitude = R.GraphicExtent.Xy2.Y
             });
         }
     }
 }