I can zoom in as far as I want, and zoom out as far as I want. BUT, if I change the ZoomLevel01 to something like ZoomLevel02, it only shows the layer when completely zoomed out:
Can you check the version of the Desktop Edition you are on and if you are on Winfroms or WPF. The easiest way to check the version is to call the Map.GetVersion, or some method like that.
Can you also give us an idea of the coordinates of your bounding box when you no longer see it etc. It sounds like the scale is not getting calculated correctly for some reason. Do you have anything in the ZoomLevelSet.CustomZoomLevels collection?
I’m using version: ThinkGeo.MapSuite.DesktopEdition.WinformsMap.GetVersion() “MapSuiteCore:3.1.246;DesktopEdition:3.0.426”
I found out the issue, which is a bit odd… This code works: landLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyles.Country1; landLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
This code does not: landLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyles.Country1; landLayer.ZoomLevelSet.ZoomLevel05.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
You must set the DefaultAreaStyle at the same level as the ZoomLevelSet… So the solution is: landLayer.ZoomLevelSet.ZoomLevel05.DefaultAreaStyle = AreaStyles.Country1; landLayer.ZoomLevelSet.ZoomLevel05.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
Does your code work after you try to David’s suggestion?
The zoom levels work the opposite way between 2.0 and 3.0, so what do you mean first zoom level? Is it zoomlevel01 or zoomlevel20, whatever it is, you can set the style for following code: landLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyles.Country1;
landLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; or landLayer.ZoomLevelSet.ZoomLevel20.DefaultAreaStyle = AreaStyles.Country1;
And in your case, you want to use country1 style from zoom level 5 to 20, right? So you code will be: landLayer.ZoomLevelSet.ZoomLevel05.DefaultAreaStyle = AreaStyles.Country1;
Your description is not clear, I don’t know what exactly you want. But I can tell how to use zoomLevelSet, for example, you want set style1 from zoom level x to zoom level y landLayer.ZoomLevelSet.ZoomLevel x.DefaultAreaStyle = style1;
Yes, if I set the layers to go from, say, ZoomLevel05 to ZoomLevel20, it works correctly…
But, say I have a control that shows a bunch of layers, and the user can say: I want to show the streets from ZoomLevel5 to ZoomLevel20.
How do I programatically set up the initial ZoomLevel? I know you can set the ApplyUntilZoomLevel property, but it doesn’t seem that you can set the initial (ZoomLevel05) property…
The way that it is designed now, you can only programmatically set the ApplyUntilZoomLevel, or so it seems.
A work around that I can think is having a big switch statement that sets the initial zoom level accordingly, which isn’t ideal.
I got your mean, your sample code is very helpful to lead me what you want. I just say you are a smart guy, because you want do so amazing things, I think a tricky way to fix your problem.
First, you need to know one thing, ApplyUntilZoomLevel is not a necessary property need set, it’s just a short-path which can make code less, but it’s not flexible like you see. So you can set style for every zoom level instead. Normal code from our HowDoI samples set style from zoomlevel from 05 to 07 is like this: layer.ZoomLevelSet.ZoomLevel05.DefaultAreaStyle = AreaStyles.Country1; layer.ZoomLevelSet.ZoomLevel05.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level07;
You also can use this code as well: layer.ZoomLevelSet.ZoomLevel05.DefaultAreaStyle = AreaStyles.Country1; layer.ZoomLevelSet.ZoomLevel06.DefaultAreaStyle = AreaStyles.Country1; layer.ZoomLevelSet.ZoomLevel07.DefaultAreaStyle = AreaStyles.Country1;
If you know this, you can use customZoomLevels which is a collection, you can pass in the initialZoomLevel and finalZoomLevel set style to corresponding zoomlevels private void SetZoomLevelStyle(FeatureLayer layer, int initialZoomLevel, int finalZoomLevel, Style style) { Collection<ZoomLevel> zoomLevels = layer.ZoomLevelSet.GetZoomLevels(); layer.ZoomLevelSet.CustomZoomLevels.Clear(); foreach (ZoomLevel item in zoomLevels) { layer.ZoomLevelSet.CustomZoomLevels.Add(item); }
for (int i = initialZoomLevel; i <= finalZoomLevel; i++) { layer.ZoomLevelSet.CustomZoomLevels<i>.CustomStyles.Add(style); } }