Skip to content

Commit 654c509

Browse files
author
wonder
committedNov 25, 2008
Allow opening layers with M dimension, but explicitly disable editation of geometries (would corrupt M dimension) and creation of new features (would keep invalid M dimension).
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@9709 c8812cc2-4d05-0410-92ff-de0c093fc19c

File tree

1 file changed

+18
-7
lines changed

1 file changed

+18
-7
lines changed
 

‎src/providers/postgres/qgspostgresprovider.cpp

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2524,27 +2524,27 @@ bool QgsPostgresProvider::getGeometryDetails()
25242524
fType = QString::fromUtf8( PQgetvalue( result, 0, 0 ) );
25252525
}
25262526
}
2527-
if ( fType == "POINT" )
2527+
if ( fType == "POINT" || fType == "POINTM" )
25282528
{
25292529
geomType = QGis::WKBPoint;
25302530
}
2531-
else if ( fType == "MULTIPOINT" )
2531+
else if ( fType == "MULTIPOINT" || fType == "MULTIPOINTM" )
25322532
{
25332533
geomType = QGis::WKBMultiPoint;
25342534
}
2535-
else if ( fType == "LINESTRING" )
2535+
else if ( fType == "LINESTRING" || fType == "LINESTRINGM" )
25362536
{
25372537
geomType = QGis::WKBLineString;
25382538
}
2539-
else if ( fType == "MULTILINESTRING" )
2539+
else if ( fType == "MULTILINESTRING" || fType == "MULTILINESTRINGM" )
25402540
{
25412541
geomType = QGis::WKBMultiLineString;
25422542
}
2543-
else if ( fType == "POLYGON" )
2543+
else if ( fType == "POLYGON" || fType == "POLYGONM" )
25442544
{
25452545
geomType = QGis::WKBPolygon;
25462546
}
2547-
else if ( fType == "MULTIPOLYGON" )
2547+
else if ( fType == "MULTIPOLYGON" || fType == "MULTIPOLYGONM" )
25482548
{
25492549
geomType = QGis::WKBMultiPolygon;
25502550
}
@@ -2565,7 +2565,18 @@ bool QgsPostgresProvider::getGeometryDetails()
25652565
tr( ". The database communication log was:\n" ) );
25662566
showMessageBox( tr( "Unable to get feature type and srid" ), log );
25672567
}
2568-
2568+
2569+
// store whether the geometry includes measure value
2570+
if ( fType == "POINTM" || fType == "MULTIPOINTM" ||
2571+
fType == "LINESTRINGM" || fType == "MULTILINESTRINGM" ||
2572+
fType == "POLYGONM" || fType == "MULTIPOLYGONM" )
2573+
{
2574+
// explicitly disable adding new features and editing of geometries
2575+
// as this would lead to corruption of measures
2576+
enabledCapabilities &= ~(QgsVectorDataProvider::ChangeGeometries | QgsVectorDataProvider::AddFeatures);
2577+
}
2578+
2579+
25692580
if ( valid )
25702581
{
25712582
QgsDebugMsg( "SRID is " + srid );

0 commit comments

Comments
 (0)
Please sign in to comment.