libLAS API Reference  1.8.1
Public Types | Public Member Functions | Static Public Attributes | List of all members
liblas::Header Class Reference

Definition of public header block. More...

#include <header.hpp>

Collaboration diagram for liblas::Header:
Collaboration graph

Public Types

typedef std::vector< uint32_t > RecordsByReturnArray
 Array of 5 elements - numbers of points recorded by each return. More...
 

Public Member Functions

 Header ()
 Default constructor. More...
 
 Header (Header const &other)
 Copy constructor. More...
 
Headeroperator= (Header const &rhs)
 Assignment operator. More...
 
bool operator== (const Header &other) const
 Comparison operator. More...
 
std::string GetFileSignature () const
 Get ASPRS LAS file signature. More...
 
void SetFileSignature (std::string const &v)
 Set ASPRS LAS file signature. More...
 
uint16_t GetFileSourceId () const
 Get file source identifier. More...
 
void SetFileSourceId (uint16_t v)
 Set file source identifier. More...
 
uint16_t GetReserved () const
 Get value field reserved by the ASPRS LAS Specification. More...
 
void SetReserved (uint16_t v)
 Set reserved value for the header identifier. More...
 
boost::uuids::uuid GetProjectId () const
 Get project identifier. More...
 
void SetProjectId (boost::uuids::uuid const &v)
 Set project identifier. More...
 
uint8_t GetVersionMajor () const
 Get major component of version of LAS format. More...
 
void SetVersionMajor (uint8_t v)
 Set major component of version of LAS format. More...
 
uint8_t GetVersionMinor () const
 Get minor component of version of LAS format. More...
 
void SetVersionMinor (uint8_t v)
 Set minor component of version of LAS format. More...
 
std::string GetSystemId (bool pad=false) const
 Get system identifier. More...
 
void SetSystemId (std::string const &v)
 Set system identifier. More...
 
std::string GetSoftwareId (bool pad=false) const
 Get software identifier. More...
 
void SetSoftwareId (std::string const &v)
 Set software identifier. More...
 
uint16_t GetCreationDOY () const
 Get day of year of file creation date. More...
 
void SetCreationDOY (uint16_t v)
 Set day of year of file creation date. More...
 
uint16_t GetCreationYear () const
 Set year of file creation date. More...
 
void SetCreationYear (uint16_t v)
 Get year of file creation date. More...
 
uint16_t GetHeaderSize () const
 Get number of bytes of generic verion of public header block storage. More...
 
void SetHeaderSize (uint16_t v)
 Sets the header size. More...
 
uint32_t GetDataOffset () const
 Get number of bytes from the beginning to the first point record. More...
 
void SetDataOffset (uint32_t v)
 Set number of bytes from the beginning to the first point record. More...
 
uint32_t GetHeaderPadding () const
 Get number of bytes from the end of the VLRs to the GetDataOffset. More...
 
void SetHeaderPadding (uint32_t v)
 Set the number of bytes from the end of the VLRs in the header to the beginning of point data. More...
 
uint32_t GetRecordsCount () const
 Get number of variable-length records. More...
 
void SetRecordsCount (uint32_t v)
 Set number of variable-length records. More...
 
PointFormatName GetDataFormatId () const
 Get identifier of point data (record) format. More...
 
void SetDataFormatId (PointFormatName v)
 Set identifier of point data (record) format. More...
 
uint16_t GetDataRecordLength () const
 The length in bytes of each point. More...
 
uint32_t GetPointRecordsCount () const
 Get total number of point records stored in the LAS file. More...
 
void SetPointRecordsCount (uint32_t v)
 Set number of point records that will be stored in a new LAS file. More...
 
RecordsByReturnArray const & GetPointRecordsByReturnCount () const
 Get array of the total point records per return. More...
 
void SetPointRecordsByReturnCount (std::size_t index, uint32_t v)
 Set values of 5-elements array of total point records per return. More...
 
double GetScaleX () const
 Get scale factor for X coordinate. More...
 
double GetScaleY () const
 Get scale factor for Y coordinate. More...
 
double GetScaleZ () const
 Get scale factor for Z coordinate. More...
 
void SetScale (double x, double y, double z)
 Set values of scale factor for X, Y and Z coordinates. More...
 
double GetOffsetX () const
 Get X coordinate offset. More...
 
double GetOffsetY () const
 Get Y coordinate offset. More...
 
double GetOffsetZ () const
 Get Z coordinate offset. More...
 
void SetOffset (double x, double y, double z)
 Set values of X, Y and Z coordinates offset. More...
 
double GetMaxX () const
 Get minimum value of extent of X coordinate. More...
 
double GetMinX () const
 Get maximum value of extent of X coordinate. More...
 
