Skip to content
Permalink
Browse files
Fix for ticket #651 (zoom full doesn't work on a single point)
git-svn-id: http://svn.osgeo.org/qgis/trunk@6799 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
g_j_m committed Mar 13, 2007
1 parent a00beb4 commit 23eca9c32a110f433178efef2bc289455cf55786
Showing with 25 additions and 0 deletions.
  1. +25 −0 src/core/qgsmaprender.cpp
@@ -579,6 +579,31 @@ void QgsMapRender::updateFullExtent()
}
it++;
}

if (mFullExtent.width() == 0.0 || mFullExtent.height() == 0.0)
{
// If all of the features are at the one point, buffer the
// rectangle a bit. If they are all at zero, do something a bit
// more crude.

if (mFullExtent.xMin() == 0.0 && mFullExtent.xMax() == 0.0 &&
mFullExtent.yMin() == 0.0 && mFullExtent.yMax() == 0.0)
{
mFullExtent.set(-1.0, -1.0, 1.0, 1.0);
}
else
{
const double padFactor = 1e-8;
double widthPad = mFullExtent.xMin() * padFactor;
double heightPad = mFullExtent.yMin() * padFactor;
double xmin = mFullExtent.xMin() - widthPad;
double xmax = mFullExtent.xMax() + widthPad;
double ymin = mFullExtent.yMin() - heightPad;
double ymax = mFullExtent.yMax() + heightPad;
mFullExtent.set(xmin, ymin, xmax, ymax);
}
}

QgsDebugMsg("Full extent: " + mFullExtent.stringRep());
}

0 comments on commit 23eca9c

Please sign in to comment.