コード例 #1
0
 public void SetSelectedPoint(double lat, double lng)
 {
     if (selectionMarker == null)
     {
         selectionMarker = AddMarker(new Markers.SelectionMarker(), lat, lng);
     }
     else
     {
         selectionMarker.Location = new Point(lat, lng);
         selectionMarker.SetVisualLocation(zoomLevel);
     }
 }
コード例 #2
0
        public MapMarker ReplaceMarker(MapMarker oldMarker, UserControl newMarker, double lat, double lng)
        {
            MapMarker m = new MapMarker(new Point(lat, lng), newMarker);
            m.SetVisualLocation(zoomLevel);
            int i = 0;
            for (; i<Markers.Count; i++)
            {
                if (Markers[i] == oldMarker)
                {
                    Markers[i]=m;
                    break;
                }
            }
            if (i==Markers.Count) return null;

            for (i = 0; i < MarkerLayer.Children.Count; i++)
            {
                if (MarkerLayer.Children[i] == oldMarker.MarkerControl)
                {
                    MarkerLayer.Children.RemoveAt(i);
                    MarkerLayer.Children.Insert(i, newMarker);
                    break;
                }
            }
            return m;
        }
コード例 #3
0
 public MapMarker AddMarker(UserControl marker, double lat, double lng)
 {
     if (!MapLayer.Children.Contains(marker))
     {
         MapMarker m = new MapMarker(new Point(lat, lng), marker);
         m.SetVisualLocation(zoomLevel);
         Markers.Add(m);
         MarkerLayer.Children.Add(marker);
         return m;
     }
     return null;
 }
コード例 #4
0
 public bool RemoveMarker(MapMarker marker)
 {
     if (!MapLayer.Children.Contains(marker.MarkerControl))
     {
         foreach (MapMarker mapMarker in Markers)
         {
             if (mapMarker == marker)
             {
                 Markers.Remove(mapMarker);
                 break;
             }
         }
         MarkerLayer.Children.Remove(marker.MarkerControl);
         return true;
     }
     return false;
 }
コード例 #5
0
 public MapControl(double lat, double lng)
 {
     InitializeComponent();
     MapLayer.RenderTransformOrigin = new Point(0.5, 0.5);
     MapLayer.RenderTransform = translateTransform;
     MarkerLayer.RenderTransformOrigin = new Point(0.5, 0.5);
     MarkerLayer.RenderTransform = translateTransform;
     MapCenter = new Point(lat, lng);
     MapLayer.SetValue(Canvas.ZIndexProperty, 100);
     MarkerLayer.SetValue(Canvas.ZIndexProperty, 200);
     selectionMarker = AddMarker(new Markers.SelectionMarker(),lat, lng);
 }