Main MRPT website > C++ reference for MRPT 1.5.9
Classes | Macros | Typedefs | Enumerations | Functions | Variables
PLY_import_export.cpp File Reference
#include "base-precomp.h"
#include <mrpt/utils/PLY_import_export.h>
#include <mrpt/system/string_utils.h>
#include <stdio.h>
Include dependency graph for PLY_import_export.cpp:

Go to the source code of this file.

Classes

struct  PlyProperty
 
struct  PlyElement
 
struct  PlyFile
 
struct  TVertex
 
struct  TFace
 

Macros

#define PLY_ASCII   1 /* ascii PLY file */
 
#define PLY_BINARY_BE   2 /* binary PLY file, big endian */
 
#define PLY_BINARY_LE   3 /* binary PLY file, little endian */
 
#define BIG_STRING   4096
 

Typedefs

typedef struct PlyProperty PlyProperty
 
typedef struct PlyElement PlyElement
 

Enumerations

enum  {
  PLY_START_TYPE = 0, PLY_CHAR = 1, PLY_SHORT = 2, PLY_INT = 3,
  PLY_UCHAR = 4, PLY_USHORT = 5, PLY_UINT = 6, PLY_FLOAT = 7,
  PLY_DOUBLE = 8, PLY_END_TYPE = 9
}
 

Functions

PlyElementfind_element (PlyFile *, const std::string &s)
 
PlyPropertyfind_property (PlyElement *, const std::string &s, int *)
 
void write_scalar_type (FILE *, int)
 
vector< stringget_words (FILE *, string &)
 
void write_binary_item (FILE *, int, unsigned int, double, int)
 
void write_ascii_item (FILE *, int, unsigned int, double, int)
 
void add_element (PlyFile *, const vector< string > &)
 
void add_property (PlyFile *, const vector< string > &)
 
void add_comment (PlyFile *, const string &)
 
void add_obj_info (PlyFile *, const string &)
 
void copy_property (PlyProperty *, const PlyProperty *)
 
void store_item (char *, int, int, unsigned int, double)
 
void get_stored_item (void *, int, int *, unsigned int *, double *)
 
double get_item_value (const char *, int)
 
void get_ascii_item (const char *, int, int *, unsigned int *, double *)
 
int get_binary_item (FILE *, int, int, int *, unsigned int *, double *)
 
void ascii_get_element (PlyFile *, char *)
 
void binary_get_element (PlyFile *, char *)
 
PlyFileply_write (FILE *fp, const vector< string > &elem_names, int file_type)
 
PlyFileply_open_for_writing (const char *name, const vector< string > &elem_names, int file_type, float *version)
 
void ply_describe_element (PlyFile *plyfile, const string &elem_name, int nelems, vector< PlyProperty > &prop_list)
 
void ply_describe_property (PlyFile *plyfile, const char *elem_name, const PlyProperty *prop)
 
void ply_element_count (PlyFile *plyfile, const string &elem_name, int nelems)
 
void ply_header_complete (PlyFile *plyfile)
 
void ply_put_element_setup (PlyFile *plyfile, const string &elem_name)
 
void ply_put_element (PlyFile *plyfile, void *elem_ptr)
 
void ply_put_comment (PlyFile *plyfile, const string &comment)
 
void ply_put_obj_info (PlyFile *plyfile, const string &obj_info)
 
PlyFileply_read (FILE *fp, vector< string > &elem_names)
 
PlyFileply_open_for_reading (const char *filename, vector< string > &elem_names, int *file_type, float *version)
 
vector< PlyPropertyply_get_element_description (PlyFile *plyfile, const string &elem_name, int &nelems, int &nprops)
 
void ply_get_property (PlyFile *plyfile, const string &elem_name, const PlyProperty *prop)
 
void ply_get_element (PlyFile *plyfile, void *elem_ptr)
 
void ply_get_comments (PlyFile *plyfile, vector< string > &comments)
 
void ply_get_obj_info (PlyFile *plyfile, vector< string > &obj_info)
 
void ply_close (PlyFile *plyfile)
 
void ply_get_info (PlyFile *ply, float *version, int *file_type)
 
double get_item_value (char *item, int type)
 
int get_prop_type (const string &type_name)
 

Variables

const int NO_OTHER_PROPS = -1
 
const char DONT_STORE_PROP = 0
 
const char STORE_PROP = 1
 
const char OTHER_PROP = 0
 
const char NAMED_PROP = 1
 
const std::string type_names []
 
const int ply_type_size []
 
const float VAL_NOT_SET = -1e10
 
const PlyProperty vert_props []
 
const PlyProperty face_props []
 

Macro Definition Documentation

◆ BIG_STRING

#define BIG_STRING   4096

Referenced by get_words().

◆ PLY_ASCII

#define PLY_ASCII   1 /* ascii PLY file */

◆ PLY_BINARY_BE

#define PLY_BINARY_BE   2 /* binary PLY file, big endian */

◆ PLY_BINARY_LE

#define PLY_BINARY_LE   3 /* binary PLY file, little endian */

Typedef Documentation

◆ PlyElement

typedef struct PlyElement PlyElement

◆ PlyProperty

typedef struct PlyProperty PlyProperty

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
PLY_START_TYPE 
PLY_CHAR 
PLY_SHORT 
PLY_INT 
PLY_UCHAR 
PLY_USHORT 
PLY_UINT 
PLY_FLOAT 
PLY_DOUBLE 
PLY_END_TYPE 

Definition at line 69 of file PLY_import_export.cpp.

Function Documentation

◆ add_comment()

void add_comment ( PlyFile plyfile,
const string line 
)

Definition at line 1829 of file PLY_import_export.cpp.

References ply_put_comment(), and mrpt::system::trim().

Referenced by ply_read().

◆ add_element()

void add_element ( PlyFile plyfile,
const vector< string > &  words 
)

Definition at line 1752 of file PLY_import_export.cpp.

References PlyFile::elems, PlyElement::name, and PlyElement::num.

Referenced by ply_read().

◆ add_obj_info()

void add_obj_info ( PlyFile plyfile,
const string line 
)

Definition at line 1844 of file PLY_import_export.cpp.

References ply_put_obj_info(), and mrpt::system::trim().

Referenced by ply_read().

◆ add_property()

void add_property ( PlyFile plyfile,
const vector< string > &  words 
)

◆ ascii_get_element()

void ascii_get_element ( PlyFile plyfile,
char *  elem_ptr 
)

◆ binary_get_element()

void binary_get_element ( PlyFile plyfile,
char *  elem_ptr 
)

◆ copy_property()

void copy_property ( PlyProperty dest,
const PlyProperty src 
)

Definition at line 1855 of file PLY_import_export.cpp.

◆ find_element()

PlyElement * find_element ( PlyFile plyfile,
const std::string s 
)

◆ find_property()

PlyProperty * find_property ( PlyElement elem,
const std::string s,
int *  index 
)

Definition at line 970 of file PLY_import_export.cpp.

References PlyElement::props.

Referenced by ply_get_property().

◆ get_ascii_item()

void get_ascii_item ( const char *  word,
int  type,
int *  int_val,
unsigned int *  uint_val,
double *  double_val 
)

Definition at line 1637 of file PLY_import_export.cpp.

References PLY_CHAR, PLY_DOUBLE, PLY_FLOAT, PLY_INT, PLY_SHORT, PLY_UCHAR, PLY_UINT, and PLY_USHORT.

Referenced by ascii_get_element().

◆ get_binary_item()

int get_binary_item ( FILE *  fp,
int  bin_file_type,
int  type,
int *  int_val,
unsigned int *  uint_val,
double *  double_val 
)

◆ get_item_value() [1/2]

double get_item_value ( const char *  ,
int   
)

◆ get_item_value() [2/2]

double get_item_value ( char *  item,
int  type 
)

◆ get_prop_type()

int get_prop_type ( const string type_name)

Definition at line 1773 of file PLY_import_export.cpp.

References PLY_END_TYPE, PLY_START_TYPE, and type_names.

Referenced by add_property().

◆ get_stored_item()

void get_stored_item ( void ptr,
int  type,
int *  int_val,
unsigned int *  uint_val,
double *  double_val 
)

Definition at line 1463 of file PLY_import_export.cpp.

References PLY_CHAR, PLY_DOUBLE, PLY_FLOAT, PLY_INT, PLY_SHORT, PLY_UCHAR, PLY_UINT, and PLY_USHORT.

Referenced by ply_put_element().

◆ get_words()

vector< string > get_words ( FILE *  fp,
string orig_line 
)

