Maria GDK 5.0.0.737
Documentation of native code in develop branch
Loading...
Searching...
No Matches
Maria::GeoBitmap Class Reference

#include <MGeoBitmap.h>

Public Types

enum  PixelType {
  MONO_UInt8 , ELEV_Int16 , ELEV_UInt16 , ELEV_Int32 ,
  ELEV_UInt32 , ELEV_Float32 , ELEV_PNG16 , CIMG_RGBA32 ,
  CIMG_ABGR32 , CIMG_BGRA32 , CIMG_RGB24 , CIMG_JPEG ,
  CIMG_PNG , CIMG_WEBP , CIMG_DXT1 , CIMG_DXT3 ,
  CIMG_DXT5 , VEC_SWVT
}
 

Public Member Functions

 GeoBitmap (int width, int height, int type, std::shared_ptr< RasterProjector > rasterProjector=nullptr)
 
std::shared_ptr< RasterProjectorrasterProjector () const
 
void setRasterProjector (const std::shared_ptr< RasterProjector > &rasterProjector)
 
bool isElevation () const
 
bool isFloat () const
 
bool isColorImage () const
 
bool isCompressed () const
 
bool isVector () const
 
bool isUnsigned () const
 
bool hasAlpha () const
 
bool isEmpty () const
 
int width () const
 
int height () const
 
int type () const
 
double nodata () const
 
double fill () const
 
int numPixels () const
 
int getIndex (int x, int y) const
 
double scale () const
 
double offset () const
 
void setOffset (double offset)
 
void setScale (double scale)
 
int pixelSize () const
 Pixel size in bytes. Not valid for compressed image formats!
 
int size () const
 
void initialize (int width, int height, int type)
 
int getInt (int idx) const
 
int getInt (int x, int y) const
 
float getFloat (int idx) const
 
float getFloat (int x, int y) const
 Override, see above.
 
uint32_t getUInt (int idx) const
 
uint32_t getUInt (int x, int y) const
 Override, see above.
 
void setInt (int x, int y, int value)
 
void setNodata (double nodata)
 
void setFill (double fill)
 
bool isNodataValue (double val) const
 Return true if the given value is a nodata or fill value.
 
bool isNodataImage () const
 Returns true if tile contains only nodata or fill values.
 
double getElevationValue (int idx) const
 
double getElevationValue (int x, int y) const
 
void setElevationValue (int idx, double value)
 
void setElevationValue (int x, int y, double value)
 
void setInt (int idx, int value)
 
void setFloat (int idx, float value)
 
void setUInt (int idx, uint32_t value)
 
void setUInt (int x, int y, uint32_t value)
 
void setFloat (int x, int y, float value)
 
void setColorRGBA (int idx, unsigned char r, unsigned char g, unsigned char b, unsigned char a=255)
 
void setColorRGBA (int x, int y, unsigned char r, unsigned char g, unsigned char b, unsigned char a=255)
 
void getColorRGBA (int idx, unsigned char &r, unsigned char &g, unsigned char &b, unsigned char &a) const
 
void getColorRGBA (int x, int y, unsigned char &r, unsigned char &g, unsigned char &b, unsigned char &a) const
 
void fill (unsigned char val)
 
const std::vector< unsigned char > & buffer () const
 
unsigned char * data ()
 
const unsigned char * constData () const
 
void setData (const std::vector< unsigned char > &data)
 
void calcMinMaxElevation (double &min, double &max) const
 
bool decompress (GeoBitmap &dst) const
 

Detailed Description

GeoBitmap - Georeferenced imagery or elevation data. Georeferenced bitmap data. This class contains a buffer of image data and optionally a georeference (RasterProjetor).

This class is mainly intended to be used for compact storage representations of geodata. For high perforamance pixel operations, you should first unpack the geobitmap to a more special purpose class.

The image data may be stored in compressed form (JPEG, PNG, DXTC, Gzip) in which case the pixel access methods (setInt(), setColorRGBA(), getInt(), etc) will not work. This class can optionally use an internal scale factor and offset for compact representation of elevation data. The relationship between the actual elevation value and the internal packed value is given by:

orig_h = packed_h*scale + offset

This class can also have a special value for nodata, representing holes in the dataset. This value is stored with no scaling or offset, so make sure the data format has enough precision to represent the chosen nodata value.

Member Function Documentation

◆ decompress()

bool GeoBitmap::decompress ( GeoBitmap dst) const

Decompress the image. Decompress image and place the output in dst.

◆ getFloat()

float Maria::GeoBitmap::getFloat ( int  idx) const
inline

Get pixel as float value. This method will return the requested pixel as a float value.

If image is a color format or DXT compressed data, nodata will be returned.

◆ getInt() [1/2]

int Maria::GeoBitmap::getInt ( int  idx) const
inline

Get pixel as integer value. This method will return the requested pixel as an integer. All elevation formats will be modified with the scale and offset of the image, if any.

Color formats will be encoded into an unsiged int RGB(A) value but cast to signed. In general you should use the getColorRGBA or getUnsignedInt methods for color pixels, although you can safely cast it back to unsigned.

Compressed formats will return nodata.

◆ getInt() [2/2]

int Maria::GeoBitmap::getInt ( int  x,
int  y 
) const
inline

Get pixel as integer value. Override, see above.

◆ getUInt()

uint32_t Maria::GeoBitmap::getUInt ( int  idx) const
inline

Get pixel as unsigned integer value. This method will return the requested pixel as an unsigned integer.

Color formats will be encoded into an unsigned int RGB(A) value DXT Compressed formats will ignore this method.

◆ hasAlpha()

bool Maria::GeoBitmap::hasAlpha ( ) const
inline

Returns true if the data consists of uncompressed color pixel data with an alpha channel.

◆ isColorImage()

bool Maria::GeoBitmap::isColorImage ( ) const
inline

Returns true if the data consists of uncompressed color pixel data

◆ isCompressed()

bool Maria::GeoBitmap::isCompressed ( ) const
inline

Returns true if the data consists of compressed data. Compressed data can not be accessed directly

◆ isElevation()

bool Maria::GeoBitmap::isElevation ( ) const
inline

Returns true if the data consists of uncompressed elevation data

◆ isFloat()

bool Maria::GeoBitmap::isFloat ( ) const
inline

Returns true if the data consists of uncompressed floating-point elevation data

◆ isUnsigned()

bool Maria::GeoBitmap::isUnsigned ( ) const
inline

Returns true if the data consists of uncompressed unsigned integer data

◆ isVector()

bool Maria::GeoBitmap::isVector ( ) const
inline

Returns true if the data consists of a vector data blob.

◆ setElevationValue()

void Maria::GeoBitmap::setElevationValue ( int  idx,
double  value 
)
inline

Set pixel value from integer. This method will apply any scale and offset parameters to pack the value in to an internal representation and store it in the internal buffer. Any RGBA color formats will be treaded as an unsigned 32-bits RGBA value. DXT Compressed formats will ignore this method.

◆ setFill()

void Maria::GeoBitmap::setFill ( double  fill)
inline

Set fill value. In case you want different values for nodata and fill, you can set this after setting nodata.

◆ setFloat()

void Maria::GeoBitmap::setFloat ( int  idx,
float  value 
)
inline

Set pixel value from float. Any RGBA color formats will simply ignore this method.

◆ setNodata()

void Maria::GeoBitmap::setNodata ( double  nodata)
inline

Set nodata and fill values. By default the nodata and fill value is the same. To use separate values for fill and nodata, set the fill value afterwards.


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