Skip to content
Permalink
Browse files

The remainder of the fix for ticket #80.

git-svn-id: http://svn.osgeo.org/qgis/trunk@5285 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
g_j_m
g_j_m committed Apr 16, 2006
1 parent ca7c535 commit 2036012b8b5bd7d68867f688ec5cffffed1d0574
Showing with 25 additions and 0 deletions.
  1. +25 −0 src/gui/qgsvectorlayer.cpp
@@ -1332,6 +1332,31 @@ QgsRect QgsVectorLayer::bBoxOfSelected()
retval.combineExtentWith(&r);
}
}

if (retval.width() == 0.0 || retval.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 (retval.xMin() == 0.0 && retval.xMax() == 0.0 &&
retval.yMin() == 0.0 && retval.yMax() == 0.0)
{
retval.set(-1.0, -1.0, 1.0, 1.0);
}
else
{
const double padFactor = 0.05;
double widthPad = retval.xMin() * padFactor;
double heightPad = retval.yMin() * padFactor;
double xmin = retval.xMin() - widthPad;
double xmax = retval.xMax() + widthPad;
double ymin = retval.yMin() - heightPad;
double ymax = retval.yMax() + heightPad;
retval.set(xmin, ymin, xmax, ymax);
}
}

return retval;
}

0 comments on commit 2036012

Please sign in to comment.
You can’t perform that action at this time.