diff --git a/src/map/loader/maploader.cpp b/src/map/loader/maploader.cpp index a096379..ec2609d 100644 --- a/src/map/loader/maploader.cpp +++ b/src/map/loader/maploader.cpp @@ -1,40 +1,46 @@ /* Copyright (C) 2020 Volker Krause This program is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ #include "maploader.h" #include -#include +#include #include +#include #include using namespace KOSMIndoorMap; -void MapLoader::loadFromOsmXml(const QString &fileName) +void MapLoader::loadFromO5m(const QString &fileName) { + QElapsedTimer loadTime; + loadTime.start(); + QFile f(fileName); if (!f.open(QFile::ReadOnly)) { qCritical() << f.fileName() << f.errorString(); return; } + const auto data = f.map(0, f.size()); OSM::DataSet ds; - OSM::XmlParser p(&ds); - p.parse(&f); + OSM::O5mParser p(&ds); + p.parse(data, f.size()); m_data.setDataSet(std::move(ds)); + qDebug() << "o5m loading took" << loadTime.elapsed() << "ms"; } diff --git a/src/map/loader/maploader.h b/src/map/loader/maploader.h index 09f2194..5415e7d 100644 --- a/src/map/loader/maploader.h +++ b/src/map/loader/maploader.h @@ -1,40 +1,40 @@ /* Copyright (C) 2020 Volker Krause This program is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ #ifndef KOSMINDOORMAP_MAPLOADER_H #define KOSMINDOORMAP_MAPLOADER_H #include "mapdata.h" #include namespace KOSMIndoorMap { /** Loader for OSM data. * Largely temporary, until we have a proper solution on how to actually get the required data. */ class MapLoader { public: - void loadFromOsmXml(const QString &fileName); + void loadFromO5m(const QString &fileName); MapData m_data; }; } #endif // KOSMINDOORMAP_MAPLOADER_H diff --git a/tests/indoormap.cpp b/tests/indoormap.cpp index 5c8eb20..3b87417 100644 --- a/tests/indoormap.cpp +++ b/tests/indoormap.cpp @@ -1,157 +1,157 @@ /* Copyright (C) 2020 Volker Krause This program is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ #include #include #include #include #include #include