Implement Get Cluster Leaves
saadsaifse opened this issue · 0 comments
There is existent method on each native map to get the leave nodes of the cluster. On iOS it looks like this public virtual IMGLFeature[] LeavesOfCluster(MGLPointFeatureCluster cluster, nuint offset, nuint limit)
. When called it requires a parameter of type MGLPointFeatureCluster
which is not available to us. Since the function to get the visible map features is only returning an interface that was created by the binding project public virtual IMGLFeature[] VisibleFeaturesAtPoint(CGPoint point)
.
The problem is that this interface does not cast back to the concrete type giving us no concrete type of MGLPointFeatureCluster
. E.g., the folliowing does not work
var features = map.VisibleFeaturesAtPoint(point.ToPoint(), layerIds);
if (features.Length > 0)
{
var feature = features.First();
if (feature as MGLPointFeatureCluster != null)
{
var leaves = source.LeavesOfCluster(feature as MGLPointFeatureCluster, 800, 0);
}
}
How can we solve this problem? I tried creating a new instance of MGLPointFeatureCluster
but it does not allow to set the coordinates and some other properties that leads to empty returned leaves. I think here we need a way to properly create the MGLPointFeatureCluster
object somehow that is equatable to the one internally inside the cluster. Or to cast to concrete type properly. Not sure if that is even possible using the binding projects.
Get cluster leaves method easily worked for Android though.
Any ideas for the iOS part?