Commit 2733f200 authored by Dennis Nienhüser's avatar Dennis Nienhüser

One hash table lookup is enough

parent 86569135
......@@ -129,11 +129,8 @@ void OsmPlacemarkData::removeTag( const QString &key )
bool OsmPlacemarkData::containsTag( const QString &key, const QString &value ) const
{
if ( m_tags.contains( key ) ) {
return m_tags.value( key ) == value;
}
return false;
auto const iter = m_tags.constFind(key);
return iter == m_tags.constEnd() ? false : iter.value() == value;
}
bool OsmPlacemarkData::containsTagKey( const QString &key ) const
......
......@@ -26,6 +26,8 @@
#include <QFile>
#include <QFileInfo>
#include <QBuffer>
#include <QElapsedTimer>
#include <QDebug>
namespace Marble {
......@@ -174,6 +176,8 @@ GeoDataDocument* OsmParser::parseXml(const QString &filename, QString &error)
GeoDataDocument *OsmParser::createDocument(OsmNodes &nodes, OsmWays &ways, OsmRelations &relations)
{
QElapsedTimer timer;
timer.start();
GeoDataDocument* document = new GeoDataDocument;
GeoDataPolyStyle backgroundPolyStyle;
backgroundPolyStyle.setFill( true );
......@@ -199,6 +203,8 @@ GeoDataDocument *OsmParser::createDocument(OsmNodes &nodes, OsmWays &ways, OsmRe
foreach(OsmNode const &node, nodes) {
node.create(document);
}
qDebug() << "grepme " << timer.elapsed();
return document;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment