[QGIS Commit] r10876 - trunk/qgis/src/app
svn_qgis at osgeo.org
svn_qgis at osgeo.org
Tue Jun 2 10:40:10 EDT 2009
Author: mhugent
Date: 2009-06-02 10:40:10 -0400 (Tue, 02 Jun 2009)
New Revision: 10876
Modified:
trunk/qgis/src/app/qgsprojectproperties.cpp
Log:
Added increment for unit iterator and added a security check if snapping unit is not there (e.g. 1.0 project file)
Modified: trunk/qgis/src/app/qgsprojectproperties.cpp
===================================================================
--- trunk/qgis/src/app/qgsprojectproperties.cpp 2009-06-02 14:40:04 UTC (rev 10875)
+++ trunk/qgis/src/app/qgsprojectproperties.cpp 2009-06-02 14:40:10 UTC (rev 10876)
@@ -121,10 +121,11 @@
}
bool ok;
+ bool toleranceUnitOk; //1.0 project files may not have a unit entry
QStringList layerIdList = QgsProject::instance()->readListEntry( "Digitizing", "/LayerSnappingList", &ok );
QStringList enabledList = QgsProject::instance()->readListEntry( "Digitizing", "/LayerSnappingEnabledList", &ok );
QStringList toleranceList = QgsProject::instance()->readListEntry( "Digitizing", "/LayerSnappingToleranceList", &ok );
- QStringList toleranceUnitList = QgsProject::instance()->readListEntry( "Digitizing", "/LayerSnappingToleranceUnitList", &ok );
+ QStringList toleranceUnitList = QgsProject::instance()->readListEntry( "Digitizing", "/LayerSnappingToleranceUnitList", &toleranceUnitOk );
QStringList snapToList = QgsProject::instance()->readListEntry( "Digitizing", "/LayerSnapToList", &ok );
QStringList::const_iterator idIter = layerIdList.constBegin();
@@ -136,7 +137,7 @@
QgsMapLayer* currentLayer = 0;
//create the new layer entries
- for ( ; idIter != layerIdList.constEnd(); ++idIter, ++enabledIter, ++tolIter, ++snapToIter )
+ for ( ; idIter != layerIdList.constEnd(); ++idIter, ++enabledIter, ++tolIter, ++tolUnitIter, ++snapToIter )
{
currentLayer = QgsMapLayerRegistry::instance()->mapLayer( *idIter );
if ( currentLayer )
@@ -164,7 +165,14 @@
newEntry.snapTo = 2;
}
newEntry.tolerance = tolIter->toDouble();
- newEntry.toleranceUnit = tolUnitIter->toInt();
+ if(toleranceUnitOk)
+ {
+ newEntry.toleranceUnit = tolUnitIter->toInt();
+ }
+ else
+ {
+ newEntry.toleranceUnit = 0;
+ }
mSnappingLayerSettings.insert( *idIter, newEntry );
}
}
More information about the QGIS-commit
mailing list