Example #1
0
        /// <summary>
        /// Init the annotations on the map from a set of exhibits anr/or a route.
        /// </summary>
        /// <param name="exhibitSet">The set of exhibits.</param>
        /// <param name="route">The route.</param>
        private void InitAnnotations(ExhibitSet exhibitSet, Route route)
        {
            if (exhibitSet != null)
            {
                foreach (var exhibit in exhibitSet)
                {
                    var annotation = new ExhibitAnnotation(exhibit.Location.Latitude, exhibit.Location.Longitude, exhibit.Id,
                                                           exhibit.Name);
                    Control.AddAnnotation(annotation);
                }
            }

            if (route != null)
            {
                foreach (Waypoint routeWaypoint in route.Waypoints)
                {
                    if (exhibitSet == null || !exhibitSet.Contains(routeWaypoint.Exhibit))
                    {
                        var annotation = new ExhibitAnnotation(routeWaypoint.Location.Latitude, routeWaypoint.Location.Longitude, routeWaypoint.Exhibit.Id,
                                                               routeWaypoint.Exhibit.Name);
                        Control.AddAnnotation(annotation);
                    }
                }
            }

            if (osmMap.GpsLocation != null)
            {
                userAnnotation = new UserAnnotation(osmMap.GpsLocation.Latitude, osmMap.GpsLocation.Longitude);
            }
        }
Example #2
0
        private void Marker_PropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            Marker marker = sender as Marker;

            if (e.PropertyName == "Center")
            {
                Markers[marker].SetCoordinate(new CLLocationCoordinate2D(marker.Center.Latitude, marker.Center.Longitude));
            }
            Control.RemoveAnnotation(Markers[marker]);
            Control.AddAnnotation(Markers[marker]);
        }
        private void UpdatePins()
        {
            Control.RemoveAnnotations(Control.Annotations);
            IList <IMapModel> pins = Element.Items;

            foreach (IMapModel current in pins)
            {
                var pin = new CustomAnnotation(current);

                Control.AddAnnotation(pin);
            }
        }
Example #4
0
        public void AddPin(IMapPin pin)
        {
            var mapPin = new UnifiedPointAnnotation
            {
                Data       = pin,
                Title      = pin.Title,
                Subtitle   = pin.Snippet,
                Coordinate = new CLLocationCoordinate2D(pin.Location.Latitude, pin.Location.Longitude)
            };

            // pin.Id = mapPin;
            Control.AddAnnotation(mapPin);
        }
Example #5
0
        private void UpdatePins()
        {
            Control.RemoveAnnotations(Control.Annotations);
            IList <ExtendedPin> pins = Element.ItemsSource?.Cast <ExtendedPin>().ToList();

            if (pins != null)
            {
                foreach (ExtendedPin current in pins)
                {
                    Control.AddAnnotation(new CustomAnnotation(current));
                }
            }
        }
Example #6
0
        private void AddMarker(Marker marker)
        {
            if (marker is Polyline)
            {
                AddPolyline(marker as Polyline);
                return;
            }
            MarkerAnnotation annotation = new MarkerAnnotation(marker);

            Control.AddAnnotation(annotation);
            Markers.Add(marker, annotation);

            marker.PropertyChanged += Marker_PropertyChanged;
        }
Example #7
0
        /// <summary>
        /// React to changes of the gps position.
        /// </summary>
        /// <param name="location">The position that changed.</param>
        private void OnGpsLocationChanged(GeoLocation location)
        {
            if (location != null)
            {
                // update user location
                if (userAnnotation != null)
                {
                    Control.RemoveAnnotation(userAnnotation);
                }
                userAnnotation = new UserAnnotation(location.Latitude, location.Longitude);
                Control.AddAnnotation(userAnnotation);

                if (osmMap.ShowNavigation)
                {
                    UpdateRoute();
                }
            }
        }