qDebug() << __PRETTY_FUNCTION__;
QPixmap ownLocationIcon(":/res/images/led_red_h.png");
- setPixmap(ownLocationIcon);
+ if (!ownLocationIcon.isNull()){
+ setPixmap(ownLocationIcon);
- QPointF defaultLocation(DEFAULT_LONGITUDE,DEFAULT_LATITUDE);
- //QPoint position = MapEngine::convertLatLonToSceneCoordinate(home);
+ 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);
+ 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");
- setPixmap(ownLocationIcon);
+ 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);
+ }
- 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");
- setPixmap(ownLocationIcon);
+ 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);
+ }
- 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)
OwnLocationItem ownLocationItem2(xCoordinate, yCoordinate);
OwnLocationItem ownLocationItem3(testLocationPoint);
+ // Test Pixmaps
+ QPixmap pixmap1;
+ QPixmap pixmap2;
+ QPixmap pixmap3;
+
+ QCOMPARE (pixmap1.isNull(), true);
+ QCOMPARE (pixmap2.isNull(), true);
+ QCOMPARE (pixmap3.isNull(), true);
+
+ pixmap1 = ownLocationItem1.pixmap();
+ pixmap2 = ownLocationItem2.pixmap();
+ pixmap3 = ownLocationItem3.pixmap();
+
+ QCOMPARE (pixmap1.isNull(), false);
+ QCOMPARE (pixmap2.isNull(), false);
+ QCOMPARE (pixmap3.isNull(), false);
+
// Test Positions
QCOMPARE(ownLocationItem1.position(),
MapEngine::convertLatLonToSceneCoordinate(defaultLocationPoint));