double GetMaxY () const
 Get minimum value of extent of Y coordinate. More...
 
double GetMinY () const
 Get maximum value of extent of Y coordinate. More...
 
double GetMaxZ () const
 Get minimum value of extent of Z coordinate. More...
 
double GetMinZ () const
 Get maximum value of extent of Z coordinate. More...
 
void SetMax (double x, double y, double z)
 Set maximum values of extent of X, Y and Z coordinates. More...
 
void SetMin (double x, double y, double z)
 Set minimum values of extent of X, Y and Z coordinates. More...
 
void AddVLR (VariableRecord const &v)
 Adds a variable length record to the header. More...
 
VariableRecord const & GetVLR (uint32_t index) const
 Returns a VLR. More...
 
const std::vector< VariableRecord > & GetVLRs () const
 Returns all of the VLRs. More...
 
void DeleteVLR (uint32_t index)
 Removes a VLR from the the header. More...
 
void DeleteVLRs (std::string const &name, uint16_t id)
 
void SetGeoreference ()
 Rewrite variable-length record with georeference infomation, if available. More...
 
SpatialReference GetSRS () const
 Fetch the georeference. More...
 
void SetSRS (SpatialReference &srs)
 Set the georeference. More...
 
Schema const & GetSchema () const
 Returns the schema. More...
 
void SetSchema (const Schema &format)
 Sets the schema. More...
 
const Bounds< double > & GetExtent () const
 Return the liblas::Bounds. More...
 
void SetExtent (Bounds< double > const &extent)
 Set the liblas::Bounds. More...
 
liblas::property_tree::ptree GetPTree () const
 Returns a property_tree that contains all of the header data in a structured format. More...
 
bool Compressed () const
 Returns true iff the file is compressed (laszip), as determined by the high bit in the point type. More...
 
void SetCompressed (bool b)
 Sets whether or not the points are compressed. More...
 
uint32_t GetVLRBlockSize () const
 
void to_rst (std::ostream &os) const
 
void to_xml (std::ostream &os) const
 
void to_json (std::ostream &os) const
 

Static Public Attributes

static char const *const FileSignature
 Official signature of ASPRS LAS file format, always "LASF". More...
 
static char const *const SystemIdentifier
 Default system identifier used by libLAS, always "libLAS". More...
 
static char const *const SoftwareIdentifier
 Default software identifier used by libLAS, always "libLAS X.Y". More...
 

Detailed Description

Definition of public header block.

The header contains set of generic data and metadata describing a family of ASPRS LAS files. The header is stored at the beginning of every valid ASPRS LAS file.

Todo:
TODO (low-priority): replace static-size char arrays as data members with std::string and return const-reference to string object.

Member Typedef Documentation

typedef std::vector<uint32_t> liblas::Header::RecordsByReturnArray

Array of 5 elements - numbers of points recorded by each return.

Todo:
TODO: Consider replacing with {boost|std::tr1}::array<T, 5> –mloskot

Constructor & Destructor Documentation

liblas::Header::Header ( )

Default constructor.

The default constructed header is configured according to the ASPRS LAS 1.2 Specification, point data format set to 0. Other fields filled with 0.

liblas::Header::Header ( Header const &  other)

Copy constructor.

Member Function Documentation

void liblas::Header::AddVLR ( VariableRecord const &  v)

Adds a variable length record to the header.

bool liblas::Header::Compressed ( ) const

Returns true iff the file is compressed (laszip), as determined by the high bit in the point type.

void liblas::Header::DeleteVLR ( uint32_t  index)

Removes a VLR from the the header.

void liblas::Header::DeleteVLRs ( std::string const &  name,
uint16_t  id 
)
uint16_t liblas::Header::GetCreationDOY ( ) const

Get day of year of file creation date.

Todo:
TODO: Use full date structure instead of Julian date number.
uint16_t liblas::Header::GetCreationYear ( ) const

Set year of file creation date.

Todo:
TODO: Remove if full date structure is used.
PointFormatName liblas::Header::GetDataFormatId ( ) const

Get identifier of point data (record) format.

uint32_t liblas::Header::GetDataOffset ( ) const

Get number of bytes from the beginning to the first point record.

uint16_t liblas::Header::GetDataRecordLength ( ) const

The length in bytes of each point.

All points in the file are considered to be fixed in size, and the PointFormatName is used to determine the fixed portion of the dimensions in the point. Any other byte space in the point record beyond the liblas::Schema::GetBaseByteSize() can be used for other, optional, dimensions. If no schema is available for the file in the form of a liblas.org VLR schema record, These extra bytes are available via liblas::Point::GetExtraData().

const Bounds<double>& liblas::Header::GetExtent ( ) const

Return the liblas::Bounds.

