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

ASCII point cloud I/O filter. More...

#include <AsciiFilter.h>

Inheritance diagram for AsciiFilter:
Collaboration diagram for AsciiFilter:

Public Member Functions

 AsciiFilter ()
 
CC_FILE_ERROR loadFile (const QString &filename, ccHObject &container, LoadParameters &parameters) override
 Loads one or more entities from a file. More...
 
bool canSave (CV_CLASS_ENUM type, bool &multiple, bool &exclusive) const override
 Returns whether this I/O filter can save the specified type of entity. More...
 
CC_FILE_ERROR saveToFile (ccHObject *entity, const QString &filename, const SaveParameters &parameters) override
 Saves an entity (or a group of) to a file. More...
 
CC_FILE_ERROR loadAsciiData (const QByteArray &data, QString sourceName, ccHObject &container, LoadParameters &parameters)
 Loads a cloud from a QByteArray. More...
 
- Public Member Functions inherited from FileIOFilter
virtual ~FileIOFilter ()=default
 
bool importSupported () const
 Returns whether this I/O filter can import files. More...
 
bool exportSupported () const
 Returns whether this I/O filter can export files. More...
 
const QStringList & getFileFilters (bool onImport) const
 Returns the file filter(s) for this I/O filter. More...
 
QString getDefaultExtension () const
 Returns the default file extension. More...
 
virtual void unregister ()
 Called when the filter is unregistered. More...
 

Static Public Member Functions

static QString GetFileFilter ()
 
static void SetDefaultSkippedLineCount (int count)
 Sets the default number of skipped lines (at loading time) More...
 
static void SetOutputCoordsPrecision (int prec)
 Sets the default output coords precision (as saving time) More...
 
static void SetOutputSFPrecision (int prec)
 Sets the default output scalar values precision (as saving time) More...
 
static void SetOutputSeparatorIndex (int separatorIndex)
 Sets the default output separator (as saving time) More...
 
static void SaveSFBeforeColor (bool state)
 Sets whether color and SF should be swapped (default is color then SF) More...
 
static void SaveColumnsNamesHeader (bool state)
 
static void SavePointCountHeader (bool state)
 
- Static Public Member Functions inherited from FileIOFilter
static QStringList ImportFilterList ()
 
static ccHObjectLoadFromFile (const QString &filename, LoadParameters &parameters, Shared filter, CC_FILE_ERROR &result)
 Loads one or more entities from a file with a known filter. More...
 
static ccHObjectLoadFromFile (const QString &filename, LoadParameters &parameters, CC_FILE_ERROR &result, const QString &fileFilter=QString())
 Loads one or more entities from a file with known type. More...
 
static CC_FILE_ERROR SaveToFile (ccHObject *entities, const QString &filename, const SaveParameters &parameters, Shared filter)
 
static CC_FILE_ERROR SaveToFile (ccHObject *entities, const QString &filename, const SaveParameters &parameters, const QString &fileFilter)
 
static bool HandleGlobalShift (const CCVector3d &P, CCVector3d &Pshift, bool &preserveCoordinateShift, LoadParameters &loadParameters, bool useInputCoordinatesShiftIfPossible=false)
 Shortcut to the ecvGlobalShiftManager mechanism specific for files. More...
 
static void DisplayErrorMessage (CC_FILE_ERROR err, const QString &action, const QString &filename)
 Displays (to console) the message corresponding to a given error code. More...
 
static bool CheckForSpecialChars (const QString &filename)
 Returns whether special characters are present in the input string. More...
 
static void ResetSesionCounter ()
 
static unsigned IncreaseSesionCounter ()
 
static void Register (Shared filter)
 Registers a new filter. More...
 
static Shared GetFilter (const QString &fileFilter, bool onImport)
 Returns the filter corresponding to the given 'file filter'. More...
 
static Shared FindBestFilterForExtension (const QString &ext)
 Returns the best filter (presumably) to open a given file extension. More...
 
static const FilterContainerGetFilters ()
 Returns the set of all registered filters. More...
 
static void UnregisterAll ()
 Unregisters all filters. More...
 

Protected Member Functions

CC_FILE_ERROR loadStream (QTextStream &stream, QString filenameOrTitle, qint64 dataSize, ccHObject &container, LoadParameters &parameters)
 Loads an ASCII stream. More...
 
CC_FILE_ERROR loadCloudFromFormatedAsciiStream (QTextStream &stream, QString filenameOrTitle, ccHObject &container, const AsciiOpenDlg::Sequence &openSequence, char separator, bool commaAsDecimal, unsigned approximateNumberOfLines, qint64 fileSize, unsigned maxCloudSize, unsigned skipLines, LoadParameters &parameters, bool showLabelsIn2D=false)
 Loads an ASCII stream with a predefined format. More...
 
- Protected Member Functions inherited from FileIOFilter
 FileIOFilter (const FilterInfo &info)
 
void setImportExtensions (const QStringList &extensions)
 
void setImportFileFilterStrings (const QStringList &filterStrings)
 
void setExportFileFilterStrings (const QStringList &filterStrings)
 

