private void UpdateMapAsync()
        {
            if (_map == null)
            {
                return;
            }

            this.InvokeIfRequired(() => {
                var selected         = lstResults.SelectedItem as PlaceNameViewModel;
                bool drawOffsetPoint = _offsetControl.IsVisible && _offsetControl.OffsetPlace != null && !string.IsNullOrWhiteSpace(_offsetControl.OffsetPlace.Offset);
                var offset           = _offsetControl.OffsetPlace;

                _map.HideAnchor();
                _map.ClearPoints();
                if (selected != null)
                {
                    _map.DropAnchor(selected.Longitude, selected.Latitude, selected.Name);

                    if (drawOffsetPoint)
                    {
                        MapPoint p     = new MapPoint();
                        p.Latitude     = offset.Latitude;
                        p.Longitude    = offset.Longitude;
                        p.Label        = string.Format("{0} {1} {2} of {3}", offset.Offset, offset.Units, offset.Direction, offset.Name);
                        var set        = new ListMapPointSet("_pointLayer");
                        set.DrawLabels = true;
                        set.Add(p);

                        _map.PlotPoints(set);
                    }
                }
            });
        }
        private void ShowOnMap()
        {
            var map = PluginManager.Instance.GetMap();

            if (map != null)
            {
                if (lstResults.ItemsSource != null)
                {
                    var label = GeoUtils.FormatCoordinates(ctlPosition.Latitude, ctlPosition.Longitude);
                    map.Show();
                    var set = new ListMapPointSet("Named places near " + label);
                    foreach (PlaceNameViewModel vm in lstResults.ItemsSource)
                    {
                        set.Add(new MapPoint {
                            Label = vm.Name, Latitude = vm.Latitude, Longitude = vm.Longitude
                        });
                    }

                    map.PlotPoints(set);
                    map.DropAnchor(ctlPosition.Longitude, ctlPosition.Latitude, "");
                }
            }
        }
Exemplo n.º 3
0
        private void ShowOnMap()
        {
            var map = PluginManager.Instance.GetMap();
            if (map != null) {
                if (lstResults.ItemsSource != null) {
                    var label = GeoUtils.FormatCoordinates(ctlPosition.Latitude, ctlPosition.Longitude);
                    map.Show();
                    var set = new ListMapPointSet("Named places near " + label);
                    foreach (PlaceNameViewModel vm in lstResults.ItemsSource) {
                        set.Add(new MapPoint { Label = vm.Name, Latitude = vm.Latitude, Longitude = vm.Longitude });
                    }

                    map.PlotPoints(set);
                    map.DropAnchor(ctlPosition.Longitude, ctlPosition.Latitude, "");
                }
            }
        }