X-Git-Url: http://vcs.maemo.org/git/?a=blobdiff_plain;f=src%2Fmap%2Fownlocationitem.cpp;h=804ee1bcdb419bc3b12378fc0408b99b883dafbc;hb=bc4bf2aeb597f39955ed8cbe3a3fdcd5914d7ec8;hp=ef3d5ef8f7042069443eb80b97990cf51a11b428;hpb=bc44ecd8b109888151c679d5e827659f894c453d;p=situare diff --git a/src/map/ownlocationitem.cpp b/src/map/ownlocationitem.cpp index ef3d5ef..804ee1b 100644 --- a/src/map/ownlocationitem.cpp +++ b/src/map/ownlocationitem.cpp @@ -21,69 +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_h.png"); - setPixmap(ownLocationIcon); - - QPointF defaultLocation(DEFAULT_LONGITUDE,DEFAULT_LATITUDE); - //QPoint position = MapEngine::convertLatLonToSceneCoordinate(home); - - 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); -} - -OwnLocationItem::OwnLocationItem(const qreal &longitude, const qreal &latitude) -{ - QPointF ownPosition(longitude,latitude); - - QPixmap ownLocationIcon(":/res/images/led_red_h.png"); + QPixmap ownLocationIcon(":/res/images/led_red.png"); setPixmap(ownLocationIcon); - setPos(MapEngine::convertLatLonToSceneCoordinate(ownPosition)); + setPos(QPoint(UNDEFINED, UNDEFINED)); setZValue(OWN_LOCATION_ICON_Z_LEVEL); - setOffset(-MAP_OWN_LOCATION_ICON_SIZE/2, -MAP_OWN_LOCATION_ICON_SIZE/2); - setFlag(QGraphicsItem::ItemIgnoresTransformations); -} - -OwnLocationItem::OwnLocationItem(const QPointF & ownPosition) -{ - QPixmap ownLocationIcon(":/res/images/led_red_h.png"); - 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); -} - -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(); + setOffset(-ownLocationIcon.width()/2, -ownLocationIcon.height()/2); }