liblas::Header Class Reference

Definition of public header block. More...

#include <lasheader.hpp>

Collaboration diagram for liblas::Header:
Collaboration graph
[legend]

List of all members.

Public Types

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

Public Member Functions

 Header ()
 Default constructor.
 Header (Header const &other)
 Copy constructor.
Headeroperator= (Header const &rhs)
 Assignment operator.
bool operator== (const Header &other) const
 Comparison operator.
std::string GetFileSignature () const
 Get ASPRS LAS file signature.
void SetFileSignature (std::string const &v)
 Set ASPRS LAS file signature.
boost::uint16_t GetFileSourceId () const
 Get file source identifier.
void SetFileSourceId (boost::uint16_t v)
 Set file source identifier.
boost::uint16_t GetReserved () const
 Get value field reserved by the ASPRS LAS Specification.
void SetReserved (boost::uint16_t v)
 Set reserved value for the header identifier.
guid GetProjectId () const
 Get project identifier.
void SetProjectId (guid const &v)
 Set project identifier.
boost::uint8_t GetVersionMajor () const
 Get major component of version of LAS format.
void SetVersionMajor (boost::uint8_t v)
 Set major component of version of LAS format.
boost::uint8_t GetVersionMinor () const
 Get minor component of version of LAS format.
void SetVersionMinor (boost::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.
boost::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.
void SetHeaderSize (uint16_t v)
 Sets the header size.
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.
PointFormatName GetDataFormatId () const
 Get identifier of point data (record) format.
void SetDataFormatId (PointFormatName v)
 Set identifier of point data (record) format.
uint16_t GetDataRecordLength () const
void SetDataRecordLength (uint16_t v)
 Set the length of the point format.
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.
RecordsByReturnArray 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 (VariableRecord const &v)
 Adds a variable length record to the header.
VariableRecord const & GetVLR (uint32_t index) const
 Returns a VLR.
const std::vector
< VariableRecord > & 
GetVLRs () const
 Returns all of the VLRs.
void DeleteVLR (uint32_t index)
 Removes a VLR from the the header.
void SetGeoreference ()
 Rewrite variable-length record with georeference infomation, if available.
SpatialReference GetSRS () const
 Fetch the georeference.
void SetSRS (SpatialReference &srs)
 Set the georeference.
Schema GetSchema () const
void SetSchema (const Schema &format)
void SetExtent (Bounds &b)
const BoundsGetExtent () const

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.

Member Typedef Documentation

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

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

Todo:
TODO: Consider replacing with {boost|stdtr1}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.

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

Removes a VLR from the the header.

boost::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
Todo:
To be documented
const Bounds& liblas::Header::GetExtent (  )  const [inline]
std::string liblas::Header::GetFileSignature (  )  const

Get ASPRS LAS file signature.

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

Get file source identifier.

Exceptions:
No throw
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.

guid liblas::Header::GetProjectId (  )  const

Get project identifier.

Returns:
Global Unique Identifier as an instance of liblas::guid class.
uint32_t liblas::Header::GetRecordsCount (  )  const

Get number of variable-length records.

boost::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 liblas::Header::GetSchema (  )  const
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.
boost::uint8_t liblas::Header::GetVersionMajor (  )  const

Get major component of version of LAS format.

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

Get minor component of version of LAS format.

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

Returns a VLR.

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::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::SetDataRecordLength ( uint16_t  v  ) 

Set the length of the point format.

Evidently, there are LAS files in the wild that contain point formats of sizes that are different than the prescribed set specified in the specification.

void liblas::Header::SetExtent ( Bounds b  ) 
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 ( boost::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
void liblas::Header::SetGeoreference (  ) 

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

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 ( guid const &  v  ) 

Set project identifier.

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

Set number of variable-length records.

void liblas::Header::SetReserved ( boost::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
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  ) 
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 ( boost::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 ( boost::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.

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:

Generated on Fri Jul 30 19:30:13 2010 for libLAS API Reference by  doxygen 1.6.1