2 Situare - A location system for Facebook
3 Copyright (C) 2010 Ixonos Plc. Authors:
5 Sami Rämö - sami.ramo@ixonos.com
6 Jussi Laitinen - jussi.laitinen@ixonos.com
7 Pekka Nissinen - pekka.nissinen@ixonos.com
8 Ville Tiensuu - ville.tiensuu@ixonos.com
9 Henri Lampela - henri.lampela@ixonos.com
11 Situare is free software; you can redistribute it and/or
12 modify it under the terms of the GNU General Public License
13 version 2 as published by the Free Software Foundation.
15 Situare is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License for more details.
20 You should have received a copy of the GNU General Public License
21 along with Situare; if not, write to the Free Software
22 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
26 #include <QtAlgorithms>
28 #include <QGraphicsView>
30 #include <QStringList>
33 #include <QHashIterator>
37 #include "frienditemshandler.h"
38 #include "gpslocationitem.h"
39 #include "mapcommon.h"
40 #include "mapfetcher.h"
41 #include "maprouteitem.h"
43 #include "mapscroller.h"
45 #include "network/networkaccessmanager.h"
46 #include "ownlocationitem.h"
47 #include "user/user.h"
49 #include "mapengine.h"
51 const int SMOOTH_CENTERING_TIME_MS = 1000;
53 MapEngine::MapEngine(QObject *parent)
55 m_autoCenteringEnabled(false),
56 m_scrollStartedByGps(false),
57 m_smoothScrollRunning(false),
59 m_zoomLevel(MAP_DEFAULT_ZOOM_LEVEL),
60 m_centerTile(QPoint(UNDEFINED, UNDEFINED)),
61 m_sceneCoordinate(SceneCoordinate(GeoCoordinate(MAP_DEFAULT_LATITUDE, MAP_DEFAULT_LONGITUDE))),
62 m_tilesGridSize(QSize(0, 0)),
63 m_viewSize(QSize(DEFAULT_SCREEN_WIDTH, DEFAULT_SCREEN_HEIGHT)),
66 qDebug() << __PRETTY_FUNCTION__;
68 m_mapScene = new MapScene(this);
70 m_mapFetcher = new MapFetcher(new NetworkAccessManager(this), this);
71 connect(this, SIGNAL(fetchImage(int, int, int)),
72 m_mapFetcher, SLOT(enqueueFetchMapImage(int, int, int)));
73 connect(m_mapFetcher, SIGNAL(mapImageReceived(int, int, int, QPixmap)),
74 this, SLOT(mapImageReceived(int, int, int, QPixmap)));
75 connect(m_mapFetcher, SIGNAL(error(int, int)),
76 this, SIGNAL(error(int, int)));
78 m_ownLocation = new OwnLocationItem();
79 m_ownLocation->hide(); // hide until first location info is received
80 m_mapScene->addItem(m_ownLocation);
82 m_gpsLocationItem = new GPSLocationItem();
83 m_mapScene->addItem(m_gpsLocationItem);
85 m_friendItemsHandler = new FriendItemsHandler(m_mapScene, this);
86 connect(this, SIGNAL(zoomLevelChanged(int)),
87 m_friendItemsHandler, SLOT(refactorFriendItems(int)));
89 connect(this, SIGNAL(friendsLocationsReady(QList<User*>&)),
90 m_friendItemsHandler, SLOT(friendListUpdated(QList<User*>&)));
92 connect(this, SIGNAL(friendImageReady(User*)),
93 m_friendItemsHandler, SLOT(friendImageReady(User*)));
95 connect(this, SIGNAL(friendsLocationsReady(QList<User*>&)),
96 this, SLOT(friendsPositionsUpdated()));
98 connect(m_friendItemsHandler, SIGNAL(locationItemClicked(QList<QString>)),
99 this, SIGNAL(locationItemClicked(QList<QString>)));
101 m_scroller = &MapScroller::getInstance();
103 connect(m_scroller, SIGNAL(coordinateUpdated(SceneCoordinate)),
104 this, SLOT(setCenterPosition(SceneCoordinate)));
106 connect(m_scroller, SIGNAL(stateChanged(QAbstractAnimation::State, QAbstractAnimation::State)),
107 this, SLOT(scrollerStateChanged(QAbstractAnimation::State)));
110 MapEngine::~MapEngine()
112 qDebug() << __PRETTY_FUNCTION__;
114 QSettings settings(DIRECTORY_NAME, FILE_NAME);
116 settings.setValue(MAP_LAST_POSITION, QVariant::fromValue(centerGeoCoordinate()));
117 settings.setValue(MAP_LAST_ZOOMLEVEL, m_zoomLevel);
120 QRect MapEngine::calculateTileGrid(SceneCoordinate coordinate)
122 qDebug() << __PRETTY_FUNCTION__;
124 QPoint tileCoordinate = convertSceneCoordinateToTileNumber(m_zoomLevel, coordinate);
127 topLeft.setX(tileCoordinate.x() - (m_tilesGridSize.width() / 2));
128 topLeft.setY(tileCoordinate.y() - (m_tilesGridSize.height() / 2));
130 return QRect(topLeft, m_tilesGridSize);
133 void MapEngine::centerAndZoomTo(QRect rect)
135 const int MARGIN_HORIZONTAL = 50;
136 const int MARGIN_VERTICAL = 5;
138 // calculate the usable size of the view
139 int viewUsableHeight = m_viewSize.height() - 2 * MARGIN_VERTICAL;
140 int viewUsableWidth = m_viewSize.width() - 2 * MARGIN_HORIZONTAL;
142 // calculate how many levels must be zoomed out from the closest zoom level to get the rect
143 // fit inside the usable view area
145 while ((rect.height() > (viewUsableHeight * (1 << shift)))
146 || (rect.width() > (viewUsableWidth * (1 << shift))))
149 scrollToPosition(SceneCoordinate(double(rect.center().x()), double(rect.center().y())));
151 int zoomLevel = qBound(OSM_MIN_ZOOM_LEVEL, OSM_MAX_ZOOM_LEVEL - shift, OSM_MAX_ZOOM_LEVEL);
152 setZoomLevel(zoomLevel);
155 GeoCoordinate MapEngine::centerGeoCoordinate()
157 qDebug() << __PRETTY_FUNCTION__;
159 return GeoCoordinate(m_sceneCoordinate);
162 void MapEngine::centerToCoordinates(GeoCoordinate coordinate)
164 qDebug() << __PRETTY_FUNCTION__;
166 scrollToPosition(SceneCoordinate(coordinate));
169 QPoint MapEngine::convertSceneCoordinateToTileNumber(int zoomLevel, SceneCoordinate coordinate)
171 qDebug() << __PRETTY_FUNCTION__;
173 int pow = 1 << (OSM_MAX_ZOOM_LEVEL - zoomLevel);
174 int x = static_cast<int>(coordinate.x() / (OSM_TILE_SIZE_X * pow));
175 int y = static_cast<int>(coordinate.y() / (OSM_TILE_SIZE_Y * pow));
180 SceneCoordinate MapEngine::convertTileNumberToSceneCoordinate(int zoomLevel, QPoint tileNumber)
182 qDebug() << __PRETTY_FUNCTION__;
184 int pow = 1 << (OSM_MAX_ZOOM_LEVEL - zoomLevel);
185 int x = tileNumber.x() * OSM_TILE_SIZE_X * pow;
186 int y = tileNumber.y() * OSM_TILE_SIZE_Y * pow;
188 return SceneCoordinate(x, y);
191 QRectF MapEngine::currentViewSceneRect() const
193 qDebug() << __PRETTY_FUNCTION__;
195 const QPoint ONE_PIXEL = QPoint(1, 1);
197 QGraphicsView *view = m_mapScene->views().at(0);
198 QPointF sceneTopLeft = view->mapToScene(0, 0);
199 QPoint viewBottomRight = QPoint(view->size().width(), view->size().height()) - ONE_PIXEL;
200 QPointF sceneBottomRight = view->mapToScene(viewBottomRight);
202 return QRectF(sceneTopLeft, sceneBottomRight);
205 void MapEngine::disableAutoCenteringIfRequired(SceneCoordinate coordinate)
207 if (isAutoCenteringEnabled()) {
208 int zoomFactor = (1 << (OSM_MAX_ZOOM_LEVEL - m_zoomLevel));
210 SceneCoordinate oldPixelValue(m_lastAutomaticPosition.x() / zoomFactor,
211 m_lastAutomaticPosition.y() / zoomFactor);
213 SceneCoordinate newPixelValue(coordinate.x() / zoomFactor,
214 coordinate.y() / zoomFactor);
216 if ((abs(oldPixelValue.x() - newPixelValue.x()) > AUTO_CENTERING_DISABLE_DISTANCE)
217 || (abs(oldPixelValue.y() - newPixelValue.y()) > AUTO_CENTERING_DISABLE_DISTANCE)) {
219 emit mapScrolledManually();
224 void MapEngine::friendsPositionsUpdated()
226 qDebug() << __PRETTY_FUNCTION__;
228 m_mapScene->spanItems(currentViewSceneRect());
231 void MapEngine::getTiles(SceneCoordinate coordinate)
233 qDebug() << __PRETTY_FUNCTION__;
235 m_viewTilesGrid = calculateTileGrid(coordinate);
236 updateViewTilesSceneRect();
237 m_mapScene->setTilesGrid(m_viewTilesGrid);
239 int topLeftX = m_viewTilesGrid.topLeft().x();
240 int topLeftY = m_viewTilesGrid.topLeft().y();
241 int bottomRightX = m_viewTilesGrid.bottomRight().x();
242 int bottomRightY = m_viewTilesGrid.bottomRight().y();
244 int tileMaxVal = tileMaxIndex(m_zoomLevel);
246 for (int x = topLeftX; x <= bottomRightX; ++x) {
247 for (int y = topLeftY; y <= bottomRightY; ++y) {
249 // map doesn't span in vertical direction, so y index must be inside the limits
250 if (y >= MAP_TILE_MIN_INDEX && y <= tileMaxVal) {
251 if (!m_mapScene->tileInScene(tilePath(m_zoomLevel, x, y)))
252 emit fetchImage(m_zoomLevel, normalize(x, MAP_TILE_MIN_INDEX, tileMaxVal), y);
258 void MapEngine::gpsPositionUpdate(GeoCoordinate position, qreal accuracy)
260 qDebug() << __PRETTY_FUNCTION__;
262 m_gpsLocationItem->updatePosition(SceneCoordinate(position), accuracy);
263 m_gpsPosition = position;
264 m_mapScene->spanItems(currentViewSceneRect());
266 if (m_autoCenteringEnabled) {
267 m_lastAutomaticPosition = SceneCoordinate(position);
268 m_scrollStartedByGps = true;
269 scrollToPosition(m_lastAutomaticPosition);
272 updateDirectionIndicator();
275 qreal MapEngine::greatCircleDistance(GeoCoordinate firstLocation, GeoCoordinate secondLocation)
277 qDebug() << __PRETTY_FUNCTION__;
279 const qreal TO_RAD = (M_PI / 180);
281 qreal dLat = (secondLocation.latitude() - firstLocation.latitude()) * TO_RAD;
282 qreal dLon = (secondLocation.longitude() - firstLocation.longitude()) * TO_RAD;
283 qreal a = pow(sin(dLat / 2), 2)
284 + cos(firstLocation.latitude() * TO_RAD)
285 * cos(secondLocation.latitude() * TO_RAD)
286 * pow(sin(dLon / 2), 2);
287 qreal c = 2 * atan2(sqrt(a), sqrt(1 - a));
289 return (EARTH_RADIUS * c);
292 void MapEngine::init()
294 qDebug() << __PRETTY_FUNCTION__;
296 QSettings settings(DIRECTORY_NAME, FILE_NAME);
298 // init can be only done if both values exists in the settings
299 if (settings.contains(MAP_LAST_POSITION) && settings.contains(MAP_LAST_ZOOMLEVEL)) {
300 QVariant zoomLevel = settings.value(MAP_LAST_ZOOMLEVEL);
301 QVariant location = settings.value(MAP_LAST_POSITION);
303 // also the init can be only done if we are able to convert variants into target data types
304 if (zoomLevel.canConvert<int>() && location.canConvert<GeoCoordinate>()) {
305 m_zoomLevel = zoomLevel.toInt();
306 m_sceneCoordinate = SceneCoordinate(location.value<GeoCoordinate>());
310 // emit zoom level and center coordinate so that all parts of the map system gets initialized
311 // NOTE: emit is also done even if we weren't able to read initial valuef from the settings
312 // so that the default values set in the constructor are used
313 emit zoomLevelChanged(m_zoomLevel);
314 scrollToPosition(m_sceneCoordinate);
317 bool MapEngine::isAutoCenteringEnabled()
319 return m_autoCenteringEnabled;
322 bool MapEngine::isCenterTileChanged(SceneCoordinate coordinate)
324 qDebug() << __PRETTY_FUNCTION__;
326 QPoint centerTile = convertSceneCoordinateToTileNumber(m_zoomLevel, coordinate);
327 QPoint temp = m_centerTile;
328 m_centerTile = centerTile;
330 return (centerTile != temp);
333 qreal MapEngine::sceneResolution()
335 qDebug() << __PRETTY_FUNCTION__;
337 const int SHIFT = 200;
338 const int KM_TO_M = 1000;
339 qreal scale = (1 << (OSM_MAX_ZOOM_LEVEL - m_zoomLevel));
340 GeoCoordinate centerCoordinate = centerGeoCoordinate();
341 SceneCoordinate shiftedSceneCoordinate(m_sceneCoordinate.x() + SHIFT * scale,
342 m_sceneCoordinate.y());
343 GeoCoordinate shiftedCoordinate(shiftedSceneCoordinate);
344 qreal dist = greatCircleDistance(centerCoordinate, shiftedCoordinate) * KM_TO_M;
345 return (dist / SHIFT);
348 void MapEngine::mapImageReceived(int zoomLevel, int x, int y, const QPixmap &image)
350 qDebug() << __PRETTY_FUNCTION__;
352 // add normal tile inside the world
353 QPoint tileNumber(x, y);
354 m_mapScene->addTile(zoomLevel, tileNumber, image, m_zoomLevel);
356 // note: add 1 so odd width is rounded up and even is rounded down
357 int tilesGridWidthHalf = (m_viewTilesGrid.width() + 1) / 2;
359 // duplicate to east side? (don't need to duplicate over padding)
360 if (tileNumber.x() < (tilesGridWidthHalf - MAP_GRID_PADDING)) {
361 QPoint adjustedTileNumber(tileNumber.x() + tileMaxIndex(zoomLevel) + 1, tileNumber.y());
362 m_mapScene->addTile(zoomLevel, adjustedTileNumber, image, m_zoomLevel);
365 // duplicate to west side? (don't need to duplicate over padding)
366 if (tileNumber.x() > (tileMaxIndex(zoomLevel) - tilesGridWidthHalf + MAP_GRID_PADDING)) {
367 QPoint adjustedTileNumber(tileNumber.x() - tileMaxIndex(zoomLevel) - 1, tileNumber.y());
368 m_mapScene->addTile(zoomLevel, adjustedTileNumber, image, m_zoomLevel);
372 int MapEngine::normalize(int value, int min, int max)
374 qDebug() << __PRETTY_FUNCTION__;
375 Q_ASSERT_X(max >= min, "parameters", "max can't be smaller than min");
378 value += max - min + 1;
381 value -= max - min + 1;
386 void MapEngine::receiveOwnLocation(User *user)
388 qDebug() << __PRETTY_FUNCTION__;
391 m_ownLocation->setPos(SceneCoordinate(user->coordinates()).toPointF());
392 if (!m_ownLocation->isVisible())
393 m_ownLocation->show();
395 m_ownLocation->hide();
398 m_mapScene->spanItems(currentViewSceneRect());
401 QGraphicsScene* MapEngine::scene()
403 qDebug() << __PRETTY_FUNCTION__;
408 void MapEngine::scrollerStateChanged(QAbstractAnimation::State newState)
410 qDebug() << __PRETTY_FUNCTION__;
412 if (m_smoothScrollRunning
413 && newState != QAbstractAnimation::Running) {
414 m_smoothScrollRunning = false;
416 // don't disable auto centering if current animation was stopped by new update from GPS
417 if (!m_scrollStartedByGps)
418 disableAutoCenteringIfRequired(m_sceneCoordinate);
421 m_scrollStartedByGps = false;
424 void MapEngine::scrollToPosition(SceneCoordinate coordinate)
426 qDebug() << __PRETTY_FUNCTION__;
429 m_scroller->setEasingCurve(QEasingCurve::InOutQuart);
430 m_scroller->setDuration(SMOOTH_CENTERING_TIME_MS);
431 m_scroller->setStartValue(m_sceneCoordinate);
432 m_scroller->setEndValue(coordinate);
433 m_smoothScrollRunning = true;
437 void MapEngine::setAutoCentering(bool enabled)
439 qDebug() << __PRETTY_FUNCTION__;
441 m_autoCenteringEnabled = enabled;
444 void MapEngine::setCenterPosition(SceneCoordinate coordinate)
446 qDebug() << __PRETTY_FUNCTION__;
448 // jump to opposite side of the world if world horizontal limit is exceeded
449 coordinate.setX(normalize(coordinate.x(), OSM_MAP_MIN_PIXEL_X, OSM_MAP_MAX_PIXEL_X));
451 // don't allow vertical scene coordinates go out of the map
452 coordinate.setY(qBound(double(OSM_MAP_MIN_PIXEL_Y),
454 double(OSM_MAP_MAX_PIXEL_Y)));
456 if (!m_smoothScrollRunning)
457 disableAutoCenteringIfRequired(coordinate);
459 m_sceneCoordinate = coordinate;
460 emit locationChanged(m_sceneCoordinate);
462 if (isCenterTileChanged(coordinate)) {
463 getTiles(coordinate);
464 m_mapScene->removeOutOfViewTiles(m_viewTilesGrid, m_zoomLevel);
467 m_mapScene->spanItems(currentViewSceneRect());
468 emit newMapResolution(sceneResolution());
470 updateDirectionIndicator();
473 void MapEngine::setGPSEnabled(bool enabled)
475 qDebug() << __PRETTY_FUNCTION__;
477 m_gpsLocationItem->setEnabled(enabled);
480 void MapEngine::setRoute(Route &route)
482 qDebug() << __PRETTY_FUNCTION__;
486 qDebug() << __PRETTY_FUNCTION__ << "from:" << m_route.startPointName();
487 qDebug() << __PRETTY_FUNCTION__ << "to:" << m_route.endPointName();
488 qDebug() << __PRETTY_FUNCTION__ << "distance:" << m_route.totalDistance();
489 qDebug() << __PRETTY_FUNCTION__ << "estimated time:" << m_route.totalTime();
491 foreach (GeoCoordinate point, m_route.geometryPoints())
492 qDebug() << __PRETTY_FUNCTION__ << "geometry point:" << point;
494 foreach (RouteSegment segment, m_route.segments()) {
495 qDebug() << __PRETTY_FUNCTION__ << "segment:" << segment.instruction();
498 // delete old route track (if exists)
499 if (m_mapRouteItem) {
500 m_mapScene->removeItem(m_mapRouteItem);
501 delete m_mapRouteItem;
504 // create new route track
505 m_mapRouteItem = new MapRouteItem(&m_route);
506 m_mapScene->addItem(m_mapRouteItem);
508 centerAndZoomTo(m_mapRouteItem->boundingRect().toRect());
511 void MapEngine::setZoomLevel(int newZoomLevel)
513 qDebug() << __PRETTY_FUNCTION__;
515 m_zoomLevel = newZoomLevel;
519 void MapEngine::setTilesGridSize(const QSize &viewSize)
521 qDebug() << __PRETTY_FUNCTION__;
523 // there must be scrolling reserve of at least half tile added to tile amount
524 // calculated from view size
525 const qreal SCROLLING_RESERVE = 0.5;
527 // converting scene tile to tile number does cause grid centering inaccuracy of one tile
528 const int CENTER_TILE_INACCURACY = 1;
530 int gridWidth = ceil(qreal(viewSize.width()) / OSM_TILE_SIZE_X + SCROLLING_RESERVE)
531 + CENTER_TILE_INACCURACY + (MAP_GRID_PADDING * 2);
532 int gridHeight = ceil(qreal(viewSize.height()) / OSM_TILE_SIZE_Y + SCROLLING_RESERVE)
533 + CENTER_TILE_INACCURACY + (MAP_GRID_PADDING * 2);
535 m_mapFetcher->setDownloadQueueSize(gridWidth * gridHeight);
537 m_tilesGridSize.setHeight(gridHeight);
538 m_tilesGridSize.setWidth(gridWidth);
541 int MapEngine::tileMaxIndex(int zoomLevel)
543 qDebug() << __PRETTY_FUNCTION__;
545 // subtract one because first tile index is zero
546 return tilesPerSide(zoomLevel) - 1;
549 QString MapEngine::tilePath(int zoomLevel, int x, int y)
551 qDebug() << __PRETTY_FUNCTION__;
553 QString tilePathString(QString::number(zoomLevel) + "/");
554 tilePathString.append(QString::number(x) + "/");
555 tilePathString.append(QString::number(y));
557 return tilePathString;
560 int MapEngine::tilesPerSide(int zoomLevel)
562 return (1 << zoomLevel);
565 void MapEngine::updateDirectionIndicator()
567 qDebug() << __PRETTY_FUNCTION__;
569 /// @todo implement distance calculation
570 qreal distance = greatCircleDistance(m_gpsPosition, m_sceneCoordinate);
572 qreal direction = m_sceneCoordinate.azimuthTo(SceneCoordinate(m_gpsPosition));
574 // direction indicator triangle should be drawn only if the gps location item is not currently
575 // visible on the view
576 bool drawDirectionIndicatorTriangle = true;
577 if (currentViewSceneRect().contains(m_gpsLocationItem->pos()))
578 drawDirectionIndicatorTriangle = false;
580 emit directionIndicatorValuesUpdate(direction, distance, drawDirectionIndicatorTriangle);
583 void MapEngine::updateViewTilesSceneRect()
585 qDebug() << __PRETTY_FUNCTION__;
587 const QPoint ONE_TILE = QPoint(1, 1);
588 const double ONE_PIXEL = 1;
590 SceneCoordinate topLeft = convertTileNumberToSceneCoordinate(m_zoomLevel,
591 m_viewTilesGrid.topLeft());
593 // one tile - one pixel is added because returned coordinates are pointing to upper left corner
595 SceneCoordinate bottomRight = convertTileNumberToSceneCoordinate(m_zoomLevel,
596 m_viewTilesGrid.bottomRight()
598 bottomRight.setX(bottomRight.x() - ONE_PIXEL);
599 bottomRight.setY(bottomRight.y() - ONE_PIXEL);
601 m_mapScene->tilesSceneRectUpdated(QRect(topLeft.toPointF().toPoint(),
602 bottomRight.toPointF().toPoint()));
605 void MapEngine::viewResized(const QSize &size)
607 qDebug() << __PRETTY_FUNCTION__;
610 setTilesGridSize(m_viewSize);
612 emit locationChanged(m_sceneCoordinate);
613 getTiles(m_sceneCoordinate);
614 m_mapScene->removeOutOfViewTiles(m_viewTilesGrid, m_zoomLevel);
615 m_mapScene->setSceneVerticalOverlap(m_viewSize.height(), m_zoomLevel);
618 void MapEngine::viewZoomFinished()
620 qDebug() << __PRETTY_FUNCTION__;
622 updateDirectionIndicator();
626 m_mapScene->removeOutOfViewTiles(m_viewTilesGrid, m_zoomLevel);
629 if (m_zoomLevel == OSM_MAX_ZOOM_LEVEL)
630 emit maxZoomLevelReached();
631 else if (m_zoomLevel == MAP_VIEW_MIN_ZOOM_LEVEL)
632 emit minZoomLevelReached();
635 void MapEngine::zoomed()
637 emit zoomLevelChanged(m_zoomLevel);
638 m_mapScene->setTilesDrawingLevels(m_zoomLevel);
639 m_mapScene->setZoomLevel(m_zoomLevel);
640 getTiles(m_sceneCoordinate);
641 m_mapScene->setSceneVerticalOverlap(m_viewSize.height(), m_zoomLevel);
642 m_mapScene->spanItems(currentViewSceneRect());
643 emit newMapResolution(sceneResolution());
646 void MapEngine::zoomIn()
648 qDebug() << __PRETTY_FUNCTION__;
650 if (m_zoomLevel < OSM_MAX_ZOOM_LEVEL) {
657 void MapEngine::zoomOut()
659 qDebug() << __PRETTY_FUNCTION__;
661 if (m_zoomLevel > MAP_VIEW_MIN_ZOOM_LEVEL) {