liblas::LASHeader Class Reference

Definition of public header block. More...

#include <lasheader.hpp>

List of all members.


Public Types

enum  FormatVersion { eVersionMajorMin = 1, eVersionMajorMax = 1, eVersionMinorMin = 0, eVersionMinorMax = 1 }
 Range of allowed ASPRS LAS file format versions. More...
enum  PointFormat { ePointFormat0 = 0, ePointFormat1 = 1 }
 Versions of point record format. More...
enum  PointSize { ePointSize0 = 20, ePointSize1 = 28 }
 Number of bytes of point record storage in particular format. More...

Public Member Functions

 LASHeader ()
 Default constructor.
 LASHeader (LASHeader const &other)
 Copy constructor.
LASHeaderoperator= (LASHeader const &rhs)
 Assignment operator.
bool operator== (const LASHeader &other) const
 Comparison operator.
std::string GetFileSignature () const
 Get ASPRS LAS file signature.
void SetFileSignature (std::string const &v)
 Set ASPRS LAS file signature.
uint16_t GetFileSourceId () const
 Get file source identifier.
void SetFileSourceId (uint16_t v)
 Set file source identifier.
uint16_t GetReserved () const
 Get value field reserved by the ASPRS LAS Specification.
void SetReserved (uint16_t v)
 Set reserved value for the header identifier.
guid GetProjectId () const
 Get project identifier.
void SetProjectId (guid const &v)
 Set project identifier.
uint8_t GetVersionMajor () const
 Get major component of version of LAS format.
void SetVersionMajor (uint8_t v)
 Set major component of version of LAS format.
uint8_t GetVersionMinor () const
 Get minor component of version of LAS format.
void SetVersionMinor (uint8_t v)
 Set minor component of version of LAS format.
std::string GetSystemId (bool pad=false) const
 Get system identifier.
void SetSystemId (std::string const &v)
 Set system identifier.
std::string GetSoftwareId (bool pad=false) const
 Get software identifier.
void SetSoftwareId (std::string const &v)
 Set software identifier.
uint16_t GetCreationDOY () const
 Get day of year of file creation date.
void SetCreationDOY (uint16_t v)
 Set day of year of file creation date.
uint16_t GetCreationYear () const
 Set year of file creation date.
void SetCreationYear (uint16_t v)
 Get year of file creation date.
uint16_t GetHeaderSize () const
 Get number of bytes of generic verion of public header block storage.
uint32_t GetDataOffset () const
 Get number of bytes from the beginning to the first point record.
void SetDataOffset (uint32_t v)
 Set number of bytes from the beginning to the first point record.
uint32_t GetRecordsCount () const
 Get number of variable-length records.
void SetRecordsCount (uint32_t v)
 Set number of variable-length records.
PointFormat GetDataFormatId () const
 Get identifier of point data (record) format.
void SetDataFormatId (PointFormat v)
 Set identifier of point data (record) format.
uint16_t GetDataRecordLength () const
uint32_t GetPointRecordsCount () const
 Get total number of point records stored in the LAS file.
void SetPointRecordsCount (uint32_t v)
 Set number of point records that will be stored in a new LAS file.
std::vector< uint32_t > const & GetPointRecordsByReturnCount () const
 Get array of the total point records per return.
void SetPointRecordsByReturnCount (std::size_t index, uint32_t v)
 Set values of 5-elements array of total point records per return.
double GetScaleX () const
 Get scale factor for X coordinate.
double GetScaleY () const
 Get scale factor for Y coordinate.
double GetScaleZ () const
 Get scale factor for Z coordinate.
void SetScale (double x, double y, double z)
 Set values of scale factor for X, Y and Z coordinates.
double GetOffsetX () const
 Get X coordinate offset.
double GetOffsetY () const
 Get Y coordinate offset.
double GetOffsetZ () const
 Get Z coordinate offset.
void SetOffset (double x, double y, double z)
 Set values of X, Y and Z coordinates offset.
double GetMaxX () const
 Get minimum value of extent of X coordinate.
double GetMinX () const
 Get maximum value of extent of X coordinate.
double GetMaxY () const
 Get minimum value of extent of Y coordinate.
double GetMinY () const
 Get maximum value of extent of Y coordinate.
double GetMaxZ () const
 Get minimum value of extent of Z coordinate.
double GetMinZ () const
 Get maximum value of extent of Z coordinate.
void SetMax (double x, double y, double z)
 Set maximum values of extent of X, Y and Z coordinates.
void SetMin (double x, double y, double z)
 Set minimum values of extent of X, Y and Z coordinates.
void AddVLR (LASVLR const &v)
 Adds a variable length record to the header.
LASVLR const & GetVLR (uint32_t index) const
 Returns a VLR.
void DeleteVLR (uint32_t index)
 Removes a VLR from the the header.
std::string GetProj4 () const
 Fetch the georeference as a PROJ.4 definition string.
void SetProj4 (std::string const &v)
 Set the georeference as a proj.4 string.
void SetGeoreference ()
 Rewrite variable-length record with georeference infomation, if available.

Static Public Attributes

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

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.

Definition at line 64 of file lasheader.hpp.


Member Enumeration Documentation

Range of allowed ASPRS LAS file format versions.

Enumerator:
eVersionMajorMin  Minimum of major component.
eVersionMajorMax  Maximum of major component.
eVersionMinorMin  Minimum of minor component.
eVersionMinorMax  Maximum of minor component.

Definition at line 69 of file lasheader.hpp.

Versions of point record format.

Enumerator:
ePointFormat0  Point Data Format 0.
ePointFormat1  Point Data Format 1.

Definition at line 78 of file lasheader.hpp.