This is a combination of the GetMax and GetMin (or GetMinX, GetMaxY, etc) data.

std::string liblas::Header::GetFileSignature ( ) const

Get ASPRS LAS file signature.

Returns
4-characters long string - "LASF".
uint16_t liblas::Header::GetFileSourceId ( ) const

Get file source identifier.

Exceptions
Nothrow
uint32_t liblas::Header::GetHeaderPadding ( ) const

Get number of bytes from the end of the VLRs to the GetDataOffset.

uint16_t liblas::Header::GetHeaderSize ( ) const

Get number of bytes of generic verion of public header block storage.

Standard version of the public header block is 227 bytes long.

double liblas::Header::GetMaxX ( ) const

Get minimum value of extent of X coordinate.

double liblas::Header::GetMaxY ( ) const

Get minimum value of extent of Y coordinate.

double liblas::Header::GetMaxZ ( ) const

Get minimum value of extent of Z coordinate.

double liblas::Header::GetMinX ( ) const

Get maximum value of extent of X coordinate.

double liblas::Header::GetMinY ( ) const

Get maximum value of extent of Y coordinate.

double liblas::Header::GetMinZ ( ) const

Get maximum value of extent of Z coordinate.

double liblas::Header::GetOffsetX ( ) const

Get X coordinate offset.

double liblas::Header::GetOffsetY ( ) const

Get Y coordinate offset.

double liblas::Header::GetOffsetZ ( ) const

Get Z coordinate offset.

RecordsByReturnArray const& liblas::Header::GetPointRecordsByReturnCount ( ) const

Get array of the total point records per return.

uint32_t liblas::Header::GetPointRecordsCount ( ) const

Get total number of point records stored in the LAS file.

boost::uuids::uuid liblas::Header::GetProjectId ( ) const

Get project identifier.

Returns
Global Unique Identifier as an instance of boost::uuid::uuid class.
liblas::property_tree::ptree liblas::Header::GetPTree ( ) const

Returns a property_tree that contains all of the header data in a structured format.

uint32_t liblas::Header::GetRecordsCount ( ) const

Get number of variable-length records.

uint16_t liblas::Header::GetReserved ( ) const

Get value field reserved by the ASPRS LAS Specification.

Note
This field is always filled with 0.
Todo:
TODO: Should we warn or throw about type overflow when user passes 65535 + 1 = 0
double liblas::Header::GetScaleX ( ) const

Get scale factor for X coordinate.

double liblas::Header::GetScaleY ( ) const

Get scale factor for Y coordinate.

double liblas::Header::GetScaleZ ( ) const

Get scale factor for Z coordinate.

Schema const& liblas::Header::GetSchema ( ) const

Returns the schema.

std::string liblas::Header::GetSoftwareId ( bool  pad = false) const

Get software identifier.

Default value is "libLAS 1.0", specified as the SoftwareIdentifier constant.

Parameters
pad- if true the returned string is padded right with spaces and its length is 32 bytes, if false (default) no padding occurs and length of the returned string is <= 32 bytes.
Returns
value of generating software identifier field.
SpatialReference liblas::Header::GetSRS ( ) const

Fetch the georeference.

std::string liblas::Header::GetSystemId ( bool  pad = false) const

Get system identifier.

Default value is "libLAS" specified as the SystemIdentifier constant.

Parameters
pad- if true the returned string is padded right with spaces and its length is 32 bytes, if false (default) no padding occurs and length of the returned string is <= 32 bytes.
Returns
value of system identifier field.
uint8_t liblas::Header::GetVersionMajor ( ) const

Get major component of version of LAS format.

Returns
Always 1 is returned as the only valid value.
uint8_t liblas::Header::GetVersionMinor ( ) const

Get minor component of version of LAS format.

Returns
Valid values are 0, 1, 2, 3.
VariableRecord const& liblas::Header::GetVLR ( uint32_t  index) const

Returns a VLR.

uint32_t liblas::Header::GetVLRBlockSize ( ) const
const std::vector<VariableRecord>& liblas::Header::GetVLRs ( ) const

Returns all of the VLRs.

Header& liblas::Header::operator= ( Header const &  rhs)

Assignment operator.

bool liblas::Header::operator== ( const Header other) const

Comparison operator.

void liblas::Header::SetCompressed ( bool  b)

Sets whether or not the points are compressed.

void liblas::Header::SetCreationDOY ( uint16_t  v)

Set day of year of file creation date.

Exceptions
std::out_of_range- given value is higher than number 366.
Todo:
TODO: Use full date structure instead of Julian date number.
void liblas::Header::SetCreationYear ( uint16_t  v)

Get year of file creation date.

