Qt Mobility Reference Documentation

QGeoMapData Class Reference

The QGeoMapData class are used as a bridge between QGraphicsGeoMap and QGeoMappingManager. More...

 #include <QGeoMapData>

Inherited by QGeoTiledMapData.


Public Functions

QGeoMapData ( QGeoMappingManagerEngine * engine, QGraphicsGeoMap * geoMap )
virtual ~QGeoMapData ()
void addMapObject ( QGeoMapObject * mapObject )
void addMapOverlay ( QGeoMapOverlay * overlay )
void associateMapObject ( QGeoMapObject * mapObject )
virtual QGeoCoordinate center () const
void clearMapObjects ()
void clearMapOverlays ()
virtual QPointF coordinateToScreenPosition ( const QGeoCoordinate & coordinate ) const = 0
QList<QGeoMapObject *> mapObjects () const
virtual QList<QGeoMapObject *> mapObjectsAtScreenPosition ( const QPointF & screenPosition )
virtual QList<QGeoMapObject *> mapObjectsInScreenRect ( const QRectF & screenRect )
QList<QGeoMapOverlay *> mapOverlays () const
virtual QGraphicsGeoMap::MapType mapType () const
virtual void paint ( QPainter * painter, const QStyleOptionGraphicsItem * option )
virtual void pan ( int dx, int dy )
void removeMapObject ( QGeoMapObject * mapObject )
void removeMapOverlay ( QGeoMapOverlay * overlay )
virtual QGeoCoordinate screenPositionToCoordinate ( const QPointF & screenPosition ) const = 0
virtual void setCenter ( const QGeoCoordinate & center )
virtual void setMapType ( QGraphicsGeoMap::MapType mapType )
virtual void setViewportSize ( const QSizeF & size )
virtual void setZoomLevel ( qreal zoomLevel )
virtual QSizeF viewportSize () const
virtual qreal zoomLevel () const

Protected Functions

QGeoMapObject * containerObject ()
virtual QGeoMapObjectInfo * createMapObjectInfo ( QGeoMapObject * object )
QGeoMappingManagerEngine * engine () const
QGraphicsGeoMap * geoMap () const

Detailed Description

The QGeoMapData class are used as a bridge between QGraphicsGeoMap and QGeoMappingManager.

Instances of QGeoMapData are created with QGeoMappingManager::createMapData(), and are used internally by QGraphicsGeoMap to manage the state of the map and the associated QGeoMapObject instances.

Plugin implementers will need to provide implementations of coordinateToScreenPosition(const QGeoCoordinate &coordinate) and QGeoCoordinate screenPositionToCoordinate(const QPointF &screenPosition).

The other virtual functions can be overriden. If the screen position to coordinate tranformations are expensive then overriding these functions may allow optimizations based on caching parts of the geometry information.

Subclasses should override createMapObjecInfo() so that QGeoMapObjectInfo instances will be created for each QGeoMapObject type in order to provide the QGeoMapData subclass specific behaviours for the map objects.


Member Function Documentation

QGeoMapData::QGeoMapData ( QGeoMappingManagerEngine * engine, QGraphicsGeoMap * geoMap )

Constructs a new map data object, which stores the map data required by geoMap and makes use of the functionality provided by engine.

QGeoMapData::~QGeoMapData () [virtual]

Destroys this map data object.

void QGeoMapData::addMapObject ( QGeoMapObject * mapObject )

Adds mapObject to the list of map objects managed by this map.

The children objects are drawn in order of the QGeoMapObject::zValue() value. Children objects having the same z value will be drawn in the order they were added.

The map will take ownership of the mapObject.

void QGeoMapData::addMapOverlay ( QGeoMapOverlay * overlay )

Adds overlay to the list of map overlays associated with this map.

The overlays will be drawn in the order in which they were added.

The map will take ownership of overlay.

void QGeoMapData::associateMapObject ( QGeoMapObject * mapObject )

Sets up the associated between the map object mapObject and this map.

This will setup an instance of a QGeoMapObjectInfo subclass for mapObject which will handle any of the map object behaviour which is specifical to this QGeoMapData subclass.

This function uses createMapObjectInfo as a factory for the QGeoMapObjectInfo instance, and so subclasses should reimplement createMapObjectInfo to create the appropriate QGeoMapObjectInfo objects.

QGeoCoordinate QGeoMapData::center () const [virtual]

Returns the coordinate of the point in the center of the map viewport.

See also setCenter().

void QGeoMapData::clearMapObjects ()

Clears the map objects associated with this map.

The map objects will be deleted.

