Skip to content

Releases: arnaudleclerc/AzureMapsControl.Components

Create expressions from JSON

05 Mar 10:28
Compare
Choose a tag to compare

Layers

  • The Filter property on the layer's options was missing. It has been added and is of type Expression.

Expressions

Expressions can now be created using their JSON representation. This is especially useful with complex expressions.

The two following examples use the same expression and render the same layer.

var fillColorExpressionJsonString = "[\"step\", [\"get\", \"DENSITY\"], \"#00ff80\", 10, \"#09e076\", 20, \"#0bbf67\", 50, \"#f7e305\", 100, \"#f7c707\", 200, \"#f78205\", 500, \"#f75e05\", 1000, \"#f72505\", 10000, \"#6b0a05\"]";

var layer = new AzureMapsControl.Components.Layers.PolygonExtrusionLayer
{
    Options = new Components.Layers.PolygonExtrusionLayerOptions
    {
        FillColor = new Components.Atlas.ExpressionOrString(System.Text.Json.JsonDocument.Parse(fillColorExpressionJsonString))
    }
};
var layer = new AzureMapsControl.Components.Layers.PolygonExtrusionLayer
        {
            Options = new Components.Layers.PolygonExtrusionLayerOptions
            {
                FillColor = new Components.Atlas.ExpressionOrString(new AzureMapsControl.Components.Atlas.Expression[] {
                    new AzureMapsControl.Components.Atlas.ExpressionOrString("step"),
                    new AzureMapsControl.Components.Atlas.Expression(new AzureMapsControl.Components.Atlas.Expression[]{
                        new AzureMapsControl.Components.Atlas.ExpressionOrString("get"),
                        new AzureMapsControl.Components.Atlas.ExpressionOrString("DENSITY")
                    }),
                    new AzureMapsControl.Components.Atlas.ExpressionOrString("#00ff80"),
                    new AzureMapsControl.Components.Atlas.ExpressionOrNumber(10),
                    new AzureMapsControl.Components.Atlas.ExpressionOrString("#09e076"),
                    new AzureMapsControl.Components.Atlas.ExpressionOrNumber(20),
                    new AzureMapsControl.Components.Atlas.ExpressionOrString("#0bbf67"),
                    new AzureMapsControl.Components.Atlas.ExpressionOrNumber(50),
                    new AzureMapsControl.Components.Atlas.ExpressionOrString("#f7e305"),
                    new AzureMapsControl.Components.Atlas.ExpressionOrNumber(100),
                    new AzureMapsControl.Components.Atlas.ExpressionOrString("#f7c707"),
                    new AzureMapsControl.Components.Atlas.ExpressionOrNumber(200),
                    new AzureMapsControl.Components.Atlas.ExpressionOrString("#f78205"),
                    new AzureMapsControl.Components.Atlas.ExpressionOrNumber(500),
                    new AzureMapsControl.Components.Atlas.ExpressionOrString("#f75e05"),
                    new AzureMapsControl.Components.Atlas.ExpressionOrNumber(1000),
                    new AzureMapsControl.Components.Atlas.ExpressionOrString("#f72505"),
                    new AzureMapsControl.Components.Atlas.ExpressionOrNumber(10000),
                    new AzureMapsControl.Components.Atlas.ExpressionOrString("#6b0a05")
                }),
            }
        };

Update Feature to deserialize ID from either string or number

03 Mar 08:02
d2f9316
Compare
Choose a tag to compare

The Id of a feature now supports int and string deserialization.

Thanks to @miguelhasse for this 👍

Publishing minimized version of azure-maps-control.js

18 Feb 12:16
Compare
Choose a tag to compare

The code of the azure-maps-control.js file has been entirely reworked and converted to typescript. The js files are now generated on the build process. There are now two .js files on the Nuget package : azure-maps-control.js and azure-maps-control.min.js.

If you use the anonymous authentication mode, you will need to update the assignment of your getTokenCallback method, as most of the namespaces of the library have been changed. You can use the following example :

azureMapsControl.Extensions.getTokenCallback = (resolve, reject, map) => {
            const url = "url_of_my_token_endpoint";
            fetch(url).then(function (response) {
                return response.text();
            }).then(function (token) {
                resolve(token);
            });
        };

