Re-factored the source to use the new coordinate classes
[situare] / src / map / frienditemshandler.cpp
index cfc10b2..7dd20e5 100644 (file)
 
 #include <QDebug>
 
+#include "coordinates/scenecoordinate.h"
 #include "friendgroupitem.h"
 #include "friendlocationitem.h"
 #include "mapcommon.h"
-#include "mapengine.h"
+/// @todo remove #include "mapengine.h"
 #include "mapscene.h"
 #include "user/user.h"
 
@@ -47,7 +48,7 @@ void FriendItemsHandler::addFriendItem(User *friendData)
     FriendLocationItem *item = new FriendLocationItem(friendData->userId());
 
     item->setProfileImage(friendData->profileImage(), friendData->profileImageUrl());
-    item->setPos(MapEngine::convertLatLonToSceneCoordinate(friendData->coordinates()));
+    item->setPos(SceneCoordinate(friendData->coordinates()).toPointF());
     m_friendItems.append(item);
     m_mapScene->addItem(item);
 
@@ -212,9 +213,7 @@ void FriendItemsHandler::updateFriendItem(FriendLocationItem *friendItem, User *
     qDebug() << __PRETTY_FUNCTION__;
 
     // update position
-    QPoint newPosition = MapEngine::convertLatLonToSceneCoordinate(friendData->coordinates());
-    if (friendItem->pos().toPoint() != newPosition)
-        friendItem->setPos(newPosition);
+    friendItem->setPos(SceneCoordinate(friendData->coordinates()).toPointF());
 
     // update image
     if (friendItem->profileImageUrl() != friendData->profileImageUrl())