QtMobility Reference Documentation

QGraphicsGeoMap Class Reference

The QGraphicsGeoMap class is used to display a map and manager the interactions between the user and the map. More...

 #include <QGraphicsGeoMap>

Inherits: QGraphicsWidget.

This class was introduced in Qt Mobility 1.1.

Public Types

enum ConnectivityMode { NoConnectivity, OfflineMode, OnlineMode, HybridMode }
enum MapType { NoMap, StreetMap, SatelliteMapDay, SatelliteMapNight, ..., MobileGrayStreetMap }

Properties

Public Functions

QGraphicsGeoMap ( QGeoMappingManager * manager, QGraphicsItem * parent = 0 )
virtual ~QGraphicsGeoMap ()
void addMapObject ( QGeoMapObject * mapObject )
void addMapOverlay ( QGeoMapOverlay * overlay )
qreal bearing () const
QGeoCoordinate center () const
void clearMapObjects ()
void clearMapOverlays ()
ConnectivityMode connectivityMode () const
QPointF coordinateToScreenPosition ( const QGeoCoordinate & coordinate ) const
void fitInViewport ( const QGeoBoundingBox & bounds, bool preserveViewportCenter = false )
QList<QGeoMapObject *> mapObjects () const
QList<QGeoMapObject *> mapObjectsAtScreenPosition ( const QPointF & screenPosition ) const
QList<QGeoMapObject *> mapObjectsInScreenRect ( const QRectF & screenRect ) const
QList<QGeoMapObject *> mapObjectsInViewport () const
QList<QGeoMapOverlay *> mapOverlays () const
MapType mapType () const
qreal maximumTilt () const
qreal maximumZoomLevel () const
qreal minimumTilt () const
qreal minimumZoomLevel () const
void removeMapObject ( QGeoMapObject * mapObject )
void removeMapOverlay ( QGeoMapOverlay * overlay )
QGeoCoordinate screenPositionToCoordinate ( QPointF screenPosition ) const
void setBearing ( qreal bearing )
void setCenter ( const QGeoCoordinate & center )
void setConnectivityMode ( ConnectivityMode connectivityMode )
void setMapType ( MapType mapType )
void setTilt ( qreal tilt )
void setZoomLevel ( qreal zoomLevel )
QList<ConnectivityMode> supportedConnectivityModes () const
QList<MapType> supportedMapTypes () const
bool supportsBearing () const
bool supportsCustomMapObjects () const
bool supportsTilting () const
qreal tilt () const
QGeoBoundingBox viewport () const
qreal zoomLevel () const

Reimplemented Public Functions

virtual void paint ( QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * parent )
virtual QPainterPath shape () const

Public Slots

void pan ( int dx, int dy )

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 zoomLevelChanged ( qreal zoomLevel )

Reimplemented Protected Functions

virtual void resizeEvent ( QGraphicsSceneResizeEvent * event )

Additional Inherited Members

Detailed Description

The QGraphicsGeoMap class is used to display a map and manager the interactions between the user and the map.

Most of the functionality is provided by QGeoMappingManager, which handles most aspects of the display.

The map viewport can be panned, the zoom level can be changed and the center coordinate of the viewport can be set explicitly.

The screenPositionToCoordinate() and coordinateToScreenPoisition() functions can be used to convert between positions on the screen and global coordinates.

Mouse and keyboard events should be handled by subclassing QGraphicsGeoMap and providing implementations of the event handling functions present in QGraphicsWidget.

Member Type Documentation

enum QGraphicsGeoMap::ConnectivityMode

Describes the method of obtaining the mapping data.

ConstantValueDescription
QGraphicsGeoMap::NoConnectivity0There is no map data.
QGraphicsGeoMap::OfflineMode1The map data will come from an offline source.
QGraphicsGeoMap::OnlineMode2The map data will come from an online source.
QGraphicsGeoMap::HybridMode3The map data will come from a combination of offline and online sources.

enum QGraphicsGeoMap::MapType

Describes a type of map data.

