Copyright (C) 2010 Ixonos Plc. Authors:
Ville Tiensuu - ville.tiensuu@ixonos.com
+ Sami Rämö - sami.ramo@ixonos.com
Situare is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
#include <QGraphicsPixmapItem>
-
+/**
+* @brief Baseclass for showing own and friends locations on the map.
+*
+* @author Ville Tiensuu - ville.tiensuu@ixonos.com
+* @author Sami Rämö - sami.ramo@ixonos.com
+*/
class BaseLocationItem : public QGraphicsPixmapItem, public QObject
-{
+{
public:
- BaseLocationItem(QObject *parent = 0);
-
- /*******************************************************************************
- * MEMBER FUNCTIONS AND SLOTS
- ******************************************************************************/
- public:
-
/**
- * @brief Hides item so that it is invisible on the map
+ * @brief Constructor of BaseLocationItem.
+ * Sets parent.
*
+ * @param parent
*/
- void hideLocation();
+ BaseLocationItem(QObject *parent = 0);
+/*******************************************************************************
+ * MEMBER FUNCTIONS AND SLOTS
+ ******************************************************************************/
+public:
/**
- * @brief returns position of item in scene coordinates.
+ * @brief Return item rect transformed to given zoom level
*
- * @return QPoint position of OwnLocationItem
- */
- QPoint position() const;
-
- /**
- * @brief sets position of item as specified in parameter.
- * Parameter can be given in georaphical coordinates
+ * Because of using ItemIgnoresTransformations, and not scaling the item, the default
+ * sceneBoundingRect can't be used because it always returns the lowest map tile level scene
+ * bounding rect. This method does return rect scaled to given zoom level.
*
- * @param newPosition Parameter that specifies new position.
- */
- void setPosition(const QPointF & newPosition);
-
- /**
- * @brief Sets item to be visible on the map.
- * Item is visible by default, function is needed only when own location
- * needs to be set back visible after hideLocation function call.
+ * @param zoomLevel Zoom level for which the sceneBoundingRect should be transformed
+ * @return sceneBoundingRect transformed to given zoom level
*/
- void showLocation();
+ QRect sceneTransformedBoundingRect(int zoomLevel) const;
};