#include "geomap.h"
-#include <QDebug>
#include <QGeoMapPixmapObject>
#include <QGeoMapPolylineObject>
#include "../user/friendmodel.h"
#include "../coordinates/geocoordinate.h"
#include "../routing/routemodel.h"
-#include <QGraphicsSceneMouseEvent>
#include "../ui/avatarimage.h"
+#include "../logger.h"
using namespace QtMobility;
*/
void filterCoordinatePoints(QList<QGeoCoordinate>* geometryPoints)
{
+ DEBUG_FUNCTION_TIME;
+
// Rough guess for maximum point count for smooth use
// Produces max 500+n items to result array (rounding error in division)...
static const int MAX_POINT_COUNT = 500;
prevGpsLocation(0,0),
initialized(false)
{
- qDebug() << __PRETTY_FUNCTION__;
+ DEBUG_FUNCTION_TIME;
connect(this, SIGNAL(panned(QPoint)), this, SLOT(panned()));
setCenter(prevGpsLocation);
GeoMap::~GeoMap()
{
- qDebug() << __PRETTY_FUNCTION__;
+ DEBUG_FUNCTION_TIME;
}
qreal GeoMap::angleToGpsLocation() const
{
+ DEBUG_FUNCTION_TIME;
const qreal result = prevGpsLocation.isValid() ? center().azimuthTo(prevGpsLocation) : 0.0;
qDebug() << "QmlMap::angleToGpsLocation: " << result;
return result;
qreal GeoMap::distanceToGpsLocation() const
{
+ DEBUG_FUNCTION_TIME;
const qreal result = prevGpsLocation.isValid() ? center().distanceTo(prevGpsLocation) : 0.0;
qDebug() << "QmlMap::distanceToGpsLocation: " << result << " meters";
return result;
QString GeoMap::distanceToGpsLocationText() const
{
+ DEBUG_FUNCTION_TIME;
const qreal distance = distanceToGpsLocation();
// copy/paste from: IndicatorButtonPanel::updateValues
const int MAX_TO_METERS = 999.5;
return distanceText;
}
-double GeoMap::centerLatitude() const {
+double GeoMap::centerLatitude() const
+{
return center().latitude();
}
-void GeoMap::setCenterLatitude(const double latitude) {
+void GeoMap::setCenterLatitude(const double latitude)
+{
+ DEBUG_FUNCTION_TIME;
QGeoCoordinate newCenter = center();
newCenter.setLatitude(latitude);
setCenter(newCenter);
return center().longitude();
}
-void GeoMap::setCenterLongitude(const double longitude) {
+void GeoMap::setCenterLongitude(const double longitude)
+{
+ DEBUG_FUNCTION_TIME;
QGeoCoordinate newCenter = center();
newCenter.setLongitude(longitude);
setCenter(newCenter);
void GeoMap::setFriendModels(FriendModel* friendModel, FilteredFriendModel* friendFilterModel)
{
+ DEBUG_FUNCTION_TIME;
Q_D(GeoMap);
Q_ASSERT(friendModel && friendFilterModel);
if (friendModel && friendFilterModel) {
void GeoMap::setRouteModel(RouteModel* routeModel)
{
+ DEBUG_FUNCTION_TIME;
Q_D(GeoMap);
Q_ASSERT(routeModel);
d->routeModel = routeModel;
void GeoMap::panned()
{
+ DEBUG_FUNCTION_TIME;
emit positionChanged();
}
void GeoMap::onFriendModelReset()
{
+ DEBUG_FUNCTION_TIME;
Q_D(GeoMap);
Q_ASSERT(d->friendModel);
-
foreach(QGeoMapPixmapObject* mapObject, d->friendMapObjects) {
removeMapObject(mapObject);
delete mapObject;
void GeoMap::onRouteModelReset()
{
- qDebug() << __PRETTY_FUNCTION__;
+ DEBUG_FUNCTION_TIME;
Q_D(GeoMap);
Q_ASSERT(d->routeModel);
removeMapObject(d->routeMapObject);
}
if (!path.isEmpty()) {
- qDebug() << "PATH BEFORE: " << path.count();
d->filterCoordinatePoints(&path);
- qDebug() << "PATH AFTER: " << path.count();
-
d->routeMapObject->setPath(path);
QPen pen(Qt::red);
pen.setWidth(5);
void GeoMap::goToGpsLocation()
{
+ DEBUG_FUNCTION_TIME;
qDebug() << "QmlMap::goToGpsLocation";
if (!source)
source = QGeoPositionInfoSource::createDefaultSource(this);
void GeoMap::onClicked(qreal mouseX, qreal mouseY)
{
+ DEBUG_FUNCTION_TIME;
Q_D(GeoMap);
QList<QGeoMapObject*> mapObjects = mapObjectsAtScreenPosition(QPointF(mouseX, mouseY));
QList<User*> filter;
void GeoMap::zoomIn()
{
+ DEBUG_FUNCTION_TIME;
setZoomLevel(zoomLevel() + 1.0);
}
void GeoMap::zoomOut()
{
+ DEBUG_FUNCTION_TIME;
if (zoomLevel() > 2.0)
setZoomLevel(zoomLevel() - 1.0);
}
void GeoMap::positionUpdated(const QGeoPositionInfo& positionInfo)
{
+ DEBUG_FUNCTION_TIME;
qDebug() << "QmlMap::positionUpdated: " << positionInfo.coordinate();
prevGpsLocation = positionInfo.coordinate();
Q_D(GeoMap);