Skip to content

Commit 314bf4e

Browse files
committedMay 4, 2015
fix issues
1 parent 5d54b32 commit 314bf4e

File tree

2 files changed

+15
-11
lines changed

2 files changed

+15
-11
lines changed
 

‎src/analysis/openstreetmap/qgsosmdatabase.cpp

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ bool QgsOSMDatabase::prepareStatements()
299299

300300
bool QgsOSMDatabase::exportSpatiaLite( ExportType type, const QString& tableName,
301301
const QStringList& tagKeys,
302-
const QStringList& notNullTagKeys)
302+
const QStringList& notNullTagKeys )
303303
{
304304
mError.clear();
305305

@@ -338,7 +338,7 @@ bool QgsOSMDatabase::exportSpatiaLite( ExportType type, const QString& tableName
338338
}
339339

340340

341-
bool QgsOSMDatabase::createSpatialTable( const QString& tableName, const QString& geometryType, const QStringList& tagKeys)
341+
bool QgsOSMDatabase::createSpatialTable( const QString& tableName, const QString& geometryType, const QStringList& tagKeys )
342342
{
343343
QString sqlCreateTable = QString( "CREATE TABLE %1 (id INTEGER PRIMARY KEY" ).arg( quotedIdentifier( tableName ) );
344344
for ( int i = 0; i < tagKeys.count(); ++i )
@@ -409,9 +409,13 @@ void QgsOSMDatabase::exportSpatiaLiteNodes( const QString& tableName, const QStr
409409
continue;
410410

411411
//check not null tags
412-
for( int i = 0; i < notNullTagKeys.count(); ++i )
412+
bool skipNull = false;
413+
for ( int i = 0; i < notNullTagKeys.count() && !skipNull; ++i )
413414
if ( !t.contains( notNullTagKeys[i] ) )
414-
continue;
415+
skipNull = true;
416+
417+
if ( skipNull )
418+
continue;
415419

416420
QgsGeometry* geom = QgsGeometry::fromPoint( n.point() );
417421
int col = 0;
@@ -446,8 +450,8 @@ void QgsOSMDatabase::exportSpatiaLiteNodes( const QString& tableName, const QStr
446450

447451

448452
void QgsOSMDatabase::exportSpatiaLiteWays( bool closed, const QString& tableName,
449-
const QStringList& tagKeys,
450-
const QStringList& notNullTagKeys)
453+
const QStringList& tagKeys,
454+
const QStringList& notNullTagKeys )
451455
{
452456
Q_UNUSED( tagKeys );
453457

@@ -487,12 +491,12 @@ void QgsOSMDatabase::exportSpatiaLiteWays( bool closed, const QString& tableName
487491
bool skipNull = false;
488492

489493
//check not null tags
490-
for( int i = 0; i < notNullTagKeys.count() && skipNull == false; ++i )
494+
for ( int i = 0; i < notNullTagKeys.count() && skipNull == false; ++i )
491495
if ( !t.contains( notNullTagKeys[i] ) )
492496
skipNull = true;
493497

494-
if(skipNull)
495-
continue;
498+
if ( skipNull )
499+
continue;
496500

497501
QgsGeometry* geom = closed ? QgsGeometry::fromPolygon( QgsPolygon() << polyline ) : QgsGeometry::fromPolyline( polyline );
498502
int col = 0;

‎src/analysis/openstreetmap/qgsosmdatabase.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,8 @@ class ANALYSIS_EXPORT QgsOSMDatabase
8888
int runCountStatement( const char* sql ) const;
8989
void deleteStatement( sqlite3_stmt*& stmt );
9090

91-
void exportSpatiaLiteNodes( const QString& tableName, const QStringList& tagKeys, const QStringList& notNullTagKeys );
92-
void exportSpatiaLiteWays( bool closed, const QString& tableName, const QStringList& tagKeys, const QStringList& notNullTagKeys );
91+
void exportSpatiaLiteNodes( const QString& tableName, const QStringList& tagKeys, const QStringList& notNullTagKeys = QStringList() );
92+
void exportSpatiaLiteWays( bool closed, const QString& tableName, const QStringList& tagKeys, const QStringList& notNullTagKeys = QStringList() );
9393
bool createSpatialTable( const QString& tableName, const QString& geometryType, const QStringList& tagKeys );
9494
bool createSpatialIndex( const QString& tableName );
9595

0 commit comments

Comments
 (0)
Please sign in to comment.