public void displayCallout(IMapAnnotation annotation, IAnnotationMarker annotationElement)
        {
            // Hide any existing callout
            hideCallout();

            // There is only ever one callout
            MapCallout callout = new MapCallout();
            calloutLayer.Children.Add(callout);

            // Hook up tap event
            callout.Callout_Tapped += callout_Callout_Tapped;

            // Assign this annotation as the data context of the callout - so it can get Title, Subtitle, etc
            callout.DataContext = annotation;

            // Position
            MapLayer.SetPosition(callout, new Location(annotation.Latitude, annotation.Longitude));

            // Callout anchor point also depends upon the anchor of the pushpin
            MapLayer.SetPositionAnchor(callout, new Windows.Foundation.Point(
                CALLOUT_ANCHOR_X + annotationElement.PositionAnchor.X,
                CALLOUT_ANCHOR_Y + annotationElement.PositionAnchor.Y));

            // Appear

            callout.animateOnscreen();

            Point offsetRequired;
            if (!isCalloutInView(callout, out offsetRequired))
                map.scrollBy(offsetRequired);

            // Store for later
            lastCallout = callout;
        }
Пример #2
0
        // This method is where we tell the map what XAML UIElement to display for a given annotation
        public IAnnotationMarker MarkerForAnnotation(IMapAnnotation annotation)
        {
            if (annotation is Restaurant)
            {
                // Use a square map marker for restaurants
                SquareMapMarker squareMarker = new SquareMapMarker();

                // Number each map marker
                squareMarker.MarkerText = restaurants.IndexOf((Restaurant)annotation).ToString();

                return squareMarker;
            }
            else if (annotation is Museum)
            {
                // Use a square map marker for restaurants
                RoundMapMarker roundMarker = new RoundMapMarker();

                // Number each map marker
                roundMarker.MarkerText = museums.IndexOf((Museum)annotation).ToString();

                return roundMarker;
            }
            else
                return null;
        }
Пример #3
0
        /// <summary>
        /// Determines whether the specified <see cref="IMapAnnotation"/> is equal to the current <see cref="T:fivenine.UnifiedMaps.CircleOverlay"/>.
        /// </summary>
        /// <param name="other">The <see cref="IMapAnnotation"/> to compare with the current <see cref="T:fivenine.UnifiedMaps.CircleOverlay"/>.</param>
        /// <returns><c>true</c> if the specified <see cref="IMapAnnotation"/> is equal to the current
        /// <see cref="T:fivenine.UnifiedMaps.CircleOverlay"/>; otherwise, <c>false</c>.</returns>
        public bool Equals(IMapAnnotation other)
        {
            var that = other as ICircleOverlay;
            if (that == null)
            {
                return false;
            }

            return Location == that.Location
               && Color == that.Color
               && Math.Abs(Radius - that.Radius) < float.Epsilon;
        }
Пример #4
0
 /// <summary>
 /// Send the pin clicked event.
 /// </summary>
 internal void SendPinClicked(IMapAnnotation pin)
 {
     PinClicked?.Invoke(this, new MapEventArgs <IMapAnnotation>(pin));
 }
Пример #5
0
 public void MapAnnotationClicked(IMapAnnotation annotation)
 {
     displayCalloutForAnnotation(annotation);
 }
Пример #6
0
        public IAnnotationMarker MarkerForAnnotation(IMapAnnotation annotation)
        {
            // Calls back to our own delegate if it exists)
            if (markerSource != null)
                return markerSource.MarkerForAnnotation(annotation);
            else
                return new DefaultMapMarker();

        }
Пример #7
0
 void displayCalloutForAnnotation(IMapAnnotation annotation)
 {
     IAnnotationMarker annotationElement = (IAnnotationMarker)annotationManager.UIElementForAnnotation(annotation);
     
     calloutManager.displayCallout(annotation, annotationElement);
 }
Пример #8
0
        /// <summary>
        /// Determines whether the specified <see cref="IMapAnnotation"/> is equal to the current <see cref="T:fivenine.UnifiedMaps.MapPin"/>.
        /// </summary>
        /// <param name="other">The <see cref="IMapAnnotation"/> to compare with the current <see cref="T:fivenine.UnifiedMaps.MapPin"/>.</param>
        /// <returns><c>true</c> if the specified <see cref="IMapAnnotation"/> is equal to the current
        /// <see cref="T:fivenine.UnifiedMaps.MapPin"/>; otherwise, <c>false</c>.</returns>
        public bool Equals(IMapAnnotation other)
        {
            var that = other as IMapPin;
            if (that == null)
            {
                return false;
            }

            return Location == that.Location &&
               string.Compare(Title, that.Title, StringComparison.OrdinalIgnoreCase) == 0 &&
               string.Compare(Snippet, that.Snippet, StringComparison.OrdinalIgnoreCase) == 0 &&
               Color == that.Color;
        }
 public CalloutButtonTappedEventArgs(int buttonIndex, IMapAnnotation annotation)
 {
     this.ButtonIndex = buttonIndex;
     this.Annotation = annotation;
 }
 public UIElement UIElementForAnnotation(IMapAnnotation annotation)
 {
     return annotationElements[annotation];
 }
Пример #11
0
        public void MapAnnotationClicked(IMapAnnotation annotation)
        {
            if (this.Annotation_Tapped != null) {
                this.Annotation_Tapped(this, new AnnotationTappedEventArgs(annotation));
            }

            displayCalloutForAnnotation(annotation);
        }
Пример #12
0
 public AnnotationTappedEventArgs( IMapAnnotation annotation)
 {
     this.Annotation = annotation;
 }
Пример #13
0
 public bool ShowCalloutForAnnotation(IMapAnnotation annotation)
 {
     // Calls back to our own delegate if it exists)
     if (markerSource != null)
         return markerSource.ShowCalloutForAnnotation(annotation);
     else
         return true;
 }