mirror of
https://codeberg.org/comaps/comaps
synced 2025-12-20 13:23:59 +00:00
Format all C++ and Java code via clang-format
Signed-off-by: Konstantin Pastbin <konstantin.pastbin@gmail.com>
This commit is contained in:
@@ -12,14 +12,18 @@
|
||||
DEFINE_bool(force, false, "Force to regenerate isolines for tiles and countries.");
|
||||
|
||||
// Options for automatic isolines generating mode.
|
||||
DEFINE_string(profiles_path, "", "Automatic isolines generating mode. "
|
||||
"Path to a json file with isolines profiles.");
|
||||
DEFINE_string(countries_to_generate_path, "", "Automatic isolines generating mode. "
|
||||
"Path to a json file with countries to generate.");
|
||||
DEFINE_string(tiles_isolines_out_dir, "", "Automatic isolines generating mode. Path to output "
|
||||
"intermediate directory with tiles isolines.");
|
||||
DEFINE_string(countries_isolines_out_dir, "", "Automatic isolines generating mode. "
|
||||
"Path to output directory with countries isolines.");
|
||||
DEFINE_string(profiles_path, "",
|
||||
"Automatic isolines generating mode. "
|
||||
"Path to a json file with isolines profiles.");
|
||||
DEFINE_string(countries_to_generate_path, "",
|
||||
"Automatic isolines generating mode. "
|
||||
"Path to a json file with countries to generate.");
|
||||
DEFINE_string(tiles_isolines_out_dir, "",
|
||||
"Automatic isolines generating mode. Path to output "
|
||||
"intermediate directory with tiles isolines.");
|
||||
DEFINE_string(countries_isolines_out_dir, "",
|
||||
"Automatic isolines generating mode. "
|
||||
"Path to output directory with countries isolines.");
|
||||
|
||||
// Common option for automatic isolines generating mode and custom packing mode.
|
||||
DEFINE_string(data_dir, "", "Path to data directory.");
|
||||
@@ -34,10 +38,8 @@ DEFINE_string(out_dir, "", "Path to output directory.");
|
||||
DEFINE_uint64(simpl_zoom, 16, "Isolines simplification zoom.");
|
||||
|
||||
// Options for custom isolines packing mode.
|
||||
DEFINE_string(countryId, "",
|
||||
"Custom isolines packing mode. Pack isolines for countryId.");
|
||||
DEFINE_string(isolines_path, "",
|
||||
"Custom isolines packing mode. Path to the directory with isolines tiles.");
|
||||
DEFINE_string(countryId, "", "Custom isolines packing mode. Pack isolines for countryId.");
|
||||
DEFINE_string(isolines_path, "", "Custom isolines packing mode. Path to the directory with isolines tiles.");
|
||||
DEFINE_uint64(max_length, 1000, "Custom isolines packing mode. Isolines max length.");
|
||||
DEFINE_uint64(alt_step_factor, 1, "Custom isolines packing mode. Altitude step factor.");
|
||||
|
||||
@@ -57,40 +59,38 @@ using namespace topography_generator;
|
||||
MAIN_WITH_ERROR_HANDLING([](int argc, char ** argv)
|
||||
{
|
||||
gflags::SetUsageMessage(
|
||||
"\n\nThis tool generates isolines and works in the following modes:\n"
|
||||
"1. Automatic isolines generating mode. Generates a binary file with isolines for each\n"
|
||||
" country id from the countries_to_generate_path. Gets options for isolines generating\n"
|
||||
" from the corresponding to the country profile in profiles_path.\n"
|
||||
" Stores intermediate binary isolines tiles to tiles_isolines_out_dir and result countries\n"
|
||||
" isolines to countries_isolines_out_dir.\n"
|
||||
"2. Custom isolines generating mode. Generates binary tile with isolines for each SRTM tile in the\n"
|
||||
" specified tile rect.\n"
|
||||
" Mode activates by passing a valid tiles rect.\n"
|
||||
" An isoline would be generated for each isolines_step difference in height.\n"
|
||||
" Tiles for lat >= 60 && lat < -60 (converted from ASTER source) can be filtered by\n"
|
||||
" median and/or gaussian filters.\n"
|
||||
" Median filter activates by nonzero filter kernel radius median_r.\n"
|
||||
" Gaussian filter activates by gaussian_st_dev > 0.0 && gaussian_r_factor > 0.0 parameters.\n"
|
||||
" Contours generating steps through altitudes matrix of SRTM tile can be adjusted by\n"
|
||||
" latlon_step_factor parameter.\n"
|
||||
" Isolines simplification activates by nonzero simpl_zoom [1..17]\n"
|
||||
"\n"
|
||||
"3. Custom packing isolines from ready tiles into a binary file for specified country id.\n"
|
||||
" Mode activates by passing a countryId parameter.\n"
|
||||
" Tool gets isolines from the tiles, covered by the country regions, selects\n"
|
||||
" altitude levels with alt_step_factor (if a tile stores altitudes for each 10 meters\n"
|
||||
" and alt_step_factor == 5, the result binary file will store altitudes for each 50 meters).\n"
|
||||
" Isolines cropped by the country regions and cut by max_length parameter.\n"
|
||||
" Isolines simplification activates by nonzero simpl_zoom [1..17]\n\n");
|
||||
"\n\nThis tool generates isolines and works in the following modes:\n"
|
||||
"1. Automatic isolines generating mode. Generates a binary file with isolines for each\n"
|
||||
" country id from the countries_to_generate_path. Gets options for isolines generating\n"
|
||||
" from the corresponding to the country profile in profiles_path.\n"
|
||||
" Stores intermediate binary isolines tiles to tiles_isolines_out_dir and result countries\n"
|
||||
" isolines to countries_isolines_out_dir.\n"
|
||||
"2. Custom isolines generating mode. Generates binary tile with isolines for each SRTM tile in the\n"
|
||||
" specified tile rect.\n"
|
||||
" Mode activates by passing a valid tiles rect.\n"
|
||||
" An isoline would be generated for each isolines_step difference in height.\n"
|
||||
" Tiles for lat >= 60 && lat < -60 (converted from ASTER source) can be filtered by\n"
|
||||
" median and/or gaussian filters.\n"
|
||||
" Median filter activates by nonzero filter kernel radius median_r.\n"
|
||||
" Gaussian filter activates by gaussian_st_dev > 0.0 && gaussian_r_factor > 0.0 parameters.\n"
|
||||
" Contours generating steps through altitudes matrix of SRTM tile can be adjusted by\n"
|
||||
" latlon_step_factor parameter.\n"
|
||||
" Isolines simplification activates by nonzero simpl_zoom [1..17]\n"
|
||||
"\n"
|
||||
"3. Custom packing isolines from ready tiles into a binary file for specified country id.\n"
|
||||
" Mode activates by passing a countryId parameter.\n"
|
||||
" Tool gets isolines from the tiles, covered by the country regions, selects\n"
|
||||
" altitude levels with alt_step_factor (if a tile stores altitudes for each 10 meters\n"
|
||||
" and alt_step_factor == 5, the result binary file will store altitudes for each 50 meters).\n"
|
||||
" Isolines cropped by the country regions and cut by max_length parameter.\n"
|
||||
" Isolines simplification activates by nonzero simpl_zoom [1..17]\n\n");
|
||||
|
||||
gflags::ParseCommandLineFlags(&argc, &argv, true);
|
||||
|
||||
bool isCustomGeneratingMode = false;
|
||||
bool isCustomPackingMode = false;
|
||||
bool const isAutomaticMode = !FLAGS_profiles_path.empty() ||
|
||||
!FLAGS_countries_to_generate_path.empty() ||
|
||||
!FLAGS_tiles_isolines_out_dir.empty() ||
|
||||
!FLAGS_countries_isolines_out_dir.empty();
|
||||
bool const isAutomaticMode = !FLAGS_profiles_path.empty() || !FLAGS_countries_to_generate_path.empty() ||
|
||||
!FLAGS_tiles_isolines_out_dir.empty() || !FLAGS_countries_isolines_out_dir.empty();
|
||||
if (isAutomaticMode)
|
||||
{
|
||||
if (FLAGS_profiles_path.empty() || FLAGS_countries_to_generate_path.empty() ||
|
||||
@@ -110,9 +110,8 @@ MAIN_WITH_ERROR_HANDLING([](int argc, char ** argv)
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
auto const validTilesRect = FLAGS_right > FLAGS_left && FLAGS_top > FLAGS_bottom &&
|
||||
FLAGS_right <= 180 && FLAGS_left >= -180 &&
|
||||
FLAGS_top <= 90 && FLAGS_bottom >= -90;
|
||||
auto const validTilesRect = FLAGS_right > FLAGS_left && FLAGS_top > FLAGS_bottom && FLAGS_right <= 180 &&
|
||||
FLAGS_left >= -180 && FLAGS_top <= 90 && FLAGS_bottom >= -90;
|
||||
|
||||
isCustomGeneratingMode = validTilesRect;
|
||||
isCustomPackingMode = !FLAGS_countryId.empty();
|
||||
@@ -155,8 +154,8 @@ MAIN_WITH_ERROR_HANDLING([](int argc, char ** argv)
|
||||
if (isAutomaticMode)
|
||||
{
|
||||
generator.InitCountryInfoGetter(FLAGS_data_dir);
|
||||
generator.InitProfiles(FLAGS_profiles_path, FLAGS_countries_to_generate_path,
|
||||
FLAGS_tiles_isolines_out_dir, FLAGS_countries_isolines_out_dir);
|
||||
generator.InitProfiles(FLAGS_profiles_path, FLAGS_countries_to_generate_path, FLAGS_tiles_isolines_out_dir,
|
||||
FLAGS_countries_isolines_out_dir);
|
||||
generator.GenerateIsolinesForCountries();
|
||||
generator.PackIsolinesForCountries();
|
||||
|
||||
@@ -188,14 +187,12 @@ MAIN_WITH_ERROR_HANDLING([](int argc, char ** argv)
|
||||
|
||||
TileIsolinesParams params;
|
||||
if (FLAGS_median_r > 0)
|
||||
{
|
||||
params.m_filters.emplace_back(std::make_unique<MedianFilter<Altitude>>(FLAGS_median_r));
|
||||
}
|
||||
|
||||
if (FLAGS_gaussian_st_dev > 0.0 && FLAGS_gaussian_r_factor > 0)
|
||||
{
|
||||
params.m_filters.emplace_back(
|
||||
std::make_unique<GaussianFilter<Altitude>>(FLAGS_gaussian_st_dev, FLAGS_gaussian_r_factor));
|
||||
std::make_unique<GaussianFilter<Altitude>>(FLAGS_gaussian_st_dev, FLAGS_gaussian_r_factor));
|
||||
}
|
||||
|
||||
params.m_outputDir = FLAGS_out_dir;
|
||||
|
||||
Reference in New Issue
Block a user