There appears to be a bug in polygon shapefile drawing such that the shape fills on the exterior of the polygon.
It is dependent on the zoom level (or more likely the scale), as it only occurs at a high zoom factor.
I have been debugging CShapefileDrawer::AddPolygonToPath assuming the issue was that the polygon was not closed or perhaps something in the Graphics::FillPath API but neither seems to be the case.
I can reproduce in MapWindow5 (5.2.0). I’m using MapWinGIS 5.0.1 built from source on Windows 7.
See attached files. Zoom to [4.135 deg, 9.755 deg]. From zoom 16 to 17 it occurs and remains such for higher zoom levels as well.
It’s definitely a simplified case, being the only layer, and a single (non-multipart) polygon, as compared with the oceans, being a single, huge, many-multi-part polygon.
The projection, as I recall, is one of the NAD-83 Montana State Planes (in feet).
I don’t have the lat/lon at the moment, but I remember that I could reproduce the error in the upper-most, left-most corner, but no in the lower-most, right-most corner.
I can get back to you with a lat/lon in perhaps 3 or 4 hours.
I think I know why this happens. GDI doesn’t like very big point coordinates. When we zoom in MapWinGIS scales the coordinates. As a result, on a big enough zoom level (and more quickly for large paths), the paths are not considered valid by GDI+ and drawing completely stops or for polygons swaps inside with outside.
You can test this like this: make a new in memory shapefile, add a two-point line, zoom in until it dissapears, then draw another line at that zoomlevel: you can again zoom in on this line but it will eventually dissapear as well.
I’ve been thinking about a possible fix, and I could think of two options:
switch to using transformations instead of manually scaling (not nice since we need to scale linewidths etc. as well - lot of work)
break our paths into smaller paths (interpolated between vertices), maybe this way the coordinates of the smaller paths are sufficiently small for GDI to work it out
Hi Mathijs, sorry Ive only just seen your reply.
Is it possible to do a proof of concept regarding your suggestion? Has this been submitted as a bug?
Thx