|
30 | 30 | static const QString TEXT_PROVIDER_KEY = "osm";
|
31 | 31 | static const QString TEXT_PROVIDER_DESCRIPTION = "Open Street Map data provider";
|
32 | 32 | static const QString DATE_TIME_FMT = "dd.MM.yyyy HH:mm:ss";
|
33 |
| -static const QString PROVIDER_VERSION = "0.5"; |
| 33 | +static const QString PROVIDER_VERSION = "0.5.1"; |
34 | 34 |
|
35 | 35 | // supported attributes
|
36 | 36 | const char* QgsOSMDataProvider::attr[] = { "timestamp", "user", "tags" };
|
@@ -213,14 +213,19 @@ QgsOSMDataProvider::QgsOSMDataProvider( QString uri )
|
213 | 213 | const unsigned char *boundaries_char = sqlite3_column_text( stmtSelectBoundary, 0 );
|
214 | 214 | QString boundaries(( const char * ) boundaries_char );
|
215 | 215 |
|
216 |
| - // boundaries should be string in following format: "xMin-yMin-xMax-yMax" |
217 |
| - int separ1_pos = boundaries.indexOf( "-" ); |
218 |
| - int separ2_pos = boundaries.indexOf( "-", separ1_pos + 1 ); |
219 |
| - int separ3_pos = boundaries.indexOf( "-", separ2_pos + 1 ); |
220 |
| - xMin = boundaries.left( separ1_pos ).toDouble(); |
221 |
| - yMin = boundaries.mid( separ1_pos + 1, separ2_pos - separ1_pos - 1 ).toDouble(); |
222 |
| - xMax = boundaries.mid( separ2_pos + 1, separ3_pos - separ2_pos - 1 ).toDouble(); |
223 |
| - yMax = boundaries.right( boundaries.size() - separ3_pos - 1 ).toDouble(); |
| 216 | + // boundaries should be string in following format: "xMin:yMin:xMax:yMax" |
| 217 | + QStringList parts = boundaries.split( QChar( ':' ) ); |
| 218 | + if ( parts.count() == 4 ) |
| 219 | + { |
| 220 | + xMin = parts[0].toDouble(); |
| 221 | + yMin = parts[1].toDouble(); |
| 222 | + xMax = parts[2].toDouble(); |
| 223 | + yMax = parts[3].toDouble(); |
| 224 | + } |
| 225 | + else |
| 226 | + { |
| 227 | + QgsDebugMsg( "Default area boundary has invalid format." ); |
| 228 | + } |
224 | 229 | }
|
225 | 230 | }
|
226 | 231 |
|
@@ -1402,8 +1407,8 @@ bool QgsOSMDataProvider::loadOsmFile( QString osm_filename )
|
1402 | 1407 | yMax = handler->yMax;
|
1403 | 1408 |
|
1404 | 1409 | // storing boundary information into database
|
1405 |
| - QString cmd3 = QString( "INSERT INTO meta ( key, val ) VALUES ('default-area-boundaries','%1-%2-%3-%4');" ) |
1406 |
| - .arg( xMin, 0, 'f', 20 ).arg( yMin, 0, 'f', 20 ).arg( xMax, 0, 'f', 20 ).arg( yMax, 0, 'f', 20 ); |
| 1410 | + QString cmd3 = QString( "INSERT INTO meta ( key, val ) VALUES ('default-area-boundaries','%1:%2:%3:%4');" ) |
| 1411 | + .arg( xMin, 0, 'f', 10 ).arg( yMin, 0, 'f', 10 ).arg( xMax, 0, 'f', 10 ).arg( yMax, 0, 'f', 10 ); |
1407 | 1412 | QByteArray cmd_bytes3 = cmd3.toAscii();
|
1408 | 1413 | const char *ptr3 = cmd_bytes3.data();
|
1409 | 1414 |
|
|
0 commit comments