45 int main(
int argc,
char **argv)
49 bool show_help =
false;
50 string outputFilename(
"");
51 string inputFilename(
"");
65 if(argc == 1) show_help =
true;
66 for(
int i = 1; i < argc && !show_help; i++) {
67 if(strcmp(argv[i],
"--help") == 0 || strcmp(argv[i],
"-help") == 0 ||
68 strcmp(argv[i],
"--usage") == 0 || strcmp(argv[i],
"-usage") == 0 ||
69 strcmp(argv[i],
"-h") == 0
75 cout <<
"Usage: "<<argv[0]<<
" [OPTIONS] <filename.bt>" << endl;
76 cout <<
"\tOPTIONS:" << endl;
77 cout <<
"\t -o <file> Output filename (default: first input filename + .bt)" << endl;
80 cout <<
"\t --offset <x> <y> <z>: add an offset to the octree coordinates (translation)\n";
82 cout <<
"\t --res <resolution>: set ressolution of OcTree to new value\n";
83 cout <<
"\t --scale <scale>: scale octree resolution by a value\n";
87 for(
int i = 1; i < argc; i++) {
89 if(strcmp(argv[i],
"--rotate") == 0) {
93 }
else if(strcmp(argv[i],
"-o") == 0 && i < argc - 1) {
95 outputFilename = argv[i];
97 }
else if (strcmp(argv[i],
"--bb") == 0 && i < argc - 7) {
115 }
else if (strcmp(argv[i],
"--res") == 0 && i < argc - 1) {
120 }
else if (strcmp(argv[i],
"--scale") == 0 && i < argc - 1) {
122 scale = atof(argv[i]);
125 }
else if (strcmp(argv[i],
"--offset") == 0 && i < argc - 4) {
128 offset(0) = (float) atof(argv[i]);
130 offset(1) = (float) atof(argv[i]);
132 offset(2) = (float) atof(argv[i]);
137 }
else if (i == argc-1){
138 inputFilename = string(argv[i]);
142 if (outputFilename ==
""){
143 outputFilename = inputFilename +
".edit.bt";
159 std::cout <<
"Setting new tree resolution: " << res << std::endl;
214 cout <<
"Writing octree to " << outputFilename << endl;
217 OCTOMAP_ERROR(
"Error writing tree to %s\n", outputFilename.c_str());
221 cout <<
"done" << endl << endl;