Files
comaps/qt/build_style/build_statistics.cpp
Konstantin Pastbin e3e4a1985a Organic Maps sources as of 02.04.2025 (fad26bbf22ac3da75e01e62aa01e5c8e11861005)
To expand with full Organic Maps and Maps.ME commits history run:
  git remote add om-historic [om-historic.git repo url]
  git fetch --tags om-historic
  git replace squashed-history historic-commits
2025-05-08 21:10:51 +07:00

45 lines
1.4 KiB
C++

#include "build_statistics.h"
#include "build_common.h"
#include "platform/platform.hpp"
#include <QtCore/QDir>
#include <QtCore/QFile>
#include <QtCore/QFileInfo>
#include <QtCore/QProcessEnvironment>
#include <exception>
#include <string>
namespace build_style
{
QString GetStyleStatistics(QString const & mapcssMappingFile, QString const & drulesFile)
{
if (!QFile(mapcssMappingFile).exists())
throw std::runtime_error("mapcss-mapping file does not exist at " + mapcssMappingFile.toStdString());
if (!QFile(drulesFile).exists())
throw std::runtime_error("drawing-rules file does not exist at " + drulesFile.toStdString());
// Add path to the protobuf EGG in the PROTOBUF_EGG_PATH environment variable.
QProcessEnvironment env{QProcessEnvironment::systemEnvironment()};
env.insert("PROTOBUF_EGG_PATH", GetProtobufEggPath());
// Run the script.
return ExecProcess("python", {
GetExternalPath("drules_info.py", "kothic/src", "../tools/python/stylesheet"),
mapcssMappingFile,
drulesFile,
}, &env);
}
QString GetCurrentStyleStatistics()
{
QString const resourceDir = GetPlatform().ResourcesDir().c_str();
QString const mappingPath = JoinPathQt({resourceDir, "mapcss-mapping.csv"});
QString const drulesPath = JoinPathQt({resourceDir, "drules_proto_design.bin"});
return GetStyleStatistics(mappingPath, drulesPath);
}
} // namespace build_style