Skip to content

Commit 782b4a1

Browse files
author
g_j_m
committedJan 28, 2006
Fix a problem with the config file containing an invalid value for the
measuring ellipsoid. This should resolve problems with calculating polygon areas and also a hanging problem when identifying polygons git-svn-id: http://svn.osgeo.org/qgis/trunk@4769 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent 90cbd51 commit 782b4a1

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed
 

‎src/core/qgsdistancearea.cpp

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,8 +166,20 @@ bool QgsDistanceArea::setEllipsoid(const QString& ellipsoid)
166166

167167
bool QgsDistanceArea::setDefaultEllipsoid()
168168
{
169+
QString defEll("WGS84");
170+
QString ellKey("/qgis/measure/ellipsoid");
169171
QSettings settings;
170-
QString ellipsoid = settings.readEntry("/qgis/measure/ellipsoid", "WGS84");
172+
QString ellipsoid = settings.readEntry(ellKey, defEll);
173+
174+
// Somehow/sometimes the settings file can have a blank ellipsoid
175+
// value. This is undesirable, so force a valid default value in
176+
// that case, and fix the problem by writing a valid value.
177+
if (ellipsoid.isEmpty())
178+
{
179+
ellipsoid = defEll;
180+
settings.writeEntry(ellKey, ellipsoid);
181+
}
182+
171183
return setEllipsoid(ellipsoid);
172184
}
173185

@@ -300,7 +312,7 @@ unsigned char* QgsDistanceArea::measurePolygon(unsigned char* feature, double* a
300312

301313
points[jdx] = mCoordTransform->transform(QgsPoint(x,y));
302314
}
303-
315+
304316
if (points.size() > 2)
305317
{
306318
areaTmp = computePolygonArea(points);

0 commit comments

Comments
 (0)
Please sign in to comment.