Skip to content

Commit

Permalink
fix issues
Browse files Browse the repository at this point in the history
  • Loading branch information
kiselev-dv committed May 4, 2015
1 parent 5d54b32 commit 314bf4e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 11 deletions.
22 changes: 13 additions & 9 deletions src/analysis/openstreetmap/qgsosmdatabase.cpp
Expand Up @@ -299,7 +299,7 @@ bool QgsOSMDatabase::prepareStatements()


bool QgsOSMDatabase::exportSpatiaLite( ExportType type, const QString& tableName, bool QgsOSMDatabase::exportSpatiaLite( ExportType type, const QString& tableName,
const QStringList& tagKeys, const QStringList& tagKeys,
const QStringList& notNullTagKeys) const QStringList& notNullTagKeys )
{ {
mError.clear(); mError.clear();


Expand Down Expand Up @@ -338,7 +338,7 @@ bool QgsOSMDatabase::exportSpatiaLite( ExportType type, const QString& tableName
} }




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


//check not null tags //check not null tags
for( int i = 0; i < notNullTagKeys.count(); ++i ) bool skipNull = false;
for ( int i = 0; i < notNullTagKeys.count() && !skipNull; ++i )
if ( !t.contains( notNullTagKeys[i] ) ) if ( !t.contains( notNullTagKeys[i] ) )
continue; skipNull = true;

if ( skipNull )
continue;


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




void QgsOSMDatabase::exportSpatiaLiteWays( bool closed, const QString& tableName, void QgsOSMDatabase::exportSpatiaLiteWays( bool closed, const QString& tableName,
const QStringList& tagKeys, const QStringList& tagKeys,
const QStringList& notNullTagKeys) const QStringList& notNullTagKeys )
{ {
Q_UNUSED( tagKeys ); Q_UNUSED( tagKeys );


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


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


if(skipNull) if ( skipNull )
continue; continue;


QgsGeometry* geom = closed ? QgsGeometry::fromPolygon( QgsPolygon() << polyline ) : QgsGeometry::fromPolyline( polyline ); QgsGeometry* geom = closed ? QgsGeometry::fromPolygon( QgsPolygon() << polyline ) : QgsGeometry::fromPolyline( polyline );
int col = 0; int col = 0;
Expand Down
4 changes: 2 additions & 2 deletions src/analysis/openstreetmap/qgsosmdatabase.h
Expand Up @@ -88,8 +88,8 @@ class ANALYSIS_EXPORT QgsOSMDatabase
int runCountStatement( const char* sql ) const; int runCountStatement( const char* sql ) const;
void deleteStatement( sqlite3_stmt*& stmt ); void deleteStatement( sqlite3_stmt*& stmt );


void exportSpatiaLiteNodes( const QString& tableName, const QStringList& tagKeys, const QStringList& notNullTagKeys ); void exportSpatiaLiteNodes( const QString& tableName, const QStringList& tagKeys, const QStringList& notNullTagKeys = QStringList() );
void exportSpatiaLiteWays( bool closed, const QString& tableName, const QStringList& tagKeys, const QStringList& notNullTagKeys ); void exportSpatiaLiteWays( bool closed, const QString& tableName, const QStringList& tagKeys, const QStringList& notNullTagKeys = QStringList() );
bool createSpatialTable( const QString& tableName, const QString& geometryType, const QStringList& tagKeys ); bool createSpatialTable( const QString& tableName, const QString& geometryType, const QStringList& tagKeys );
bool createSpatialIndex( const QString& tableName ); bool createSpatialIndex( const QString& tableName );


Expand Down

0 comments on commit 314bf4e

Please sign in to comment.