Skip to content

Commit 3b2177b

Browse files
committed
Add properties when creating shapes
1 parent 455093c commit 3b2177b

2 files changed

Lines changed: 20 additions & 29 deletions

File tree

samples/AzureMapsControl.Sample/Pages/Layers/LineLayerOnReady.razor

Lines changed: 18 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,14 @@
4040
new AzureMapsControl.Components.Atlas.Position(11.581155, 48.141852),
4141
new AzureMapsControl.Components.Atlas.Position(11.581990, 48.143534),
4242
new AzureMapsControl.Components.Atlas.Position(11.583355, 48.143896),
43-
new AzureMapsControl.Components.Atlas.Position(11.583662, 48.144258),
43+
new AzureMapsControl.Components.Atlas.Position(11.583662, 48.144258)
44+
}),
45+
new Dictionary<string, object>()
46+
{
47+
{ "Color", "#00FF00" }
48+
}));
49+
await dataSource.AddAsync(new AzureMapsControl.Components.Atlas.Shape<AzureMapsControl.Components.Atlas.LineString>(
50+
new AzureMapsControl.Components.Atlas.LineString(new[] {
4451
new AzureMapsControl.Components.Atlas.Position(11.585458, 48.145596),
4552
new AzureMapsControl.Components.Atlas.Position(11.587910, 48.145779),
4653
new AzureMapsControl.Components.Atlas.Position(11.589632, 48.146608),
@@ -51,40 +58,23 @@
5158
new AzureMapsControl.Components.Atlas.Position(11.593594, 48.151084),
5259
new AzureMapsControl.Components.Atlas.Position(11.594028, 48.151803),
5360
new AzureMapsControl.Components.Atlas.Position(11.592281, 48.152074)
54-
})));
61+
}),
62+
new Dictionary<string, object>()
63+
{
64+
{ "Color", "#FF0000" }
65+
}));
5566

5667
var layer = new AzureMapsControl.Components.Layers.LineLayer
5768
{
58-
Options = new Components.Layers.LineLayerOptions
69+
Options = new AzureMapsControl.Components.Layers.LineLayerOptions
5970
{
6071
Source = dataSourceId,
61-
StrokeWidth = new Components.Atlas.ExpressionOrNumber(6),
62-
StrokeGradient = new Components.Atlas.Expression(
72+
StrokeWidth = new AzureMapsControl.Components.Atlas.ExpressionOrNumber(6),
73+
StrokeColor = new AzureMapsControl.Components.Atlas.ExpressionOrString(
6374
new AzureMapsControl.Components.Atlas.Expression[]
6475
{
65-
new AzureMapsControl.Components.Atlas.ExpressionOrString("interpolate"),
66-
new Components.Atlas.Expression(
67-
new AzureMapsControl.Components.Atlas.Expression[]
68-
{
69-
new AzureMapsControl.Components.Atlas.ExpressionOrString("linear")
70-
}),
71-
new Components.Atlas.Expression(
72-
new AzureMapsControl.Components.Atlas.Expression[]
73-
{
74-
new AzureMapsControl.Components.Atlas.ExpressionOrString("line-progress")
75-
}),
76-
new AzureMapsControl.Components.Atlas.ExpressionOrNumber(0),
77-
new AzureMapsControl.Components.Atlas.ExpressionOrString("blue"),
78-
new AzureMapsControl.Components.Atlas.ExpressionOrNumber(0.1),
79-
new AzureMapsControl.Components.Atlas.ExpressionOrString("royalBlue"),
80-
new AzureMapsControl.Components.Atlas.ExpressionOrNumber(0.3),
81-
new AzureMapsControl.Components.Atlas.ExpressionOrString("cyan"),
82-
new AzureMapsControl.Components.Atlas.ExpressionOrNumber(0.5),
83-
new AzureMapsControl.Components.Atlas.ExpressionOrString("lime"),
84-
new AzureMapsControl.Components.Atlas.ExpressionOrNumber(0.7),
85-
new AzureMapsControl.Components.Atlas.ExpressionOrString("yellow"),
86-
new AzureMapsControl.Components.Atlas.ExpressionOrNumber(1),
87-
new AzureMapsControl.Components.Atlas.ExpressionOrString("red"),
76+
new AzureMapsControl.Components.Atlas.ExpressionOrString("get"),
77+
new AzureMapsControl.Components.Atlas.ExpressionOrString("Color")
8878
})
8979
}
9080
};

src/AzureMapsControl.Components/typescript/geometries/geometry-builder.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ export class GeometryBuilder {
1414
public static buildShape(shape: Shape): azmaps.Shape {
1515
return new azmaps.Shape(
1616
this.buildGeometry(shape.geometry),
17-
shape.id
17+
shape.id,
18+
Core.formatProperties(shape.properties)
1819
);
1920
}
2021

0 commit comments

Comments
 (0)