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; }
// 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; }
/// <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; }
/// <summary> /// Send the pin clicked event. /// </summary> internal void SendPinClicked(IMapAnnotation pin) { PinClicked?.Invoke(this, new MapEventArgs <IMapAnnotation>(pin)); }
public void MapAnnotationClicked(IMapAnnotation annotation) { displayCalloutForAnnotation(annotation); }
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(); }
void displayCalloutForAnnotation(IMapAnnotation annotation) { IAnnotationMarker annotationElement = (IAnnotationMarker)annotationManager.UIElementForAnnotation(annotation); calloutManager.displayCallout(annotation, annotationElement); }
/// <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]; }
public void MapAnnotationClicked(IMapAnnotation annotation) { if (this.Annotation_Tapped != null) { this.Annotation_Tapped(this, new AnnotationTappedEventArgs(annotation)); } displayCalloutForAnnotation(annotation); }
public AnnotationTappedEventArgs( IMapAnnotation annotation) { this.Annotation = annotation; }
public bool ShowCalloutForAnnotation(IMapAnnotation annotation) { // Calls back to our own delegate if it exists) if (markerSource != null) return markerSource.ShowCalloutForAnnotation(annotation); else return true; }