ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
ccCommandLineParser Class Reference

Command line parser. More...

#include <ecvCommandLineParser.h>

Inheritance diagram for ccCommandLineParser:
Collaboration diagram for ccCommandLineParser:

Public Member Functions

 ~ccCommandLineParser () override
 Destructor. More...
 
QString getExportFilename (const CLEntityDesc &entityDesc, QString extension=QString(), QString suffix=QString(), QString *baseOutputFilename=nullptr, bool forceNoTimestamp=false) const override
 Returns the name of a to-be-exported entity. More...
 
QString exportEntity (CLEntityDesc &entityDesc, const QString &suffix=QString(), QString *baseOutputFilename=nullptr, ccCommandLineInterface::ExportOptions options=ExportOption::NoOptions) override
 Exports a cloud or a mesh. More...
 
void removeClouds (bool onlyLast=false) override
 Removes all clouds (or only the last one ;) More...
 
void removeMeshes (bool onlyLast=false) override
 Removes all meshes (or only the last one ;) More...
 
QStringList & arguments () override
 Returns the list of arguments. More...
 
const QStringList & arguments () const override
 Returns the list of arguments (const version) More...
 
bool registerCommand (Command::Shared command) override
 
QDialog * widgetParent () override
 Returns a (widget) parent (if any is available) More...
 
void print (const QString &message) const override
 
void warning (const QString &message) const override
 
bool error (const QString &message) const override
 
bool saveClouds (QString suffix=QString(), bool allAtOnce=false, const QString *allAtOnceFileName=nullptr) override
 Saves all clouds. More...
 
bool saveMeshes (QString suffix=QString(), bool allAtOnce=false, const QString *allAtOnceFileName=nullptr) override
 Saves all meshes. More...
 
bool importFile (QString filename, const GlobalShiftOptions &globalShiftOptions, FileIOFilter::Shared filter=FileIOFilter::Shared(nullptr)) override
 Loads a file with a specific filter. More...
 
QString cloudExportFormat () const override
 Returns the current cloud(s) export format. More...
 
QString cloudExportExt () const override
 Returns the current cloud(s) export extension (warning: can be anything) More...
 
QString meshExportFormat () const override
 Returns the current mesh(es) export format. More...
 
QString meshExportExt () const override
 Returns the current mesh(es) export extension (warning: can be anything) More...
 
QString hierarchyExportFormat () const override
 Returns the current hierarchy(ies) export format. More...
 
QString hierarchyExportExt () const override
 
void setCloudExportFormat (QString format, QString ext) override
 Sets the current cloud(s) export format and extension. More...
 
void setMeshExportFormat (QString format, QString ext) override
 Sets the current mesh(es) export format and extension. More...
 
void setHierarchyExportFormat (QString format, QString ext) override
 Sets the current hierarchy(ies) export format and extension. More...
 
- Public Member Functions inherited from ccCommandLineInterface
 ccCommandLineInterface ()
 Default constructor. More...
 
virtual ~ccCommandLineInterface ()=default
 
virtual bool registerCommand (Command::Shared command)=0
 Registers a new command. More...
 
virtual ecvProgressDialogprogressDialog ()
 Returns a (shared) progress dialog (if any is available) More...
 
virtual CLLoadParametersfileLoadingParams ()
 File loading parameters. More...
 
virtual std::vector< CLCloudDesc > & clouds ()
 Currently opened point clouds and their filename. More...
 
virtual const std::vector< CLCloudDesc > & clouds () const
 Currently opened point clouds and their filename (const version) More...
 
virtual std::vector< CLMeshDesc > & meshes ()
 Currently opened meshes and their filename. More...
 
virtual const std::vector< CLMeshDesc > & meshes () const
 Currently opened meshes and their filename (const version) More...
 
void toggleSilentMode (bool state)
 Toggles silent mode. More...
 
bool silentMode () const
 Returns the silent mode. More...
 
void toggleAutoSaveMode (bool state)
 
bool autoSaveMode () const
 
void toggleAddTimestamp (bool state)
 
bool addTimestamp () const
 
void setNumericalPrecision (int p)
 Sets the numerical precision. More...
 
int numericalPrecision () const
 Returns the numerical precision. More...
 
bool nextCommandIsGlobalShift () const
 Returns whether the nex command is the '-GLOBAL_SHIFT' option. More...
 
bool processGlobalShiftCommand (GlobalShiftOptions &options)
 

Static Public Member Functions

static int Parse (int nargs, char **args, ccPluginInterfaceList &plugins)
 Parses the input command. More...
 
- Static Public Member Functions inherited from ccCommandLineInterface
static bool IsCommand (const QString &token, const char *command)
 Test whether a command line token is a valid command keyword or not. More...
 

Protected Member Functions

 ccCommandLineParser ()
 Default constructor. More...
 
void registerBuiltInCommands ()
 
void cleanup ()
 
