QtMobility Reference Documentation

QGeoMapData Class Reference

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

 #include <QGeoMapData>

Inherits: QObject.

Inherited by: QGeoTiledMapData.

This class was introduced in Qt Mobility 1.1.

Properties

  • 1 property inherited from QObject

Public Functions

QGeoMapData ( QGeoMappingManagerEngine * engine )
virtual ~QGeoMapData ()
void addMapObject ( QGeoMapObject * mapObject )
void addMapOverlay ( QGeoMapOverlay * overlay )
qreal bearing () const
virtual QGeoCoordinate center () const
void clearMapObjects ()
void clearMapOverlays ()
virtual QGraphicsGeoMap::ConnectivityMode connectivityMode () const
virtual QPointF coordinateToScreenPosition ( const QGeoCoordinate & coordinate ) const = 0
virtual void fitInViewport ( const QGeoBoundingBox & bounds, bool preserveViewportCenter = false ) = 0
virtual void init ()
QList<QGeoMapObject *> mapObjects () const
virtual QList<QGeoMapObject *> mapObjectsAtScreenPosition ( const QPointF & screenPosition ) const
virtual QList<QGeoMapObject *> mapObjectsInScreenRect ( const QRectF & screenRect ) const
virtual QList<QGeoMapObject *> mapObjectsInViewport () const
QList<QGeoMapOverlay *> mapOverlays () const
virtual QGraphicsGeoMap::MapType mapType () const
qreal maximumTilt () const
qreal minimumTilt () 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
void setBearing ( qreal bearing )
virtual void setCenter ( const QGeoCoordinate & center )
virtual void setConnectivityMode ( QGraphicsGeoMap::ConnectivityMode connectivityMode )
virtual void setMapType ( QGraphicsGeoMap::MapType mapType )
void setTilt ( qreal tilt )
virtual void setWindowSize ( const QSizeF & size )
virtual void setZoomLevel ( qreal zoomLevel )
bool supportsBearing () const
bool supportsTilting () const
qreal tilt () const
virtual QGeoBoundingBox viewport () const = 0
virtual QSizeF windowSize () const
virtual qreal zoomLevel () const
  • 29 public functions inherited from QObject

Signals

void bearingChanged ( qreal bearing )
void centerChanged ( const QGeoCoordinate & coordinate )
void connectivityModeChanged ( QGraphicsGeoMap::ConnectivityMode connectivityMode )
void mapTypeChanged ( QGraphicsGeoMap::MapType mapType )
void tiltChanged ( qreal tilt )
void updateMapDisplay ( const QRectF & target = QRectF() )
void windowSizeChanged ( const QSizeF & windowSize )
void zoomLevelChanged ( qreal zoomLevel )

Protected Functions

QGeoMapObject * containerObject ()
virtual QGeoMapObjectInfo * createMapObjectInfo ( QGeoMapObject * object )
QGeoMappingManagerEngine * engine () const
virtual void paintMap ( QPainter * painter, const QStyleOptionGraphicsItem * option )
virtual void paintObjects ( QPainter * painter, const QStyleOptionGraphicsItem * option )
virtual void paintProviderNotices ( QPainter * painter, const QStyleOptionGraphicsItem * option )
void setBlockPropertyChangeSignals ( bool block )
  • 7 protected functions inherited from QObject

Additional Inherited Members

  • 1 public slot inherited from QObject
  • 1 public variable inherited from QObject
  • 4 static public members inherited from QObject
  • 2 protected variables inherited from QObject

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 overridden. 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 createMapObjectInfo() so that QGeoMapObjectInfo instances will be created for each QGeoMapObject type in order to provide the QGeoMapData subclass specific behaviours for the map objects.

Property Documentation

bearing : qreal

Returns the current bearing of the map.

Value in degrees in the range of 0-360. 0 being equivalent to 0 degrees from north.

This property was introduced in Qt Mobility 1.2.

Access functions:

qreal bearing () const
void setBearing ( qreal bearing )

Notifier signal:

void bearingChanged ( qreal bearing )

center : QGeoCoordinate

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

This property was introduced in Qt Mobility 1.1.

Access functions:

virtual QGeoCoordinate center () const
virtual void setCenter ( const QGeoCoordinate & center )

Notifier signal:

void centerChanged ( const QGeoCoordinate & coordinate )

connectivityMode : QGraphicsGeoMap::ConnectivityMode

Returns the connectivity mode for this map.

This property was introduced in Qt Mobility 1.1.

