Skip to content

Commit 3951bcf

Browse files
author
g_j_m
committed
The remainder of the fix for ticket #80.
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@5285 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent ca799f4 commit 3951bcf

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

src/gui/qgsvectorlayer.cpp

+25
Original file line numberDiff line numberDiff line change
@@ -1332,6 +1332,31 @@ QgsRect QgsVectorLayer::bBoxOfSelected()
13321332
retval.combineExtentWith(&r);
13331333
}
13341334
}
1335+
1336+
if (retval.width() == 0.0 || retval.height() == 0.0)
1337+
{
1338+
// If all of the features are at the one point, buffer the
1339+
// rectangle a bit. If they are all at zero, do something a bit
1340+
// more crude.
1341+
1342+
if (retval.xMin() == 0.0 && retval.xMax() == 0.0 &&
1343+
retval.yMin() == 0.0 && retval.yMax() == 0.0)
1344+
{
1345+
retval.set(-1.0, -1.0, 1.0, 1.0);
1346+
}
1347+
else
1348+
{
1349+
const double padFactor = 0.05;
1350+
double widthPad = retval.xMin() * padFactor;
1351+
double heightPad = retval.yMin() * padFactor;
1352+
double xmin = retval.xMin() - widthPad;
1353+
double xmax = retval.xMax() + widthPad;
1354+
double ymin = retval.yMin() - heightPad;
1355+
double ymax = retval.yMax() + heightPad;
1356+
retval.set(xmin, ymin, xmax, ymax);
1357+
}
1358+
}
1359+
13351360
return retval;
13361361
}
13371362

0 commit comments

Comments
 (0)