int start (QDialog *parent=0)
 Parses the command line. More...
 

Additional Inherited Members

- Public Types inherited from ccCommandLineInterface
enum class  ExportOption {
  NoOptions = 0x0 , ForceCloud = 0x1 , ForceMesh = 0x2 , ForceHierarchy = 0x4 ,
  ForceNoTimestamp = 0x8
}
 
- Protected Attributes inherited from ccCommandLineInterface
std::vector< CLCloudDescm_clouds
 Currently opened point clouds and their filename. More...
 
std::vector< CLMeshDescm_meshes
 Currently opened meshes and their filename. More...
 
bool m_silentMode
 Silent mode. More...
 
bool m_autoSaveMode
 Whether files should be automatically saved (after each process) or not. More...
 
bool m_addTimestamp
 Whether a timestamp should be automatically added to output files or not. More...
 
int m_precision
 Default numerical precision for ASCII output. More...
 
CLLoadParameters m_loadingParameters
 File loading parameters. More...
 

Detailed Description

Command line parser.

Definition at line 20 of file ecvCommandLineParser.h.

Constructor & Destructor Documentation

◆ ~ccCommandLineParser()

ccCommandLineParser::~ccCommandLineParser ( )
override

Destructor.

Definition at line 147 of file ecvCommandLineParser.cpp.

◆ ccCommandLineParser()

ccCommandLineParser::ccCommandLineParser ( )
protected

Default constructor.

Shouldn't be called by user.

Definition at line 135 of file ecvCommandLineParser.cpp.

Member Function Documentation

◆ arguments() [1/2]

const QStringList& ccCommandLineParser::arguments ( ) const
inlineoverridevirtual

Returns the list of arguments (const version)

Implements ccCommandLineInterface.

Definition at line 42 of file ecvCommandLineParser.h.

◆ arguments() [2/2]

QStringList& ccCommandLineParser::arguments ( )
inlineoverridevirtual

Returns the list of arguments.

Implements ccCommandLineInterface.

Definition at line 41 of file ecvCommandLineParser.h.

◆ cleanup()

void ccCommandLineParser::cleanup ( )
protected

Definition at line 696 of file ecvCommandLineParser.cpp.

References removeClouds(), and removeMeshes().

◆ cloudExportExt()

QString ccCommandLineParser::cloudExportExt ( ) const
inlineoverridevirtual

Returns the current cloud(s) export extension (warning: can be anything)

Implements ccCommandLineInterface.

Definition at line 60 of file ecvCommandLineParser.h.

◆ cloudExportFormat()

QString ccCommandLineParser::cloudExportFormat ( ) const
inlineoverridevirtual

Returns the current cloud(s) export format.

Implements ccCommandLineInterface.

Definition at line 59 of file ecvCommandLineParser.h.

◆ error()

bool ccCommandLineParser::error ( const QString &  message) const
overridevirtual

Implements ccCommandLineInterface.

Definition at line 52 of file ecvCommandLineParser.cpp.

References CVLog::Error().

Referenced by saveClouds(), saveMeshes(), and start().

◆ exportEntity()

◆ getExportFilename()

QString ccCommandLineParser::getExportFilename ( const CLEntityDesc entityDesc,
QString  extension = QString(),
QString  suffix = QString(),
QString *  baseOutputFilename = nullptr,
bool  forceNoTimestamp = false 
) const
overridevirtual

◆ hierarchyExportExt()

QString ccCommandLineParser::hierarchyExportExt ( ) const
inlineoverridevirtual

Returns the current hierarchy(ies) export extension (warning: can be anything)

Implements ccCommandLineInterface.

Definition at line 66 of file ecvCommandLineParser.h.

◆ hierarchyExportFormat()

QString ccCommandLineParser::hierarchyExportFormat ( ) const
inlineoverridevirtual

Returns the current hierarchy(ies) export format.

Implements ccCommandLineInterface.

Definition at line 63 of file ecvCommandLineParser.h.

◆ importFile()

bool ccCommandLineParser::importFile ( QString  filename,
const GlobalShiftOptions globalShiftOptions,
FileIOFilter::Shared  filter = FileIOFilter::Shared(nullptr) 
)
overridevirtual

◆ meshExportExt()

QString ccCommandLineParser::meshExportExt ( ) const
inlineoverridevirtual

Returns the current mesh(es) export extension (warning: can be anything)

Implements ccCommandLineInterface.

Definition at line 62 of file ecvCommandLineParser.h.

◆ meshExportFormat()

QString ccCommandLineParser::meshExportFormat ( ) const
inlineoverridevirtual

Returns the current mesh(es) export format.

Implements ccCommandLineInterface.

Definition at line 61 of file ecvCommandLineParser.h.

◆ Parse()

int ccCommandLineParser::Parse ( int  nargs,
char **  args,
ccPluginInterfaceList plugins 
)
static

Parses the input command.

Definition at line 58 of file ecvCommandLineParser.cpp.

