Skip to content

Commit

Permalink
Fix a problem with the config file containing an invalid value for the
Browse files Browse the repository at this point in the history
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
  • Loading branch information
g_j_m committed Jan 28, 2006
1 parent 90cbd51 commit 782b4a1
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 782b4a1

Please sign in to comment.