-
-
Notifications
You must be signed in to change notification settings - Fork 3k
/
qgsmergeattributesdialog.h
85 lines (73 loc) · 3.78 KB
/
qgsmergeattributesdialog.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
/***************************************************************************
qgsmergeattributesdialog.h
--------------------------
begin : May 2009
copyright : (C) 2009 by Marco Hugentobler
email : marco dot hugentobler at karto dot baug dot ethz dot ch
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef QGSMERGEATTRIBUTESDIALOG_H
#define QGSMERGEATTRIBUTESDIALOG_H
#include "ui_qgsmergeattributesdialogbase.h"
#include "qgsfeature.h"
class QgsMapCanvas;
class QgsRubberBand;
class QgsVectorLayer;
class QComboBox;
/** A dialog to insert the merge behaviour for attributes (e.g. for the union features editing tool)*/
class APP_EXPORT QgsMergeAttributesDialog: public QDialog, private Ui::QgsMergeAttributesDialogBase
{
Q_OBJECT
public:
QgsMergeAttributesDialog( const QgsFeatureList& features, QgsVectorLayer* vl, QgsMapCanvas* canvas, QWidget * parent = 0, Qt::WindowFlags f = 0 );
~QgsMergeAttributesDialog();
QgsAttributes mergedAttributes() const;
/** Returns a list of attribute indexes which should be skipped when merging (eg, attributes
* which have been set to "skip"
*/
QSet<int> skippedAttributeIndexes() const;
private slots:
void comboValueChanged( const QString & text );
void selectedRowChanged();
void on_mFromSelectedPushButton_clicked();
void on_mRemoveFeatureFromSelectionButton_clicked();
private:
QgsMergeAttributesDialog(); //default constructor forbidden
void createTableWidgetContents();
/** Create new combo box with the options for featureXX / mean / min / max */
QComboBox* createMergeComboBox( QVariant::Type columnType ) const;
/** Returns the table widget column index of a combo box
@return the column index or -1 in case of error*/
int findComboColumn( QComboBox* c ) const;
/** Calculates the merged value of a column (depending on the selected merge behaviour) and inserts the value in the corresponding cell*/
void refreshMergedValue( int col );
/** Inserts the attribute value of a specific feature into the row of merged attributes*/
QVariant featureAttribute( int featureId, int col );
/** Calculates and inserts the minimum attribute value of a column*/
QVariant minimumAttribute( int col );
/** Calculates and inserts the maximum value of a column*/
QVariant maximumAttribute( int col );
/** Calculates and inserts the mean value of a column*/
QVariant meanAttribute( int col );
/** Calculates and inserts the median value of a column*/
QVariant medianAttribute( int col );
/** Calculates and inserts the sum of a column*/
QVariant sumAttribute( int col );
/** Appends the values of the features for the final value*/
QVariant concatenationAttribute( int col );
/** Sets mSelectionRubberBand to a new feature*/
void createRubberBandForFeature( int featureId );
QgsFeatureList mFeatureList;
QgsVectorLayer* mVectorLayer;
QgsMapCanvas* mMapCanvas;
/** Item that highlights the selected feature in the merge table*/
QgsRubberBand* mSelectionRubberBand;
};
#endif // QGSMERGEATTRIBUTESDIALOG_H