Hi Bob,
The ClusterPointStyle have been in the Desktop edition and here are some codes which might fit your requirements.
int clusterCellsize = 50;
private void Form_Load(object sender, EventArgs e)
{
winformsMap1.MapUnit = GeographyUnit.DecimalDegree;
winformsMap1.CurrentExtent = new RectangleShape(-131.22, 55.05, -54.03, 16.91);
WorldMapKitWmsDesktopOverlay worldMapKitOverlay = new WorldMapKitWmsDesktopOverlay();
winformsMap1.Overlays.Add(worldMapKitOverlay);
ClusterPointStyle clusterPointStyle = new ClusterPointStyle(PointSymbolType.Triangle,
new GeoSolidBrush(GeoColor.FromArgb(150, GeoColor.StandardColors.Orange)),
new GeoPen(GeoColor.StandardColors.Red, 2), 27);
clusterPointStyle.CellSize = clusterCellsize;
clusterPointStyle.TextStyle = new TextStyle("FeatureCount", new GeoFont("Arial", 8), new GeoSolidBrush(GeoColor.StandardColors.Black));
clusterPointStyle.TextStyle.DuplicateRule = LabelDuplicateRule.UnlimitedDuplicateLabels;
clusterPointStyle.TextStyle.PointPlacement = PointPlacement.Center;
ShapeFileFeatureLayer clusterMajorCitiesLayer = new ShapeFileFeatureLayer(@"..\..\SampleData\Data\MajorCities.shp", ShapeFileReadWriteMode.ReadOnly);
clusterMajorCitiesLayer.ZoomLevelSet.ZoomLevel01.CustomStyles.Clear();
clusterMajorCitiesLayer.ZoomLevelSet.ZoomLevel01.CustomStyles.Add(clusterPointStyle);
clusterMajorCitiesLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
LayerOverlay overlay = new LayerOverlay();
overlay.Layers.Add(clusterMajorCitiesLayer);
winformsMap1.Overlays.Add(overlay);
winformsMap1.Refresh();
}
private void winformsMap1_MapClick(object sender, MapClickWinformsMapEventArgs e)
{
// We get the scale to determine the grid. This scale property should really be on the Canvas!
double scale = ExtentHelper.GetScale(winformsMap1.CurrentExtent, winformsMap1.Width, winformsMap1.MapUnit);
// Setup our grid for clustering the points. This is where we specify our cell size in pixels
MapSuiteTileMatrix mapSuiteTileMatrix = new MapSuiteTileMatrix(scale, clusterCellsize, clusterCellsize, winformsMap1.MapUnit);
// Pass in the current extent to get our grid cells. All points in these cells will be consolidated
IEnumerable<TileMatrixCell> tileMatricCells = mapSuiteTileMatrix.GetContainedCells(winformsMap1.CurrentExtent);
foreach (var cell in tileMatricCells)
{
if (cell.BoundingBox.Contains(e.WorldLocation))
{
ShapeFileFeatureSource clusterMajorCitiesLayer = new ShapeFileFeatureSource(@"..\..\SampleData\Data\MajorCities.shp", ShapeFileReadWriteMode.ReadOnly);
clusterMajorCitiesLayer.Open();
Collection<Feature> clusterCells = clusterMajorCitiesLayer.GetFeaturesInsideBoundingBox(cell.BoundingBox, ReturningColumnsType.AllColumns);
// you can show those features information according to your need.
MessageBox.Show(clusterCells.Count + "");
}
}
}
In the code above, the tileMatricCells means the current map had been splited into many cells and one cluster marker represents one cell. In this way, we can use “cell.BoundingBox.Contains(e.WorldLocation)” to get the current cluster marker’s features.
Besides, you may need to do more work to filter the places where the user clicked on the map.
Hope those codes would help for you.
Regards,
Johnny