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

Function main

tools/poly_borders/poly_borders_tool/poly_borders_tool.cpp:19–64  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

17using namespace poly_borders;
18
19int main(int argc, char ** argv)
20{
21 gflags::ParseCommandLineFlags(&argc, &argv, true);
22 gflags::SetUsageMessage(
23 "\n\n\tThe tool is used to process *.poly borders files. We use such files\n"
24 "\tto cut the planet into mwms in generator. The problem is that we have\n"
25 "\tempty spaces between neighbouring borders. This tool creates new borders\n"
26 "\tbased on input data by removing points from borders in such a way that the\n"
27 "\tchanged area of each border will not be too large.\n"
28 "\tArguments:\n"
29 "\t\t--borders_path=/path/to/directory/with/borders\n"
30 "\t\t--output_path=/path/to/directory/where/new/borders/will/be/placed\n");
31
32 if (FLAGS_borders_path.empty() || FLAGS_output_path.empty())
33 {
34 gflags::ShowUsageWithFlags("poly_borders_postprocessor");
35 return 0;
36 }
37
38 CHECK_NOT_EQUAL(FLAGS_borders_path, FLAGS_output_path, ());
39 CHECK(Platform::IsDirectory(FLAGS_borders_path), ("Cannot find directory:", FLAGS_borders_path));
40 CHECK(Platform::IsDirectory(FLAGS_output_path), ("Cannot find directory:", FLAGS_output_path));
41
42 try
43 {
44 BordersData data;
45 data.Init(FLAGS_borders_path);
46 data.RemoveEmptySpaceBetweenBorders();
47 data.PrintDiff();
48 data.DumpPolyFiles(FLAGS_output_path);
49 }
50 catch (RootException const & e)
51 {
52 LOG(LERROR, ("Core exception:", e.Msg()));
53 }
54 catch (std::exception const & e)
55 {
56 LOG(LERROR, ("Std exception:", e.what()));
57 }
58 catch (...)
59 {
60 LOG(LERROR, ("Unknown exception."));
61 }
62
63 return 0;
64}

Callers

nothing calls this directly

Calls 6

PrintDiffMethod · 0.80
DumpPolyFilesMethod · 0.80
emptyMethod · 0.45
InitMethod · 0.45
whatMethod · 0.45

Tested by

no test coverage detected