Skip to content

Commit

Permalink
enable floating points in drawPolygon
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@5466 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
rblazek committed May 17, 2006
1 parent 8297b7f commit c168d39
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/gui/qgsvectorlayer.cpp
Expand Up @@ -647,15 +647,20 @@ std::cerr << i << ": " << ring->first[i]
ringDetails.push_back(std::make_pair(ii, ringSize));

// Transfer points to the array of QPointF
for (register unsigned int j = 0; j != ringSize; ++j, ++ii)
//for (register unsigned int j = 0; j != ringSize; ++j, ++ii)
for (register unsigned int j = 0; j != ringSize; ++j, ii++)
{
// there is maybe a bug in Qt4.1: when using doubles without rounding,
// I've experienced crashes (broken pipe) when drawing polygon
// with more than 3000 vertices [MD]
pa[ii].setX(static_cast<int>(r->first[j] + 0.5));
pa[ii].setY(static_cast<int>(r->second[j] + 0.5));
// pa[ii].setX(r->first[j]);
// pa[ii].setY(r->second[j]);
//pa[ii].setX(static_cast<int>(r->first[j] + 0.5));
//pa[ii].setY(static_cast<int>(r->second[j] + 0.5));

// The crash was probably caused by writing outside
// pa(total_points + numRings - 1) size, because
// cycle was using ++ii insted of ii++ => reenabled floating point
pa[ii].setX(r->first[j]);
pa[ii].setY(r->second[j]);
}

// Store the last point of the first ring, and insert it at
Expand Down

0 comments on commit c168d39

Please sign in to comment.