@@ -56,10 +56,10 @@ QgsNewSpatialiteLayerDialog::QgsNewSpatialiteLayerDialog( QWidget *parent, Qt::W
56
56
restoreGeometry ( settings.value ( QStringLiteral ( " Windows/NewSpatiaLiteLayer/geometry" ) ).toByteArray () );
57
57
58
58
mGeometryTypeBox ->addItem ( tr ( " Point" ), QStringLiteral ( " POINT" ) );
59
- mGeometryTypeBox ->addItem ( tr ( " Line" ), QStringLiteral ( " LINE " ) );
59
+ mGeometryTypeBox ->addItem ( tr ( " Line" ), QStringLiteral ( " LINESTRING " ) );
60
60
mGeometryTypeBox ->addItem ( tr ( " Polygon" ), QStringLiteral ( " POLYGON" ) );
61
61
mGeometryTypeBox ->addItem ( tr ( " MultiPoint" ), QStringLiteral ( " MULTIPOINT" ) );
62
- mGeometryTypeBox ->addItem ( tr ( " MultiLine" ), QStringLiteral ( " MULTILINE " ) );
62
+ mGeometryTypeBox ->addItem ( tr ( " MultiLine" ), QStringLiteral ( " MULTILINESTRING " ) );
63
63
mGeometryTypeBox ->addItem ( tr ( " MultiPolygon" ), QStringLiteral ( " MULTIPOLYGON" ) );
64
64
65
65
mAddAttributeButton ->setIcon ( QgsApplication::getThemeIcon ( QStringLiteral ( " /mActionNewAttribute.svg" ) ) );
@@ -147,6 +147,24 @@ QString QgsNewSpatialiteLayerDialog::selectedType() const
147
147
return mGeometryTypeBox ->currentData ( Qt::UserRole ).toString ();
148
148
}
149
149
150
+ QString QgsNewSpatialiteLayerDialog::selectedZM () const
151
+ {
152
+ if ( mGeometryWithZCheckBox ->isChecked () && !mGeometryWithMCheckBox ->isChecked () )
153
+ {
154
+ return QStringLiteral ( " XYZ" );
155
+ }
156
+ else if ( !mGeometryWithZCheckBox ->isChecked () && mGeometryWithMCheckBox ->isChecked () )
157
+ {
158
+ return QStringLiteral ( " XYM" );
159
+ }
160
+ else if ( mGeometryWithZCheckBox ->isChecked () && mGeometryWithMCheckBox ->isChecked () )
161
+ {
162
+ return QStringLiteral ( " XYZM" );
163
+ }
164
+
165
+ return QStringLiteral ( " XY" );
166
+ }
167
+
150
168
void QgsNewSpatialiteLayerDialog::checkOk ()
151
169
{
152
170
bool created = !leLayerName->text ().isEmpty () &&
@@ -320,7 +338,8 @@ bool QgsNewSpatialiteLayerDialog::createDb()
320
338
settings.setValue ( QStringLiteral ( " SpatiaLite/connections/selected" ), fi.fileName () + tr ( " @" ) + fi.canonicalFilePath () );
321
339
settings.setValue ( key, fi.canonicalFilePath () );
322
340
323
- QMessageBox::information ( nullptr , tr ( " SpatiaLite Database" ), tr ( " Registered new database!" ) );
341
+ // Reload connections to refresh browser panel
342
+ QgisApp::instance ()->reloadConnections ();
324
343
}
325
344
326
345
pbnFindSRID->setEnabled ( true );
@@ -366,11 +385,12 @@ bool QgsNewSpatialiteLayerDialog::apply()
366
385
367
386
QgsDebugMsg ( sql ); // OK
368
387
369
- QString sqlAddGeom = QStringLiteral ( " select AddGeometryColumn(%1,%2,%3,%4,2 )" )
388
+ QString sqlAddGeom = QStringLiteral ( " select AddGeometryColumn(%1,%2,%3,%4,%5 )" )
370
389
.arg ( quotedValue ( leLayerName->text () ),
371
390
quotedValue ( leGeometryColumn->text () ) )
372
391
.arg ( mCrsId .split ( ' :' ).value ( 1 , QStringLiteral ( " 0" ) ).toInt () )
373
- .arg ( quotedValue ( selectedType () ) );
392
+ .arg ( quotedValue ( selectedType () ) )
393
+ .arg ( quotedValue ( selectedZM () ) );
374
394
QgsDebugMsg ( sqlAddGeom ); // OK
375
395
376
396
QString sqlCreateIndex = QStringLiteral ( " select CreateSpatialIndex(%1,%2)" )
@@ -426,6 +446,9 @@ bool QgsNewSpatialiteLayerDialog::apply()
426
446
leGeometryColumn->text () ), leLayerName->text (), QStringLiteral ( " spatialite" ) );
427
447
if ( layer->isValid () )
428
448
{
449
+ // Reload connections to refresh browser panel
450
+ QgisApp::instance ()->reloadConnections ();
451
+
429
452
// register this layer with the central layers registry
430
453
QList<QgsMapLayer *> myList;
431
454
myList << layer;
0 commit comments