Definition at line 1259 of file PLY_import_export.cpp.

References ASSERT_, BIG_STRING, and mrpt::system::tokenize().

Referenced by ascii_get_element(), and ply_read().

◆ ply_close()

void ply_close ( PlyFile plyfile)

◆ ply_describe_element()

void ply_describe_element ( PlyFile plyfile,
const string elem_name,
int  nelems,
vector< PlyProperty > &  prop_list 
)

◆ ply_describe_property()

void ply_describe_property ( PlyFile plyfile,
const char *  elem_name,
const PlyProperty prop 
)

◆ ply_element_count()

void ply_element_count ( PlyFile plyfile,
const string elem_name,
int  nelems 
)

Definition at line 372 of file PLY_import_export.cpp.

References find_element(), and PlyElement::num.

Referenced by mrpt::utils::PLY_Exporter::saveToPlyFile().

◆ ply_get_comments()

void ply_get_comments ( PlyFile plyfile,
vector< string > &  comments 
)

Definition at line 869 of file PLY_import_export.cpp.

References PlyFile::comments.

Referenced by mrpt::utils::PLY_Importer::loadFromPlyFile().

◆ ply_get_element()

void ply_get_element ( PlyFile plyfile,
void elem_ptr 
)

◆ ply_get_element_description()

vector<PlyProperty> ply_get_element_description ( PlyFile plyfile,
const string elem_name,
int &  nelems,
int &  nprops 
)

◆ ply_get_info()

void ply_get_info ( PlyFile ply,
float *  version,
int *  file_type 
)

Definition at line 926 of file PLY_import_export.cpp.

References PlyFile::file_type, PlyFile::version, and version.

◆ ply_get_obj_info()

void ply_get_obj_info ( PlyFile plyfile,
vector< string > &  obj_info 
)

Definition at line 887 of file PLY_import_export.cpp.

References PlyFile::obj_info.

Referenced by mrpt::utils::PLY_Importer::loadFromPlyFile().

◆ ply_get_property()

void ply_get_property ( PlyFile plyfile,
const string elem_name,
const PlyProperty prop 
)

◆ ply_header_complete()

void ply_header_complete ( PlyFile plyfile)

◆ ply_open_for_reading()

PlyFile* ply_open_for_reading ( const char *  filename,
vector< string > &  elem_names,
int *  file_type,
float *  version 
)

◆ ply_open_for_writing()

PlyFile* ply_open_for_writing ( const char *  name,
const vector< string > &  elem_names,
int  file_type,
float *  version 
)

◆ ply_put_comment()

void ply_put_comment ( PlyFile plyfile,
const string comment 
)

Definition at line 601 of file PLY_import_export.cpp.

References PlyFile::comments.

Referenced by add_comment(), and mrpt::utils::PLY_Exporter::saveToPlyFile().

◆ ply_put_element()

void ply_put_element ( PlyFile plyfile,
void elem_ptr 
)

◆ ply_put_element_setup()

void ply_put_element_setup ( PlyFile plyfile,
const string elem_name 
)

Definition at line 467 of file PLY_import_export.cpp.

References find_element(), and PlyFile::which_elem.

Referenced by mrpt::utils::PLY_Exporter::saveToPlyFile().

◆ ply_put_obj_info()

void ply_put_obj_info ( PlyFile plyfile,
const string obj_info 
)

Definition at line 616 of file PLY_import_export.cpp.

References PlyFile::obj_info.

Referenced by add_obj_info(), and mrpt::utils::PLY_Exporter::saveToPlyFile().

◆ ply_read()

PlyFile* ply_read ( FILE *  fp,
vector< string > &  elem_names 
)

◆ ply_write()

PlyFile* ply_write ( FILE *  fp,
const vector< string > &  elem_names,
int  file_type 
)

Definition at line 219 of file PLY_import_export.cpp.

References PlyFile::elems, PlyFile::file_type, and PlyFile::version.

Referenced by ply_open_for_writing().

◆ store_item()

void store_item ( char *  item,
int  type,
int  int_val,
unsigned int  uint_val,
double  double_val 
)

◆ write_ascii_item()

void write_ascii_item ( FILE *  fp,
int  int_val,
unsigned int  uint_val,
double  double_val,
int  type 
)

◆ write_binary_item()

void write_binary_item ( FILE *  fp,
int  int_val,
unsigned int  uint_val,
double  double_val,
int  type 
)

Definition at line 1357 of file PLY_import_export.cpp.

References PLY_CHAR, PLY_DOUBLE, PLY_FLOAT, PLY_INT, PLY_SHORT, PLY_UCHAR, PLY_UINT, and PLY_USHORT.

Referenced by ply_put_element().

◆ write_scalar_type()

void write_scalar_type ( FILE *  fp,
int  code 
)

Definition at line 1231 of file PLY_import_export.cpp.

References mrpt::system::os::fprintf(), PLY_END_TYPE, and type_names.

Referenced by ply_header_complete().

Variable Documentation

◆ DONT_STORE_PROP

const char DONT_STORE_PROP = 0

Definition at line 88 of file PLY_import_export.cpp.

Referenced by ply_read().

◆ face_props

const PlyProperty face_props[]
Initial value:
= {
{"intensity", PLY_FLOAT, PLY_FLOAT, offsetof(TFace,intensity), 0, 0, 0, 0},
{"vertex_indices", PLY_INT, PLY_INT, offsetof(TFace,verts), 1, PLY_UCHAR, PLY_UCHAR, offsetof(TFace,nverts)}
}
#define offsetof(_structure, _field)
Definition: util.h:55

Definition at line 1884 of file PLY_import_export.cpp.

Referenced by mrpt::utils::PLY_Exporter::saveToPlyFile().

◆ NAMED_PROP

const char NAMED_PROP = 1

Definition at line 92 of file PLY_import_export.cpp.

Referenced by ply_describe_element(), and ply_describe_property().

◆ NO_OTHER_PROPS

const int NO_OTHER_PROPS = -1

Definition at line 86 of file PLY_import_export.cpp.

Referenced by ascii_get_element(), binary_get_element(), and ply_read().

◆ OTHER_PROP

const char OTHER_PROP = 0

Definition at line 91 of file PLY_import_export.cpp.

Referenced by ply_put_element().

◆ ply_type_size

const int ply_type_size[]
Initial value:
= {
0, 1, 2, 4, 1, 2, 4, 4, 8
}

Definition at line 153 of file PLY_import_export.cpp.

Referenced by ascii_get_element(), binary_get_element(), and ply_put_element().

◆ STORE_PROP

const char STORE_PROP = 1

Definition at line 89 of file PLY_import_export.cpp.

Referenced by ply_get_property().

◆ type_names

const std::string type_names[]
Initial value:
= {
string("invalid"),
string("char"), string("short"), string("int"),
string("uchar"), string("ushort"), string("uint"),
string("float"), string("double"),
}
GLsizei const GLchar ** string
Definition: glext.h:3919

Definition at line 147 of file PLY_import_export.cpp.

Referenced by get_prop_type(), and write_scalar_type().

◆ VAL_NOT_SET

const float VAL_NOT_SET = -1e10

Definition at line 1860 of file PLY_import_export.cpp.

Referenced by mrpt::utils::PLY_Importer::loadFromPlyFile().

◆ vert_props

const PlyProperty vert_props[]
Initial value:
= {
{"x", PLY_FLOAT, PLY_FLOAT, offsetof(TVertex,x), 0 , 0 , 0 , 0},
{"y", PLY_FLOAT, PLY_FLOAT, offsetof(TVertex,y), 0 , 0 , 0 , 0},
{"z", PLY_FLOAT, PLY_FLOAT, offsetof(TVertex,z), 0 , 0 , 0 , 0},
{"intensity", PLY_FLOAT, PLY_FLOAT, offsetof(TVertex,intensity), 0 , 0 , 0 , 0}
}
#define offsetof(_structure, _field)
Definition: util.h:55
GLdouble GLdouble z
Definition: glext.h:3734
GLenum GLint GLint y
Definition: glext.h:3516
GLenum GLint x
Definition: glext.h:3516

Definition at line 1869 of file PLY_import_export.cpp.

Referenced by mrpt::utils::PLY_Importer::loadFromPlyFile(), and mrpt::utils::PLY_Exporter::saveToPlyFile().




Page generated by Doxygen 1.8.14 for MRPT 1.5.9 Git: 690a4699f Wed Apr 15 19:29:53 2020 +0200 at miƩ abr 15 19:30:12 CEST 2020