ConstantValueDescription
QGraphicsGeoMap::NoMap0Indicates a lack of map valid data.
QGraphicsGeoMap::StreetMap1The map data is a graphical representation of streets and building boundaries.
QGraphicsGeoMap::SatelliteMapDay2The map data is composed of images collected by satellites during the daytime.
QGraphicsGeoMap::SatelliteMapNight3The map data is composed of images collected by satellites during the nighttime. For the online nokia plugin the SatelliteMapDay data is being used.
QGraphicsGeoMap::TerrainMap4The map data is a graphical representation of terrain features. This may also include some of the information provided by QGraphicsGeoMap::StreetMap.
QGraphicsGeoMap::HybridMap5The map data is composed of images collected by satellites during the daytime, on top of which there is a graphical representation of streets superimposed.
QGraphicsGeoMap::TransitMap6The map data is a graphical representation of streets and building boundaries, on top of which there is a public transport scheme superimposed.
QGraphicsGeoMap::GrayStreetMap7The map data is a color-reduced version of the QGraphicsGeoMap::StreetMap map data.
QGraphicsGeoMap::MobileStreetMap8The map data is a mobile scheme (increased font and line size) of the QGraphicsGeoMap::StreetMap map data.
QGraphicsGeoMap::MobileTerrainMap9The map data is a mobile scheme (increased font and line size) of the QGraphicsGeoMap::TerrainMap map data.
QGraphicsGeoMap::MobileHybridMap10The map data is a mobile scheme (increased font and line size) of the QGraphicsGeoMap::HybridMap map data.
QGraphicsGeoMap::MobileTransitMap11The map data is a mobile scheme (increased font and line size) of the QGraphicsGeoMap::TransitMap map data.
QGraphicsGeoMap::MobileGrayStreetMap12The map data is a mobile scheme (increased font and line size) of the QGraphicsGeoMap::GrayStreetMap map data.

Property Documentation

bearing : qreal

This property holds the bearing 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.

Changes to this property will be ignored if supportsBearing() returns false.

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

This property holds the coordinate at the center of the map viewport.

Panning the map can be more efficient than changing the center by small increments.

This property was introduced in Qt Mobility 1.1.

Access functions:

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

Notifier signal:

void centerChanged ( const QGeoCoordinate & coordinate )

connectivityMode : ConnectivityMode

This property holds the connectivity mode used to obtain the map data.

Setting connectivityMode to a mode not present in supportedConnectivityModes() will do nothing.

This property was introduced in Qt Mobility 1.1.

Access functions:

ConnectivityMode connectivityMode () const
void setConnectivityMode ( ConnectivityMode connectivityMode )

Notifier signal:

void connectivityModeChanged ( QGraphicsGeoMap::ConnectivityMode connectivityMode )

mapType : MapType

This property holds the type of map data displayed by the map.

Setting mapType to a type not present in supportedMapTypes() will do nothing.

This property was introduced in Qt Mobility 1.1.

Access functions:

MapType mapType () const
void setMapType ( MapType mapType )

Notifier signal:

void mapTypeChanged ( QGraphicsGeoMap::MapType mapType )

maximumTilt : const qreal

This property holds the maximum tilt supported by the QGeoMappingManager associated with this widget.

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 maximumTilt () const

maximumZoomLevel : const qreal

This property holds the maximum zoom level supported by the QGeoMappingManager associated with this widget.

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:

qreal maximumZoomLevel () const

minimumTilt : const qreal

This property holds the minimum tilt supported by the QGeoMappingManager associated with this widget.

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 minimumTilt () const

minimumZoomLevel : const qreal

This property holds the minimum zoom level supported by the QGeoMappingManager associated with this widget.

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:

qreal minimumZoomLevel () const

supportsBearing : const bool

This property holds whether bearing is supported by the QGeoMappingManager associated with this widget.

This property was introduced in Qt Mobility 1.2.

Access functions:

bool supportsBearing () const

supportsTilting : const bool

This property holds whether tilting is supported by the QGeoMappingManager associated with this widget.

This property was introduced in Qt Mobility 1.2.

Access functions:

bool supportsTilting () const

tilt : qreal

This property holds the 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.

If tilt is less than minimumTilt() then minimumTilt() will be used, and if tilt is larger than maximumTilt() then maximumTilt() will be used.

Changes to this property will be ignored if supportsTilting() returns false.

This property was introduced in Qt Mobility 1.2.

Access functions:

qreal tilt () const
void setTilt ( qreal tilt )

Notifier signal:

void tiltChanged ( qreal tilt )

zoomLevel : qreal

This property holds the zoom level of the map.

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.

This property was introduced in Qt Mobility 1.1.

Access functions:

qreal zoomLevel () const
void setZoomLevel ( qreal zoomLevel )

Notifier signal:

void zoomLevelChanged ( qreal zoomLevel )

Member Function Documentation

QGraphicsGeoMap::QGraphicsGeoMap ( QGeoMappingManager * manager, QGraphicsItem * parent = 0 )

Creates a new mapping widget, with the mapping operations managed by manager, and the specified parent.

Note that the manager will typically be accessed from an instance of QGeoServiceProvider:

 QGeoServiceProvider serviceProvider("nokia");
 QGeoMappingManager *manager = serviceProvider.mappingManager();
 QGraphicsGeoMap *widget = new QGraphicsGeoMap(manager);

QGraphicsGeoMap::~QGraphicsGeoMap () [virtual]

