|
MorphoGraphX
2.0-1-227
|
#include <PlyFile.hpp>
Classes | |
| class | Element |
| class | Property |
Public Types | |
| enum | TYPE { CHAR, UCHAR, SHORT, USHORT, INT, UINT, FLOAT, DOUBLE, NB_TYPES, INVALID_TYPE } |
| Enumeration for the possible types of the properties. More... | |
| enum | FORMAT_TYPES { UNSPECIFIED_FORMAT, ASCII, BINARY_LITTLE_ENDIAN, BINARY_BIG_ENDIAN } |
| Enumeration of the possible file formats. More... | |
Public Member Functions | |
| PlyFile () | |
| Create a new file. More... | |
| void | clear () |
| Remove any element from the file, and reset version number and format. More... | |
| bool | init (FORMAT_TYPES format=BINARY_LITTLE_ENDIAN, const QString &version="1.0") |
| Initialize the file with a format and a version. More... | |
| bool | validate () |
| Validate the content. More... | |
| void | allocate () |
| Allocate all the properties of all the element in the file. More... | |
| FORMAT_TYPES | format () const |
| Format of the file. More... | |
| bool | setFormat (FORMAT_TYPES f) |
| Set the file format, checking the validity of the argument. More... | |
| bool | setVersion (QString version) |
| Set the format version, checking it's validity. More... | |
| const QString & | version () const |
| Version fo the format. More... | |
| Element * | element (size_t idx) |
| Access an element by index. More... | |
| const Element * | element (size_t idx) const |
| Access an element by index. More... | |
| Element * | element (const QString &name) |
| Access an element by name. More... | |
| const Element * | element (const QString &name) const |
| Access an element by name. More... | |
| Element * | createElement (const QString &name, size_t nb_elements) |
Create a element name with nb_elements items. More... | |
| Element * | currentElement () |
| Get the current element (i.e. More... | |
| bool | hasElement (const QString &name) const |
Check if the element name exists. More... | |
| size_t | nbElements () const |
| Return the number of elements in the file. More... | |
| bool | attach (Element *el) |
| Attach an element to the file. More... | |
| bool | detach (Element *el) |
| Detach an element from the file. More... | |
| bool | parseHeader (const QString &filename) |
| Parse the head of a PLY file. More... | |
| bool | parseContent () |
| Parse the content of the current file. More... | |
| bool | error (const QString err) const |
| Write the error on standard out, possibly with file and line number if they have been specified. More... | |
| bool | save (const QString &filename) const |
Save the file to filename. More... | |
| qint64 | contentPosition () const |
| Get the position of the content in a file. More... | |
| bool | isValid () const |
| Check if the last call to PlyFile::validate was successful of not. More... | |
| operator bool () const | |
| Check if the last call to PlyFile::validate was successful of not. More... | |
| const QStringList & | comments () const |
| See the comments currently defined. More... | |
| void | addComment (QString line) |
| Add a comment. More... | |
| void | clearComments () |
| Remove all comments. More... | |
| void | _attach (Element *el) |
| void | _detach (Element *el) |
Static Public Attributes | |
| static const unsigned int | typeSizes [NB_TYPES] |
| Array holding the size in byte of the various types. More... | |
| static char const *const | typeNames [NB_TYPES+1][3] |
| Array of C-string representation of the types. More... | |
| static char const *const | formatNames [4] |
| Array of C-string representation of the formats. More... | |
Protected Member Functions | |
| bool | parseAsciiContent (QFile &f) |
| bool | parseBinaryContent (QFile &f, bool little_endian) |
| bool | readFormat (const QStringList &fields) |
| bool | readElement (const QStringList &fields) |
| bool | readProperty (const QStringList &fields) |
| bool | writeHeader (QFile &f) const |
| bool | writeAsciiContent (QFile &f) const |
| bool | writeBinaryContent (QFile &f, bool little_endian) const |
| TYPE | parseType (QString typeName) const |
Protected Attributes | |
| QList< Element * > | _elements |
| QHash< QString, int > | _element_map |
| Element * | current_element |
| QString | filename |
| int | line_nb |
| FORMAT_TYPES | _format |
| QString | _version |
| QStringList | _comments |
| int | _version_major |
| int | _version_minor |
| bool | is_valid |
| qint64 | _contentPosition |
Class representing the content of a PLY file.
A PLY file is a collection of elements, with a format and a version number (that currently should be 1.0).
Each element has a name, that must be unique in the file, a size (i.e. how many items they contain), and a set of properties, shared by the elements.
Each property has:
Definition at line 64 of file PlyFile.hpp.
Enumeration of the possible file formats.
Definition at line 99 of file PlyFile.hpp.
| enum mgx::PlyFile::TYPE |
Enumeration for the possible types of the properties.
Definition at line 68 of file PlyFile.hpp.
| mgx::PlyFile::PlyFile | ( | ) |
Create a new file.
| void mgx::PlyFile::_attach | ( | Element * | el | ) |
| void mgx::PlyFile::_detach | ( | Element * | el | ) |
| void mgx::PlyFile::addComment | ( | QString | line | ) |
Add a comment.
If the line contains new lines, it will be split
| void mgx::PlyFile::allocate | ( | ) |
Allocate all the properties of all the element in the file.
| bool mgx::PlyFile::attach | ( | Element * | el | ) |
Attach an element to the file.
| void mgx::PlyFile::clear | ( | ) |
Remove any element from the file, and reset version number and format.
|
inline |
Remove all comments.
Definition at line 677 of file PlyFile.hpp.
|
inline |
See the comments currently defined.
Definition at line 663 of file PlyFile.hpp.
|
inline |
Get the position of the content in a file.
This is set by PlyFile::parseHeader
Definition at line 645 of file PlyFile.hpp.
| Element* mgx::PlyFile::createElement | ( | const QString & | name, |
| size_t | nb_elements | ||
| ) |
Create a element name with nb_elements items.
|
inline |
Get the current element (i.e.
the last one created with createElement
Definition at line 589 of file PlyFile.hpp.
| bool mgx::PlyFile::detach | ( | Element * | el | ) |
Detach an element from the file.
| Element* mgx::PlyFile::element | ( | const QString & | name | ) |
Access an element by name.
| const Element* mgx::PlyFile::element | ( | const QString & | name | ) | const |
Access an element by name.
| Element* mgx::PlyFile::element | ( | size_t | idx | ) |
Access an element by index.
| const Element* mgx::PlyFile::element | ( | size_t | idx | ) | const |
Access an element by index.
| bool mgx::PlyFile::error | ( | const QString | err | ) | const |
Write the error on standard out, possibly with file and line number if they have been specified.
Then, returns false.
|
inline |
Format of the file.
Definition at line 539 of file PlyFile.hpp.
| bool mgx::PlyFile::hasElement | ( | const QString & | name | ) | const |
Check if the element name exists.
| bool mgx::PlyFile::init | ( | FORMAT_TYPES | format = BINARY_LITTLE_ENDIAN, |
| const QString & | version = "1.0" |
||
| ) |
Initialize the file with a format and a version.
|
inline |
Check if the last call to PlyFile::validate was successful of not.
Definition at line 652 of file PlyFile.hpp.
|
inline |
Return the number of elements in the file.
Definition at line 600 of file PlyFile.hpp.
|
inline |
Check if the last call to PlyFile::validate was successful of not.
Definition at line 658 of file PlyFile.hpp.
|
protected |
|
protected |
| bool mgx::PlyFile::parseContent | ( | ) |
Parse the content of the current file.
The file's header must have been parsed. This gives the user the opportunity to change the memory type of the properties before reading. Also, any property with a INVALID_TYPE memory type will be skipped instead of read.
| bool mgx::PlyFile::parseHeader | ( | const QString & | filename | ) |
Parse the head of a PLY file.
|
protected |
|
protected |
|
protected |
|
protected |
| bool mgx::PlyFile::save | ( | const QString & | filename | ) | const |
Save the file to filename.
|
inline |
Set the file format, checking the validity of the argument.
Definition at line 545 of file PlyFile.hpp.
| bool mgx::PlyFile::setVersion | ( | QString | version | ) |
Set the format version, checking it's validity.
| bool mgx::PlyFile::validate | ( | ) |
Validate the content.
This must be called before writing
|
inline |
Version fo the format.
Definition at line 561 of file PlyFile.hpp.
|
protected |
|
protected |
|
protected |
|
protected |
Definition at line 716 of file PlyFile.hpp.
|
protected |
Definition at line 719 of file PlyFile.hpp.
|
protected |
Definition at line 707 of file PlyFile.hpp.
|
protected |
Definition at line 706 of file PlyFile.hpp.
|
protected |
Definition at line 714 of file PlyFile.hpp.
|
protected |
Definition at line 715 of file PlyFile.hpp.
|
protected |
Definition at line 717 of file PlyFile.hpp.
|
protected |
Definition at line 717 of file PlyFile.hpp.
|
protected |
Definition at line 709 of file PlyFile.hpp.
|
protected |
Definition at line 711 of file PlyFile.hpp.
|
static |
Array of C-string representation of the formats.
Definition at line 109 of file PlyFile.hpp.
|
protected |
Definition at line 718 of file PlyFile.hpp.
|
protected |
Definition at line 712 of file PlyFile.hpp.
|
static |
Array of C-string representation of the types.
Definition at line 94 of file PlyFile.hpp.
|
static |
Array holding the size in byte of the various types.
Definition at line 90 of file PlyFile.hpp.
1.8.17