2 Situare - A location system for Facebook
3 Copyright (C) 2010 Ixonos Plc. Authors:
5 Ville Tiensuu - ville.tiensuu@ixonos.com
6 Sami Rämö - sami.ramo@ixonos.com
8 Situare is free software; you can redistribute it and/or
9 modify it under the terms of the GNU General Public License
10 version 2 as published by the Free Software Foundation.
12 Situare is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with Situare; if not, write to the Free Software
19 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
25 #include "mapcommon.h"
27 #include "baselocationitem.h"
29 BaseLocationItem::BaseLocationItem(QObject *parent)
32 qDebug() << __PRETTY_FUNCTION__;
34 setFlag(QGraphicsItem::ItemIgnoresTransformations);
37 QRect BaseLocationItem::sceneTransformedBoundingRect(int zoomLevel) const
39 qDebug() << __PRETTY_FUNCTION__;
41 QRect rect = sceneBoundingRect().toRect();
43 // returned rect size is size of original image and not scaled to size of currently presented
44 // image because of using ItemIgnoresTransformations flag. Thus the rect must be scaled
46 int multiplier = 1 << (MAX_MAP_ZOOM_LEVEL - zoomLevel);
48 int heightDelta = (rect.height() * multiplier - rect.height()) / 2;
49 int widthDelta = (rect.width() * multiplier - rect.width()) / 2;
51 return rect.adjusted(-widthDelta, -heightDelta, widthDelta, heightDelta);