Skip to content
Permalink
Browse files

Added increment for unit iterator and added a security check if snapp…

…ing unit is not there (e.g. 1.0 project file)

git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@10876 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
mhugent
mhugent committed Jun 2, 2009
1 parent fad8260 commit e00f490ef95e586ba3342c3bb2c4fb53d0adce14
Showing with 11 additions and 3 deletions.
  1. +11 −3 src/app/qgsprojectproperties.cpp
@@ -121,10 +121,11 @@ QgsProjectProperties::QgsProjectProperties( QgsMapCanvas* mapCanvas, QWidget *pa
}

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 @@ QgsProjectProperties::QgsProjectProperties( QgsMapCanvas* mapCanvas, QWidget *pa
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 @@ QgsProjectProperties::QgsProjectProperties( QgsMapCanvas* mapCanvas, QWidget *pa
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 );
}
}

0 comments on commit e00f490

Please sign in to comment.
You can’t perform that action at this time.