References COMMAND_SILENT_MODE, ecvConsole::Init(), ccCommandLineInterface::IsCommand(), ecvConsole::ReleaseInstance(), and result.

Referenced by main().

◆ print()

void ccCommandLineParser::print ( const QString &  message) const
overridevirtual

Implements ccCommandLineInterface.

Definition at line 44 of file ecvCommandLineParser.cpp.

References CVLog::Print().

Referenced by exportEntity(), importFile(), and start().

◆ registerBuiltInCommands()

void ccCommandLineParser::registerBuiltInCommands ( )
protected

Definition at line 627 of file ecvCommandLineParser.cpp.

References registerCommand().

◆ registerCommand()

bool ccCommandLineParser::registerCommand ( Command::Shared  command)
override

Definition at line 154 of file ecvCommandLineParser.cpp.

References warning().

Referenced by registerBuiltInCommands().

◆ removeClouds()

void ccCommandLineParser::removeClouds ( bool  onlyLast = false)
overridevirtual

Removes all clouds (or only the last one ;)

Implements ccCommandLineInterface.

Definition at line 339 of file ecvCommandLineParser.cpp.

References ccCommandLineInterface::m_clouds.

Referenced by cleanup().

◆ removeMeshes()

void ccCommandLineParser::removeMeshes ( bool  onlyLast = false)
overridevirtual

Removes all meshes (or only the last one ;)

Implements ccCommandLineInterface.

Definition at line 347 of file ecvCommandLineParser.cpp.

References ccCommandLineInterface::m_meshes, and CLMeshDesc::mesh.

Referenced by cleanup().

◆ saveClouds()

bool ccCommandLineParser::saveClouds ( QString  suffix = QString(),
bool  allAtOnce = false,
const QString *  allAtOnceFileName = nullptr 
)
overridevirtual

Saves all clouds.

Parameters
suffixoptional suffix
allAtOncewhether to save all clouds in the same file or one cloud per file
Returns
success

Implements ccCommandLineInterface.

Definition at line 519 of file ecvCommandLineParser.cpp.

References ccHObject::addChild(), ccHObject::DP_NONE, error(), exportEntity(), ccCommandLineInterface::ForceCloud, FileIOFilter::GetFilter(), ccCommandLineInterface::m_clouds, CV_TYPES::POINT_CLOUD, and CommandSave::SetFileDesc().

◆ saveMeshes()

bool ccCommandLineParser::saveMeshes ( QString  suffix = QString(),
bool  allAtOnce = false,
const QString *  allAtOnceFileName = nullptr 
)
overridevirtual

Saves all meshes.

Parameters
suffixoptional suffix
allAtOncewhether to save all meshes in the same file or one mesh per file
Returns
success

Implements ccCommandLineInterface.

Definition at line 574 of file ecvCommandLineParser.cpp.

References ccHObject::addChild(), ccHObject::DP_NONE, error(), exportEntity(), ccCommandLineInterface::ForceMesh, FileIOFilter::GetFilter(), ccCommandLineInterface::m_meshes, CV_TYPES::MESH, and CommandSave::SetFileDesc().

◆ setCloudExportFormat()

void ccCommandLineParser::setCloudExportFormat ( QString  format,
QString  ext 
)
inlineoverridevirtual

Sets the current cloud(s) export format and extension.

Implements ccCommandLineInterface.

Definition at line 67 of file ecvCommandLineParser.h.

References format.

◆ setHierarchyExportFormat()

void ccCommandLineParser::setHierarchyExportFormat ( QString  format,
QString  ext 
)
inlineoverridevirtual

Sets the current hierarchy(ies) export format and extension.

Implements ccCommandLineInterface.

Definition at line 75 of file ecvCommandLineParser.h.

References format.

◆ setMeshExportFormat()

void ccCommandLineParser::setMeshExportFormat ( QString  format,
QString  ext 
)
inlineoverridevirtual

Sets the current mesh(es) export format and extension.

Implements ccCommandLineInterface.

Definition at line 71 of file ecvCommandLineParser.h.

References format.

◆ start()

int ccCommandLineParser::start ( QDialog *  parent = 0)
protected

Parses the command line.

Definition at line 701 of file ecvCommandLineParser.cpp.

References COMMAND_HELP, COMMAND_SILENT_MODE, error(), print(), and warning().

◆ warning()

void ccCommandLineParser::warning ( const QString &  message) const
overridevirtual

Implements ccCommandLineInterface.

Definition at line 48 of file ecvCommandLineParser.cpp.

References CVLog::Warning().

Referenced by getExportFilename(), registerCommand(), and start().

◆ widgetParent()

QDialog* ccCommandLineParser::widgetParent ( )
inlineoverridevirtual

Returns a (widget) parent (if any is available)

Reimplemented from ccCommandLineInterface.

Definition at line 44 of file ecvCommandLineParser.h.


The documentation for this class was generated from the following files: