MoSync 3.3
MAP::GoogleMapSource Class Reference

Implements a MapSource for Google Static Maps. More...

#include <MAP/GoogleMapSource.h>

Inheritance diagram for MAP::GoogleMapSource:
MAP::MapSource MAUtil::DownloadListener

List of all members.

Public Member Functions

 GoogleMapSource (GoogleMapKind mapKind)
virtual ~GoogleMapSource ()
int getTileSize () const
int getMagnificationMin () const
int getMagnificationMax () const
void getTileUrl (char *buffer, MapTileCoordinate tileXY)
MapTileCoordinate lonLatToTile (LonLat lonlat, MagnificationType magnification)
PixelCoordinate lonLatToPixel (LonLat lonlat, MagnificationType magnification)
LonLat tileCenterToLonLat (const int tileSize, const MapTileCoordinate &tile, const double offsetX, const double offsetY)
void requestTile (IMapSourceListener *listener, const MapTileCoordinate tileXY)
void requestJobComplete (IMapSourceListener *listener)
void clearQueue ()
int getTileCount ()
void finishedDownloading (Downloader *downloader, MAHandle data)
void downloadCancelled (Downloader *downloader)
void error (Downloader *downloader, int code)
virtual void notifyProgress (Downloader *downloader, int downloadedBytes, int totalBytes)
virtual bool outOfMemory (Downloader *downloader)

Static Public Attributes

static const char * ApiKey

Detailed Description

Implements a MapSource for Google Static Maps.

NOTE: This code is just a sample, Google's Static Maps service is not intended for use as a map tile server.


Constructor & Destructor Documentation

Creates a GoogleMapSource of the specified map kind.


Member Function Documentation

int MAP::GoogleMapSource::getTileSize ( ) const [inline, virtual]

Returns tile size

Implements MAP::MapSource.

int MAP::GoogleMapSource::getMagnificationMin ( ) const [inline, virtual]

Returns minimum magnification

Implements MAP::MapSource.

int MAP::GoogleMapSource::getMagnificationMax ( ) const [inline, virtual]

Returns maximum magnification

Implements MAP::MapSource.

void MAP::GoogleMapSource::getTileUrl ( char *  buffer,
MapTileCoordinate  tileXY 
) [virtual]

Returns URL for retrieving a tile

Implements MAP::MapSource.

Converts LonLat to tile coordinates for a tile that contains the lonlat point.

Implements MAP::MapSource.

Converts LonLat to a pixel coordinate, in a global pixel grid

Implements MAP::MapSource.

LonLat MAP::GoogleMapSource::tileCenterToLonLat ( const int  tileSize,
const MapTileCoordinate tile,
const double  offsetX,
const double  offsetY 
) [virtual]

Convert tile center plus pixel offset to WGS84 lat/lon.

Implements MAP::MapSource.

void MAP::MapSource::requestTile ( IMapSourceListener listener,
const MapTileCoordinate  tileXY 
) [inherited]

Returns all tiles required to cover specified rectangle around centerpoint.

void MAP::MapSource::requestJobComplete ( IMapSourceListener listener) [inherited]
void MAP::MapSource::clearQueue ( ) [inherited]

Clears any queued requests

int MAP::MapSource::getTileCount ( ) [inline, inherited]
void MAP::MapSource::finishedDownloading ( Downloader downloader,
MAHandle  data 
) [virtual, inherited]

Called when all data has been downloaded.

Parameters:
downloaderA pointer to the downloader sending this event.
dataMAHandle to the binary data resource with the downloaded data. It is the responsibility of the application to free the data handle once it is not needed (use maDestroyObject() for this). In case a handle was supplied to beginDownloading() the data parameter will refer to that handle.

Implements MAUtil::DownloadListener.

void MAP::MapSource::downloadCancelled ( Downloader downloader) [virtual, inherited]

Called if the download has been cancelled.

Parameters:
downloaderA pointer to the downloader sending this event.

Implements MAUtil::DownloadListener.

void MAP::MapSource::error ( Downloader downloader,
int  code 
) [virtual, inherited]

Called if an error occured.

Parameters:
downloaderA pointer to the downloader sending this event.
codeThe error code describing the error. See CONNERR .

Implements MAUtil::DownloadListener.

virtual void MAUtil::DownloadListener::notifyProgress ( Downloader downloader,
int  downloadedBytes,
int  totalBytes 
) [virtual, inherited]

Called when some data has been downloaded to notify about the progress of the download.

Parameters:
downloaderA pointer to the downloader sending this event.
downloadedBytesThe amount of bytes downloaded.
totalBytesThe amount of bytes to be downloaded. Zero means that the total content length is unknown.
virtual bool MAUtil::DownloadListener::outOfMemory ( Downloader downloader) [virtual, inherited]

Called if the Downloader runs out of memory. Try to free some resource memory. If you managed to free some, return true to make the Downloader try again. If you can't free any more, return false to make the Downloader fail with CONNERR_DOWNLOADER_OOM. The default implementation does nothing and returns false. Note: This feature is not yet implemented, outOfMemory() is never called by download framework.


Member Data Documentation

const char* MAP::GoogleMapSource::ApiKey [static]

Google Static Maps reqires a registered API key. see http://code.google.com/apis/maps/documentation/staticmaps/ for details.

NOTE: Assign your registered key string to GoogleMapSource::ApiKey before using this map source.

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines