![]() |
ACloudViewer
3.9.4
A Modern Library for 3D Data Processing
|
ASCII point cloud I/O filter. More...
#include <AsciiFilter.h>


Public Member Functions | |
| AsciiFilter () | |
| CC_FILE_ERROR | loadFile (const QString &filename, ccHObject &container, LoadParameters ¶meters) 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 ¶meters) override |
| Saves an entity (or a group of) to a file. More... | |
| CC_FILE_ERROR | loadAsciiData (const QByteArray &data, QString sourceName, ccHObject &container, LoadParameters ¶meters) |
| 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 ccHObject * | LoadFromFile (const QString &filename, LoadParameters ¶meters, Shared filter, CC_FILE_ERROR &result) |
| Loads one or more entities from a file with a known filter. More... | |
| static ccHObject * | LoadFromFile (const QString &filename, LoadParameters ¶meters, 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 ¶meters, Shared filter) |
| static CC_FILE_ERROR | SaveToFile (ccHObject *entities, const QString &filename, const SaveParameters ¶meters, 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 FilterContainer & | GetFilters () |
| 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 ¶meters) |
| 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 ¶meters, 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 |
ASCII point cloud I/O filter.
Definition at line 21 of file AsciiFilter.h.
| AsciiFilter::AsciiFilter | ( | ) |
Definition at line 67 of file AsciiFilter.cpp.
References FileIOFilter::BuiltIn, FileIOFilter::Export, GetFileFilter(), and FileIOFilter::Import.
|
overridevirtual |
Returns whether this I/O filter can save the specified type of entity.
| type | entity type |
| multiple | whether the filter can save multiple instances of this entity at once |
| exclusive | whether the filter can only save this type of entity if selected or if it can be mixed with other types |
Reimplemented from FileIOFilter.
Definition at line 75 of file AsciiFilter.cpp.
References CV_TYPES::HIERARCHY_OBJECT, CV_TYPES::POINT_CLOUD, and type.
|
inlinestatic |
Definition at line 26 of file AsciiFilter.h.
Referenced by AsciiFilter(), ccPointListPickingDlg::exportToASCII(), and CommandChangeCloudOutputFormat::process().
| CC_FILE_ERROR AsciiFilter::loadAsciiData | ( | const QByteArray & | data, |
| QString | sourceName, | ||
| ccHObject & | container, | ||
| LoadParameters & | parameters | ||
| ) |
Loads a cloud from a QByteArray.
Definition at line 393 of file AsciiFilter.cpp.
References data, and loadStream().
|
protected |
Loads an ASCII stream with a predefined format.
Definition at line 704 of file AsciiFilter.cpp.
References ecvColor::RgbaTpl< Type >::a, ccHObject::addChild(), ccPointCloud::addNorm(), cc2DLabel::addPickedPoint(), cloudViewer::PointCloudTpl< T >::addPoint(), ccPointCloud::addRGBColor(), cloudAttributesDescriptor::alphaIndex, ecvColor::RgbaTpl< Type >::b, cloudAttributesDescriptor::blueIndex, cloudViewer::PointCloudTpl< T >::capacity(), CC_FERR_CANCELED_BY_USER, CC_FERR_NO_ERROR, CC_FERR_NOT_ENOUGH_MEMORY, CC_MAX_NUMBER_OF_POINTS_PER_CLOUD, cloudViewer::utility::ceil(), cloudAttributesDescriptor::cloud, cc2DLabel::displayPointLegend(), CVLog::Error(), ccHObject::filterChildren(), cloudAttributesDescriptor::fRgbaIndex, Vector3Tpl< PointCoordinateType >::fromArray(), ecvColor::FromRgbaToRgb(), ecvColor::RgbaTpl< Type >::g, cloudAttributesDescriptor::greenIndex, cloudAttributesDescriptor::greyIndex, FileIOFilter::HandleGlobalShift(), cloudAttributesDescriptor::hasFloatRGBColors, cloudAttributesDescriptor::hasNorms, cloudAttributesDescriptor::hasRGBColors, cloudAttributesDescriptor::iRgbaIndex, CV_TYPES::LABEL_2D, cloudAttributesDescriptor::labelIndex, M_PI, ecvColor::MAX, NAN_VALUE, cloudViewer::NormalizedProgress::oneStep(), FileIOFilter::LoadParameters::parentWidget, prepareCloud(), CVLog::PrintDebug(), ecvColor::RgbaTpl< Type >::r, cloudAttributesDescriptor::redIndex, ccPointCloud::reserve(), cloudAttributesDescriptor::reset(), ccPointCloud::resize(), result, cloudAttributesDescriptor::scalarFields, cloudAttributesDescriptor::scalarIndexes, cloudViewer::NormalizedProgress::scale(), ccPointCloud::setCurrentDisplayedScalarField(), cc2DLabel::setDisplayedIn2D(), ccShiftedObject::setGlobalShift(), ccObject::setName(), ccDrawableObject::setVisible(), ccDrawableObject::showSF(), cloudViewer::PointCloudTpl< T >::size(), QtCompat::SkipEmptyParts, CVLog::Warning(), Tuple3Tpl< Type >::x, cloudAttributesDescriptor::xCoordIndex, cloudAttributesDescriptor::xNormIndex, Tuple3Tpl< Type >::y, cloudAttributesDescriptor::yCoordIndex, cloudAttributesDescriptor::yNormIndex, Tuple3Tpl< Type >::z, cloudAttributesDescriptor::zCoordIndex, and cloudAttributesDescriptor::zNormIndex.
Referenced by loadStream().
|
overridevirtual |
Loads one or more entities from a file.
This method must be implemented by children classes.
| filename | file to load |
| container | container to store loaded entities |
| parameters | generic loading parameters |
Reimplemented from FileIOFilter.
Definition at line 377 of file AsciiFilter.cpp.
References CC_FERR_READING, CC_FERR_UNKNOWN_FILE, filename, and loadStream().
|
protected |
Loads an ASCII stream.
Definition at line 402 of file AsciiFilter.cpp.
References FileIOFilter::LoadParameters::alwaysDisplayLoadDialog, CC_FERR_CANCELED_BY_USER, CC_FERR_NO_LOAD, cloudViewer::utility::ceil(), AsciiOpenDlg::CheckOpenSequence(), AsciiOpenDlg::getAverageLineSize(), AsciiOpenDlg::getMaxCloudSize(), AsciiOpenDlg::getOpenSequence(), AsciiOpenDlg::getSeparator(), AsciiOpenDlg::getSkippedLinesCount(), loadCloudFromFormatedAsciiStream(), FileIOFilter::LoadParameters::parentWidget, AsciiOpenDlg::ResetApplyAll(), AsciiOpenDlg::restorePreviousContext(), FileIOFilter::LoadParameters::sessionStart, AsciiOpenDlg::setInput(), AsciiOpenDlg::showLabelsIn2D(), and AsciiOpenDlg::useCommaAsDecimal().
Referenced by loadAsciiData(), and loadFile().
|
static |
Sets whether fields names should be saved in a header line (default is false)
Definition at line 59 of file AsciiFilter.cpp.
References s_saveColumnsNamesHeader.
Referenced by CommandChangeCloudOutputFormat::process().
|
static |
Sets whether the number of points should be saved on the first line (default is false)
Definition at line 63 of file AsciiFilter.cpp.
References s_savePointCountHeader.
Referenced by CommandChangeCloudOutputFormat::process().
|
static |
Sets whether color and SF should be swapped (default is color then SF)
Definition at line 57 of file AsciiFilter.cpp.
References s_saveSFBeforeColor.
Referenced by CommandChangeCloudOutputFormat::process().
|
overridevirtual |
Saves an entity (or a group of) to a file.
This method must be implemented by children classes.
| entity | entity (or group of) to save |
| filename | filename |
| parameters | generic saving parameters |
Reimplemented from FileIOFilter.
Definition at line 91 of file AsciiFilter.cpp.
References AsciiHeaderColumns::A(), AsciiHeaderColumns::Af(), FileIOFilter::SaveParameters::alwaysDisplaySaveDialog, ecvColor::RgbTpl< Type >::b, AsciiHeaderColumns::B(), AsciiHeaderColumns::Bf(), QtCompatRegExpOption::CaseInsensitive, CC_FERR_BAD_ARGUMENT, CC_FERR_CANCELED_BY_USER, CC_FERR_NO_ERROR, CC_FERR_WRITING, AsciiSaveDlg::coordsPrecision(), count, AsciiSaveDlg::enableSaveColumnsNamesHeader(), AsciiSaveDlg::enableSavePointCountHeader(), AsciiSaveDlg::enableSwapColorAndSF(), filename, ecvColor::RgbTpl< Type >::g, AsciiHeaderColumns::G(), ccHObject::getChild(), ccHObject::getChildrenNumber(), ccObject::getName(), cloudViewer::PointCloudTpl< T >::getNumberOfScalarFields(), cloudViewer::GenericIndexedCloud::getPoint(), ccGenericPointCloud::getPointColor(), ccGenericPointCloud::getPointNormal(), cloudViewer::PointCloudTpl< T >::getScalarField(), AsciiSaveDlg::getSeparator(), AsciiSaveDlg::getSeparatorIndex(), AsciiHeaderColumns::Gf(), ccDrawableObject::hasColors(), ccDrawableObject::hasNormals(), CV_TYPES::HIERARCHY_OBJECT, ccObject::isA(), ccObject::isKindOf(), ecvColor::MAX, AsciiHeaderColumns::Nx(), AsciiHeaderColumns::Ny(), AsciiHeaderColumns::Nz(), cloudViewer::NormalizedProgress::oneStep(), FileIOFilter::SaveParameters::parentWidget, cloudViewer::t::geometry::path, CV_TYPES::POINT_CLOUD, CVLog::Print(), ecvColor::RgbTpl< Type >::r, AsciiHeaderColumns::R(), result, AsciiHeaderColumns::Rf(), s_outputCoordPrecision, s_outputSeparatorIndex, s_outputSFPrecision, s_saveColumnsNamesHeader, s_savePointCountHeader, s_saveSFBeforeColor, AsciiSaveDlg::saveAlphaChannel(), AsciiSaveDlg::saveColumnsNamesHeader(), AsciiSaveDlg::saveFloatColors(), AsciiSaveDlg::savePointCountHeader(), AsciiSaveDlg::setCoordsPrecision(), AsciiSaveDlg::setSeparatorIndex(), AsciiSaveDlg::setSfPrecision(), AsciiSaveDlg::sfPrecision(), cloudViewer::GenericCloud::size(), AsciiSaveDlg::swapColorAndSF(), ccHObjectCaster::ToGenericPointCloud(), ccShiftedObject::toGlobal3d(), CVLog::Warning(), Tuple3Tpl< Type >::x, AsciiHeaderColumns::X(), Tuple3Tpl< Type >::y, AsciiHeaderColumns::Y(), Tuple3Tpl< Type >::z, and AsciiHeaderColumns::Z().
|
static |
Sets the default number of skipped lines (at loading time)
Definition at line 43 of file AsciiFilter.cpp.
References count, and s_defaultSkippedLineCount.
Referenced by CommandLoad::process().
|
static |
Sets the default output coords precision (as saving time)
Definition at line 47 of file AsciiFilter.cpp.
References s_outputCoordPrecision.
Referenced by CommandChangeCloudOutputFormat::process().
|
static |
Sets the default output separator (as saving time)
index can be:
Definition at line 53 of file AsciiFilter.cpp.
References s_outputSeparatorIndex.
Referenced by CommandChangeCloudOutputFormat::process().
|
static |
Sets the default output scalar values precision (as saving time)
Definition at line 51 of file AsciiFilter.cpp.
References s_outputSFPrecision.
Referenced by CommandChangeCloudOutputFormat::process().