Skip to content
Permalink
Browse files

fix crash when viewing project properties of 1.1 project files

(missing LayerSnappingToleranceUnitList)


git-svn-id: http://svn.osgeo.org/qgis/trunk@10853 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef
jef committed May 27, 2009
1 parent 57b8e33 commit 2cd587c4bf8e4150ede9f22ed2e8be20acf382e1
Showing with 39 additions and 2 deletions.
  1. +1 −1 src/app/qgssnappingdialog.h
  2. +37 −1 src/core/qgsprojectfiletransform.cpp
  3. +1 −0 src/core/qgsprojectfiletransform.h
@@ -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
@@ -26,6 +26,7 @@
#include <QDomDocument>
#include <QPrinter> //to find out screen resolution
#include <cstdlib>
#include "qgsprojectproperty.h"

typedef QgsProjectVersion PFV;

@@ -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 )
@@ -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 );
}
@@ -80,6 +80,7 @@ class QgsProjectFileTransform
void transform091to0100();
void transform0100to0110();
void transform0110to1000();
void transform1100to1200();
};


0 comments on commit 2cd587c

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