Skip to content
Permalink
Browse files

Improvements for merge tool. Show a progress dialog during the merge …

…and make the item showing the attribute values after the merge editable

git-svn-id: http://svn.osgeo.org/qgis/trunk@10943 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
mhugent
mhugent committed Jun 17, 2009
1 parent 3999172 commit 6d54e8714bc703cbd660d7d439450439b58380fa
Showing with 19 additions and 3 deletions.
  1. +17 −1 src/app/qgisapp.cpp
  2. +1 −1 src/app/qgisapp.h
  3. +1 −1 src/app/qgsmergeattributesdialog.cpp
@@ -53,6 +53,7 @@
#include <QPrinter>
#include <QProcess>
#include <QProgressBar>
#include <QProgressDialog>
#include <QRegExp>
#include <QRegExpValidator>
#include <QSettings>
@@ -4139,7 +4140,7 @@ void QgisApp::deletePart()
mMapCanvas->setMapTool( mMapTools.mDeletePart );
}

QgsGeometry* QgisApp::unionGeometries(const QgsVectorLayer* vl, QgsFeatureList& featureList) const
QgsGeometry* QgisApp::unionGeometries(const QgsVectorLayer* vl, QgsFeatureList& featureList)
{
if(!vl || featureList.size() < 2)
{
@@ -4153,8 +4154,20 @@ QgsGeometry* QgisApp::unionGeometries(const QgsVectorLayer* vl, QgsFeatureList&
return 0;
}

QProgressDialog progress(tr("Merging features..."), tr("Abort"), 0, featureList.size(), this);
progress.setWindowModality(Qt::WindowModal);

QApplication::setOverrideCursor( Qt::WaitCursor );

for(int i = 1; i < featureList.size(); ++i)
{
if(progress.wasCanceled())
{
delete unionGeom;
QApplication::restoreOverrideCursor();
return 0;
}
progress.setValue(i);
QgsGeometry* currentGeom = featureList[i].geometry();
if(currentGeom)
{
@@ -4167,6 +4180,9 @@ QgsGeometry* QgisApp::unionGeometries(const QgsVectorLayer* vl, QgsFeatureList&
}
}
}

QApplication::restoreOverrideCursor();
progress.setValue(featureList.size());
return unionGeom;
}

@@ -667,7 +667,7 @@ class QgisApp : public QMainWindow
bool saveDirty();
/** Helper function to union several geometries together (used in function mergeSelectedFeatures)
@return 0 in case of error*/
QgsGeometry* unionGeometries(const QgsVectorLayer* vl, QgsFeatureList& featureList) const;
QgsGeometry* unionGeometries(const QgsVectorLayer* vl, QgsFeatureList& featureList);

/// QgisApp aren't copyable
QgisApp( QgisApp const & );
@@ -248,7 +248,7 @@ void QgsMergeAttributesDialog::refreshMergedValue(int col)

//insert string into table widget
QTableWidgetItem* newTotalItem = new QTableWidgetItem(evalText);
newTotalItem->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable);
newTotalItem->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsEditable);
mTableWidget->setItem(mTableWidget->rowCount() - 1, col, newTotalItem);
}

0 comments on commit 6d54e87

Please sign in to comment.
You can’t perform that action at this time.