Adding OverviewMapControl

17 Feb 11:34
Compare
Choose a tag to compare

The OverviewMap control not being part of the atlas library, you need to include the js file of the scalebar into your application and reference it with a script tag on your razor page. It can be found on the GitHub repository of the overviewmap control.

For this control only, there is the possibility to update its options. The OverviewMapControl class exposes an UpdateAsync with which you can update the options of the control. The following example updates the style of the map in the overlay when the style of the map has been changed.

@page "/OverviewMap"

@using AzureMapsControl.Components.Map
<AzureMap Id="map"
          Controls="new Components.Controls.Control[]
          {
              new AzureMapsControl.Components.Controls.OverviewMapControl(new Components.Controls.OverviewMapControlOptions
              {
                  ShowToggle = true,
                  Style = new Components.Atlas.Either<Components.Controls.ControlStyle, string>(AzureMapsControl.Components.Controls.ControlStyle.Auto)
              },
              AzureMapsControl.Components.Controls.ControlPosition.TopLeft),
              new AzureMapsControl.Components.Controls.StyleControl(position: AzureMapsControl.Components.Controls.ControlPosition.TopRight)
          }"
          EventActivationFlags="MapEventActivationFlags.None().Enable(MapEventType.StyleData)"
          OnStyleData="OnStyleData"/>

@code {
    public async void OnStyleData(MapStyleDataEventArgs eventArgs)
    {
        var overviewControl = eventArgs.Map.Controls?.OfType<AzureMapsControl.Components.Controls.OverviewMapControl>()?.FirstOrDefault();
        if(overviewControl is not null)
        {
            await overviewControl.UpdateAsync(options => options.MapStyle = eventArgs.Style);
        }
    }
} 

Adding ScalebarControl

15 Feb 11:33
Compare
Choose a tag to compare

This release brings changes to the controls. The structure of the Controls classes has been changed to support their options and position with more flexibility.

Here is how you can add controls on your map now :

@page "/Controls"

@using AzureMapsControl.Components.Map
<AzureMap Id="map"
          Controls="new Components.Controls.Control[]
          {
                        new Components.Controls.ZoomControl(new Components.Controls.ZoomControlOptions { Style = AzureMapsControl.Components.Controls.ControlStyle.Dark }, AzureMapsControl.Components.Controls.ControlPosition.TopLeft),
            new Components.Controls.PitchControl(new Components.Controls.PitchControlOptions { Style = AzureMapsControl.Components.Controls.ControlStyle.Dark }, AzureMapsControl.Components.Controls.ControlPosition.TopRight),
            new Components.Controls.CompassControl(new Components.Controls.CompassControlOptions { Style = AzureMapsControl.Components.Controls.ControlStyle.Dark }, AzureMapsControl.Components.Controls.ControlPosition.BottomLeft),
            new Components.Controls.StyleControl(new Components.Controls.StyleControlOptions { Style = AzureMapsControl.Components.Controls.ControlStyle.Dark, MapStyles = MapStyle.All() }, AzureMapsControl.Components.Controls.ControlPosition.BottomRight)
          }" />

This release also includes a new ScalebarControl which is not part of the atlas.js library. If you want to use this new control, you will have to include its javascript file directly in your application and reference it via a script tag on your razor pages. The file can be found on the GitHub repository for the scalebar. If you do not use this scalebar, everything should still work fine without including the script.

Change default values of UserInteractionOptions

24 Jan 09:35
9d8e8b8
Compare
Choose a tag to compare
  • UserInteractionOptions should use the default values of the azure-maps-control library. #27

Updating HtmlMarkerOptions when an event as been triggered

03 Jan 11:49
Compare
Choose a tag to compare
  • Fixes #24 by updating the options on the HtmlMarker when an event has been triggered

0.8.0 - Anonymous Authentication

08 Dec 08:37
75e83d4
Compare
Choose a tag to compare
  • Library now supports anonymous authentication

0.7.1 - Adding support of ILogger

25 Nov 15:56
734b784
Compare
Choose a tag to compare
Merge pull request #20 from arnaudleclerc/releases/0.8.0

Releases/0.8.0

0.7.0 - .NET 5

25 Nov 11:17
819e270
Compare
Choose a tag to compare

The library now targets .net5.0