예제 #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);
            }
        }
예제 #2
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();
                }
            }
        }