File tree 1 file changed +25
-0
lines changed
1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -1332,6 +1332,31 @@ QgsRect QgsVectorLayer::bBoxOfSelected()
1332
1332
retval.combineExtentWith (&r);
1333
1333
}
1334
1334
}
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
+
1335
1360
return retval;
1336
1361
}
1337
1362
You can’t perform that action at this time.
0 commit comments