void QGeoMapData::clearMapOverlays ()

Clears the map overlays associated with this map.

The map overlays will be deleted.

QGeoMapObject * QGeoMapData::containerObject () [protected]

Returns the QGeoMapObject which acts as the parent to all QGeoMapObject instances which are added to the map by the user.

QPointF QGeoMapData::coordinateToScreenPosition ( const QGeoCoordinate & coordinate ) const [pure virtual]

Returns the position on the screen at which coordinate is displayed.

An invalid QPointF will be returned if coordinate is invalid or is not within the current viewport.

QGeoMapObjectInfo * QGeoMapData::createMapObjectInfo ( QGeoMapObject * object ) [virtual protected]

Creates a QGeoMapObjectInfo instance which implements the behaviours of the map object object which are specific to this QGeoMapData.

The default implementation returns 0.

QGeoMappingManagerEngine * QGeoMapData::engine () const [protected]

Returns the mapping engine that this map data object is associated with.

QGraphicsGeoMap * QGeoMapData::geoMap () const [protected]

Returns the QGraphicsGeoMap instance that this map data object is associated with.

QList<QGeoMapObject *> QGeoMapData::mapObjects () const

Returns the map objects associated with this map.

QList<QGeoMapObject *> QGeoMapData::mapObjectsAtScreenPosition ( const QPointF & screenPosition ) [virtual]

Returns the list of map objects managed by this map which contain the point screenPosition within their boundaries.

QList<QGeoMapObject *> QGeoMapData::mapObjectsInScreenRect ( const QRectF & screenRect ) [virtual]

Returns the list of map objects managed by this map which are displayed at least partially within the on screen rectangle screenRect.

QList<QGeoMapOverlay *> QGeoMapData::mapOverlays () const

Returns the map overlays associated with this map.

QGraphicsGeoMap::MapType QGeoMapData::mapType () const [virtual]

Returns the type of map data which is being displayed.

See also setMapType().

void QGeoMapData::paint ( QPainter * painter, const QStyleOptionGraphicsItem * option ) [virtual]

Paints the map on painter, using the options option.

This should handle the painting of the map overlays and the map objects as well.

The default implementation just draws the overlays.

void QGeoMapData::pan ( int dx, int dy ) [virtual]

Pans the map view dx pixels in the x direction and dy pixels in the y direction.

The x and y axes are specified in Graphics View Framework coordinates. By default this will mean that positive values of dx move the viewed area to the right and that positive values of dy move the viewed area down.

void QGeoMapData::removeMapObject ( QGeoMapObject * mapObject )

Removes mapObject from the list of map objects managed by this map. The map will release ownership of the mapObject.

void QGeoMapData::removeMapOverlay ( QGeoMapOverlay * overlay )

Removes overlay from the list of map overlays associated with this map.

The map will release ownership of overlay.

QGeoCoordinate QGeoMapData::screenPositionToCoordinate ( const QPointF & screenPosition ) const [pure virtual]

Returns the coordinate corresponding to the point in the viewport at screenPosition.

An invalid QGeoCoordinate will be returned if screenPosition is invalid or is not within the current viewport.

void QGeoMapData::setCenter ( const QGeoCoordinate & center ) [virtual]

Centers the map viewport on the coordinate center.

See also center().

void QGeoMapData::setMapType ( QGraphicsGeoMap::MapType mapType ) [virtual]

Changes the type of map data to display to mapType.

See also mapType().

void QGeoMapData::setViewportSize ( const QSizeF & size ) [virtual]

Sets the size of the map viewport to size.

The size will be adjusted by the associated QGraphicsGeoMap as it resizes.

See also viewportSize().

void QGeoMapData::setZoomLevel ( qreal zoomLevel ) [virtual]

Sets the zoom level of the map to zoomLevel.

Larger values of the zoom level correspond to more detailed views of the map.

If zoomLevel is less than minimumZoomLevel() then minimumZoomLevel() will be used, and if zoomLevel is larger than maximumZoomLevel() then maximumZoomLevel() will be used.

See also zoomLevel().

QSizeF QGeoMapData::viewportSize () const [virtual]

Returns the size of the map viewport.

The size will be adjusted by the associated QGraphicsGeoMap as it resizes.

See also setViewportSize().

qreal QGeoMapData::zoomLevel () const [virtual]

Returns the zoom level of the map.

Larger values of the zoom level correspond to more detailed views of the map.

See also setZoomLevel().

X

Thank you for giving your feedback.

Make sure it is related to this specific page. For more general bugs and requests, please use the Qt Bug Tracker.