rasdaman complete source
Public Member Functions | Protected Attributes | List of all members
RasdamanHelper2 Class Reference

Helper class for handling rasdaman collections and images. More...

#include <RasdamanHelper2.h>

Public Member Functions

 RasdamanHelper2 (RasdamanConnector *rasconn)
 
virtual ~RasdamanHelper2 ()
 
double doesCollectionExist (std::string collname) throw (r_Error)
 
void insertCollection (std::string collname, r_Type::r_Type_Id rtype, bool asCube)
 
void insertUserCollection (std::string collname, std::string colltypename)
 
void dropCollection (std::string collname)
 
void dropImage (std::string collname, double oid)
 
std::vector< double > getImageOIDs (std::string collname)
 
r_Minterval getImageSdom (std::string collname, double localImgOID)
 
r_Marray_Type * getMarrayType (std::string collname)
 
r_Type::r_Type_Id getBaseTypeId (std::string collname)
 
std::string getBaseTypeName (std::string collname)
 
unsigned int getBaseTypeSize (std::string collname)
 
unsigned int getBaseTypeElementCount (std::string collname)
 
unsigned int getTypeSize (r_Type::r_Type_Id rtype) throw (r_Error)
 
std::string getTypePrefixString (r_Type::r_Type_Id rtype)
 
void getImageBuffer (std::string collname, double localImgOID, char *buf, r_Minterval &sdom)
 
double insertImage (std::string collname, char *buf, r_Point &shift, r_Minterval &sdom, bool bRowMajor2ColMajor, std::string marraytypename, std::string tiling)
 
void updateImage (std::string collname, double imgid, char *buf, r_Point &shift, r_Minterval &sdom, bool bRowMajor2ColMajor, std::string marraytypename) throw (r_Error)
 
void colBuf2RowBuf (char *colbuf, char *rowbuf, r_Type::r_Type_Id rtype, int ncols, int nrows, int nlayers) throw (r_Error)
 
void colBuf2RowBuf (char *colbuf, char *rowbuf, unsigned int pixelsize, r_Minterval &sdom)
 
void colBuf2RowBuf (char *colbuf, char *rowbuf, unsigned int pixelsize, unsigned int nelem, int ncols, int nrows, int nlayers)
 
void rowBuf2ColBuf (char *rowbuf, char *colbuf, r_Type::r_Type_Id rtype, int ncols, int nrows, int nlayers) throw (r_Error)
 
void rowBuf2ColBuf (char *rowbuf, char *colbuf, unsigned int pixelsize, r_Minterval &sdom)
 
void rowBuf2ColBuf (char *rowbuf, char *colbuf, unsigned int pixelsize, unsigned int nelem, int ncols, int nrows, int nlayers)
 
std::vector< int > offset2index (int offset, std::vector< int > &sdom)
 
std::vector< int > offset2index (int offset, r_Minterval &sdom)
 
int index2offset (r_Minterval &sdom, std::vector< int > &index)
 
int index2offset (std::vector< int > &sdom, std::vector< int > &index)
 
void createCollection (r_Database &db, r_Ref< r_Set< r_Ref< r_GMarray > > > &imgSet, r_Type::r_Type_Id rtype, bool asCube) throw (r_Error)
 
void createMDD (r_Ref< r_GMarray > &image, r_Minterval sdom, r_Type::r_Type_Id rtype) throw (r_Error)
 
std::string getNumConstChar (r_Type::r_Type_Id rtype) throw (r_Error)
 
int getWCPSTypeId (r_Type::r_Type_Id rtype)
 
std::string getDataTypeString (r_Type::r_Type_Id rtype)
 
long getMaxImgSize (void)
 
void setMaxImgSize (long maximgsize)
 
bool isNMMetaAvailable (void)
 
void writeNMMetadata (string collname, long oid, long epsgcode, string crsname, double minx, double maxx, double miny, double maxy, double minz, double maxz, double csx, double csy, double csz, string pixeltype, double stats_min, double stats_max, double stats_mean, double stats_stddev, string RATName) throw (r_Error)
 
int writeNMRAT (std::string filename, double oid, int band) throw (r_Error)
 
int writePSMetadata (std::string collname, std::string crs, r_Type::r_Type_Id rtype, int nbands, double xmin, double xmax, double ymin, double ymax, double zmax, double zmin, int xpix, int ypix, int zpix)
 
std::vector< double > getNMMetaGeoDomain (long oid)
 
std::vector< double > getNMMetaCellSize (long oid)
 
std::string getNMMetaCrsName (long oid)
 
int deletePSMetadata (std::string collname)
 
int deleteNMMetadata (std::string collname, double oid)
 
bool checkDbConnection (void)
 

Protected Attributes

RasdamanConnectorm_pRasconn
 pointer to the connection object More...
 
r_Transaction m_transaction
 private transaction object of this helper More...
 
long m_maximgsize
 the maximum image (tile/buffer) size that More...
 

Detailed Description

Helper class for handling rasdaman collections and images.

