| 348 | {} |
| 349 | |
| 350 | bool CommandChangeCloudOutputFormat::process(ccCommandLineInterface& cmd) |
| 351 | { |
| 352 | QString defaultExt; |
| 353 | QString fileFilter = getFileFormatFilter(cmd, defaultExt); |
| 354 | if (fileFilter.isEmpty()) |
| 355 | { |
| 356 | return false; |
| 357 | } |
| 358 | |
| 359 | cmd.setCloudExportFormat(fileFilter, defaultExt); |
| 360 | cmd.print(QObject::tr("Output export format (clouds) set to: %1").arg(defaultExt.toUpper())); |
| 361 | |
| 362 | //default options for ASCII output |
| 363 | if (fileFilter == AsciiFilter::GetFileFilter()) |
| 364 | { |
| 365 | AsciiFilter::SetOutputCoordsPrecision(cmd.numericalPrecision()); |
| 366 | AsciiFilter::SetOutputSFPrecision(cmd.numericalPrecision()); |
| 367 | AsciiFilter::SetOutputSeparatorIndex(0); //space |
| 368 | AsciiFilter::SaveSFBeforeColor(false); //default order: point, color, SF, normal |
| 369 | AsciiFilter::SaveColumnsNamesHeader(false); |
| 370 | AsciiFilter::SavePointCountHeader(false); |
| 371 | } |
| 372 | |
| 373 | //look for additional parameters |
| 374 | while (!cmd.arguments().empty()) |
| 375 | { |
| 376 | QString argument = cmd.arguments().front(); |
| 377 | if (ccCommandLineInterface::IsCommand(argument, COMMAND_EXPORT_EXTENSION)) |
| 378 | { |
| 379 | //local option confirmed, we can move on |
| 380 | cmd.arguments().pop_front(); |
| 381 | |
| 382 | if (cmd.arguments().empty()) |
| 383 | { |
| 384 | return cmd.error(QObject::tr("Missing parameter: extension after '%1'").arg(COMMAND_EXPORT_EXTENSION)); |
| 385 | } |
| 386 | |
| 387 | cmd.setCloudExportFormat(cmd.cloudExportFormat(), cmd.arguments().takeFirst()); |
| 388 | cmd.print(QObject::tr("New output extension for clouds: %1").arg(cmd.cloudExportExt())); |
| 389 | } |
| 390 | else if (ccCommandLineInterface::IsCommand(argument, COMMAND_ASCII_EXPORT_PRECISION)) |
| 391 | { |
| 392 | //local option confirmed, we can move on |
| 393 | cmd.arguments().pop_front(); |
| 394 | |
| 395 | if (cmd.arguments().empty()) |
| 396 | { |
| 397 | return cmd.error(QObject::tr("Missing parameter: precision value after '%1'").arg(COMMAND_ASCII_EXPORT_PRECISION)); |
| 398 | } |
| 399 | bool ok; |
| 400 | int precision = cmd.arguments().takeFirst().toInt(&ok); |
| 401 | if (!ok || precision < 0) |
| 402 | { |
| 403 | return cmd.error(QObject::tr("Invalid value for precision! (%1)").arg(COMMAND_ASCII_EXPORT_PRECISION)); |
| 404 | } |
| 405 | |
| 406 | if (fileFilter != AsciiFilter::GetFileFilter()) |
| 407 | { |
nothing calls this directly
no test coverage detected