Skip to content

Commit

Permalink
fix crash when viewing project properties of 1.1 project files
Browse files Browse the repository at this point in the history
(missing LayerSnappingToleranceUnitList)


git-svn-id: http://svn.osgeo.org/qgis/trunk@10853 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef committed May 27, 2009
1 parent 57b8e33 commit 2cd587c
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/app/qgssnappingdialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ struct LayerEntry
int snapTo; //0 = to vertex, 1 = to segment, 2 = to vertex and to segment
QString layerName;
double tolerance;
int toleranceUnit;
int toleranceUnit; // 0 = map units, 1 = pixels
};

/**A dialog to enter advanced editing properties, e.g. topological editing, snapping settings
Expand Down
38 changes: 37 additions & 1 deletion src/core/qgsprojectfiletransform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include <QDomDocument>
#include <QPrinter> //to find out screen resolution
#include <cstdlib>
#include "qgsprojectproperty.h"

typedef QgsProjectVersion PFV;

Expand All @@ -38,7 +39,8 @@ QgsProjectFileTransform::transform QgsProjectFileTransform::transformers[] =
{PFV( 0, 9, 1 ), PFV( 0, 10, 0 ), &QgsProjectFileTransform::transform091to0100},
{PFV( 0, 9, 2 ), PFV( 0, 10, 0 ), &QgsProjectFileTransform::transformNull},
{PFV( 0, 10, 0 ), PFV( 0, 11, 0 ), &QgsProjectFileTransform::transform0100to0110},
{PFV( 0, 11, 0 ), PFV( 1, 0, 0 ), &QgsProjectFileTransform::transform0110to1000}
{PFV( 0, 11, 0 ), PFV( 1, 0, 0 ), &QgsProjectFileTransform::transform0110to1000},
{PFV( 1, 1, 0 ), PFV( 1, 2, 0 ), &QgsProjectFileTransform::transform1100to1200},
};

bool QgsProjectFileTransform::updateRevision( QgsProjectVersion newVersion )
Expand Down Expand Up @@ -346,3 +348,37 @@ void QgsProjectFileTransform::transform0110to1000()
}
}
}

void QgsProjectFileTransform::transform1100to1200()
{
QgsDebugMsg( "Entering..." );
if ( mDom.isNull() )
return;

QDomNode qgis = mDom.firstChildElement( "qgis" );
if ( qgis.isNull() )
return;

QDomElement properties = qgis.firstChildElement( "properties" );
if ( properties.isNull() )
return;

QDomElement digitizing = properties.firstChildElement( "Digitizing" );
if ( digitizing.isNull() )
return;

QDomElement tolList = digitizing.firstChildElement( "LayerSnappingToleranceList" );
if ( tolList.isNull() )
return;

QDomElement tolUnitList = digitizing.firstChildElement( "LayerSnappingToleranceUnitList" );
if ( !tolUnitList.isNull() )
return;

QStringList units;
for ( int i = 0; i < tolList.childNodes().count(); i++ )
units << "0";

QgsPropertyValue value( units );
value.writeXML( "LayerSnappingToleranceUnitList", digitizing, mDom );
}
1 change: 1 addition & 0 deletions src/core/qgsprojectfiletransform.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ class QgsProjectFileTransform
void transform091to0100();
void transform0100to0110();
void transform0110to1000();
void transform1100to1200();
};


Expand Down

0 comments on commit 2cd587c

Please sign in to comment.