void QgsOfflineEditing::committedGeometriesChanges( const QString& qgisLayerId, const QgsGeometryMap& changedGeometries ) { sqlite3* db = openLoggingDb(); if ( db == NULL ) { return; } // insert log int layerId = getOrCreateLayerId( db, qgisLayerId ); int commitNo = getCommitNo( db ); for ( QgsGeometryMap::const_iterator it = changedGeometries.begin(); it != changedGeometries.end(); ++it ) { QgsFeatureId fid = it.key(); if ( isAddedFeature( db, layerId, fid ) ) { // skip added features continue; } QgsGeometry geom = it.value(); QString sql = QString( "INSERT INTO 'log_geometry_updates' VALUES ( %1, %2, %3, '%4' )" ) .arg( layerId ) .arg( commitNo ) .arg( fid ) .arg( geom.exportToWkt() ); sqlExec( db, sql ); // TODO: use WKB instead of WKT? } increaseCommitNo( db ); sqlite3_close( db ); }
bool QgsMemoryProvider::changeGeometryValues( QgsGeometryMap & geometry_map ) { for ( QgsGeometryMap::const_iterator it = geometry_map.begin(); it != geometry_map.end(); ++it ) { QgsFeatureMap::iterator fit = mFeatures.find( it.key() ); if ( fit == mFeatures.end() ) continue; // update spatial index if ( mSpatialIndex ) mSpatialIndex->deleteFeature( *fit ); fit->setGeometry( it.value() ); // update spatial index if ( mSpatialIndex ) mSpatialIndex->insertFeature( *fit ); } updateExtent(); return TRUE; }