1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2024-11-24 03:35:53 +01:00

Code cleanup

This commit is contained in:
Martin Tůma 2024-11-07 18:40:25 +01:00
parent 9b0fb8b77c
commit 70ddd83154
2 changed files with 11 additions and 15 deletions

View File

@ -77,16 +77,6 @@ static QList<QByteArray> valList(const QList<QByteArray> &in)
return out; return out;
} }
static bool symbolCmp(const Style::Symbol &a, const Style::Symbol &b)
{
return a.priority() > b.priority();
}
static bool labelCmp(const Style::TextRender &a, const Style::TextRender &b)
{
return a.priority() > b.priority();
}
const Style::Menu::Layer *Style::Menu::findLayer(const QString &id) const const Style::Menu::Layer *Style::Menu::findLayer(const QString &id) const
{ {
for (int i = 0; i < _layers.size(); i++) for (int i = 0; i < _layers.size(); i++)
@ -770,11 +760,11 @@ void Style::load(const MapData &data, qreal ratio)
if (!QFileInfo::exists(path) || !loadXml(path, data, ratio)) if (!QFileInfo::exists(path) || !loadXml(path, data, ratio))
loadXml(":/mapsforge/default.xml", data, ratio); loadXml(":/mapsforge/default.xml", data, ratio);
std::sort(_symbols.begin(), _symbols.end(), symbolCmp); std::sort(_symbols.begin(), _symbols.end());
std::sort(_lineSymbols.begin(), _lineSymbols.end(), symbolCmp); std::sort(_lineSymbols.begin(), _lineSymbols.end());
std::stable_sort(_pointLabels.begin(), _pointLabels.end(), labelCmp); std::stable_sort(_pointLabels.begin(), _pointLabels.end());
std::stable_sort(_areaLabels.begin(), _areaLabels.end(), labelCmp); std::stable_sort(_areaLabels.begin(), _areaLabels.end());
std::stable_sort(_pathLabels.begin(), _pathLabels.end(), labelCmp); std::stable_sort(_pathLabels.begin(), _pathLabels.end());
} }
void Style::clear() void Style::clear()

View File

@ -217,6 +217,9 @@ public:
unsigned key() const {return _key;} unsigned key() const {return _key;}
int priority() const {return _priority;} int priority() const {return _priority;}
bool operator<(const TextRender &other) const
{return _priority > other._priority;}
private: private:
friend class Style; friend class Style;
@ -239,6 +242,9 @@ public:
bool rotate() const {return _rotate;} bool rotate() const {return _rotate;}
int priority() const {return _priority;} int priority() const {return _priority;}
bool operator<(const Symbol &other) const
{return _priority > other._priority;}
private: private:
friend class Style; friend class Style;