Hello ThinkGeo,
I want to create my own ClusterMarkerStyle because I would like to give a cluster further information.
I have to use the InMemoryMarkerOverlay therefore it's not possible for me to use the ClusterPointerStyle.
Is it possible to obtain the algorithm of the clustering of markers (C#)?
Thank you for your help.
Regards,
Marcus
Algorithm of GetMarkers (ClusterMarkerStyle)
Marcus,
I have provided the source code for ClusterMarkerStyle that could help you create your own ClusterMarkerStyle, any problem when you creating pleae let me know? I think it obviously show the algorithm of get markers in the code.
Thanks,
James
Marcus,
I have provided the source code for ClusterMarkerStyle that could help you create your own ClusterMarkerStyle, any problem when you creating pleae let me know? I think it obviously show the algorithm of get markers in the code.
Thanks,
James
Hello James,
my problem is that I want to display different icons within a style of a overlay.
Normal markers will get one of three different icons.
Is a marker a cluster, the cluster will get a different icon too.
I am not possible to disinguish between clusters and markers with the source code of the ClusterMarkerStyle within the GetMarkers function.
Thanks,
Marcus
Marcus,
It depends on which MarkerStyle you set it to the property, I give an example that you set a PointMarkerStyle, below is the code for PointMakerStyle.GetMarkers
public override Collection<Marker> GetMarkers(IEnumerable<Feature> features)
{
Collection<Marker> returnMarkers = new Collection<Marker>();
foreach (Feature feature in features)
{
if (feature.GetWellKnownType() == WellKnownType.Point)
{
PointShape point = (PointShape)feature.GetShape();
Marker marker = CreateMarkerByPoint(point, feature.Id, feature.ColumnValues);
returnMarkers.Add(marker);
}
else if (feature.GetWellKnownType() == WellKnownType.Multipoint)
{
MultipointShape multiPoint = (MultipointShape)feature.GetShape();
for (int i = 0; i < multiPoint.Points.Count; i++)
{
string markerId = feature.Id + "_" + (i + 1).ToString(CultureInfo.InvariantCulture);
Marker marker = CreateMarkerByPoint(multiPoint.Points, markerId, feature.ColumnValues);
returnMarkers.Add(marker);
}
}
}
return returnMarkers;
}
Thanks,
James