1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2025-03-15 03:17:44 +01:00

Added support for the "exclude" theme rules added in recent Mapsforge versions

This commit is contained in:
Martin Tůma 2025-03-11 07:34:31 +01:00
parent a2f1ef7572
commit 94785ee2ec
2 changed files with 9 additions and 6 deletions

View File

@ -116,13 +116,15 @@ QSet<QString> Style::Menu::cats() const
}
Style::Rule::Filter::Filter(const MapData &data, const QList<QByteArray> &keys,
const QList<QByteArray> &vals) : _neg(false)
const QList<QByteArray> &vals) : _neg(false), _excl(false)
{
_keys = keyList(data, keys);
QList<QByteArray> vc(vals);
if (vc.removeAll("~"))
_neg = true;
if (vc.removeAll("-"))
_excl = true;
_vals = valList(vc);
}

View File

@ -38,7 +38,7 @@ public:
class Filter {
public:
Filter() : _neg(false) {}
Filter() : _neg(false), _excl(false) {}
Filter(const MapData &data, const QList<QByteArray> &keys,
const QList<QByteArray> &vals);
@ -47,14 +47,15 @@ public:
if (_neg) {
if (!keyMatches(tags))
return true;
return valueMatches(tags);
return valueMatches(tags) ^ _excl;
} else
return (keyMatches(tags) && valueMatches(tags));
return (keyMatches(tags) && (valueMatches(tags) ^ _excl));
}
bool isTautology() const
{
return (!_neg && _keys.contains(0u) && _vals.contains(QByteArray()));
return (!_neg && !_excl && _keys.contains(0u)
&& _vals.contains(QByteArray()));
}
private:
@ -86,7 +87,7 @@ public:
QList<unsigned> _keys;
QList<QByteArray> _vals;
bool _neg;
bool _neg, _excl;
};
void setType(Type type)