Number of bytes of point record storage in particular format.

Enumerator:
ePointSize0  Size of point record in data format 0.
ePointSize1  Size of point record in data format 1.

Definition at line 85 of file lasheader.hpp.


Constructor & Destructor Documentation

liblas::LASHeader::LASHeader (  ) 

Default constructor.

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

liblas::LASHeader::LASHeader ( LASHeader const &  other  ) 

Copy constructor.


Member Function Documentation

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

Assignment operator.

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

Comparison operator.

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

Get ASPRS LAS file signature.

Returns:
4-characters long string - "LASF".

void liblas::LASHeader::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.

uint16_t liblas::LASHeader::GetFileSourceId (  )  const

Get file source identifier.

Exceptions:
No throw

void liblas::LASHeader::SetFileSourceId ( uint16_t  v  ) 

Set file source identifier.

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

uint16_t liblas::LASHeader::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

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

Set reserved value for the header identifier.

Parameters:
v - should be set to a value between 1 and 65535.
Exceptions:
No throw

guid liblas::LASHeader::GetProjectId (  )  const

Get project identifier.

Returns:
Global Unique Identifier as an instance of liblas::guid class.

void liblas::LASHeader::SetProjectId ( guid const &  v  ) 

Set project identifier.

uint8_t liblas::LASHeader::GetVersionMajor (  )  const

Get major component of version of LAS format.

Returns:
Always 1 is returned as the only valid value.

void liblas::LASHeader::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.

uint8_t liblas::LASHeader::GetVersionMinor (  )  const

Get minor component of version of LAS format.

Returns:
Valid values are 1 or 0.

void liblas::LASHeader::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.

std::string liblas::LASHeader::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.

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

Set system identifier.

Exceptions:
std::invalid_argument - if identifier longer than 32 bytes.
Parameters:
v - system identifiers string.

std::string liblas::LASHeader::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.

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

Set software identifier.

Exceptions:
std::invalid_argument - if identifier is longer than 32 bytes.
Parameters:
v - software identifiers string.

uint16_t liblas::LASHeader::GetCreationDOY (  )  const

Get day of year of file creation date.

Todo:
TODO: Use full date structure instead of Julian date number.

void liblas::LASHeader::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.

uint16_t liblas::LASHeader::GetCreationYear (  )  const

Set year of file creation date.

Todo:
TODO: Remove if full date structure is used.

void liblas::LASHeader::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.

uint16_t liblas::LASHeader::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.

uint32_t liblas::LASHeader::GetDataOffset (  )  const

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

void liblas::LASHeader::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.

uint32_t liblas::LASHeader::GetRecordsCount (  )  const

Get number of variable-length records.

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

Set number of variable-length records.

PointFormat liblas::LASHeader::GetDataFormatId (  )  const

Get identifier of point data (record) format.

void liblas::LASHeader::SetDataFormatId ( PointFormat  v  ) 

Set identifier of point data (record) format.

uint16_t liblas::LASHeader::GetDataRecordLength (  )  const

Todo:
To be documented

uint32_t liblas::LASHeader::GetPointRecordsCount (  )  const

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

void liblas::LASHeader::SetPointRecordsCount ( uint32_t  v  ) 

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

std::vector<uint32_t> const& liblas::LASHeader::GetPointRecordsByReturnCount (  )  const

Get array of the total point records per return.

void liblas::LASHeader::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.

double liblas::LASHeader::GetScaleX (  )  const

Get scale factor for X coordinate.

double liblas::LASHeader::GetScaleY (  )  const

Get scale factor for Y coordinate.

double liblas::LASHeader::GetScaleZ (  )  const

Get scale factor for Z coordinate.

void liblas::LASHeader::SetScale ( double  x,
double  y,
double  z 
)

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

double liblas::LASHeader::GetOffsetX (  )  const

Get X coordinate offset.

double liblas::LASHeader::GetOffsetY (  )  const

Get Y coordinate offset.

double liblas::LASHeader::GetOffsetZ (  )  const

Get Z coordinate offset.

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

Set values of X, Y and Z coordinates offset.

double liblas::LASHeader::GetMaxX (  )  const

Get minimum value of extent of X coordinate.

double liblas::LASHeader::GetMinX (  )  const

Get maximum value of extent of X coordinate.

double liblas::LASHeader::GetMaxY (  )  const

Get minimum value of extent of Y coordinate.

double liblas::LASHeader::GetMinY (  )  const

Get maximum value of extent of Y coordinate.

double liblas::LASHeader::GetMaxZ (  )  const

Get minimum value of extent of Z coordinate.

double liblas::LASHeader::GetMinZ (  )  const

Get maximum value of extent of Z coordinate.

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

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

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

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

void liblas::LASHeader::AddVLR ( LASVLR const &  v  ) 

Adds a variable length record to the header.

LASVLR const& liblas::LASHeader::GetVLR ( uint32_t  index  )  const

Returns a VLR.

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

Removes a VLR from the the header.

std::string liblas::LASHeader::GetProj4 (  )  const

Fetch the georeference as a PROJ.4 definition string.

void liblas::LASHeader::SetProj4 ( std::string const &  v  ) 

Set the georeference as a proj.4 string.

void liblas::LASHeader::SetGeoreference (  ) 

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


Member Data Documentation

char const* const liblas::LASHeader::FileSignature [static]

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

Definition at line 92 of file lasheader.hpp.

char const* const liblas::LASHeader::SystemIdentifier [static]

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

Definition at line 95 of file lasheader.hpp.

char const* const liblas::LASHeader::SoftwareIdentifier [static]

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

Definition at line 98 of file lasheader.hpp.


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