kopia lustrzana https://gitlab.com/tomaszg/geostat
Simplify adding new maps
rodzic
325af6efba
commit
0e51018b9f
12
geostat.cpp
12
geostat.cpp
|
@ -148,16 +148,8 @@ int main(int argc, char** argv) {
|
||||||
|
|
||||||
if (!heat_file.empty()) {
|
if (!heat_file.empty()) {
|
||||||
const Map* chosen_map;
|
const Map* chosen_map;
|
||||||
if (heat_map == "Poland_relief")
|
if (maps.count(heat_map) > 0)
|
||||||
chosen_map = &Poland_relief;
|
chosen_map = &maps.at(heat_map);
|
||||||
else if (heat_map == "Poland" || heat_map.empty())
|
|
||||||
chosen_map = &Poland;
|
|
||||||
else if (heat_map == "Europe")
|
|
||||||
chosen_map = &Europe;
|
|
||||||
else if (heat_map == "Podlaskie")
|
|
||||||
chosen_map = &Podlaskie;
|
|
||||||
else if (heat_map == "Pomorskie")
|
|
||||||
chosen_map = &Pomorskie;
|
|
||||||
else {
|
else {
|
||||||
std::cout << "Map " << heat_map << " not found.\n";
|
std::cout << "Map " << heat_map << " not found.\n";
|
||||||
std::exit(EXIT_FAILURE);
|
std::exit(EXIT_FAILURE);
|
||||||
|
|
14
maps.h
14
maps.h
|
@ -1,5 +1,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <map>
|
||||||
|
|
||||||
class Map {
|
class Map {
|
||||||
public:
|
public:
|
||||||
const int size_x;
|
const int size_x;
|
||||||
|
@ -24,8 +26,10 @@ public:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const Map Poland(1000, 972, 48.7, 55.2, 13.8, 24.5, "Poland.png");
|
const std::map<std::string, Map> maps = {
|
||||||
const Map Poland_relief(1000, 972, 48.7, 55.2, 13.8, 24.5, "Poland_relief.png");
|
{"Poland", Map(1000, 972, 48.7, 55.2, 13.8, 24.5, "Poland.png")},
|
||||||
const Map Europe(1249, 1024, 28, 82, -25, 54, "Europe.png");
|
{"Poland_relief", Map(1000, 972, 48.7, 55.2, 13.8, 24.5, "Poland_relief.png")},
|
||||||
const Map Podlaskie(727, 1024, 52.17, 54.5, 21.45, 24.1, "Podlaskie.png");
|
{"Europe", Map(1249, 1024, 28, 82, -25, 54, "Europe.png")},
|
||||||
const Map Pomorskie(1000, 785, 53.40, 54.92, 16.65, 19.75, "Pomorskie.png");
|
{"Podlaskie", Map(727, 1024, 52.17, 54.5, 21.45, 24.1, "Podlaskie.png")},
|
||||||
|
{"Pomorskie", Map(1000, 785, 53.40, 54.92, 16.65, 19.75, "Pomorskie.png")}
|
||||||
|
};
|
||||||
|
|
Ładowanie…
Reference in New Issue