ThinkGeo.com    |     Documentation    |     Premium Support

Print Preview System does not correctly display/hide layers according to assigned Zoom Levels

We use a set of custom Zoom Levels which we assign to FeatureLayers (SqlFeatureLayer and ShapefileFeatureLayer) so that layers can change visibility automatically as they are zoomed in and out. We allow the user of our application to choose what that scale should be. When these layers are displayed in the MapView in a LayerOverlay the layers show and hide exactly when they should. However, when displayed in the MapPrinterLayer they do not change visibility at the correct scale. I can only assume that, internally, ThinkGeo’s calculated scale is coming up with a different value than what I see.

For testing I am using two different methods for visually determining the current scale of the MapPrinterLayer. I am using the ThinkGeo’s ScaleTextPrinterLayer and also my own scale text class called SilvicsScaleTextPrinterLayer. I think the ThinkGeo class is displaying incorrectly. The class I wrote appears to be displaying correctly according to the scale being set when I zoom in or out on the MapPrinterLayer.

I have attached a sample project to demonstrate this issue. In the project, I use a single shapefile and set up its zoom levels so that it should become invisible if the scale is above 1:63360. However, according to my SilvicsScaleTextPrinterLayer, the layer remains visible through scale 1:110880. In the sample project, you can see where the shapefile is initialized and added to the MapPrinterLayer in class frmMain in mLoadShapeFiles. Please note that the text in Black is the ThinkGeo ScaleTextPrinterLayer and the Blue text is my scale text, SilvicsScaleTextPrinterLayer.

I suspect that this has something to do with my monitor, which is a 4k set at 175% magnification, since that was to be the problem with some of the previous issues.

Please have a look and see what you think.

Thanks,

Steve
PageLayoutControl_TG_14.zip (2.0 MB)

Hi Steve,

Thanks for the sample project. You were right about the 175% monitor.

On a high-DPI screen the map frame inside the page layout knew its size in device pixels but was never told the display scale factor, so the layers inside it computed their scale 1.75 times too small. At a true 1:110,880 they believed they were at 1:63,360, which is where your zoom levels stop. Layers in a LayerOverlay were not affected because the MapView already passes the scale factor to them.

This is fixed in 15.0.0-beta166. Layers inside a MapPrinterLayer now show and hide at the same scale as in the MapView, on any monitor. Are you guys still preparing for your release and need to stick with a stable release? In that case we can put it to v14.5.6 by the end of this month. There will not be a v14.5.7 by the way, we are going to have v15 released by late October.

One more thing from your sample: the black ThinkGeo ScaleTextPrinterLayer needs to know the map’s projection to measure ground distance. Set oScaleTextLeyer.Projection = New Projection(EnumCoordSys.NAD83_UTM_zone_16N) and it reads close to your own scale text. It measures real ground distance on a sphere, so it can still differ by a fraction of a percent from the grid-based scale your zoom levels use. For matching your zoom levels, your own SilvicsScaleTextPrinterLayer is the right reference.

Thanks,
Ben

Hi Ben,

Thanks for the quick response. The sample project works fine with 15.0.0-beta 166. Our release is coming very soon so we won’t even upgrade to the 14.5.6 version, we can live with the scale issue for awhile. But many thanks for making it available. Also thanks for the heads up about the ThinkGeo ScaleTextPrinterLayer.

Cheers!

Steve

No problem, Steve, you are always welcome!