Skip to content


Browse files Browse the repository at this point in the history
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: c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
g_j_m committed Jan 28, 2006
1 parent cb008a8 commit f9f6164
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions src/core/qgsdistancearea.cpp
Expand Up @@ -166,8 +166,20 @@ bool QgsDistanceArea::setEllipsoid(const QString& ellipsoid)

bool QgsDistanceArea::setDefaultEllipsoid()
QString defEll("WGS84");
QString ellKey("/qgis/measure/ellipsoid");
QSettings settings;
QString ellipsoid = settings.readEntry("/qgis/measure/ellipsoid", "WGS84");
QString ellipsoid = settings.readEntry(ellKey, defEll);

// Somehow/sometimes the settings file can have a blank ellipsoid
// value. This is undesirable, so force a valid default value in
// that case, and fix the problem by writing a valid value.
if (ellipsoid.isEmpty())
ellipsoid = defEll;
settings.writeEntry(ellKey, ellipsoid);

return setEllipsoid(ellipsoid);

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

points[jdx] = mCoordTransform->transform(QgsPoint(x,y));

if (points.size() > 2)
areaTmp = computePolygonArea(points);
Expand Down

0 comments on commit f9f6164

Please sign in to comment.