Skip to content

Releases: arnaudleclerc/AzureMapsControl.Components

1.5.2

Choose a tag to compare

@arnaudleclerc arnaudleclerc released this 06 May 08:21

Bugfix

  • Fix #42 - Added Road to MapStyle.

1.5.1

Choose a tag to compare

@arnaudleclerc arnaudleclerc released this 30 Apr 13:51

Bugfix

  • ImportDataFromUrlAsync on the DataSource now throws an exception of type Microsoft.JSInterop.JSException if the data could not be imported.

1.5.0

Choose a tag to compare

@arnaudleclerc arnaudleclerc released this 26 Apr 07:06

Adding support of Popup templates (#36)

You can now apply a PopupTemplate to a popup. Please refer to the documentation for more details.

1.4.0

Choose a tag to compare

@arnaudleclerc arnaudleclerc released this 23 Apr 06:27

Features

  • DataSource now supports adding features using a JSON string or a JSONDocument. The expected format is a JSON representation of a FeatureCollection.
  • DataSource can be disposed using DisposeAsync. No operation is possible on the datasource once it has been disposed. Trying to use a disposed datasource will throw a ComponentDisposedException.
  • The current options of the datasource can be retrieved from the azure-maps instance of the datasource using GetOptionsAsync.
  • The shapes of the datasource can be retrieved using GetShapesAsync. This works fine with a small dataset of data but might lead to issues with a larger one.
  • When creating a datasource, you can now pass some EventActivationFlags to react to events on the datasource. Supported events are dataadded, dataremoved, sourceadded, sourceremoved, and datasourceupdated.

1.3.0

Choose a tag to compare

@arnaudleclerc arnaudleclerc released this 19 Apr 06:55

Features

On the Map, 4 new methods allow you to retrieve the current map options : GetCameraOptionsAsync, GetStyleOptionsAsync, GetTrafficOptionsAsync, GetUserInteractionOptionsAsync. This can for example be used to retrieve the current zoom level of the map.

public async Task OnMapClick(MapMouseEventArgs eventArgs)
    {
        var options = await eventArgs.Map.GetCameraOptionsAsync();
        await eventArgs.Map.SetCameraOptionsAsync(cameraOptions => {
            cameraOptions.Type = CameraType.Fly;
            cameraOptions.Duration = 1000;
            cameraOptions.Zoom = options.Zoom + 1;
        });
    }

Bugfix

  • The Zoom property on MoveAlongPathAnimationOptions, RoutePathAnimationOptions, SetCoordinatesAnimationOptions, SnakeLineAnimationOptions, OverviewMapControlOptions, CameraOptions are now of type double? (previously int?). The same applies to ZoomDelta on ZoomControlOptions.

1.2.0

Choose a tag to compare

@arnaudleclerc arnaudleclerc released this 15 Apr 10:42

Features

#37 - Setting properties on the canvas and on the canvas container of the map.

The following methods have been added on the map class :

  • SetCanvasStylePropertyAsync and SetCanvasStylePropertiesAsync to add properties on the canvas of the map.
  • SetCanvasContainerStylePropertyAsync and SetCanvasContainerStylePropertiesAsync to add properties on the container of the canvas of the map.

1.1.0

Choose a tag to compare

@arnaudleclerc arnaudleclerc released this 13 Apr 13:59

Features

  • #39 - Adding a GeolocationControl which allows you to use the current location of the browser on your application. More information on the docs.

Changes

ComponentNotAddedToMapException

Some components need to be added to the map before being able to call their methods. Prior to the 1.1.0, calling the methods of a component interacting with the atlas library before adding it to the map would raise a NullReferenceException. The following methods will now raise a ComponentNotAddedToMapException indicating that the object needs to be added to the map first :

  • GeolocationControl: GetLastKnownPositionAsync, DisposeAsync, SetOptionsAsync.
  • OverviewMapControl: UpdateAsync, SetOptionsAsync.
  • DataSource: AddAsync, RemoveAsync, ImportDataFromUrlAsync, ClearAsync.
  • HtmlMarker: TogglePopupAsync.
  • Popup: OpenAsync, CloseAsync, RemoveAsync, UpdateAsync, SetOptionsAsync.

ValueTask instead of Task

The previously named methods now returns a ValueTask instead of a Task.

API deprecation

The UpdateAsync methods on OverviewMapControl and Popup are deprecated and will be removed in a future major version. They will still be supported on the future v1 versions. On both of those classes, you can use SetOptionsAsync instead.

1.0.0

Choose a tag to compare

@arnaudleclerc arnaudleclerc released this 09 Apr 14:09

This version mostly contains improvements on the organization of the source code and on the workflows to build the library.

A couple of noticeable API changes have been introduced.

API Changes

  • The AddAsync methods on a DataSource now expects an instance of Shape<TGeometry> or Feature<TGeometry> instead of the geometry itself. This was necessary to have a stable codebase and be able to serialize and deserialize shapes and feature more easilly.
  • The events on the map and on the layers now contains the Shapes and the Features attached to the event. Each object also contains its coordinates.

0.17.1

Choose a tag to compare

@arnaudleclerc arnaudleclerc released this 06 Apr 06:42

Bugfixes

Adding Features to datasource

Choose a tag to compare

@arnaudleclerc arnaudleclerc released this 24 Mar 11:19

Two new signatures for the AddAsync method on DataSource:

  • Task AddAsync(IEnumerable<Feature> features)
  • Task AddAsync(params Feature[] features)

The calls to AddAsync now support adding geometries which are wrapped into shapes, but also adding features containing a geometry. The added features are accessible via the Features property of the datasource.

@page "/SymbolLayerWithFeatures"

@using AzureMapsControl.Components.Map
<AzureMap Id="map"
          CameraOptions="new CameraOptions { Zoom = 16, Center = new Components.Atlas.Position(-122.13284, 47.63699) }"
          EventActivationFlags="MapEventActivationFlags
                                .None()
                                .Enable(MapEventType.Ready)"
          OnReady="OnMapReady" />
i
@code  {
    public async Task OnMapReady(MapEventArgs eventArgs)
    {
        var datasourceId = "datasourceId";
        var datasource = new AzureMapsControl.Components.Data.DataSource(datasourceId);
        await eventArgs.Map.AddSourceAsync(datasource);

        var feature = new AzureMapsControl.Components.Atlas.Feature<AzureMapsControl.Components.Atlas.Point>(new AzureMapsControl.Components.Atlas.Point(
                    new AzureMapsControl.Components.Atlas.Position(-122.13284, 47.63699)
                ), new Dictionary<string, object> {
                    { "title", "Cafeteria" },
                    { "subtitle", "Building 40"}
                });

        await datasource.AddAsync(feature);

        var textFieldExpressionJsonString = "[\"format\", [\"get\", \"title\"], {\"text-font\": [\"literal\", [\"StandardFont-Bold\"]], \"font-scale\": 1.25}, \"\\n\", {}, [\"get\", \"subtitle\"], {\"font-scale\": 0.75}]";

        var layer = new AzureMapsControl.Components.Layers.SymbolLayer {
            Options = new Components.Layers.SymbolLayerOptions {
                Source = datasourceId,
                TextOptions = new Components.Layers.TextOptions {
                    TextField = new Components.Atlas.ExpressionOrString(
                        System.Text.Json.JsonDocument.Parse(textFieldExpressionJsonString)
                    )
                }
            }
        };

        await eventArgs.Map.AddLayerAsync(layer);
    }
}

Removing a feature is possible by calling the RemoveAsync method of the datasource, just like for the geometries. Some new API are available to remove only geometries, only features or both of them.