9
9
** $QT_BEGIN_LICENSE:LGPL$
10
10
** Commercial Usage
11
** Licensees holding valid Qt Commercial licenses may use this file in
12
** accordance with the Qt Solutions Commercial License Agreement provided
13
** with the Software or, alternatively, in accordance with the terms
11
** Licensees holding valid Qt Commercial licenses may use this file in
12
** accordance with the Qt Commercial License Agreement provided with
13
** the Software or, alternatively, in accordance with the terms
14
14
** contained in a written agreement between you and Nokia.
16
16
** GNU Lesser General Public License Usage
33
33
** ensure the GNU General Public License version 3.0 requirements will be
34
34
** met: http://www.gnu.org/copyleft/gpl.html.
36
** Please note Third Party Software included with Qt Solutions may impose
37
** additional restrictions and it is the user's responsibility to ensure
38
** that they have met the licensing requirements of the GPL, LGPL, or Qt
39
** Solutions Commercial license and the relevant license of the Third
40
** Party Software they are using.
42
36
** If you are unsure which license is appropriate for your use, please
43
37
** contact the sales department at qt-sales@nokia.com.
44
38
** $QT_END_LICENSE$
55
49
QTM_BEGIN_NAMESPACE
57
QGeoTiledMapPixmapObjectInfo::QGeoTiledMapPixmapObjectInfo(QGeoMapData *mapData, QGeoMapObject *mapObject)
58
: QGeoTiledMapObjectInfo(mapData, mapObject),
51
QGeoTiledMapPixmapObjectInfo::QGeoTiledMapPixmapObjectInfo(QGeoTiledMapData *mapData, QGeoMapObject *mapObject)
52
: QGeoTiledMapObjectInfo(mapData, mapObject),
62
55
pixmap = static_cast<QGeoMapPixmapObject*>(mapObject);
58
SIGNAL(coordinateChanged(QGeoCoordinate)),
60
SLOT(coordinateChanged(QGeoCoordinate)));
62
SIGNAL(pixmapChanged(QPixmap)),
64
SLOT(pixmapChanged(QPixmap)));
66
SIGNAL(offsetChanged(QPoint)),
68
SLOT(offsetChanged(QPoint)));
70
pixmapItem1 = new QGraphicsPixmapItem();
71
graphicsItem = pixmapItem1;
73
pixmapChanged(this->pixmap->pixmap());
74
coordinateChanged(this->pixmap->coordinate());
65
77
QGeoTiledMapPixmapObjectInfo::~QGeoTiledMapPixmapObjectInfo() {}
67
void QGeoTiledMapPixmapObjectInfo::objectUpdated()
69
if (!pixmap->coordinate().isValid()
70
|| pixmap->pixmap().isNull()) {
80
pixmapItem = new QGraphicsPixmapItem();
82
pixmapItem->setPixmap(pixmap->pixmap());
83
pixmapItem->setPos(tiledMapData->coordinateToWorldPixel(pixmap->coordinate()));
85
graphicsItem = pixmapItem;
79
void QGeoTiledMapPixmapObjectInfo::updateValidity()
81
setValid((pixmap->coordinate().isValid() && !pixmap->pixmap().isNull()));
84
void QGeoTiledMapPixmapObjectInfo::coordinateChanged(const QGeoCoordinate &coordinate)
91
void QGeoTiledMapPixmapObjectInfo::pixmapChanged(const QPixmap &pixmap)
94
if (!this->pixmap->pixmap().isNull()) {
95
pixmapItem1->setPixmap(this->pixmap->pixmap());
97
pixmapItem2->setPixmap(this->pixmap->pixmap());
103
void QGeoTiledMapPixmapObjectInfo::offsetChanged(const QPoint &offset)
109
void QGeoTiledMapPixmapObjectInfo::zoomLevelChanged(qreal zoomLevel)
115
void QGeoTiledMapPixmapObjectInfo::update()
117
int zoomFactor = tiledMapData->zoomFactor();
119
QPointF pos = tiledMapData->coordinateToWorldReferencePosition(pixmap->coordinate());
121
QPointF offset = pixmap->offset();
122
offset *= zoomFactor;
125
int width = tiledMapData->worldReferenceSize().width();
135
int rightBound = pos.x() + pixmap->pixmap().width() * zoomFactor;
137
QPointF pos2 = QPointF(-1.0 * static_cast<qreal>(width / zoomFactor), 0);
139
if (rightBound > width ) {
141
pixmapItem2 = new QGraphicsPixmapItem(pixmapItem1);
142
pixmapItem2->setPixmap(pixmap->pixmap());
151
pixmapItem1->setScale(zoomFactor);
153
pixmapItem1->setPos(pos);
155
pixmapItem2->setPos(pos2);
89
void QGeoTiledMapPixmapObjectInfo::mapUpdated()
92
qreal zoomFactor = tiledMapData->zoomFactor();
93
pixmapItem->setScale(zoomFactor);
94
pixmapItem->setTransform(QTransform::fromTranslate(pixmap->offset().x() * zoomFactor, pixmap->offset().y() * zoomFactor));
160
#include "moc_qgeotiledmappixmapobjectinfo_p.cpp"