MoSync 3.3
MAP::MapSource Class Reference

Base class for map sources. More...

#include <MAP/MapSource.h>

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

List of all members.

Public Member Functions

 MapSource ()
virtual ~MapSource ()
virtual int getTileSize () const =0
virtual int getMagnificationMin () const =0
virtual int getMagnificationMax () const =0
virtual void getTileUrl (char *buffer, MapTileCoordinate tileXY)=0
virtual PixelCoordinate lonLatToPixel (LonLat lonlat, MagnificationType magnification)=0
virtual MapTileCoordinate lonLatToTile (LonLat lonlat, MagnificationType magnification)=0
virtual LonLat tileCenterToLonLat (const int tileSize, const MapTileCoordinate &tile, const double offsetX, const double offsetY)=0
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)

Detailed Description

Base class for map sources.

A map source is a provider of map tiles. Behavior is modeled after OpenStreetMap tile server.


Constructor & Destructor Documentation

virtual MAP::MapSource::~MapSource ( ) [virtual]

Member Function Documentation

virtual int MAP::MapSource::getTileSize ( ) const [pure virtual]
virtual int MAP::MapSource::getMagnificationMin ( ) const [pure virtual]

Returns minimum magnification

Implemented in MAP::GoogleMapSource, MAP::CloudMadeMapSource, and MAP::OpenStreetMapSource.

virtual int MAP::MapSource::getMagnificationMax ( ) const [pure virtual]

Returns maximum magnification

Implemented in MAP::GoogleMapSource, MAP::CloudMadeMapSource, and MAP::OpenStreetMapSource.

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

Returns URL for retrieving a tile

Implemented in MAP::CloudMadeMapSource, MAP::GoogleMapSource, and MAP::OpenStreetMapSource.

virtual PixelCoordinate MAP::MapSource::lonLatToPixel ( LonLat  lonlat,
MagnificationType  magnification 
) [pure virtual]

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

Implemented in MAP::CloudMadeMapSource, MAP::GoogleMapSource, and MAP::OpenStreetMapSource.

virtual MapTileCoordinate MAP::MapSource::lonLatToTile ( LonLat  lonlat,
MagnificationType  magnification 
) [pure virtual]

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

Implemented in MAP::CloudMadeMapSource, MAP::GoogleMapSource, and MAP::OpenStreetMapSource.

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

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

Implemented in MAP::CloudMadeMapSource, MAP::GoogleMapSource, and MAP::OpenStreetMapSource.

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

Returns all tiles required to cover specified rectangle around centerpoint.

Clears any queued requests

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

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]

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]

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.

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines