Encapsulated class to read JSON metadata into memory, and write the JSON metadata associated with the octree root node. This is global information that is not the same as the metadata for the root node. Inherits OutofcoreAbstractMetadata interface for metadata in pcl_outofcore. More...
#include <outofcore_base_data.h>
Public Member Functions | |
virtual std::string | getCoordinateSystem () const |
Get metadata information about the coordinate system. | |
virtual boost::uint64_t | getDepth () const |
virtual std::vector < boost::uint64_t > & | getLODPoints () |
virtual std::vector < boost::uint64_t > | getLODPoints () const |
virtual boost::uint64_t | getLODPoints (const boost::uint64_t &depth_index) const |
Get the number of points at the given depth. | |
boost::filesystem::path | getMetadataFilename () const |
Gets the name of the JSON file. | |
virtual std::string | getOctreeName () |
Returns the name of the tree; this is not the same as the filename. | |
int | getOutofcoreVersion () const |
et the outofcore version read from the "version" field of the JSON object | |
virtual std::string | getPointType () |
virtual int | loadMetadataFromDisk () |
Loads the data from a JSON file located at metadata_filename_. | |
virtual int | loadMetadataFromDisk (const boost::filesystem::path &path_to_metadata) |
Loads the data from a JSON file located at metadata_filename_. | |
OutofcoreOctreeBaseMetadata () | |
Empty constructor. | |
OutofcoreOctreeBaseMetadata (const boost::filesystem::path &path_arg) | |
Load metadata from disk. | |
OutofcoreOctreeBaseMetadata (const OutofcoreOctreeBaseMetadata &orig) | |
Copy constructor. | |
virtual void | serializeMetadataToDisk () |
Writes the data to a JSON file located at metadata_filename_. | |
virtual void | setCoordinateSystem (const std::string &coordinate_system) |
Set information about the coordinate system. | |
virtual void | setDepth (const boost::uint64_t &depth_arg) |
Set the depth of the tree corresponding to JSON "lod:number". This should always be equal to LOD_num_points_.size()-1. | |
virtual void | setLODPoints (const boost::uint64_t &depth) |
Initialize the LOD vector with points all 0. | |
virtual void | setLODPoints (std::vector< boost::uint64_t > &lod_points_arg) |
Copy a vector of LOD points into this metadata (dangerous!) | |
virtual void | setLODPoints (const boost::uint64_t &lod_index_arg, const boost::uint64_t &num_points_arg, const bool increment=true) |
Set the number of points at lod_index_arg manually. | |
void | setMetadataFilename (const boost::filesystem::path &path_to_metadata) |
Sets the name of the JSON file. | |
virtual void | setOctreeName (const std::string &name_arg) |
Sets the name of the tree. | |
void | setOutofcoreVersion (const int version) |
Set the outofcore version stored in the "version" field of the JSON object. | |
virtual void | setPointType (const std::string &point_type_arg) |
Sets a single string identifying the point type of this tree. | |
~OutofcoreOctreeBaseMetadata () | |
Default destructor. | |
Protected Member Functions | |
virtual void | writeMetadataString (std::vector< char > &buf) |
Writes the JSON metadata to a string. | |
Protected Attributes | |
std::string | coordinate_system_ |
Coordinate system; maps to JSON "coord_sys":string. | |
boost::uint64_t | levels_of_depth_ |
Depth of the tree (which is the number of levels of depth); maps to JSON "lod":int. | |
std::vector< boost::uint64_t > | LOD_num_points_ |
Vector of number of points at each LOD. For a tree with no LOD, all fields will be zero except for the field indexed by LOD_points_[levels_of_depth]; maps to JSON "numpts":int array. | |
boost::filesystem::path | metadata_filename_ |
Metadata (JSON) file pathname (octree extension JSON file) | |
int | outofcore_version_ |
Outofcore library version identifier; maps to JSON "version":int. | |
std::string | point_type_ |
Delineates the point types of the field; maps to JSON "pointtype":string: | |
std::string | tree_name_ |
Name of the tree (which could be used, for example, as the name of a layer); maps to JSON "name":string. | |
Friends | |
std::ostream & | operator<< (std::ostream &os, const OutofcoreOctreeBaseMetadata &metadata_arg) |
Provide operator overload to stream ascii file data. |
Encapsulated class to read JSON metadata into memory, and write the JSON metadata associated with the octree root node. This is global information that is not the same as the metadata for the root node. Inherits OutofcoreAbstractMetadata interface for metadata in pcl_outofcore.
This class encapsulates the outofcore base metadata serialization/deserialization. At the time it was written, this depended on cJSON to write JSON objects to disk. This class can be extended to have arbitrary JSON ascii metadata fields saved to the metadata object file on disk. The class has been encapuslated to abstract the detailso of the on-disk format from the outofcore implementation. For example, the format could be changed to XML/YAML, or any dynamic format at some point.
The JSON file is formatted in the following way:
{ "name": "nameoftree", "version": 3, "pointtype": "urp", #(needs to be changed*) "lod": 3, #(depth of the tree "numpts": [X0, X1, X2, ..., XD], #total number of points at each LOD "coord_system": "ECEF" #the tree is not affected by this value }
Any properties not stored in the metadata file are computed when the file is loaded. By convention, and for historical reasons from the original Urban Robotics implementation, the JSON file representing the overall tree is a JSON file named with the ".octree" extension.
Definition at line 97 of file outofcore_base_data.h.
Empty constructor.
Definition at line 55 of file outofcore_base_data.cpp.
pcl::outofcore::OutofcoreOctreeBaseMetadata::OutofcoreOctreeBaseMetadata | ( | const boost::filesystem::path & | path_arg | ) |
Load metadata from disk.
[in] | path_arg | Location of JSON metadata file to load from disk |
Definition at line 68 of file outofcore_base_data.cpp.
Default destructor.
Definition at line 83 of file outofcore_base_data.cpp.
pcl::outofcore::OutofcoreOctreeBaseMetadata::OutofcoreOctreeBaseMetadata | ( | const OutofcoreOctreeBaseMetadata & | orig | ) |
Copy constructor.
Definition at line 90 of file outofcore_base_data.cpp.
std::string pcl::outofcore::OutofcoreOctreeBaseMetadata::getCoordinateSystem | ( | ) | const [virtual] |
Get metadata information about the coordinate system.
Definition at line 349 of file outofcore_base_data.cpp.
boost::uint64_t pcl::outofcore::OutofcoreOctreeBaseMetadata::getDepth | ( | ) | const [virtual] |
Definition at line 363 of file outofcore_base_data.cpp.
std::vector< boost::uint64_t > & pcl::outofcore::OutofcoreOctreeBaseMetadata::getLODPoints | ( | ) | [virtual] |
Definition at line 284 of file outofcore_base_data.cpp.
std::vector< boost::uint64_t > pcl::outofcore::OutofcoreOctreeBaseMetadata::getLODPoints | ( | ) | const [virtual] |
Definition at line 292 of file outofcore_base_data.cpp.
boost::uint64_t pcl::outofcore::OutofcoreOctreeBaseMetadata::getLODPoints | ( | const boost::uint64_t & | depth_index | ) | const [virtual] |
Get the number of points at the given depth.
Definition at line 300 of file outofcore_base_data.cpp.
boost::filesystem::path pcl::outofcore::OutofcoreOctreeBaseMetadata::getMetadataFilename | ( | ) | const |
Gets the name of the JSON file.
Definition at line 122 of file outofcore_base_data.cpp.
Returns the name of the tree; this is not the same as the filename.
Definition at line 252 of file outofcore_base_data.cpp.
et the outofcore version read from the "version" field of the JSON object
Definition at line 106 of file outofcore_base_data.cpp.
Definition at line 268 of file outofcore_base_data.cpp.
int pcl::outofcore::OutofcoreOctreeBaseMetadata::loadMetadataFromDisk | ( | ) | [virtual] |
Loads the data from a JSON file located at metadata_filename_.
Definition at line 175 of file outofcore_base_data.cpp.
int pcl::outofcore::OutofcoreOctreeBaseMetadata::loadMetadataFromDisk | ( | const boost::filesystem::path & | path_to_metadata | ) | [virtual] |
Loads the data from a JSON file located at metadata_filename_.
Implements pcl::outofcore::OutofcoreAbstractMetadata.
Definition at line 243 of file outofcore_base_data.cpp.
void pcl::outofcore::OutofcoreOctreeBaseMetadata::serializeMetadataToDisk | ( | ) | [virtual] |
Writes the data to a JSON file located at metadata_filename_.
Implements pcl::outofcore::OutofcoreAbstractMetadata.
Definition at line 138 of file outofcore_base_data.cpp.
void pcl::outofcore::OutofcoreOctreeBaseMetadata::setCoordinateSystem | ( | const std::string & | coordinate_system | ) | [virtual] |
Set information about the coordinate system.
Definition at line 341 of file outofcore_base_data.cpp.
void pcl::outofcore::OutofcoreOctreeBaseMetadata::setDepth | ( | const boost::uint64_t & | depth_arg | ) | [virtual] |
Set the depth of the tree corresponding to JSON "lod:number". This should always be equal to LOD_num_points_.size()-1.
Definition at line 357 of file outofcore_base_data.cpp.
void pcl::outofcore::OutofcoreOctreeBaseMetadata::setLODPoints | ( | const boost::uint64_t & | depth | ) | [virtual] |
Initialize the LOD vector with points all 0.
Definition at line 308 of file outofcore_base_data.cpp.
void pcl::outofcore::OutofcoreOctreeBaseMetadata::setLODPoints | ( | std::vector< boost::uint64_t > & | lod_points_arg | ) | [virtual] |
Copy a vector of LOD points into this metadata (dangerous!)
Definition at line 318 of file outofcore_base_data.cpp.
void pcl::outofcore::OutofcoreOctreeBaseMetadata::setLODPoints | ( | const boost::uint64_t & | lod_index_arg, |
const boost::uint64_t & | num_points_arg, | ||
const bool | increment = true |
||
) | [virtual] |
Set the number of points at lod_index_arg manually.
[in] | lod_index_arg | the depth at which this increments the number of LOD points |
[in] | num_points_arg | The number of points to store at that LOD |
[in] | increment | If true, increments the number of points at the LOD rather than overwriting the number of points |
Definition at line 328 of file outofcore_base_data.cpp.
void pcl::outofcore::OutofcoreOctreeBaseMetadata::setMetadataFilename | ( | const boost::filesystem::path & | path_to_metadata | ) |
Sets the name of the JSON file.
Definition at line 130 of file outofcore_base_data.cpp.
void pcl::outofcore::OutofcoreOctreeBaseMetadata::setOctreeName | ( | const std::string & | name_arg | ) | [virtual] |
Sets the name of the tree.
Definition at line 260 of file outofcore_base_data.cpp.
void pcl::outofcore::OutofcoreOctreeBaseMetadata::setOutofcoreVersion | ( | const int | version | ) |
Set the outofcore version stored in the "version" field of the JSON object.
Definition at line 114 of file outofcore_base_data.cpp.
void pcl::outofcore::OutofcoreOctreeBaseMetadata::setPointType | ( | const std::string & | point_type_arg | ) | [virtual] |
Sets a single string identifying the point type of this tree.
Definition at line 276 of file outofcore_base_data.cpp.
void pcl::outofcore::OutofcoreOctreeBaseMetadata::writeMetadataString | ( | std::vector< char > & | buf | ) | [protected, virtual] |
Writes the JSON metadata to a string.
Implements pcl::outofcore::OutofcoreAbstractMetadata.
Definition at line 372 of file outofcore_base_data.cpp.
std::ostream& operator<< | ( | std::ostream & | os, |
const OutofcoreOctreeBaseMetadata & | metadata_arg | ||
) | [friend] |
Provide operator overload to stream ascii file data.
Definition at line 381 of file outofcore_base_data.cpp.
Coordinate system; maps to JSON "coord_sys":string.
Definition at line 200 of file outofcore_base_data.h.
boost::uint64_t pcl::outofcore::OutofcoreOctreeBaseMetadata::levels_of_depth_ [protected] |
Depth of the tree (which is the number of levels of depth); maps to JSON "lod":int.
Definition at line 211 of file outofcore_base_data.h.
std::vector<boost::uint64_t> pcl::outofcore::OutofcoreOctreeBaseMetadata::LOD_num_points_ [protected] |
Vector of number of points at each LOD. For a tree with no LOD, all fields will be zero except for the field indexed by LOD_points_[levels_of_depth]; maps to JSON "numpts":int array.
Definition at line 214 of file outofcore_base_data.h.
boost::filesystem::path pcl::outofcore::OutofcoreOctreeBaseMetadata::metadata_filename_ [protected] |
Metadata (JSON) file pathname (octree extension JSON file)
Definition at line 194 of file outofcore_base_data.h.
int pcl::outofcore::OutofcoreOctreeBaseMetadata::outofcore_version_ [protected] |
Outofcore library version identifier; maps to JSON "version":int.
Definition at line 197 of file outofcore_base_data.h.
Delineates the point types of the field; maps to JSON "pointtype":string:
Definition at line 208 of file outofcore_base_data.h.
Name of the tree (which could be used, for example, as the name of a layer); maps to JSON "name":string.
Definition at line 203 of file outofcore_base_data.h.