Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[FEATURE]: offline editing plugin from Mathias Walker
git-svn-id: http://svn.osgeo.org/qgis/trunk@14335 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
mhugent committed Oct 5, 2010
1 parent 0554824 commit 18b4391
Show file tree
Hide file tree
Showing 17 changed files with 1,974 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/core/qgsvectorlayer.cpp
Expand Up @@ -3228,6 +3228,9 @@ bool QgsVectorLayer::commitChanges()
if (( cap & QgsVectorDataProvider::DeleteAttributes ) && mDataProvider->deleteAttributes( mDeletedAttributeIds ) )
{
mCommitErrors << tr( "SUCCESS: %n attribute(s) deleted.", "deleted attributes count", mDeletedAttributeIds.size() );

emit committedAttributesDeleted( getLayerID(), mDeletedAttributeIds );

mDeletedAttributeIds.clear();
attributesChanged = true;
}
Expand All @@ -3250,6 +3253,9 @@ bool QgsVectorLayer::commitChanges()
if (( cap & QgsVectorDataProvider::AddAttributes ) && mDataProvider->addAttributes( addedAttributes ) )
{
mCommitErrors << tr( "SUCCESS: %n attribute(s) added.", "added attributes count", mAddedAttributeIds.size() );

emit committedAttributesAdded( getLayerID(), addedAttributes );

mAddedAttributeIds.clear();
attributesChanged = true;
}
Expand Down Expand Up @@ -3366,6 +3372,9 @@ bool QgsVectorLayer::commitChanges()
if (( cap & QgsVectorDataProvider::ChangeAttributeValues ) && mDataProvider->changeAttributeValues( mChangedAttributeValues ) )
{
mCommitErrors << tr( "SUCCESS: %n attribute value(s) changed.", "changed attribute values count", mChangedAttributeValues.size() );

emit committedAttributeValuesChanges( getLayerID(), mChangedAttributeValues );

mChangedAttributeValues.clear();
}
else
Expand Down Expand Up @@ -3404,6 +3413,9 @@ bool QgsVectorLayer::commitChanges()
if (( cap & QgsVectorDataProvider::AddFeatures ) && mDataProvider->addFeatures( mAddedFeatures ) )
{
mCommitErrors << tr( "SUCCESS: %n feature(s) added.", "added features count", mAddedFeatures.size() );

emit committedFeaturesAdded( getLayerID(), mAddedFeatures );

mAddedFeatures.clear();
}
else
Expand All @@ -3422,6 +3434,9 @@ bool QgsVectorLayer::commitChanges()
if (( cap & QgsVectorDataProvider::ChangeGeometries ) && mDataProvider->changeGeometryValues( mChangedGeometries ) )
{
mCommitErrors << tr( "SUCCESS: %n geometries were changed.", "changed geometries count", mChangedGeometries.size() );

emit committedGeometriesChanges( getLayerID(), mChangedGeometries );

mChangedGeometries.clear();
}
else
Expand All @@ -3444,6 +3459,9 @@ bool QgsVectorLayer::commitChanges()
mChangedAttributeValues.remove( *it );
mChangedGeometries.remove( *it );
}

emit committedFeaturesRemoved( getLayerID(), mDeletedFeatureIds );

mDeletedFeatureIds.clear();
}
else
Expand Down
8 changes: 8 additions & 0 deletions src/core/qgsvectorlayer.h
Expand Up @@ -594,6 +594,14 @@ class CORE_EXPORT QgsVectorLayer : public QgsMapLayer

void attributeValueChanged( int fid, int idx, const QVariant & );

/** Signals emitted after committing changes */
void committedAttributesDeleted( const QString& layerId, const QgsAttributeIds& deletedAttributeIds );
void committedAttributesAdded( const QString& layerId, const QList<QgsField>& addedAttributes );
void committedFeaturesAdded( const QString& layerId, const QgsFeatureList& addedFeatures );
void committedFeaturesRemoved( const QString& layerId, const QgsFeatureIds& deletedFeatureIds );
void committedAttributeValuesChanges( const QString& layerId, const QgsChangedAttributesMap& changedAttributesValues );
void committedGeometriesChanges( const QString& layerId, const QgsGeometryMap& changedGeometries );

private: // Private methods

/** vector layers are not copyable */
Expand Down
1 change: 1 addition & 0 deletions src/plugins/CMakeLists.txt
Expand Up @@ -13,6 +13,7 @@ SUBDIRS (copyright_label
evis
point_displacement_renderer
spatialquery
offline_editing
)

IF (POSTGRES_FOUND)
Expand Down
56 changes: 56 additions & 0 deletions src/plugins/offline_editing/CMakeLists.txt
@@ -0,0 +1,56 @@

########################################################
# Files

SET (offline_editing_plugin_SRCS
offline_editing_plugin.cpp
offline_editing_plugin_gui.cpp
offline_editing.cpp
offline_editing_progress_dialog.cpp
)

SET (offline_editing_plugin_UIS
offline_editing_plugin_guibase.ui
offline_editing_progress_dialog_base.ui
)

SET (offline_editing_plugin_MOC_HDRS
offline_editing_plugin.h
offline_editing_plugin_gui.h
offline_editing.h
offline_editing_progress_dialog.h
)

SET (offline_editing_plugin_RCCS offline_editing_plugin.qrc)

########################################################
# Build

QT4_WRAP_UI (offline_editing_plugin_UIS_H ${offline_editing_plugin_UIS})

QT4_WRAP_CPP (offline_editing_plugin_MOC_SRCS ${offline_editing_plugin_MOC_HDRS})

QT4_ADD_RESOURCES(offline_editing_plugin_RCC_SRCS ${offline_editing_plugin_RCCS})

ADD_LIBRARY (offlineeditingplugin MODULE ${offline_editing_plugin_SRCS} ${offline_editing_plugin_MOC_SRCS} ${offline_editing_plugin_RCC_SRCS} ${offline_editing_plugin_UIS_H})

INCLUDE_DIRECTORIES(
${CMAKE_CURRENT_BINARY_DIR}
${SQLITE3_INCLUDE_DIR} ${SPATIALITE_INCLUDE_DIR}
../../core ../../core/raster ../../core/renderer ../../core/symbology
../../gui
..
)

TARGET_LINK_LIBRARIES(offlineeditingplugin
qgis_core
qgis_gui
)


########################################################
# Install

INSTALL(TARGETS offlineeditingplugin
RUNTIME DESTINATION ${QGIS_PLUGIN_DIR}
LIBRARY DESTINATION ${QGIS_PLUGIN_DIR})

0 comments on commit 18b4391

Please sign in to comment.