Skip to content
Permalink
Browse files

Also support MultiPoints

  • Loading branch information
uclaros authored and nyalldawson committed Mar 15, 2021
1 parent ea7122b commit def9af621b7bd14aa348c402e426fdeebb42ce62
Showing with 18 additions and 2 deletions.
  1. +17 −1 src/app/qgsmergeattributesdialog.cpp
  2. +1 −1 src/ui/qgsmergeattributesdialogbase.ui
@@ -79,7 +79,8 @@ QgsMergeAttributesDialog::QgsMergeAttributesDialog( const QgsFeatureList &featur
mFromLargestPushButton->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "mActionFromLargestFeature.svg" ) ) );
mRemoveFeatureFromSelectionButton->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "mActionRemoveSelectedFeature.svg" ) ) );

mFromLargestPushButton->setEnabled( mVectorLayer->geometryType() == QgsWkbTypes::LineGeometry ||
mFromLargestPushButton->setEnabled( mVectorLayer->geometryType() == QgsWkbTypes::PointGeometry ||
mVectorLayer->geometryType() == QgsWkbTypes::LineGeometry ||
mVectorLayer->geometryType() == QgsWkbTypes::PolygonGeometry );
mTakeLargestAttributesLabel->setEnabled( mFromLargestPushButton->isEnabled() );

@@ -494,6 +495,21 @@ void QgsMergeAttributesDialog::mFromLargestPushButton_clicked()

switch ( mVectorLayer->geometryType() )
{
case QgsWkbTypes::PointGeometry:
{
QgsFeatureList::const_iterator f_it = mFeatureList.constBegin();
for ( ; f_it != mFeatureList.constEnd(); ++f_it )
{
const QgsAbstractGeometry *geom = f_it->geometry().constGet();
int partCount = geom ? geom->partCount() : 0;
if ( partCount > maxValue )
{
featureId = f_it->id();
maxValue = partCount;
}
}
break;
}
case QgsWkbTypes::LineGeometry:
{
QgsFeatureList::const_iterator f_it = mFeatureList.constBegin();
@@ -65,7 +65,7 @@
<item>
<widget class="QPushButton" name="mFromLargestPushButton">
<property name="toolTip">
<string>Take all attributes from the Polygon with the largest area or Line with the longest length</string>
<string>Take all attributes from the Polygon with the largest area, Line with the longest length or MultiPoint with the most parts</string>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">

0 comments on commit def9af6

Please sign in to comment.