Exceptions
std::out_of_range- given value is higher than number 9999.
Todo:
TODO: Remove if full date structure is used.
void liblas::Header::SetDataFormatId ( PointFormatName  v)

Set identifier of point data (record) format.

void liblas::Header::SetDataOffset ( uint32_t  v)

Set number of bytes from the beginning to the first point record.

Exceptions
std::out_of_range- if given offset is bigger than 227+2 bytes for the LAS 1.0 format and 227 bytes for the LAS 1.1 format.
void liblas::Header::SetExtent ( Bounds< double > const &  extent)

Set the liblas::Bounds.

This is a combination of the GetMax and GetMin (or GetMinX, GetMaxY, etc) data, and it is equivalent to setting all of these values.

void liblas::Header::SetFileSignature ( std::string const &  v)

Set ASPRS LAS file signature.

The only value allowed as file signature is "LASF", defined as FileSignature constant.

Exceptions
std::invalid_argument- if invalid signature given.
Parameters
v- string contains file signature, at least 4-bytes long with "LASF" as first four bytes.
void liblas::Header::SetFileSourceId ( uint16_t  v)

Set file source identifier.

Parameters
v- should be set to a value between 1 and 65535.
Exceptions
Nothrow
Todo:
TODO: Should we warn or throw about type overflow when user passes 65535 + 1 = 0
void liblas::Header::SetGeoreference ( )

Rewrite variable-length record with georeference infomation, if available.

void liblas::Header::SetHeaderPadding ( uint32_t  v)

Set the number of bytes from the end of the VLRs in the header to the beginning of point data.

Exceptions
std::out_of_range- if given offset is bigger than 227+2 bytes for the LAS 1.0 format and 227 bytes for the LAS 1.1 format.
void liblas::Header::SetHeaderSize ( uint16_t  v)

Sets the header size.

Note that this is not the same as the offset to point data.

void liblas::Header::SetMax ( double  x,
double  y,
double  z 
)

Set maximum values of extent of X, Y and Z coordinates.

void liblas::Header::SetMin ( double  x,
double  y,
double  z 
)

Set minimum values of extent of X, Y and Z coordinates.

void liblas::Header::SetOffset ( double  x,
double  y,
double  z 
)

Set values of X, Y and Z coordinates offset.

void liblas::Header::SetPointRecordsByReturnCount ( std::size_t  index,
uint32_t  v 
)

Set values of 5-elements array of total point records per return.

Exceptions
std::out_of_range- if index is bigger than 4.
Parameters
index- subscript (0-4) of array element being updated.
v- new value to assign to array element identified by index.
void liblas::Header::SetPointRecordsCount ( uint32_t  v)

Set number of point records that will be stored in a new LAS file.

void liblas::Header::SetProjectId ( boost::uuids::uuid const &  v)

Set project identifier.

void liblas::Header::SetRecordsCount ( uint32_t  v)

Set number of variable-length records.

void liblas::Header::SetReserved ( uint16_t  v)

Set reserved value for the header identifier.

Parameters
v- should be set to a value between 1 and 65535.
Exceptions
Nothrow
void liblas::Header::SetScale ( double  x,
double  y,
double  z 
)

Set values of scale factor for X, Y and Z coordinates.

void liblas::Header::SetSchema ( const Schema format)

Sets the schema.

void liblas::Header::SetSoftwareId ( std::string const &  v)

Set software identifier.

Exceptions
std::invalid_argument- if identifier is longer than 32 bytes.
Parameters
v- software identifiers string.
void liblas::Header::SetSRS ( SpatialReference srs)

Set the georeference.

void liblas::Header::SetSystemId ( std::string const &  v)

Set system identifier.

Exceptions
std::invalid_argument- if identifier longer than 32 bytes.
Parameters
v- system identifiers string.
void liblas::Header::SetVersionMajor ( uint8_t  v)

Set major component of version of LAS format.

Exceptions
std::out_of_range- invalid value given.
Parameters
v- value between eVersionMajorMin and eVersionMajorMax.
void liblas::Header::SetVersionMinor ( uint8_t  v)

Set minor component of version of LAS format.

Exceptions
std::out_of_range- invalid value given.
Parameters
v- value between eVersionMinorMin and eVersionMinorMax.
void liblas::Header::to_json ( std::ostream &  os) const
void liblas::Header::to_rst ( std::ostream &  os) const
void liblas::Header::to_xml ( std::ostream &  os) const

Member Data Documentation

char const* const liblas::Header::FileSignature
static

Official signature of ASPRS LAS file format, always "LASF".

char const* const liblas::Header::SoftwareIdentifier
static

Default software identifier used by libLAS, always "libLAS X.Y".

char const* const liblas::Header::SystemIdentifier
static

Default system identifier used by libLAS, always "libLAS".


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