Skip to content

Commit 6c73111

Browse files
Improve height field detection for extrusion
1 parent 3d5422d commit 6c73111

1 file changed

Lines changed: 4 additions & 8 deletions

File tree

src/core/utils/layerutils.cpp

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
#include <qgsrasterlayer.h>
4040
#include <qgsrasterlayerelevationproperties.h>
4141
#include <qgssinglesymbolrenderer.h>
42+
#include <qgsstringutils.h>
4243
#include <qgssymbol.h>
4344
#include <qgssymbollayer.h>
4445
#include <qgstextbuffersettings.h>
@@ -568,10 +569,9 @@ QString LayerUtils::guessFriendlyHeightField( QgsVectorLayer *layer )
568569
QStringLiteral( "extrusion" ),
569570
QStringLiteral( "height" ),
570571
QStringLiteral( "hauteur" ), // French (height)
571-
QStringLiteral( "hoehe" ), // German (height)
572+
QStringLiteral( "hohe" ), // German (height)
572573
};
573574

574-
QString bestPartialMatch;
575575
for ( const QString &candidate : sCandidates )
576576
{
577577
for ( const QgsField &field : fields )
@@ -582,18 +582,14 @@ QString LayerUtils::guessFriendlyHeightField( QgsVectorLayer *layer )
582582
}
583583

584584
const QString fieldName = field.name();
585-
if ( fieldName.compare( candidate, Qt::CaseInsensitive ) == 0 )
585+
if ( QgsStringUtils::unaccent( fieldName ).contains( candidate, Qt::CaseInsensitive ) )
586586
{
587587
return fieldName;
588588
}
589-
if ( bestPartialMatch.isEmpty() && fieldName.contains( candidate, Qt::CaseInsensitive ) )
590-
{
591-
bestPartialMatch = fieldName;
592-
}
593589
}
594590
}
595591

596-
return bestPartialMatch;
592+
return QString();
597593
}
598594

599595
QSet<QVariant> LayerUtils::uniqueValuesForVectorLayerFieldIndex( QgsVectorLayer *layer, int fieldIndex )

0 commit comments

Comments
 (0)