Opened 18 years ago

Closed 16 years ago

Last modified 15 years ago

#83 closed defect (fixed)

Strange polygon fill rendering

Reported by: lubaby Owned by: g_j_m
Priority: major: does not work as expected Milestone:
Component: Vectors Version: 0.11.0
Keywords: Cc:
Must Fix for Release: No Platform: Windows
Platform Version: Awaiting user input: yes

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.

Attachments (5)

strange_vectors.png (60.5 KB ) - added by lubaby 18 years ago.
strange_vectors2.png (37.8 KB ) - added by lubaby 18 years ago.
qgis_08_svn_render_bug.png (103.0 KB ) - added by neteler@… 18 years ago.
QGIS 08 SVN polygon render bug (white pixels spreaded around)
badpolys_aa.gif (30.3 KB ) - added by gsherman 18 years ago.
Polygon clipping/fill problems with antialias on
qgis-pre3cvs10dec2006_huge_polygon_err.png (53.4 KB ) - added by hamish_nospam@… 17 years ago.
screenshot of NZ coastline showing the filling error

Download all attachments as: .zip

Change History (38)

by lubaby, 18 years ago

Attachment: strange_vectors.png added

by lubaby, 18 years ago

Attachment: strange_vectors2.png added

comment:2 by g_j_m, 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

comment:3 by gsherman, 18 years ago

Owner: changed from gsherman to g_j_m

comment:4 by g_j_m, 18 years ago

Milestone: Version 0.8 Release

comment:5 by anonymous, 18 years ago

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

by neteler@…, 18 years ago

Attachment: qgis_08_svn_render_bug.png added

QGIS 08 SVN polygon render bug (white pixels spreaded around)

comment:6 by neteler@…, 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

comment:7 by neteler@…, 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

comment:8 by g_j_m, 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.

comment:9 by anonymous, 18 years ago

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

Markus

comment:10 by g_j_m, 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.

comment:11 by g_j_m, 18 years ago

Status: newassigned

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.

comment:12 by g_j_m, 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.

comment:13 by g_j_m, 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.

comment:14 by g_j_m, 18 years ago

Milestone: Version 0.8 Release

comment:15 by g_j_m, 18 years ago

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

comment:16 by gsherman, 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.

by gsherman, 18 years ago

Attachment: badpolys_aa.gif added

Polygon clipping/fill problems with antialias on

comment:17 by g_j_m, 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.

comment:18 by g_j_m, 18 years ago

SVN r5567 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...

comment:19 by g_j_m, 18 years ago

More examples of this problem are in ticket #293

comment:20 by anonymous, 17 years ago

Milestone: Version 0.8 Release

comment:21 by g_j_m, 17 years ago

Using Qt 4.2.0 seems to resolve the problem reported above where the option available since r5567 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

comment:22 by gsherman, 17 years ago

Milestone: Version 0.8 ReleaseVersion 0.9 Release
Must Fix for Release: No

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.

comment:23 by hamish_nospam@…, 17 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

by hamish_nospam@…, 17 years ago

screenshot of NZ coastline showing the filling error

comment:24 by hamish_nospam@…, 17 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]

comment:25 by hamish_nospam@…, 17 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

comment:26 by anonymous, 17 years ago

Awaiting user input: unset

comment:27 by g_j_m, 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...

comment:28 by hamish, 16 years ago

Platform: LinuxWindows

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

Hamish

comment:29 by hamish, 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

comment:30 by hamish, 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

comment:31 by msieczka, 16 years ago

Awaiting user input: set
Version: HEAD0.11.0

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.

comment:32 by gjm, 16 years ago

Resolution: fixed
Status: assignedclosed

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.

comment:33 by (none), 15 years ago

Milestone: Version 1.0.0

Milestone Version 1.0.0 deleted

Note: See TracTickets for help on using tickets.