Skip to content

Commit

Permalink
Fix null annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
Morten Nielsen committed Nov 7, 2023
1 parent 9143693 commit d303e23
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public class GeoViewControllerSampleVM

public void OnGeoViewTapped(object sender, GeoViewInputEventArgs eventArgs) => Identify(eventArgs.Position, eventArgs.Location);

public async void Identify(Point location, MapPoint? mapLocation)
public async void Identify(Point location, MapPoint mapLocation)
{
Controller.DismissCallout();
var result = await Controller.IdentifyLayersAsync(location, 10);
Expand Down
21 changes: 13 additions & 8 deletions src/Toolkit/Toolkit/GeoViewController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -168,21 +168,26 @@ private void GeoView_Unloaded(GeoView sender)
public virtual Task<IReadOnlyList<IdentifyLayerResult>> IdentifyLayersAsync(Point screenPoint, double tolerance, bool returnPopupsOnly = false, CancellationToken cancellationToken = default) =>
ConnectedView?.IdentifyLayersAsync(screenPoint, tolerance, returnPopupsOnly, cancellationToken) ??
Task.FromResult<IReadOnlyList<IdentifyLayerResult>>(Array.Empty<IdentifyLayerResult>());

/// <inheritdoc cref="GeoView.IdentifyLayerAsync(Layer, Point, double, bool, CancellationToken)"/>
public virtual Task<IdentifyLayerResult> IdentifyLayerAsync(Layer layer, Point screenPoint, double tolerance, bool returnPopupsOnly = false, CancellationToken cancellationToken = default) =>
ConnectedView?.IdentifyLayerAsync(layer, screenPoint, tolerance, returnPopupsOnly, cancellationToken) ??
Task.FromResult<IdentifyLayerResult>(null!);
public virtual async Task<IdentifyLayerResult?> IdentifyLayerAsync(Layer layer, Point screenPoint, double tolerance, bool returnPopupsOnly = false, CancellationToken cancellationToken = default)
{
if (ConnectedView is null) return null;
return await ConnectedView.IdentifyLayerAsync(layer, screenPoint, tolerance, returnPopupsOnly, cancellationToken).ConfigureAwait(false);
}

/// <inheritdoc cref="GeoView.IdentifyGraphicsOverlaysAsync(Point, double, bool, long)" />
public virtual Task<IReadOnlyList<IdentifyGraphicsOverlayResult>> IdentifyGraphicsOverlaysAsync(Point screenPoint, double tolerance, bool returnPopupsOnly = false, long maximumResultsPerOverlay = 1) =>
ConnectedView?.IdentifyGraphicsOverlaysAsync(screenPoint, tolerance, returnPopupsOnly, maximumResultsPerOverlay) ??
Task.FromResult<IReadOnlyList<IdentifyGraphicsOverlayResult>>(Array.Empty<IdentifyGraphicsOverlayResult>());

/// <inheritdoc cref="GeoView.IdentifyGraphicsOverlaysAsync(Point, double, bool, long)" />
public virtual Task<IdentifyGraphicsOverlayResult> IdentifyGraphicsOverlayAsync(GraphicsOverlay overlay, Point screenPoint, double tolerance, bool returnPopupsOnly = false, long maximumResults = 1) =>
ConnectedView?.IdentifyGraphicsOverlayAsync(overlay, screenPoint, tolerance, returnPopupsOnly, maximumResults) ??
Task.FromResult<IdentifyGraphicsOverlayResult>(null!);
public virtual async Task<IdentifyGraphicsOverlayResult?> IdentifyGraphicsOverlayAsync(GraphicsOverlay overlay, Point screenPoint, double tolerance, bool returnPopupsOnly = false, long maximumResults = 1)
{
if (ConnectedView is null) return null;
return await ConnectedView.IdentifyGraphicsOverlayAsync(overlay, screenPoint, tolerance, returnPopupsOnly, maximumResults).ConfigureAwait(false);
}

#endregion Identify

#region Callouts
Expand Down Expand Up @@ -253,7 +258,7 @@ private static void OnGeoViewControllerChanged(BindableObject bindable, object o
/// </summary>
/// <param name="geoView">The target <see cref="GeoView"/> on which to set the <see cref="GeoViewController.GeoViewController"/> XAML attached property.</param>
/// <param name="value">The property value to set.</param>
public static void SetGeoViewController(GeoViewDPType geoView, GeoViewController? value) => geoView?.SetValue(GeoViewControllerProperty, value) ?? throw new System.ArgumentNullException(nameof(geoView));
public static void SetGeoViewController(GeoViewDPType geoView, GeoViewController? value) => geoView?.SetValue(GeoViewControllerProperty, value);

private static void OnGeoViewControllerChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
Expand Down

0 comments on commit d303e23

Please sign in to comment.