Open mitikov opened 2 years ago
Oke, I think I got an understanding how expressions are expected to be built:
private readonly Expression isCluster = new(new[] { new ExpressionOrString("has"), new ExpressionOrString("point_count") });
private Expression leafValue(DisplayedMode mode) => new(new[] { new ExpressionOrString("get"), new ExpressionOrString(mode.Name) });
private readonly Expression clusterValue = new(new[] { new ExpressionOrString("get"), new ExpressionOrString("total") });
private Expression ConstuctValueFactory(DisplayedMode mode) => new(new[] { new ExpressionOrString("case"), isCluster, clusterValue, leafValue(mode) });
I might add a few helpers to reduce boilerplate, such as well-known case
statement, or cluster check.
Thanks,
Here is the PR #71 that reduces volume of boilerplate code for consumers.
Thanks.
Thanks for the PR! A new 1.12.0-alpha0019
version has just been published. Would you mind testing this version and telling me if this behaves like you expect it to ?
If so, I will generate a stable version afterwards.
Hey @arnaudleclerc , thanks for approving the PR. The code I'm contributing flows from extension methods I've already used in my project; I'm pretty sure it works.
I'd like to supply a few more PRs, like #72 prior calling it a day. How does that sound?
Regards / Nik
Sounds good, feel free to open the PRs. Thanks for contributing 👍
Is how to create a cluster documented anywhere? This shows how to set it up using JavaScript. But everything I've tried to apply this to the DataSource
and SymbolLayer
doesn't work. It's still just all individual pins (symbols).
thanks - dave
Hey folks, could you please provide an example on how to build complex
AzureMapsControl.Components.Atlas.Expression
during clustering.I'm doing a POC for migrating from pure JS to Blazor, and I've stumbled upon the task of converting datasource expressions.
The things I do in JS:
['case', isCluster, ['get', 'cluster_hits'], ['get', 'hits']];
isCluster = ['has', 'point_count'];
['+', valueGetter]
The JS constructs look quite readable; at the same time I could not build anything close using Blazor wrapper. The docs show straightforward value getter as of now.
Thanks, Nik