Skip to content

Commit

Permalink
Pilibocik: Doxygen
Browse files Browse the repository at this point in the history
  • Loading branch information
dotevo committed Dec 7, 2011
1 parent d7d5b76 commit 6168b81
Show file tree
Hide file tree
Showing 5 changed files with 459 additions and 25 deletions.
32 changes: 28 additions & 4 deletions lib/PiLibocik/include/pilibocik/boundarybox.h
Expand Up @@ -10,15 +10,39 @@
namespace PiLibocik{


/**
* @brief Boundary box has positions of two corners.
*
* @class BoundaryBox boundarybox.h "include/pilibocik/boundarybox.h"
*/
class BoundaryBox{
private:
Position p1;
Position p2;
int precision;
QMap< int, QPair< double,double > > spatialError;
Position p1; /**< TODO */
Position p2; /**< TODO */
int precision; /**< TODO */
QMap< int, QPair< double,double > > spatialError; /**< TODO */
public:
/**
* @brief Constructor
*
* @fn BoundaryBox
* @param p1 First corner
* @param p2 Second corner
*/
BoundaryBox(Position p1,Position p2);
/**
* @brief
*
* @fn getCurrentError
* @return Error of precision
*/
QPair< double,double > getCurrentError();
/**
* @brief List of geohashes in box.
*
* @fn getGeohashesIn
* @param precision precision of geohash.
*/
QList < Geohash > getGeohashesIn(int precision);
};

Expand Down
162 changes: 158 additions & 4 deletions lib/PiLibocik/include/pilibocik/geohash.h
Expand Up @@ -7,42 +7,182 @@
#include <QHash>

namespace PiLibocik{
/**
* @brief
*
* @class Geohash geohash.h "include/pilibocik/geohash.h"
*/
class Geohash
{
private:
static const QString char_map;
static const QString char_map; /**< TODO */


/**
* @brief
*
* @fn init
* @param geohash
*/
void init(QString geohash);
public:
int geohashSize;
char *geohashValue;
int geohashSize; /**< TODO */
char *geohashValue; /**< TODO */

/**
* @brief Empty constructor
*
* @fn Geohash
*/
Geohash();
/**
* @brief Constructor with precision and empty data.
*
* @fn Geohash
* @param precision Length of geohash in base32.
*/
Geohash(int precision);
/**
* @brief Construct geohash from QString.
*
* @fn Geohash
* @param geohash Geohash in base32.
*/
Geohash(QString geohash);
/**
* @brief Coping constructor.
*
* @fn Geohash
* @param geohash
*/
Geohash(const Geohash &geohash);
/**
* @brief Geohash from position.
*
* @fn Geohash
* @param lon
* @param lat
* @param precision
*/
Geohash(double lon,double lat,int precision);
/**
* @brief Geohash from data.
*
* @fn Geohash
* @param n Array of chars.
* @param size Array size.
*/
Geohash(char *n,int size);
/**
* @brief Destructor
*
* @fn ~Geohash
*/
~Geohash();

/**
* @brief Geohash to QString (in base32).
*
* @fn toQString
*/
QString toQString();
/**
* @brief Static method to generate geohash in position.
*
* @fn generateGeohash
* @param lon
* @param lat
* @param precision geohash length
*/
static QString generateGeohash(double lon, double lat, int precision);

/**
* @brief Increment geohash value. 009 to 00a etc.
*
* @fn operator ++
* @param int
*/
void operator++(int);
/**
* @brief Decrement geohash value.
*
* @fn operator --
* @param int
*/
void operator--(int);
/**
* @brief
*
* @fn operator -
* @param q
*/
unsigned long long operator-(Geohash &q);
bool operator>(Geohash &q);
/**
* @brief
*
* @fn operator >
* @param q
*/
bool operator>(Geohash &q);
/**
* @brief
*
* @fn operator <
* @param q
*/
bool operator<(Geohash &q);
/**
* @brief
*
* @fn operator <
* @param q
*/
bool operator<(const Geohash &q);
/**
* @brief
*
* @fn operator ==
* @param q
*/
bool operator==(Geohash &q);
/**
* @brief
*
* @fn operator =
* @param q
*/
Geohash &operator=(Geohash &q);
/**
* @brief
*
* @fn operator =
* @param q
*/
Geohash &operator=(const Geohash &q);
/**
* @brief Return error.
*
* @fn getError
* @param prec
*/
static QPair< double, double > getError(int prec);
/**
* @brief Return error.
*
* @fn getError
*/
QPair< double, double > getError();
};
}

/**
* @brief
*
* @fn operator <
* @param e1
* @param e2
* @return bool operator
*/
inline bool operator<(const PiLibocik::Geohash &e1, const PiLibocik::Geohash &e2){
for(int i=0;i<e1.geohashSize&&i<e2.geohashSize;i++){
if((short)e1.geohashValue[i]<(short)e2.geohashValue[i]){
Expand All @@ -53,12 +193,26 @@ inline bool operator<(const PiLibocik::Geohash &e1, const PiLibocik::Geohash &e
return false;
}

/**
* @brief Function used in Hash.
*
* @fn caseInsensitiveLessThan
* @param s1
* @param s2
* @return bool
*/
inline bool caseInsensitiveLessThan(const PiLibocik::Geohash &s1, const PiLibocik::Geohash &s2)
{
return s1<s2;
}


/**
* @brief
*
* @fn qHash
* @param key
*/
uint qHash(PiLibocik::Geohash &key);

#endif // GEOHASH_H

0 comments on commit 6168b81

Please sign in to comment.