Skip to content

Commit 2cd587c

Browse files
author
jef
committedMay 27, 2009
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
1 parent 57b8e33 commit 2cd587c

File tree

3 files changed

+39
-2
lines changed

3 files changed

+39
-2
lines changed
 

‎src/app/qgssnappingdialog.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ struct LayerEntry
2828
int snapTo; //0 = to vertex, 1 = to segment, 2 = to vertex and to segment
2929
QString layerName;
3030
double tolerance;
31-
int toleranceUnit;
31+
int toleranceUnit; // 0 = map units, 1 = pixels
3232
};
3333

3434
/**A dialog to enter advanced editing properties, e.g. topological editing, snapping settings

‎src/core/qgsprojectfiletransform.cpp

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
#include <QDomDocument>
2727
#include <QPrinter> //to find out screen resolution
2828
#include <cstdlib>
29+
#include "qgsprojectproperty.h"
2930

3031
typedef QgsProjectVersion PFV;
3132

@@ -38,7 +39,8 @@ QgsProjectFileTransform::transform QgsProjectFileTransform::transformers[] =
3839
{PFV( 0, 9, 1 ), PFV( 0, 10, 0 ), &QgsProjectFileTransform::transform091to0100},
3940
{PFV( 0, 9, 2 ), PFV( 0, 10, 0 ), &QgsProjectFileTransform::transformNull},
4041
{PFV( 0, 10, 0 ), PFV( 0, 11, 0 ), &QgsProjectFileTransform::transform0100to0110},
41-
{PFV( 0, 11, 0 ), PFV( 1, 0, 0 ), &QgsProjectFileTransform::transform0110to1000}
42+
{PFV( 0, 11, 0 ), PFV( 1, 0, 0 ), &QgsProjectFileTransform::transform0110to1000},
43+
{PFV( 1, 1, 0 ), PFV( 1, 2, 0 ), &QgsProjectFileTransform::transform1100to1200},
4244
};
4345

4446
bool QgsProjectFileTransform::updateRevision( QgsProjectVersion newVersion )
@@ -346,3 +348,37 @@ void QgsProjectFileTransform::transform0110to1000()
346348
}
347349
}
348350
}
351+
352+
void QgsProjectFileTransform::transform1100to1200()
353+
{
354+
QgsDebugMsg( "Entering..." );
355+
if ( mDom.isNull() )
356+
return;
357+
358+
QDomNode qgis = mDom.firstChildElement( "qgis" );
359+
if ( qgis.isNull() )
360+
return;
361+
362+
QDomElement properties = qgis.firstChildElement( "properties" );
363+
if ( properties.isNull() )
364+
return;
365+
366+
QDomElement digitizing = properties.firstChildElement( "Digitizing" );
367+
if ( digitizing.isNull() )
368+
return;
369+
370+
QDomElement tolList = digitizing.firstChildElement( "LayerSnappingToleranceList" );
371+
if ( tolList.isNull() )
372+
return;
373+
374+
QDomElement tolUnitList = digitizing.firstChildElement( "LayerSnappingToleranceUnitList" );
375+
if ( !tolUnitList.isNull() )
376+
return;
377+
378+
QStringList units;
379+
for ( int i = 0; i < tolList.childNodes().count(); i++ )
380+
units << "0";
381+
382+
QgsPropertyValue value( units );
383+
value.writeXML( "LayerSnappingToleranceUnitList", digitizing, mDom );
384+
}

‎src/core/qgsprojectfiletransform.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ class QgsProjectFileTransform
8080
void transform091to0100();
8181
void transform0100to0110();
8282
void transform0110to1000();
83+
void transform1100to1200();
8384
};
8485

8586

0 commit comments

Comments
 (0)
Please sign in to comment.