Skip to content

Commit a785159

Browse files
author
mhugent
committed
[FEATURE]: offline editing plugin from Mathias Walker
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@14335 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent 9b3db76 commit a785159

17 files changed

+1974
-0
lines changed

src/core/qgsvectorlayer.cpp

+18
Original file line numberDiff line numberDiff line change
@@ -3228,6 +3228,9 @@ bool QgsVectorLayer::commitChanges()
32283228
if (( cap & QgsVectorDataProvider::DeleteAttributes ) && mDataProvider->deleteAttributes( mDeletedAttributeIds ) )
32293229
{
32303230
mCommitErrors << tr( "SUCCESS: %n attribute(s) deleted.", "deleted attributes count", mDeletedAttributeIds.size() );
3231+
3232+
emit committedAttributesDeleted( getLayerID(), mDeletedAttributeIds );
3233+
32313234
mDeletedAttributeIds.clear();
32323235
attributesChanged = true;
32333236
}
@@ -3250,6 +3253,9 @@ bool QgsVectorLayer::commitChanges()
32503253
if (( cap & QgsVectorDataProvider::AddAttributes ) && mDataProvider->addAttributes( addedAttributes ) )
32513254
{
32523255
mCommitErrors << tr( "SUCCESS: %n attribute(s) added.", "added attributes count", mAddedAttributeIds.size() );
3256+
3257+
emit committedAttributesAdded( getLayerID(), addedAttributes );
3258+
32533259
mAddedAttributeIds.clear();
32543260
attributesChanged = true;
32553261
}
@@ -3366,6 +3372,9 @@ bool QgsVectorLayer::commitChanges()
33663372
if (( cap & QgsVectorDataProvider::ChangeAttributeValues ) && mDataProvider->changeAttributeValues( mChangedAttributeValues ) )
33673373
{
33683374
mCommitErrors << tr( "SUCCESS: %n attribute value(s) changed.", "changed attribute values count", mChangedAttributeValues.size() );
3375+
3376+
emit committedAttributeValuesChanges( getLayerID(), mChangedAttributeValues );
3377+
33693378
mChangedAttributeValues.clear();
33703379
}
33713380
else
@@ -3404,6 +3413,9 @@ bool QgsVectorLayer::commitChanges()
34043413
if (( cap & QgsVectorDataProvider::AddFeatures ) && mDataProvider->addFeatures( mAddedFeatures ) )
34053414
{
34063415
mCommitErrors << tr( "SUCCESS: %n feature(s) added.", "added features count", mAddedFeatures.size() );
3416+
3417+
emit committedFeaturesAdded( getLayerID(), mAddedFeatures );
3418+
34073419
mAddedFeatures.clear();
34083420
}
34093421
else
@@ -3422,6 +3434,9 @@ bool QgsVectorLayer::commitChanges()
34223434
if (( cap & QgsVectorDataProvider::ChangeGeometries ) && mDataProvider->changeGeometryValues( mChangedGeometries ) )
34233435
{
34243436
mCommitErrors << tr( "SUCCESS: %n geometries were changed.", "changed geometries count", mChangedGeometries.size() );
3437+
3438+
emit committedGeometriesChanges( getLayerID(), mChangedGeometries );
3439+
34253440
mChangedGeometries.clear();
34263441
}
34273442
else
@@ -3444,6 +3459,9 @@ bool QgsVectorLayer::commitChanges()
34443459
mChangedAttributeValues.remove( *it );
34453460
mChangedGeometries.remove( *it );
34463461
}
3462+
3463+
emit committedFeaturesRemoved( getLayerID(), mDeletedFeatureIds );
3464+
34473465
mDeletedFeatureIds.clear();
34483466
}
34493467
else

src/core/qgsvectorlayer.h

+8
Original file line numberDiff line numberDiff line change
@@ -594,6 +594,14 @@ class CORE_EXPORT QgsVectorLayer : public QgsMapLayer
594594

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

597+
/** Signals emitted after committing changes */
598+
void committedAttributesDeleted( const QString& layerId, const QgsAttributeIds& deletedAttributeIds );
599+
void committedAttributesAdded( const QString& layerId, const QList<QgsField>& addedAttributes );
600+
void committedFeaturesAdded( const QString& layerId, const QgsFeatureList& addedFeatures );
601+
void committedFeaturesRemoved( const QString& layerId, const QgsFeatureIds& deletedFeatureIds );
602+
void committedAttributeValuesChanges( const QString& layerId, const QgsChangedAttributesMap& changedAttributesValues );
603+
void committedGeometriesChanges( const QString& layerId, const QgsGeometryMap& changedGeometries );
604+
597605
private: // Private methods
598606

599607
/** vector layers are not copyable */

src/plugins/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ SUBDIRS (copyright_label
1313
evis
1414
point_displacement_renderer
1515
spatialquery
16+
offline_editing
1617
)
1718

1819
IF (POSTGRES_FOUND)
+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
2+
########################################################
3+
# Files
4+
5+
SET (offline_editing_plugin_SRCS
6+
offline_editing_plugin.cpp
7+
offline_editing_plugin_gui.cpp
8+
offline_editing.cpp
9+
offline_editing_progress_dialog.cpp
10+
)
11+
12+
SET (offline_editing_plugin_UIS
13+
offline_editing_plugin_guibase.ui
14+
offline_editing_progress_dialog_base.ui
15+
)
16+
17+
SET (offline_editing_plugin_MOC_HDRS
18+
offline_editing_plugin.h
19+
offline_editing_plugin_gui.h
20+
offline_editing.h
21+
offline_editing_progress_dialog.h
22+
)
23+
24+
SET (offline_editing_plugin_RCCS offline_editing_plugin.qrc)
25+
26+
########################################################
27+
# Build
28+
29+
QT4_WRAP_UI (offline_editing_plugin_UIS_H ${offline_editing_plugin_UIS})
30+
31+
QT4_WRAP_CPP (offline_editing_plugin_MOC_SRCS ${offline_editing_plugin_MOC_HDRS})
32+
33+
QT4_ADD_RESOURCES(offline_editing_plugin_RCC_SRCS ${offline_editing_plugin_RCCS})
34+
35+
ADD_LIBRARY (offlineeditingplugin MODULE ${offline_editing_plugin_SRCS} ${offline_editing_plugin_MOC_SRCS} ${offline_editing_plugin_RCC_SRCS} ${offline_editing_plugin_UIS_H})
36+
37+
INCLUDE_DIRECTORIES(
38+
${CMAKE_CURRENT_BINARY_DIR}
39+
${SQLITE3_INCLUDE_DIR} ${SPATIALITE_INCLUDE_DIR}
40+
../../core ../../core/raster ../../core/renderer ../../core/symbology
41+
../../gui
42+
..
43+
)
44+
45+
TARGET_LINK_LIBRARIES(offlineeditingplugin
46+
qgis_core
47+
qgis_gui
48+
)
49+
50+
51+
########################################################
52+
# Install
53+
54+
INSTALL(TARGETS offlineeditingplugin
55+
RUNTIME DESTINATION ${QGIS_PLUGIN_DIR}
56+
LIBRARY DESTINATION ${QGIS_PLUGIN_DIR})

0 commit comments

Comments
 (0)