qCC_io version 2.13.alpha (Qt) - 31 May 2022
CloudCompare standard I/O filters (file readers & writers)
Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
AsciiFilter Class Reference

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

#include <AsciiFilter.h>

Inheritance diagram for AsciiFilter:
Inheritance graph
[legend]
Collaboration diagram for AsciiFilter:
Collaboration graph
[legend]

Public Member Functions

CC_FILE_ERROR loadFile (const QString &filename, ccHObject &container, LoadParameters &parameters) override
 Loads one or more entities from a file. More...
 
bool canSave (CC_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.
 
- Public Member Functions inherited from FileIOFilter
QCC_IO_LIB_API bool importSupported () const
 Returns whether this I/O filter can import files.
 
QCC_IO_LIB_API bool exportSupported () const
 Returns whether this I/O filter can export files.
 
QCC_IO_LIB_API const QStringList & getFileFilters (bool onImport) const
 Returns the file filter(s) for this I/O filter. More...
 
QCC_IO_LIB_API QString getDefaultExtension () const
 Returns the default file extension.
 
virtual CC_FILE_ERROR loadFile (const QString &filename, ccHObject &container, LoadParameters &parameters)
 Loads one or more entities from a file. More...
 
virtual CC_FILE_ERROR saveToFile (ccHObject *entity, const QString &filename, const SaveParameters &parameters)
 Saves an entity (or a group of) to a file. More...
 
virtual bool canSave (CC_CLASS_ENUM type, bool &multiple, bool &exclusive) const
 Returns whether this I/O filter can save the specified type of entity. 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)
 
static void SetOutputCoordsPrecision (int prec)
 Sets the default output coords precision (as saving time)
 
static void SetOutputSFPrecision (int prec)
 Sets the default output scalar values precision (as saving time)
 
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)
 
static void SaveColumnsNamesHeader (bool state)
 Sets whether fields names should be saved in a header line (default is false)
 
static void SavePointCountHeader (bool state)
 Sets whether the number of points should be saved on the first line (default is false)
 
- Static Public Member Functions inherited from FileIOFilter
static QCC_IO_LIB_API QStringList ImportFilterList ()
 
static QCC_IO_LIB_API ccHObject * LoadFromFile (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 QCC_IO_LIB_API ccHObject * LoadFromFile (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 QCC_IO_LIB_API CC_FILE_ERROR SaveToFile (ccHObject *entities, const QString &filename, const SaveParameters &parameters, Shared filter)
 Saves an entity (or a group of) to a specific file thanks to a given filter. More...
 
static QCC_IO_LIB_API CC_FILE_ERROR SaveToFile (ccHObject *entities, const QString &filename, const SaveParameters &parameters, const QString &fileFilter)
 Saves an entity (or a group of) to a specific file thanks to a given filter. More...
 
static QCC_IO_LIB_API bool HandleGlobalShift (const CCVector3d &P, CCVector3d &Pshift, bool &preserveCoordinateShift, LoadParameters &loadParameters, bool useInputCoordinatesShiftIfPossible=false)
 Shortcut to the ccGlobalShiftManager mechanism specific for files. More...
 
static QCC_IO_LIB_API 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 QCC_IO_LIB_API bool CheckForSpecialChars (const QString &filename)
 Returns whether special characters are present in the input string.
 
static QCC_IO_LIB_API void ResetSesionCounter ()
 Indicates to the I/O filters that a new loading/saving session has started (for "Apply all" buttons for instance)
 
static QCC_IO_LIB_API unsigned IncreaseSesionCounter ()
 Indicates to the I/O filters that a new loading/saving action has started. More...
 
static QCC_IO_LIB_API void InitInternalFilters ()
 Init internal filters (should be called once)
 
static QCC_IO_LIB_API void Register (Shared filter)
 Registers a new filter.
 
static QCC_IO_LIB_API Shared GetFilter (const QString &fileFilter, bool onImport)
 Returns the filter corresponding to the given 'file filter'.
 
static QCC_IO_LIB_API Shared FindBestFilterForExtension (const QString &ext)
 Returns the best filter (presumably) to open a given file extension.
 
static QCC_IO_LIB_API const FilterContainerGetFilters ()
 Returns the set of all registered filters.
 
static QCC_IO_LIB_API 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.
 
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.
 
- Protected Member Functions inherited from FileIOFilter
QCC_IO_LIB_API 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.
 
using FilterContainer = std::vector< FileIOFilter::Shared >
 Type of a I/O filters container.
 
- Static Protected Attributes inherited from FileIOFilter
static constexpr float DEFAULT_PRIORITY = 25.0f
 

Detailed Description

ASCII point cloud I/O filter.

Member Function Documentation

◆ canSave()

bool AsciiFilter::canSave ( CC_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.

◆ 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.

◆ 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.

◆ SetOutputSeparatorIndex()

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

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