X-Git-Url: http://vcs.maemo.org/git/?a=blobdiff_plain;f=src%2Fmap%2Fownlocationitem.cpp;h=804ee1bcdb419bc3b12378fc0408b99b883dafbc;hb=bc4bf2aeb597f39955ed8cbe3a3fdcd5914d7ec8;hp=1b4dcbfbb596ddeb46d5b2679ffccf921273893d;hpb=0e46d580c2d370a10154d681e5c4c7f94f2c9e67;p=situare diff --git a/src/map/ownlocationitem.cpp b/src/map/ownlocationitem.cpp index 1b4dcbf..804ee1b 100644 --- a/src/map/ownlocationitem.cpp +++ b/src/map/ownlocationitem.cpp @@ -21,83 +21,17 @@ #include -#include "ownlocationitem.h" -#include "mapengine.h" #include "mapcommon.h" +#include "ownlocationitem.h" + OwnLocationItem::OwnLocationItem() { qDebug() << __PRETTY_FUNCTION__; + QPixmap ownLocationIcon(":/res/images/led_red.png"); + setPixmap(ownLocationIcon); - QPixmap ownLocationIcon(":/res/images/led_red_h.png"); - if (!ownLocationIcon.isNull()){ - setPixmap(ownLocationIcon); - - QPointF defaultLocation(DEFAULT_LONGITUDE,DEFAULT_LATITUDE); - - setPos(MapEngine::convertLatLonToSceneCoordinate(defaultLocation)); - setZValue(OWN_LOCATION_ICON_Z_LEVEL); - setOffset(-MAP_OWN_LOCATION_ICON_SIZE/2, -MAP_OWN_LOCATION_ICON_SIZE/2); - setFlag(QGraphicsItem::ItemIgnoresTransformations); - } - - else - qDebug() << "Own Location Icon cannot be loaded"; -} - -OwnLocationItem::OwnLocationItem(const qreal &longitude, const qreal &latitude) -{ - QPointF ownPosition(longitude,latitude); - - QPixmap ownLocationIcon(":/res/images/led_red_h.png"); - if (!ownLocationIcon.isNull()){ - setPixmap(ownLocationIcon); - - setPos(MapEngine::convertLatLonToSceneCoordinate(ownPosition)); - setZValue(OWN_LOCATION_ICON_Z_LEVEL); - setOffset(-MAP_OWN_LOCATION_ICON_SIZE/2, -MAP_OWN_LOCATION_ICON_SIZE/2); - setFlag(QGraphicsItem::ItemIgnoresTransformations); - } - - else - qDebug() << "Own Location Icon cannot be loaded"; -} - -OwnLocationItem::OwnLocationItem(const QPointF & ownPosition) -{ - QPixmap ownLocationIcon(":/res/images/led_red_h.png"); - if (!ownLocationIcon.isNull()){ - setPixmap(ownLocationIcon); - - setPos(MapEngine::convertLatLonToSceneCoordinate(ownPosition)); - setZValue(OWN_LOCATION_ICON_Z_LEVEL); - setOffset(-MAP_OWN_LOCATION_ICON_SIZE/2, -MAP_OWN_LOCATION_ICON_SIZE/2); - setFlag(QGraphicsItem::ItemIgnoresTransformations); - } - - else - qDebug() << "Own Location Icon cannot be loaded"; -} - -void OwnLocationItem::setPosition(const QPointF & newPosition) -{ - setPos(MapEngine::convertLatLonToSceneCoordinate(newPosition)); -} - -QPoint OwnLocationItem::position() const -{ - QPointF currentPosition; - currentPosition = pos(); - - return currentPosition.toPoint(); -} - -void OwnLocationItem::hideOwnLocation() -{ - hide(); -} - -void OwnLocationItem::showOwnLocation() -{ - show(); + setPos(QPoint(UNDEFINED, UNDEFINED)); + setZValue(OWN_LOCATION_ICON_Z_LEVEL); + setOffset(-ownLocationIcon.width()/2, -ownLocationIcon.height()/2); }