MCPcopy Create free account
hub / github.com/comaps/comaps / BuildAndApply

Function BuildAndApply

qt/build_style/build_style.cpp:36–68  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

34namespace build_style
35{
36void BuildAndApply(QString const & mapcssFile)
37{
38 // Ensure mapcss exists
39 if (!QFile(mapcssFile).exists())
40 throw std::runtime_error("mapcss files does not exist");
41
42 QDir const projectDir = QFileInfo(mapcssFile).absoluteDir();
43 QString const styleDir = projectDir.absolutePath() + QDir::separator();
44 QString const prioDir = styleDir + ".." + QDir::separator() + "include";
45 QString const outputDir = styleDir + "out" + QDir::separator();
46
47 // Ensure output directory is clear
48 if (QDir(outputDir).exists() && !QDir(outputDir).removeRecursively())
49 throw std::runtime_error("Unable to remove the output directory");
50 if (!QDir().mkdir(outputDir))
51 throw std::runtime_error("Unable to make the output directory");
52
53 bool const hasSymbols = QDir(styleDir + "symbols/").exists();
54 if (hasSymbols)
55 {
56 auto future = std::async(std::launch::async, BuildSkins, styleDir, outputDir);
57 BuildDrawingRules(mapcssFile, outputDir, prioDir);
58 future.get(); // may rethrow exception from the BuildSkin
59
60 ApplyDrawingRules(outputDir);
61 ApplySkins(outputDir);
62 }
63 else
64 {
65 BuildDrawingRules(mapcssFile, outputDir, prioDir);
66 ApplyDrawingRules(outputDir);
67 }
68}
69
70void BuildIfNecessaryAndApply(QString const & mapcssFile)
71{

Callers 2

OnBuildStyleMethod · 0.85
BuildIfNecessaryAndApplyFunction · 0.85

Calls 4

BuildDrawingRulesFunction · 0.85
ApplyDrawingRulesFunction · 0.85
ApplySkinsFunction · 0.85
getMethod · 0.65

Tested by

no test coverage detected