Esempio n. 1
0
        private void btnGo_Click(object sender, RoutedEventArgs e)
        {
            if (MapControl.QueryResultContainer == null)
            {
                MessageBox.Show("没有设置查询结果容器,无法进行查询。", "系统消息", MessageBoxButton.OK);
                return;
            }
            string keywords = txtKeyWords.Text;

            if (keywords.Trim() == string.Empty)
            {
                return;
            }
            Point  geoPt  = new Point();
            Match  m      = Regex.Match(txtKeyWords.Text, @"r:(?<radius>\d+(\.\d+)?)");
            double radius = 0;

            if (m.Success)
            {
                radius   = double.Parse(m.Groups["radius"].Value);
                keywords = Regex.Replace(keywords, @"r:(?<radius>\d+(\.\d+)?)", string.Empty);
            }
            if (GeoHelper.ExtractGeoCoord(keywords, out geoPt))
            {
                GeoTo(geoPt, radius);
            }
            else
            {
                MapControl.QueryResultContainer.Clear();
                MapControl.Map.Query(MapControl.QueryResultContainer, null, keywords);
            }
        }
Esempio n. 2
0
        void _mapsrv_Prj2GeoCompleted(object sender, Prj2GeoCompletedEventArgs e)
        {
            ObservableCollection <AgileMapServiceProxy.PointF> pts = e.Result;

            if (pts == null || pts.Count == 0)
            {
                return;
            }
            if (e.UserState != null && e.UserState.ToString() == "MouseTip")
            {
                AgileMapServiceProxy.PointF pt = pts[0];
                switch (_coordDisplayType)
                {
                case enumCoordDisplayType.DecimalDegree:
                    currentGeocoordTips.Text = "地理坐标:" + pt.x.ToString("####.######") + cstDegreeChar + " , " +
                                               pt.y.ToString("####.######") + cstDegreeChar;
                    break;

                case enumCoordDisplayType.DegreeMinuteSecond:
                    currentGeocoordTips.Text = "地理坐标:" + GeoHelper.DegreeToString(pt.x) + " , " + GeoHelper.DegreeToString(pt.y);
                    break;
                }
            }
        }