Qt Mobility 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>

Public Types

enum MapType { NoMap, StreetMap, SatelliteMapDay, SatelliteMapNight, TerrainMap }

Properties


Public Functions

QGraphicsGeoMap ( QGraphicsItem * parent = 0 )
QGraphicsGeoMap ( QGeoMappingManager * manager, QGraphicsItem * parent = 0 )
virtual ~QGraphicsGeoMap ()
void addMapObject ( QGeoMapObject * mapObject )
QGeoCoordinate center () const
void clearMapObjects ()
QPointF coordinateToScreenPosition ( const QGeoCoordinate & coordinate ) const
QList<QGeoMapObject *> mapObjects () const
QList<QGeoMapObject *> mapObjectsAtScreenPosition ( const QPointF & screenPosition )
QList<QGeoMapObject *> mapObjectsInScreenRect ( const QRectF & screenRect )
MapType mapType () const
qreal maximumZoomLevel () const
qreal minimumZoomLevel () const
void paint ( QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * parent )
void removeMapObject ( QGeoMapObject * mapObject )
QGeoCoordinate screenPositionToCoordinate ( QPointF screenPosition ) const
void setCenter ( const QGeoCoordinate & center )
void setMapType ( MapType mapType )
void setZoomLevel ( qreal zoomLevel )
QPainterPath shape () const
QList<MapType> supportedMapTypes () const
qreal zoomLevel () const

Public Slots

void pan ( int dx, int dy )

Signals

void centerChanged ( const QGeoCoordinate & coordinate )
void mapTypeChanged ( QGraphicsGeoMap::MapType mapType )
void panned ( const QPoint & offset )
void zoomLevelChanged ( qreal zoomLevel )

Protected Functions

void resizeEvent ( QGraphicsSceneResizeEvent * event )

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::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.
QGraphicsGeoMap::TerrainMap4The map data is a graphical representation of terrain features. This may also include some of the information provided by QGraphicsGeoMap::StreetMap.

Property Documentation

center : QGeoCoordinate

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

Access functions:

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

Notifier signal:

void centerChanged ( const QGeoCoordinate & coordinate )

mapType : MapType

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

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

Access functions:

MapType mapType () const
void setMapType ( MapType mapType )

Notifier signal:

void mapTypeChanged ( QGraphicsGeoMap::MapType mapType )

maximumZoomLevel : const qreal

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

Access functions:

qreal maximumZoomLevel () const

minimumZoomLevel : const qreal

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

Access functions:

qreal minimumZoomLevel () const

zoomLevel : qreal

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

Access functions:

qreal zoomLevel () const
void setZoomLevel ( qreal zoomLevel )

Notifier signal:

void zoomLevelChanged ( qreal zoomLevel )

Member Function Documentation

QGraphicsGeoMap::QGraphicsGeoMap ( QGraphicsItem * parent = 0 )

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.

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

Indicates that the map has been centered on coordinate.

This signal will not be emitted when the user pans the map.

void QGraphicsGeoMap::clearMapObjects ()

Clears the map objects associated with this map.

The map objects will be deleted.

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.

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

Returns the map objects associated with this map.

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

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

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

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

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

Indicates that the type of the map has been changed.

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

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.

void QGraphicsGeoMap::panned ( const QPoint & offset ) [signal]

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.

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

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.

QPainterPath QGraphicsGeoMap::shape () const

QList<MapType> QGraphicsGeoMap::supportedMapTypes () const

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

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

Indicates that the zoom level has changed to zoomLevel.

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.