Access functions:

virtual QGraphicsGeoMap::ConnectivityMode connectivityMode () const
virtual void setConnectivityMode ( QGraphicsGeoMap::ConnectivityMode connectivityMode )

Notifier signal:

void connectivityModeChanged ( QGraphicsGeoMap::ConnectivityMode connectivityMode )

mapType : QGraphicsGeoMap::MapType

Returns the type of map data which is being displayed.

This property was introduced in Qt Mobility 1.1.

Access functions:

virtual QGraphicsGeoMap::MapType mapType () const
virtual void setMapType ( QGraphicsGeoMap::MapType mapType )

Notifier signal:

void mapTypeChanged ( QGraphicsGeoMap::MapType mapType )

maximumTilt : const qreal

Returns maximum tilt supported by this engine.

This property was introduced in Qt Mobility 1.2.

Access functions:

qreal maximumTilt () const

minimumTilt : const qreal

Returns minimum tilt supported by this engine.

This property was introduced in Qt Mobility 1.2.

Access functions:

qreal minimumTilt () const

supportsBearing : const bool

Returns whether bearing is supported by this engine.

This property was introduced in Qt Mobility 1.2.

Access functions:

bool supportsBearing () const

supportsTilting : const bool

Returns whether tilting is supported by this engine.

This property was introduced in Qt Mobility 1.2.

Access functions:

bool supportsTilting () const

tilt : qreal

Returns the current tilt of the map.

Value in degrees where 0 is equivalent to 90 degrees between view and earth's surface i.e. looking straight down to earth.

This property was introduced in Qt Mobility 1.2.

Access functions:

qreal tilt () const
void setTilt ( qreal tilt )

Notifier signal:

void tiltChanged ( qreal tilt )

windowSize : QSizeF

Returns the size of the map viewport.

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

This property was introduced in Qt Mobility 1.1.

Access functions:

virtual QSizeF windowSize () const
virtual void setWindowSize ( const QSizeF & size )

Notifier signal:

void windowSizeChanged ( const QSizeF & windowSize )

zoomLevel : qreal

Returns the zoom level of the map.

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

This property was introduced in Qt Mobility 1.1.

Access functions:

virtual qreal zoomLevel () const
virtual void setZoomLevel ( qreal zoomLevel )

Notifier signal:

void zoomLevelChanged ( qreal zoomLevel )

Member Function Documentation

QGeoMapData::QGeoMapData ( QGeoMappingManagerEngine * engine )

Constructs a new map data object, which 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.

This function was introduced in Qt Mobility 1.1.

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.

This function was introduced in Qt Mobility 1.1.

void QGeoMapData::bearingChanged ( qreal bearing ) [signal]

This signal is emitted when the bearing of the map has changed.

The new value is bearing.

This function was introduced in Qt Mobility 1.2.

void QGeoMapData::centerChanged ( const QGeoCoordinate & coordinate ) [signal]

This signal is emitted when the center of the map has changed.

The new value is coordinate.

This function was introduced in Qt Mobility 1.1.

void QGeoMapData::clearMapObjects ()

Clears the map objects associated with this map.

The map objects will be deleted.

This function was introduced in Qt Mobility 1.1.

void QGeoMapData::clearMapOverlays ()

Clears the map overlays associated with this map.

The map overlays will be deleted.

This function was introduced in Qt Mobility 1.1.

void QGeoMapData::connectivityModeChanged ( QGraphicsGeoMap::ConnectivityMode connectivityMode ) [signal]

This signal is emitted when the connectivity mode used to fetch the map data has changed.

The new value is connectivityMode.

This function was introduced in Qt Mobility 1.1.

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.

This function was introduced in Qt Mobility 1.1.

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.

This function was introduced in Qt Mobility 1.1.

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

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

The default implementation returns 0.

This function was introduced in Qt Mobility 1.1.

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

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

This function was introduced in Qt Mobility 1.1.

void QGeoMapData::fitInViewport ( const QGeoBoundingBox & bounds, bool preserveViewportCenter = false ) [pure virtual]

Attempts to fit the bounding box bounds into the viewport of the map.

This method will change the zoom level to the maximum zoom level such that all of bounds is visible within the resulting viewport.

If preserveViewportCenter is false the map will be centered on the bounding box bounds before the zoom level is changed, otherwise the center of the map will not be changed.

This function was introduced in Qt Mobility 1.1.

void QGeoMapData::init () [virtual]

