File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -78,4 +78,29 @@ void QgsMapLayerSet::updateFullExtent()
78
78
}
79
79
it++;
80
80
}
81
+
82
+ if (mFullExtent .width () == 0.0 || mFullExtent .height () == 0.0 )
83
+ {
84
+ // If all of the features are at the one point, buffer the
85
+ // rectangle a bit. If they are all at zero, do something a bit
86
+ // more crude.
87
+
88
+ if (mFullExtent .xMin () == 0.0 && mFullExtent .xMax () == 0.0 &&
89
+ mFullExtent .yMin () == 0.0 && mFullExtent .yMax () == 0.0 )
90
+ {
91
+ mFullExtent .set (-1.0 , -1.0 , 1.0 , 1.0 );
92
+ }
93
+ else
94
+ {
95
+ const double padFactor = 1e-8 ;
96
+ double widthPad = mFullExtent .xMin () * padFactor;
97
+ double heightPad = mFullExtent .yMin () * padFactor;
98
+ double xmin = mFullExtent .xMin () - widthPad;
99
+ double xmax = mFullExtent .xMax () + widthPad;
100
+ double ymin = mFullExtent .yMin () - heightPad;
101
+ double ymax = mFullExtent .yMax () + heightPad;
102
+ mFullExtent .set (xmin, ymin, xmax, ymax);
103
+ }
104
+ }
105
+
81
106
}
You can’t perform that action at this time.
0 commit comments