Skip to content

Commit

Permalink
add support for non-numeric fields in generic minimumValue/maximumVal…
Browse files Browse the repository at this point in the history
…ue fallback method

git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@14034 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef committed Aug 9, 2010
1 parent 801f93c commit ab2a7a8
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/core/qgsvectordataprovider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,11 @@ void QgsVectorDataProvider::fillMinMaxCache()
mCacheMinValues[it.key()] = QVariant( DBL_MAX );
mCacheMaxValues[it.key()] = QVariant( -DBL_MAX );
}
else
{
mCacheMinValues[it.key()] = QVariant();
mCacheMaxValues[it.key()] = QVariant();
}
}

QgsFeature f;
Expand Down Expand Up @@ -402,6 +407,18 @@ void QgsVectorDataProvider::fillMinMaxCache()
if ( value > mCacheMaxValues[*it].toDouble() )
mCacheMaxValues[*it] = value;
}
else
{
QString value = varValue.toString();
if ( mCacheMinValues[*it].isNull() || value < mCacheMinValues[*it].toString() )
{
mCacheMinValues[*it] = value;
}
if ( mCacheMaxValues[*it].isNull() || value > mCacheMinValues[*it].toString() )
{
mCacheMaxValues[*it] = value;
}
}
}
}

Expand Down

0 comments on commit ab2a7a8

Please sign in to comment.