This function is run after the QGeoMapData instance has been constructed.

Any subclasses which override this function should make sure that QGeoMapData::init() is called within the body of the overriding function.

This function was introduced in Qt Mobility 1.1.

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

Returns the map objects associated with this map.

This function was introduced in Qt Mobility 1.1.

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

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

This function was introduced in Qt Mobility 1.1.

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

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

This function was introduced in Qt Mobility 1.1.

QList<QGeoMapObject *> QGeoMapData::mapObjectsInViewport () const [virtual]

Returns the list of visible map objects manager by this widget which are displayed at least partially within the viewport of the map.

This function was introduced in Qt Mobility 1.1.

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

Returns the map overlays associated with this map.

This function was introduced in Qt Mobility 1.1.

void QGeoMapData::mapTypeChanged ( QGraphicsGeoMap::MapType mapType ) [signal]

This signal is emitted when the type of the map has changes.

The value is mapType.

This function was introduced in Qt Mobility 1.1.

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

Paints the map and everything associated with it on painter, using the options option.

This will paint the map with paintMap(), then the map overlays with QGeoMapOverlay::paint(), then the map objects with paintObjects(), and finally paintProviderNotices().

This function was introduced in Qt Mobility 1.1.

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

Paints the map on painter, using the options option.

The map overlays, map objects and the provider notices (such as copyright and powered by notices) are painted in separate methods, which are combined in the paint() method.

The default implementation does not paint anything.

This function was introduced in Qt Mobility 1.1.

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

Paints the map objects on painter, using the options option.

The default implementation makes use of the coordinateToScreenPosition implemented by the subclass to perform object positioning and rendering.

This implementation should suffice for most common use cases, and supports the full range of coordinate systems and transforms available to a QGeoMapObject.

This function was introduced in Qt Mobility 1.1.

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

Paints the provider notices on painter, using the options option.

The provider notices are things like the copyright and powered by notices.

The provider may not want the client developers to be able to move the notices from their standard positions and so we have not provided API support for specifying the position of the notices at this time.

If support for hinting at the position of the notices is to be provided by plugin parameters, the suggested parameter keys are "mapping.notices.copyright.alignment" and "mapping.notices.poweredby.alignment", with type Qt::Alignment.

The default implementation does not paint anything.

This function was introduced in Qt Mobility 1.1.

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.

Subclasses should call QGeoMapData::setCenter() when the pan has completed.

This function was introduced in Qt Mobility 1.1.

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.

This function was introduced in Qt Mobility 1.1.

void QGeoMapData::removeMapOverlay ( QGeoMapOverlay * overlay )

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

The map will release ownership of overlay.

This function was introduced in Qt Mobility 1.1.

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.

This function was introduced in Qt Mobility 1.1.

void QGeoMapData::setBlockPropertyChangeSignals ( bool block ) [protected]

Sets whether changes to properties will trigger their corresponding signals to block.

By default the QGeoMapData implementations of the property functions are used which cause the property notification signals to be emitted immediately.

Calling this function with block set to true will prevent these signals from being called, which will allow a subclass to defer the emission of the signal until a later time.

If this function needs to be called it should be used as soon as possible, preferably in the constructor of the QGeoMapData subclass.

This function was introduced in Qt Mobility 1.1.

void QGeoMapData::tiltChanged ( qreal tilt ) [signal]

This signal is emitted when the tilt of the map has changed.

The new value is tilt.

This function was introduced in Qt Mobility 1.2.

void QGeoMapData::updateMapDisplay ( const QRectF & target = QRectF() ) [signal]

This signal is emitted when the region target of the window which contains the map needs to be updated.

If target is empty then the entire map will be updated.

This function was introduced in Qt Mobility 1.1.

QGeoBoundingBox QGeoMapData::viewport () const [pure virtual]

Returns a bounding box corresponding to the physical area displayed in the viewport of the map.

The bounding box which is returned is defined by the upper left and lower right corners of the visible area of the map.

This function was introduced in Qt Mobility 1.1.

void QGeoMapData::windowSizeChanged ( const QSizeF & windowSize ) [signal]

This signal is emitted when the size of the window which contains the map has changed.

The new value is windowSize.

This function was introduced in Qt Mobility 1.1.

void QGeoMapData::zoomLevelChanged ( qreal zoomLevel ) [signal]

This signal is emitted when the zoom level of the map has changed.

The new value is zoomLevel.

This function was introduced in Qt Mobility 1.1.

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.