Destroys this map widget.

void QGraphicsGeoMap::addMapObject ( QGeoMapObject * mapObject )

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

If mapObject is within the viewport of the map and QGeoMapObject::isVisible() returns true then the map will display the map object immediately.

The map will take ownership of the mapObject.

If supportsCustomMapObject() returns false and mapObject is a custom map object then mapObject will not be added to the map.

This function was introduced in Qt Mobility 1.1.

void QGraphicsGeoMap::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 QGraphicsGeoMap::bearingChanged ( qreal bearing ) [signal]

This signal is emitted when the bearing of the map changes.

The new value is bearing.

This signal will not be emitted if supportsBearing() returns false.

This function was introduced in Qt Mobility 1.2.

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

This signal is emitted when the center of the map changes.

The new value is coordinate.

This function was introduced in Qt Mobility 1.1.

void QGraphicsGeoMap::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 QGraphicsGeoMap::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 QGraphicsGeoMap::connectivityModeChanged ( QGraphicsGeoMap::ConnectivityMode connectivityMode ) [signal]

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

The new value is connectivityMode.

This function was introduced in Qt Mobility 1.1.

QPointF QGraphicsGeoMap::coordinateToScreenPosition ( const QGeoCoordinate & coordinate ) const

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.

void QGraphicsGeoMap::fitInViewport ( const QGeoBoundingBox & bounds, bool preserveViewportCenter = false )

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.

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

Returns the map objects associated with this map.

This function was introduced in Qt Mobility 1.1.

QList<QGeoMapObject *> QGraphicsGeoMap::mapObjectsAtScreenPosition ( const QPointF & screenPosition ) const

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

This function was introduced in Qt Mobility 1.1.

QList<QGeoMapObject *> QGraphicsGeoMap::mapObjectsInScreenRect ( const QRectF & screenRect ) const

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

This function was introduced in Qt Mobility 1.1.

QList<QGeoMapObject *> QGraphicsGeoMap::mapObjectsInViewport () const

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 *> QGraphicsGeoMap::mapOverlays () const

Returns the map overlays associated with this map.

This function was introduced in Qt Mobility 1.1.

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

This signal is emitted when the map type changes.

The new value is mapType.

This function was introduced in Qt Mobility 1.1.

void QGraphicsGeoMap::paint ( QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * parent ) [virtual]

Reimplemented from QGraphicsItem::paint().

This function was introduced in Qt Mobility 1.1.

void QGraphicsGeoMap::pan ( int dx, int dy ) [slot]

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.

After the panning has occurred the centerChanged() signal will be emitted.

This function was introduced in Qt Mobility 1.1.

void QGraphicsGeoMap::removeMapObject ( QGeoMapObject * mapObject )

Removes mapObject from the list of map objects managed by this widget.

If mapObject is within the viewport of the map and QGeoMapObject::isVisible() returns true then the map will stop displaying the map object immediately.

The map will release ownership of the mapObject.

This function was introduced in Qt Mobility 1.1.

void QGraphicsGeoMap::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.

void QGraphicsGeoMap::resizeEvent ( QGraphicsSceneResizeEvent * event ) [virtual protected]

Reimplemented from QGraphicsWidget::resizeEvent().

This function was introduced in Qt Mobility 1.1.

QGeoCoordinate QGraphicsGeoMap::screenPositionToCoordinate ( QPointF screenPosition ) const

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.

QPainterPath QGraphicsGeoMap::shape () const [virtual]

Reimplemented from QGraphicsItem::shape().

This function was introduced in Qt Mobility 1.1.

QList<ConnectivityMode> QGraphicsGeoMap::supportedConnectivityModes () const

Returns the connectivity modes supported by the QGeoMappingManager associated with this widget.

This function was introduced in Qt Mobility 1.1.

QList<MapType> QGraphicsGeoMap::supportedMapTypes () const

Returns the map types supported by the QGeoMappingManager associated with this widget.

This function was introduced in Qt Mobility 1.1.

bool QGraphicsGeoMap::supportsCustomMapObjects () const

Returns whether custom map objects are supported by this engine.

Custom map objects are map objects based on QGraphicsItem instances, which are hard to support in cases where the map rendering is not being performed by the Qt Graphics View framwork.

This function was introduced in Qt Mobility 1.2.

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

This signal is emitted when the tilt of the map changes.

The new value is tilt.

This signal will not be emitted if supportsTilting() returns false.

This function was introduced in Qt Mobility 1.2.

QGeoBoundingBox QGraphicsGeoMap::viewport () const

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 QGraphicsGeoMap::zoomLevelChanged ( qreal zoomLevel ) [signal]

This signal is emitted when the zoom level of the map changes.

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.