Skip to content

Commit

Permalink
Allow opening layers with M dimension, but explicitly disable editati…
Browse files Browse the repository at this point in the history
…on 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
  • Loading branch information
wonder committed Nov 25, 2008
1 parent 5bc3650 commit 654c509
Showing 1 changed file with 18 additions and 7 deletions.
25 changes: 18 additions & 7 deletions src/providers/postgres/qgspostgresprovider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2524,27 +2524,27 @@ bool QgsPostgresProvider::getGeometryDetails()
fType = QString::fromUtf8( PQgetvalue( result, 0, 0 ) );
}
}
if ( fType == "POINT" )
if ( fType == "POINT" || fType == "POINTM" )
{
geomType = QGis::WKBPoint;
}
else if ( fType == "MULTIPOINT" )
else if ( fType == "MULTIPOINT" || fType == "MULTIPOINTM" )
{
geomType = QGis::WKBMultiPoint;
}
else if ( fType == "LINESTRING" )
else if ( fType == "LINESTRING" || fType == "LINESTRINGM" )
{
geomType = QGis::WKBLineString;
}
else if ( fType == "MULTILINESTRING" )
else if ( fType == "MULTILINESTRING" || fType == "MULTILINESTRINGM" )
{
geomType = QGis::WKBMultiLineString;
}
else if ( fType == "POLYGON" )
else if ( fType == "POLYGON" || fType == "POLYGONM" )
{
geomType = QGis::WKBPolygon;
}
else if ( fType == "MULTIPOLYGON" )
else if ( fType == "MULTIPOLYGON" || fType == "MULTIPOLYGONM" )
{
geomType = QGis::WKBMultiPolygon;
}
Expand All @@ -2565,7 +2565,18 @@ bool QgsPostgresProvider::getGeometryDetails()
tr( ". The database communication log was:\n" ) );
showMessageBox( tr( "Unable to get feature type and srid" ), log );
}


// store whether the geometry includes measure value
if ( fType == "POINTM" || fType == "MULTIPOINTM" ||
fType == "LINESTRINGM" || fType == "MULTILINESTRINGM" ||
fType == "POLYGONM" || fType == "MULTIPOLYGONM" )
{
// explicitly disable adding new features and editing of geometries
// as this would lead to corruption of measures
enabledCapabilities &= ~(QgsVectorDataProvider::ChangeGeometries | QgsVectorDataProvider::AddFeatures);
}


if ( valid )
{
QgsDebugMsg( "SRID is " + srid );
Expand Down

0 comments on commit 654c509

Please sign in to comment.