kopia lustrzana https://gitlab.com/tomaszg/geostat
113 wiersze
3.0 KiB
C++
113 wiersze
3.0 KiB
C++
|
#include "debug.h"
|
||
|
#include "ocdb.h"
|
||
|
#include "okapi.h"
|
||
|
|
||
|
#include <string>
|
||
|
#include <fstream>
|
||
|
// #include <filesystem>
|
||
|
#include <sqlite3.h>
|
||
|
#include <unistd.h>
|
||
|
#include <nlohmann/json.hpp>
|
||
|
|
||
|
using json = nlohmann::json;
|
||
|
|
||
|
const std::string Database = "ocpl.sqlite";
|
||
|
const std::string Dump_path = "/home/tomaszg/src/geo/dump_mini/";
|
||
|
|
||
|
int main(int argc, char** argv) {
|
||
|
|
||
|
int o;
|
||
|
while ((o = getopt(argc, argv, "d:h?")) != -1)
|
||
|
switch (o) {
|
||
|
case 'd':
|
||
|
try {
|
||
|
if (std::stoi(optarg) > 0) {
|
||
|
// Debug(1) << "Setting debug level to " << optarg;
|
||
|
Debug::set_debug_level(std::stoi(optarg));
|
||
|
}
|
||
|
}
|
||
|
catch (...) {
|
||
|
std::cout << "Option \"-d\" requires a valid number as an argument\n";
|
||
|
std::exit(EXIT_FAILURE);
|
||
|
}
|
||
|
break;
|
||
|
// case 'g':
|
||
|
// gpx_file = optarg;
|
||
|
// break;
|
||
|
// case 'p':
|
||
|
// use_ocpl = 1;
|
||
|
// break;
|
||
|
// case 'u':
|
||
|
// ocpl_user = optarg;
|
||
|
// break;
|
||
|
// case 'M':
|
||
|
// show_minmax = 1;
|
||
|
// break;
|
||
|
// case 'D':
|
||
|
// show_dist = 1;
|
||
|
// break;
|
||
|
// case 'O':
|
||
|
// show_owners = 1;
|
||
|
// break;
|
||
|
// case 'Y':
|
||
|
// show_types = 1;
|
||
|
// break;
|
||
|
// case 'H':
|
||
|
// heat_file = optarg;
|
||
|
// break;
|
||
|
// case 's':
|
||
|
// try {
|
||
|
// if (std::stoi(optarg) > 0) {
|
||
|
// heat_stamp_size = std::stoi(optarg);
|
||
|
// }
|
||
|
// }
|
||
|
// catch (...) {
|
||
|
// std::cout << "Option \"-s\" requires a valid number as an argument\n";
|
||
|
// std::exit(EXIT_FAILURE);
|
||
|
// }
|
||
|
// break;
|
||
|
// case 'm':
|
||
|
// heat_map = optarg;
|
||
|
// break;
|
||
|
// case 'e':
|
||
|
// heat_exp = 1;
|
||
|
// break;
|
||
|
// case 'L':
|
||
|
// show_list = 1;
|
||
|
// break;
|
||
|
// case 'T':
|
||
|
// show_dt = 1;
|
||
|
// break;
|
||
|
case 'h':
|
||
|
case '?':
|
||
|
default:
|
||
|
std::cout << "Usage: ???\n";
|
||
|
// std::cout << "Generate stats from Opencaching data or GPX files.\n\n";
|
||
|
// std::cout << " * Data source:\n";
|
||
|
// std::cout << "\t-p\tuse Opencaching.pl\n";
|
||
|
// std::cout << "\t-u user\tuser for Opencaching\n";
|
||
|
// std::cout << "\t-g file\tuse specified gpx file\n";
|
||
|
// std::cout << " * Output:\n";
|
||
|
// std::cout << "\t-M\tprint geographically extreme caches\n";
|
||
|
// std::cout << "\t-D\tprint furthest and closest caches\n";
|
||
|
// std::cout << "\t-H file\trender a heat map to a file\n";
|
||
|
// std::cout << "\t-s n\tstamp size for a heat map (default = 15)\n";
|
||
|
// std::cout << "\t-e\tuse exponential to flatten the heat map\n";
|
||
|
// std::cout << "\t-m map\tchosen map: Poland, Poland_relief, Poland_big, Europe or a name of voivodeship (default = Poland)\n";
|
||
|
// std::cout << "\t-L\tprint all caches\n";
|
||
|
// std::cout << "\t-T\tprint D/T matrix\n";
|
||
|
// std::cout << "\t-O\tprint owner count for found caches\n";
|
||
|
// std::cout << "\t-Y\tprint types count for found caches\n";
|
||
|
// std::cout << "\t-h\tdisplay this help screen\n";
|
||
|
// std::exit(EXIT_FAILURE);
|
||
|
}
|
||
|
|
||
|
OCdb db(Database);
|
||
|
db.init(Dump_path);
|
||
|
|
||
|
// std::string ocpl_url = "https://opencaching.pl/okapi/";
|
||
|
// #include "config_user.h"
|
||
|
// Okapi OCpl(ocpl_url, ocpl_key);
|
||
|
// db.update(OCpl);
|
||
|
}
|