Bug report #83
Strange polygon fill rendering
|Assignee:||Gavin Macaulay -|
|Affected QGIS version:||Regression?:||No|
|Operating System:||Windows||Easy fix?:||No|
|Pull Request or Patch supplied:||Resolution:||fixed|
|Crashes QGIS or corrupts data:||Copied to github as #:||10142|
See attached screenshot (
strange_vectors1.png) - one polygon is not fulfilled with light green. This issue do not appear in Map Composer (see
strange_vectors2.png) only in map canvas.
#1 Updated by Redmine Admin over 15 years ago
Dataset available at:
#2 Updated by Gavin Macaulay - over 15 years ago
I note that the polygon in question appears to cross the +/-180 degree line or perhaps is discontinuous in some way. This is clearly seen by doing the following:
- load the oceansea_af.shp file
- zoom out slightly
- use the Select Features tool to select the rightmost region
- note how the leftmost region with the missing shading is highlighted too, indicating they are the same feature
#4 Updated by neteler-itc-it - over 15 years ago
I have the same problem (or a similar one), see
attached screenshot. This shows a SHAPE file
with white spreckle. The same happens on
another installation of a person I know (different
Linux version). I am using
qtcore-4.1.0-2 on Redhat Enterprise 4.
#5 Updated by neteler-itc-it - over 15 years ago
I darkly remember to have seen these problems in
a very early version of QGIS (0.5 or earlier) and
I think that I had submitted a bug report into
the sourceforge bugtracker in those days.
Is it possible that islands are causing the problem?
#6 Updated by Gavin Macaulay - over 15 years ago
The white speckle is caused by holes (or islands - depends on yor point of view) in polygons in combination with the way that qgis draws such holes. This seems to have become worse in Qt4 over Qt3. IF anti-aliasing is turned on, polygons render correctly.
The problem with qgis not filling some polygons correctly happens even on polygons without holes in them.
#9 Updated by Gavin Macaulay - over 15 years ago
- Status changed from Open to In Progress
After writing some code to load and display the polygons in question, the problem appears to be in QImage:
Qgis draws to a QImage using a QPainter, and then converts that to a QPixmap for display on screen (I think it does this because anti-aliasing is only available with QImage and maybe also transparency). If the drawing of the polygon is done directly to a QPixmap, the fill is correct. The image resulting from a QImage.save() is filled incorrectly, so that suggests that QImage is the problem, not the conversion from QImage to QPixmap.
I tried various configuration changes to the QImage, but nothing that I've tried to date has resolved the problem.
I've submitted this as a bug to Trolltech.
#10 Updated by Gavin Macaulay - over 15 years ago
The comments about white speckle in polygons may be caused by this Qt bug (http://www.trolltech.com/developer/task-tracker/index_html?method=entry&id=107816), which is scheduled to be fixed in Qt 4.2.0.
#11 Updated by Gavin Macaulay - over 15 years ago
This is a bug in Qt, the status of which can be followed at http://www.trolltech.com/developer/task-tracker/index_html?method=entry&id=118762
No info yet on when this will be fixed, but since it's out of our control, I've removed the 0.8 milestone from this ticket.
#14 Updated by Gavin Macaulay - about 15 years ago
My, it's even worse with anti-aliasing on:)
As far as I could tell, the only solution while Qt still has the bug is to move qgis back to drawing to a QPixmap - which will prevent anti-aliasing and transparency. It may well be a serious enough problem to do that, I think, especially when there isn't a user accessible workaround for all cases where it occurs.
#15 Updated by Gavin Macaulay - about 15 years ago
SVN 6abc64b5 (SVN r5568) has a possible work-around to the problem. There is now a toggle in the options dialog box that lets the user swap between using a QImage or a QPixmap for rendering the map. QImage is the default one, and was the only option before this commit.
Note that using QPixmap disables the anti-aliasing because a QPixmap renderer doesn't support anti-aliasing.
On my system this fixes the problem with drawing the shapefiles at http://kosatka.fns.uniba.sk/~1balazovic/qgis/oceansea.tar.gz, and also removes the white speckle discussed above. Others have reported that it crashes their X server...
#19 Updated by hamish_nospam-yahoo-com - almost 15 years ago
Hi, I am getting the bug same here, but only on Windows.
(0.8 works on the Mac, 0.8 untested on Linux)
MacOSX + 0.7.4 had a similar problem (mentioned in the OSX release notes) for polygons with more than 10,000 verticies.
MacOSX + 0.8pre2 -- it works. (!)
Debian/Sarge + 0.7.4 - it works.
Windows + 0.7.4 -- it works.
Windows + 0.8pre2, 0.8pre3_Tim_10Dec2006 -- I see the bug.
(I'll try to attach a screenshot, very close to Alaska img)
I will explore anti-aliasing and Qoptions and get back to you.
Vector file is the new zealand coastline, saved as a number of clean ed polygons (no islands), saved as a shapefile (exported from GRASS).
#20 Updated by hamish_nospam-yahoo-com - almost 15 years ago
Hi, tested Anti-aliasing and "Fix incorrectly filled polygon" options on Windows (0.8p3_Tim_10Dec2006 build)
Zooming way in fixed it
Turning on Anti-aliasing fixed it
Turning on "Fix incorrectly filled polygon" in options/rendering menu did not fix it (!!!)
I can make the shapefile available to individual devels for testing purposes, but not public. Email me if you want it (leave in the "_nospam").
This bug is important for us: I will not be able to deploy 0.8 on our PCs with this bug, I will have to keep them at 0.7.4. That's ok, as I'd rather the students use the Macs anyway ;)
ps- user friendly but vague option descriptions are a total pain. Can the "technical version" of the option description appear in the tool tip? [anti-alias, Qpixmap|Qimage]
#21 Updated by hamish_nospam-yahoo-com - over 14 years ago
Still happens with the 0.8.0 release (binary from qgis.org).
I find if I use a lower resolution vector polygon (NOAA GSHHS coastline land shapefile) the filling works ok (turn of border) but the border doesn't. Using a higher resolution coastline both border and filling (turn border pattern to none) show the bug.
Playing with rendering options in the setup menu had no effect.
#24 Updated by hamish - over 13 years ago
I have just installed qgis_setup0.9.1.18_12_2007.exe on a Windows XP machine and it is still broken WRT filling polygons with many thousands of vertices.
(same as last year's qgis-pre3cvs10dec2006_huge_polygon_err.png attached to this report)
The same shapefile + QGIS 0.7.4 on the same machine renders correctly. (but I blew that installation away to install 0.9.1)
#25 Updated by hamish - over 13 years ago
I have just installed the new 0.10.0 for WinXP and it renders well!
i.e. the problem seen in the attached screenshot qgis-pre3cvs10dec2006_huge_polygon_err.png is gone.
Before closing the report it might be nice to have someone test with the alaska and world shapefile datasets, and take a stab at documenting what changed to fix this.
#26 Updated by Maciej Sieczka - about 13 years ago
Under WINE 1.0.0 configured to emulate Win XP, on amd64 Debian testing, I can't reproduce this error with Shapefile data using Marco's "QGIS 0.11.0 for Windows pre-release testing installer" and the QGIS Alaska sample dataset, in either QGIS renderinf mode.
#27 Updated by gjm - about 13 years ago
- Resolution set to fixed
- Status changed from In Progress to Closed
This problem appears to be fixed in all of it's various guises. It has always been a problem with how Qt renders polygons, particularly with the way that Qgis displays holes in polygons. I can only assume that the more recent versions of Qt have finally fixed the problem.