mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-25 00:58:06 -05:00
Add initial support for editing TopoGeometry objects
This is pretty hackish in that it basically creates a new TopoGeometry on every edit, leaving loads of orphaned ones around.
This commit is contained in:
parent
bd8237f648
commit
bbecffdb65
@ -2412,11 +2412,28 @@ bool QgsPostgresProvider::changeGeometryValues( QgsGeometryMap & geometry_map )
|
||||
// Start the PostGIS transaction
|
||||
mConnectionRW->PQexecNR( "BEGIN" );
|
||||
|
||||
QString update = QString( "UPDATE %1 SET %2=%3 WHERE %4" )
|
||||
.arg( mQuery )
|
||||
.arg( quotedIdentifier( mGeometryColumn ) )
|
||||
.arg( geomParam( 1 ) )
|
||||
.arg( pkParamWhereClause( 2 ) );
|
||||
QString update;
|
||||
|
||||
if ( mSpatialColType == sctTopoGeometry ) {
|
||||
// NOTE: We are creating a new TopoGeometry objects with the new shape.
|
||||
// TODO: _replace_ the initial TopoGeometry instead, so that it keeps
|
||||
// the same identifier and thus still partecipates in any
|
||||
// hierarchical definition. Also creating a new object results
|
||||
// in orphaned topogeometries!
|
||||
update = QString( "UPDATE %1 SET %2=toTopoGeom(%3,t.name,layer_id(%2))"
|
||||
" FROM topology.topology t WHERE t.id = topology_id(%2)"
|
||||
" AND %4" )
|
||||
.arg( mQuery )
|
||||
.arg( quotedIdentifier( mGeometryColumn ) )
|
||||
.arg( geomParam( 1 ) )
|
||||
.arg( pkParamWhereClause( 2 ) );
|
||||
} else {
|
||||
update = QString( "UPDATE %1 SET %2=%3 WHERE %4" )
|
||||
.arg( mQuery )
|
||||
.arg( quotedIdentifier( mGeometryColumn ) )
|
||||
.arg( geomParam( 1 ) )
|
||||
.arg( pkParamWhereClause( 2 ) );
|
||||
}
|
||||
|
||||
QgsDebugMsg( "updating: " + update );
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user