MoSync 3.3
MAP::MapViewport Class Reference

Simple slippy map viewport. More...

#include <MAP/MapViewport.h>

Inheritance diagram for MAP::MapViewport:
MAP::IMapCacheListener MAPUtil::Broadcaster< IMapViewportListener > MAP::LayerMapViewport

List of all members.

Public Member Functions

 MapViewport ()
virtual ~MapViewport ()
void updateMap ()
MapSourcegetMapSource () const
void setMapSource (MapSource *source)
LonLat getCenterPosition () const
void setCenterPosition (LonLat targetLonLat, bool immediate, bool isPointerEvent)
void setCenterPosition (LonLat targetLonLat, MagnificationType magnification, bool immediate, bool isPointerEvent)
PixelCoordinate getCenterPositionPixels () const
MagnificationType getMagnification () const
void setMagnification (MagnificationType magnification)
bool showLonLat () const
void setShowLonLat (bool enabled)
bool showHairlineCross () const
void setShowHairlineCross (bool enabled)
bool showPixelScale () const
void setShowPixelScale (bool enabled)
void startGlide ()
void stopGlide ()
FontgetFont () const
void setFont (Font *font)
void scroll (MapViewportScrollDirection direction, bool largeStep)
void zoomIn ()
void zoomOut ()
void setWidth (int width)
void setHeight (int height)
virtual bool handleKeyPress (int keyCode)
virtual bool handleKeyRelease (int keyCode)
virtual void tileReceived (MapCache *sender, MapTile *tile, bool foundInCache)
virtual void jobComplete (MapCache *sender)
virtual void error (MapCache *sender, int error)
MAPoint2d worldPixelToViewport (PixelCoordinate wpx)
PixelCoordinate viewportToWorldPixel (MAPoint2d pt)
void centerAndScaleToRectangle (LonLat lowerLeft, LonLat upperRight)
int getWidth ()
int getHeight () const
int getScaledWidth () const
int getScaledHeight () const
virtual void drawViewport (Point origin)
void beginZooming (const MAPoint2d &p1, const MAPoint2d &p2)
void updateZooming (const MAPoint2d &p1, const MAPoint2d &p2)
void endZooming ()
bool isZooming ()
void beginPanning (const MAPoint2d &p)
void updatePanning (const MAPoint2d &p)
void endPanning ()
void moveCenterPositionInPixels (int xdelta, int ydelta)
void setScale (double scale)
double getScale ()
void addListener (IMapViewportListener *listener)
void removeListener (IMapViewportListener *listener)
Vector< IMapViewportListener * > * getListeners ()

Protected Member Functions

virtual void onViewportUpdated ()
virtual void onError (int code)
virtual void drawOverlay (Rect &bounds, MagnificationType magnification)

Friends

class MapViewportIdleListener

Detailed Description

Simple slippy map viewport.


Constructor & Destructor Documentation

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

Member Function Documentation

Map update scope

Map source property

Center position property

void MAP::MapViewport::setCenterPosition ( LonLat  targetLonLat,
bool  immediate,
bool  isPointerEvent 
)
void MAP::MapViewport::setCenterPosition ( LonLat  targetLonLat,
MagnificationType  magnification,
bool  immediate,
bool  isPointerEvent 
)

Magnification property

bool MAP::MapViewport::showLonLat ( ) const [inline]
void MAP::MapViewport::setShowLonLat ( bool  enabled)
bool MAP::MapViewport::showHairlineCross ( ) const [inline]
bool MAP::MapViewport::showPixelScale ( ) const [inline]
void MAP::MapViewport::setShowPixelScale ( bool  enabled)
Font* MAP::MapViewport::getFont ( ) const [inline]

Returns currently used font.

void MAP::MapViewport::setFont ( Font font) [inline]

Sets font property.

void MAP::MapViewport::scroll ( MapViewportScrollDirection  direction,
bool  largeStep 
)

Scrolls the map in the specified direction.

Increases magnification by 1 step, i.e. a factor of two.

void MAP::MapViewport::setWidth ( int  width)
void MAP::MapViewport::setHeight ( int  height)
virtual bool MAP::MapViewport::handleKeyPress ( int  keyCode) [virtual]

Handles key press. Returns true if handled.

Reimplemented in MAP::LayerMapViewport.

virtual bool MAP::MapViewport::handleKeyRelease ( int  keyCode) [virtual]

Handles key release. Returns true if handled.

Reimplemented in MAP::LayerMapViewport.

virtual void MAP::MapViewport::tileReceived ( MapCache sender,
MapTile tile,
bool  foundInCache 
) [virtual]

Called when a requested tile has been received into cache from map source.

Implements MAP::IMapCacheListener.

virtual void MAP::MapViewport::jobComplete ( MapCache sender) [virtual]

Called when a tile job is completed.

Implements MAP::IMapCacheListener.

virtual void MAP::MapViewport::error ( MapCache sender,
int  code 
) [virtual]

Called when an error occurred, likely when MapSource failed to download tile.

Implements MAP::IMapCacheListener.

Converts from global map pixels to viewport pixels.

Converts from viewport pixels to global map pixels.

void MAP::MapViewport::centerAndScaleToRectangle ( LonLat  lowerLeft,
LonLat  upperRight 
)
int MAP::MapViewport::getWidth ( ) [inline]
int MAP::MapViewport::getHeight ( ) const [inline]
int MAP::MapViewport::getScaledWidth ( ) const [inline]

References floor().

int MAP::MapViewport::getScaledHeight ( ) const [inline]

References floor().

virtual void MAP::MapViewport::drawViewport ( Point  origin) [virtual]
void MAP::MapViewport::beginZooming ( const MAPoint2d p1,
const MAPoint2d p2 
)
void MAP::MapViewport::updateZooming ( const MAPoint2d p1,
const MAPoint2d p2 
)
void MAP::MapViewport::moveCenterPositionInPixels ( int  xdelta,
int  ydelta 
)
void MAP::MapViewport::setScale ( double  scale)
virtual void MAP::MapViewport::onViewportUpdated ( ) [protected, virtual]
virtual void MAP::MapViewport::onError ( int  code) [protected, virtual]
virtual void MAP::MapViewport::drawOverlay ( Rect bounds,
MagnificationType  magnification 
) [protected, virtual]

Reimplemented in MAP::LayerMapViewport.

void MAPUtil::Broadcaster< IMapViewportListener >::addListener ( IMapViewportListener *  listener) [inline, inherited]

Add a listener. Clients should call this to register for notification.

void MAPUtil::Broadcaster< IMapViewportListener >::removeListener ( IMapViewportListener *  listener) [inline, inherited]

Remove a listener. Clients should call this to unregister for notification.


Friends And Related Function Documentation

friend class MapViewportIdleListener [friend]
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines