Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix for ticket #651 (zoom to full extent doesn't work for a single point
layer)


git-svn-id: http://svn.osgeo.org/qgis/branches/Release-0_8_0@6800 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
g_j_m committed Mar 13, 2007
1 parent 1322743 commit 2a20064
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions src/gui/qgsmaplayerset.cpp
Expand Up @@ -78,4 +78,29 @@ void QgsMapLayerSet::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);
}
}

}

0 comments on commit 2a20064

Please sign in to comment.