mirror of
https://github.com/tumic0/GPXSee.git
synced 2025-03-15 19:27:45 +01:00
Added support for the "exclude" theme rules added in recent Mapsforge versions
This commit is contained in:
parent
a2f1ef7572
commit
94785ee2ec
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user