Bug report #83

Strange polygon fill rendering

Added by Redmine Admin over 18 years ago. Updated about 15 years ago.

Status:Closed
Priority:Low
Assignee:Gavin Macaulay -
Category:Vectors
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

Description

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.

strange_vectors.png (60.5 KB) Redmine Admin, 2006-04-16 01:59 PM

strange_vectors2.png (37.8 KB) Redmine Admin, 2006-04-16 02:09 PM

qgis_08_svn_render_bug.png - QGIS 08 SVN polygon render bug (white pixels spreaded around) (103 KB) neteler-itc-it -, 2006-05-23 01:14 AM

badpolys_aa.gif - Polygon clipping/fill problems with antialias on (30.3 KB) Gary Sherman, 2006-07-06 08:23 PM

qgis-pre3cvs10dec2006_huge_polygon_err.png - screenshot of NZ coastline showing the filling error (53.4 KB) hamish_nospam-yahoo-com -, 2006-12-10 11:58 PM

History

#2 Updated by Gavin Macaulay - over 18 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

#3 Updated by anonymous - over 18 years ago

Note: the problem goes away if one zooms in enough or turns on anti-aliasing (Settings:Options:Rendering).

#4 Updated by neteler-itc-it - over 18 years ago

Hi,

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.

Markus

#5 Updated by neteler-itc-it - over 18 years ago

Hi again,

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?

Markus

#6 Updated by Gavin Macaulay - over 18 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.

#7 Updated by anonymous - over 18 years ago

"IF anti-aliasing is turned on, polygons render correctly." - how to do that? For example in KDE?

Markus

#8 Updated by Gavin Macaulay - over 18 years ago

There is an anti-aliasing toggle in qgis, available in the Settings:Options:Rendering dialog box tab. Note that this makes drawing much slower.

#9 Updated by Gavin Macaulay - over 18 years ago

  • Status changed from Open to In Progress

An update.

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 18 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 18 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.

#12 Updated by Gavin Macaulay - over 18 years ago

Some images showing the problem are available in ticket #173.

#13 Updated by Gary Sherman over 18 years ago

In the latest preview release, this problem can NOT be solved by turning on anti-aliasing, at least with the data set I tested. My comments intially reported in ticket #173 still stand. See the attached badpolys_aa.gif.

#14 Updated by Gavin Macaulay - over 18 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 - over 18 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...

#16 Updated by Gavin Macaulay - about 18 years ago

More examples of this problem are in ticket #293

#17 Updated by Gavin Macaulay - about 18 years ago

Using Qt 4.2.0 seems to resolve the problem reported above where the option available since 6abc64b5 (SVN r5568) causes the X server. The original problem still exists. The tracker item now stats that a fix for this will be in Qt 4.3.0

#18 Updated by Gary Sherman almost 18 years ago

Since this is a Qt issue and can't be resolved until Qt 4.3.0, I have moved this ticket to the 0.9 Milestone.

#19 Updated by hamish_nospam-yahoo-com - almost 18 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).

Hamish

#20 Updated by hamish_nospam-yahoo-com - almost 18 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 ;)

Hamish

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 - almost 18 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.

Hamish

#22 Updated by Gavin Macaulay - over 17 years ago

This bug is supposedly fixed in Qt 4.3.0, and the situation is improved, but non-anti-aliased shapefiles still draw incorrectly :)

The 'fix problems with incorrectly filled polygons' works well for me now (Linux).

Reports from other OS's welcome...

#23 Updated by hamish - over 16 years ago

Still broken on Windows, but seems to work elsewhere. Changing Platform to that.

Hamish

#24 Updated by hamish - over 16 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)

Hamish

#25 Updated by hamish - over 16 years ago

Hi,

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.

Hamish

#26 Updated by Maciej Sieczka - over 16 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 16 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.

#28 Updated by Anonymous about 15 years ago

Milestone Version 1.0.0 deleted

Also available in: Atom PDF