Hi,
I’m trying to improve zooming experience, especially with touch screen and pinch zooming. The default 20 zoom levels are very coarse and after pinch zooming the map snaps to the closest predefined zoom level. I’ve tried to overcome this by partitioning the zoom levels further as in the example at https://wiki.thinkgeo.com/wiki/source_code_desktopeditionsample_zoomlevelpartitioning_cs_091023.zip
This is the code that I changed in the tutorial:
private void mapView_Loaded(object sender, RoutedEventArgs e)
{
// Set the Map Unit.
mapView.MapUnit = GeographyUnit.Meter;
// Add a base map overlay.
var cloudVectorBaseMapOverlay = new ThinkGeoCloudRasterMapsOverlay("USlbIyO5uIMja2y0qoM21RRM6NBXUad4hjK3NBD6pD0~", "f6OJsvCDDzmccnevX55nL7nXpPDXXKANe5cN6czVjCH0s8jhpCH-2A~~", ThinkGeoCloudRasterMapsMapType.Light);
mapView.Overlays.Add(cloudVectorBaseMapOverlay);
mapView.ZoomLevelSet = PartitionZoomLevelSet(10, new ZoomLevelSet());
mapView.Refresh();
}
// https://wiki.thinkgeo.com/wiki/source_code_desktopeditionsample_zoomlevelpartitioning_cs_091023.zip
// This code will take the zoom level set you pass in and add
// the number of intermediate levels you specify.
public ZoomLevelSet PartitionZoomLevelSet(int stepsBetweenZoomLevels, ZoomLevelSet referenceZoomLevelSet)
{
ZoomLevelSet partitionedZoomLevelSet = new ZoomLevelSet();
Collection<ZoomLevel> zoomLevels = referenceZoomLevelSet.GetZoomLevels();
partitionedZoomLevelSet.CustomZoomLevels.Add(new ZoomLevel(zoomLevels[0].Scale));
foreach (ZoomLevel zoomLevel in zoomLevels)
{
double lowerScale = ZoomLevelSet.GetLowerZoomLevelScale(zoomLevel.Scale, referenceZoomLevelSet);
if (lowerScale != zoomLevel.Scale)
{
for (int x = 1; x < stepsBetweenZoomLevels + 2; x++)
{
double steppedScale = zoomLevel.Scale - (((zoomLevel.Scale - lowerScale) / (stepsBetweenZoomLevels + 1)) * x);
partitionedZoomLevelSet.CustomZoomLevels.Add(new ZoomLevel(steppedScale));
}
}
}
return partitionedZoomLevelSet;
}
The result is quite ok, but I noticed quite a lot of flickering, when e.g. zooming fast in and out with mouse wheel. Sometimes when you zoom only a little, you don’t see that flickering. But when you zoom quicker, then you start seeing white tiles being drawn before the actual map data gets drawn instead.
Is there some “double buffering” feature or similar that could be enabled to reduce the flickering?
Thanks,
Rasmus