QGeoMapCustomObject Class ReferenceThe QGeoMapCustomObject class is a QGeoMapObject used to draw a QGraphicsItem on a map. More... #include <QGeoMapCustomObject> Inherits: QGeoMapObject. This class was introduced in Qt Mobility 1.2. Properties
Public Functions
Reimplemented Public Functions
Signals
Additional Inherited Members
Detailed DescriptionThe QGeoMapCustomObject class is a QGeoMapObject used to draw a QGraphicsItem on a map. Any arbitrary QGraphicsItem can be associated with a QGeoMapCustomObject, and to this end it contains support for interpreting the coordinates of the QGraphicsItem in a variety of different ways. For example, the following code creates a QGraphicsEllipseItem and a QGeoMapCustomObject to display it. The EllipseItem extends from the origin point, out 20 meters to the east and 30 metres south. QGraphicsEllipseItem *ellipseItem = new QGraphicsEllipseItem; ellipseItem->setRect(0, 0, 20, 30); QGeoMapCustomObject *mapObject = new QGeoMapCustomObject; mapObject->setGraphicsItem(ellipseItem); mapObject->setUnits(QGeoMapObject::MeterUnit); mapObject->setOrigin(QGeoCoordinate(-27.5796, 153.1)); Units and coordinatesThe local units and coordinates of the QGraphicsItem are transformed onto the map based on the units, origin, transformType and transform properties. Several systems are available, including pixels, meters and seconds of arc. It should be noted that both pixel and meter coordinate systems are south- oriented (ie, positive Y axis faces south on the map). However, the RelativeArcSeconds unit system faces north to align with the standard latitude grid. The Y axis can be flipped if necessary by making use of the GraphicsItem's transform property QTransform northFlip; northFlip.scale(0, -1); ellipseItem->setTransform(northFlip); Transform methodsNormally, the GraphicsItem will be transformed into map coordinates using a bilinear interpolation. Another option is the ExactTransform, which converts the GraphicsItem exactly into map coordinates, but is only available for certain subclasses of QGraphicsItem. Other interpolation methods may be provided in future for greater accuracy near poles and in different map projections, without the limitations of ExactTransform. Calling setUnits() or setting the units property will result in the default value of transformType being restored. See QGeoMapObject::transformType for more details. CaveatsOther than the coordinate system features, there are a few differences with using QGraphicsItems on a map compared to using them on a standard QGraphicsScene. One of the most important of these is the use of the update() function. When an application changes anything that has an effect upon the appearance, size, shape etc of the QGraphicsItem, it must call QGeoMapCustomObject::update() to ensure that the map is updated. Another is the use of child items of a QGraphicsItem. These are supported in more or less the same manner as in QGraphicsScene, with the exception of use in concert with ExactTransform -- any object with transformType set to ExactTransform will not have children of its QGraphicsItem drawn on the map. Property Documentation
|
QGraphicsItem * | graphicsItem () const |
void | setGraphicsItem ( QGraphicsItem * graphicsItem ) |
Notifier signal:
void | graphicsItemChanged ( QGraphicsItem * graphicsItem ) |
This property holds the offset in pixels at which the graphics item will be drawn by this custom object.
The default value of this property is QPoint(0, 0). If this value is not changed the upper left coordinate of the graphics item will be drawn at the coordinate specified by QGeoMapCustomObject::coordinate.
The offset is in pixels and is independent of the zoom level of the map.
This property was introduced in Qt Mobility 1.2.
Access functions:
QPoint | offset () const |
void | setOffset ( const QPoint & offset ) |
Notifier signal:
void | offsetChanged ( const QPoint & offset ) |
Constructs a new custom object.
Constructs a new custom object which will draw a QGraphicsItem at an offset of offset pixels from the coordinate coordinate.
This function was introduced in Qt Mobility 1.2.
Destroys this custom object.
This signal is emitted when the graphics item which this custom object draws is changed.
The new value will be graphicsItem.
This function was introduced in Qt Mobility 1.2.
This signal is emitted when the on-screen offset from the coordinate at which this custom object should be drawn has changed.
The new value will be offset.
This function was introduced in Qt Mobility 1.2.
Sets the origin of the object to origin.
This function was introduced in Qt Mobility 1.2.
Sets the transform type of the object to type.
This function was introduced in Qt Mobility 1.2.
Sets the coordinate units of the object to unit.
Note that setting this property will reset the transformType property to the default for the units given. For PixelUnit, this is ExactTransform, and for all others, BilinearTransform.
This function was introduced in Qt Mobility 1.2.
This signal indicates that the graphics item has changed and that the map needs to be updated.
This function was introduced in Qt Mobility 1.2.
Reimplemented from QGeoMapObject::type().
This function was introduced in Qt Mobility 1.2.
If the graphics item is modified this method should be called immediately afterwards to inform the map that an update is required. .
This method causes the triggerUpdate() signal to be emitted.
This function was introduced in Qt Mobility 1.2.
Cette page est une traduction d'une page de la documentation de Qt, écrite par Nokia Corporation and/or its subsidiary(-ies). Les éventuels problèmes résultant d'une mauvaise traduction ne sont pas imputables à Nokia. | Qt qtmobility-1.2 | |
Copyright © 2012 Developpez LLC. Tous droits réservés Developpez LLC. Aucune reproduction, même partielle, ne peut être faite de ce site et de l'ensemble de son contenu : textes, documents et images sans l'autorisation expresse de Developpez LLC. Sinon, vous encourez selon la loi jusqu'à 3 ans de prison et jusqu'à 300 000 E de dommages et intérêts. Cette page est déposée à la SACD. | ||
Vous avez déniché une erreur ? Un bug ? Une redirection cassée ? Ou tout autre problème, quel qu'il soit ? Ou bien vous désirez participer à ce projet de traduction ? N'hésitez pas à nous contacter ou par MP ! |
Copyright © 2000-2012 - www.developpez.com