summaryrefslogtreecommitdiff
path: root/src/positioning/qgeorectangle.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/positioning/qgeorectangle.cpp')
-rw-r--r--src/positioning/qgeorectangle.cpp41
1 files changed, 23 insertions, 18 deletions
diff --git a/src/positioning/qgeorectangle.cpp b/src/positioning/qgeorectangle.cpp
index 337b4c76..a760831c 100644
--- a/src/positioning/qgeorectangle.cpp
+++ b/src/positioning/qgeorectangle.cpp
@@ -938,31 +938,36 @@ QGeoRectangle &QGeoRectangle::operator|=(const QGeoRectangle &rectangle)
bool joinWrapLeft = (nonWrapRight >= wrapLeft);
bool joinWrapRight = (nonWrapLeft <= wrapRight);
- if (joinWrapLeft) {
- if (joinWrapRight) {
- left = -180.0;
- right = 180.0;
- } else {
- left = nonWrapLeft;
- right = wrapRight;
- }
+ if (wrapLeft <= nonWrapLeft) { // The wrapping rectangle contains the non-wrapping one entirely
+ left = wrapLeft;
+ right = wrapRight;
} else {
- if (joinWrapRight) {
- left = wrapLeft;
- right = nonWrapRight;
- } else {
- double wrapRightDistance = nonWrapLeft - wrapRight;
- double wrapLeftDistance = wrapLeft - nonWrapRight;
-
- if (wrapLeftDistance == wrapRightDistance) {
+ if (joinWrapLeft) {
+ if (joinWrapRight) {
left = -180.0;
right = 180.0;
- } else if (wrapLeftDistance < wrapRightDistance) {
+ } else {
left = nonWrapLeft;
right = wrapRight;
- } else {
+ }
+ } else {
+ if (joinWrapRight) {
left = wrapLeft;
right = nonWrapRight;
+ } else {
+ double wrapRightDistance = nonWrapLeft - wrapRight;
+ double wrapLeftDistance = wrapLeft - nonWrapRight;
+
+ if (wrapLeftDistance == wrapRightDistance) {
+ left = -180.0;
+ right = 180.0;
+ } else if (wrapLeftDistance < wrapRightDistance) {
+ left = nonWrapLeft;
+ right = wrapRight;
+ } else {
+ left = wrapLeft;
+ right = nonWrapRight;
+ }
}
}
}