This class facilitates handling of rasdaman collections by hiding especially rasml queries (r_oql_execute() calls) including transaction handling from the user and attempts to provide a 'non-db-like' interface to rasdaman collections and images.

See Also
RasdamanConnector

Constructor & Destructor Documentation

RasdamanHelper2::RasdamanHelper2 ( RasdamanConnector rasconn)

Constructor taking a RasdamanConnector object.

Parameters
rasconnpointer to RasdamanConnector object, which controls the connection to the underlying rasdaman data base. Note that the connector object may be shared with other helper objects.
virtual RasdamanHelper2::~RasdamanHelper2 ( )
virtual

Member Function Documentation

bool RasdamanHelper2::checkDbConnection ( void  )
void RasdamanHelper2::colBuf2RowBuf ( char *  colbuf,
char *  rowbuf,
r_Type::r_Type_Id  rtype,
int  ncols,
int  nrows,
int  nlayers 
)
throw (r_Error
)

Transposes a 1D, 2D, or 3D column-major arrays into a row-major array

Parameters
colbufcolumn-major array
rowbufrow-major array
rtypedata type of array elements
ncolsnumber of columns of the data set (#pixel in x-direction)
nrowsnumber of rows of the data set (#pixel in y-direction)
nlayersnumber of layers of the data set (#pixel in z-direction)
void RasdamanHelper2::colBuf2RowBuf ( char *  colbuf,
char *  rowbuf,
unsigned int  pixelsize,
r_Minterval &  sdom 
)

Transposes a n-dimensional column-major array into a row-major array

Parameters
colbufcolumn-major array
rowbufrow-major array
pixelsizesize of array elements in byte
sdomdimensions of the array
void RasdamanHelper2::colBuf2RowBuf ( char *  colbuf,
char *  rowbuf,
unsigned int  pixelsize,
unsigned int  nelem,
int  ncols,
int  nrows,
int  nlayers 
)

Transposes a 1D, 2D, or 3D multi-band row-major arrays into a col-major array

void RasdamanHelper2::createCollection ( r_Database &  db,
r_Ref< r_Set< r_Ref< r_GMarray > > > &  imgSet,
r_Type::r_Type_Id  rtype,
bool  asCube 
)
throw (r_Error
)
void RasdamanHelper2::createMDD ( r_Ref< r_GMarray > &  image,
r_Minterval  sdom,
r_Type::r_Type_Id  rtype 
)
throw (r_Error
)
int RasdamanHelper2::deleteNMMetadata ( std::string  collname,
double  oid 
)
int RasdamanHelper2::deletePSMetadata ( std::string  collname)
double RasdamanHelper2::doesCollectionExist ( std::string  collname)
throw (r_Error
)

checks whether the data base contains the specified collection

Parameters
collnamecollection name
Returns
when the collection exists, the local OID is returned, otherwise -1;
void RasdamanHelper2::dropCollection ( std::string  collname)

Deletes collection 'collname' from the data base.

void RasdamanHelper2::dropImage ( std::string  collname,
double  oid 
)

Deletes an image from a collection.

unsigned int RasdamanHelper2::getBaseTypeElementCount ( std::string  collname)

Returns the size in bytes of the collection's base type

r_Type::r_Type_Id RasdamanHelper2::getBaseTypeId ( std::string  collname)

Returns the data (pixel) type id of the given collection.

std::string RasdamanHelper2::getBaseTypeName ( std::string  collname)

Returns the base type of the collection

unsigned int RasdamanHelper2::getBaseTypeSize ( std::string  collname)

Returns the size in bytes of the collection's base type

std::string RasdamanHelper2::getDataTypeString ( r_Type::r_Type_Id  rtype)
void RasdamanHelper2::getImageBuffer ( std::string  collname,
double  localImgOID,
char *  buf,
r_Minterval &  sdom 
)

Copies a given section of a particular image.

Parameters
collnameThe name of the collection the image belongs to.
localImgOIDThe image's local OID
bufPointer to an allocated array the image values are copied into.
sdomAn r_Minterval object specifying the spatial domain of the image section to be copied into buf.
std::vector<double> RasdamanHelper2::getImageOIDs ( std::string  collname)

Returns a collection's (local) image OIDs

r_Minterval RasdamanHelper2::getImageSdom ( std::string  collname,
double  localImgOID 
)

Queries the spatial domain of the given image

Parameters
collnamename of collection the particular image belongs to
localImgOIDlocal OID of the image for which the spatial domain is requested
Returns
a r_Minterval object specifying the spatial cell domain of the image
r_Marray_Type* RasdamanHelper2::getMarrayType ( std::string  collname)
long RasdamanHelper2::getMaxImgSize ( void  )
inline

References m_maximgsize.

std::vector<double> RasdamanHelper2::getNMMetaCellSize ( long  oid)
std::string RasdamanHelper2::getNMMetaCrsName ( long  oid)
std::vector<double> RasdamanHelper2::getNMMetaGeoDomain ( long  oid)
std::string RasdamanHelper2::getNumConstChar ( r_Type::r_Type_Id  rtype)
throw (r_Error
)
std::string RasdamanHelper2::getTypePrefixString ( r_Type::r_Type_Id  rtype)

returns the string representation (e.g. 'Grey', 'ULong') of rtype which can be used as prefix to build collection and image type strings such as 'GreySet', 'UShortImage', etc.

unsigned int RasdamanHelper2::getTypeSize ( r_Type::r_Type_Id  rtype)
throw (r_Error
)
int RasdamanHelper2::getWCPSTypeId ( r_Type::r_Type_Id  rtype)
int RasdamanHelper2::index2offset ( r_Minterval &  sdom,
std::vector< int > &  index 
)
int RasdamanHelper2::index2offset ( std::vector< int > &  sdom,
std::vector< int > &  index 
)
void RasdamanHelper2::insertCollection ( std::string  collname,
r_Type::r_Type_Id  rtype,
bool  asCube 
)

Inserts a new collection 'collname' of type rtype into the data base

double RasdamanHelper2::insertImage ( std::string  collname,
char *  buf,
r_Point &  shift,
r_Minterval &  sdom,
bool  bRowMajor2ColMajor,
std::string  marraytypename,
std::string  tiling 
)

insert an image into the collection

void RasdamanHelper2::insertUserCollection ( std::string  collname,
std::string  colltypename 
)

Inserts a new collection 'collname' of type rtype into the data base

bool RasdamanHelper2::isNMMetaAvailable ( void  )
std::vector<int> RasdamanHelper2::offset2index ( int  offset,
std::vector< int > &  sdom 
)

Calculates the n-dimensional 0-based index of an array element given its 0-based index (offset) within the underlying 1D array.

The method requires the dimensions being specified starting with the fastest moving index (i.e. {column, row, layer, ...} for row-major arrays and {row, column, layer, ...} for column-major arrays).

std::vector<int> RasdamanHelper2::offset2index ( int  offset,
r_Minterval &  sdom 
)

Calculates n-dimensional 0-based index of an array element given its 0-based index (offset) within the underlying 1D array

void RasdamanHelper2::rowBuf2ColBuf ( char *  rowbuf,
char *  colbuf,
r_Type::r_Type_Id  rtype,
int  ncols,
int  nrows,
int  nlayers 
)
throw (r_Error
)

Transposes a 1D, 2D, or 3D row-major array into a column-major array

Parameters
colbufcolumn-major array
rowbufrow-major array
rtypedata type of array elements
ncolsnumber of columns of the data set (#pixel in x-direction)
nrowsnumber of rows of the data set (#pixel in y-direction)
nlayersnumber of layers of the data set (#pixel in z-direction)
void RasdamanHelper2::rowBuf2ColBuf ( char *  rowbuf,
char *  colbuf,
unsigned int  pixelsize,
r_Minterval &  sdom 
)

Transposes a n-dimensional row-major array into a column-major array

Parameters
colbufcolumn-major array
rowbufrow-major array
pixelsizesize of array elements in byte
sdomdimensions of the array
void RasdamanHelper2::rowBuf2ColBuf ( char *  rowbuf,
char *  colbuf,
unsigned int  pixelsize,
unsigned int  nelem,
int  ncols,
int  nrows,
int  nlayers 
)

Transposes a 1D, 2D, or 3D multi-band row-major arrays into a col-major array

void RasdamanHelper2::setMaxImgSize ( long  maximgsize)
inline

References m_maximgsize.

void RasdamanHelper2::updateImage ( std::string  collname,
double  imgid,
char *  buf,
r_Point &  shift,
r_Minterval &  sdom,
bool  bRowMajor2ColMajor,
std::string  marraytypename 
)
throw (r_Error
)

update an already present image in the collection

void RasdamanHelper2::writeNMMetadata ( string  collname,
long  oid,
long  epsgcode,
string  crsname,
double  minx,
double  maxx,
double  miny,
double  maxy,
double  minz,
double  maxz,
double  csx,
double  csy,
double  csz,
string  pixeltype,
double  stats_min,
double  stats_max,
double  stats_mean,
double  stats_stddev,
string  RATName 
)
throw (r_Error
)
int RasdamanHelper2::writeNMRAT ( std::string  filename,
double  oid,
int  band 
)
throw (r_Error
)
int RasdamanHelper2::writePSMetadata ( std::string  collname,
std::string  crs,
r_Type::r_Type_Id  rtype,
int  nbands,
double  xmin,
double  xmax,
double  ymin,
double  ymax,
double  zmax,
double  zmin,
int  xpix,
int  ypix,
int  zpix 
)

Member Data Documentation

long RasdamanHelper2::m_maximgsize
protected

the maximum image (tile/buffer) size that

Referenced by getMaxImgSize(), and setMaxImgSize().

RasdamanConnector* RasdamanHelper2::m_pRasconn
protected

pointer to the connection object

r_Transaction RasdamanHelper2::m_transaction
protected

private transaction object of this helper


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