Skip to content

Commit

Permalink
Added increment for unit iterator and added a security check if snapp…
Browse files Browse the repository at this point in the history
…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 committed Jun 2, 2009
1 parent fad8260 commit e00f490
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/app/qgsprojectproperties.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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 )
Expand Down Expand Up @@ -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 );
}
}
Expand Down

0 comments on commit e00f490

Please sign in to comment.