Additional Inherited Members

- Public Types inherited from FileIOFilter
enum  FilterFeature {
  NoFeatures = 0x0000 , Import = 0x00001 , Export = 0x0002 , BuiltIn = 0x0004 ,
  DynamicInfo = 0x0008
}
 
using Shared = QSharedPointer< FileIOFilter >
 Shared type. More...
 
using FilterContainer = std::vector< FileIOFilter::Shared >
 Type of a I/O filters container. More...
 
- Static Protected Attributes inherited from FileIOFilter
static constexpr float DEFAULT_PRIORITY = 25.0f
 

Detailed Description

ASCII point cloud I/O filter.

Definition at line 21 of file AsciiFilter.h.

Constructor & Destructor Documentation

◆ AsciiFilter()

AsciiFilter::AsciiFilter ( )

Member Function Documentation

◆ canSave()

bool AsciiFilter::canSave ( CV_CLASS_ENUM  type,
bool &  multiple,
bool &  exclusive 
) const
overridevirtual

Returns whether this I/O filter can save the specified type of entity.

Parameters
typeentity type
multiplewhether the filter can save multiple instances of this entity at once
exclusivewhether the filter can only save this type of entity if selected or if it can be mixed with other types
Returns
whether the entity type can be saved

Reimplemented from FileIOFilter.

◆ GetFileFilter()

static QString AsciiFilter::GetFileFilter ( )
inlinestatic

◆ loadAsciiData()

CC_FILE_ERROR AsciiFilter::loadAsciiData ( const QByteArray &  data,
QString  sourceName,
ccHObject container,
LoadParameters parameters 
)

Loads a cloud from a QByteArray.

◆ loadCloudFromFormatedAsciiStream()

CC_FILE_ERROR AsciiFilter::loadCloudFromFormatedAsciiStream ( QTextStream &  stream,
QString  filenameOrTitle,
ccHObject container,
const AsciiOpenDlg::Sequence openSequence,
char  separator,
bool  commaAsDecimal,
unsigned  approximateNumberOfLines,
qint64  fileSize,
unsigned  maxCloudSize,
unsigned  skipLines,
LoadParameters parameters,
bool  showLabelsIn2D = false 
)
protected

Loads an ASCII stream with a predefined format.

◆ loadFile()

CC_FILE_ERROR AsciiFilter::loadFile ( const QString &  filename,
ccHObject container,
LoadParameters parameters 
)
overridevirtual

Loads one or more entities from a file.

This method must be implemented by children classes.

Parameters
filenamefile to load
containercontainer to store loaded entities
parametersgeneric loading parameters
Returns
error

Reimplemented from FileIOFilter.

◆ loadStream()

CC_FILE_ERROR AsciiFilter::loadStream ( QTextStream &  stream,
QString  filenameOrTitle,
qint64  dataSize,
ccHObject container,
LoadParameters parameters 
)
protected

Loads an ASCII stream.

◆ SaveColumnsNamesHeader()

static void AsciiFilter::SaveColumnsNamesHeader ( bool  state)
static

Sets whether fields names should be saved in a header line (default is false)

Referenced by CommandChangeCloudOutputFormat::process().

◆ SavePointCountHeader()

static void AsciiFilter::SavePointCountHeader ( bool  state)
static

Sets whether the number of points should be saved on the first line (default is false)

Referenced by CommandChangeCloudOutputFormat::process().

◆ SaveSFBeforeColor()

static void AsciiFilter::SaveSFBeforeColor ( bool  state)
static

Sets whether color and SF should be swapped (default is color then SF)

Referenced by CommandChangeCloudOutputFormat::process().

◆ saveToFile()

CC_FILE_ERROR AsciiFilter::saveToFile ( ccHObject entity,
const QString &  filename,
const SaveParameters parameters 
)
overridevirtual

Saves an entity (or a group of) to a file.

This method must be implemented by children classes.

Parameters
entityentity (or group of) to save
filenamefilename
parametersgeneric saving parameters
Returns
error

Reimplemented from FileIOFilter.

◆ SetDefaultSkippedLineCount()

static void AsciiFilter::SetDefaultSkippedLineCount ( int  count)
static

Sets the default number of skipped lines (at loading time)

Referenced by CommandLoad::process().

◆ SetOutputCoordsPrecision()

static void AsciiFilter::SetOutputCoordsPrecision ( int  prec)
static

Sets the default output coords precision (as saving time)

Referenced by CommandChangeCloudOutputFormat::process().

◆ SetOutputSeparatorIndex()

static void AsciiFilter::SetOutputSeparatorIndex ( int  separatorIndex)
static

Sets the default output separator (as saving time)

index can be:

  • 0: space
  • 1: comma
  • 2: semicolon
  • 3: tab

Referenced by CommandChangeCloudOutputFormat::process().

◆ SetOutputSFPrecision()

static void AsciiFilter::SetOutputSFPrecision ( int  prec)
static

Sets the default output scalar values precision (as saving time)

Referenced by CommandChangeCloudOutputFormat::process().


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