Okay, tested this further.
Looks like the map zooms to any scale, but still seems to Snap to the zoom levels of the map prior to determining which style is applied to that layer.
In a test we do the following:
We make our own set of Map zoom levels (although this still does funny things with the default)
mapView.ZoomScales = new Collection<double>
// These are the zoom levels we use in the dropdown, they are not all used in the map
// but we want to show them all so users can select them.
// Note: These are in reverse order of how they appear in the dropdown.
// The first one is the highest zoom level, and the last one is the lowest zoom level.
{
100000000,50000000,20000000,10000000,5000000,2000000,1000000,500000,200000,100000,50000,
25000,10000,5000,2000,1000,500,200,100
};
We add the base map and a source file (just some areas from your how do I samples)
var baseOverlay = new ThinkGeoCloudVectorMapsOverlay("USlbIyO5uIMja2y0qoM21RRM6NBXUad4hjK3NBD6pD0~",
"f6OJsvCDDzmccnevX55nL7nXpPDXXKANe5cN6czVjCH0s8jhpCH-2A~~", ThinkGeoCloudVectorMapsMapType.Light);
// Set up the tile cache for the base overlay, passing in the location and an ID to distinguish the cache.
baseOverlay.TileCache = new FileRasterTileCache(@".\cache", "basemap");
mapView.Overlays.Add(baseOverlay);
// Create a new overlay that will hold our new layer and add it to the map.
var fileGeoDatabaseOverlay = new LayerOverlay();
mapView.Overlays.Add("overlay", fileGeoDatabaseOverlay);
// Create the new layer and set the projection as the data is in srid 2276 and our background is srid 3857 (spherical mercator).
var fileGeoDatabaseFeatureLayer = new FileGeoDatabaseFeatureLayer(@"C:\ProgramData\GeoCarta\UserMap\zoning.gdb")
{
FeatureSource =
{
ProjectionConverter = new ProjectionConverter(2276, 3857)
},
ActiveLayer = "zoning"
};
// Add the layer to the overlay we created earlier.
fileGeoDatabaseOverlay.Layers.Add("Zoning", fileGeoDatabaseFeatureLayer);
We then set that layer to have styles only for a range of values:
SetLayerStyles(fileGeoDatabaseFeatureLayer, _minimumZoomLevel, _maximumZoomLevel);
Here is that function:
private static void SetLayerStyles(FeatureLayer layer, double minimum, double maximum)
{
// Create the Custom Zoom Level Set
layer.ZoomLevelSet.CustomZoomLevels.Clear();
ZoomLevel defaultZoomLevel = layer.ZoomLevelSet.ZoomLevel01;
defaultZoomLevel.DefaultAreaStyle = null;
defaultZoomLevel.DefaultLineStyle = null;
defaultZoomLevel.DefaultPointStyle = null;
defaultZoomLevel.DefaultTextStyle = null;
ZoomLevelSet zoomLevels = new ZoomLevelSet();
zoomLevels.CustomZoomLevels.Add(new ZoomLevel(100000000.0)); // All the way zoomed out (off)
zoomLevels.CustomZoomLevels.Add(new ZoomLevel(maximum + 0.1)); // Turn layer off (maybe all the way out), no styles
zoomLevels.CustomZoomLevels.Add(new ZoomLevel(maximum)); // Display the layer using these styles
zoomLevels.CustomZoomLevels.Add(new ZoomLevel(minimum)); // Again, same style as above
zoomLevels.CustomZoomLevels.Add(new ZoomLevel(minimum - 0.1)); // And nothing
zoomLevels.CustomZoomLevels.Add(new ZoomLevel(0.0)); // And nothing
// Initialize the levels
foreach (ZoomLevel level in zoomLevels.CustomZoomLevels)
{
level.DefaultAreaStyle = null;
level.DefaultLineStyle = null;
level.DefaultPointStyle = null;
level.DefaultTextStyle = null;
}
// Grab the 2 levels (the range) so I can set them
layer.ZoomLevelSet = zoomLevels;
ZoomLevel maximumLevel = layer.ZoomLevelSet.CustomZoomLevels[2];
ZoomLevel minimumLevel = layer.ZoomLevelSet.CustomZoomLevels[3];
// Create an Area style on zoom level 1 and then apply it to all zoom levels up to 20.
AreaStyle style = new AreaStyle(GeoPens.Black, new GeoSolidBrush(new GeoColor(50, GeoColors.Blue)));
minimumLevel.DefaultAreaStyle = style;
maximumLevel.DefaultAreaStyle = style;
}
We set the minimum to 1.0 and maximum to 1,000,000
If we zoom to 1,000,000 the layer shows on the map, zoom to 2,000,000 it does not show. But when we set the scale to say 1,000,100 one would expect the layer not to show, but it does, and it does all the way up to in the 1,450,000 range. We need the layer to show at and above the minimum and below or at the maximum, this is not the case.
Any pearls of wisdom you can share would help, or is there more I need to do.