Skip to content

Commit

Permalink
Add properties when creating shapes
Browse files Browse the repository at this point in the history
  • Loading branch information
arnaudleclerc committed Jun 25, 2021
1 parent 455093c commit 3b2177b
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 29 deletions.
46 changes: 18 additions & 28 deletions samples/AzureMapsControl.Sample/Pages/Layers/LineLayerOnReady.razor
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,14 @@
new AzureMapsControl.Components.Atlas.Position(11.581155, 48.141852),
new AzureMapsControl.Components.Atlas.Position(11.581990, 48.143534),
new AzureMapsControl.Components.Atlas.Position(11.583355, 48.143896),
new AzureMapsControl.Components.Atlas.Position(11.583662, 48.144258),
new AzureMapsControl.Components.Atlas.Position(11.583662, 48.144258)
}),
new Dictionary<string, object>()
{
{ "Color", "#00FF00" }
}));
await dataSource.AddAsync(new AzureMapsControl.Components.Atlas.Shape<AzureMapsControl.Components.Atlas.LineString>(
new AzureMapsControl.Components.Atlas.LineString(new[] {
new AzureMapsControl.Components.Atlas.Position(11.585458, 48.145596),
new AzureMapsControl.Components.Atlas.Position(11.587910, 48.145779),
new AzureMapsControl.Components.Atlas.Position(11.589632, 48.146608),
Expand All @@ -51,40 +58,23 @@
new AzureMapsControl.Components.Atlas.Position(11.593594, 48.151084),
new AzureMapsControl.Components.Atlas.Position(11.594028, 48.151803),
new AzureMapsControl.Components.Atlas.Position(11.592281, 48.152074)
})));
}),
new Dictionary<string, object>()
{
{ "Color", "#FF0000" }
}));

var layer = new AzureMapsControl.Components.Layers.LineLayer
{
Options = new Components.Layers.LineLayerOptions
Options = new AzureMapsControl.Components.Layers.LineLayerOptions
{
Source = dataSourceId,
StrokeWidth = new Components.Atlas.ExpressionOrNumber(6),
StrokeGradient = new Components.Atlas.Expression(
StrokeWidth = new AzureMapsControl.Components.Atlas.ExpressionOrNumber(6),
StrokeColor = new AzureMapsControl.Components.Atlas.ExpressionOrString(
new AzureMapsControl.Components.Atlas.Expression[]
{
new AzureMapsControl.Components.Atlas.ExpressionOrString("interpolate"),
new Components.Atlas.Expression(
new AzureMapsControl.Components.Atlas.Expression[]
{
new AzureMapsControl.Components.Atlas.ExpressionOrString("linear")
}),
new Components.Atlas.Expression(
new AzureMapsControl.Components.Atlas.Expression[]
{
new AzureMapsControl.Components.Atlas.ExpressionOrString("line-progress")
}),
new AzureMapsControl.Components.Atlas.ExpressionOrNumber(0),
new AzureMapsControl.Components.Atlas.ExpressionOrString("blue"),
new AzureMapsControl.Components.Atlas.ExpressionOrNumber(0.1),
new AzureMapsControl.Components.Atlas.ExpressionOrString("royalBlue"),
new AzureMapsControl.Components.Atlas.ExpressionOrNumber(0.3),
new AzureMapsControl.Components.Atlas.ExpressionOrString("cyan"),
new AzureMapsControl.Components.Atlas.ExpressionOrNumber(0.5),
new AzureMapsControl.Components.Atlas.ExpressionOrString("lime"),
new AzureMapsControl.Components.Atlas.ExpressionOrNumber(0.7),
new AzureMapsControl.Components.Atlas.ExpressionOrString("yellow"),
new AzureMapsControl.Components.Atlas.ExpressionOrNumber(1),
new AzureMapsControl.Components.Atlas.ExpressionOrString("red"),
new AzureMapsControl.Components.Atlas.ExpressionOrString("get"),
new AzureMapsControl.Components.Atlas.ExpressionOrString("Color")
})
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ export class GeometryBuilder {
public static buildShape(shape: Shape): azmaps.Shape {
return new azmaps.Shape(
this.buildGeometry(shape.geometry),
shape.id
shape.id,
Core.formatProperties(shape.properties)
);
}

Expand Down

0 comments on commit 3b2177b

Please sign in to comment.