Hi GS,
Maybe there are some misunderstanding here, In Map Suite, here are the steps what we did in the drawing system:
1. Generate all the features in specified boundingBox for drawing
2. Calculate current zoom level
3. Check all the style applied to the zoom level
4. Loop all the styles on the zoom level to draw the features.
Just as mentioned above, from step #4, the drawing system doesn’t know what the scale or zoom level of the map control or drawing system is. If we would like to create a new custom PointStyle and specify different Icons based on different Zoom level/scale, we need to calculate the scale/zoom level at first and then do the check which icon will be applied rather than always use the same image. After these changes, the code about overwrite “DrawCore” method should be:
protected override void DrawCore(IEnumerable<Feature> features, GeoCanvas canvas, Collection<SimpleCandidate> labelsInThisLayer, Collection<SimpleCandidate> labelsInAllLayers)
{
try
{
// given you didn't customize the zoomLevelSet, please create the zoomLevelSet using code followed
ZoomLevelSet zoomLevelSet = new ZoomLevelSet();
ZoomLevel currentZoomLevel = zoomLevelSet.GetZoomLevelForDrawing(canvas.CurrentWorldExtent, canvas.Width, canvas.MapUnit, canvas.Dpi);
// and then check the 'currentZoomLevel' and apply different icons to different zoom level.
// Todo: after doing this, you don't need to apply different styles for different zoom levels in Page_load
foreach (Feature feature in features)
{
PointShape pointShape = (PointShape)feature.GetShape();
string path = "0";
if (currentZoomLevel.scale > zoomLevelSet.ZoomLevel06.scale)
{
canvas.DrawWorldImageWithoutScaling(_dictImageBigger[path], pointShape.X, pointShape.Y, DrawingLevel.LevelFour, 0, 0, 0);
}
else if (currentZoomLevel.scale < zoomLevelSet.ZoomLevel06.scale)
{
// apply othe images
}
//.............
}
}
catch (Exception ex)
{
return;
}
}
Hope that makes sense. Thanks,
Johnny